2 ******************************************************************************
3 * @file stm32g4xx_ll_rcc.h
4 * @author MCD Application Team
5 * @brief Header file of RCC LL module.
6 ******************************************************************************
9 * <h2><center>© Copyright (c) 2018 STMicroelectronics.
10 * All rights reserved.</center></h2>
12 * This software component is licensed by ST 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
17 ******************************************************************************
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32G4xx_LL_RCC_H
22 #define STM32G4xx_LL_RCC_H
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32g4xx.h"
31 /** @addtogroup STM32G4xx_LL_Driver
35 /** @defgroup RCC_LL RCC
39 /* Private types -------------------------------------------------------------*/
40 /* Private variables ---------------------------------------------------------*/
41 /** @defgroup RCC_LL_Private_Variables RCC Private Variables
49 /* Private constants ---------------------------------------------------------*/
50 /** @defgroup RCC_LL_Private_Constants RCC Private Constants
53 /* Defines used to perform offsets*/
54 /* Offset used to access to RCC_CCIPR and RCC_CCIPR2 registers */
55 #define RCC_OFFSET_CCIPR 0U
56 #define RCC_OFFSET_CCIPR2 0x14U
62 /* Private macros ------------------------------------------------------------*/
63 #if defined(USE_FULL_LL_DRIVER)
64 /** @defgroup RCC_LL_Private_Macros RCC Private Macros
70 #endif /*USE_FULL_LL_DRIVER*/
72 /* Exported types ------------------------------------------------------------*/
73 #if defined(USE_FULL_LL_DRIVER)
74 /** @defgroup RCC_LL_Exported_Types RCC Exported Types
78 /** @defgroup LL_ES_CLOCK_FREQ Clocks Frequency Structure
83 * @brief RCC Clocks Frequency Structure
87 uint32_t SYSCLK_Frequency
; /*!< SYSCLK clock frequency */
88 uint32_t HCLK_Frequency
; /*!< HCLK clock frequency */
89 uint32_t PCLK1_Frequency
; /*!< PCLK1 clock frequency */
90 uint32_t PCLK2_Frequency
; /*!< PCLK2 clock frequency */
91 } LL_RCC_ClocksTypeDef
;
100 #endif /* USE_FULL_LL_DRIVER */
102 /* Exported constants --------------------------------------------------------*/
103 /** @defgroup RCC_LL_Exported_Constants RCC Exported Constants
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
113 #if !defined (HSE_VALUE)
114 #define HSE_VALUE 8000000U /*!< Value of the HSE oscillator in Hz */
115 #endif /* HSE_VALUE */
117 #if !defined (HSI_VALUE)
118 #define HSI_VALUE 16000000U /*!< Value of the HSI oscillator in Hz */
119 #endif /* HSI_VALUE */
121 #if !defined (LSE_VALUE)
122 #define LSE_VALUE 32768U /*!< Value of the LSE oscillator in Hz */
123 #endif /* LSE_VALUE */
125 #if !defined (LSI_VALUE)
126 #define LSI_VALUE 32000U /*!< Value of the LSI oscillator in Hz */
127 #endif /* LSI_VALUE */
129 #if !defined (HSI48_VALUE)
130 #define HSI48_VALUE 48000000U /*!< Value of the HSI48 oscillator in Hz */
131 #endif /* HSI48_VALUE */
133 #if !defined (EXTERNAL_CLOCK_VALUE)
134 #define EXTERNAL_CLOCK_VALUE 48000U /*!< Value of the I2S_CKIN, I2S and SAI1 external clock source in Hz */
135 #endif /* EXTERNAL_CLOCK_VALUE */
141 /** @defgroup RCC_LL_EC_CLEAR_FLAG Clear Flags Defines
142 * @brief Flags defines which can be used with LL_RCC_WriteReg function
145 #define LL_RCC_CICR_LSIRDYC RCC_CICR_LSIRDYC /*!< LSI Ready Interrupt Clear */
146 #define LL_RCC_CICR_LSERDYC RCC_CICR_LSERDYC /*!< LSE Ready Interrupt Clear */
147 #define LL_RCC_CICR_HSIRDYC RCC_CICR_HSIRDYC /*!< HSI Ready Interrupt Clear */
148 #define LL_RCC_CICR_HSERDYC RCC_CICR_HSERDYC /*!< HSE Ready Interrupt Clear */
149 #define LL_RCC_CICR_PLLRDYC RCC_CICR_PLLRDYC /*!< PLL Ready Interrupt Clear */
150 #define LL_RCC_CICR_HSI48RDYC RCC_CICR_HSI48RDYC /*!< HSI48 Ready Interrupt Clear */
151 #define LL_RCC_CICR_LSECSSC RCC_CICR_LSECSSC /*!< LSE Clock Security System Interrupt Clear */
152 #define LL_RCC_CICR_CSSC RCC_CICR_CSSC /*!< Clock Security System Interrupt Clear */
157 /** @defgroup RCC_LL_EC_GET_FLAG Get Flags Defines
158 * @brief Flags defines which can be used with LL_RCC_ReadReg function
161 #define LL_RCC_CIFR_LSIRDYF RCC_CIFR_LSIRDYF /*!< LSI Ready Interrupt flag */
162 #define LL_RCC_CIFR_LSERDYF RCC_CIFR_LSERDYF /*!< LSE Ready Interrupt flag */
163 #define LL_RCC_CIFR_HSIRDYF RCC_CIFR_HSIRDYF /*!< HSI Ready Interrupt flag */
164 #define LL_RCC_CIFR_HSERDYF RCC_CIFR_HSERDYF /*!< HSE Ready Interrupt flag */
165 #define LL_RCC_CIFR_PLLRDYF RCC_CIFR_PLLRDYF /*!< PLL Ready Interrupt flag */
166 #define LL_RCC_CIFR_HSI48RDYF RCC_CIFR_HSI48RDYF /*!< HSI48 Ready Interrupt flag */
167 #define LL_RCC_CIFR_LSECSSF RCC_CIFR_LSECSSF /*!< LSE Clock Security System Interrupt flag */
168 #define LL_RCC_CIFR_CSSF RCC_CIFR_CSSF /*!< Clock Security System Interrupt flag */
169 #define LL_RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF /*!< Low-Power reset 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_SFTRSTF RCC_CSR_SFTRSTF /*!< Software Reset flag */
173 #define LL_RCC_CSR_IWDGRSTF RCC_CSR_IWDGRSTF /*!< Independent Watchdog reset flag */
174 #define LL_RCC_CSR_WWDGRSTF RCC_CSR_WWDGRSTF /*!< Window watchdog reset flag */
175 #define LL_RCC_CSR_BORRSTF RCC_CSR_BORRSTF /*!< BOR reset flag */
180 /** @defgroup RCC_LL_EC_IT IT Defines
181 * @brief IT defines which can be used with LL_RCC_ReadReg and LL_RCC_WriteReg functions
184 #define LL_RCC_CIER_LSIRDYIE RCC_CIER_LSIRDYIE /*!< LSI Ready Interrupt Enable */
185 #define LL_RCC_CIER_LSERDYIE RCC_CIER_LSERDYIE /*!< LSE Ready Interrupt Enable */
186 #define LL_RCC_CIER_HSIRDYIE RCC_CIER_HSIRDYIE /*!< HSI Ready Interrupt Enable */
187 #define LL_RCC_CIER_HSERDYIE RCC_CIER_HSERDYIE /*!< HSE Ready Interrupt Enable */
188 #define LL_RCC_CIER_PLLRDYIE RCC_CIER_PLLRDYIE /*!< PLL Ready Interrupt Enable */
189 #define LL_RCC_CIER_HSI48RDYIE RCC_CIER_HSI48RDYIE /*!< HSI48 Ready Interrupt Enable */
190 #define LL_RCC_CIER_LSECSSIE RCC_CIER_LSECSSIE /*!< LSE CSS Interrupt Enable */
195 /** @defgroup RCC_LL_EC_LSEDRIVE LSE oscillator drive capability
198 #define LL_RCC_LSEDRIVE_LOW 0x00000000U /*!< Xtal mode lower driving capability */
199 #define LL_RCC_LSEDRIVE_MEDIUMLOW RCC_BDCR_LSEDRV_0 /*!< Xtal mode medium low driving capability */
200 #define LL_RCC_LSEDRIVE_MEDIUMHIGH RCC_BDCR_LSEDRV_1 /*!< Xtal mode medium high driving capability */
201 #define LL_RCC_LSEDRIVE_HIGH RCC_BDCR_LSEDRV /*!< Xtal mode higher driving capability */
206 /** @defgroup RCC_LL_EC_LSCO_CLKSOURCE LSCO Selection
209 #define LL_RCC_LSCO_CLKSOURCE_LSI 0x00000000U /*!< LSI selection for low speed clock */
210 #define LL_RCC_LSCO_CLKSOURCE_LSE RCC_BDCR_LSCOSEL /*!< LSE selection for low speed clock */
215 /** @defgroup RCC_LL_EC_SYS_CLKSOURCE System clock switch
218 #define LL_RCC_SYS_CLKSOURCE_HSI RCC_CFGR_SW_HSI /*!< HSI selection as system clock */
219 #define LL_RCC_SYS_CLKSOURCE_HSE RCC_CFGR_SW_HSE /*!< HSE selection as system clock */
220 #define LL_RCC_SYS_CLKSOURCE_PLL RCC_CFGR_SW_PLL /*!< PLL selection as system clock */
225 /** @defgroup RCC_LL_EC_SYS_CLKSOURCE_STATUS System clock switch status
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 */
235 /** @defgroup RCC_LL_EC_SYSCLK_DIV AHB prescaler
238 #define LL_RCC_SYSCLK_DIV_1 RCC_CFGR_HPRE_DIV1 /*!< SYSCLK not divided */
239 #define LL_RCC_SYSCLK_DIV_2 RCC_CFGR_HPRE_DIV2 /*!< SYSCLK divided by 2 */
240 #define LL_RCC_SYSCLK_DIV_4 RCC_CFGR_HPRE_DIV4 /*!< SYSCLK divided by 4 */
241 #define LL_RCC_SYSCLK_DIV_8 RCC_CFGR_HPRE_DIV8 /*!< SYSCLK divided by 8 */
242 #define LL_RCC_SYSCLK_DIV_16 RCC_CFGR_HPRE_DIV16 /*!< SYSCLK divided by 16 */
243 #define LL_RCC_SYSCLK_DIV_64 RCC_CFGR_HPRE_DIV64 /*!< SYSCLK divided by 64 */
244 #define LL_RCC_SYSCLK_DIV_128 RCC_CFGR_HPRE_DIV128 /*!< SYSCLK divided by 128 */
245 #define LL_RCC_SYSCLK_DIV_256 RCC_CFGR_HPRE_DIV256 /*!< SYSCLK divided by 256 */
246 #define LL_RCC_SYSCLK_DIV_512 RCC_CFGR_HPRE_DIV512 /*!< SYSCLK divided by 512 */
251 /** @defgroup RCC_LL_EC_APB1_DIV APB low-speed prescaler (APB1)
254 #define LL_RCC_APB1_DIV_1 RCC_CFGR_PPRE1_DIV1 /*!< HCLK not divided */
255 #define LL_RCC_APB1_DIV_2 RCC_CFGR_PPRE1_DIV2 /*!< HCLK divided by 2 */
256 #define LL_RCC_APB1_DIV_4 RCC_CFGR_PPRE1_DIV4 /*!< HCLK divided by 4 */
257 #define LL_RCC_APB1_DIV_8 RCC_CFGR_PPRE1_DIV8 /*!< HCLK divided by 8 */
258 #define LL_RCC_APB1_DIV_16 RCC_CFGR_PPRE1_DIV16 /*!< HCLK divided by 16 */
263 /** @defgroup RCC_LL_EC_APB2_DIV APB high-speed prescaler (APB2)
266 #define LL_RCC_APB2_DIV_1 RCC_CFGR_PPRE2_DIV1 /*!< HCLK not divided */
267 #define LL_RCC_APB2_DIV_2 RCC_CFGR_PPRE2_DIV2 /*!< HCLK divided by 2 */
268 #define LL_RCC_APB2_DIV_4 RCC_CFGR_PPRE2_DIV4 /*!< HCLK divided by 4 */
269 #define LL_RCC_APB2_DIV_8 RCC_CFGR_PPRE2_DIV8 /*!< HCLK divided by 8 */
270 #define LL_RCC_APB2_DIV_16 RCC_CFGR_PPRE2_DIV16 /*!< HCLK divided by 16 */
275 /** @defgroup RCC_LL_EC_MCO1SOURCE MCO1 SOURCE selection
278 #define LL_RCC_MCO1SOURCE_NOCLOCK 0x00000000U /*!< MCO output disabled, no clock on MCO */
279 #define LL_RCC_MCO1SOURCE_SYSCLK RCC_CFGR_MCOSEL_0 /*!< SYSCLK selection as MCO1 source */
280 #define LL_RCC_MCO1SOURCE_HSI (RCC_CFGR_MCOSEL_0| RCC_CFGR_MCOSEL_1) /*!< HSI16 selection as MCO1 source */
281 #define LL_RCC_MCO1SOURCE_HSE RCC_CFGR_MCOSEL_2 /*!< HSE selection as MCO1 source */
282 #define LL_RCC_MCO1SOURCE_PLLCLK (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_2) /*!< Main PLL selection as MCO1 source */
283 #define LL_RCC_MCO1SOURCE_LSI (RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSI selection as MCO1 source */
284 #define LL_RCC_MCO1SOURCE_LSE (RCC_CFGR_MCOSEL_0|RCC_CFGR_MCOSEL_1|RCC_CFGR_MCOSEL_2) /*!< LSE selection as MCO1 source */
285 #define LL_RCC_MCO1SOURCE_HSI48 RCC_CFGR_MCOSEL_3 /*!< HSI48 selection as MCO1 source */
290 /** @defgroup RCC_LL_EC_MCO1_DIV MCO1 prescaler
293 #define LL_RCC_MCO1_DIV_1 RCC_CFGR_MCOPRE_DIV1 /*!< MCO not divided */
294 #define LL_RCC_MCO1_DIV_2 RCC_CFGR_MCOPRE_DIV2 /*!< MCO divided by 2 */
295 #define LL_RCC_MCO1_DIV_4 RCC_CFGR_MCOPRE_DIV4 /*!< MCO divided by 4 */
296 #define LL_RCC_MCO1_DIV_8 RCC_CFGR_MCOPRE_DIV8 /*!< MCO divided by 8 */
297 #define LL_RCC_MCO1_DIV_16 RCC_CFGR_MCOPRE_DIV16 /*!< MCO divided by 16 */
302 #if defined(USE_FULL_LL_DRIVER)
303 /** @defgroup RCC_LL_EC_PERIPH_FREQUENCY Peripheral clock frequency
306 #define LL_RCC_PERIPH_FREQUENCY_NO 0x00000000U /*!< No clock enabled for the peripheral */
307 #define LL_RCC_PERIPH_FREQUENCY_NA 0xFFFFFFFFU /*!< Frequency cannot be provided as external clock */
311 #endif /* USE_FULL_LL_DRIVER */
313 /** @defgroup RCC_LL_EC_USARTx_CLKSOURCE Peripheral USART clock source selection
316 #define LL_RCC_USART1_CLKSOURCE_PCLK2 (RCC_CCIPR_USART1SEL << 16U) /*!< PCLK2 clock used as USART1 clock source */
317 #define LL_RCC_USART1_CLKSOURCE_SYSCLK ((RCC_CCIPR_USART1SEL << 16U) | RCC_CCIPR_USART1SEL_0) /*!< SYSCLK clock used as USART1 clock source */
318 #define LL_RCC_USART1_CLKSOURCE_HSI ((RCC_CCIPR_USART1SEL << 16U) | RCC_CCIPR_USART1SEL_1) /*!< HSI clock used as USART1 clock source */
319 #define LL_RCC_USART1_CLKSOURCE_LSE ((RCC_CCIPR_USART1SEL << 16U) | RCC_CCIPR_USART1SEL) /*!< LSE clock used as USART1 clock source */
320 #define LL_RCC_USART2_CLKSOURCE_PCLK1 (RCC_CCIPR_USART2SEL << 16U) /*!< PCLK1 clock used as USART2 clock source */
321 #define LL_RCC_USART2_CLKSOURCE_SYSCLK ((RCC_CCIPR_USART2SEL << 16U) | RCC_CCIPR_USART2SEL_0) /*!< SYSCLK clock used as USART2 clock source */
322 #define LL_RCC_USART2_CLKSOURCE_HSI ((RCC_CCIPR_USART2SEL << 16U) | RCC_CCIPR_USART2SEL_1) /*!< HSI clock used as USART2 clock source */
323 #define LL_RCC_USART2_CLKSOURCE_LSE ((RCC_CCIPR_USART2SEL << 16U) | RCC_CCIPR_USART2SEL) /*!< LSE clock used as USART2 clock source */
324 #define LL_RCC_USART3_CLKSOURCE_PCLK1 (RCC_CCIPR_USART3SEL << 16U) /*!< PCLK1 clock used as USART3 clock source */
325 #define LL_RCC_USART3_CLKSOURCE_SYSCLK ((RCC_CCIPR_USART3SEL << 16U) | RCC_CCIPR_USART3SEL_0) /*!< SYSCLK clock used as USART3 clock source */
326 #define LL_RCC_USART3_CLKSOURCE_HSI ((RCC_CCIPR_USART3SEL << 16U) | RCC_CCIPR_USART3SEL_1) /*!< HSI clock used as USART3 clock source */
327 #define LL_RCC_USART3_CLKSOURCE_LSE ((RCC_CCIPR_USART3SEL << 16U) | RCC_CCIPR_USART3SEL) /*!< LSE clock used as USART3 clock source */
332 /** @defgroup RCC_LL_EC_UARTx_CLKSOURCE Peripheral UART clock source selection
335 #if defined(RCC_CCIPR_UART4SEL)
336 #define LL_RCC_UART4_CLKSOURCE_PCLK1 (RCC_CCIPR_UART4SEL << 16U) /*!< PCLK1 clock used as UART4 clock source */
337 #define LL_RCC_UART4_CLKSOURCE_SYSCLK ((RCC_CCIPR_UART4SEL << 16U) | RCC_CCIPR_UART4SEL_0) /*!< SYSCLK clock used as UART4 clock source */
338 #define LL_RCC_UART4_CLKSOURCE_HSI ((RCC_CCIPR_UART4SEL << 16U) | RCC_CCIPR_UART4SEL_1) /*!< HSI clock used as UART4 clock source */
339 #define LL_RCC_UART4_CLKSOURCE_LSE ((RCC_CCIPR_UART4SEL << 16U) | RCC_CCIPR_UART4SEL) /*!< LSE clock used as UART4 clock source */
340 #endif /* RCC_CCIPR_UART4SEL */
341 #if defined(RCC_CCIPR_UART5SEL)
342 #define LL_RCC_UART5_CLKSOURCE_PCLK1 (RCC_CCIPR_UART5SEL << 16U) /*!< PCLK1 clock used as UART5 clock source */
343 #define LL_RCC_UART5_CLKSOURCE_SYSCLK ((RCC_CCIPR_UART5SEL << 16U) | RCC_CCIPR_UART5SEL_0) /*!< SYSCLK clock used as UART5 clock source */
344 #define LL_RCC_UART5_CLKSOURCE_HSI ((RCC_CCIPR_UART5SEL << 16U) | RCC_CCIPR_UART5SEL_1) /*!< HSI clock used as UART5 clock source */
345 #define LL_RCC_UART5_CLKSOURCE_LSE ((RCC_CCIPR_UART5SEL << 16U) | RCC_CCIPR_UART5SEL) /*!< LSE clock used as UART5 clock source */
346 #endif /* RCC_CCIPR_UART5SEL */
351 /** @defgroup RCC_LL_EC_LPUART1_CLKSOURCE Peripheral LPUART clock source selection
354 #define LL_RCC_LPUART1_CLKSOURCE_PCLK1 0x00000000U /*!< PCLK1 clock used as LPUART1 clock source */
355 #define LL_RCC_LPUART1_CLKSOURCE_SYSCLK RCC_CCIPR_LPUART1SEL_0 /*!< SYSCLK clock used as LPUART1 clock source */
356 #define LL_RCC_LPUART1_CLKSOURCE_HSI RCC_CCIPR_LPUART1SEL_1 /*!< HSI clock used as LPUART1 clock source */
357 #define LL_RCC_LPUART1_CLKSOURCE_LSE RCC_CCIPR_LPUART1SEL /*!< LSE clock used as LPUART1 clock source */
362 /** @defgroup RCC_LL_EC_I2Cx_CLKSOURCE Peripheral I2C clock source selection
365 #define LL_RCC_I2C1_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C1SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C1 clock source */
366 #define LL_RCC_I2C1_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C1SEL_Pos << 16U) | (RCC_CCIPR_I2C1SEL_0 >> RCC_CCIPR_I2C1SEL_Pos)) /*!< SYSCLK clock used as I2C1 clock source */
367 #define LL_RCC_I2C1_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C1SEL_Pos << 16U) | (RCC_CCIPR_I2C1SEL_1 >> RCC_CCIPR_I2C1SEL_Pos)) /*!< HSI clock used as I2C1 clock source */
368 #define LL_RCC_I2C2_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C2SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C2 clock source */
369 #define LL_RCC_I2C2_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C2SEL_Pos << 16U) | (RCC_CCIPR_I2C2SEL_0 >> RCC_CCIPR_I2C2SEL_Pos)) /*!< SYSCLK clock used as I2C2 clock source */
370 #define LL_RCC_I2C2_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C2SEL_Pos << 16U) | (RCC_CCIPR_I2C2SEL_1 >> RCC_CCIPR_I2C2SEL_Pos)) /*!< HSI clock used as I2C2 clock source */
371 #define LL_RCC_I2C3_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C3SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C3 clock source */
372 #define LL_RCC_I2C3_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C3SEL_Pos << 16U) | (RCC_CCIPR_I2C3SEL_0 >> RCC_CCIPR_I2C3SEL_Pos)) /*!< SYSCLK clock used as I2C3 clock source */
373 #define LL_RCC_I2C3_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C3SEL_Pos << 16U) | (RCC_CCIPR_I2C3SEL_1 >> RCC_CCIPR_I2C3SEL_Pos)) /*!< HSI clock used as I2C3 clock source */
374 #if defined(RCC_CCIPR2_I2C4SEL)
375 #define LL_RCC_I2C4_CLKSOURCE_PCLK1 ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U)) /*!< PCLK1 clock used as I2C4 clock source */
376 #define LL_RCC_I2C4_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U) | (RCC_CCIPR2_I2C4SEL_0 >> RCC_CCIPR2_I2C4SEL_Pos)) /*!< SYSCLK clock used as I2C4 clock source */
377 #define LL_RCC_I2C4_CLKSOURCE_HSI ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U) | (RCC_CCIPR2_I2C4SEL_1 >> RCC_CCIPR2_I2C4SEL_Pos)) /*!< HSI clock used as I2C4 clock source */
378 #endif /* RCC_CCIPR2_I2C4SEL */
383 /** @defgroup RCC_LL_EC_LPTIM1_CLKSOURCE Peripheral LPTIM clock source selection
386 #define LL_RCC_LPTIM1_CLKSOURCE_PCLK1 0x00000000U /*!< PCLK1 clock used as LPTIM1 clock source */
387 #define LL_RCC_LPTIM1_CLKSOURCE_LSI RCC_CCIPR_LPTIM1SEL_0 /*!< LSI clock used as LPTIM1 clock source */
388 #define LL_RCC_LPTIM1_CLKSOURCE_HSI RCC_CCIPR_LPTIM1SEL_1 /*!< HSI clock used as LPTIM1 clock source */
389 #define LL_RCC_LPTIM1_CLKSOURCE_LSE RCC_CCIPR_LPTIM1SEL /*!< LSE clock used as LPTIM1 clock source */
394 /** @defgroup RCC_LL_EC_SAI1_CLKSOURCE Peripheral SAI clock source selection
397 #define LL_RCC_SAI1_CLKSOURCE_SYSCLK 0x00000000U /*!< System clock used as SAI1 clock source */
398 #define LL_RCC_SAI1_CLKSOURCE_PLL RCC_CCIPR_SAI1SEL_0 /*!< PLL clock used as SAI1 clock source */
399 #define LL_RCC_SAI1_CLKSOURCE_PIN RCC_CCIPR_SAI1SEL_1 /*!< EXT clock used as SAI1 clock source */
400 #define LL_RCC_SAI1_CLKSOURCE_HSI (RCC_CCIPR_SAI1SEL_0 | RCC_CCIPR_SAI1SEL_1) /*!< HSI clock used as SAI1 clock source */
405 /** @defgroup RCC_LL_EC_I2S_CLKSOURCE Peripheral I2S clock source selection
408 #define LL_RCC_I2S_CLKSOURCE_SYSCLK 0x00000000U /*!< System clock used as I2S clock source */
409 #define LL_RCC_I2S_CLKSOURCE_PLL RCC_CCIPR_I2S23SEL_0 /*!< PLL clock used as I2S clock source */
410 #define LL_RCC_I2S_CLKSOURCE_PIN RCC_CCIPR_I2S23SEL_1 /*!< EXT clock used as I2S clock source */
411 #define LL_RCC_I2S_CLKSOURCE_HSI (RCC_CCIPR_I2S23SEL_0 | RCC_CCIPR_I2S23SEL_1) /*!< HSI clock used as I2S clock source */
417 /** @defgroup RCC_LL_EC_FDCAN_CLKSOURCE Peripheral FDCAN clock source selection
420 #define LL_RCC_FDCAN_CLKSOURCE_HSE 0x00000000U /*!< HSE clock used as FDCAN clock source */
421 #define LL_RCC_FDCAN_CLKSOURCE_PLL RCC_CCIPR_FDCANSEL_0 /*!< PLL clock used as FDCAN clock source */
422 #define LL_RCC_FDCAN_CLKSOURCE_PCLK1 RCC_CCIPR_FDCANSEL_1 /*!< PCLK1 clock used as FDCAN clock source */
428 /** @defgroup RCC_LL_EC_RNG_CLKSOURCE Peripheral RNG clock source selection
431 #define LL_RCC_RNG_CLKSOURCE_HSI48 0x00000000U /*!< HSI48 clock used as RNG clock source */
432 #define LL_RCC_RNG_CLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1 /*!< PLL clock used as RNG clock source */
437 /** @defgroup RCC_LL_EC_USB_CLKSOURCE Peripheral USB clock source selection
440 #define LL_RCC_USB_CLKSOURCE_HSI48 0x00000000U /*!< HSI48 clock used as USB clock source */
441 #define LL_RCC_USB_CLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1 /*!< PLL clock used as USB clock source */
446 /** @defgroup RCC_LL_EC_ADC_CLKSOURCE Peripheral ADC clock source selection
449 #define LL_RCC_ADC12_CLKSOURCE_NONE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_ADC12SEL_Pos << 16U)) /*!< No clock used as ADC12 clock source */
450 #define LL_RCC_ADC12_CLKSOURCE_PLL ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_ADC12SEL_Pos << 16U) | (RCC_CCIPR_ADC12SEL_0 >> RCC_CCIPR_ADC12SEL_Pos)) /*!< PLL clock used as ADC12 clock source */
451 #define LL_RCC_ADC12_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_ADC12SEL_Pos << 16U) | (RCC_CCIPR_ADC12SEL_1 >> RCC_CCIPR_ADC12SEL_Pos)) /*!< SYSCLK clock used as ADC12 clock source */
452 #if defined(RCC_CCIPR_ADC345SEL)
453 #define LL_RCC_ADC345_CLKSOURCE_NONE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_ADC345SEL_Pos << 16U)) /*!< No clock used as ADC345 clock source */
454 #define LL_RCC_ADC345_CLKSOURCE_PLL ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_ADC345SEL_Pos << 16U) | (RCC_CCIPR_ADC345SEL_0 >> RCC_CCIPR_ADC345SEL_Pos)) /*!< PLL clock used as ADC345 clock source */
455 #define LL_RCC_ADC345_CLKSOURCE_SYSCLK ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_ADC345SEL_Pos << 16U) | (RCC_CCIPR_ADC345SEL_1 >> RCC_CCIPR_ADC345SEL_Pos)) /*!< SYSCLK clock used as ADC345 clock source */
456 #endif /* RCC_CCIPR_ADC345SEL */
461 /** @defgroup RCC_LL_EC_QUADSPI Peripheral QUADSPI get clock source
464 #define LL_RCC_QUADSPI_CLKSOURCE_SYSCLK 0x00000000U /*!< SYSCLK used as QuadSPI clock source */
465 #define LL_RCC_QUADSPI_CLKSOURCE_HSI RCC_CCIPR2_QSPISEL_0 /*!< HSI used as QuadSPI clock source */
466 #define LL_RCC_QUADSPI_CLKSOURCE_PLL RCC_CCIPR2_QSPISEL_1 /*!< PLL used as QuadSPI clock source */
472 /** @defgroup RCC_LL_EC_USARTx Peripheral USART get clock source
475 #define LL_RCC_USART1_CLKSOURCE RCC_CCIPR_USART1SEL /*!< USART1 Clock source selection */
476 #define LL_RCC_USART2_CLKSOURCE RCC_CCIPR_USART2SEL /*!< USART2 Clock source selection */
477 #define LL_RCC_USART3_CLKSOURCE RCC_CCIPR_USART3SEL /*!< USART3 Clock source selection */
482 /** @defgroup RCC_LL_EC_UARTx Peripheral UART get clock source
485 #if defined(RCC_CCIPR_UART4SEL)
486 #define LL_RCC_UART4_CLKSOURCE RCC_CCIPR_UART4SEL /*!< UART4 Clock source selection */
487 #endif /* RCC_CCIPR_UART4SEL */
488 #if defined(RCC_CCIPR_UART5SEL)
489 #define LL_RCC_UART5_CLKSOURCE RCC_CCIPR_UART5SEL /*!< UART5 Clock source selection */
490 #endif /* RCC_CCIPR_UART5SEL */
495 /** @defgroup RCC_LL_EC_LPUART1 Peripheral LPUART get clock source
498 #define LL_RCC_LPUART1_CLKSOURCE RCC_CCIPR_LPUART1SEL /*!< LPUART1 Clock source selection */
503 /** @defgroup RCC_LL_EC_I2C1 Peripheral I2C get clock source
506 #define LL_RCC_I2C1_CLKSOURCE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C1SEL_Pos << 16U) | (RCC_CCIPR_I2C1SEL >> RCC_CCIPR_I2C1SEL_Pos)) /*!< I2C1 Clock source selection */
507 #define LL_RCC_I2C2_CLKSOURCE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C2SEL_Pos << 16U) | (RCC_CCIPR_I2C2SEL >> RCC_CCIPR_I2C2SEL_Pos)) /*!< I2C2 Clock source selection */
508 #define LL_RCC_I2C3_CLKSOURCE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_I2C3SEL_Pos << 16U) | (RCC_CCIPR_I2C3SEL >> RCC_CCIPR_I2C3SEL_Pos)) /*!< I2C3 Clock source selection */
509 #if defined(RCC_CCIPR2_I2C4SEL)
510 #define LL_RCC_I2C4_CLKSOURCE ((RCC_OFFSET_CCIPR2 << 24U) | (RCC_CCIPR2_I2C4SEL_Pos << 16U) | (RCC_CCIPR2_I2C4SEL >> RCC_CCIPR2_I2C4SEL_Pos)) /*!< I2C4 Clock source selection */
511 #endif /* RCC_CCIPR2_I2C4SEL */
516 /** @defgroup RCC_LL_EC_LPTIM1 Peripheral LPTIM get clock source
519 #define LL_RCC_LPTIM1_CLKSOURCE RCC_CCIPR_LPTIM1SEL /*!< LPTIM1 Clock source selection */
524 /** @defgroup RCC_LL_EC_SAI1 Peripheral SAI get clock source
527 #define LL_RCC_SAI1_CLKSOURCE RCC_CCIPR_SAI1SEL /*!< SAI1 Clock source selection */
532 /** @defgroup RCC_LL_EC_I2S Peripheral I2S get clock source
535 #define LL_RCC_I2S_CLKSOURCE RCC_CCIPR_I2S23SEL /*!< I2S Clock source selection */
541 /** @defgroup RCC_LL_EC_FDCAN Peripheral FDCAN get clock source
544 #define LL_RCC_FDCAN_CLKSOURCE RCC_CCIPR_FDCANSEL /*!< FDCAN Clock source selection */
551 /** @defgroup RCC_LL_EC_RNG Peripheral RNG get clock source
554 #define LL_RCC_RNG_CLKSOURCE RCC_CCIPR_CLK48SEL /*!< RNG Clock source selection */
559 /** @defgroup RCC_LL_EC_USB Peripheral USB get clock source
562 #define LL_RCC_USB_CLKSOURCE RCC_CCIPR_CLK48SEL /*!< USB Clock source selection */
567 /** @defgroup RCC_LL_EC_ADC Peripheral ADC get clock source
570 #define LL_RCC_ADC12_CLKSOURCE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_ADC12SEL_Pos << 16U) | (RCC_CCIPR_ADC12SEL >> RCC_CCIPR_ADC12SEL_Pos)) /*!< ADC12 Clock source selection */
571 #if defined(RCC_CCIPR_ADC345SEL_Pos)
572 #define LL_RCC_ADC345_CLKSOURCE ((RCC_OFFSET_CCIPR << 24U) | (RCC_CCIPR_ADC345SEL_Pos << 16U) | (RCC_CCIPR_ADC345SEL >> RCC_CCIPR_ADC345SEL_Pos)) /*!< ADC345 Clock source selection */
573 #endif /* RCC_CCIPR_ADC345SEL_Pos */
578 /** @defgroup RCC_LL_EC_QUADSPI Peripheral QUADSPI get clock source
581 #define LL_RCC_QUADSPI_CLKSOURCE RCC_CCIPR2_QSPISEL /*!< QuadSPI Clock source selection */
586 /** @defgroup RCC_LL_EC_RTC_CLKSOURCE RTC clock source selection
589 #define LL_RCC_RTC_CLKSOURCE_NONE 0x00000000U /*!< No clock used as RTC clock */
590 #define LL_RCC_RTC_CLKSOURCE_LSE RCC_BDCR_RTCSEL_0 /*!< LSE oscillator clock used as RTC clock */
591 #define LL_RCC_RTC_CLKSOURCE_LSI RCC_BDCR_RTCSEL_1 /*!< LSI oscillator clock used as RTC clock */
592 #define LL_RCC_RTC_CLKSOURCE_HSE_DIV32 RCC_BDCR_RTCSEL /*!< HSE oscillator clock divided by 32 used as RTC clock */
598 /** @defgroup RCC_LL_EC_PLLSOURCE PLL entry clock source
601 #define LL_RCC_PLLSOURCE_NONE 0x00000000U /*!< No clock */
602 #define LL_RCC_PLLSOURCE_HSI RCC_PLLCFGR_PLLSRC_HSI /*!< HSI16 clock selected as PLL entry clock source */
603 #define LL_RCC_PLLSOURCE_HSE RCC_PLLCFGR_PLLSRC_HSE /*!< HSE clock selected as PLL entry clock source */
608 /** @defgroup RCC_LL_EC_PLLM_DIV PLL division factor
611 #define LL_RCC_PLLM_DIV_1 0x00000000U /*!< PLL division factor by 1 */
612 #define LL_RCC_PLLM_DIV_2 RCC_PLLCFGR_PLLM_0 /*!< PLL division factor by 2 */
613 #define LL_RCC_PLLM_DIV_3 RCC_PLLCFGR_PLLM_1 /*!< PLL division factor by 3 */
614 #define LL_RCC_PLLM_DIV_4 (RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL division factor by 4 */
615 #define LL_RCC_PLLM_DIV_5 RCC_PLLCFGR_PLLM_2 /*!< PLL division factor by 5 */
616 #define LL_RCC_PLLM_DIV_6 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL division factor by 6 */
617 #define LL_RCC_PLLM_DIV_7 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL division factor by 7 */
618 #define LL_RCC_PLLM_DIV_8 (RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL division factor by 8 */
619 #define LL_RCC_PLLM_DIV_9 RCC_PLLCFGR_PLLM_3 /*!< PLL division factor by 9 */
620 #define LL_RCC_PLLM_DIV_10 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_0) /*!< PLL division factor by 10 */
621 #define LL_RCC_PLLM_DIV_11 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1) /*!< PLL division factor by 11 */
622 #define LL_RCC_PLLM_DIV_12 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL division factor by 12 */
623 #define LL_RCC_PLLM_DIV_13 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2) /*!< PLL division factor by 13 */
624 #define LL_RCC_PLLM_DIV_14 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_0) /*!< PLL division factor by 14 */
625 #define LL_RCC_PLLM_DIV_15 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1) /*!< PLL division factor by 15 */
626 #define LL_RCC_PLLM_DIV_16 (RCC_PLLCFGR_PLLM_3 | RCC_PLLCFGR_PLLM_2 | RCC_PLLCFGR_PLLM_1 | RCC_PLLCFGR_PLLM_0) /*!< PLL division factor by 16 */
631 /** @defgroup RCC_LL_EC_PLLR_DIV PLL division factor (PLLR)
634 #define LL_RCC_PLLR_DIV_2 0x00000000U /*!< Main PLL division factor for PLLCLK (system clock) by 2 */
635 #define LL_RCC_PLLR_DIV_4 (RCC_PLLCFGR_PLLR_0) /*!< Main PLL division factor for PLLCLK (system clock) by 4 */
636 #define LL_RCC_PLLR_DIV_6 (RCC_PLLCFGR_PLLR_1) /*!< Main PLL division factor for PLLCLK (system clock) by 6 */
637 #define LL_RCC_PLLR_DIV_8 (RCC_PLLCFGR_PLLR) /*!< Main PLL division factor for PLLCLK (system clock) by 8 */
642 /** @defgroup RCC_LL_EC_PLLP_DIV PLL division factor (PLLP)
645 #define LL_RCC_PLLP_DIV_2 (RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 2 */
646 #define LL_RCC_PLLP_DIV_3 (RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 3 */
647 #define LL_RCC_PLLP_DIV_4 (RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 4 */
648 #define LL_RCC_PLLP_DIV_5 (RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 5 */
649 #define LL_RCC_PLLP_DIV_6 (RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 6 */
650 #define LL_RCC_PLLP_DIV_7 (RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 7 */
651 #define LL_RCC_PLLP_DIV_8 (RCC_PLLCFGR_PLLPDIV_3) /*!< Main PLL division factor for PLLP output by 8 */
652 #define LL_RCC_PLLP_DIV_9 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 9 */
653 #define LL_RCC_PLLP_DIV_10 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 10 */
654 #define LL_RCC_PLLP_DIV_11 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 11 */
655 #define LL_RCC_PLLP_DIV_12 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 12 */
656 #define LL_RCC_PLLP_DIV_13 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 13 */
657 #define LL_RCC_PLLP_DIV_14 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 14 */
658 #define LL_RCC_PLLP_DIV_15 (RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 15 */
659 #define LL_RCC_PLLP_DIV_16 (RCC_PLLCFGR_PLLPDIV_4) /*!< Main PLL division factor for PLLP output by 16 */
660 #define LL_RCC_PLLP_DIV_17 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 17 */
661 #define LL_RCC_PLLP_DIV_18 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 18 */
662 #define LL_RCC_PLLP_DIV_19 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 19 */
663 #define LL_RCC_PLLP_DIV_20 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 20 */
664 #define LL_RCC_PLLP_DIV_21 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 21 */
665 #define LL_RCC_PLLP_DIV_22 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 22 */
666 #define LL_RCC_PLLP_DIV_23 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 23 */
667 #define LL_RCC_PLLP_DIV_24 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3) /*!< Main PLL division factor for PLLP output by 24 */
668 #define LL_RCC_PLLP_DIV_25 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 25 */
669 #define LL_RCC_PLLP_DIV_26 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 26 */
670 #define LL_RCC_PLLP_DIV_27 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 27 */
671 #define LL_RCC_PLLP_DIV_28 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2) /*!< Main PLL division factor for PLLP output by 28 */
672 #define LL_RCC_PLLP_DIV_29 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 29 */
673 #define LL_RCC_PLLP_DIV_30 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1) /*!< Main PLL division factor for PLLP output by 30 */
674 #define LL_RCC_PLLP_DIV_31 (RCC_PLLCFGR_PLLPDIV_4|RCC_PLLCFGR_PLLPDIV_3|RCC_PLLCFGR_PLLPDIV_2|RCC_PLLCFGR_PLLPDIV_1|RCC_PLLCFGR_PLLPDIV_0) /*!< Main PLL division factor for PLLP output by 31 */
679 /** @defgroup RCC_LL_EC_PLLQ_DIV PLL division factor (PLLQ)
682 #define LL_RCC_PLLQ_DIV_2 0x00000000U /*!< Main PLL division factor for PLLQ output by 2 */
683 #define LL_RCC_PLLQ_DIV_4 (RCC_PLLCFGR_PLLQ_0) /*!< Main PLL division factor for PLLQ output by 4 */
684 #define LL_RCC_PLLQ_DIV_6 (RCC_PLLCFGR_PLLQ_1) /*!< Main PLL division factor for PLLQ output by 6 */
685 #define LL_RCC_PLLQ_DIV_8 (RCC_PLLCFGR_PLLQ) /*!< Main PLL division factor for PLLQ output by 8 */
694 /* Exported macro ------------------------------------------------------------*/
695 /** @defgroup RCC_LL_Exported_Macros RCC Exported Macros
699 /** @defgroup RCC_LL_EM_WRITE_READ Common Write and read registers Macros
704 * @brief Write a value in RCC register
705 * @param __REG__ Register to be written
706 * @param __VALUE__ Value to be written in the register
709 #define LL_RCC_WriteReg(__REG__, __VALUE__) WRITE_REG(RCC->__REG__, __VALUE__)
712 * @brief Read a value in RCC register
713 * @param __REG__ Register to be read
714 * @retval Register value
716 #define LL_RCC_ReadReg(__REG__) READ_REG(RCC->__REG__)
721 /** @defgroup RCC_LL_EM_CALC_FREQ Calculate frequencies
726 * @brief Helper macro to calculate the PLLCLK frequency on system domain
727 * @note ex: @ref __LL_RCC_CALC_PLLCLK_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
728 * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetR ());
729 * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
730 * @param __PLLM__ This parameter can be one of the following values:
731 * @arg @ref LL_RCC_PLLM_DIV_1
732 * @arg @ref LL_RCC_PLLM_DIV_2
733 * @arg @ref LL_RCC_PLLM_DIV_3
734 * @arg @ref LL_RCC_PLLM_DIV_4
735 * @arg @ref LL_RCC_PLLM_DIV_5
736 * @arg @ref LL_RCC_PLLM_DIV_6
737 * @arg @ref LL_RCC_PLLM_DIV_7
738 * @arg @ref LL_RCC_PLLM_DIV_8
739 * @arg @ref LL_RCC_PLLM_DIV_9
740 * @arg @ref LL_RCC_PLLM_DIV_10
741 * @arg @ref LL_RCC_PLLM_DIV_11
742 * @arg @ref LL_RCC_PLLM_DIV_12
743 * @arg @ref LL_RCC_PLLM_DIV_13
744 * @arg @ref LL_RCC_PLLM_DIV_14
745 * @arg @ref LL_RCC_PLLM_DIV_15
746 * @arg @ref LL_RCC_PLLM_DIV_16
747 * @param __PLLN__ Between Min_Data = 8 and Max_Data = 127
748 * @param __PLLR__ This parameter can be one of the following values:
749 * @arg @ref LL_RCC_PLLR_DIV_2
750 * @arg @ref LL_RCC_PLLR_DIV_4
751 * @arg @ref LL_RCC_PLLR_DIV_6
752 * @arg @ref LL_RCC_PLLR_DIV_8
753 * @retval PLL clock frequency (in Hz)
755 #define __LL_RCC_CALC_PLLCLK_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLR__) ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
756 ((((__PLLR__) >> RCC_PLLCFGR_PLLR_Pos) + 1U) * 2U))
759 * @brief Helper macro to calculate the PLLCLK frequency used on ADC domain
760 * @note ex: @ref __LL_RCC_CALC_PLLCLK_ADC_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
761 * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetP ());
762 * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
763 * @param __PLLM__ This parameter can be one of the following values:
764 * @arg @ref LL_RCC_PLLM_DIV_1
765 * @arg @ref LL_RCC_PLLM_DIV_2
766 * @arg @ref LL_RCC_PLLM_DIV_3
767 * @arg @ref LL_RCC_PLLM_DIV_4
768 * @arg @ref LL_RCC_PLLM_DIV_5
769 * @arg @ref LL_RCC_PLLM_DIV_6
770 * @arg @ref LL_RCC_PLLM_DIV_7
771 * @arg @ref LL_RCC_PLLM_DIV_8
772 * @arg @ref LL_RCC_PLLM_DIV_9
773 * @arg @ref LL_RCC_PLLM_DIV_10
774 * @arg @ref LL_RCC_PLLM_DIV_11
775 * @arg @ref LL_RCC_PLLM_DIV_12
776 * @arg @ref LL_RCC_PLLM_DIV_13
777 * @arg @ref LL_RCC_PLLM_DIV_14
778 * @arg @ref LL_RCC_PLLM_DIV_15
779 * @arg @ref LL_RCC_PLLM_DIV_16
781 * @param __PLLN__ Between Min_Data = 8 and Max_Data = 127
782 * @param __PLLP__ This parameter can be one of the following values:
783 * @arg @ref LL_RCC_PLLP_DIV_2
784 * @arg @ref LL_RCC_PLLP_DIV_3
785 * @arg @ref LL_RCC_PLLP_DIV_4
786 * @arg @ref LL_RCC_PLLP_DIV_5
787 * @arg @ref LL_RCC_PLLP_DIV_6
788 * @arg @ref LL_RCC_PLLP_DIV_7
789 * @arg @ref LL_RCC_PLLP_DIV_8
790 * @arg @ref LL_RCC_PLLP_DIV_9
791 * @arg @ref LL_RCC_PLLP_DIV_10
792 * @arg @ref LL_RCC_PLLP_DIV_11
793 * @arg @ref LL_RCC_PLLP_DIV_12
794 * @arg @ref LL_RCC_PLLP_DIV_13
795 * @arg @ref LL_RCC_PLLP_DIV_14
796 * @arg @ref LL_RCC_PLLP_DIV_15
797 * @arg @ref LL_RCC_PLLP_DIV_16
798 * @arg @ref LL_RCC_PLLP_DIV_17
799 * @arg @ref LL_RCC_PLLP_DIV_18
800 * @arg @ref LL_RCC_PLLP_DIV_19
801 * @arg @ref LL_RCC_PLLP_DIV_20
802 * @arg @ref LL_RCC_PLLP_DIV_21
803 * @arg @ref LL_RCC_PLLP_DIV_22
804 * @arg @ref LL_RCC_PLLP_DIV_23
805 * @arg @ref LL_RCC_PLLP_DIV_24
806 * @arg @ref LL_RCC_PLLP_DIV_25
807 * @arg @ref LL_RCC_PLLP_DIV_26
808 * @arg @ref LL_RCC_PLLP_DIV_27
809 * @arg @ref LL_RCC_PLLP_DIV_28
810 * @arg @ref LL_RCC_PLLP_DIV_29
811 * @arg @ref LL_RCC_PLLP_DIV_30
812 * @arg @ref LL_RCC_PLLP_DIV_31
813 * @retval PLL clock frequency (in Hz)
815 #define __LL_RCC_CALC_PLLCLK_ADC_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLP__) ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
816 ((__PLLP__) >> RCC_PLLCFGR_PLLPDIV_Pos))
819 * @brief Helper macro to calculate the PLLCLK frequency used on 48M domain
820 * @note ex: @ref __LL_RCC_CALC_PLLCLK_48M_FREQ (HSE_VALUE,@ref LL_RCC_PLL_GetDivider (),
821 * @ref LL_RCC_PLL_GetN (), @ref LL_RCC_PLL_GetQ ());
822 * @param __INPUTFREQ__ PLL Input frequency (based on HSE/HSI)
823 * @param __PLLM__ This parameter can be one of the following values:
824 * @arg @ref LL_RCC_PLLM_DIV_1
825 * @arg @ref LL_RCC_PLLM_DIV_2
826 * @arg @ref LL_RCC_PLLM_DIV_3
827 * @arg @ref LL_RCC_PLLM_DIV_4
828 * @arg @ref LL_RCC_PLLM_DIV_5
829 * @arg @ref LL_RCC_PLLM_DIV_6
830 * @arg @ref LL_RCC_PLLM_DIV_7
831 * @arg @ref LL_RCC_PLLM_DIV_8
832 * @arg @ref LL_RCC_PLLM_DIV_9
833 * @arg @ref LL_RCC_PLLM_DIV_10
834 * @arg @ref LL_RCC_PLLM_DIV_11
835 * @arg @ref LL_RCC_PLLM_DIV_12
836 * @arg @ref LL_RCC_PLLM_DIV_13
837 * @arg @ref LL_RCC_PLLM_DIV_14
838 * @arg @ref LL_RCC_PLLM_DIV_15
839 * @arg @ref LL_RCC_PLLM_DIV_16
840 * @param __PLLN__ Between Min_Data = 8 and Max_Data = 127
841 * @param __PLLQ__ This parameter can be one of the following values:
842 * @arg @ref LL_RCC_PLLQ_DIV_2
843 * @arg @ref LL_RCC_PLLQ_DIV_4
844 * @arg @ref LL_RCC_PLLQ_DIV_6
845 * @arg @ref LL_RCC_PLLQ_DIV_8
846 * @retval PLL clock frequency (in Hz)
848 #define __LL_RCC_CALC_PLLCLK_48M_FREQ(__INPUTFREQ__, __PLLM__, __PLLN__, __PLLQ__) ((__INPUTFREQ__) * (__PLLN__) / ((((__PLLM__)>> RCC_PLLCFGR_PLLM_Pos) + 1U)) / \
849 ((((__PLLQ__) >> RCC_PLLCFGR_PLLQ_Pos) + 1U) << 1U))
852 * @brief Helper macro to calculate the HCLK frequency
853 * @param __SYSCLKFREQ__ SYSCLK frequency (based on HSE/HSI/PLLCLK)
854 * @param __AHBPRESCALER__ This parameter can be one of the following values:
855 * @arg @ref LL_RCC_SYSCLK_DIV_1
856 * @arg @ref LL_RCC_SYSCLK_DIV_2
857 * @arg @ref LL_RCC_SYSCLK_DIV_4
858 * @arg @ref LL_RCC_SYSCLK_DIV_8
859 * @arg @ref LL_RCC_SYSCLK_DIV_16
860 * @arg @ref LL_RCC_SYSCLK_DIV_64
861 * @arg @ref LL_RCC_SYSCLK_DIV_128
862 * @arg @ref LL_RCC_SYSCLK_DIV_256
863 * @arg @ref LL_RCC_SYSCLK_DIV_512
864 * @retval HCLK clock frequency (in Hz)
866 #define __LL_RCC_CALC_HCLK_FREQ(__SYSCLKFREQ__,__AHBPRESCALER__) ((__SYSCLKFREQ__) >> (AHBPrescTable[((__AHBPRESCALER__) & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos] & 0x1FU))
869 * @brief Helper macro to calculate the PCLK1 frequency (ABP1)
870 * @param __HCLKFREQ__ HCLK frequency
871 * @param __APB1PRESCALER__ This parameter can be one of the following values:
872 * @arg @ref LL_RCC_APB1_DIV_1
873 * @arg @ref LL_RCC_APB1_DIV_2
874 * @arg @ref LL_RCC_APB1_DIV_4
875 * @arg @ref LL_RCC_APB1_DIV_8
876 * @arg @ref LL_RCC_APB1_DIV_16
877 * @retval PCLK1 clock frequency (in Hz)
879 #define __LL_RCC_CALC_PCLK1_FREQ(__HCLKFREQ__, __APB1PRESCALER__) ((__HCLKFREQ__) >> (APBPrescTable[(__APB1PRESCALER__) >> RCC_CFGR_PPRE1_Pos] & 0x1FU))
882 * @brief Helper macro to calculate the PCLK2 frequency (ABP2)
883 * @param __HCLKFREQ__ HCLK frequency
884 * @param __APB2PRESCALER__ This parameter can be one of the following values:
885 * @arg @ref LL_RCC_APB2_DIV_1
886 * @arg @ref LL_RCC_APB2_DIV_2
887 * @arg @ref LL_RCC_APB2_DIV_4
888 * @arg @ref LL_RCC_APB2_DIV_8
889 * @arg @ref LL_RCC_APB2_DIV_16
890 * @retval PCLK2 clock frequency (in Hz)
892 #define __LL_RCC_CALC_PCLK2_FREQ(__HCLKFREQ__, __APB2PRESCALER__) ((__HCLKFREQ__) >> (APBPrescTable[(__APB2PRESCALER__) >> RCC_CFGR_PPRE2_Pos] & 0x1FU))
902 /* Exported functions --------------------------------------------------------*/
903 /** @defgroup RCC_LL_Exported_Functions RCC Exported Functions
907 /** @defgroup RCC_LL_EF_HSE HSE
912 * @brief Enable the Clock Security System.
913 * @rmtoll CR CSSON LL_RCC_HSE_EnableCSS
916 __STATIC_INLINE
void LL_RCC_HSE_EnableCSS(void)
918 SET_BIT(RCC
->CR
, RCC_CR_CSSON
);
922 * @brief Enable HSE external oscillator (HSE Bypass)
923 * @rmtoll CR HSEBYP LL_RCC_HSE_EnableBypass
926 __STATIC_INLINE
void LL_RCC_HSE_EnableBypass(void)
928 SET_BIT(RCC
->CR
, RCC_CR_HSEBYP
);
932 * @brief Disable HSE external oscillator (HSE Bypass)
933 * @rmtoll CR HSEBYP LL_RCC_HSE_DisableBypass
936 __STATIC_INLINE
void LL_RCC_HSE_DisableBypass(void)
938 CLEAR_BIT(RCC
->CR
, RCC_CR_HSEBYP
);
942 * @brief Enable HSE crystal oscillator (HSE ON)
943 * @rmtoll CR HSEON LL_RCC_HSE_Enable
946 __STATIC_INLINE
void LL_RCC_HSE_Enable(void)
948 SET_BIT(RCC
->CR
, RCC_CR_HSEON
);
952 * @brief Disable HSE crystal oscillator (HSE ON)
953 * @rmtoll CR HSEON LL_RCC_HSE_Disable
956 __STATIC_INLINE
void LL_RCC_HSE_Disable(void)
958 CLEAR_BIT(RCC
->CR
, RCC_CR_HSEON
);
962 * @brief Check if HSE oscillator Ready
963 * @rmtoll CR HSERDY LL_RCC_HSE_IsReady
964 * @retval State of bit (1 or 0).
966 __STATIC_INLINE
uint32_t LL_RCC_HSE_IsReady(void)
968 return ((READ_BIT(RCC
->CR
, RCC_CR_HSERDY
) == (RCC_CR_HSERDY
)) ? 1UL : 0UL);
975 /** @defgroup RCC_LL_EF_HSI HSI
980 * @brief Enable HSI even in stop mode
981 * @note HSI oscillator is forced ON even in Stop mode
982 * @rmtoll CR HSIKERON LL_RCC_HSI_EnableInStopMode
985 __STATIC_INLINE
void LL_RCC_HSI_EnableInStopMode(void)
987 SET_BIT(RCC
->CR
, RCC_CR_HSIKERON
);
991 * @brief Disable HSI in stop mode
992 * @rmtoll CR HSIKERON LL_RCC_HSI_DisableInStopMode
995 __STATIC_INLINE
void LL_RCC_HSI_DisableInStopMode(void)
997 CLEAR_BIT(RCC
->CR
, RCC_CR_HSIKERON
);
1001 * @brief Enable HSI oscillator
1002 * @rmtoll CR HSION LL_RCC_HSI_Enable
1005 __STATIC_INLINE
void LL_RCC_HSI_Enable(void)
1007 SET_BIT(RCC
->CR
, RCC_CR_HSION
);
1011 * @brief Disable HSI oscillator
1012 * @rmtoll CR HSION LL_RCC_HSI_Disable
1015 __STATIC_INLINE
void LL_RCC_HSI_Disable(void)
1017 CLEAR_BIT(RCC
->CR
, RCC_CR_HSION
);
1021 * @brief Check if HSI clock is ready
1022 * @rmtoll CR HSIRDY LL_RCC_HSI_IsReady
1023 * @retval State of bit (1 or 0).
1025 __STATIC_INLINE
uint32_t LL_RCC_HSI_IsReady(void)
1027 return ((READ_BIT(RCC
->CR
, RCC_CR_HSIRDY
) == (RCC_CR_HSIRDY
)) ? 1UL : 0UL);
1031 * @brief Get HSI Calibration value
1032 * @note When HSITRIM is written, HSICAL is updated with the sum of
1033 * HSITRIM and the factory trim value
1034 * @rmtoll ICSCR HSICAL LL_RCC_HSI_GetCalibration
1035 * @retval Between Min_Data = 0x00 and Max_Data = 0xFF
1037 __STATIC_INLINE
uint32_t LL_RCC_HSI_GetCalibration(void)
1039 return (uint32_t)(READ_BIT(RCC
->ICSCR
, RCC_ICSCR_HSICAL
) >> RCC_ICSCR_HSICAL_Pos
);
1043 * @brief Set HSI Calibration trimming
1044 * @note user-programmable trimming value that is added to the HSICAL
1045 * @note Default value is 16, which, when added to the HSICAL value,
1046 * should trim the HSI to 16 MHz +/- 1 %
1047 * @rmtoll ICSCR HSITRIM LL_RCC_HSI_SetCalibTrimming
1048 * @param Value Between Min_Data = 0 and Max_Data = 127
1051 __STATIC_INLINE
void LL_RCC_HSI_SetCalibTrimming(uint32_t Value
)
1053 MODIFY_REG(RCC
->ICSCR
, RCC_ICSCR_HSITRIM
, Value
<< RCC_ICSCR_HSITRIM_Pos
);
1057 * @brief Get HSI Calibration trimming
1058 * @rmtoll ICSCR HSITRIM LL_RCC_HSI_GetCalibTrimming
1059 * @retval Between Min_Data = 0 and Max_Data = 127
1061 __STATIC_INLINE
uint32_t LL_RCC_HSI_GetCalibTrimming(void)
1063 return (uint32_t)(READ_BIT(RCC
->ICSCR
, RCC_ICSCR_HSITRIM
) >> RCC_ICSCR_HSITRIM_Pos
);
1070 /** @defgroup RCC_LL_EF_HSI48 HSI48
1075 * @brief Enable HSI48
1076 * @rmtoll CRRCR HSI48ON LL_RCC_HSI48_Enable
1079 __STATIC_INLINE
void LL_RCC_HSI48_Enable(void)
1081 SET_BIT(RCC
->CRRCR
, RCC_CRRCR_HSI48ON
);
1085 * @brief Disable HSI48
1086 * @rmtoll CRRCR HSI48ON LL_RCC_HSI48_Disable
1089 __STATIC_INLINE
void LL_RCC_HSI48_Disable(void)
1091 CLEAR_BIT(RCC
->CRRCR
, RCC_CRRCR_HSI48ON
);
1095 * @brief Check if HSI48 oscillator Ready
1096 * @rmtoll CRRCR HSI48RDY LL_RCC_HSI48_IsReady
1097 * @retval State of bit (1 or 0).
1099 __STATIC_INLINE
uint32_t LL_RCC_HSI48_IsReady(void)
1101 return ((READ_BIT(RCC
->CRRCR
, RCC_CRRCR_HSI48RDY
) == (RCC_CRRCR_HSI48RDY
)) ? 1UL : 0UL);
1105 * @brief Get HSI48 Calibration value
1106 * @rmtoll CRRCR HSI48CAL LL_RCC_HSI48_GetCalibration
1107 * @retval Between Min_Data = 0x00 and Max_Data = 0x1FF
1109 __STATIC_INLINE
uint32_t LL_RCC_HSI48_GetCalibration(void)
1111 return (uint32_t)(READ_BIT(RCC
->CRRCR
, RCC_CRRCR_HSI48CAL
) >> RCC_CRRCR_HSI48CAL_Pos
);
1118 /** @defgroup RCC_LL_EF_LSE LSE
1123 * @brief Enable Low Speed External (LSE) crystal.
1124 * @rmtoll BDCR LSEON LL_RCC_LSE_Enable
1127 __STATIC_INLINE
void LL_RCC_LSE_Enable(void)
1129 SET_BIT(RCC
->BDCR
, RCC_BDCR_LSEON
);
1133 * @brief Disable Low Speed External (LSE) crystal.
1134 * @rmtoll BDCR LSEON LL_RCC_LSE_Disable
1137 __STATIC_INLINE
void LL_RCC_LSE_Disable(void)
1139 CLEAR_BIT(RCC
->BDCR
, RCC_BDCR_LSEON
);
1143 * @brief Enable external clock source (LSE bypass).
1144 * @rmtoll BDCR LSEBYP LL_RCC_LSE_EnableBypass
1147 __STATIC_INLINE
void LL_RCC_LSE_EnableBypass(void)
1149 SET_BIT(RCC
->BDCR
, RCC_BDCR_LSEBYP
);
1153 * @brief Disable external clock source (LSE bypass).
1154 * @rmtoll BDCR LSEBYP LL_RCC_LSE_DisableBypass
1157 __STATIC_INLINE
void LL_RCC_LSE_DisableBypass(void)
1159 CLEAR_BIT(RCC
->BDCR
, RCC_BDCR_LSEBYP
);
1163 * @brief Set LSE oscillator drive capability
1164 * @note The oscillator is in Xtal mode when it is not in bypass mode.
1165 * @rmtoll BDCR LSEDRV LL_RCC_LSE_SetDriveCapability
1166 * @param LSEDrive This parameter can be one of the following values:
1167 * @arg @ref LL_RCC_LSEDRIVE_LOW
1168 * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
1169 * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
1170 * @arg @ref LL_RCC_LSEDRIVE_HIGH
1173 __STATIC_INLINE
void LL_RCC_LSE_SetDriveCapability(uint32_t LSEDrive
)
1175 MODIFY_REG(RCC
->BDCR
, RCC_BDCR_LSEDRV
, LSEDrive
);
1179 * @brief Get LSE oscillator drive capability
1180 * @rmtoll BDCR LSEDRV LL_RCC_LSE_GetDriveCapability
1181 * @retval Returned value can be one of the following values:
1182 * @arg @ref LL_RCC_LSEDRIVE_LOW
1183 * @arg @ref LL_RCC_LSEDRIVE_MEDIUMLOW
1184 * @arg @ref LL_RCC_LSEDRIVE_MEDIUMHIGH
1185 * @arg @ref LL_RCC_LSEDRIVE_HIGH
1187 __STATIC_INLINE
uint32_t LL_RCC_LSE_GetDriveCapability(void)
1189 return (uint32_t)(READ_BIT(RCC
->BDCR
, RCC_BDCR_LSEDRV
));
1193 * @brief Enable Clock security system on LSE.
1194 * @rmtoll BDCR LSECSSON LL_RCC_LSE_EnableCSS
1197 __STATIC_INLINE
void LL_RCC_LSE_EnableCSS(void)
1199 SET_BIT(RCC
->BDCR
, RCC_BDCR_LSECSSON
);
1203 * @brief Disable Clock security system on LSE.
1204 * @note Clock security system can be disabled only after a LSE
1205 * failure detection. In that case it MUST be disabled by software.
1206 * @rmtoll BDCR LSECSSON LL_RCC_LSE_DisableCSS
1209 __STATIC_INLINE
void LL_RCC_LSE_DisableCSS(void)
1211 CLEAR_BIT(RCC
->BDCR
, RCC_BDCR_LSECSSON
);
1215 * @brief Check if LSE oscillator Ready
1216 * @rmtoll BDCR LSERDY LL_RCC_LSE_IsReady
1217 * @retval State of bit (1 or 0).
1219 __STATIC_INLINE
uint32_t LL_RCC_LSE_IsReady(void)
1221 return ((READ_BIT(RCC
->BDCR
, RCC_BDCR_LSERDY
) == (RCC_BDCR_LSERDY
)) ? 1UL : 0UL);
1225 * @brief Check if CSS on LSE failure Detection
1226 * @rmtoll BDCR LSECSSD LL_RCC_LSE_IsCSSDetected
1227 * @retval State of bit (1 or 0).
1229 __STATIC_INLINE
uint32_t LL_RCC_LSE_IsCSSDetected(void)
1231 return ((READ_BIT(RCC
->BDCR
, RCC_BDCR_LSECSSD
) == (RCC_BDCR_LSECSSD
)) ? 1UL : 0UL);
1238 /** @defgroup RCC_LL_EF_LSI LSI
1243 * @brief Enable LSI Oscillator
1244 * @rmtoll CSR LSION LL_RCC_LSI_Enable
1247 __STATIC_INLINE
void LL_RCC_LSI_Enable(void)
1249 SET_BIT(RCC
->CSR
, RCC_CSR_LSION
);
1253 * @brief Disable LSI Oscillator
1254 * @rmtoll CSR LSION LL_RCC_LSI_Disable
1257 __STATIC_INLINE
void LL_RCC_LSI_Disable(void)
1259 CLEAR_BIT(RCC
->CSR
, RCC_CSR_LSION
);
1263 * @brief Check if LSI is Ready
1264 * @rmtoll CSR LSIRDY LL_RCC_LSI_IsReady
1265 * @retval State of bit (1 or 0).
1267 __STATIC_INLINE
uint32_t LL_RCC_LSI_IsReady(void)
1269 return ((READ_BIT(RCC
->CSR
, RCC_CSR_LSIRDY
) == (RCC_CSR_LSIRDY
)) ? 1UL : 0UL);
1276 /** @defgroup RCC_LL_EF_LSCO LSCO
1281 * @brief Enable Low speed clock
1282 * @rmtoll BDCR LSCOEN LL_RCC_LSCO_Enable
1285 __STATIC_INLINE
void LL_RCC_LSCO_Enable(void)
1287 SET_BIT(RCC
->BDCR
, RCC_BDCR_LSCOEN
);
1291 * @brief Disable Low speed clock
1292 * @rmtoll BDCR LSCOEN LL_RCC_LSCO_Disable
1295 __STATIC_INLINE
void LL_RCC_LSCO_Disable(void)
1297 CLEAR_BIT(RCC
->BDCR
, RCC_BDCR_LSCOEN
);
1301 * @brief Configure Low speed clock selection
1302 * @rmtoll BDCR LSCOSEL LL_RCC_LSCO_SetSource
1303 * @param Source This parameter can be one of the following values:
1304 * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSI
1305 * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSE
1308 __STATIC_INLINE
void LL_RCC_LSCO_SetSource(uint32_t Source
)
1310 MODIFY_REG(RCC
->BDCR
, RCC_BDCR_LSCOSEL
, Source
);
1314 * @brief Get Low speed clock selection
1315 * @rmtoll BDCR LSCOSEL LL_RCC_LSCO_GetSource
1316 * @retval Returned value can be one of the following values:
1317 * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSI
1318 * @arg @ref LL_RCC_LSCO_CLKSOURCE_LSE
1320 __STATIC_INLINE
uint32_t LL_RCC_LSCO_GetSource(void)
1322 return (uint32_t)(READ_BIT(RCC
->BDCR
, RCC_BDCR_LSCOSEL
));
1329 /** @defgroup RCC_LL_EF_System System
1334 * @brief Configure the system clock source
1335 * @rmtoll CFGR SW LL_RCC_SetSysClkSource
1336 * @param Source This parameter can be one of the following values:
1337 * @arg @ref LL_RCC_SYS_CLKSOURCE_HSI
1338 * @arg @ref LL_RCC_SYS_CLKSOURCE_HSE
1339 * @arg @ref LL_RCC_SYS_CLKSOURCE_PLL
1342 __STATIC_INLINE
void LL_RCC_SetSysClkSource(uint32_t Source
)
1344 MODIFY_REG(RCC
->CFGR
, RCC_CFGR_SW
, Source
);
1348 * @brief Get the system clock source
1349 * @rmtoll CFGR SWS LL_RCC_GetSysClkSource
1350 * @retval Returned value can be one of the following values:
1351 * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI
1352 * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE
1353 * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL
1355 __STATIC_INLINE
uint32_t LL_RCC_GetSysClkSource(void)
1357 return (uint32_t)(READ_BIT(RCC
->CFGR
, RCC_CFGR_SWS
));
1361 * @brief Set AHB prescaler
1362 * @rmtoll CFGR HPRE LL_RCC_SetAHBPrescaler
1363 * @param Prescaler This parameter can be one of the following values:
1364 * @arg @ref LL_RCC_SYSCLK_DIV_1
1365 * @arg @ref LL_RCC_SYSCLK_DIV_2
1366 * @arg @ref LL_RCC_SYSCLK_DIV_4
1367 * @arg @ref LL_RCC_SYSCLK_DIV_8
1368 * @arg @ref LL_RCC_SYSCLK_DIV_16
1369 * @arg @ref LL_RCC_SYSCLK_DIV_64
1370 * @arg @ref LL_RCC_SYSCLK_DIV_128
1371 * @arg @ref LL_RCC_SYSCLK_DIV_256
1372 * @arg @ref LL_RCC_SYSCLK_DIV_512
1375 __STATIC_INLINE
void LL_RCC_SetAHBPrescaler(uint32_t Prescaler
)
1377 MODIFY_REG(RCC
->CFGR
, RCC_CFGR_HPRE
, Prescaler
);
1381 * @brief Set APB1 prescaler
1382 * @rmtoll CFGR PPRE1 LL_RCC_SetAPB1Prescaler
1383 * @param Prescaler This parameter can be one of the following values:
1384 * @arg @ref LL_RCC_APB1_DIV_1
1385 * @arg @ref LL_RCC_APB1_DIV_2
1386 * @arg @ref LL_RCC_APB1_DIV_4
1387 * @arg @ref LL_RCC_APB1_DIV_8
1388 * @arg @ref LL_RCC_APB1_DIV_16
1391 __STATIC_INLINE
void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler
)
1393 MODIFY_REG(RCC
->CFGR
, RCC_CFGR_PPRE1
, Prescaler
);
1397 * @brief Set APB2 prescaler
1398 * @rmtoll CFGR PPRE2 LL_RCC_SetAPB2Prescaler
1399 * @param Prescaler This parameter can be one of the following values:
1400 * @arg @ref LL_RCC_APB2_DIV_1
1401 * @arg @ref LL_RCC_APB2_DIV_2
1402 * @arg @ref LL_RCC_APB2_DIV_4
1403 * @arg @ref LL_RCC_APB2_DIV_8
1404 * @arg @ref LL_RCC_APB2_DIV_16
1407 __STATIC_INLINE
void LL_RCC_SetAPB2Prescaler(uint32_t Prescaler
)
1409 MODIFY_REG(RCC
->CFGR
, RCC_CFGR_PPRE2
, Prescaler
);
1413 * @brief Get AHB prescaler
1414 * @rmtoll CFGR HPRE LL_RCC_GetAHBPrescaler
1415 * @retval Returned value can be one of the following values:
1416 * @arg @ref LL_RCC_SYSCLK_DIV_1
1417 * @arg @ref LL_RCC_SYSCLK_DIV_2
1418 * @arg @ref LL_RCC_SYSCLK_DIV_4
1419 * @arg @ref LL_RCC_SYSCLK_DIV_8
1420 * @arg @ref LL_RCC_SYSCLK_DIV_16
1421 * @arg @ref LL_RCC_SYSCLK_DIV_64
1422 * @arg @ref LL_RCC_SYSCLK_DIV_128
1423 * @arg @ref LL_RCC_SYSCLK_DIV_256
1424 * @arg @ref LL_RCC_SYSCLK_DIV_512
1426 __STATIC_INLINE
uint32_t LL_RCC_GetAHBPrescaler(void)
1428 return (uint32_t)(READ_BIT(RCC
->CFGR
, RCC_CFGR_HPRE
));
1432 * @brief Get APB1 prescaler
1433 * @rmtoll CFGR PPRE1 LL_RCC_GetAPB1Prescaler
1434 * @retval Returned value can be one of the following values:
1435 * @arg @ref LL_RCC_APB1_DIV_1
1436 * @arg @ref LL_RCC_APB1_DIV_2
1437 * @arg @ref LL_RCC_APB1_DIV_4
1438 * @arg @ref LL_RCC_APB1_DIV_8
1439 * @arg @ref LL_RCC_APB1_DIV_16
1441 __STATIC_INLINE
uint32_t LL_RCC_GetAPB1Prescaler(void)
1443 return (uint32_t)(READ_BIT(RCC
->CFGR
, RCC_CFGR_PPRE1
));
1447 * @brief Get APB2 prescaler
1448 * @rmtoll CFGR PPRE2 LL_RCC_GetAPB2Prescaler
1449 * @retval Returned value can be one of the following values:
1450 * @arg @ref LL_RCC_APB2_DIV_1
1451 * @arg @ref LL_RCC_APB2_DIV_2
1452 * @arg @ref LL_RCC_APB2_DIV_4
1453 * @arg @ref LL_RCC_APB2_DIV_8
1454 * @arg @ref LL_RCC_APB2_DIV_16
1456 __STATIC_INLINE
uint32_t LL_RCC_GetAPB2Prescaler(void)
1458 return (uint32_t)(READ_BIT(RCC
->CFGR
, RCC_CFGR_PPRE2
));
1465 /** @defgroup RCC_LL_EF_MCO MCO
1470 * @brief Configure MCOx
1471 * @rmtoll CFGR MCOSEL LL_RCC_ConfigMCO\n
1472 * CFGR MCOPRE LL_RCC_ConfigMCO
1473 * @param MCOxSource This parameter can be one of the following values:
1474 * @arg @ref LL_RCC_MCO1SOURCE_NOCLOCK
1475 * @arg @ref LL_RCC_MCO1SOURCE_SYSCLK
1476 * @arg @ref LL_RCC_MCO1SOURCE_HSI
1477 * @arg @ref LL_RCC_MCO1SOURCE_HSE
1478 * @arg @ref LL_RCC_MCO1SOURCE_HSI48
1479 * @arg @ref LL_RCC_MCO1SOURCE_PLLCLK
1480 * @arg @ref LL_RCC_MCO1SOURCE_LSI
1481 * @arg @ref LL_RCC_MCO1SOURCE_LSE
1483 * (*) value not defined in all devices.
1484 * @param MCOxPrescaler This parameter can be one of the following values:
1485 * @arg @ref LL_RCC_MCO1_DIV_1
1486 * @arg @ref LL_RCC_MCO1_DIV_2
1487 * @arg @ref LL_RCC_MCO1_DIV_4
1488 * @arg @ref LL_RCC_MCO1_DIV_8
1489 * @arg @ref LL_RCC_MCO1_DIV_16
1492 __STATIC_INLINE
void LL_RCC_ConfigMCO(uint32_t MCOxSource
, uint32_t MCOxPrescaler
)
1494 MODIFY_REG(RCC
->CFGR
, RCC_CFGR_MCOSEL
| RCC_CFGR_MCOPRE
, MCOxSource
| MCOxPrescaler
);
1501 /** @defgroup RCC_LL_EF_Peripheral_Clock_Source Peripheral Clock Source
1506 * @brief Configure USARTx clock source
1507 * @rmtoll CCIPR USARTxSEL LL_RCC_SetUSARTClockSource
1508 * @param USARTxSource This parameter can be one of the following values:
1509 * @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK2
1510 * @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
1511 * @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
1512 * @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
1513 * @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1
1514 * @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK
1515 * @arg @ref LL_RCC_USART2_CLKSOURCE_HSI
1516 * @arg @ref LL_RCC_USART2_CLKSOURCE_LSE
1517 * @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1
1518 * @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK
1519 * @arg @ref LL_RCC_USART3_CLKSOURCE_HSI
1520 * @arg @ref LL_RCC_USART3_CLKSOURCE_LSE
1523 __STATIC_INLINE
void LL_RCC_SetUSARTClockSource(uint32_t USARTxSource
)
1525 MODIFY_REG(RCC
->CCIPR
, (USARTxSource
>> 16U), (USARTxSource
& 0x0000FFFFU
));
1530 * @brief Configure UARTx clock source
1531 * @rmtoll CCIPR UARTxSEL LL_RCC_SetUARTClockSource
1532 * @param UARTxSource This parameter can be one of the following values:
1533 * @arg @ref LL_RCC_UART4_CLKSOURCE_PCLK1 (*)
1534 * @arg @ref LL_RCC_UART4_CLKSOURCE_SYSCLK (*)
1535 * @arg @ref LL_RCC_UART4_CLKSOURCE_HSI (*)
1536 * @arg @ref LL_RCC_UART4_CLKSOURCE_LSE (*)
1537 * @arg @ref LL_RCC_UART5_CLKSOURCE_PCLK1 (*)
1538 * @arg @ref LL_RCC_UART5_CLKSOURCE_SYSCLK (*)
1539 * @arg @ref LL_RCC_UART5_CLKSOURCE_HSI (*)
1540 * @arg @ref LL_RCC_UART5_CLKSOURCE_LSE (*)
1542 * (*) value not defined in all devices.
1545 __STATIC_INLINE
void LL_RCC_SetUARTClockSource(uint32_t UARTxSource
)
1547 MODIFY_REG(RCC
->CCIPR
, (UARTxSource
>> 16U), (UARTxSource
& 0x0000FFFFU
));
1552 * @brief Configure LPUART1x clock source
1553 * @rmtoll CCIPR LPUART1SEL LL_RCC_SetLPUARTClockSource
1554 * @param LPUARTxSource This parameter can be one of the following values:
1555 * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK1
1556 * @arg @ref LL_RCC_LPUART1_CLKSOURCE_SYSCLK
1557 * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
1558 * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
1561 __STATIC_INLINE
void LL_RCC_SetLPUARTClockSource(uint32_t LPUARTxSource
)
1563 MODIFY_REG(RCC
->CCIPR
, RCC_CCIPR_LPUART1SEL
, LPUARTxSource
);
1567 * @brief Configure I2Cx clock source
1568 * @rmtoll CCIPR I2CxSEL LL_RCC_SetI2CClockSource
1569 * @param I2CxSource This parameter can be one of the following values:
1570 * @arg @ref LL_RCC_I2C1_CLKSOURCE_PCLK1
1571 * @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
1572 * @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
1573 * @arg @ref LL_RCC_I2C2_CLKSOURCE_PCLK1
1574 * @arg @ref LL_RCC_I2C2_CLKSOURCE_SYSCLK
1575 * @arg @ref LL_RCC_I2C2_CLKSOURCE_HSI
1576 * @arg @ref LL_RCC_I2C3_CLKSOURCE_PCLK1
1577 * @arg @ref LL_RCC_I2C3_CLKSOURCE_SYSCLK
1578 * @arg @ref LL_RCC_I2C3_CLKSOURCE_HSI
1579 * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK1 (*)
1580 * @arg @ref LL_RCC_I2C4_CLKSOURCE_SYSCLK (*)
1581 * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI (*)
1583 * (*) value not defined in all devices.
1586 __STATIC_INLINE
void LL_RCC_SetI2CClockSource(uint32_t I2CxSource
)
1588 __IO
uint32_t *reg
= (__IO
uint32_t *)(uint32_t)(RCC_BASE
+ 0x88U
+ (I2CxSource
>> 24U));
1589 MODIFY_REG(*reg
, 3UL << ((I2CxSource
& 0x001F0000U
) >> 16U), ((I2CxSource
& 0x000000FFU
) << ((I2CxSource
& 0x001F0000U
) >> 16U)));
1593 * @brief Configure LPTIMx clock source
1594 * @rmtoll CCIPR LPTIM1SEL LL_RCC_SetLPTIMClockSource
1595 * @param LPTIMxSource This parameter can be one of the following values:
1596 * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
1597 * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
1598 * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI
1599 * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
1602 __STATIC_INLINE
void LL_RCC_SetLPTIMClockSource(uint32_t LPTIMxSource
)
1604 MODIFY_REG(RCC
->CCIPR
, RCC_CCIPR_LPTIM1SEL
, LPTIMxSource
);
1608 * @brief Configure SAIx clock source
1609 * @rmtoll CCIPR SAI1SEL LL_RCC_SetSAIClockSource
1610 * @param SAIxSource This parameter can be one of the following values:
1611 * @arg @ref LL_RCC_SAI1_CLKSOURCE_SYSCLK
1612 * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL
1613 * @arg @ref LL_RCC_SAI1_CLKSOURCE_PIN
1614 * @arg @ref LL_RCC_SAI1_CLKSOURCE_HSI
1616 * (*) value not defined in all devices.
1619 __STATIC_INLINE
void LL_RCC_SetSAIClockSource(uint32_t SAIxSource
)
1621 MODIFY_REG(RCC
->CCIPR
, RCC_CCIPR_SAI1SEL
, SAIxSource
);
1625 * @brief Configure I2S clock source
1626 * @rmtoll CCIPR I2S23SEL LL_RCC_SetI2SClockSource
1627 * @param I2SxSource This parameter can be one of the following values:
1628 * @arg @ref LL_RCC_I2S_CLKSOURCE_SYSCLK
1629 * @arg @ref LL_RCC_I2S_CLKSOURCE_PLL
1630 * @arg @ref LL_RCC_I2S_CLKSOURCE_PIN
1631 * @arg @ref LL_RCC_I2S_CLKSOURCE_HSI
1634 __STATIC_INLINE
void LL_RCC_SetI2SClockSource(uint32_t I2SxSource
)
1636 MODIFY_REG(RCC
->CCIPR
, RCC_CCIPR_I2S23SEL
, I2SxSource
);
1641 * @brief Configure FDCAN clock source
1642 * @rmtoll CCIPR FDCANSEL LL_RCC_SetFDCANClockSource
1643 * @param FDCANxSource This parameter can be one of the following values:
1644 * @arg @ref LL_RCC_FDCAN_CLKSOURCE_HSE
1645 * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLL
1646 * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PCLK1
1649 __STATIC_INLINE
void LL_RCC_SetFDCANClockSource(uint32_t FDCANxSource
)
1651 MODIFY_REG(RCC
->CCIPR
, RCC_CCIPR_FDCANSEL
, FDCANxSource
);
1656 * @brief Configure RNG clock source
1657 * @rmtoll CCIPR CLK48SEL LL_RCC_SetRNGClockSource
1658 * @param RNGxSource This parameter can be one of the following values:
1659 * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI48
1660 * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL
1663 __STATIC_INLINE
void LL_RCC_SetRNGClockSource(uint32_t RNGxSource
)
1665 MODIFY_REG(RCC
->CCIPR
, RCC_CCIPR_CLK48SEL
, RNGxSource
);
1669 * @brief Configure USB clock source
1670 * @rmtoll CCIPR CLK48SEL LL_RCC_SetUSBClockSource
1671 * @param USBxSource This parameter can be one of the following values:
1672 * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48
1673 * @arg @ref LL_RCC_USB_CLKSOURCE_PLL
1676 __STATIC_INLINE
void LL_RCC_SetUSBClockSource(uint32_t USBxSource
)
1678 MODIFY_REG(RCC
->CCIPR
, RCC_CCIPR_CLK48SEL
, USBxSource
);
1682 * @brief Configure ADC clock source
1683 * @rmtoll CCIPR ADC12SEL LL_RCC_SetADCClockSource\n
1684 * CCIPR ADC345SEL LL_RCC_SetADCClockSource
1685 * @param ADCxSource This parameter can be one of the following values:
1686 * @arg @ref LL_RCC_ADC12_CLKSOURCE_NONE
1687 * @arg @ref LL_RCC_ADC12_CLKSOURCE_PLL
1688 * @arg @ref LL_RCC_ADC12_CLKSOURCE_SYSCLK
1689 * @arg @ref LL_RCC_ADC345_CLKSOURCE_NONE (*)
1690 * @arg @ref LL_RCC_ADC345_CLKSOURCE_PLL (*)
1691 * @arg @ref LL_RCC_ADC345_CLKSOURCE_SYSCLK (*)
1693 * (*) value not defined in all devices.
1696 __STATIC_INLINE
void LL_RCC_SetADCClockSource(uint32_t ADCxSource
)
1698 MODIFY_REG(RCC
->CCIPR
, 3U << ((ADCxSource
& 0x001F0000U
) >> 16U), ((ADCxSource
& 0x000000FFU
) << ((ADCxSource
& 0x001F0000U
) >> 16U)));
1701 #if defined(QUADSPI)
1703 * @brief Configure QUADSPI clock source
1704 * @rmtoll CCIPR2 QSPISEL LL_RCC_SetQUADSPIClockSource
1705 * @param Source This parameter can be one of the following values:
1706 * @arg @ref LL_RCC_QUADSPI_CLKSOURCE_SYSCLK
1707 * @arg @ref LL_RCC_QUADSPI_CLKSOURCE_HSI
1708 * @arg @ref LL_RCC_QUADSPI_CLKSOURCE_PLL
1711 __STATIC_INLINE
void LL_RCC_SetQUADSPIClockSource(uint32_t Source
)
1713 MODIFY_REG(RCC
->CCIPR2
, RCC_CCIPR2_QSPISEL
, Source
);
1715 #endif /* QUADSPI */
1718 * @brief Get USARTx clock source
1719 * @rmtoll CCIPR USARTxSEL LL_RCC_GetUSARTClockSource
1720 * @param USARTx This parameter can be one of the following values:
1721 * @arg @ref LL_RCC_USART1_CLKSOURCE
1722 * @arg @ref LL_RCC_USART2_CLKSOURCE
1723 * @arg @ref LL_RCC_USART3_CLKSOURCE
1724 * @retval Returned value can be one of the following values:
1725 * @arg @ref LL_RCC_USART1_CLKSOURCE_PCLK2
1726 * @arg @ref LL_RCC_USART1_CLKSOURCE_SYSCLK
1727 * @arg @ref LL_RCC_USART1_CLKSOURCE_HSI
1728 * @arg @ref LL_RCC_USART1_CLKSOURCE_LSE
1729 * @arg @ref LL_RCC_USART2_CLKSOURCE_PCLK1
1730 * @arg @ref LL_RCC_USART2_CLKSOURCE_SYSCLK
1731 * @arg @ref LL_RCC_USART2_CLKSOURCE_HSI
1732 * @arg @ref LL_RCC_USART2_CLKSOURCE_LSE
1733 * @arg @ref LL_RCC_USART3_CLKSOURCE_PCLK1
1734 * @arg @ref LL_RCC_USART3_CLKSOURCE_SYSCLK
1735 * @arg @ref LL_RCC_USART3_CLKSOURCE_HSI
1736 * @arg @ref LL_RCC_USART3_CLKSOURCE_LSE
1738 __STATIC_INLINE
uint32_t LL_RCC_GetUSARTClockSource(uint32_t USARTx
)
1740 return (uint32_t)(READ_BIT(RCC
->CCIPR
, USARTx
) | (USARTx
<< 16U));
1745 * @brief Get UARTx clock source
1746 * @rmtoll CCIPR UARTxSEL LL_RCC_GetUARTClockSource
1747 * @param UARTx This parameter can be one of the following values:
1748 * @arg @ref LL_RCC_UART4_CLKSOURCE (*)
1749 * @arg @ref LL_RCC_UART5_CLKSOURCE (*)
1750 * @retval Returned value can be one of the following values:
1751 * @arg @ref LL_RCC_UART4_CLKSOURCE_PCLK1 (*)
1752 * @arg @ref LL_RCC_UART4_CLKSOURCE_SYSCLK (*)
1753 * @arg @ref LL_RCC_UART4_CLKSOURCE_HSI (*)
1754 * @arg @ref LL_RCC_UART4_CLKSOURCE_LSE (*)
1755 * @arg @ref LL_RCC_UART5_CLKSOURCE_PCLK1 (*)
1756 * @arg @ref LL_RCC_UART5_CLKSOURCE_SYSCLK (*)
1757 * @arg @ref LL_RCC_UART5_CLKSOURCE_HSI (*)
1758 * @arg @ref LL_RCC_UART5_CLKSOURCE_LSE (*)
1760 * (*) value not defined in all devices.
1762 __STATIC_INLINE
uint32_t LL_RCC_GetUARTClockSource(uint32_t UARTx
)
1764 return (uint32_t)(READ_BIT(RCC
->CCIPR
, UARTx
) | (UARTx
<< 16U));
1769 * @brief Get LPUARTx clock source
1770 * @rmtoll CCIPR LPUART1SEL LL_RCC_GetLPUARTClockSource
1771 * @param LPUARTx This parameter can be one of the following values:
1772 * @arg @ref LL_RCC_LPUART1_CLKSOURCE
1773 * @retval Returned value can be one of the following values:
1774 * @arg @ref LL_RCC_LPUART1_CLKSOURCE_PCLK1
1775 * @arg @ref LL_RCC_LPUART1_CLKSOURCE_SYSCLK
1776 * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
1777 * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
1779 __STATIC_INLINE
uint32_t LL_RCC_GetLPUARTClockSource(uint32_t LPUARTx
)
1781 return (uint32_t)(READ_BIT(RCC
->CCIPR
, LPUARTx
));
1785 * @brief Get I2Cx clock source
1786 * @rmtoll CCIPR I2CxSEL LL_RCC_GetI2CClockSource
1787 * @param I2Cx This parameter can be one of the following values:
1788 * @arg @ref LL_RCC_I2C1_CLKSOURCE
1789 * @arg @ref LL_RCC_I2C2_CLKSOURCE
1790 * @arg @ref LL_RCC_I2C3_CLKSOURCE
1791 * @arg @ref LL_RCC_I2C4_CLKSOURCE (*)
1793 * (*) value not defined in all devices.
1794 * @retval Returned value can be one of the following values:
1795 * @arg @ref LL_RCC_I2C1_CLKSOURCE_PCLK1
1796 * @arg @ref LL_RCC_I2C1_CLKSOURCE_SYSCLK
1797 * @arg @ref LL_RCC_I2C1_CLKSOURCE_HSI
1798 * @arg @ref LL_RCC_I2C2_CLKSOURCE_PCLK1
1799 * @arg @ref LL_RCC_I2C2_CLKSOURCE_SYSCLK
1800 * @arg @ref LL_RCC_I2C2_CLKSOURCE_HSI
1801 * @arg @ref LL_RCC_I2C3_CLKSOURCE_PCLK1
1802 * @arg @ref LL_RCC_I2C3_CLKSOURCE_SYSCLK
1803 * @arg @ref LL_RCC_I2C3_CLKSOURCE_HSI
1804 * @arg @ref LL_RCC_I2C4_CLKSOURCE_PCLK1 (*)
1805 * @arg @ref LL_RCC_I2C4_CLKSOURCE_SYSCLK (*)
1806 * @arg @ref LL_RCC_I2C4_CLKSOURCE_HSI (*)
1808 * (*) value not defined in all devices.
1810 __STATIC_INLINE
uint32_t LL_RCC_GetI2CClockSource(uint32_t I2Cx
)
1812 __IO
const uint32_t *reg
= (__IO
uint32_t *)(uint32_t)(RCC_BASE
+ 0x88U
+ (I2Cx
>> 24U));
1813 return (uint32_t)((READ_BIT(*reg
, 3UL << ((I2Cx
& 0x001F0000U
) >> 16U)) >> ((I2Cx
& 0x001F0000U
) >> 16U)) | (I2Cx
& 0xFFFF0000U
));
1817 * @brief Get LPTIMx clock source
1818 * @rmtoll CCIPR LPTIMxSEL LL_RCC_GetLPTIMClockSource
1819 * @param LPTIMx This parameter can be one of the following values:
1820 * @arg @ref LL_RCC_LPTIM1_CLKSOURCE
1821 * @retval Returned value can be one of the following values:
1822 * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_PCLK1
1823 * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSI
1824 * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_HSI
1825 * @arg @ref LL_RCC_LPTIM1_CLKSOURCE_LSE
1827 __STATIC_INLINE
uint32_t LL_RCC_GetLPTIMClockSource(uint32_t LPTIMx
)
1829 return (uint32_t)(READ_BIT(RCC
->CCIPR
, LPTIMx
));
1833 * @brief Get SAIx clock source
1834 * @rmtoll CCIPR SAI1SEL LL_RCC_GetSAIClockSource
1835 * @param SAIx This parameter can be one of the following values:
1836 * @arg @ref LL_RCC_SAI1_CLKSOURCE
1838 * (*) value not defined in all devices.
1839 * @retval Returned value can be one of the following values:
1840 * @arg @ref LL_RCC_SAI1_CLKSOURCE_SYSCLK
1841 * @arg @ref LL_RCC_SAI1_CLKSOURCE_PLL
1842 * @arg @ref LL_RCC_SAI1_CLKSOURCE_PIN
1843 * @arg @ref LL_RCC_SAI1_CLKSOURCE_HSI
1845 * (*) value not defined in all devices.
1847 __STATIC_INLINE
uint32_t LL_RCC_GetSAIClockSource(uint32_t SAIx
)
1849 return (uint32_t)(READ_BIT(RCC
->CCIPR
, SAIx
));
1853 * @brief Get I2Sx clock source
1854 * @rmtoll CCIPR I2S23SEL LL_RCC_GetI2SClockSource
1855 * @param I2Sx This parameter can be one of the following values:
1856 * @arg @ref LL_RCC_I2S_CLKSOURCE
1857 * @retval Returned value can be one of the following values:
1858 * @arg @ref LL_RCC_I2S_CLKSOURCE_SYSCLK
1859 * @arg @ref LL_RCC_I2S_CLKSOURCE_PLL
1860 * @arg @ref LL_RCC_I2S_CLKSOURCE_PIN
1861 * @arg @ref LL_RCC_I2S_CLKSOURCE_HSI
1863 __STATIC_INLINE
uint32_t LL_RCC_GetI2SClockSource(uint32_t I2Sx
)
1865 return (uint32_t)(READ_BIT(RCC
->CCIPR
, I2Sx
));
1870 * @brief Get FDCANx clock source
1871 * @rmtoll CCIPR FDCANSEL LL_RCC_GetFDCANClockSource
1872 * @param FDCANx This parameter can be one of the following values:
1873 * @arg @ref LL_RCC_FDCAN_CLKSOURCE
1874 * @retval Returned value can be one of the following values:
1875 * @arg @ref LL_RCC_FDCAN_CLKSOURCE_HSE
1876 * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PLL
1877 * @arg @ref LL_RCC_FDCAN_CLKSOURCE_PCLK1
1880 __STATIC_INLINE
uint32_t LL_RCC_GetFDCANClockSource(uint32_t FDCANx
)
1882 return (uint32_t)(READ_BIT(RCC
->CCIPR
, FDCANx
));
1887 * @brief Get RNGx clock source
1888 * @rmtoll CCIPR CLK48SEL LL_RCC_GetRNGClockSource
1889 * @param RNGx This parameter can be one of the following values:
1890 * @arg @ref LL_RCC_RNG_CLKSOURCE
1891 * @retval Returned value can be one of the following values:
1892 * @arg @ref LL_RCC_RNG_CLKSOURCE_HSI48
1893 * @arg @ref LL_RCC_RNG_CLKSOURCE_PLL
1895 __STATIC_INLINE
uint32_t LL_RCC_GetRNGClockSource(uint32_t RNGx
)
1897 return (uint32_t)(READ_BIT(RCC
->CCIPR
, RNGx
));
1901 * @brief Get USBx clock source
1902 * @rmtoll CCIPR CLK48SEL LL_RCC_GetUSBClockSource
1903 * @param USBx This parameter can be one of the following values:
1904 * @arg @ref LL_RCC_USB_CLKSOURCE
1905 * @retval Returned value can be one of the following values:
1906 * @arg @ref LL_RCC_USB_CLKSOURCE_HSI48
1907 * @arg @ref LL_RCC_USB_CLKSOURCE_PLL
1909 __STATIC_INLINE
uint32_t LL_RCC_GetUSBClockSource(uint32_t USBx
)
1911 return (uint32_t)(READ_BIT(RCC
->CCIPR
, USBx
));
1915 * @brief Get ADCx clock source
1916 * @rmtoll CCIPR ADCSEL LL_RCC_GetADCClockSource
1917 * @param ADCx This parameter can be one of the following values:
1918 * @arg @ref LL_RCC_ADC12_CLKSOURCE
1919 * @arg @ref LL_RCC_ADC345_CLKSOURCE (*)
1920 * @retval Returned value can be one of the following values:
1921 * @arg @ref LL_RCC_ADC12_CLKSOURCE_NONE
1922 * @arg @ref LL_RCC_ADC12_CLKSOURCE_PLL
1923 * @arg @ref LL_RCC_ADC12_CLKSOURCE_SYSCLK
1924 * @arg @ref LL_RCC_ADC345_CLKSOURCE_NONE (*)
1925 * @arg @ref LL_RCC_ADC345_CLKSOURCE_PLL (*)
1926 * @arg @ref LL_RCC_ADC345_CLKSOURCE_SYSCLK (*)
1928 * (*) value not defined in all devices.
1930 __STATIC_INLINE
uint32_t LL_RCC_GetADCClockSource(uint32_t ADCx
)
1932 return (uint32_t)((READ_BIT(RCC
->CCIPR
, 3UL << ((ADCx
& 0x001F0000U
) >> 16U)) >> ((ADCx
& 0x001F0000U
) >> 16U)) | (ADCx
& 0xFFFF0000U
));
1935 #if defined(QUADSPI)
1937 * @brief Get QUADSPI clock source
1938 * @rmtoll CCIPR2 QSPISEL LL_RCC_GetQUADSPIClockSource
1939 * @param QUADSPIx This parameter can be one of the following values:
1940 * @arg @ref LL_RCC_QUADSPI_CLKSOURCE
1941 * @retval Returned value can be one of the following values:
1942 * @arg @ref LL_RCC_QUADSPI_CLKSOURCE_SYSCLK
1943 * @arg @ref LL_RCC_QUADSPI_CLKSOURCE_HSI
1944 * @arg @ref LL_RCC_QUADSPI_CLKSOURCE_PLL
1946 __STATIC_INLINE
uint32_t LL_RCC_GetQUADSPIClockSource(uint32_t QUADSPIx
)
1948 return (uint32_t)(READ_BIT(RCC
->CCIPR2
, QUADSPIx
));
1950 #endif /* QUADSPI */
1955 /** @defgroup RCC_LL_EF_RTC RTC
1960 * @brief Set RTC Clock Source
1961 * @note Once the RTC clock source has been selected, it cannot be changed anymore unless
1962 * the Backup domain is reset, or unless a failure is detected on LSE (LSECSSD is
1963 * set). The BDRST bit can be used to reset them.
1964 * @rmtoll BDCR RTCSEL LL_RCC_SetRTCClockSource
1965 * @param Source This parameter can be one of the following values:
1966 * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
1967 * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
1968 * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
1969 * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
1972 __STATIC_INLINE
void LL_RCC_SetRTCClockSource(uint32_t Source
)
1974 MODIFY_REG(RCC
->BDCR
, RCC_BDCR_RTCSEL
, Source
);
1978 * @brief Get RTC Clock Source
1979 * @rmtoll BDCR RTCSEL LL_RCC_GetRTCClockSource
1980 * @retval Returned value can be one of the following values:
1981 * @arg @ref LL_RCC_RTC_CLKSOURCE_NONE
1982 * @arg @ref LL_RCC_RTC_CLKSOURCE_LSE
1983 * @arg @ref LL_RCC_RTC_CLKSOURCE_LSI
1984 * @arg @ref LL_RCC_RTC_CLKSOURCE_HSE_DIV32
1986 __STATIC_INLINE
uint32_t LL_RCC_GetRTCClockSource(void)
1988 return (uint32_t)(READ_BIT(RCC
->BDCR
, RCC_BDCR_RTCSEL
));
1993 * @rmtoll BDCR RTCEN LL_RCC_EnableRTC
1996 __STATIC_INLINE
void LL_RCC_EnableRTC(void)
1998 SET_BIT(RCC
->BDCR
, RCC_BDCR_RTCEN
);
2002 * @brief Disable RTC
2003 * @rmtoll BDCR RTCEN LL_RCC_DisableRTC
2006 __STATIC_INLINE
void LL_RCC_DisableRTC(void)
2008 CLEAR_BIT(RCC
->BDCR
, RCC_BDCR_RTCEN
);
2012 * @brief Check if RTC has been enabled or not
2013 * @rmtoll BDCR RTCEN LL_RCC_IsEnabledRTC
2014 * @retval State of bit (1 or 0).
2016 __STATIC_INLINE
uint32_t LL_RCC_IsEnabledRTC(void)
2018 return ((READ_BIT(RCC
->BDCR
, RCC_BDCR_RTCEN
) == (RCC_BDCR_RTCEN
)) ? 1UL : 0UL);
2022 * @brief Force the Backup domain reset
2023 * @rmtoll BDCR BDRST LL_RCC_ForceBackupDomainReset
2026 __STATIC_INLINE
void LL_RCC_ForceBackupDomainReset(void)
2028 SET_BIT(RCC
->BDCR
, RCC_BDCR_BDRST
);
2032 * @brief Release the Backup domain reset
2033 * @rmtoll BDCR BDRST LL_RCC_ReleaseBackupDomainReset
2036 __STATIC_INLINE
void LL_RCC_ReleaseBackupDomainReset(void)
2038 CLEAR_BIT(RCC
->BDCR
, RCC_BDCR_BDRST
);
2046 /** @defgroup RCC_LL_EF_PLL PLL
2052 * @rmtoll CR PLLON LL_RCC_PLL_Enable
2055 __STATIC_INLINE
void LL_RCC_PLL_Enable(void)
2057 SET_BIT(RCC
->CR
, RCC_CR_PLLON
);
2061 * @brief Disable PLL
2062 * @note Cannot be disabled if the PLL clock is used as the system clock
2063 * @rmtoll CR PLLON LL_RCC_PLL_Disable
2066 __STATIC_INLINE
void LL_RCC_PLL_Disable(void)
2068 CLEAR_BIT(RCC
->CR
, RCC_CR_PLLON
);
2072 * @brief Check if PLL Ready
2073 * @rmtoll CR PLLRDY LL_RCC_PLL_IsReady
2074 * @retval State of bit (1 or 0).
2076 __STATIC_INLINE
uint32_t LL_RCC_PLL_IsReady(void)
2078 return ((READ_BIT(RCC
->CR
, RCC_CR_PLLRDY
) == (RCC_CR_PLLRDY
)) ? 1UL : 0UL);
2082 * @brief Configure PLL used for SYSCLK Domain
2083 * @note PLL Source and PLLM Divider can be written only when PLL
2085 * @note PLLN/PLLR can be written only when PLL is disabled.
2086 * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_SYS\n
2087 * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_SYS\n
2088 * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_SYS\n
2089 * PLLCFGR PLLR LL_RCC_PLL_ConfigDomain_SYS
2090 * @param Source This parameter can be one of the following values:
2091 * @arg @ref LL_RCC_PLLSOURCE_NONE
2092 * @arg @ref LL_RCC_PLLSOURCE_HSI
2093 * @arg @ref LL_RCC_PLLSOURCE_HSE
2094 * @param PLLM This parameter can be one of the following values:
2095 * @arg @ref LL_RCC_PLLM_DIV_1
2096 * @arg @ref LL_RCC_PLLM_DIV_2
2097 * @arg @ref LL_RCC_PLLM_DIV_3
2098 * @arg @ref LL_RCC_PLLM_DIV_4
2099 * @arg @ref LL_RCC_PLLM_DIV_5
2100 * @arg @ref LL_RCC_PLLM_DIV_6
2101 * @arg @ref LL_RCC_PLLM_DIV_7
2102 * @arg @ref LL_RCC_PLLM_DIV_8
2103 * @arg @ref LL_RCC_PLLM_DIV_9
2104 * @arg @ref LL_RCC_PLLM_DIV_10
2105 * @arg @ref LL_RCC_PLLM_DIV_11
2106 * @arg @ref LL_RCC_PLLM_DIV_12
2107 * @arg @ref LL_RCC_PLLM_DIV_13
2108 * @arg @ref LL_RCC_PLLM_DIV_14
2109 * @arg @ref LL_RCC_PLLM_DIV_15
2110 * @arg @ref LL_RCC_PLLM_DIV_16
2111 * @param PLLN Between Min_Data = 8 and Max_Data = 127
2112 * @param PLLR This parameter can be one of the following values:
2113 * @arg @ref LL_RCC_PLLR_DIV_2
2114 * @arg @ref LL_RCC_PLLR_DIV_4
2115 * @arg @ref LL_RCC_PLLR_DIV_6
2116 * @arg @ref LL_RCC_PLLR_DIV_8
2119 __STATIC_INLINE
void LL_RCC_PLL_ConfigDomain_SYS(uint32_t Source
, uint32_t PLLM
, uint32_t PLLN
, uint32_t PLLR
)
2121 MODIFY_REG(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLSRC
| RCC_PLLCFGR_PLLM
| RCC_PLLCFGR_PLLN
| RCC_PLLCFGR_PLLR
,
2122 Source
| PLLM
| (PLLN
<< RCC_PLLCFGR_PLLN_Pos
) | PLLR
);
2126 * @brief Configure PLL used for ADC domain clock
2127 * @note PLL Source and PLLM Divider can be written only when PLL
2129 * @note PLLN/PLLP can be written only when PLL is disabled.
2130 * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_ADC\n
2131 * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_ADC\n
2132 * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_ADC\n
2133 * PLLCFGR PLLPDIV LL_RCC_PLL_ConfigDomain_ADC
2134 * @param Source This parameter can be one of the following values:
2135 * @arg @ref LL_RCC_PLLSOURCE_NONE
2136 * @arg @ref LL_RCC_PLLSOURCE_HSI
2137 * @arg @ref LL_RCC_PLLSOURCE_HSE
2138 * @param PLLM This parameter can be one of the following values:
2139 * @arg @ref LL_RCC_PLLM_DIV_1
2140 * @arg @ref LL_RCC_PLLM_DIV_2
2141 * @arg @ref LL_RCC_PLLM_DIV_3
2142 * @arg @ref LL_RCC_PLLM_DIV_4
2143 * @arg @ref LL_RCC_PLLM_DIV_5
2144 * @arg @ref LL_RCC_PLLM_DIV_6
2145 * @arg @ref LL_RCC_PLLM_DIV_7
2146 * @arg @ref LL_RCC_PLLM_DIV_8
2147 * @arg @ref LL_RCC_PLLM_DIV_9
2148 * @arg @ref LL_RCC_PLLM_DIV_10
2149 * @arg @ref LL_RCC_PLLM_DIV_11
2150 * @arg @ref LL_RCC_PLLM_DIV_12
2151 * @arg @ref LL_RCC_PLLM_DIV_13
2152 * @arg @ref LL_RCC_PLLM_DIV_14
2153 * @arg @ref LL_RCC_PLLM_DIV_15
2154 * @arg @ref LL_RCC_PLLM_DIV_16
2155 * @param PLLN Between Min_Data = 8 and Max_Data = 127
2156 * @param PLLP This parameter can be one of the following values:
2157 * @arg @ref LL_RCC_PLLP_DIV_2
2158 * @arg @ref LL_RCC_PLLP_DIV_3
2159 * @arg @ref LL_RCC_PLLP_DIV_4
2160 * @arg @ref LL_RCC_PLLP_DIV_5
2161 * @arg @ref LL_RCC_PLLP_DIV_6
2162 * @arg @ref LL_RCC_PLLP_DIV_7
2163 * @arg @ref LL_RCC_PLLP_DIV_8
2164 * @arg @ref LL_RCC_PLLP_DIV_9
2165 * @arg @ref LL_RCC_PLLP_DIV_10
2166 * @arg @ref LL_RCC_PLLP_DIV_11
2167 * @arg @ref LL_RCC_PLLP_DIV_12
2168 * @arg @ref LL_RCC_PLLP_DIV_13
2169 * @arg @ref LL_RCC_PLLP_DIV_14
2170 * @arg @ref LL_RCC_PLLP_DIV_15
2171 * @arg @ref LL_RCC_PLLP_DIV_16
2172 * @arg @ref LL_RCC_PLLP_DIV_17
2173 * @arg @ref LL_RCC_PLLP_DIV_18
2174 * @arg @ref LL_RCC_PLLP_DIV_19
2175 * @arg @ref LL_RCC_PLLP_DIV_20
2176 * @arg @ref LL_RCC_PLLP_DIV_21
2177 * @arg @ref LL_RCC_PLLP_DIV_22
2178 * @arg @ref LL_RCC_PLLP_DIV_23
2179 * @arg @ref LL_RCC_PLLP_DIV_24
2180 * @arg @ref LL_RCC_PLLP_DIV_25
2181 * @arg @ref LL_RCC_PLLP_DIV_26
2182 * @arg @ref LL_RCC_PLLP_DIV_27
2183 * @arg @ref LL_RCC_PLLP_DIV_28
2184 * @arg @ref LL_RCC_PLLP_DIV_29
2185 * @arg @ref LL_RCC_PLLP_DIV_30
2186 * @arg @ref LL_RCC_PLLP_DIV_31
2189 __STATIC_INLINE
void LL_RCC_PLL_ConfigDomain_ADC(uint32_t Source
, uint32_t PLLM
, uint32_t PLLN
, uint32_t PLLP
)
2191 MODIFY_REG(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLSRC
| RCC_PLLCFGR_PLLM
| RCC_PLLCFGR_PLLN
| RCC_PLLCFGR_PLLPDIV
,
2192 Source
| PLLM
| (PLLN
<< RCC_PLLCFGR_PLLN_Pos
) | PLLP
);
2196 * @brief Configure PLL used for 48Mhz domain clock
2197 * @note PLL Source and PLLM Divider can be written only when PLL,
2199 * @note PLLN/PLLQ can be written only when PLL is disabled.
2200 * @note This can be selected for USB, RNG
2201 * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_ConfigDomain_48M\n
2202 * PLLCFGR PLLM LL_RCC_PLL_ConfigDomain_48M\n
2203 * PLLCFGR PLLN LL_RCC_PLL_ConfigDomain_48M\n
2204 * PLLCFGR PLLQ LL_RCC_PLL_ConfigDomain_48M
2205 * @param Source This parameter can be one of the following values:
2206 * @arg @ref LL_RCC_PLLSOURCE_NONE
2207 * @arg @ref LL_RCC_PLLSOURCE_HSI
2208 * @arg @ref LL_RCC_PLLSOURCE_HSE
2209 * @param PLLM This parameter can be one of the following values:
2210 * @arg @ref LL_RCC_PLLM_DIV_1
2211 * @arg @ref LL_RCC_PLLM_DIV_2
2212 * @arg @ref LL_RCC_PLLM_DIV_3
2213 * @arg @ref LL_RCC_PLLM_DIV_4
2214 * @arg @ref LL_RCC_PLLM_DIV_5
2215 * @arg @ref LL_RCC_PLLM_DIV_6
2216 * @arg @ref LL_RCC_PLLM_DIV_7
2217 * @arg @ref LL_RCC_PLLM_DIV_8
2218 * @arg @ref LL_RCC_PLLM_DIV_9
2219 * @arg @ref LL_RCC_PLLM_DIV_10
2220 * @arg @ref LL_RCC_PLLM_DIV_11
2221 * @arg @ref LL_RCC_PLLM_DIV_12
2222 * @arg @ref LL_RCC_PLLM_DIV_13
2223 * @arg @ref LL_RCC_PLLM_DIV_14
2224 * @arg @ref LL_RCC_PLLM_DIV_15
2225 * @arg @ref LL_RCC_PLLM_DIV_16
2226 * @param PLLN Between Min_Data = 8 and Max_Data = 127
2227 * @param PLLQ This parameter can be one of the following values:
2228 * @arg @ref LL_RCC_PLLQ_DIV_2
2229 * @arg @ref LL_RCC_PLLQ_DIV_4
2230 * @arg @ref LL_RCC_PLLQ_DIV_6
2231 * @arg @ref LL_RCC_PLLQ_DIV_8
2234 __STATIC_INLINE
void LL_RCC_PLL_ConfigDomain_48M(uint32_t Source
, uint32_t PLLM
, uint32_t PLLN
, uint32_t PLLQ
)
2236 MODIFY_REG(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLSRC
| RCC_PLLCFGR_PLLM
| RCC_PLLCFGR_PLLN
| RCC_PLLCFGR_PLLQ
,
2237 Source
| PLLM
| (PLLN
<< RCC_PLLCFGR_PLLN_Pos
) | PLLQ
);
2241 * @brief Configure PLL clock source
2242 * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_SetMainSource
2243 * @param PLLSource This parameter can be one of the following values:
2244 * @arg @ref LL_RCC_PLLSOURCE_NONE
2245 * @arg @ref LL_RCC_PLLSOURCE_HSI
2246 * @arg @ref LL_RCC_PLLSOURCE_HSE
2249 __STATIC_INLINE
void LL_RCC_PLL_SetMainSource(uint32_t PLLSource
)
2251 MODIFY_REG(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLSRC
, PLLSource
);
2255 * @brief Get the oscillator used as PLL clock source.
2256 * @rmtoll PLLCFGR PLLSRC LL_RCC_PLL_GetMainSource
2257 * @retval Returned value can be one of the following values:
2258 * @arg @ref LL_RCC_PLLSOURCE_NONE
2259 * @arg @ref LL_RCC_PLLSOURCE_HSI
2260 * @arg @ref LL_RCC_PLLSOURCE_HSE
2262 __STATIC_INLINE
uint32_t LL_RCC_PLL_GetMainSource(void)
2264 return (uint32_t)(READ_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLSRC
));
2268 * @brief Get Main PLL multiplication factor for VCO
2269 * @rmtoll PLLCFGR PLLN LL_RCC_PLL_GetN
2270 * @retval Between Min_Data = 8 and Max_Data = 127
2272 __STATIC_INLINE
uint32_t LL_RCC_PLL_GetN(void)
2274 return (uint32_t)(READ_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLN
) >> RCC_PLLCFGR_PLLN_Pos
);
2278 * @brief Get Main PLL division factor for PLLP
2279 * @note Used for PLLADCCLK (ADC clock)
2280 * @rmtoll PLLCFGR PLLPDIV LL_RCC_PLL_GetP\n
2281 * @rmtoll PLLCFGR PLLP LL_RCC_PLL_GetP
2282 * @retval Returned value can be one of the following values:
2283 * @arg @ref LL_RCC_PLLP_DIV_2
2284 * @arg @ref LL_RCC_PLLP_DIV_3
2285 * @arg @ref LL_RCC_PLLP_DIV_4
2286 * @arg @ref LL_RCC_PLLP_DIV_5
2287 * @arg @ref LL_RCC_PLLP_DIV_6
2288 * @arg @ref LL_RCC_PLLP_DIV_7
2289 * @arg @ref LL_RCC_PLLP_DIV_8
2290 * @arg @ref LL_RCC_PLLP_DIV_9
2291 * @arg @ref LL_RCC_PLLP_DIV_10
2292 * @arg @ref LL_RCC_PLLP_DIV_11
2293 * @arg @ref LL_RCC_PLLP_DIV_12
2294 * @arg @ref LL_RCC_PLLP_DIV_13
2295 * @arg @ref LL_RCC_PLLP_DIV_14
2296 * @arg @ref LL_RCC_PLLP_DIV_15
2297 * @arg @ref LL_RCC_PLLP_DIV_16
2298 * @arg @ref LL_RCC_PLLP_DIV_17
2299 * @arg @ref LL_RCC_PLLP_DIV_18
2300 * @arg @ref LL_RCC_PLLP_DIV_19
2301 * @arg @ref LL_RCC_PLLP_DIV_20
2302 * @arg @ref LL_RCC_PLLP_DIV_21
2303 * @arg @ref LL_RCC_PLLP_DIV_22
2304 * @arg @ref LL_RCC_PLLP_DIV_23
2305 * @arg @ref LL_RCC_PLLP_DIV_24
2306 * @arg @ref LL_RCC_PLLP_DIV_25
2307 * @arg @ref LL_RCC_PLLP_DIV_26
2308 * @arg @ref LL_RCC_PLLP_DIV_27
2309 * @arg @ref LL_RCC_PLLP_DIV_28
2310 * @arg @ref LL_RCC_PLLP_DIV_29
2311 * @arg @ref LL_RCC_PLLP_DIV_30
2312 * @arg @ref LL_RCC_PLLP_DIV_31
2314 __STATIC_INLINE
uint32_t LL_RCC_PLL_GetP(void)
2316 return (uint32_t) ((READ_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLPDIV
) != 0U) ? READ_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLPDIV
) : ((READ_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLP
) == RCC_PLLCFGR_PLLP
) ? LL_RCC_PLLP_DIV_17
: LL_RCC_PLLP_DIV_7
) );
2320 * @brief Get Main PLL division factor for PLLQ
2321 * @note Used for PLL48M1CLK selected for USB, RNG (48 MHz clock)
2322 * @rmtoll PLLCFGR PLLQ LL_RCC_PLL_GetQ
2323 * @retval Returned value can be one of the following values:
2324 * @arg @ref LL_RCC_PLLQ_DIV_2
2325 * @arg @ref LL_RCC_PLLQ_DIV_4
2326 * @arg @ref LL_RCC_PLLQ_DIV_6
2327 * @arg @ref LL_RCC_PLLQ_DIV_8
2329 __STATIC_INLINE
uint32_t LL_RCC_PLL_GetQ(void)
2331 return (uint32_t)(READ_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLQ
));
2335 * @brief Get Main PLL division factor for PLLR
2336 * @note Used for PLLCLK (system clock)
2337 * @rmtoll PLLCFGR PLLR LL_RCC_PLL_GetR
2338 * @retval Returned value can be one of the following values:
2339 * @arg @ref LL_RCC_PLLR_DIV_2
2340 * @arg @ref LL_RCC_PLLR_DIV_4
2341 * @arg @ref LL_RCC_PLLR_DIV_6
2342 * @arg @ref LL_RCC_PLLR_DIV_8
2344 __STATIC_INLINE
uint32_t LL_RCC_PLL_GetR(void)
2346 return (uint32_t)(READ_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLR
));
2350 * @brief Get Division factor for the main PLL and other PLL
2351 * @rmtoll PLLCFGR PLLM LL_RCC_PLL_GetDivider
2352 * @retval Returned value can be one of the following values:
2353 * @arg @ref LL_RCC_PLLM_DIV_1
2354 * @arg @ref LL_RCC_PLLM_DIV_2
2355 * @arg @ref LL_RCC_PLLM_DIV_3
2356 * @arg @ref LL_RCC_PLLM_DIV_4
2357 * @arg @ref LL_RCC_PLLM_DIV_5
2358 * @arg @ref LL_RCC_PLLM_DIV_6
2359 * @arg @ref LL_RCC_PLLM_DIV_7
2360 * @arg @ref LL_RCC_PLLM_DIV_8
2361 * @arg @ref LL_RCC_PLLM_DIV_9
2362 * @arg @ref LL_RCC_PLLM_DIV_10
2363 * @arg @ref LL_RCC_PLLM_DIV_11
2364 * @arg @ref LL_RCC_PLLM_DIV_12
2365 * @arg @ref LL_RCC_PLLM_DIV_13
2366 * @arg @ref LL_RCC_PLLM_DIV_14
2367 * @arg @ref LL_RCC_PLLM_DIV_15
2368 * @arg @ref LL_RCC_PLLM_DIV_16
2370 __STATIC_INLINE
uint32_t LL_RCC_PLL_GetDivider(void)
2372 return (uint32_t)(READ_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLM
));
2376 * @brief Enable PLL output mapped on ADC domain clock
2377 * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_EnableDomain_ADC
2380 __STATIC_INLINE
void LL_RCC_PLL_EnableDomain_ADC(void)
2382 SET_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLPEN
);
2386 * @brief Disable PLL output mapped on ADC domain clock
2387 * @note Cannot be disabled if the PLL clock is used as the system
2389 * @note In order to save power, when the PLLCLK of the PLL is
2390 * not used, should be 0
2391 * @rmtoll PLLCFGR PLLPEN LL_RCC_PLL_DisableDomain_ADC
2394 __STATIC_INLINE
void LL_RCC_PLL_DisableDomain_ADC(void)
2396 CLEAR_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLPEN
);
2400 * @brief Enable PLL output mapped on 48MHz domain clock
2401 * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_EnableDomain_48M
2404 __STATIC_INLINE
void LL_RCC_PLL_EnableDomain_48M(void)
2406 SET_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLQEN
);
2410 * @brief Disable PLL output mapped on 48MHz domain clock
2411 * @note Cannot be disabled if the PLL clock is used as the system
2413 * @note In order to save power, when the PLLCLK of the PLL is
2414 * not used, should be 0
2415 * @rmtoll PLLCFGR PLLQEN LL_RCC_PLL_DisableDomain_48M
2418 __STATIC_INLINE
void LL_RCC_PLL_DisableDomain_48M(void)
2420 CLEAR_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLQEN
);
2424 * @brief Enable PLL output mapped on SYSCLK domain
2425 * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_EnableDomain_SYS
2428 __STATIC_INLINE
void LL_RCC_PLL_EnableDomain_SYS(void)
2430 SET_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLREN
);
2434 * @brief Disable PLL output mapped on SYSCLK domain
2435 * @note Cannot be disabled if the PLL clock is used as the system
2437 * @note In order to save power, when the PLLCLK of the PLL is
2438 * not used, Main PLL should be 0
2439 * @rmtoll PLLCFGR PLLREN LL_RCC_PLL_DisableDomain_SYS
2442 __STATIC_INLINE
void LL_RCC_PLL_DisableDomain_SYS(void)
2444 CLEAR_BIT(RCC
->PLLCFGR
, RCC_PLLCFGR_PLLREN
);
2451 /** @defgroup RCC_LL_EF_FLAG_Management FLAG Management
2456 * @brief Clear LSI ready interrupt flag
2457 * @rmtoll CICR LSIRDYC LL_RCC_ClearFlag_LSIRDY
2460 __STATIC_INLINE
void LL_RCC_ClearFlag_LSIRDY(void)
2462 SET_BIT(RCC
->CICR
, RCC_CICR_LSIRDYC
);
2466 * @brief Clear LSE ready interrupt flag
2467 * @rmtoll CICR LSERDYC LL_RCC_ClearFlag_LSERDY
2470 __STATIC_INLINE
void LL_RCC_ClearFlag_LSERDY(void)
2472 SET_BIT(RCC
->CICR
, RCC_CICR_LSERDYC
);
2476 * @brief Clear HSI ready interrupt flag
2477 * @rmtoll CICR HSIRDYC LL_RCC_ClearFlag_HSIRDY
2480 __STATIC_INLINE
void LL_RCC_ClearFlag_HSIRDY(void)
2482 SET_BIT(RCC
->CICR
, RCC_CICR_HSIRDYC
);
2486 * @brief Clear HSE ready interrupt flag
2487 * @rmtoll CICR HSERDYC LL_RCC_ClearFlag_HSERDY
2490 __STATIC_INLINE
void LL_RCC_ClearFlag_HSERDY(void)
2492 SET_BIT(RCC
->CICR
, RCC_CICR_HSERDYC
);
2496 * @brief Clear PLL ready interrupt flag
2497 * @rmtoll CICR PLLRDYC LL_RCC_ClearFlag_PLLRDY
2500 __STATIC_INLINE
void LL_RCC_ClearFlag_PLLRDY(void)
2502 SET_BIT(RCC
->CICR
, RCC_CICR_PLLRDYC
);
2506 * @brief Clear HSI48 ready interrupt flag
2507 * @rmtoll CICR HSI48RDYC LL_RCC_ClearFlag_HSI48RDY
2510 __STATIC_INLINE
void LL_RCC_ClearFlag_HSI48RDY(void)
2512 SET_BIT(RCC
->CICR
, RCC_CICR_HSI48RDYC
);
2516 * @brief Clear Clock security system interrupt flag
2517 * @rmtoll CICR CSSC LL_RCC_ClearFlag_HSECSS
2520 __STATIC_INLINE
void LL_RCC_ClearFlag_HSECSS(void)
2522 SET_BIT(RCC
->CICR
, RCC_CICR_CSSC
);
2526 * @brief Clear LSE Clock security system interrupt flag
2527 * @rmtoll CICR LSECSSC LL_RCC_ClearFlag_LSECSS
2530 __STATIC_INLINE
void LL_RCC_ClearFlag_LSECSS(void)
2532 SET_BIT(RCC
->CICR
, RCC_CICR_LSECSSC
);
2536 * @brief Check if LSI ready interrupt occurred or not
2537 * @rmtoll CIFR LSIRDYF LL_RCC_IsActiveFlag_LSIRDY
2538 * @retval State of bit (1 or 0).
2540 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_LSIRDY(void)
2542 return ((READ_BIT(RCC
->CIFR
, RCC_CIFR_LSIRDYF
) == (RCC_CIFR_LSIRDYF
)) ? 1UL : 0UL);
2546 * @brief Check if LSE ready interrupt occurred or not
2547 * @rmtoll CIFR LSERDYF LL_RCC_IsActiveFlag_LSERDY
2548 * @retval State of bit (1 or 0).
2550 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_LSERDY(void)
2552 return ((READ_BIT(RCC
->CIFR
, RCC_CIFR_LSERDYF
) == (RCC_CIFR_LSERDYF
)) ? 1UL : 0UL);
2556 * @brief Check if HSI ready interrupt occurred or not
2557 * @rmtoll CIFR HSIRDYF LL_RCC_IsActiveFlag_HSIRDY
2558 * @retval State of bit (1 or 0).
2560 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_HSIRDY(void)
2562 return ((READ_BIT(RCC
->CIFR
, RCC_CIFR_HSIRDYF
) == (RCC_CIFR_HSIRDYF
)) ? 1UL : 0UL);
2566 * @brief Check if HSE ready interrupt occurred or not
2567 * @rmtoll CIFR HSERDYF LL_RCC_IsActiveFlag_HSERDY
2568 * @retval State of bit (1 or 0).
2570 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_HSERDY(void)
2572 return ((READ_BIT(RCC
->CIFR
, RCC_CIFR_HSERDYF
) == (RCC_CIFR_HSERDYF
)) ? 1UL : 0UL);
2576 * @brief Check if PLL ready interrupt occurred or not
2577 * @rmtoll CIFR PLLRDYF LL_RCC_IsActiveFlag_PLLRDY
2578 * @retval State of bit (1 or 0).
2580 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_PLLRDY(void)
2582 return ((READ_BIT(RCC
->CIFR
, RCC_CIFR_PLLRDYF
) == (RCC_CIFR_PLLRDYF
)) ? 1UL : 0UL);
2586 * @brief Check if HSI48 ready interrupt occurred or not
2587 * @rmtoll CIR HSI48RDYF LL_RCC_IsActiveFlag_HSI48RDY
2588 * @retval State of bit (1 or 0).
2590 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_HSI48RDY(void)
2592 return ((READ_BIT(RCC
->CIFR
, RCC_CIFR_HSI48RDYF
) == (RCC_CIFR_HSI48RDYF
)) ? 1UL : 0UL);
2596 * @brief Check if Clock security system interrupt occurred or not
2597 * @rmtoll CIFR CSSF LL_RCC_IsActiveFlag_HSECSS
2598 * @retval State of bit (1 or 0).
2600 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_HSECSS(void)
2602 return ((READ_BIT(RCC
->CIFR
, RCC_CIFR_CSSF
) == (RCC_CIFR_CSSF
)) ? 1UL : 0UL);
2606 * @brief Check if LSE Clock security system interrupt occurred or not
2607 * @rmtoll CIFR LSECSSF LL_RCC_IsActiveFlag_LSECSS
2608 * @retval State of bit (1 or 0).
2610 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_LSECSS(void)
2612 return ((READ_BIT(RCC
->CIFR
, RCC_CIFR_LSECSSF
) == (RCC_CIFR_LSECSSF
)) ? 1UL : 0UL);
2616 * @brief Check if RCC flag Independent Watchdog reset is set or not.
2617 * @rmtoll CSR IWDGRSTF LL_RCC_IsActiveFlag_IWDGRST
2618 * @retval State of bit (1 or 0).
2620 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_IWDGRST(void)
2622 return ((READ_BIT(RCC
->CSR
, RCC_CSR_IWDGRSTF
) == (RCC_CSR_IWDGRSTF
)) ? 1UL : 0UL);
2626 * @brief Check if RCC flag Low Power reset is set or not.
2627 * @rmtoll CSR LPWRRSTF LL_RCC_IsActiveFlag_LPWRRST
2628 * @retval State of bit (1 or 0).
2630 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_LPWRRST(void)
2632 return ((READ_BIT(RCC
->CSR
, RCC_CSR_LPWRRSTF
) == (RCC_CSR_LPWRRSTF
)) ? 1UL : 0UL);
2636 * @brief Check if RCC flag Option byte reset is set or not.
2637 * @rmtoll CSR OBLRSTF LL_RCC_IsActiveFlag_OBLRST
2638 * @retval State of bit (1 or 0).
2640 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_OBLRST(void)
2642 return ((READ_BIT(RCC
->CSR
, RCC_CSR_OBLRSTF
) == (RCC_CSR_OBLRSTF
)) ? 1UL : 0UL);
2646 * @brief Check if RCC flag Pin reset is set or not.
2647 * @rmtoll CSR PINRSTF LL_RCC_IsActiveFlag_PINRST
2648 * @retval State of bit (1 or 0).
2650 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_PINRST(void)
2652 return ((READ_BIT(RCC
->CSR
, RCC_CSR_PINRSTF
) == (RCC_CSR_PINRSTF
)) ? 1UL : 0UL);
2656 * @brief Check if RCC flag Software reset is set or not.
2657 * @rmtoll CSR SFTRSTF LL_RCC_IsActiveFlag_SFTRST
2658 * @retval State of bit (1 or 0).
2660 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_SFTRST(void)
2662 return ((READ_BIT(RCC
->CSR
, RCC_CSR_SFTRSTF
) == (RCC_CSR_SFTRSTF
)) ? 1UL : 0UL);
2666 * @brief Check if RCC flag Window Watchdog reset is set or not.
2667 * @rmtoll CSR WWDGRSTF LL_RCC_IsActiveFlag_WWDGRST
2668 * @retval State of bit (1 or 0).
2670 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_WWDGRST(void)
2672 return ((READ_BIT(RCC
->CSR
, RCC_CSR_WWDGRSTF
) == (RCC_CSR_WWDGRSTF
)) ? 1UL : 0UL);
2676 * @brief Check if RCC flag BOR reset is set or not.
2677 * @rmtoll CSR BORRSTF LL_RCC_IsActiveFlag_BORRST
2678 * @retval State of bit (1 or 0).
2680 __STATIC_INLINE
uint32_t LL_RCC_IsActiveFlag_BORRST(void)
2682 return ((READ_BIT(RCC
->CSR
, RCC_CSR_BORRSTF
) == (RCC_CSR_BORRSTF
)) ? 1UL : 0UL);
2686 * @brief Set RMVF bit to clear the reset flags.
2687 * @rmtoll CSR RMVF LL_RCC_ClearResetFlags
2690 __STATIC_INLINE
void LL_RCC_ClearResetFlags(void)
2692 SET_BIT(RCC
->CSR
, RCC_CSR_RMVF
);
2699 /** @defgroup RCC_LL_EF_IT_Management IT Management
2704 * @brief Enable LSI ready interrupt
2705 * @rmtoll CIER LSIRDYIE LL_RCC_EnableIT_LSIRDY
2708 __STATIC_INLINE
void LL_RCC_EnableIT_LSIRDY(void)
2710 SET_BIT(RCC
->CIER
, RCC_CIER_LSIRDYIE
);
2714 * @brief Enable LSE ready interrupt
2715 * @rmtoll CIER LSERDYIE LL_RCC_EnableIT_LSERDY
2718 __STATIC_INLINE
void LL_RCC_EnableIT_LSERDY(void)
2720 SET_BIT(RCC
->CIER
, RCC_CIER_LSERDYIE
);
2724 * @brief Enable HSI ready interrupt
2725 * @rmtoll CIER HSIRDYIE LL_RCC_EnableIT_HSIRDY
2728 __STATIC_INLINE
void LL_RCC_EnableIT_HSIRDY(void)
2730 SET_BIT(RCC
->CIER
, RCC_CIER_HSIRDYIE
);
2734 * @brief Enable HSE ready interrupt
2735 * @rmtoll CIER HSERDYIE LL_RCC_EnableIT_HSERDY
2738 __STATIC_INLINE
void LL_RCC_EnableIT_HSERDY(void)
2740 SET_BIT(RCC
->CIER
, RCC_CIER_HSERDYIE
);
2744 * @brief Enable PLL ready interrupt
2745 * @rmtoll CIER PLLRDYIE LL_RCC_EnableIT_PLLRDY
2748 __STATIC_INLINE
void LL_RCC_EnableIT_PLLRDY(void)
2750 SET_BIT(RCC
->CIER
, RCC_CIER_PLLRDYIE
);
2754 * @brief Enable HSI48 ready interrupt
2755 * @rmtoll CIER HSI48RDYIE LL_RCC_EnableIT_HSI48RDY
2758 __STATIC_INLINE
void LL_RCC_EnableIT_HSI48RDY(void)
2760 SET_BIT(RCC
->CIER
, RCC_CIER_HSI48RDYIE
);
2764 * @brief Enable LSE clock security system interrupt
2765 * @rmtoll CIER LSECSSIE LL_RCC_EnableIT_LSECSS
2768 __STATIC_INLINE
void LL_RCC_EnableIT_LSECSS(void)
2770 SET_BIT(RCC
->CIER
, RCC_CIER_LSECSSIE
);
2774 * @brief Disable LSI ready interrupt
2775 * @rmtoll CIER LSIRDYIE LL_RCC_DisableIT_LSIRDY
2778 __STATIC_INLINE
void LL_RCC_DisableIT_LSIRDY(void)
2780 CLEAR_BIT(RCC
->CIER
, RCC_CIER_LSIRDYIE
);
2784 * @brief Disable LSE ready interrupt
2785 * @rmtoll CIER LSERDYIE LL_RCC_DisableIT_LSERDY
2788 __STATIC_INLINE
void LL_RCC_DisableIT_LSERDY(void)
2790 CLEAR_BIT(RCC
->CIER
, RCC_CIER_LSERDYIE
);
2794 * @brief Disable HSI ready interrupt
2795 * @rmtoll CIER HSIRDYIE LL_RCC_DisableIT_HSIRDY
2798 __STATIC_INLINE
void LL_RCC_DisableIT_HSIRDY(void)
2800 CLEAR_BIT(RCC
->CIER
, RCC_CIER_HSIRDYIE
);
2804 * @brief Disable HSE ready interrupt
2805 * @rmtoll CIER HSERDYIE LL_RCC_DisableIT_HSERDY
2808 __STATIC_INLINE
void LL_RCC_DisableIT_HSERDY(void)
2810 CLEAR_BIT(RCC
->CIER
, RCC_CIER_HSERDYIE
);
2814 * @brief Disable PLL ready interrupt
2815 * @rmtoll CIER PLLRDYIE LL_RCC_DisableIT_PLLRDY
2818 __STATIC_INLINE
void LL_RCC_DisableIT_PLLRDY(void)
2820 CLEAR_BIT(RCC
->CIER
, RCC_CIER_PLLRDYIE
);
2824 * @brief Disable HSI48 ready interrupt
2825 * @rmtoll CIER HSI48RDYIE LL_RCC_DisableIT_HSI48RDY
2828 __STATIC_INLINE
void LL_RCC_DisableIT_HSI48RDY(void)
2830 CLEAR_BIT(RCC
->CIER
, RCC_CIER_HSI48RDYIE
);
2834 * @brief Disable LSE clock security system interrupt
2835 * @rmtoll CIER LSECSSIE LL_RCC_DisableIT_LSECSS
2838 __STATIC_INLINE
void LL_RCC_DisableIT_LSECSS(void)
2840 CLEAR_BIT(RCC
->CIER
, RCC_CIER_LSECSSIE
);
2844 * @brief Checks if LSI ready interrupt source is enabled or disabled.
2845 * @rmtoll CIER LSIRDYIE LL_RCC_IsEnabledIT_LSIRDY
2846 * @retval State of bit (1 or 0).
2848 __STATIC_INLINE
uint32_t LL_RCC_IsEnabledIT_LSIRDY(void)
2850 return ((READ_BIT(RCC
->CIER
, RCC_CIER_LSIRDYIE
) == (RCC_CIER_LSIRDYIE
)) ? 1UL : 0UL);
2854 * @brief Checks if LSE ready interrupt source is enabled or disabled.
2855 * @rmtoll CIER LSERDYIE LL_RCC_IsEnabledIT_LSERDY
2856 * @retval State of bit (1 or 0).
2858 __STATIC_INLINE
uint32_t LL_RCC_IsEnabledIT_LSERDY(void)
2860 return ((READ_BIT(RCC
->CIER
, RCC_CIER_LSERDYIE
) == (RCC_CIER_LSERDYIE
)) ? 1UL : 0UL);
2864 * @brief Checks if HSI ready interrupt source is enabled or disabled.
2865 * @rmtoll CIER HSIRDYIE LL_RCC_IsEnabledIT_HSIRDY
2866 * @retval State of bit (1 or 0).
2868 __STATIC_INLINE
uint32_t LL_RCC_IsEnabledIT_HSIRDY(void)
2870 return ((READ_BIT(RCC
->CIER
, RCC_CIER_HSIRDYIE
) == (RCC_CIER_HSIRDYIE
)) ? 1UL : 0UL);
2874 * @brief Checks if HSE ready interrupt source is enabled or disabled.
2875 * @rmtoll CIER HSERDYIE LL_RCC_IsEnabledIT_HSERDY
2876 * @retval State of bit (1 or 0).
2878 __STATIC_INLINE
uint32_t LL_RCC_IsEnabledIT_HSERDY(void)
2880 return ((READ_BIT(RCC
->CIER
, RCC_CIER_HSERDYIE
) == (RCC_CIER_HSERDYIE
)) ? 1UL : 0UL);
2884 * @brief Checks if PLL ready interrupt source is enabled or disabled.
2885 * @rmtoll CIER PLLRDYIE LL_RCC_IsEnabledIT_PLLRDY
2886 * @retval State of bit (1 or 0).
2888 __STATIC_INLINE
uint32_t LL_RCC_IsEnabledIT_PLLRDY(void)
2890 return ((READ_BIT(RCC
->CIER
, RCC_CIER_PLLRDYIE
) == (RCC_CIER_PLLRDYIE
)) ? 1UL : 0UL);
2894 * @brief Checks if HSI48 ready interrupt source is enabled or disabled.
2895 * @rmtoll CIER HSI48RDYIE LL_RCC_IsEnabledIT_HSI48RDY
2896 * @retval State of bit (1 or 0).
2898 __STATIC_INLINE
uint32_t LL_RCC_IsEnabledIT_HSI48RDY(void)
2900 return ((READ_BIT(RCC
->CIER
, RCC_CIER_HSI48RDYIE
) == (RCC_CIER_HSI48RDYIE
)) ? 1UL : 0UL);
2904 * @brief Checks if LSECSS interrupt source is enabled or disabled.
2905 * @rmtoll CIER LSECSSIE LL_RCC_IsEnabledIT_LSECSS
2906 * @retval State of bit (1 or 0).
2908 __STATIC_INLINE
uint32_t LL_RCC_IsEnabledIT_LSECSS(void)
2910 return ((READ_BIT(RCC
->CIER
, RCC_CIER_LSECSSIE
) == (RCC_CIER_LSECSSIE
)) ? 1UL : 0UL);
2917 #if defined(USE_FULL_LL_DRIVER)
2918 /** @defgroup RCC_LL_EF_Init De-initialization function
2921 ErrorStatus
LL_RCC_DeInit(void);
2926 /** @defgroup RCC_LL_EF_Get_Freq Get system and peripherals clocks frequency functions
2929 void LL_RCC_GetSystemClocksFreq(LL_RCC_ClocksTypeDef
*RCC_Clocks
);
2930 uint32_t LL_RCC_GetUSARTClockFreq(uint32_t USARTxSource
);
2932 uint32_t LL_RCC_GetUARTClockFreq(uint32_t UARTxSource
);
2934 uint32_t LL_RCC_GetI2CClockFreq(uint32_t I2CxSource
);
2935 uint32_t LL_RCC_GetLPUARTClockFreq(uint32_t LPUARTxSource
);
2936 uint32_t LL_RCC_GetLPTIMClockFreq(uint32_t LPTIMxSource
);
2937 uint32_t LL_RCC_GetSAIClockFreq(uint32_t SAIxSource
);
2938 uint32_t LL_RCC_GetI2SClockFreq(uint32_t I2SxSource
);
2940 uint32_t LL_RCC_GetFDCANClockFreq(uint32_t FDCANxSource
);
2942 uint32_t LL_RCC_GetRNGClockFreq(uint32_t RNGxSource
);
2943 uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource
);
2944 uint32_t LL_RCC_GetADCClockFreq(uint32_t ADCxSource
);
2945 #if defined(QUADSPI)
2946 uint32_t LL_RCC_GetQUADSPIClockFreq(uint32_t QUADSPIxSource
);
2947 #endif /* QUADSPI */
2951 #endif /* USE_FULL_LL_DRIVER */
2969 #endif /* STM32G4xx_LL_RCC_H */
2971 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/