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