]> begriffs open source - cmsis/blob - main/Core_A/html/group__peripheral__gr.html
Update documentation for branch main
[cmsis] / main / Core_A / html / group__peripheral__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-Core (Cortex-A): Peripheral Access</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-Core (Cortex-A)
47    &#160;<span id="projectnumber"><script type="text/javascript">
48      <!--
49      writeHeader.call(this);
50      writeVersionDropdown.call(this);
51      //-->
52     </script>
53    </span>
54    </div>
55    <div id="projectbrief">CMSIS-Core support for Cortex-A processor-based devices</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 <script type="text/javascript">
83   writeSubComponentTabs.call(this);
84 </script>
85 <!-- Generated by Doxygen 1.9.6 -->
86 <script type="text/javascript">
87 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
88 var searchBox = new SearchBox("searchBox", "search/",'.html');
89 /* @license-end */
90 </script>
91 </div><!-- top -->
92 <div id="side-nav" class="ui-resizable side-nav-resizable">
93   <div id="nav-tree">
94     <div id="nav-tree-contents">
95       <div id="nav-sync" class="sync"></div>
96     </div>
97   </div>
98   <div id="splitbar" style="-moz-user-select:none;" 
99        class="ui-resizable-handle">
100   </div>
101 </div>
102 <script type="text/javascript">
103 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
104 $(document).ready(function(){initNavTree('group__peripheral__gr.html',''); initResizable(); });
105 /* @license-end */
106 </script>
107 <div id="doc-content">
108 <!-- window showing the filter options -->
109 <div id="MSearchSelectWindow"
110      onmouseover="return searchBox.OnSearchSelectShow()"
111      onmouseout="return searchBox.OnSearchSelectHide()"
112      onkeydown="return searchBox.OnSearchSelectKey(event)">
113 </div>
114
115 <!-- iframe showing the search results (closed by default) -->
116 <div id="MSearchResultsWindow">
117 <div id="MSearchResults">
118 <div class="SRPage">
119 <div id="SRIndex">
120 <div id="SRResults"></div>
121 <div class="SRStatus" id="Loading">Loading...</div>
122 <div class="SRStatus" id="Searching">Searching...</div>
123 <div class="SRStatus" id="NoMatches">No Matches</div>
124 </div>
125 </div>
126 </div>
127 </div>
128
129 <div class="header">
130   <div class="summary">
131 <a href="#define-members">Macros</a>  </div>
132   <div class="headertitle"><div class="title">Peripheral Access</div></div>
133 </div><!--header-->
134 <div class="contents">
135
136 <p>Naming conventions and optional features for accessing peripherals.  
137 <a href="#details">More...</a></p>
138 <table class="memberdecls">
139 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
140 Macros</h2></td></tr>
141 <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>
142 <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.  <br /></td></tr>
143 <tr class="separator:ga286e3b913dbd236c7f48ea70c8821f4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
144 <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>
145 <tr class="memdesc:ga139b6e261c981f014f386927ca4a8444"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extract from a peripheral register value the a bit field value.  <br /></td></tr>
146 <tr class="separator:ga139b6e261c981f014f386927ca4a8444"><td class="memSeparator" colspan="2">&#160;</td></tr>
147 </table>
148 <a name="details" id="details"></a><h2 class="groupheader">Description</h2>
149 <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>
150 <p>The definitions for <a class="el" href="group__peripheral__gr.html">Peripheral Access</a> 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>
151 <p>Each peripheral provides a data type definition with a name that is composed of:</p><ul>
152 <li>an optional prefix <b>&lt;<em>device abbreviation&gt;</em>_</b></li>
153 <li><b>&lt;<em>peripheral name</em>&gt;</b></li>
154 <li>postfix <b>_Type</b> or <b>_TypeDef</b> to identify a type definition.</li>
155 </ul>
156 <p>Examples:</p><ul>
157 <li><b>UART_TypeDef</b> for the peripheral <b>UART</b>.</li>
158 <li><b>IMX_UART_TypeDef</b> for the device family <b>IMX</b> and the peripheral <b>UART</b>.</li>
159 </ul>
160 <p>The data type definition uses standard C data types defined by the ANSI C header file &lt;stdint.h&gt;.</p>
161 <ul>
162 <li>IO Type Qualifiers are used to specify the access to peripheral variables. <table class="markdownTable">
163 <tr class="markdownTableHead">
164 <th class="markdownTableHeadLeft">IO Type Qualifier   </th><th class="markdownTableHeadLeft">Type   </th><th class="markdownTableHeadLeft">Description    </th></tr>
165 <tr class="markdownTableRowOdd">
166 <td class="markdownTableBodyLeft"><b>__IM</b>   </td><td class="markdownTableBodyLeft">Struct member   </td><td class="markdownTableBodyLeft">Defines 'read only' permissions    </td></tr>
167 <tr class="markdownTableRowEven">
168 <td class="markdownTableBodyLeft"><b>__OM</b>   </td><td class="markdownTableBodyLeft">Struct member   </td><td class="markdownTableBodyLeft">Defines 'write only' permissions    </td></tr>
169 <tr class="markdownTableRowOdd">
170 <td class="markdownTableBodyLeft"><b>__IOM</b>   </td><td class="markdownTableBodyLeft">Struct member   </td><td class="markdownTableBodyLeft">Defines 'read / write' permissions    </td></tr>
171 <tr class="markdownTableRowEven">
172 <td class="markdownTableBodyLeft"><b>__I</b>   </td><td class="markdownTableBodyLeft">Scalar variable   </td><td class="markdownTableBodyLeft">Defines 'read only' permissions    </td></tr>
173 <tr class="markdownTableRowOdd">
174 <td class="markdownTableBodyLeft"><b>__O</b>   </td><td class="markdownTableBodyLeft">Scalar variable   </td><td class="markdownTableBodyLeft">Defines 'write only' permissions    </td></tr>
175 <tr class="markdownTableRowEven">
176 <td class="markdownTableBodyLeft"><b>__IO</b>   </td><td class="markdownTableBodyLeft">Scalar variable   </td><td class="markdownTableBodyLeft">Defines 'read / write' permissions   </td></tr>
177 </table>
178 </li>
179 </ul>
180 <p>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.</p>
181 <div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
182 <div class="line">  __O  uint32_t UART_CR;            <span class="comment">// Offset: 0x0000 ( /W) Control Register </span></div>
183 <div class="line">  __IO uint32_t UART_MR;            <span class="comment">// Offset: 0x0004 (R/W) Mode Register </span></div>
184 <div class="line">  __O  uint32_t UART_IER;           <span class="comment">// Offset: 0x0008 ( /W) Interrupt Enable Register </span></div>
185 <div class="line">  __O  uint32_t UART_IDR;           <span class="comment">// Offset: 0x000C ( /W) Interrupt Disable Register </span></div>
186 <div class="line">  __I  uint32_t UART_IMR;           <span class="comment">// Offset: 0x0010 (R/ ) Interrupt Mask Register </span></div>
187 <div class="line">  __I  uint32_t UART_SR;            <span class="comment">// Offset: 0x0014 (R/ ) Status Register </span></div>
188 <div class="line">  __I  uint32_t UART_RHR;           <span class="comment">// Offset: 0x0018 (R/ ) Receive Holding Register </span></div>
189 <div class="line">  __O  uint32_t UART_THR;           <span class="comment">// Offset: 0x001C ( /W) Transmit Holding Register </span></div>
190 <div class="line">  __IO uint32_t UART_BRGR;          <span class="comment">// Offset: 0x0020 (R/W) Baud Rate Generator Register </span></div>
191 <div class="line">  __IO uint32_t UART_CMPR;          <span class="comment">// Offset: 0x0024 (R/W) Comparison Register </span></div>
192 <div class="line">  __IO uint32_t UART_RTOR;          <span class="comment">// Offset: 0x0028 (R/W) Receiver Time-out Register </span></div>
193 <div class="line">  __I  uint32_t RESERVED[46];       <span class="comment">// Offset: 0x002C (R/ ) Reserved                     </span></div>
194 <div class="line">  __IO uint32_t UART_WPMR;          <span class="comment">// Offset: 0x00E4 (R/W) Write Protection Mode Register </span></div>
195 <div class="line">} IMX_UART_TypeDef;</div>
196 </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>
197 <p><b>Example:</b> In this example, <b>IMX_UART2</b> and <b>IMX_UART3</b> are two pointers to UARTs defined with above register structure. <br  />
198 </p><div class="fragment"><div class="line"><span class="preprocessor">#define IMX_UART2   ((IMX_UART_TypeDef *) IMX_UART2_BASE)</span></div>
199 <div class="line"><span class="preprocessor">#define IMX_UART3   ((IMX_UART_TypeDef *) IMX_UART3_BASE)</span></div>
200 </div><!-- fragment --><dl class="section note"><dt>Note</dt><dd><ul>
201 <li>The prefix <b>IMX</b> is optional.</li>
202 </ul>
203 </dd></dl>
204 <p>The registers in the various UARTs can now be referred in the user code as shown below:<br  />
205 </p><div class="fragment"><div class="line">val = IMX_UART2-&gt;SR   <span class="comment">// is the Status Register of UART2.</span></div>
206 </div><!-- fragment --><hr  />
207 <h1><a class="anchor" id="core_cmsis_pal_min_reqs"></a>
208 Minimal Requirements</h1>
209 <p>To access the peripheral registers and related function in a device, the files <b><em>device.h</em></b> and <b>core_ca.h</b> define as a minimum: <br  />
210 <br  />
211 </p><ul>
212 <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  />
213 <br  />
214 <b>Example:</b> <div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keyword">struct</span></div>
215 <div class="line">{</div>
216 <div class="line">  __IOM uint32_t C_CTLR;              <span class="comment">// Offset: 0x0000 (R/W) CPU Interface Control Register </span></div>
217 <div class="line">  __IOM uint32_t C_PMR;               <span class="comment">// Offset: 0x0004 (R/W) Interrupt Priority Mask Register </span></div>
218 <div class="line">  __IOM uint32_t C_BPR;               <span class="comment">// Offset: 0x0008 (R/W) Binary Point Register </span></div>
219 <div class="line">  __IM  uint32_t C_IAR;               <span class="comment">// Offset: 0x000C (R/ ) Interrupt Acknowledge Register </span></div>
220 <div class="line">  __OM  uint32_t C_EOIR;              <span class="comment">// Offset: 0x0010 ( /W) End Of Interrupt Register </span></div>
221 <div class="line">  __IM  uint32_t C_RPR;               <span class="comment">// Offset: 0x0014 (R/ ) Running Priority Register </span></div>
222 <div class="line">  __IM  uint32_t C_HPPIR;             <span class="comment">// Offset: 0x0018 (R/ ) Highest Priority Pending Interrupt Register </span></div>
223 <div class="line">  __IOM uint32_t C_ABPR;              <span class="comment">// Offset: 0x001C (R/W) Aliased Binary Point Register </span></div>
224 <div class="line">  __IM  uint32_t C_AIAR;              <span class="comment">// Offset: 0x0020 (R/ ) Aliased Interrupt Acknowledge Register </span></div>
225 <div class="line">  __OM  uint32_t C_AEOIR;             <span class="comment">// Offset: 0x0024 ( /W) Aliased End Of Interrupt Register </span></div>
226 <div class="line">  __IM  uint32_t C_AHPPIR;            <span class="comment">// Offset: 0x0028 (R/ ) Aliased Highest Priority Pending Interrupt Register </span></div>
227 <div class="line">  __IOM uint32_t C_STATUSR;           <span class="comment">// Offset: 0x002C (R/W) Error Reporting Status Register, optional </span></div>
228 <div class="line">  __I   uint32_t RESERVED1[40];       <span class="comment">// Offset: 0x0030 (R/ ) Reserved</span></div>
229 <div class="line">  __IOM uint32_t C_APR[4];            <span class="comment">// Offset: 0x00D0 (R/W) Active Priority Register </span></div>
230 <div class="line">  __IOM uint32_t C_NSAPR[4];          <span class="comment">// Offset: 0x00E0 (R/W) Non-secure Active Priority Register </span></div>
231 <div class="line">  __I   uint32_t RESERVED2[3];        <span class="comment">// Offset: 0x00F6 (R/ ) Reserved</span></div>
232 <div class="line">  __IM  uint32_t C_IIDR;              <span class="comment">// Offset: 0x00FC (R/ ) CPU Interface Identification Register </span></div>
233 <div class="line">  __I   uint32_t RESERVED3[960];      <span class="comment">// Offset: 0x0100 (R/ ) Reserved</span></div>
234 <div class="line">  __OM  uint32_t C_DIR;               <span class="comment">// Offset: 0x1000 ( /W) Deactivate Interrupt Register </span></div>
235 <div class="line">}  <a class="code hl_struct" href="structGICInterface__Type.html">GICInterface_Type</a>;</div>
236 <div class="ttc" id="astructGICInterface__Type_html"><div class="ttname"><a href="structGICInterface__Type.html">GICInterface_Type</a></div></div>
237 </div><!-- fragment --></li>
238 <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  />
239 <br  />
240 <b>Example:</b> <div class="fragment"><div class="line"><span class="preprocessor">#define GIC_INTERFACE_BASE (0xe8202000UL)   </span><span class="comment">// GIC Interface Base Address     </span></div>
241 </div><!-- fragment --></li>
242 <li><b>Access Definitions</b> for each peripheral. In case of multiple peripherals that are using the same <b>register layout typedef</b>, multiple access definitions exist. <br  />
243 <br  />
244 <b>Example:</b> <div class="fragment"><div class="line"><span class="preprocessor">#define GICInterface   ((GICInterface_Type *) GIC_INTERFACE_BASE)   </span><span class="comment">// GIC Interface Access Definition </span></div>
245 </div><!-- fragment --></li>
246 </ul>
247 <p>These definitions allow accessing peripheral registers with simple assignments.</p>
248 <ul>
249 <li><b>Example:</b> <br  />
250 <div class="fragment"><div class="line">GICInterface-&gt;C_CTLR |= 1;   <span class="comment">// Enable Interface</span></div>
251 </div><!-- fragment --></li>
252 </ul>
253 <hr  />
254 <h1><a class="anchor" id="core_cmsis_pal_opts"></a>
255 Optional Features</h1>
256 <p>Optionally, the file <b><em>device</em>.h</b> may define:</p>
257 <ul>
258 <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>
259 <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>
260 </ul>
261 <hr  />
262 <h1><a class="anchor" id="core_cmsis_pal_bitfields"></a>
263 Register Bit Fields</h1>
264 <p>For Core Register, macros define the position and the mask value for a bit field.</p>
265 <p><b>Example:</b></p>
266 <p>Bit field definitions for register ACTLR in CP15.</p>
267 <div class="fragment"><div class="line"><span class="comment">// CP15 Register ACTLR</span></div>
268 <div class="line"><span class="preprocessor">#define ACTLR_DDI_Pos                  28U                       </span></div>
269 <div class="line"><span class="preprocessor">#define ACTLR_DDI_Msk                  (1UL &lt;&lt; ACTLR_DDI_Pos)    </span></div>
270 <div class="line">                                       </div>
271 <div class="line"><span class="preprocessor">#define ACTLR_DDVM_Pos                 15U                       </span></div>
272 <div class="line"><span class="preprocessor">#define ACTLR_DDVM_Msk                 (1UL &lt;&lt; ACTLR_DDVM_Pos)   </span></div>
273 <div class="line">                                       </div>
274 <div class="line"><span class="preprocessor">#define ACTLR_L1PCTL_Pos               13U                       </span></div>
275 <div class="line"><span class="preprocessor">#define ACTLR_L1PCTL_Msk               (3UL &lt;&lt; ACTLR_L1PCTL_Pos) </span></div>
276 <div class="line">                                       </div>
277 <div class="line"><span class="preprocessor">#define ACTLR_L1RADIS_Pos              12U                       </span></div>
278 <div class="line"><span class="preprocessor">#define ACTLR_L1RADIS_Msk              (1UL &lt;&lt; ACTLR_L1RADIS_Pos)</span></div>
279 <div class="line">                                       </div>
280 <div class="line"><span class="preprocessor">#define ACTLR_L2RADIS_Pos              11U                       </span></div>
281 <div class="line"><span class="preprocessor">#define ACTLR_L2RADIS_Msk              (1UL &lt;&lt; ACTLR_L2RADIS_Pos)</span></div>
282 <div class="line">                                       </div>
283 <div class="line"><span class="preprocessor">#define ACTLR_DODMBS_Pos               10U                       </span></div>
284 <div class="line"><span class="preprocessor">#define ACTLR_DODMBS_Msk               (1UL &lt;&lt; ACTLR_DODMBS_Pos) </span></div>
285 <div class="line">                                       </div>
286 <div class="line"><span class="preprocessor">#define ACTLR_SMP_Pos                  6U                        </span></div>
287 <div class="line"><span class="preprocessor">#define ACTLR_SMP_Msk                  (1UL &lt;&lt; ACTLR_SMP_Pos)     </span></div>
288 </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>
289 <h2 class="groupheader">Macro Definition Documentation</h2>
290 <a id="ga139b6e261c981f014f386927ca4a8444" name="ga139b6e261c981f014f386927ca4a8444"></a>
291 <h2 class="memtitle"><span class="permalink"><a href="#ga139b6e261c981f014f386927ca4a8444">&#9670;&#160;</a></span>_FLD2VAL</h2>
292
293 <div class="memitem">
294 <div class="memproto">
295       <table class="memname">
296         <tr>
297           <td class="memname">#define _FLD2VAL</td>
298           <td>(</td>
299           <td class="paramtype">&#160;</td>
300           <td class="paramname">field, </td>
301         </tr>
302         <tr>
303           <td class="paramkey"></td>
304           <td></td>
305           <td class="paramtype">&#160;</td>
306           <td class="paramname">value&#160;</td>
307         </tr>
308         <tr>
309           <td></td>
310           <td>)</td>
311           <td></td><td></td>
312         </tr>
313       </table>
314 </div><div class="memdoc">
315 <dl class="params"><dt>Parameters</dt><dd>
316   <table class="params">
317     <tr><td class="paramname">field</td><td>name of bit field. </td></tr>
318     <tr><td class="paramname">value</td><td>value of the register. This parameter is interpreted as an uint32_t type.</td></tr>
319   </table>
320   </dd>
321 </dl>
322 <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>
323 <p><b>Example:</b> </p><div class="fragment"><div class="line">i = <a class="code hl_define" href="group__peripheral__gr.html#ga139b6e261c981f014f386927ca4a8444">_FLD2VAL</a>(ACTLR_SMP, ACTLR);</div>
324 <div class="ttc" id="agroup__peripheral__gr_html_ga139b6e261c981f014f386927ca4a8444"><div class="ttname"><a href="group__peripheral__gr.html#ga139b6e261c981f014f386927ca4a8444">_FLD2VAL</a></div><div class="ttdeci">#define _FLD2VAL(field, value)</div><div class="ttdoc">Extract from a peripheral register value the a bit field value.</div><div class="ttdef"><b>Definition:</b> core_ca.txt:229</div></div>
325 </div><!-- fragment --> 
326 </div>
327 </div>
328 <a id="ga286e3b913dbd236c7f48ea70c8821f4e" name="ga286e3b913dbd236c7f48ea70c8821f4e"></a>
329 <h2 class="memtitle"><span class="permalink"><a href="#ga286e3b913dbd236c7f48ea70c8821f4e">&#9670;&#160;</a></span>_VAL2FLD</h2>
330
331 <div class="memitem">
332 <div class="memproto">
333       <table class="memname">
334         <tr>
335           <td class="memname">#define _VAL2FLD</td>
336           <td>(</td>
337           <td class="paramtype">&#160;</td>
338           <td class="paramname">field, </td>
339         </tr>
340         <tr>
341           <td class="paramkey"></td>
342           <td></td>
343           <td class="paramtype">&#160;</td>
344           <td class="paramname">value&#160;</td>
345         </tr>
346         <tr>
347           <td></td>
348           <td>)</td>
349           <td></td><td></td>
350         </tr>
351       </table>
352 </div><div class="memdoc">
353 <dl class="params"><dt>Parameters</dt><dd>
354   <table class="params">
355     <tr><td class="paramname">field</td><td>name of bit field. </td></tr>
356     <tr><td class="paramname">value</td><td>value for the bit field. This parameter is interpreted as an uint32_t type.</td></tr>
357   </table>
358   </dd>
359 </dl>
360 <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>
361 <p><b>Example:</b> </p><div class="fragment"><div class="line">ACTLR = <a class="code hl_define" href="group__peripheral__gr.html#ga286e3b913dbd236c7f48ea70c8821f4e">_VAL2FLD</a>(ACTLR_SMP, 0x1)</div>
362 <div class="ttc" id="agroup__peripheral__gr_html_ga286e3b913dbd236c7f48ea70c8821f4e"><div class="ttname"><a href="group__peripheral__gr.html#ga286e3b913dbd236c7f48ea70c8821f4e">_VAL2FLD</a></div><div class="ttdeci">#define _VAL2FLD(field, value)</div><div class="ttdoc">Mask and shift a bit field value for assigning the result to a peripheral register.</div><div class="ttdef"><b>Definition:</b> core_ca.txt:212</div></div>
363 </div><!-- fragment --> 
364 </div>
365 </div>
366 </div><!-- contents -->
367 </div><!-- doc-content -->
368 <!-- start footer part -->
369 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
370   <ul>
371     <li class="footer">
372       <script type="text/javascript">
373         <!--
374         writeFooter.call(this);
375         //-->
376       </script> 
377     </li>
378   </ul>
379 </div>
380 </body>
381 </html>