]> begriffs open source - cmsis/blob - CMSIS/Documentation/Core/html/group__peripheral__gr.html
adding documentation for section 'Core'
[cmsis] / CMSIS / Documentation / Core / html / group__peripheral__gr.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <title>Peripheral Access</title>
7 <title>CMSIS-CORE: Peripheral Access</title>
8 <link href="tabs.css" rel="stylesheet" type="text/css"/>
9 <link href="cmsis.css" rel="stylesheet" type="text/css" />
10 <script type="text/javascript" src="jquery.js"></script>
11 <script type="text/javascript" src="dynsections.js"></script>
12 <script type="text/javascript" src="printComponentTabs.js"></script>
13 <link href="navtree.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="resize.js"></script>
15 <script type="text/javascript" src="navtree.js"></script>
16 <script type="text/javascript">
17   $(document).ready(initResizable);
18   $(window).load(resizeHeight);
19 </script>
20 <link href="search/search.css" rel="stylesheet" type="text/css"/>
21 <script type="text/javascript" src="search/search.js"></script>
22 <script type="text/javascript">
23   $(document).ready(function() { searchBox.OnSelectItem(0); });
24 </script>
25 </head>
26 <body>
27 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
28 <div id="titlearea">
29 <table cellspacing="0" cellpadding="0">
30  <tbody>
31  <tr style="height: 46px;">
32   <td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
33   <td style="padding-left: 0.5em;">
34    <div id="projectname">CMSIS-CORE
35    &#160;<span id="projectnumber">Version 5.0.0 - Beta</span>
36    </div>
37    <div id="projectbrief">CMSIS-CORE support for Cortex-M processor-based devices</div>
38   </td>
39  </tr>
40  </tbody>
41 </table>
42 </div>
43 <!-- end header part -->
44 <div id="CMSISnav" class="tabs1">
45     <ul class="tablist">
46       <script type="text/javascript">
47                 <!--
48                 writeComponentTabs.call(this);
49                 //-->
50       </script>
51           </ul>
52 </div>
53 <!-- Generated by Doxygen 1.8.6 -->
54 <script type="text/javascript">
55 var searchBox = new SearchBox("searchBox", "search",false,'Search');
56 </script>
57   <div id="navrow1" class="tabs">
58     <ul class="tablist">
59       <li><a href="index.html"><span>Main&#160;Page</span></a></li>
60       <li><a href="pages.html"><span>Usage&#160;and&#160;Description</span></a></li>
61       <li><a href="modules.html"><span>Reference</span></a></li>
62       <li>
63         <div id="MSearchBox" class="MSearchBoxInactive">
64         <span class="left">
65           <img id="MSearchSelect" src="search/mag_sel.png"
66                onmouseover="return searchBox.OnSearchSelectShow()"
67                onmouseout="return searchBox.OnSearchSelectHide()"
68                alt=""/>
69           <input type="text" id="MSearchField" value="Search" accesskey="S"
70                onfocus="searchBox.OnSearchFieldFocus(true)" 
71                onblur="searchBox.OnSearchFieldFocus(false)" 
72                onkeyup="searchBox.OnSearchFieldChange(event)"/>
73           </span><span class="right">
74             <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
75           </span>
76         </div>
77       </li>
78     </ul>
79   </div>
80 </div><!-- top -->
81 <div id="side-nav" class="ui-resizable side-nav-resizable">
82   <div id="nav-tree">
83     <div id="nav-tree-contents">
84       <div id="nav-sync" class="sync"></div>
85     </div>
86   </div>
87   <div id="splitbar" style="-moz-user-select:none;" 
88        class="ui-resizable-handle">
89   </div>
90 </div>
91 <script type="text/javascript">
92 $(document).ready(function(){initNavTree('group__peripheral__gr.html','');});
93 </script>
94 <div id="doc-content">
95 <!-- window showing the filter options -->
96 <div id="MSearchSelectWindow"
97      onmouseover="return searchBox.OnSearchSelectShow()"
98      onmouseout="return searchBox.OnSearchSelectHide()"
99      onkeydown="return searchBox.OnSearchSelectKey(event)">
100 <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>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</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>
101
102 <!-- iframe showing the search results (closed by default) -->
103 <div id="MSearchResultsWindow">
104 <iframe src="javascript:void(0)" frameborder="0" 
105         name="MSearchResults" id="MSearchResults">
106 </iframe>
107 </div>
108
109 <div class="header">
110   <div class="summary">
111 <a href="#define-members">Macros</a>  </div>
112   <div class="headertitle">
113 <div class="title">Peripheral Access</div>  </div>
114 </div><!--header-->
115 <div class="contents">
116
117 <p>Describes naming conventions, requirements, and optional features for accessing peripherals.  
118 <a href="#details">More...</a></p>
119 <table class="memberdecls">
120 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
121 Macros</h2></td></tr>
122 <tr class="memitem:ga286e3b913dbd236c7f48ea70c8821f4e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__peripheral__gr.html#ga286e3b913dbd236c7f48ea70c8821f4e">_VAL2FLD</a>(field, value)</td></tr>
123 <tr class="memdesc:ga286e3b913dbd236c7f48ea70c8821f4e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Mask and shift a bit field value for assigning the result to a peripheral register.  <a href="#ga286e3b913dbd236c7f48ea70c8821f4e">More...</a><br/></td></tr>
124 <tr class="separator:ga286e3b913dbd236c7f48ea70c8821f4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
125 <tr class="memitem:ga139b6e261c981f014f386927ca4a8444"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__peripheral__gr.html#ga139b6e261c981f014f386927ca4a8444">_FLD2VAL</a>(field, value)</td></tr>
126 <tr class="memdesc:ga139b6e261c981f014f386927ca4a8444"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extract from a peripheral register value the a bit field value.  <a href="#ga139b6e261c981f014f386927ca4a8444">More...</a><br/></td></tr>
127 <tr class="separator:ga139b6e261c981f014f386927ca4a8444"><td class="memSeparator" colspan="2">&#160;</td></tr>
128 </table>
129 <a name="details" id="details"></a><h2 class="groupheader">Description</h2>
130 <p>The section below describes the naming conventions, requirements, and optional features for accessing device specific peripherals. Most of the rules also apply to the core peripherals. The <a class="el" href="device_h_pg.html">Device Header File &lt;device.h&gt;</a> contains typically these definition and also includes the core specific header files.</p>
131 <p>Most of the definitions can be generated using the <a href="../../SVD/html/index.html"><b>CMSIS-SVD</b></a> System View Description for Peripherals. Refer to <a href="../../SVD/html/svd_SVDConv_pg.html"><b>SVDConv.exe</b></a> for more information.</p>
132 <p>Each peripheral provides a data type definition with a name that is composed of:</p>
133 <ul>
134 <li>prefix <b>&lt;<em>device abbreviation&gt;</em>_</b></li>
135 <li><b>&lt;<em>peripheral name</em>&gt;</b></li>
136 <li>postfix <b>_Type</b> or <b>_TypeDef</b> to identify a type definition.</li>
137 </ul>
138 <p>Example: <b>LPC_UART_TypeDef</b> for the device <b>LPC</b> and the peripheral <b>UART</b>.</p>
139 <p>The data type definition uses standard C data types defined by the ANSI C header file &lt;stdint.h&gt;.</p>
140 <ul>
141 <li>IO Type Qualifiers are used to specify the access to peripheral variables. <table class="doxtable">
142 <tr>
143 <th align="left">IO Type Qualifier </th><th align="left">Type </th><th align="left">Description  </th></tr>
144 <tr>
145 <td align="left"><b>__IM</b> </td><td align="left">Struct member </td><td align="left">Defines 'read only' permissions </td></tr>
146 <tr>
147 <td align="left"><b>__OM</b> </td><td align="left">Struct member </td><td align="left">Defines 'write only' permissions </td></tr>
148 <tr>
149 <td align="left"><b>__IOM</b> </td><td align="left">Struct member </td><td align="left">Defines 'read / write' permissions </td></tr>
150 <tr>
151 <td align="left"><b>__I</b> </td><td align="left">Scalar variable </td><td align="left">Defines 'read only' permissions </td></tr>
152 <tr>
153 <td align="left"><b>__O</b> </td><td align="left">Scalar variable </td><td align="left">Defines 'write only' permissions </td></tr>
154 <tr>
155 <td align="left"><b>__IO</b> </td><td align="left">Scalar variable </td><td align="left">Defines 'read / write' permissions </td></tr>
156 </table>
157 <dl class="section note"><dt>Note</dt><dd><b>__IM</b>, <b>__OM</b>, <b>__IOM</b> are added in CMSIS-Core V4.20 to enhance support for C++. Prior version used <b>__I</b>, <b>__O</b>, <b>__IO</b> also for struct member definitions.</dd></dl>
158 The typedef <b>&lt;<em>device abbreviation</em>&gt;_UART_TypeDef</b> shown below defines the generic register layout for all UART channels in a device.</li>
159 </ul>
160 <div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct</span></div>
161 <div class="line">{</div>
162 <div class="line">  <span class="keyword">union </span>{</div>
163 <div class="line">  __IM  uint8_t  RBR;                 <span class="comment">/* Offset: 0x000 (R/ )  Receiver Buffer Register            */</span></div>
164 <div class="line">  __OM  uint8_t  THR;                 <span class="comment">/* Offset: 0x000 ( /W)  Transmit Holding Register           */</span></div>
165 <div class="line">  __IOM uint8_t  DLL;                 <span class="comment">/* Offset: 0x000 (R/W)  Divisor Latch LSB                   */</span></div>
166 <div class="line">        uint32_t RESERVED0;</div>
167 <div class="line">  };</div>
168 <div class="line">  <span class="keyword">union </span>{</div>
169 <div class="line">  __IOM uint8_t  DLM;                 <span class="comment">/* Offset: 0x004 (R/W)  Divisor Latch MSB                   */</span></div>
170 <div class="line">  __IOM uint32_t IER;                 <span class="comment">/* Offset: 0x004 (R/W)  Interrupt Enable Register           */</span></div>
171 <div class="line">  };</div>
172 <div class="line">  <span class="keyword">union </span>{</div>
173 <div class="line">  __IM  uint32_t IIR;                 <span class="comment">/* Offset: 0x008 (R/ )  Interrupt ID Register               */</span></div>
174 <div class="line">  __OM  uint8_t  FCR;                 <span class="comment">/* Offset: 0x008 ( /W)  FIFO Control Register               */</span></div>
175 <div class="line">  };</div>
176 <div class="line">  __IOM uint8_t  LCR;                 <span class="comment">/* Offset: 0x00C (R/W)  Line Control Register               */</span></div>
177 <div class="line">        uint8_t  RESERVED1[7];</div>
178 <div class="line">  __IM  uint8_t  LSR;                 <span class="comment">/* Offset: 0x014 (R/ )  Line Status Register                */</span></div>
179 <div class="line">        uint8_t  RESERVED2[7];</div>
180 <div class="line">  __IOM uint8_t  SCR;                 <span class="comment">/* Offset: 0x01C (R/W)  Scratch Pad Register                */</span></div>
181 <div class="line">        uint8_t  RESERVED3[3];</div>
182 <div class="line">  __IOM uint32_t ACR;                 <span class="comment">/* Offset: 0x020 (R/W)  Autobaud Control Register           */</span></div>
183 <div class="line">  __IOM uint8_t  ICR;                 <span class="comment">/* Offset: 0x024 (R/W)  IrDA Control Register               */</span></div>
184 <div class="line">        uint8_t  RESERVED4[3];</div>
185 <div class="line">  __IOM uint8_t  FDR;                 <span class="comment">/* Offset: 0x028 (R/W)  Fractional Divider Register         */</span></div>
186 <div class="line">        uint8_t  RESERVED5[7];</div>
187 <div class="line">  __IOM uint8_t  TER;                 <span class="comment">/* Offset: 0x030 (R/W)  Transmit Enable Register            */</span></div>
188 <div class="line">        uint8_t  RESERVED6[39];</div>
189 <div class="line">  __IM  uint8_t  FIFOLVL;             <span class="comment">/* Offset: 0x058 (R/ )  FIFO Level Register                 */</span></div>
190 <div class="line">} LPC_UART_TypeDef;</div>
191 </div><!-- fragment --><p>To access the registers of the UART defined above, pointers to this register structure are defined. If more instances of a peripheral exist, the variables have a postfix (digit or letter) that identifies the peripheral.</p>
192 <p><b>Example:</b> In this example <b>LPC_UART2</b> and <b>LPC_UART3</b> are two pointers to UARTs defined with above register structure. <br/>
193 </p>
194 <div class="fragment"><div class="line"><span class="preprocessor">#define LPC_UART2             ((LPC_UART_TypeDef      *) LPC_UART2_BASE    )</span></div>
195 <div class="line"><span class="preprocessor">#define LPC_UART3             ((LPC_UART_TypeDef      *) LPC_UART3_BASE    )</span></div>
196 </div><!-- fragment --><p>The registers in the various UARTs can now be referred in the user code as shown below:<br/>
197 </p>
198 <div class="fragment"><div class="line">val = LPC_UART2-&gt;DR   <span class="comment">// is the data register of UART1.</span></div>
199 </div><!-- fragment --><hr/>
200 <h1><a class="anchor" id="core_cmsis_pal_min_reqs"></a>
201 Minimal Requirements</h1>
202 <p>To access the peripheral registers and related function in a device, the files <b><em>device.h</em></b> and <b>core_cm<em>#</em>.h</b> define as a minimum: <br/>
203 <br/>
204 </p>
205 <ul>
206 <li>The <b>Register Layout Typedef</b> for each peripheral that defines all register names. RESERVED is used to introduce space into the structure for adjusting the addresses of the peripheral registers. <br/>
207 <br/>
208 <b>Example:</b> <div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct</span></div>
209 <div class="line">{</div>
210 <div class="line">  __IOM uint32_t CTRL;                <span class="comment">/* Offset: 0x000 (R/W)  SysTick Control and Status Register */</span></div>
211 <div class="line">  __IOM uint32_t LOAD;                <span class="comment">/* Offset: 0x004 (R/W)  SysTick Reload Value Register       */</span></div>
212 <div class="line">  __IOM uint32_t VAL;                 <span class="comment">/* Offset: 0x008 (R/W)  SysTick Current Value Register      */</span></div>
213 <div class="line">  __IM  uint32_t CALIB;               <span class="comment">/* Offset: 0x00C (R/ )  SysTick Calibration Register        */</span></div>
214 <div class="line">} <a class="code" href="structSysTick__Type.html">SysTick_Type</a>;</div>
215 </div><!-- fragment --></li>
216 <li><b>Base Address</b> for each peripheral (in case of multiple peripherals that use the same <b>register layout typedef</b> multiple base addresses are defined). <br/>
217 <br/>
218 <b>Example:</b> <div class="fragment"><div class="line"><span class="preprocessor">#define SysTick_BASE (SCS_BASE + 0x0010)            </span><span class="comment">/* SysTick Base Address     */</span><span class="preprocessor"></span></div>
219 </div><!-- fragment --></li>
220 <li><b>Access Definitions</b> for each peripheral. In case of multiple peripherals that are using the same <b>register layout typdef</b>, multiple access definitions exist (LPC_UART0, LPC_UART2). <br/>
221 <br/>
222 <b>Example:</b> <div class="fragment"><div class="line"><span class="preprocessor">#define SysTick ((SysTick_Type *) Systick_BASE)    </span><span class="comment">/* SysTick access definition */</span><span class="preprocessor"></span></div>
223 </div><!-- fragment --></li>
224 </ul>
225 <p>These definitions allow accessing peripheral registers with simple assignments.</p>
226 <ul>
227 <li><b>Example:</b> <br/>
228 <div class="fragment"><div class="line">SysTick-&gt;CTRL = 0;</div>
229 </div><!-- fragment --></li>
230 </ul>
231 <hr/>
232 <h1><a class="anchor" id="core_cmsis_pal_opts"></a>
233 Optional Features</h1>
234 <p>Optionally, the file <b><em>device</em>.h</b> may define:</p>
235 <ul>
236 <li><a class="el" href="group__peripheral__gr.html#core_cmsis_pal_bitfields">Register Bit Fields</a> and #define constants that simplify access to peripheral registers. These constants may define bit-positions or other specific patterns that are required for programming peripheral registers. The identifiers should start with <b>&lt;<em>device abbreviation</em>&gt;_</b> and <b>&lt;<em>peripheral name</em>&gt;_</b>. It is recommended to use CAPITAL letters for #define constants.</li>
237 <li>More complex functions (i.e. status query before a sending register is accessed). Again, these functions start with <b>&lt;<em>device abbreviation</em>&gt;_</b> and <b>&lt;<em>peripheral name</em>&gt;_</b>.</li>
238 </ul>
239 <hr/>
240 <h1><a class="anchor" id="core_cmsis_pal_bitfields"></a>
241 Register Bit Fields</h1>
242 <p>For Core Register, macros define the position and the mask value for a bit field. It is recommended to create such definitions also for other peripheral registers.</p>
243 <p><b>Example:</b></p>
244 <p>Bit field definitions for register CPUID in SCB (System Control Block).</p>
245 <div class="fragment"><div class="line"><span class="comment">/* SCB CPUID Register Definitions */</span></div>
246 <div class="line"><span class="preprocessor">#define SCB_CPUID_IMPLEMENTER_Pos      24U                                       </span></div>
247 <div class="line"><span class="preprocessor">#define SCB_CPUID_IMPLEMENTER_Msk      (0xFFUL &lt;&lt; SCB_CPUID_IMPLEMENTER_Pos)     </span></div>
248 <div class="line"><span class="preprocessor">#define SCB_CPUID_VARIANT_Pos          20U                                       </span></div>
249 <div class="line"><span class="preprocessor">#define SCB_CPUID_VARIANT_Msk          (0xFUL &lt;&lt; SCB_CPUID_VARIANT_Pos)          </span></div>
250 <div class="line"><span class="preprocessor">#define SCB_CPUID_ARCHITECTURE_Pos     16U                                       </span></div>
251 <div class="line"><span class="preprocessor">#define SCB_CPUID_ARCHITECTURE_Msk     (0xFUL &lt;&lt; SCB_CPUID_ARCHITECTURE_Pos)     </span></div>
252 <div class="line"><span class="preprocessor">#define SCB_CPUID_PARTNO_Pos            4U                                       </span></div>
253 <div class="line"><span class="preprocessor">#define SCB_CPUID_PARTNO_Msk           (0xFFFUL &lt;&lt; SCB_CPUID_PARTNO_Pos)         </span></div>
254 <div class="line"><span class="preprocessor">#define SCB_CPUID_REVISION_Pos          0U                                       </span></div>
255 <div class="line"><span class="preprocessor">#define SCB_CPUID_REVISION_Msk         (0xFUL </span><span class="comment">/*&lt;&lt; SCB_CPUID_REVISION_Pos*/</span><span class="preprocessor">)     </span></div>
256 </div><!-- fragment --><p>The macros <b><a class="el" href="group__peripheral__gr.html#ga286e3b913dbd236c7f48ea70c8821f4e" title="Mask and shift a bit field value for assigning the result to a peripheral register. ">_VAL2FLD(field, value)</a></b> and <b><a class="el" href="group__peripheral__gr.html#ga139b6e261c981f014f386927ca4a8444" title="Extract from a peripheral register value the a bit field value. ">_FLD2VAL(field, value)</a></b> enable access to bit fields. </p>
257 <h2 class="groupheader">Macro Definition Documentation</h2>
258 <a class="anchor" id="ga139b6e261c981f014f386927ca4a8444"></a>
259 <div class="memitem">
260 <div class="memproto">
261       <table class="memname">
262         <tr>
263           <td class="memname">#define _FLD2VAL</td>
264           <td>(</td>
265           <td class="paramtype">&#160;</td>
266           <td class="paramname">field, </td>
267         </tr>
268         <tr>
269           <td class="paramkey"></td>
270           <td></td>
271           <td class="paramtype">&#160;</td>
272           <td class="paramname">value&#160;</td>
273         </tr>
274         <tr>
275           <td></td>
276           <td>)</td>
277           <td></td><td></td>
278         </tr>
279       </table>
280 </div><div class="memdoc">
281 <dl class="params"><dt>Parameters</dt><dd>
282   <table class="params">
283     <tr><td class="paramname">field</td><td>name of bit field. </td></tr>
284     <tr><td class="paramname">value</td><td>value of the register. This parameter is interpreted as an uint32_t type.</td></tr>
285   </table>
286   </dd>
287 </dl>
288 <p>The macro <a class="el" href="group__peripheral__gr.html#ga139b6e261c981f014f386927ca4a8444">_FLD2VAL</a> uses the #define's <em>_Pos</em> and <em>_Msk</em> of the related bit field to extract the value of a bit field from a register.</p>
289 <p><b>Example:</b> </p>
290 <div class="fragment"><div class="line"><span class="keywordtype">id</span> = <a class="code" href="group__peripheral__gr.html#ga139b6e261c981f014f386927ca4a8444">_FLD2VAL</a>(SCB_CPUID_REVISION, SCB-&gt;CPUID);</div>
291 </div><!-- fragment --> 
292 </div>
293 </div>
294 <a class="anchor" id="ga286e3b913dbd236c7f48ea70c8821f4e"></a>
295 <div class="memitem">
296 <div class="memproto">
297       <table class="memname">
298         <tr>
299           <td class="memname">#define _VAL2FLD</td>
300           <td>(</td>
301           <td class="paramtype">&#160;</td>
302           <td class="paramname">field, </td>
303         </tr>
304         <tr>
305           <td class="paramkey"></td>
306           <td></td>
307           <td class="paramtype">&#160;</td>
308           <td class="paramname">value&#160;</td>
309         </tr>
310         <tr>
311           <td></td>
312           <td>)</td>
313           <td></td><td></td>
314         </tr>
315       </table>
316 </div><div class="memdoc">
317 <dl class="params"><dt>Parameters</dt><dd>
318   <table class="params">
319     <tr><td class="paramname">field</td><td>name of bit field. </td></tr>
320     <tr><td class="paramname">value</td><td>value for the bit field. This parameter is interpreted as an uint32_t type.</td></tr>
321   </table>
322   </dd>
323 </dl>
324 <p>The macro <a class="el" href="group__peripheral__gr.html#ga286e3b913dbd236c7f48ea70c8821f4e">_VAL2FLD</a> uses the #define's <em>_Pos</em> and <em>_Msk</em> of the related bit field to shift bit-field values for assigning to a register.</p>
325 <p><b>Example:</b> </p>
326 <div class="fragment"><div class="line">SCB-&gt;CPUID = <a class="code" href="group__peripheral__gr.html#ga286e3b913dbd236c7f48ea70c8821f4e">_VAL2FLD</a>(SCB_CPUID_REVISION, 0x3) | <a class="code" href="group__peripheral__gr.html#ga286e3b913dbd236c7f48ea70c8821f4e">_VAL2FLD</a>(SCB_CPUID_VARIANT, 0x3);</div>
327 </div><!-- fragment --> 
328 </div>
329 </div>
330 </div><!-- contents -->
331 </div><!-- doc-content -->
332 <!-- start footer part -->
333 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
334   <ul>
335     <li class="footer">Generated on Tue Sep 13 2016 16:45:26 for CMSIS-CORE by ARM Ltd. All rights reserved.
336         <!--
337     <a href="http://www.doxygen.org/index.html">
338     <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 
339         -->
340         </li>
341   </ul>
342 </div>
343 </body>
344 </html>