]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Core/src/Ref_SystemAndClock.txt
Merge branch 'develop' of https://github.com/ARM-software/CMSIS_5 into feature/RTX_Do...
[cmsis] / CMSIS / DoxyGen / Core / src / Ref_SystemAndClock.txt
1 /* ################################  System and Clock Configuration   ########################### */\r
2 /**************************************************************************************************/\r
3 /**\r
4 \defgroup   system_init_gr   System and Clock Configuration\r
5 \brief Describes system_<i>device</i>.c file that contains functions for system and clock setup.\r
6 \details\r
7 ARM provides a template file <b>system_<i>device</i>.c</b> that must be adapted by \r
8 the silicon vendor to match their actual device. As a <b>minimum requirement</b>, \r
9 this file must provide:\r
10  -  A device-specific system configuration function, \ref SystemInit().\r
11  -  A global variable that contains the system frequency, \ref SystemCoreClock. \r
12 \r
13 The file configures the device and, typically, initializes the oscillator (PLL) that is part \r
14 of the microcontroller device. This file might export other functions or variables that provide \r
15 a more flexible configuration of the microcontroller system.\r
16 \r
17 \r
18 \section system_init_code_ex_sec Code Example     \r
19 The code below shows the usage of the variable \ref SystemCoreClock and the functions \r
20 SystemInit() and SystemCoreClockUpdate() with an LPC1700.\r
21     \r
22 \code\r
23 #include "LPC17xx.h"\r
24 \r
25 uint32_t coreClock_1 = 0;                       /* Variables to store core clock values */\r
26 uint32_t coreClock_2 = 0;\r
27 \r
28 \r
29 int main (void)  {\r
30 \r
31   coreClock_1 = SystemCoreClock;                /* Store value of predefined SystemCoreClock */\r
32 \r
33   SystemCoreClockUpdate();                      /* Update SystemCoreClock according to register settings */\r
34 \r
35   coreClock_2 = SystemCoreClock;                /* Store value of calculated SystemCoreClock */\r
36 \r
37   if (coreClock_2 != coreClock_1)  {            /* Without changing the clock setting both core clock values should be the same */ \r
38     // Error Handling\r
39   }\r
40 \r
41   while(1);\r
42 }\r
43 \endcode    \r
44     \r
45 @{\r
46 */\r
47 \r
48 \r
49 /**************************************************************************************************/\r
50 /** \r
51     \brief      Variable to hold the system core clock value\r
52     \details\r
53     Holds the system core clock, which is the system clock      frequency supplied to the SysTick \r
54     timer and the processor core clock. This variable can be used by debuggers to query the \r
55     frequency of the debug timer or to configure the trace clock speed.\r
56                      \r
57     \attention  Compilers must be configured to avoid removing this variable in case the application \r
58                 program is not using it. Debugging systems require the variable to be physically \r
59                 present in memory so that it can be examined to configure the debugger.\r
60 */\r
61 uint32_t SystemCoreClock;\r
62 \r
63 \r
64 /**************************************************************************************************/\r
65 /** \r
66     \brief      Function to Initialize the system.\r
67     \details    \r
68     Initializes the microcontroller system. Typically, this function configures the \r
69                      oscillator (PLL) that is part of the microcontroller device. For systems \r
70                      with a variable clock speed, it updates the variable \ref SystemCoreClock.\r
71                      SystemInit is called from the file <b>startup<i>_device</i></b>.\r
72 */\r
73 void SystemInit (void);\r
74 \r
75 \r
76 /**************************************************************************************************/\r
77 /** \r
78     \brief      Function to update the variable \ref SystemCoreClock\r
79     \details    \r
80     Updates the variable \ref SystemCoreClock and must be called whenever the core clock is changed \r
81     during program execution. The function evaluates the clock register settings and calculates \r
82     the current core clock.\r
83 */\r
84 void SystemCoreClockUpdate (void);\r
85 \r
86 \r
87 /** @} */  /* end group system_init_gr */\r
88 \r