1 /**
2   ******************************************************************************
3   * @file    stm32f0xx_ll_rcc.h
4   * @author  MCD Application Team
5   * @brief   Header file of RCC LL module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2016 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file in
13   * the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   ******************************************************************************
16   */
17 
18 /* Define to prevent recursive inclusion -------------------------------------*/
19 #ifndef __STM32F0xx_LL_RCC_H
20 #define __STM32F0xx_LL_RCC_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /* Includes ------------------------------------------------------------------*/
27 #include "stm32f0xx.h"
28 
29 /** @addtogroup STM32F0xx_LL_Driver
30   * @{
31   */
32 
33 #if defined(RCC)
34 
35 /** @defgroup RCC_LL RCC
36   * @{
37   */
38 
39 /* Private types -------------------------------------------------------------*/
40 /* Private variables ---------------------------------------------------------*/
41 /* Private constants ---------------------------------------------------------*/
42 /** @defgroup RCC_LL_Private_Constants RCC Private Constants
43   * @{
44   */
45 /* Defines used for the bit position in the register and perform offsets*/
46 #define RCC_POSITION_HPRE       (uint32_t)4U  /*!< field position in register RCC_CFGR */
47 #define RCC_POSITION_PPRE1      (uint32_t)8U  /*!< field position in register RCC_CFGR */
48 #define RCC_POSITION_PLLMUL     (uint32_t)18U /*!< field position in register RCC_CFGR */
49 #define RCC_POSITION_HSICAL     (uint32_t)8U  /*!< field position in register RCC_CR */
50 #define RCC_POSITION_HSITRIM    (uint32_t)3U  /*!< field position in register RCC_CR */
51 #define RCC_POSITION_HSI14TRIM  (uint32_t)3U  /*!< field position in register RCC_CR2 */
52 #define RCC_POSITION_HSI14CAL   (uint32_t)8U  /*!< field position in register RCC_CR2 */
53 #if defined(RCC_HSI48_SUPPORT)
54 #define RCC_POSITION_HSI48CAL   (uint32_t)24U /*!< field position in register RCC_CR2 */
55 #endif /* RCC_HSI48_SUPPORT */
56 #define RCC_POSITION_USART1SW   (uint32_t)0U  /*!< field position in register RCC_CFGR3 */
57 #define RCC_POSITION_USART2SW   (uint32_t)16U /*!< field position in register RCC_CFGR3 */
58 #define RCC_POSITION_USART3SW   (uint32_t)18U /*!< field position in register RCC_CFGR3 */
59 
60 /**
61   * @}
62   */
63 
64 /* Private macros ------------------------------------------------------------*/
65 #if defined(USE_FULL_LL_DRIVER)
66 /** @defgroup RCC_LL_Private_Macros RCC Private Macros
67   * @{
68   */
69 /**
70   * @}
71   */
72 #endif /*USE_FULL_LL_DRIVER*/
73 /* Exported types ------------------------------------------------------------*/
74 #if defined(USE_FULL_LL_DRIVER)
75 /** @defgroup RCC_LL_Exported_Types RCC Exported Types
76   * @{
77   */
78 
79 /** @defgroup LL_ES_CLOCK_FREQ Clocks Frequency Structure
80   * @{
81   */
82 
83 /**
84   * @brief  RCC Clocks Frequency Structure
85   */
86 typedef struct
87 {
88   uint32_t SYSCLK_Frequency;        /*!< SYSCLK clock frequency */
89   uint32_t HCLK_Frequency;          /*!< HCLK clock frequency */
90   uint32_t PCLK1_Frequency;         /*!< PCLK1 clock frequency */
91 } LL_RCC_ClocksTypeDef;
92 
93 /**
94   * @}
95   */
96 
97 /**
98   * @}
99   */
100 #endif /* USE_FULL_LL_DRIVER */
101 
102 /* Exported constants --------------------------------------------------------*/
103 /** @defgroup RCC_LL_Exported_Constants RCC Exported Constants
104   * @{
105   */
106 
107 /** @defgroup RCC_LL_EC_OSC_VALUES Oscillator Values adaptation
108   * @brief    Defines used to adapt values of different oscillators
109   * @note     These values could be modified in the user environment according to
110   *           HW set-up.
111   * @{
112   */
113 #if !defined  (HSE_VALUE)
114 #define HSE_VALUE    8000000U  /*!< Value of the HSE oscillator in Hz */
115 #endif /* HSE_VALUE */
116 
117 #if !defined  (HSI_VALUE)
118 #define HSI_VALUE    8000000U  /*!< Value of the HSI oscillator in Hz */
119 #endif /* HSI_VALUE */
120 
121 #if !defined  (LSE_VALUE)
122 #define LSE_VALUE    32768U    /*!< Value of the LSE oscillator in Hz */
123 #endif /* LSE_VALUE */
124 
125 #if !defined  (LSI_VALUE)
126 #define LSI_VALUE    32000U    /*!< Value of the LSI oscillator in Hz */
127 #endif /* LSI_VALUE */
128 #if defined(RCC_HSI48_SUPPORT)
129 
130 #if !defined  (HSI48_VALUE)
131 #define HSI48_VALUE  48000000U /*!< Value of the HSI48 oscillator in Hz */
132 #endif /* HSI48_VALUE */
133 #endif /* RCC_HSI48_SUPPORT */
134 /**
135   * @}
136   */
137 
138 /** @defgroup RCC_LL_EC_CLEAR_FLAG Clear Flags Defines
139   * @brief    Flags defines which can be used with LL_RCC_WriteReg function
140   * @{
141   */
142 #define LL_RCC_CIR_LSIRDYC                RCC_CIR_LSIRDYC     /*!< LSI Ready Interrupt Clear */
143 #define LL_RCC_CIR_LSERDYC                RCC_CIR_LSERDYC     /*!< LSE Ready Interrupt Clear */
144 #define LL_RCC_CIR_HSIRDYC                RCC_CIR_HSIRDYC     /*!< HSI Ready Interrupt Clear */
145 #define LL_RCC_CIR_HSERDYC                RCC_CIR_HSERDYC     /*!< HSE Ready Interrupt Clear */
146 #define LL_RCC_CIR_PLLRDYC                RCC_CIR_PLLRDYC     /*!< PLL Ready Interrupt Clear */
147 #define LL_RCC_CIR_HSI14RDYC               RCC_CIR_HSI14RDYC  /*!< HSI14 Ready Interrupt Clear */
148 #if defined(RCC_HSI48_SUPPORT)
149 #define LL_RCC_CIR_HSI48RDYC               RCC_CIR_HSI48RDYC  /*!< HSI48 Ready Interrupt Clear */
150 #endif /* RCC_HSI48_SUPPORT */
151 #define LL_RCC_CIR_CSSC                   RCC_CIR_CSSC        /*!< Clock Security System Interrupt Clear */
152 /**
153   * @}
154   */
155 
156 /** @defgroup RCC_LL_EC_GET_FLAG Get Flags Defines
157   * @brief    Flags defines which can be used with LL_RCC_ReadReg function
158   * @{
159   */
160 #define LL_RCC_CIR_LSIRDYF                RCC_CIR_LSIRDYF     /*!< LSI Ready Interrupt flag */
161 #define LL_RCC_CIR_LSERDYF                RCC_CIR_LSERDYF     /*!< LSE Ready Interrupt flag */
162 #define LL_RCC_CIR_HSIRDYF                RCC_CIR_HSIRDYF     /*!< HSI Ready Interrupt flag */
163 #define LL_RCC_CIR_HSERDYF                RCC_CIR_HSERDYF     /*!< HSE Ready Interrupt flag */
164 #define LL_RCC_CIR_PLLRDYF                RCC_CIR_PLLRDYF     /*!< PLL Ready Interrupt flag */
165 #define LL_RCC_CIR_HSI14RDYF               RCC_CIR_HSI14RDYF  /*!< HSI14 Ready Interrupt flag */
166 #if defined(RCC_HSI48_SUPPORT)
167 #define LL_RCC_CIR_HSI48RDYF               RCC_CIR_HSI48RDYF  /*!< HSI48 Ready Interrupt flag */
168 #endif /* RCC_HSI48_SUPPORT */
169 #define LL_RCC_CIR_CSSF                   RCC_CIR_CSSF       /*!< Clock Security System Interrupt flag */
170 #define LL_RCC_CSR_OBLRSTF                RCC_CSR_OBLRSTF         /*!< OBL reset flag */
171 #define LL_RCC_CSR_PINRSTF                RCC_CSR_PINRSTF         /*!< PIN reset flag */
172 #define LL_RCC_CSR_PORRSTF                RCC_CSR_PORRSTF         /*!< POR/PDR reset flag */
173 #define LL_RCC_CSR_SFTRSTF                RCC_CSR_SFTRSTF         /*!< Software Reset flag */
174 #define LL_RCC_CSR_IWDGRSTF               RCC_CSR_IWDGRSTF        /*!< Independent Watchdog reset flag */
175 #define LL_RCC_CSR_WWDGRSTF               RCC_CSR_WWDGRSTF        /*!< Window watchdog reset flag */
176 #define LL_RCC_CSR_LPWRRSTF               RCC_CSR_LPWRRSTF        /*!< Low-Power reset flag */
177 #if defined(RCC_CSR_V18PWRRSTF)
178 #define LL_RCC_CSR_V18PWRRSTF             RCC_CSR_V18PWRRSTF      /*!< Reset flag of the 1.8 V domain. */
179 #endif /* RCC_CSR_V18PWRRSTF */
180 /**
181   * @}
182   */
183 
184 /** @defgroup RCC_LL_EC_IT IT Defines
185   * @brief    IT defines which can be used with LL_RCC_ReadReg and  LL_RCC_WriteReg functions
186   * @{
187   */
188 #define LL_RCC_CIR_LSIRDYIE               RCC_CIR_LSIRDYIE      /*!< LSI Ready Interrupt Enable */
189 #define LL_RCC_CIR_LSERDYIE               RCC_CIR_LSERDYIE      /*!< LSE Ready Interrupt Enable */
190 #define LL_RCC_CIR_HSIRDYIE               RCC_CIR_HSIRDYIE      /*!< HSI Ready Interrupt Enable */
191 #define LL_RCC_CIR_HSERDYIE               RCC_CIR_HSERDYIE      /*!< HSE Ready Interrupt Enable */
192 #define LL_RCC_CIR_PLLRDYIE               RCC_CIR_PLLRDYIE      /*!< PLL Ready Interrupt Enable */
193 #define LL_RCC_CIR_HSI14RDYIE              RCC_CIR_HSI14RDYIE   /*!< HSI14 Ready Interrupt Enable */
194 #if defined(RCC_HSI48_SUPPORT)
195 #define LL_RCC_CIR_HSI48RDYIE              RCC_CIR_HSI48RDYIE   /*!< HSI48 Ready Interrupt Enable */
196 #endif /* RCC_HSI48_SUPPORT */
197 /**
198   * @}
199   */
200 
201 /** @defgroup RCC_LL_EC_LSEDRIVE  LSE oscillator drive capability
202   * @{
203   */
204 #define LL_RCC_LSEDRIVE_LOW                ((uint32_t)0x00000000U) /*!< Xtal mode lower driving capability */
205 #define LL_RCC_LSEDRIVE_MEDIUMLOW          RCC_BDCR_LSEDRV_1 /*!< Xtal mode medium low driving capability */
206 #define LL_RCC_LSEDRIVE_MEDIUMHIGH         RCC_BDCR_LSEDRV_0 /*!< Xtal mode medium high driving capability */
207 #define LL_RCC_LSEDRIVE_HIGH               RCC_BDCR_LSEDRV   /*!< Xtal mode higher driving capability */
208 /**
209   * @}
210   */
211 
212 /** @defgroup RCC_LL_EC_SYS_CLKSOURCE  System clock switch
213   * @{
214   */
215 #define LL_RCC_SYS_CLKSOURCE_HSI           RCC_CFGR_SW_HSI    /*!< HSI selection as system clock */
216 #define LL_RCC_SYS_CLKSOURCE_HSE           RCC_CFGR_SW_HSE    /*!< HSE selection as system clock */
217 #define LL_RCC_SYS_CLKSOURCE_PLL           RCC_CFGR_SW_PLL    /*!< PLL selection as system clock */
218 #if defined(RCC_CFGR_SW_HSI48)
219 #define LL_RCC_SYS_CLKSOURCE_HSI48         RCC_CFGR_SW_HSI48  /*!< HSI48 selection as system clock */
220 #endif /* RCC_CFGR_SW_HSI48 */
221 /**
222   * @}
223   */
224 
225 /** @defgroup RCC_LL_EC_SYS_CLKSOURCE_STATUS  System clock switch status
226   * @{
227   */
228 #define LL_RCC_SYS_CLKSOURCE_STATUS_HSI    RCC_CFGR_SWS_HSI   /*!< HSI used as system clock */
229 #define LL_RCC_SYS_CLKSOURCE_STATUS_HSE    RCC_CFGR_SWS_HSE   /*!< HSE used as system clock */
230 #define LL_RCC_SYS_CLKSOURCE_STATUS_PLL    RCC_CFGR_SWS_PLL   /*!< PLL used as system clock */
231 #if defined(RCC_CFGR_SWS_HSI48)
232 #define LL_RCC_SYS_CLKSOURCE_STATUS_HSI48  RCC_CFGR_SWS_HSI48 /*!< HSI48 used as system clock */
233 #endif /* RCC_CFGR_SWS_HSI48 */
234 /**
235   * @}
236   */
237 
238 /** @defgroup RCC_LL_EC_SYSCLK_DIV  AHB prescaler
239   * @{
240   */
241 #define LL_RCC_SYSCLK_DIV_1                RCC_CFGR_HPRE_DIV1   /*!< SYSCLK not divided */
242 #define LL_RCC_SYSCLK_DIV_2                RCC_CFGR_HPRE_DIV2   /*!< SYSCLK divided by 2 */
243 #define LL_RCC_SYSCLK_DIV_4                RCC_CFGR_HPRE_DIV4   /*!< SYSCLK divided by 4 */
244 #define LL_RCC_SYSCLK_DIV_8                RCC_CFGR_HPRE_DIV8   /*!< SYSCLK divided by 8 */
245 #define LL_RCC_SYSCLK_DIV_16               RCC_CFGR_HPRE_DIV16  /*!< SYSCLK divided by 16 */
246 #define LL_RCC_SYSCLK_DIV_64               RCC_CFGR_HPRE_DIV64  /*!< SYSCLK divided by 64 */
247 #define LL_RCC_SYSCLK_DIV_128              RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */
248 #define LL_RCC_SYSCLK_DIV_256              RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */
249 #define LL_RCC_SYSCLK_DIV_512              RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */
250 /**
251   * @}
252   */
253 
254 /** @defgroup RCC_LL_EC_APB1_DIV  APB low-speed prescaler (APB1)
255   * @{
256   */
257 #define LL_RCC_APB1_DIV_1                  RCC_CFGR_PPRE_DIV1  /*!< HCLK not divided */
258 #define LL_RCC_APB1_DIV_2                  RCC_CFGR_PPRE_DIV2  /*!< HCLK divided by 2 */
259 #define LL_RCC_APB1_DIV_4                  RCC_CFGR_PPRE_DIV4  /*!< HCLK divided by 4 */
260 #define LL_RCC_APB1_DIV_8                  RCC_CFGR_PPRE_DIV8  /*!< HCLK divided by 8 */
261 #define LL_RCC_APB1_DIV_16                 RCC_CFGR_PPRE_DIV16 /*!< HCLK divided by 16 */
262 /**
263   * @}
264   */
265 
266 /** @defgroup RCC_LL_EC_MCO1SOURCE  MCO1 SOURCE selection
267   * @{
268   */
269 #define LL_RCC_MCO1SOURCE_NOCLOCK          RCC_CFGR_MCOSEL_NOCLOCK      /*!< MCO output disabled, no clock on MCO */
270 #define LL_RCC_MCO1SOURCE_HSI14            RCC_CFGR_MCOSEL_HSI14        /*!< HSI14 oscillator clock selected */
271 #define LL_RCC_MCO1SOURCE_SYSCLK           RCC_CFGR_MCOSEL_SYSCLK       /*!< SYSCLK selection as MCO source */
272 #define LL_RCC_MCO1SOURCE_HSI              RCC_CFGR_MCOSEL_HSI          /*!< HSI selection as MCO source */
273 #define LL_RCC_MCO1SOURCE_HSE              RCC_CFGR_MCOSEL_HSE          /*!< HSE selection as MCO source */
274 #define LL_RCC_MCO1SOURCE_LSI              RCC_CFGR_MCOSEL_LSI          /*!< LSI selection as MCO source */
275 #define LL_RCC_MCO1SOURCE_LSE              RCC_CFGR_MCOSEL_LSE          /*!< LSE selection as MCO source */
276 #if defined(RCC_CFGR_MCOSEL_HSI48)
277 #define LL_RCC_MCO1SOURCE_HSI48            RCC_CFGR_MCOSEL_HSI48        /*!< HSI48 selection as MCO source */
278 #endif /* RCC_CFGR_MCOSEL_HSI48 */
279 #define LL_RCC_MCO1SOURCE_PLLCLK_DIV_2     RCC_CFGR_MCOSEL_PLL_DIV2     /*!< PLL clock divided by 2*/
280 #if defined(RCC_CFGR_PLLNODIV)
281 #define LL_RCC_MCO1SOURCE_PLLCLK           (RCC_CFGR_MCOSEL_PLL_DIV2 | RCC_CFGR_PLLNODIV) /*!< PLL clock selected*/
282 #endif /* RCC_CFGR_PLLNODIV */
283 /**
284   * @}
285   */
286 
287 /** @defgroup RCC_LL_EC_MCO1_DIV  MCO1 prescaler
288   * @{
289   */
290 #define LL_RCC_MCO1_DIV_1                  ((uint32_t)0x00000000U)/*!< MCO Clock divided by 1 */
291 #if defined(RCC_CFGR_MCOPRE)
292 #define LL_RCC_MCO1_DIV_2                  RCC_CFGR_MCOPRE_DIV2   /*!< MCO Clock divided by 2 */
293 #define LL_RCC_MCO1_DIV_4                  RCC_CFGR_MCOPRE_DIV4   /*!< MCO Clock divided by 4 */
294 #define LL_RCC_MCO1_DIV_8                  RCC_CFGR_MCOPRE_DIV8   /*!< MCO Clock divided by 8 */
295 #define LL_RCC_MCO1_DIV_16                 RCC_CFGR_MCOPRE_DIV16  /*!< MCO Clock divided by 16 */
296 #define LL_RCC_MCO1_DIV_32                 RCC_CFGR_MCOPRE_DIV32  /*!< MCO Clock divided by 32 */
297 #define LL_RCC_MCO1_DIV_64                 RCC_CFGR_MCOPRE_DIV64  /*!< MCO Clock divided by 64 */
298 #define LL_RCC_MCO1_DIV_128                RCC_CFGR_MCOPRE_DIV128 /*!< MCO Clock divided by 128 */
299 #endif /* RCC_CFGR_MCOPRE */
300 /**
301   * @}
302   */
303 
304 #if defined(USE_FULL_LL_DRIVER)
305 /** @defgroup RCC_LL_EC_PERIPH_FREQUENCY Peripheral clock frequency
306   * @{
307   */
308 #define LL_RCC_PERIPH_FREQUENCY_NO         0x00000000U      /*!< No clock enabled for the peripheral            */
309 #define LL_RCC_PERIPH_FREQUENCY_NA         0xFFFFFFFFU      /*!< Frequency cannot be provided as external clock */
310 /**
311   * @}
312   */
313 #endif /* USE_FULL_LL_DRIVER */
314 
315 /** @defgroup RCC_LL_EC_USART1_CLKSOURCE Peripheral USART clock source selection
316   * @{
317   */
318 #define LL_RCC_USART1_CLKSOURCE_PCLK1      (uint32_t)((RCC_POSITION_USART1SW << 24) | RCC_CFGR3_USART1SW_PCLK)   /*!< PCLK1 clock used as USART1 clock source */
319 #define LL_RCC_USART1_CLKSOURCE_SYSCLK     (uint32_t)((RCC_POSITION_USART1SW << 24) | RCC_CFGR3_USART1SW_SYSCLK) /*!< System clock selected as USART1 clock source */
320 #define LL_RCC_USART1_CLKSOURCE_LSE        (uint32_t)((RCC_POSITION_USART1SW << 24) | RCC_CFGR3_USART1SW_LSE)    /*!< LSE oscillator clock used as USART1 clock source */
321 #define LL_RCC_USART1_CLKSOURCE_HSI        (uint32_t)((RCC_POSITION_USART1SW << 24) | RCC_CFGR3_USART1SW_HSI)    /*!< HSI oscillator clock used as USART1 clock source */
322 #if defined(RCC_CFGR3_USART2SW)
323 #define LL_RCC_USART2_CLKSOURCE_PCLK1      (uint32_t)((RCC_POSITION_USART2SW << 24) | RCC_CFGR3_USART2SW_PCLK)   /*!< PCLK1 clock used as USART2 clock source */
324 #define LL_RCC_USART2_CLKSOURCE_SYSCLK     (uint32_t)((RCC_POSITION_USART2SW << 24) | RCC_CFGR3_USART2SW_SYSCLK) /*!< System clock selected as USART2 clock source */
325 #define LL_RCC_USART2_CLKSOURCE_LSE        (uint32_t)((RCC_POSITION_USART2SW << 24) | RCC_CFGR3_USART2SW_LSE)    /*!< LSE oscillator clock used as USART2 clock source */
326 #define LL_RCC_USART2_CLKSOURCE_HSI        (uint32_t)((RCC_POSITION_USART2SW << 24) | RCC_CFGR3_USART2SW_HSI)    /*!< HSI oscillator clock used as USART2 clock source */
327 #endif /* RCC_CFGR3_USART2SW */
328 #if defined(RCC_CFGR3_USART3SW)
329 #define LL_RCC_USART3_CLKSOURCE_PCLK1      (uint32_t)((RCC_POSITION_USART3SW << 24) | RCC_CFGR3_USART3SW_PCLK)   /*!< PCLK1 clock used as USART3 clock source */
330 #define LL_RCC_USART3_CLKSOURCE_SYSCLK     (uint32_t)((RCC_POSITION_USART3SW << 24) | RCC_CFGR3_USART3SW_SYSCLK) /*!< System clock selected as USART3 clock source */
331 #define LL_RCC_USART3_CLKSOURCE_LSE        (uint32_t)((RCC_POSITION_USART3SW << 24) | RCC_CFGR3_USART3SW_LSE)    /*!< LSE oscillator clock used as USART3 clock source */
332 #define LL_RCC_USART3_CLKSOURCE_HSI        (uint32_t)((RCC_POSITION_USART3SW << 24) | RCC_CFGR3_USART3SW_HSI)    /*!< HSI oscillator clock used as USART3 clock source */
333 #endif /* RCC_CFGR3_USART3SW */
334 /**
335   * @}
336   */
337 
338 /** @defgroup RCC_LL_EC_I2C1_CLKSOURCE Peripheral I2C clock source selection
339   * @{
340   */
341 #define LL_RCC_I2C1_CLKSOURCE_HSI          RCC_CFGR3_I2C1SW_HSI    /*!< HSI oscillator clock used as I2C1 clock source */
342 #define LL_RCC_I2C1_CLKSOURCE_SYSCLK       RCC_CFGR3_I2C1SW_SYSCLK /*!< System clock selected as I2C1 clock source */
343 /**
344   * @}
345   */
346 
347 #if defined(CEC)
348 /** @defgroup RCC_LL_EC_CEC_CLKSOURCE Peripheral CEC clock source selection
349   * @{
350   */
351 #define LL_RCC_CEC_CLKSOURCE_HSI_DIV244    RCC_CFGR3_CECSW_HSI_DIV244 /*!< HSI clock divided by 244 selected as HDMI CEC entry clock source */
352 #define LL_RCC_CEC_CLKSOURCE_LSE           RCC_CFGR3_CECSW_LSE        /*!< LSE clock selected as HDMI CEC entry clock source */
353 /**
354   * @}
355   */
356 
357 #endif /* CEC */
358 
359 #if defined(USB)
360 /** @defgroup RCC_LL_EC_USB_CLKSOURCE Peripheral USB clock source selection
361   * @{
362   */
363 #if defined(RCC_CFGR3_USBSW_HSI48)
364 #define LL_RCC_USB_CLKSOURCE_HSI48         RCC_CFGR3_USBSW_HSI48   /*!< HSI48 oscillator clock used as USB clock source */
365 #else
366 #define LL_RCC_USB_CLKSOURCE_NONE          ((uint32_t)0x00000000)  /*!< USB Clock disabled */
367 #endif /*RCC_CFGR3_USBSW_HSI48*/
368 #define LL_RCC_USB_CLKSOURCE_PLL           RCC_CFGR3_USBSW_PLLCLK  /*!< PLL selected as USB clock source */
369 /**
370   * @}
371   */
372 
373 #endif /* USB */
374 
375 /** @defgroup RCC_LL_EC_USART1 Peripheral USART get clock source
376   * @{
377   */
378 #define LL_RCC_USART1_CLKSOURCE            RCC_POSITION_USART1SW /*!< USART1 Clock source selection */
379 #if defined(RCC_CFGR3_USART2SW)
380 #define LL_RCC_USART2_CLKSOURCE            RCC_POSITION_USART2SW /*!< USART2 Clock source selection */
381 #endif /* RCC_CFGR3_USART2SW */
382 #if defined(RCC_CFGR3_USART3SW)
383 #define LL_RCC_USART3_CLKSOURCE            RCC_POSITION_USART3SW /*!< USART3 Clock source selection */
384 #endif /* RCC_CFGR3_USART3SW */
385 /**
386   * @}
387   */
388 
389 /** @defgroup RCC_LL_EC_I2C1 Peripheral I2C get clock source
390   * @{
391   */
392 #define LL_RCC_I2C1_CLKSOURCE              RCC_CFGR3_I2C1SW     /*!< I2C1 Clock source selection */
393 /**
394   * @}
395   */
396 
397 #if defined(CEC)
398 /** @defgroup RCC_LL_EC_CEC Peripheral CEC get clock source
399   * @{
400   */
401 #define LL_RCC_CEC_CLKSOURCE               RCC_CFGR3_CECSW            /*!< CEC Clock source selection */
402 /**
403   * @}
404   */
405 #endif /* CEC */
406 
407 #if defined(USB)
408 /** @defgroup RCC_LL_EC_USB Peripheral USB get clock source
409   * @{
410   */
411 #define LL_RCC_USB_CLKSOURCE               RCC_CFGR3_USBSW         /*!< USB Clock source selection */
412 /**
413   * @}
414   */
415 #endif /* USB */
416 
417 /** @defgroup RCC_LL_EC_RTC_CLKSOURCE  RTC clock source selection
418   * @{
419   */
420 #define LL_RCC_RTC_CLKSOURCE_NONE          0x00000000U                   /*!< No clock used as RTC clock */
421 #define LL_RCC_RTC_CLKSOURCE_LSE           RCC_BDCR_RTCSEL_0       /*!< LSE oscillator clock used as RTC clock */
422 #define LL_RCC_RTC_CLKSOURCE_LSI           RCC_BDCR_RTCSEL_1       /*!< LSI oscillator clock used as RTC clock */
423 #define LL_RCC_RTC_CLKSOURCE_HSE_DIV32     RCC_BDCR_RTCSEL         /*!< HSE oscillator clock divided by 32 used as RTC clock */
424 /**
425   * @}
426   */
427 
428 /** @defgroup RCC_LL_EC_PLL_MUL PLL Multiplicator factor
429   * @{
430   */
431 #define LL_RCC_PLL_MUL_2                   RCC_CFGR_PLLMUL2  /*!< PLL input clock*2 */
432 #define LL_RCC_PLL_MUL_3                   RCC_CFGR_PLLMUL3  /*!< PLL input clock*3 */
433 #define LL_RCC_PLL_MUL_4                   RCC_CFGR_PLLMUL4  /*!< PLL input clock*4 */
434 #define LL_RCC_PLL_MUL_5                   RCC_CFGR_PLLMUL5  /*!< PLL input clock*5 */
435 #define LL_RCC_PLL_MUL_6                   RCC_CFGR_PLLMUL6  /*!< PLL input clock*6 */
436 #define LL_RCC_PLL_MUL_7                   RCC_CFGR_PLLMUL7  /*!< PLL input clock*7 */
437 #define LL_RCC_PLL_MUL_8                   RCC_CFGR_PLLMUL8  /*!< PLL input clock*8 */
438 #define LL_RCC_PLL_MUL_9                   RCC_CFGR_PLLMUL9  /*!< PLL input clock*9 */
439 #define LL_RCC_PLL_MUL_10                  RCC_CFGR_PLLMUL10  /*!< PLL input clock*10 */
440 #define LL_RCC_PLL_MUL_11                  RCC_CFGR_PLLMUL11  /*!< PLL input clock*11 */
441 #define LL_RCC_PLL_MUL_12                  RCC_CFGR_PLLMUL12  /*!< PLL input clock*12 */
442 #define LL_RCC_PLL_MUL_13                  RCC_CFGR_PLLMUL13  /*!< PLL input clock*13 */
443 #define LL_RCC_PLL_MUL_14                  RCC_CFGR_PLLMUL14  /*!< PLL input clock*14 */
444 #define LL_RCC_PLL_MUL_15                  RCC_CFGR_PLLMUL15  /*!< PLL input clock*15 */
445 #define LL_RCC_PLL_MUL_16                  RCC_CFGR_PLLMUL16  /*!< PLL input clock*16 */
446 /**
447   * @}
448   */
449 
450 /** @defgroup RCC_LL_EC_PLLSOURCE PLL SOURCE
451   * @{
452   */
453 #define LL_RCC_PLLSOURCE_NONE              0x00000000U                                   /*!< No clock selected as main PLL entry clock source */
454 #define LL_RCC_PLLSOURCE_HSE               RCC_CFGR_PLLSRC_HSE_PREDIV                    /*!< HSE/PREDIV clock selected as PLL entry clock source */
455 #if defined(RCC_PLLSRC_PREDIV1_SUPPORT)
456 #define LL_RCC_PLLSOURCE_HSI               RCC_CFGR_PLLSRC_HSI_PREDIV                    /*!< HSI/PREDIV clock selected as PLL entry clock source */
457 #if defined(RCC_CFGR_SW_HSI48)
458 #define LL_RCC_PLLSOURCE_HSI48             RCC_CFGR_PLLSRC_HSI48_PREDIV                  /*!< HSI48/PREDIV clock selected as PLL entry clock source */
459 #endif /* RCC_CFGR_SW_HSI48 */
460 #else
461 #define LL_RCC_PLLSOURCE_HSI_DIV_2         RCC_CFGR_PLLSRC_HSI_DIV2                      /*!< HSI clock divided by 2 selected as PLL entry clock source */
462 #define LL_RCC_PLLSOURCE_HSE_DIV_1         (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV1)    /*!< HSE clock selected as PLL entry clock source */
463 #define LL_RCC_PLLSOURCE_HSE_DIV_2         (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV2)    /*!< HSE/2 clock selected as PLL entry clock source */
464 #define LL_RCC_PLLSOURCE_HSE_DIV_3         (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV3)    /*!< HSE/3 clock selected as PLL entry clock source */
465 #define LL_RCC_PLLSOURCE_HSE_DIV_4         (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV4)    /*!< HSE/4 clock selected as PLL entry clock source */
466 #define LL_RCC_PLLSOURCE_HSE_DIV_5         (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV5)    /*!< HSE/5 clock selected as PLL entry clock source */
467 #define LL_RCC_PLLSOURCE_HSE_DIV_6         (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV6)    /*!< HSE/6 clock selected as PLL entry clock source */
468 #define LL_RCC_PLLSOURCE_HSE_DIV_7         (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV7)    /*!< HSE/7 clock selected as PLL entry clock source */
469 #define LL_RCC_PLLSOURCE_HSE_DIV_8         (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV8)    /*!< HSE/8 clock selected as PLL entry clock source */
470 #define LL_RCC_PLLSOURCE_HSE_DIV_9         (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV9)    /*!< HSE/9 clock selected as PLL entry clock source */
471 #define LL_RCC_PLLSOURCE_HSE_DIV_10        (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV10)   /*!< HSE/10 clock selected as PLL entry clock source */
472 #define LL_RCC_PLLSOURCE_HSE_DIV_11        (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV11)   /*!< HSE/11 clock selected as PLL entry clock source */
473 #define LL_RCC_PLLSOURCE_HSE_DIV_12        (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV12)   /*!< HSE/12 clock selected as PLL entry clock source */
474 #define LL_RCC_PLLSOURCE_HSE_DIV_13        (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV13)   /*!< HSE/13 clock selected as PLL entry clock source */
475 #define LL_RCC_PLLSOURCE_HSE_DIV_14        (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV14)   /*!< HSE/14 clock selected as PLL entry clock source */
476 #define LL_RCC_PLLSOURCE_HSE_DIV_15        (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV15)   /*!< HSE/15 clock selected as PLL entry clock source */
477 #define LL_RCC_PLLSOURCE_HSE_DIV_16        (RCC_CFGR_PLLSRC_HSE_PREDIV | RCC_CFGR2_PREDIV_DIV16)   /*!< HSE/16 clock selected as PLL entry clock source */
478 #endif /* RCC_PLLSRC_PREDIV1_SUPPORT */
479 /**
480   * @}
481   */
482 
483 /** @defgroup RCC_LL_EC_PREDIV_DIV PREDIV Division factor
484   * @{
485   */
486 #define LL_RCC_PREDIV_DIV_1                RCC_CFGR2_PREDIV_DIV1   /*!< PREDIV input clock not divided */
487 #define LL_RCC_PREDIV_DIV_2                RCC_CFGR2_PREDIV_DIV2   /*!< PREDIV input clock divided by 2 */
488 #define LL_RCC_PREDIV_DIV_3                RCC_CFGR2_PREDIV_DIV3   /*!< PREDIV input clock divided by 3 */
489 #define LL_RCC_PREDIV_DIV_4                RCC_CFGR2_PREDIV_DIV4   /*!< PREDIV input clock divided by 4 */
490 #define LL_RCC_PREDIV_DIV_5                RCC_CFGR2_PREDIV_DIV5   /*!< PREDIV input clock divided by 5 */
491 #define LL_RCC_PREDIV_DIV_6                RCC_CFGR2_PREDIV_DIV6   /*!< PREDIV input clock divided by 6 */
492 #define LL_RCC_PREDIV_DIV_7                RCC_CFGR2_PREDIV_DIV7   /*!< PREDIV input clock divided by 7 */
493 #define LL_RCC_PREDIV_DIV_8                RCC_CFGR2_PREDIV_DIV8   /*!< PREDIV input clock divided by 8 */
494 #define LL_RCC_PREDIV_DIV_9                RCC_CFGR2_PREDIV_DIV9   /*!< PREDIV input clock divided by 9 */
495 #define LL_RCC_PREDIV_DIV_10               RCC_CFGR2_PREDIV_DIV10  /*!< PREDIV input clock divided by 10 */
496 #define LL_RCC_PREDIV_DIV_11               RCC_CFGR2_PREDIV_DIV11  /*!< PREDIV input clock divided by 11 */
497 #define LL_RCC_PREDIV_DIV_12               RCC_CFGR2_PREDIV_DIV12  /*!< PREDIV input clock divided by 12 */
498 #define LL_RCC_PREDIV_DIV_13               RCC_CFGR2_PREDIV_DIV13  /*!< PREDIV input clock divided by 13 */
499 #define LL_RCC_PREDIV_DIV_14               RCC_CFGR2_PREDIV_DIV14  /*!< PREDIV input clock divided by 14 */
500 #define LL_RCC_PREDIV_DIV_15               RCC_CFGR2_PREDIV_DIV15  /*!< PREDIV input clock divided by 15 */
501 #define LL_RCC_PREDIV_DIV_16               RCC_CFGR2_PREDIV_DIV16  /*!< PREDIV input clock divided by 16 */
502 /**
503   * @}
504   */
505 
506 /**
507   * @}
508   */
509 
510 /* Exported macro ------------------------------------------------------------*/
511 /** @defgroup RCC_LL_Exported_Macros RCC Exported Macros
512   * @{
513   */
514 
515 /** @defgroup RCC_LL_EM_WRITE_READ Common Write and read registers Macros
516   * @{
517   */
518 
519 /**
520   * @brief  Write a value in RCC register
521   * @param  __REG__ Register to be written
522   * @param  __VALUE__ Value to be written in the register
523   * @retval None
524   */
525 #define LL_RCC_WriteReg(__REG__, __VALUE__) WRITE_REG(RCC->__REG__, (__VALUE__))
526 
527 /**
528   * @brief  Read a value in RCC register
529   * @param  __REG__ Register to be read
530   * @retval Register value
531   */
532 #define LL_RCC_ReadReg(__REG__) READ_REG(RCC->__REG__)
533 /**
534   * @}
535   */
536 
537 /** @defgroup RCC_LL_EM_CALC_FREQ Calculate frequencies
538   * @{
539   */
540 
541 #if defined(RCC_PLLSRC_PREDIV1_SUPPORT)
542 /**
543   * @brief  Helper macro to calculate the PLLCLK frequency
544   * @note ex: @ref __LL_RCC_CALC_PLLCLK_FREQ (HSE_VALUE, @ref LL_RCC_PLL_GetMultiplicator()
545   *             , @ref LL_RCC_PLL_GetPrediv());
546   * @param  __INPUTFREQ__ PLL Input frequency (based on HSE/HSI/HSI48)
547   * @param  __PLLMUL__ This parameter can be one of the following values:
548   *         @arg @ref LL_RCC_PLL_MUL_2
549   *         @arg @ref LL_RCC_PLL_MUL_3
550   *         @arg @ref LL_RCC_PLL_MUL_4
551   *         @arg @ref LL_RCC_PLL_MUL_5
552   *         @arg @ref LL_RCC_PLL_MUL_6
553   *         @arg @ref LL_RCC_PLL_MUL_7
554   *         @arg @ref LL_RCC_PLL_MUL_8
555   *         @arg @ref LL_RCC_PLL_MUL_9
556   *         @arg @ref LL_RCC_PLL_MUL_10
557   *         @arg @ref LL_RCC_PLL_MUL_11
558   *         @arg @ref LL_RCC_PLL_MUL_12
559   *         @arg @ref LL_RCC_PLL_MUL_13
560   *         @arg @ref LL_RCC_PLL_MUL_14
561   *         @arg @ref LL_RCC_PLL_MUL_15
562   *         @arg @ref LL_RCC_PLL_MUL_16
563   * @param  __PLLPREDIV__ This parameter can be one of the following values:
564   *         @arg @ref LL_RCC_PREDIV_DIV_1
565   *         @arg @ref LL_RCC_PREDIV_DIV_2
566   *         @arg @ref LL_RCC_PREDIV_DIV_3
567   *         @arg @ref LL_RCC_PREDIV_DIV_4
568   *         @arg @ref LL_RCC_PREDIV_DIV_5
569   *         @arg @ref LL_RCC_PREDIV_DIV_6
570   *         @arg @ref LL_RCC_PREDIV_DIV_7
571   *         @arg @ref LL_RCC_PREDIV_DIV_8
572   *         @arg @ref LL_RCC_PREDIV_DIV_9
573   *         @arg @ref LL_RCC_PREDIV_DIV_10
574   *         @arg @ref LL_RCC_PREDIV_DIV_11
575   *         @arg @ref LL_RCC_PREDIV_DIV_12
576   *         @arg @ref LL_RCC_PREDIV_DIV_13
577   *         @arg @ref LL_RCC_PREDIV_DIV_14
578   *         @arg @ref LL_RCC_PREDIV_DIV_15
579   *         @arg @ref LL_RCC_PREDIV_DIV_16
580   * @retval PLL clock frequency (in Hz)
581   */
582 #define __LL_RCC_CALC_PLLCLK_FREQ(__INPUTFREQ__, __PLLMUL__, __PLLPREDIV__) \
583           (((__INPUTFREQ__) / ((((__PLLPREDIV__) & RCC_CFGR2_PREDIV) + 1U))) * ((((__PLLMUL__) & RCC_CFGR_PLLMUL) >> RCC_POSITION_PLLMUL) + 2U))
584 
585 #else
586 /**
587   * @brief  Helper macro to calculate the PLLCLK frequency
588   * @note ex: @ref __LL_RCC_CALC_PLLCLK_FREQ (HSE_VALUE / (@ref LL_RCC_PLL_GetPrediv () + 1), @ref LL_RCC_PLL_GetMultiplicator());
589   * @param  __INPUTFREQ__ PLL Input frequency (based on HSE div Prediv / HSI div 2)
590   * @param  __PLLMUL__ This parameter can be one of the following values:
591   *         @arg @ref LL_RCC_PLL_MUL_2
592   *         @arg @ref LL_RCC_PLL_MUL_3
593   *         @arg @ref LL_RCC_PLL_MUL_4
594   *         @arg @ref LL_RCC_PLL_MUL_5
595   *         @arg @ref LL_RCC_PLL_MUL_6
596   *         @arg @ref LL_RCC_PLL_MUL_7
597   *         @arg @ref LL_RCC_PLL_MUL_8
598   *         @arg @ref LL_RCC_PLL_MUL_9
599   *         @arg @ref LL_RCC_PLL_MUL_10
600   *         @arg @ref LL_RCC_PLL_MUL_11
601   *         @arg @ref LL_RCC_PLL_MUL_12
602   *         @arg @ref LL_RCC_PLL_MUL_13
603   *         @arg @ref LL_RCC_PLL_MUL_14
604   *         @arg @ref LL_RCC_PLL_MUL_15
605   *         @arg @ref LL_RCC_PLL_MUL_16
606   * @retval PLL clock frequency (in Hz)
607   */
608 #define __LL_RCC_CALC_PLLCLK_FREQ(__INPUTFREQ__, __PLLMUL__) \
609           ((__INPUTFREQ__) * ((((__PLLMUL__) & RCC_CFGR_PLLMUL) >> RCC_POSITION_PLLMUL) + 2U))
610 #endif /* RCC_PLLSRC_PREDIV1_SUPPORT */
611 /**
612   * @brief  Helper macro to calculate the HCLK frequency
613   * @note: __AHBPRESCALER__ be retrieved by @ref LL_RCC_GetAHBPrescaler
614   *        ex: __LL_RCC_CALC_HCLK_FREQ(LL_RCC_GetAHBPrescaler())
615   * @param  __SYSCLKFREQ__ SYSCLK frequency (based on HSE/HSI/PLLCLK)
616   * @param  __AHBPRESCALER__ This parameter can be one of the following values:
617   *         @arg @ref LL_RCC_SYSCLK_DIV_1
618   *         @arg @ref LL_RCC_SYSCLK_DIV_2
619   *         @arg @ref LL_RCC_SYSCLK_DIV_4
620   *         @arg @ref LL_RCC_SYSCLK_DIV_8
621   *         @arg @ref LL_RCC_SYSCLK_DIV_16
622   *         @arg @ref LL_RCC_SYSCLK_DIV_64
623   *         @arg @ref LL_RCC_SYSCLK_DIV_128
624   *         @arg @ref LL_RCC_SYSCLK_DIV_256
625   *         @arg @ref LL_RCC_SYSCLK_DIV_512
626   * @retval HCLK clock frequency (in Hz)
627   */
628 #define __LL_RCC_CALC_HCLK_FREQ(__SYSCLKFREQ__, __AHBPRESCALER__) ((__SYSCLKFREQ__) >> AHBPrescTable[((__AHBPRESCALER__) & RCC_CFGR_HPRE) >>  RCC_CFGR_HPRE_Pos])
629 
630 /**
631   * @brief  Helper macro to calculate the PCLK1 frequency (ABP1)
632   * @note: __APB1PRESCALER__ be retrieved by @ref LL_RCC_GetAPB1Prescaler
633   *        ex: __LL_RCC_CALC_PCLK1_FREQ(LL_RCC_GetAPB1Prescaler())
634   * @param  __HCLKFREQ__ HCLK frequency
635   * @param  __APB1PRESCALER__ This parameter can be one of the following values:
636   *         @arg @ref LL_RCC_APB1_DIV_1
637   *         @arg @ref LL_RCC_APB1_DIV_2
638   *         @arg @ref LL_RCC_APB1_DIV_4
639   *         @arg @ref LL_RCC_APB1_DIV_8
640   *         @arg @ref LL_RCC_APB1_DIV_16
641   * @retval PCLK1 clock frequency (in Hz)
642   */
643 #define __LL_RCC_CALC_PCLK1_FREQ(__HCLKFREQ__, __APB1PRESCALER__) ((__HCLKFREQ__) >> APBPrescTable[(__APB1PRESCALER__) >>  RCC_CFGR_PPRE_Pos])
644 
645 /**
646   * @}
647   */
648 
649 /**
650   * @}
651   */
652 
653 /* Exported functions --------------------------------------------------------*/
654 /** @defgroup RCC_LL_Exported_Functions RCC Exported Functions
655   * @{
656   */
657 
658 /** @defgroup RCC_LL_EF_HSE HSE
659   * @{
660   */
661 
662 /**
663   * @brief  Enable the Clock Security System.
664   * @rmtoll CR           CSSON         LL_RCC_HSE_EnableCSS
665   * @retval None
666   */
LL_RCC_HSE_EnableCSS(void)667 __STATIC_INLINE void LL_RCC_HSE_EnableCSS(void)
668 {
669   SET_BIT(RCC->CR, RCC_CR_CSSON);
670 }
671 
672 /**
673   * @brief  Disable the Clock Security System.
674   * @note Cannot be disabled in HSE is ready (only by hardware)
675   * @rmtoll CR           CSSON         LL_RCC_HSE_DisableCSS
676   * @retval None
677   */
LL_RCC_HSE_DisableCSS(void)678 __STATIC_INLINE void LL_RCC_HSE_DisableCSS(void)
679 {
680   CLEAR_BIT(RCC->CR, RCC_CR_CSSON);
681 }
682 
683 /**
684   * @brief  Enable HSE external oscillator (HSE Bypass)
685   * @rmtoll CR           HSEBYP        LL_RCC_HSE_EnableBypass
686   * @retval None
687   */
LL_RCC_HSE_EnableBypass(void)688 __STATIC_INLINE void LL_RCC_HSE_EnableBypass(void)
689 {
690   SET_BIT(RCC->CR, RCC_CR_HSEBYP);
691 }
692 
693 /**
694   * @brief  Disable HSE external oscillator (HSE Bypass)
695   * @rmtoll CR           HSEBYP        LL_RCC_HSE_DisableBypass
696   * @retval None
697   */
LL_RCC_HSE_DisableBypass(void)698 __STATIC_INLINE void LL_RCC_HSE_DisableBypass(void)
699 {
700   CLEAR_BIT(RCC->CR, RCC_CR_HSEBYP);
701 }
702 
703 /**
704   * @brief  Enable HSE crystal oscillator (HSE ON)
705   * @rmtoll CR           HSEON         LL_RCC_HSE_Enable
706   * @retval None
707   */
LL_RCC_HSE_Enable(void)708 __STATIC_INLINE void LL_RCC_HSE_Enable(void)
709 {
710   SET_BIT(RCC->CR, RCC_CR_HSEON);
711 }
712 
713 /**
714   * @brief  Disable HSE crystal oscillator (HSE ON)
715   * @rmtoll CR           HSEON         LL_RCC_HSE_Disable
716   * @retval None
717   */
LL_RCC_HSE_Disable(void)718 __STATIC_INLINE void LL_RCC_HSE_Disable(void)
719 {
720   CLEAR_BIT(RCC->CR, RCC_CR_HSEON);
721 }
722 
723 /**
724   * @brief  Check if HSE oscillator Ready
725   * @rmtoll CR           HSERDY        LL_RCC_HSE_IsReady
726   * @retval State of bit (1 or 0).
727   */
LL_RCC_HSE_IsReady(void)728 __STATIC_INLINE uint32_t LL_RCC_HSE_IsReady(void)
729 {
730   return (READ_BIT(RCC->CR, RCC_CR_HSERDY) == (RCC_CR_HSERDY));
731 }
732 
733 /**
734   * @}
735   */
736 
737 /** @defgroup RCC_LL_EF_HSI HSI
738   * @{
739   */
740 
741 /**
742   * @brief  Enable HSI oscillator
743   * @rmtoll CR           HSION         LL_RCC_HSI_Enable
744   * @retval None
745   */
LL_RCC_HSI_Enable(void)746 __STATIC_INLINE void LL_RCC_HSI_Enable(void)
747 {
748   SET_BIT(RCC->CR, RCC_CR_HSION);
749 }
750 
751 /**
752   * @brief  Disable HSI oscillator
753   * @rmtoll CR           HSION         LL_RCC_HSI_Disable
754   * @retval None
755   */
LL_RCC_HSI_Disable(void)756 __STATIC_INLINE void LL_RCC_HSI_Disable(void)
757 {
758   CLEAR_BIT(RCC->CR, RCC_CR_HSION);
759 }
760 
761 /**
762   * @brief  Check if HSI clock is ready
763   * @rmtoll CR           HSIRDY        LL_RCC_HSI_IsReady
764   * @retval State of bit (1 or 0).
765   */
LL_RCC_HSI_IsReady(void)766 __STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
767 {
768   return (READ_BIT(RCC->CR, RCC_CR_HSIRDY) == (RCC_CR_HSIRDY));
769 }
770 
771 /**
772   * @brief  Get HSI Calibration value
773   * @note When HSITRIM is written, HSICAL is updated with the sum of
774   *       HSITRIM and the factory trim value
775   * @rmtoll CR        HSICAL        LL_RCC_HSI_GetCalibration
776   * @retval Between Min_Data = 0x00 and Max_Data = 0xFF
777   */
LL_RCC_HSI_GetCalibration(void)778 __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibration(void)
779 {
780   return (uint32_t)(READ_BIT(RCC->CR, RCC_CR_HSICAL) >> RCC_CR_HSICAL_Pos);
781 }
782 
783 /**
784   * @brief  Set HSI Calibration trimming
785   * @note user-programmable trimming value that is added to the HSICAL
786   * @note Default value is 16, which, when added to the HSICAL value,
787   *       should trim the HSI to 16 MHz +/- 1 %
788   * @rmtoll CR        HSITRIM       LL_RCC_HSI_SetCalibTrimming
789   * @param  Value between Min_Data = 0x00 and Max_Data = 0x1F
790   * @retval None
791   */
LL_RCC_HSI_SetCalibTrimming(uint32_t Value)792 __STATIC_INLINE void LL_RCC_HSI_SetCalibTrimming(uint32_t Value)
793 {
794   MODIFY_REG(RCC->CR, RCC_CR_HSITRIM, Value << RCC_CR_HSITRIM_Pos);
795 }
796 
797 /**
798   * @brief  Get HSI Calibration trimming
799   * @rmtoll CR        HSITRIM       LL_RCC_HSI_GetCalibTrimming
800   * @retval Between Min_Data = 0x00 and Max_Data = 0x1F
801   */
LL_RCC_HSI_GetCalibTrimming(void)802 __STATIC_INLINE uint32_t LL_RCC_HSI_GetCalibTrimming(void)
803 {
804   return (uint32_t)(READ_BIT(RCC->CR, RCC_CR_HSITRIM) >> RCC_CR_HSITRIM_Pos);
805 }
806 
807 /**
808   * @}
809   */
810 
811 #if defined(RCC_HSI48_SUPPORT)
812 /** @defgroup RCC_LL_EF_HSI48 HSI48
813   * @{
814   */
815 
816 /**
817   * @brief  Enable HSI48
818   * @rmtoll CR2          HSI48ON       LL_RCC_HSI48_Enable
819   * @retval None
820   */
LL_RCC_HSI48_Enable(void)821 __STATIC_INLINE void LL_RCC_HSI48_Enable(void)
822 {
823   SET_BIT(RCC->CR2, RCC_CR2_HSI48ON);
824 }
825 
826 /**
827   * @brief  Disable HSI48
828   * @rmtoll CR2          HSI48ON       LL_RCC_HSI48_Disable
829   * @retval None
830   */
LL_RCC_HSI48_Disable(void)831 __STATIC_INLINE void LL_RCC_HSI48_Disable(void)
832 {
833   CLEAR_BIT(RCC->CR2, RCC_CR2_HSI48ON);
834 }
835 
836 /**
837   * @brief  Check if HSI48 oscillator Ready
838   * @rmtoll CR2          HSI48RDY      LL_RCC_HSI48_IsReady
839   * @retval State of bit (1 or 0).
840   */
LL_RCC_HSI48_IsReady(void)841 __STATIC_INLINE uint32_t LL_RCC_HSI48_IsReady(void)
842 {
843   return (READ_BIT(RCC->CR2, RCC_CR2_HSI48RDY) == (RCC_CR2_HSI48RDY));
844 }
845 
846 /**
847   * @brief  Get HSI48 Calibration value
848   * @rmtoll CR2          HSI48CAL      LL_RCC_HSI48_GetCalibration
849   * @retval Between Min_Data = 0x00 and Max_Data = 0xFF
850   */
LL_RCC_HSI48_GetCalibration(void)851 __STATIC_INLINE uint32_t LL_RCC_HSI48_GetCalibration(void)
852 {
853   return (uint32_t)(READ_BIT(RCC->CR2, RCC_CR2_HSI48CAL) >> RCC_POSITION_HSI48CAL);
854 }
855 
856 /**
857   * @}
858   */
859 
860 #endif /* RCC_HSI48_SUPPORT */
861 
862 /** @defgroup RCC_LL_EF_HSI14 HSI14
863   * @{
864   */
865 
866 /**
867   * @brief  Enable HSI14
868   * @rmtoll CR2          HSI14ON       LL_RCC_HSI14_Enable
869   * @retval None
870   */
LL_RCC_HSI14_Enable(void)871 __STATIC_INLINE void LL_RCC_HSI14_Enable(void)
872 {
873   SET_BIT(RCC->CR2, RCC_CR2_HSI14ON);
874 }
875 
876 /**
877   * @brief  Disable HSI14
878   * @rmtoll CR2          HSI14ON       LL_RCC_HSI14_Disable
879   * @retval None
880   */
LL_RCC_HSI14_Disable(void)881 __STATIC_INLINE void LL_RCC_HSI14_Disable(void)
882 {
883   CLEAR_BIT(RCC->CR2, RCC_CR2_HSI14ON);
884 }
885 
886 /**
887   * @brief  Check if HSI14 oscillator Ready
888   * @rmtoll CR2          HSI14RDY      LL_RCC_HSI14_IsReady
889   * @retval State of bit (1 or 0).
890   */
LL_RCC_HSI14_IsReady(void)891 __STATIC_INLINE uint32_t LL_RCC_HSI14_IsReady(void)
892 {
893   return (READ_BIT(RCC->CR2, RCC_CR2_HSI14RDY) == (RCC_CR2_HSI14RDY));
894 }
895 
896 /**
897   * @brief  ADC interface can turn on the HSI14 oscillator
898   * @rmtoll CR2          HSI14DIS      LL_RCC_HSI14_EnableADCControl
899   * @retval None
900   */
LL_RCC_HSI14_EnableADCControl(void)901 __STATIC_INLINE void LL_RCC_HSI14_EnableADCControl(void)
902 {
903   CLEAR_BIT(RCC->CR2, RCC_CR2_HSI14DIS);
904 }
905 
906 /**
907   * @brief  ADC interface can not turn on the HSI14 oscillator
908   * @rmtoll CR2          HSI14DIS      LL_RCC_HSI14_DisableADCControl
909   * @retval None
910   */
LL_RCC_HSI14_DisableADCControl(void)911 __STATIC_INLINE void LL_RCC_HSI14_DisableADCControl(void)
912 {
913   SET_BIT(RCC->CR2, RCC_CR2_HSI14DIS);
914 }
915 
916 /**
917   * @brief  Set HSI14 Calibration trimming
918   * @note user-programmable trimming value that is added to the HSI14CAL
919   * @note Default value is 16, which, when added to the HSI14CAL value,
920   *       should trim the HSI14 to 14 MHz +/- 1 %
921   * @rmtoll CR2          HSI14TRIM     LL_RCC_HSI14_SetCalibTrimming
922   * @param  Value between Min_Data = 0x00 and Max_Data = 0xFF
923   * @retval None
924   */
LL_RCC_HSI14_SetCalibTrimming(uint32_t Value)925 __STATIC_INLINE void LL_RCC_HSI14_SetCalibTrimming(uint32_t Value)
926 {
927   MODIFY_REG(RCC->CR2, RCC_CR2_HSI14TRIM, Value << RCC_POSITION_HSI14TRIM);
928 }
929 
930 /**
931   * @brief  Get HSI14 Calibration value
932   * @note When HSI14TRIM is written, HSI14CAL is updated with the sum of
933   *       HSI14TRIM and the factory trim value
934   * @rmtoll CR2          HSI14TRIM     LL_RCC_HSI14_GetCalibTrimming
935   * @retval Between Min_Data = 0x00 and Max_Data = 0x1F
936   */
LL_RCC_HSI14_GetCalibTrimming(void)937 __STATIC_INLINE uint32_t LL_RCC_HSI14_GetCalibTrimming(void)
938 {
939   return (uint32_t)(READ_BIT(RCC->CR2, RCC_CR2_HSI14TRIM) >> RCC_POSITION_HSI14TRIM);
940 }
941 
942 /**
943   * @brief  Get HSI14 Calibration trimming
944   * @rmtoll CR2          HSI14CAL      LL_RCC_HSI14_GetCalibration
945   * @retval Between Min_Data = 0x00 and Max_Data = 0x1F
946   */
LL_RCC_HSI14_GetCalibration(void)947 __STATIC_INLINE uint32_t LL_RCC_HSI14_GetCalibration(void)
948 {
949   return (uint32_t)(READ_BIT(RCC->CR2, RCC_CR2_HSI14CAL) >> RCC_POSITION_HSI14CAL);
950 }
951 
952 /**
953   * @}
954   */
955 
956 /** @defgroup RCC_LL_EF_LSE LSE
957   * @{
958   */
959 
960 /**
961   * @brief  Enable  Low Speed External (LSE) crystal.
962   * @rmtoll BDCR         LSEON         LL_RCC_LSE_Enable
963   * @retval None
964   */
LL_RCC_LSE_Enable(void)965 __STATIC_INLINE void LL_RCC_LSE_Enable(void)
966 {
967   SET_BIT(RCC->BDCR, RCC_BDCR_LSEON);
968 }
969 
970 /**
971   * @brief  Disable  Low Speed External (LSE) crystal.
972   * @rmtoll BDCR         LSEON         LL_RCC_LSE_Disable
973   * @retval None
974   */
LL_RCC_LSE_Disable(void)975 __STATIC_INLINE void LL_RCC_LSE_Disable(void)
976 {
977   CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEON);
978 }
979 
980 /**
981   * @brief  Enable external clock source (LSE bypass).
982   * @rmtoll BDCR         LSEBYP        LL_RCC_LSE_EnableBypass
983   * @retval None
984   */
LL_RCC_LSE_EnableBypass(void)985 __STATIC_INLINE void LL_RCC_LSE_EnableBypass(void)
986 {
987   SET_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
988 }
989 
990 /**
991   * @brief  Disable external clock source (LSE bypass).
992   * @rmtoll BDCR         LSEBYP        LL_RCC_LSE_DisableBypass
993   * @retval None
994   */
LL_RCC_LSE_DisableBypass(void)995 __STATIC_INLINE void LL_RCC_LSE_DisableBypass(void)
996 {
997   CLEAR_BIT(RCC->BDCR, RCC_BDCR_LSEBYP);
998 }
999 
1000 /**
1001   * @brief  Set LSE oscillator drive capability
1002   * @note The oscillator is in Xtal mode when it is not in bypass mode.
1003   * @rmtoll BDCR         LSEDRV        LL_RCC_LSE_SetDriveCapability
1004   * @param  LSEDrive This parameter can be one of the following values:
1005   *         @arg @ref LL_RCC_LSEDRIVE_LOW
1006   *         @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
1007   *         @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
1008   *         @arg @ref LL_RCC_LSEDRIVE_HIGH
1009   * @retval None
1010   */
LL_RCC_LSE_SetDriveCapability(uint32_t LSEDrive)1011 __STATIC_INLINE void LL_RCC_LSE_SetDriveCapability(uint32_t LSEDrive)
1012 {
1013   MODIFY_REG(RCC->BDCR, RCC_BDCR_LSEDRV, LSEDrive);
1014 }
1015 
1016 /**
1017   * @brief  Get LSE oscillator drive capability
1018   * @rmtoll BDCR         LSEDRV        LL_RCC_LSE_GetDriveCapability
1019   * @retval Returned value can be one of the following values:
1020   *         @arg @ref LL_RCC_LSEDRIVE_LOW
1021   *         @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
1022   *         @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
1023   *         @arg @ref LL_RCC_LSEDRIVE_HIGH
1024   */
LL_RCC_LSE_GetDriveCapability(void)1025 __STATIC_INLINE uint32_t LL_RCC_LSE_GetDriveCapability(void)
1026 {
1027   return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_LSEDRV));
1028 }
1029 
1030 /**
1031   * @brief  Check if LSE oscillator Ready
1032   * @rmtoll BDCR         LSERDY        LL_RCC_LSE_IsReady
1033   * @retval State of bit (1 or 0).
1034   */
LL_RCC_LSE_IsReady(void)1035 __STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)
1036 {
1037   return (READ_BIT(RCC->BDCR, RCC_BDCR_LSERDY) == (RCC_BDCR_LSERDY));
1038 }
1039 
1040 /**
1041   * @}
1042   */
1043 
1044 /** @defgroup RCC_LL_EF_LSI LSI
1045   * @{
1046   */
1047 
1048 /**
1049   * @brief  Enable LSI Oscillator
1050   * @rmtoll CSR          LSION         LL_RCC_LSI_Enable
1051   * @retval None
1052   */
LL_RCC_LSI_Enable(void)1053 __STATIC_INLINE void LL_RCC_LSI_Enable(void)
1054 {
1055   SET_BIT(RCC->CSR, RCC_CSR_LSION);
1056 }
1057 
1058 /**
1059   * @brief  Disable LSI Oscillator
1060   * @rmtoll CSR          LSION         LL_RCC_LSI_Disable
1061   * @retval None
1062   */
LL_RCC_LSI_Disable(void)1063 __STATIC_INLINE void LL_RCC_LSI_Disable(void)
1064 {
1065   CLEAR_BIT(RCC->CSR, RCC_CSR_LSION);
1066 }
1067 
1068 /**
1069   * @brief  Check if LSI is Ready
1070   * @rmtoll CSR          LSIRDY        LL_RCC_LSI_IsReady
1071   * @retval State of bit (1 or 0).
1072   */
LL_RCC_LSI_IsReady(void)1073 __STATIC_INLINE uint32_t LL_RCC_LSI_IsReady(void)
1074 {
1075   return (READ_BIT(RCC->CSR, RCC_CSR_LSIRDY) == (RCC_CSR_LSIRDY));
1076 }
1077 
1078 /**
1079   * @}
1080   */
1081 
1082 /** @defgroup RCC_LL_EF_System System
1083   * @{
1084   */
1085 
1086 /**
1087   * @brief  Configure the system clock source
1088   * @rmtoll CFGR         SW            LL_RCC_SetSysClkSource
1089   * @param  Source This parameter can be one of the following values:
1090   *         @arg @ref LL_RCC_SYS_CLKSOURCE_HSI
1091   *         @arg @ref LL_RCC_SYS_CLKSOURCE_HSE
1092   *         @arg @ref LL_RCC_SYS_CLKSOURCE_PLL
1093   *         @arg @ref LL_RCC_SYS_CLKSOURCE_HSI48 (*)
1094   *
1095   *         (*) value not defined in all devices
1096   * @retval None
1097   */
LL_RCC_SetSysClkSource(uint32_t Source)1098 __STATIC_INLINE void LL_RCC_SetSysClkSource(uint32_t Source)
1099 {
1100   MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, Source);
1101 }
1102 
1103 /**
1104   * @brief  Get the system clock source
1105   * @rmtoll CFGR         SWS           LL_RCC_GetSysClkSource
1106   * @retval Returned value can be one of the following values:
1107   *         @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI
1108   *         @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE
1109   *         @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL
1110   *         @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI48 (*)
1111   *
1112   *         (*) value not defined in all devices
1113   */
LL_RCC_GetSysClkSource(void)1114 __STATIC_INLINE uint32_t LL_RCC_GetSysClkSource(void)
1115 {
1116   return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS));
1117 }
1118 
1119 /**
1120   * @brief  Set AHB prescaler
1121   * @rmtoll CFGR         HPRE          LL_RCC_SetAHBPrescaler
1122   * @param  Prescaler This parameter can be one of the following values:
1123   *         @arg @ref LL_RCC_SYSCLK_DIV_1
1124   *         @arg @ref LL_RCC_SYSCLK_DIV_2
1125   *         @arg @ref LL_RCC_SYSCLK_DIV_4
1126   *         @arg @ref LL_RCC_SYSCLK_DIV_8
1127   *         @arg @ref LL_RCC_SYSCLK_DIV_16
1128   *         @arg @ref LL_RCC_SYSCLK_DIV_64
1129   *         @arg @ref LL_RCC_SYSCLK_DIV_128
1130   *         @arg @ref LL_RCC_SYSCLK_DIV_256
1131   *         @arg @ref LL_RCC_SYSCLK_DIV_512
1132   * @retval None
1133   */
LL_RCC_SetAHBPrescaler(uint32_t Prescaler)1134 __STATIC_INLINE void LL_RCC_SetAHBPrescaler(uint32_t Prescaler)
1135 {
1136   MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, Prescaler);
1137 }
1138 
1139 /**
1140   * @brief  Set APB1 prescaler
1141   * @rmtoll CFGR         PPRE         LL_RCC_SetAPB1Prescaler
1142   * @param  Prescaler This parameter can be one of the following values:
1143   *         @arg @ref LL_RCC_APB1_DIV_1
1144   *         @arg @ref LL_RCC_APB1_DIV_2
1145   *         @arg @ref LL_RCC_APB1_DIV_4
1146   *         @arg @ref LL_RCC_APB1_DIV_8
1147   *         @arg @ref LL_RCC_APB1_DIV_16
1148   * @retval None
1149   */
LL_RCC_SetAPB1Prescaler(uint32_t Prescaler)1150 __STATIC_INLINE void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler)
1151 {
1152   MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE, Prescaler);
1153 }
1154 
1155 /**
1156   * @brief  Get AHB prescaler
1157   * @rmtoll CFGR         HPRE          LL_RCC_GetAHBPrescaler
1158   * @retval Returned value can be one of the following values:
1159   *         @arg @ref LL_RCC_SYSCLK_DIV_1
1160   *         @arg @ref LL_RCC_SYSCLK_DIV_2
1161   *         @arg @ref LL_RCC_SYSCLK_DIV_4
1162   *         @arg @ref LL_RCC_SYSCLK_DIV_8
1163   *         @arg @ref LL_RCC_SYSCLK_DIV_16
1164   *         @arg @ref LL_RCC_SYSCLK_DIV_64
1165   *         @arg @ref LL_RCC_SYSCLK_DIV_128
1166   *         @arg @ref LL_RCC_SYSCLK_DIV_256
1167   *         @arg @ref LL_RCC_SYSCLK_DIV_512
1168   */
LL_RCC_GetAHBPrescaler(void)1169 __STATIC_INLINE uint32_t LL_RCC_GetAHBPrescaler(void)
1170 {
1171   return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_HPRE));
1172 }
1173 
1174 /**
1175   * @brief  Get APB1 prescaler
1176   * @rmtoll CFGR         PPRE         LL_RCC_GetAPB1Prescaler
1177   * @retval Returned value can be one of the following values:
1178   *         @arg @ref LL_RCC_APB1_DIV_1
1179   *         @arg @ref LL_RCC_APB1_DIV_2
1180   *         @arg @ref LL_RCC_APB1_DIV_4
1181   *         @arg @ref LL_RCC_APB1_DIV_8
1182   *         @arg @ref LL_RCC_APB1_DIV_16
1183   */
LL_RCC_GetAPB1Prescaler(void)1184 __STATIC_INLINE uint32_t LL_RCC_GetAPB1Prescaler(void)
1185 {
1186   return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PPRE));
1187 }
1188 
1189 /**
1190   * @}
1191   */
1192 
1193 /** @defgroup RCC_LL_EF_MCO MCO
1194   * @{
1195   */
1196 
1197 /**
1198   * @brief  Configure MCOx
1199   * @rmtoll CFGR         MCO           LL_RCC_ConfigMCO\n
1200   *         CFGR         MCOPRE        LL_RCC_ConfigMCO\n
1201   *         CFGR         PLLNODIV      LL_RCC_ConfigMCO
1202   * @param  MCOxSource This parameter can be one of the following values:
1203   *         @arg @ref LL_RCC_MCO1SOURCE_NOCLOCK
1204   *         @arg @ref LL_RCC_MCO1SOURCE_HSI14
1205   *         @arg @ref LL_RCC_MCO1SOURCE_SYSCLK
1206   *         @arg @ref LL_RCC_MCO1SOURCE_HSI
1207   *         @arg @ref LL_RCC_MCO1SOURCE_HSE
1208   *         @arg @ref LL_RCC_MCO1SOURCE_LSI
1209   *         @arg @ref LL_RCC_MCO1SOURCE_LSE
1210   *         @arg @ref LL_RCC_MCO1SOURCE_HSI48 (*)
1211   *         @arg @ref LL_RCC_MCO1SOURCE_PLLCLK (*)
1212   *         @arg @ref LL_RCC_MCO1SOURCE_PLLCLK_DIV_2
1213   *
1214   *         (*) value not defined in all devices
1215   * @param  MCOxPrescaler This parameter can be one of the following values:
1216   *         @arg @ref LL_RCC_MCO1_DIV_1
1217   *         @arg @ref LL_RCC_MCO1_DIV_2 (*)
1218   *         @arg @ref LL_RCC_MCO1_DIV_4 (*)
1219   *         @arg @ref LL_RCC_MCO1_DIV_8 (*)
1220   *         @arg @ref LL_RCC_MCO1_DIV_16 (*)
1221   *         @arg @ref LL_RCC_MCO1_DIV_32 (*)
1222   *         @arg @ref LL_RCC_MCO1_DIV_64 (*)
1223   *         @arg @ref LL_RCC_MCO1_DIV_128 (*)
1224   *
1225   *         (*) value not defined in all devices
1226   * @retval None
1227   */
LL_RCC_ConfigMCO(uint32_t MCOxSource,uint32_t MCOxPrescaler)1228 __STATIC_INLINE void LL_RCC_ConfigMCO(uint32_t MCOxSource, uint32_t MCOxPrescaler)
1229 {
1230 #if defined(RCC_CFGR_MCOPRE)
1231 #if defined(RCC_CFGR_PLLNODIV)
1232   MODIFY_REG(RCC->CFGR, RCC_CFGR_MCOSEL | RCC_CFGR_MCOPRE | RCC_CFGR_PLLNODIV, MCOxSource | MCOxPrescaler);
1233 #else
1234   MODIFY_REG(RCC->CFGR, RCC_CFGR_MCOSEL | RCC_CFGR_MCOPRE, MCOxSource | MCOxPrescaler);
1235 #endif /* RCC_CFGR_PLLNODIV */
1236 #else
1237   MODIFY_REG(RCC->CFGR, RCC_CFGR_MCOSEL, MCOxSource);
1238 #endif /* RCC_CFGR_MCOPRE */
1239 }
1240 
1241 /**
1242   * @}
1243   */
1244 
1245 /** @defgroup RCC_LL_EF_Peripheral_Clock_Source Peripheral Clock Source
1246   * @{
1247   */
1248 
1249 /**
1250   * @brief  Configure USARTx clock source
1251   * @rmtoll CFGR3        USART1SW      LL_RCC_SetUSARTClockSource\n
1252   *         CFGR3        USART2SW      LL_RCC_SetUSARTClockSource\n
1253   *         CFGR3        USART3SW      LL_RCC_SetUSARTClockSource
1254   * @param  USARTxSource This parameter can be one of the following values:
1255   *         @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK1
1256   *         @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
1257   *         @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
1258   *         @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
1259   *         @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1 (*)
1260   *         @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK (*)
1261   *         @arg @ref LL_RCC_USART2_CLKSOURCE_LSE (*)
1262   *         @arg @ref LL_RCC_USART2_CLKSOURCE_HSI (*)
1263   *         @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1 (*)
1264   *         @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK (*)
1265   *         @arg @ref LL_RCC_USART3_CLKSOURCE_LSE (*)
1266   *         @arg @ref LL_RCC_USART3_CLKSOURCE_HSI (*)
1267   *
1268   *         (*) value not defined in all devices.
1269   * @retval None
1270   */
LL_RCC_SetUSARTClockSource(uint32_t USARTxSource)1271 __STATIC_INLINE void LL_RCC_SetUSARTClockSource(uint32_t USARTxSource)
1272 {
1273   MODIFY_REG(RCC->CFGR3, (RCC_CFGR3_USART1SW << ((USARTxSource  & 0xFF000000U) >> 24U)), (USARTxSource & 0x00FFFFFFU));
1274 }
1275 
1276 /**
1277   * @brief  Configure I2Cx clock source
1278   * @rmtoll CFGR3        I2C1SW        LL_RCC_SetI2CClockSource
1279   * @param  I2CxSource This parameter can be one of the following values:
1280   *         @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
1281   *         @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
1282   * @retval None
1283   */
LL_RCC_SetI2CClockSource(uint32_t I2CxSource)1284 __STATIC_INLINE void LL_RCC_SetI2CClockSource(uint32_t I2CxSource)
1285 {
1286   MODIFY_REG(RCC->CFGR3, RCC_CFGR3_I2C1SW, I2CxSource);
1287 }
1288 
1289 #if defined(CEC)
1290 /**
1291   * @brief  Configure CEC clock source
1292   * @rmtoll CFGR3        CECSW         LL_RCC_SetCECClockSource
1293   * @param  CECxSource This parameter can be one of the following values:
1294   *         @arg @ref LL_RCC_CEC_CLKSOURCE_HSI_DIV244
1295   *         @arg @ref LL_RCC_CEC_CLKSOURCE_LSE
1296   * @retval None
1297   */
LL_RCC_SetCECClockSource(uint32_t CECxSource)1298 __STATIC_INLINE void LL_RCC_SetCECClockSource(uint32_t CECxSource)
1299 {
1300   MODIFY_REG(RCC->CFGR3, RCC_CFGR3_CECSW, CECxSource);
1301 }
1302 #endif /* CEC */
1303 
1304 #if defined(USB)
1305 /**
1306   * @brief  Configure USB clock source
1307   * @rmtoll CFGR3        USBSW         LL_RCC_SetUSBClockSource
1308   * @param  USBxSource This parameter can be one of the following values:
1309   *         @arg @ref LL_RCC_USB_CLKSOURCE_HSI48 (*)
1310   *         @arg @ref LL_RCC_USB_CLKSOURCE_NONE (*)
1311   *         @arg @ref LL_RCC_USB_CLKSOURCE_PLL
1312   *
1313   *         (*) value not defined in all devices.
1314   * @retval None
1315   */
LL_RCC_SetUSBClockSource(uint32_t USBxSource)1316 __STATIC_INLINE void LL_RCC_SetUSBClockSource(uint32_t USBxSource)
1317 {
1318   MODIFY_REG(RCC->CFGR3, RCC_CFGR3_USBSW, USBxSource);
1319 }
1320 #endif /* USB */
1321 
1322 /**
1323   * @brief  Get USARTx clock source
1324   * @rmtoll CFGR3        USART1SW      LL_RCC_GetUSARTClockSource\n
1325   *         CFGR3        USART2SW      LL_RCC_GetUSARTClockSource\n
1326   *         CFGR3        USART3SW      LL_RCC_GetUSARTClockSource
1327   * @param  USARTx This parameter can be one of the following values:
1328   *         @arg @ref LL_RCC_USART1_CLKSOURCE
1329   *         @arg @ref LL_RCC_USART2_CLKSOURCE (*)
1330   *         @arg @ref LL_RCC_USART3_CLKSOURCE (*)
1331   *
1332   *         (*) value not defined in all devices.
1333   * @retval Returned value can be one of the following values:
1334   *         @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK1
1335   *         @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
1336   *         @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
1337   *         @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
1338   *         @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1 (*)
1339   *         @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK (*)
1340   *         @arg @ref LL_RCC_USART2_CLKSOURCE_LSE (*)
1341   *         @arg @ref LL_RCC_USART2_CLKSOURCE_HSI (*)
1342   *         @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1 (*)
1343   *         @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK (*)
1344   *         @arg @ref LL_RCC_USART3_CLKSOURCE_LSE (*)
1345   *         @arg @ref LL_RCC_USART3_CLKSOURCE_HSI (*)
1346   *
1347   *         (*) value not defined in all devices.
1348   */
LL_RCC_GetUSARTClockSource(uint32_t USARTx)1349 __STATIC_INLINE uint32_t LL_RCC_GetUSARTClockSource(uint32_t USARTx)
1350 {
1351   return (uint32_t)(READ_BIT(RCC->CFGR3, (RCC_CFGR3_USART1SW << USARTx)) | (USARTx << 24U));
1352 }
1353 
1354 /**
1355   * @brief  Get I2Cx clock source
1356   * @rmtoll CFGR3        I2C1SW        LL_RCC_GetI2CClockSource
1357   * @param  I2Cx This parameter can be one of the following values:
1358   *         @arg @ref LL_RCC_I2C1_CLKSOURCE
1359   * @retval Returned value can be one of the following values:
1360   *         @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
1361   *         @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
1362   */
LL_RCC_GetI2CClockSource(uint32_t I2Cx)1363 __STATIC_INLINE uint32_t LL_RCC_GetI2CClockSource(uint32_t I2Cx)
1364 {
1365   return (uint32_t)(READ_BIT(RCC->CFGR3, I2Cx));
1366 }
1367 
1368 #if defined(CEC)
1369 /**
1370   * @brief  Get CEC clock source
1371   * @rmtoll CFGR3        CECSW         LL_RCC_GetCECClockSource
1372   * @param  CECx This parameter can be one of the following values:
1373   *         @arg @ref LL_RCC_CEC_CLKSOURCE
1374   * @retval Returned value can be one of the following values:
1375   *         @arg @ref LL_RCC_CEC_CLKSOURCE_HSI_DIV244
1376   *         @arg @ref LL_RCC_CEC_CLKSOURCE_LSE
1377   */
LL_RCC_GetCECClockSource(uint32_t CECx)1378 __STATIC_INLINE uint32_t LL_RCC_GetCECClockSource(uint32_t CECx)
1379 {
1380   return (uint32_t)(READ_BIT(RCC->CFGR3, CECx));
1381 }
1382 #endif /* CEC */
1383 
1384 #if defined(USB)
1385 /**
1386   * @brief  Get USBx clock source
1387   * @rmtoll CFGR3        USBSW         LL_RCC_GetUSBClockSource
1388   * @param  USBx This parameter can be one of the following values:
1389   *         @arg @ref LL_RCC_USB_CLKSOURCE
1390   * @retval Returned value can be one of the following values:
1391   *         @arg @ref LL_RCC_USB_CLKSOURCE_HSI48 (*)
1392   *         @arg @ref LL_RCC_USB_CLKSOURCE_NONE (*)
1393   *         @arg @ref LL_RCC_USB_CLKSOURCE_PLL
1394   *
1395   *         (*) value not defined in all devices.
1396   */
LL_RCC_GetUSBClockSource(uint32_t USBx)1397 __STATIC_INLINE uint32_t LL_RCC_GetUSBClockSource(uint32_t USBx)
1398 {
1399   return (uint32_t)(READ_BIT(RCC->CFGR3, USBx));
1400 }
1401 #endif /* USB */
1402 
1403 /**
1404   * @}
1405   */
1406 
1407 /** @defgroup RCC_LL_EF_RTC RTC
1408   * @{
1409   */
1410 
1411 /**
1412   * @brief  Set RTC Clock Source
1413   * @note Once the RTC clock source has been selected, it cannot be changed any more unless
1414   *       the Backup domain is reset. The BDRST bit can be used to reset them.
1415   * @rmtoll BDCR         RTCSEL        LL_RCC_SetRTCClockSource
1416   * @param  Source This parameter can be one of the following values:
1417   *         @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
1418   *         @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
1419   *         @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
1420   *         @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
1421   * @retval None
1422   */
LL_RCC_SetRTCClockSource(uint32_t Source)1423 __STATIC_INLINE void LL_RCC_SetRTCClockSource(uint32_t Source)
1424 {
1425   MODIFY_REG(RCC->BDCR, RCC_BDCR_RTCSEL, Source);
1426 }
1427 
1428 /**
1429   * @brief  Get RTC Clock Source
1430   * @rmtoll BDCR         RTCSEL        LL_RCC_GetRTCClockSource
1431   * @retval Returned value can be one of the following values:
1432   *         @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
1433   *         @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
1434   *         @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
1435   *         @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
1436   */
LL_RCC_GetRTCClockSource(void)1437 __STATIC_INLINE uint32_t LL_RCC_GetRTCClockSource(void)
1438 {
1439   return (uint32_t)(READ_BIT(RCC->BDCR, RCC_BDCR_RTCSEL));
1440 }
1441 
1442 /**
1443   * @brief  Enable RTC
1444   * @rmtoll BDCR         RTCEN         LL_RCC_EnableRTC
1445   * @retval None
1446   */
LL_RCC_EnableRTC(void)1447 __STATIC_INLINE void LL_RCC_EnableRTC(void)
1448 {
1449   SET_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
1450 }
1451 
1452 /**
1453   * @brief  Disable RTC
1454   * @rmtoll BDCR         RTCEN         LL_RCC_DisableRTC
1455   * @retval None
1456   */
LL_RCC_DisableRTC(void)1457 __STATIC_INLINE void LL_RCC_DisableRTC(void)
1458 {
1459   CLEAR_BIT(RCC->BDCR, RCC_BDCR_RTCEN);
1460 }
1461 
1462 /**
1463   * @brief  Check if RTC has been enabled or not
1464   * @rmtoll BDCR         RTCEN         LL_RCC_IsEnabledRTC
1465   * @retval State of bit (1 or 0).
1466   */
LL_RCC_IsEnabledRTC(void)1467 __STATIC_INLINE uint32_t LL_RCC_IsEnabledRTC(void)
1468 {
1469   return (READ_BIT(RCC->BDCR, RCC_BDCR_RTCEN) == (RCC_BDCR_RTCEN));
1470 }
1471 
1472 /**
1473   * @brief  Force the Backup domain reset
1474   * @rmtoll BDCR         BDRST         LL_RCC_ForceBackupDomainReset
1475   * @retval None
1476   */
LL_RCC_ForceBackupDomainReset(void)1477 __STATIC_INLINE void LL_RCC_ForceBackupDomainReset(void)
1478 {
1479   SET_BIT(RCC->BDCR, RCC_BDCR_BDRST);
1480 }
1481 
1482 /**
1483   * @brief  Release the Backup domain reset
1484   * @rmtoll BDCR         BDRST         LL_RCC_ReleaseBackupDomainReset
1485   * @retval None
1486   */
LL_RCC_ReleaseBackupDomainReset(void)1487 __STATIC_INLINE void LL_RCC_ReleaseBackupDomainReset(void)
1488 {
1489   CLEAR_BIT(RCC->BDCR, RCC_BDCR_BDRST);
1490 }
1491 
1492 /**
1493   * @}
1494   */
1495 
1496 /** @defgroup RCC_LL_EF_PLL PLL
1497   * @{
1498   */
1499 
1500 /**
1501   * @brief  Enable PLL
1502   * @rmtoll CR           PLLON         LL_RCC_PLL_Enable
1503   * @retval None
1504   */
LL_RCC_PLL_Enable(void)1505 __STATIC_INLINE void LL_RCC_PLL_Enable(void)
1506 {
1507   SET_BIT(RCC->CR, RCC_CR_PLLON);
1508 }
1509 
1510 /**
1511   * @brief  Disable PLL
1512   * @note Cannot be disabled if the PLL clock is used as the system clock
1513   * @rmtoll CR           PLLON         LL_RCC_PLL_Disable
1514   * @retval None
1515   */
LL_RCC_PLL_Disable(void)1516 __STATIC_INLINE void LL_RCC_PLL_Disable(void)
1517 {
1518   CLEAR_BIT(RCC->CR, RCC_CR_PLLON);
1519 }
1520 
1521 /**
1522   * @brief  Check if PLL Ready
1523   * @rmtoll CR           PLLRDY        LL_RCC_PLL_IsReady
1524   * @retval State of bit (1 or 0).
1525   */
LL_RCC_PLL_IsReady(void)1526 __STATIC_INLINE uint32_t LL_RCC_PLL_IsReady(void)
1527 {
1528   return (READ_BIT(RCC->CR, RCC_CR_PLLRDY) == (RCC_CR_PLLRDY));
1529 }
1530 
1531 #if defined(RCC_PLLSRC_PREDIV1_SUPPORT)
1532 /**
1533   * @brief  Configure PLL used for SYSCLK Domain
1534   * @rmtoll CFGR         PLLSRC        LL_RCC_PLL_ConfigDomain_SYS\n
1535   *         CFGR         PLLMUL        LL_RCC_PLL_ConfigDomain_SYS\n
1536   *         CFGR2        PREDIV        LL_RCC_PLL_ConfigDomain_SYS
1537   * @param  Source This parameter can be one of the following values:
1538   *         @arg @ref LL_RCC_PLLSOURCE_HSI
1539   *         @arg @ref LL_RCC_PLLSOURCE_HSE
1540   *         @arg @ref LL_RCC_PLLSOURCE_HSI48 (*)
1541   *
1542   *         (*) value not defined in all devices
1543   * @param  PLLMul This parameter can be one of the following values:
1544   *         @arg @ref LL_RCC_PLL_MUL_2
1545   *         @arg @ref LL_RCC_PLL_MUL_3
1546   *         @arg @ref LL_RCC_PLL_MUL_4
1547   *         @arg @ref LL_RCC_PLL_MUL_5
1548   *         @arg @ref LL_RCC_PLL_MUL_6
1549   *         @arg @ref LL_RCC_PLL_MUL_7
1550   *         @arg @ref LL_RCC_PLL_MUL_8
1551   *         @arg @ref LL_RCC_PLL_MUL_9
1552   *         @arg @ref LL_RCC_PLL_MUL_10
1553   *         @arg @ref LL_RCC_PLL_MUL_11
1554   *         @arg @ref LL_RCC_PLL_MUL_12
1555   *         @arg @ref LL_RCC_PLL_MUL_13
1556   *         @arg @ref LL_RCC_PLL_MUL_14
1557   *         @arg @ref LL_RCC_PLL_MUL_15
1558   *         @arg @ref LL_RCC_PLL_MUL_16
1559   * @param  PLLDiv This parameter can be one of the following values:
1560   *         @arg @ref LL_RCC_PREDIV_DIV_1
1561   *         @arg @ref LL_RCC_PREDIV_DIV_2
1562   *         @arg @ref LL_RCC_PREDIV_DIV_3
1563   *         @arg @ref LL_RCC_PREDIV_DIV_4
1564   *         @arg @ref LL_RCC_PREDIV_DIV_5
1565   *         @arg @ref LL_RCC_PREDIV_DIV_6
1566   *         @arg @ref LL_RCC_PREDIV_DIV_7
1567   *         @arg @ref LL_RCC_PREDIV_DIV_8
1568   *         @arg @ref LL_RCC_PREDIV_DIV_9
1569   *         @arg @ref LL_RCC_PREDIV_DIV_10
1570   *         @arg @ref LL_RCC_PREDIV_DIV_11
1571   *         @arg @ref LL_RCC_PREDIV_DIV_12
1572   *         @arg @ref LL_RCC_PREDIV_DIV_13
1573   *         @arg @ref LL_RCC_PREDIV_DIV_14
1574   *         @arg @ref LL_RCC_PREDIV_DIV_15
1575   *         @arg @ref LL_RCC_PREDIV_DIV_16
1576   * @retval None
1577   */
LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source,uint32_t PLLMul,uint32_t PLLDiv)1578 __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source, uint32_t PLLMul, uint32_t PLLDiv)
1579 {
1580   MODIFY_REG(RCC->CFGR, RCC_CFGR_PLLSRC | RCC_CFGR_PLLMUL, Source | PLLMul);
1581   MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV, PLLDiv);
1582 }
1583 
1584 #else
1585 
1586 /**
1587   * @brief  Configure PLL used for SYSCLK Domain
1588   * @rmtoll CFGR         PLLSRC        LL_RCC_PLL_ConfigDomain_SYS\n
1589   *         CFGR         PLLMUL        LL_RCC_PLL_ConfigDomain_SYS\n
1590   *         CFGR2        PREDIV        LL_RCC_PLL_ConfigDomain_SYS
1591   * @param  Source This parameter can be one of the following values:
1592   *         @arg @ref LL_RCC_PLLSOURCE_HSI_DIV_2
1593   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_1
1594   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_2
1595   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_3
1596   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_4
1597   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_5
1598   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_6
1599   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_7
1600   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_8
1601   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_9
1602   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_10
1603   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_11
1604   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_12
1605   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_13
1606   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_14
1607   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_15
1608   *         @arg @ref LL_RCC_PLLSOURCE_HSE_DIV_16
1609   * @param  PLLMul This parameter can be one of the following values:
1610   *         @arg @ref LL_RCC_PLL_MUL_2
1611   *         @arg @ref LL_RCC_PLL_MUL_3
1612   *         @arg @ref LL_RCC_PLL_MUL_4
1613   *         @arg @ref LL_RCC_PLL_MUL_5
1614   *         @arg @ref LL_RCC_PLL_MUL_6
1615   *         @arg @ref LL_RCC_PLL_MUL_7
1616   *         @arg @ref LL_RCC_PLL_MUL_8
1617   *         @arg @ref LL_RCC_PLL_MUL_9
1618   *         @arg @ref LL_RCC_PLL_MUL_10
1619   *         @arg @ref LL_RCC_PLL_MUL_11
1620   *         @arg @ref LL_RCC_PLL_MUL_12
1621   *         @arg @ref LL_RCC_PLL_MUL_13
1622   *         @arg @ref LL_RCC_PLL_MUL_14
1623   *         @arg @ref LL_RCC_PLL_MUL_15
1624   *         @arg @ref LL_RCC_PLL_MUL_16
1625   * @retval None
1626   */
LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source,uint32_t PLLMul)1627 __STATIC_INLINE void LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source, uint32_t PLLMul)
1628 {
1629   MODIFY_REG(RCC->CFGR, RCC_CFGR_PLLSRC | RCC_CFGR_PLLMUL, (Source & RCC_CFGR_PLLSRC) | PLLMul);
1630   MODIFY_REG(RCC->CFGR2, RCC_CFGR2_PREDIV, (Source & RCC_CFGR2_PREDIV));
1631 }
1632 #endif /* RCC_PLLSRC_PREDIV1_SUPPORT */
1633 
1634 /**
1635   * @brief  Configure PLL clock source
1636   * @rmtoll CFGR      PLLSRC        LL_RCC_PLL_SetMainSource
1637   * @param PLLSource This parameter can be one of the following values:
1638   *         @arg @ref LL_RCC_PLLSOURCE_NONE
1639   *         @arg @ref LL_RCC_PLLSOURCE_HSI (*)
1640   *         @arg @ref LL_RCC_PLLSOURCE_HSI_DIV_2 (*)
1641   *         @arg @ref LL_RCC_PLLSOURCE_HSE
1642   *         @arg @ref LL_RCC_PLLSOURCE_HSI48 (*)
1643   *
1644   *         (*) value not defined in all devices
1645   * @retval None
1646   */
LL_RCC_PLL_SetMainSource(uint32_t PLLSource)1647 __STATIC_INLINE void LL_RCC_PLL_SetMainSource(uint32_t PLLSource)
1648 {
1649   MODIFY_REG(RCC->CFGR, RCC_CFGR_PLLSRC, PLLSource);
1650 }
1651 
1652 /**
1653   * @brief  Get the oscillator used as PLL clock source.
1654   * @rmtoll CFGR         PLLSRC        LL_RCC_PLL_GetMainSource
1655   * @retval Returned value can be one of the following values:
1656   *         @arg @ref LL_RCC_PLLSOURCE_NONE
1657   *         @arg @ref LL_RCC_PLLSOURCE_HSI (*)
1658   *         @arg @ref LL_RCC_PLLSOURCE_HSI_DIV_2 (*)
1659   *         @arg @ref LL_RCC_PLLSOURCE_HSE
1660   *         @arg @ref LL_RCC_PLLSOURCE_HSI48 (*)
1661   *
1662   *         (*) value not defined in all devices
1663   */
LL_RCC_PLL_GetMainSource(void)1664 __STATIC_INLINE uint32_t LL_RCC_PLL_GetMainSource(void)
1665 {
1666   return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLSRC));
1667 }
1668 
1669 /**
1670   * @brief  Get PLL multiplication Factor
1671   * @rmtoll CFGR         PLLMUL        LL_RCC_PLL_GetMultiplicator
1672   * @retval Returned value can be one of the following values:
1673   *         @arg @ref LL_RCC_PLL_MUL_2
1674   *         @arg @ref LL_RCC_PLL_MUL_3
1675   *         @arg @ref LL_RCC_PLL_MUL_4
1676   *         @arg @ref LL_RCC_PLL_MUL_5
1677   *         @arg @ref LL_RCC_PLL_MUL_6
1678   *         @arg @ref LL_RCC_PLL_MUL_7
1679   *         @arg @ref LL_RCC_PLL_MUL_8
1680   *         @arg @ref LL_RCC_PLL_MUL_9
1681   *         @arg @ref LL_RCC_PLL_MUL_10
1682   *         @arg @ref LL_RCC_PLL_MUL_11
1683   *         @arg @ref LL_RCC_PLL_MUL_12
1684   *         @arg @ref LL_RCC_PLL_MUL_13
1685   *         @arg @ref LL_RCC_PLL_MUL_14
1686   *         @arg @ref LL_RCC_PLL_MUL_15
1687   *         @arg @ref LL_RCC_PLL_MUL_16
1688   */
LL_RCC_PLL_GetMultiplicator(void)1689 __STATIC_INLINE uint32_t LL_RCC_PLL_GetMultiplicator(void)
1690 {
1691   return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_PLLMUL));
1692 }
1693 
1694 /**
1695   * @brief  Get PREDIV division factor for the main PLL
1696   * @note They can be written only when the PLL is disabled
1697   * @rmtoll CFGR2        PREDIV        LL_RCC_PLL_GetPrediv
1698   * @retval Returned value can be one of the following values:
1699   *         @arg @ref LL_RCC_PREDIV_DIV_1
1700   *         @arg @ref LL_RCC_PREDIV_DIV_2
1701   *         @arg @ref LL_RCC_PREDIV_DIV_3
1702   *         @arg @ref LL_RCC_PREDIV_DIV_4
1703   *         @arg @ref LL_RCC_PREDIV_DIV_5
1704   *         @arg @ref LL_RCC_PREDIV_DIV_6
1705   *         @arg @ref LL_RCC_PREDIV_DIV_7
1706   *         @arg @ref LL_RCC_PREDIV_DIV_8
1707   *         @arg @ref LL_RCC_PREDIV_DIV_9
1708   *         @arg @ref LL_RCC_PREDIV_DIV_10
1709   *         @arg @ref LL_RCC_PREDIV_DIV_11
1710   *         @arg @ref LL_RCC_PREDIV_DIV_12
1711   *         @arg @ref LL_RCC_PREDIV_DIV_13
1712   *         @arg @ref LL_RCC_PREDIV_DIV_14
1713   *         @arg @ref LL_RCC_PREDIV_DIV_15
1714   *         @arg @ref LL_RCC_PREDIV_DIV_16
1715   */
LL_RCC_PLL_GetPrediv(void)1716 __STATIC_INLINE uint32_t LL_RCC_PLL_GetPrediv(void)
1717 {
1718   return (uint32_t)(READ_BIT(RCC->CFGR2, RCC_CFGR2_PREDIV));
1719 }
1720 
1721 /**
1722   * @}
1723   */
1724 
1725 /** @defgroup RCC_LL_EF_FLAG_Management FLAG Management
1726   * @{
1727   */
1728 
1729 /**
1730   * @brief  Clear LSI ready interrupt flag
1731   * @rmtoll CIR         LSIRDYC       LL_RCC_ClearFlag_LSIRDY
1732   * @retval None
1733   */
LL_RCC_ClearFlag_LSIRDY(void)1734 __STATIC_INLINE void LL_RCC_ClearFlag_LSIRDY(void)
1735 {
1736   SET_BIT(RCC->CIR, RCC_CIR_LSIRDYC);
1737 }
1738 
1739 /**
1740   * @brief  Clear LSE ready interrupt flag
1741   * @rmtoll CIR         LSERDYC       LL_RCC_ClearFlag_LSERDY
1742   * @retval None
1743   */
LL_RCC_ClearFlag_LSERDY(void)1744 __STATIC_INLINE void LL_RCC_ClearFlag_LSERDY(void)
1745 {
1746   SET_BIT(RCC->CIR, RCC_CIR_LSERDYC);
1747 }
1748 
1749 /**
1750   * @brief  Clear HSI ready interrupt flag
1751   * @rmtoll CIR         HSIRDYC       LL_RCC_ClearFlag_HSIRDY
1752   * @retval None
1753   */
LL_RCC_ClearFlag_HSIRDY(void)1754 __STATIC_INLINE void LL_RCC_ClearFlag_HSIRDY(void)
1755 {
1756   SET_BIT(RCC->CIR, RCC_CIR_HSIRDYC);
1757 }
1758 
1759 /**
1760   * @brief  Clear HSE ready interrupt flag
1761   * @rmtoll CIR         HSERDYC       LL_RCC_ClearFlag_HSERDY
1762   * @retval None
1763   */
LL_RCC_ClearFlag_HSERDY(void)1764 __STATIC_INLINE void LL_RCC_ClearFlag_HSERDY(void)
1765 {
1766   SET_BIT(RCC->CIR, RCC_CIR_HSERDYC);
1767 }
1768 
1769 /**
1770   * @brief  Clear PLL ready interrupt flag
1771   * @rmtoll CIR         PLLRDYC       LL_RCC_ClearFlag_PLLRDY
1772   * @retval None
1773   */
LL_RCC_ClearFlag_PLLRDY(void)1774 __STATIC_INLINE void LL_RCC_ClearFlag_PLLRDY(void)
1775 {
1776   SET_BIT(RCC->CIR, RCC_CIR_PLLRDYC);
1777 }
1778 
1779 /**
1780   * @brief  Clear HSI14 ready interrupt flag
1781   * @rmtoll CIR          HSI14RDYC     LL_RCC_ClearFlag_HSI14RDY
1782   * @retval None
1783   */
LL_RCC_ClearFlag_HSI14RDY(void)1784 __STATIC_INLINE void LL_RCC_ClearFlag_HSI14RDY(void)
1785 {
1786   SET_BIT(RCC->CIR, RCC_CIR_HSI14RDYC);
1787 }
1788 
1789 #if defined(RCC_HSI48_SUPPORT)
1790 /**
1791   * @brief  Clear HSI48 ready interrupt flag
1792   * @rmtoll CIR          HSI48RDYC     LL_RCC_ClearFlag_HSI48RDY
1793   * @retval None
1794   */
LL_RCC_ClearFlag_HSI48RDY(void)1795 __STATIC_INLINE void LL_RCC_ClearFlag_HSI48RDY(void)
1796 {
1797   SET_BIT(RCC->CIR, RCC_CIR_HSI48RDYC);
1798 }
1799 #endif /* RCC_HSI48_SUPPORT */
1800 
1801 /**
1802   * @brief  Clear Clock security system interrupt flag
1803   * @rmtoll CIR         CSSC          LL_RCC_ClearFlag_HSECSS
1804   * @retval None
1805   */
LL_RCC_ClearFlag_HSECSS(void)1806 __STATIC_INLINE void LL_RCC_ClearFlag_HSECSS(void)
1807 {
1808   SET_BIT(RCC->CIR, RCC_CIR_CSSC);
1809 }
1810 
1811 /**
1812   * @brief  Check if LSI ready interrupt occurred or not
1813   * @rmtoll CIR         LSIRDYF       LL_RCC_IsActiveFlag_LSIRDY
1814   * @retval State of bit (1 or 0).
1815   */
LL_RCC_IsActiveFlag_LSIRDY(void)1816 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSIRDY(void)
1817 {
1818   return (READ_BIT(RCC->CIR, RCC_CIR_LSIRDYF) == (RCC_CIR_LSIRDYF));
1819 }
1820 
1821 /**
1822   * @brief  Check if LSE ready interrupt occurred or not
1823   * @rmtoll CIR         LSERDYF       LL_RCC_IsActiveFlag_LSERDY
1824   * @retval State of bit (1 or 0).
1825   */
LL_RCC_IsActiveFlag_LSERDY(void)1826 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LSERDY(void)
1827 {
1828   return (READ_BIT(RCC->CIR, RCC_CIR_LSERDYF) == (RCC_CIR_LSERDYF));
1829 }
1830 
1831 /**
1832   * @brief  Check if HSI ready interrupt occurred or not
1833   * @rmtoll CIR         HSIRDYF       LL_RCC_IsActiveFlag_HSIRDY
1834   * @retval State of bit (1 or 0).
1835   */
LL_RCC_IsActiveFlag_HSIRDY(void)1836 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSIRDY(void)
1837 {
1838   return (READ_BIT(RCC->CIR, RCC_CIR_HSIRDYF) == (RCC_CIR_HSIRDYF));
1839 }
1840 
1841 /**
1842   * @brief  Check if HSE ready interrupt occurred or not
1843   * @rmtoll CIR         HSERDYF       LL_RCC_IsActiveFlag_HSERDY
1844   * @retval State of bit (1 or 0).
1845   */
LL_RCC_IsActiveFlag_HSERDY(void)1846 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSERDY(void)
1847 {
1848   return (READ_BIT(RCC->CIR, RCC_CIR_HSERDYF) == (RCC_CIR_HSERDYF));
1849 }
1850 
1851 /**
1852   * @brief  Check if PLL ready interrupt occurred or not
1853   * @rmtoll CIR         PLLRDYF       LL_RCC_IsActiveFlag_PLLRDY
1854   * @retval State of bit (1 or 0).
1855   */
LL_RCC_IsActiveFlag_PLLRDY(void)1856 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PLLRDY(void)
1857 {
1858   return (READ_BIT(RCC->CIR, RCC_CIR_PLLRDYF) == (RCC_CIR_PLLRDYF));
1859 }
1860 
1861 /**
1862   * @brief  Check if HSI14 ready interrupt occurred or not
1863   * @rmtoll CIR          HSI14RDYF     LL_RCC_IsActiveFlag_HSI14RDY
1864   * @retval State of bit (1 or 0).
1865   */
LL_RCC_IsActiveFlag_HSI14RDY(void)1866 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSI14RDY(void)
1867 {
1868   return (READ_BIT(RCC->CIR, RCC_CIR_HSI14RDYF) == (RCC_CIR_HSI14RDYF));
1869 }
1870 
1871 #if defined(RCC_HSI48_SUPPORT)
1872 /**
1873   * @brief  Check if HSI48 ready interrupt occurred or not
1874   * @rmtoll CIR          HSI48RDYF     LL_RCC_IsActiveFlag_HSI48RDY
1875   * @retval State of bit (1 or 0).
1876   */
LL_RCC_IsActiveFlag_HSI48RDY(void)1877 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSI48RDY(void)
1878 {
1879   return (READ_BIT(RCC->CIR, RCC_CIR_HSI48RDYF) == (RCC_CIR_HSI48RDYF));
1880 }
1881 #endif /* RCC_HSI48_SUPPORT */
1882 
1883 /**
1884   * @brief  Check if Clock security system interrupt occurred or not
1885   * @rmtoll CIR         CSSF          LL_RCC_IsActiveFlag_HSECSS
1886   * @retval State of bit (1 or 0).
1887   */
LL_RCC_IsActiveFlag_HSECSS(void)1888 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_HSECSS(void)
1889 {
1890   return (READ_BIT(RCC->CIR, RCC_CIR_CSSF) == (RCC_CIR_CSSF));
1891 }
1892 
1893 /**
1894   * @brief  Check if RCC flag Independent Watchdog reset is set or not.
1895   * @rmtoll CSR          IWDGRSTF      LL_RCC_IsActiveFlag_IWDGRST
1896   * @retval State of bit (1 or 0).
1897   */
LL_RCC_IsActiveFlag_IWDGRST(void)1898 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_IWDGRST(void)
1899 {
1900   return (READ_BIT(RCC->CSR, RCC_CSR_IWDGRSTF) == (RCC_CSR_IWDGRSTF));
1901 }
1902 
1903 /**
1904   * @brief  Check if RCC flag Low Power reset is set or not.
1905   * @rmtoll CSR          LPWRRSTF      LL_RCC_IsActiveFlag_LPWRRST
1906   * @retval State of bit (1 or 0).
1907   */
LL_RCC_IsActiveFlag_LPWRRST(void)1908 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_LPWRRST(void)
1909 {
1910   return (READ_BIT(RCC->CSR, RCC_CSR_LPWRRSTF) == (RCC_CSR_LPWRRSTF));
1911 }
1912 
1913 /**
1914   * @brief  Check if RCC flag is set or not.
1915   * @rmtoll CSR          OBLRSTF       LL_RCC_IsActiveFlag_OBLRST
1916   * @retval State of bit (1 or 0).
1917   */
LL_RCC_IsActiveFlag_OBLRST(void)1918 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_OBLRST(void)
1919 {
1920   return (READ_BIT(RCC->CSR, RCC_CSR_OBLRSTF) == (RCC_CSR_OBLRSTF));
1921 }
1922 
1923 /**
1924   * @brief  Check if RCC flag Pin reset is set or not.
1925   * @rmtoll CSR          PINRSTF       LL_RCC_IsActiveFlag_PINRST
1926   * @retval State of bit (1 or 0).
1927   */
LL_RCC_IsActiveFlag_PINRST(void)1928 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PINRST(void)
1929 {
1930   return (READ_BIT(RCC->CSR, RCC_CSR_PINRSTF) == (RCC_CSR_PINRSTF));
1931 }
1932 
1933 /**
1934   * @brief  Check if RCC flag POR/PDR reset is set or not.
1935   * @rmtoll CSR          PORRSTF       LL_RCC_IsActiveFlag_PORRST
1936   * @retval State of bit (1 or 0).
1937   */
LL_RCC_IsActiveFlag_PORRST(void)1938 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_PORRST(void)
1939 {
1940   return (READ_BIT(RCC->CSR, RCC_CSR_PORRSTF) == (RCC_CSR_PORRSTF));
1941 }
1942 
1943 /**
1944   * @brief  Check if RCC flag Software reset is set or not.
1945   * @rmtoll CSR          SFTRSTF       LL_RCC_IsActiveFlag_SFTRST
1946   * @retval State of bit (1 or 0).
1947   */
LL_RCC_IsActiveFlag_SFTRST(void)1948 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_SFTRST(void)
1949 {
1950   return (READ_BIT(RCC->CSR, RCC_CSR_SFTRSTF) == (RCC_CSR_SFTRSTF));
1951 }
1952 
1953 /**
1954   * @brief  Check if RCC flag Window Watchdog reset is set or not.
1955   * @rmtoll CSR          WWDGRSTF      LL_RCC_IsActiveFlag_WWDGRST
1956   * @retval State of bit (1 or 0).
1957   */
LL_RCC_IsActiveFlag_WWDGRST(void)1958 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_WWDGRST(void)
1959 {
1960   return (READ_BIT(RCC->CSR, RCC_CSR_WWDGRSTF) == (RCC_CSR_WWDGRSTF));
1961 }
1962 
1963 #if defined(RCC_CSR_V18PWRRSTF)
1964 /**
1965   * @brief  Check if RCC Reset flag of the 1.8 V domain is set or not.
1966   * @rmtoll CSR          V18PWRRSTF    LL_RCC_IsActiveFlag_V18PWRRST
1967   * @retval State of bit (1 or 0).
1968   */
LL_RCC_IsActiveFlag_V18PWRRST(void)1969 __STATIC_INLINE uint32_t LL_RCC_IsActiveFlag_V18PWRRST(void)
1970 {
1971   return (READ_BIT(RCC->CSR, RCC_CSR_V18PWRRSTF) == (RCC_CSR_V18PWRRSTF));
1972 }
1973 #endif /* RCC_CSR_V18PWRRSTF */
1974 
1975 /**
1976   * @brief  Set RMVF bit to clear the reset flags.
1977   * @rmtoll CSR          RMVF          LL_RCC_ClearResetFlags
1978   * @retval None
1979   */
LL_RCC_ClearResetFlags(void)1980 __STATIC_INLINE void LL_RCC_ClearResetFlags(void)
1981 {
1982   SET_BIT(RCC->CSR, RCC_CSR_RMVF);
1983 }
1984 
1985 /**
1986   * @}
1987   */
1988 
1989 /** @defgroup RCC_LL_EF_IT_Management IT Management
1990   * @{
1991   */
1992 
1993 /**
1994   * @brief  Enable LSI ready interrupt
1995   * @rmtoll CIR         LSIRDYIE      LL_RCC_EnableIT_LSIRDY
1996   * @retval None
1997   */
LL_RCC_EnableIT_LSIRDY(void)1998 __STATIC_INLINE void LL_RCC_EnableIT_LSIRDY(void)
1999 {
2000   SET_BIT(RCC->CIR, RCC_CIR_LSIRDYIE);
2001 }
2002 
2003 /**
2004   * @brief  Enable LSE ready interrupt
2005   * @rmtoll CIR         LSERDYIE      LL_RCC_EnableIT_LSERDY
2006   * @retval None
2007   */
LL_RCC_EnableIT_LSERDY(void)2008 __STATIC_INLINE void LL_RCC_EnableIT_LSERDY(void)
2009 {
2010   SET_BIT(RCC->CIR, RCC_CIR_LSERDYIE);
2011 }
2012 
2013 /**
2014   * @brief  Enable HSI ready interrupt
2015   * @rmtoll CIR         HSIRDYIE      LL_RCC_EnableIT_HSIRDY
2016   * @retval None
2017   */
LL_RCC_EnableIT_HSIRDY(void)2018 __STATIC_INLINE void LL_RCC_EnableIT_HSIRDY(void)
2019 {
2020   SET_BIT(RCC->CIR, RCC_CIR_HSIRDYIE);
2021 }
2022 
2023 /**
2024   * @brief  Enable HSE ready interrupt
2025   * @rmtoll CIR         HSERDYIE      LL_RCC_EnableIT_HSERDY
2026   * @retval None
2027   */
LL_RCC_EnableIT_HSERDY(void)2028 __STATIC_INLINE void LL_RCC_EnableIT_HSERDY(void)
2029 {
2030   SET_BIT(RCC->CIR, RCC_CIR_HSERDYIE);
2031 }
2032 
2033 /**
2034   * @brief  Enable PLL ready interrupt
2035   * @rmtoll CIR         PLLRDYIE      LL_RCC_EnableIT_PLLRDY
2036   * @retval None
2037   */
LL_RCC_EnableIT_PLLRDY(void)2038 __STATIC_INLINE void LL_RCC_EnableIT_PLLRDY(void)
2039 {
2040   SET_BIT(RCC->CIR, RCC_CIR_PLLRDYIE);
2041 }
2042 
2043 /**
2044   * @brief  Enable HSI14 ready interrupt
2045   * @rmtoll CIR          HSI14RDYIE    LL_RCC_EnableIT_HSI14RDY
2046   * @retval None
2047   */
LL_RCC_EnableIT_HSI14RDY(void)2048 __STATIC_INLINE void LL_RCC_EnableIT_HSI14RDY(void)
2049 {
2050   SET_BIT(RCC->CIR, RCC_CIR_HSI14RDYIE);
2051 }
2052 
2053 #if defined(RCC_HSI48_SUPPORT)
2054 /**
2055   * @brief  Enable HSI48 ready interrupt
2056   * @rmtoll CIR          HSI48RDYIE    LL_RCC_EnableIT_HSI48RDY
2057   * @retval None
2058   */
LL_RCC_EnableIT_HSI48RDY(void)2059 __STATIC_INLINE void LL_RCC_EnableIT_HSI48RDY(void)
2060 {
2061   SET_BIT(RCC->CIR, RCC_CIR_HSI48RDYIE);
2062 }
2063 #endif /* RCC_HSI48_SUPPORT */
2064 
2065 /**
2066   * @brief  Disable LSI ready interrupt
2067   * @rmtoll CIR         LSIRDYIE      LL_RCC_DisableIT_LSIRDY
2068   * @retval None
2069   */
LL_RCC_DisableIT_LSIRDY(void)2070 __STATIC_INLINE void LL_RCC_DisableIT_LSIRDY(void)
2071 {
2072   CLEAR_BIT(RCC->CIR, RCC_CIR_LSIRDYIE);
2073 }
2074 
2075 /**
2076   * @brief  Disable LSE ready interrupt
2077   * @rmtoll CIR         LSERDYIE      LL_RCC_DisableIT_LSERDY
2078   * @retval None
2079   */
LL_RCC_DisableIT_LSERDY(void)2080 __STATIC_INLINE void LL_RCC_DisableIT_LSERDY(void)
2081 {
2082   CLEAR_BIT(RCC->CIR, RCC_CIR_LSERDYIE);
2083 }
2084 
2085 /**
2086   * @brief  Disable HSI ready interrupt
2087   * @rmtoll CIR         HSIRDYIE      LL_RCC_DisableIT_HSIRDY
2088   * @retval None
2089   */
LL_RCC_DisableIT_HSIRDY(void)2090 __STATIC_INLINE void LL_RCC_DisableIT_HSIRDY(void)
2091 {
2092   CLEAR_BIT(RCC->CIR, RCC_CIR_HSIRDYIE);
2093 }
2094 
2095 /**
2096   * @brief  Disable HSE ready interrupt
2097   * @rmtoll CIR         HSERDYIE      LL_RCC_DisableIT_HSERDY
2098   * @retval None
2099   */
LL_RCC_DisableIT_HSERDY(void)2100 __STATIC_INLINE void LL_RCC_DisableIT_HSERDY(void)
2101 {
2102   CLEAR_BIT(RCC->CIR, RCC_CIR_HSERDYIE);
2103 }
2104 
2105 /**
2106   * @brief  Disable PLL ready interrupt
2107   * @rmtoll CIR         PLLRDYIE      LL_RCC_DisableIT_PLLRDY
2108   * @retval None
2109   */
LL_RCC_DisableIT_PLLRDY(void)2110 __STATIC_INLINE void LL_RCC_DisableIT_PLLRDY(void)
2111 {
2112   CLEAR_BIT(RCC->CIR, RCC_CIR_PLLRDYIE);
2113 }
2114 
2115 /**
2116   * @brief  Disable HSI14 ready interrupt
2117   * @rmtoll CIR          HSI14RDYIE    LL_RCC_DisableIT_HSI14RDY
2118   * @retval None
2119   */
LL_RCC_DisableIT_HSI14RDY(void)2120 __STATIC_INLINE void LL_RCC_DisableIT_HSI14RDY(void)
2121 {
2122   CLEAR_BIT(RCC->CIR, RCC_CIR_HSI14RDYIE);
2123 }
2124 
2125 #if defined(RCC_HSI48_SUPPORT)
2126 /**
2127   * @brief  Disable HSI48 ready interrupt
2128   * @rmtoll CIR          HSI48RDYIE    LL_RCC_DisableIT_HSI48RDY
2129   * @retval None
2130   */
LL_RCC_DisableIT_HSI48RDY(void)2131 __STATIC_INLINE void LL_RCC_DisableIT_HSI48RDY(void)
2132 {
2133   CLEAR_BIT(RCC->CIR, RCC_CIR_HSI48RDYIE);
2134 }
2135 #endif /* RCC_HSI48_SUPPORT */
2136 
2137 /**
2138   * @brief  Checks if LSI ready interrupt source is enabled or disabled.
2139   * @rmtoll CIR         LSIRDYIE      LL_RCC_IsEnabledIT_LSIRDY
2140   * @retval State of bit (1 or 0).
2141   */
LL_RCC_IsEnabledIT_LSIRDY(void)2142 __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSIRDY(void)
2143 {
2144   return (READ_BIT(RCC->CIR, RCC_CIR_LSIRDYIE) == (RCC_CIR_LSIRDYIE));
2145 }
2146 
2147 /**
2148   * @brief  Checks if LSE ready interrupt source is enabled or disabled.
2149   * @rmtoll CIR         LSERDYIE      LL_RCC_IsEnabledIT_LSERDY
2150   * @retval State of bit (1 or 0).
2151   */
LL_RCC_IsEnabledIT_LSERDY(void)2152 __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_LSERDY(void)
2153 {
2154   return (READ_BIT(RCC->CIR, RCC_CIR_LSERDYIE) == (RCC_CIR_LSERDYIE));
2155 }
2156 
2157 /**
2158   * @brief  Checks if HSI ready interrupt source is enabled or disabled.
2159   * @rmtoll CIR         HSIRDYIE      LL_RCC_IsEnabledIT_HSIRDY
2160   * @retval State of bit (1 or 0).
2161   */
LL_RCC_IsEnabledIT_HSIRDY(void)2162 __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSIRDY(void)
2163 {
2164   return (READ_BIT(RCC->CIR, RCC_CIR_HSIRDYIE) == (RCC_CIR_HSIRDYIE));
2165 }
2166 
2167 /**
2168   * @brief  Checks if HSE ready interrupt source is enabled or disabled.
2169   * @rmtoll CIR         HSERDYIE      LL_RCC_IsEnabledIT_HSERDY
2170   * @retval State of bit (1 or 0).
2171   */
LL_RCC_IsEnabledIT_HSERDY(void)2172 __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSERDY(void)
2173 {
2174   return (READ_BIT(RCC->CIR, RCC_CIR_HSERDYIE) == (RCC_CIR_HSERDYIE));
2175 }
2176 
2177 /**
2178   * @brief  Checks if PLL ready interrupt source is enabled or disabled.
2179   * @rmtoll CIR         PLLRDYIE      LL_RCC_IsEnabledIT_PLLRDY
2180   * @retval State of bit (1 or 0).
2181   */
LL_RCC_IsEnabledIT_PLLRDY(void)2182 __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_PLLRDY(void)
2183 {
2184   return (READ_BIT(RCC->CIR, RCC_CIR_PLLRDYIE) == (RCC_CIR_PLLRDYIE));
2185 }
2186 
2187 /**
2188   * @brief  Checks if HSI14 ready interrupt source is enabled or disabled.
2189   * @rmtoll CIR          HSI14RDYIE    LL_RCC_IsEnabledIT_HSI14RDY
2190   * @retval State of bit (1 or 0).
2191   */
LL_RCC_IsEnabledIT_HSI14RDY(void)2192 __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSI14RDY(void)
2193 {
2194   return (READ_BIT(RCC->CIR, RCC_CIR_HSI14RDYIE) == (RCC_CIR_HSI14RDYIE));
2195 }
2196 
2197 #if defined(RCC_HSI48_SUPPORT)
2198 /**
2199   * @brief  Checks if HSI48 ready interrupt source is enabled or disabled.
2200   * @rmtoll CIR          HSI48RDYIE    LL_RCC_IsEnabledIT_HSI48RDY
2201   * @retval State of bit (1 or 0).
2202   */
LL_RCC_IsEnabledIT_HSI48RDY(void)2203 __STATIC_INLINE uint32_t LL_RCC_IsEnabledIT_HSI48RDY(void)
2204 {
2205   return (READ_BIT(RCC->CIR, RCC_CIR_HSI48RDYIE) == (RCC_CIR_HSI48RDYIE));
2206 }
2207 #endif /* RCC_HSI48_SUPPORT */
2208 
2209 /**
2210   * @}
2211   */
2212 
2213 #if defined(USE_FULL_LL_DRIVER)
2214 /** @defgroup RCC_LL_EF_Init De-initialization function
2215   * @{
2216   */
2217 ErrorStatus LL_RCC_DeInit(void);
2218 /**
2219   * @}
2220   */
2221 
2222 /** @defgroup RCC_LL_EF_Get_Freq Get system and peripherals clocks frequency functions
2223   * @{
2224   */
2225 void        LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef *RCC_Clocks);
2226 uint32_t    LL_RCC_GetUSARTClockFreq(uint32_t USARTxSource);
2227 uint32_t    LL_RCC_GetI2CClockFreq(uint32_t I2CxSource);
2228 #if defined(USB_OTG_FS) || defined(USB)
2229 uint32_t    LL_RCC_GetUSBClockFreq(uint32_t USBxSource);
2230 #endif /* USB_OTG_FS || USB */
2231 #if defined(CEC)
2232 uint32_t    LL_RCC_GetCECClockFreq(uint32_t CECxSource);
2233 #endif /* CEC */
2234 /**
2235   * @}
2236   */
2237 #endif /* USE_FULL_LL_DRIVER */
2238 
2239 /**
2240   * @}
2241   */
2242 
2243 /**
2244   * @}
2245   */
2246 
2247 #endif /* RCC */
2248 
2249 /**
2250   * @}
2251   */
2252 
2253 #ifdef __cplusplus
2254 }
2255 #endif
2256 
2257 #endif /* __STM32F0xx_LL_RCC_H */
2258 
2259