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.
 
 
 

3388 lines
179 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32wbxx_hal_rcc.h
  4. * @author MCD Application Team
  5. * @brief Header file of RCC HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2019 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 STM32WBxx_HAL_RCC_H
  21. #define STM32WBxx_HAL_RCC_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32wbxx_hal_def.h"
  27. #include "stm32wbxx_ll_rcc.h"
  28. #include "stm32wbxx_ll_bus.h"
  29. /** @addtogroup STM32WBxx_HAL_Driver
  30. * @{
  31. */
  32. /** @addtogroup RCC
  33. * @{
  34. */
  35. /* Private constants ---------------------------------------------------------*/
  36. /** @addtogroup RCC_Private_Constants
  37. * @{
  38. */
  39. /* Defines used for Flags */
  40. #define CR_REG_INDEX 1U
  41. #define BDCR_REG_INDEX 2U
  42. #define CSR_REG_INDEX 3U
  43. #define CRRCR_REG_INDEX 4U
  44. #define RCC_FLAG_MASK 0x1FU
  45. /**
  46. * @}
  47. */
  48. /* Private macros ------------------------------------------------------------*/
  49. /** @addtogroup RCC_Private_Macros
  50. * @{
  51. */
  52. #if defined(RCC_HSI48_SUPPORT)
  53. #define IS_RCC_OSCILLATORTYPE(__OSCILLATOR__) (((__OSCILLATOR__) == RCC_OSCILLATORTYPE_NONE) || \
  54. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) || \
  55. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) || \
  56. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI48) == RCC_OSCILLATORTYPE_HSI48) || \
  57. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_MSI) == RCC_OSCILLATORTYPE_MSI) || \
  58. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI1) == RCC_OSCILLATORTYPE_LSI1) || \
  59. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI2) == RCC_OSCILLATORTYPE_LSI2) || \
  60. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE))
  61. #else
  62. #define IS_RCC_OSCILLATORTYPE(__OSCILLATOR__) (((__OSCILLATOR__) == RCC_OSCILLATORTYPE_NONE) || \
  63. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSE) == RCC_OSCILLATORTYPE_HSE) || \
  64. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_HSI) == RCC_OSCILLATORTYPE_HSI) || \
  65. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_MSI) == RCC_OSCILLATORTYPE_MSI) || \
  66. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI1) == RCC_OSCILLATORTYPE_LSI1) || \
  67. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSI2) == RCC_OSCILLATORTYPE_LSI2) || \
  68. (((__OSCILLATOR__) & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE))
  69. #endif
  70. #define IS_RCC_HSE(__HSE__) (((__HSE__) == RCC_HSE_OFF) || ((__HSE__) == RCC_HSE_ON))
  71. #define IS_RCC_LSE(__LSE__) (((__LSE__) == RCC_LSE_OFF) || ((__LSE__) == RCC_LSE_ON) || \
  72. ((__LSE__) == RCC_LSE_BYPASS))
  73. #define IS_RCC_HSI(__HSI__) (((__HSI__) == RCC_HSI_OFF) || ((__HSI__) == RCC_HSI_ON))
  74. #define IS_RCC_HSI_CALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= (uint32_t)127U)
  75. #define IS_RCC_LSI(__LSI__) (((__LSI__) == RCC_LSI_OFF) || ((__LSI__) == RCC_LSI_ON))
  76. #define IS_RCC_LSI2_CALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= (uint32_t)15U)
  77. #define IS_RCC_MSI(__MSI__) (((__MSI__) == RCC_MSI_OFF) || ((__MSI__) == RCC_MSI_ON))
  78. #define IS_RCC_MSICALIBRATION_VALUE(__VALUE__) ((__VALUE__) <= (uint32_t)255U)
  79. #if defined(RCC_HSI48_SUPPORT)
  80. #define IS_RCC_HSI48(__HSI48__) (((__HSI48__) == RCC_HSI48_OFF) || ((__HSI48__) == RCC_HSI48_ON))
  81. #endif
  82. #define IS_RCC_PLL(__PLL__) (((__PLL__) == RCC_PLL_NONE) ||((__PLL__) == RCC_PLL_OFF) || \
  83. ((__PLL__) == RCC_PLL_ON))
  84. #define IS_RCC_PLLSOURCE(__SOURCE__) (((__SOURCE__) == RCC_PLLSOURCE_NONE) || \
  85. ((__SOURCE__) == RCC_PLLSOURCE_MSI) || \
  86. ((__SOURCE__) == RCC_PLLSOURCE_HSI) || \
  87. ((__SOURCE__) == RCC_PLLSOURCE_HSE))
  88. #define IS_RCC_PLLM_VALUE(__VALUE__) (((__VALUE__) == RCC_PLLM_DIV1) || \
  89. ((__VALUE__) == RCC_PLLM_DIV2) || \
  90. ((__VALUE__) == RCC_PLLM_DIV3) || \
  91. ((__VALUE__) == RCC_PLLM_DIV4) || \
  92. ((__VALUE__) == RCC_PLLM_DIV5) || \
  93. ((__VALUE__) == RCC_PLLM_DIV6) || \
  94. ((__VALUE__) == RCC_PLLM_DIV7) || \
  95. ((__VALUE__) == RCC_PLLM_DIV8))
  96. #define IS_RCC_PLLN_VALUE(__VALUE__) ((6U <= (__VALUE__)) && ((__VALUE__) <= 127U))
  97. #define IS_RCC_PLLP_VALUE(__VALUE__) ((RCC_PLLP_DIV2 <= (__VALUE__)) && ((__VALUE__) <= RCC_PLLP_DIV32))
  98. #define IS_RCC_PLLQ_VALUE(__VALUE__) ((RCC_PLLQ_DIV2 <= (__VALUE__)) && ((__VALUE__) <= RCC_PLLQ_DIV8))
  99. #define IS_RCC_PLLR_VALUE(__VALUE__) ((RCC_PLLR_DIV2 <= (__VALUE__)) && ((__VALUE__) <= RCC_PLLR_DIV8))
  100. #if defined(SAI1)
  101. #define IS_RCC_PLLSAI1CLOCKOUT_VALUE(__VALUE__) (((((__VALUE__) & RCC_PLLSAI1_ADCCLK) == RCC_PLLSAI1_ADCCLK) || \
  102. (((__VALUE__) & RCC_PLLSAI1_SAI1CLK) == RCC_PLLSAI1_SAI1CLK) || \
  103. (((__VALUE__) & RCC_PLLSAI1_USBCLK) == RCC_PLLSAI1_USBCLK)) && \
  104. (((__VALUE__) & ~(RCC_PLLSAI1_ADCCLK | RCC_PLLSAI1_SAI1CLK | RCC_PLLSAI1_USBCLK)) == 0U))
  105. #endif
  106. #define IS_RCC_MSI_CLOCK_RANGE(__RANGE__) (((__RANGE__) == RCC_MSIRANGE_0) || \
  107. ((__RANGE__) == RCC_MSIRANGE_1) || \
  108. ((__RANGE__) == RCC_MSIRANGE_2) || \
  109. ((__RANGE__) == RCC_MSIRANGE_3) || \
  110. ((__RANGE__) == RCC_MSIRANGE_4) || \
  111. ((__RANGE__) == RCC_MSIRANGE_5) || \
  112. ((__RANGE__) == RCC_MSIRANGE_6) || \
  113. ((__RANGE__) == RCC_MSIRANGE_7) || \
  114. ((__RANGE__) == RCC_MSIRANGE_8) || \
  115. ((__RANGE__) == RCC_MSIRANGE_9) || \
  116. ((__RANGE__) == RCC_MSIRANGE_10) || \
  117. ((__RANGE__) == RCC_MSIRANGE_11))
  118. #define IS_RCC_CLOCKTYPE(__CLK__) ((1U <= (__CLK__)) && ((__CLK__) <= (RCC_CLOCKTYPE_SYSCLK | \
  119. RCC_CLOCKTYPE_HCLK | \
  120. RCC_CLOCKTYPE_PCLK1 | \
  121. RCC_CLOCKTYPE_PCLK2 | \
  122. RCC_CLOCKTYPE_HCLK2 | \
  123. RCC_CLOCKTYPE_HCLK4)))
  124. #define IS_RCC_SYSCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_SYSCLKSOURCE_MSI) || \
  125. ((__SOURCE__) == RCC_SYSCLKSOURCE_HSI) || \
  126. ((__SOURCE__) == RCC_SYSCLKSOURCE_HSE) || \
  127. ((__SOURCE__) == RCC_SYSCLKSOURCE_PLLCLK))
  128. #define IS_RCC_HCLKx(__HCLK__) (((__HCLK__) == RCC_SYSCLK_DIV1) || ((__HCLK__) == RCC_SYSCLK_DIV2) || ((__HCLK__) == RCC_SYSCLK_DIV3) || \
  129. ((__HCLK__) == RCC_SYSCLK_DIV4) || ((__HCLK__) == RCC_SYSCLK_DIV5) || ((__HCLK__) == RCC_SYSCLK_DIV6) || \
  130. ((__HCLK__) == RCC_SYSCLK_DIV8) || ((__HCLK__) == RCC_SYSCLK_DIV10) || ((__HCLK__) == RCC_SYSCLK_DIV16) || \
  131. ((__HCLK__) == RCC_SYSCLK_DIV32) || ((__HCLK__) == RCC_SYSCLK_DIV64) || ((__HCLK__) == RCC_SYSCLK_DIV128) || \
  132. ((__HCLK__) == RCC_SYSCLK_DIV256) || ((__HCLK__) == RCC_SYSCLK_DIV512))
  133. #define IS_RCC_PCLKx(__PCLK__) (((__PCLK__) == RCC_HCLK_DIV1) || ((__PCLK__) == RCC_HCLK_DIV2) || \
  134. ((__PCLK__) == RCC_HCLK_DIV4) || ((__PCLK__) == RCC_HCLK_DIV8) || \
  135. ((__PCLK__) == RCC_HCLK_DIV16))
  136. #define IS_RCC_RTCCLKSOURCE(__SOURCE__) (((__SOURCE__) == RCC_RTCCLKSOURCE_NONE) || \
  137. ((__SOURCE__) == RCC_RTCCLKSOURCE_LSE) || \
  138. ((__SOURCE__) == RCC_RTCCLKSOURCE_LSI) || \
  139. ((__SOURCE__) == RCC_RTCCLKSOURCE_HSE_DIV32))
  140. #if defined(RCC_MCO3_SUPPORT)
  141. #define IS_RCC_MCO(__MCOX__) (((__MCOX__) == RCC_MCO1) || \
  142. ((__MCOX__) == RCC_MCO2) || \
  143. ((__MCOX__) == RCC_MCO3))
  144. #else
  145. #define IS_RCC_MCO(__MCOX__) (((__MCOX__) == RCC_MCO1) || \
  146. ((__MCOX__) == RCC_MCO2))
  147. #endif
  148. #if defined(RCC_HSI48_SUPPORT)
  149. #define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK) || \
  150. ((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || \
  151. ((__SOURCE__) == RCC_MCO1SOURCE_MSI) || \
  152. ((__SOURCE__) == RCC_MCO1SOURCE_HSI) || \
  153. ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || \
  154. ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) || \
  155. ((__SOURCE__) == RCC_MCO1SOURCE_LSI1) || \
  156. ((__SOURCE__) == RCC_MCO1SOURCE_LSI2) || \
  157. ((__SOURCE__) == RCC_MCO1SOURCE_LSE) || \
  158. ((__SOURCE__) == RCC_MCO1SOURCE_HSI48))
  159. #else
  160. #define IS_RCC_MCO1SOURCE(__SOURCE__) (((__SOURCE__) == RCC_MCO1SOURCE_NOCLOCK) || \
  161. ((__SOURCE__) == RCC_MCO1SOURCE_SYSCLK) || \
  162. ((__SOURCE__) == RCC_MCO1SOURCE_MSI) || \
  163. ((__SOURCE__) == RCC_MCO1SOURCE_HSI) || \
  164. ((__SOURCE__) == RCC_MCO1SOURCE_HSE) || \
  165. ((__SOURCE__) == RCC_MCO1SOURCE_PLLCLK) || \
  166. ((__SOURCE__) == RCC_MCO1SOURCE_LSI1) || \
  167. ((__SOURCE__) == RCC_MCO1SOURCE_LSI2) || \
  168. ((__SOURCE__) == RCC_MCO1SOURCE_LSE))
  169. #endif
  170. #define IS_RCC_MCO2SOURCE(__SOURCE__) IS_RCC_MCO1SOURCE((__SOURCE__))
  171. #define IS_RCC_MCO3SOURCE(__SOURCE__) IS_RCC_MCO1SOURCE((__SOURCE__))
  172. #define IS_RCC_MCODIV(__DIV__) (((__DIV__) == RCC_MCODIV_1) || ((__DIV__) == RCC_MCODIV_2) || \
  173. ((__DIV__) == RCC_MCODIV_4) || ((__DIV__) == RCC_MCODIV_8) || \
  174. ((__DIV__) == RCC_MCODIV_16))
  175. #define IS_RCC_LSE_DRIVE(__DRIVE__) (((__DRIVE__) == RCC_LSEDRIVE_LOW) || \
  176. ((__DRIVE__) == RCC_LSEDRIVE_MEDIUMLOW) || \
  177. ((__DRIVE__) == RCC_LSEDRIVE_MEDIUMHIGH) || \
  178. ((__DRIVE__) == RCC_LSEDRIVE_HIGH))
  179. #define IS_RCC_STOP_WAKEUPCLOCK(__SOURCE__) (((__SOURCE__) == RCC_STOP_WAKEUPCLOCK_MSI) || \
  180. ((__SOURCE__) == RCC_STOP_WAKEUPCLOCK_HSI))
  181. /**
  182. * @}
  183. */
  184. /* Exported types ------------------------------------------------------------*/
  185. /** @defgroup RCC_Exported_Types RCC Exported Types
  186. * @{
  187. */
  188. /**
  189. * @brief RCC PLL configuration structure definition
  190. */
  191. typedef struct
  192. {
  193. uint32_t PLLState; /*!< The new state of the PLL.
  194. This parameter must be a value of @ref RCC_PLL_Config */
  195. uint32_t PLLSource; /*!< RCC_PLLSource: PLL entry clock source.
  196. This parameter must be a value of @ref RCC_PLL_Clock_Source */
  197. uint32_t PLLM; /*!< PLLM: Division factor for PLL VCO input clock.
  198. This parameter must be a value of @ref RCC_PLLM_Clock_Divider */
  199. uint32_t PLLN; /*!< PLLN: Multiplication factor for PLL VCO output clock.
  200. This parameter must be a number between Min_Data = 6 and Max_Data = 127 */
  201. uint32_t PLLP; /*!< PLLP: Division factor for SAI & ADC clock.
  202. This parameter must be a value of @ref RCC_PLLP_Clock_Divider */
  203. uint32_t PLLQ; /*!< PLLQ: Division factor for RNG and USB clocks.
  204. This parameter must be a value of @ref RCC_PLLQ_Clock_Divider */
  205. uint32_t PLLR; /*!< PLLR: Division for the main system clock.
  206. User have to set the PLLR parameter correctly to not exceed max frequency 64MHZ.
  207. This parameter must be a value of @ref RCC_PLLR_Clock_Divider */
  208. } RCC_PLLInitTypeDef;
  209. /**
  210. * @brief RCC Internal/External Oscillator (HSE, HSI, HSI48, MSI, LSE and LSI) configuration structure definition
  211. */
  212. typedef struct
  213. {
  214. uint32_t OscillatorType; /*!< The oscillators to be configured.
  215. This parameter can be a combination of @ref RCC_Oscillator_Type */
  216. uint32_t HSEState; /*!< The new state of the HSE.
  217. This parameter can be a value of @ref RCC_HSE_Config */
  218. uint32_t LSEState; /*!< The new state of the LSE.
  219. This parameter can be a value of @ref RCC_LSE_Config */
  220. uint32_t HSIState; /*!< The new state of the HSI.
  221. This parameter can be a value of @ref RCC_HSI_Config */
  222. uint32_t HSICalibrationValue; /*!< The calibration trimming value (default is @ref RCC_HSICALIBRATION_DEFAULT).*/
  223. uint32_t LSIState; /*!< The new state of the LSI.
  224. This parameter can be a value of @ref RCC_LSI_Config */
  225. uint32_t LSI2CalibrationValue; /*!< The LSI2 calibration trimming value .
  226. This parameter must be a number between Min_Data = 0x0 and Max_Data = 0xF */
  227. uint32_t MSIState; /*!< The new state of the MSI.
  228. This parameter can be a value of @ref RCC_MSI_Config */
  229. uint32_t MSICalibrationValue; /*!< The calibration trimming value (default is @ref RCC_MSICALIBRATION_DEFAULT).
  230. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */
  231. uint32_t MSIClockRange; /*!< The MSI frequency range.
  232. This parameter can be a value of @ref RCC_MSI_Clock_Range */
  233. #if defined(RCC_HSI48_SUPPORT)
  234. uint32_t HSI48State; /*!< The new state of the HSI48 .
  235. This parameter can be a value of @ref RCC_HSI48_Config */
  236. #endif
  237. RCC_PLLInitTypeDef PLL; /*!< Main PLL structure parameters */
  238. } RCC_OscInitTypeDef;
  239. /**
  240. * @brief RCC System, AHB and APB buses clock configuration structure definition
  241. */
  242. typedef struct
  243. {
  244. uint32_t ClockType; /*!< The clock to be configured.
  245. This parameter can be a combination of @ref RCC_System_Clock_Type */
  246. uint32_t SYSCLKSource; /*!< The clock source used as system clock (SYSCLK).
  247. This parameter can be a value of @ref RCC_System_Clock_Source */
  248. uint32_t AHBCLKDivider; /*!< The AHBx clock (HCLK1) divider. This clock is derived from the system clock (SYSCLK).
  249. This parameter can be a value of @ref RCC_AHBx_Clock_Source */
  250. uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK).
  251. This parameter can be a value of @ref RCC_APBx_Clock_Source */
  252. uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK).
  253. This parameter can be a value of @ref RCC_APBx_Clock_Source */
  254. uint32_t AHBCLK2Divider; /*!< The AHB clock (HCLK2) divider. This clock is derived from the system clock (SYSCLK).
  255. This parameter can be a value of @ref RCC_AHBx_Clock_Source */
  256. uint32_t AHBCLK4Divider; /*!< The AHB shared clock (HCLK4) divider. This clock is derived from the system clock (SYSCLK).
  257. This parameter can be a value of @ref RCC_AHBx_Clock_Source */
  258. } RCC_ClkInitTypeDef;
  259. /**
  260. * @}
  261. */
  262. /* Exported constants --------------------------------------------------------*/
  263. /** @defgroup RCC_Exported_Constants RCC Exported Constants
  264. * @{
  265. */
  266. /** @defgroup RCC_Timeout_Value Timeout Values
  267. * @{
  268. */
  269. #define RCC_DBP_TIMEOUT_VALUE 2U /* 2 ms (minimum Tick + 1) */
  270. #define RCC_LSE_TIMEOUT_VALUE LSE_STARTUP_TIMEOUT /* LSE timeout in ms */
  271. /**
  272. * @}
  273. */
  274. /** @defgroup RCC_Oscillator_Type Oscillator Type
  275. * @{
  276. */
  277. #define RCC_OSCILLATORTYPE_NONE 0x00000000U /*!< Oscillator configuration unchanged */
  278. #define RCC_OSCILLATORTYPE_HSE 0x00000001U /*!< HSE to configure */
  279. #define RCC_OSCILLATORTYPE_HSI 0x00000002U /*!< HSI to configure */
  280. #define RCC_OSCILLATORTYPE_LSE 0x00000004U /*!< LSE to configure */
  281. #define RCC_OSCILLATORTYPE_LSI1 0x00000008U /*!< LSI1 to configure */
  282. #define RCC_OSCILLATORTYPE_LSI2 0x00000010U /*!< LSI2 to configure */
  283. #define RCC_OSCILLATORTYPE_MSI 0x00000020U /*!< MSI to configure */
  284. #if defined(RCC_HSI48_SUPPORT)
  285. #define RCC_OSCILLATORTYPE_HSI48 0x00000040U /*!< HSI48 to configure */
  286. #endif
  287. /**
  288. * @}
  289. */
  290. /** @defgroup RCC_HSE_Config HSE Config
  291. * @{
  292. */
  293. #define RCC_HSE_OFF 0x00000000U /*!< HSE clock deactivation */
  294. #define RCC_HSE_ON RCC_CR_HSEON /*!< HSE clock activation */
  295. /**
  296. * @}
  297. */
  298. /** @defgroup RCC_LSE_Config LSE Config
  299. * @{
  300. */
  301. #define RCC_LSE_OFF 0x00000000U /*!< LSE clock deactivation */
  302. #define RCC_LSE_ON RCC_BDCR_LSEON /*!< LSE clock activation */
  303. #define RCC_LSE_BYPASS ((uint32_t)(RCC_BDCR_LSEBYP | RCC_BDCR_LSEON)) /*!< External clock source for LSE clock */
  304. /**
  305. * @}
  306. */
  307. /** @defgroup RCC_HSI_Config HSI Config
  308. * @{
  309. */
  310. #define RCC_HSI_OFF 0x00000000U /*!< HSI clock deactivation */
  311. #define RCC_HSI_ON RCC_CR_HSION /*!< HSI clock activation */
  312. #define RCC_HSICALIBRATION_DEFAULT 64U /*!< Default HSI calibration trimming value */
  313. /**
  314. * @}
  315. */
  316. /** @defgroup RCC_LSI_Config LSI Config
  317. * @{
  318. */
  319. #define RCC_LSI_OFF 0x00000000U /*!< LSI clock deactivation */
  320. #define RCC_LSI_ON (RCC_CSR_LSI1ON | RCC_CSR_LSI2ON) /*!< LSI1 or LSI2 clock activation */
  321. /**
  322. * @}
  323. */
  324. /** @defgroup RCC_MSI_Config MSI Config
  325. * @{
  326. */
  327. #define RCC_MSI_OFF 0x00000000U /*!< MSI clock deactivation */
  328. #define RCC_MSI_ON RCC_CR_MSION /*!< MSI clock activation */
  329. #define RCC_MSICALIBRATION_DEFAULT 0U /*!< Default MSI calibration trimming value */
  330. /**
  331. * @}
  332. */
  333. #if defined(RCC_HSI48_SUPPORT)
  334. /** @defgroup RCC_HSI48_Config HSI48 Config
  335. * @{
  336. */
  337. #define RCC_HSI48_OFF 0x00000000U /*!< HSI48 clock deactivation */
  338. #define RCC_HSI48_ON RCC_CRRCR_HSI48ON /*!< HSI48 clock activation */
  339. /**
  340. * @}
  341. */
  342. #endif
  343. /** @defgroup RCC_PLL_Config PLL Config
  344. * @{
  345. */
  346. #define RCC_PLL_NONE 0x00000000U /*!< PLL configuration unchanged */
  347. #define RCC_PLL_OFF 0x00000001U /*!< PLL deactivation */
  348. #define RCC_PLL_ON 0x00000002U /*!< PLL activation */
  349. /**
  350. * @}
  351. */
  352. /** @defgroup RCC_PLLM_Clock_Divider PLLM Clock Divider
  353. * @{
  354. */
  355. #define RCC_PLLM_DIV1 LL_RCC_PLLM_DIV_1 /*!< PLLM division factor = 1 */
  356. #define RCC_PLLM_DIV2 LL_RCC_PLLM_DIV_2 /*!< PLLM division factor = 2 */
  357. #define RCC_PLLM_DIV3 LL_RCC_PLLM_DIV_3 /*!< PLLM division factor = 3 */
  358. #define RCC_PLLM_DIV4 LL_RCC_PLLM_DIV_4 /*!< PLLM division factor = 4 */
  359. #define RCC_PLLM_DIV5 LL_RCC_PLLM_DIV_5 /*!< PLLM division factor = 5 */
  360. #define RCC_PLLM_DIV6 LL_RCC_PLLM_DIV_6 /*!< PLLM division factor = 6 */
  361. #define RCC_PLLM_DIV7 LL_RCC_PLLM_DIV_7 /*!< PLLM division factor = 7 */
  362. #define RCC_PLLM_DIV8 LL_RCC_PLLM_DIV_8 /*!< PLLM division factor = 8 */
  363. /**
  364. * @}
  365. */
  366. /** @defgroup RCC_PLLP_Clock_Divider PLLP Clock Divider
  367. * @{
  368. */
  369. #define RCC_PLLP_DIV2 LL_RCC_PLLP_DIV_2 /*!< PLLP division factor = 2 */
  370. #define RCC_PLLP_DIV3 LL_RCC_PLLP_DIV_3 /*!< PLLP division factor = 3 */
  371. #define RCC_PLLP_DIV4 LL_RCC_PLLP_DIV_4 /*!< PLLP division factor = 4 */
  372. #define RCC_PLLP_DIV5 LL_RCC_PLLP_DIV_5 /*!< PLLP division factor = 5 */
  373. #define RCC_PLLP_DIV6 LL_RCC_PLLP_DIV_6 /*!< PLLP division factor = 6 */
  374. #define RCC_PLLP_DIV7 LL_RCC_PLLP_DIV_7 /*!< PLLP division factor = 7 */
  375. #define RCC_PLLP_DIV8 LL_RCC_PLLP_DIV_8 /*!< PLLP division factor = 8 */
  376. #define RCC_PLLP_DIV9 LL_RCC_PLLP_DIV_9 /*!< PLLP division factor = 9 */
  377. #define RCC_PLLP_DIV10 LL_RCC_PLLP_DIV_10 /*!< PLLP division factor = 10 */
  378. #define RCC_PLLP_DIV11 LL_RCC_PLLP_DIV_11 /*!< PLLP division factor = 11 */
  379. #define RCC_PLLP_DIV12 LL_RCC_PLLP_DIV_12 /*!< PLLP division factor = 12 */
  380. #define RCC_PLLP_DIV13 LL_RCC_PLLP_DIV_13 /*!< PLLP division factor = 13 */
  381. #define RCC_PLLP_DIV14 LL_RCC_PLLP_DIV_14 /*!< PLLP division factor = 14 */
  382. #define RCC_PLLP_DIV15 LL_RCC_PLLP_DIV_15 /*!< PLLP division factor = 15 */
  383. #define RCC_PLLP_DIV16 LL_RCC_PLLP_DIV_16 /*!< PLLP division factor = 16 */
  384. #define RCC_PLLP_DIV17 LL_RCC_PLLP_DIV_17 /*!< PLLP division factor = 17 */
  385. #define RCC_PLLP_DIV18 LL_RCC_PLLP_DIV_18 /*!< PLLP division factor = 18 */
  386. #define RCC_PLLP_DIV19 LL_RCC_PLLP_DIV_19 /*!< PLLP division factor = 19 */
  387. #define RCC_PLLP_DIV20 LL_RCC_PLLP_DIV_20 /*!< PLLP division factor = 20 */
  388. #define RCC_PLLP_DIV21 LL_RCC_PLLP_DIV_21 /*!< PLLP division factor = 21 */
  389. #define RCC_PLLP_DIV22 LL_RCC_PLLP_DIV_22 /*!< PLLP division factor = 22 */
  390. #define RCC_PLLP_DIV23 LL_RCC_PLLP_DIV_23 /*!< PLLP division factor = 23 */
  391. #define RCC_PLLP_DIV24 LL_RCC_PLLP_DIV_24 /*!< PLLP division factor = 24 */
  392. #define RCC_PLLP_DIV25 LL_RCC_PLLP_DIV_25 /*!< PLLP division factor = 25 */
  393. #define RCC_PLLP_DIV26 LL_RCC_PLLP_DIV_26 /*!< PLLP division factor = 26 */
  394. #define RCC_PLLP_DIV27 LL_RCC_PLLP_DIV_27 /*!< PLLP division factor = 27 */
  395. #define RCC_PLLP_DIV28 LL_RCC_PLLP_DIV_28 /*!< PLLP division factor = 28 */
  396. #define RCC_PLLP_DIV29 LL_RCC_PLLP_DIV_29 /*!< PLLP division factor = 29 */
  397. #define RCC_PLLP_DIV30 LL_RCC_PLLP_DIV_30 /*!< PLLP division factor = 30 */
  398. #define RCC_PLLP_DIV31 LL_RCC_PLLP_DIV_31 /*!< PLLP division factor = 31 */
  399. #define RCC_PLLP_DIV32 LL_RCC_PLLP_DIV_32 /*!< PLLP division factor = 32 */
  400. /**
  401. * @}
  402. */
  403. /** @defgroup RCC_PLLQ_Clock_Divider PLLQ Clock Divider
  404. * @{
  405. */
  406. #define RCC_PLLQ_DIV2 LL_RCC_PLLQ_DIV_2 /*!< PLLQ division factor = 2 */
  407. #define RCC_PLLQ_DIV3 LL_RCC_PLLQ_DIV_3 /*!< PLLQ division factor = 3 */
  408. #define RCC_PLLQ_DIV4 LL_RCC_PLLQ_DIV_4 /*!< PLLQ division factor = 4 */
  409. #define RCC_PLLQ_DIV5 LL_RCC_PLLQ_DIV_5 /*!< PLLQ division factor = 5 */
  410. #define RCC_PLLQ_DIV6 LL_RCC_PLLQ_DIV_6 /*!< PLLQ division factor = 6 */
  411. #define RCC_PLLQ_DIV7 LL_RCC_PLLQ_DIV_7 /*!< PLLQ division factor = 7 */
  412. #define RCC_PLLQ_DIV8 LL_RCC_PLLQ_DIV_8 /*!< PLLQ division factor = 8 */
  413. /**
  414. * @}
  415. */
  416. /** @defgroup RCC_PLLR_Clock_Divider PLLR Clock Divider
  417. * @{
  418. */
  419. #define RCC_PLLR_DIV2 LL_RCC_PLLR_DIV_2 /*!< PLLR division factor = 2 */
  420. #define RCC_PLLR_DIV3 LL_RCC_PLLR_DIV_3 /*!< PLLR division factor = 3 */
  421. #define RCC_PLLR_DIV4 LL_RCC_PLLR_DIV_4 /*!< PLLR division factor = 4 */
  422. #define RCC_PLLR_DIV5 LL_RCC_PLLR_DIV_5 /*!< PLLR division factor = 5 */
  423. #define RCC_PLLR_DIV6 LL_RCC_PLLR_DIV_6 /*!< PLLR division factor = 6 */
  424. #define RCC_PLLR_DIV7 LL_RCC_PLLR_DIV_7 /*!< PLLR division factor = 7 */
  425. #define RCC_PLLR_DIV8 LL_RCC_PLLR_DIV_8 /*!< PLLR division factor = 8 */
  426. /**
  427. * @}
  428. */
  429. /** @defgroup RCC_PLL_Clock_Source PLL Clock Source
  430. * @{
  431. */
  432. #define RCC_PLLSOURCE_NONE LL_RCC_PLLSOURCE_NONE /*!< No clock selected as PLL entry clock source */
  433. #define RCC_PLLSOURCE_MSI LL_RCC_PLLSOURCE_MSI /*!< MSI clock selected as PLL entry clock source */
  434. #define RCC_PLLSOURCE_HSI LL_RCC_PLLSOURCE_HSI /*!< HSI clock selected as PLL entry clock source */
  435. #define RCC_PLLSOURCE_HSE LL_RCC_PLLSOURCE_HSE /*!< HSE clock selected as PLL entry clock source */
  436. /**
  437. * @}
  438. */
  439. /** @defgroup RCC_PLL_Clock_Output PLL Clock Output
  440. * @{
  441. */
  442. #define RCC_PLL_SYSCLK RCC_PLLCFGR_PLLREN /*!< PLLCLK selection from main PLL */
  443. #define RCC_PLL_USBCLK RCC_PLLCFGR_PLLQEN /*!< PLLUSBCLK selection from main PLL */
  444. #define RCC_PLL_RNGCLK RCC_PLLCFGR_PLLQEN /*!< PLLRNGCLK selection from main PLL */
  445. #if defined(SAI1)
  446. #define RCC_PLL_SAI1CLK RCC_PLLCFGR_PLLPEN /*!< PLLSAI1CLK selection from main PLL */
  447. #endif
  448. #define RCC_PLL_ADCCLK RCC_PLLCFGR_PLLPEN /*!< PLLADCCLK selection from main PLL */
  449. /**
  450. * @}
  451. */
  452. #if defined(SAI1)
  453. /** @defgroup RCC_PLLSAI1_Clock_Output PLLSAI1 Clock Output
  454. * @{
  455. */
  456. #define RCC_PLLSAI1_ADCCLK RCC_PLLSAI1CFGR_PLLREN /*!< PLLADCCLK selection from PLLSAI1 */
  457. #define RCC_PLLSAI1_USBCLK RCC_PLLSAI1CFGR_PLLQEN /*!< USBCLK selection from PLLSAI1 */
  458. #define RCC_PLLSAI1_SAI1CLK RCC_PLLSAI1CFGR_PLLPEN /*!< PLLSAI1CLK selection from PLLSAI1 */
  459. /**
  460. * @}
  461. */
  462. #endif
  463. /** @defgroup RCC_MSI_Clock_Range MSI Clock Range
  464. * @{
  465. */
  466. #define RCC_MSIRANGE_0 LL_RCC_MSIRANGE_0 /*!< MSI = 100 KHz */
  467. #define RCC_MSIRANGE_1 LL_RCC_MSIRANGE_1 /*!< MSI = 200 KHz */
  468. #define RCC_MSIRANGE_2 LL_RCC_MSIRANGE_2 /*!< MSI = 400 KHz */
  469. #define RCC_MSIRANGE_3 LL_RCC_MSIRANGE_3 /*!< MSI = 800 KHz */
  470. #define RCC_MSIRANGE_4 LL_RCC_MSIRANGE_4 /*!< MSI = 1 MHz */
  471. #define RCC_MSIRANGE_5 LL_RCC_MSIRANGE_5 /*!< MSI = 2 MHz */
  472. #define RCC_MSIRANGE_6 LL_RCC_MSIRANGE_6 /*!< MSI = 4 MHz */
  473. #define RCC_MSIRANGE_7 LL_RCC_MSIRANGE_7 /*!< MSI = 8 MHz */
  474. #define RCC_MSIRANGE_8 LL_RCC_MSIRANGE_8 /*!< MSI = 16 MHz */
  475. #define RCC_MSIRANGE_9 LL_RCC_MSIRANGE_9 /*!< MSI = 24 MHz */
  476. #define RCC_MSIRANGE_10 LL_RCC_MSIRANGE_10 /*!< MSI = 32 MHz */
  477. #define RCC_MSIRANGE_11 LL_RCC_MSIRANGE_11 /*!< MSI = 48 MHz */
  478. /**
  479. * @}
  480. */
  481. /** @defgroup RCC_System_Clock_Type System Clock Type
  482. * @{
  483. */
  484. #define RCC_CLOCKTYPE_SYSCLK 0x00000001U /*!< SYSCLK to configure */
  485. #define RCC_CLOCKTYPE_HCLK 0x00000002U /*!< HCLK to configure */
  486. #define RCC_CLOCKTYPE_PCLK1 0x00000004U /*!< PCLK1 to configure */
  487. #define RCC_CLOCKTYPE_PCLK2 0x00000008U /*!< PCLK2 to configure */
  488. #define RCC_CLOCKTYPE_HCLK2 0x00000020U /*!< HCLK2 to configure */
  489. #define RCC_CLOCKTYPE_HCLK4 0x00000040U /*!< HCLK4 to configure */
  490. /**
  491. * @}
  492. */
  493. /** @defgroup RCC_System_Clock_Source System Clock Source
  494. * @{
  495. */
  496. #define RCC_SYSCLKSOURCE_MSI LL_RCC_SYS_CLKSOURCE_MSI /*!< MSI selection as system clock */
  497. #define RCC_SYSCLKSOURCE_HSI LL_RCC_SYS_CLKSOURCE_HSI /*!< HSI selection as system clock */
  498. #define RCC_SYSCLKSOURCE_HSE LL_RCC_SYS_CLKSOURCE_HSE /*!< HSE selection as system clock */
  499. #define RCC_SYSCLKSOURCE_PLLCLK LL_RCC_SYS_CLKSOURCE_PLL /*!< PLL selection as system clock */
  500. /**
  501. * @}
  502. */
  503. /** @defgroup RCC_System_Clock_Source_Status System Clock Source Status
  504. * @{
  505. */
  506. #define RCC_SYSCLKSOURCE_STATUS_MSI LL_RCC_SYS_CLKSOURCE_STATUS_MSI /*!< MSI used as system clock */
  507. #define RCC_SYSCLKSOURCE_STATUS_HSI LL_RCC_SYS_CLKSOURCE_STATUS_HSI /*!< HSI used as system clock */
  508. #define RCC_SYSCLKSOURCE_STATUS_HSE LL_RCC_SYS_CLKSOURCE_STATUS_HSE /*!< HSE used as system clock */
  509. #define RCC_SYSCLKSOURCE_STATUS_PLLCLK LL_RCC_SYS_CLKSOURCE_STATUS_PLL /*!< PLL used as system clock */
  510. /**
  511. * @}
  512. */
  513. /** @defgroup RCC_AHBx_Clock_Source AHB Clock Source
  514. * @{
  515. */
  516. #define RCC_SYSCLK_DIV1 LL_RCC_SYSCLK_DIV_1 /*!< SYSCLK not divided */
  517. #define RCC_SYSCLK_DIV2 LL_RCC_SYSCLK_DIV_2 /*!< SYSCLK divided by 2 */
  518. #define RCC_SYSCLK_DIV3 LL_RCC_SYSCLK_DIV_3 /*!< SYSCLK divided by 3 */
  519. #define RCC_SYSCLK_DIV4 LL_RCC_SYSCLK_DIV_4 /*!< SYSCLK divided by 4 */
  520. #define RCC_SYSCLK_DIV5 LL_RCC_SYSCLK_DIV_5 /*!< SYSCLK divided by 5 */
  521. #define RCC_SYSCLK_DIV6 LL_RCC_SYSCLK_DIV_6 /*!< SYSCLK divided by 6 */
  522. #define RCC_SYSCLK_DIV8 LL_RCC_SYSCLK_DIV_8 /*!< SYSCLK divided by 8 */
  523. #define RCC_SYSCLK_DIV10 LL_RCC_SYSCLK_DIV_10 /*!< SYSCLK divided by 10 */
  524. #define RCC_SYSCLK_DIV16 LL_RCC_SYSCLK_DIV_16 /*!< SYSCLK divided by 16 */
  525. #define RCC_SYSCLK_DIV32 LL_RCC_SYSCLK_DIV_32 /*!< SYSCLK divided by 32 */
  526. #define RCC_SYSCLK_DIV64 LL_RCC_SYSCLK_DIV_64 /*!< SYSCLK divided by 64 */
  527. #define RCC_SYSCLK_DIV128 LL_RCC_SYSCLK_DIV_128 /*!< SYSCLK divided by 128 */
  528. #define RCC_SYSCLK_DIV256 LL_RCC_SYSCLK_DIV_256 /*!< SYSCLK divided by 256 */
  529. #define RCC_SYSCLK_DIV512 LL_RCC_SYSCLK_DIV_512 /*!< SYSCLK divided by 512 */
  530. /**
  531. * @}
  532. */
  533. /** @defgroup RCC_APBx_Clock_Source APB1 Clock Source
  534. * @{
  535. */
  536. #define RCC_HCLK_DIV1 LL_RCC_APB1_DIV_1 /*!< HCLK not divided */
  537. #define RCC_HCLK_DIV2 LL_RCC_APB1_DIV_2 /*!< HCLK divided by 2 */
  538. #define RCC_HCLK_DIV4 LL_RCC_APB1_DIV_4 /*!< HCLK divided by 4 */
  539. #define RCC_HCLK_DIV8 LL_RCC_APB1_DIV_8 /*!< HCLK divided by 8 */
  540. #define RCC_HCLK_DIV16 LL_RCC_APB1_DIV_16 /*!< HCLK divided by 16 */
  541. /**
  542. * @}
  543. */
  544. /** @defgroup RCC_RTC_Clock_Source RTC Clock Source
  545. * @{
  546. */
  547. #define RCC_RTCCLKSOURCE_NONE LL_RCC_RTC_CLKSOURCE_NONE /*!< No clock used as RTC clock */
  548. #define RCC_RTCCLKSOURCE_LSE LL_RCC_RTC_CLKSOURCE_LSE /*!< LSE oscillator clock used as RTC clock */
  549. #define RCC_RTCCLKSOURCE_LSI LL_RCC_RTC_CLKSOURCE_LSI /*!< LSI oscillator clock used as RTC clock */
  550. #define RCC_RTCCLKSOURCE_HSE_DIV32 LL_RCC_RTC_CLKSOURCE_HSE_DIV32 /*!< HSE oscillator clock divided by 32 used as RTC clock */
  551. /**
  552. * @}
  553. */
  554. /** @defgroup RCC_MCO_Index MCO Index
  555. * @{
  556. */
  557. #define RCC_MCO1 0x00000000U /*!< MCO1 index */
  558. #define RCC_MCO2 0x00000001U /*!< MCO2 index */
  559. #if defined(RCC_MCO3_SUPPORT)
  560. #define RCC_MCO3 0x00000002U /*!< MCO3 index */
  561. #endif
  562. #define RCC_MCO RCC_MCO1 /*!< MCO1 to be compliant with other families with 1 MCO*/
  563. /**
  564. * @}
  565. */
  566. /** @defgroup RCC_MCO1_Clock_Source MCO1 Clock Source
  567. * @{
  568. */
  569. #define RCC_MCO1SOURCE_NOCLOCK LL_RCC_MCO1SOURCE_NOCLOCK /*!< MCO1 output disabled, no clock on MCO1 */
  570. #define RCC_MCO1SOURCE_SYSCLK LL_RCC_MCO1SOURCE_SYSCLK /*!< SYSCLK selection as MCO1 source */
  571. #define RCC_MCO1SOURCE_MSI LL_RCC_MCO1SOURCE_MSI /*!< MSI selection as MCO1 source */
  572. #define RCC_MCO1SOURCE_HSI LL_RCC_MCO1SOURCE_HSI /*!< HSI selection as MCO1 source */
  573. #define RCC_MCO1SOURCE_HSE LL_RCC_MCO1SOURCE_HSE /*!< HSE after stabilization selection as MCO1 source */
  574. #define RCC_MCO1SOURCE_PLLCLK LL_RCC_MCO1SOURCE_PLLCLK /*!< PLLCLK selection as MCO1 source */
  575. #define RCC_MCO1SOURCE_LSI1 LL_RCC_MCO1SOURCE_LSI1 /*!< LSI1 selection as MCO1 source */
  576. #define RCC_MCO1SOURCE_LSI2 LL_RCC_MCO1SOURCE_LSI2 /*!< LSI2 selection as MCO1 source */
  577. #define RCC_MCO1SOURCE_LSE LL_RCC_MCO1SOURCE_LSE /*!< LSE selection as MCO1 source */
  578. #if defined(RCC_HSI48_SUPPORT)
  579. #define RCC_MCO1SOURCE_HSI48 LL_RCC_MCO1SOURCE_HSI48 /*!< HSI48 selection as MCO1 source */
  580. #endif
  581. #define RCC_MCO1SOURCE_HSE_BEFORE_STAB LL_RCC_MCO1SOURCE_HSE_BEFORE_STAB /*!< HSE before stabilization selection as MCO1 source */
  582. /**
  583. * @}
  584. */
  585. /** @defgroup RCC_MCOx_Clock_Prescaler MCO Clock Prescaler
  586. * @{
  587. */
  588. #define RCC_MCODIV_1 LL_RCC_MCO1_DIV_1 /*!< MCO not divided */
  589. #define RCC_MCODIV_2 LL_RCC_MCO1_DIV_2 /*!< MCO divided by 2 */
  590. #define RCC_MCODIV_4 LL_RCC_MCO1_DIV_4 /*!< MCO divided by 4 */
  591. #define RCC_MCODIV_8 LL_RCC_MCO1_DIV_8 /*!< MCO divided by 8 */
  592. #define RCC_MCODIV_16 LL_RCC_MCO1_DIV_16 /*!< MCO divided by 16 */
  593. /**
  594. * @}
  595. */
  596. /** @defgroup RCC_HSEAMPTHRESHOLD HSE bias current factor
  597. * @{
  598. */
  599. #define RCC_HSEAMPTHRESHOLD_1_2 LL_RCC_HSEAMPTHRESHOLD_1_2 /*!< HSE bias current factor 1/2 */
  600. #define RCC_HSEAMPTHRESHOLD_3_4 LL_RCC_HSEAMPTHRESHOLD_3_4 /*!< HSE bias current factor 3/4 */
  601. /**
  602. * @}
  603. */
  604. /** @defgroup RCC_HSE_CURRENTMAX HSE current max limit
  605. * @{
  606. */
  607. #define RCC_HSE_CURRENTMAX_0 LL_RCC_HSE_CURRENTMAX_0 /*!< HSE current max limit 0.18 mA/V */
  608. #define RCC_HSE_CURRENTMAX_1 LL_RCC_HSE_CURRENTMAX_1 /*!< HSE current max limit 0.57 mA/V */
  609. #define RCC_HSE_CURRENTMAX_2 LL_RCC_HSE_CURRENTMAX_2 /*!< HSE current max limit 0.78 mA/V */
  610. #define RCC_HSE_CURRENTMAX_3 LL_RCC_HSE_CURRENTMAX_3 /*!< HSE current max limit 1.13 mA/V */
  611. #define RCC_HSE_CURRENTMAX_4 LL_RCC_HSE_CURRENTMAX_4 /*!< HSE current max limit 0.61 mA/V */
  612. #define RCC_HSE_CURRENTMAX_5 LL_RCC_HSE_CURRENTMAX_5 /*!< HSE current max limit 1.65 mA/V */
  613. #define RCC_HSE_CURRENTMAX_6 LL_RCC_HSE_CURRENTMAX_6 /*!< HSE current max limit 2.12 mA/V */
  614. #define RCC_HSE_CURRENTMAX_7 LL_RCC_HSE_CURRENTMAX_7 /*!< HSE current max limit 2.84 mA/V */
  615. /**
  616. * @}
  617. */
  618. /** @defgroup RCC_Interrupt Interrupts
  619. * @{
  620. */
  621. #define RCC_IT_LSI1RDY LL_RCC_CIFR_LSI1RDYF /*!< LSI1 Ready Interrupt flag */
  622. #define RCC_IT_LSI2RDY LL_RCC_CIFR_LSI2RDYF /*!< LSI2 Ready Interrupt flag */
  623. #define RCC_IT_LSERDY LL_RCC_CIFR_LSERDYF /*!< LSE Ready Interrupt flag */
  624. #define RCC_IT_MSIRDY LL_RCC_CIFR_MSIRDYF /*!< MSI Ready Interrupt flag */
  625. #define RCC_IT_HSIRDY LL_RCC_CIFR_HSIRDYF /*!< HSI Ready Interrupt flag */
  626. #define RCC_IT_HSERDY LL_RCC_CIFR_HSERDYF /*!< HSE Ready Interrupt flag */
  627. #define RCC_IT_PLLRDY LL_RCC_CIFR_PLLRDYF /*!< PLL Ready Interrupt flag */
  628. #if defined(SAI1)
  629. #define RCC_IT_PLLSAI1RDY LL_RCC_CIFR_PLLSAI1RDYF /*!< PLLSAI1 Ready Interrupt flag */
  630. #endif
  631. #define RCC_IT_HSECSS LL_RCC_CIFR_CSSF /*!< HSE Clock Security System Interrupt flag */
  632. #define RCC_IT_LSECSS LL_RCC_CIFR_LSECSSF /*!< LSE Clock Security System Interrupt flag */
  633. #if defined(RCC_HSI48_SUPPORT)
  634. #define RCC_IT_HSI48RDY LL_RCC_CIFR_HSI48RDYF /*!< HSI48 Ready Interrupt flag */
  635. #endif
  636. /**
  637. * @}
  638. */
  639. /** @defgroup RCC_Flag Flags
  640. * Elements values convention: XXXYYYYYb
  641. * - YYYYY : Flag position in the register
  642. * - XXX : Register index
  643. * - 001: CR register
  644. * - 010: BDCR register
  645. * - 011: CSR register
  646. * - 100: CRRCR register
  647. * @{
  648. */
  649. /* Flags in the CR register */
  650. #define RCC_FLAG_MSIRDY ((CR_REG_INDEX << 5U) | RCC_CR_MSIRDY_Pos) /*!< MSI Ready flag */
  651. #define RCC_FLAG_HSIRDY ((CR_REG_INDEX << 5U) | RCC_CR_HSIRDY_Pos) /*!< HSI Ready flag */
  652. #define RCC_FLAG_HSERDY ((CR_REG_INDEX << 5U) | RCC_CR_HSERDY_Pos) /*!< HSE Ready flag */
  653. #define RCC_FLAG_PLLRDY ((CR_REG_INDEX << 5U) | RCC_CR_PLLRDY_Pos) /*!< PLL Ready flag */
  654. #if defined(SAI1)
  655. #define RCC_FLAG_PLLSAI1RDY ((CR_REG_INDEX << 5U) | RCC_CR_PLLSAI1RDY_Pos) /*!< PLLSAI1 Ready flag */
  656. #endif
  657. /* Flags in the BDCR register */
  658. #define RCC_FLAG_LSERDY ((BDCR_REG_INDEX << 5U) | RCC_BDCR_LSERDY_Pos) /*!< LSE Ready flag */
  659. #define RCC_FLAG_LSECSSD ((BDCR_REG_INDEX << 5U) | RCC_BDCR_LSECSSD_Pos) /*!< LSE Clock Security System failure detection flag */
  660. /* Flags in the CSR register */
  661. #define RCC_FLAG_LSI1RDY ((CSR_REG_INDEX << 5U) | RCC_CSR_LSI1RDY_Pos) /*!< LSI1 Ready flag */
  662. #define RCC_FLAG_LSI2RDY ((CSR_REG_INDEX << 5U) | RCC_CSR_LSI2RDY_Pos) /*!< LSI2 Ready flag */
  663. #define RCC_FLAG_OBLRST ((CSR_REG_INDEX << 5U) | RCC_CSR_OBLRSTF_Pos) /*!< Option Byte Loader reset flag */
  664. #define RCC_FLAG_PINRST ((CSR_REG_INDEX << 5U) | RCC_CSR_PINRSTF_Pos) /*!< Pin reset flag (NRST pin) */
  665. #define RCC_FLAG_BORRST ((CSR_REG_INDEX << 5U) | RCC_CSR_BORRSTF_Pos) /*!< BOR reset flag */
  666. #define RCC_FLAG_SFTRST ((CSR_REG_INDEX << 5U) | RCC_CSR_SFTRSTF_Pos) /*!< Software Reset flag */
  667. #define RCC_FLAG_IWDGRST ((CSR_REG_INDEX << 5U) | RCC_CSR_IWDGRSTF_Pos) /*!< Watchdog reset flag */
  668. #define RCC_FLAG_WWDGRST ((CSR_REG_INDEX << 5U) | RCC_CSR_WWDGRSTF_Pos) /*!< Window watchdog reset flag */
  669. #define RCC_FLAG_LPWRRST ((CSR_REG_INDEX << 5U) | RCC_CSR_LPWRRSTF_Pos) /*!< Low-Power reset flag */
  670. /* Flags in the CRRCR register */
  671. #if defined(RCC_HSI48_SUPPORT)
  672. #define RCC_FLAG_HSI48RDY ((CRRCR_REG_INDEX << 5U) | RCC_CRRCR_HSI48RDY_Pos) /*!< HSI48 Ready flag */
  673. #endif
  674. /**
  675. * @}
  676. */
  677. /** @defgroup RCC_LSEDrive_Config LSE Drive Configuration
  678. * @{
  679. */
  680. #define RCC_LSEDRIVE_LOW LL_RCC_LSEDRIVE_LOW /*!< LSE low drive capability */
  681. #define RCC_LSEDRIVE_MEDIUMLOW LL_RCC_LSEDRIVE_MEDIUMLOW /*!< LSE medium low drive capability */
  682. #define RCC_LSEDRIVE_MEDIUMHIGH LL_RCC_LSEDRIVE_MEDIUMHIGH /*!< LSE medium high drive capability */
  683. #define RCC_LSEDRIVE_HIGH LL_RCC_LSEDRIVE_HIGH /*!< LSE high drive capability */
  684. /**
  685. * @}
  686. */
  687. /** @defgroup RCC_Stop_WakeUpClock Wake-Up from STOP Clock
  688. * @{
  689. */
  690. #define RCC_STOP_WAKEUPCLOCK_MSI LL_RCC_STOP_WAKEUPCLOCK_MSI /*!< MSI selection after wake-up from STOP */
  691. #define RCC_STOP_WAKEUPCLOCK_HSI LL_RCC_STOP_WAKEUPCLOCK_HSI /*!< HSI selection after wake-up from STOP */
  692. /**
  693. * @}
  694. */
  695. /**
  696. * @}
  697. */
  698. /* Exported macros -----------------------------------------------------------*/
  699. /** @defgroup RCC_Exported_Macros RCC Exported Macros
  700. * @{
  701. */
  702. /** @defgroup RCC_AHB1_Peripheral_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  703. * @brief Enable or disable the AHB1 peripheral clock.
  704. * @note After reset, the peripheral clock (used for registers read/write access)
  705. * is disabled and the application software has to enable this clock before
  706. * using it.
  707. * @{
  708. */
  709. #define __HAL_RCC_DMA1_CLK_ENABLE() LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA1)
  710. #if defined(DMA2)
  711. #define __HAL_RCC_DMA2_CLK_ENABLE() LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMA2)
  712. #endif
  713. #define __HAL_RCC_DMAMUX1_CLK_ENABLE() LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_DMAMUX1)
  714. #define __HAL_RCC_CRC_CLK_ENABLE() LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_CRC)
  715. #if defined(TSC)
  716. #define __HAL_RCC_TSC_CLK_ENABLE() LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_TSC)
  717. #endif
  718. #define __HAL_RCC_DMA1_CLK_DISABLE() LL_AHB1_GRP1_DisableClock(LL_AHB1_GRP1_PERIPH_DMA1)
  719. #if defined(DMA2)
  720. #define __HAL_RCC_DMA2_CLK_DISABLE() LL_AHB1_GRP1_DisableClock(LL_AHB1_GRP1_PERIPH_DMA2)
  721. #endif
  722. #define __HAL_RCC_DMAMUX1_CLK_DISABLE() LL_AHB1_GRP1_DisableClock(LL_AHB1_GRP1_PERIPH_DMAMUX1)
  723. #define __HAL_RCC_CRC_CLK_DISABLE() LL_AHB1_GRP1_DisableClock(LL_AHB1_GRP1_PERIPH_CRC)
  724. #if defined(TSC)
  725. #define __HAL_RCC_TSC_CLK_DISABLE() LL_AHB1_GRP1_DisableClock(LL_AHB1_GRP1_PERIPH_TSC)
  726. #endif
  727. /**
  728. * @}
  729. */
  730. /** @defgroup RCC_AHB2_Peripheral_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  731. * @brief Enable or disable the AHB2 peripheral clock.
  732. * @note After reset, the peripheral clock (used for registers read/write access)
  733. * is disabled and the application software has to enable this clock before
  734. * using it.
  735. * @{
  736. */
  737. #define __HAL_RCC_GPIOA_CLK_ENABLE() LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOA)
  738. #define __HAL_RCC_GPIOB_CLK_ENABLE() LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOB)
  739. #define __HAL_RCC_GPIOC_CLK_ENABLE() LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOC)
  740. #if defined(GPIOD)
  741. #define __HAL_RCC_GPIOD_CLK_ENABLE() LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOD)
  742. #endif
  743. #define __HAL_RCC_GPIOE_CLK_ENABLE() LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOE)
  744. #define __HAL_RCC_GPIOH_CLK_ENABLE() LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_GPIOH)
  745. #if defined(ADC_SUPPORT_5_MSPS)
  746. #define __HAL_RCC_ADC_CLK_ENABLE() LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_ADC)
  747. #endif
  748. #if defined(AES1)
  749. #define __HAL_RCC_AES1_CLK_ENABLE() LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_AES1)
  750. #endif
  751. #define __HAL_RCC_GPIOA_CLK_DISABLE() LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOA)
  752. #define __HAL_RCC_GPIOB_CLK_DISABLE() LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOB)
  753. #define __HAL_RCC_GPIOC_CLK_DISABLE() LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOC)
  754. #if defined(GPIOD)
  755. #define __HAL_RCC_GPIOD_CLK_DISABLE() LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOD)
  756. #endif
  757. #define __HAL_RCC_GPIOE_CLK_DISABLE() LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOE)
  758. #define __HAL_RCC_GPIOH_CLK_DISABLE() LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_GPIOH)
  759. #if defined(ADC_SUPPORT_5_MSPS)
  760. #define __HAL_RCC_ADC_CLK_DISABLE() LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_ADC)
  761. #endif
  762. #if defined(AES1)
  763. #define __HAL_RCC_AES1_CLK_DISABLE() LL_AHB2_GRP1_DisableClock(LL_AHB2_GRP1_PERIPH_AES1)
  764. #endif
  765. /**
  766. * @}
  767. */
  768. /** @defgroup RCC_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  769. * @brief Enable or disable the AHB3 peripheral clock.
  770. * @note After reset, the peripheral clock (used for registers read/write access)
  771. * is disabled and the application software has to enable this clock before
  772. * using it.
  773. * @{
  774. */
  775. #if defined(QUADSPI)
  776. #define __HAL_RCC_QUADSPI_CLK_ENABLE() LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_QUADSPI)
  777. #endif
  778. #define __HAL_RCC_PKA_CLK_ENABLE() LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_PKA)
  779. #define __HAL_RCC_AES2_CLK_ENABLE() LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_AES2)
  780. #define __HAL_RCC_RNG_CLK_ENABLE() LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_RNG)
  781. #define __HAL_RCC_HSEM_CLK_ENABLE() LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_HSEM)
  782. #define __HAL_RCC_IPCC_CLK_ENABLE() LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_IPCC)
  783. #define __HAL_RCC_FLASH_CLK_ENABLE() LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_FLASH)
  784. #if defined(QUADSPI)
  785. #define __HAL_RCC_QUADSPI_CLK_DISABLE() LL_AHB3_GRP1_DisableClock(LL_AHB3_GRP1_PERIPH_QUADSPI)
  786. #endif
  787. #define __HAL_RCC_PKA_CLK_DISABLE() LL_AHB3_GRP1_DisableClock(LL_AHB3_GRP1_PERIPH_PKA)
  788. #define __HAL_RCC_AES2_CLK_DISABLE() LL_AHB3_GRP1_DisableClock(LL_AHB3_GRP1_PERIPH_AES2)
  789. #define __HAL_RCC_RNG_CLK_DISABLE() LL_AHB3_GRP1_DisableClock(LL_AHB3_GRP1_PERIPH_RNG)
  790. #define __HAL_RCC_HSEM_CLK_DISABLE() LL_AHB3_GRP1_DisableClock(LL_AHB3_GRP1_PERIPH_HSEM)
  791. #define __HAL_RCC_IPCC_CLK_DISABLE() LL_AHB3_GRP1_DisableClock(LL_AHB3_GRP1_PERIPH_IPCC)
  792. #define __HAL_RCC_FLASH_CLK_DISABLE() LL_AHB3_GRP1_DisableClock(LL_AHB3_GRP1_PERIPH_FLASH)
  793. /**
  794. * @}
  795. */
  796. /** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  797. * @brief Enable or disable the APB1 peripheral clock.
  798. * @note After reset, the peripheral clock (used for registers read/write access)
  799. * is disabled and the application software has to enable this clock before
  800. * using it.
  801. * @{
  802. */
  803. #define __HAL_RCC_RTCAPB_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_RTCAPB)
  804. #define __HAL_RCC_WWDG_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_WWDG)
  805. #define __HAL_RCC_TIM2_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_TIM2)
  806. #if defined(LCD)
  807. #define __HAL_RCC_LCD_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LCD)
  808. #endif
  809. #if defined(SPI2)
  810. #define __HAL_RCC_SPI2_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI2)
  811. #endif
  812. #define __HAL_RCC_I2C1_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_I2C1)
  813. #if defined(I2C3)
  814. #define __HAL_RCC_I2C3_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_I2C3)
  815. #endif
  816. #if defined(CRS)
  817. #define __HAL_RCC_CRS_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_CRS)
  818. #endif
  819. #if defined(USB)
  820. #define __HAL_RCC_USB_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USB)
  821. #endif
  822. #define __HAL_RCC_LPTIM1_CLK_ENABLE() LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPTIM1)
  823. #define __HAL_RCC_LPTIM2_CLK_ENABLE() LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_LPTIM2)
  824. #if defined(LPUART1)
  825. #define __HAL_RCC_LPUART1_CLK_ENABLE() LL_APB1_GRP2_EnableClock(LL_APB1_GRP2_PERIPH_LPUART1)
  826. #endif
  827. #define __HAL_RCC_RTCAPB_CLK_DISABLE() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_RTCAPB)
  828. #define __HAL_RCC_TIM2_CLK_DISABLE() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_TIM2)
  829. #if defined(LCD)
  830. #define __HAL_RCC_LCD_CLK_DISABLE() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_LCD)
  831. #endif
  832. #if defined(SPI2)
  833. #define __HAL_RCC_SPI2_CLK_DISABLE() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_SPI2)
  834. #endif
  835. #define __HAL_RCC_I2C1_CLK_DISABLE() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_I2C1)
  836. #if defined(I2C3)
  837. #define __HAL_RCC_I2C3_CLK_DISABLE() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_I2C3)
  838. #endif
  839. #if defined(CRS)
  840. #define __HAL_RCC_CRS_CLK_DISABLE() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_CRS)
  841. #endif
  842. #if defined(USB)
  843. #define __HAL_RCC_USB_CLK_DISABLE() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_USB)
  844. #endif
  845. #define __HAL_RCC_LPTIM1_CLK_DISABLE() LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_LPTIM1)
  846. #define __HAL_RCC_LPTIM2_CLK_DISABLE() LL_APB1_GRP2_DisableClock(LL_APB1_GRP2_PERIPH_LPTIM2)
  847. #if defined(LPUART1)
  848. #define __HAL_RCC_LPUART1_CLK_DISABLE() LL_APB1_GRP2_DisableClock(LL_APB1_GRP2_PERIPH_LPUART1)
  849. #endif
  850. /**
  851. * @}
  852. */
  853. /** @defgroup RCC_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  854. * @brief Enable or disable the APB2 peripheral clock.
  855. * @note After reset, the peripheral clock (used for registers read/write access)
  856. * is disabled and the application software has to enable this clock before
  857. * using it.
  858. * @{
  859. */
  860. #if defined(ADC_SUPPORT_2_5_MSPS)
  861. #define __HAL_RCC_ADC_CLK_ENABLE() LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC)
  862. #endif
  863. #define __HAL_RCC_TIM1_CLK_ENABLE() LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM1)
  864. #define __HAL_RCC_SPI1_CLK_ENABLE() LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SPI1)
  865. #define __HAL_RCC_USART1_CLK_ENABLE() LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1)
  866. #define __HAL_RCC_TIM16_CLK_ENABLE() LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM16)
  867. #define __HAL_RCC_TIM17_CLK_ENABLE() LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM17)
  868. #if defined(SAI1)
  869. #define __HAL_RCC_SAI1_CLK_ENABLE() LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SAI1)
  870. #endif
  871. #if defined(ADC_SUPPORT_2_5_MSPS)
  872. #define __HAL_RCC_ADC_CLK_DISABLE() LL_APB2_GRP1_DisableClock(LL_APB2_GRP1_PERIPH_ADC)
  873. #endif
  874. #define __HAL_RCC_TIM1_CLK_DISABLE() LL_APB2_GRP1_DisableClock(LL_APB2_GRP1_PERIPH_TIM1)
  875. #define __HAL_RCC_SPI1_CLK_DISABLE() LL_APB2_GRP1_DisableClock(LL_APB2_GRP1_PERIPH_SPI1)
  876. #define __HAL_RCC_USART1_CLK_DISABLE() LL_APB2_GRP1_DisableClock(LL_APB2_GRP1_PERIPH_USART1)
  877. #define __HAL_RCC_TIM16_CLK_DISABLE() LL_APB2_GRP1_DisableClock(LL_APB2_GRP1_PERIPH_TIM16)
  878. #define __HAL_RCC_TIM17_CLK_DISABLE() LL_APB2_GRP1_DisableClock(LL_APB2_GRP1_PERIPH_TIM17)
  879. #if defined(SAI1)
  880. #define __HAL_RCC_SAI1_CLK_DISABLE() LL_APB2_GRP1_DisableClock(LL_APB2_GRP1_PERIPH_SAI1)
  881. #endif
  882. /**
  883. * @}
  884. */
  885. /** @defgroup RCC_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enabled or Disabled Status
  886. * @brief Check whether the AHB1 peripheral clock is enabled or not.
  887. * @note After reset, the peripheral clock (used for registers read/write access)
  888. * is disabled and the application software has to enable this clock before
  889. * using it.
  890. * @{
  891. */
  892. #define __HAL_RCC_DMA1_IS_CLK_ENABLED() LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_DMA1)
  893. #if defined(DMA2)
  894. #define __HAL_RCC_DMA2_IS_CLK_ENABLED() LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_DMA2)
  895. #endif
  896. #define __HAL_RCC_DMAMUX1_IS_CLK_ENABLED() LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_DMAMUX1)
  897. #define __HAL_RCC_CRC_IS_CLK_ENABLED() LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_CRC)
  898. #if defined(TSC)
  899. #define __HAL_RCC_TSC_IS_CLK_ENABLED() LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_TSC)
  900. #endif
  901. #define __HAL_RCC_DMA1_IS_CLK_DISABLED() !(LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_DMA1))
  902. #if defined(DMA2)
  903. #define __HAL_RCC_DMA2_IS_CLK_DISABLED() !(LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_DMA2))
  904. #endif
  905. #define __HAL_RCC_DMAMUX1_IS_CLK_DISABLED() !(LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_DMAMUX1))
  906. #define __HAL_RCC_CRC_IS_CLK_DISABLED() !(LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_CRC))
  907. #if defined(TSC)
  908. #define __HAL_RCC_TSC_IS_CLK_DISABLED() !(LL_AHB1_GRP1_IsEnabledClock(LL_AHB1_GRP1_PERIPH_TSC))
  909. #endif
  910. /**
  911. * @}
  912. */
  913. /** @defgroup RCC_AHB2_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enabled or Disabled Status
  914. * @brief Check whether the AHB2 peripheral clock is enabled or not.
  915. * @note After reset, the peripheral clock (used for registers read/write access)
  916. * is disabled and the application software has to enable this clock before
  917. * using it.
  918. * @{
  919. */
  920. #define __HAL_RCC_GPIOA_IS_CLK_ENABLED() LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOA)
  921. #define __HAL_RCC_GPIOB_IS_CLK_ENABLED() LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOB)
  922. #define __HAL_RCC_GPIOC_IS_CLK_ENABLED() LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOC)
  923. #if defined(GPIOD)
  924. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOD)
  925. #endif
  926. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOE)
  927. #define __HAL_RCC_GPIOH_IS_CLK_ENABLED() LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOH)
  928. #if defined(ADC_SUPPORT_5_MSPS)
  929. #define __HAL_RCC_ADC_IS_CLK_ENABLED() LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_ADC)
  930. #endif
  931. #if defined(AES1)
  932. #define __HAL_RCC_AES1_IS_CLK_ENABLED() LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_AES1)
  933. #endif
  934. #define __HAL_RCC_GPIOA_IS_CLK_DISABLED() !(LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOA))
  935. #define __HAL_RCC_GPIOB_IS_CLK_DISABLED() !(LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOB))
  936. #define __HAL_RCC_GPIOC_IS_CLK_DISABLED() !(LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOC))
  937. #if defined(GPIOD)
  938. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() !(LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOD))
  939. #endif
  940. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() !(LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOE))
  941. #define __HAL_RCC_GPIOH_IS_CLK_DISABLED() !(LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_GPIOH))
  942. #if defined(ADC_SUPPORT_5_MSPS)
  943. #define __HAL_RCC_ADC_IS_CLK_DISABLED() !(LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_ADC))
  944. #endif
  945. #if defined(AES1)
  946. #define __HAL_RCC_AES1_IS_CLK_DISABLED() !(LL_AHB2_GRP1_IsEnabledClock(LL_AHB2_GRP1_PERIPH_AES1))
  947. #endif
  948. /**
  949. * @}
  950. */
  951. /** @defgroup RCC_AHB3_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enabled or Disabled Status
  952. * @brief Check whether the AHB3 peripheral clock is enabled or not.
  953. * @note After reset, the peripheral clock (used for registers read/write access)
  954. * is disabled and the application software has to enable this clock before
  955. * using it.
  956. * @{
  957. */
  958. #if defined(QUADSPI)
  959. #define __HAL_RCC_QUADSPI_IS_CLK_ENABLED() LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_QUADSPI)
  960. #endif
  961. #define __HAL_RCC_PKA_IS_CLK_ENABLED() LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_PKA)
  962. #define __HAL_RCC_AES2_IS_CLK_ENABLED() LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_AES2)
  963. #define __HAL_RCC_RNG_IS_CLK_ENABLED() LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_RNG)
  964. #define __HAL_RCC_HSEM_IS_CLK_ENABLED() LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_HSEM)
  965. #define __HAL_RCC_IPCC_IS_CLK_ENABLED() LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_IPCC)
  966. #define __HAL_RCC_FLASH_IS_CLK_ENABLED() LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_FLASH)
  967. #if defined(QUADSPI)
  968. #define __HAL_RCC_QUADSPI_IS_CLK_DISABLED() !(LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_QUADSPI))
  969. #endif
  970. #define __HAL_RCC_PKA_IS_CLK_DISABLED() !(LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_PKA))
  971. #define __HAL_RCC_AES2_IS_CLK_DISABLED() !(LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_AES2))
  972. #define __HAL_RCC_RNG_IS_CLK_DISABLED() !(LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_RNG))
  973. #define __HAL_RCC_HSEM_IS_CLK_DISABLED() !(LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_HSEM))
  974. #define __HAL_RCC_IPCC_IS_CLK_DISABLED() !(LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_IPCC))
  975. #define __HAL_RCC_FLASH_IS_CLK_DISABLED() !(LL_AHB3_GRP1_IsEnabledClock(LL_AHB3_GRP1_PERIPH_FLASH))
  976. /**
  977. * @}
  978. */
  979. /** @defgroup RCC_APB1_Clock_Enable_Disable_Status APB1 Peripheral Clock Enabled or Disabled Status
  980. * @brief Check whether the APB1 peripheral clock is enabled or not.
  981. * @note After reset, the peripheral clock (used for registers read/write access)
  982. * is disabled and the application software has to enable this clock before
  983. * using it.
  984. * @{
  985. */
  986. #define __HAL_RCC_RTCAPB_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_RTCAPB)
  987. #define __HAL_RCC_WWDG_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_WWDG)
  988. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_TIM2)
  989. #if defined(LCD)
  990. #define __HAL_RCC_LCD_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_LCD)
  991. #endif
  992. #if defined(SPI2)
  993. #define __HAL_RCC_SPI2_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_SPI2)
  994. #endif
  995. #define __HAL_RCC_I2C1_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_I2C1)
  996. #if defined(I2C3)
  997. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_I2C3)
  998. #endif
  999. #if defined(CRS)
  1000. #define __HAL_RCC_CRS_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_CRS)
  1001. #endif
  1002. #if defined(USB)
  1003. #define __HAL_RCC_USB_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_USB)
  1004. #endif
  1005. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_LPTIM1)
  1006. #define __HAL_RCC_LPTIM2_IS_CLK_ENABLED() LL_APB1_GRP2_IsEnabledClock(LL_APB1_GRP2_PERIPH_LPTIM2)
  1007. #if defined(LPUART1)
  1008. #define __HAL_RCC_LPUART1_IS_CLK_ENABLED() LL_APB1_GRP2_IsEnabledClock(LL_APB1_GRP2_PERIPH_LPUART1)
  1009. #endif
  1010. #define __HAL_RCC_RTCAPB_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_RTCAPB))
  1011. #define __HAL_RCC_WWDG_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_WWDG))
  1012. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_TIM2))
  1013. #if defined(LCD)
  1014. #define __HAL_RCC_LCD_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_LCD))
  1015. #endif
  1016. #if defined(SPI2)
  1017. #define __HAL_RCC_SPI2_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_SPI2))
  1018. #endif
  1019. #define __HAL_RCC_I2C1_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_I2C1))
  1020. #if defined(I2C3)
  1021. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_I2C3))
  1022. #endif
  1023. #if defined(CRS)
  1024. #define __HAL_RCC_CRS_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_CRS))
  1025. #endif
  1026. #if defined(USB)
  1027. #define __HAL_RCC_USB_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_USB))
  1028. #endif
  1029. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() !(LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_LPTIM1))
  1030. #define __HAL_RCC_LPTIM2_IS_CLK_DISABLED() !(LL_APB1_GRP2_IsEnabledClock(LL_APB1_GRP2_PERIPH_LPTIM2))
  1031. #if defined(LPUART1)
  1032. #define __HAL_RCC_LPUART1_IS_CLK_DISABLED() !(LL_APB1_GRP2_IsEnabledClock(LL_APB1_GRP2_PERIPH_LPUART1))
  1033. #endif
  1034. /**
  1035. * @}
  1036. */
  1037. /** @defgroup RCC_APB2_Clock_Enable_Disable_Status APB2 Peripheral Clock Enabled or Disabled Status
  1038. * @brief Check whether the APB2 peripheral clock is enabled or not.
  1039. * @note After reset, the peripheral clock (used for registers read/write access)
  1040. * is disabled and the application software has to enable this clock before
  1041. * using it.
  1042. * @{
  1043. */
  1044. #if defined(ADC_SUPPORT_2_5_MSPS)
  1045. #define __HAL_RCC_ADC_IS_CLK_ENABLED() LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_ADC)
  1046. #endif
  1047. #define __HAL_RCC_TIM1_IS_CLK_ENABLED() LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_TIM1)
  1048. #define __HAL_RCC_SPI1_IS_CLK_ENABLED() LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_SPI1)
  1049. #define __HAL_RCC_USART1_IS_CLK_ENABLED() LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_USART1)
  1050. #define __HAL_RCC_TIM16_IS_CLK_ENABLED() LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_TIM16)
  1051. #define __HAL_RCC_TIM17_IS_CLK_ENABLED() LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_TIM17)
  1052. #if defined(SAI1)
  1053. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_SAI1)
  1054. #endif
  1055. #if defined(ADC_SUPPORT_2_5_MSPS)
  1056. #define __HAL_RCC_ADC_IS_CLK_DISABLED() !(LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_ADC))
  1057. #endif
  1058. #define __HAL_RCC_TIM1_IS_CLK_DISABLED() !(LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_TIM1))
  1059. #define __HAL_RCC_SPI1_IS_CLK_DISABLED() !(LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_SPI1))
  1060. #define __HAL_RCC_USART1_IS_CLK_DISABLED() !(LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_USART1))
  1061. #define __HAL_RCC_TIM16_IS_CLK_DISABLED() !(LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_TIM16))
  1062. #define __HAL_RCC_TIM17_IS_CLK_DISABLED() !(LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_TIM17))
  1063. #if defined(SAI1)
  1064. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() !(LL_APB2_GRP1_IsEnabledClock(LL_APB2_GRP1_PERIPH_SAI1))
  1065. #endif
  1066. /**
  1067. * @}
  1068. */
  1069. /** @defgroup RCC_AHB1_Peripheral_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  1070. * @brief Enable or disable the AHB1 peripheral clock.
  1071. * @note After reset, the peripheral clock (used for registers read/write access)
  1072. * is disabled and the application software has to enable this clock before
  1073. * using it.
  1074. * @{
  1075. */
  1076. #define __HAL_RCC_C2DMA1_CLK_ENABLE() LL_C2_AHB1_GRP1_EnableClock(LL_C2_AHB1_GRP1_PERIPH_DMA1)
  1077. #if defined(DMA2)
  1078. #define __HAL_RCC_C2DMA2_CLK_ENABLE() LL_C2_AHB1_GRP1_EnableClock(LL_C2_AHB1_GRP1_PERIPH_DMA2)
  1079. #endif
  1080. #define __HAL_RCC_C2DMAMUX1_CLK_ENABLE() LL_C2_AHB1_GRP1_EnableClock(LL_C2_AHB1_GRP1_PERIPH_DMAMUX1)
  1081. #define __HAL_RCC_C2SRAM1_CLK_ENABLE() LL_C2_AHB1_GRP1_EnableClock(LL_C2_AHB1_GRP1_PERIPH_SRAM1)
  1082. #define __HAL_RCC_C2CRC_CLK_ENABLE() LL_C2_AHB1_GRP1_EnableClock(LL_C2_AHB1_GRP1_PERIPH_CRC)
  1083. #if defined(TSC)
  1084. #define __HAL_RCC_C2TSC_CLK_ENABLE() LL_C2_AHB1_GRP1_EnableClock(LL_C2_AHB1_GRP1_PERIPH_TSC)
  1085. #endif
  1086. #define __HAL_RCC_C2DMA1_CLK_DISABLE() LL_C2_AHB1_GRP1_DisableClock(LL_C2_AHB1_GRP1_PERIPH_DMA1)
  1087. #if defined(DMA2)
  1088. #define __HAL_RCC_C2DMA2_CLK_DISABLE() LL_C2_AHB1_GRP1_DisableClock(LL_C2_AHB1_GRP1_PERIPH_DMA2)
  1089. #endif
  1090. #define __HAL_RCC_C2DMAMUX1_CLK_DISABLE() LL_C2_AHB1_GRP1_DisableClock(LL_C2_AHB1_GRP1_PERIPH_DMAMUX1)
  1091. #define __HAL_RCC_C2SRAM1_CLK_DISABLE() LL_C2_AHB1_GRP1_DisableClock(LL_C2_AHB1_GRP1_PERIPH_SRAM1)
  1092. #define __HAL_RCC_C2CRC_CLK_DISABLE() LL_C2_AHB1_GRP1_DisableClock(LL_C2_AHB1_GRP1_PERIPH_CRC)
  1093. #if defined(TSC)
  1094. #define __HAL_RCC_C2TSC_CLK_DISABLE() LL_C2_AHB1_GRP1_DisableClock(LL_C2_AHB1_GRP1_PERIPH_TSC)
  1095. #endif
  1096. /**
  1097. * @}
  1098. */
  1099. /** @defgroup RCC_AHB2_Peripheral_Clock_Enable_Disable AHB2 Peripheral Clock Enable Disable
  1100. * @brief Enable or disable the AHB2 peripheral clock.
  1101. * @note After reset, the peripheral clock (used for registers read/write access)
  1102. * is disabled and the application software has to enable this clock before
  1103. * using it.
  1104. * @{
  1105. */
  1106. #define __HAL_RCC_C2GPIOA_CLK_ENABLE() LL_C2_AHB2_GRP1_EnableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOA)
  1107. #define __HAL_RCC_C2GPIOB_CLK_ENABLE() LL_C2_AHB2_GRP1_EnableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOB)
  1108. #define __HAL_RCC_C2GPIOC_CLK_ENABLE() LL_C2_AHB2_GRP1_EnableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOC)
  1109. #if defined(GPIOD)
  1110. #define __HAL_RCC_C2GPIOD_CLK_ENABLE() LL_C2_AHB2_GRP1_EnableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOD)
  1111. #endif
  1112. #define __HAL_RCC_C2GPIOE_CLK_ENABLE() LL_C2_AHB2_GRP1_EnableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOE)
  1113. #define __HAL_RCC_C2GPIOH_CLK_ENABLE() LL_C2_AHB2_GRP1_EnableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOH)
  1114. #if defined(ADC_SUPPORT_5_MSPS)
  1115. #define __HAL_RCC_C2ADC_CLK_ENABLE() LL_C2_AHB2_GRP1_EnableClock(LL_C2_AHB2_GRP1_PERIPH_ADC)
  1116. #endif
  1117. #if defined(AES1)
  1118. #define __HAL_RCC_C2AES1_CLK_ENABLE() LL_C2_AHB2_GRP1_EnableClock(LL_C2_AHB2_GRP1_PERIPH_AES1)
  1119. #endif
  1120. #define __HAL_RCC_C2GPIOA_CLK_DISABLE() LL_C2_AHB2_GRP1_DisableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOA)
  1121. #define __HAL_RCC_C2GPIOB_CLK_DISABLE() LL_C2_AHB2_GRP1_DisableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOB)
  1122. #define __HAL_RCC_C2GPIOC_CLK_DISABLE() LL_C2_AHB2_GRP1_DisableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOC)
  1123. #if defined(GPIOD)
  1124. #define __HAL_RCC_C2GPIOD_CLK_DISABLE() LL_C2_AHB2_GRP1_DisableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOD)
  1125. #endif
  1126. #define __HAL_RCC_C2GPIOE_CLK_DISABLE() LL_C2_AHB2_GRP1_DisableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOE)
  1127. #define __HAL_RCC_C2GPIOH_CLK_DISABLE() LL_C2_AHB2_GRP1_DisableClock(LL_C2_AHB2_GRP1_PERIPH_GPIOH)
  1128. #if defined(ADC_SUPPORT_5_MSPS)
  1129. #define __HAL_RCC_C2ADC_CLK_DISABLE() LL_C2_AHB2_GRP1_DisableClock(LL_C2_AHB2_GRP1_PERIPH_ADC)
  1130. #endif
  1131. #if defined(AES1)
  1132. #define __HAL_RCC_C2AES1_CLK_DISABLE() LL_C2_AHB2_GRP1_DisableClock(LL_C2_AHB2_GRP1_PERIPH_AES1)
  1133. #endif
  1134. /**
  1135. * @}
  1136. */
  1137. /** @defgroup RCC_AHB3_Clock_Enable_Disable AHB3 Peripheral Clock Enable Disable
  1138. * @brief Enable or disable the AHB3 peripheral clock.
  1139. * @note After reset, the peripheral clock (used for registers read/write access)
  1140. * is disabled and the application software has to enable this clock before
  1141. * using it.
  1142. * @{
  1143. */
  1144. #define __HAL_RCC_C2PKA_CLK_ENABLE() LL_C2_AHB3_GRP1_EnableClock(LL_C2_AHB3_GRP1_PERIPH_PKA)
  1145. #define __HAL_RCC_C2AES2_CLK_ENABLE() LL_C2_AHB3_GRP1_EnableClock(LL_C2_AHB3_GRP1_PERIPH_AES2)
  1146. #define __HAL_RCC_C2RNG_CLK_ENABLE() LL_C2_AHB3_GRP1_EnableClock(LL_C2_AHB3_GRP1_PERIPH_RNG)
  1147. #define __HAL_RCC_C2HSEM_CLK_ENABLE() LL_C2_AHB3_GRP1_EnableClock(LL_C2_AHB3_GRP1_PERIPH_HSEM)
  1148. #define __HAL_RCC_C2IPCC_CLK_ENABLE() LL_C2_AHB3_GRP1_EnableClock(LL_C2_AHB3_GRP1_PERIPH_IPCC)
  1149. #define __HAL_RCC_C2FLASH_CLK_ENABLE() LL_C2_AHB3_GRP1_EnableClock(LL_C2_AHB3_GRP1_PERIPH_FLASH)
  1150. #define __HAL_RCC_C2PKA_CLK_DISABLE() LL_C2_AHB3_GRP1_DisableClock(LL_C2_AHB3_GRP1_PERIPH_PKA)
  1151. #define __HAL_RCC_C2AES2_CLK_DISABLE() LL_C2_AHB3_GRP1_DisableClock(LL_C2_AHB3_GRP1_PERIPH_AES2)
  1152. #define __HAL_RCC_C2RNG_CLK_DISABLE() LL_C2_AHB3_GRP1_DisableClock(LL_C2_AHB3_GRP1_PERIPH_RNG)
  1153. #define __HAL_RCC_C2HSEM_CLK_DISABLE() LL_C2_AHB3_GRP1_DisableClock(LL_C2_AHB3_GRP1_PERIPH_HSEM)
  1154. #define __HAL_RCC_C2IPCC_CLK_DISABLE() LL_C2_AHB3_GRP1_DisableClock(LL_C2_AHB3_GRP1_PERIPH_IPCC)
  1155. #define __HAL_RCC_C2FLASH_CLK_DISABLE() LL_C2_AHB3_GRP1_DisableClock(LL_C2_AHB3_GRP1_PERIPH_FLASH)
  1156. /**
  1157. * @}
  1158. */
  1159. /** @defgroup RCC_APB1_Clock_Enable_Disable APB1 Peripheral Clock Enable Disable
  1160. * @brief Enable or disable the APB1 peripheral clock.
  1161. * @note After reset, the peripheral clock (used for registers read/write access)
  1162. * is disabled and the application software has to enable this clock before
  1163. * using it.
  1164. * @{
  1165. */
  1166. #define __HAL_RCC_C2RTCAPB_CLK_ENABLE() LL_C2_APB1_GRP1_EnableClock(LL_C2_APB1_GRP1_PERIPH_RTCAPB)
  1167. #define __HAL_RCC_C2TIM2_CLK_ENABLE() LL_C2_APB1_GRP1_EnableClock(LL_C2_APB1_GRP1_PERIPH_TIM2)
  1168. #if defined(LCD)
  1169. #define __HAL_RCC_C2LCD_CLK_ENABLE() LL_C2_APB1_GRP1_EnableClock(LL_C2_APB1_GRP1_PERIPH_LCD)
  1170. #endif
  1171. #if defined(SPI2)
  1172. #define __HAL_RCC_C2SPI2_CLK_ENABLE() LL_C2_APB1_GRP1_EnableClock(LL_C2_APB1_GRP1_PERIPH_SPI2)
  1173. #endif
  1174. #define __HAL_RCC_C2I2C1_CLK_ENABLE() LL_C2_APB1_GRP1_EnableClock(LL_C2_APB1_GRP1_PERIPH_I2C1)
  1175. #if defined(I2C3)
  1176. #define __HAL_RCC_C2I2C3_CLK_ENABLE() LL_C2_APB1_GRP1_EnableClock(LL_C2_APB1_GRP1_PERIPH_I2C3)
  1177. #endif
  1178. #if defined(CRS)
  1179. #define __HAL_RCC_C2CRS_CLK_ENABLE() LL_C2_APB1_GRP1_EnableClock(LL_C2_APB1_GRP1_PERIPH_CRS)
  1180. #endif
  1181. #if defined(USB)
  1182. #define __HAL_RCC_C2USB_CLK_ENABLE() LL_C2_APB1_GRP1_EnableClock(LL_C2_APB1_GRP1_PERIPH_USB)
  1183. #endif
  1184. #define __HAL_RCC_C2LPTIM1_CLK_ENABLE() LL_C2_APB1_GRP1_EnableClock(LL_C2_APB1_GRP1_PERIPH_LPTIM1)
  1185. #define __HAL_RCC_C2LPTIM2_CLK_ENABLE() LL_C2_APB1_GRP2_EnableClock(LL_C2_APB1_GRP2_PERIPH_LPTIM2)
  1186. #if defined(LPUART1)
  1187. #define __HAL_RCC_C2LPUART1_CLK_ENABLE() LL_C2_APB1_GRP2_EnableClock(LL_C2_APB1_GRP2_PERIPH_LPUART1)
  1188. #endif
  1189. #define __HAL_RCC_C2RTCAPB_CLK_DISABLE() LL_C2_APB1_GRP1_DisableClock(LL_C2_APB1_GRP1_PERIPH_RTCAPB)
  1190. #define __HAL_RCC_C2TIM2_CLK_DISABLE() LL_C2_APB1_GRP1_DisableClock(LL_C2_APB1_GRP1_PERIPH_TIM2)
  1191. #if defined(LCD)
  1192. #define __HAL_RCC_C2LCD_CLK_DISABLE() LL_C2_APB1_GRP1_DisableClock(LL_C2_APB1_GRP1_PERIPH_LCD)
  1193. #endif
  1194. #if defined(SPI2)
  1195. #define __HAL_RCC_C2SPI2_CLK_DISABLE() LL_C2_APB1_GRP1_DisableClock(LL_C2_APB1_GRP1_PERIPH_SPI2)
  1196. #endif
  1197. #define __HAL_RCC_C2I2C1_CLK_DISABLE() LL_C2_APB1_GRP1_DisableClock(LL_C2_APB1_GRP1_PERIPH_I2C1)
  1198. #if defined(I2C3)
  1199. #define __HAL_RCC_C2I2C3_CLK_DISABLE() LL_C2_APB1_GRP1_DisableClock(LL_C2_APB1_GRP1_PERIPH_I2C3)
  1200. #endif
  1201. #if defined(CRS)
  1202. #define __HAL_RCC_C2CRS_CLK_DISABLE() LL_C2_APB1_GRP1_DisableClock(LL_C2_APB1_GRP1_PERIPH_CRS)
  1203. #endif
  1204. #if defined(USB)
  1205. #define __HAL_RCC_C2USB_CLK_DISABLE() LL_C2_APB1_GRP1_DisableClock(LL_C2_APB1_GRP1_PERIPH_USB)
  1206. #endif
  1207. #define __HAL_RCC_C2LPTIM1_CLK_DISABLE() LL_C2_APB1_GRP1_DisableClock(LL_C2_APB1_GRP1_PERIPH_LPTIM1)
  1208. #define __HAL_RCC_C2LPTIM2_CLK_DISABLE() LL_C2_APB1_GRP2_DisableClock(LL_C2_APB1_GRP2_PERIPH_LPTIM2)
  1209. #if defined(LPUART1)
  1210. #define __HAL_RCC_C2LPUART1_CLK_DISABLE() LL_C2_APB1_GRP2_DisableClock(LL_C2_APB1_GRP2_PERIPH_LPUART1)
  1211. #endif
  1212. /**
  1213. * @}
  1214. */
  1215. /** @defgroup RCC_APB2_Clock_Enable_Disable APB2 Peripheral Clock Enable Disable
  1216. * @brief Enable or disable the APB2 peripheral clock.
  1217. * @note After reset, the peripheral clock (used for registers read/write access)
  1218. * is disabled and the application software has to enable this clock before
  1219. * using it.
  1220. * @{
  1221. */
  1222. #if defined(ADC_SUPPORT_2_5_MSPS)
  1223. #define __HAL_RCC_C2ADC_CLK_ENABLE() LL_C2_APB2_GRP1_EnableClock(LL_C2_APB2_GRP1_PERIPH_ADC)
  1224. #endif
  1225. #define __HAL_RCC_C2TIM1_CLK_ENABLE() LL_C2_APB2_GRP1_EnableClock(LL_C2_APB2_GRP1_PERIPH_TIM1)
  1226. #define __HAL_RCC_C2SPI1_CLK_ENABLE() LL_C2_APB2_GRP1_EnableClock(LL_C2_APB2_GRP1_PERIPH_SPI1)
  1227. #define __HAL_RCC_C2USART1_CLK_ENABLE() LL_C2_APB2_GRP1_EnableClock(LL_C2_APB2_GRP1_PERIPH_USART1)
  1228. #define __HAL_RCC_C2TIM16_CLK_ENABLE() LL_C2_APB2_GRP1_EnableClock(LL_C2_APB2_GRP1_PERIPH_TIM16)
  1229. #define __HAL_RCC_C2TIM17_CLK_ENABLE() LL_C2_APB2_GRP1_EnableClock(LL_C2_APB2_GRP1_PERIPH_TIM17)
  1230. #if defined(SAI1)
  1231. #define __HAL_RCC_C2SAI1_CLK_ENABLE() LL_C2_APB2_GRP1_EnableClock(LL_C2_APB2_GRP1_PERIPH_SAI1)
  1232. #endif
  1233. #if defined(ADC_SUPPORT_2_5_MSPS)
  1234. #define __HAL_RCC_C2ADC_CLK_DISABLE() LL_C2_APB2_GRP1_DisableClock(LL_C2_APB2_GRP1_PERIPH_ADC)
  1235. #endif
  1236. #define __HAL_RCC_C2TIM1_CLK_DISABLE() LL_C2_APB2_GRP1_DisableClock(LL_C2_APB2_GRP1_PERIPH_TIM1)
  1237. #define __HAL_RCC_C2SPI1_CLK_DISABLE() LL_C2_APB2_GRP1_DisableClock(LL_C2_APB2_GRP1_PERIPH_SPI1)
  1238. #define __HAL_RCC_C2USART1_CLK_DISABLE() LL_C2_APB2_GRP1_DisableClock(LL_C2_APB2_GRP1_PERIPH_USART1)
  1239. #define __HAL_RCC_C2TIM16_CLK_DISABLE() LL_C2_APB2_GRP1_DisableClock(LL_C2_APB2_GRP1_PERIPH_TIM16)
  1240. #define __HAL_RCC_C2TIM17_CLK_DISABLE() LL_C2_APB2_GRP1_DisableClock(LL_C2_APB2_GRP1_PERIPH_TIM17)
  1241. #if defined(SAI1)
  1242. #define __HAL_RCC_C2SAI1_CLK_DISABLE() LL_C2_APB2_GRP1_DisableClock(LL_C2_APB2_GRP1_PERIPH_SAI1)
  1243. #endif
  1244. /**
  1245. * @}
  1246. */
  1247. /** @defgroup RCC_APB3_Clock_Enable_Disable APB3 Peripheral Clock Enable Disable
  1248. * @brief Enable or disable the APB3 peripheral clock.
  1249. * @note After reset, the peripheral clock (used for registers read/write access)
  1250. * is disabled and the application software has to enable this clock before
  1251. * using it.
  1252. * @{
  1253. */
  1254. #define __HAL_RCC_C2BLE_CLK_ENABLE() LL_C2_APB3_GRP1_EnableClock(LL_C2_APB3_GRP1_PERIPH_BLE)
  1255. #if defined(RCC_802_SUPPORT)
  1256. #define __HAL_RCC_C2802_CLK_ENABLE() LL_C2_APB3_GRP1_EnableClock(LL_C2_APB3_GRP1_PERIPH_802)
  1257. #endif
  1258. #define __HAL_RCC_C2BLE_CLK_DISABLE() LL_C2_APB3_GRP1_DisableClock(LL_C2_APB3_GRP1_PERIPH_BLE)
  1259. #if defined(RCC_802_SUPPORT)
  1260. #define __HAL_RCC_C2802_CLK_DISABLE() LL_C2_APB3_GRP1_DisableClock(LL_C2_APB3_GRP1_PERIPH_802)
  1261. #endif
  1262. /**
  1263. * @}
  1264. */
  1265. /** @defgroup RCC_AHB1_Peripheral_Clock_Enable_Disable_Status AHB1 Peripheral Clock Enabled or Disabled Status
  1266. * @brief Check whether the AHB1 peripheral clock is enabled or not.
  1267. * @note After reset, the peripheral clock (used for registers read/write access)
  1268. * is disabled and the application software has to enable this clock before
  1269. * using it.
  1270. * @{
  1271. */
  1272. #define __HAL_RCC_C2DMA1_IS_CLK_ENABLED() LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_DMA1)
  1273. #if defined(DMA2)
  1274. #define __HAL_RCC_C2DMA2_IS_CLK_ENABLED() LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_DMA2)
  1275. #endif
  1276. #define __HAL_RCC_C2DMAMUX1_IS_CLK_ENABLED() LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_DMAMUX1)
  1277. #define __HAL_RCC_C2SRAM1_IS_CLK_ENABLED() LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_SRAM1)
  1278. #define __HAL_RCC_C2CRC_IS_CLK_ENABLED() LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_CRC)
  1279. #if defined(TSC)
  1280. #define __HAL_RCC_C2TSC_IS_CLK_ENABLED() LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_TSC)
  1281. #endif
  1282. #define __HAL_RCC_C2DMA1_IS_CLK_DISABLED() !(LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_DMA1))
  1283. #if defined(DMA2)
  1284. #define __HAL_RCC_C2DMA2_IS_CLK_DISABLED() !(LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_DMA2))
  1285. #endif
  1286. #define __HAL_RCC_C2DMAMUX1_IS_CLK_DISABLED() !(LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_DMAMUX1))
  1287. #define __HAL_RCC_C2SRAM1_IS_CLK_DISABLED() !(LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_SRAM1))
  1288. #define __HAL_RCC_C2CRC_IS_CLK_DISABLED() !(LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_CRC))
  1289. #if defined(TSC)
  1290. #define __HAL_RCC_C2TSC_IS_CLK_DISABLED() !(LL_C2_AHB1_GRP1_IsEnabledClock(LL_C2_AHB1_GRP1_PERIPH_TSC))
  1291. #endif
  1292. /**
  1293. * @}
  1294. */
  1295. /** @defgroup RCC_AHB2_Clock_Enable_Disable_Status AHB2 Peripheral Clock Enabled or Disabled Status
  1296. * @brief Check whether the AHB2 peripheral clock is enabled or not.
  1297. * @note After reset, the peripheral clock (used for registers read/write access)
  1298. * is disabled and the application software has to enable this clock before
  1299. * using it.
  1300. * @{
  1301. */
  1302. #define __HAL_RCC_C2GPIOA_IS_CLK_ENABLED() LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOA)
  1303. #define __HAL_RCC_C2GPIOB_IS_CLK_ENABLED() LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOB)
  1304. #define __HAL_RCC_C2GPIOC_IS_CLK_ENABLED() LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOC)
  1305. #if defined(GPIOD)
  1306. #define __HAL_RCC_C2GPIOD_IS_CLK_ENABLED() LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOD)
  1307. #endif
  1308. #define __HAL_RCC_C2GPIOE_IS_CLK_ENABLED() LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOE)
  1309. #define __HAL_RCC_C2GPIOH_IS_CLK_ENABLED() LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOH)
  1310. #if defined(ADC_SUPPORT_5_MSPS)
  1311. #define __HAL_RCC_C2ADC_IS_CLK_ENABLED() LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_ADC)
  1312. #endif
  1313. #if defined(AES1)
  1314. #define __HAL_RCC_C2AES1_IS_CLK_ENABLED() LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_AES1)
  1315. #endif
  1316. #define __HAL_RCC_C2GPIOA_IS_CLK_DISABLED() !(LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOA))
  1317. #define __HAL_RCC_C2GPIOB_IS_CLK_DISABLED() !(LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOB))
  1318. #define __HAL_RCC_C2GPIOC_IS_CLK_DISABLED() !(LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOC))
  1319. #if defined(GPIOD)
  1320. #define __HAL_RCC_C2GPIOD_IS_CLK_DISABLED() !(LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOD))
  1321. #endif
  1322. #define __HAL_RCC_C2GPIOE_IS_CLK_DISABLED() !(LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOE))
  1323. #define __HAL_RCC_C2GPIOH_IS_CLK_DISABLED() !(LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_GPIOH))
  1324. #if defined(ADC_SUPPORT_5_MSPS)
  1325. #define __HAL_RCC_C2ADC_IS_CLK_DISABLED() !(LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_ADC))
  1326. #endif
  1327. #if defined(AES1)
  1328. #define __HAL_RCC_C2AES1_IS_CLK_DISABLED() !(LL_C2_AHB2_GRP1_IsEnabledClock(LL_C2_AHB2_GRP1_PERIPH_AES1))
  1329. #endif
  1330. /**
  1331. * @}
  1332. */
  1333. /** @defgroup RCC_AHB3_Clock_Enable_Disable_Status AHB3 Peripheral Clock Enabled or Disabled Status
  1334. * @brief Check whether the AHB3 peripheral clock is enabled or not.
  1335. * @note After reset, the peripheral clock (used for registers read/write access)
  1336. * is disabled and the application software has to enable this clock before
  1337. * using it.
  1338. * @{
  1339. */
  1340. #define __HAL_RCC_C2PKA_IS_CLK_ENABLED() LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_PKA)
  1341. #define __HAL_RCC_C2AES2_IS_CLK_ENABLED() LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_AES2)
  1342. #define __HAL_RCC_C2RNG_IS_CLK_ENABLED() LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_RNG)
  1343. #define __HAL_RCC_C2HSEM_IS_CLK_ENABLED() LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_HSEM)
  1344. #define __HAL_RCC_C2IPCC_IS_CLK_ENABLED() LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_IPCC)
  1345. #define __HAL_RCC_C2FLASH_IS_CLK_ENABLED() LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_FLASH)
  1346. #define __HAL_RCC_C2PKA_IS_CLK_DISABLED() !(LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_PKA))
  1347. #define __HAL_RCC_C2AES2_IS_CLK_DISABLED() !(LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_AES2))
  1348. #define __HAL_RCC_C2RNG_IS_CLK_DISABLED() !(LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_RNG))
  1349. #define __HAL_RCC_C2HSEM_IS_CLK_DISABLED() !(LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_HSEM))
  1350. #define __HAL_RCC_C2IPCC_IS_CLK_DISABLED() !(LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_IPCC))
  1351. #define __HAL_RCC_C2FLASH_IS_CLK_DISABLED() !(LL_C2_AHB3_GRP1_IsEnabledClock(LL_C2_AHB3_GRP1_PERIPH_FLASH))
  1352. /**
  1353. * @}
  1354. */
  1355. /** @defgroup RCC_APB1_Clock_Enable_Disable_Status APB1 Peripheral Clock Enabled or Disabled Status
  1356. * @brief Check whether the APB1 peripheral clock is enabled or not.
  1357. * @note After reset, the peripheral clock (used for registers read/write access)
  1358. * is disabled and the application software has to enable this clock before
  1359. * using it.
  1360. * @{
  1361. */
  1362. #define __HAL_RCC_C2RTCAPB_IS_CLK_ENABLED() LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_RTCAPB)
  1363. #define __HAL_RCC_C2TIM2_IS_CLK_ENABLED() LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_TIM2)
  1364. #if defined(LCD)
  1365. #define __HAL_RCC_C2LCD_IS_CLK_ENABLED() LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_LCD)
  1366. #endif
  1367. #if defined(SPI2)
  1368. #define __HAL_RCC_C2SPI2_IS_CLK_ENABLED() LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_SPI2)
  1369. #endif
  1370. #define __HAL_RCC_C2I2C1_IS_CLK_ENABLED() LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_I2C1)
  1371. #if defined(I2C3)
  1372. #define __HAL_RCC_C2I2C3_IS_CLK_ENABLED() LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_I2C3)
  1373. #endif
  1374. #if defined(CRS)
  1375. #define __HAL_RCC_C2CRS_IS_CLK_ENABLED() LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_CRS)
  1376. #endif
  1377. #if defined(USB)
  1378. #define __HAL_RCC_C2USB_IS_CLK_ENABLED() LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_USB)
  1379. #endif
  1380. #define __HAL_RCC_C2LPTIM1_IS_CLK_ENABLED() LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_LPTIM1)
  1381. #define __HAL_RCC_C2LPTIM2_IS_CLK_ENABLED() LL_C2_APB1_GRP2_IsEnabledClock(LL_C2_APB1_GRP2_PERIPH_LPTIM2)
  1382. #if defined(LPUART1)
  1383. #define __HAL_RCC_C2LPUART1_IS_CLK_ENABLED() LL_C2_APB1_GRP2_IsEnabledClock(LL_C2_APB1_GRP2_PERIPH_LPUART1)
  1384. #endif
  1385. #define __HAL_RCC_C2RTCAPB_IS_CLK_DISABLED() !(LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_RTCAPB))
  1386. #define __HAL_RCC_C2TIM2_IS_CLK_DISABLED() !(LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_TIM2))
  1387. #if defined(LCD)
  1388. #define __HAL_RCC_C2LCD_IS_CLK_DISABLED() !(LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_LCD))
  1389. #endif
  1390. #if defined(SPI2)
  1391. #define __HAL_RCC_C2SPI2_IS_CLK_DISABLED() !(LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_SPI2))
  1392. #endif
  1393. #define __HAL_RCC_C2I2C1_IS_CLK_DISABLED() !(LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_I2C1))
  1394. #if defined(I2C3)
  1395. #define __HAL_RCC_C2I2C3_IS_CLK_DISABLED() !(LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_I2C3))
  1396. #endif
  1397. #if defined(CRS)
  1398. #define __HAL_RCC_C2CRS_IS_CLK_DISABLED() !(LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_CRS))
  1399. #endif
  1400. #if defined(USB)
  1401. #define __HAL_RCC_C2USB_IS_CLK_DISABLED() !(LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_USB))
  1402. #endif
  1403. #define __HAL_RCC_C2LPTIM1_IS_CLK_DISABLED() !(LL_C2_APB1_GRP1_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_LPTIM1))
  1404. #define __HAL_RCC_C2LPTIM2_IS_CLK_DISABLED() !(LL_C2_APB1_GRP2_IsEnabledClock(LL_C2_APB1_GRP2_PERIPH_LPTIM2))
  1405. #if defined(LPUART1)
  1406. #define __HAL_RCC_C2LPUART1_IS_CLK_DISABLED() !(LL_C2_APB1_GRP2_IsEnabledClock(LL_C2_APB1_GRP1_PERIPH_LPTIM1))
  1407. #endif
  1408. /**
  1409. * @}
  1410. */
  1411. /** @defgroup RCC_APB2_Clock_Enable_Disable_Status APB2 Peripheral Clock Enabled or Disabled Status
  1412. * @brief Check whether the APB2 peripheral clock is enabled or not.
  1413. * @note After reset, the peripheral clock (used for registers read/write access)
  1414. * is disabled and the application software has to enable this clock before
  1415. * using it.
  1416. * @{
  1417. */
  1418. #if defined(ADC_SUPPORT_2_5_MSPS)
  1419. #define __HAL_RCC_C2ADC_IS_CLK_ENABLED() LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_ADC)
  1420. #endif
  1421. #define __HAL_RCC_C2TIM1_IS_CLK_ENABLED() LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_TIM1)
  1422. #define __HAL_RCC_C2SPI1_IS_CLK_ENABLED() LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_SPI1)
  1423. #define __HAL_RCC_C2USART1_IS_CLK_ENABLED() LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_USART1)
  1424. #define __HAL_RCC_C2TIM16_IS_CLK_ENABLED() LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_TIM16)
  1425. #define __HAL_RCC_C2TIM17_IS_CLK_ENABLED() LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_TIM17)
  1426. #if defined(SAI1)
  1427. #define __HAL_RCC_C2SAI1_IS_CLK_ENABLED() LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_SAI1)
  1428. #endif
  1429. #if defined(ADC_SUPPORT_2_5_MSPS)
  1430. #define __HAL_RCC_C2ADC_IS_CLK_DISABLED() !( LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_ADC))
  1431. #endif
  1432. #define __HAL_RCC_C2TIM1_IS_CLK_DISABLED() !( LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_TIM1))
  1433. #define __HAL_RCC_C2SPI1_IS_CLK_DISABLED() !( LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_SPI1))
  1434. #define __HAL_RCC_C2USART1_IS_CLK_DISABLED() !( LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_USART1))
  1435. #define __HAL_RCC_C2TIM16_IS_CLK_DISABLED() !( LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_TIM16))
  1436. #define __HAL_RCC_C2TIM17_IS_CLK_DISABLED() !( LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_TIM17))
  1437. #if defined(SAI1)
  1438. #define __HAL_RCC_C2SAI1_IS_CLK_DISABLED() !( LL_C2_APB2_GRP1_IsEnabledClock(LL_C2_APB2_GRP1_PERIPH_SAI1))
  1439. #endif
  1440. /**
  1441. * @}
  1442. */
  1443. /** @defgroup RCC_APB3_Clock_Enable_Disable_Status APB3 Peripheral Clock Enabled or Disabled Status
  1444. * @brief Check whether the APB3 peripheral clock is enabled or not.
  1445. * @note After reset, the peripheral clock (used for registers read/write access)
  1446. * is disabled and the application software has to enable this clock before
  1447. * using it.
  1448. * @{
  1449. */
  1450. #define __HAL_RCC_C2BLE_IS_CLK_ENABLED() LL_C2_APB3_GRP1_IsEnabledClock(LL_C2_APB3_GRP1_PERIPH_BLE)
  1451. #if defined(RCC_802_SUPPORT)
  1452. #define __HAL_RCC_C2802_IS_CLK_ENABLED() LL_C2_APB3_GRP1_IsEnabledClock(LL_C2_APB3_GRP1_PERIPH_802)
  1453. #endif
  1454. #define __HAL_RCC_C2BLE_IS_CLK_DISABLED() !(LL_C2_APB3_GRP1_IsEnabledClock(LL_C2_APB3_GRP1_PERIPH_BLE))
  1455. #if defined(RCC_802_SUPPORT)
  1456. #define __HAL_RCC_C2802_IS_CLK_DISABLED() !(LL_C2_APB3_GRP1_IsEnabledClock(LL_C2_APB3_GRP1_PERIPH_802))
  1457. #endif
  1458. /**
  1459. * @}
  1460. */
  1461. /** @defgroup RCC_AHB1_Force_Release_Reset AHB1 Peripheral Force Release Reset
  1462. * @brief Force or release AHB1 peripheral reset.
  1463. * @{
  1464. */
  1465. #define __HAL_RCC_AHB1_FORCE_RESET() LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_ALL)
  1466. #define __HAL_RCC_DMA1_FORCE_RESET() LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA1)
  1467. #if defined(DMA2)
  1468. #define __HAL_RCC_DMA2_FORCE_RESET() LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA2)
  1469. #endif
  1470. #define __HAL_RCC_DMAMUX1_FORCE_RESET() LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMAMUX1)
  1471. #define __HAL_RCC_CRC_FORCE_RESET() LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_CRC)
  1472. #if defined(TSC)
  1473. #define __HAL_RCC_TSC_FORCE_RESET() LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_TSC)
  1474. #endif
  1475. #define __HAL_RCC_AHB1_RELEASE_RESET() LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_ALL)
  1476. #define __HAL_RCC_DMA1_RELEASE_RESET() LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA1)
  1477. #if defined(DMA2)
  1478. #define __HAL_RCC_DMA2_RELEASE_RESET() LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA2)
  1479. #endif
  1480. #define __HAL_RCC_DMAMUX1_RELEASE_RESET() LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMAMUX1)
  1481. #define __HAL_RCC_CRC_RELEASE_RESET() LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_CRC)
  1482. #if defined(TSC)
  1483. #define __HAL_RCC_TSC_RELEASE_RESET() LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_TSC)
  1484. #endif
  1485. /**
  1486. * @}
  1487. */
  1488. /** @defgroup RCC_AHB2_Force_Release_Reset AHB2 Peripheral Force Release Reset
  1489. * @brief Force or release AHB2 peripheral reset.
  1490. * @{
  1491. */
  1492. #define __HAL_RCC_AHB2_FORCE_RESET() LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_ALL)
  1493. #define __HAL_RCC_GPIOA_FORCE_RESET() LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_GPIOA)
  1494. #define __HAL_RCC_GPIOB_FORCE_RESET() LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_GPIOB)
  1495. #define __HAL_RCC_GPIOC_FORCE_RESET() LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_GPIOC)
  1496. #if defined(GPIOD)
  1497. #define __HAL_RCC_GPIOD_FORCE_RESET() LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_GPIOD)
  1498. #endif
  1499. #define __HAL_RCC_GPIOE_FORCE_RESET() LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_GPIOE)
  1500. #define __HAL_RCC_GPIOH_FORCE_RESET() LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_GPIOH)
  1501. #if defined(ADC_SUPPORT_5_MSPS)
  1502. #define __HAL_RCC_ADC_FORCE_RESET() LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_ADC)
  1503. #endif
  1504. #if defined(AES1)
  1505. #define __HAL_RCC_AES1_FORCE_RESET() LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_AES1)
  1506. #endif
  1507. #define __HAL_RCC_AHB2_RELEASE_RESET() LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_ALL)
  1508. #define __HAL_RCC_GPIOA_RELEASE_RESET() LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_GPIOA)
  1509. #define __HAL_RCC_GPIOB_RELEASE_RESET() LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_GPIOB)
  1510. #define __HAL_RCC_GPIOC_RELEASE_RESET() LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_GPIOC)
  1511. #if defined(GPIOD)
  1512. #define __HAL_RCC_GPIOD_RELEASE_RESET() LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_GPIOD)
  1513. #endif
  1514. #define __HAL_RCC_GPIOE_RELEASE_RESET() LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_GPIOE)
  1515. #define __HAL_RCC_GPIOH_RELEASE_RESET() LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_GPIOH)
  1516. #if defined(ADC_SUPPORT_5_MSPS)
  1517. #define __HAL_RCC_ADC_RELEASE_RESET() LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_ADC)
  1518. #endif
  1519. #if defined(AES1)
  1520. #define __HAL_RCC_AES1_RELEASE_RESET() LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_AES1)
  1521. #endif
  1522. /**
  1523. * @}
  1524. */
  1525. /** @defgroup RCC_AHB3_Force_Release_Reset AHB3 Peripheral Force Release Reset
  1526. * @brief Force or release AHB3 peripheral reset.
  1527. * @{
  1528. */
  1529. #define __HAL_RCC_AHB3_FORCE_RESET() LL_AHB3_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_ALL)
  1530. #if defined(QUADSPI)
  1531. #define __HAL_RCC_QUADSPI_FORCE_RESET() LL_AHB3_GRP1_ForceReset(LL_AHB3_GRP1_PERIPH_QUADSPI)
  1532. #endif
  1533. #define __HAL_RCC_PKA_FORCE_RESET() LL_AHB3_GRP1_ForceReset(LL_AHB3_GRP1_PERIPH_PKA)
  1534. #define __HAL_RCC_AES2_FORCE_RESET() LL_AHB3_GRP1_ForceReset(LL_AHB3_GRP1_PERIPH_AES2)
  1535. #define __HAL_RCC_RNG_FORCE_RESET() LL_AHB3_GRP1_ForceReset(LL_AHB3_GRP1_PERIPH_RNG)
  1536. #define __HAL_RCC_HSEM_FORCE_RESET() LL_AHB3_GRP1_ForceReset(LL_AHB3_GRP1_PERIPH_HSEM)
  1537. #define __HAL_RCC_IPCC_FORCE_RESET() LL_AHB3_GRP1_ForceReset(LL_AHB3_GRP1_PERIPH_IPCC)
  1538. #define __HAL_RCC_FLASH_FORCE_RESET() LL_AHB3_GRP1_ForceReset(LL_AHB3_GRP1_PERIPH_FLASH)
  1539. #define __HAL_RCC_AHB3_RELEASE_RESET() LL_AHB3_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_ALL)
  1540. #if defined(QUADSPI)
  1541. #define __HAL_RCC_QUADSPI_RELEASE_RESET() LL_AHB3_GRP1_ReleaseReset(LL_AHB3_GRP1_PERIPH_QUADSPI)
  1542. #endif
  1543. #define __HAL_RCC_PKA_RELEASE_RESET() LL_AHB3_GRP1_ReleaseReset(LL_AHB3_GRP1_PERIPH_PKA)
  1544. #define __HAL_RCC_AES2_RELEASE_RESET() LL_AHB3_GRP1_ReleaseReset(LL_AHB3_GRP1_PERIPH_AES2)
  1545. #define __HAL_RCC_RNG_RELEASE_RESET() LL_AHB3_GRP1_ReleaseReset(LL_AHB3_GRP1_PERIPH_RNG)
  1546. #define __HAL_RCC_HSEM_RELEASE_RESET() LL_AHB3_GRP1_ReleaseReset(LL_AHB3_GRP1_PERIPH_HSEM)
  1547. #define __HAL_RCC_IPCC_RELEASE_RESET() LL_AHB3_GRP1_ReleaseReset(LL_AHB3_GRP1_PERIPH_IPCC)
  1548. #define __HAL_RCC_FLASH_RELEASE_RESET() LL_AHB3_GRP1_ReleaseReset(LL_AHB3_GRP1_PERIPH_FLASH)
  1549. /**
  1550. * @}
  1551. */
  1552. /** @defgroup RCC_APB1_Force_Release_Reset APB1 Peripheral Force Release Reset
  1553. * @brief Force or release APB1 peripheral reset.
  1554. * @{
  1555. */
  1556. #define __HAL_RCC_APB1L_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_ALL)
  1557. #define __HAL_RCC_TIM2_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM2)
  1558. #if defined(LCD)
  1559. #define __HAL_RCC_LCD_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_LCD)
  1560. #endif
  1561. #if defined(SPI2)
  1562. #define __HAL_RCC_SPI2_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_SPI2)
  1563. #endif
  1564. #define __HAL_RCC_I2C1_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_I2C1)
  1565. #if defined(I2C3)
  1566. #define __HAL_RCC_I2C3_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_I2C3)
  1567. #endif
  1568. #if defined(CRS)
  1569. #define __HAL_RCC_CRS_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_CRS)
  1570. #endif
  1571. #if defined(USB)
  1572. #define __HAL_RCC_USB_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USB)
  1573. #endif
  1574. #define __HAL_RCC_LPTIM1_FORCE_RESET() LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_LPTIM1)
  1575. #define __HAL_RCC_APB1H_FORCE_RESET() LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_ALL)
  1576. #if defined(LPUART1)
  1577. #define __HAL_RCC_LPUART1_FORCE_RESET() LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_LPUART1)
  1578. #endif
  1579. #define __HAL_RCC_LPTIM2_FORCE_RESET() LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_LPTIM2)
  1580. #define __HAL_RCC_APB1_FORCE_RESET() do { \
  1581. __HAL_RCC_APB1L_FORCE_RESET();\
  1582. __HAL_RCC_APB1H_FORCE_RESET();\
  1583. } while(0U)
  1584. #define __HAL_RCC_APB1L_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_ALL)
  1585. #define __HAL_RCC_TIM2_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM2)
  1586. #if defined(LCD)
  1587. #define __HAL_RCC_LCD_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_LCD)
  1588. #endif
  1589. #if defined(SPI2)
  1590. #define __HAL_RCC_SPI2_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_SPI2)
  1591. #endif
  1592. #define __HAL_RCC_I2C1_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C1)
  1593. #if defined(I2C3)
  1594. #define __HAL_RCC_I2C3_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C3)
  1595. #endif
  1596. #if defined(CRS)
  1597. #define __HAL_RCC_CRS_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_CRS)
  1598. #endif
  1599. #if defined(USB)
  1600. #define __HAL_RCC_USB_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USB)
  1601. #endif
  1602. #define __HAL_RCC_LPTIM1_RELEASE_RESET() LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_LPTIM1)
  1603. #define __HAL_RCC_APB1H_RELEASE_RESET() LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_ALL)
  1604. #if defined(LPUART1)
  1605. #define __HAL_RCC_LPUART1_RELEASE_RESET() LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_LPUART1)
  1606. #endif
  1607. #define __HAL_RCC_LPTIM2_RELEASE_RESET() LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_LPTIM2)
  1608. #define __HAL_RCC_APB1_RELEASE_RESET() do { \
  1609. __HAL_RCC_APB1L_RELEASE_RESET();\
  1610. __HAL_RCC_APB1H_RELEASE_RESET();\
  1611. } while(0U)
  1612. /**
  1613. * @}
  1614. */
  1615. /** @defgroup RCC_APB2_Force_Release_Reset APB2 Peripheral Force Release Reset
  1616. * @brief Force or release APB2 peripheral reset.
  1617. * @{
  1618. */
  1619. #define __HAL_RCC_APB2_FORCE_RESET() LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_ALL)
  1620. #if defined(ADC_SUPPORT_2_5_MSPS)
  1621. #define __HAL_RCC_ADC_FORCE_RESET() LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_ADC)
  1622. #endif
  1623. #define __HAL_RCC_TIM1_FORCE_RESET() LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM1)
  1624. #define __HAL_RCC_SPI1_FORCE_RESET() LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_SPI1)
  1625. #define __HAL_RCC_USART1_FORCE_RESET() LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_USART1)
  1626. #define __HAL_RCC_TIM16_FORCE_RESET() LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM16)
  1627. #define __HAL_RCC_TIM17_FORCE_RESET() LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_TIM17)
  1628. #if defined(SAI1)
  1629. #define __HAL_RCC_SAI1_FORCE_RESET() LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_SAI1)
  1630. #endif
  1631. #define __HAL_RCC_APB2_RELEASE_RESET() LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_ALL)
  1632. #if defined(ADC_SUPPORT_2_5_MSPS)
  1633. #define __HAL_RCC_ADC_RELEASE_RESET() LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_ADC)
  1634. #endif
  1635. #define __HAL_RCC_TIM1_RELEASE_RESET() LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM1)
  1636. #define __HAL_RCC_SPI1_RELEASE_RESET() LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_SPI1)
  1637. #define __HAL_RCC_USART1_RELEASE_RESET() LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_USART1)
  1638. #define __HAL_RCC_TIM16_RELEASE_RESET() LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM16)
  1639. #define __HAL_RCC_TIM17_RELEASE_RESET() LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_TIM17)
  1640. #if defined(SAI1)
  1641. #define __HAL_RCC_SAI1_RELEASE_RESET() LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_SAI1)
  1642. #endif
  1643. /**
  1644. * @}
  1645. */
  1646. /** @defgroup RCC_APB3_Force_Release_Reset APB3 Peripheral Force Release Reset
  1647. * @brief Force or release APB3 peripheral reset.
  1648. * @{
  1649. */
  1650. #define __HAL_RCC_APB3_FORCE_RESET() LL_APB3_GRP1_ForceReset(LL_APB3_GRP1_PERIPH_ALL)
  1651. #define __HAL_RCC_RF_FORCE_RESET() LL_APB3_GRP1_ForceReset(LL_APB3_GRP1_PERIPH_RF)
  1652. #define __HAL_RCC_APB3_RELEASE_RESET() LL_APB3_GRP1_ReleaseReset(LL_APB3_GRP1_PERIPH_ALL)
  1653. #define __HAL_RCC_RF_RELEASE_RESET() LL_APB3_GRP1_ReleaseReset(LL_APB3_GRP1_PERIPH_RF)
  1654. /**
  1655. * @}
  1656. */
  1657. /** @defgroup RCC_AHB1_Clock_Sleep_Enable_Disable AHB1 Peripheral Clock Sleep Enable Disable
  1658. * @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  1659. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1660. * power consumption.
  1661. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1662. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1663. * @{
  1664. */
  1665. #define __HAL_RCC_DMA1_CLK_SLEEP_ENABLE() LL_AHB1_GRP1_EnableClockSleep(LL_AHB1_GRP1_PERIPH_DMA1)
  1666. #if defined(DMA2)
  1667. #define __HAL_RCC_DMA2_CLK_SLEEP_ENABLE() LL_AHB1_GRP1_EnableClockSleep(LL_AHB1_GRP1_PERIPH_DMA2)
  1668. #endif
  1669. #define __HAL_RCC_DMAMUX1_CLK_SLEEP_ENABLE() LL_AHB1_GRP1_EnableClockSleep(LL_AHB1_GRP1_PERIPH_DMAMUX1)
  1670. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() LL_AHB1_GRP1_EnableClockSleep(LL_AHB1_GRP1_PERIPH_SRAM1)
  1671. #define __HAL_RCC_CRC_CLK_SLEEP_ENABLE() LL_AHB1_GRP1_EnableClockSleep(LL_AHB1_GRP1_PERIPH_CRC)
  1672. #if defined(TSC)
  1673. #define __HAL_RCC_TSC_CLK_SLEEP_ENABLE() LL_AHB1_GRP1_EnableClockSleep(LL_AHB1_GRP1_PERIPH_TSC)
  1674. #endif
  1675. #define __HAL_RCC_DMA1_CLK_SLEEP_DISABLE() LL_AHB1_GRP1_DisableClockSleep(LL_AHB1_GRP1_PERIPH_DMA1)
  1676. #if defined(DMA2)
  1677. #define __HAL_RCC_DMA2_CLK_SLEEP_DISABLE() LL_AHB1_GRP1_DisableClockSleep(LL_AHB1_GRP1_PERIPH_DMA2)
  1678. #endif
  1679. #define __HAL_RCC_DMAMUX1_CLK_SLEEP_DISABLE() LL_AHB1_GRP1_DisableClockSleep(LL_AHB1_GRP1_PERIPH_DMAMUX1)
  1680. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() LL_AHB1_GRP1_DisableClockSleep(LL_AHB1_GRP1_PERIPH_SRAM1)
  1681. #define __HAL_RCC_CRC_CLK_SLEEP_DISABLE() LL_AHB1_GRP1_DisableClockSleep(LL_AHB1_GRP1_PERIPH_CRC)
  1682. #if defined(TSC)
  1683. #define __HAL_RCC_TSC_CLK_SLEEP_DISABLE() LL_AHB1_GRP1_DisableClockSleep(LL_AHB1_GRP1_PERIPH_TSC)
  1684. #endif
  1685. #define __HAL_RCC_C2DMA1_CLK_SLEEP_ENABLE() LL_C2_AHB1_GRP1_EnableClockSleep(LL_C2_AHB1_GRP1_PERIPH_DMA1)
  1686. #if defined(DMA2)
  1687. #define __HAL_RCC_C2DMA2_CLK_SLEEP_ENABLE() LL_C2_AHB1_GRP1_EnableClockSleep(LL_C2_AHB1_GRP1_PERIPH_DMA2)
  1688. #endif
  1689. #define __HAL_RCC_C2DMAMUX1_CLK_SLEEP_ENABLE() LL_C2_AHB1_GRP1_EnableClockSleep(LL_C2_AHB1_GRP1_PERIPH_DMAMUX1)
  1690. #define __HAL_RCC_C2SRAM1_CLK_SLEEP_ENABLE() LL_C2_AHB1_GRP1_EnableClockSleep(LL_C2_AHB1_GRP1_PERIPH_SRAM1)
  1691. #define __HAL_RCC_C2CRC_CLK_SLEEP_ENABLE() LL_C2_AHB1_GRP1_EnableClockSleep(LL_C2_AHB1_GRP1_PERIPH_CRC)
  1692. #if defined(TSC)
  1693. #define __HAL_RCC_C2TSC_CLK_SLEEP_ENABLE() LL_C2_AHB1_GRP1_EnableClockSleep(LL_C2_AHB1_GRP1_PERIPH_TSC)
  1694. #endif
  1695. #define __HAL_RCC_C2DMA1_CLK_SLEEP_DISABLE() LL_C2_AHB1_GRP1_DisableClockSleep(LL_C2_AHB1_GRP1_PERIPH_DMA1)
  1696. #if defined(DMA2)
  1697. #define __HAL_RCC_C2DMA2_CLK_SLEEP_DISABLE() LL_C2_AHB1_GRP1_DisableClockSleep(LL_C2_AHB1_GRP1_PERIPH_DMA2)
  1698. #endif
  1699. #define __HAL_RCC_C2DMAMUX1_CLK_SLEEP_DISABLE() LL_C2_AHB1_GRP1_DisableClockSleep(LL_C2_AHB1_GRP1_PERIPH_DMAMUX1)
  1700. #define __HAL_RCC_C2SRAM1_CLK_SLEEP_DISABLE() LL_C2_AHB1_GRP1_DisableClockSleep(LL_C2_AHB1_GRP1_PERIPH_SRAM1)
  1701. #define __HAL_RCC_C2CRC_CLK_SLEEP_DISABLE() LL_C2_AHB1_GRP1_DisableClockSleep(LL_C2_AHB1_GRP1_PERIPH_CRC)
  1702. #if defined(TSC)
  1703. #define __HAL_RCC_C2TSC_CLK_SLEEP_DISABLE() LL_C2_AHB1_GRP1_DisableClockSleep(LL_C2_AHB1_GRP1_PERIPH_TSC)
  1704. #endif
  1705. /**
  1706. * @}
  1707. */
  1708. /** @defgroup RCC_AHB2_Clock_Sleep_Enable_Disable AHB2 Peripheral Clock Sleep Enable Disable
  1709. * @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  1710. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1711. * power consumption.
  1712. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1713. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1714. * @{
  1715. */
  1716. #define __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE() LL_AHB2_GRP1_EnableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOA)
  1717. #define __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE() LL_AHB2_GRP1_EnableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOB)
  1718. #define __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE() LL_AHB2_GRP1_EnableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOC)
  1719. #if defined(GPIOD)
  1720. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() LL_AHB2_GRP1_EnableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOD)
  1721. #endif
  1722. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() LL_AHB2_GRP1_EnableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOE)
  1723. #define __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE() LL_AHB2_GRP1_EnableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOH)
  1724. #if defined(ADC_SUPPORT_5_MSPS)
  1725. #define __HAL_RCC_ADC_CLK_SLEEP_ENABLE() LL_AHB2_GRP1_EnableClockSleep(LL_AHB2_GRP1_PERIPH_ADC)
  1726. #endif
  1727. #if defined(AES1)
  1728. #define __HAL_RCC_AES1_CLK_SLEEP_ENABLE() LL_AHB2_GRP1_EnableClockSleep(LL_AHB2_GRP1_PERIPH_AES1)
  1729. #endif
  1730. #define __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE() LL_AHB2_GRP1_DisableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOA)
  1731. #define __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE() LL_AHB2_GRP1_DisableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOB)
  1732. #define __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE() LL_AHB2_GRP1_DisableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOC)
  1733. #if defined(GPIOD)
  1734. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() LL_AHB2_GRP1_DisableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOD)
  1735. #endif
  1736. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() LL_AHB2_GRP1_DisableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOE)
  1737. #define __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE() LL_AHB2_GRP1_DisableClockSleep(LL_AHB2_GRP1_PERIPH_GPIOH)
  1738. #if defined(ADC_SUPPORT_5_MSPS)
  1739. #define __HAL_RCC_ADC_CLK_SLEEP_DISABLE() LL_AHB2_GRP1_DisableClockSleep(LL_AHB2_GRP1_PERIPH_ADC)
  1740. #endif
  1741. #if defined(AES1)
  1742. #define __HAL_RCC_AES1_CLK_SLEEP_DISABLE() LL_AHB2_GRP1_DisableClockSleep(LL_AHB2_GRP1_PERIPH_AES1)
  1743. #endif
  1744. #define __HAL_RCC_C2GPIOA_CLK_SLEEP_ENABLE() LL_C2_AHB2_GRP1_EnableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOA)
  1745. #define __HAL_RCC_C2GPIOB_CLK_SLEEP_ENABLE() LL_C2_AHB2_GRP1_EnableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOB)
  1746. #define __HAL_RCC_C2GPIOC_CLK_SLEEP_ENABLE() LL_C2_AHB2_GRP1_EnableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOC)
  1747. #if defined(GPIOD)
  1748. #define __HAL_RCC_C2GPIOD_CLK_SLEEP_ENABLE() LL_C2_AHB2_GRP1_EnableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOD)
  1749. #endif
  1750. #define __HAL_RCC_C2GPIOE_CLK_SLEEP_ENABLE() LL_C2_AHB2_GRP1_EnableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOE)
  1751. #define __HAL_RCC_C2GPIOH_CLK_SLEEP_ENABLE() LL_C2_AHB2_GRP1_EnableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOH)
  1752. #if defined(ADC_SUPPORT_5_MSPS)
  1753. #define __HAL_RCC_C2ADC_CLK_SLEEP_ENABLE() LL_C2_AHB2_GRP1_EnableClockSleep(LL_C2_AHB2_GRP1_PERIPH_ADC)
  1754. #endif
  1755. #if defined(AES1)
  1756. #define __HAL_RCC_C2AES1_CLK_SLEEP_ENABLE() LL_C2_AHB2_GRP1_EnableClockSleep(LL_C2_AHB2_GRP1_PERIPH_AES1)
  1757. #endif
  1758. #define __HAL_RCC_C2GPIOA_CLK_SLEEP_DISABLE() LL_C2_AHB2_GRP1_DisableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOA)
  1759. #define __HAL_RCC_C2GPIOB_CLK_SLEEP_DISABLE() LL_C2_AHB2_GRP1_DisableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOB)
  1760. #define __HAL_RCC_C2GPIOC_CLK_SLEEP_DISABLE() LL_C2_AHB2_GRP1_DisableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOC)
  1761. #if defined(GPIOD)
  1762. #define __HAL_RCC_C2GPIOD_CLK_SLEEP_DISABLE() LL_C2_AHB2_GRP1_DisableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOD)
  1763. #endif
  1764. #define __HAL_RCC_C2GPIOE_CLK_SLEEP_DISABLE() LL_C2_AHB2_GRP1_DisableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOE)
  1765. #define __HAL_RCC_C2GPIOH_CLK_SLEEP_DISABLE() LL_C2_AHB2_GRP1_DisableClockSleep(LL_C2_AHB2_GRP1_PERIPH_GPIOH)
  1766. #if defined(ADC_SUPPORT_5_MSPS)
  1767. #define __HAL_RCC_C2ADC_CLK_SLEEP_DISABLE() LL_C2_AHB2_GRP1_DisableClockSleep(LL_C2_AHB2_GRP1_PERIPH_ADC)
  1768. #endif
  1769. #if defined(AES1)
  1770. #define __HAL_RCC_C2AES1_CLK_SLEEP_DISABLE() LL_C2_AHB2_GRP1_DisableClockSleep(LL_C2_AHB2_GRP1_PERIPH_AES1)
  1771. #endif
  1772. /**
  1773. * @}
  1774. */
  1775. /** @defgroup RCC_AHB3_Clock_Sleep_Enable_Disable AHB3 Peripheral Clock Sleep Enable Disable
  1776. * @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  1777. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1778. * power consumption.
  1779. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1780. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1781. * @{
  1782. */
  1783. #if defined(QUADSPI)
  1784. #define __HAL_RCC_QUADSPI_CLK_SLEEP_ENABLE() LL_AHB3_GRP1_EnableClockSleep(LL_AHB3_GRP1_PERIPH_QUADSPI)
  1785. #endif
  1786. #define __HAL_RCC_PKA_CLK_SLEEP_ENABLE() LL_AHB3_GRP1_EnableClockSleep(LL_AHB3_GRP1_PERIPH_PKA)
  1787. #define __HAL_RCC_AES2_CLK_SLEEP_ENABLE() LL_AHB3_GRP1_EnableClockSleep(LL_AHB3_GRP1_PERIPH_AES2)
  1788. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() LL_AHB3_GRP1_EnableClockSleep(LL_AHB3_GRP1_PERIPH_RNG)
  1789. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() LL_AHB3_GRP1_EnableClockSleep(LL_AHB3_GRP1_PERIPH_SRAM2)
  1790. #define __HAL_RCC_FLASH_CLK_SLEEP_ENABLE() LL_AHB3_GRP1_EnableClockSleep(LL_AHB3_GRP1_PERIPH_FLASH)
  1791. #if defined(QUADSPI)
  1792. #define __HAL_RCC_QUADSPI_CLK_SLEEP_DISABLE() LL_AHB3_GRP1_DisableClockSleep(LL_AHB3_GRP1_PERIPH_QUADSPI)
  1793. #endif
  1794. #define __HAL_RCC_PKA_CLK_SLEEP_DISABLE() LL_AHB3_GRP1_DisableClockSleep(LL_AHB3_GRP1_PERIPH_PKA)
  1795. #define __HAL_RCC_AES2_CLK_SLEEP_DISABLE() LL_AHB3_GRP1_DisableClockSleep(LL_AHB3_GRP1_PERIPH_AES2)
  1796. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() LL_AHB3_GRP1_DisableClockSleep(LL_AHB3_GRP1_PERIPH_RNG)
  1797. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() LL_AHB3_GRP1_DisableClockSleep(LL_AHB3_GRP1_PERIPH_SRAM2)
  1798. #define __HAL_RCC_FLASH_CLK_SLEEP_DISABLE() LL_AHB3_GRP1_DisableClockSleep(LL_AHB3_GRP1_PERIPH_FLASH)
  1799. #define __HAL_RCC_C2PKA_CLK_SLEEP_ENABLE() LL_C2_AHB3_GRP1_EnableClockSleep(LL_C2_AHB3_GRP1_PERIPH_PKA)
  1800. #define __HAL_RCC_C2AES2_CLK_SLEEP_ENABLE() LL_C2_AHB3_GRP1_EnableClockSleep(LL_C2_AHB3_GRP1_PERIPH_AES2)
  1801. #define __HAL_RCC_C2RNG_CLK_SLEEP_ENABLE() LL_C2_AHB3_GRP1_EnableClockSleep(LL_C2_AHB3_GRP1_PERIPH_RNG)
  1802. #define __HAL_RCC_C2SRAM2_CLK_SLEEP_ENABLE() LL_C2_AHB3_GRP1_EnableClockSleep(LL_C2_AHB3_GRP1_PERIPH_SRAM2)
  1803. #define __HAL_RCC_C2FLASH_CLK_SLEEP_ENABLE() LL_C2_AHB3_GRP1_EnableClockSleep(LL_C2_AHB3_GRP1_PERIPH_FLASH)
  1804. #define __HAL_RCC_C2PKA_CLK_SLEEP_DISABLE() LL_C2_AHB3_GRP1_DisableClockSleep(LL_C2_AHB3_GRP1_PERIPH_PKA)
  1805. #define __HAL_RCC_C2AES2_CLK_SLEEP_DISABLE() LL_C2_AHB3_GRP1_DisableClockSleep(LL_C2_AHB3_GRP1_PERIPH_AES2)
  1806. #define __HAL_RCC_C2RNG_CLK_SLEEP_DISABLE() LL_C2_AHB3_GRP1_DisableClockSleep(LL_C2_AHB3_GRP1_PERIPH_RNG)
  1807. #define __HAL_RCC_C2SRAM2_CLK_SLEEP_DISABLE() LL_C2_AHB3_GRP1_DisableClockSleep(LL_C2_AHB3_GRP1_PERIPH_SRAM2)
  1808. #define __HAL_RCC_C2FLASH_CLK_SLEEP_DISABLE() LL_C2_AHB3_GRP1_DisableClockSleep(LL_C2_AHB3_GRP1_PERIPH_FLASH)
  1809. /**
  1810. * @}
  1811. */
  1812. /** @defgroup RCC_APB1_Clock_Sleep_Enable_Disable APB1 Peripheral Clock Sleep Enable Disable
  1813. * @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  1814. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1815. * power consumption.
  1816. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1817. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1818. * @{
  1819. */
  1820. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_TIM2)
  1821. #if defined(LCD)
  1822. #define __HAL_RCC_LCD_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_LCD)
  1823. #endif
  1824. #define __HAL_RCC_RTCAPB_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_RTCAPB)
  1825. #define __HAL_RCC_WWDG_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_WWDG)
  1826. #if defined(SPI2)
  1827. #define __HAL_RCC_SPI2_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_SPI2)
  1828. #endif
  1829. #define __HAL_RCC_I2C1_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_I2C1)
  1830. #if defined(I2C3)
  1831. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_I2C3)
  1832. #endif
  1833. #if defined(CRS)
  1834. #define __HAL_RCC_CRS_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_CRS)
  1835. #endif
  1836. #if defined(USB)
  1837. #define __HAL_RCC_USB_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_USB)
  1838. #endif
  1839. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() LL_APB1_GRP1_EnableClockSleep(LL_APB1_GRP1_PERIPH_LPTIM1)
  1840. #if defined(LPUART1)
  1841. #define __HAL_RCC_LPUART1_CLK_SLEEP_ENABLE() LL_APB1_GRP2_EnableClockSleep(LL_APB1_GRP2_PERIPH_LPUART1)
  1842. #endif
  1843. #define __HAL_RCC_LPTIM2_CLK_SLEEP_ENABLE() LL_APB1_GRP2_EnableClockSleep(LL_APB1_GRP2_PERIPH_LPTIM2)
  1844. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_TIM2)
  1845. #if defined(LCD)
  1846. #define __HAL_RCC_LCD_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_LCD)
  1847. #endif
  1848. #define __HAL_RCC_RTCAPB_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_RTCAPB)
  1849. #define __HAL_RCC_WWDG_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_WWDG)
  1850. #if defined(SPI2)
  1851. #define __HAL_RCC_SPI2_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_SPI2)
  1852. #endif
  1853. #define __HAL_RCC_I2C1_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_I2C1)
  1854. #if defined(I2C3)
  1855. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_I2C3)
  1856. #endif
  1857. #if defined(CRS)
  1858. #define __HAL_RCC_CRS_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_CRS)
  1859. #endif
  1860. #if defined(USB)
  1861. #define __HAL_RCC_USB_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_USB)
  1862. #endif
  1863. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() LL_APB1_GRP1_DisableClockSleep(LL_APB1_GRP1_PERIPH_LPTIM1)
  1864. #if defined(LPUART1)
  1865. #define __HAL_RCC_LPUART1_CLK_SLEEP_DISABLE() LL_APB1_GRP2_DisableClockSleep(LL_APB1_GRP2_PERIPH_LPUART1)
  1866. #endif
  1867. #define __HAL_RCC_LPTIM2_CLK_SLEEP_DISABLE() LL_APB1_GRP2_DisableClockSleep(LL_APB1_GRP2_PERIPH_LPTIM2)
  1868. #define __HAL_RCC_C2TIM2_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP1_EnableClockSleep(LL_C2_APB1_GRP1_PERIPH_TIM2)
  1869. #if defined(LCD)
  1870. #define __HAL_RCC_C2LCD_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP1_EnableClockSleep(LL_C2_APB1_GRP1_PERIPH_LCD)
  1871. #endif
  1872. #define __HAL_RCC_C2RTCAPB_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP1_EnableClockSleep(LL_C2_APB1_GRP1_PERIPH_RTCAPB)
  1873. #if defined(SPI2)
  1874. #define __HAL_RCC_C2SPI2_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP1_EnableClockSleep(LL_C2_APB1_GRP1_PERIPH_SPI2)
  1875. #endif
  1876. #define __HAL_RCC_C2I2C1_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP1_EnableClockSleep(LL_C2_APB1_GRP1_PERIPH_I2C1)
  1877. #if defined(I2C3)
  1878. #define __HAL_RCC_C2I2C3_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP1_EnableClockSleep(LL_C2_APB1_GRP1_PERIPH_I2C3)
  1879. #endif
  1880. #if defined(CRS)
  1881. #define __HAL_RCC_C2CRS_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP1_EnableClockSleep(LL_C2_APB1_GRP1_PERIPH_CRS)
  1882. #endif
  1883. #if defined(USB)
  1884. #define __HAL_RCC_C2USB_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP1_EnableClockSleep(LL_C2_APB1_GRP1_PERIPH_USB)
  1885. #endif
  1886. #define __HAL_RCC_C2LPTIM1_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP1_EnableClockSleep(LL_C2_APB1_GRP1_PERIPH_LPTIM1)
  1887. #if defined(LPUART1)
  1888. #define __HAL_RCC_C2LPUART1_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP2_EnableClockSleep(LL_C2_APB1_GRP2_PERIPH_LPUART1)
  1889. #endif
  1890. #define __HAL_RCC_C2LPTIM2_CLK_SLEEP_ENABLE() LL_C2_APB1_GRP2_EnableClockSleep(LL_C2_APB1_GRP2_PERIPH_LPTIM2)
  1891. #define __HAL_RCC_C2TIM2_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP1_DisableClockSleep(LL_C2_APB1_GRP1_PERIPH_TIM2)
  1892. #if defined(LCD)
  1893. #define __HAL_RCC_C2LCD_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP1_DisableClockSleep(LL_C2_APB1_GRP1_PERIPH_LCD)
  1894. #endif
  1895. #define __HAL_RCC_C2RTCAPB_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP1_DisableClockSleep(LL_C2_APB1_GRP1_PERIPH_RTCAPB)
  1896. #if defined(SPI2)
  1897. #define __HAL_RCC_C2SPI2_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP1_DisableClockSleep(LL_C2_APB1_GRP1_PERIPH_SPI2)
  1898. #endif
  1899. #define __HAL_RCC_C2I2C1_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP1_DisableClockSleep(LL_C2_APB1_GRP1_PERIPH_I2C1)
  1900. #if defined(I2C3)
  1901. #define __HAL_RCC_C2I2C3_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP1_DisableClockSleep(LL_C2_APB1_GRP1_PERIPH_I2C3)
  1902. #endif
  1903. #if defined(CRS)
  1904. #define __HAL_RCC_C2CRS_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP1_DisableClockSleep(LL_C2_APB1_GRP1_PERIPH_CRS)
  1905. #endif
  1906. #if defined(USB)
  1907. #define __HAL_RCC_C2USB_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP1_DisableClockSleep(LL_C2_APB1_GRP1_PERIPH_USB)
  1908. #endif
  1909. #define __HAL_RCC_C2LPTIM1_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP1_DisableClockSleep(LL_C2_APB1_GRP1_PERIPH_LPTIM1)
  1910. #if defined(LPUART1)
  1911. #define __HAL_RCC_C2LPUART1_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP2_DisableClockSleep(LL_C2_APB1_GRP2_PERIPH_LPUART1)
  1912. #endif
  1913. #define __HAL_RCC_C2LPTIM2_CLK_SLEEP_DISABLE() LL_C2_APB1_GRP2_DisableClockSleep(LL_C2_APB1_GRP2_PERIPH_LPTIM2)
  1914. /**
  1915. * @}
  1916. */
  1917. /** @defgroup RCC_APB2_Clock_Sleep_Enable_Disable APB2 Peripheral Clock Sleep Enable Disable
  1918. * @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  1919. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1920. * power consumption.
  1921. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1922. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1923. * @{
  1924. */
  1925. #if defined(ADC_SUPPORT_2_5_MSPS)
  1926. #define __HAL_RCC_ADC_CLK_SLEEP_ENABLE() LL_APB2_GRP1_EnableClockSleep(LL_APB2_GRP1_PERIPH_ADC)
  1927. #endif
  1928. #define __HAL_RCC_TIM1_CLK_SLEEP_ENABLE() LL_APB2_GRP1_EnableClockSleep(LL_APB2_GRP1_PERIPH_TIM1)
  1929. #define __HAL_RCC_SPI1_CLK_SLEEP_ENABLE() LL_APB2_GRP1_EnableClockSleep(LL_APB2_GRP1_PERIPH_SPI1)
  1930. #define __HAL_RCC_USART1_CLK_SLEEP_ENABLE() LL_APB2_GRP1_EnableClockSleep(LL_APB2_GRP1_PERIPH_USART1)
  1931. #define __HAL_RCC_TIM16_CLK_SLEEP_ENABLE() LL_APB2_GRP1_EnableClockSleep(LL_APB2_GRP1_PERIPH_TIM16)
  1932. #define __HAL_RCC_TIM17_CLK_SLEEP_ENABLE() LL_APB2_GRP1_EnableClockSleep(LL_APB2_GRP1_PERIPH_TIM17)
  1933. #if defined(SAI1)
  1934. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() LL_APB2_GRP1_EnableClockSleep(LL_APB2_GRP1_PERIPH_SAI1)
  1935. #endif
  1936. #if defined(ADC_SUPPORT_2_5_MSPS)
  1937. #define __HAL_RCC_ADC_CLK_SLEEP_DISABLE() LL_APB2_GRP1_DisableClockSleep(LL_APB2_GRP1_PERIPH_ADC)
  1938. #endif
  1939. #define __HAL_RCC_TIM1_CLK_SLEEP_DISABLE() LL_APB2_GRP1_DisableClockSleep(LL_APB2_GRP1_PERIPH_TIM1)
  1940. #define __HAL_RCC_SPI1_CLK_SLEEP_DISABLE() LL_APB2_GRP1_DisableClockSleep(LL_APB2_GRP1_PERIPH_SPI1)
  1941. #define __HAL_RCC_USART1_CLK_SLEEP_DISABLE() LL_APB2_GRP1_DisableClockSleep(LL_APB2_GRP1_PERIPH_USART1)
  1942. #define __HAL_RCC_TIM16_CLK_SLEEP_DISABLE() LL_APB2_GRP1_DisableClockSleep(LL_APB2_GRP1_PERIPH_TIM16)
  1943. #define __HAL_RCC_TIM17_CLK_SLEEP_DISABLE() LL_APB2_GRP1_DisableClockSleep(LL_APB2_GRP1_PERIPH_TIM17)
  1944. #if defined(SAI1)
  1945. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() LL_APB2_GRP1_DisableClockSleep(LL_APB2_GRP1_PERIPH_SAI1)
  1946. #endif
  1947. #if defined(ADC_SUPPORT_2_5_MSPS)
  1948. #define __HAL_RCC_C2ADC_CLK_SLEEP_ENABLE() LL_C2_APB2_GRP1_EnableClockSleep(LL_C2_APB2_GRP1_PERIPH_ADC)
  1949. #endif
  1950. #define __HAL_RCC_C2TIM1_CLK_SLEEP_ENABLE() LL_C2_APB2_GRP1_EnableClockSleep(LL_C2_APB2_GRP1_PERIPH_TIM1)
  1951. #define __HAL_RCC_C2SPI1_CLK_SLEEP_ENABLE() LL_C2_APB2_GRP1_EnableClockSleep(LL_C2_APB2_GRP1_PERIPH_SPI1)
  1952. #define __HAL_RCC_C2USART1_CLK_SLEEP_ENABLE() LL_C2_APB2_GRP1_EnableClockSleep(LL_C2_APB2_GRP1_PERIPH_USART1)
  1953. #define __HAL_RCC_C2TIM16_CLK_SLEEP_ENABLE() LL_C2_APB2_GRP1_EnableClockSleep(LL_C2_APB2_GRP1_PERIPH_TIM16)
  1954. #define __HAL_RCC_C2TIM17_CLK_SLEEP_ENABLE() LL_C2_APB2_GRP1_EnableClockSleep(LL_C2_APB2_GRP1_PERIPH_TIM17)
  1955. #if defined(SAI1)
  1956. #define __HAL_RCC_C2SAI1_CLK_SLEEP_ENABLE() LL_C2_APB2_GRP1_EnableClockSleep(LL_C2_APB2_GRP1_PERIPH_SAI1)
  1957. #endif
  1958. #if defined(ADC_SUPPORT_2_5_MSPS)
  1959. #define __HAL_RCC_C2ADC_CLK_SLEEP_DISABLE() LL_C2_APB2_GRP1_DisableClockSleep(LL_C2_APB2_GRP1_PERIPH_ADC)
  1960. #endif
  1961. #define __HAL_RCC_C2TIM1_CLK_SLEEP_DISABLE() LL_C2_APB2_GRP1_DisableClockSleep(LL_C2_APB2_GRP1_PERIPH_TIM1)
  1962. #define __HAL_RCC_C2SPI1_CLK_SLEEP_DISABLE() LL_C2_APB2_GRP1_DisableClockSleep(LL_C2_APB2_GRP1_PERIPH_SPI1)
  1963. #define __HAL_RCC_C2USART1_CLK_SLEEP_DISABLE() LL_C2_APB2_GRP1_DisableClockSleep(LL_C2_APB2_GRP1_PERIPH_USART1)
  1964. #define __HAL_RCC_C2TIM16_CLK_SLEEP_DISABLE() LL_C2_APB2_GRP1_DisableClockSleep(LL_C2_APB2_GRP1_PERIPH_TIM16)
  1965. #define __HAL_RCC_C2TIM17_CLK_SLEEP_DISABLE() LL_C2_APB2_GRP1_DisableClockSleep(LL_C2_APB2_GRP1_PERIPH_TIM17)
  1966. #if defined(SAI1)
  1967. #define __HAL_RCC_C2SAI1_CLK_SLEEP_DISABLE() LL_C2_APB2_GRP1_DisableClockSleep(LL_C2_APB2_GRP1_PERIPH_SAI1)
  1968. #endif
  1969. /**
  1970. * @}
  1971. */
  1972. /** @defgroup RCC_AHB1_Clock_Sleep_Enable_Disable_Status AHB1 Peripheral Clock Sleep Enabled or Disabled Status
  1973. * @brief Check whether the AHB1 peripheral clock during Low Power (Sleep) mode is enabled or not.
  1974. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1975. * power consumption.
  1976. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1977. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1978. * @{
  1979. */
  1980. #define __HAL_RCC_DMA1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN) != RESET)
  1981. #if defined(DMA2)
  1982. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN) != RESET)
  1983. #endif
  1984. #define __HAL_RCC_DMAMUX1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMAMUX1SMEN) != RESET)
  1985. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN) != RESET)
  1986. #define __HAL_RCC_CRC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN) != RESET)
  1987. #if defined(TSC)
  1988. #define __HAL_RCC_TSC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN) != RESET)
  1989. #endif
  1990. #define __HAL_RCC_DMA1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA1SMEN) == RESET)
  1991. #if defined(DMA2)
  1992. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMA2SMEN) == RESET)
  1993. #endif
  1994. #define __HAL_RCC_DMAMUX1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_DMAMUX1SMEN) == RESET)
  1995. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_SRAM1SMEN) == RESET)
  1996. #define __HAL_RCC_CRC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_CRCSMEN) == RESET)
  1997. #if defined(TSC)
  1998. #define __HAL_RCC_TSC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB1SMENR, RCC_AHB1SMENR_TSCSMEN) == RESET)
  1999. #endif
  2000. #define __HAL_RCC_C2DMA1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_DMA1SMEN) != RESET)
  2001. #if defined(DMA2)
  2002. #define __HAL_RCC_C2DMA2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_DMA2SMEN) != RESET)
  2003. #endif
  2004. #define __HAL_RCC_C2DMAMUX1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_DMAMUX1SMEN) != RESET)
  2005. #define __HAL_RCC_C2SRAM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_SRAM1SMEN) != RESET)
  2006. #define __HAL_RCC_C2CRC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_CRCSMEN) != RESET)
  2007. #if defined(TSC)
  2008. #define __HAL_RCC_C2TSC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_TSCSMEN) != RESET)
  2009. #endif
  2010. #define __HAL_RCC_C2DMA1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_DMA1SMEN) == RESET)
  2011. #if defined(DMA2)
  2012. #define __HAL_RCC_C2DMA2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_DMA2SMEN) == RESET)
  2013. #endif
  2014. #define __HAL_RCC_C2DMAMUX1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_DMAMUX1SMEN) == RESET)
  2015. #define __HAL_RCC_C2SRAM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_SRAM1SMEN) == RESET)
  2016. #define __HAL_RCC_C2CRC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_CRCSMEN) == RESET)
  2017. #if defined(TSC)
  2018. #define __HAL_RCC_C2TSC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB1SMENR, RCC_C2AHB1SMENR_TSCSMEN) == RESET)
  2019. #endif
  2020. /**
  2021. * @}
  2022. */
  2023. /** @defgroup RCC_AHB2_Clock_Sleep_Enable_Disable_Status AHB2 Peripheral Clock Sleep Enabled or Disabled Status
  2024. * @brief Check whether the AHB2 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2025. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2026. * power consumption.
  2027. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2028. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2029. * @{
  2030. */
  2031. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN) != RESET)
  2032. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN) != RESET)
  2033. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN) != RESET)
  2034. #if defined(GPIOD)
  2035. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN) != RESET)
  2036. #endif
  2037. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN) != RESET)
  2038. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN) != RESET)
  2039. #if defined(ADC_SUPPORT_5_MSPS)
  2040. #define __HAL_RCC_ADC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN) != RESET)
  2041. #endif
  2042. #if defined(AES1)
  2043. #define __HAL_RCC_AES1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AES1SMEN) != RESET)
  2044. #endif
  2045. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOASMEN) == RESET)
  2046. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOBSMEN) == RESET)
  2047. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOCSMEN) == RESET)
  2048. #if defined(GPIOD)
  2049. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIODSMEN) == RESET)
  2050. #endif
  2051. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOESMEN) == RESET)
  2052. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_GPIOHSMEN) == RESET)
  2053. #if defined(ADC_SUPPORT_5_MSPS)
  2054. #define __HAL_RCC_ADC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_ADCSMEN) == RESET)
  2055. #endif
  2056. #if defined(AES1)
  2057. #define __HAL_RCC_AES1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB2SMENR, RCC_AHB2SMENR_AES1SMEN) == RESET)
  2058. #endif
  2059. #define __HAL_RCC_C2GPIOA_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOASMEN) != RESET)
  2060. #define __HAL_RCC_C2GPIOB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOBSMEN) != RESET)
  2061. #define __HAL_RCC_C2GPIOC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOCSMEN) != RESET)
  2062. #if defined(GPIOD)
  2063. #define __HAL_RCC_C2GPIOD_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIODSMEN) != RESET)
  2064. #endif
  2065. #define __HAL_RCC_C2GPIOE_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOESMEN) != RESET)
  2066. #define __HAL_RCC_C2GPIOH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOHSMEN) != RESET)
  2067. #if defined(ADC_SUPPORT_5_MSPS)
  2068. #define __HAL_RCC_C2ADC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_ADCSMEN) != RESET)
  2069. #endif
  2070. #if defined(AES1)
  2071. #define __HAL_RCC_C2AES1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_AES1SMEN) != RESET)
  2072. #endif
  2073. #define __HAL_RCC_C2GPIOA_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOASMEN) == RESET)
  2074. #define __HAL_RCC_C2GPIOB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOBSMEN) == RESET)
  2075. #define __HAL_RCC_C2GPIOC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOCSMEN) == RESET)
  2076. #if defined(GPIOD)
  2077. #define __HAL_RCC_C2GPIOD_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIODSMEN) == RESET)
  2078. #endif
  2079. #define __HAL_RCC_C2GPIOE_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOESMEN) == RESET)
  2080. #define __HAL_RCC_C2GPIOH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_GPIOHSMEN) == RESET)
  2081. #if defined(ADC_SUPPORT_5_MSPS)
  2082. #define __HAL_RCC_C2ADC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_ADCSMEN) == RESET)
  2083. #endif
  2084. #if defined(AES1)
  2085. #define __HAL_RCC_C2AES1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB2SMENR, RCC_C2AHB2SMENR_AES1SMEN) == RESET)
  2086. #endif
  2087. /**
  2088. * @}
  2089. */
  2090. /** @defgroup RCC_AHB3_Clock_Sleep_Enable_Disable_Status AHB3 Peripheral Clock Sleep Enabled or Disabled Status
  2091. * @brief Check whether the AHB3 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2092. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2093. * power consumption.
  2094. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2095. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2096. * @{
  2097. */
  2098. #if defined(QUADSPI)
  2099. #define __HAL_RCC_QUADSPI_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QUADSPISMEN) != RESET)
  2100. #endif
  2101. #define __HAL_RCC_PKA_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_PKASMEN) != RESET)
  2102. #define __HAL_RCC_AES2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_AES2SMEN) != RESET)
  2103. #define __HAL_RCC_RNG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_RNGSMEN) != RESET)
  2104. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_SRAM2SMEN) != RESET)
  2105. #define __HAL_RCC_FLASH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FLASHSMEN) != RESET)
  2106. #if defined(QUADSPI)
  2107. #define __HAL_RCC_QUADSPI_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_QUADSPISMEN) == RESET)
  2108. #endif
  2109. #define __HAL_RCC_PKA_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_PKASMEN) == RESET)
  2110. #define __HAL_RCC_AES2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_AES2SMEN) == RESET)
  2111. #define __HAL_RCC_RNG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_RNGSMEN) == RESET)
  2112. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_SRAM2SMEN) == RESET)
  2113. #define __HAL_RCC_FLASH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->AHB3SMENR, RCC_AHB3SMENR_FLASHSMEN) == RESET)
  2114. #define __HAL_RCC_C2PKA_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_PKASMEN) != RESET)
  2115. #define __HAL_RCC_C2AES2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_AES2SMEN) != RESET)
  2116. #define __HAL_RCC_C2RNG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_RNGSMEN) != RESET)
  2117. #define __HAL_RCC_C2SRAM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_SRAM2SMEN) != RESET)
  2118. #define __HAL_RCC_C2FLASH_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_FLASHSMEN) != RESET)
  2119. #define __HAL_RCC_C2PKA_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_PKASMEN) == RESET)
  2120. #define __HAL_RCC_C2AES2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_AES2SMEN) == RESET)
  2121. #define __HAL_RCC_C2RNG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_RNGSMEN) == RESET)
  2122. #define __HAL_RCC_C2SRAM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_SRAM2SMEN) == RESET)
  2123. #define __HAL_RCC_C2FLASH_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2AHB3SMENR, RCC_C2AHB3SMENR_FLASHSMEN) == RESET)
  2124. /**
  2125. * @}
  2126. */
  2127. /** @defgroup RCC_APB1_Clock_Sleep_Enable_Disable_Status APB1 Peripheral Clock Sleep Enabled or Disabled Status
  2128. * @brief Check whether the APB1 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2129. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2130. * power consumption.
  2131. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2132. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2133. * @{
  2134. */
  2135. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN) != RESET)
  2136. #if defined(LCD)
  2137. #define __HAL_RCC_LCD_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN) != RESET)
  2138. #endif
  2139. #define __HAL_RCC_RTCAPB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN) != RESET)
  2140. #define __HAL_RCC_WWDG_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN) != RESET)
  2141. #if defined(SPI2)
  2142. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN) != RESET)
  2143. #endif
  2144. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN) != RESET)
  2145. #if defined(I2C3)
  2146. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN) != RESET)
  2147. #endif
  2148. #if defined(CRS)
  2149. #define __HAL_RCC_CRS_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN) != RESET)
  2150. #endif
  2151. #if defined(USB)
  2152. #define __HAL_RCC_USB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBSMEN) != RESET)
  2153. #endif
  2154. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN) != RESET)
  2155. #if defined(LPUART1)
  2156. #define __HAL_RCC_LPUART1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN) != RESET)
  2157. #endif
  2158. #define __HAL_RCC_LPTIM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN) != RESET)
  2159. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_TIM2SMEN) == RESET)
  2160. #if defined(LCD)
  2161. #define __HAL_RCC_LCD_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LCDSMEN) == RESET)
  2162. #endif
  2163. #define __HAL_RCC_RTCAPB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_RTCAPBSMEN) == RESET)
  2164. #define __HAL_RCC_WWDG_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_WWDGSMEN) == RESET)
  2165. #if defined(SPI2)
  2166. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_SPI2SMEN) == RESET)
  2167. #endif
  2168. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C1SMEN) == RESET)
  2169. #if defined(I2C3)
  2170. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_I2C3SMEN) == RESET)
  2171. #endif
  2172. #if defined(CRS)
  2173. #define __HAL_RCC_CRS_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_CRSSMEN) == RESET)
  2174. #endif
  2175. #if defined(USB)
  2176. #define __HAL_RCC_USB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_USBSMEN) == RESET)
  2177. #endif
  2178. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR1, RCC_APB1SMENR1_LPTIM1SMEN) == RESET)
  2179. #if defined(LPUART1)
  2180. #define __HAL_RCC_LPUART1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPUART1SMEN) == RESET)
  2181. #endif
  2182. #define __HAL_RCC_LPTIM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB1SMENR2, RCC_APB1SMENR2_LPTIM2SMEN) == RESET)
  2183. #define __HAL_RCC_C2TIM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_TIM2SMEN) != RESET)
  2184. #if defined(LCD)
  2185. #define __HAL_RCC_C2LCD_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_LCDSMEN) != RESET)
  2186. #endif
  2187. #define __HAL_RCC_C2RTCAPB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_RTCAPBSMEN) != RESET)
  2188. #if defined(SPI2)
  2189. #define __HAL_RCC_C2SPI2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_SPI2SMEN) != RESET)
  2190. #endif
  2191. #define __HAL_RCC_C2I2C1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_I2C1SMEN) != RESET)
  2192. #if defined(I2C3)
  2193. #define __HAL_RCC_C2I2C3_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_I2C3SMEN) != RESET)
  2194. #endif
  2195. #if defined(CRS)
  2196. #define __HAL_RCC_C2CRS_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_CRSSMEN) != RESET)
  2197. #endif
  2198. #if defined(USB)
  2199. #define __HAL_RCC_C2USB_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_USBSMEN) != RESET)
  2200. #endif
  2201. #define __HAL_RCC_C2LPTIM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_LPTIM1SMEN) != RESET)
  2202. #if defined(LPUART1)
  2203. #define __HAL_RCC_C2LPUART1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR2, RCC_C2APB1SMENR2_LPUART1SMEN) != RESET)
  2204. #endif
  2205. #define __HAL_RCC_C2LPTIM2_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB1SMENR2, RCC_C2APB1SMENR2_LPTIM2SMEN) != RESET)
  2206. #define __HAL_RCC_C2TIM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_TIM2SMEN) == RESET)
  2207. #if defined(LCD)
  2208. #define __HAL_RCC_C2LCD_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_LCDSMEN) == RESET)
  2209. #endif
  2210. #define __HAL_RCC_C2RTCAPB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_RTCAPBSMEN) == RESET)
  2211. #if defined(SPI2)
  2212. #define __HAL_RCC_C2SPI2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_SPI2SMEN) == RESET)
  2213. #endif
  2214. #define __HAL_RCC_C2I2C1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_I2C1SMEN) == RESET)
  2215. #if defined(I2C3)
  2216. #define __HAL_RCC_C2I2C3_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_I2C3SMEN) == RESET)
  2217. #endif
  2218. #if defined(CRS)
  2219. #define __HAL_RCC_C2CRS_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_CRSSMEN) == RESET)
  2220. #endif
  2221. #if defined(USB)
  2222. #define __HAL_RCC_C2USB_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_USBSMEN) == RESET)
  2223. #endif
  2224. #define __HAL_RCC_C2LPTIM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR1, RCC_C2APB1SMENR1_LPTIM1SMEN) == RESET)
  2225. #if defined(LPUART1)
  2226. #define __HAL_RCC_C2LPUART1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR2, RCC_C2APB1SMENR2_LPUART1SMEN) == RESET)
  2227. #endif
  2228. #define __HAL_RCC_C2LPTIM2_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB1SMENR2, RCC_C2APB1SMENR2_LPTIM2SMEN) == RESET)
  2229. /**
  2230. * @}
  2231. */
  2232. /** @defgroup RCC_APB2_Clock_Sleep_Enable_Disable_Status APB2 Peripheral Clock Sleep Enabled or Disabled Status
  2233. * @brief Check whether the APB2 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2234. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2235. * power consumption.
  2236. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2237. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2238. * @{
  2239. */
  2240. #if defined(ADC_SUPPORT_2_5_MSPS)
  2241. #define __HAL_RCC_ADC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_ADCSMEN) != RESET)
  2242. #endif
  2243. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN) != RESET)
  2244. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN) != RESET)
  2245. #define __HAL_RCC_USART1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN) != RESET)
  2246. #define __HAL_RCC_TIM16_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN) != RESET)
  2247. #define __HAL_RCC_TIM17_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN) != RESET)
  2248. #if defined(SAI1)
  2249. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN) != RESET)
  2250. #endif
  2251. #if defined(ADC_SUPPORT_2_5_MSPS)
  2252. #define __HAL_RCC_ADC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_ADCSMEN) == RESET)
  2253. #endif
  2254. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM1SMEN) == RESET)
  2255. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SPI1SMEN) == RESET)
  2256. #define __HAL_RCC_USART1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_USART1SMEN) == RESET)
  2257. #define __HAL_RCC_TIM16_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM16SMEN) == RESET)
  2258. #define __HAL_RCC_TIM17_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_TIM17SMEN) == RESET)
  2259. #if defined(SAI1)
  2260. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->APB2SMENR, RCC_APB2SMENR_SAI1SMEN) == RESET)
  2261. #endif
  2262. #if defined(ADC_SUPPORT_2_5_MSPS)
  2263. #define __HAL_RCC_C2ADC_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_ADCSMEN) != RESET)
  2264. #endif
  2265. #define __HAL_RCC_C2TIM1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_TIM1SMEN) != RESET)
  2266. #define __HAL_RCC_C2SPI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_SPI1SMEN) != RESET)
  2267. #define __HAL_RCC_C2USART1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_USART1SMEN) != RESET)
  2268. #define __HAL_RCC_C2TIM16_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_TIM16SMEN) != RESET)
  2269. #define __HAL_RCC_C2TIM17_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_TIM17SMEN) != RESET)
  2270. #if defined(SAI1)
  2271. #define __HAL_RCC_C2SAI1_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_SAI1SMEN) != RESET)
  2272. #endif
  2273. #if defined(ADC_SUPPORT_2_5_MSPS)
  2274. #define __HAL_RCC_C2ADC_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_ADCSMEN) == RESET)
  2275. #endif
  2276. #define __HAL_RCC_C2TIM1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_TIM1SMEN) == RESET)
  2277. #define __HAL_RCC_C2SPI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_SPI1SMEN) == RESET)
  2278. #define __HAL_RCC_C2USART1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_USART1SMEN) == RESET)
  2279. #define __HAL_RCC_C2TIM16_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_TIM16SMEN) == RESET)
  2280. #define __HAL_RCC_C2TIM17_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_TIM17SMEN) == RESET)
  2281. #if defined(SAI1)
  2282. #define __HAL_RCC_C2SAI1_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB2SMENR, RCC_C2APB2SMENR_SAI1SMEN) == RESET)
  2283. #endif
  2284. /**
  2285. * @}
  2286. */
  2287. /** @defgroup RCC_C2APB3_Clock_Sleep_Enable_Disable APB3 Peripheral Clock Sleep Enable Disable
  2288. * @brief Enable or disable the APB3 peripheral clock during Low Power (Sleep) mode.
  2289. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2290. * power consumption.
  2291. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2292. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2293. * @{
  2294. */
  2295. #define __HAL_RCC_C2BLE_CLK_SLEEP_ENABLE() LL_C2_APB3_GRP1_EnableClockSleep(LL_C2_APB3_GRP1_PERIPH_BLE)
  2296. #if defined(RCC_802_SUPPORT)
  2297. #define __HAL_RCC_C2802_CLK_SLEEP_ENABLE() LL_C2_APB3_GRP1_EnableClockSleep(LL_C2_APB3_GRP1_PERIPH_802)
  2298. #endif
  2299. #define __HAL_RCC_C2BLE_CLK_SLEEP_DISABLE() LL_C2_APB3_GRP1_DisableClockSleep(LL_C2_APB3_GRP1_PERIPH_BLE)
  2300. #if defined(RCC_802_SUPPORT)
  2301. #define __HAL_RCC_C2802_CLK_SLEEP_DISABLE() LL_C2_APB3_GRP1_DisableClockSleep(LL_C2_APB3_GRP1_PERIPH_802)
  2302. #endif
  2303. /**
  2304. * @}
  2305. */
  2306. /** @defgroup RCC_C2APB3_Clock_Sleep_Enable_Disable_Status APB3 Peripheral Clock Sleep Enabled or Disabled Status
  2307. * @brief Check whether the APB3 peripheral clock during Low Power (Sleep) mode is enabled or not.
  2308. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  2309. * power consumption.
  2310. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  2311. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  2312. * @{
  2313. */
  2314. #define __HAL_RCC_C2BLE_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB3SMENR, RCC_C2APB3SMENR_BLESMEN) != RESET)
  2315. #if defined(RCC_802_SUPPORT)
  2316. #define __HAL_RCC_C2802_IS_CLK_SLEEP_ENABLED() (READ_BIT(RCC->C2APB3SMENR, RCC_C2APB3SMENR_802SMEN) != RESET)
  2317. #endif
  2318. #define __HAL_RCC_C2BLE_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB3SMENR, RCC_C2APB3SMENR_BLESMEN) == RESET)
  2319. #if defined(RCC_802_SUPPORT)
  2320. #define __HAL_RCC_C2802_IS_CLK_SLEEP_DISABLED() (READ_BIT(RCC->C2APB3SMENR, RCC_C2APB3SMENR_802SMEN) == RESET)
  2321. #endif
  2322. /**
  2323. * @}
  2324. */
  2325. /** @defgroup RCC_Backup_Domain_Reset RCC Backup Domain Reset
  2326. * @{
  2327. */
  2328. /** @brief Macros to force or release the Backup domain reset.
  2329. * @note This function resets the RTC peripheral (including the backup registers)
  2330. * and the RTC clock source selection in RCC_CSR register.
  2331. * @note The BKPSRAM is not affected by this reset.
  2332. * @retval None
  2333. */
  2334. #define __HAL_RCC_BACKUPRESET_FORCE() LL_RCC_ForceBackupDomainReset()
  2335. #define __HAL_RCC_BACKUPRESET_RELEASE() LL_RCC_ReleaseBackupDomainReset()
  2336. /**
  2337. * @}
  2338. */
  2339. /** @defgroup RCC_RTC_Clock_Configuration RCC RTC Clock Configuration
  2340. * @{
  2341. */
  2342. /** @brief Macros to enable or disable the RTC clock.
  2343. * @note As the RTC is in the Backup domain and write access is denied to
  2344. * this domain after reset, you have to enable write access using
  2345. * HAL_PWR_EnableBkUpAccess() function before to configure the RTC
  2346. * (to be done once after reset).
  2347. * @note These macros must be used after the RTC clock source was selected.
  2348. * @retval None
  2349. */
  2350. #define __HAL_RCC_RTC_ENABLE() LL_RCC_EnableRTC()
  2351. #define __HAL_RCC_RTC_DISABLE() LL_RCC_DisableRTC()
  2352. /**
  2353. * @}
  2354. */
  2355. /** @brief Macros to enable the Internal High Speed oscillator (HSI).
  2356. * @note The HSI is stopped by hardware when entering STOP, STANDBY or SHUTDOWN modes.
  2357. * It is enabled by hardware to force the HSI oscillator ON when STOPWUCK=1
  2358. * or HSIASFS = 1 when leaving Stop modes, or in case of failure of the HSE
  2359. * crystal oscillator and Security System CSS is enabled.
  2360. * @note After enabling the HSI, the application software should wait on HSIRDY
  2361. * flag to be set indicating that HSI clock is stable and can be used as
  2362. * system clock source.
  2363. * @retval None
  2364. */
  2365. #define __HAL_RCC_HSI_ENABLE() LL_RCC_HSI_Enable()
  2366. /** @brief Macro to disable the Internal High Speed oscillator (HSI).
  2367. * @note HSI can not be stopped if it is used as system clock source. In this case,
  2368. * you have to select another source of the system clock then stop the HSI.
  2369. * @note When the HSI is stopped, HSIRDY flag goes low after 6 HSI oscillator
  2370. * clock cycles.
  2371. * @retval None
  2372. */
  2373. #define __HAL_RCC_HSI_DISABLE() LL_RCC_HSI_Disable()
  2374. /** @brief Macro to adjust the Internal High Speed oscillator (HSI) calibration value.
  2375. * @note The calibration is used to compensate for the variations in voltage
  2376. * and temperature that influence the frequency of the internal HSI RC.
  2377. * @param __HSICALIBRATIONVALUE__ specifies the calibration trimming value
  2378. * (default is RCC_HSICALIBRATION_DEFAULT).
  2379. * This parameter must be a number between Min_data=0 and Max_Data=127.
  2380. * @retval None
  2381. */
  2382. #define __HAL_RCC_HSI_CALIBRATIONVALUE_ADJUST(__HSICALIBRATIONVALUE__) LL_RCC_HSI_SetCalibTrimming(__HSICALIBRATIONVALUE__)
  2383. /**
  2384. * @brief Macros to enable or disable the wakeup the Internal High Speed oscillator (HSI)
  2385. * in parallel to the Internal Multi Speed oscillator (MSI) used at system wakeup.
  2386. * @note The enable of this function has not effect on the HSION bit.
  2387. * This parameter can be: ENABLE or DISABLE.
  2388. * @retval None
  2389. */
  2390. #define __HAL_RCC_HSIAUTOMATIC_START_ENABLE() LL_RCC_HSI_EnableAutoFromStop()
  2391. #define __HAL_RCC_HSIAUTOMATIC_START_DISABLE() LL_RCC_HSI_DisableAutoFromStop()
  2392. /**
  2393. * @brief Macros to enable or disable the force of the Internal High Speed oscillator (HSI)
  2394. * in STOP mode to be quickly available as kernel clock for USARTs and I2Cs.
  2395. * @note Keeping the HSI ON in STOP mode allows to avoid slowing down the communication
  2396. * speed because of the HSI startup time.
  2397. * @note The enable of this function has not effect on the HSION bit.
  2398. * @retval None
  2399. */
  2400. #define __HAL_RCC_HSISTOP_ENABLE() LL_RCC_HSI_EnableInStopMode()
  2401. #define __HAL_RCC_HSISTOP_DISABLE() LL_RCC_HSI_DisableInStopMode()
  2402. /**
  2403. * @brief Macros to enable or disable the Internal Multi Speed oscillator (MSI).
  2404. * @note The MSI is stopped by hardware when entering STOP and STANDBY modes.
  2405. * It is used (enabled by hardware) as system clock source after
  2406. * startup from Reset, wakeup from STOP and STANDBY mode, or in case
  2407. * of failure of the HSE used directly or indirectly as system clock
  2408. * (if the Clock Security System CSS is enabled).
  2409. * @note MSI can not be stopped if it is used as system clock source.
  2410. * In this case, you have to select another source of the system
  2411. * clock then stop the MSI.
  2412. * @note After enabling the MSI, the application software should wait on
  2413. * MSIRDY flag to be set indicating that MSI clock is stable and can
  2414. * be used as system clock source.
  2415. * @note When the MSI is stopped, MSIRDY flag goes low after 6 MSI oscillator
  2416. * clock cycles.
  2417. * @retval None
  2418. */
  2419. #define __HAL_RCC_MSI_ENABLE() LL_RCC_MSI_Enable()
  2420. #define __HAL_RCC_MSI_DISABLE() LL_RCC_MSI_Disable()
  2421. /** @brief Macro to adjust the Internal Multi Speed oscillator (MSI) calibration value.
  2422. * @note The calibration is used to compensate for the variations in voltage
  2423. * and temperature that influence the frequency of the internal MSI RC.
  2424. * Refer to the Application Note AN3300 for more details on how to
  2425. * calibrate the MSI.
  2426. * @param __MSICALIBRATIONVALUE__ specifies the calibration trimming value
  2427. * (default is @ref RCC_MSICALIBRATION_DEFAULT).
  2428. * This parameter must be a number between 0 and 255.
  2429. * @retval None
  2430. */
  2431. #define __HAL_RCC_MSI_CALIBRATIONVALUE_ADJUST(__MSICALIBRATIONVALUE__) LL_RCC_MSI_SetCalibTrimming(__MSICALIBRATIONVALUE__)
  2432. /**
  2433. * @brief Macro configures the Internal Multi Speed oscillator (MSI) clock range in run mode
  2434. * @note After restart from Reset , the MSI clock is around 4 MHz.
  2435. * After stop the startup clock can be MSI (at any of its possible
  2436. * frequencies, the one that was used before entering stop mode) or HSI.
  2437. * After Standby its frequency can be selected between 4 possible values
  2438. * (1, 2, 4 or 8 MHz).
  2439. * @note MSIRANGE can be modified when MSI is OFF (MSION=0) or when MSI is ready
  2440. * (MSIRDY=1).
  2441. * @note The MSI clock range after reset can be modified on the fly.
  2442. * @param __MSIRANGEVALUE__ specifies the MSI clock range.
  2443. * This parameter must be one of the following values:
  2444. * @arg @ref RCC_MSIRANGE_0 MSI clock is around 100 KHz
  2445. * @arg @ref RCC_MSIRANGE_1 MSI clock is around 200 KHz
  2446. * @arg @ref RCC_MSIRANGE_2 MSI clock is around 400 KHz
  2447. * @arg @ref RCC_MSIRANGE_3 MSI clock is around 800 KHz
  2448. * @arg @ref RCC_MSIRANGE_4 MSI clock is around 1 MHz
  2449. * @arg @ref RCC_MSIRANGE_5 MSI clock is around 2MHz
  2450. * @arg @ref RCC_MSIRANGE_6 MSI clock is around 4MHz (default after Reset)
  2451. * @arg @ref RCC_MSIRANGE_7 MSI clock is around 8 MHz
  2452. * @arg @ref RCC_MSIRANGE_8 MSI clock is around 16 MHz
  2453. * @arg @ref RCC_MSIRANGE_9 MSI clock is around 24 MHz
  2454. * @arg @ref RCC_MSIRANGE_10 MSI clock is around 32 MHz
  2455. * @arg @ref RCC_MSIRANGE_11 MSI clock is around 48 MHz
  2456. * @retval None
  2457. */
  2458. #define __HAL_RCC_MSI_RANGE_CONFIG(__MSIRANGEVALUE__) LL_RCC_MSI_SetRange(__MSIRANGEVALUE__)
  2459. /** @brief Macro to get the Internal Multi Speed oscillator (MSI) clock range in run mode
  2460. * @retval MSI clock range.
  2461. * This parameter must be one of the following values:
  2462. * @arg @ref RCC_MSIRANGE_0 MSI clock is around 100 KHz
  2463. * @arg @ref RCC_MSIRANGE_1 MSI clock is around 200 KHz
  2464. * @arg @ref RCC_MSIRANGE_2 MSI clock is around 400 KHz
  2465. * @arg @ref RCC_MSIRANGE_3 MSI clock is around 800 KHz
  2466. * @arg @ref RCC_MSIRANGE_4 MSI clock is around 1 MHz
  2467. * @arg @ref RCC_MSIRANGE_5 MSI clock is around 2 MHz
  2468. * @arg @ref RCC_MSIRANGE_6 MSI clock is around 4 MHz (default after Reset)
  2469. * @arg @ref RCC_MSIRANGE_7 MSI clock is around 8 MHz
  2470. * @arg @ref RCC_MSIRANGE_8 MSI clock is around 16 MHz
  2471. * @arg @ref RCC_MSIRANGE_9 MSI clock is around 24 MHz
  2472. * @arg @ref RCC_MSIRANGE_10 MSI clock is around 32 MHz
  2473. * @arg @ref RCC_MSIRANGE_11 MSI clock is around 48 MHz
  2474. */
  2475. #define __HAL_RCC_GET_MSI_RANGE() LL_RCC_MSI_GetRange()
  2476. /** @brief Macros to enable or disable the Internal Low Speed oscillator (LSI1).
  2477. * @note After enabling the LSI1, the application software should wait on
  2478. * LSI1RDY flag to be set indicating that LSI1 clock is stable and can
  2479. * be used to clock the IWDG and/or the RTC.
  2480. * @retval None
  2481. */
  2482. #define __HAL_RCC_LSI1_ENABLE() LL_RCC_LSI1_Enable()
  2483. #define __HAL_RCC_LSI1_DISABLE() LL_RCC_LSI1_Disable()
  2484. /** @brief Macros to enable or disable the Internal Low Speed oscillator (LSI2).
  2485. * @note After enabling the LSI2, the application software should wait on
  2486. * LSI2RDY flag to be set indicating that LSI2 clock is stable and can
  2487. * be used to clock the IWDG and/or the RTC.
  2488. * @retval None
  2489. */
  2490. #define __HAL_RCC_LSI2_ENABLE() LL_RCC_LSI2_Enable()
  2491. #define __HAL_RCC_LSI2_DISABLE() LL_RCC_LSI2_Disable()
  2492. /** @brief Macro to adjust the Internal Low Speed oscillator (LSI2) calibration value.
  2493. * @note The calibration is used to compensate for the variations in voltage
  2494. * and temperature that influence the frequency of the internal HSI RC.
  2495. * @param __LSI2TRIMMINGVALUE__ specifies the calibration trimming value
  2496. * This parameter must be a number between Min_data=0 and Max_Data=15.
  2497. * @retval None
  2498. */
  2499. #define __HAL_RCC_LSI2_CALIBRATIONVALUE_ADJUST(__LSI2TRIMMINGVALUE__) LL_RCC_LSI2_SetTrimming(__LSI2TRIMMINGVALUE__)
  2500. /**
  2501. * @brief Macro to configure the External High Speed oscillator (HSE).
  2502. * @note After enabling the HSE (RCC_HSE_ON), the application
  2503. * software should wait on HSERDY flag to be set indicating that HSE clock
  2504. * is stable and can be used to clock the PLL and/or system clock.
  2505. * @note HSE state can not be changed if it is used directly or through the
  2506. * PLL as system clock. In this case, you have to select another source
  2507. * of the system clock then change the HSE state (ex. disable it).
  2508. * @note The HSE is stopped by hardware when entering STOP and STANDBY modes.
  2509. * @note This function reset the CSSON bit, so if the clock security system(CSS)
  2510. * was previously enabled you have to enable it again after calling this
  2511. * function.
  2512. * @param __STATE__ specifies the new state of the HSE.
  2513. * This parameter can be one of the following values:
  2514. * @arg @ref RCC_HSE_OFF Turn OFF the HSE oscillator, HSERDY flag goes low after
  2515. * 6 HSE oscillator clock cycles.
  2516. * @arg @ref RCC_HSE_ON Turn ON the HSE oscillator.
  2517. * @note (*) Value not defined for all devices
  2518. * @retval None
  2519. */
  2520. #define __HAL_RCC_HSE_CONFIG(__STATE__) \
  2521. do { \
  2522. if((__STATE__) == RCC_HSE_ON) \
  2523. { \
  2524. LL_RCC_HSE_Enable(); \
  2525. } \
  2526. else \
  2527. { \
  2528. LL_RCC_HSE_Disable(); \
  2529. } \
  2530. } while(0U)
  2531. /** @brief Macros to enable or disable the HSE Prescaler
  2532. * @note HSE div2 could be used as Sysclk or PLL entry in Range2
  2533. * @retval None
  2534. */
  2535. #define __HAL_RCC_HSE_DIV2_ENABLE() LL_RCC_HSE_EnableDiv2()
  2536. #define __HAL_RCC_HSE_DIV2_DISABLE() LL_RCC_HSE_DisableDiv2()
  2537. /**
  2538. * @brief Macro to configure the External Low Speed oscillator (LSE).
  2539. * @note Transitions LSE Bypass to LSE On and LSE On to LSE Bypass are not
  2540. * supported by this macro. User should request a transition to LSE Off
  2541. * first and then LSE On or LSE Bypass.
  2542. * @note As the LSE is in the Backup domain and write access is denied to
  2543. * this domain after reset, you have to enable write access using
  2544. * HAL_PWR_EnableBkUpAccess() function before to configure the LSE
  2545. * (to be done once after reset).
  2546. * @note After enabling the LSE (RCC_LSE_ON or RCC_LSE_BYPASS), the application
  2547. * software should wait on LSERDY flag to be set indicating that LSE clock
  2548. * is stable and can be used to clock the RTC.
  2549. * @param __STATE__ specifies the new state of the LSE.
  2550. * This parameter can be one of the following values:
  2551. * @arg @ref RCC_LSE_OFF Turn OFF the LSE oscillator, LSERDY flag goes low after
  2552. * 6 LSE oscillator clock cycles.
  2553. * @arg @ref RCC_LSE_ON Turn ON the LSE oscillator.
  2554. * @arg @ref RCC_LSE_BYPASS LSE oscillator bypassed with external clock.
  2555. * @retval None
  2556. */
  2557. #define __HAL_RCC_LSE_CONFIG(__STATE__) \
  2558. do { \
  2559. if((__STATE__) == RCC_LSE_ON) \
  2560. { \
  2561. LL_RCC_LSE_Enable(); \
  2562. } \
  2563. else if((__STATE__) == RCC_LSE_BYPASS) \
  2564. { \
  2565. LL_RCC_LSE_EnableBypass(); \
  2566. LL_RCC_LSE_Enable(); \
  2567. } \
  2568. else \
  2569. { \
  2570. LL_RCC_LSE_Disable(); \
  2571. LL_RCC_LSE_DisableBypass(); \
  2572. } \
  2573. } while(0U)
  2574. #if defined(RCC_HSI48_SUPPORT)
  2575. /** @brief Macros to enable or disable the Internal High Speed 48MHz oscillator (HSI48).
  2576. * @note The HSI48 is stopped by hardware when entering STOP and STANDBY modes.
  2577. * @note After enabling the HSI48, the application software should wait on HSI48RDY
  2578. * flag to be set indicating that HSI48 clock is stable.
  2579. * This parameter can be: ENABLE or DISABLE.
  2580. * @retval None
  2581. */
  2582. #define __HAL_RCC_HSI48_ENABLE() LL_RCC_HSI48_Enable()
  2583. #define __HAL_RCC_HSI48_DISABLE() LL_RCC_HSI48_Disable()
  2584. #endif
  2585. /** @brief Macros to configure HSE sense amplifier threshold.
  2586. * @note to configure HSE sense amplifier, first disable HSE
  2587. * using @ref __HAL_RCC_HSE_CONFIG(RCC_HSE_OFF) macro.
  2588. *
  2589. * @param __HSE_AMPTHRES__ specifies the HSE sense amplifier threshold.
  2590. * This parameter can be one of the following values:
  2591. * @arg @ref RCC_HSEAMPTHRESHOLD_1_2 HSE bias current factor 1/2.
  2592. * @arg @ref RCC_HSEAMPTHRESHOLD_3_4 HSE bias current factor 3/4.
  2593. * @retval None
  2594. */
  2595. #define __HAL_RCC_HSE_AMPCONFIG(__HSE_AMPTHRES__) LL_RCC_HSE_SetSenseAmplifier(__HSE_AMPTHRES__)
  2596. /** @brief Macros to configure HSE current control.
  2597. * @note to configure HSE current control, first disable HSE
  2598. * using @ref __HAL_RCC_HSE_CONFIG(RCC_HSE_OFF) macro.
  2599. *
  2600. * @param __HSE_CURRENTMAX__ specifies the HSE current max limit.
  2601. * This parameter can be one of the following values:
  2602. * @arg @ref RCC_HSE_CURRENTMAX_0 HSE current max limit 0.18 mA/V.
  2603. * @arg @ref RCC_HSE_CURRENTMAX_1 HSE current max limit 0.57 mA/V.
  2604. * @arg @ref RCC_HSE_CURRENTMAX_2 HSE current max limit 0.78 mA/V.
  2605. * @arg @ref RCC_HSE_CURRENTMAX_3 HSE current max limit 1.13 mA/V.
  2606. * @arg @ref RCC_HSE_CURRENTMAX_4 HSE current max limit 0.61 mA/V.
  2607. * @arg @ref RCC_HSE_CURRENTMAX_5 HSE current max limit 1.65 mA/V.
  2608. * @arg @ref RCC_HSE_CURRENTMAX_6 HSE current max limit 2.12 mA/V.
  2609. * @arg @ref RCC_HSE_CURRENTMAX_7 HSE current max limit 2.84 mA/V.
  2610. * @retval None
  2611. */
  2612. #define __HAL_RCC_HSE_CURRENTCONFIG(__HSE_CURRENTMAX__) LL_RCC_HSE_SetCurrentControl(__HSE_CURRENTMAX__)
  2613. /** @brief Macros to configure HSE capacitor tuning.
  2614. * @note to configure HSE current control, first disable HSE
  2615. * using __HAL_RCC_HSE_CONFIG(RCC_HSE_OFF) macro.
  2616. *
  2617. * @param __HSE_LOAD_CAPACITANCE__ specifies the HSE capacitor value.
  2618. * This Value Between Min_Data = 0 and Max_Data = 63
  2619. * @retval None
  2620. */
  2621. #define __HAL_RCC_HSE_CAPACITORTUNING(__HSE_LOAD_CAPACITANCE__) LL_RCC_HSE_SetCapacitorTuning(__HSE_LOAD_CAPACITANCE__)
  2622. /** @brief Macros to configure the RTC clock (RTCCLK).
  2623. * @param __RTC_CLKSOURCE__ specifies the RTC clock source.
  2624. * This parameter can be one of the following values:
  2625. * @arg @ref RCC_RTCCLKSOURCE_NONE none clock selected as RTC clock.
  2626. * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock.
  2627. * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock.
  2628. * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV32 HSE clock divided by 32 selected
  2629. * @note As the RTC clock configuration bits are in the Backup domain and write
  2630. * access is denied to this domain after reset, you have to enable write
  2631. * access using the Power Backup Access macro before to configure
  2632. * the RTC clock source (to be done once after reset).
  2633. * @note Once the RTC clock is configured it cannot be changed unless the
  2634. * Backup domain is reset using @ref __HAL_RCC_BACKUPRESET_FORCE() macro, or by
  2635. * a Power On Reset (POR).
  2636. * @note If the LSE or LSI is used as RTC clock source, the RTC continues to
  2637. * work in STOP and STANDBY modes, and can be used as wakeup source.
  2638. * However, when the HSE clock is used as RTC clock source, the RTC
  2639. * cannot be used in STOP and STANDBY modes.
  2640. * @note The maximum input clock frequency for RTC is 1MHz (when using HSE as
  2641. * RTC clock source).
  2642. * @retval None
  2643. */
  2644. #define __HAL_RCC_RTC_CONFIG(__RTC_CLKSOURCE__) LL_RCC_SetRTCClockSource(__RTC_CLKSOURCE__)
  2645. /** @brief Macro to get the RTC clock source.
  2646. * @retval The returned value can be one of the following:
  2647. * @arg @ref RCC_RTCCLKSOURCE_NONE none clock selected as RTC clock.
  2648. * @arg @ref RCC_RTCCLKSOURCE_LSE LSE selected as RTC clock.
  2649. * @arg @ref RCC_RTCCLKSOURCE_LSI LSI selected as RTC clock.
  2650. * @arg @ref RCC_RTCCLKSOURCE_HSE_DIV32 HSE clock divided by 32 selected
  2651. */
  2652. #define __HAL_RCC_GET_RTC_SOURCE() LL_RCC_GetRTCClockSource()
  2653. /** @brief Macros to enable or disable the main PLL.
  2654. * @note After enabling the main PLL, the application software should wait on
  2655. * PLLRDY flag to be set indicating that PLL clock is stable and can
  2656. * be used as system clock source.
  2657. * @note The main PLL can not be disabled if it is used as system clock source
  2658. * @note The main PLL is disabled by hardware when entering STOP and STANDBY modes.
  2659. * @retval None
  2660. */
  2661. #define __HAL_RCC_PLL_ENABLE() LL_RCC_PLL_Enable()
  2662. #define __HAL_RCC_PLL_DISABLE() LL_RCC_PLL_Disable()
  2663. /** @brief Macro to configure the PLL clock source.
  2664. * @param __PLLSOURCE__ specifies the PLL entry clock source.
  2665. * This parameter can be one of the following values:
  2666. * @arg @ref RCC_PLLSOURCE_NONE No clock selected as PLL clock entry
  2667. * @arg @ref RCC_PLLSOURCE_MSI MSI oscillator clock selected as PLL clock entry
  2668. * @arg @ref RCC_PLLSOURCE_HSI HSI oscillator clock selected as PLL clock entry
  2669. * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
  2670. * @note This function must be used only when the main PLL is disabled.
  2671. * @note This clock source is common for the main PLL and audio PLL (PLL and PLLSAI1).
  2672. * @retval None
  2673. *
  2674. */
  2675. #define __HAL_RCC_PLL_PLLSOURCE_CONFIG(__PLLSOURCE__) \
  2676. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLSRC, (__PLLSOURCE__))
  2677. /** @brief Macro to configure the PLL multiplication factor.
  2678. * @note This function must be used only when the main PLL is disabled.
  2679. * @param __PLLM__ specifies the division factor for PLL VCO input clock
  2680. * This parameter must be a value of @ref RCC_PLLM_Clock_Divider.
  2681. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  2682. * frequency ranges from 4 to 16 MHz. It is recommended to select a frequency
  2683. * of 16 MHz to limit PLL jitter.
  2684. * @retval None
  2685. *
  2686. */
  2687. #define __HAL_RCC_PLL_PLLM_CONFIG(__PLLM__) \
  2688. MODIFY_REG(RCC->PLLCFGR, RCC_PLLCFGR_PLLM, (__PLLM__))
  2689. /**
  2690. * @brief Macro to configure the main PLL clock source, multiplication and division factors.
  2691. * @note This function must be used only when the main PLL is disabled.
  2692. *
  2693. * @param __PLLSOURCE__ specifies the PLL entry clock source.
  2694. * This parameter can be one of the following values:
  2695. * @arg @ref RCC_PLLSOURCE_NONE No clock selected as PLL clock entry
  2696. * @arg @ref RCC_PLLSOURCE_MSI MSI oscillator clock selected as PLL clock entry
  2697. * @arg @ref RCC_PLLSOURCE_HSI HSI oscillator clock selected as PLL clock entry
  2698. * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator clock selected as PLL clock entry
  2699. * @note This clock source is common for the main PLL and audio PLL (PLL and PLLSAI1).
  2700. *
  2701. * @param __PLLM__ specifies the division factor for PLL VCO input clock.
  2702. * This parameter must be a value of @ref RCC_PLLM_Clock_Divider.
  2703. * @note You have to set the PLLM parameter correctly to ensure that the VCO input
  2704. * frequency ranges from 2.66 to 16 MHz. It is recommended to select a frequency
  2705. * of 16 MHz to limit PLL jitter.
  2706. *
  2707. * @param __PLLN__ specifies the multiplication factor for PLL VCO output clock.
  2708. * This parameter must be a number between 6 and 127.
  2709. * @note You have to set the PLLN parameter correctly to ensure that the VCO
  2710. * output frequency is between 96 and 344 MHz.
  2711. *
  2712. * @param __PLLP__ specifies the division factor for ADC and SAI1 clock.
  2713. * This parameter must be a value of @ref RCC_PLLP_Clock_Divider.
  2714. *
  2715. * @param __PLLQ__ specifies the division factor for USB and RNG clocks.
  2716. * This parameter must be a value of @ref RCC_PLLQ_Clock_Divider
  2717. * @note If the USB FS is used in your application, you have to set the
  2718. * PLLQ parameter correctly to have 48 MHz clock for the USB. However,
  2719. * the RNG need a frequency lower than or equal to 48 MHz to work
  2720. * correctly.
  2721. *
  2722. * @param __PLLR__ specifies the division factor for the main system clock.
  2723. * This parameter must be a value of @ref RCC_PLLR_Clock_Divider
  2724. * @note You have to set the PLLR parameter correctly to not exceed 48 MHZ.
  2725. * @retval None
  2726. */
  2727. #define __HAL_RCC_PLL_CONFIG(__PLLSOURCE__, __PLLM__, __PLLN__, __PLLP__, __PLLQ__,__PLLR__ ) \
  2728. MODIFY_REG( RCC->PLLCFGR, \
  2729. (RCC_PLLCFGR_PLLSRC | \
  2730. RCC_PLLCFGR_PLLM | \
  2731. RCC_PLLCFGR_PLLN | \
  2732. RCC_PLLCFGR_PLLP | \
  2733. RCC_PLLCFGR_PLLQ | \
  2734. RCC_PLLCFGR_PLLR), \
  2735. ((uint32_t) (__PLLSOURCE__) | \
  2736. (uint32_t) (__PLLM__) | \
  2737. (uint32_t) ((__PLLN__) << RCC_PLLCFGR_PLLN_Pos) | \
  2738. (uint32_t) (__PLLP__) | \
  2739. (uint32_t) (__PLLQ__) | \
  2740. (uint32_t) (__PLLR__)))
  2741. /** @brief Macro to get the oscillator used as PLL clock source.
  2742. * @retval The oscillator used as PLL clock source. The returned value can be one
  2743. * of the following:
  2744. * @arg @ref RCC_PLLSOURCE_NONE No oscillator is used as PLL clock source.
  2745. * @arg @ref RCC_PLLSOURCE_MSI MSI oscillator is used as PLL clock source.
  2746. * @arg @ref RCC_PLLSOURCE_HSI HSI oscillator is used as PLL clock source.
  2747. * @arg @ref RCC_PLLSOURCE_HSE HSE oscillator is used as PLL clock source.
  2748. */
  2749. #define __HAL_RCC_GET_PLL_OSCSOURCE() LL_RCC_PLL_GetMainSource()
  2750. /**
  2751. * @brief Enable or disable each clock output (RCC_PLL_SYSCLK, RCC_PLL_USBCLK, RCC_PLL_SAI1CLK)
  2752. * @note Enabling/disabling clock outputs RCC_PLL_SAI1CLK and RCC_PLL_USBCLK can be done at anytime
  2753. * without the need to stop the PLL in order to save power. But RCC_PLL_SYSCLK cannot
  2754. * be stopped if used as System Clock.
  2755. * @param __PLLCLOCKOUT__ specifies the PLL clock to be output.
  2756. * This parameter can be one or a combination of the following values:
  2757. * @arg @ref RCC_PLL_SAI1CLK This clock is used to generate the clock for SAI
  2758. * @arg @ref RCC_PLL_ADCCLK This clock is used to generate the clock for ADC
  2759. * @arg @ref RCC_PLL_USBCLK This Clock is used to generate the clock for the USB FS (48 MHz)
  2760. * @arg @ref RCC_PLL_RNGCLK This clock is used to generate the clock for RNG
  2761. * @arg @ref RCC_PLL_SYSCLK This Clock is used to generate the high speed system clock (up to 64MHz)
  2762. * @retval None
  2763. */
  2764. #define __HAL_RCC_PLLCLKOUT_ENABLE(__PLLCLOCKOUT__) SET_BIT(RCC->PLLCFGR, (__PLLCLOCKOUT__))
  2765. #define __HAL_RCC_PLLCLKOUT_DISABLE(__PLLCLOCKOUT__) CLEAR_BIT(RCC->PLLCFGR, (__PLLCLOCKOUT__))
  2766. /**
  2767. * @brief Get clock output enable status (RCC_PLL_SYSCLK, RCC_PLL_USBCLK, RCC_PLL_SAI1CLK)
  2768. * @param __PLLCLOCKOUT__ specifies the output PLL clock to be checked.
  2769. * This parameter can be one of the following values:
  2770. * @arg @ref RCC_PLL_SAI1CLK This clock is used to generate an accurate clock to achieve high-quality audio performance on SAI interface
  2771. * @arg @ref RCC_PLL_ADCCLK same
  2772. * @arg @ref RCC_PLL_USBCLK This Clock is used to generate the clock for the USB FS (48 MHz)
  2773. * @arg @ref RCC_PLL_RNGCLK same
  2774. * @arg @ref RCC_PLL_SYSCLK This Clock is used to generate the high speed system clock (up to 64MHz)
  2775. * @retval SET / RESET
  2776. */
  2777. #define __HAL_RCC_GET_PLLCLKOUT_CONFIG(__PLLCLOCKOUT__) READ_BIT(RCC->PLLCFGR, (__PLLCLOCKOUT__))
  2778. /**
  2779. * @brief Macro to configure the system clock source.
  2780. * @param __SYSCLKSOURCE__ specifies the system clock source.
  2781. * This parameter can be one of the following values:
  2782. * @arg @ref RCC_SYSCLKSOURCE_MSI MSI oscillator is used as system clock source.
  2783. * @arg @ref RCC_SYSCLKSOURCE_HSI HSI oscillator is used as system clock source.
  2784. * @arg @ref RCC_SYSCLKSOURCE_HSE HSE oscillator is used as system clock source.
  2785. * @arg @ref RCC_SYSCLKSOURCE_PLLCLK PLL output is used as system clock source.
  2786. * @retval None
  2787. */
  2788. #define __HAL_RCC_SYSCLK_CONFIG(__SYSCLKSOURCE__) LL_RCC_SetSysClkSource(__SYSCLKSOURCE__)
  2789. /** @brief Macro to get the clock source used as system clock.
  2790. * @retval The clock source used as system clock. The returned value can be one
  2791. * of the following:
  2792. * @arg @ref RCC_SYSCLKSOURCE_STATUS_MSI MSI used as system clock.
  2793. * @arg @ref RCC_SYSCLKSOURCE_STATUS_HSI HSI used as system clock.
  2794. * @arg @ref RCC_SYSCLKSOURCE_STATUS_HSE HSE used as system clock.
  2795. * @arg @ref RCC_SYSCLKSOURCE_STATUS_PLLCLK PLL used as system clock.
  2796. */
  2797. #define __HAL_RCC_GET_SYSCLK_SOURCE() LL_RCC_GetSysClkSource()
  2798. /**
  2799. * @brief Macro to configure the External Low Speed oscillator (LSE) drive capability.
  2800. * @note As the LSE is in the Backup domain and write access is denied to
  2801. * this domain after reset, you have to enable write access using
  2802. * HAL_PWR_EnableBkUpAccess() function before to configure the LSE
  2803. * (to be done once after reset).
  2804. * @param __LSEDRIVE__ specifies the new state of the LSE drive capability.
  2805. * This parameter can be one of the following values:
  2806. * @arg @ref RCC_LSEDRIVE_LOW LSE oscillator low drive capability.
  2807. * @arg @ref RCC_LSEDRIVE_MEDIUMLOW LSE oscillator medium low drive capability.
  2808. * @arg @ref RCC_LSEDRIVE_MEDIUMHIGH LSE oscillator medium high drive capability.
  2809. * @arg @ref RCC_LSEDRIVE_HIGH LSE oscillator high drive capability.
  2810. * @retval None
  2811. */
  2812. #define __HAL_RCC_LSEDRIVE_CONFIG(__LSEDRIVE__) LL_RCC_LSE_SetDriveCapability(__LSEDRIVE__)
  2813. /**
  2814. * @brief Macro to configure the wake up from stop clock.
  2815. * @param __STOPWUCLK__ specifies the clock source used after wake up from stop.
  2816. * This parameter can be one of the following values:
  2817. * @arg @ref RCC_STOP_WAKEUPCLOCK_MSI MSI selected as system clock source
  2818. * @arg @ref RCC_STOP_WAKEUPCLOCK_HSI HSI selected as system clock source
  2819. * @retval None
  2820. */
  2821. #define __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(__STOPWUCLK__) LL_RCC_SetClkAfterWakeFromStop(__STOPWUCLK__)
  2822. /** @brief Macro to configure the MCO clock.
  2823. * @param __MCOCLKSOURCE__ specifies the MCO clock source.
  2824. * This parameter can be one of the following values:
  2825. * @arg @ref RCC_MCO1SOURCE_NOCLOCK MCO output disabled
  2826. * @arg @ref RCC_MCO1SOURCE_SYSCLK System clock selected as MCO source
  2827. * @arg @ref RCC_MCO1SOURCE_MSI MSI clock selected as MCO source
  2828. * @arg @ref RCC_MCO1SOURCE_HSI HSI clock selected as MCO source
  2829. * @arg @ref RCC_MCO1SOURCE_HSE HSE clock selected as MCO sourcee
  2830. * @arg @ref RCC_MCO1SOURCE_PLLCLK Main PLL clock selected as MCO source
  2831. * @arg @ref RCC_MCO1SOURCE_LSI1 LSI1 clock selected as MCO source
  2832. * @arg @ref RCC_MCO1SOURCE_LSI2 LSI2 clock selected as MCO source
  2833. * @arg @ref RCC_MCO1SOURCE_LSE LSE clock selected as MCO source
  2834. * @arg @ref RCC_MCO1SOURCE_HSI48 HSI48 clock selected as MCO source (*)
  2835. *
  2836. * @param __MCODIV__ specifies the MCO clock prescaler.
  2837. * This parameter can be one of the following values:
  2838. * @arg @ref RCC_MCODIV_1 MCO clock source is divided by 1
  2839. * @arg @ref RCC_MCODIV_2 MCO clock source is divided by 2
  2840. * @arg @ref RCC_MCODIV_4 MCO clock source is divided by 4
  2841. * @arg @ref RCC_MCODIV_8 MCO clock source is divided by 8
  2842. * @arg @ref RCC_MCODIV_16 MCO clock source is divided by 16
  2843. *
  2844. * @note (*) Value not defined for all devices
  2845. */
  2846. #define __HAL_RCC_MCO1_CONFIG(__MCOCLKSOURCE__, __MCODIV__) LL_RCC_ConfigMCO((__MCOCLKSOURCE__), (__MCODIV__))
  2847. /** @defgroup RCC_Flags_Interrupts_Management Flags Interrupts Management
  2848. * @brief macros to manage the specified RCC Flags and interrupts.
  2849. * @{
  2850. */
  2851. /** @brief Enable RCC interrupt.
  2852. * @param __INTERRUPT__ specifies the RCC interrupt sources to be enabled.
  2853. * This parameter can be any combination of the following values:
  2854. * @arg @ref RCC_IT_LSI1RDY LSI1 ready interrupt enable
  2855. * @arg @ref RCC_IT_LSERDY LSE ready interrupt enable
  2856. * @arg @ref RCC_IT_MSIRDY HSI ready interrupt enable
  2857. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt enable
  2858. * @arg @ref RCC_IT_HSERDY HSE ready interrupt enable
  2859. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt enable
  2860. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt enable
  2861. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt enable
  2862. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt enable (*)
  2863. * @arg @ref RCC_IT_LSI2RDY LSI2 ready interrupt enable
  2864. *
  2865. * @note (*) Value not defined for all devices
  2866. *
  2867. * @retval None
  2868. */
  2869. #define __HAL_RCC_ENABLE_IT(__INTERRUPT__) SET_BIT(RCC->CIER, (__INTERRUPT__))
  2870. /** @brief Disable RCC interrupt.
  2871. * @param __INTERRUPT__ specifies the RCC interrupt sources to be disabled.
  2872. * This parameter can be any combination of the following values:
  2873. * @arg @ref RCC_IT_LSI1RDY LSI1 ready interrupt enable
  2874. * @arg @ref RCC_IT_LSERDY LSE ready interrupt enable
  2875. * @arg @ref RCC_IT_MSIRDY HSI ready interrupt enable
  2876. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt enable
  2877. * @arg @ref RCC_IT_HSERDY HSE ready interrupt enable
  2878. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt enable
  2879. * @arg @ref RCC_IT_PLLSAI1RDY PLLSAI1 ready interrupt enable
  2880. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt enable
  2881. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt enable (*)
  2882. * @arg @ref RCC_IT_LSI2RDY LSI2 ready interrupt enable
  2883. *
  2884. * @note (*) Value not defined for all devices
  2885. *
  2886. * @retval None
  2887. */
  2888. #define __HAL_RCC_DISABLE_IT(__INTERRUPT__) CLEAR_BIT(RCC->CIER, (__INTERRUPT__))
  2889. /** @brief Clear RCC interrupt pending bits (Perform Byte access to RCC_CICR[17:0]
  2890. * bits to clear the selected interrupt pending bits.
  2891. * @param __INTERRUPT__ specifies the interrupt pending bit to clear.
  2892. * This parameter can be any combination of the following values:
  2893. * @arg @ref RCC_IT_LSI1RDY LSI1 ready interrupt clear
  2894. * @arg @ref RCC_IT_LSERDY LSE ready interrupt clear
  2895. * @arg @ref RCC_IT_MSIRDY HSI ready interrupt clear
  2896. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt clear
  2897. * @arg @ref RCC_IT_HSERDY HSE ready interrupt clear
  2898. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt clear
  2899. * @arg @ref RCC_IT_PLLRDY PLLSAI1 ready interrupt clear
  2900. * @arg @ref RCC_IT_HSECSS HSE Clock security system interrupt clear
  2901. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt clear
  2902. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt clear (*)
  2903. * @arg @ref RCC_IT_LSI2RDY LSI2 ready interrupt clear
  2904. *
  2905. * @note (*) Value not defined for all devices
  2906. */
  2907. #define __HAL_RCC_CLEAR_IT(__INTERRUPT__) (RCC->CICR = (__INTERRUPT__))
  2908. /** @brief Check whether the RCC interrupt has occurred or not.
  2909. * @param __INTERRUPT__ specifies the RCC interrupt source to check.
  2910. * This parameter can be one of the following values:
  2911. * @arg @ref RCC_IT_LSI1RDY LSI1 ready interrupt flag
  2912. * @arg @ref RCC_IT_LSERDY LSE ready interrupt flag
  2913. * @arg @ref RCC_IT_MSIRDY HSI ready interrupt flag
  2914. * @arg @ref RCC_IT_HSIRDY HSI ready interrupt flag
  2915. * @arg @ref RCC_IT_HSERDY HSE ready interrupt flag
  2916. * @arg @ref RCC_IT_PLLRDY Main PLL ready interrupt flag
  2917. * @arg @ref RCC_IT_PLLRDY PLLSAI1 ready interrupt flag
  2918. * @arg @ref RCC_IT_HSECSS HSE Clock security system interrupt flag
  2919. * @arg @ref RCC_IT_LSECSS LSE Clock security system interrupt flag
  2920. * @arg @ref RCC_IT_HSI48RDY HSI48 ready interrupt flag (*)
  2921. * @arg @ref RCC_IT_LSI2RDY LSI2 ready interrupt flag
  2922. *
  2923. * @note (*) Value not defined for all devices
  2924. *
  2925. * @retval The new state of __INTERRUPT__ (TRUE or FALSE).
  2926. */
  2927. #define __HAL_RCC_GET_IT(__INTERRUPT__) ((RCC->CIFR & (__INTERRUPT__)) == (__INTERRUPT__))
  2928. /** @brief Set RMVF bit to clear the reset flags.
  2929. * The reset flags are: RCC_FLAG_OBLRST, RCC_FLAG_PINRST, RCC_FLAG_BORRST,
  2930. * RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST and RCC_FLAG_LPWRRST.
  2931. * @retval None
  2932. */
  2933. #define __HAL_RCC_CLEAR_RESET_FLAGS() LL_RCC_ClearResetFlags()
  2934. /** @brief Check whether the selected RCC flag is set or not.
  2935. * @param __FLAG__ specifies the flag to check.
  2936. * This parameter can be one of the following values:
  2937. * @arg @ref RCC_FLAG_MSIRDY MSI oscillator clock ready
  2938. * @arg @ref RCC_FLAG_HSIRDY HSI oscillator clock ready
  2939. * @arg @ref RCC_FLAG_HSERDY HSE oscillator clock ready
  2940. * @arg @ref RCC_FLAG_PLLRDY Main PLL clock ready
  2941. * @arg @ref RCC_FLAG_PLLRDY PLLSAI1 clock ready
  2942. * @arg @ref RCC_FLAG_HSI48RDY HSI48 clock ready for devices with HSI48 (*)
  2943. * @arg @ref RCC_FLAG_LSERDY LSE oscillator clock ready
  2944. * @arg @ref RCC_FLAG_LSECSSD Clock security system failure on LSE oscillator detection
  2945. * @arg @ref RCC_FLAG_LSI1RDY LSI1 oscillator clock ready
  2946. * @arg @ref RCC_FLAG_LSI2RDY LSI2 oscillator clock ready
  2947. * @arg @ref RCC_FLAG_BORRST BOR reset
  2948. * @arg @ref RCC_FLAG_OBLRST OBLRST reset
  2949. * @arg @ref RCC_FLAG_PINRST Pin reset
  2950. * @arg @ref RCC_FLAG_SFTRST Software reset
  2951. * @arg @ref RCC_FLAG_IWDGRST Independent Watchdog reset
  2952. * @arg @ref RCC_FLAG_WWDGRST Window Watchdog reset
  2953. * @arg @ref RCC_FLAG_LPWRRST Low Power reset
  2954. *
  2955. * @note (*) Value not defined for all devices
  2956. *
  2957. * @retval The new state of __FLAG__ (TRUE or FALSE).
  2958. */
  2959. #define __HAL_RCC_GET_FLAG(__FLAG__) (((((((__FLAG__) >> 5U) == CR_REG_INDEX) ? RCC->CR : \
  2960. ((((__FLAG__) >> 5U) == CRRCR_REG_INDEX) ? RCC->CRRCR : \
  2961. ((((__FLAG__) >> 5U) == BDCR_REG_INDEX) ? RCC->BDCR : \
  2962. ((((__FLAG__) >> 5U) == CSR_REG_INDEX) ? RCC->CSR : RCC->CIFR)))) & \
  2963. (1U << ((__FLAG__) & RCC_FLAG_MASK))) != RESET) \
  2964. ? 1U : 0U)
  2965. /**
  2966. * @}
  2967. */
  2968. /**
  2969. * @}
  2970. */
  2971. /* Include RCC HAL Extended module */
  2972. #include "stm32wbxx_hal_rcc_ex.h"
  2973. /* Exported functions --------------------------------------------------------*/
  2974. /** @addtogroup RCC_Exported_Functions
  2975. * @{
  2976. */
  2977. /** @addtogroup RCC_Exported_Functions_Group1
  2978. * @{
  2979. */
  2980. /* Initialization and de-initialization functions ******************************/
  2981. HAL_StatusTypeDef HAL_RCC_DeInit(void);
  2982. HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
  2983. HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency);
  2984. /**
  2985. * @}
  2986. */
  2987. /** @addtogroup RCC_Exported_Functions_Group2
  2988. * @{
  2989. */
  2990. /* Peripheral Control functions ************************************************/
  2991. void HAL_RCC_MCOConfig(uint32_t RCC_MCOx, uint32_t RCC_MCOSource, uint32_t RCC_MCODiv);
  2992. void HAL_RCC_EnableCSS(void);
  2993. uint32_t HAL_RCC_GetSysClockFreq(void);
  2994. uint32_t HAL_RCC_GetHCLKFreq(void);
  2995. uint32_t HAL_RCC_GetHCLK2Freq(void);
  2996. uint32_t HAL_RCC_GetHCLK4Freq(void);
  2997. uint32_t HAL_RCC_GetPCLK1Freq(void);
  2998. uint32_t HAL_RCC_GetPCLK2Freq(void);
  2999. void HAL_RCC_GetOscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct);
  3000. void HAL_RCC_GetClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t *pFLatency);
  3001. /* LSE & HSE CSS NMI IRQ handler */
  3002. void HAL_RCC_NMI_IRQHandler(void);
  3003. /* User Callbacks in non blocking mode (IT mode) */
  3004. void HAL_RCC_CSSCallback(void);
  3005. /**
  3006. * @}
  3007. */
  3008. /**
  3009. * @}
  3010. */
  3011. /**
  3012. * @}
  3013. */
  3014. /**
  3015. * @}
  3016. */
  3017. #ifdef __cplusplus
  3018. }
  3019. #endif
  3020. #endif /* STM32WBxx_HAL_RCC_H */
  3021. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/