]> begriffs open source - cmsis/blob - main/Driver/html/group__vio__interface__gr.html
Update documentation for branch main
[cmsis] / main / Driver / html / group__vio__interface__gr.html
1 <!-- HTML header for doxygen 1.9.6-->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
4 <head>
5 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6 <meta http-equiv="X-UA-Compatible" content="IE=11"/>
7 <meta name="viewport" content="width=device-width, initial-scale=1"/>
8 <title>CMSIS-Driver: VIO</title>
9 <link href="doxygen.css" rel="stylesheet" type="text/css"/>
10 <link href="tabs.css" rel="stylesheet" type="text/css"/>
11 <link href="extra_navtree.css" rel="stylesheet" type="text/css"/>
12 <link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
13 <link href="extra_search.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="jquery.js"></script>
15 <script type="text/javascript" src="dynsections.js"></script>
16 <script type="text/javascript" src="printComponentTabs.js"></script>
17 <script type="text/javascript" src="footer.js"></script>
18 <script type="text/javascript" src="navtree.js"></script>
19 <link href="navtree.css" rel="stylesheet" type="text/css"/>
20 <script type="text/javascript" src="resize.js"></script>
21 <script type="text/javascript" src="navtreedata.js"></script>
22 <script type="text/javascript" src="navtree.js"></script>
23 <link href="search/search.css" rel="stylesheet" type="text/css"/>
24 <script type="text/javascript" src="search/searchdata.js"></script>
25 <script type="text/javascript" src="search/search.js"></script>
26 <script type="text/javascript">
27 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
28   $(document).ready(function() { init_search(); });
29 /* @license-end */
30 </script>
31 <script type="text/javascript" src="darkmode_toggle.js"></script>
32 <link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
33 <link href="extra_navtree.css" rel="stylesheet" type="text/css"/>
34 <link href="extra_search.css" rel="stylesheet" type="text/css"/>
35 <link href="version.css" rel="stylesheet" type="text/css" />
36 <script type="text/javascript" src="../../version.js"></script>
37 </head>
38 <body>
39 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
40 <div id="titlearea">
41 <table cellspacing="0" cellpadding="0">
42  <tbody>
43  <tr style="height: 55px;">
44   <td id="projectlogo" style="padding: 1.5em;"><img alt="Logo" src="cmsis_logo_white_small.png"/></td>
45   <td style="padding-left: 1em; padding-bottom: 1em;padding-top: 1em;">
46    <div id="projectname">CMSIS-Driver
47    &#160;<span id="projectnumber"><script type="text/javascript">
48      <!--
49      writeHeader.call(this);
50      writeVersionDropdown.call(this, "CMSIS-Driver");
51      //-->
52     </script>
53    </span>
54    </div>
55    <div id="projectbrief">Peripheral Interface for Middleware and Application Code</div>
56   </td>
57    <td>        <div id="MSearchBox" class="MSearchBoxInactive">
58         <span class="left">
59           <span id="MSearchSelect"                onmouseover="return searchBox.OnSearchSelectShow()"                onmouseout="return searchBox.OnSearchSelectHide()">&#160;</span>
60           <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
61                onfocus="searchBox.OnSearchFieldFocus(true)" 
62                onblur="searchBox.OnSearchFieldFocus(false)" 
63                onkeyup="searchBox.OnSearchFieldChange(event)"/>
64           </span><span class="right">
65             <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
66           </span>
67         </div>
68 </td>
69   <!--END !PROJECT_NAME-->
70  </tr>
71  </tbody>
72 </table>
73 </div>
74 <!-- end header part -->
75 <div id="CMSISnav" class="tabs1">
76   <ul class="tablist">
77     <script type="text/javascript">
78       writeComponentTabs.call(this);
79     </script>
80   </ul>
81 </div>
82 <!-- Generated by Doxygen 1.9.6 -->
83 <script type="text/javascript">
84 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
85 var searchBox = new SearchBox("searchBox", "search/",'.html');
86 /* @license-end */
87 </script>
88 </div><!-- top -->
89 <div id="side-nav" class="ui-resizable side-nav-resizable">
90   <div id="nav-tree">
91     <div id="nav-tree-contents">
92       <div id="nav-sync" class="sync"></div>
93     </div>
94   </div>
95   <div id="splitbar" style="-moz-user-select:none;" 
96        class="ui-resizable-handle">
97   </div>
98 </div>
99 <script type="text/javascript">
100 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
101 $(document).ready(function(){initNavTree('group__vio__interface__gr.html',''); initResizable(); });
102 /* @license-end */
103 </script>
104 <div id="doc-content">
105 <!-- window showing the filter options -->
106 <div id="MSearchSelectWindow"
107      onmouseover="return searchBox.OnSearchSelectShow()"
108      onmouseout="return searchBox.OnSearchSelectHide()"
109      onkeydown="return searchBox.OnSearchSelectKey(event)">
110 </div>
111
112 <!-- iframe showing the search results (closed by default) -->
113 <div id="MSearchResultsWindow">
114 <div id="MSearchResults">
115 <div class="SRPage">
116 <div id="SRIndex">
117 <div id="SRResults"></div>
118 <div class="SRStatus" id="Loading">Loading...</div>
119 <div class="SRStatus" id="Searching">Searching...</div>
120 <div class="SRStatus" id="NoMatches">No Matches</div>
121 </div>
122 </div>
123 </div>
124 </div>
125
126 <div class="header">
127   <div class="summary">
128 <a href="#groups">Content</a>  </div>
129   <div class="headertitle"><div class="title">VIO</div></div>
130 </div><!--header-->
131 <div class="contents">
132
133 <p>API for Virtual I/O (VIO) (cmsis_vio.h)  
134 <a href="#details">More...</a></p>
135 <table class="memberdecls">
136 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="groups" name="groups"></a>
137 Content</h2></td></tr>
138 <tr class="memitem:group__vioDefines__gr"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__vioDefines__gr.html">Defines and Structs</a></td></tr>
139 <tr class="memdesc:group__vioDefines__gr"><td class="mdescLeft">&#160;</td><td class="mdescRight">Documents the defines and structs of the VIO API. <br /></td></tr>
140 <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
141 </table>
142 <a name="details" id="details"></a><h2 class="groupheader">Description</h2>
143 <p>API for Virtual I/O (VIO) (cmsis_vio.h) </p>
144 <p>The VIO software component is a virtual I/O abstraction for peripherals that are typically used in example projects. It enables developers to move from an evaluation kit to custom hardware and helps to scale project examples at large to many development boards:</p>
145 <div class="image">
146 <img src="vioRationale.png" alt=""/>
147 <div class="caption">
148 Virtual I/O provides a generic API for examples and testing</div></div>
149 <p><b>VIO API</b></p>
150 <p>The following header file defines the Application Programming Interface (API) for VIO:</p><ul>
151 <li><b>cmsis_vio.h</b> : API for VIO</li>
152 </ul>
153 <p><b>VIO User Code Templates</b></p>
154 <p>The VIO software component contains two user code templates with different purposes:</p><ul>
155 <li>VIO:Custom: This file is an empty stub with all functions that are defined in the header file that can be used to implement the VIO layer for the hardware that is used in the application.</li>
156 <li>VIO:Virtual: This file uses a fixed memory location to emulate the VIO functionality and can be used off-the-shelf.</li>
157 </ul>
158 <p><b>VIO Memory Location Structure</b></p>
159 <p>For testing purposes, it is required to have fixed memory locations that are used to read/store values. In the VIO:Virtual template file (<b>vio.c</b>), an exemplary implementation is shown:</p>
160 <div class="fragment"><div class="line"><span class="comment">// Input, output variables</span></div>
161 <div class="line">__USED uint32_t      vioSignalIn;                                       <span class="comment">// Memory for incoming signal</span></div>
162 <div class="line">__USED uint32_t      vioSignalOut;                                      <span class="comment">// Memory for outgoing signal</span></div>
163 <div class="line">__USED <span class="keywordtype">char</span>          vioPrintMem[VIO_PRINTMEM_NUM][VIO_PRINT_MAX_SIZE]; <span class="comment">// Memory for the last value for each level</span></div>
164 <div class="line">__USED int32_t       vioValue   [VIO_VALUE_NUM];                        <span class="comment">// Memory for value used in vioGetValue/vioSetValue</span></div>
165 <div class="line">__USED <a class="code hl_struct" href="group__vioValues__gr.html#structvioValueXYZ__t">vioValueXYZ_t</a> vioValueXYZ[VIO_VALUEXYZ_NUM];                     <span class="comment">// Memory for XYZ value for 3-D vector</span></div>
166 <div class="line">__USED <a class="code hl_struct" href="group__vioIPAddr__gr.html#structvioAddrIPv4__t">vioAddrIPv4_t</a> vioAddrIPv4[VIO_IPV4_ADDRESS_NUM];                 <span class="comment">// Memory for IPv4 address value used in vioSetIPv4/vioGetIPv4</span></div>
167 <div class="line">__USED <a class="code hl_struct" href="group__vioIPAddr__gr.html#structvioAddrIPv6__t">vioAddrIPv6_t</a> vioAddrIPv6[VIO_IPV6_ADDRESS_NUM];                 <span class="comment">// Memory for IPv6 address value used in vioSetIPv6/vioGetIPv6</span></div>
168 <div class="ttc" id="agroup__vioIPAddr__gr_html_structvioAddrIPv4__t"><div class="ttname"><a href="group__vioIPAddr__gr.html#structvioAddrIPv4__t">vioAddrIPv4_t</a></div><div class="ttdoc">IPv4 Internet Address.</div><div class="ttdef"><b>Definition:</b> cmsis_vio.h:91</div></div>
169 <div class="ttc" id="agroup__vioIPAddr__gr_html_structvioAddrIPv6__t"><div class="ttname"><a href="group__vioIPAddr__gr.html#structvioAddrIPv6__t">vioAddrIPv6_t</a></div><div class="ttdoc">IPv6 Internet Address.</div><div class="ttdef"><b>Definition:</b> cmsis_vio.h:96</div></div>
170 <div class="ttc" id="agroup__vioValues__gr_html_structvioValueXYZ__t"><div class="ttname"><a href="group__vioValues__gr.html#structvioValueXYZ__t">vioValueXYZ_t</a></div><div class="ttdoc">3-D vector value</div><div class="ttdef"><b>Definition:</b> cmsis_vio.h:84</div></div>
171 </div><!-- fragment --><p>Use these memory locations to monitor or set the variables as required in the application.</p>
172 <p>Two defines are available that help to disconnect the actual peripherals and enable virtual I/Os: <code>CMSIS_VIN</code> and <code>CMSIS_VOUT</code>. They help to write code that can be used in testing environments without real hardware access. The following implementation example shows such code:</p>
173 <p><b>Code Example (VIO Implementation)</b> </p><div class="fragment"><div class="line"><span class="comment">// Initialize test input, output.</span></div>
174 <div class="line"><span class="keywordtype">void</span> <a class="code hl_function" href="group__vioDefines__gr.html#ga84e05ae351226f41d461dbe982b2372f">vioInit</a> (<span class="keywordtype">void</span>) {</div>
175 <div class="line">  uint32_t i;</div>
176 <div class="line"><span class="preprocessor">#if !defined CMSIS_VIN</span></div>
177 <div class="line"><span class="comment">// Add user variables here:</span></div>
178 <div class="line"> </div>
179 <div class="line"><span class="preprocessor">#endif</span></div>
180 <div class="line"><span class="preprocessor">#if !defined CMSIS_VOUT</span></div>
181 <div class="line"><span class="comment">// Add user variables here:</span></div>
182 <div class="line"> </div>
183 <div class="line"><span class="preprocessor">#endif</span></div>
184 <div class="line"> </div>
185 <div class="line">  vioSignalIn  = 0U;</div>
186 <div class="line">  vioSignalOut = 0U;</div>
187 <div class="line"> </div>
188 <div class="line">  memset (vioPrintMem, 0, <span class="keyword">sizeof</span>(vioPrintMem));</div>
189 <div class="line">  memset (vioValue,    0, <span class="keyword">sizeof</span>(vioValue));</div>
190 <div class="line">  memset (vioValueXYZ, 0, <span class="keyword">sizeof</span>(vioValueXYZ));</div>
191 <div class="line">  memset (vioAddrIPv4, 0, <span class="keyword">sizeof</span>(vioAddrIPv4));</div>
192 <div class="line">  memset (vioAddrIPv6, 0, <span class="keyword">sizeof</span>(vioAddrIPv6));</div>
193 <div class="line"> </div>
194 <div class="line"><span class="preprocessor">#if !defined CMSIS_VOUT</span></div>
195 <div class="line"><span class="comment">// Add user code here:</span></div>
196 <div class="line"><span class="comment">// &lt;code vioInit output&gt;</span></div>
197 <div class="line"> </div>
198 <div class="line">  BSP_LED_Init(LED_BLUE);</div>
199 <div class="line">  BSP_LED_Init(LED_RED);</div>
200 <div class="line">  BSP_LED_Init(LED_GREEN);</div>
201 <div class="line"><span class="comment">// &lt;/code&gt;</span></div>
202 <div class="line"><span class="preprocessor">#endif</span></div>
203 <div class="line"> </div>
204 <div class="line"><span class="preprocessor">#if !defined CMSIS_VIN</span></div>
205 <div class="line"><span class="comment">// Add user code here:</span></div>
206 <div class="line"><span class="comment">// &lt;code vioInit input&gt;</span></div>
207 <div class="line"> </div>
208 <div class="line">  BSP_PB_Init(BUTTON_USER, BUTTON_MODE_GPIO);</div>
209 <div class="line"><span class="comment">// &lt;/code&gt;</span></div>
210 <div class="line"><span class="preprocessor">#endif</span></div>
211 <div class="line"> </div>
212 <div class="line">  <span class="keywordflow">return</span>;</div>
213 <div class="line">}</div>
214 <div class="ttc" id="agroup__vioDefines__gr_html_ga84e05ae351226f41d461dbe982b2372f"><div class="ttname"><a href="group__vioDefines__gr.html#ga84e05ae351226f41d461dbe982b2372f">vioInit</a></div><div class="ttdeci">void vioInit(void)</div><div class="ttdoc">Initialize test input, output.</div><div class="ttdef"><b>Definition:</b> VIO.txt:221</div></div>
215 </div><!-- fragment --><p><b>Memory display in IDEs</b></p>
216 <p>Arm Keil MDK uses the provided SCVD file to display the VIO signals in Component Viewer:</p>
217 <div class="image">
218 <img src="vioComponentViewer.png" alt=""/>
219 </div>
220  </div><!-- contents -->
221 </div><!-- doc-content -->
222 <!-- start footer part -->
223 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
224   <ul>
225     <li class="footer">
226       <script type="text/javascript">
227         <!--
228         writeFooter.call(this);
229         //-->
230       </script> 
231     </li>
232   </ul>
233 </div>
234 </body>
235 </html>