You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1519 lines
68 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_hal_rcc_ex.h
  4. * @author MCD Application Team
  5. * @version V1.3.0
  6. * @date 29-January-2016
  7. * @brief Header file of RCC HAL Extended module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32L4xx_HAL_RCC_EX_H
  39. #define __STM32L4xx_HAL_RCC_EX_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32l4xx_hal_def.h"
  45. /** @addtogroup STM32L4xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup RCCEx
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup RCCEx_Exported_Types RCCEx Exported Types
  53. * @{
  54. */
  55. /**
  56. * @brief PLLSAI1 Clock structure definition
  57. */
  58. typedef struct
  59. {
  60. uint32_t PLLSAI1N; /*!< PLLSAI1N: specifies the multiplication factor for PLLSAI1 VCO output clock.
  61. This parameter must be a number between 8 and 86. */
  62. uint32_t PLLSAI1P; /*!< PLLSAI1P: specifies the division factor for SAI clock.
  63. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */
  64. uint32_t PLLSAI1Q; /*!< PLLSAI1Q: specifies the division factor for USB/RNG/SDMMC1 clock.
  65. This parameter must be a value of @ref RCC_PLLQ_Clock_Divider */
  66. uint32_t PLLSAI1R; /*!< PLLSAI1R: specifies the division factor for ADC clock.
  67. This parameter must be a value of @ref RCC_PLLR_Clock_Divider */
  68. uint32_t PLLSAI1ClockOut; /*!< PLLSAIClockOut: specifies PLLSAI1 output clock to be enabled.
  69. This parameter must be a value of @ref RCC_PLLSAI1_Clock_Output */
  70. }RCC_PLLSAI1InitTypeDef;
  71. /**
  72. * @brief PLLSAI2 Clock structure definition
  73. */
  74. typedef struct
  75. {
  76. uint32_t PLLSAI2N; /*!< PLLSAI2N: specifies the multiplication factor for PLLSAI2 VCO output clock.
  77. This parameter must be a number between 8 and 86. */
  78. uint32_t PLLSAI2P; /*!< PLLSAI2P: specifies the division factor for SAI clock.
  79. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */
  80. uint32_t PLLSAI2R; /*!< PLLSAI2R: specifies the division factor for ADC clock.
  81. This parameter must be a value of @ref RCC_PLLR_Clock_Divider */
  82. uint32_t PLLSAI2ClockOut; /*!< PLLSAIClockOut: specifies PLLSAI2 output clock to be enabled.
  83. This parameter must be a value of @ref RCC_PLLSAI2_Clock_Output */
  84. }RCC_PLLSAI2InitTypeDef;
  85. /**
  86. * @brief RCC extended clocks structure definition
  87. */
  88. typedef struct
  89. {
  90. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  91. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  92. RCC_PLLSAI1InitTypeDef PLLSAI1; /*!< PLLSAI1 structure parameters.
  93. This parameter will be used only when PLLSAI1 is selected as Clock Source for SAI1, USB/RNG/SDMMC1 or ADC */
  94. RCC_PLLSAI2InitTypeDef PLLSAI2; /*!< PLLSAI2 structure parameters.
  95. This parameter will be used only when PLLSAI2 is selected as Clock Source for SAI2 or ADC */
  96. uint32_t Usart1ClockSelection; /*!< Specifies USART1 clock source.
  97. This parameter can be a value of @ref RCCEx_USART1_Clock_Source */
  98. uint32_t Usart2ClockSelection; /*!< Specifies USART2 clock source.
  99. This parameter can be a value of @ref RCCEx_USART2_Clock_Source */
  100. uint32_t Usart3ClockSelection; /*!< Specifies USART3 clock source.
  101. This parameter can be a value of @ref RCCEx_USART3_Clock_Source */
  102. uint32_t Uart4ClockSelection; /*!< Specifies UART4 clock source.
  103. This parameter can be a value of @ref RCCEx_UART4_Clock_Source */
  104. uint32_t Uart5ClockSelection; /*!< Specifies UART5 clock source.
  105. This parameter can be a value of @ref RCCEx_UART5_Clock_Source */
  106. uint32_t Lpuart1ClockSelection; /*!< Specifies LPUART1 clock source.
  107. This parameter can be a value of @ref RCCEx_LPUART1_Clock_Source */
  108. uint32_t I2c1ClockSelection; /*!< Specifies I2C1 clock source.
  109. This parameter can be a value of @ref RCCEx_I2C1_Clock_Source */
  110. uint32_t I2c2ClockSelection; /*!< Specifies I2C2 clock source.
  111. This parameter can be a value of @ref RCCEx_I2C2_Clock_Source */
  112. uint32_t I2c3ClockSelection; /*!< Specifies I2C3 clock source.
  113. This parameter can be a value of @ref RCCEx_I2C3_Clock_Source */
  114. uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 clock source.
  115. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */
  116. uint32_t Lptim2ClockSelection; /*!< Specifies LPTIM2 clock source.
  117. This parameter can be a value of @ref RCCEx_LPTIM2_Clock_Source */
  118. uint32_t Sai1ClockSelection; /*!< Specifies SAI1 clock source.
  119. This parameter can be a value of @ref RCCEx_SAI1_Clock_Source */
  120. uint32_t Sai2ClockSelection; /*!< Specifies SAI2 clock source.
  121. This parameter can be a value of @ref RCCEx_SAI2_Clock_Source */
  122. #if defined(USB_OTG_FS)
  123. uint32_t UsbClockSelection; /*!< Specifies USB clock source (warning: same source for SDMMC1 and RNG).
  124. This parameter can be a value of @ref RCCEx_USB_Clock_Source */
  125. #endif /* USB_OTG_FS */
  126. uint32_t Sdmmc1ClockSelection; /*!< Specifies SDMMC1 clock source (warning: same source for USB and RNG).
  127. This parameter can be a value of @ref RCCEx_SDMMC1_Clock_Source */
  128. uint32_t RngClockSelection; /*!< Specifies RNG clock source (warning: same source for USB and SDMMC1).
  129. This parameter can be a value of @ref RCCEx_RNG_Clock_Source */
  130. uint32_t AdcClockSelection; /*!< Specifies ADC interface clock source.
  131. This parameter can be a value of @ref RCCEx_ADC_Clock_Source */
  132. uint32_t Swpmi1ClockSelection; /*!< Specifies SWPMI1 clock source.
  133. This parameter can be a value of @ref RCCEx_SWPMI1_Clock_Source */
  134. uint32_t DfsdmClockSelection; /*!< Specifies DFSDM clock source.
  135. This parameter can be a value of @ref RCCEx_DFSDM_Clock_Source */
  136. uint32_t RTCClockSelection; /*!< Specifies RTC clock source.
  137. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  138. }RCC_PeriphCLKInitTypeDef;
  139. /**
  140. * @}
  141. */
  142. /* Exported constants --------------------------------------------------------*/
  143. /** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants
  144. * @{
  145. */
  146. /** @defgroup RCCEx_LSCO_Clock_Source Low Speed Clock Source
  147. * @{
  148. */
  149. #define RCC_LSCOSOURCE_LSI (uint32_t)0x00000000U /*!< LSI selection for low speed clock output */
  150. #define RCC_LSCOSOURCE_LSE RCC_BDCR_LSCOSEL /*!< LSE selection for low speed clock output */
  151. /**
  152. * @}
  153. */
  154. /** @defgroup RCCEx_Periph_Clock_Selection Periph Clock Selection
  155. * @{
  156. */
  157. #define RCC_PERIPHCLK_USART1 ((uint32_t)0x00000001U)
  158. #define RCC_PERIPHCLK_USART2 ((uint32_t)0x00000002U)
  159. #define RCC_PERIPHCLK_USART3 ((uint32_t)0x00000004U)
  160. #define RCC_PERIPHCLK_UART4 ((uint32_t)0x00000008U)
  161. #define RCC_PERIPHCLK_UART5 ((uint32_t)0x00000010U)
  162. #define RCC_PERIPHCLK_LPUART1 ((uint32_t)0x00000020U)
  163. #define RCC_PERIPHCLK_I2C1 ((uint32_t)0x00000040U)
  164. #define RCC_PERIPHCLK_I2C2 ((uint32_t)0x00000080U)
  165. #define RCC_PERIPHCLK_I2C3 ((uint32_t)0x00000100U)
  166. #define RCC_PERIPHCLK_LPTIM1 ((uint32_t)0x00000200U)
  167. #define RCC_PERIPHCLK_LPTIM2 ((uint32_t)0x00000400U)
  168. #define RCC_PERIPHCLK_SAI1 ((uint32_t)0x00000800U)
  169. #define RCC_PERIPHCLK_SAI2 ((uint32_t)0x00001000U)
  170. #if defined(USB_OTG_FS)
  171. #define RCC_PERIPHCLK_USB ((uint32_t)0x00002000U)
  172. #endif
  173. #define RCC_PERIPHCLK_ADC ((uint32_t)0x00004000U)
  174. #define RCC_PERIPHCLK_SWPMI1 ((uint32_t)0x00008000U)
  175. #define RCC_PERIPHCLK_DFSDM ((uint32_t)0x00010000U)
  176. #define RCC_PERIPHCLK_RTC ((uint32_t)0x00020000U)
  177. #define RCC_PERIPHCLK_RNG ((uint32_t)0x00040000U)
  178. #define RCC_PERIPHCLK_SDMMC1 ((uint32_t)0x00080000U)
  179. /**
  180. * @}
  181. */
  182. /** @defgroup RCCEx_USART1_Clock_Source USART1 Clock Source
  183. * @{
  184. */
  185. #define RCC_USART1CLKSOURCE_PCLK2 ((uint32_t)0x00000000U)
  186. #define RCC_USART1CLKSOURCE_SYSCLK RCC_CCIPR_USART1SEL_0
  187. #define RCC_USART1CLKSOURCE_HSI RCC_CCIPR_USART1SEL_1
  188. #define RCC_USART1CLKSOURCE_LSE (RCC_CCIPR_USART1SEL_0 | RCC_CCIPR_USART1SEL_1)
  189. /**
  190. * @}
  191. */
  192. /** @defgroup RCCEx_USART2_Clock_Source USART2 Clock Source
  193. * @{
  194. */
  195. #define RCC_USART2CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  196. #define RCC_USART2CLKSOURCE_SYSCLK RCC_CCIPR_USART2SEL_0
  197. #define RCC_USART2CLKSOURCE_HSI RCC_CCIPR_USART2SEL_1
  198. #define RCC_USART2CLKSOURCE_LSE (RCC_CCIPR_USART2SEL_0 | RCC_CCIPR_USART2SEL_1)
  199. /**
  200. * @}
  201. */
  202. /** @defgroup RCCEx_USART3_Clock_Source USART3 Clock Source
  203. * @{
  204. */
  205. #define RCC_USART3CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  206. #define RCC_USART3CLKSOURCE_SYSCLK RCC_CCIPR_USART3SEL_0
  207. #define RCC_USART3CLKSOURCE_HSI RCC_CCIPR_USART3SEL_1
  208. #define RCC_USART3CLKSOURCE_LSE (RCC_CCIPR_USART3SEL_0 | RCC_CCIPR_USART3SEL_1)
  209. /**
  210. * @}
  211. */
  212. /** @defgroup RCCEx_UART4_Clock_Source UART4 Clock Source
  213. * @{
  214. */
  215. #define RCC_UART4CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  216. #define RCC_UART4CLKSOURCE_SYSCLK RCC_CCIPR_UART4SEL_0
  217. #define RCC_UART4CLKSOURCE_HSI RCC_CCIPR_UART4SEL_1
  218. #define RCC_UART4CLKSOURCE_LSE (RCC_CCIPR_UART4SEL_0 | RCC_CCIPR_UART4SEL_1)
  219. /**
  220. * @}
  221. */
  222. /** @defgroup RCCEx_UART5_Clock_Source UART5 Clock Source
  223. * @{
  224. */
  225. #define RCC_UART5CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  226. #define RCC_UART5CLKSOURCE_SYSCLK RCC_CCIPR_UART5SEL_0
  227. #define RCC_UART5CLKSOURCE_HSI RCC_CCIPR_UART5SEL_1
  228. #define RCC_UART5CLKSOURCE_LSE (RCC_CCIPR_UART5SEL_0 | RCC_CCIPR_UART5SEL_1)
  229. /**
  230. * @}
  231. */
  232. /** @defgroup RCCEx_LPUART1_Clock_Source LPUART1 Clock Source
  233. * @{
  234. */
  235. #define RCC_LPUART1CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  236. #define RCC_LPUART1CLKSOURCE_SYSCLK RCC_CCIPR_LPUART1SEL_0
  237. #define RCC_LPUART1CLKSOURCE_HSI RCC_CCIPR_LPUART1SEL_1
  238. #define RCC_LPUART1CLKSOURCE_LSE (RCC_CCIPR_LPUART1SEL_0 | RCC_CCIPR_LPUART1SEL_1)
  239. /**
  240. * @}
  241. */
  242. /** @defgroup RCCEx_I2C1_Clock_Source I2C1 Clock Source
  243. * @{
  244. */
  245. #define RCC_I2C1CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  246. #define RCC_I2C1CLKSOURCE_SYSCLK RCC_CCIPR_I2C1SEL_0
  247. #define RCC_I2C1CLKSOURCE_HSI RCC_CCIPR_I2C1SEL_1
  248. /**
  249. * @}
  250. */
  251. /** @defgroup RCCEx_I2C2_Clock_Source I2C2 Clock Source
  252. * @{
  253. */
  254. #define RCC_I2C2CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  255. #define RCC_I2C2CLKSOURCE_SYSCLK RCC_CCIPR_I2C2SEL_0
  256. #define RCC_I2C2CLKSOURCE_HSI RCC_CCIPR_I2C2SEL_1
  257. /**
  258. * @}
  259. */
  260. /** @defgroup RCCEx_I2C3_Clock_Source I2C3 Clock Source
  261. * @{
  262. */
  263. #define RCC_I2C3CLKSOURCE_PCLK1 ((uint32_t)0x00000000U)
  264. #define RCC_I2C3CLKSOURCE_SYSCLK RCC_CCIPR_I2C3SEL_0
  265. #define RCC_I2C3CLKSOURCE_HSI RCC_CCIPR_I2C3SEL_1
  266. /**
  267. * @}
  268. */
  269. /** @defgroup RCCEx_SAI1_Clock_Source SAI1 Clock Source
  270. * @{
  271. */
  272. #define RCC_SAI1CLKSOURCE_PLLSAI1 ((uint32_t)0x00000000U)
  273. #define RCC_SAI1CLKSOURCE_PLLSAI2 RCC_CCIPR_SAI1SEL_0
  274. #define RCC_SAI1CLKSOURCE_PLL RCC_CCIPR_SAI1SEL_1
  275. #define RCC_SAI1CLKSOURCE_PIN RCC_CCIPR_SAI1SEL
  276. /**
  277. * @}
  278. */
  279. /** @defgroup RCCEx_SAI2_Clock_Source SAI2 Clock Source
  280. * @{
  281. */
  282. #define RCC_SAI2CLKSOURCE_PLLSAI1 ((uint32_t)0x00000000U)
  283. #define RCC_SAI2CLKSOURCE_PLLSAI2 RCC_CCIPR_SAI2SEL_0
  284. #define RCC_SAI2CLKSOURCE_PLL RCC_CCIPR_SAI2SEL_1
  285. #define RCC_SAI2CLKSOURCE_PIN RCC_CCIPR_SAI2SEL
  286. /**
  287. * @}
  288. */
  289. /** @defgroup RCCEx_LPTIM1_Clock_Source LPTIM1 Clock Source
  290. * @{
  291. */
  292. #define RCC_LPTIM1CLKSOURCE_PCLK ((uint32_t)0x00000000U)
  293. #define RCC_LPTIM1CLKSOURCE_LSI RCC_CCIPR_LPTIM1SEL_0
  294. #define RCC_LPTIM1CLKSOURCE_HSI RCC_CCIPR_LPTIM1SEL_1
  295. #define RCC_LPTIM1CLKSOURCE_LSE RCC_CCIPR_LPTIM1SEL
  296. /**
  297. * @}
  298. */
  299. /** @defgroup RCCEx_LPTIM2_Clock_Source LPTIM2 Clock Source
  300. * @{
  301. */
  302. #define RCC_LPTIM2CLKSOURCE_PCLK ((uint32_t)0x00000000U)
  303. #define RCC_LPTIM2CLKSOURCE_LSI RCC_CCIPR_LPTIM2SEL_0
  304. #define RCC_LPTIM2CLKSOURCE_HSI RCC_CCIPR_LPTIM2SEL_1
  305. #define RCC_LPTIM2CLKSOURCE_LSE RCC_CCIPR_LPTIM2SEL
  306. /**
  307. * @}
  308. */
  309. /** @defgroup RCCEx_SDMMC1_Clock_Source SDMMC1 Clock Source
  310. * @{
  311. */
  312. #define RCC_SDMMC1CLKSOURCE_NONE ((uint32_t)0x00000000U)
  313. #define RCC_SDMMC1CLKSOURCE_PLLSAI1 RCC_CCIPR_CLK48SEL_0
  314. #define RCC_SDMMC1CLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1
  315. #define RCC_SDMMC1CLKSOURCE_MSI RCC_CCIPR_CLK48SEL
  316. /**
  317. * @}
  318. */
  319. /** @defgroup RCCEx_RNG_Clock_Source RNG Clock Source
  320. * @{
  321. */
  322. #define RCC_RNGCLKSOURCE_NONE ((uint32_t)0x00000000U)
  323. #define RCC_RNGCLKSOURCE_PLLSAI1 RCC_CCIPR_CLK48SEL_0
  324. #define RCC_RNGCLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1
  325. #define RCC_RNGCLKSOURCE_MSI RCC_CCIPR_CLK48SEL
  326. /**
  327. * @}
  328. */
  329. #if defined(USB_OTG_FS)
  330. /** @defgroup RCCEx_USB_Clock_Source USB Clock Source
  331. * @{
  332. */
  333. #define RCC_USBCLKSOURCE_NONE ((uint32_t)0x00000000U)
  334. #define RCC_USBCLKSOURCE_PLLSAI1 RCC_CCIPR_CLK48SEL_0
  335. #define RCC_USBCLKSOURCE_PLL RCC_CCIPR_CLK48SEL_1
  336. #define RCC_USBCLKSOURCE_MSI RCC_CCIPR_CLK48SEL
  337. /**
  338. * @}
  339. */
  340. #endif /* USB_OTG_FS */
  341. /** @defgroup RCCEx_ADC_Clock_Source ADC Clock Source
  342. * @{
  343. */
  344. #define RCC_ADCCLKSOURCE_NONE ((uint32_t)0x00000000U)
  345. #define RCC_ADCCLKSOURCE_PLLSAI1 RCC_CCIPR_ADCSEL_0
  346. #define RCC_ADCCLKSOURCE_PLLSAI2 RCC_CCIPR_ADCSEL_1
  347. #define RCC_ADCCLKSOURCE_SYSCLK RCC_CCIPR_ADCSEL
  348. /**
  349. * @}
  350. */
  351. /** @defgroup RCCEx_SWPMI1_Clock_Source SWPMI1 Clock Source
  352. * @{
  353. */
  354. #define RCC_SWPMI1CLKSOURCE_PCLK ((uint32_t)0x00000000U)
  355. #define RCC_SWPMI1CLKSOURCE_HSI RCC_CCIPR_SWPMI1SEL
  356. /**
  357. * @}
  358. */
  359. /** @defgroup RCCEx_DFSDM_Clock_Source DFSDM Clock Source
  360. * @{
  361. */
  362. #define RCC_DFSDMCLKSOURCE_PCLK ((uint32_t)0x00000000U)
  363. #define RCC_DFSDMCLKSOURCE_SYSCLK RCC_CCIPR_DFSDMSEL
  364. /**
  365. * @}
  366. */
  367. /** @defgroup RCCEx_EXTI_LINE_LSECSS RCC LSE CSS external interrupt line
  368. * @{
  369. */
  370. #define RCC_EXTI_LINE_LSECSS EXTI_IMR1_IM19 /*!< External interrupt line 19 connected to the LSE CSS EXTI Line */
  371. /**
  372. * @}
  373. */
  374. /**
  375. * @}
  376. */
  377. /* Exported macros -----------------------------------------------------------*/
  378. /** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros
  379. * @{
  380. */
  381. /**
  382. * @brief Macro to configure the PLLSAI1 clock multiplication and division factors.
  383. *
  384. * @note This function must be used only when the PLLSAI1 is disabled.
  385. * @note PLLSAI1 clock source is common with the main PLL (configured through
  386. * __HAL_RCC_PLL_CONFIG() macro)
  387. *
  388. * @param __PLLSAI1N__ specifies the multiplication factor for PLLSAI1 VCO output clock.
  389. * This parameter must be a number between 8 and 86.
  390. * @note You have to set the PLLSAI1N parameter correctly to ensure that the VCO
  391. * output frequency is between 64 and 344 MHz.
  392. * PLLSAI1 clock frequency = f(PLLSAI1) multiplied by PLLSAI1N
  393. *
  394. * @param __PLLSAI1P__ specifies the division factor for SAI clock.
  395. * This parameter must be a number in the range (7 or 17).
  396. * SAI1 clock frequency = f(PLLSAI1) / PLLSAI1P
  397. *
  398. * @param __PLLSAI1Q__ specifies the division factor for USB/RNG/SDMMC1 clock.
  399. * This parameter must be in the range (2, 4, 6 or 8).
  400. * USB/RNG/SDMMC1 clock frequency = f(PLLSAI1) / PLLSAI1Q
  401. *
  402. * @param __PLLSAI1R__ specifies the division factor for SAR ADC clock.
  403. * This parameter must be in the range (2, 4, 6 or 8).
  404. * ADC clock frequency = f(PLLSAI1) / PLLSAI1R
  405. *
  406. * @retval None
  407. */
  408. #define __HAL_RCC_PLLSAI1_CONFIG(__PLLSAI1N__, __PLLSAI1P__, __PLLSAI1Q__, __PLLSAI1R__) \
  409. WRITE_REG(RCC->PLLSAI1CFGR, ((__PLLSAI1N__) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1N)) | \
  410. (((__PLLSAI1P__) >> 4U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1P)) | \
  411. ((((__PLLSAI1Q__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1Q)) | \
  412. ((((__PLLSAI1R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1R)))
  413. /**
  414. * @brief Macro to configure the PLLSAI1 clock multiplication factor N.
  415. *
  416. * @note This function must be used only when the PLLSAI1 is disabled.
  417. * @note PLLSAI1 clock source is common with the main PLL (configured through
  418. * __HAL_RCC_PLL_CONFIG() macro)
  419. *
  420. * @param __PLLSAI1N__ specifies the multiplication factor for PLLSAI1 VCO output clock.
  421. * This parameter must be a number between 8 and 86.
  422. * @note You have to set the PLLSAI1N parameter correctly to ensure that the VCO
  423. * output frequency is between 64 and 344 MHz.
  424. * Use to set PLLSAI1 clock frequency = f(PLLSAI1) multiplied by PLLSAI1N
  425. *
  426. * @retval None
  427. */
  428. #define __HAL_RCC_PLLSAI1_MULN_CONFIG(__PLLSAI1N__) \
  429. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1N, (__PLLSAI1N__) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1N))
  430. /** @brief Macro to configure the PLLSAI1 clock division factor P.
  431. *
  432. * @note This function must be used only when the PLLSAI1 is disabled.
  433. * @note PLLSAI1 clock source is common with the main PLL (configured through
  434. * __HAL_RCC_PLL_CONFIG() macro)
  435. *
  436. * @param __PLLSAI1P__ specifies the division factor for SAI clock.
  437. * This parameter must be a number in the range (7 or 17).
  438. * Use to set SAI1 clock frequency = f(PLLSAI1) / PLLSAI1P
  439. *
  440. * @retval None
  441. */
  442. #define __HAL_RCC_PLLSAI1_DIVP_CONFIG(__PLLSAI1P__) \
  443. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1P, ((__PLLSAI1P__) >> 4U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1P))
  444. /** @brief Macro to configure the PLLSAI1 clock division factor Q.
  445. *
  446. * @note This function must be used only when the PLLSAI1 is disabled.
  447. * @note PLLSAI1 clock source is common with the main PLL (configured through
  448. * __HAL_RCC_PLL_CONFIG() macro)
  449. *
  450. * @param __PLLSAI1Q__ specifies the division factor for USB/RNG/SDMMC1 clock.
  451. * This parameter must be in the range (2, 4, 6 or 8).
  452. * Use to set USB/RNG/SDMMC1 clock frequency = f(PLLSAI1) / PLLSAI1Q
  453. *
  454. * @retval None
  455. */
  456. #define __HAL_RCC_PLLSAI1_DIVQ_CONFIG(__PLLSAI1Q__) \
  457. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1Q, (((__PLLSAI1Q__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1Q))
  458. /** @brief Macro to configure the PLLSAI1 clock division factor R.
  459. *
  460. * @note This function must be used only when the PLLSAI1 is disabled.
  461. * @note PLLSAI1 clock source is common with the main PLL (configured through
  462. * __HAL_RCC_PLL_CONFIG() macro)
  463. *
  464. * @param __PLLSAI1R__ specifies the division factor for ADC clock.
  465. * This parameter must be in the range (2, 4, 6 or 8)
  466. * Use to set ADC clock frequency = f(PLLSAI1) / PLLSAI1R
  467. *
  468. * @retval None
  469. */
  470. #define __HAL_RCC_PLLSAI1_DIVR_CONFIG(__PLLSAI1R__) \
  471. MODIFY_REG(RCC->PLLSAI1CFGR, RCC_PLLSAI1CFGR_PLLSAI1R, (((__PLLSAI1R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI1CFGR_PLLSAI1R))
  472. /**
  473. * @brief Macros to enable or disable the PLLSAI1.
  474. * @note The PLLSAI1 is disabled by hardware when entering STOP and STANDBY modes.
  475. * @retval None
  476. */
  477. #define __HAL_RCC_PLLSAI1_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLLSAI1ON)
  478. #define __HAL_RCC_PLLSAI1_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLLSAI1ON)
  479. /**
  480. * @brief Macros to enable or disable each clock output (PLLSAI1_SAI1, PLLSAI1_USB2 and PLLSAI1_ADC1).
  481. * @note Enabling and disabling those clocks can be done without the need to stop the PLL.
  482. * This is mainly used to save Power.
  483. * @param __PLLSAI1_CLOCKOUT__ specifies the PLLSAI1 clock to be output.
  484. * This parameter can be one or a combination of the following values:
  485. * @arg @ref RCC_PLLSAI1_SAI1CLK This clock is used to generate an accurate clock to achieve
  486. * high-quality audio performance on SAI interface in case.
  487. * @arg @ref RCC_PLLSAI1_48M2CLK This clock is used to generate the clock for the USB OTG FS (48 MHz),
  488. * the random number generator (<=48 MHz) and the SDIO (<= 48 MHz).
  489. * @arg @ref RCC_PLLSAI1_ADC1CLK Clock used to clock ADC peripheral.
  490. * @retval None
  491. */
  492. #define __HAL_RCC_PLLSAI1CLKOUT_ENABLE(__PLLSAI1_CLOCKOUT__) SET_BIT(RCC->PLLSAI1CFGR, (__PLLSAI1_CLOCKOUT__))
  493. #define __HAL_RCC_PLLSAI1CLKOUT_DISABLE(__PLLSAI1_CLOCKOUT__) CLEAR_BIT(RCC->PLLSAI1CFGR, (__PLLSAI1_CLOCKOUT__))
  494. /**
  495. * @brief Macro to get clock output enable status (PLLSAI1_SAI1, PLLSAI1_USB2 and PLLSAI1_ADC1).
  496. * @param __PLLSAI1_CLOCKOUT__ specifies the PLLSAI1 clock to be output.
  497. * This parameter can be one of the following values:
  498. * @arg @ref RCC_PLLSAI1_SAI1CLK This clock is used to generate an accurate clock to achieve
  499. * high-quality audio performance on SAI interface in case.
  500. * @arg @ref RCC_PLLSAI1_48M2CLK This clock is used to generate the clock for the USB OTG FS (48 MHz),
  501. * the random number generator (<=48 MHz) and the SDIO (<= 48 MHz).
  502. * @arg @ref RCC_PLLSAI1_ADC1CLK Clock used to clock ADC peripheral.
  503. * @retval SET / RESET
  504. */
  505. #define __HAL_RCC_GET_PLLSAI1CLKOUT_CONFIG(__PLLSAI1_CLOCKOUT__) READ_BIT(RCC->PLLSAI1CFGR, (__PLLSAI1_CLOCKOUT__))
  506. /**
  507. * @brief Macro to configure the PLLSAI2 clock multiplication and division factors.
  508. *
  509. * @note This function must be used only when the PLLSAI2 is disabled.
  510. * @note PLLSAI2 clock source is common with the main PLL (configured through
  511. * __HAL_RCC_PLL_CONFIG() macro)
  512. *
  513. * @param __PLLSAI2N__ specifies the multiplication factor for PLLSAI2 VCO output clock.
  514. * This parameter must be a number between 8 and 86.
  515. * @note You have to set the PLLSAI2N parameter correctly to ensure that the VCO
  516. * output frequency is between 64 and 344 MHz.
  517. *
  518. * @param __PLLSAI2P__ specifies the division factor for SAI clock.
  519. * This parameter must be a number in the range (7 or 17).
  520. *
  521. *
  522. * @param __PLLSAI2R__ specifies the division factor for SAR ADC clock.
  523. * This parameter must be in the range (2, 4, 6 or 8)
  524. *
  525. * @retval None
  526. */
  527. #define __HAL_RCC_PLLSAI2_CONFIG(__PLLSAI2N__, __PLLSAI2P__, __PLLSAI2R__) \
  528. WRITE_REG(RCC->PLLSAI2CFGR, ((__PLLSAI2N__) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2N)) | \
  529. (((__PLLSAI2P__) >> 4U) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2P)) | \
  530. ((((__PLLSAI2R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2R)))
  531. /**
  532. * @brief Macro to configure the PLLSAI2 clock multiplication factor N.
  533. *
  534. * @note This function must be used only when the PLLSAI2 is disabled.
  535. * @note PLLSAI2 clock source is common with the main PLL (configured through
  536. * __HAL_RCC_PLL_CONFIG() macro)
  537. *
  538. * @param __PLLSAI2N__ specifies the multiplication factor for PLLSAI2 VCO output clock.
  539. * This parameter must be a number between 8 and 86.
  540. * @note You have to set the PLLSAI2N parameter correctly to ensure that the VCO
  541. * output frequency is between 64 and 344 MHz.
  542. * PLLSAI1 clock frequency = f(PLLSAI1) multiplied by PLLSAI2N
  543. *
  544. * @retval None
  545. */
  546. #define __HAL_RCC_PLLSAI2_MULN_CONFIG(__PLLSAI2N__) \
  547. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2N, (__PLLSAI2N__) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2N))
  548. /** @brief Macro to configure the PLLSAI2 clock division factor P.
  549. *
  550. * @note This function must be used only when the PLLSAI2 is disabled.
  551. * @note PLLSAI2 clock source is common with the main PLL (configured through
  552. * __HAL_RCC_PLL_CONFIG() macro)
  553. *
  554. * @param __PLLSAI2P__ specifies the division factor.
  555. * This parameter must be a number in the range (7 or 17).
  556. * Use to set SAI2 clock frequency = f(PLLSAI2) / __PLLSAI2P__
  557. *
  558. * @retval None
  559. */
  560. #define __HAL_RCC_PLLSAI2_DIVP_CONFIG(__PLLSAI2P__) \
  561. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2P, ((__PLLSAI2P__) >> 4U) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2P))
  562. /** @brief Macro to configure the PLLSAI2 clock division factor R.
  563. *
  564. * @note This function must be used only when the PLLSAI2 is disabled.
  565. * @note PLLSAI1 clock source is common with the main PLL (configured through
  566. * __HAL_RCC_PLL_CONFIG() macro)
  567. *
  568. * @param __PLLSAI2R__ specifies the division factor.
  569. * This parameter must be in the range (2, 4, 6 or 8).
  570. * Use to set ADC clock frequency = f(PLLSAI2) / __PLLSAI2Q__
  571. *
  572. * @retval None
  573. */
  574. #define __HAL_RCC_PLLSAI2_DIVR_CONFIG(__PLLSAI2R__) \
  575. MODIFY_REG(RCC->PLLSAI2CFGR, RCC_PLLSAI2CFGR_PLLSAI2R, (((__PLLSAI2R__) >> 1U) - 1U) << POSITION_VAL(RCC_PLLSAI2CFGR_PLLSAI2R))
  576. /**
  577. * @brief Macros to enable or disable the PLLSAI2.
  578. * @note The PLLSAI2 is disabled by hardware when entering STOP and STANDBY modes.
  579. * @retval None
  580. */
  581. #define __HAL_RCC_PLLSAI2_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLLSAI2ON)
  582. #define __HAL_RCC_PLLSAI2_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLLSAI2ON)
  583. /**
  584. * @brief Macros to enable or disable each clock output (PLLSAI2_SAI2 and PLLSAI2_ADC2).
  585. * @note Enabling and disabling those clocks can be done without the need to stop the PLL.
  586. * This is mainly used to save Power.
  587. * @param __PLLSAI2_CLOCKOUT__ specifies the PLLSAI2 clock to be output.
  588. * This parameter can be one or a combination of the following values:
  589. * @arg @ref RCC_PLLSAI2_SAI2CLK This clock is used to generate an accurate clock to achieve
  590. * high-quality audio performance on SAI interface in case.
  591. * @arg @ref RCC_PLLSAI2_ADC2CLK Clock used to clock ADC peripheral.
  592. * @retval None
  593. */
  594. #define __HAL_RCC_PLLSAI2CLKOUT_ENABLE(__PLLSAI2_CLOCKOUT__) SET_BIT(RCC->PLLSAI2CFGR, (__PLLSAI2_CLOCKOUT__))
  595. #define __HAL_RCC_PLLSAI2CLKOUT_DISABLE(__PLLSAI2_CLOCKOUT__) CLEAR_BIT(RCC->PLLSAI2CFGR, (__PLLSAI2_CLOCKOUT__))
  596. /**
  597. * @brief Macro to get clock output enable status (PLLSAI2_SAI2 and PLLSAI2_ADC2).
  598. * @param __PLLSAI2_CLOCKOUT__ specifies the PLLSAI2 clock to be output.
  599. * This parameter can be one of the following values:
  600. * @arg @ref RCC_PLLSAI2_SAI2CLK This clock is used to generate an accurate clock to achieve
  601. * high-quality audio performance on SAI interface in case.
  602. * @arg @ref RCC_PLLSAI2_ADC2CLK Clock used to clock ADC peripheral.
  603. * @retval SET / RESET
  604. */
  605. #define __HAL_RCC_GET_PLLSAI2CLKOUT_CONFIG(__PLLSAI2_CLOCKOUT__) READ_BIT(RCC->PLLSAI2CFGR, (__PLLSAI2_CLOCKOUT__))
  606. /**
  607. * @brief Macro to configure the SAI1 clock source.
  608. * @param __SAI1_CLKSOURCE__ defines the SAI1 clock source. This clock is derived
  609. * from the PLLSAI1, system PLL or external clock (through a dedicated pin).
  610. * This parameter can be one of the following values:
  611. * @arg @ref RCC_SAI1CLKSOURCE_PLLSAI1 SAI1 clock = PLLSAI1 "P" clock (PLLSAI1CLK)
  612. * @arg @ref RCC_SAI1CLKSOURCE_PLLSAI2 SAI1 clock = PLLSAI2 "P" clock (PLLSAI2CLK)
  613. * @arg @ref RCC_SAI1CLKSOURCE_PLL SAI1 clock = PLL "P" clock (PLLSAI3CLK)
  614. * @arg @ref RCC_SAI1CLKSOURCE_PIN SAI1 clock = External Clock (SAI1_EXTCLK)
  615. *
  616. * @retval None
  617. */
  618. #define __HAL_RCC_SAI1_CONFIG(__SAI1_CLKSOURCE__)\
  619. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_SAI1SEL, (uint32_t)(__SAI1_CLKSOURCE__))
  620. /** @brief Macro to get the SAI1 clock source.
  621. * @retval The clock source can be one of the following values:
  622. * @arg @ref RCC_SAI1CLKSOURCE_PLLSAI1 SAI1 clock = PLLSAI1 "P" clock (PLLSAI1CLK)
  623. * @arg @ref RCC_SAI1CLKSOURCE_PLLSAI2 SAI1 clock = PLLSAI2 "P" clock (PLLSAI2CLK)
  624. * @arg @ref RCC_SAI1CLKSOURCE_PLL SAI1 clock = PLL "P" clock (PLLSAI3CLK)
  625. * @arg @ref RCC_SAI1CLKSOURCE_PIN SAI1 clock = External Clock (SAI1_EXTCLK)
  626. */
  627. #define __HAL_RCC_GET_SAI1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_SAI1SEL)))
  628. /**
  629. * @brief Macro to configure the SAI2 clock source.
  630. * @param __SAI2_CLKSOURCE__ defines the SAI2 clock source. This clock is derived
  631. * from the PLLSAI2, system PLL or external clock (through a dedicated pin).
  632. * This parameter can be one of the following values:
  633. * @arg @ref RCC_SAI2CLKSOURCE_PLLSAI1 SAI2 clock = PLLSAI1 "P" clock (PLLSAI1CLK)
  634. * @arg @ref RCC_SAI2CLKSOURCE_PLLSAI2 SAI2 clock = PLLSAI2 "P" clock (PLLSAI2CLK)
  635. * @arg @ref RCC_SAI2CLKSOURCE_PLL SAI2 clock = PLL "P" clock (PLLSAI3CLK)
  636. * @arg @ref RCC_SAI2CLKSOURCE_PIN SAI2 clock = External Clock (SAI2_EXTCLK)
  637. * @retval None
  638. */
  639. #define __HAL_RCC_SAI2_CONFIG(__SAI2_CLKSOURCE__ )\
  640. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_SAI2SEL, (uint32_t)(__SAI2_CLKSOURCE__))
  641. /** @brief Macro to get the SAI2 clock source.
  642. * @retval The clock source can be one of the following values:
  643. * @arg @ref RCC_SAI2CLKSOURCE_PLLSAI1 SAI2 clock = PLLSAI1 "P" clock (PLLSAI1CLK)
  644. * @arg @ref RCC_SAI2CLKSOURCE_PLLSAI2 SAI2 clock = PLLSAI2 "P" clock (PLLSAI2CLK)
  645. * @arg @ref RCC_SAI2CLKSOURCE_PLL SAI2 clock = PLL "P" clock (PLLSAI3CLK)
  646. * @arg @ref RCC_SAI2CLKSOURCE_PIN SAI2 clock = External Clock (SAI2_EXTCLK)
  647. */
  648. #define __HAL_RCC_GET_SAI2_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_SAI2SEL)))
  649. /** @brief Macro to configure the I2C1 clock (I2C1CLK).
  650. *
  651. * @param __I2C1_CLKSOURCE__ specifies the I2C1 clock source.
  652. * This parameter can be one of the following values:
  653. * @arg @ref RCC_I2C1CLKSOURCE_PCLK1 PCLK1 selected as I2C1 clock
  654. * @arg @ref RCC_I2C1CLKSOURCE_HSI HSI selected as I2C1 clock
  655. * @arg @ref RCC_I2C1CLKSOURCE_SYSCLK System Clock selected as I2C1 clock
  656. * @retval None
  657. */
  658. #define __HAL_RCC_I2C1_CONFIG(__I2C1_CLKSOURCE__) \
  659. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_I2C1SEL, (uint32_t)(__I2C1_CLKSOURCE__))
  660. /** @brief Macro to get the I2C1 clock source.
  661. * @retval The clock source can be one of the following values:
  662. * @arg @ref RCC_I2C1CLKSOURCE_PCLK1 PCLK1 selected as I2C1 clock
  663. * @arg @ref RCC_I2C1CLKSOURCE_HSI HSI selected as I2C1 clock
  664. * @arg @ref RCC_I2C1CLKSOURCE_SYSCLK System Clock selected as I2C1 clock
  665. */
  666. #define __HAL_RCC_GET_I2C1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_I2C1SEL)))
  667. /** @brief Macro to configure the I2C2 clock (I2C2CLK).
  668. *
  669. * @param __I2C2_CLKSOURCE__ specifies the I2C2 clock source.
  670. * This parameter can be one of the following values:
  671. * @arg @ref RCC_I2C2CLKSOURCE_PCLK1 PCLK1 selected as I2C2 clock
  672. * @arg @ref RCC_I2C2CLKSOURCE_HSI HSI selected as I2C2 clock
  673. * @arg @ref RCC_I2C2CLKSOURCE_SYSCLK System Clock selected as I2C2 clock
  674. * @retval None
  675. */
  676. #define __HAL_RCC_I2C2_CONFIG(__I2C2_CLKSOURCE__) \
  677. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_I2C2SEL, (uint32_t)(__I2C2_CLKSOURCE__))
  678. /** @brief Macro to get the I2C2 clock source.
  679. * @retval The clock source can be one of the following values:
  680. * @arg @ref RCC_I2C2CLKSOURCE_PCLK1 PCLK1 selected as I2C2 clock
  681. * @arg @ref RCC_I2C2CLKSOURCE_HSI HSI selected as I2C2 clock
  682. * @arg @ref RCC_I2C2CLKSOURCE_SYSCLK System Clock selected as I2C2 clock
  683. */
  684. #define __HAL_RCC_GET_I2C2_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_I2C2SEL)))
  685. /** @brief Macro to configure the I2C3 clock (I2C3CLK).
  686. *
  687. * @param __I2C3_CLKSOURCE__ specifies the I2C3 clock source.
  688. * This parameter can be one of the following values:
  689. * @arg @ref RCC_I2C3CLKSOURCE_PCLK1 PCLK1 selected as I2C3 clock
  690. * @arg @ref RCC_I2C3CLKSOURCE_HSI HSI selected as I2C3 clock
  691. * @arg @ref RCC_I2C3CLKSOURCE_SYSCLK System Clock selected as I2C3 clock
  692. * @retval None
  693. */
  694. #define __HAL_RCC_I2C3_CONFIG(__I2C3_CLKSOURCE__) \
  695. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_I2C3SEL, (uint32_t)(__I2C3_CLKSOURCE__))
  696. /** @brief Macro to get the I2C3 clock source.
  697. * @retval The clock source can be one of the following values:
  698. * @arg @ref RCC_I2C3CLKSOURCE_PCLK1 PCLK1 selected as I2C3 clock
  699. * @arg @ref RCC_I2C3CLKSOURCE_HSI HSI selected as I2C3 clock
  700. * @arg @ref RCC_I2C3CLKSOURCE_SYSCLK System Clock selected as I2C3 clock
  701. */
  702. #define __HAL_RCC_GET_I2C3_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_I2C3SEL)))
  703. /** @brief Macro to configure the USART1 clock (USART1CLK).
  704. *
  705. * @param __USART1_CLKSOURCE__ specifies the USART1 clock source.
  706. * This parameter can be one of the following values:
  707. * @arg @ref RCC_USART1CLKSOURCE_PCLK2 PCLK2 selected as USART1 clock
  708. * @arg @ref RCC_USART1CLKSOURCE_HSI HSI selected as USART1 clock
  709. * @arg @ref RCC_USART1CLKSOURCE_SYSCLK System Clock selected as USART1 clock
  710. * @arg @ref RCC_USART1CLKSOURCE_LSE SE selected as USART1 clock
  711. * @retval None
  712. */
  713. #define __HAL_RCC_USART1_CONFIG(__USART1_CLKSOURCE__) \
  714. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_USART1SEL, (uint32_t)(__USART1_CLKSOURCE__))
  715. /** @brief Macro to get the USART1 clock source.
  716. * @retval The clock source can be one of the following values:
  717. * @arg @ref RCC_USART1CLKSOURCE_PCLK2 PCLK2 selected as USART1 clock
  718. * @arg @ref RCC_USART1CLKSOURCE_HSI HSI selected as USART1 clock
  719. * @arg @ref RCC_USART1CLKSOURCE_SYSCLK System Clock selected as USART1 clock
  720. * @arg @ref RCC_USART1CLKSOURCE_LSE LSE selected as USART1 clock
  721. */
  722. #define __HAL_RCC_GET_USART1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_USART1SEL)))
  723. /** @brief Macro to configure the USART2 clock (USART2CLK).
  724. *
  725. * @param __USART2_CLKSOURCE__ specifies the USART2 clock source.
  726. * This parameter can be one of the following values:
  727. * @arg @ref RCC_USART2CLKSOURCE_PCLK1 PCLK1 selected as USART2 clock
  728. * @arg @ref RCC_USART2CLKSOURCE_HSI HSI selected as USART2 clock
  729. * @arg @ref RCC_USART2CLKSOURCE_SYSCLK System Clock selected as USART2 clock
  730. * @arg @ref RCC_USART2CLKSOURCE_LSE LSE selected as USART2 clock
  731. * @retval None
  732. */
  733. #define __HAL_RCC_USART2_CONFIG(__USART2_CLKSOURCE__) \
  734. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_USART2SEL, (uint32_t)(__USART2_CLKSOURCE__))
  735. /** @brief Macro to get the USART2 clock source.
  736. * @retval The clock source can be one of the following values:
  737. * @arg @ref RCC_USART2CLKSOURCE_PCLK1 PCLK1 selected as USART2 clock
  738. * @arg @ref RCC_USART2CLKSOURCE_HSI HSI selected as USART2 clock
  739. * @arg @ref RCC_USART2CLKSOURCE_SYSCLK System Clock selected as USART2 clock
  740. * @arg @ref RCC_USART2CLKSOURCE_LSE LSE selected as USART2 clock
  741. */
  742. #define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_USART2SEL)))
  743. /** @brief Macro to configure the USART3 clock (USART3CLK).
  744. *
  745. * @param __USART3_CLKSOURCE__ specifies the USART3 clock source.
  746. * This parameter can be one of the following values:
  747. * @arg @ref RCC_USART3CLKSOURCE_PCLK1 PCLK1 selected as USART3 clock
  748. * @arg @ref RCC_USART3CLKSOURCE_HSI HSI selected as USART3 clock
  749. * @arg @ref RCC_USART3CLKSOURCE_SYSCLK System Clock selected as USART3 clock
  750. * @arg @ref RCC_USART3CLKSOURCE_LSE LSE selected as USART3 clock
  751. * @retval None
  752. */
  753. #define __HAL_RCC_USART3_CONFIG(__USART3_CLKSOURCE__) \
  754. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_USART3SEL, (uint32_t)(__USART3_CLKSOURCE__))
  755. /** @brief Macro to get the USART3 clock source.
  756. * @retval The clock source can be one of the following values:
  757. * @arg @ref RCC_USART3CLKSOURCE_PCLK1 PCLK1 selected as USART3 clock
  758. * @arg @ref RCC_USART3CLKSOURCE_HSI HSI selected as USART3 clock
  759. * @arg @ref RCC_USART3CLKSOURCE_SYSCLK System Clock selected as USART3 clock
  760. * @arg @ref RCC_USART3CLKSOURCE_LSE LSE selected as USART3 clock
  761. */
  762. #define __HAL_RCC_GET_USART3_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_USART3SEL)))
  763. /** @brief Macro to configure the UART4 clock (UART4CLK).
  764. *
  765. * @param __UART4_CLKSOURCE__ specifies the UART4 clock source.
  766. * This parameter can be one of the following values:
  767. * @arg @ref RCC_UART4CLKSOURCE_PCLK1 PCLK1 selected as UART4 clock
  768. * @arg @ref RCC_UART4CLKSOURCE_HSI HSI selected as UART4 clock
  769. * @arg @ref RCC_UART4CLKSOURCE_SYSCLK System Clock selected as UART4 clock
  770. * @arg @ref RCC_UART4CLKSOURCE_LSE LSE selected as UART4 clock
  771. * @retval None
  772. */
  773. #define __HAL_RCC_UART4_CONFIG(__UART4_CLKSOURCE__) \
  774. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_UART4SEL, (uint32_t)(__UART4_CLKSOURCE__))
  775. /** @brief Macro to get the UART4 clock source.
  776. * @retval The clock source can be one of the following values:
  777. * @arg @ref RCC_UART4CLKSOURCE_PCLK1 PCLK1 selected as UART4 clock
  778. * @arg @ref RCC_UART4CLKSOURCE_HSI HSI selected as UART4 clock
  779. * @arg @ref RCC_UART4CLKSOURCE_SYSCLK System Clock selected as UART4 clock
  780. * @arg @ref RCC_UART4CLKSOURCE_LSE LSE selected as UART4 clock
  781. */
  782. #define __HAL_RCC_GET_UART4_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_UART4SEL)))
  783. /** @brief Macro to configure the UART5 clock (UART5CLK).
  784. *
  785. * @param __UART5_CLKSOURCE__ specifies the UART5 clock source.
  786. * This parameter can be one of the following values:
  787. * @arg @ref RCC_UART5CLKSOURCE_PCLK1 PCLK1 selected as UART5 clock
  788. * @arg @ref RCC_UART5CLKSOURCE_HSI HSI selected as UART5 clock
  789. * @arg @ref RCC_UART5CLKSOURCE_SYSCLK System Clock selected as UART5 clock
  790. * @arg @ref RCC_UART5CLKSOURCE_LSE LSE selected as UART5 clock
  791. * @retval None
  792. */
  793. #define __HAL_RCC_UART5_CONFIG(__UART5_CLKSOURCE__) \
  794. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_UART5SEL, (uint32_t)(__UART5_CLKSOURCE__))
  795. /** @brief Macro to get the UART5 clock source.
  796. * @retval The clock source can be one of the following values:
  797. * @arg @ref RCC_UART5CLKSOURCE_PCLK1 PCLK1 selected as UART5 clock
  798. * @arg @ref RCC_UART5CLKSOURCE_HSI HSI selected as UART5 clock
  799. * @arg @ref RCC_UART5CLKSOURCE_SYSCLK System Clock selected as UART5 clock
  800. * @arg @ref RCC_UART5CLKSOURCE_LSE LSE selected as UART5 clock
  801. */
  802. #define __HAL_RCC_GET_UART5_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_UART5SEL)))
  803. /** @brief Macro to configure the LPUART1 clock (LPUART1CLK).
  804. *
  805. * @param __LPUART1_CLKSOURCE__ specifies the LPUART1 clock source.
  806. * This parameter can be one of the following values:
  807. * @arg @ref RCC_LPUART1CLKSOURCE_PCLK1 PCLK1 selected as LPUART1 clock
  808. * @arg @ref RCC_LPUART1CLKSOURCE_HSI HSI selected as LPUART1 clock
  809. * @arg @ref RCC_LPUART1CLKSOURCE_SYSCLK System Clock selected as LPUART1 clock
  810. * @arg @ref RCC_LPUART1CLKSOURCE_LSE LSE selected as LPUART1 clock
  811. * @retval None
  812. */
  813. #define __HAL_RCC_LPUART1_CONFIG(__LPUART1_CLKSOURCE__) \
  814. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_LPUART1SEL, (uint32_t)(__LPUART1_CLKSOURCE__))
  815. /** @brief Macro to get the LPUART1 clock source.
  816. * @retval The clock source can be one of the following values:
  817. * @arg @ref RCC_LPUART1CLKSOURCE_PCLK1 PCLK1 selected as LPUART1 clock
  818. * @arg @ref RCC_LPUART1CLKSOURCE_HSI HSI selected as LPUART1 clock
  819. * @arg @ref RCC_LPUART1CLKSOURCE_SYSCLK System Clock selected as LPUART1 clock
  820. * @arg @ref RCC_LPUART1CLKSOURCE_LSE LSE selected as LPUART1 clock
  821. */
  822. #define __HAL_RCC_GET_LPUART1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_LPUART1SEL)))
  823. /** @brief Macro to configure the LPTIM1 clock (LPTIM1CLK).
  824. *
  825. * @param __LPTIM1_CLKSOURCE__ specifies the LPTIM1 clock source.
  826. * This parameter can be one of the following values:
  827. * @arg @ref RCC_LPTIM1CLKSOURCE_PCLK PCLK selected as LPTIM1 clock
  828. * @arg @ref RCC_LPTIM1CLKSOURCE_LSI HSI selected as LPTIM1 clock
  829. * @arg @ref RCC_LPTIM1CLKSOURCE_HSI LSI selected as LPTIM1 clock
  830. * @arg @ref RCC_LPTIM1CLKSOURCE_LSE LSE selected as LPTIM1 clock
  831. * @retval None
  832. */
  833. #define __HAL_RCC_LPTIM1_CONFIG(__LPTIM1_CLKSOURCE__) \
  834. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_LPTIM1SEL, (uint32_t)(__LPTIM1_CLKSOURCE__))
  835. /** @brief Macro to get the LPTIM1 clock source.
  836. * @retval The clock source can be one of the following values:
  837. * @arg @ref RCC_LPTIM1CLKSOURCE_PCLK PCLK selected as LPUART1 clock
  838. * @arg @ref RCC_LPTIM1CLKSOURCE_LSI HSI selected as LPUART1 clock
  839. * @arg @ref RCC_LPTIM1CLKSOURCE_HSI System Clock selected as LPUART1 clock
  840. * @arg @ref RCC_LPTIM1CLKSOURCE_LSE LSE selected as LPUART1 clock
  841. */
  842. #define __HAL_RCC_GET_LPTIM1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_LPTIM1SEL)))
  843. /** @brief Macro to configure the LPTIM2 clock (LPTIM2CLK).
  844. *
  845. * @param __LPTIM2_CLKSOURCE__ specifies the LPTIM2 clock source.
  846. * This parameter can be one of the following values:
  847. * @arg @ref RCC_LPTIM2CLKSOURCE_PCLK PCLK selected as LPTIM2 clock
  848. * @arg @ref RCC_LPTIM2CLKSOURCE_LSI HSI selected as LPTIM2 clock
  849. * @arg @ref RCC_LPTIM2CLKSOURCE_HSI LSI selected as LPTIM2 clock
  850. * @arg @ref RCC_LPTIM2CLKSOURCE_LSE LSE selected as LPTIM2 clock
  851. * @retval None
  852. */
  853. #define __HAL_RCC_LPTIM2_CONFIG(__LPTIM2_CLKSOURCE__) \
  854. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_LPTIM2SEL, (uint32_t)(__LPTIM2_CLKSOURCE__))
  855. /** @brief Macro to get the LPTIM2 clock source.
  856. * @retval The clock source can be one of the following values:
  857. * @arg @ref RCC_LPTIM2CLKSOURCE_PCLK PCLK selected as LPUART1 clock
  858. * @arg @ref RCC_LPTIM2CLKSOURCE_LSI HSI selected as LPUART1 clock
  859. * @arg @ref RCC_LPTIM2CLKSOURCE_HSI System Clock selected as LPUART1 clock
  860. * @arg @ref RCC_LPTIM2CLKSOURCE_LSE LSE selected as LPUART1 clock
  861. */
  862. #define __HAL_RCC_GET_LPTIM2_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_LPTIM2SEL)))
  863. /** @brief Macro to configure the SDMMC1 clock.
  864. *
  865. * @note USB, RNG and SDMMC1 peripherals share the same 48MHz clock source.
  866. *
  867. * @param __SDMMC1_CLKSOURCE__ specifies the SDMMC1 clock source.
  868. * This parameter can be one of the following values:
  869. * @arg @ref RCC_SDMMC1CLKSOURCE_NONE No clock selected as SDMMC1 clock
  870. * @arg @ref RCC_SDMMC1CLKSOURCE_MSI MSI selected as SDMMC1 clock
  871. * @arg @ref RCC_SDMMC1CLKSOURCE_PLLSAI1 PLLSAI1 Clock selected as SDMMC1 clock
  872. * @arg @ref RCC_SDMMC1CLKSOURCE_PLL PLL Clock selected as SDMMC1 clock
  873. * @retval None
  874. */
  875. #define __HAL_RCC_SDMMC1_CONFIG(__SDMMC1_CLKSOURCE__) \
  876. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CLK48SEL, (uint32_t)(__SDMMC1_CLKSOURCE__))
  877. /** @brief Macro to get the SDMMC1 clock.
  878. * @retval The clock source can be one of the following values:
  879. * @arg @ref RCC_SDMMC1CLKSOURCE_NONE No clock selected as SDMMC1 clock
  880. * @arg @ref RCC_SDMMC1CLKSOURCE_MSI MSI selected as SDMMC1 clock
  881. * @arg @ref RCC_SDMMC1CLKSOURCE_PLLSAI1 PLLSAI1 "Q" clock (PLL48M2CLK) selected as SDMMC1 clock
  882. * @arg @ref RCC_SDMMC1CLKSOURCE_PLL PLL "Q" clock (PLL48M1CLK) selected as SDMMC1 clock
  883. */
  884. #define __HAL_RCC_GET_SDMMC1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_CLK48SEL)))
  885. /** @brief Macro to configure the RNG clock.
  886. *
  887. * @note USB, RNG and SDMMC1 peripherals share the same 48MHz clock source.
  888. *
  889. * @param __RNG_CLKSOURCE__ specifies the RNG clock source.
  890. * This parameter can be one of the following values:
  891. * @arg @ref RCC_RNGCLKSOURCE_NONE No clock selected as RNG clock
  892. * @arg @ref RCC_RNGCLKSOURCE_MSI MSI selected as RNG clock
  893. * @arg @ref RCC_RNGCLKSOURCE_PLLSAI1 PLLSAI1 Clock selected as RNG clock
  894. * @arg @ref RCC_RNGCLKSOURCE_PLL PLL Clock selected as RNG clock
  895. * @retval None
  896. */
  897. #define __HAL_RCC_RNG_CONFIG(__RNG_CLKSOURCE__) \
  898. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CLK48SEL, (uint32_t)(__RNG_CLKSOURCE__))
  899. /** @brief Macro to get the RNG clock.
  900. * @retval The clock source can be one of the following values:
  901. * @arg @ref RCC_RNGCLKSOURCE_NONE No clock selected as RNG clock
  902. * @arg @ref RCC_RNGCLKSOURCE_MSI MSI selected as RNG clock
  903. * @arg @ref RCC_RNGCLKSOURCE_PLLSAI1 PLLSAI1 "Q" clock (PLL48M2CLK) selected as RNG clock
  904. * @arg @ref RCC_RNGCLKSOURCE_PLL PLL "Q" clock (PLL48M1CLK) selected as RNG clock
  905. */
  906. #define __HAL_RCC_GET_RNG_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_CLK48SEL)))
  907. #if defined(USB_OTG_FS)
  908. /** @brief Macro to configure the USB clock (USBCLK).
  909. *
  910. * @note USB, RNG and SDMMC1 peripherals share the same 48MHz clock source.
  911. *
  912. * @param __USB_CLKSOURCE__ specifies the USB clock source.
  913. * This parameter can be one of the following values:
  914. * @arg @ref RCC_USBCLKSOURCE_NONE No clock selected as 48MHz clock
  915. * @arg @ref RCC_USBCLKSOURCE_MSI MSI selected as USB clock
  916. * @arg @ref RCC_USBCLKSOURCE_PLLSAI1 PLLSAI1 "Q" clock (PLL48M2CLK) selected as USB clock
  917. * @arg @ref RCC_USBCLKSOURCE_PLL PLL "Q" clock (PLL48M1CLK) selected as USB clock
  918. * @retval None
  919. */
  920. #define __HAL_RCC_USB_CONFIG(__USB_CLKSOURCE__) \
  921. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_CLK48SEL, (uint32_t)(__USB_CLKSOURCE__))
  922. /** @brief Macro to get the USB clock source.
  923. * @retval The clock source can be one of the following values:
  924. * @arg @ref RCC_USBCLKSOURCE_NONE No clock selected as 48MHz clock
  925. * @arg @ref RCC_USBCLKSOURCE_MSI MSI selected as USB clock
  926. * @arg @ref RCC_USBCLKSOURCE_PLLSAI1 PLLSAI1 "Q" clock (PLL48M2CLK) selected as USB clock
  927. * @arg @ref RCC_USBCLKSOURCE_PLL PLL "Q" clock (PLL48M1CLK) selected as USB clock
  928. */
  929. #define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_CLK48SEL)))
  930. #endif /* USB_OTG_FS */
  931. /** @brief Macro to configure the ADC interface clock.
  932. * @param __ADC_CLKSOURCE__ specifies the ADC digital interface clock source.
  933. * This parameter can be one of the following values:
  934. * @arg @ref RCC_ADCCLKSOURCE_NONE No clock selected as ADC clock
  935. * @arg @ref RCC_ADCCLKSOURCE_PLLSAI1 PLLSAI1 Clock selected as ADC clock
  936. * @arg @ref RCC_ADCCLKSOURCE_PLLSAI2 PLLSAI2 Clock selected as ADC clock
  937. * @arg @ref RCC_ADCCLKSOURCE_SYSCLK System Clock selected as ADC clock
  938. * @retval None
  939. */
  940. #define __HAL_RCC_ADC_CONFIG(__ADC_CLKSOURCE__) \
  941. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_ADCSEL, (uint32_t)(__ADC_CLKSOURCE__))
  942. /** @brief Macro to get the ADC clock source.
  943. * @retval The clock source can be one of the following values:
  944. * @arg @ref RCC_ADCCLKSOURCE_NONE No clock selected as ADC clock
  945. * @arg @ref RCC_ADCCLKSOURCE_PLLSAI1 PLLSAI1 Clock selected as ADC clock
  946. * @arg @ref RCC_ADCCLKSOURCE_PLLSAI2 PLLSAI2 Clock selected as ADC clock
  947. * @arg @ref RCC_ADCCLKSOURCE_SYSCLK System Clock selected as ADC clock
  948. */
  949. #define __HAL_RCC_GET_ADC_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_ADCSEL)))
  950. /** @brief Macro to configure the SWPMI1 clock.
  951. * @param __SWPMI1_CLKSOURCE__ specifies the SWPMI1 clock source.
  952. * This parameter can be one of the following values:
  953. * @arg @ref RCC_SWPMI1CLKSOURCE_PCLK PCLK Clock selected as SWPMI1 clock
  954. * @arg @ref RCC_SWPMI1CLKSOURCE_HSI HSI Clock selected as SWPMI1 clock
  955. * @retval None
  956. */
  957. #define __HAL_RCC_SWPMI1_CONFIG(__SWPMI1_CLKSOURCE__) \
  958. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_SWPMI1SEL, (uint32_t)(__SWPMI1_CLKSOURCE__))
  959. /** @brief Macro to get the SWPMI1 clock source.
  960. * @retval The clock source can be one of the following values:
  961. * @arg @ref RCC_SWPMI1CLKSOURCE_PCLK PCLK Clock selected as SWPMI1 clock
  962. * @arg @ref RCC_SWPMI1CLKSOURCE_HSI HSI Clock selected as SWPMI1 clock
  963. */
  964. #define __HAL_RCC_GET_SWPMI1_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_SWPMI1SEL)))
  965. /** @brief Macro to configure the DFSDM clock.
  966. * @param __DFSDM_CLKSOURCE__ specifies the DFSDM clock source.
  967. * This parameter can be one of the following values:
  968. * @arg @ref RCC_DFSDMCLKSOURCE_PCLK PCLK Clock selected as DFSDM clock
  969. * @arg @ref RCC_DFSDMCLKSOURCE_SYSCLK System Clock selected as DFSDM clock
  970. * @retval None
  971. */
  972. #define __HAL_RCC_DFSDM_CONFIG(__DFSDM_CLKSOURCE__) \
  973. MODIFY_REG(RCC->CCIPR, RCC_CCIPR_DFSDMSEL, (uint32_t)(__DFSDM_CLKSOURCE__))
  974. /** @brief Macro to get the DFSDM clock source.
  975. * @retval The clock source can be one of the following values:
  976. * @arg @ref RCC_DFSDMCLKSOURCE_PCLK PCLK Clock selected as DFSDM clock
  977. * @arg @ref RCC_DFSDMCLKSOURCE_SYSCLK System Clock selected as DFSDM clock
  978. */
  979. #define __HAL_RCC_GET_DFSDM_SOURCE() ((uint32_t)(READ_BIT(RCC->CCIPR, RCC_CCIPR_DFSDMSEL)))
  980. /** @defgroup RCCEx_Flags_Interrupts_Management Flags Interrupts Management
  981. * @brief macros to manage the specified RCC Flags and interrupts.
  982. * @{
  983. */
  984. /** @brief Enable PLLSAI1RDY interrupt.
  985. * @retval None
  986. */
  987. #define __HAL_RCC_PLLSAI1_ENABLE_IT() SET_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE)
  988. /** @brief Disable PLLSAI1RDY interrupt.
  989. * @retval None
  990. */
  991. #define __HAL_RCC_PLLSAI1_DISABLE_IT() CLEAR_BIT(RCC->CIER, RCC_CIER_PLLSAI1RDYIE)
  992. /** @brief Clear the PLLSAI1RDY interrupt pending bit.
  993. * @retval None
  994. */
  995. #define __HAL_RCC_PLLSAI1_CLEAR_IT() WRITE_REG(RCC->CICR, RCC_CICR_PLLSAI1RDYC)
  996. /** @brief Check whether PLLSAI1RDY interrupt has occurred or not.
  997. * @retval TRUE or FALSE.
  998. */
  999. #define __HAL_RCC_PLLSAI1_GET_IT_SOURCE() (READ_BIT(RCC->CIFR, RCC_CIFR_PLLSAI1RDYF) == RCC_CIFR_PLLSAI1RDYF)
  1000. /** @brief Check whether the PLLSAI1RDY flag is set or not.
  1001. * @retval TRUE or FALSE.
  1002. */
  1003. #define __HAL_RCC_PLLSAI1_GET_FLAG() (READ_BIT(RCC->CR, RCC_CR_PLLSAI1RDY) == (RCC_CR_PLLSAI1RDY))
  1004. /** @brief Enable PLLSAI2RDY interrupt.
  1005. * @retval None
  1006. */
  1007. #define __HAL_RCC_PLLSAI2_ENABLE_IT() SET_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE)
  1008. /** @brief Disable PLLSAI2RDY interrupt.
  1009. * @retval None
  1010. */
  1011. #define __HAL_RCC_PLLSAI2_DISABLE_IT() CLEAR_BIT(RCC->CIER, RCC_CIER_PLLSAI2RDYIE)
  1012. /** @brief Clear the PLLSAI2RDY interrupt pending bit.
  1013. * @retval None
  1014. */
  1015. #define __HAL_RCC_PLLSAI2_CLEAR_IT() WRITE_REG(RCC->CICR, RCC_CICR_PLLSAI2RDYC)
  1016. /** @brief Check whether the PLLSAI2RDY interrupt has occurred or not.
  1017. * @retval TRUE or FALSE.
  1018. */
  1019. #define __HAL_RCC_PLLSAI2_GET_IT_SOURCE() (READ_BIT(RCC->CIFR, RCC_CIFR_PLLSAI2RDYF) == RCC_CIFR_PLLSAI2RDYF)
  1020. /** @brief Check whether the PLLSAI2RDY flag is set or not.
  1021. * @retval TRUE or FALSE.
  1022. */
  1023. #define __HAL_RCC_PLLSAI2_GET_FLAG() (READ_BIT(RCC->CR, RCC_CR_PLLSAI2RDY) == (RCC_CR_PLLSAI2RDY))
  1024. /**
  1025. * @brief Enable the RCC LSE CSS Extended Interrupt Line.
  1026. * @retval None
  1027. */
  1028. #define __HAL_RCC_LSECSS_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, RCC_EXTI_LINE_LSECSS)
  1029. /**
  1030. * @brief Disable the RCC LSE CSS Extended Interrupt Line.
  1031. * @retval None
  1032. */
  1033. #define __HAL_RCC_LSECSS_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, RCC_EXTI_LINE_LSECSS)
  1034. /**
  1035. * @brief Enable the RCC LSE CSS Event Line.
  1036. * @retval None.
  1037. */
  1038. #define __HAL_RCC_LSECSS_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, RCC_EXTI_LINE_LSECSS)
  1039. /**
  1040. * @brief Disable the RCC LSE CSS Event Line.
  1041. * @retval None.
  1042. */
  1043. #define __HAL_RCC_LSECSS_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, RCC_EXTI_LINE_LSECSS)
  1044. /**
  1045. * @brief Enable the RCC LSE CSS Extended Interrupt Falling Trigger.
  1046. * @retval None.
  1047. */
  1048. #define __HAL_RCC_LSECSS_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, RCC_EXTI_LINE_LSECSS)
  1049. /**
  1050. * @brief Disable the RCC LSE CSS Extended Interrupt Falling Trigger.
  1051. * @retval None.
  1052. */
  1053. #define __HAL_RCC_LSECSS_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, RCC_EXTI_LINE_LSECSS)
  1054. /**
  1055. * @brief Enable the RCC LSE CSS Extended Interrupt Rising Trigger.
  1056. * @retval None.
  1057. */
  1058. #define __HAL_RCC_LSECSS_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, RCC_EXTI_LINE_LSECSS)
  1059. /**
  1060. * @brief Disable the RCC LSE CSS Extended Interrupt Rising Trigger.
  1061. * @retval None.
  1062. */
  1063. #define __HAL_RCC_LSECSS_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, RCC_EXTI_LINE_LSECSS)
  1064. /**
  1065. * @brief Enable the RCC LSE CSS Extended Interrupt Rising & Falling Trigger.
  1066. * @retval None.
  1067. */
  1068. #define __HAL_RCC_LSECSS_EXTI_ENABLE_RISING_FALLING_EDGE() \
  1069. do { \
  1070. __HAL_RCC_LSECSS_EXTI_ENABLE_RISING_EDGE(); \
  1071. __HAL_RCC_LSECSS_EXTI_ENABLE_FALLING_EDGE(); \
  1072. } while(0)
  1073. /**
  1074. * @brief Disable the RCC LSE CSS Extended Interrupt Rising & Falling Trigger.
  1075. * @retval None.
  1076. */
  1077. #define __HAL_RCC_LSECSS_EXTI_DISABLE_RISING_FALLING_EDGE() \
  1078. do { \
  1079. __HAL_RCC_LSECSS_EXTI_DISABLE_RISING_EDGE(); \
  1080. __HAL_RCC_LSECSS_EXTI_DISABLE_FALLING_EDGE(); \
  1081. } while(0)
  1082. /**
  1083. * @brief Check whether the specified RCC LSE CSS EXTI interrupt flag is set or not.
  1084. * @retval EXTI RCC LSE CSS Line Status.
  1085. */
  1086. #define __HAL_RCC_LSECSS_EXTI_GET_FLAG() (READ_BIT(EXTI->PR1, RCC_EXTI_LINE_LSECSS) == RCC_EXTI_LINE_LSECSS)
  1087. /**
  1088. * @brief Clear the RCC LSE CSS EXTI flag.
  1089. * @retval None.
  1090. */
  1091. #define __HAL_RCC_LSECSS_EXTI_CLEAR_FLAG() WRITE_REG(EXTI->PR1, RCC_EXTI_LINE_LSECSS)
  1092. /**
  1093. * @brief Generate a Software interrupt on the RCC LSE CSS EXTI line.
  1094. * @retval None.
  1095. */
  1096. #define __HAL_RCC_LSECSS_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, RCC_EXTI_LINE_LSECSS)
  1097. /**
  1098. * @}
  1099. */
  1100. /**
  1101. * @}
  1102. */
  1103. /* Exported functions --------------------------------------------------------*/
  1104. /** @addtogroup RCCEx_Exported_Functions
  1105. * @{
  1106. */
  1107. /** @addtogroup RCCEx_Exported_Functions_Group1
  1108. * @{
  1109. */
  1110. HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  1111. void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  1112. uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk);
  1113. /**
  1114. * @}
  1115. */
  1116. /** @addtogroup RCCEx_Exported_Functions_Group2
  1117. * @{
  1118. */
  1119. HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI1(RCC_PLLSAI1InitTypeDef *PLLSAI1Init);
  1120. HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI1(void);
  1121. HAL_StatusTypeDef HAL_RCCEx_EnablePLLSAI2(RCC_PLLSAI2InitTypeDef *PLLSAI2Init);
  1122. HAL_StatusTypeDef HAL_RCCEx_DisablePLLSAI2(void);
  1123. void HAL_RCCEx_WakeUpStopCLKConfig(uint32_t WakeUpClk);
  1124. void HAL_RCCEx_StandbyMSIRangeConfig(uint32_t MSIRange);
  1125. void HAL_RCCEx_EnableLSECSS(void);
  1126. void HAL_RCCEx_DisableLSECSS(void);
  1127. void HAL_RCCEx_EnableLSECSS_IT(void);
  1128. void HAL_RCCEx_LSECSS_IRQHandler(void);
  1129. void HAL_RCCEx_LSECSS_Callback(void);
  1130. void HAL_RCCEx_EnableLSCO(uint32_t LSCOSource);
  1131. void HAL_RCCEx_DisableLSCO(void);
  1132. void HAL_RCCEx_EnableMSIPLLMode(void);
  1133. void HAL_RCCEx_DisableMSIPLLMode(void);
  1134. /**
  1135. * @}
  1136. */
  1137. /**
  1138. * @}
  1139. */
  1140. /* Private macros ------------------------------------------------------------*/
  1141. /** @addtogroup RCCEx_Private_Macros
  1142. * @{
  1143. */
  1144. #define IS_RCC_LSCOSOURCE(__SOURCE__) (((__SOURCE__) == RCC_LSCOSOURCE_LSI) || \
  1145. ((__SOURCE__) == RCC_LSCOSOURCE_LSE))
  1146. #if defined(STM32L471xx)
  1147. #define IS_RCC_PERIPHCLOCK(__SELECTION__) \
  1148. ((((__SELECTION__) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  1149. (((__SELECTION__) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  1150. (((__SELECTION__) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  1151. (((__SELECTION__) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  1152. (((__SELECTION__) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  1153. (((__SELECTION__) & RCC_PERIPHCLK_LPUART1) == RCC_PERIPHCLK_LPUART1) || \
  1154. (((__SELECTION__) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  1155. (((__SELECTION__) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  1156. (((__SELECTION__) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  1157. (((__SELECTION__) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  1158. (((__SELECTION__) & RCC_PERIPHCLK_LPTIM2) == RCC_PERIPHCLK_LPTIM2) || \
  1159. (((__SELECTION__) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  1160. (((__SELECTION__) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  1161. (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \
  1162. (((__SELECTION__) & RCC_PERIPHCLK_SWPMI1) == RCC_PERIPHCLK_SWPMI1) || \
  1163. (((__SELECTION__) & RCC_PERIPHCLK_DFSDM) == RCC_PERIPHCLK_DFSDM) || \
  1164. (((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \
  1165. (((__SELECTION__) & RCC_PERIPHCLK_RNG) == RCC_PERIPHCLK_RNG) || \
  1166. (((__SELECTION__) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1))
  1167. #else
  1168. #define IS_RCC_PERIPHCLOCK(__SELECTION__) \
  1169. ((((__SELECTION__) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  1170. (((__SELECTION__) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  1171. (((__SELECTION__) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  1172. (((__SELECTION__) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  1173. (((__SELECTION__) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  1174. (((__SELECTION__) & RCC_PERIPHCLK_LPUART1) == RCC_PERIPHCLK_LPUART1) || \
  1175. (((__SELECTION__) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  1176. (((__SELECTION__) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  1177. (((__SELECTION__) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  1178. (((__SELECTION__) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  1179. (((__SELECTION__) & RCC_PERIPHCLK_LPTIM2) == RCC_PERIPHCLK_LPTIM2) || \
  1180. (((__SELECTION__) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  1181. (((__SELECTION__) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  1182. (((__SELECTION__) & RCC_PERIPHCLK_USB) == RCC_PERIPHCLK_USB) || \
  1183. (((__SELECTION__) & RCC_PERIPHCLK_ADC) == RCC_PERIPHCLK_ADC) || \
  1184. (((__SELECTION__) & RCC_PERIPHCLK_SWPMI1) == RCC_PERIPHCLK_SWPMI1) || \
  1185. (((__SELECTION__) & RCC_PERIPHCLK_DFSDM) == RCC_PERIPHCLK_DFSDM) || \
  1186. (((__SELECTION__) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC) || \
  1187. (((__SELECTION__) & RCC_PERIPHCLK_RNG) == RCC_PERIPHCLK_RNG) || \
  1188. (((__SELECTION__) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1))
  1189. #endif /* STM32L471xx */
  1190. #define IS_RCC_USART1CLKSOURCE(__SOURCE__) \
  1191. (((__SOURCE__) == RCC_USART1CLKSOURCE_PCLK2) || \
  1192. ((__SOURCE__) == RCC_USART1CLKSOURCE_SYSCLK) || \
  1193. ((__SOURCE__) == RCC_USART1CLKSOURCE_LSE) || \
  1194. ((__SOURCE__) == RCC_USART1CLKSOURCE_HSI))
  1195. #define IS_RCC_USART2CLKSOURCE(__SOURCE__) \
  1196. (((__SOURCE__) == RCC_USART2CLKSOURCE_PCLK1) || \
  1197. ((__SOURCE__) == RCC_USART2CLKSOURCE_SYSCLK) || \
  1198. ((__SOURCE__) == RCC_USART2CLKSOURCE_LSE) || \
  1199. ((__SOURCE__) == RCC_USART2CLKSOURCE_HSI))
  1200. #define IS_RCC_USART3CLKSOURCE(__SOURCE__) \
  1201. (((__SOURCE__) == RCC_USART3CLKSOURCE_PCLK1) || \
  1202. ((__SOURCE__) == RCC_USART3CLKSOURCE_SYSCLK) || \
  1203. ((__SOURCE__) == RCC_USART3CLKSOURCE_LSE) || \
  1204. ((__SOURCE__) == RCC_USART3CLKSOURCE_HSI))
  1205. #define IS_RCC_UART4CLKSOURCE(__SOURCE__) \
  1206. (((__SOURCE__) == RCC_UART4CLKSOURCE_PCLK1) || \
  1207. ((__SOURCE__) == RCC_UART4CLKSOURCE_SYSCLK) || \
  1208. ((__SOURCE__) == RCC_UART4CLKSOURCE_LSE) || \
  1209. ((__SOURCE__) == RCC_UART4CLKSOURCE_HSI))
  1210. #define IS_RCC_UART5CLKSOURCE(__SOURCE__) \
  1211. (((__SOURCE__) == RCC_UART5CLKSOURCE_PCLK1) || \
  1212. ((__SOURCE__) == RCC_UART5CLKSOURCE_SYSCLK) || \
  1213. ((__SOURCE__) == RCC_UART5CLKSOURCE_LSE) || \
  1214. ((__SOURCE__) == RCC_UART5CLKSOURCE_HSI))
  1215. #define IS_RCC_LPUART1CLKSOURCE(__SOURCE__) \
  1216. (((__SOURCE__) == RCC_LPUART1CLKSOURCE_PCLK1) || \
  1217. ((__SOURCE__) == RCC_LPUART1CLKSOURCE_SYSCLK) || \
  1218. ((__SOURCE__) == RCC_LPUART1CLKSOURCE_LSE) || \
  1219. ((__SOURCE__) == RCC_LPUART1CLKSOURCE_HSI))
  1220. #define IS_RCC_I2C1CLKSOURCE(__SOURCE__) \
  1221. (((__SOURCE__) == RCC_I2C1CLKSOURCE_PCLK1) || \
  1222. ((__SOURCE__) == RCC_I2C1CLKSOURCE_SYSCLK)|| \
  1223. ((__SOURCE__) == RCC_I2C1CLKSOURCE_HSI))
  1224. #define IS_RCC_I2C2CLKSOURCE(__SOURCE__) \
  1225. (((__SOURCE__) == RCC_I2C2CLKSOURCE_PCLK1) || \
  1226. ((__SOURCE__) == RCC_I2C2CLKSOURCE_SYSCLK)|| \
  1227. ((__SOURCE__) == RCC_I2C2CLKSOURCE_HSI))
  1228. #define IS_RCC_I2C3CLKSOURCE(__SOURCE__) \
  1229. (((__SOURCE__) == RCC_I2C3CLKSOURCE_PCLK1) || \
  1230. ((__SOURCE__) == RCC_I2C3CLKSOURCE_SYSCLK)|| \
  1231. ((__SOURCE__) == RCC_I2C3CLKSOURCE_HSI))
  1232. #define IS_RCC_SAI1CLK(__SOURCE__) \
  1233. (((__SOURCE__) == RCC_SAI1CLKSOURCE_PLLSAI1) || \
  1234. ((__SOURCE__) == RCC_SAI1CLKSOURCE_PLLSAI2) || \
  1235. ((__SOURCE__) == RCC_SAI1CLKSOURCE_PLL) || \
  1236. ((__SOURCE__) == RCC_SAI1CLKSOURCE_PIN))
  1237. #define IS_RCC_SAI2CLK(__SOURCE__) \
  1238. (((__SOURCE__) == RCC_SAI2CLKSOURCE_PLLSAI1) || \
  1239. ((__SOURCE__) == RCC_SAI2CLKSOURCE_PLLSAI2) || \
  1240. ((__SOURCE__) == RCC_SAI2CLKSOURCE_PLL) || \
  1241. ((__SOURCE__) == RCC_SAI2CLKSOURCE_PIN))
  1242. #define IS_RCC_LPTIM1CLK(__SOURCE__) \
  1243. (((__SOURCE__) == RCC_LPTIM1CLKSOURCE_PCLK) || \
  1244. ((__SOURCE__) == RCC_LPTIM1CLKSOURCE_LSI) || \
  1245. ((__SOURCE__) == RCC_LPTIM1CLKSOURCE_HSI) || \
  1246. ((__SOURCE__) == RCC_LPTIM1CLKSOURCE_LSE))
  1247. #define IS_RCC_LPTIM2CLK(__SOURCE__) \
  1248. (((__SOURCE__) == RCC_LPTIM2CLKSOURCE_PCLK) || \
  1249. ((__SOURCE__) == RCC_LPTIM2CLKSOURCE_LSI) || \
  1250. ((__SOURCE__) == RCC_LPTIM2CLKSOURCE_HSI) || \
  1251. ((__SOURCE__) == RCC_LPTIM2CLKSOURCE_LSE))
  1252. #define IS_RCC_SDMMC1CLKSOURCE(__SOURCE__) \
  1253. (((__SOURCE__) == RCC_SDMMC1CLKSOURCE_NONE) || \
  1254. ((__SOURCE__) == RCC_SDMMC1CLKSOURCE_PLLSAI1) || \
  1255. ((__SOURCE__) == RCC_SDMMC1CLKSOURCE_PLL) || \
  1256. ((__SOURCE__) == RCC_SDMMC1CLKSOURCE_MSI))
  1257. #define IS_RCC_RNGCLKSOURCE(__SOURCE__) \
  1258. (((__SOURCE__) == RCC_RNGCLKSOURCE_NONE) || \
  1259. ((__SOURCE__) == RCC_RNGCLKSOURCE_PLLSAI1) || \
  1260. ((__SOURCE__) == RCC_RNGCLKSOURCE_PLL) || \
  1261. ((__SOURCE__) == RCC_RNGCLKSOURCE_MSI))
  1262. #if defined(USB_OTG_FS)
  1263. #define IS_RCC_USBCLKSOURCE(__SOURCE__) \
  1264. (((__SOURCE__) == RCC_USBCLKSOURCE_NONE) || \
  1265. ((__SOURCE__) == RCC_USBCLKSOURCE_PLLSAI1) || \
  1266. ((__SOURCE__) == RCC_USBCLKSOURCE_PLL) || \
  1267. ((__SOURCE__) == RCC_USBCLKSOURCE_MSI))
  1268. #endif /* USB_OTG_FS */
  1269. #define IS_RCC_ADCCLKSOURCE(__SOURCE__) \
  1270. (((__SOURCE__) == RCC_ADCCLKSOURCE_NONE) || \
  1271. ((__SOURCE__) == RCC_ADCCLKSOURCE_PLLSAI1) || \
  1272. ((__SOURCE__) == RCC_ADCCLKSOURCE_PLLSAI2) || \
  1273. ((__SOURCE__) == RCC_ADCCLKSOURCE_SYSCLK))
  1274. #define IS_RCC_SWPMI1CLKSOURCE(__SOURCE__) \
  1275. (((__SOURCE__) == RCC_SWPMI1CLKSOURCE_PCLK) || \
  1276. ((__SOURCE__) == RCC_SWPMI1CLKSOURCE_HSI))
  1277. #define IS_RCC_DFSDMCLKSOURCE(__SOURCE__) \
  1278. (((__SOURCE__) == RCC_DFSDMCLKSOURCE_PCLK) || \
  1279. ((__SOURCE__) == RCC_DFSDMCLKSOURCE_SYSCLK))
  1280. #define IS_RCC_PLLSAI1N_VALUE(__VALUE__) ((8U <= (__VALUE__)) && ((__VALUE__) <= 86U))
  1281. #define IS_RCC_PLLSAI1P_VALUE(__VALUE__) (((__VALUE__) == 7U) || ((__VALUE__) == 17U))
  1282. #define IS_RCC_PLLSAI1Q_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \
  1283. ((__VALUE__) == 6U) || ((__VALUE__) == 8U))
  1284. #define IS_RCC_PLLSAI1R_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \
  1285. ((__VALUE__) == 6U) || ((__VALUE__) == 8U))
  1286. #define IS_RCC_PLLSAI2N_VALUE(__VALUE__) ((8U <= (__VALUE__)) && ((__VALUE__) <= 86U))
  1287. #define IS_RCC_PLLSAI2P_VALUE(__VALUE__) (((__VALUE__) == 7U) || ((__VALUE__) == 17U))
  1288. #define IS_RCC_PLLSAI2R_VALUE(__VALUE__) (((__VALUE__) == 2U) || ((__VALUE__) == 4U) || \
  1289. ((__VALUE__) == 6U) || ((__VALUE__) == 8U))
  1290. /**
  1291. * @}
  1292. */
  1293. /**
  1294. * @}
  1295. */
  1296. /**
  1297. * @}
  1298. */
  1299. #ifdef __cplusplus
  1300. }
  1301. #endif
  1302. #endif /* __STM32L4xx_HAL_RCC_EX_H */
  1303. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/