]> begriffs open source - cmsis/blob - dev/v6.0.0-dev53/Core_A/html/system_c_pg.html
Update documentation for branch main
[cmsis] / dev / v6.0.0-dev53 / Core_A / html / system_c_pg.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): System Configuration Files system_&lt;Device&gt;.c and system_&lt;Device&gt;.h</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('system_c_pg.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><div class="header">
130   <div class="headertitle"><div class="title">System Configuration Files system_&lt;Device&gt;.c and system_&lt;Device&gt;.h </div></div>
131 </div><!--header-->
132 <div class="contents">
133 <div class="textblock"><p>The <a class="el" href="system_c_pg.html">System Configuration Files system_&lt;Device&gt;.c and system_&lt;Device&gt;.h</a> provides as a minimum the functions described under <a class="el" href="group__system__init__gr.html">System and Clock Configuration</a>. These functions are device specific and need adaptations. In addition, the file might have configuration settings for the device such as XTAL frequency or PLL prescaler settings.</p>
134 <p>For devices with external memory BUS the system_&lt;Device&gt;.c also configures the BUS system.</p>
135 <p>The silicon vendor might expose other functions (i.e. for power configuration) in the system_&lt;Device&gt;.c file.</p>
136 <p>In case of additional features the function prototypes need to be added to the system_&lt;Device&gt;.h header file.</p>
137 <h1><a class="anchor" id="system_Device_sec"></a>
138 system_Device.c Template File</h1>
139 <p>The <a class="el" href="system_c_pg.html#system_Device_sec">system_Device.c Template File</a> is shown below.</p>
140 <pre class="fragment">/******************************************************************************
141  * @file     system_&lt;Device&gt;.c
142  * @brief    CMSIS Cortex-A Device Peripheral Access Layer 
143  * @version  V1.00
144  * @date     10. January 2018
145  ******************************************************************************/
146 /*
147  * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
148  *
149  * SPDX-License-Identifier: Apache-2.0
150  *
151  * Licensed under the Apache License, Version 2.0 (the License); you may
152  * not use this file except in compliance with the License.
153  * You may obtain a copy of the License at
154  *
155  * www.apache.org/licenses/LICENSE-2.0
156  *
157  * Unless required by applicable law or agreed to in writing, software
158  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
159  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
160  * See the License for the specific language governing permissions and
161  * limitations under the License.
162  */
163
164 #include &lt;stdint.h&gt;
165 #include "&lt;Device&gt;.h" /* ToDo: replace '&lt;Device&gt;' with your device name */
166 #include "irq_ctrl.h"
167
168 /*----------------------------------------------------------------------------
169   Define clocks
170  *----------------------------------------------------------------------------*/
171 /* ToDo: add here your necessary defines for device initialization
172          following is an example for different system frequencies */
173 #define XTAL            (12000000U)       /* Oscillator frequency             */
174
175 #define SYSTEM_CLOCK    (5 * XTAL)
176
177
178 /*----------------------------------------------------------------------------
179   System Core Clock Variable
180  *----------------------------------------------------------------------------*/
181 /* ToDo: initialize SystemCoreClock with the system core clock frequency value
182          achieved after system intitialization.
183          This means system core clock frequency after call to SystemInit() */
184 uint32_t SystemCoreClock = SYSTEM_CLOCK;  /* System Clock Frequency (Core Clock)*/
185
186
187
188 /*----------------------------------------------------------------------------
189   Clock functions
190  *----------------------------------------------------------------------------*/
191
192 void SystemCoreClockUpdate (void)            /* Get Core Clock Frequency      */
193 {
194 /* ToDo: add code to calculate the system frequency based upon the current
195          register settings.
196          This function can be used to retrieve the system core clock frequeny
197          after user changed register sittings. */
198   SystemCoreClock = SYSTEM_CLOCK;
199 }
200
201
202 /*----------------------------------------------------------------------------
203   System Initialization
204  *----------------------------------------------------------------------------*/
205 void SystemInit (void)
206 {
207 /* ToDo: add code to initialize the system
208    Do not use global variables because this function is called before
209    reaching pre-main. RW section may be overwritten afterwards.          */
210   SystemCoreClock = SYSTEM_CLOCK;
211
212   // Invalidate entire Unified TLB
213   __set_TLBIALL(0);
214
215   // Invalidate entire branch predictor array
216   __set_BPIALL(0);
217   __DSB();
218   __ISB();
219
220   //  Invalidate instruction cache and flush branch target cache
221   __set_ICIALLU(0);
222   __DSB();
223   __ISB();
224
225   //  Invalidate data cache
226   L1C_InvalidateDCacheAll();
227   
228   // Create Translation Table
229   MMU_CreateTranslationTable();
230
231   // Enable MMU
232   MMU_Enable();
233
234   // Enable Caches
235   L1C_EnableCaches();
236   L1C_EnableBTAC();
237
238 #if (__L2C_PRESENT == 1) 
239   // Enable GIC
240   L2C_Enable();
241 #endif
242
243 #if ((__FPU_PRESENT == 1) &amp;&amp; (__FPU_USED == 1))
244   // Enable FPU
245   __FPU_Enable();
246 #endif
247
248   // IRQ Initialize
249   IRQ_Initialize();
250 }
251 </pre><h1><a class="anchor" id="system_Device_h_sec"></a>
252 system_Device.h Template File</h1>
253 <p>The system_&lt;Device&gt;.h header file contains prototypes to access the public functions in the system_&lt;device&gt;.c file. The <a class="el" href="system_c_pg.html#system_Device_h_sec">system_Device.h Template File</a> is shown below.</p>
254 <pre class="fragment">/**************************************************************************//**
255  * @file     system_&lt;Device&gt;.h
256  * @brief    CMSIS Cortex-A Device Peripheral Access Layer
257  * @version  V5.00
258  * @date     10. January 2018
259  ******************************************************************************/
260 /*
261  * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
262  *
263  * SPDX-License-Identifier: Apache-2.0
264  *
265  * Licensed under the Apache License, Version 2.0 (the License); you may
266  * not use this file except in compliance with the License.
267  * You may obtain a copy of the License at
268  *
269  * www.apache.org/licenses/LICENSE-2.0
270  *
271  * Unless required by applicable law or agreed to in writing, software
272  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
273  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
274  * See the License for the specific language governing permissions and
275  * limitations under the License.
276  */
277
278 #ifndef SYSTEM_&lt;Device&gt;_H   /* ToDo: replace '&lt;Device&gt;' with your device name */
279 #define SYSTEM_&lt;Device&gt;_H
280
281 #ifdef __cplusplus
282 extern "C" {
283 #endif
284
285 #include &lt;stdint.h&gt;
286
287 extern uint32_t SystemCoreClock;     /*!&lt; System Clock Frequency (Core Clock)  */
288
289 /**
290   \brief Setup the microcontroller system.
291
292    Initialize the System and update the SystemCoreClock variable.
293  */
294 extern void SystemInit (void);
295
296 /**
297   \brief  Update SystemCoreClock variable.
298
299    Updates the SystemCoreClock with current core Clock retrieved from cpu registers.
300  */
301 extern void SystemCoreClockUpdate (void);
302
303 /**
304   \brief  Create Translation Table.
305
306    Creates Memory Management Unit Translation Table.
307  */
308 extern void MMU_CreateTranslationTable(void);
309
310 #ifdef __cplusplus
311 }
312 #endif
313
314 #endif /* SYSTEM_&lt;Device&gt;_H */
315 </pre> </div></div><!-- contents -->
316 </div><!-- PageDoc -->
317 </div><!-- doc-content -->
318 <!-- start footer part -->
319 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
320   <ul>
321     <li class="footer">
322       <script type="text/javascript">
323         <!--
324         writeFooter.call(this);
325         //-->
326       </script> 
327     </li>
328   </ul>
329 </div>
330 </body>
331 </html>