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.
 
 
 

3277 lines
152 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx_hal_rcc_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of RCC HAL Extension module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2017 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. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32H7xx_HAL_RCC_EX_H
  21. #define STM32H7xx_HAL_RCC_EX_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32h7xx_hal_def.h"
  27. /** @addtogroup STM32H7xx_HAL_Driver
  28. * @{
  29. */
  30. /** @addtogroup RCCEx
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /** @defgroup RCCEx_Exported_Types RCCEx Exported Types
  35. * @{
  36. */
  37. /**
  38. * @brief PLL2 Clock structure definition
  39. */
  40. typedef struct
  41. {
  42. uint32_t PLL2M; /*!< PLL2M: Division factor for PLL2 VCO input clock.
  43. This parameter must be a number between Min_Data = 1 and Max_Data = 63 */
  44. uint32_t PLL2N; /*!< PLL2N: Multiplication factor for PLL2 VCO output clock.
  45. This parameter must be a number between Min_Data = 4 and Max_Data = 512 */
  46. uint32_t PLL2P; /*!< PLL2P: Division factor for system clock.
  47. This parameter must be a number between Min_Data = 2 and Max_Data = 128
  48. odd division factors are not allowed */
  49. uint32_t PLL2Q; /*!< PLL2Q: Division factor for peripheral clocks.
  50. This parameter must be a number between Min_Data = 1 and Max_Data = 128 */
  51. uint32_t PLL2R; /*!< PLL2R: Division factor for peripheral clocks.
  52. This parameter must be a number between Min_Data = 1 and Max_Data = 128 */
  53. uint32_t PLL2RGE; /*!<PLL2RGE: PLL2 clock Input range
  54. This parameter must be a value of @ref RCC_PLL2_VCI_Range */
  55. uint32_t PLL2VCOSEL; /*!<PLL2VCOSEL: PLL2 clock Output range
  56. This parameter must be a value of @ref RCC_PLL2_VCO_Range */
  57. uint32_t PLL2FRACN; /*!<PLL2FRACN: Specifies Fractional Part Of The Multiplication Factor for
  58. PLL2 VCO It should be a value between 0 and 8191 */
  59. }RCC_PLL2InitTypeDef;
  60. /**
  61. * @brief PLL3 Clock structure definition
  62. */
  63. typedef struct
  64. {
  65. uint32_t PLL3M; /*!< PLL3M: Division factor for PLL3 VCO input clock.
  66. This parameter must be a number between Min_Data = 1 and Max_Data = 63 */
  67. uint32_t PLL3N; /*!< PLL3N: Multiplication factor for PLL3 VCO output clock.
  68. This parameter must be a number between Min_Data = 4 and Max_Data = 512 */
  69. uint32_t PLL3P; /*!< PLL3P: Division factor for system clock.
  70. This parameter must be a number between Min_Data = 2 and Max_Data = 128
  71. odd division factors are not allowed */
  72. uint32_t PLL3Q; /*!< PLL3Q: Division factor for peripheral clocks.
  73. This parameter must be a number between Min_Data = 1 and Max_Data = 128 */
  74. uint32_t PLL3R; /*!< PLL3R: Division factor for peripheral clocks.
  75. This parameter must be a number between Min_Data = 1 and Max_Data = 128 */
  76. uint32_t PLL3RGE; /*!<PLL3RGE: PLL3 clock Input range
  77. This parameter must be a value of @ref RCC_PLL3_VCI_Range */
  78. uint32_t PLL3VCOSEL; /*!<PLL3VCOSEL: PLL3 clock Output range
  79. This parameter must be a value of @ref RCC_PLL3_VCO_Range */
  80. uint32_t PLL3FRACN; /*!<PLL3FRACN: Specifies Fractional Part Of The Multiplication Factor for
  81. PLL3 VCO It should be a value between 0 and 8191 */
  82. }RCC_PLL3InitTypeDef;
  83. /**
  84. * @brief RCC PLL1 Clocks structure definition
  85. */
  86. typedef struct
  87. {
  88. uint32_t PLL1_P_Frequency;
  89. uint32_t PLL1_Q_Frequency;
  90. uint32_t PLL1_R_Frequency;
  91. }PLL1_ClocksTypeDef;
  92. /**
  93. * @brief RCC PLL2 Clocks structure definition
  94. */
  95. typedef struct
  96. {
  97. uint32_t PLL2_P_Frequency;
  98. uint32_t PLL2_Q_Frequency;
  99. uint32_t PLL2_R_Frequency;
  100. }PLL2_ClocksTypeDef;
  101. /**
  102. * @brief RCC PLL3 Clocks structure definition
  103. */
  104. typedef struct
  105. {
  106. uint32_t PLL3_P_Frequency;
  107. uint32_t PLL3_Q_Frequency;
  108. uint32_t PLL3_R_Frequency;
  109. }PLL3_ClocksTypeDef;
  110. /**
  111. * @brief RCC extended clocks structure definition
  112. */
  113. typedef struct
  114. {
  115. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  116. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  117. RCC_PLL2InitTypeDef PLL2; /*!< PLL2structure parameters.
  118. This parameter will be used only when PLL2 is selected as kernel clock Source for some peripherals */
  119. RCC_PLL3InitTypeDef PLL3; /*!< PLL3 structure parameters.
  120. This parameter will be used only when PLL2 is selected as kernel clock Source for some peripherals */
  121. uint32_t FmcClockSelection; /*!< Specifies FMC clock source
  122. This parameter can be a value of @ref RCCEx_FMC_Clock_Source */
  123. uint32_t QspiClockSelection; /*!< Specifies QSPI clock source
  124. This parameter can be a value of @ref RCCEx_QSPI_Clock_Source */
  125. #if defined(DSI)
  126. uint32_t DsiClockSelection; /*!< Specifies DSI clock source
  127. This parameter can be a value of @ref RCCEx_DSI_Clock_Source */
  128. #endif /*DSI*/
  129. uint32_t SdmmcClockSelection; /*!< Specifies SDMMC clock source
  130. This parameter can be a value of @ref RCCEx_SDMMC_Clock_Source */
  131. uint32_t CkperClockSelection; /*!< Specifies CKPER clock source
  132. This parameter can be a value of @ref RCCEx_CLKP_Clock_Source */
  133. uint32_t Sai1ClockSelection; /*!< Specifies SAI1 clock source
  134. This parameter can be a value of @ref RCCEx_SAI1_Clock_Source */
  135. uint32_t Sai23ClockSelection; /*!< Specifies SAI2/3 clock source
  136. This parameter can be a value of @ref RCCEx_SAI23_Clock_Source */
  137. uint32_t Spi123ClockSelection; /*!< Specifies SPI1/2/3 clock source
  138. This parameter can be a value of @ref RCCEx_SPI123_Clock_Source */
  139. uint32_t Spi45ClockSelection; /*!< Specifies SPI4/5 clock source
  140. This parameter can be a value of @ref RCCEx_SPI45_Clock_Source */
  141. uint32_t SpdifrxClockSelection; /*!< Specifies SPDIFRX Clock clock source
  142. This parameter can be a value of @ref RCCEx_SPDIFRX_Clock_Source */
  143. uint32_t Dfsdm1ClockSelection; /*!< Specifies DFSDM1 Clock clock source
  144. This parameter can be a value of @ref RCCEx_DFSDM1_Clock_Source */
  145. #if defined(FDCAN1) || defined(FDCAN2)
  146. uint32_t FdcanClockSelection; /*!< Specifies FDCAN Clock clock source
  147. This parameter can be a value of @ref RCCEx_FDCAN_Clock_Source */
  148. #endif /*FDCAN1 || FDCAN2*/
  149. uint32_t Swpmi1ClockSelection; /*!< Specifies SWPMI1 Clock clock source
  150. This parameter can be a value of @ref RCCEx_SWPMI1_Clock_Source */
  151. uint32_t Usart234578ClockSelection; /*!< Specifies USART2/3/4/5/7/8 clock source
  152. This parameter can be a value of @ref RCCEx_USART234578_Clock_Source */
  153. uint32_t Usart16ClockSelection; /*!< Specifies USART1/6 clock source
  154. This parameter can be a value of @ref RCCEx_USART16_Clock_Source */
  155. uint32_t RngClockSelection; /*!< Specifies RNG clock source
  156. This parameter can be a value of @ref RCCEx_RNG_Clock_Source */
  157. uint32_t I2c123ClockSelection; /*!< Specifies I2C1/2/3 clock source
  158. This parameter can be a value of @ref RCCEx_I2C123_Clock_Source */
  159. uint32_t UsbClockSelection; /*!< Specifies USB clock source
  160. This parameter can be a value of @ref RCCEx_USB_Clock_Source */
  161. uint32_t CecClockSelection; /*!< Specifies CEC clock source
  162. This parameter can be a value of @ref RCCEx_CEC_Clock_Source */
  163. uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 clock source
  164. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */
  165. uint32_t Lpuart1ClockSelection; /*!< Specifies LPUART1 clock source
  166. This parameter can be a value of @ref RCCEx_LPUART1_Clock_Source */
  167. uint32_t I2c4ClockSelection; /*!< Specifies I2C4 clock source
  168. This parameter can be a value of @ref RCCEx_I2C4_Clock_Source */
  169. uint32_t Lptim2ClockSelection; /*!< Specifies LPTIM2 clock source
  170. This parameter can be a value of @ref RCCEx_LPTIM2_Clock_Source */
  171. uint32_t Lptim345ClockSelection; /*!< Specifies LPTIM3/4/5 clock source
  172. This parameter can be a value of @ref RCCEx_LPTIM345_Clock_Source */
  173. uint32_t AdcClockSelection; /*!< Specifies ADC interface clock source
  174. This parameter can be a value of @ref RCCEx_ADC_Clock_Source */
  175. uint32_t Sai4AClockSelection; /*!< Specifies SAI4A clock source
  176. This parameter can be a value of @ref RCCEx_SAI4A_Clock_Source */
  177. uint32_t Sai4BClockSelection; /*!< Specifies SAI4B clock source
  178. This parameter can be a value of @ref RCCEx_SAI4B_Clock_Source */
  179. uint32_t Spi6ClockSelection; /*!< Specifies SPI6 clock source
  180. This parameter can be a value of @ref RCCEx_SPI6_Clock_Source */
  181. uint32_t RTCClockSelection; /*!< Specifies RTC Clock clock source
  182. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  183. uint32_t Hrtim1ClockSelection; /*!< Specifies HRTIM1 Clock clock source
  184. This parameter can be a value of @ref RCCEx_HRTIM1_Clock_Source */
  185. uint32_t TIMPresSelection; /*!< Specifies TIM Clock Prescalers Selection.
  186. This parameter can be a value of @ref RCCEx_TIM_Prescaler_Selection */
  187. }RCC_PeriphCLKInitTypeDef;
  188. /**
  189. * @brief RCC_CRS Init structure definition
  190. */
  191. typedef struct
  192. {
  193. uint32_t Prescaler; /*!< Specifies the division factor of the SYNC signal.
  194. This parameter can be a value of @ref RCCEx_CRS_SynchroDivider */
  195. uint32_t Source; /*!< Specifies the SYNC signal source.
  196. This parameter can be a value of @ref RCCEx_CRS_SynchroSource */
  197. uint32_t Polarity; /*!< Specifies the input polarity for the SYNC signal source.
  198. This parameter can be a value of @ref RCCEx_CRS_SynchroPolarity */
  199. uint32_t ReloadValue; /*!< Specifies the value to be loaded in the frequency error counter with each SYNC event.
  200. It can be calculated in using macro __HAL_RCC_CRS_RELOADVALUE_CALCULATE(__FTARGET__, __FSYNC__)
  201. This parameter must be a number between 0 and 0xFFFF or a value of @ref RCCEx_CRS_ReloadValueDefault .*/
  202. uint32_t ErrorLimitValue; /*!< Specifies the value to be used to evaluate the captured frequency error value.
  203. This parameter must be a number between 0 and 0xFF or a value of @ref RCCEx_CRS_ErrorLimitDefault */
  204. uint32_t HSI48CalibrationValue; /*!< Specifies a user-programmable trimming value to the HSI48 oscillator.
  205. This parameter must be a number between 0 and 0x3F or a value of @ref RCCEx_CRS_HSI48CalibrationDefault */
  206. }RCC_CRSInitTypeDef;
  207. /**
  208. * @brief RCC_CRS Synchronization structure definition
  209. */
  210. typedef struct
  211. {
  212. uint32_t ReloadValue; /*!< Specifies the value loaded in the Counter reload value.
  213. This parameter must be a number between 0 and 0xFFFF */
  214. uint32_t HSI48CalibrationValue; /*!< Specifies value loaded in HSI48 oscillator smooth trimming.
  215. This parameter must be a number between 0 and 0x3F */
  216. uint32_t FreqErrorCapture; /*!< Specifies the value loaded in the .FECAP, the frequency error counter
  217. value latched in the time of the last SYNC event.
  218. This parameter must be a number between 0 and 0xFFFF */
  219. uint32_t FreqErrorDirection; /*!< Specifies the value loaded in the .FEDIR, the counting direction of the
  220. frequency error counter latched in the time of the last SYNC event.
  221. It shows whether the actual frequency is below or above the target.
  222. This parameter must be a value of @ref RCCEx_CRS_FreqErrorDirection*/
  223. }RCC_CRSSynchroInfoTypeDef;
  224. /**
  225. * @}
  226. */
  227. /* Exported constants --------------------------------------------------------*/
  228. /** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants
  229. * @{
  230. */
  231. /** @defgroup RCCEx_Periph_Clock_Selection RCCEx Periph Clock Selection
  232. * @{
  233. */
  234. #define RCC_PERIPHCLK_USART16 (0x00000001U)
  235. #define RCC_PERIPHCLK_USART1 RCC_PERIPHCLK_USART16
  236. #define RCC_PERIPHCLK_USART6 RCC_PERIPHCLK_USART16
  237. #define RCC_PERIPHCLK_USART234578 (0x00000002U)
  238. #define RCC_PERIPHCLK_USART2 RCC_PERIPHCLK_USART234578
  239. #define RCC_PERIPHCLK_USART3 RCC_PERIPHCLK_USART234578
  240. #define RCC_PERIPHCLK_UART4 RCC_PERIPHCLK_USART234578
  241. #define RCC_PERIPHCLK_UART5 RCC_PERIPHCLK_USART234578
  242. #define RCC_PERIPHCLK_UART7 RCC_PERIPHCLK_USART234578
  243. #define RCC_PERIPHCLK_UART8 RCC_PERIPHCLK_USART234578
  244. #define RCC_PERIPHCLK_LPUART1 (0x00000004U)
  245. #define RCC_PERIPHCLK_I2C123 (0x00000008U)
  246. #define RCC_PERIPHCLK_I2C1 RCC_PERIPHCLK_I2C123
  247. #define RCC_PERIPHCLK_I2C2 RCC_PERIPHCLK_I2C123
  248. #define RCC_PERIPHCLK_I2C3 RCC_PERIPHCLK_I2C123
  249. #define RCC_PERIPHCLK_I2C4 (0x00000010U)
  250. #define RCC_PERIPHCLK_LPTIM1 (0x00000020U)
  251. #define RCC_PERIPHCLK_LPTIM2 (0x00000040U)
  252. #define RCC_PERIPHCLK_LPTIM345 (0x00000080U)
  253. #define RCC_PERIPHCLK_LPTIM3 RCC_PERIPHCLK_LPTIM345
  254. #define RCC_PERIPHCLK_LPTIM4 RCC_PERIPHCLK_LPTIM345
  255. #define RCC_PERIPHCLK_LPTIM5 RCC_PERIPHCLK_LPTIM345
  256. #define RCC_PERIPHCLK_SAI1 (0x00000100U)
  257. #define RCC_PERIPHCLK_SAI23 (0x00000200U)
  258. #define RCC_PERIPHCLK_SAI2 RCC_PERIPHCLK_SAI23
  259. #define RCC_PERIPHCLK_SAI3 RCC_PERIPHCLK_SAI23
  260. #define RCC_PERIPHCLK_SAI4A (0x00000400U)
  261. #define RCC_PERIPHCLK_SAI4B (0x00000800U)
  262. #define RCC_PERIPHCLK_SPI123 (0x00001000U)
  263. #define RCC_PERIPHCLK_SPI1 RCC_PERIPHCLK_SPI123
  264. #define RCC_PERIPHCLK_SPI2 RCC_PERIPHCLK_SPI123
  265. #define RCC_PERIPHCLK_SPI3 RCC_PERIPHCLK_SPI123
  266. #define RCC_PERIPHCLK_SPI45 (0x00002000U)
  267. #define RCC_PERIPHCLK_SPI4 RCC_PERIPHCLK_SPI45
  268. #define RCC_PERIPHCLK_SPI5 RCC_PERIPHCLK_SPI45
  269. #define RCC_PERIPHCLK_SPI6 (0x00004000U)
  270. #define RCC_PERIPHCLK_FDCAN (0x00008000U)
  271. #define RCC_PERIPHCLK_SDMMC (0x00010000U)
  272. #define RCC_PERIPHCLK_RNG (0x00020000U)
  273. #define RCC_PERIPHCLK_USB (0x00040000U)
  274. #define RCC_PERIPHCLK_ADC (0x00080000U)
  275. #define RCC_PERIPHCLK_SWPMI1 (0x00100000U)
  276. #define RCC_PERIPHCLK_DFSDM1 (0x00200000U)
  277. #define RCC_PERIPHCLK_RTC (0x00400000U)
  278. #define RCC_PERIPHCLK_CEC (0x00800000U)
  279. #define RCC_PERIPHCLK_FMC (0x01000000U)
  280. #define RCC_PERIPHCLK_QSPI (0x02000000U)
  281. #define RCC_PERIPHCLK_DSI (0x04000000U)
  282. #define RCC_PERIPHCLK_SPDIFRX (0x08000000U)
  283. #define RCC_PERIPHCLK_HRTIM1 (0x10000000U)
  284. #if defined(LTDC)
  285. #define RCC_PERIPHCLK_LTDC (0x20000000U)
  286. #endif /* LTDC */
  287. #define RCC_PERIPHCLK_TIM (0x40000000U)
  288. #define RCC_PERIPHCLK_CKPER (0x80000000U)
  289. /**
  290. * @}
  291. */
  292. /** @defgroup RCC_PLL2_Clock_Output RCC PLL2 Clock Output
  293. * @{
  294. */
  295. #define RCC_PLL2_DIVP RCC_PLLCFGR_DIVP2EN
  296. #define RCC_PLL2_DIVQ RCC_PLLCFGR_DIVQ2EN
  297. #define RCC_PLL2_DIVR RCC_PLLCFGR_DIVR2EN
  298. /**
  299. * @}
  300. */
  301. /** @defgroup RCC_PLL3_Clock_Output RCC PLL3 Clock Output
  302. * @{
  303. */
  304. #define RCC_PLL3_DIVP RCC_PLLCFGR_DIVP3EN
  305. #define RCC_PLL3_DIVQ RCC_PLLCFGR_DIVQ3EN
  306. #define RCC_PLL3_DIVR RCC_PLLCFGR_DIVR3EN
  307. /**
  308. * @}
  309. */
  310. /** @defgroup RCC_PLL2_VCI_Range RCC PLL2 VCI Range
  311. * @{
  312. */
  313. #define RCC_PLL2VCIRANGE_0 RCC_PLLCFGR_PLL2RGE_0
  314. #define RCC_PLL2VCIRANGE_1 RCC_PLLCFGR_PLL2RGE_1
  315. #define RCC_PLL2VCIRANGE_2 RCC_PLLCFGR_PLL2RGE_2
  316. #define RCC_PLL2VCIRANGE_3 RCC_PLLCFGR_PLL2RGE_3
  317. /**
  318. * @}
  319. */
  320. /** @defgroup RCC_PLL2_VCO_Range RCC PLL2 VCO Range
  321. * @{
  322. */
  323. #define RCC_PLL2VCOWIDE (0x00000000U)
  324. #define RCC_PLL2VCOMEDIUM RCC_PLLCFGR_PLL2VCOSEL
  325. /**
  326. * @}
  327. */
  328. /** @defgroup RCC_PLL3_VCI_Range RCC PLL3 VCI Range
  329. * @{
  330. */
  331. #define RCC_PLL3VCIRANGE_0 RCC_PLLCFGR_PLL3RGE_0
  332. #define RCC_PLL3VCIRANGE_1 RCC_PLLCFGR_PLL3RGE_1
  333. #define RCC_PLL3VCIRANGE_2 RCC_PLLCFGR_PLL3RGE_2
  334. #define RCC_PLL3VCIRANGE_3 RCC_PLLCFGR_PLL3RGE_3
  335. /**
  336. * @}
  337. */
  338. /** @defgroup RCC_PLL3_VCO_Range RCC PLL3 VCO Range
  339. * @{
  340. */
  341. #define RCC_PLL3VCOWIDE (0x00000000U)
  342. #define RCC_PLL3VCOMEDIUM RCC_PLLCFGR_PLL3VCOSEL
  343. /**
  344. * @}
  345. */
  346. /** @defgroup RCCEx_USART16_Clock_Source RCCEx USART1/6 Clock Source
  347. * @{
  348. */
  349. #define RCC_USART16CLKSOURCE_D2PCLK2 (0x00000000U)
  350. #define RCC_USART16CLKSOURCE_PLL2 RCC_D2CCIP2R_USART16SEL_0
  351. #define RCC_USART16CLKSOURCE_PLL3 RCC_D2CCIP2R_USART16SEL_1
  352. #define RCC_USART16CLKSOURCE_HSI (RCC_D2CCIP2R_USART16SEL_0 | RCC_D2CCIP2R_USART16SEL_1)
  353. #define RCC_USART16CLKSOURCE_CSI RCC_D2CCIP2R_USART16SEL_2
  354. #define RCC_USART16CLKSOURCE_LSE (RCC_D2CCIP2R_USART16SEL_0 | RCC_D2CCIP2R_USART16SEL_2)
  355. /**
  356. * @}
  357. */
  358. /** @defgroup RCCEx_USART1_Clock_Source RCCEx USART1 Clock Source
  359. * @{
  360. */
  361. #define RCC_USART1CLKSOURCE_D2PCLK2 RCC_USART16CLKSOURCE_D2PCLK2
  362. #define RCC_USART1CLKSOURCE_PLL2 RCC_USART16CLKSOURCE_PLL2
  363. #define RCC_USART1CLKSOURCE_PLL3 RCC_USART16CLKSOURCE_PLL3
  364. #define RCC_USART1CLKSOURCE_HSI RCC_USART16CLKSOURCE_HSI
  365. #define RCC_USART1CLKSOURCE_CSI RCC_USART16CLKSOURCE_CSI
  366. #define RCC_USART1CLKSOURCE_LSE RCC_USART16CLKSOURCE_LSE
  367. /**
  368. * @}
  369. */
  370. /** @defgroup RCCEx_USART6_Clock_Source RCCEx USART6 Clock Source
  371. * @{
  372. */
  373. #define RCC_USART6CLKSOURCE_D2PCLK2 RCC_USART16CLKSOURCE_D2PCLK2
  374. #define RCC_USART6CLKSOURCE_PLL2 RCC_USART16CLKSOURCE_PLL2
  375. #define RCC_USART6CLKSOURCE_PLL3 RCC_USART16CLKSOURCE_PLL3
  376. #define RCC_USART6CLKSOURCE_HSI RCC_USART16CLKSOURCE_HSI
  377. #define RCC_USART6CLKSOURCE_CSI RCC_USART16CLKSOURCE_CSI
  378. #define RCC_USART6CLKSOURCE_LSE RCC_USART16CLKSOURCE_LSE
  379. /**
  380. * @}
  381. */
  382. /** @defgroup RCCEx_USART234578_Clock_Source RCCEx USART2/3/4/5/7/8 Clock Source
  383. * @{
  384. */
  385. #define RCC_USART234578CLKSOURCE_D2PCLK1 (0x00000000U)
  386. #define RCC_USART234578CLKSOURCE_PLL2 RCC_D2CCIP2R_USART28SEL_0
  387. #define RCC_USART234578CLKSOURCE_PLL3 RCC_D2CCIP2R_USART28SEL_1
  388. #define RCC_USART234578CLKSOURCE_HSI (RCC_D2CCIP2R_USART28SEL_0 | RCC_D2CCIP2R_USART28SEL_1)
  389. #define RCC_USART234578CLKSOURCE_CSI RCC_D2CCIP2R_USART28SEL_2
  390. #define RCC_USART234578CLKSOURCE_LSE (RCC_D2CCIP2R_USART28SEL_0 | RCC_D2CCIP2R_USART28SEL_2)
  391. /**
  392. * @}
  393. */
  394. /** @defgroup RCCEx_USART2_Clock_Source RCCEx USART2 Clock Source
  395. * @{
  396. */
  397. #define RCC_USART2CLKSOURCE_D2PCLK1 RCC_USART234578CLKSOURCE_D2PCLK1
  398. #define RCC_USART2CLKSOURCE_PLL2 RCC_USART234578CLKSOURCE_PLL2
  399. #define RCC_USART2CLKSOURCE_PLL3 RCC_USART234578CLKSOURCE_PLL3
  400. #define RCC_USART2CLKSOURCE_HSI RCC_USART234578CLKSOURCE_HSI
  401. #define RCC_USART2CLKSOURCE_CSI RCC_USART234578CLKSOURCE_CSI
  402. #define RCC_USART2CLKSOURCE_LSE RCC_USART234578CLKSOURCE_LSE
  403. /**
  404. * @}
  405. */
  406. /** @defgroup RCCEx_USART3_Clock_Source RCCEx USART3 Clock Source
  407. * @{
  408. */
  409. #define RCC_USART3CLKSOURCE_D2PCLK1 RCC_USART234578CLKSOURCE_D2PCLK1
  410. #define RCC_USART3CLKSOURCE_PLL2 RCC_USART234578CLKSOURCE_PLL2
  411. #define RCC_USART3CLKSOURCE_PLL3 RCC_USART234578CLKSOURCE_PLL3
  412. #define RCC_USART3CLKSOURCE_HSI RCC_USART234578CLKSOURCE_HSI
  413. #define RCC_USART3CLKSOURCE_CSI RCC_USART234578CLKSOURCE_CSI
  414. #define RCC_USART3CLKSOURCE_LSE RCC_USART234578CLKSOURCE_LSE
  415. /**
  416. * @}
  417. */
  418. /** @defgroup RCCEx_UART4_Clock_Source RCCEx UART4 Clock Source
  419. * @{
  420. */
  421. #define RCC_UART4CLKSOURCE_D2PCLK1 RCC_USART234578CLKSOURCE_D2PCLK1
  422. #define RCC_UART4CLKSOURCE_PLL2 RCC_USART234578CLKSOURCE_PLL2
  423. #define RCC_UART4CLKSOURCE_PLL3 RCC_USART234578CLKSOURCE_PLL3
  424. #define RCC_UART4CLKSOURCE_HSI RCC_USART234578CLKSOURCE_HSI
  425. #define RCC_UART4CLKSOURCE_CSI RCC_USART234578CLKSOURCE_CSI
  426. #define RCC_UART4CLKSOURCE_LSE RCC_USART234578CLKSOURCE_LSE
  427. /**
  428. * @}
  429. */
  430. /** @defgroup RCCEx_UART5_Clock_Source RCCEx UART5 Clock Source
  431. * @{
  432. */
  433. #define RCC_UART5CLKSOURCE_D2PCLK1 RCC_USART234578CLKSOURCE_D2PCLK1
  434. #define RCC_UART5CLKSOURCE_PLL2 RCC_USART234578CLKSOURCE_PLL2
  435. #define RCC_UART5CLKSOURCE_PLL3 RCC_USART234578CLKSOURCE_PLL3
  436. #define RCC_UART5CLKSOURCE_HSI RCC_USART234578CLKSOURCE_HSI
  437. #define RCC_UART5CLKSOURCE_CSI RCC_USART234578CLKSOURCE_CSI
  438. #define RCC_UART5CLKSOURCE_LSE RCC_USART234578CLKSOURCE_LSE
  439. /**
  440. * @}
  441. */
  442. /** @defgroup RCCEx_UART7_Clock_Source RCCEx UART7 Clock Source
  443. * @{
  444. */
  445. #define RCC_UART7CLKSOURCE_D2PCLK1 RCC_USART234578CLKSOURCE_D2PCLK1
  446. #define RCC_UART7CLKSOURCE_PLL2 RCC_USART234578CLKSOURCE_PLL2
  447. #define RCC_UART7CLKSOURCE_PLL3 RCC_USART234578CLKSOURCE_PLL3
  448. #define RCC_UART7CLKSOURCE_HSI RCC_USART234578CLKSOURCE_HSI
  449. #define RCC_UART7CLKSOURCE_CSI RCC_USART234578CLKSOURCE_CSI
  450. #define RCC_UART7CLKSOURCE_LSE RCC_USART234578CLKSOURCE_LSE
  451. /**
  452. * @}
  453. */
  454. /** @defgroup RCCEx_UART8_Clock_Source RCCEx UART8 Clock Source
  455. * @{
  456. */
  457. #define RCC_UART8CLKSOURCE_D2PCLK1 RCC_USART234578CLKSOURCE_D2PCLK1
  458. #define RCC_UART8CLKSOURCE_PLL2 RCC_USART234578CLKSOURCE_PLL2
  459. #define RCC_UART8CLKSOURCE_PLL3 RCC_USART234578CLKSOURCE_PLL3
  460. #define RCC_UART8CLKSOURCE_HSI RCC_USART234578CLKSOURCE_HSI
  461. #define RCC_UART8CLKSOURCE_CSI RCC_USART234578CLKSOURCE_CSI
  462. #define RCC_UART8CLKSOURCE_LSE RCC_USART234578CLKSOURCE_LSE
  463. /**
  464. * @}
  465. */
  466. /** @defgroup RCCEx_LPUART1_Clock_Source RCCEx LPUART1 Clock Source
  467. * @{
  468. */
  469. #define RCC_LPUART1CLKSOURCE_D3PCLK1 (0x00000000U)
  470. #define RCC_LPUART1CLKSOURCE_PLL2 RCC_D3CCIPR_LPUART1SEL_0
  471. #define RCC_LPUART1CLKSOURCE_PLL3 RCC_D3CCIPR_LPUART1SEL_1
  472. #define RCC_LPUART1CLKSOURCE_HSI (RCC_D3CCIPR_LPUART1SEL_0 | RCC_D3CCIPR_LPUART1SEL_1)
  473. #define RCC_LPUART1CLKSOURCE_CSI RCC_D3CCIPR_LPUART1SEL_2
  474. #define RCC_LPUART1CLKSOURCE_LSE (RCC_D3CCIPR_LPUART1SEL_2 | RCC_D3CCIPR_LPUART1SEL_0)
  475. /**
  476. * @}
  477. */
  478. /** @defgroup RCCEx_I2C123_Clock_Source RCCEx I2C1/2/3 Clock Source
  479. * @{
  480. */
  481. #define RCC_I2C123CLKSOURCE_D2PCLK1 (0x00000000U)
  482. #define RCC_I2C123CLKSOURCE_PLL3 RCC_D2CCIP2R_I2C123SEL_0
  483. #define RCC_I2C123CLKSOURCE_HSI RCC_D2CCIP2R_I2C123SEL_1
  484. #define RCC_I2C123CLKSOURCE_CSI (RCC_D2CCIP2R_I2C123SEL_0 | RCC_D2CCIP2R_I2C123SEL_1)
  485. /**
  486. * @}
  487. */
  488. /** @defgroup RCCEx_I2C1_Clock_Source RCCEx I2C1 Clock Source
  489. * @{
  490. */
  491. #define RCC_I2C1CLKSOURCE_D2PCLK1 RCC_I2C123CLKSOURCE_D2PCLK1
  492. #define RCC_I2C1CLKSOURCE_PLL3 RCC_I2C123CLKSOURCE_PLL3
  493. #define RCC_I2C1CLKSOURCE_HSI RCC_I2C123CLKSOURCE_HSI
  494. #define RCC_I2C1CLKSOURCE_CSI RCC_I2C123CLKSOURCE_CSI
  495. /**
  496. * @}
  497. */
  498. /** @defgroup RCCEx_I2C2_Clock_Source RCCEx I2C2 Clock Source
  499. * @{
  500. */
  501. #define RCC_I2C2CLKSOURCE_D2PCLK1 RCC_I2C123CLKSOURCE_D2PCLK1
  502. #define RCC_I2C2CLKSOURCE_PLL3 RCC_I2C123CLKSOURCE_PLL3
  503. #define RCC_I2C2CLKSOURCE_HSI RCC_I2C123CLKSOURCE_HSI
  504. #define RCC_I2C2CLKSOURCE_CSI RCC_I2C123CLKSOURCE_CSI
  505. /**
  506. * @}
  507. */
  508. /** @defgroup RCCEx_I2C3_Clock_Source RCCEx I2C3 Clock Source
  509. * @{
  510. */
  511. #define RCC_I2C3CLKSOURCE_D2PCLK1 RCC_I2C123CLKSOURCE_D2PCLK1
  512. #define RCC_I2C3CLKSOURCE_PLL3 RCC_I2C123CLKSOURCE_PLL3
  513. #define RCC_I2C3CLKSOURCE_HSI RCC_I2C123CLKSOURCE_HSI
  514. #define RCC_I2C3CLKSOURCE_CSI RCC_I2C123CLKSOURCE_CSI
  515. /**
  516. * @}
  517. */
  518. /** @defgroup RCCEx_I2C4_Clock_Source RCCEx I2C4 Clock Source
  519. * @{
  520. */
  521. #define RCC_I2C4CLKSOURCE_D3PCLK1 (0x00000000U)
  522. #define RCC_I2C4CLKSOURCE_PLL3 RCC_D3CCIPR_I2C4SEL_0
  523. #define RCC_I2C4CLKSOURCE_HSI RCC_D3CCIPR_I2C4SEL_1
  524. #define RCC_I2C4CLKSOURCE_CSI (RCC_D3CCIPR_I2C4SEL_0 | RCC_D3CCIPR_I2C4SEL_1)
  525. /**
  526. * @}
  527. */
  528. /** @defgroup RCCEx_RNG_Clock_Source RCCEx RNG Clock Source
  529. * @{
  530. */
  531. #define RCC_RNGCLKSOURCE_HSI48 (0x00000000U)
  532. #define RCC_RNGCLKSOURCE_PLL RCC_D2CCIP2R_RNGSEL_0
  533. #define RCC_RNGCLKSOURCE_LSE RCC_D2CCIP2R_RNGSEL_1
  534. #define RCC_RNGCLKSOURCE_LSI RCC_D2CCIP2R_RNGSEL
  535. /**
  536. * @}
  537. */
  538. /** @defgroup RCCEx_HRTIM1_Clock_Source RCC Extended HRTIM1 Clock Source
  539. * @{
  540. */
  541. #define RCC_HRTIM1CLK_TIMCLK (0x00000000U)
  542. #define RCC_HRTIM1CLK_CPUCLK RCC_CFGR_HRTIMSEL
  543. /**
  544. * @}
  545. */
  546. /** @defgroup RCCEx_USB_Clock_Source RCCEx USB Clock Source
  547. * @{
  548. */
  549. #define RCC_USBCLKSOURCE_PLL RCC_D2CCIP2R_USBSEL_0
  550. #define RCC_USBCLKSOURCE_PLL3 RCC_D2CCIP2R_USBSEL_1
  551. #define RCC_USBCLKSOURCE_HSI48 RCC_D2CCIP2R_USBSEL
  552. /**
  553. * @}
  554. */
  555. /** @defgroup RCCEx_SAI1_Clock_Source SAI1 Clock Source
  556. * @{
  557. */
  558. #define RCC_SAI1CLKSOURCE_PLL (0x00000000U)
  559. #define RCC_SAI1CLKSOURCE_PLL2 RCC_D2CCIP1R_SAI1SEL_0
  560. #define RCC_SAI1CLKSOURCE_PLL3 RCC_D2CCIP1R_SAI1SEL_1
  561. #define RCC_SAI1CLKSOURCE_PIN (RCC_D2CCIP1R_SAI1SEL_0 | RCC_D2CCIP1R_SAI1SEL_1)
  562. #define RCC_SAI1CLKSOURCE_CLKP RCC_D2CCIP1R_SAI1SEL_2
  563. /**
  564. * @}
  565. */
  566. /** @defgroup RCCEx_SAI23_Clock_Source SAI2/3 Clock Source
  567. * @{
  568. */
  569. #define RCC_SAI23CLKSOURCE_PLL (0x00000000U)
  570. #define RCC_SAI23CLKSOURCE_PLL2 RCC_D2CCIP1R_SAI23SEL_0
  571. #define RCC_SAI23CLKSOURCE_PLL3 RCC_D2CCIP1R_SAI23SEL_1
  572. #define RCC_SAI23CLKSOURCE_PIN (RCC_D2CCIP1R_SAI23SEL_0 | RCC_D2CCIP1R_SAI23SEL_1)
  573. #define RCC_SAI23CLKSOURCE_CLKP RCC_D2CCIP1R_SAI23SEL_2
  574. /**
  575. * @}
  576. */
  577. /** @defgroup RCCEx_SAI2_Clock_Source SAI2 Clock Source
  578. * @{
  579. */
  580. #define RCC_SAI2CLKSOURCE_PLL RCC_SAI23CLKSOURCE_PLL
  581. #define RCC_SAI2CLKSOURCE_PLL2 RCC_SAI23CLKSOURCE_PLL2
  582. #define RCC_SAI2CLKSOURCE_PLL3 RCC_SAI23CLKSOURCE_PLL3
  583. #define RCC_SAI2CLKSOURCE_PIN RCC_SAI23CLKSOURCE_PIN
  584. #define RCC_SAI2CLKSOURCE_CLKP RCC_SAI23CLKSOURCE_CLKP
  585. /**
  586. * @}
  587. */
  588. /** @defgroup RCCEx_SAI3_Clock_Source SAI3 Clock Source
  589. * @{
  590. */
  591. #define RCC_SAI3CLKSOURCE_PLL RCC_SAI23CLKSOURCE_PLL
  592. #define RCC_SAI3CLKSOURCE_PLL2 RCC_SAI23CLKSOURCE_PLL2
  593. #define RCC_SAI3CLKSOURCE_PLL3 RCC_SAI23CLKSOURCE_PLL3
  594. #define RCC_SAI3CLKSOURCE_PIN RCC_SAI23CLKSOURCE_PIN
  595. #define RCC_SAI3CLKSOURCE_CLKP RCC_SAI23CLKSOURCE_CLKP
  596. /**
  597. * @}
  598. */
  599. /** @defgroup RCCEx_SPI123_Clock_Source SPI1/2/3 Clock Source
  600. * @{
  601. */
  602. #define RCC_SPI123CLKSOURCE_PLL (0x00000000U)
  603. #define RCC_SPI123CLKSOURCE_PLL2 RCC_D2CCIP1R_SPI123SEL_0
  604. #define RCC_SPI123CLKSOURCE_PLL3 RCC_D2CCIP1R_SPI123SEL_1
  605. #define RCC_SPI123CLKSOURCE_PIN (RCC_D2CCIP1R_SPI123SEL_0 | RCC_D2CCIP1R_SPI123SEL_1)
  606. #define RCC_SPI123CLKSOURCE_CLKP RCC_D2CCIP1R_SPI123SEL_2
  607. /**
  608. * @}
  609. */
  610. /** @defgroup RCCEx_SPI1_Clock_Source SPI1 Clock Source
  611. * @{
  612. */
  613. #define RCC_SPI1CLKSOURCE_PLL RCC_SPI123CLKSOURCE_PLL
  614. #define RCC_SPI1CLKSOURCE_PLL2 RCC_SPI123CLKSOURCE_PLL2
  615. #define RCC_SPI1CLKSOURCE_PLL3 RCC_SPI123CLKSOURCE_PLL3
  616. #define RCC_SPI1CLKSOURCE_PIN RCC_SPI123CLKSOURCE_PIN
  617. #define RCC_SPI1CLKSOURCE_CLKP RCC_SPI123CLKSOURCE_CLKP
  618. /**
  619. * @}
  620. */
  621. /** @defgroup RCCEx_SPI2_Clock_Source SPI2 Clock Source
  622. * @{
  623. */
  624. #define RCC_SPI2CLKSOURCE_PLL RCC_SPI123CLKSOURCE_PLL
  625. #define RCC_SPI2CLKSOURCE_PLL2 RCC_SPI123CLKSOURCE_PLL2
  626. #define RCC_SPI2CLKSOURCE_PLL3 RCC_SPI123CLKSOURCE_PLL3
  627. #define RCC_SPI2CLKSOURCE_PIN RCC_SPI123CLKSOURCE_PIN
  628. #define RCC_SPI2CLKSOURCE_CLKP RCC_SPI123CLKSOURCE_CLKP
  629. /**
  630. * @}
  631. */
  632. /** @defgroup RCCEx_SPI3_Clock_Source SPI3 Clock Source
  633. * @{
  634. */
  635. #define RCC_SPI3CLKSOURCE_PLL RCC_SPI123CLKSOURCE_PLL
  636. #define RCC_SPI3CLKSOURCE_PLL2 RCC_SPI123CLKSOURCE_PLL2
  637. #define RCC_SPI3CLKSOURCE_PLL3 RCC_SPI123CLKSOURCE_PLL3
  638. #define RCC_SPI3CLKSOURCE_PIN RCC_SPI123CLKSOURCE_PIN
  639. #define RCC_SPI3CLKSOURCE_CLKP RCC_SPI123CLKSOURCE_CLKP
  640. /**
  641. * @}
  642. */
  643. /** @defgroup RCCEx_SPI45_Clock_Source SPI4/5 Clock Source
  644. * @{
  645. */
  646. #define RCC_SPI45CLKSOURCE_D2PCLK1 (0x00000000U)
  647. #define RCC_SPI45CLKSOURCE_PLL2 RCC_D2CCIP1R_SPI45SEL_0
  648. #define RCC_SPI45CLKSOURCE_PLL3 RCC_D2CCIP1R_SPI45SEL_1
  649. #define RCC_SPI45CLKSOURCE_HSI (RCC_D2CCIP1R_SPI45SEL_0 | RCC_D2CCIP1R_SPI45SEL_1)
  650. #define RCC_SPI45CLKSOURCE_CSI RCC_D2CCIP1R_SPI45SEL_2
  651. #define RCC_SPI45CLKSOURCE_HSE (RCC_D2CCIP1R_SPI45SEL_0 | RCC_D2CCIP1R_SPI45SEL_2)
  652. /**
  653. * @}
  654. */
  655. /** @defgroup RCCEx_SPI4_Clock_Source SPI4 Clock Source
  656. * @{
  657. */
  658. #define RCC_SPI4CLKSOURCE_D2PCLK1 RCC_SPI45CLKSOURCE_D2PCLK1
  659. #define RCC_SPI4CLKSOURCE_PLL2 RCC_SPI45CLKSOURCE_PLL2
  660. #define RCC_SPI4CLKSOURCE_PLL3 RCC_SPI45CLKSOURCE_PLL3
  661. #define RCC_SPI4CLKSOURCE_HSI RCC_SPI45CLKSOURCE_HSI
  662. #define RCC_SPI4CLKSOURCE_CSI RCC_SPI45CLKSOURCE_CSI
  663. #define RCC_SPI4CLKSOURCE_HSE RCC_SPI45CLKSOURCE_HSE
  664. /**
  665. * @}
  666. */
  667. /** @defgroup RCCEx_SPI5_Clock_Source SPI5 Clock Source
  668. * @{
  669. */
  670. #define RCC_SPI5CLKSOURCE_D2PCLK1 RCC_SPI45CLKSOURCE_D2PCLK1
  671. #define RCC_SPI5CLKSOURCE_PLL2 RCC_SPI45CLKSOURCE_PLL2
  672. #define RCC_SPI5CLKSOURCE_PLL3 RCC_SPI45CLKSOURCE_PLL3
  673. #define RCC_SPI5CLKSOURCE_HSI RCC_SPI45CLKSOURCE_HSI
  674. #define RCC_SPI5CLKSOURCE_CSI RCC_SPI45CLKSOURCE_CSI
  675. #define RCC_SPI5CLKSOURCE_HSE RCC_SPI45CLKSOURCE_HSE
  676. /**
  677. * @}
  678. */
  679. /** @defgroup RCCEx_SPI6_Clock_Source SPI6 Clock Source
  680. * @{
  681. */
  682. #define RCC_SPI6CLKSOURCE_D3PCLK1 (0x00000000U)
  683. #define RCC_SPI6CLKSOURCE_PLL2 RCC_D3CCIPR_SPI6SEL_0
  684. #define RCC_SPI6CLKSOURCE_PLL3 RCC_D3CCIPR_SPI6SEL_1
  685. #define RCC_SPI6CLKSOURCE_HSI (RCC_D3CCIPR_SPI6SEL_0 | RCC_D3CCIPR_SPI6SEL_1)
  686. #define RCC_SPI6CLKSOURCE_CSI RCC_D3CCIPR_SPI6SEL_2
  687. #define RCC_SPI6CLKSOURCE_HSE (RCC_D3CCIPR_SPI6SEL_0 | RCC_D3CCIPR_SPI6SEL_2)
  688. /**
  689. * @}
  690. */
  691. /** @defgroup RCCEx_SAI4A_Clock_Source SAI4A Clock Source
  692. * @{
  693. */
  694. #define RCC_SAI4ACLKSOURCE_PLL (0x00000000U)
  695. #define RCC_SAI4ACLKSOURCE_PLL2 RCC_D3CCIPR_SAI4ASEL_0
  696. #define RCC_SAI4ACLKSOURCE_PLL3 RCC_D3CCIPR_SAI4ASEL_1
  697. #define RCC_SAI4ACLKSOURCE_PIN (RCC_D3CCIPR_SAI4ASEL_0 | RCC_D3CCIPR_SAI4ASEL_1)
  698. #define RCC_SAI4ACLKSOURCE_CLKP RCC_D3CCIPR_SAI4ASEL_2
  699. /**
  700. * @}
  701. */
  702. /** @defgroup RCCEx_SAI4B_Clock_Source SAI4B Clock Source
  703. * @{
  704. */
  705. #define RCC_SAI4BCLKSOURCE_PLL (0x00000000U)
  706. #define RCC_SAI4BCLKSOURCE_PLL2 RCC_D3CCIPR_SAI4BSEL_0
  707. #define RCC_SAI4BCLKSOURCE_PLL3 RCC_D3CCIPR_SAI4BSEL_1
  708. #define RCC_SAI4BCLKSOURCE_PIN (RCC_D3CCIPR_SAI4BSEL_0 | RCC_D3CCIPR_SAI4BSEL_1)
  709. #define RCC_SAI4BCLKSOURCE_CLKP RCC_D3CCIPR_SAI4BSEL_2
  710. /**
  711. * @}
  712. */
  713. /** @defgroup RCCEx_LPTIM1_Clock_Source RCCEx LPTIM1 Clock Source
  714. * @{
  715. */
  716. #define RCC_LPTIM1CLKSOURCE_D2PCLK1 (0x00000000U)
  717. #define RCC_LPTIM1CLKSOURCE_PLL2 RCC_D2CCIP2R_LPTIM1SEL_0
  718. #define RCC_LPTIM1CLKSOURCE_PLL3 RCC_D2CCIP2R_LPTIM1SEL_1
  719. #define RCC_LPTIM1CLKSOURCE_LSE (RCC_D2CCIP2R_LPTIM1SEL_0 | RCC_D2CCIP2R_LPTIM1SEL_1)
  720. #define RCC_LPTIM1CLKSOURCE_LSI RCC_D2CCIP2R_LPTIM1SEL_2
  721. #define RCC_LPTIM1CLKSOURCE_CLKP (RCC_D2CCIP2R_LPTIM1SEL_0 | RCC_D2CCIP2R_LPTIM1SEL_2)
  722. /**
  723. * @}
  724. */
  725. /** @defgroup RCCEx_LPTIM2_Clock_Source RCCEx LPTIM2 Clock Source
  726. * @{
  727. */
  728. #define RCC_LPTIM2CLKSOURCE_D3PCLK1 (0x00000000U)
  729. #define RCC_LPTIM2CLKSOURCE_PLL2 RCC_D3CCIPR_LPTIM2SEL_0
  730. #define RCC_LPTIM2CLKSOURCE_PLL3 RCC_D3CCIPR_LPTIM2SEL_1
  731. #define RCC_LPTIM2CLKSOURCE_LSE (RCC_D3CCIPR_LPTIM2SEL_0 | RCC_D3CCIPR_LPTIM2SEL_1)
  732. #define RCC_LPTIM2CLKSOURCE_LSI RCC_D3CCIPR_LPTIM2SEL_2
  733. #define RCC_LPTIM2CLKSOURCE_CLKP (RCC_D3CCIPR_LPTIM2SEL_0 | RCC_D3CCIPR_LPTIM2SEL_2)
  734. /**
  735. * @}
  736. */
  737. /** @defgroup RCCEx_LPTIM345_Clock_Source RCCEx LPTIM3/4/5 Clock Source
  738. * @{
  739. */
  740. #define RCC_LPTIM345CLKSOURCE_D3PCLK1 (0x00000000U)
  741. #define RCC_LPTIM345CLKSOURCE_PLL2 RCC_D3CCIPR_LPTIM345SEL_0
  742. #define RCC_LPTIM345CLKSOURCE_PLL3 RCC_D3CCIPR_LPTIM345SEL_1
  743. #define RCC_LPTIM345CLKSOURCE_LSE (RCC_D3CCIPR_LPTIM345SEL_0 | RCC_D3CCIPR_LPTIM345SEL_1)
  744. #define RCC_LPTIM345CLKSOURCE_LSI RCC_D3CCIPR_LPTIM345SEL_2
  745. #define RCC_LPTIM345CLKSOURCE_CLKP (RCC_D3CCIPR_LPTIM345SEL_0 | RCC_D3CCIPR_LPTIM345SEL_2)
  746. /**
  747. * @}
  748. */
  749. /** @defgroup RCCEx_LPTIM3_Clock_Source RCCEx LPTIM3 Clock Source
  750. * @{
  751. */
  752. #define RCC_LPTIM3CLKSOURCE_D3PCLK1 RCC_LPTIM345CLKSOURCE_D3PCLK1
  753. #define RCC_LPTIM3CLKSOURCE_PLL2 RCC_LPTIM345CLKSOURCE_PLL2
  754. #define RCC_LPTIM3CLKSOURCE_PLL3 RCC_LPTIM345CLKSOURCE_PLL3
  755. #define RCC_LPTIM3CLKSOURCE_LSE RCC_LPTIM345CLKSOURCE_LSE
  756. #define RCC_LPTIM3CLKSOURCE_LSI RCC_LPTIM345CLKSOURCE_LSI
  757. #define RCC_LPTIM3CLKSOURCE_CLKP RCC_LPTIM345CLKSOURCE_CLKP
  758. /**
  759. * @}
  760. */
  761. /** @defgroup RCCEx_LPTIM4_Clock_Source RCCEx LPTIM4 Clock Source
  762. * @{
  763. */
  764. #define RCC_LPTIM4CLKSOURCE_D3PCLK1 RCC_LPTIM345CLKSOURCE_D3PCLK1
  765. #define RCC_LPTIM4CLKSOURCE_PLL2 RCC_LPTIM345CLKSOURCE_PLL2
  766. #define RCC_LPTIM4CLKSOURCE_PLL3 RCC_LPTIM345CLKSOURCE_PLL3
  767. #define RCC_LPTIM4CLKSOURCE_LSE RCC_LPTIM345CLKSOURCE_LSE
  768. #define RCC_LPTIM4CLKSOURCE_LSI RCC_LPTIM345CLKSOURCE_LSI
  769. #define RCC_LPTIM4CLKSOURCE_CLKP RCC_LPTIM345CLKSOURCE_CLKP
  770. /**
  771. * @}
  772. */
  773. /** @defgroup RCCEx_LPTIM5_Clock_Source RCCEx LPTIM5 Clock Source
  774. * @{
  775. */
  776. #define RCC_LPTIM5CLKSOURCE_D3PCLK1 RCC_LPTIM345CLKSOURCE_D3PCLK1
  777. #define RCC_LPTIM5CLKSOURCE_PLL2 RCC_LPTIM345CLKSOURCE_PLL2
  778. #define RCC_LPTIM5CLKSOURCE_PLL3 RCC_LPTIM345CLKSOURCE_PLL3
  779. #define RCC_LPTIM5CLKSOURCE_LSE RCC_LPTIM345CLKSOURCE_LSE
  780. #define RCC_LPTIM5CLKSOURCE_LSI RCC_LPTIM345CLKSOURCE_LSI
  781. #define RCC_LPTIM5CLKSOURCE_CLKP RCC_LPTIM345CLKSOURCE_CLKP
  782. /**
  783. * @}
  784. */
  785. /** @defgroup RCCEx_QSPI_Clock_Source RCCEx QSPI Clock Source
  786. * @{
  787. */
  788. #define RCC_QSPICLKSOURCE_D1HCLK (0x00000000U)
  789. #define RCC_QSPICLKSOURCE_PLL RCC_D1CCIPR_QSPISEL_0
  790. #define RCC_QSPICLKSOURCE_PLL2 RCC_D1CCIPR_QSPISEL_1
  791. #define RCC_QSPICLKSOURCE_CLKP RCC_D1CCIPR_QSPISEL
  792. /**
  793. * @}
  794. */
  795. #if defined(DSI)
  796. /** @defgroup RCCEx_DSI_Clock_Source RCCEx DSI Clock Source
  797. * @{
  798. */
  799. #define RCC_DSICLKSOURCE_PHY (0x00000000U)
  800. #define RCC_DSICLKSOURCE_PLL2 RCC_D1CCIPR_DSISEL
  801. /**
  802. * @}
  803. */
  804. #endif /*DSI*/
  805. /** @defgroup RCCEx_FMC_Clock_Source RCCEx FMC Clock Source
  806. * @{
  807. */
  808. #define RCC_FMCCLKSOURCE_D1HCLK (0x00000000U)
  809. #define RCC_FMCCLKSOURCE_PLL RCC_D1CCIPR_FMCSEL_0
  810. #define RCC_FMCCLKSOURCE_PLL2 RCC_D1CCIPR_FMCSEL_1
  811. #define RCC_FMCCLKSOURCE_CLKP RCC_D1CCIPR_FMCSEL
  812. /**
  813. * @}
  814. */
  815. #if defined(FDCAN1) || defined(FDCAN2)
  816. /** @defgroup RCCEx_FDCAN_Clock_Source RCCEx FDCAN Clock Source
  817. * @{
  818. */
  819. #define RCC_FDCANCLKSOURCE_HSE (0x00000000U)
  820. #define RCC_FDCANCLKSOURCE_PLL RCC_D2CCIP1R_FDCANSEL_0
  821. #define RCC_FDCANCLKSOURCE_PLL2 RCC_D2CCIP1R_FDCANSEL_1
  822. /**
  823. * @}
  824. */
  825. #endif /*FDCAN1 || FDCAN2*/
  826. /** @defgroup RCCEx_SDMMC_Clock_Source RCCEx SDMMC Clock Source
  827. * @{
  828. */
  829. #define RCC_SDMMCCLKSOURCE_PLL (0x00000000U)
  830. #define RCC_SDMMCCLKSOURCE_PLL2 RCC_D1CCIPR_SDMMCSEL
  831. /**
  832. * @}
  833. */
  834. /** @defgroup RCCEx_ADC_Clock_Source RCCEx ADC Clock Source
  835. * @{
  836. */
  837. #define RCC_ADCCLKSOURCE_PLL2 (0x00000000U)
  838. #define RCC_ADCCLKSOURCE_PLL3 RCC_D3CCIPR_ADCSEL_0
  839. #define RCC_ADCCLKSOURCE_CLKP RCC_D3CCIPR_ADCSEL_1
  840. /**
  841. * @}
  842. */
  843. /** @defgroup RCCEx_SWPMI1_Clock_Source RCCEx SWPMI1 Clock Source
  844. * @{
  845. */
  846. #define RCC_SWPMI1CLKSOURCE_D2PCLK1 (0x00000000U)
  847. #define RCC_SWPMI1CLKSOURCE_HSI RCC_D2CCIP1R_SWPSEL
  848. /**
  849. * @}
  850. */
  851. /** @defgroup RCCEx_DFSDM1_Clock_Source RCCEx DFSDM1 Clock Source
  852. * @{
  853. */
  854. #define RCC_DFSDM1CLKSOURCE_D2PCLK1 (0x00000000U)
  855. #define RCC_DFSDM1CLKSOURCE_SYS RCC_D2CCIP1R_DFSDM1SEL
  856. /**
  857. * @}
  858. */
  859. /** @defgroup RCCEx_SPDIFRX_Clock_Source RCCEx SPDIFRX Clock Source
  860. * @{
  861. */
  862. #define RCC_SPDIFRXCLKSOURCE_PLL (0x00000000U)
  863. #define RCC_SPDIFRXCLKSOURCE_PLL2 RCC_D2CCIP1R_SPDIFSEL_0
  864. #define RCC_SPDIFRXCLKSOURCE_PLL3 RCC_D2CCIP1R_SPDIFSEL_1
  865. #define RCC_SPDIFRXCLKSOURCE_HSI RCC_D2CCIP1R_SPDIFSEL
  866. /**
  867. * @}
  868. */
  869. /** @defgroup RCCEx_CEC_Clock_Source RCCEx CEC Clock Source
  870. * @{
  871. */
  872. #define RCC_CECCLKSOURCE_LSE (0x00000000U)
  873. #define RCC_CECCLKSOURCE_LSI RCC_D2CCIP2R_CECSEL_0
  874. #define RCC_CECCLKSOURCE_CSI RCC_D2CCIP2R_CECSEL_1
  875. /**
  876. * @}
  877. */
  878. /** @defgroup RCCEx_CLKP_Clock_Source RCCEx CLKP Clock Source
  879. * @{
  880. */
  881. #define RCC_CLKPSOURCE_HSI (0x00000000U)
  882. #define RCC_CLKPSOURCE_CSI RCC_D1CCIPR_CKPERSEL_0
  883. #define RCC_CLKPSOURCE_HSE RCC_D1CCIPR_CKPERSEL_1
  884. /**
  885. * @}
  886. */
  887. /** @defgroup RCCEx_TIM_Prescaler_Selection RCCEx TIM Prescaler Selection
  888. * @{
  889. */
  890. #define RCC_TIMPRES_DESACTIVATED (0x00000000U)
  891. #define RCC_TIMPRES_ACTIVATED RCC_CFGR_TIMPRE
  892. /**
  893. * @}
  894. */
  895. #if defined(DUAL_CORE)
  896. /** @defgroup RCCEx_RCC_BootCx RCCEx RCC BootCx
  897. * @{
  898. */
  899. #define RCC_BOOT_C1 RCC_GCR_BOOT_C1
  900. #define RCC_BOOT_C2 RCC_GCR_BOOT_C2
  901. /**
  902. * @}
  903. */
  904. #endif /*DUAL_CORE*/
  905. #if defined(DUAL_CORE)
  906. /** @defgroup RCCEx_RCC_WWDGx RCCEx RCC WWDGx
  907. * @{
  908. */
  909. #define RCC_WWDG1 RCC_GCR_WW1RSC
  910. #define RCC_WWDG2 RCC_GCR_WW2RSC
  911. /**
  912. * @}
  913. */
  914. #else
  915. /** @defgroup RCCEx_RCC_WWDGx RCCEx RCC WWDGx
  916. * @{
  917. */
  918. #define RCC_WWDG1 RCC_GCR_WW1RSC
  919. /**
  920. * @}
  921. */
  922. #endif /*DUAL_CORE*/
  923. /** @defgroup RCCEx_CRS_Status RCCEx CRS Status
  924. * @{
  925. */
  926. #define RCC_CRS_NONE (0x00000000U)
  927. #define RCC_CRS_TIMEOUT (0x00000001U)
  928. #define RCC_CRS_SYNCOK (0x00000002U)
  929. #define RCC_CRS_SYNCWARN (0x00000004U)
  930. #define RCC_CRS_SYNCERR (0x00000008U)
  931. #define RCC_CRS_SYNCMISS (0x00000010U)
  932. #define RCC_CRS_TRIMOVF (0x00000020U)
  933. /**
  934. * @}
  935. */
  936. /** @defgroup RCCEx_CRS_SynchroSource RCCEx CRS SynchroSource
  937. * @{
  938. */
  939. #define RCC_CRS_SYNC_SOURCE_PIN (0x00000000U) /*!< Synchro Signal source external pin, Available on STM32H7 Rev.B and abobe devices only */
  940. #define RCC_CRS_SYNC_SOURCE_LSE CRS_CFGR_SYNCSRC_0 /*!< Synchro Signal source LSE */
  941. #define RCC_CRS_SYNC_SOURCE_USB1 CRS_CFGR_SYNCSRC_1 /*!< Synchro Signal source USB1 SOF (default) */
  942. #define RCC_CRS_SYNC_SOURCE_USB2 (CRS_CFGR_SYNCSRC_1|CRS_CFGR_SYNCSRC_0) /*!< Synchro Signal source USB2 SOF */
  943. /**
  944. * @}
  945. */
  946. /** @defgroup RCCEx_CRS_SynchroDivider RCCEx CRS SynchroDivider
  947. * @{
  948. */
  949. #define RCC_CRS_SYNC_DIV1 (0x00000000U) /*!< Synchro Signal not divided (default) */
  950. #define RCC_CRS_SYNC_DIV2 CRS_CFGR_SYNCDIV_0 /*!< Synchro Signal divided by 2 */
  951. #define RCC_CRS_SYNC_DIV4 CRS_CFGR_SYNCDIV_1 /*!< Synchro Signal divided by 4 */
  952. #define RCC_CRS_SYNC_DIV8 (CRS_CFGR_SYNCDIV_1 | CRS_CFGR_SYNCDIV_0) /*!< Synchro Signal divided by 8 */
  953. #define RCC_CRS_SYNC_DIV16 CRS_CFGR_SYNCDIV_2 /*!< Synchro Signal divided by 16 */
  954. #define RCC_CRS_SYNC_DIV32 (CRS_CFGR_SYNCDIV_2 | CRS_CFGR_SYNCDIV_0) /*!< Synchro Signal divided by 32 */
  955. #define RCC_CRS_SYNC_DIV64 (CRS_CFGR_SYNCDIV_2 | CRS_CFGR_SYNCDIV_1) /*!< Synchro Signal divided by 64 */
  956. #define RCC_CRS_SYNC_DIV128 CRS_CFGR_SYNCDIV /*!< Synchro Signal divided by 128 */
  957. /**
  958. * @}
  959. */
  960. /** @defgroup RCCEx_CRS_SynchroPolarity RCCEx CRS SynchroPolarity
  961. * @{
  962. */
  963. #define RCC_CRS_SYNC_POLARITY_RISING (0x00000000U) /*!< Synchro Active on rising edge (default) */
  964. #define RCC_CRS_SYNC_POLARITY_FALLING CRS_CFGR_SYNCPOL /*!< Synchro Active on falling edge */
  965. /**
  966. * @}
  967. */
  968. /** @defgroup RCCEx_CRS_ReloadValueDefault RCCEx CRS ReloadValueDefault
  969. * @{
  970. */
  971. #define RCC_CRS_RELOADVALUE_DEFAULT (0x0000BB7FU) /*!< The reset value of the RELOAD field corresponds
  972. to a target frequency of 48 MHz and a synchronization signal frequency of 1 kHz (SOF signal from USB). */
  973. /**
  974. * @}
  975. */
  976. /** @defgroup RCCEx_CRS_ErrorLimitDefault RCCEx CRS ErrorLimitDefault
  977. * @{
  978. */
  979. #define RCC_CRS_ERRORLIMIT_DEFAULT (0x00000022U) /*!< Default Frequency error limit */
  980. /**
  981. * @}
  982. */
  983. /** @defgroup RCCEx_CRS_HSI48CalibrationDefault RCCEx CRS HSI48CalibrationDefault
  984. * @{
  985. */
  986. #define RCC_CRS_HSI48CALIBRATION_DEFAULT (0x00000020U) /*!< The default value is 32, which corresponds to the middle of the trimming interval.
  987. The trimming step is around 67 kHz between two consecutive TRIM steps. A higher TRIM value
  988. corresponds to a higher output frequency */
  989. /**
  990. * @}
  991. */
  992. /** @defgroup RCCEx_CRS_FreqErrorDirection RCCEx CRS FreqErrorDirection
  993. * @{
  994. */
  995. #define RCC_CRS_FREQERRORDIR_UP (0x00000000U) /*!< Upcounting direction, the actual frequency is above the target */
  996. #define RCC_CRS_FREQERRORDIR_DOWN (CRS_ISR_FEDIR) /*!< Downcounting direction, the actual frequency is below the target */
  997. /**
  998. * @}
  999. */
  1000. /** @defgroup RCCEx_CRS_Interrupt_Sources RCCEx CRS Interrupt Sources
  1001. * @{
  1002. */
  1003. #define RCC_CRS_IT_SYNCOK CRS_CR_SYNCOKIE /*!< SYNC event OK */
  1004. #define RCC_CRS_IT_SYNCWARN CRS_CR_SYNCWARNIE /*!< SYNC warning */
  1005. #define RCC_CRS_IT_ERR CRS_CR_ERRIE /*!< Error */
  1006. #define RCC_CRS_IT_ESYNC CRS_CR_ESYNCIE /*!< Expected SYNC */
  1007. #define RCC_CRS_IT_SYNCERR CRS_CR_ERRIE /*!< SYNC error */
  1008. #define RCC_CRS_IT_SYNCMISS CRS_CR_ERRIE /*!< SYNC missed */
  1009. #define RCC_CRS_IT_TRIMOVF CRS_CR_ERRIE /*!< Trimming overflow or underflow */
  1010. /**
  1011. * @}
  1012. */
  1013. /** @defgroup RCCEx_CRS_Flags RCCEx CRS Flags
  1014. * @{
  1015. */
  1016. #define RCC_CRS_FLAG_SYNCOK CRS_ISR_SYNCOKF /*!< SYNC event OK flag */
  1017. #define RCC_CRS_FLAG_SYNCWARN CRS_ISR_SYNCWARNF /*!< SYNC warning flag */
  1018. #define RCC_CRS_FLAG_ERR CRS_ISR_ERRF /*!< Error flag */
  1019. #define RCC_CRS_FLAG_ESYNC CRS_ISR_ESYNCF /*!< Expected SYNC flag */
  1020. #define RCC_CRS_FLAG_SYNCERR CRS_ISR_SYNCERR /*!< SYNC error */
  1021. #define RCC_CRS_FLAG_SYNCMISS CRS_ISR_SYNCMISS /*!< SYNC missed*/
  1022. #define RCC_CRS_FLAG_TRIMOVF CRS_ISR_TRIMOVF /*!< Trimming overflow or underflow */
  1023. /**
  1024. * @}
  1025. */
  1026. /**
  1027. * @}
  1028. */
  1029. /* Exported macro ------------------------------------------------------------*/
  1030. /** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros
  1031. * @{
  1032. */
  1033. /** @brief Macros to enable or disable PLL2.
  1034. * @note After enabling PLL2, the application software should wait on
  1035. * PLL2RDY flag to be set indicating that PLL2 clock is stable and can
  1036. * be used as kernel clock source.
  1037. * @note PLL2 is disabled by hardware when entering STOP and STANDBY modes.
  1038. */
  1039. #define __HAL_RCC_PLL2_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLL2ON)
  1040. #define __HAL_RCC_PLL2_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLL2ON)
  1041. /**
  1042. * @brief Enables or disables each clock output (PLL2_P_CLK, PLL2_Q_CLK, PLL2_R_CLK)
  1043. * @note Enabling/disabling those Clocks can be done only when the PLL2 is disabled,
  1044. * This is mainly used to save Power.
  1045. * @param __RCC_PLL2ClockOut__ Specifies the PLL2 clock to be outputted
  1046. * This parameter can be one of the following values:
  1047. * @arg RCC_PLL2_DIVP: This clock is used to generate system clock (up to 400MHZ)
  1048. * @arg RCC_PLL2_DIVQ: This clock is used to generate peripherals clock (up to 400MHZ)
  1049. * @arg RCC_PLL2_DIVR: This clock is used to generate peripherals clock (up to 400MHZ)
  1050. * @retval None
  1051. */
  1052. #define __HAL_RCC_PLL2CLKOUT_ENABLE(__RCC_PLL2ClockOut__) SET_BIT(RCC->PLLCFGR, (__RCC_PLL2ClockOut__))
  1053. #define __HAL_RCC_PLL2CLKOUT_DISABLE(__RCC_PLL2ClockOut__) CLEAR_BIT(RCC->PLLCFGR, (__RCC_PLL2ClockOut__))
  1054. /**
  1055. * @brief Enables or disables Fractional Part Of The Multiplication Factor of PLL2 VCO
  1056. * @note Enabling/disabling Fractional Part can be any time without the need to stop the PLL2
  1057. * @retval None
  1058. */
  1059. #define __HAL_RCC_PLL2FRACN_ENABLE() SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL2FRACEN)
  1060. #define __HAL_RCC_PLL2FRACN_DISABLE() CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL2FRACEN)
  1061. /**
  1062. * @brief Macro to configures the PLL2 multiplication and division factors.
  1063. * @note This function must be used only when PLL2 is disabled.
  1064. *
  1065. * @param __PLL2M__ specifies the division factor for PLL2 VCO input clock
  1066. * This parameter must be a number between 1 and 63.
  1067. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  1068. * frequency ranges from 1 to 16 MHz.
  1069. *
  1070. * @param __PLL2N__ specifies the multiplication factor for PLL2 VCO output clock
  1071. * This parameter must be a number between 4 and 512.
  1072. * @note You have to set the PLL2N parameter correctly to ensure that the VCO
  1073. * output frequency is between 150 and 420 MHz (when in medium VCO range) or
  1074. * between 192 and 836 MHZ (when in wide VCO range)
  1075. *
  1076. * @param __PLL2P__ specifies the division factor for peripheral kernel clocks
  1077. * This parameter must be a number between 2 and 128 (where odd numbers not allowed)
  1078. *
  1079. * @param __PLL2Q__ specifies the division factor for peripheral kernel clocks
  1080. * This parameter must be a number between 1 and 128
  1081. *
  1082. * @param __PLL2R__ specifies the division factor for peripheral kernel clocks
  1083. * This parameter must be a number between 1 and 128
  1084. *
  1085. * @retval None
  1086. */
  1087. #define __HAL_RCC_PLL2_CONFIG(__PLL2M__, __PLL2N__, __PLL2P__, __PLL2Q__,__PLL2R__ ) \
  1088. do{ MODIFY_REG(RCC->PLLCKSELR, ( RCC_PLLCKSELR_DIVM2) , ( (__PLL2M__) <<12U)); \
  1089. WRITE_REG (RCC->PLL2DIVR , ( (((__PLL2N__) - 1U ) & RCC_PLL2DIVR_N2) | ((((__PLL2P__) -1U ) << 9U) & RCC_PLL2DIVR_P2) | \
  1090. ((((__PLL2Q__) -1U) << 16U) & RCC_PLL2DIVR_Q2) | ((((__PLL2R__)- 1U) << 24U) & RCC_PLL2DIVR_R2))); \
  1091. } while(0)
  1092. /**
  1093. * @brief Macro to configures PLL2 clock Fractional Part Of The Multiplication Factor
  1094. *
  1095. * @note These bits can be written at any time, allowing dynamic fine-tuning of the PLL2 VCO
  1096. *
  1097. * @param __RCC_PLL2FRACN__ Specifies Fractional Part Of The Multiplication factor for PLL2 VCO
  1098. * It should be a value between 0 and 8191
  1099. * @note Warning: the software has to set correctly these bits to insure that the VCO
  1100. * output frequency is between its valid frequency range, which is:
  1101. * 192 to 836 MHz if PLL2VCOSEL = 0
  1102. * 150 to 420 MHz if PLL2VCOSEL = 1.
  1103. *
  1104. *
  1105. * @retval None
  1106. */
  1107. #define __HAL_RCC_PLL2FRACN_CONFIG(__RCC_PLL2FRACN__) MODIFY_REG(RCC->PLL2FRACR, RCC_PLL2FRACR_FRACN2,(uint32_t)(__RCC_PLL2FRACN__) << RCC_PLL2FRACR_FRACN2_Pos)
  1108. /** @brief Macro to select the PLL2 reference frequency range.
  1109. * @param __RCC_PLL2VCIRange__ specifies the PLL2 input frequency range
  1110. * This parameter can be one of the following values:
  1111. * @arg RCC_PLL2VCIRANGE_0: Range frequency is between 1 and 2 MHz
  1112. * @arg RCC_PLL2VCIRANGE_1: Range frequency is between 2 and 4 MHz
  1113. * @arg RCC_PLL2VCIRANGE_2: Range frequency is between 4 and 8 MHz
  1114. * @arg RCC_PLL2VCIRANGE_3: Range frequency is between 8 and 16 MHz
  1115. * @retval None
  1116. */
  1117. #define __HAL_RCC_PLL2_VCIRANGE(__RCC_PLL2VCIRange__) \
  1118. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL2RGE, (__RCC_PLL2VCIRange__))
  1119. /** @brief Macro to select the PLL2 reference frequency range.
  1120. * @param __RCC_PLL2VCORange__ Specifies the PLL2 input frequency range
  1121. * This parameter can be one of the following values:
  1122. * @arg RCC_PLL2VCOWIDE: Range frequency is between 192 and 836 MHz
  1123. * @arg RCC_PLL2VCOMEDIUM: Range frequency is between 150 and 420 MHz
  1124. * @retval None
  1125. */
  1126. #define __HAL_RCC_PLL2_VCORANGE(__RCC_PLL2VCORange__) \
  1127. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL2VCOSEL, (__RCC_PLL2VCORange__))
  1128. /** @brief Macros to enable or disable the main PLL3.
  1129. * @note After enabling PLL3, the application software should wait on
  1130. * PLL3RDY flag to be set indicating that PLL3 clock is stable and can
  1131. * be used as kernel clock source.
  1132. * @note PLL3 is disabled by hardware when entering STOP and STANDBY modes.
  1133. */
  1134. #define __HAL_RCC_PLL3_ENABLE() SET_BIT(RCC->CR, RCC_CR_PLL3ON)
  1135. #define __HAL_RCC_PLL3_DISABLE() CLEAR_BIT(RCC->CR, RCC_CR_PLL3ON)
  1136. /**
  1137. * @brief Enables or disables Fractional Part Of The Multiplication Factor of PLL3 VCO
  1138. * @note Enabling/disabling Fractional Part can be any time without the need to stop the PLL3
  1139. * @retval None
  1140. */
  1141. #define __HAL_RCC_PLL3FRACN_ENABLE() SET_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL3FRACEN)
  1142. #define __HAL_RCC_PLL3FRACN_DISABLE() CLEAR_BIT(RCC->PLLCFGR, RCC_PLLCFGR_PLL3FRACEN)
  1143. /**
  1144. * @brief Enables or disables each clock output (PLL3_P_CLK, PLL3_Q_CLK, PLL3_R_CLK)
  1145. * @note Enabling/disabling those Clocks can be done only when the PLL3 is disabled,
  1146. * This is mainly used to save Power.
  1147. * @param __RCC_PLL3ClockOut__ specifies the PLL3 clock to be outputted
  1148. * This parameter can be one of the following values:
  1149. * @arg RCC_PLL3_DIVP: This clock is used to generate system clock (up to 400MHZ)
  1150. * @arg RCC_PLL3_DIVQ: This clock is used to generate peripherals clock (up to 400MHZ)
  1151. * @arg RCC_PLL3_DIVR: This clock is used to generate peripherals clock (up to 400MHZ)
  1152. * @retval None
  1153. */
  1154. #define __HAL_RCC_PLL3CLKOUT_ENABLE(__RCC_PLL3ClockOut__) SET_BIT(RCC->PLLCFGR, (__RCC_PLL3ClockOut__))
  1155. #define __HAL_RCC_PLL3CLKOUT_DISABLE(__RCC_PLL3ClockOut__) CLEAR_BIT(RCC->PLLCFGR, (__RCC_PLL3ClockOut__))
  1156. /**
  1157. * @brief Macro to configures the PLL3 multiplication and division factors.
  1158. * @note This function must be used only when PLL3 is disabled.
  1159. *
  1160. * @param __PLL3M__ specifies the division factor for PLL3 VCO input clock
  1161. * This parameter must be a number between 1 and 63.
  1162. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  1163. * frequency ranges from 1 to 16 MHz.
  1164. *
  1165. * @param __PLL3N__ specifies the multiplication factor for PLL3 VCO output clock
  1166. * This parameter must be a number between 4 and 512.
  1167. * @note You have to set the PLL3N parameter correctly to ensure that the VCO
  1168. * output frequency is between 150 and 420 MHz (when in medium VCO range) or
  1169. * between 192 and 836 MHZ (when in wide VCO range)
  1170. *
  1171. * @param __PLL3P__ specifies the division factor for peripheral kernel clocks
  1172. * This parameter must be a number between 2 and 128 (where odd numbers not allowed)
  1173. *
  1174. * @param __PLL3Q__ specifies the division factor for peripheral kernel clocks
  1175. * This parameter must be a number between 1 and 128
  1176. *
  1177. * @param __PLL3R__ specifies the division factor for peripheral kernel clocks
  1178. * This parameter must be a number between 1 and 128
  1179. *
  1180. * @retval None
  1181. */
  1182. #define __HAL_RCC_PLL3_CONFIG(__PLL3M__, __PLL3N__, __PLL3P__, __PLL3Q__,__PLL3R__ ) \
  1183. do{ MODIFY_REG(RCC->PLLCKSELR, ( RCC_PLLCKSELR_DIVM3) , ( (__PLL3M__) <<20U)); \
  1184. WRITE_REG (RCC->PLL3DIVR , ( (((__PLL3N__) - 1U ) & RCC_PLL3DIVR_N3) | ((((__PLL3P__) -1U ) << 9U) & RCC_PLL3DIVR_P3) | \
  1185. ((((__PLL3Q__) -1U) << 16U) & RCC_PLL3DIVR_Q3) | ((((__PLL3R__) - 1U) << 24U) & RCC_PLL3DIVR_R3))); \
  1186. } while(0)
  1187. /**
  1188. * @brief Macro to configures PLL3 clock Fractional Part of The Multiplication Factor
  1189. *
  1190. * @note These bits can be written at any time, allowing dynamic fine-tuning of the PLL3 VCO
  1191. *
  1192. * @param __RCC_PLL3FRACN__ specifies Fractional Part Of The Multiplication Factor for PLL3 VCO
  1193. * It should be a value between 0 and 8191
  1194. * @note Warning: the software has to set correctly these bits to insure that the VCO
  1195. * output frequency is between its valid frequency range, which is:
  1196. * 192 to 836 MHz if PLL3VCOSEL = 0
  1197. * 150 to 420 MHz if PLL3VCOSEL = 1.
  1198. *
  1199. *
  1200. * @retval None
  1201. */
  1202. #define __HAL_RCC_PLL3FRACN_CONFIG(__RCC_PLL3FRACN__) MODIFY_REG(RCC->PLL3FRACR, RCC_PLL3FRACR_FRACN3, (uint32_t)(__RCC_PLL3FRACN__) << RCC_PLL3FRACR_FRACN3_Pos)
  1203. /** @brief Macro to select the PLL3 reference frequency range.
  1204. * @param __RCC_PLL3VCIRange__ specifies the PLL1 input frequency range
  1205. * This parameter can be one of the following values:
  1206. * @arg RCC_PLL3VCIRANGE_0: Range frequency is between 1 and 2 MHz
  1207. * @arg RCC_PLL3VCIRANGE_1: Range frequency is between 2 and 4 MHz
  1208. * @arg RCC_PLL3VCIRANGE_2: Range frequency is between 4 and 8 MHz
  1209. * @arg RCC_PLL3VCIRANGE_3: Range frequency is between 8 and 16 MHz
  1210. * @retval None
  1211. */
  1212. #define __HAL_RCC_PLL3_VCIRANGE(__RCC_PLL3VCIRange__) \
  1213. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL3RGE, (__RCC_PLL3VCIRange__))
  1214. /** @brief Macro to select the PLL3 reference frequency range.
  1215. * @param __RCC_PLL3VCORange__ specifies the PLL1 input frequency range
  1216. * This parameter can be one of the following values:
  1217. * @arg RCC_PLL3VCOWIDE: Range frequency is between 192 and 836 MHz
  1218. * @arg RCC_PLL3VCOMEDIUM: Range frequency is between 150 and 420 MHz
  1219. * @retval None
  1220. */
  1221. #define __HAL_RCC_PLL3_VCORANGE(__RCC_PLL3VCORange__) \
  1222. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLL3VCOSEL, (__RCC_PLL3VCORange__))
  1223. /**
  1224. * @brief Macro to Configure the SAI1 clock source.
  1225. * @param __RCC_SAI1CLKSource__ defines the SAI1 clock source. This clock is derived
  1226. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  1227. * This parameter can be one of the following values:
  1228. * @arg RCC_SAI1CLKSOURCE_PLL: SAI1 clock = PLL
  1229. * @arg RCC_SAI1CLKSOURCE_PLL2: SAI1 clock = PLL2
  1230. * @arg RCC_SAI1CLKSOURCE_PLL3: SAI1 clock = PLL3
  1231. * @arg RCC_SAI1CLKSOURCE_OSC: SAI1 clock = OSC
  1232. * @arg RCC_SAI1CLKSOURCE_PIN: SAI1 clock = External Clock
  1233. * @retval None
  1234. */
  1235. #define __HAL_RCC_SAI1_CONFIG(__RCC_SAI1CLKSource__ )\
  1236. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SAI1SEL, (__RCC_SAI1CLKSource__))
  1237. /** @brief Macro to get the SAI1 clock source.
  1238. * @retval The clock source can be one of the following values:
  1239. * @arg RCC_SAI1CLKSOURCE_PLL: SAI1 clock = PLL
  1240. * @arg RCC_SAI1CLKSOURCE_PLL2: SAI1 clock = PLL2
  1241. * @arg RCC_SAI1CLKSOURCE_PLL3: SAI1 clock = PLL3
  1242. * @arg RCC_SAI1CLKSOURCE_CLKP: SAI1 clock = CLKP
  1243. * @arg RCC_SAI1CLKSOURCE_PIN: SAI1 clock = External Clock
  1244. */
  1245. #define __HAL_RCC_GET_SAI1_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SAI1SEL)))
  1246. /**
  1247. * @brief Macro to Configure the SPDIFRX clock source.
  1248. * @param __RCC_SPDIFCLKSource__ defines the SPDIFRX clock source. This clock is derived
  1249. * from system PLL, PLL2, PLL3, or internal OSC clock
  1250. * This parameter can be one of the following values:
  1251. * @arg RCC_SPDIFRXCLKSOURCE_PLL: SPDIFRX clock = PLL
  1252. * @arg RCC_SPDIFRXCLKSOURCE_PLL2: SPDIFRX clock = PLL2
  1253. * @arg RCC_SPDIFRXCLKSOURCE_PLL3: SPDIFRX clock = PLL3
  1254. * @arg RCC_SPDIFRXCLKSOURCE_HSI: SPDIFRX clock = HSI
  1255. * @retval None
  1256. */
  1257. #define __HAL_RCC_SPDIFRX_CONFIG(__RCC_SPDIFCLKSource__ )\
  1258. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SPDIFSEL, (__RCC_SPDIFCLKSource__))
  1259. /**
  1260. * @brief Macro to get the SPDIFRX clock source.
  1261. * @retval None
  1262. */
  1263. #define __HAL_RCC_GET_SPDIFRX_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SPDIFSEL)))
  1264. /**
  1265. * @brief Macro to Configure the SAI2/3 clock source.
  1266. * @param __RCC_SAI23CLKSource__ defines the SAI2/3 clock source. This clock is derived
  1267. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  1268. * This parameter can be one of the following values:
  1269. * @arg RCC_SAI23CLKSOURCE_PLL: SAI2/3 clock = PLL
  1270. * @arg RCC_SAI23CLKSOURCE_PLL2: SAI2/3 clock = PLL2
  1271. * @arg RCC_SAI23CLKSOURCE_PLL3: SAI2/3 clock = PLL3
  1272. * @arg RCC_SAI23CLKSOURCE_CLKP: SAI2/3 clock = CLKP
  1273. * @arg RCC_SAI23CLKSOURCE_PIN: SAI2/3 clock = External Clock
  1274. * @retval None
  1275. */
  1276. #define __HAL_RCC_SAI23_CONFIG(__RCC_SAI23CLKSource__ )\
  1277. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SAI23SEL, (__RCC_SAI23CLKSource__))
  1278. /** @brief Macro to get the SAI2/3 clock source.
  1279. * @retval The clock source can be one of the following values:
  1280. * @arg RCC_SAI23CLKSOURCE_PLL: SAI2/3 clock = PLL
  1281. * @arg RCC_SAI23CLKSOURCE_PLL2: SAI2/3 clock = PLL2
  1282. * @arg RCC_SAI23CLKSOURCE_PLL3: SAI2/3 clock = PLL3
  1283. * @arg RCC_SAI23CLKSOURCE_CLKP: SAI2/3 clock = CLKP
  1284. * @arg RCC_SAI23CLKSOURCE_PIN: SAI2/3 clock = External Clock
  1285. */
  1286. #define __HAL_RCC_GET_SAI23_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SAI23SEL)))
  1287. /**
  1288. * @brief Macro to Configure the SAI2 clock source.
  1289. * @param __RCC_SAI2CLKSource__ defines the SAI2 clock source. This clock is derived
  1290. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  1291. * This parameter can be one of the following values:
  1292. * @arg RCC_SAI2CLKSOURCE_PLL: SAI2 clock = PLL
  1293. * @arg RCC_SAI2CLKSOURCE_PLL2: SAI2 clock = PLL2
  1294. * @arg RCC_SAI2CLKSOURCE_PLL3: SAI2 clock = PLL3
  1295. * @arg RCC_SAI2CLKSOURCE_CLKP: SAI2 clock = CLKP
  1296. * @arg RCC_SAI2CLKSOURCE_PIN: SAI2 clock = External Clock
  1297. * @retval None
  1298. */
  1299. #define __HAL_RCC_SAI2_CONFIG(__RCC_SAI2CLKSource__ )\
  1300. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SAI23SEL, (__RCC_SAI2CLKSource__))
  1301. /** @brief Macro to get the SAI2 clock source.
  1302. * @retval The clock source can be one of the following values:
  1303. * @arg RCC_SAI2CLKSOURCE_PLL: SAI2 clock = PLL
  1304. * @arg RCC_SAI2CLKSOURCE_PLL2: SAI2 clock = PLL2
  1305. * @arg RCC_SAI2CLKSOURCE_PLL3: SAI2 clock = PLL3
  1306. * @arg RCC_SAI2CLKSOURCE_CLKP: SAI2 clock = CLKP
  1307. * @arg RCC_SAI2CLKSOURCE_PIN: SAI2 clock = External Clock
  1308. */
  1309. #define __HAL_RCC_GET_SAI2_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SAI23SEL)))
  1310. /**
  1311. * @brief Macro to Configure the SAI3 clock source.
  1312. * @param __RCC_SAI3CLKSource__ defines the SAI3 clock source. This clock is derived
  1313. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  1314. * This parameter can be one of the following values:
  1315. * @arg RCC_SAI3CLKSOURCE_PLL: SAI3 clock = PLL
  1316. * @arg RCC_SAI3CLKSOURCE_PLL2: SAI3 clock = PLL2
  1317. * @arg RCC_SAI3CLKSOURCE_PLL3: SAI3 clock = PLL3
  1318. * @arg RCC_SAI3CLKSOURCE_CLKP: SAI3 clock = CLKP
  1319. * @arg RCC_SAI3CLKSOURCE_PIN: SAI3 clock = External Clock
  1320. * @retval None
  1321. */
  1322. #define __HAL_RCC_SAI3_CONFIG(__RCC_SAI3CLKSource__ )\
  1323. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SAI23SEL, (__RCC_SAI3CLKSource__))
  1324. /** @brief Macro to get the SAI3 clock source.
  1325. * @retval The clock source can be one of the following values:
  1326. * @arg RCC_SAI3CLKSOURCE_PLL: SAI3 clock = PLL
  1327. * @arg RCC_SAI3CLKSOURCE_PLL2: SAI3 clock = PLL2
  1328. * @arg RCC_SAI3CLKSOURCE_PLL3: SAI3 clock = PLL3
  1329. * @arg RCC_SAI3CLKSOURCE_CLKP: SAI3 clock = CLKP
  1330. * @arg RCC_SAI3CLKSOURCE_PIN: SAI3 clock = External Clock
  1331. */
  1332. #define __HAL_RCC_GET_SAI3_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SAI23SEL)))
  1333. /**
  1334. * @brief Macro to Configure the SAI4A clock source.
  1335. * @param __RCC_SAI4ACLKSource__ defines the SAI4A clock source. This clock is derived
  1336. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  1337. * This parameter can be one of the following values:
  1338. * @arg RCC_SAI4ACLKSOURCE_PLL: SAI4A clock = PLL
  1339. * @arg RCC_SAI4ACLKSOURCE_PLL2: SAI4A clock = PLL2
  1340. * @arg RCC_SAI4ACLKSOURCE_PLL3: SAI4A clock = PLL3
  1341. * @arg RCC_SAI4ACLKSOURCE_CLKP: SAI4A clock = CLKP
  1342. * @arg RCC_SAI4ACLKSOURCE_PIN: SAI4A clock = External Clock
  1343. * @retval None
  1344. */
  1345. #define __HAL_RCC_SAI4A_CONFIG(__RCC_SAI4ACLKSource__ )\
  1346. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_SAI4ASEL, (__RCC_SAI4ACLKSource__))
  1347. /** @brief Macro to get the SAI4A clock source.
  1348. * @retval The clock source can be one of the following values:
  1349. * @arg RCC_SAI4ACLKSOURCE_PLL: SAI4B clock = PLL
  1350. * @arg RCC_SAI4ACLKSOURCE_PLL2: SAI4B clock = PLL2
  1351. * @arg RCC_SAI4ACLKSOURCE_PLL3: SAI4B clock = PLL3
  1352. * @arg RCC_SAI4ACLKSOURCE_CLKP: SAI4B clock = CLKP
  1353. * @arg RCC_SAI4ACLKSOURCE_PIN: SAI4B clock = External Clock
  1354. */
  1355. #define __HAL_RCC_GET_SAI4A_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_SAI4ASEL)))
  1356. /**
  1357. * @brief Macro to Configure the SAI4B clock source.
  1358. * @param __RCC_SAI4BCLKSource__ defines the SAI4B clock source. This clock is derived
  1359. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  1360. * This parameter can be one of the following values:
  1361. * @arg RCC_SAI4BCLKSOURCE_PLL: SAI4B clock = PLL
  1362. * @arg RCC_SAI4BCLKSOURCE_PLL2: SAI4B clock = PLL2
  1363. * @arg RCC_SAI4BCLKSOURCE_PLL3: SAI4B clock = PLL3
  1364. * @arg RCC_SAI4BCLKSOURCE_CLKP: SAI4B clock = CLKP
  1365. * @arg RCC_SAI4BCLKSOURCE_PIN: SAI4B clock = External Clock
  1366. * @retval None
  1367. */
  1368. #define __HAL_RCC_SAI4B_CONFIG(__RCC_SAI4BCLKSource__ )\
  1369. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_SAI4BSEL, (__RCC_SAI4BCLKSource__))
  1370. /** @brief Macro to get the SAI4B clock source.
  1371. * @retval The clock source can be one of the following values:
  1372. * @arg RCC_SAI4BCLKSOURCE_PLL: SAI4B clock = PLL
  1373. * @arg RCC_SAI4BCLKSOURCE_PLL2: SAI4B clock = PLL2
  1374. * @arg RCC_SAI4BCLKSOURCE_PLL3: SAI4B clock = PLL3
  1375. * @arg RCC_SAI4BCLKSOURCE_CLKP: SAI4B clock = CLKP
  1376. * @arg RCC_SAI4BCLKSOURCE_PIN: SAI4B clock = External Clock
  1377. */
  1378. #define __HAL_RCC_GET_SAI4B_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_SAI4BSEL)))
  1379. /** @brief macro to configure the I2C1/2/3 clock (I2C123CLK).
  1380. *
  1381. * @param __I2C123CLKSource__ specifies the I2C1/2/3 clock source.
  1382. * This parameter can be one of the following values:
  1383. * @arg RCC_I2C123CLKSOURCE_D2PCLK1: D2PCLK1 selected as I2C1/2/3 clock
  1384. * @arg RCC_I2C123CLKSOURCE_PLL3: PLL3 selected as I2C1/2/3 clock
  1385. * @arg RCC_I2C123CLKSOURCE_HSI: HSI selected as I2C1/2/3 clock
  1386. * @arg RCC_I2C123CLKSOURCE_CSI: CSI selected as I2C1/2/3 clock
  1387. */
  1388. #define __HAL_RCC_I2C123_CONFIG(__I2C123CLKSource__) \
  1389. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_I2C123SEL, (uint32_t)(__I2C123CLKSource__))
  1390. /** @brief macro to get the I2C1/2/3 clock source.
  1391. * @retval The clock source can be one of the following values:
  1392. * @arg RCC_I2C123CLKSOURCE_D2PCLK1: D2PCLK1 selected as I2C1/2/3 clock
  1393. * @arg RCC_I2C123CLKSOURCE_PLL3: PLL3 selected as I2C1/2/3 clock
  1394. * @arg RCC_I2C123CLKSOURCE_HSI: HSI selected as I2C1/2/3 clock
  1395. * @arg RCC_I2C123CLKSOURCE_CSI: CSI selected as I2C1/2/3 clock
  1396. */
  1397. #define __HAL_RCC_GET_I2C123_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_I2C123SEL)))
  1398. /** @brief macro to configure the I2C1 clock (I2C1CLK).
  1399. *
  1400. * @param __I2C1CLKSource__ specifies the I2C1 clock source.
  1401. * This parameter can be one of the following values:
  1402. * @arg RCC_I2C1CLKSOURCE_D2PCLK1: D2PCLK1 selected as I2C1 clock
  1403. * @arg RCC_I2C1CLKSOURCE_PLL3: PLL3 selected as I2C1 clock
  1404. * @arg RCC_I2C1CLKSOURCE_HSI: HSI selected as I2C1 clock
  1405. * @arg RCC_I2C1CLKSOURCE_CSI: CSI selected as I2C1 clock
  1406. */
  1407. #define __HAL_RCC_I2C1_CONFIG(__I2C1CLKSource__) \
  1408. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_I2C123SEL, (uint32_t)(__I2C1CLKSource__))
  1409. /** @brief macro to get the I2C1 clock source.
  1410. * @retval The clock source can be one of the following values:
  1411. * @arg RCC_I2C1CLKSOURCE_D2PCLK1: D2PCLK1 selected as I2C1 clock
  1412. * @arg RCC_I2C1CLKSOURCE_PLL3: PLL3 selected as I2C1 clock
  1413. * @arg RCC_I2C1CLKSOURCE_HSI: HSI selected as I2C1 clock
  1414. * @arg RCC_I2C1CLKSOURCE_CSI: CSI selected as I2C1 clock
  1415. */
  1416. #define __HAL_RCC_GET_I2C1_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_I2C123SEL)))
  1417. /** @brief macro to configure the I2C2 clock (I2C2CLK).
  1418. *
  1419. * @param __I2C2CLKSource__ specifies the I2C2 clock source.
  1420. * This parameter can be one of the following values:
  1421. * @arg RCC_I2C2CLKSOURCE_D2PCLK1: D2PCLK1 selected as I2C2 clock
  1422. * @arg RCC_I2C2CLKSOURCE_PLL3: PLL3 selected as I2C2 clock
  1423. * @arg RCC_I2C2CLKSOURCE_HSI: HSI selected as I2C2 clock
  1424. * @arg RCC_I2C2CLKSOURCE_CSI: CSI selected as I2C2 clock
  1425. */
  1426. #define __HAL_RCC_I2C2_CONFIG(__I2C2CLKSource__) \
  1427. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_I2C123SEL, (uint32_t)(__I2C2CLKSource__))
  1428. /** @brief macro to get the I2C2 clock source.
  1429. * @retval The clock source can be one of the following values:
  1430. * @arg RCC_I2C2CLKSOURCE_D2PCLK1: D2PCLK1 selected as I2C2 clock
  1431. * @arg RCC_I2C2CLKSOURCE_PLL3: PLL3 selected as I2C2 clock
  1432. * @arg RCC_I2C2CLKSOURCE_HSI: HSI selected as I2C2 clock
  1433. * @arg RCC_I2C2CLKSOURCE_CSI: CSI selected as I2C2 clock
  1434. */
  1435. #define __HAL_RCC_GET_I2C2_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_I2C123SEL)))
  1436. /** @brief macro to configure the I2C3 clock (I2C3CLK).
  1437. *
  1438. * @param __I2C3CLKSource__ specifies the I2C3 clock source.
  1439. * This parameter can be one of the following values:
  1440. * @arg RCC_I2C3CLKSOURCE_D2PCLK1: D2PCLK1 selected as I2C3 clock
  1441. * @arg RCC_I2C3CLKSOURCE_PLL3: PLL3 selected as I2C3 clock
  1442. * @arg RCC_I2C3CLKSOURCE_HSI: HSI selected as I2C3 clock
  1443. * @arg RCC_I2C3CLKSOURCE_CSI: CSI selected as I2C3 clock
  1444. */
  1445. #define __HAL_RCC_I2C3_CONFIG(__I2C3CLKSource__) \
  1446. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_I2C123SEL, (uint32_t)(__I2C3CLKSource__))
  1447. /** @brief macro to get the I2C3 clock source.
  1448. * @retval The clock source can be one of the following values:
  1449. * @arg RCC_I2C3CLKSOURCE_D2PCLK1: D2PCLK1 selected as I2C3 clock
  1450. * @arg RCC_I2C3CLKSOURCE_PLL3: PLL3 selected as I2C3 clock
  1451. * @arg RCC_I2C3CLKSOURCE_HSI: HSI selected as I2C3 clock
  1452. * @arg RCC_I2C3CLKSOURCE_CSI: CSI selected as I2C3 clock
  1453. */
  1454. #define __HAL_RCC_GET_I2C3_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_I2C123SEL)))
  1455. /** @brief macro to configure the I2C4 clock (I2C4CLK).
  1456. *
  1457. * @param __I2C4CLKSource__ specifies the I2C4 clock source.
  1458. * This parameter can be one of the following values:
  1459. * @arg RCC_I2C4CLKSOURCE_D3PCLK1: D3PCLK1 selected as I2C4 clock
  1460. * @arg RCC_I2C4CLKSOURCE_PLL3: PLL3 selected as I2C4 clock
  1461. * @arg RCC_I2C4CLKSOURCE_HSI: HSI selected as I2C4 clock
  1462. * @arg RCC_I2C4CLKSOURCE_CSI: CSI selected as I2C4 clock
  1463. */
  1464. #define __HAL_RCC_I2C4_CONFIG(__I2C4CLKSource__) \
  1465. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_I2C4SEL, (uint32_t)(__I2C4CLKSource__))
  1466. /** @brief macro to get the I2C4 clock source.
  1467. * @retval The clock source can be one of the following values:
  1468. * @arg RCC_I2C4CLKSOURCE_D3PCLK1: D3PCLK1 selected as I2C4 clock
  1469. * @arg RCC_I2C4CLKSOURCE_PLL3: PLL3 selected as I2C4 clock
  1470. * @arg RCC_I2C4CLKSOURCE_HSI: HSI selected as I2C4 clock
  1471. * @arg RCC_I2C4CLKSOURCE_CSI: CSI selected as I2C4 clock
  1472. */
  1473. #define __HAL_RCC_GET_I2C4_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_I2C4SEL)))
  1474. /** @brief macro to configure the USART1/6 clock (USART16CLK).
  1475. *
  1476. * @param __USART16CLKSource__ specifies the USART1/6 clock source.
  1477. * This parameter can be one of the following values:
  1478. * @arg RCC_USART16CLKSOURCE_D2PCLK2: APB2 Clock selected as USART1/6 clock
  1479. * @arg RCC_USART16CLKSOURCE_PLL2: PLL2_Q Clock selected as USART1/6 clock
  1480. * @arg RCC_USART16CLKSOURCE_PLL3: PLL3_Q Clock selected as USART1/6 clock
  1481. * @arg RCC_USART16CLKSOURCE_HSI: HSI selected as USART1/6 clock
  1482. * @arg RCC_USART16CLKSOURCE_CSI: CSI Clock selected as USART1/6 clock
  1483. * @arg RCC_USART16CLKSOURCE_LSE: LSE selected as USART1/6 clock
  1484. */
  1485. #define __HAL_RCC_USART16_CONFIG(__USART16CLKSource__) \
  1486. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART16SEL, (uint32_t)(__USART16CLKSource__))
  1487. /** @brief macro to get the USART1/6 clock source.
  1488. * @retval The clock source can be one of the following values:
  1489. * @arg RCC_USART16CLKSOURCE_D2PCLK2: APB2 Clock selected as USART1/6 clock
  1490. * @arg RCC_USART16CLKSOURCE_PLL2: PLL2_Q Clock selected as USART1/6 clock
  1491. * @arg RCC_USART16CLKSOURCE_PLL3: PLL3_Q Clock selected as USART1/6 clock
  1492. * @arg RCC_USART16CLKSOURCE_HSI: HSI selected as USART1/6 clock
  1493. * @arg RCC_USART16CLKSOURCE_CSI: CSI Clock selected as USART1/6 clock
  1494. * @arg RCC_USART16CLKSOURCE_LSE: LSE selected as USART1/6 clock
  1495. */
  1496. #define __HAL_RCC_GET_USART16_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART16SEL)))
  1497. /** @brief macro to configure the USART234578 clock (USART234578CLK).
  1498. *
  1499. * @param __USART234578CLKSource__ specifies the USART2/3/4/5/7/8 clock source.
  1500. * This parameter can be one of the following values:
  1501. * @arg RCC_USART234578CLKSOURCE_D2PCLK1: APB1 Clock selected as USART2/3/4/5/7/8 clock
  1502. * @arg RCC_USART234578CLKSOURCE_PLL2: PLL2_Q Clock selected as USART2/3/4/5/7/8 clock
  1503. * @arg RCC_USART234578CLKSOURCE_PLL3: PLL3_Q Clock selected as USART2/3/4/5/7/8 clock
  1504. * @arg RCC_USART234578CLKSOURCE_HSI: HSI selected as USART2/3/4/5/7/8 clock
  1505. * @arg RCC_USART234578CLKSOURCE_CSI: CSI Clock selected as USART2/3/4/5/7/8 clock
  1506. * @arg RCC_USART234578CLKSOURCE_LSE: LSE selected as USART2/3/4/5/7/8 clock
  1507. */
  1508. #define __HAL_RCC_USART234578_CONFIG(__USART234578CLKSource__) \
  1509. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL, (uint32_t)(__USART234578CLKSource__))
  1510. /** @brief macro to get the USART2/3/4/5/7/8 clock source.
  1511. * @retval The clock source can be one of the following values:
  1512. * @arg RCC_USART234578CLKSOURCE_D2PCLK1: APB1 Clock selected as USART2/3/4/5/7/8 clock
  1513. * @arg RCC_USART234578CLKSOURCE_PLL2: PLL2_Q Clock selected as USART2/3/4/5/7/8 clock
  1514. * @arg RCC_USART234578CLKSOURCE_PLL3: PLL3_Q Clock selected as USART2/3/4/5/7/8 clock
  1515. * @arg RCC_USART234578CLKSOURCE_HSI: HSI selected as USART2/3/4/5/7/8 clock
  1516. * @arg RCC_USART234578CLKSOURCE_CSI: CSI Clock selected as USART2/3/4/5/7/8 clock
  1517. * @arg RCC_USART234578CLKSOURCE_LSE: LSE selected as USART2/3/4/5/7/8 clock
  1518. */
  1519. #define __HAL_RCC_GET_USART234578_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL)))
  1520. /** @brief macro to configure the USART1 clock (USART1CLK).
  1521. *
  1522. * @param __USART1CLKSource__ specifies the USART1 clock source.
  1523. * This parameter can be one of the following values:
  1524. * @arg RCC_USART1CLKSOURCE_D2PCLK2: APB2 Clock selected as USART1 clock
  1525. * @arg RCC_USART1CLKSOURCE_PLL2: PLL2_Q Clock selected as USART1 clock
  1526. * @arg RCC_USART1CLKSOURCE_PLL3: PLL3_Q Clock selected as USART1 clock
  1527. * @arg RCC_USART1CLKSOURCE_HSI: HSI selected as USART1 clock
  1528. * @arg RCC_USART1CLKSOURCE_CSI: CSI Clock selected as USART1 clock
  1529. * @arg RCC_USART1CLKSOURCE_LSE: LSE selected as USART1 clock
  1530. */
  1531. #define __HAL_RCC_USART1_CONFIG(__USART1CLKSource__) \
  1532. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART16SEL, (uint32_t)(__USART1CLKSource__))
  1533. /** @brief macro to get the USART1 clock source.
  1534. * @retval The clock source can be one of the following values:
  1535. * @arg RCC_USART1CLKSOURCE_D2PCLK2: APB2 Clock selected as USART1 clock
  1536. * @arg RCC_USART1CLKSOURCE_PLL2: PLL2_Q Clock selected as USART1 clock
  1537. * @arg RCC_USART1CLKSOURCE_PLL3: PLL3_Q Clock selected as USART1 clock
  1538. * @arg RCC_USART1CLKSOURCE_HSI: HSI selected as USART1 clock
  1539. * @arg RCC_USART1CLKSOURCE_CSI: CSI Clock selected as USART1 clock
  1540. * @arg RCC_USART1CLKSOURCE_LSE: LSE selected as USART1 clock
  1541. */
  1542. #define __HAL_RCC_GET_USART1_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART16SEL)))
  1543. /** @brief macro to configure the USART2 clock (USART2CLK).
  1544. *
  1545. * @param __USART2CLKSource__ specifies the USART2 clock source.
  1546. * This parameter can be one of the following values:
  1547. * @arg RCC_USART2CLKSOURCE_D2PCLK1: APB1 Clock selected as USART2 clock
  1548. * @arg RCC_USART2CLKSOURCE_PLL2: PLL2_Q Clock selected as USART2 clock
  1549. * @arg RCC_USART2CLKSOURCE_PLL3: PLL3_Q Clock selected as USART2 clock
  1550. * @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
  1551. * @arg RCC_USART2CLKSOURCE_CSI: CSI Clock selected as USART2 clock
  1552. * @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
  1553. */
  1554. #define __HAL_RCC_USART2_CONFIG(__USART2CLKSource__) \
  1555. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL, (uint32_t)(__USART2CLKSource__))
  1556. /** @brief macro to get the USART2 clock source.
  1557. * @retval The clock source can be one of the following values:
  1558. * @arg RCC_USART2CLKSOURCE_D2PCLK1: APB1 Clock selected as USART2 clock
  1559. * @arg RCC_USART2CLKSOURCE_PLL2: PLL2_Q Clock selected as USART2 clock
  1560. * @arg RCC_USART2CLKSOURCE_PLL3: PLL3_Q Clock selected as USART2 clock
  1561. * @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
  1562. * @arg RCC_USART2CLKSOURCE_CSI: CSI Clock selected as USART2 clock
  1563. * @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
  1564. */
  1565. #define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL)))
  1566. /** @brief macro to configure the USART3 clock (USART3CLK).
  1567. *
  1568. * @param __USART3CLKSource__ specifies the USART3 clock source.
  1569. * This parameter can be one of the following values:
  1570. * @arg RCC_USART3CLKSOURCE_D2PCLK1: APB1 Clock selected as USART3 clock
  1571. * @arg RCC_USART3CLKSOURCE_PLL2: PLL2_Q Clock selected as USART3 clock
  1572. * @arg RCC_USART3CLKSOURCE_PLL3: PLL3_Q Clock selected as USART3 clock
  1573. * @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock
  1574. * @arg RCC_USART3CLKSOURCE_CSI: CSI Clock selected as USART3 clock
  1575. * @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock
  1576. */
  1577. #define __HAL_RCC_USART3_CONFIG(__USART3CLKSource__) \
  1578. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL, (uint32_t)(__USART3CLKSource__))
  1579. /** @brief macro to get the USART3 clock source.
  1580. * @retval The clock source can be one of the following values:
  1581. * @arg RCC_USART2CLKSOURCE_D2PCLK1: APB1 Clock selected as USART3 clock
  1582. * @arg RCC_USART3CLKSOURCE_PLL2: PLL2_Q Clock selected as USART3 clock
  1583. * @arg RCC_USART3CLKSOURCE_PLL3: PLL3_Q Clock selected as USART3 clock
  1584. * @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock
  1585. * @arg RCC_USART3CLKSOURCE_CSI: CSI Clock selected as USART3 clock
  1586. * @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock
  1587. */
  1588. #define __HAL_RCC_GET_USART3_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL)))
  1589. /** @brief macro to configure the UART4 clock (UART4CLK).
  1590. *
  1591. * @param __UART4CLKSource__ specifies the UART4 clock source.
  1592. * This parameter can be one of the following values:
  1593. * @arg RCC_UART4CLKSOURCE_D2PCLK1: APB1 Clock selected as UART4 clock
  1594. * @arg RCC_UART4CLKSOURCE_PLL2: PLL2_Q Clock selected as UART4 clock
  1595. * @arg RCC_UART4CLKSOURCE_PLL3: PLL3_Q Clock selected as UART4 clock
  1596. * @arg RCC_UART4CLKSOURCE_HSI: HSI selected as UART4 clock
  1597. * @arg RCC_UART4CLKSOURCE_CSI: CSI Clock selected as UART4 clock
  1598. * @arg RCC_UART4CLKSOURCE_LSE: LSE selected as UART4 clock
  1599. */
  1600. #define __HAL_RCC_UART4_CONFIG(__UART4CLKSource__) \
  1601. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL, (uint32_t)(__UART4CLKSource__))
  1602. /** @brief macro to get the UART4 clock source.
  1603. * @retval The clock source can be one of the following values:
  1604. * @arg RCC_UART4CLKSOURCE_D2PCLK1: APB1 Clock selected as UART4 clock
  1605. * @arg RCC_UART4CLKSOURCE_PLL2: PLL2_Q Clock selected as UART4 clock
  1606. * @arg RCC_UART4CLKSOURCE_PLL3: PLL3_Q Clock selected as UART4 clock
  1607. * @arg RCC_UART4CLKSOURCE_HSI: HSI selected as UART4 clock
  1608. * @arg RCC_UART4CLKSOURCE_CSI: CSI Clock selected as UART4 clock
  1609. * @arg RCC_UART4CLKSOURCE_LSE: LSE selected as UART4 clock
  1610. */
  1611. #define __HAL_RCC_GET_UART4_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL)))
  1612. /** @brief macro to configure the UART5 clock (UART5CLK).
  1613. *
  1614. * @param __UART5CLKSource__ specifies the UART5 clock source.
  1615. * This parameter can be one of the following values:
  1616. * @arg RCC_UART5CLKSOURCE_D2PCLK1: APB1 Clock selected as UART5 clock
  1617. * @arg RCC_UART5CLKSOURCE_PLL2: PLL2_Q Clock selected as UART5 clock
  1618. * @arg RCC_UART5CLKSOURCE_PLL3: PLL3_Q Clock selected as UART5 clock
  1619. * @arg RCC_UART5CLKSOURCE_HSI: HSI selected as UART5 clock
  1620. * @arg RCC_UART5CLKSOURCE_CSI: CSI Clock selected as UART5 clock
  1621. * @arg RCC_UART5CLKSOURCE_LSE: LSE selected as UART5 clock
  1622. */
  1623. #define __HAL_RCC_UART5_CONFIG(__UART5CLKSource__) \
  1624. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL, (uint32_t)(__UART5CLKSource__))
  1625. /** @brief macro to get the UART5 clock source.
  1626. * @retval The clock source can be one of the following values:
  1627. * @arg RCC_UART5CLKSOURCE_D2PCLK1: APB1 Clock selected as UART5 clock
  1628. * @arg RCC_UART5CLKSOURCE_PLL2: PLL2_Q Clock selected as UART5 clock
  1629. * @arg RCC_UART5CLKSOURCE_PLL3: PLL3_Q Clock selected as UART5 clock
  1630. * @arg RCC_UART5CLKSOURCE_HSI: HSI selected as UART5 clock
  1631. * @arg RCC_UART5CLKSOURCE_CSI: CSI Clock selected as UART5 clock
  1632. * @arg RCC_UART5CLKSOURCE_LSE: LSE selected as UART5 clock
  1633. */
  1634. #define __HAL_RCC_GET_UART5_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL)))
  1635. /** @brief macro to configure the USART6 clock (USART6CLK).
  1636. *
  1637. * @param __USART6CLKSource__ specifies the USART6 clock source.
  1638. * This parameter can be one of the following values:
  1639. * @arg RCC_USART6CLKSOURCE_D2PCLK2: APB2 Clock selected as USART6 clock
  1640. * @arg RCC_USART6CLKSOURCE_PLL2: PLL2_Q Clock selected as USART6 clock
  1641. * @arg RCC_USART6CLKSOURCE_PLL3: PLL3_Q Clock selected as USART6 clock
  1642. * @arg RCC_USART6CLKSOURCE_HSI: HSI selected as USART6 clock
  1643. * @arg RCC_USART6CLKSOURCE_CSI: CSI Clock selected as USART6 clock
  1644. * @arg RCC_USART6CLKSOURCE_LSE: LSE selected as USART6 clock
  1645. */
  1646. #define __HAL_RCC_USART6_CONFIG(__USART6CLKSource__) \
  1647. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART16SEL, (uint32_t)(__USART6CLKSource__))
  1648. /** @brief macro to get the USART6 clock source.
  1649. * @retval The clock source can be one of the following values:
  1650. * @arg RCC_USART6CLKSOURCE_D2PCLK2: APB2 Clock selected as USART6 clock
  1651. * @arg RCC_USART6CLKSOURCE_PLL2: PLL2_Q Clock selected as USART6 clock
  1652. * @arg RCC_USART6CLKSOURCE_PLL3: PLL3_Q Clock selected as USART6 clock
  1653. * @arg RCC_USART6CLKSOURCE_HSI: HSI selected as USART6 clock
  1654. * @arg RCC_USART6CLKSOURCE_CSI: CSI Clock selected as USART6 clock
  1655. * @arg RCC_USART6CLKSOURCE_LSE: LSE selected as USART6 clock
  1656. */
  1657. #define __HAL_RCC_GET_USART6_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART16SEL)))
  1658. /** @brief macro to configure the UART5 clock (UART7CLK).
  1659. *
  1660. * @param __UART7CLKSource__ specifies the UART7 clock source.
  1661. * This parameter can be one of the following values:
  1662. * @arg RCC_UART7CLKSOURCE_D2PCLK1: APB1 Clock selected as UART7 clock
  1663. * @arg RCC_UART7CLKSOURCE_PLL2: PLL2_Q Clock selected as UART7 clock
  1664. * @arg RCC_UART7CLKSOURCE_PLL3: PLL3_Q Clock selected as UART7 clock
  1665. * @arg RCC_UART7CLKSOURCE_HSI: HSI selected as UART7 clock
  1666. * @arg RCC_UART7CLKSOURCE_CSI: CSI Clock selected as UART7 clock
  1667. * @arg RCC_UART7CLKSOURCE_LSE: LSE selected as UART7 clock
  1668. */
  1669. #define __HAL_RCC_UART7_CONFIG(__UART7CLKSource__) \
  1670. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL, (uint32_t)(__UART7CLKSource__))
  1671. /** @brief macro to get the UART7 clock source.
  1672. * @retval The clock source can be one of the following values:
  1673. * @arg RCC_UART7CLKSOURCE_D2PCLK1: APB1 Clock selected as UART7 clock
  1674. * @arg RCC_UART7CLKSOURCE_PLL2: PLL2_Q Clock selected as UART7 clock
  1675. * @arg RCC_UART7CLKSOURCE_PLL3: PLL3_Q Clock selected as UART7 clock
  1676. * @arg RCC_UART7CLKSOURCE_HSI: HSI selected as UART7 clock
  1677. * @arg RCC_UART7CLKSOURCE_CSI: CSI Clock selected as UART7 clock
  1678. * @arg RCC_UART7CLKSOURCE_LSE: LSE selected as UART7 clock
  1679. */
  1680. #define __HAL_RCC_GET_UART7_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL)))
  1681. /** @brief macro to configure the UART8 clock (UART8CLK).
  1682. *
  1683. * @param __UART8CLKSource__ specifies the UART8 clock source.
  1684. * This parameter can be one of the following values:
  1685. * @arg RCC_UART8CLKSOURCE_D2PCLK1: APB1 Clock selected as UART8 clock
  1686. * @arg RCC_UART8CLKSOURCE_PLL2: PLL2_Q Clock selected as UART8 clock
  1687. * @arg RCC_UART8CLKSOURCE_PLL3: PLL3_Q Clock selected as UART8 clock
  1688. * @arg RCC_UART8CLKSOURCE_HSI: HSI selected as UART8 clock
  1689. * @arg RCC_UART8CLKSOURCE_CSI: CSI Clock selected as UART8 clock
  1690. * @arg RCC_UART8CLKSOURCE_LSE: LSE selected as UART8 clock
  1691. */
  1692. #define __HAL_RCC_UART8_CONFIG(__UART8CLKSource__) \
  1693. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL, (uint32_t)(__UART8CLKSource__))
  1694. /** @brief macro to get the UART8 clock source.
  1695. * @retval The clock source can be one of the following values:
  1696. * @arg RCC_UART8CLKSOURCE_D2PCLK1: APB1 Clock selected as UART8 clock
  1697. * @arg RCC_UART8CLKSOURCE_PLL2: PLL2_Q Clock selected as UART8 clock
  1698. * @arg RCC_UART8CLKSOURCE_PLL3: PLL3_Q Clock selected as UART8 clock
  1699. * @arg RCC_UART8CLKSOURCE_HSI: HSI selected as UART8 clock
  1700. * @arg RCC_UART8CLKSOURCE_CSI: CSI Clock selected as UART8 clock
  1701. * @arg RCC_UART8CLKSOURCE_LSE: LSE selected as UART8 clock
  1702. */
  1703. #define __HAL_RCC_GET_UART8_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USART28SEL)))
  1704. /** @brief macro to configure the LPUART1 clock (LPUART1CLK).
  1705. *
  1706. * @param __LPUART1CLKSource__ specifies the LPUART1 clock source.
  1707. * This parameter can be one of the following values:
  1708. * @arg RCC_LPUART1CLKSOURCE_D3PCLK1: APB4 Clock selected as LPUART1 clock
  1709. * @arg RCC_LPUART1CLKSOURCE_PLL2: PLL2_Q Clock selected as LPUART1 clock
  1710. * @arg RCC_LPUART1CLKSOURCE_PLL3: PLL3_Q Clock selected as LPUART1 clock
  1711. * @arg RCC_LPUART1CLKSOURCE_HSI: HSI selected as LPUART1 clock
  1712. * @arg RCC_LPUART1CLKSOURCE_CSI: CSI Clock selected as LPUART1 clock
  1713. * @arg RCC_LPUART1CLKSOURCE_LSE: LSE selected as LPUART1 clock
  1714. */
  1715. #define __HAL_RCC_LPUART1_CONFIG(__LPUART1CLKSource__) \
  1716. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_LPUART1SEL, (uint32_t)(__LPUART1CLKSource__))
  1717. /** @brief macro to get the LPUART1 clock source.
  1718. * @retval The clock source can be one of the following values:
  1719. * @arg RCC_LPUART1CLKSOURCE_D3PCLK1: APB4 Clock selected as LPUART1 clock
  1720. * @arg RCC_LPUART1CLKSOURCE_PLL2: PLL2_Q Clock selected as LPUART1 clock
  1721. * @arg RCC_LPUART1CLKSOURCE_PLL3: PLL3_Q Clock selected as LPUART1 clock
  1722. * @arg RCC_LPUART1CLKSOURCE_HSI: HSI selected as LPUART1 clock
  1723. * @arg RCC_LPUART1CLKSOURCE_CSI: CSI Clock selected as LPUART1 clock
  1724. * @arg RCC_LPUART1CLKSOURCE_LSE: LSE selected as LPUART1 clock
  1725. */
  1726. #define __HAL_RCC_GET_LPUART1_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_LPUART1SEL)))
  1727. /** @brief macro to configure the LPTIM1 clock source.
  1728. *
  1729. * @param __LPTIM1CLKSource__ specifies the LPTIM1 clock source.
  1730. * This parameter can be one of the following values:
  1731. * @arg RCC_LPTIM1CLKSOURCE_D2PCLK1: APB1 Clock selected as LPTIM1 clock
  1732. * @arg RCC_LPTIM1CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM1 clock
  1733. * @arg RCC_LPTIM1CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM1 clock
  1734. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  1735. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI Clock selected as LPTIM1 clock
  1736. * @arg RCC_LPTIM1CLKSOURCE_CLKP: CLKP selected as LPTIM1 clock
  1737. */
  1738. #define __HAL_RCC_LPTIM1_CONFIG(__LPTIM1CLKSource__) \
  1739. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_LPTIM1SEL, (uint32_t)(__LPTIM1CLKSource__))
  1740. /** @brief macro to get the LPTIM1 clock source.
  1741. * @retval The clock source can be one of the following values:
  1742. * @arg RCC_LPTIM1CLKSOURCE_D2PCLK1: APB1 Clock selected as LPTIM1 clock
  1743. * @arg RCC_LPTIM1CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM1 clock
  1744. * @arg RCC_LPTIM1CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM1 clock
  1745. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  1746. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI Clock selected as LPTIM1 clock
  1747. * @arg RCC_LPTIM1CLKSOURCE_CLKP: CLKP selected as LPTIM1 clock
  1748. */
  1749. #define __HAL_RCC_GET_LPTIM1_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_LPTIM1SEL)))
  1750. /** @brief macro to configure the LPTIM2 clock source.
  1751. *
  1752. * @param __LPTIM2CLKSource__ specifies the LPTIM2 clock source.
  1753. * This parameter can be one of the following values:
  1754. * @arg RCC_LPTIM2CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM2 clock
  1755. * @arg RCC_LPTIM2CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM2 clock
  1756. * @arg RCC_LPTIM2CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM2 clock
  1757. * @arg RCC_LPTIM2CLKSOURCE_LSE: LSE selected as LPTIM2 clock
  1758. * @arg RCC_LPTIM2CLKSOURCE_LSI: LSI Clock selected as LPTIM2 clock
  1759. * @arg RCC_LPTIM2CLKSOURCE_CLKP: CLKP selected as LPTIM2 clock
  1760. */
  1761. #define __HAL_RCC_LPTIM2_CONFIG(__LPTIM2CLKSource__) \
  1762. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM2SEL, (uint32_t)(__LPTIM2CLKSource__))
  1763. /** @brief macro to get the LPTIM2 clock source.
  1764. * @retval The clock source can be one of the following values:
  1765. * @arg RCC_LPTIM2CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM2 clock
  1766. * @arg RCC_LPTIM2CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM2 clock
  1767. * @arg RCC_LPTIM2CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM2 clock
  1768. * @arg RCC_LPTIM2CLKSOURCE_LSE: LSE selected as LPTIM2 clock
  1769. * @arg RCC_LPTIM2CLKSOURCE_LSI: LSI Clock selected as LPTIM2 clock
  1770. * @arg RCC_LPTIM2CLKSOURCE_CLKP: CLKP selected as LPTIM2 clock
  1771. */
  1772. #define __HAL_RCC_GET_LPTIM2_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM2SEL)))
  1773. /** @brief macro to configure the LPTIM3/4/5 clock source.
  1774. *
  1775. * @param __LPTIM345CLKSource__ specifies the LPTIM3/4/5 clock source.
  1776. * @arg RCC_LPTIM345CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM3/4/5 clock
  1777. * @arg RCC_LPTIM345CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM3/4/5 clock
  1778. * @arg RCC_LPTIM345CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM3/4/5 clock
  1779. * @arg RCC_LPTIM345CLKSOURCE_LSE: LSE selected as LPTIM3/4/5 clock
  1780. * @arg RCC_LPTIM345CLKSOURCE_LSI: LSI Clock selected as LPTIM3/4/5 clock
  1781. * @arg RCC_LPTIM345CLKSOURCE_CLKP: CLKP selected as LPTIM3/4/5 clock
  1782. */
  1783. #define __HAL_RCC_LPTIM345_CONFIG(__LPTIM345CLKSource__) \
  1784. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM345SEL, (uint32_t)(__LPTIM345CLKSource__))
  1785. /** @brief macro to get the LPTIM3/4/5 clock source.
  1786. * @retval The clock source can be one of the following values:
  1787. * @arg RCC_LPTIM345CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM3/4/5 clock
  1788. * @arg RCC_LPTIM345CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM3/4/5 clock
  1789. * @arg RCC_LPTIM345CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM3/4/5 clock
  1790. * @arg RCC_LPTIM345CLKSOURCE_LSE: LSE selected as LPTIM3/4/5 clock
  1791. * @arg RCC_LPTIM345CLKSOURCE_LSI: LSI Clock selected as LPTIM3/4/5 clock
  1792. * @arg RCC_LPTIM345CLKSOURCE_CLKP: CLKP selected as LPTIM3/4/5 clock
  1793. */
  1794. #define __HAL_RCC_GET_LPTIM345_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM345SEL)))
  1795. /** @brief macro to configure the LPTIM3 clock source.
  1796. *
  1797. * @param __LPTIM3CLKSource__ specifies the LPTIM3 clock source.
  1798. * @arg RCC_LPTIM3CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM3 clock
  1799. * @arg RCC_LPTIM3CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM3 clock
  1800. * @arg RCC_LPTIM3CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM3 clock
  1801. * @arg RCC_LPTIM3CLKSOURCE_LSE: LSE selected as LPTIM3 clock
  1802. * @arg RCC_LPTIM3CLKSOURCE_LSI: LSI Clock selected as LPTIM3 clock
  1803. * @arg RCC_LPTIM3CLKSOURCE_CLKP: CLKP selected as LPTIM3 clock
  1804. */
  1805. #define __HAL_RCC_LPTIM3_CONFIG(__LPTIM3CLKSource__) \
  1806. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM345SEL, (uint32_t)(__LPTIM3CLKSource__))
  1807. /** @brief macro to get the LPTIM3 clock source.
  1808. * @retval The clock source can be one of the following values:
  1809. * @arg RCC_LPTIM3CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM3 clock
  1810. * @arg RCC_LPTIM3CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM3 clock
  1811. * @arg RCC_LPTIM3CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM3 clock
  1812. * @arg RCC_LPTIM3CLKSOURCE_LSE: LSE selected as LPTIM3 clock
  1813. * @arg RCC_LPTIM3CLKSOURCE_LSI: LSI Clock selected as LPTIM3 clock
  1814. * @arg RCC_LPTIM3CLKSOURCE_CLKP: CLKP selected as LPTIM3 clock
  1815. */
  1816. #define __HAL_RCC_GET_LPTIM3_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM345SEL)))
  1817. /** @brief macro to configure the LPTIM4 clock source.
  1818. *
  1819. * @param __LPTIM4CLKSource__ specifies the LPTIM4 clock source.
  1820. * @arg RCC_LPTIM4CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM4 clock
  1821. * @arg RCC_LPTIM4CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM4 clock
  1822. * @arg RCC_LPTIM4CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM4 clock
  1823. * @arg RCC_LPTIM4CLKSOURCE_LSE: LSE selected as LPTIM4 clock
  1824. * @arg RCC_LPTIM4CLKSOURCE_LSI: LSI Clock selected as LPTIM4 clock
  1825. * @arg RCC_LPTIM4CLKSOURCE_CLKP: CLKP selected as LPTIM4 clock
  1826. */
  1827. #define __HAL_RCC_LPTIM4_CONFIG(__LPTIM4CLKSource__) \
  1828. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM345SEL, (uint32_t)(__LPTIM4CLKSource__))
  1829. /** @brief macro to get the LPTIM4 clock source.
  1830. * @retval The clock source can be one of the following values:
  1831. * @arg RCC_LPTIM4CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM4 clock
  1832. * @arg RCC_LPTIM4CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM4 clock
  1833. * @arg RCC_LPTIM4CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM4 clock
  1834. * @arg RCC_LPTIM4CLKSOURCE_LSE: LSE selected as LPTIM4 clock
  1835. * @arg RCC_LPTIM4CLKSOURCE_LSI: LSI Clock selected as LPTIM4 clock
  1836. * @arg RCC_LPTIM4CLKSOURCE_CLKP: CLKP selected as LPTIM4 clock
  1837. */
  1838. #define __HAL_RCC_GET_LPTIM4_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM345SEL)))
  1839. /** @brief macro to configure the LPTIM5 clock source.
  1840. *
  1841. * @param __LPTIM5CLKSource__ specifies the LPTIM5 clock source.
  1842. * @arg RCC_LPTIM5CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM5 clock
  1843. * @arg RCC_LPTIM5CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM5 clock
  1844. * @arg RCC_LPTIM5CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM5 clock
  1845. * @arg RCC_LPTIM5CLKSOURCE_LSE: LSE selected as LPTIM5 clock
  1846. * @arg RCC_LPTIM5CLKSOURCE_LSI: LSI Clock selected as LPTIM5 clock
  1847. * @arg RCC_LPTIM5CLKSOURCE_CLKP: CLKP selected as LPTIM5 clock
  1848. */
  1849. #define __HAL_RCC_LPTIM5_CONFIG(__LPTIM5CLKSource__) \
  1850. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM345SEL, (uint32_t)(__LPTIM5CLKSource__))
  1851. /** @brief macro to get the LPTIM5 clock source.
  1852. * @retval The clock source can be one of the following values:
  1853. * @arg RCC_LPTIM5CLKSOURCE_D3PCLK1: APB4 Clock selected as LPTIM5 clock
  1854. * @arg RCC_LPTIM5CLKSOURCE_PLL2: PLL2_P Clock selected as LPTIM5 clock
  1855. * @arg RCC_LPTIM5CLKSOURCE_PLL3: PLL3_R Clock selected as LPTIM5 clock
  1856. * @arg RCC_LPTIM5CLKSOURCE_LSE: LSE selected as LPTIM5 clock
  1857. * @arg RCC_LPTIM5CLKSOURCE_LSI: LSI Clock selected as LPTIM5 clock
  1858. * @arg RCC_LPTIM5CLKSOURCE_CLKP: CLKP selected as LPTIM5 clock
  1859. */
  1860. #define __HAL_RCC_GET_LPTIM5_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_LPTIM345SEL)))
  1861. /** @brief macro to configure the QSPI clock source.
  1862. *
  1863. * @param __QSPICLKSource__ specifies the QSPI clock source.
  1864. * @arg RCC_RCC_QSPICLKSOURCE_D1HCLK: Domain1 HCLK Clock selected as QSPI clock
  1865. * @arg RCC_RCC_QSPICLKSOURCE_PLL : PLL1_Q Clock selected as QSPI clock
  1866. * @arg RCC_RCC_QSPICLKSOURCE_PLL2 : PLL2_R Clock selected as QSPI clock
  1867. * @arg RCC_RCC_QSPICLKSOURCE_CLKP CLKP selected as QSPI clock
  1868. */
  1869. #define __HAL_RCC_QSPI_CONFIG(__QSPICLKSource__) \
  1870. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_QSPISEL, (uint32_t)(__QSPICLKSource__))
  1871. /** @brief macro to get the QSPI clock source.
  1872. * @retval The clock source can be one of the following values:
  1873. * @arg RCC_RCC_QSPICLKSOURCE_D1HCLK: Domain1 HCLK Clock selected as QSPI clock
  1874. * @arg RCC_RCC_QSPICLKSOURCE_PLL : PLL1_Q Clock selected as QSPI clock
  1875. * @arg RCC_RCC_QSPICLKSOURCE_PLL2 : PLL2_R Clock selected as QSPI clock
  1876. * @arg RCC_RCC_QSPICLKSOURCE_CLKP CLKP selected as QSPI clock
  1877. */
  1878. #define __HAL_RCC_GET_QSPI_SOURCE() ((uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_QSPISEL)))
  1879. #if defined(DSI)
  1880. /** @brief macro to configure the DSI clock source.
  1881. *
  1882. * @param __DSICLKSource__ specifies the DSI clock source.
  1883. * @arg RCC_RCC_DSICLKSOURCE_PHY:DSI clock from PHY is selected as DSI byte lane clock
  1884. * @arg RCC_RCC_DSICLKSOURCE_PLL2 : PLL2_Q Clock clock is selected as DSI byte lane clock
  1885. */
  1886. #define __HAL_RCC_DSI_CONFIG(__DSICLKSource__) \
  1887. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_DSISEL, (uint32_t)(__DSICLKSource__))
  1888. /** @brief macro to get the DSI clock source.
  1889. * @retval The clock source can be one of the following values:
  1890. * @arg RCC_RCC_DSICLKSOURCE_PHY: DSI clock from PHY is selected as DSI byte lane clock
  1891. * @arg RCC_RCC_DSICLKSOURCE_PLL2: PLL2_Q Clock clock is selected as DSI byte lane clock
  1892. */
  1893. #define __HAL_RCC_GET_DSI_SOURCE() ((uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_DSISEL)))
  1894. #endif /*DSI*/
  1895. /** @brief macro to configure the FMC clock source.
  1896. *
  1897. * @param __FMCCLKSource__ specifies the FMC clock source.
  1898. * @arg RCC_RCC_FMCCLKSOURCE_D1HCLK: Domain1 HCLK Clock selected as FMC clock
  1899. * @arg RCC_RCC_FMCCLKSOURCE_PLL : PLL1_Q Clock selected as FMC clock
  1900. * @arg RCC_RCC_FMCCLKSOURCE_PLL2 : PLL2_R Clock selected as FMC clock
  1901. * @arg RCC_RCC_FMCCLKSOURCE_CLKP CLKP selected as FMC clock
  1902. */
  1903. #define __HAL_RCC_FMC_CONFIG(__FMCCLKSource__) \
  1904. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_FMCSEL, (uint32_t)(__FMCCLKSource__))
  1905. /** @brief macro to get the FMC clock source.
  1906. * @retval The clock source can be one of the following values:
  1907. * @arg RCC_RCC_FMCCLKSOURCE_D1HCLK: Domain1 HCLK Clock selected as FMC clock
  1908. * @arg RCC_RCC_FMCCLKSOURCE_PLL : PLL1_Q Clock selected as FMC clock
  1909. * @arg RCC_RCC_FMCCLKSOURCE_PLL2 : PLL2_R Clock selected as FMC clock
  1910. * @arg RCC_RCC_FMCCLKSOURCE_CLKP CLKP selected as FMC clock
  1911. */
  1912. #define __HAL_RCC_GET_FMC_SOURCE() ((uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_FMCSEL)))
  1913. /** @brief Macro to configure the USB clock (USBCLK).
  1914. * @param __USBCLKSource__ specifies the USB clock source.
  1915. * This parameter can be one of the following values:
  1916. * @arg RCC_USBCLKSOURCE_PLL: PLL1Q selected as USB clock
  1917. * @arg RCC_USBCLKSOURCE_PLL3: PLL3Q Clock selected as USB clock
  1918. * @arg RCC_USBCLKSOURCE_HSI48: RC48 MHZ Clock selected as USB clock
  1919. */
  1920. #define __HAL_RCC_USB_CONFIG(__USBCLKSource__) \
  1921. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USBSEL, (uint32_t)(__USBCLKSource__))
  1922. /** @brief Macro to get the USB clock source.
  1923. * @retval The clock source can be one of the following values:
  1924. * @arg RCC_USBCLKSOURCE_PLL: PLL1Q selected as USB clock
  1925. * @arg RCC_USBCLKSOURCE_PLL3: PLL3Q Clock selected as USB clock
  1926. * @arg RCC_USBCLKSOURCE_HSI48: RC48 MHZ Clock selected as USB clock
  1927. */
  1928. #define __HAL_RCC_GET_USB_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USBSEL)))
  1929. /** @brief Macro to configure the ADC clock
  1930. * @param __ADCCLKSource__ specifies the ADC digital interface clock source.
  1931. * This parameter can be one of the following values:
  1932. * @arg RCC_ADCCLKSOURCE_PLL2: PLL2_P Clock selected as ADC clock
  1933. * @arg RCC_ADCCLKSOURCE_PLL3: PLL3_R Clock selected as ADC clock
  1934. * @arg RCC_ADCCLKSOURCE_CLKP: CLKP Clock selected as ADC clock
  1935. */
  1936. #define __HAL_RCC_ADC_CONFIG(__ADCCLKSource__) \
  1937. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_ADCSEL, (uint32_t)(__ADCCLKSource__))
  1938. /** @brief Macro to get the ADC clock source.
  1939. * @retval The clock source can be one of the following values:
  1940. * @arg RCC_ADCCLKSOURCE_PLL2: PLL2_P Clock selected as ADC clock
  1941. * @arg RCC_ADCCLKSOURCE_PLL3: PLL3_R Clock selected as ADC clock
  1942. * @arg RCC_ADCCLKSOURCE_CLKP: CLKP Clock selected as ADC clock
  1943. */
  1944. #define __HAL_RCC_GET_ADC_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_ADCSEL)))
  1945. /** @brief Macro to configure the SWPMI1 clock
  1946. * @param __SWPMI1CLKSource__ specifies the SWPMI1 clock source.
  1947. * This parameter can be one of the following values:
  1948. * @arg RCC_SWPMI1CLKSOURCE_D2PCLK1: D2PCLK1 Clock selected as SWPMI1 clock
  1949. * @arg RCC_SWPMI1CLKSOURCE_HSI: HSI Clock selected as SWPMI1 clock
  1950. */
  1951. #define __HAL_RCC_SWPMI1_CONFIG(__SWPMI1CLKSource__) \
  1952. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SWPSEL, (uint32_t)(__SWPMI1CLKSource__))
  1953. /** @brief Macro to get the SWPMI1 clock source.
  1954. * @retval The clock source can be one of the following values:
  1955. * @arg RCC_SWPMI1CLKSOURCE_D2PCLK1: D2PCLK1 Clock selected as SWPMI1 clock
  1956. * @arg RCC_SWPMI1CLKSOURCE_HSI: HSI Clock selected as SWPMI1 clock
  1957. */
  1958. #define __HAL_RCC_GET_SWPMI1_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SWPSEL)))
  1959. /** @brief Macro to configure the DFSDM1 clock
  1960. * @param __DFSDM1CLKSource__ specifies the DFSDM1 clock source.
  1961. * This parameter can be one of the following values:
  1962. * @arg RCC_DFSDM1CLKSOURCE_D2PCLK: D2PCLK Clock selected as DFSDM1 clock
  1963. * @arg RCC_DFSDM1CLKSOURCE_SYS: System Clock selected as DFSDM1 clock
  1964. */
  1965. #define __HAL_RCC_DFSDM1_CONFIG(__DFSDM1CLKSource__) \
  1966. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_DFSDM1SEL, (uint32_t)(__DFSDM1CLKSource__))
  1967. /** @brief Macro to get the DFSDM1 clock source.
  1968. * @retval The clock source can be one of the following values:
  1969. * @arg RCC_DFSDM1CLKSOURCE_D2PCLK: D2PCLK Clock selected as DFSDM1 clock
  1970. * @arg RCC_DFSDM1CLKSOURCE_SYS: System Clock selected as DFSDM1 clock
  1971. */
  1972. #define __HAL_RCC_GET_DFSDM1_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_DFSDM1SEL)))
  1973. /** @brief macro to configure the CEC clock (CECCLK).
  1974. *
  1975. * @param __CECCLKSource__ specifies the CEC clock source.
  1976. * This parameter can be one of the following values:
  1977. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  1978. * @arg RCC_CECCLKSOURCE_LSI: LSI selected as CEC clock
  1979. * @arg RCC_CECCLKSOURCE_CSI: CSI Clock selected as CEC clock
  1980. */
  1981. #define __HAL_RCC_CEC_CONFIG(__CECCLKSource__) \
  1982. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_CECSEL, (uint32_t)(__CECCLKSource__))
  1983. /** @brief macro to get the CEC clock source.
  1984. * @retval The clock source can be one of the following values:
  1985. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  1986. * @arg RCC_CECCLKSOURCE_LSI: LSI selected as CEC clock
  1987. * @arg RCC_CECCLKSOURCE_CSI: CSI Clock selected as CEC clock
  1988. */
  1989. #define __HAL_RCC_GET_CEC_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_CECSEL)))
  1990. /** @brief Macro to configure the CLKP : Oscillator clock for peripheral
  1991. * @param __CLKPSource__ specifies Oscillator clock for peripheral
  1992. * This parameter can be one of the following values:
  1993. * @arg RCC_CLKPSOURCE_HSI: HSI selected Oscillator clock for peripheral
  1994. * @arg RCC_CLKPSOURCE_CSI: CSI selected Oscillator clock for peripheral
  1995. * @arg RCC_CLKPSOURCE_HSE: HSE selected Oscillator clock for peripheral
  1996. */
  1997. #define __HAL_RCC_CLKP_CONFIG(__CLKPSource__) \
  1998. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_CKPERSEL, (uint32_t)(__CLKPSource__))
  1999. /** @brief Macro to get the Oscillator clock for peripheral source.
  2000. * @retval The clock source can be one of the following values:
  2001. * @arg RCC_CLKPSOURCE_HSI: HSI selected Oscillator clock for peripheral
  2002. * @arg RCC_CLKPSOURCE_CSI: CSI selected Oscillator clock for peripheral
  2003. * @arg RCC_CLKPSOURCE_HSE: HSE selected Oscillator clock for peripheral
  2004. */
  2005. #define __HAL_RCC_GET_CLKP_SOURCE() ((uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_CKPERSEL)))
  2006. #if defined(FDCAN1) || defined(FDCAN2)
  2007. /** @brief Macro to configure the FDCAN clock
  2008. * @param __FDCANCLKSource__ specifies clock source for FDCAN
  2009. * This parameter can be one of the following values:
  2010. * @arg RCC_FDCANCLKSOURCE_HSE: HSE selected as FDCAN clock
  2011. * @arg RCC_FDCANCLKSOURCE_PLL: PLL selected as FDCAN clock
  2012. * @arg RCC_FDCANCLKSOURCE_PLL2: PLL2 selected as FDCAN clock
  2013. */
  2014. #define __HAL_RCC_FDCAN_CONFIG(__FDCANCLKSource__) \
  2015. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_FDCANSEL, (uint32_t)(__FDCANCLKSource__))
  2016. /** @brief Macro to get the FDCAN clock
  2017. * @retval The clock source can be one of the following values:
  2018. * @arg RCC_FDCANCLKSOURCE_HSE: HSE selected as FDCAN clock
  2019. * @arg RCC_FDCANCLKSOURCE_PLL: PLL selected as FDCAN clock
  2020. * @arg RCC_FDCANCLKSOURCE_PLL2: PLL2 selected as FDCAN clock
  2021. */
  2022. #define __HAL_RCC_GET_FDCAN_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_FDCANSEL)))
  2023. #endif /*FDCAN1 || FDCAN2*/
  2024. /**
  2025. * @brief Macro to Configure the SPI1/2/3 clock source.
  2026. * @param __RCC_SPI123CLKSource__ defines the SPI1/2/3 clock source. This clock is derived
  2027. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  2028. * This parameter can be one of the following values:
  2029. * @arg RCC_SPI123CLKSOURCE_PLL: SPI1/2/3 clock = PLL
  2030. * @arg RCC_SPI123CLKSOURCE_PLL2: SPI1/2/3 clock = PLL2
  2031. * @arg RCC_SPI123CLKSOURCE_PLL3: SPI1/2/3 clock = PLL3
  2032. * @arg RCC_SPI123CLKSOURCE_CLKP: SPI1/2/3 clock = CLKP
  2033. * @arg RCC_SPI123CLKSOURCE_PIN: SPI1/2/3 clock = External Clock
  2034. * @retval None
  2035. */
  2036. #define __HAL_RCC_SPI123_CONFIG(__RCC_SPI123CLKSource__ )\
  2037. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI123SEL, (__RCC_SPI123CLKSource__))
  2038. /** @brief Macro to get the SPI1/2/3 clock source.
  2039. * @retval The clock source can be one of the following values:
  2040. * @arg RCC_SPI123CLKSOURCE_PLL: SPI1/2/3 clock = PLL
  2041. * @arg RCC_SPI123CLKSOURCE_PLL2: SPI1/2/3 clock = PLL2
  2042. * @arg RCC_SPI123CLKSOURCE_PLL3: SPI1/2/3 clock = PLL3
  2043. * @arg RCC_SPI123CLKSOURCE_CLKP: SPI1/2/3 clock = CLKP
  2044. * @arg RCC_SPI123CLKSOURCE_PIN: SPI1/2/3 clock = External Clock
  2045. */
  2046. #define __HAL_RCC_GET_SPI123_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI123SEL)))
  2047. /**
  2048. * @brief Macro to Configure the SPI1 clock source.
  2049. * @param __RCC_SPI1CLKSource__ defines the SPI1 clock source. This clock is derived
  2050. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  2051. * This parameter can be one of the following values:
  2052. * @arg RCC_SPI1CLKSOURCE_PLL: SPI1 clock = PLL
  2053. * @arg RCC_SPI1CLKSOURCE_PLL2: SPI1 clock = PLL2
  2054. * @arg RCC_SPI1CLKSOURCE_PLL3: SPI1 clock = PLL3
  2055. * @arg RCC_SPI1CLKSOURCE_CLKP: SPI1 clock = CLKP
  2056. * @arg RCC_SPI1CLKSOURCE_PIN: SPI1 clock = External Clock
  2057. * @retval None
  2058. */
  2059. #define __HAL_RCC_SPI1_CONFIG(__RCC_SPI1CLKSource__ )\
  2060. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI123SEL, (__RCC_SPI1CLKSource__))
  2061. /** @brief Macro to get the SPI1 clock source.
  2062. * @retval The clock source can be one of the following values:
  2063. * @arg RCC_SPI1CLKSOURCE_PLL: SPI1 clock = PLL
  2064. * @arg RCC_SPI1CLKSOURCE_PLL2: SPI1 clock = PLL2
  2065. * @arg RCC_SPI1CLKSOURCE_PLL3: SPI1 clock = PLL3
  2066. * @arg RCC_SPI1CLKSOURCE_CLKP: SPI1 clock = CLKP
  2067. * @arg RCC_SPI1CLKSOURCE_PIN: SPI1 clock = External Clock
  2068. */
  2069. #define __HAL_RCC_GET_SPI1_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI123SEL)))
  2070. /**
  2071. * @brief Macro to Configure the SPI2 clock source.
  2072. * @param __RCC_SPI2CLKSource__ defines the SPI2 clock source. This clock is derived
  2073. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  2074. * This parameter can be one of the following values:
  2075. * @arg RCC_SPI2CLKSOURCE_PLL: SPI2 clock = PLL
  2076. * @arg RCC_SPI2CLKSOURCE_PLL2: SPI2 clock = PLL2
  2077. * @arg RCC_SPI2CLKSOURCE_PLL3: SPI2 clock = PLL3
  2078. * @arg RCC_SPI2CLKSOURCE_CLKP: SPI2 clock = CLKP
  2079. * @arg RCC_SPI2CLKSOURCE_PIN: SPI2 clock = External Clock
  2080. * @retval None
  2081. */
  2082. #define __HAL_RCC_SPI2_CONFIG(__RCC_SPI2CLKSource__ )\
  2083. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI123SEL, (__RCC_SPI2CLKSource__))
  2084. /** @brief Macro to get the SPI2 clock source.
  2085. * @retval The clock source can be one of the following values:
  2086. * @arg RCC_SPI2CLKSOURCE_PLL: SPI2 clock = PLL
  2087. * @arg RCC_SPI2CLKSOURCE_PLL2: SPI2 clock = PLL2
  2088. * @arg RCC_SPI2CLKSOURCE_PLL3: SPI2 clock = PLL3
  2089. * @arg RCC_SPI2CLKSOURCE_CLKP: SPI2 clock = CLKP
  2090. * @arg RCC_SPI2CLKSOURCE_PIN: SPI2 clock = External Clock
  2091. */
  2092. #define __HAL_RCC_GET_SPI2_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI123SEL)))
  2093. /**
  2094. * @brief Macro to Configure the SPI3 clock source.
  2095. * @param __RCC_SPI3CLKSource__ defines the SPI3 clock source. This clock is derived
  2096. * from system PLL, PLL2, PLL3, OSC or external clock (through a dedicated PIN)
  2097. * This parameter can be one of the following values:
  2098. * @arg RCC_SPI3CLKSOURCE_PLL: SPI3 clock = PLL
  2099. * @arg RCC_SPI3CLKSOURCE_PLL2: SPI3 clock = PLL2
  2100. * @arg RCC_SPI3CLKSOURCE_PLL3: SPI3 clock = PLL3
  2101. * @arg RCC_SPI3CLKSOURCE_CLKP: SPI3 clock = CLKP
  2102. * @arg RCC_SPI3CLKSOURCE_PIN: SPI3 clock = External Clock
  2103. * @retval None
  2104. */
  2105. #define __HAL_RCC_SPI3_CONFIG(__RCC_SPI3CLKSource__ )\
  2106. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI123SEL, (__RCC_SPI3CLKSource__))
  2107. /** @brief Macro to get the SPI3 clock source.
  2108. * @retval The clock source can be one of the following values:
  2109. * @arg RCC_SPI3CLKSOURCE_PLL: SPI3 clock = PLL
  2110. * @arg RCC_SPI3CLKSOURCE_PLL2: SPI3 clock = PLL2
  2111. * @arg RCC_SPI3CLKSOURCE_PLL3: SPI3 clock = PLL3
  2112. * @arg RCC_SPI3CLKSOURCE_CLKP: SPI3 clock = CLKP
  2113. * @arg RCC_SPI3CLKSOURCE_PIN: SPI3 clock = External Clock
  2114. */
  2115. #define __HAL_RCC_GET_SPI3_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI123SEL)))
  2116. /**
  2117. * @brief Macro to Configure the SPI4/5 clock source.
  2118. * @param __RCC_SPI45CLKSource__ defines the SPI4/5 clock source. This clock is derived
  2119. * from system PCLK, PLL2, PLL3, OSC
  2120. * This parameter can be one of the following values:
  2121. * @arg RCC_SPI45CLKSOURCE_D2PCLK1:SPI4/5 clock = D2PCLK1
  2122. * @arg RCC_SPI45CLKSOURCE_PLL2: SPI4/5 clock = PLL2
  2123. * @arg RCC_SPI45CLKSOURCE_PLL3: SPI4/5 clock = PLL3
  2124. * @arg RCC_SPI45CLKSOURCE_HSI: SPI4/5 clock = HSI
  2125. * @arg RCC_SPI45CLKSOURCE_CSI: SPI4/5 clock = CSI
  2126. * @arg RCC_SPI45CLKSOURCE_HSE: SPI4/5 clock = HSE
  2127. * @retval None
  2128. */
  2129. #define __HAL_RCC_SPI45_CONFIG(__RCC_SPI45CLKSource__ )\
  2130. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI45SEL, (__RCC_SPI45CLKSource__))
  2131. /** @brief Macro to get the SPI4/5 clock source.
  2132. * @retval The clock source can be one of the following values:
  2133. * @arg RCC_SPI45CLKSOURCE_D2PCLK1:SPI4/5 clock = D2PCLK1
  2134. * @arg RCC_SPI45CLKSOURCE_PLL2: SPI4/5 clock = PLL2
  2135. * @arg RCC_SPI45CLKSOURCE_PLL3: SPI4/5 clock = PLL3
  2136. * @arg RCC_SPI45CLKSOURCE_HSI: SPI4/5 clock = HSI
  2137. * @arg RCC_SPI45CLKSOURCE_CSI: SPI4/5 clock = CSI
  2138. * @arg RCC_SPI45CLKSOURCE_HSE: SPI4/5 clock = HSE
  2139. */
  2140. #define __HAL_RCC_GET_SPI45_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI45SEL)))
  2141. /**
  2142. * @brief Macro to Configure the SPI4 clock source.
  2143. * @param __RCC_SPI4CLKSource__ defines the SPI4 clock source. This clock is derived
  2144. * from system PCLK, PLL2, PLL3, OSC
  2145. * This parameter can be one of the following values:
  2146. * @arg RCC_SPI4CLKSOURCE_D2PCLK1:SPI4 clock = D2PCLK1
  2147. * @arg RCC_SPI4CLKSOURCE_PLL2: SPI4 clock = PLL2
  2148. * @arg RCC_SPI4CLKSOURCE_PLL3: SPI4 clock = PLL3
  2149. * @arg RCC_SPI4CLKSOURCE_HSI: SPI4 clock = HSI
  2150. * @arg RCC_SPI4CLKSOURCE_CSI: SPI4 clock = CSI
  2151. * @arg RCC_SPI4CLKSOURCE_HSE: SPI4 clock = HSE
  2152. * @retval None
  2153. */
  2154. #define __HAL_RCC_SPI4_CONFIG(__RCC_SPI4CLKSource__ )\
  2155. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI45SEL, (__RCC_SPI4CLKSource__))
  2156. /** @brief Macro to get the SPI4 clock source.
  2157. * @retval The clock source can be one of the following values:
  2158. * @arg RCC_SPI4CLKSOURCE_D2PCLK1:SPI4 clock = D2PCLK1
  2159. * @arg RCC_SPI4CLKSOURCE_PLL2: SPI4 clock = PLL2
  2160. * @arg RCC_SPI4CLKSOURCE_PLL3: SPI4 clock = PLL3
  2161. * @arg RCC_SPI4CLKSOURCE_HSI: SPI4 clock = HSI
  2162. * @arg RCC_SPI4CLKSOURCE_CSI: SPI4 clock = CSI
  2163. * @arg RCC_SPI4CLKSOURCE_HSE: SPI4 clock = HSE
  2164. */
  2165. #define __HAL_RCC_GET_SPI4_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI45SEL)))
  2166. /**
  2167. * @brief Macro to Configure the SPI5 clock source.
  2168. * @param __RCC_SPI5CLKSource__ defines the SPI5 clock source. This clock is derived
  2169. * from system PCLK, PLL2, PLL3, OSC
  2170. * This parameter can be one of the following values:
  2171. * @arg RCC_SPI5CLKSOURCE_D2PCLK1:SPI5 clock = D2PCLK1
  2172. * @arg RCC_SPI5CLKSOURCE_PLL2: SPI5 clock = PLL2
  2173. * @arg RCC_SPI5CLKSOURCE_PLL3: SPI5 clock = PLL3
  2174. * @arg RCC_SPI5CLKSOURCE_HSI: SPI5 clock = HSI
  2175. * @arg RCC_SPI5CLKSOURCE_CSI: SPI5 clock = CSI
  2176. * @arg RCC_SPI5CLKSOURCE_HSE: SPI5 clock = HSE
  2177. * @retval None
  2178. */
  2179. #define __HAL_RCC_SPI5_CONFIG(__RCC_SPI5CLKSource__ )\
  2180. MODIFY_REG(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI45SEL, (__RCC_SPI5CLKSource__))
  2181. /** @brief Macro to get the SPI5 clock source.
  2182. * @retval The clock source can be one of the following values:
  2183. * @arg RCC_SPI5CLKSOURCE_D2PCLK1:SPI5 clock = D2PCLK1
  2184. * @arg RCC_SPI5CLKSOURCE_PLL2: SPI5 clock = PLL2
  2185. * @arg RCC_SPI5CLKSOURCE_PLL3: SPI5 clock = PLL3
  2186. * @arg RCC_SPI5CLKSOURCE_HSI: SPI5 clock = HSI
  2187. * @arg RCC_SPI5CLKSOURCE_CSI: SPI5 clock = CSI
  2188. * @arg RCC_SPI5CLKSOURCE_HSE: SPI5 clock = HSE
  2189. */
  2190. #define __HAL_RCC_GET_SPI5_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP1R, RCC_D2CCIP1R_SPI45SEL)))
  2191. /**
  2192. * @brief Macro to Configure the SPI6 clock source.
  2193. * @param __RCC_SPI6CLKSource__ defines the SPI6 clock source. This clock is derived
  2194. * from system PCLK, PLL2, PLL3, OSC
  2195. * This parameter can be one of the following values:
  2196. * @arg RCC_SPI6CLKSOURCE_D3PCLK1:SPI6 clock = D2PCLK1
  2197. * @arg RCC_SPI6CLKSOURCE_PLL2: SPI6 clock = PLL2
  2198. * @arg RCC_SPI6CLKSOURCE_PLL3: SPI6 clock = PLL3
  2199. * @arg RCC_SPI6CLKSOURCE_HSI: SPI6 clock = HSI
  2200. * @arg RCC_SPI6CLKSOURCE_CSI: SPI6 clock = CSI
  2201. * @arg RCC_SPI6CLKSOURCE_HSE: SPI6 clock = HSE
  2202. * @retval None
  2203. */
  2204. #define __HAL_RCC_SPI6_CONFIG(__RCC_SPI6CLKSource__ )\
  2205. MODIFY_REG(RCC->D3CCIPR, RCC_D3CCIPR_SPI6SEL, (__RCC_SPI6CLKSource__))
  2206. /** @brief Macro to get the SPI6 clock source.
  2207. * @retval The clock source can be one of the following values:
  2208. * @arg RCC_SPI6CLKSOURCE_D3PCLK1:SPI6 clock = D2PCLK1
  2209. * @arg RCC_SPI6CLKSOURCE_PLL2: SPI6 clock = PLL2
  2210. * @arg RCC_SPI6CLKSOURCE_PLL3: SPI6 clock = PLL3
  2211. * @arg RCC_SPI6CLKSOURCE_HSI: SPI6 clock = HSI
  2212. * @arg RCC_SPI6CLKSOURCE_CSI: SPI6 clock = CSI
  2213. * @arg RCC_SPI6CLKSOURCE_HSE: SPI6 clock = HSE
  2214. */
  2215. #define __HAL_RCC_GET_SPI6_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_SPI6SEL)))
  2216. /** @brief Macro to configure the SDMMC clock
  2217. * @param __SDMMCCLKSource__ specifies clock source for SDMMC
  2218. * This parameter can be one of the following values:
  2219. * @arg RCC_SDMMCCLKSOURCE_PLL: PLLQ selected as SDMMC clock
  2220. * @arg RCC_SDMMCCLKSOURCE_PLL2: PLL2R selected as SDMMC clock
  2221. */
  2222. #define __HAL_RCC_SDMMC_CONFIG(__SDMMCCLKSource__) \
  2223. MODIFY_REG(RCC->D1CCIPR, RCC_D1CCIPR_SDMMCSEL, (uint32_t)(__SDMMCCLKSource__))
  2224. /** @brief Macro to get the SDMMC clock
  2225. */
  2226. #define __HAL_RCC_GET_SDMMC_SOURCE() ((uint32_t)(READ_BIT(RCC->D1CCIPR, RCC_D1CCIPR_SDMMCSEL)))
  2227. /** @brief macro to configure the RNG clock (RNGCLK).
  2228. *
  2229. * @param __RNGCLKSource__ specifies the RNG clock source.
  2230. * This parameter can be one of the following values:
  2231. * @arg RCC_RNGCLKSOURCE_HSI48: HSI48 selected as RNG clock
  2232. * @arg RCC_RNGCLKSOURCE_PLL: PLL1Q selected as RNG clock
  2233. * @arg RCC_RNGCLKSOURCE_LSE: LSE selected as RNG clock
  2234. * @arg RCC_RNGCLKSOURCE_LSI: LSI selected as RNG clock
  2235. */
  2236. #define __HAL_RCC_RNG_CONFIG(__RNGCLKSource__) \
  2237. MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_RNGSEL, (uint32_t)(__RNGCLKSource__))
  2238. /** @brief macro to get the RNG clock source.
  2239. * @retval The clock source can be one of the following values:
  2240. * @arg RCC_RNGCLKSOURCE_HSI48: HSI48 selected as RNG clock
  2241. * @arg RCC_RNGCLKSOURCE_PLL: PLL1Q selected as RNG clock
  2242. * @arg RCC_RNGCLKSOURCE_LSE: LSE selected as RNG clock
  2243. * @arg RCC_RNGCLKSOURCE_LSI: LSI selected as RNG clock
  2244. */
  2245. #define __HAL_RCC_GET_RNG_SOURCE() ((uint32_t)(READ_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_RNGSEL)))
  2246. /** @defgroup RCCEx_HRTIMx_Clock_Config RCC Extended HRTIMx Clock Config
  2247. * @{
  2248. */
  2249. /** @brief Macro to configure the HRTIM1 prescaler clock source.
  2250. * @param __HRTIM1CLKSource__ specifies the HRTIM1 prescaler clock source.
  2251. * This parameter can be one of the following values:
  2252. * @arg @ref RCC_HRTIM1CLK_TIMCLK Timers clock selected as HRTIM1 prescaler clock
  2253. * @arg @ref RCC_HRTIM1CLK_CPUCLK CPU Clock selected as HRTIM1 clock
  2254. */
  2255. #define __HAL_RCC_HRTIM1_CONFIG(__HRTIM1CLKSource__) \
  2256. MODIFY_REG(RCC->CFGR, RCC_CFGR_HRTIMSEL, (uint32_t)(__HRTIM1CLKSource__))
  2257. /** @brief Macro to get the HRTIM1 clock source.
  2258. * @retval The clock source can be one of the following values:
  2259. * @arg @ref RCC_HRTIM1CLK_TIMCLK Timers clock selected as HRTIM1 prescaler clock
  2260. * @arg @ref RCC_HRTIM1CLK_CPUCLK CPU Clock selected as HRTIM1 clock
  2261. */
  2262. #define __HAL_RCC_GET_HRTIM1_SOURCE() ((uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_HRTIMSEL)))
  2263. /** @brief Macro to configure the Timers clocks prescalers
  2264. * @param __PRESC__ specifies the Timers clocks prescalers selection
  2265. * This parameter can be one of the following values:
  2266. * @arg RCC_TIMPRES_DESACTIVATED: The Timers kernels clocks prescaler is
  2267. * equal to rcc_hclk1 if D2PPREx is corresponding to division by 1 or 2,
  2268. * else it is equal to 2 x Frcc_pclkx_d2 (default after reset)
  2269. * @arg RCC_TIMPRES_ACTIVATED: The Timers kernels clocks prescaler is
  2270. * equal to rcc_hclk1 if D2PPREx is corresponding to division by 1, 2 or 4,
  2271. * else it is equal to 4 x Frcc_pclkx_d2
  2272. */
  2273. #define __HAL_RCC_TIMCLKPRESCALER(__PRESC__) do {RCC->CFGR &= ~(RCC_CFGR_TIMPRE);\
  2274. RCC->CFGR |= (__PRESC__); \
  2275. }while(0)
  2276. /**
  2277. * @}
  2278. */
  2279. /**
  2280. * @brief Enable the specified CRS interrupts.
  2281. * @param __INTERRUPT__ specifies the CRS interrupt sources to be enabled.
  2282. * This parameter can be any combination of the following values:
  2283. * @arg @ref RCC_CRS_IT_SYNCOK SYNC event OK interrupt
  2284. * @arg @ref RCC_CRS_IT_SYNCWARN SYNC warning interrupt
  2285. * @arg @ref RCC_CRS_IT_ERR Synchronization or trimming error interrupt
  2286. * @arg @ref RCC_CRS_IT_ESYNC Expected SYNC interrupt
  2287. * @retval None
  2288. */
  2289. #define __HAL_RCC_CRS_ENABLE_IT(__INTERRUPT__) SET_BIT(CRS->CR, (__INTERRUPT__))
  2290. /**
  2291. * @brief Disable the specified CRS interrupts.
  2292. * @param __INTERRUPT__ specifies the CRS interrupt sources to be disabled.
  2293. * This parameter can be any combination of the following values:
  2294. * @arg @ref RCC_CRS_IT_SYNCOK SYNC event OK interrupt
  2295. * @arg @ref RCC_CRS_IT_SYNCWARN SYNC warning interrupt
  2296. * @arg @ref RCC_CRS_IT_ERR Synchronization or trimming error interrupt
  2297. * @arg @ref RCC_CRS_IT_ESYNC Expected SYNC interrupt
  2298. * @retval None
  2299. */
  2300. #define __HAL_RCC_CRS_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(CRS->CR, (__INTERRUPT__))
  2301. /** @brief Check whether the CRS interrupt has occurred or not.
  2302. * @param __INTERRUPT__ specifies the CRS interrupt source to check.
  2303. * This parameter can be one of the following values:
  2304. * @arg @ref RCC_CRS_IT_SYNCOK SYNC event OK interrupt
  2305. * @arg @ref RCC_CRS_IT_SYNCWARN SYNC warning interrupt
  2306. * @arg @ref RCC_CRS_IT_ERR Synchronization or trimming error interrupt
  2307. * @arg @ref RCC_CRS_IT_ESYNC Expected SYNC interrupt
  2308. * @retval The new state of __INTERRUPT__ (SET or RESET).
  2309. */
  2310. #define __HAL_RCC_CRS_GET_IT_SOURCE(__INTERRUPT__) ((READ_BIT(CRS->CR, (__INTERRUPT__)) != 0U) ? SET : RESET)
  2311. /** @brief Clear the CRS interrupt pending bits
  2312. * @param __INTERRUPT__ specifies the interrupt pending bit to clear.
  2313. * This parameter can be any combination of the following values:
  2314. * @arg @ref RCC_CRS_IT_SYNCOK SYNC event OK interrupt
  2315. * @arg @ref RCC_CRS_IT_SYNCWARN SYNC warning interrupt
  2316. * @arg @ref RCC_CRS_IT_ERR Synchronization or trimming error interrupt
  2317. * @arg @ref RCC_CRS_IT_ESYNC Expected SYNC interrupt
  2318. * @arg @ref RCC_CRS_IT_TRIMOVF Trimming overflow or underflow interrupt
  2319. * @arg @ref RCC_CRS_IT_SYNCERR SYNC error interrupt
  2320. * @arg @ref RCC_CRS_IT_SYNCMISS SYNC missed interrupt
  2321. */
  2322. /* CRS IT Error Mask */
  2323. #define RCC_CRS_IT_ERROR_MASK ((uint32_t)(RCC_CRS_IT_TRIMOVF | RCC_CRS_IT_SYNCERR | RCC_CRS_IT_SYNCMISS))
  2324. #define __HAL_RCC_CRS_CLEAR_IT(__INTERRUPT__) do { \
  2325. if(((__INTERRUPT__) & RCC_CRS_IT_ERROR_MASK) != 0U) \
  2326. { \
  2327. WRITE_REG(CRS->ICR, CRS_ICR_ERRC | ((__INTERRUPT__) & ~RCC_CRS_IT_ERROR_MASK)); \
  2328. } \
  2329. else \
  2330. { \
  2331. WRITE_REG(CRS->ICR, (__INTERRUPT__)); \
  2332. } \
  2333. } while(0)
  2334. /**
  2335. * @brief Check whether the specified CRS flag is set or not.
  2336. * @param __FLAG__ specifies the flag to check.
  2337. * This parameter can be one of the following values:
  2338. * @arg @ref RCC_CRS_FLAG_SYNCOK SYNC event OK
  2339. * @arg @ref RCC_CRS_FLAG_SYNCWARN SYNC warning
  2340. * @arg @ref RCC_CRS_FLAG_ERR Error
  2341. * @arg @ref RCC_CRS_FLAG_ESYNC Expected SYNC
  2342. * @arg @ref RCC_CRS_FLAG_TRIMOVF Trimming overflow or underflow
  2343. * @arg @ref RCC_CRS_FLAG_SYNCERR SYNC error
  2344. * @arg @ref RCC_CRS_FLAG_SYNCMISS SYNC missed
  2345. * @retval The new state of _FLAG_ (TRUE or FALSE).
  2346. */
  2347. #define __HAL_RCC_CRS_GET_FLAG(__FLAG__) (READ_BIT(CRS->ISR, (__FLAG__)) == (__FLAG__))
  2348. /**
  2349. * @brief Clear the CRS specified FLAG.
  2350. * @param __FLAG__ specifies the flag to clear.
  2351. * This parameter can be one of the following values:
  2352. * @arg @ref RCC_CRS_FLAG_SYNCOK SYNC event OK
  2353. * @arg @ref RCC_CRS_FLAG_SYNCWARN SYNC warning
  2354. * @arg @ref RCC_CRS_FLAG_ERR Error
  2355. * @arg @ref RCC_CRS_FLAG_ESYNC Expected SYNC
  2356. * @arg @ref RCC_CRS_FLAG_TRIMOVF Trimming overflow or underflow
  2357. * @arg @ref RCC_CRS_FLAG_SYNCERR SYNC error
  2358. * @arg @ref RCC_CRS_FLAG_SYNCMISS SYNC missed
  2359. * @note RCC_CRS_FLAG_ERR clears RCC_CRS_FLAG_TRIMOVF, RCC_CRS_FLAG_SYNCERR, RCC_CRS_FLAG_SYNCMISS and consequently RCC_CRS_FLAG_ERR
  2360. * @retval None
  2361. */
  2362. /* CRS Flag Error Mask */
  2363. #define RCC_CRS_FLAG_ERROR_MASK ((uint32_t)(RCC_CRS_FLAG_TRIMOVF | RCC_CRS_FLAG_SYNCERR | RCC_CRS_FLAG_SYNCMISS))
  2364. #define __HAL_RCC_CRS_CLEAR_FLAG(__FLAG__) do { \
  2365. if(((__FLAG__) & RCC_CRS_FLAG_ERROR_MASK) != 0U) \
  2366. { \
  2367. WRITE_REG(CRS->ICR, CRS_ICR_ERRC | ((__FLAG__) & ~RCC_CRS_FLAG_ERROR_MASK)); \
  2368. } \
  2369. else \
  2370. { \
  2371. WRITE_REG(CRS->ICR, (__FLAG__)); \
  2372. } \
  2373. } while(0)
  2374. /** @defgroup RCCEx_CRS_Extended_Features RCCEx CRS Extended Features
  2375. * @{
  2376. */
  2377. /**
  2378. * @brief Enable the oscillator clock for frequency error counter.
  2379. * @note when the CEN bit is set the CRS_CFGR register becomes write-protected.
  2380. * @retval None
  2381. */
  2382. #define __HAL_RCC_CRS_FREQ_ERROR_COUNTER_ENABLE() SET_BIT(CRS->CR, CRS_CR_CEN)
  2383. /**
  2384. * @brief Disable the oscillator clock for frequency error counter.
  2385. * @retval None
  2386. */
  2387. #define __HAL_RCC_CRS_FREQ_ERROR_COUNTER_DISABLE() CLEAR_BIT(CRS->CR, CRS_CR_CEN)
  2388. /**
  2389. * @brief Enable the automatic hardware adjustment of TRIM bits.
  2390. * @note When the AUTOTRIMEN bit is set the CRS_CFGR register becomes write-protected.
  2391. * @retval None
  2392. */
  2393. #define __HAL_RCC_CRS_AUTOMATIC_CALIB_ENABLE() SET_BIT(CRS->CR, CRS_CR_AUTOTRIMEN)
  2394. /**
  2395. * @brief Enable or disable the automatic hardware adjustment of TRIM bits.
  2396. * @retval None
  2397. */
  2398. #define __HAL_RCC_CRS_AUTOMATIC_CALIB_DISABLE() CLEAR_BIT(CRS->CR, CRS_CR_AUTOTRIMEN)
  2399. /**
  2400. * @brief Macro to calculate reload value to be set in CRS register according to target and sync frequencies
  2401. * @note The RELOAD value should be selected according to the ratio between the target frequency and the frequency
  2402. * of the synchronization source after pre-scaling. It is then decreased by one in order to
  2403. * reach the expected synchronization on the zero value. The formula is the following:
  2404. * RELOAD = (fTARGET / fSYNC) -1
  2405. * @param __FTARGET__ Target frequency (value in Hz)
  2406. * @param __FSYNC__ Synchronization signal frequency (value in Hz)
  2407. * @retval None
  2408. */
  2409. #define __HAL_RCC_CRS_RELOADVALUE_CALCULATE(__FTARGET__, __FSYNC__) (((__FTARGET__) / (__FSYNC__)) - 1U)
  2410. /**
  2411. * @}
  2412. */
  2413. /**
  2414. * @}
  2415. */
  2416. /* Exported functions --------------------------------------------------------*/
  2417. /** @addtogroup RCCEx_Exported_Functions_Group1
  2418. * @{
  2419. */
  2420. HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  2421. void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  2422. uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk);
  2423. uint32_t HAL_RCCEx_GetD1PCLK1Freq(void);
  2424. uint32_t HAL_RCCEx_GetD3PCLK1Freq(void);
  2425. uint32_t HAL_RCCEx_GetD1SysClockFreq(void);
  2426. void HAL_RCCEx_GetPLL1ClockFreq(PLL1_ClocksTypeDef* PLL1_Clocks);
  2427. void HAL_RCCEx_GetPLL2ClockFreq(PLL2_ClocksTypeDef* PLL2_Clocks);
  2428. void HAL_RCCEx_GetPLL3ClockFreq(PLL3_ClocksTypeDef* PLL3_Clocks);
  2429. /**
  2430. * @}
  2431. */
  2432. /** @addtogroup RCCEx_Exported_Functions_Group2
  2433. * @{
  2434. */
  2435. void HAL_RCCEx_WakeUpStopCLKConfig(uint32_t WakeUpClk);
  2436. void HAL_RCCEx_KerWakeUpStopCLKConfig(uint32_t WakeUpClk);
  2437. void HAL_RCCEx_EnableLSECSS(void);
  2438. void HAL_RCCEx_DisableLSECSS(void);
  2439. #if defined(DUAL_CORE)
  2440. void HAL_RCCEx_EnableBootCore(uint32_t RCC_BootCx);
  2441. #endif /*DUAL_CORE*/
  2442. void HAL_RCCEx_WWDGxSysResetConfig(uint32_t RCC_WWDGx);
  2443. /**
  2444. * @}
  2445. */
  2446. /** @addtogroup RCCEx_Exported_Functions_Group3
  2447. * @{
  2448. */
  2449. void HAL_RCCEx_CRSConfig(RCC_CRSInitTypeDef *pInit);
  2450. void HAL_RCCEx_CRSSoftwareSynchronizationGenerate(void);
  2451. void HAL_RCCEx_CRSGetSynchronizationInfo(RCC_CRSSynchroInfoTypeDef *pSynchroInfo);
  2452. uint32_t HAL_RCCEx_CRSWaitSynchronization(uint32_t Timeout);
  2453. void HAL_RCCEx_CRS_IRQHandler(void);
  2454. void HAL_RCCEx_CRS_SyncOkCallback(void);
  2455. void HAL_RCCEx_CRS_SyncWarnCallback(void);
  2456. void HAL_RCCEx_CRS_ExpectedSyncCallback(void);
  2457. void HAL_RCCEx_CRS_ErrorCallback(uint32_t Error);
  2458. /**
  2459. * @}
  2460. */
  2461. /* Private macros ------------------------------------------------------------*/
  2462. /** @addtogroup RCCEx_Private_Macros RCCEx Private Macros
  2463. * @{
  2464. */
  2465. /** @defgroup RCCEx_IS_RCC_Definitions RCC Private macros to check input parameters
  2466. * @{
  2467. */
  2468. #define IS_RCC_PLL2CLOCKOUT_VALUE(VALUE) (((VALUE) == RCC_PLL2_DIVP) || \
  2469. ((VALUE) == RCC_PLL2_DIVQ) || \
  2470. ((VALUE) == RCC_PLL2_DIVR))
  2471. #define IS_RCC_PLL3CLOCKOUT_VALUE(VALUE) (((VALUE) == RCC_PLL3_DIVP) || \
  2472. ((VALUE) == RCC_PLL3_DIVQ) || \
  2473. ((VALUE) == RCC_PLL3_DIVR))
  2474. #define IS_RCC_USART16CLKSOURCE(SOURCE) (((SOURCE) == RCC_USART16CLKSOURCE_D2PCLK2)|| \
  2475. ((SOURCE) == RCC_USART16CLKSOURCE_PLL2) || \
  2476. ((SOURCE) == RCC_USART16CLKSOURCE_PLL3) || \
  2477. ((SOURCE) == RCC_USART16CLKSOURCE_CSI) || \
  2478. ((SOURCE) == RCC_USART16CLKSOURCE_LSE) || \
  2479. ((SOURCE) == RCC_USART16CLKSOURCE_HSI))
  2480. #define IS_RCC_USART234578CLKSOURCE(SOURCE) (((SOURCE) == RCC_USART234578CLKSOURCE_D2PCLK1)|| \
  2481. ((SOURCE) == RCC_USART234578CLKSOURCE_PLL2) || \
  2482. ((SOURCE) == RCC_USART234578CLKSOURCE_PLL3) || \
  2483. ((SOURCE) == RCC_USART234578CLKSOURCE_CSI) || \
  2484. ((SOURCE) == RCC_USART234578CLKSOURCE_LSE) || \
  2485. ((SOURCE) == RCC_USART234578CLKSOURCE_HSI))
  2486. #define IS_RCC_USART1CLKSOURCE(SOURCE) (((SOURCE) == RCC_USART1CLKSOURCE_D2PCLK2)|| \
  2487. ((SOURCE) == RCC_USART1CLKSOURCE_PLL2) || \
  2488. ((SOURCE) == RCC_USART1CLKSOURCE_PLL3) || \
  2489. ((SOURCE) == RCC_USART1CLKSOURCE_CSI) || \
  2490. ((SOURCE) == RCC_USART1CLKSOURCE_LSE) || \
  2491. ((SOURCE) == RCC_USART1CLKSOURCE_HSI))
  2492. #define IS_RCC_USART2CLKSOURCE(SOURCE) (((SOURCE) == RCC_USART2CLKSOURCE_D2PCLK1)|| \
  2493. ((SOURCE) == RCC_USART2CLKSOURCE_PLL2) || \
  2494. ((SOURCE) == RCC_USART2CLKSOURCE_PLL3) || \
  2495. ((SOURCE) == RCC_USART2CLKSOURCE_CSI) || \
  2496. ((SOURCE) == RCC_USART2CLKSOURCE_LSE) || \
  2497. ((SOURCE) == RCC_USART2CLKSOURCE_HSI))
  2498. #define IS_RCC_USART3CLKSOURCE(SOURCE) (((SOURCE) == RCC_USART3CLKSOURCE_D2PCLK1)|| \
  2499. ((SOURCE) == RCC_USART3CLKSOURCE_PLL2) || \
  2500. ((SOURCE) == RCC_USART3CLKSOURCE_PLL3) || \
  2501. ((SOURCE) == RCC_USART3CLKSOURCE_CSI) || \
  2502. ((SOURCE) == RCC_USART3CLKSOURCE_LSE) || \
  2503. ((SOURCE) == RCC_USART3CLKSOURCE_HSI))
  2504. #define IS_RCC_UART4CLKSOURCE(SOURCE) (((SOURCE) == RCC_UART4CLKSOURCE_D2PCLK1) || \
  2505. ((SOURCE) == RCC_UART4CLKSOURCE_PLL2) || \
  2506. ((SOURCE) == RCC_UART4CLKSOURCE_PLL3) || \
  2507. ((SOURCE) == RCC_UART4CLKSOURCE_CSI) || \
  2508. ((SOURCE) == RCC_UART4CLKSOURCE_LSE) || \
  2509. ((SOURCE) == RCC_UART4CLKSOURCE_HSI))
  2510. #define IS_RCC_UART5CLKSOURCE(SOURCE) (((SOURCE) == RCC_UART5CLKSOURCE_D2PCLK1) || \
  2511. ((SOURCE) == RCC_UART5CLKSOURCE_PLL2) || \
  2512. ((SOURCE) == RCC_UART5CLKSOURCE_PLL3) || \
  2513. ((SOURCE) == RCC_UART5CLKSOURCE_CSI) || \
  2514. ((SOURCE) == RCC_UART5CLKSOURCE_LSE) || \
  2515. ((SOURCE) == RCC_UART5CLKSOURCE_HSI))
  2516. #define IS_RCC_USART6CLKSOURCE(SOURCE) (((SOURCE) == RCC_USART6CLKSOURCE_D2PCLK2)|| \
  2517. ((SOURCE) == RCC_USART6CLKSOURCE_PLL2) || \
  2518. ((SOURCE) == RCC_USART6CLKSOURCE_PLL3) || \
  2519. ((SOURCE) == RCC_USART6CLKSOURCE_CSI) || \
  2520. ((SOURCE) == RCC_USART6CLKSOURCE_LSE) || \
  2521. ((SOURCE) == RCC_USART6CLKSOURCE_HSI))
  2522. #define IS_RCC_UART7CLKSOURCE(SOURCE) (((SOURCE) == RCC_UART7CLKSOURCE_D2PCLK1)|| \
  2523. ((SOURCE) == RCC_UART7CLKSOURCE_PLL2) || \
  2524. ((SOURCE) == RCC_UART7CLKSOURCE_PLL3) || \
  2525. ((SOURCE) == RCC_UART7CLKSOURCE_CSI) || \
  2526. ((SOURCE) == RCC_UART7CLKSOURCE_LSE) || \
  2527. ((SOURCE) == RCC_UART7CLKSOURCE_HSI))
  2528. #define IS_RCC_UART8CLKSOURCE(SOURCE) (((SOURCE) == RCC_UART8CLKSOURCE_D2PCLK1)|| \
  2529. ((SOURCE) == RCC_UART8CLKSOURCE_PLL2) || \
  2530. ((SOURCE) == RCC_UART8CLKSOURCE_PLL3) || \
  2531. ((SOURCE) == RCC_UART8CLKSOURCE_CSI) || \
  2532. ((SOURCE) == RCC_UART8CLKSOURCE_LSE) || \
  2533. ((SOURCE) == RCC_UART8CLKSOURCE_HSI))
  2534. #define IS_RCC_LPUART1CLKSOURCE(SOURCE) (((SOURCE) == RCC_LPUART1CLKSOURCE_D3PCLK1) || \
  2535. ((SOURCE) == RCC_LPUART1CLKSOURCE_PLL2) || \
  2536. ((SOURCE) == RCC_LPUART1CLKSOURCE_PLL3) || \
  2537. ((SOURCE) == RCC_LPUART1CLKSOURCE_CSI) || \
  2538. ((SOURCE) == RCC_LPUART1CLKSOURCE_LSE) || \
  2539. ((SOURCE) == RCC_LPUART1CLKSOURCE_HSI))
  2540. #define IS_RCC_I2C123CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2C123CLKSOURCE_PLL3) || \
  2541. ((SOURCE) == RCC_I2C123CLKSOURCE_HSI) || \
  2542. ((SOURCE) == RCC_I2C123CLKSOURCE_D2PCLK1)|| \
  2543. ((SOURCE) == RCC_I2C123CLKSOURCE_CSI))
  2544. #define IS_RCC_I2C1CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2C1CLKSOURCE_PLL3) || \
  2545. ((SOURCE) == RCC_I2C1CLKSOURCE_HSI) || \
  2546. ((SOURCE) == RCC_I2C1CLKSOURCE_D2PCLK1)|| \
  2547. ((SOURCE) == RCC_I2C1CLKSOURCE_CSI))
  2548. #define IS_RCC_I2C2CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2C2CLKSOURCE_PLL3) || \
  2549. ((SOURCE) == RCC_I2C2CLKSOURCE_HSI) || \
  2550. ((SOURCE) == RCC_I2C2CLKSOURCE_D2PCLK1)|| \
  2551. ((SOURCE) == RCC_I2C2CLKSOURCE_CSI))
  2552. #define IS_RCC_I2C3CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2C3CLKSOURCE_PLL3) || \
  2553. ((SOURCE) == RCC_I2C3CLKSOURCE_HSI) || \
  2554. ((SOURCE) == RCC_I2C3CLKSOURCE_D2PCLK1)|| \
  2555. ((SOURCE) == RCC_I2C3CLKSOURCE_CSI))
  2556. #define IS_RCC_I2C4CLKSOURCE(SOURCE) (((SOURCE) == RCC_I2C4CLKSOURCE_PLL3) || \
  2557. ((SOURCE) == RCC_I2C4CLKSOURCE_HSI) || \
  2558. ((SOURCE) == RCC_I2C4CLKSOURCE_D3PCLK1)|| \
  2559. ((SOURCE) == RCC_I2C3CLKSOURCE_CSI))
  2560. #define IS_RCC_RNGCLKSOURCE(SOURCE) (((SOURCE) == RCC_RNGCLKSOURCE_HSI48)|| \
  2561. ((SOURCE) == RCC_RNGCLKSOURCE_PLL) || \
  2562. ((SOURCE) == RCC_RNGCLKSOURCE_LSE) || \
  2563. ((SOURCE) == RCC_RNGCLKSOURCE_LSI))
  2564. #define IS_RCC_HRTIM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_HRTIM1CLK_TIMCLK) || \
  2565. ((SOURCE) == RCC_HRTIM1CLK_CPUCLK))
  2566. #define IS_RCC_USBCLKSOURCE(SOURCE) (((SOURCE) == RCC_USBCLKSOURCE_PLL) || \
  2567. ((SOURCE) == RCC_USBCLKSOURCE_PLL3) || \
  2568. ((SOURCE) == RCC_USBCLKSOURCE_HSI48))
  2569. #define IS_RCC_SAI1CLK(__SOURCE__) \
  2570. (((__SOURCE__) == RCC_SAI1CLKSOURCE_PLL) || \
  2571. ((__SOURCE__) == RCC_SAI1CLKSOURCE_PLL2) || \
  2572. ((__SOURCE__) == RCC_SAI1CLKSOURCE_PLL3) || \
  2573. ((__SOURCE__) == RCC_SAI1CLKSOURCE_CLKP) || \
  2574. ((__SOURCE__) == RCC_SAI1CLKSOURCE_PIN))
  2575. #define IS_RCC_SAI23CLK(__SOURCE__) \
  2576. (((__SOURCE__) == RCC_SAI23CLKSOURCE_PLL) || \
  2577. ((__SOURCE__) == RCC_SAI23CLKSOURCE_PLL2) || \
  2578. ((__SOURCE__) == RCC_SAI23CLKSOURCE_PLL3) || \
  2579. ((__SOURCE__) == RCC_SAI23CLKSOURCE_CLKP) || \
  2580. ((__SOURCE__) == RCC_SAI23CLKSOURCE_PIN))
  2581. #define IS_RCC_SAI2CLK(__SOURCE__) \
  2582. (((__SOURCE__) == RCC_SAI2CLKSOURCE_PLL) || \
  2583. ((__SOURCE__) == RCC_SAI2CLKSOURCE_PLL2) || \
  2584. ((__SOURCE__) == RCC_SAI2CLKSOURCE_PLL3) || \
  2585. ((__SOURCE__) == RCC_SAI2CLKSOURCE_CLKP) || \
  2586. ((__SOURCE__) == RCC_SAI2CLKSOURCE_PIN))
  2587. #define IS_RCC_SAI3CLK(__SOURCE__) \
  2588. (((__SOURCE__) == RCC_SAI3CLKSOURCE_PLL) || \
  2589. ((__SOURCE__) == RCC_SAI3CLKSOURCE_PLL2) || \
  2590. ((__SOURCE__) == RCC_SAI3CLKSOURCE_PLL3) || \
  2591. ((__SOURCE__) == RCC_SAI3CLKSOURCE_CLKP) || \
  2592. ((__SOURCE__) == RCC_SAI3CLKSOURCE_PIN))
  2593. #define IS_RCC_SPI123CLK(__SOURCE__) \
  2594. (((__SOURCE__) == RCC_SPI123CLKSOURCE_PLL) || \
  2595. ((__SOURCE__) == RCC_SPI123CLKSOURCE_PLL2) || \
  2596. ((__SOURCE__) == RCC_SPI123CLKSOURCE_PLL3) || \
  2597. ((__SOURCE__) == RCC_SPI123CLKSOURCE_CLKP) || \
  2598. ((__SOURCE__) == RCC_SPI123CLKSOURCE_PIN))
  2599. #define IS_RCC_SPI1CLK(__SOURCE__) \
  2600. (((__SOURCE__) == RCC_SPI1CLKSOURCE_PLL) || \
  2601. ((__SOURCE__) == RCC_SPI1CLKSOURCE_PLL2) || \
  2602. ((__SOURCE__) == RCC_SPI1CLKSOURCE_PLL3) || \
  2603. ((__SOURCE__) == RCC_SPI1CLKSOURCE_CLKP) || \
  2604. ((__SOURCE__) == RCC_SPI1CLKSOURCE_PIN))
  2605. #define IS_RCC_SPI2CLK(__SOURCE__) \
  2606. (((__SOURCE__) == RCC_SPI2CLKSOURCE_PLL) || \
  2607. ((__SOURCE__) == RCC_SPI2CLKSOURCE_PLL2) || \
  2608. ((__SOURCE__) == RCC_SPI2CLKSOURCE_PLL3) || \
  2609. ((__SOURCE__) == RCC_SPI2CLKSOURCE_CLKP) || \
  2610. ((__SOURCE__) == RCC_SPI2CLKSOURCE_PIN))
  2611. #define IS_RCC_SPI3CLK(__SOURCE__) \
  2612. (((__SOURCE__) == RCC_SPI3CLKSOURCE_PLL) || \
  2613. ((__SOURCE__) == RCC_SPI3CLKSOURCE_PLL2) || \
  2614. ((__SOURCE__) == RCC_SPI3CLKSOURCE_PLL3) || \
  2615. ((__SOURCE__) == RCC_SPI3CLKSOURCE_CLKP) || \
  2616. ((__SOURCE__) == RCC_SPI3CLKSOURCE_PIN))
  2617. #define IS_RCC_SPI45CLK(__SOURCE__) \
  2618. (((__SOURCE__) == RCC_SPI45CLKSOURCE_D2PCLK1) || \
  2619. ((__SOURCE__) == RCC_SPI45CLKSOURCE_PLL2) || \
  2620. ((__SOURCE__) == RCC_SPI45CLKSOURCE_PLL3) || \
  2621. ((__SOURCE__) == RCC_SPI45CLKSOURCE_HSI) || \
  2622. ((__SOURCE__) == RCC_SPI45CLKSOURCE_CSI) || \
  2623. ((__SOURCE__) == RCC_SPI45CLKSOURCE_HSE))
  2624. #define IS_RCC_SPI4CLK(__SOURCE__) \
  2625. (((__SOURCE__) == RCC_SPI4CLKSOURCE_D2PCLK1) || \
  2626. ((__SOURCE__) == RCC_SPI4CLKSOURCE_PLL2) || \
  2627. ((__SOURCE__) == RCC_SPI4CLKSOURCE_PLL3) || \
  2628. ((__SOURCE__) == RCC_SPI4CLKSOURCE_HSI) || \
  2629. ((__SOURCE__) == RCC_SPI4CLKSOURCE_CSI) || \
  2630. ((__SOURCE__) == RCC_SPI4CLKSOURCE_HSE))
  2631. #define IS_RCC_SPI5CLK(__SOURCE__) \
  2632. (((__SOURCE__) == RCC_SPI5CLKSOURCE_D2PCLK1)|| \
  2633. ((__SOURCE__) == RCC_SPI5CLKSOURCE_PLL2) || \
  2634. ((__SOURCE__) == RCC_SPI5CLKSOURCE_PLL3) || \
  2635. ((__SOURCE__) == RCC_SPI5CLKSOURCE_HSI) || \
  2636. ((__SOURCE__) == RCC_SPI5CLKSOURCE_CSI) || \
  2637. ((__SOURCE__) == RCC_SPI5CLKSOURCE_HSE))
  2638. #define IS_RCC_SPI6CLK(__SOURCE__) \
  2639. (((__SOURCE__) == RCC_SPI6CLKSOURCE_D3PCLK1) || \
  2640. ((__SOURCE__) == RCC_SPI6CLKSOURCE_PLL2) || \
  2641. ((__SOURCE__) == RCC_SPI6CLKSOURCE_PLL3) || \
  2642. ((__SOURCE__) == RCC_SPI6CLKSOURCE_HSI) || \
  2643. ((__SOURCE__) == RCC_SPI6CLKSOURCE_CSI) || \
  2644. ((__SOURCE__) == RCC_SPI6CLKSOURCE_HSE))
  2645. #define IS_RCC_SAI4ACLK(__SOURCE__) \
  2646. (((__SOURCE__) == RCC_SAI4ACLKSOURCE_PLL) || \
  2647. ((__SOURCE__) == RCC_SAI4ACLKSOURCE_PLL2) || \
  2648. ((__SOURCE__) == RCC_SAI4ACLKSOURCE_PLL3) || \
  2649. ((__SOURCE__) == RCC_SAI4ACLKSOURCE_CLKP) || \
  2650. ((__SOURCE__) == RCC_SAI4ACLKSOURCE_PIN))
  2651. #define IS_RCC_SAI4BCLK(__SOURCE__) \
  2652. (((__SOURCE__) == RCC_SAI4BCLKSOURCE_PLL) || \
  2653. ((__SOURCE__) == RCC_SAI4BCLKSOURCE_PLL2) || \
  2654. ((__SOURCE__) == RCC_SAI4BCLKSOURCE_PLL3) || \
  2655. ((__SOURCE__) == RCC_SAI4BCLKSOURCE_CLKP) || \
  2656. ((__SOURCE__) == RCC_SAI4BCLKSOURCE_PIN))
  2657. #define IS_RCC_PLL3M_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 63U))
  2658. #define IS_RCC_PLL3N_VALUE(VALUE) ((4U <= (VALUE)) && ((VALUE) <= 512U))
  2659. #define IS_RCC_PLL3P_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 128U))
  2660. #define IS_RCC_PLL3Q_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 128U))
  2661. #define IS_RCC_PLL3R_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 128U))
  2662. #define IS_RCC_PLL2M_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 63U))
  2663. #define IS_RCC_PLL2N_VALUE(VALUE) ((4U <= (VALUE)) && ((VALUE) <= 512U))
  2664. #define IS_RCC_PLL2P_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 128U))
  2665. #define IS_RCC_PLL2Q_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 128U))
  2666. #define IS_RCC_PLL2R_VALUE(VALUE) ((1U <= (VALUE)) && ((VALUE) <= 128U))
  2667. #define IS_RCC_PLL2RGE_VALUE(VALUE) (((VALUE) == RCC_PLL2VCIRANGE_0) || \
  2668. ((VALUE) == RCC_PLL2VCIRANGE_1) || \
  2669. ((VALUE) == RCC_PLL2VCIRANGE_2) || \
  2670. ((VALUE) == RCC_PLL2VCIRANGE_3))
  2671. #define IS_RCC_PLL3RGE_VALUE(VALUE) (((VALUE) == RCC_PLL3VCIRANGE_0) || \
  2672. ((VALUE) == RCC_PLL3VCIRANGE_1) || \
  2673. ((VALUE) == RCC_PLL3VCIRANGE_2) || \
  2674. ((VALUE) == RCC_PLL3VCIRANGE_3))
  2675. #define IS_RCC_PLL2VCO_VALUE(VALUE) (((VALUE) == RCC_PLL2VCOWIDE) || \
  2676. ((VALUE) == RCC_PLL2VCOMEDIUM))
  2677. #define IS_RCC_PLL3VCO_VALUE(VALUE) (((VALUE) == RCC_PLL3VCOWIDE) || \
  2678. ((VALUE) == RCC_PLL3VCOMEDIUM))
  2679. #define IS_RCC_PLLFRACN_VALUE(VALUE) ((VALUE) <=8191U)
  2680. #define IS_RCC_LPTIM1CLK(SOURCE) (((SOURCE) == RCC_LPTIM1CLKSOURCE_D2PCLK1)|| \
  2681. ((SOURCE) == RCC_LPTIM1CLKSOURCE_PLL2) || \
  2682. ((SOURCE) == RCC_LPTIM1CLKSOURCE_PLL3) || \
  2683. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE) || \
  2684. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) || \
  2685. ((SOURCE) == RCC_LPTIM1CLKSOURCE_CLKP))
  2686. #define IS_RCC_LPTIM2CLK(SOURCE) (((SOURCE) == RCC_LPTIM2CLKSOURCE_D3PCLK1)|| \
  2687. ((SOURCE) == RCC_LPTIM2CLKSOURCE_PLL2) || \
  2688. ((SOURCE) == RCC_LPTIM2CLKSOURCE_PLL3) || \
  2689. ((SOURCE) == RCC_LPTIM2CLKSOURCE_LSE) || \
  2690. ((SOURCE) == RCC_LPTIM2CLKSOURCE_LSI) || \
  2691. ((SOURCE) == RCC_LPTIM2CLKSOURCE_CLKP))
  2692. #define IS_RCC_LPTIM345CLK(SOURCE) (((SOURCE) == RCC_LPTIM345CLKSOURCE_D3PCLK1)|| \
  2693. ((SOURCE) == RCC_LPTIM345CLKSOURCE_PLL2) || \
  2694. ((SOURCE) == RCC_LPTIM345CLKSOURCE_PLL3) || \
  2695. ((SOURCE) == RCC_LPTIM345CLKSOURCE_LSE) || \
  2696. ((SOURCE) == RCC_LPTIM345CLKSOURCE_LSI) || \
  2697. ((SOURCE) == RCC_LPTIM345CLKSOURCE_CLKP))
  2698. #define IS_RCC_LPTIM3CLK(SOURCE) (((SOURCE) == RCC_LPTIM3CLKSOURCE_D3PCLK1)|| \
  2699. ((SOURCE) == RCC_LPTIM3CLKSOURCE_PLL2) || \
  2700. ((SOURCE) == RCC_LPTIM3CLKSOURCE_PLL3) || \
  2701. ((SOURCE) == RCC_LPTIM3CLKSOURCE_LSE) || \
  2702. ((SOURCE) == RCC_LPTIM3CLKSOURCE_LSI) || \
  2703. ((SOURCE) == RCC_LPTIM3CLKSOURCE_CLKP))
  2704. #define IS_RCC_LPTIM4CLK(SOURCE) (((SOURCE) == RCC_LPTIM4CLKSOURCE_D3PCLK1)|| \
  2705. ((SOURCE) == RCC_LPTIM4CLKSOURCE_PLL2) || \
  2706. ((SOURCE) == RCC_LPTIM4CLKSOURCE_PLL3) || \
  2707. ((SOURCE) == RCC_LPTIM4CLKSOURCE_LSE) || \
  2708. ((SOURCE) == RCC_LPTIM4CLKSOURCE_LSI) || \
  2709. ((SOURCE) == RCC_LPTIM4CLKSOURCE_CLKP))
  2710. #define IS_RCC_LPTIM5CLK(SOURCE) (((SOURCE) == RCC_LPTIM5CLKSOURCE_D3PCLK1)|| \
  2711. ((SOURCE) == RCC_LPTIM5CLKSOURCE_PLL2) || \
  2712. ((SOURCE) == RCC_LPTIM5CLKSOURCE_PLL3) || \
  2713. ((SOURCE) == RCC_LPTIM5CLKSOURCE_LSE) || \
  2714. ((SOURCE) == RCC_LPTIM5CLKSOURCE_LSI) || \
  2715. ((SOURCE) == RCC_LPTIM5CLKSOURCE_CLKP))
  2716. #define IS_RCC_QSPICLK(__SOURCE__) \
  2717. (((__SOURCE__) == RCC_QSPICLKSOURCE_D1HCLK) || \
  2718. ((__SOURCE__) == RCC_QSPICLKSOURCE_PLL) || \
  2719. ((__SOURCE__) == RCC_QSPICLKSOURCE_PLL2) || \
  2720. ((__SOURCE__) == RCC_QSPICLKSOURCE_CLKP))
  2721. #if defined(DSI)
  2722. #define IS_RCC_DSICLK(__SOURCE__) \
  2723. (((__SOURCE__) == RCC_DSICLKSOURCE_PHY) || \
  2724. ((__SOURCE__) == RCC_DSICLKSOURCE_PLL2))
  2725. #endif /*DSI*/
  2726. #define IS_RCC_FMCCLK(__SOURCE__) \
  2727. (((__SOURCE__) == RCC_FMCCLKSOURCE_D1HCLK) || \
  2728. ((__SOURCE__) == RCC_FMCCLKSOURCE_PLL) || \
  2729. ((__SOURCE__) == RCC_FMCCLKSOURCE_PLL2) || \
  2730. ((__SOURCE__) == RCC_FMCCLKSOURCE_CLKP))
  2731. #if defined(FDCAN1) || defined(FDCAN2)
  2732. #define IS_RCC_FDCANCLK(__SOURCE__) \
  2733. (((__SOURCE__) == RCC_FDCANCLKSOURCE_HSE) || \
  2734. ((__SOURCE__) == RCC_FDCANCLKSOURCE_PLL) || \
  2735. ((__SOURCE__) == RCC_FDCANCLKSOURCE_PLL2))
  2736. #endif /*FDCAN1 || FDCAN2*/
  2737. #define IS_RCC_SDMMC(__SOURCE__) \
  2738. (((__SOURCE__) == RCC_SDMMCCLKSOURCE_PLL) || \
  2739. ((__SOURCE__) == RCC_SDMMCCLKSOURCE_PLL2))
  2740. #define IS_RCC_ADCCLKSOURCE(SOURCE) (((SOURCE) == RCC_ADCCLKSOURCE_PLL2) || \
  2741. ((SOURCE) == RCC_ADCCLKSOURCE_PLL3) || \
  2742. ((SOURCE) == RCC_ADCCLKSOURCE_CLKP))
  2743. #define IS_RCC_SWPMI1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SWPMI1CLKSOURCE_D2PCLK1) || \
  2744. ((SOURCE) == RCC_SWPMI1CLKSOURCE_HSI))
  2745. #define IS_RCC_DFSDM1CLKSOURCE(SOURCE) (((SOURCE) == RCC_DFSDM1CLKSOURCE_D2PCLK1) || \
  2746. ((SOURCE) == RCC_DFSDM1CLKSOURCE_SYS))
  2747. #define IS_RCC_SPDIFRXCLKSOURCE(SOURCE)(((SOURCE) == RCC_SPDIFRXCLKSOURCE_PLL) || \
  2748. ((SOURCE) == RCC_SPDIFRXCLKSOURCE_PLL2) || \
  2749. ((SOURCE) == RCC_SPDIFRXCLKSOURCE_PLL3) || \
  2750. ((SOURCE) == RCC_SPDIFRXCLKSOURCE_HSI))
  2751. #define IS_RCC_CECCLKSOURCE(SOURCE) (((SOURCE) == RCC_CECCLKSOURCE_LSE) || \
  2752. ((SOURCE) == RCC_CECCLKSOURCE_LSI) || \
  2753. ((SOURCE) == RCC_CECCLKSOURCE_CSI))
  2754. #define IS_RCC_CLKPSOURCE(SOURCE) (((SOURCE) == RCC_CLKPSOURCE_HSI) || \
  2755. ((SOURCE) == RCC_CLKPSOURCE_CSI) || \
  2756. ((SOURCE) == RCC_CLKPSOURCE_HSE))
  2757. #define IS_RCC_TIMPRES(VALUE) \
  2758. (((VALUE) == RCC_TIMPRES_DESACTIVATED) || \
  2759. ((VALUE) == RCC_TIMPRES_ACTIVATED))
  2760. #if defined(DUAL_CORE)
  2761. #define IS_RCC_BOOT_CORE(CORE) (((CORE) == RCC_BOOT_C1) || \
  2762. ((CORE) == RCC_BOOT_C2))
  2763. #endif /*DUAL_CORE*/
  2764. #if defined(DUAL_CORE)
  2765. #define IS_RCC_SCOPE_WWDG(WWDG) (((WWDG) == RCC_WWDG1) || \
  2766. ((WWDG) == RCC_WWDG2))
  2767. #else
  2768. #define IS_RCC_SCOPE_WWDG(WWDG) ((WWDG) == RCC_WWDG1)
  2769. #endif /*DUAL_CORE*/
  2770. #define IS_RCC_CRS_SYNC_SOURCE(__SOURCE__) (((__SOURCE__) == RCC_CRS_SYNC_SOURCE_USB2) || \
  2771. ((__SOURCE__) == RCC_CRS_SYNC_SOURCE_LSE) || \
  2772. ((__SOURCE__) == RCC_CRS_SYNC_SOURCE_USB1) || \
  2773. ((__SOURCE__) == RCC_CRS_SYNC_SOURCE_PIN))
  2774. #define IS_RCC_CRS_SYNC_DIV(__DIV__) (((__DIV__) == RCC_CRS_SYNC_DIV1) || ((__DIV__) == RCC_CRS_SYNC_DIV2) || \
  2775. ((__DIV__) == RCC_CRS_SYNC_DIV4) || ((__DIV__) == RCC_CRS_SYNC_DIV8) || \
  2776. ((__DIV__) == RCC_CRS_SYNC_DIV16) || ((__DIV__) == RCC_CRS_SYNC_DIV32) || \
  2777. ((__DIV__) == RCC_CRS_SYNC_DIV64) || ((__DIV__) == RCC_CRS_SYNC_DIV128))
  2778. #define IS_RCC_CRS_SYNC_POLARITY(__POLARITY__) (((__POLARITY__) == RCC_CRS_SYNC_POLARITY_RISING) || \
  2779. ((__POLARITY__) == RCC_CRS_SYNC_POLARITY_FALLING))
  2780. #define IS_RCC_CRS_RELOADVALUE(__VALUE__) (((__VALUE__) <= 0xFFFFU))
  2781. #define IS_RCC_CRS_ERRORLIMIT(__VALUE__) (((__VALUE__) <= 0xFFU))
  2782. #define IS_RCC_CRS_HSI48CALIBRATION(__VALUE__) (((__VALUE__) <= 0x3FU))
  2783. #define IS_RCC_CRS_FREQERRORDIR(__DIR__) (((__DIR__) == RCC_CRS_FREQERRORDIR_UP) || \
  2784. ((__DIR__) == RCC_CRS_FREQERRORDIR_DOWN))
  2785. /**
  2786. * @}
  2787. */
  2788. /**
  2789. * @}
  2790. */
  2791. /**
  2792. * @}
  2793. */
  2794. /**
  2795. * @}
  2796. */
  2797. #ifdef __cplusplus
  2798. }
  2799. #endif
  2800. #endif /* STM32H7xx_HAL_RCC_EX_H */
  2801. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/