summaryrefslogtreecommitdiffstats
path: root/ucs2-lib/doc/html/_p__u_m__s_y_n_c__a_n_d__a_s_y_n_c__r_e_s_u_l_t_s.html
blob: eadd0926e6ffad10b3109059e12729d86dba8709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>UNICENS: Synchronous vs. Asynchronous Results</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="style_html.css" rel="stylesheet" type="text/css" />
<link href="inic.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="GlobalWrapper">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr>
  <td><a href="index.html"><img alt="Logo" src="logo.png"/></a></td>
  <td>
   <div id="projectname">UNICENS&#160;<span id="projectnumber">V2.1.0-3491</span></div>
   <div id="projectbrief">User Manual and API Reference</div>
    <div id="searchbox">        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_p__u_m__s_y_n_c__a_n_d__a_s_y_n_c__r_e_s_u_l_t_s.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Synchronous vs. Asynchronous Results </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>The UNICENS library distinguishes between <em>synchronous</em> and <em>asynchronous</em> returned results.</p>
<h1>Synchronous Results</h1>
<p>If a UNICENS API function detects an error the error is returned synchronously. For this purpose enumeration <a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_ga886138f5d13e84ffaa3df5769830e1cd.html#ga886138f5d13e84ffaa3df5769830e1cd">Ucs_Return_t</a> is used. If no error has occurred <a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_ga886138f5d13e84ffaa3df5769830e1cd.html#gga886138f5d13e84ffaa3df5769830e1cda3fb51656e17ee4802f23706f35e349bc">UCS_RET_SUCCESS</a> is returned.</p>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line"><a class="code" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_ga886138f5d13e84ffaa3df5769830e1cd.html#ga886138f5d13e84ffaa3df5769830e1cd" title="Standard return codes used for synchronous response.">Ucs_Return_t</a> ret = <a class="code" href="group___g___u_c_s___n_e_t_ga83c2e74a4cc216aa10d7c6a1a517d459.html#ga83c2e74a4cc216aa10d7c6a1a517d459" title="Starts up the MOST Network.">Ucs_Network_Startup</a>(ucs_inst_ptr, 52U, 0xFFFFU, my_result_fptr);</div>
</div><!-- fragment --><h1>Asynchronous Results</h1>
<p>The communication between the EHC and the INIC is an asynchronous process. If the EHC calls an INIC function the returned result is received asynchronously. Thus, most of the UNICENS API functions provide callback function pointers to receive INIC results/errors.</p>
<h2>INIC Errors</h2>
<p>If the INIC returns an error, this information is mapped to a UNICENS standard result structure <a class="el" href="struct_ucs___std_result__t.html">Ucs_StdResult_t</a>.</p>
<div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct</span></div>
<div class="line">{</div>
<div class="line">    <a class="code" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_gac844b77cf41aef663782bc0b43d3540c.html#gac844b77cf41aef663782bc0b43d3540c" title="Result codes used for asynchronous response.">Ucs_Result_t</a> code;  <span class="comment">/* Result/Error code */</span></div>
<div class="line">    uint8_t *info_ptr;  <span class="comment">/* INIC error data */</span></div>
<div class="line">    uint8_t size;       <span class="comment">/* Size of the INIC error data in bytes */</span></div>
<div class="line"></div>
<div class="line">} <a class="code" href="struct_ucs___std_result__t.html" title="Standard result structure which provides fields for detailed status and error information.">Ucs_StdResult_t</a>;</div>
</div><!-- fragment --><p>The result codes are based on the INIC error codes and UNICENS specific result codes. The mapping of the INIC and the UNICENS codes are shown in the table below.</p>
<table class="doxtable">
<tr>
<th>UNICENS Result Code </th><th style="text-align:center;">INIC Error Code </th><th>Description  </th></tr>
<tr>
<td><a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_gac844b77cf41aef663782bc0b43d3540c.html#ggac844b77cf41aef663782bc0b43d3540cae19d5a51de78bbf903a108a4e36a0fdf">UCS_RES_SUCCESS</a> </td><td style="text-align:center;">- </td><td>Operation succeed, no error occurred  </td></tr>
<tr>
<td rowspan="7"><a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_gac844b77cf41aef663782bc0b43d3540c.html#ggac844b77cf41aef663782bc0b43d3540ca4f4226f6e507caf5a9e044759c6409cf">UCS_RES_ERR_MOST_STANDARD</a> </td><td style="text-align:center;">0x01 </td><td>FBlock ID not available  </td></tr>
<tr>
<td style="text-align:center;">0x02 </td><td>Instance ID not available  </td></tr>
<tr>
<td style="text-align:center;">0x03 </td><td>Function ID not available  </td></tr>
<tr>
<td style="text-align:center;">0x04 </td><td>OP-Type not available  </td></tr>
<tr>
<td style="text-align:center;">0x05 </td><td>Invalid length  </td></tr>
<tr>
<td style="text-align:center;">0x06 </td><td>Parameter wrong/out of range  </td></tr>
<tr>
<td style="text-align:center;">0x0C </td><td>Segmentation error  </td></tr>
<tr>
<td><a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_gac844b77cf41aef663782bc0b43d3540c.html#ggac844b77cf41aef663782bc0b43d3540ca8ff50e770356e4fca8d36a308e323d83">UCS_RES_ERR_BUSY</a> </td><td rowspan="4" style="text-align:center;">0x20 </td><td>INIC function specific error with error class "Busy (0x01)".<br/>
 Process in INIC is currently busy. Retries are possible in a reasonable time.   </td></tr>
<tr>
<td><a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_gac844b77cf41aef663782bc0b43d3540c.html#ggac844b77cf41aef663782bc0b43d3540caa7f09aea37cedd8dfbe3665781aae6aa">UCS_RES_ERR_PROCESSING</a> </td><td>INIC function specific error with error class "Processing (0x02)".<br/>
 Process could not be finished. Retries are possible.   </td></tr>
<tr>
<td><a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_gac844b77cf41aef663782bc0b43d3540c.html#ggac844b77cf41aef663782bc0b43d3540caa142d5f1f196cbf759f2cbd6d8a7468a">UCS_RES_ERR_CONFIGURATION</a> </td><td>INIC function specific error with error class "Configuration (0x03)".<br/>
 Wrong configuration (values are temporarily out of range). Retries are not useful.   </td></tr>
<tr>
<td><a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_gac844b77cf41aef663782bc0b43d3540c.html#ggac844b77cf41aef663782bc0b43d3540cae64970c5c3ad3d0dc6996b77cd528dbb">UCS_RES_ERR_SYSTEM</a> </td><td>INIC function specific error with error class "System (0x04)".<br/>
 Current state of INIC or network prevents a successful execution of the process and retries are not possible. Retries are only possible when the state changes, but it is not clear when or if this happens (dynamic error).   </td></tr>
<tr>
<td><a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_gac844b77cf41aef663782bc0b43d3540c.html#ggac844b77cf41aef663782bc0b43d3540ca3099d31f6d533972cf96c86dca0b0cc7">UCS_RES_ERR_TIMEOUT</a> </td><td style="text-align:center;">- </td><td>Timeout during operation  </td></tr>
<tr>
<td><a class="el" href="group___g___u_c_s___i_n_i_t___a_n_d___s_r_v___t_y_p_e_s_gac844b77cf41aef663782bc0b43d3540c.html#ggac844b77cf41aef663782bc0b43d3540ca4e2229e49fe1197dd9df919719fcd38a">UCS_RES_ERR_TRANSMISSION</a> </td><td style="text-align:center;">- </td><td>Transmission error occurred on the MOST network  </td></tr>
</table>
<h3>Detailed Error Information</h3>
<p>If one of the errors above occurs, the raw INIC error data is stored in a byte stream referenced by pointer <code>info_ptr</code>. Parameter <code>size</code> represents the size of the INIC error data in bytes.</p>
<p><b>Example:</b><br/>
 The INIC returns the following error:</p>
<ul>
<li>Error Code: 0x20</li>
<li>Error Class: 0x03</li>
<li>Error ID: 0x32</li>
<li>Addition Parameter: 0x4711</li>
</ul>
<p>The information is stored in variable <code>my_result</code> which is from type <a class="el" href="struct_ucs___std_result__t.html" title="Standard result structure which provides fields for detailed status and error information.">Ucs_StdResult_t</a>:</p>
<ul>
<li><code>my_result.code: UCS_RES_ERR_CONFIGURATION</code></li>
<li><code>my_result.info_ptr[0]: 0x20</code></li>
<li><code>my_result.info_ptr[1]: 0x03</code></li>
<li><code>my_result.info_ptr[2]: 0x32</code></li>
<li><code>my_result.info_ptr[3]: 0x47</code></li>
<li><code>my_result.info_ptr[4]: 0x11</code></li>
<li><code>my_result.size: 5</code> </li>
</ul>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">&copy; 2017 Microchip Technology Inc. All rights reserved. <a href="http://www.microchip.com" target="_blank">www.microchip.com</a></li>
  </ul>
</div>
</body>
<!--
Generated on Mon Apr 3 2017 13:52:59 for UNICENS by
Doxygen 1.8.2
-->
<script language="javascript">
<!--
$('#MSearchResults').wrap('<div style="position: absolute; margin-left: 444px;"></div>');
-->
</script>
</html>