py32f0xx_ll_rcc.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. /**
  2. ******************************************************************************
  3. * @file py32f0xx_ll_rcc.c
  4. * @author MCU Application Team
  5. * @brief RCC LL module driver.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by Puya under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. * @attention
  19. *
  20. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  21. * All rights reserved.</center></h2>
  22. *
  23. * This software component is licensed by ST under BSD 3-Clause license,
  24. * the "License"; You may not use this file except in compliance with the
  25. * License. You may obtain a copy of the License at:
  26. * opensource.org/licenses/BSD-3-Clause
  27. *
  28. ******************************************************************************
  29. */
  30. #if defined(USE_FULL_LL_DRIVER)
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "py32f0xx_ll_rcc.h"
  33. #ifdef USE_FULL_ASSERT
  34. #include "py32_assert.h"
  35. #else
  36. #define assert_param(expr) ((void)0U)
  37. #endif
  38. /** @addtogroup PY32F0xx_LL_Driver
  39. * @{
  40. */
  41. #if defined(RCC)
  42. /** @addtogroup RCC_LL
  43. * @{
  44. */
  45. /* Private types -------------------------------------------------------------*/
  46. /* Private variables ---------------------------------------------------------*/
  47. /* Private constants ---------------------------------------------------------*/
  48. /* Private macros ------------------------------------------------------------*/
  49. /** @addtogroup RCC_LL_Private_Macros
  50. * @{
  51. */
  52. #define IS_LL_RCC_MCO_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_MCO1_CLKSOURCE))
  53. #if (defined(RCC_CCIPR_COMP1SEL) && defined(RCC_CCIPR_COMP2SEL))
  54. #define IS_LL_RCC_COMP_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_COMP1_CLKSOURCE) \
  55. || ((__VALUE__) == LL_RCC_COMP2_CLKSOURCE))
  56. #endif
  57. #if defined(RCC_CCIPR_LPTIMSEL)
  58. #define IS_LL_RCC_LPTIM_CLKSOURCE(__VALUE__) (((__VALUE__) == LL_RCC_LPTIM1_CLKSOURCE))
  59. #endif /* LPTIM1 */
  60. /**
  61. * @}
  62. */
  63. /* Private function prototypes -----------------------------------------------*/
  64. /** @defgroup RCC_LL_Private_Functions RCC Private functions
  65. * @{
  66. */
  67. uint32_t RCC_GetSystemClockFreq(void);
  68. uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency);
  69. uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency);
  70. #if defined(RCC_PLL_SUPPORT)
  71. uint32_t RCC_PLL_GetFreqDomain_SYS(void);
  72. #endif
  73. /**
  74. * @}
  75. */
  76. /* Exported functions --------------------------------------------------------*/
  77. /** @addtogroup RCC_LL_Exported_Functions
  78. * @{
  79. */
  80. /** @addtogroup RCC_LL_EF_Init
  81. * @{
  82. */
  83. /**
  84. * @brief Reset the RCC clock configuration to the default reset state.
  85. * @note The default reset state of the clock configuration is given below:
  86. * - HSI ON and used as system clock source
  87. * - HSE and PLL OFF
  88. * - AHB and APB1 prescaler set to 1.
  89. * - CSS, MCO OFF
  90. * - All interrupts disabled
  91. * @note This function does not modify the configuration of the
  92. * - Peripheral clocks
  93. * - LSI, LSE and RTC clocks
  94. * @retval An ErrorStatus enumeration value:
  95. * - SUCCESS: RCC registers are de-initialized
  96. * - ERROR: not applicable
  97. */
  98. ErrorStatus LL_RCC_DeInit(void)
  99. {
  100. /* Set HSION bit and wait for HSI READY bit */
  101. LL_RCC_HSI_Enable();
  102. while (LL_RCC_HSI_IsReady() != 1U)
  103. {}
  104. /* Set HSI_FS, HSITRIM bits to default value*/
  105. LL_RCC_HSI_SetCalibFreq(LL_RCC_HSICALIBRATION_8MHz);
  106. /* Reset CFGR register */
  107. LL_RCC_WriteReg(CFGR, 0x00000000U);
  108. /* Wait till SYSCLK is HSISYS */
  109. while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_HSISYS)
  110. {}
  111. /* Reset whole CR register but HSI in 2 steps in case HSEBYP is set */
  112. LL_RCC_WriteReg(CR, RCC_CR_HSION);
  113. while (LL_RCC_HSE_IsReady() != 0U)
  114. {}
  115. LL_RCC_WriteReg(CR, RCC_CR_HSION);
  116. #if defined(RCC_PLL_SUPPORT)
  117. /* Wait for PLL READY bit to be reset */
  118. while (LL_RCC_PLL_IsReady() != 0U)
  119. {}
  120. /* Reset PLLCFGR register */
  121. LL_RCC_WriteReg(PLLCFGR, 0x00000000U);
  122. #endif
  123. /* Disable all interrupts */
  124. LL_RCC_WriteReg(CIER, 0x00000000U);
  125. /* Clear all interrupts flags */
  126. LL_RCC_WriteReg(CICR, 0xFFFFFFFFU);
  127. return SUCCESS;
  128. }
  129. /**
  130. * @}
  131. */
  132. /** @addtogroup RCC_LL_EF_Get_Freq
  133. * @brief Return the frequencies of different on chip clocks; System, AHB and APB1 buses clocks
  134. * and different peripheral clocks available on the device.
  135. * @note If SYSCLK source is HSI, function returns values based on HSI_VALUE divided by HSI division factor(**)
  136. * @note If SYSCLK source is HSE, function returns values based on HSE_VALUE(***)
  137. * @note If SYSCLK source is PLL, function returns values based on HSE_VALUE(***)
  138. * or HSI_VALUE(**) multiplied/divided by the PLL factors.
  139. * @note (**) HSI_VALUE is a constant defined in this file (default value
  140. * 8 MHz) but the real value may vary depending on the variations
  141. * in voltage and temperature.
  142. * @note (***) HSE_VALUE is a constant defined in this file (default value
  143. * 8 MHz), user has to ensure that HSE_VALUE is same as the real
  144. * frequency of the crystal used. Otherwise, this function may
  145. * have wrong result.
  146. * @note The result of this function could be incorrect when using fractional
  147. * value for HSE crystal.
  148. * @note This function can be used by the user application to compute the
  149. * baud-rate for the communication peripherals or configure other parameters.
  150. * @{
  151. */
  152. /**
  153. * @brief Return the frequencies of different on chip clocks; System, AHB and APB1 buses clocks
  154. * @note Each time SYSCLK, HCLK and/or PCLK1 clock changes, this function
  155. * must be called to update structure fields. Otherwise, any
  156. * configuration based on this function will be incorrect.
  157. * @param RCC_Clocks pointer to a @ref LL_RCC_ClocksTypeDef structure which will hold the clocks frequencies
  158. * @retval None
  159. */
  160. void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks)
  161. {
  162. /* Get SYSCLK frequency */
  163. RCC_Clocks->SYSCLK_Frequency = RCC_GetSystemClockFreq();
  164. /* HCLK clock frequency */
  165. RCC_Clocks->HCLK_Frequency = RCC_GetHCLKClockFreq(RCC_Clocks->SYSCLK_Frequency);
  166. /* PCLK1 clock frequency */
  167. RCC_Clocks->PCLK1_Frequency = RCC_GetPCLK1ClockFreq(RCC_Clocks->HCLK_Frequency);
  168. }
  169. /**
  170. * @brief Return MCO clock frequency
  171. * @param MCOx This parameter can be one of the following values:
  172. * @arg @ref LL_RCC_MCO1_CLKSOURCE
  173. * @retval MCO clock frequency (in Hz)
  174. * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (HSE, LSI or LSE) is not ready
  175. * - @ref LL_RCC_PERIPH_FREQUENCY_NA indicates that no clock source selected
  176. */
  177. uint32_t LL_RCC_GetMCOClockFreq(uint32_t MCOx)
  178. {
  179. uint32_t mco_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
  180. /* Check parameter */
  181. assert_param(IS_LL_RCC_MCO_CLKSOURCE(MCOx));
  182. switch (LL_RCC_GetMCOClockSource(MCOx))
  183. {
  184. case LL_RCC_MCO1SOURCE_SYSCLK: /* MCO Clock is SYSCLK */
  185. mco_frequency = SystemCoreClock;
  186. break;
  187. case LL_RCC_MCO1SOURCE_HSI: /* MCO Clock is HSI */
  188. mco_frequency = LL_RCC_HSI_GetFreq();
  189. break;
  190. case LL_RCC_MCO1SOURCE_HSE: /* MCO Clock is HSE */
  191. if (LL_RCC_HSE_IsReady() == 1U)
  192. {
  193. mco_frequency = HSE_VALUE;
  194. }
  195. break;
  196. #if defined(RCC_PLL_SUPPORT)
  197. case LL_RCC_MCO1SOURCE_PLLCLK: /* MCO Clock is PLLCLK */
  198. mco_frequency = RCC_PLL_GetFreqDomain_SYS();
  199. break;
  200. #endif
  201. case LL_RCC_MCO1SOURCE_LSI: /* MCO Clock is LSI */
  202. if (LL_RCC_LSI_IsReady() == 1U)
  203. {
  204. mco_frequency = LSI_VALUE;
  205. }
  206. break;
  207. #if defined(RCC_LSE_SUPPORT)
  208. case LL_RCC_MCO1SOURCE_LSE: /* MCO Clock is LSE */
  209. if (LL_RCC_LSE_IsReady() == 1U)
  210. {
  211. mco_frequency = LSE_VALUE;
  212. }
  213. break;
  214. #endif
  215. case LL_RCC_MCO1SOURCE_NOCLOCK: /* No clock used as MCO clock source */
  216. default:
  217. mco_frequency = LL_RCC_PERIPH_FREQUENCY_NA;
  218. return mco_frequency;
  219. }
  220. mco_frequency = mco_frequency / (1U << (LL_RCC_GetMCODiv(MCOx) >> RCC_CFGR_MCOPRE_Pos));
  221. return mco_frequency;
  222. }
  223. /**
  224. * @brief Return LSC clock frequency
  225. * @retval LSC clock frequency (in Hz)
  226. * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (LSI or LSE) is not ready
  227. */
  228. uint32_t LL_RCC_GetLSCClockFreq(void)
  229. {
  230. #if defined(RCC_LSE_SUPPORT)
  231. uint32_t lsc_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
  232. switch (LL_RCC_LSCO_GetSource())
  233. {
  234. case LL_RCC_LSCO_CLKSOURCE_LSE: /* LSC Clock is LSE Osc. */
  235. if (LL_RCC_LSE_IsReady() == 1U)
  236. {
  237. lsc_frequency = LSE_VALUE;
  238. }
  239. break;
  240. case LL_RCC_LSCO_CLKSOURCE_LSI: /* LSC Clock is LSI Osc. */
  241. default:
  242. if (LL_RCC_LSI_IsReady() == 1U)
  243. {
  244. lsc_frequency = LSI_VALUE;
  245. }
  246. break;
  247. }
  248. return lsc_frequency;
  249. #else
  250. return LSI_VALUE;
  251. #endif
  252. }
  253. #if defined(RCC_CCIPR_PVDSEL)
  254. /**
  255. * @brief Return PVD clock frequency
  256. * @retval PVD clock frequency (in Hz)
  257. * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (PCLK1, LSI or LSE) is not ready
  258. */
  259. uint32_t LL_RCC_GetPVDClockFreq(void)
  260. {
  261. uint32_t pvd_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
  262. /* PVDCLK clock frequency */
  263. switch (LL_RCC_GetPVDClockSource())
  264. {
  265. case LL_RCC_PVD_CLKSOURCE_LSC: /* PVD Clock is LSC */
  266. pvd_frequency = LL_RCC_GetLSCClockFreq();
  267. break;
  268. case LL_RCC_PVD_CLKSOURCE_PCLK1: /* PVD Clock is PCLK1 */
  269. default:
  270. pvd_frequency = RCC_GetPCLK1ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq()));
  271. break;
  272. }
  273. return pvd_frequency;
  274. }
  275. #endif
  276. #if defined(COMP1)
  277. /**
  278. * @brief Return COMP clock frequency
  279. * @param COMPx This parameter can be one of the following values:
  280. * @arg @ref LL_RCC_COMP1_CLKSOURCE
  281. * @arg @ref LL_RCC_COMP2_CLKSOURCE
  282. * @retval COMP clock frequency (in Hz)
  283. * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (PCLK1, LSI or LSE) is not ready
  284. */
  285. uint32_t LL_RCC_GetCOMPClockFreq(uint32_t COMPx)
  286. {
  287. uint32_t comp_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
  288. /* Check parameter */
  289. assert_param(IS_LL_RCC_COMP_CLKSOURCE(COMPx));
  290. if (COMPx == LL_RCC_COMP1_CLKSOURCE)
  291. {
  292. /* COMP1CLK clock frequency */
  293. switch (LL_RCC_GetCOMPClockSource(COMPx))
  294. {
  295. case LL_RCC_COMP1_CLKSOURCE_LSC: /* COMP1 Clock is LSC */
  296. comp_frequency = LL_RCC_GetLSCClockFreq();
  297. break;
  298. case LL_RCC_COMP1_CLKSOURCE_PCLK1: /* COMP1 Clock is PCLK1 */
  299. default:
  300. comp_frequency = RCC_GetPCLK1ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq()));
  301. break;
  302. }
  303. }
  304. #if defined(COMP2)
  305. else
  306. {
  307. /* COMP2CLK clock frequency */
  308. switch (LL_RCC_GetCOMPClockSource(COMPx))
  309. {
  310. case LL_RCC_COMP2_CLKSOURCE_LSC: /* COMP2 Clock is LSC */
  311. comp_frequency = LL_RCC_GetLSCClockFreq();
  312. break;
  313. case LL_RCC_COMP2_CLKSOURCE_PCLK1: /* COMP2 Clock is PCLK1 */
  314. default:
  315. comp_frequency = RCC_GetPCLK1ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq()));
  316. break;
  317. }
  318. }
  319. #endif
  320. return comp_frequency;
  321. }
  322. #endif
  323. /**
  324. * @brief Return LPTIMx clock frequency
  325. * @param LPTIMx This parameter can be one of the following values:
  326. * @arg @ref LL_RCC_LPTIM1_CLKSOURCE
  327. * @retval LPTIM clock frequency (in Hz)
  328. * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillator (PCLK1, LSI or LSE) is not ready
  329. * - @ref LL_RCC_PERIPH_FREQUENCY_NA indicates that no clock source selected
  330. */
  331. uint32_t LL_RCC_GetLPTIMClockFreq(uint32_t LPTIMx)
  332. {
  333. uint32_t lptim_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
  334. /* Check parameter */
  335. assert_param(IS_LL_RCC_LPTIM_CLKSOURCE(LPTIMx));
  336. if (LPTIMx == LL_RCC_LPTIM1_CLKSOURCE)
  337. {
  338. /* LPTIM1CLK clock frequency */
  339. switch (LL_RCC_GetLPTIMClockSource(LPTIMx))
  340. {
  341. case LL_RCC_LPTIM1_CLKSOURCE_LSI: /* LPTIM1 Clock is LSI Osc. */
  342. if (LL_RCC_LSI_IsReady() == 1U)
  343. {
  344. lptim_frequency = LSI_VALUE;
  345. }
  346. break;
  347. case LL_RCC_LPTIM1_CLKSOURCE_NONE: /* No clock used as LPTIM1 clock source */
  348. lptim_frequency = LL_RCC_PERIPH_FREQUENCY_NA;
  349. break;
  350. #if defined(RCC_LSE_SUPPORT)
  351. case LL_RCC_LPTIM1_CLKSOURCE_LSE: /* LPTIM1 Clock is LSE Osc. */
  352. if (LL_RCC_LSE_IsReady() == 1U)
  353. {
  354. lptim_frequency = LSE_VALUE;
  355. }
  356. break;
  357. #endif
  358. case LL_RCC_LPTIM1_CLKSOURCE_PCLK1: /* LPTIM1 Clock is PCLK1 */
  359. default:
  360. lptim_frequency = RCC_GetPCLK1ClockFreq(RCC_GetHCLKClockFreq(RCC_GetSystemClockFreq()));
  361. break;
  362. }
  363. }
  364. return lptim_frequency;
  365. }
  366. #if defined(RCC_BDCR_RTCSEL)
  367. /**
  368. * @brief Return RTC clock frequency
  369. * @retval RTC clock frequency (in Hz)
  370. * - @ref LL_RCC_PERIPH_FREQUENCY_NO indicates that oscillators (LSI, LSE or HSE) are not ready
  371. * - @ref LL_RCC_PERIPH_FREQUENCY_NA indicates that no clock source selected
  372. */
  373. uint32_t LL_RCC_GetRTCClockFreq(void)
  374. {
  375. uint32_t rtc_frequency = LL_RCC_PERIPH_FREQUENCY_NO;
  376. /* RTCCLK clock frequency */
  377. switch (LL_RCC_GetRTCClockSource())
  378. {
  379. #if defined(RCC_LSE_SUPPORT)
  380. case LL_RCC_RTC_CLKSOURCE_LSE: /* LSE clock used as RTC clock source */
  381. if (LL_RCC_LSE_IsReady() == 1U)
  382. {
  383. rtc_frequency = LSE_VALUE;
  384. }
  385. break;
  386. #endif
  387. case LL_RCC_RTC_CLKSOURCE_LSI: /* LSI clock used as RTC clock source */
  388. if (LL_RCC_LSI_IsReady() == 1U)
  389. {
  390. rtc_frequency = LSI_VALUE;
  391. }
  392. break;
  393. case LL_RCC_RTC_CLKSOURCE_HSE_DIV128: /* HSE/128 clock used as RTC clock source */
  394. if (LL_RCC_HSE_IsReady() == 1U)
  395. {
  396. rtc_frequency = HSE_VALUE / 128U;
  397. }
  398. break;
  399. case LL_RCC_RTC_CLKSOURCE_NONE: /* No clock used as RTC clock source */
  400. default:
  401. rtc_frequency = LL_RCC_PERIPH_FREQUENCY_NA;
  402. break;
  403. }
  404. return rtc_frequency;
  405. }
  406. #endif
  407. /**
  408. * @}
  409. */
  410. /**
  411. * @}
  412. */
  413. /** @addtogroup RCC_LL_Private_Functions
  414. * @{
  415. */
  416. /**
  417. * @brief Return SYSTEM clock frequency
  418. * @retval SYSTEM clock frequency (in Hz)
  419. */
  420. uint32_t RCC_GetSystemClockFreq(void)
  421. {
  422. uint32_t frequency;
  423. /* Get SYSCLK source -------------------------------------------------------*/
  424. switch (LL_RCC_GetSysClkSource())
  425. {
  426. case LL_RCC_SYS_CLKSOURCE_STATUS_HSE: /* HSE used as system clock source */
  427. frequency = HSE_VALUE;
  428. break;
  429. #if defined(RCC_PLL_SUPPORT)
  430. case LL_RCC_SYS_CLKSOURCE_STATUS_PLL: /* PLL used as system clock source */
  431. frequency = RCC_PLL_GetFreqDomain_SYS();
  432. break;
  433. #endif
  434. case LL_RCC_SYS_CLKSOURCE_STATUS_LSI: /* LSI used as system clock source */
  435. frequency = LSI_VALUE;
  436. break;
  437. #if defined(RCC_LSE_SUPPORT)
  438. case LL_RCC_SYS_CLKSOURCE_STATUS_LSE: /* LSE used as system clock source */
  439. frequency = LSE_VALUE;
  440. break;
  441. #endif
  442. case LL_RCC_SYS_CLKSOURCE_STATUS_HSISYS: /* HSISYS used as system clock source */
  443. default:
  444. #if defined(RCC_HSIDIV_SUPPORT)
  445. frequency = __LL_RCC_CALC_HSI_FREQ(LL_RCC_GetHSIDiv());
  446. #else
  447. frequency = __LL_RCC_CALC_HSI_FREQ();
  448. #endif
  449. break;
  450. }
  451. return frequency;
  452. }
  453. /**
  454. * @brief Return HCLK clock frequency
  455. * @param SYSCLK_Frequency SYSCLK clock frequency
  456. * @retval HCLK clock frequency (in Hz)
  457. */
  458. uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
  459. {
  460. /* HCLK clock frequency */
  461. return __LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, LL_RCC_GetAHBPrescaler());
  462. }
  463. /**
  464. * @brief Return PCLK1 clock frequency
  465. * @param HCLK_Frequency HCLK clock frequency
  466. * @retval PCLK1 clock frequency (in Hz)
  467. */
  468. uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
  469. {
  470. /* PCLK1 clock frequency */
  471. return __LL_RCC_CALC_PCLK1_FREQ(HCLK_Frequency, LL_RCC_GetAPB1Prescaler());
  472. }
  473. #if defined(RCC_PLL_SUPPORT)
  474. /**
  475. * @brief Return PLL clock frequency used for system domain
  476. * @retval PLL clock frequency (in Hz)
  477. */
  478. uint32_t RCC_PLL_GetFreqDomain_SYS(void)
  479. {
  480. uint32_t pllinputfreq;
  481. uint32_t pllsource;
  482. pllsource = LL_RCC_PLL_GetMainSource();
  483. switch (pllsource)
  484. {
  485. case LL_RCC_PLLSOURCE_HSE: /* HSE used as PLL clock source */
  486. pllinputfreq = HSE_VALUE;
  487. break;
  488. case LL_RCC_PLLSOURCE_HSI: /* HSI used as PLL clock source */
  489. default:
  490. pllinputfreq = LL_RCC_HSI_GetFreq();
  491. break;
  492. }
  493. return __LL_RCC_CALC_PLLCLK_FREQ(pllinputfreq);
  494. }
  495. #endif
  496. /**
  497. * @}
  498. */
  499. /**
  500. * @}
  501. */
  502. #endif /* defined(RCC) */
  503. /**
  504. * @}
  505. */
  506. #endif /* USE_FULL_LL_DRIVER */
  507. /************************ (C) COPYRIGHT Puya*****END OF FILE****/