4141 (+) Configure the AHB and APB buses pre-scalers
4242 (+) Enable the clock for the peripheral(s) to be used
4343 (+) Configure the clock kernel source(s) for peripherals which clocks are not
44- derived from the System clock through :RCC_D1CCIPR,RCC_D2CCIP1R,RCC_D2CCIP2R
45- and RCC_D3CCIPR registers
44+ derived from the System clock.
4645
4746 ##### RCC Limitations #####
4847 ==============================================================================
@@ -193,15 +192,10 @@ static HAL_StatusTypeDef RCC_PLL_Config(uint32_t PLLnumber, const RCC_PLLInitTyp
193192 HSE and PLL.
194193 The AHB clock (HCLK) is derived from System core clock through configurable
195194 pre-scaler and used to clock the CPU, memory and peripherals mapped
196- on AHB and APB bus of the 3 Domains (D1, D2, D3)* through configurable pre-scalers
195+ on AHB and APB bus through configurable pre-scalers
197196 and used to clock the peripherals mapped on these buses. You can use
198197 "HAL_RCC_GetSysClockFreq()" function to retrieve system clock frequency.
199198
200- -@- All the peripheral clocks are derived from the System clock (SYSCLK) except those
201- with dual clock domain where kernel source clock could be selected through
202- RCC_D1CCIPR,RCC_D2CCIP1R,RCC_D2CCIP2R and RCC_D3CCIPR registers.
203-
204- (*) : 2 Domains (CD and SRD) for stm32h7a3xx and stm32h7b3xx family lines.
205199@endverbatim
206200 * @{
207201 */
@@ -248,7 +242,7 @@ HAL_StatusTypeDef HAL_RCC_DeInit(void)
248242 /* Reset CFGR register (HSI is selected as system clock source) */
249243 CLEAR_REG (RCC -> CFGR );
250244
251- /* Update the SystemCoreClock and SystemD2Clock global variables */
245+ /* Update the SystemCoreClock global variables */
252246 SystemCoreClock = HSI_VALUE ;
253247
254248 /* Adapt Systick interrupt period */
@@ -874,8 +868,6 @@ HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
874868 * occur when the clock source will be ready.
875869 * You can use HAL_RCC_GetClockConfig() function to know which clock is
876870 * currently used as system clock source.
877- * @note Depending on the device voltage range, the software has to set correctly
878- * D1CPRE[3:0] bits to ensure that Domain1 core clock not exceed the maximum allowed frequency
879871 * (for more details refer to section above "Initialization/de-initialization functions")
880872 * @retval None
881873 */
@@ -1255,9 +1247,15 @@ void HAL_RCC_DisableCSS(void)
12551247 */
12561248uint32_t HAL_RCC_GetSysClockFreq (void )
12571249{
1258- uint32_t pllp , pllsource , pllm , pllfracen , hsivalue ;
1259- float_t fracn1 , pllvco ;
1260- uint32_t sysclockfreq , prescaler ;
1250+ uint32_t pllp ;
1251+ uint32_t pllsource ;
1252+ uint32_t pllm ;
1253+ uint32_t pllfracen ;
1254+ uint32_t hsivalue ;
1255+ float_t fracn1 ;
1256+ float_t pllvco ;
1257+ uint32_t sysclockfreq ;
1258+ uint32_t prescaler ;
12611259
12621260 /* Get SYSCLK source -------------------------------------------------------*/
12631261
@@ -1355,7 +1353,8 @@ uint32_t HAL_RCC_GetSysClockFreq(void)
13551353 */
13561354uint32_t HAL_RCC_GetHCLKFreq (void )
13571355{
1358- uint32_t clock , prescaler ;
1356+ uint32_t clock ;
1357+ uint32_t prescaler ;
13591358 const uint8_t AHBPrescTable [8 ] = {1U , 2U , 3U , 4U , 6U , 7U , 8U , 9U };
13601359
13611360 /* SysClk */
@@ -1377,7 +1376,8 @@ uint32_t HAL_RCC_GetHCLKFreq(void)
13771376 */
13781377uint32_t HAL_RCC_GetPCLK1Freq (void )
13791378{
1380- uint32_t clock , prescaler ;
1379+ uint32_t clock ;
1380+ uint32_t prescaler ;
13811381 /* Get HCLK source and compute PCLK1 frequency ---------------------------*/
13821382 clock = HAL_RCC_GetHCLKFreq ();
13831383 /* APB1 prescaler */
@@ -1397,7 +1397,8 @@ uint32_t HAL_RCC_GetPCLK1Freq(void)
13971397 */
13981398uint32_t HAL_RCC_GetPCLK2Freq (void )
13991399{
1400- uint32_t clock , prescaler ;
1400+ uint32_t clock ;
1401+ uint32_t prescaler ;
14011402 /* Get HCLK source and compute PCLK2 frequency ---------------------------*/
14021403 clock = HAL_RCC_GetHCLKFreq ();
14031404 /* APB2 prescaler */
@@ -1417,7 +1418,8 @@ uint32_t HAL_RCC_GetPCLK2Freq(void)
14171418 */
14181419uint32_t HAL_RCC_GetPCLK4Freq (void )
14191420{
1420- uint32_t clock , prescaler ;
1421+ uint32_t clock ;
1422+ uint32_t prescaler ;
14211423 /* Get HCLK source and compute PCLK4 frequency ---------------------------*/
14221424 clock = HAL_RCC_GetHCLKFreq ();
14231425 /* APB4 prescaler */
@@ -1437,7 +1439,8 @@ uint32_t HAL_RCC_GetPCLK4Freq(void)
14371439 */
14381440uint32_t HAL_RCC_GetPCLK5Freq (void )
14391441{
1440- uint32_t clock , prescaler ;
1442+ uint32_t clock ;
1443+ uint32_t prescaler ;
14411444 /* Get HCLK source and compute PCLK5 frequency ---------------------------*/
14421445 clock = HAL_RCC_GetHCLKFreq ();
14431446 /* APB5 prescaler */
@@ -2100,7 +2103,7 @@ static uint32_t RCC_PLL1_GetVCOOutputFreq(void)
21002103 uint32_t pllfracn ;
21012104 float_t frequency ;
21022105
2103- /* Get PLL1 CFGR and DIVR register values */
2106+ /* Get PLL1 CKSELR and DIVR register values */
21042107 tmpreg1 = RCC -> PLLCKSELR ;
21052108 tmpreg2 = RCC -> PLL1DIVR1 ;
21062109
@@ -2115,7 +2118,7 @@ static uint32_t RCC_PLL1_GetVCOOutputFreq(void)
21152118 }
21162119
21172120 /* Check if fractional part is enable */
2118- if ((tmpreg1 & RCC_PLLCFGR_PLL1FRACEN ) != 0U )
2121+ if ((RCC -> PLLCFGR & RCC_PLLCFGR_PLL1FRACEN ) != 0U )
21192122 {
21202123 pllfracn = (RCC -> PLL1FRACR & RCC_PLL1FRACR_FRACN ) >> RCC_PLL1FRACR_FRACN_Pos ;
21212124 }
@@ -2154,10 +2157,10 @@ static uint32_t RCC_PLL1_GetVCOOutputFreq(void)
21542157 pllsrc = 0U ;
21552158 break ;
21562159 }
2157-
2160+
21582161 /* Compute VCO output frequency */
21592162 frequency = ((float_t )pllsrc / (float_t )pllm ) * ((float_t )plln + ((float_t )pllfracn / (float_t )0x2000U ));
2160-
2163+
21612164 return (uint32_t )frequency ;
21622165}
21632166
@@ -2175,7 +2178,7 @@ static uint32_t RCC_PLL2_GetVCOOutputFreq(void)
21752178 uint32_t pllfracn ;
21762179 float_t frequency ;
21772180
2178- /* Get PLL2 CFGR and DIVR register values */
2181+ /* Get PLL2 CKSELR and DIVR register values */
21792182 tmpreg1 = RCC -> PLLCKSELR ;
21802183 tmpreg2 = RCC -> PLL2DIVR1 ;
21812184
@@ -2190,7 +2193,7 @@ static uint32_t RCC_PLL2_GetVCOOutputFreq(void)
21902193 }
21912194
21922195 /* Check if fractional part is enable */
2193- if ((tmpreg1 & RCC_PLLCFGR_PLL2FRACEN ) != 0U )
2196+ if ((RCC -> PLLCFGR & RCC_PLLCFGR_PLL2FRACEN ) != 0U )
21942197 {
21952198 pllfracn = (RCC -> PLL2FRACR & RCC_PLL2FRACR_FRACN ) >> RCC_PLL2FRACR_FRACN_Pos ;
21962199 }
@@ -2232,7 +2235,7 @@ static uint32_t RCC_PLL2_GetVCOOutputFreq(void)
22322235
22332236 /* Compute VCO output frequency */
22342237 frequency = ((float_t )pllsrc / (float_t )pllm ) * ((float_t )plln + ((float_t )pllfracn / (float_t )0x2000U ));
2235-
2238+
22362239 return (uint32_t )frequency ;
22372240}
22382241
@@ -2250,7 +2253,7 @@ static uint32_t RCC_PLL3_GetVCOOutputFreq(void)
22502253 uint32_t pllfracn ;
22512254 float_t frequency ;
22522255
2253- /* Get PLL3 CFGR and DIVR register values */
2256+ /* Get PLL3 CKSELR and DIVR register values */
22542257 tmpreg1 = RCC -> PLLCKSELR ;
22552258 tmpreg2 = RCC -> PLL3DIVR1 ;
22562259
@@ -2265,7 +2268,7 @@ static uint32_t RCC_PLL3_GetVCOOutputFreq(void)
22652268 }
22662269
22672270 /* Check if fractional part is enable */
2268- if ((tmpreg1 & RCC_PLLCFGR_PLL3FRACEN ) != 0U )
2271+ if ((RCC -> PLLCFGR & RCC_PLLCFGR_PLL3FRACEN ) != 0U )
22692272 {
22702273 pllfracn = (RCC -> PLL3FRACR & RCC_PLL3FRACR_FRACN ) >> RCC_PLL3FRACR_FRACN_Pos ;
22712274 }
@@ -2307,7 +2310,7 @@ static uint32_t RCC_PLL3_GetVCOOutputFreq(void)
23072310
23082311 /* Compute VCO output frequency */
23092312 frequency = ((float_t )pllsrc / (float_t )pllm ) * ((float_t )plln + ((float_t )pllfracn / (float_t )0x2000U ));
2310-
2313+
23112314 return (uint32_t )frequency ;
23122315}
23132316
0 commit comments