44 * @author MCD Application Team
55 * @brief CMSIS Cortex-Mx Device Peripheral Access Layer System Source File.
66 *
7- * This file provides two functions and one global variable to be called from
7+ * This file provides two functions and one global variable to be called from
88 * user application:
9- * - SystemInit(): This function is called at startup just after reset and
9+ * - SystemInit(): This function is called at startup just after reset and
1010 * before branch to main program. This call is made inside
1111 * the "startup_stm32h7xx.s" file.
1212 *
1313 * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
14- * by the user application to setup the SysTick
14+ * by the user application to setup the SysTick
1515 * timer or configure other parameters.
16- *
16+ *
1717 * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
1818 * be called whenever the core clock is changed
1919 * during program execution.
3939
4040/** @addtogroup stm32h7xx_system
4141 * @{
42- */
43-
42+ */
43+
4444/** @addtogroup STM32H7xx_System_Private_Includes
4545 * @{
4646 */
107107 /* This variable is updated in three ways:
108108 1) by calling CMSIS function SystemCoreClockUpdate()
109109 2) by calling HAL API function HAL_RCC_GetHCLKFreq()
110- 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
110+ 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
111111 Note: If you use this function to configure the system clock; then there
112112 is no need to call the 2 first functions listed above, since SystemCoreClock
113113 variable is updated automatically.
140140 * @retval None
141141 */
142142void SystemInit (void )
143- {
143+ {
144144#if defined (DATA_IN_D2_SRAM )
145145 __IO uint32_t tmpreg ;
146146#endif /* DATA_IN_D2_SRAM */
@@ -152,7 +152,7 @@ void SystemInit (void)
152152 /* Reset the RCC clock configuration to the default reset state ------------*/
153153 /* Set HSION bit */
154154 RCC -> CR |= RCC_CR_HSION ;
155-
155+
156156 /* Reset CFGR register */
157157 RCC -> CFGR = 0x00000000 ;
158158
@@ -164,7 +164,7 @@ void SystemInit (void)
164164
165165 /* Reset D2CFGR register */
166166 RCC -> D2CFGR = 0x00000000 ;
167-
167+
168168 /* Reset D3CFGR register */
169169 RCC -> D3CFGR = 0x00000000 ;
170170
@@ -182,14 +182,14 @@ void SystemInit (void)
182182 RCC -> PLL2DIVR = 0x00000000 ;
183183
184184 /* Reset PLL2FRACR register */
185-
185+
186186 RCC -> PLL2FRACR = 0x00000000 ;
187187 /* Reset PLL3DIVR register */
188188 RCC -> PLL3DIVR = 0x00000000 ;
189189
190190 /* Reset PLL3FRACR register */
191191 RCC -> PLL3FRACR = 0x00000000 ;
192-
192+
193193 /* Reset HSEBYP bit */
194194 RCC -> CR &= 0xFFFBFFFFU ;
195195
@@ -221,7 +221,7 @@ void SystemInit (void)
221221 if ((DBGMCU -> IDCODE & 0xFFFF0000U ) < 0x20000000U )
222222 {
223223 /* if stm32h7 revY*/
224- /* Change the switch matrix read issuing capability to 1 for the AXI SRAM target (Target 7) */
224+ /* Change the switch matrix read issuing capability to 1 for the AXI SRAM target (Target 7) */
225225 * ((__IO uint32_t * )0x51008108 ) = 0x000000001U ;
226226 }
227227
@@ -230,7 +230,7 @@ void SystemInit (void)
230230 SCB -> VTOR = D1_AXISRAM_BASE | VECT_TAB_OFFSET ; /* Vector Table Relocation in Internal D1 AXI-RAM */
231231#else
232232 SCB -> VTOR = NVIC_FLASH_VECTOR_ADDRESS ; /* Vector Table Relocation in Internal FLASH */ // MBED PATCH for Bootloader
233- #endif
233+ #endif
234234
235235#endif /*DUAL_CORE && CORE_CM4*/
236236
@@ -241,33 +241,33 @@ void SystemInit (void)
241241 * The SystemCoreClock variable contains the core clock , it can
242242 * be used by the user application to setup the SysTick timer or configure
243243 * other parameters.
244- *
244+ *
245245 * @note Each time the core clock changes, this function must be called
246246 * to update SystemCoreClock variable value. Otherwise, any configuration
247- * based on this variable will be incorrect.
248- *
249- * @note - The system frequency computed by this function is not the real
250- * frequency in the chip. It is calculated based on the predefined
247+ * based on this variable will be incorrect.
248+ *
249+ * @note - The system frequency computed by this function is not the real
250+ * frequency in the chip. It is calculated based on the predefined
251251 * constant and the selected clock source:
252- *
253- * - If SYSCLK source is CSI, SystemCoreClock will contain the CSI_VALUE(*)
252+ *
253+ * - If SYSCLK source is CSI, SystemCoreClock will contain the CSI_VALUE(*)
254254 * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(**)
255- * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(***)
255+ * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(***)
256256 * - If SYSCLK source is PLL, SystemCoreClock will contain the CSI_VALUE(*),
257257 * HSI_VALUE(**) or HSE_VALUE(***) multiplied/divided by the PLL factors.
258258 *
259259 * (*) CSI_VALUE is a constant defined in stm32h7xx_hal.h file (default value
260260 * 4 MHz) but the real value may vary depending on the variations
261- * in voltage and temperature.
261+ * in voltage and temperature.
262262 * (**) HSI_VALUE is a constant defined in stm32h7xx_hal.h file (default value
263263 * 64 MHz) but the real value may vary depending on the variations
264- * in voltage and temperature.
265- *
264+ * in voltage and temperature.
265+ *
266266 * (***)HSE_VALUE is a constant defined in stm32h7xx_hal.h file (default value
267267 * 25 MHz), user has to ensure that HSE_VALUE is same as the real
268268 * frequency of the crystal used. Otherwise, this function may
269269 * have wrong result.
270- *
270+ *
271271 * - The result of this function could be not correct when using fractional
272272 * value for HSE crystal.
273273 * @param None
@@ -283,7 +283,7 @@ void SystemCoreClockUpdate (void)
283283 switch (RCC -> CFGR & RCC_CFGR_SWS )
284284 {
285285 case RCC_CFGR_SWS_HSI : /* HSI used as system clock source */
286- SystemCoreClock = (uint32_t ) (HSI_VALUE >> ((RCC -> CR & RCC_CR_HSIDIV )>> 3 ));
286+ SystemCoreClock = (uint32_t ) (HSI_VALUE >> ((RCC -> CR & RCC_CR_HSIDIV )>> 3 ));
287287 break ;
288288
289289 case RCC_CFGR_SWS_CSI : /* CSI used as system clock source */
@@ -306,27 +306,27 @@ void SystemCoreClockUpdate (void)
306306
307307 if (pllm != 0U )
308308 {
309- switch (pllsource )
310- {
309+ switch (pllsource )
310+ {
311311 case RCC_PLLCKSELR_PLLSRC_HSI : /* HSI used as PLL clock source */
312312
313- hsivalue = (HSI_VALUE >> ((RCC -> CR & RCC_CR_HSIDIV )>> 3 )) ;
313+ hsivalue = (HSI_VALUE >> ((RCC -> CR & RCC_CR_HSIDIV )>> 3 )) ;
314314 pllvco = ( (float_t )hsivalue / (float_t )pllm ) * ((float_t )(uint32_t )(RCC -> PLL1DIVR & RCC_PLL1DIVR_N1 ) + (fracn1 /(float_t )0x2000 ) + (float_t )1 );
315315
316- break ;
316+ break ;
317317
318318 case RCC_PLLCKSELR_PLLSRC_CSI : /* CSI used as PLL clock source */
319319 pllvco = ((float_t )CSI_VALUE / (float_t )pllm ) * ((float_t )(uint32_t )(RCC -> PLL1DIVR & RCC_PLL1DIVR_N1 ) + (fracn1 /(float_t )0x2000 ) + (float_t )1 );
320- break ;
320+ break ;
321321
322322 case RCC_PLLCKSELR_PLLSRC_HSE : /* HSE used as PLL clock source */
323323 pllvco = ((float_t )HSE_VALUE / (float_t )pllm ) * ((float_t )(uint32_t )(RCC -> PLL1DIVR & RCC_PLL1DIVR_N1 ) + (fracn1 /(float_t )0x2000 ) + (float_t )1 );
324- break ;
324+ break ;
325325
326- default :
326+ default :
327327 pllvco = ((float_t )CSI_VALUE / (float_t )pllm ) * ((float_t )(uint32_t )(RCC -> PLL1DIVR & RCC_PLL1DIVR_N1 ) + (fracn1 /(float_t )0x2000 ) + (float_t )1 );
328- break ;
329- }
328+ break ;
329+ }
330330 pllp = (((RCC -> PLL1DIVR & RCC_PLL1DIVR_P1 ) >>9 ) + 1U ) ;
331331 SystemCoreClock = (uint32_t )(float_t )(pllvco /(float_t )pllp );
332332 }
@@ -340,7 +340,7 @@ void SystemCoreClockUpdate (void)
340340 SystemCoreClock = CSI_VALUE ;
341341 break ;
342342 }
343-
343+
344344 /* Compute SystemClock frequency --------------------------------------------------*/
345345 tmp = D1CorePrescTable [(RCC -> D1CFGR & RCC_D1CFGR_D1CPRE )>> RCC_D1CFGR_D1CPRE_Pos ];
346346
@@ -351,7 +351,7 @@ void SystemCoreClockUpdate (void)
351351 SystemD2Clock = (SystemCoreClock >> ((D1CorePrescTable [(RCC -> D1CFGR & RCC_D1CFGR_HPRE )>> RCC_D1CFGR_HPRE_Pos ]) & 0x1FU ));
352352
353353}
354-
354+
355355
356356/**
357357 * @}
0 commit comments