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.
 
 
 

2699 lines
162 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_hal_rcc_ex.h
  4. * @author MCD Application Team
  5. * @version V1.0.1
  6. * @date 25-June-2015
  7. * @brief Header file of RCC HAL Extension module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32F7xx_HAL_RCC_EX_H
  39. #define __STM32F7xx_HAL_RCC_EX_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f7xx_hal_def.h"
  45. /** @addtogroup STM32F7xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup RCCEx
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup RCCEx_Exported_Types RCCEx Exported Types
  53. * @{
  54. */
  55. /**
  56. * @brief PLLI2S Clock structure definition
  57. */
  58. typedef struct
  59. {
  60. uint32_t PLLI2SN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  61. This parameter must be a number between Min_Data = 49 and Max_Data = 432.
  62. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  63. uint32_t PLLI2SR; /*!< Specifies the division factor for I2S clock.
  64. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  65. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  66. uint32_t PLLI2SQ; /*!< Specifies the division factor for SAI1 clock.
  67. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  68. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  69. uint32_t PLLI2SP; /*!< Specifies the division factor for SPDIF-RX clock.
  70. This parameter must be a number between 0 and 3 for respective values 2, 4, 6 and 8.
  71. This parameter will be used only when PLLI2S is selected as Clock Source SPDDIF-RX */
  72. }RCC_PLLI2SInitTypeDef;
  73. /**
  74. * @brief PLLSAI Clock structure definition
  75. */
  76. typedef struct
  77. {
  78. uint32_t PLLSAIN; /*!< Specifies the multiplication factor for PLLI2S VCO output clock.
  79. This parameter must be a number between Min_Data = 49 and Max_Data = 432.
  80. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  81. uint32_t PLLSAIQ; /*!< Specifies the division factor for SAI1 clock.
  82. This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  83. This parameter will be used only when PLLSAI is selected as Clock Source SAI or LTDC */
  84. uint32_t PLLSAIR; /*!< specifies the division factor for LTDC clock
  85. This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  86. This parameter will be used only when PLLSAI is selected as Clock Source LTDC */
  87. uint32_t PLLSAIP; /*!< Specifies the division factor for 48MHz clock.
  88. This parameter can be a value of @ref RCCEx_PLLSAIP_Clock_Divider
  89. This parameter will be used only when PLLSAI is disabled */
  90. }RCC_PLLSAIInitTypeDef;
  91. /**
  92. * @brief RCC extended clocks structure definition
  93. */
  94. typedef struct
  95. {
  96. uint32_t PeriphClockSelection; /*!< The Extended Clock to be configured.
  97. This parameter can be a value of @ref RCCEx_Periph_Clock_Selection */
  98. RCC_PLLI2SInitTypeDef PLLI2S; /*!< PLL I2S structure parameters.
  99. This parameter will be used only when PLLI2S is selected as Clock Source I2S or SAI */
  100. RCC_PLLSAIInitTypeDef PLLSAI; /*!< PLL SAI structure parameters.
  101. This parameter will be used only when PLLI2S is selected as Clock Source SAI or LTDC */
  102. uint32_t PLLI2SDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  103. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  104. This parameter will be used only when PLLI2S is selected as Clock Source SAI */
  105. uint32_t PLLSAIDivQ; /*!< Specifies the PLLI2S division factor for SAI1 clock.
  106. This parameter must be a number between Min_Data = 1 and Max_Data = 32
  107. This parameter will be used only when PLLSAI is selected as Clock Source SAI */
  108. uint32_t PLLSAIDivR; /*!< Specifies the PLLSAI division factor for LTDC clock.
  109. This parameter must be one value of @ref RCCEx_PLLSAI_DIVR */
  110. uint32_t RTCClockSelection; /*!< Specifies RTC Clock source Selection.
  111. This parameter can be a value of @ref RCC_RTC_Clock_Source */
  112. uint32_t I2sClockSelection; /*!< Specifies I2S Clock source Selection.
  113. This parameter can be a value of @ref RCCEx_I2S_Clock_Source */
  114. uint32_t TIMPresSelection; /*!< Specifies TIM Clock Prescalers Selection.
  115. This parameter can be a value of @ref RCCEx_TIM_Prescaler_Selection */
  116. uint32_t Sai1ClockSelection; /*!< Specifies SAI1 Clock Prescalers Selection
  117. This parameter can be a value of @ref RCCEx_SAI1_Clock_Source */
  118. uint32_t Sai2ClockSelection; /*!< Specifies SAI2 Clock Prescalers Selection
  119. This parameter can be a value of @ref RCCEx_SAI2_Clock_Source */
  120. uint32_t Usart1ClockSelection; /*!< USART1 clock source
  121. This parameter can be a value of @ref RCCEx_USART1_Clock_Source */
  122. uint32_t Usart2ClockSelection; /*!< USART2 clock source
  123. This parameter can be a value of @ref RCCEx_USART2_Clock_Source */
  124. uint32_t Usart3ClockSelection; /*!< USART3 clock source
  125. This parameter can be a value of @ref RCCEx_USART3_Clock_Source */
  126. uint32_t Uart4ClockSelection; /*!< UART4 clock source
  127. This parameter can be a value of @ref RCCEx_UART4_Clock_Source */
  128. uint32_t Uart5ClockSelection; /*!< UART5 clock source
  129. This parameter can be a value of @ref RCCEx_UART5_Clock_Source */
  130. uint32_t Usart6ClockSelection; /*!< USART6 clock source
  131. This parameter can be a value of @ref RCCEx_USART6_Clock_Source */
  132. uint32_t Uart7ClockSelection; /*!< UART7 clock source
  133. This parameter can be a value of @ref RCCEx_UART7_Clock_Source */
  134. uint32_t Uart8ClockSelection; /*!< UART8 clock source
  135. This parameter can be a value of @ref RCCEx_UART8_Clock_Source */
  136. uint32_t I2c1ClockSelection; /*!< I2C1 clock source
  137. This parameter can be a value of @ref RCCEx_I2C1_Clock_Source */
  138. uint32_t I2c2ClockSelection; /*!< I2C2 clock source
  139. This parameter can be a value of @ref RCCEx_I2C2_Clock_Source */
  140. uint32_t I2c3ClockSelection; /*!< I2C3 clock source
  141. This parameter can be a value of @ref RCCEx_I2C3_Clock_Source */
  142. uint32_t I2c4ClockSelection; /*!< I2C4 clock source
  143. This parameter can be a value of @ref RCCEx_I2C4_Clock_Source */
  144. uint32_t Lptim1ClockSelection; /*!< Specifies LPTIM1 clock source
  145. This parameter can be a value of @ref RCCEx_LPTIM1_Clock_Source */
  146. uint32_t CecClockSelection; /*!< CEC clock source
  147. This parameter can be a value of @ref RCCEx_CEC_Clock_Source */
  148. uint32_t Clk48ClockSelection; /*!< Specifies 48Mhz clock source used by USB OTG FS, RNG and SDMMC
  149. This parameter can be a value of @ref RCCEx_CLK48_Clock_Source */
  150. uint32_t Sdmmc1ClockSelection; /*!< SDMMC1 clock source
  151. This parameter can be a value of @ref RCCEx_SDMMC1_Clock_Source */
  152. }RCC_PeriphCLKInitTypeDef;
  153. /**
  154. * @}
  155. */
  156. /* Exported constants --------------------------------------------------------*/
  157. /** @defgroup RCCEx_Exported_Constants RCCEx Exported Constants
  158. * @{
  159. */
  160. /** @defgroup RCCEx_Periph_Clock_Selection RCC Periph Clock Selection
  161. * @{
  162. */
  163. #define RCC_PERIPHCLK_I2S ((uint32_t)0x00000001)
  164. #if defined(STM32F756xx) || defined(STM32F746xx)
  165. #define RCC_PERIPHCLK_LTDC ((uint32_t)0x00000008)
  166. #endif /* STM32F756xx || STM32F746xx */
  167. #define RCC_PERIPHCLK_TIM ((uint32_t)0x00000010)
  168. #define RCC_PERIPHCLK_RTC ((uint32_t)0x00000020)
  169. #define RCC_PERIPHCLK_USART1 ((uint32_t)0x00000040)
  170. #define RCC_PERIPHCLK_USART2 ((uint32_t)0x00000080)
  171. #define RCC_PERIPHCLK_USART3 ((uint32_t)0x00000100)
  172. #define RCC_PERIPHCLK_UART4 ((uint32_t)0x00000200)
  173. #define RCC_PERIPHCLK_UART5 ((uint32_t)0x00000400)
  174. #define RCC_PERIPHCLK_USART6 ((uint32_t)0x00000800)
  175. #define RCC_PERIPHCLK_UART7 ((uint32_t)0x00001000)
  176. #define RCC_PERIPHCLK_UART8 ((uint32_t)0x00002000)
  177. #define RCC_PERIPHCLK_I2C1 ((uint32_t)0x00004000)
  178. #define RCC_PERIPHCLK_I2C2 ((uint32_t)0x00008000)
  179. #define RCC_PERIPHCLK_I2C3 ((uint32_t)0x00010000)
  180. #define RCC_PERIPHCLK_I2C4 ((uint32_t)0x00020000)
  181. #define RCC_PERIPHCLK_LPTIM1 ((uint32_t)0x00040000)
  182. #define RCC_PERIPHCLK_SAI1 ((uint32_t)0x00080000)
  183. #define RCC_PERIPHCLK_SAI2 ((uint32_t)0x00100000)
  184. #define RCC_PERIPHCLK_CLK48 ((uint32_t)0x00200000)
  185. #define RCC_PERIPHCLK_CEC ((uint32_t)0x00400000)
  186. #define RCC_PERIPHCLK_SDMMC1 ((uint32_t)0x00800000)
  187. #define RCC_PERIPHCLK_SPDIFRX ((uint32_t)0x01000000)
  188. #define RCC_PERIPHCLK_PLLI2S ((uint32_t)0x02000000)
  189. /**
  190. * @}
  191. */
  192. /** @defgroup RCCEx_PLLSAIP_Clock_Divider RCCEx PLLSAIP Clock Divider
  193. * @{
  194. */
  195. #define RCC_PLLSAIP_DIV2 ((uint32_t)0x00000000)
  196. #define RCC_PLLSAIP_DIV4 ((uint32_t)0x00000001)
  197. #define RCC_PLLSAIP_DIV6 ((uint32_t)0x00000002)
  198. #define RCC_PLLSAIP_DIV8 ((uint32_t)0x00000003)
  199. /**
  200. * @}
  201. */
  202. /** @defgroup RCCEx_PLLSAI_DIVR RCCEx PLLSAI DIVR
  203. * @{
  204. */
  205. #define RCC_PLLSAIDIVR_2 ((uint32_t)0x00000000)
  206. #define RCC_PLLSAIDIVR_4 RCC_DCKCFGR1_PLLSAIDIVR_0
  207. #define RCC_PLLSAIDIVR_8 RCC_DCKCFGR1_PLLSAIDIVR_1
  208. #define RCC_PLLSAIDIVR_16 RCC_DCKCFGR1_PLLSAIDIVR
  209. /**
  210. * @}
  211. */
  212. /** @defgroup RCCEx_I2S_Clock_Source RCCEx I2S Clock Source
  213. * @{
  214. */
  215. #define RCC_I2SCLKSOURCE_PLLI2S ((uint32_t)0x00000000)
  216. #define RCC_I2SCLKSOURCE_EXT RCC_CFGR_I2SSRC
  217. /**
  218. * @}
  219. */
  220. /** @defgroup RCCEx_SAI1_Clock_Source RCCEx SAI1 Clock Source
  221. * @{
  222. */
  223. #define RCC_SAI1CLKSOURCE_PLLSAI ((uint32_t)0x00000000)
  224. #define RCC_SAI1CLKSOURCE_PLLI2S RCC_DCKCFGR1_SAI1SEL_0
  225. #define RCC_SAI1CLKSOURCE_PIN RCC_DCKCFGR1_SAI1SEL_1
  226. /**
  227. * @}
  228. */
  229. /** @defgroup RCCEx_SAI2_Clock_Source RCCEx SAI2 Clock Source
  230. * @{
  231. */
  232. #define RCC_SAI2CLKSOURCE_PLLSAI ((uint32_t)0x00000000)
  233. #define RCC_SAI2CLKSOURCE_PLLI2S RCC_DCKCFGR1_SAI2SEL_0
  234. #define RCC_SAI2CLKSOURCE_PIN RCC_DCKCFGR1_SAI2SEL_1
  235. /**
  236. * @}
  237. */
  238. /** @defgroup RCCEx_SDMMC1_Clock_Source RCCEx SDMMC1 Clock Source
  239. * @{
  240. */
  241. #define RCC_SDMMC1CLKSOURCE_CLK48 ((uint32_t)0x00000000)
  242. #define RCC_SDMMC1CLKSOURCE_SYSCLK RCC_DCKCFGR2_SDMMC1SEL
  243. /**
  244. * @}
  245. */
  246. /** @defgroup RCCEx_CEC_Clock_Source RCCEx CEC Clock Source
  247. * @{
  248. */
  249. #define RCC_CECCLKSOURCE_LSE ((uint32_t)0x00000000)
  250. #define RCC_CECCLKSOURCE_HSI RCC_DCKCFGR2_CECSEL /* CEC clock is HSI/488*/
  251. /**
  252. * @}
  253. */
  254. /** @defgroup RCCEx_USART1_Clock_Source RCCEx USART1 Clock Source
  255. * @{
  256. */
  257. #define RCC_USART1CLKSOURCE_PCLK2 ((uint32_t)0x00000000)
  258. #define RCC_USART1CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART1SEL_0
  259. #define RCC_USART1CLKSOURCE_HSI RCC_DCKCFGR2_USART1SEL_1
  260. #define RCC_USART1CLKSOURCE_LSE RCC_DCKCFGR2_USART1SEL
  261. /**
  262. * @}
  263. */
  264. /** @defgroup RCCEx_USART2_Clock_Source RCCEx USART2 Clock Source
  265. * @{
  266. */
  267. #define RCC_USART2CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  268. #define RCC_USART2CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART2SEL_0
  269. #define RCC_USART2CLKSOURCE_HSI RCC_DCKCFGR2_USART2SEL_1
  270. #define RCC_USART2CLKSOURCE_LSE RCC_DCKCFGR2_USART2SEL
  271. /**
  272. * @}
  273. */
  274. /** @defgroup RCCEx_USART3_Clock_Source RCCEx USART3 Clock Source
  275. * @{
  276. */
  277. #define RCC_USART3CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  278. #define RCC_USART3CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART3SEL_0
  279. #define RCC_USART3CLKSOURCE_HSI RCC_DCKCFGR2_USART3SEL_1
  280. #define RCC_USART3CLKSOURCE_LSE RCC_DCKCFGR2_USART3SEL
  281. /**
  282. * @}
  283. */
  284. /** @defgroup RCCEx_UART4_Clock_Source RCCEx UART4 Clock Source
  285. * @{
  286. */
  287. #define RCC_UART4CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  288. #define RCC_UART4CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART4SEL_0
  289. #define RCC_UART4CLKSOURCE_HSI RCC_DCKCFGR2_UART4SEL_1
  290. #define RCC_UART4CLKSOURCE_LSE RCC_DCKCFGR2_UART4SEL
  291. /**
  292. * @}
  293. */
  294. /** @defgroup RCCEx_UART5_Clock_Source RCCEx UART5 Clock Source
  295. * @{
  296. */
  297. #define RCC_UART5CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  298. #define RCC_UART5CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART5SEL_0
  299. #define RCC_UART5CLKSOURCE_HSI RCC_DCKCFGR2_UART5SEL_1
  300. #define RCC_UART5CLKSOURCE_LSE RCC_DCKCFGR2_UART5SEL
  301. /**
  302. * @}
  303. */
  304. /** @defgroup RCCEx_USART6_Clock_Source RCCEx USART6 Clock Source
  305. * @{
  306. */
  307. #define RCC_USART6CLKSOURCE_PCLK2 ((uint32_t)0x00000000)
  308. #define RCC_USART6CLKSOURCE_SYSCLK RCC_DCKCFGR2_USART6SEL_0
  309. #define RCC_USART6CLKSOURCE_HSI RCC_DCKCFGR2_USART6SEL_1
  310. #define RCC_USART6CLKSOURCE_LSE RCC_DCKCFGR2_USART6SEL
  311. /**
  312. * @}
  313. */
  314. /** @defgroup RCCEx_UART7_Clock_Source RCCEx UART7 Clock Source
  315. * @{
  316. */
  317. #define RCC_UART7CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  318. #define RCC_UART7CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART7SEL_0
  319. #define RCC_UART7CLKSOURCE_HSI RCC_DCKCFGR2_UART7SEL_1
  320. #define RCC_UART7CLKSOURCE_LSE RCC_DCKCFGR2_UART7SEL
  321. /**
  322. * @}
  323. */
  324. /** @defgroup RCCEx_UART8_Clock_Source RCCEx UART8 Clock Source
  325. * @{
  326. */
  327. #define RCC_UART8CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  328. #define RCC_UART8CLKSOURCE_SYSCLK RCC_DCKCFGR2_UART8SEL_0
  329. #define RCC_UART8CLKSOURCE_HSI RCC_DCKCFGR2_UART8SEL_1
  330. #define RCC_UART8CLKSOURCE_LSE RCC_DCKCFGR2_UART8SEL
  331. /**
  332. * @}
  333. */
  334. /** @defgroup RCCEx_I2C1_Clock_Source RCCEx I2C1 Clock Source
  335. * @{
  336. */
  337. #define RCC_I2C1CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  338. #define RCC_I2C1CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C1SEL_0
  339. #define RCC_I2C1CLKSOURCE_HSI RCC_DCKCFGR2_I2C1SEL_1
  340. /**
  341. * @}
  342. */
  343. /** @defgroup RCCEx_I2C2_Clock_Source RCCEx I2C2 Clock Source
  344. * @{
  345. */
  346. #define RCC_I2C2CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  347. #define RCC_I2C2CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C2SEL_0
  348. #define RCC_I2C2CLKSOURCE_HSI RCC_DCKCFGR2_I2C2SEL_1
  349. /**
  350. * @}
  351. */
  352. /** @defgroup RCCEx_I2C3_Clock_Source RCCEx I2C3 Clock Source
  353. * @{
  354. */
  355. #define RCC_I2C3CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  356. #define RCC_I2C3CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C3SEL_0
  357. #define RCC_I2C3CLKSOURCE_HSI RCC_DCKCFGR2_I2C3SEL_1
  358. /**
  359. * @}
  360. */
  361. /** @defgroup RCCEx_I2C4_Clock_Source RCCEx I2C4 Clock Source
  362. * @{
  363. */
  364. #define RCC_I2C4CLKSOURCE_PCLK1 ((uint32_t)0x00000000)
  365. #define RCC_I2C4CLKSOURCE_SYSCLK RCC_DCKCFGR2_I2C4SEL_0
  366. #define RCC_I2C4CLKSOURCE_HSI RCC_DCKCFGR2_I2C4SEL_1
  367. /**
  368. * @}
  369. */
  370. /** @defgroup RCCEx_LPTIM1_Clock_Source RCCEx LPTIM1 Clock Source
  371. * @{
  372. */
  373. #define RCC_LPTIM1CLKSOURCE_PCLK ((uint32_t)0x00000000)
  374. #define RCC_LPTIM1CLKSOURCE_LSI RCC_DCKCFGR2_LPTIM1SEL_0
  375. #define RCC_LPTIM1CLKSOURCE_HSI RCC_DCKCFGR2_LPTIM1SEL_1
  376. #define RCC_LPTIM1CLKSOURCE_LSE RCC_DCKCFGR2_LPTIM1SEL
  377. /**
  378. * @}
  379. */
  380. /** @defgroup RCCEx_CLK48_Clock_Source RCCEx CLK48 Clock Source
  381. * @{
  382. */
  383. #define RCC_CLK48SOURCE_PLL ((uint32_t)0x00000000)
  384. #define RCC_CLK48SOURCE_PLLSAIP RCC_DCKCFGR2_CK48MSEL
  385. /**
  386. * @}
  387. */
  388. /** @defgroup RCCEx_TIM_Prescaler_Selection RCCEx TIM Prescaler Selection
  389. * @{
  390. */
  391. #define RCC_TIMPRES_DESACTIVATED ((uint32_t)0x00000000)
  392. #define RCC_TIMPRES_ACTIVATED RCC_DCKCFGR1_TIMPRE
  393. /**
  394. * @}
  395. */
  396. /**
  397. * @}
  398. */
  399. /* Exported macro ------------------------------------------------------------*/
  400. /** @defgroup RCCEx_Exported_Macros RCCEx Exported Macros
  401. * @{
  402. */
  403. /** @defgroup RCCEx_Peripheral_Clock_Enable_Disable RCCEx_Peripheral_Clock_Enable_Disable
  404. * @brief Enables or disables the AHB/APB peripheral clock.
  405. * @note After reset, the peripheral clock (used for registers read/write access)
  406. * is disabled and the application software has to enable this clock before
  407. * using it.
  408. * @{
  409. */
  410. /** @brief Enables or disables the AHB1 peripheral clock.
  411. * @note After reset, the peripheral clock (used for registers read/write access)
  412. * is disabled and the application software has to enable this clock before
  413. * using it.
  414. */
  415. #define __HAL_RCC_BKPSRAM_CLK_ENABLE() do { \
  416. __IO uint32_t tmpreg; \
  417. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  418. /* Delay after an RCC peripheral clock enabling */ \
  419. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_BKPSRAMEN);\
  420. UNUSED(tmpreg); \
  421. } while(0)
  422. #define __HAL_RCC_DTCMRAMEN_CLK_ENABLE() do { \
  423. __IO uint32_t tmpreg; \
  424. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DTCMRAMEN);\
  425. /* Delay after an RCC peripheral clock enabling */ \
  426. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DTCMRAMEN);\
  427. UNUSED(tmpreg); \
  428. } while(0)
  429. #define __HAL_RCC_DMA2_CLK_ENABLE() do { \
  430. __IO uint32_t tmpreg; \
  431. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\
  432. /* Delay after an RCC peripheral clock enabling */ \
  433. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2EN);\
  434. UNUSED(tmpreg); \
  435. } while(0)
  436. #define __HAL_RCC_DMA2D_CLK_ENABLE() do { \
  437. __IO uint32_t tmpreg; \
  438. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  439. /* Delay after an RCC peripheral clock enabling */ \
  440. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_DMA2DEN);\
  441. UNUSED(tmpreg); \
  442. } while(0)
  443. #define __HAL_RCC_USB_OTG_HS_CLK_ENABLE() do { \
  444. __IO uint32_t tmpreg; \
  445. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  446. /* Delay after an RCC peripheral clock enabling */ \
  447. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSEN);\
  448. UNUSED(tmpreg); \
  449. } while(0)
  450. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_ENABLE() do { \
  451. __IO uint32_t tmpreg; \
  452. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  453. /* Delay after an RCC peripheral clock enabling */ \
  454. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_OTGHSULPIEN);\
  455. UNUSED(tmpreg); \
  456. } while(0)
  457. #define __HAL_RCC_GPIOA_CLK_ENABLE() do { \
  458. __IO uint32_t tmpreg; \
  459. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\
  460. /* Delay after an RCC peripheral clock enabling */ \
  461. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\
  462. UNUSED(tmpreg); \
  463. } while(0)
  464. #define __HAL_RCC_GPIOB_CLK_ENABLE() do { \
  465. __IO uint32_t tmpreg; \
  466. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOBEN);\
  467. /* Delay after an RCC peripheral clock enabling */ \
  468. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOBEN);\
  469. UNUSED(tmpreg); \
  470. } while(0)
  471. #define __HAL_RCC_GPIOC_CLK_ENABLE() do { \
  472. __IO uint32_t tmpreg; \
  473. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);\
  474. /* Delay after an RCC peripheral clock enabling */ \
  475. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);\
  476. UNUSED(tmpreg); \
  477. } while(0)
  478. #define __HAL_RCC_GPIOD_CLK_ENABLE() do { \
  479. __IO uint32_t tmpreg; \
  480. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  481. /* Delay after an RCC peripheral clock enabling */ \
  482. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);\
  483. UNUSED(tmpreg); \
  484. } while(0)
  485. #define __HAL_RCC_GPIOE_CLK_ENABLE() do { \
  486. __IO uint32_t tmpreg; \
  487. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  488. /* Delay after an RCC peripheral clock enabling */ \
  489. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOEEN);\
  490. UNUSED(tmpreg); \
  491. } while(0)
  492. #define __HAL_RCC_GPIOF_CLK_ENABLE() do { \
  493. __IO uint32_t tmpreg; \
  494. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  495. /* Delay after an RCC peripheral clock enabling */ \
  496. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOFEN);\
  497. UNUSED(tmpreg); \
  498. } while(0)
  499. #define __HAL_RCC_GPIOG_CLK_ENABLE() do { \
  500. __IO uint32_t tmpreg; \
  501. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  502. /* Delay after an RCC peripheral clock enabling */ \
  503. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOGEN);\
  504. UNUSED(tmpreg); \
  505. } while(0)
  506. #define __HAL_RCC_GPIOH_CLK_ENABLE() do { \
  507. __IO uint32_t tmpreg; \
  508. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOHEN);\
  509. /* Delay after an RCC peripheral clock enabling */ \
  510. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOHEN);\
  511. UNUSED(tmpreg); \
  512. } while(0)
  513. #define __HAL_RCC_GPIOI_CLK_ENABLE() do { \
  514. __IO uint32_t tmpreg; \
  515. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  516. /* Delay after an RCC peripheral clock enabling */ \
  517. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOIEN);\
  518. UNUSED(tmpreg); \
  519. } while(0)
  520. #define __HAL_RCC_GPIOJ_CLK_ENABLE() do { \
  521. __IO uint32_t tmpreg; \
  522. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  523. /* Delay after an RCC peripheral clock enabling */ \
  524. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOJEN);\
  525. UNUSED(tmpreg); \
  526. } while(0)
  527. #define __HAL_RCC_GPIOK_CLK_ENABLE() do { \
  528. __IO uint32_t tmpreg; \
  529. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  530. /* Delay after an RCC peripheral clock enabling */ \
  531. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOKEN);\
  532. UNUSED(tmpreg); \
  533. } while(0)
  534. #define __HAL_RCC_BKPSRAM_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_BKPSRAMEN))
  535. #define __HAL_RCC_DTCMRAMEN_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DTCMRAMEN))
  536. #define __HAL_RCC_DMA2_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2EN))
  537. #define __HAL_RCC_DMA2D_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_DMA2DEN))
  538. #define __HAL_RCC_USB_OTG_HS_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSEN))
  539. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_OTGHSULPIEN))
  540. #define __HAL_RCC_GPIOA_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOAEN))
  541. #define __HAL_RCC_GPIOB_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOBEN))
  542. #define __HAL_RCC_GPIOC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOCEN))
  543. #define __HAL_RCC_GPIOD_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIODEN))
  544. #define __HAL_RCC_GPIOE_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOEEN))
  545. #define __HAL_RCC_GPIOF_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOFEN))
  546. #define __HAL_RCC_GPIOG_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOGEN))
  547. #define __HAL_RCC_GPIOH_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOHEN))
  548. #define __HAL_RCC_GPIOI_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOIEN))
  549. #define __HAL_RCC_GPIOJ_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOJEN))
  550. #define __HAL_RCC_GPIOK_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_GPIOKEN))
  551. /**
  552. * @brief Enable ETHERNET clock.
  553. */
  554. #define __HAL_RCC_ETHMAC_CLK_ENABLE() do { \
  555. __IO uint32_t tmpreg; \
  556. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  557. /* Delay after an RCC peripheral clock enabling */ \
  558. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACEN);\
  559. UNUSED(tmpreg); \
  560. } while(0)
  561. #define __HAL_RCC_ETHMACTX_CLK_ENABLE() do { \
  562. __IO uint32_t tmpreg; \
  563. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  564. /* Delay after an RCC peripheral clock enabling */ \
  565. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACTXEN);\
  566. UNUSED(tmpreg); \
  567. } while(0)
  568. #define __HAL_RCC_ETHMACRX_CLK_ENABLE() do { \
  569. __IO uint32_t tmpreg; \
  570. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  571. /* Delay after an RCC peripheral clock enabling */ \
  572. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACRXEN);\
  573. UNUSED(tmpreg); \
  574. } while(0)
  575. #define __HAL_RCC_ETHMACPTP_CLK_ENABLE() do { \
  576. __IO uint32_t tmpreg; \
  577. SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  578. /* Delay after an RCC peripheral clock enabling */ \
  579. tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_ETHMACPTPEN);\
  580. UNUSED(tmpreg); \
  581. } while(0)
  582. #define __HAL_RCC_ETH_CLK_ENABLE() do { \
  583. __HAL_RCC_ETHMAC_CLK_ENABLE(); \
  584. __HAL_RCC_ETHMACTX_CLK_ENABLE(); \
  585. __HAL_RCC_ETHMACRX_CLK_ENABLE(); \
  586. } while(0)
  587. /**
  588. * @brief Disable ETHERNET clock.
  589. */
  590. #define __HAL_RCC_ETHMAC_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACEN))
  591. #define __HAL_RCC_ETHMACTX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACTXEN))
  592. #define __HAL_RCC_ETHMACRX_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACRXEN))
  593. #define __HAL_RCC_ETHMACPTP_CLK_DISABLE() (RCC->AHB1ENR &= ~(RCC_AHB1ENR_ETHMACPTPEN))
  594. #define __HAL_RCC_ETH_CLK_DISABLE() do { \
  595. __HAL_RCC_ETHMACTX_CLK_DISABLE(); \
  596. __HAL_RCC_ETHMACRX_CLK_DISABLE(); \
  597. __HAL_RCC_ETHMAC_CLK_DISABLE(); \
  598. } while(0)
  599. /** @brief Enable or disable the AHB2 peripheral clock.
  600. * @note After reset, the peripheral clock (used for registers read/write access)
  601. * is disabled and the application software has to enable this clock before
  602. * using it.
  603. */
  604. #define __HAL_RCC_DCMI_CLK_ENABLE() do { \
  605. __IO uint32_t tmpreg; \
  606. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  607. /* Delay after an RCC peripheral clock enabling */ \
  608. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_DCMIEN);\
  609. UNUSED(tmpreg); \
  610. } while(0)
  611. #define __HAL_RCC_RNG_CLK_ENABLE() do { \
  612. __IO uint32_t tmpreg; \
  613. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  614. /* Delay after an RCC peripheral clock enabling */ \
  615. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_RNGEN);\
  616. UNUSED(tmpreg); \
  617. } while(0)
  618. #define __HAL_RCC_USB_OTG_FS_CLK_ENABLE() do { \
  619. __IO uint32_t tmpreg; \
  620. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);\
  621. /* Delay after an RCC peripheral clock enabling */ \
  622. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);\
  623. UNUSED(tmpreg); \
  624. __HAL_RCC_SYSCFG_CLK_ENABLE();\
  625. } while(0)
  626. #define __HAL_RCC_DCMI_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_DCMIEN))
  627. #define __HAL_RCC_RNG_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_RNGEN))
  628. #define __HAL_RCC_USB_OTG_FS_CLK_DISABLE() do { (RCC->AHB2ENR &= ~(RCC_AHB2ENR_OTGFSEN));\
  629. __HAL_RCC_SYSCFG_CLK_DISABLE();\
  630. }while(0)
  631. #if defined(STM32F756xx)
  632. #define __HAL_RCC_CRYP_CLK_ENABLE() do { \
  633. __IO uint32_t tmpreg; \
  634. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  635. /* Delay after an RCC peripheral clock enabling */ \
  636. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_CRYPEN);\
  637. UNUSED(tmpreg); \
  638. } while(0)
  639. #define __HAL_RCC_HASH_CLK_ENABLE() do { \
  640. __IO uint32_t tmpreg; \
  641. SET_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  642. /* Delay after an RCC peripheral clock enabling */ \
  643. tmpreg = READ_BIT(RCC->AHB2ENR, RCC_AHB2ENR_HASHEN);\
  644. UNUSED(tmpreg); \
  645. } while(0)
  646. #define __HAL_RCC_CRYP_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_CRYPEN))
  647. #define __HAL_RCC_HASH_CLK_DISABLE() (RCC->AHB2ENR &= ~(RCC_AHB2ENR_HASHEN))
  648. #endif /* STM32F756x */
  649. /** @brief Enables or disables the AHB3 peripheral clock.
  650. * @note After reset, the peripheral clock (used for registers read/write access)
  651. * is disabled and the application software has to enable this clock before
  652. * using it.
  653. */
  654. #define __HAL_RCC_FMC_CLK_ENABLE() do { \
  655. __IO uint32_t tmpreg; \
  656. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  657. /* Delay after an RCC peripheral clock enabling */ \
  658. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);\
  659. UNUSED(tmpreg); \
  660. } while(0)
  661. #define __HAL_RCC_QSPI_CLK_ENABLE() do { \
  662. __IO uint32_t tmpreg; \
  663. SET_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  664. /* Delay after an RCC peripheral clock enabling */ \
  665. tmpreg = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_QSPIEN);\
  666. UNUSED(tmpreg); \
  667. } while(0)
  668. #define __HAL_RCC_FMC_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_FMCEN))
  669. #define __HAL_RCC_QSPI_CLK_DISABLE() (RCC->AHB3ENR &= ~(RCC_AHB3ENR_QSPIEN))
  670. /** @brief Enable or disable the Low Speed APB (APB1) peripheral clock.
  671. * @note After reset, the peripheral clock (used for registers read/write access)
  672. * is disabled and the application software has to enable this clock before
  673. * using it.
  674. */
  675. #define __HAL_RCC_TIM2_CLK_ENABLE() do { \
  676. __IO uint32_t tmpreg; \
  677. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  678. /* Delay after an RCC peripheral clock enabling */ \
  679. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM2EN);\
  680. UNUSED(tmpreg); \
  681. } while(0)
  682. #define __HAL_RCC_TIM3_CLK_ENABLE() do { \
  683. __IO uint32_t tmpreg; \
  684. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  685. /* Delay after an RCC peripheral clock enabling */ \
  686. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM3EN);\
  687. UNUSED(tmpreg); \
  688. } while(0)
  689. #define __HAL_RCC_TIM4_CLK_ENABLE() do { \
  690. __IO uint32_t tmpreg; \
  691. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  692. /* Delay after an RCC peripheral clock enabling */ \
  693. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM4EN);\
  694. UNUSED(tmpreg); \
  695. } while(0)
  696. #define __HAL_RCC_TIM5_CLK_ENABLE() do { \
  697. __IO uint32_t tmpreg; \
  698. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
  699. /* Delay after an RCC peripheral clock enabling */ \
  700. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM5EN);\
  701. UNUSED(tmpreg); \
  702. } while(0)
  703. #define __HAL_RCC_TIM6_CLK_ENABLE() do { \
  704. __IO uint32_t tmpreg; \
  705. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  706. /* Delay after an RCC peripheral clock enabling */ \
  707. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM6EN);\
  708. UNUSED(tmpreg); \
  709. } while(0)
  710. #define __HAL_RCC_TIM7_CLK_ENABLE() do { \
  711. __IO uint32_t tmpreg; \
  712. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  713. /* Delay after an RCC peripheral clock enabling */ \
  714. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM7EN);\
  715. UNUSED(tmpreg); \
  716. } while(0)
  717. #define __HAL_RCC_TIM12_CLK_ENABLE() do { \
  718. __IO uint32_t tmpreg; \
  719. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  720. /* Delay after an RCC peripheral clock enabling */ \
  721. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM12EN);\
  722. UNUSED(tmpreg); \
  723. } while(0)
  724. #define __HAL_RCC_TIM13_CLK_ENABLE() do { \
  725. __IO uint32_t tmpreg; \
  726. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  727. /* Delay after an RCC peripheral clock enabling */ \
  728. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM13EN);\
  729. UNUSED(tmpreg); \
  730. } while(0)
  731. #define __HAL_RCC_TIM14_CLK_ENABLE() do { \
  732. __IO uint32_t tmpreg; \
  733. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  734. /* Delay after an RCC peripheral clock enabling */ \
  735. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_TIM14EN);\
  736. UNUSED(tmpreg); \
  737. } while(0)
  738. #define __HAL_RCC_LPTIM1_CLK_ENABLE() do { \
  739. __IO uint32_t tmpreg; \
  740. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  741. /* Delay after an RCC peripheral clock enabling */ \
  742. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_LPTIM1EN);\
  743. UNUSED(tmpreg); \
  744. } while(0)
  745. #define __HAL_RCC_SPI2_CLK_ENABLE() do { \
  746. __IO uint32_t tmpreg; \
  747. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
  748. /* Delay after an RCC peripheral clock enabling */ \
  749. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI2EN);\
  750. UNUSED(tmpreg); \
  751. } while(0)
  752. #define __HAL_RCC_SPI3_CLK_ENABLE() do { \
  753. __IO uint32_t tmpreg; \
  754. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  755. /* Delay after an RCC peripheral clock enabling */ \
  756. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPI3EN);\
  757. UNUSED(tmpreg); \
  758. } while(0)
  759. #define __HAL_RCC_SPDIFRX_CLK_ENABLE() do { \
  760. __IO uint32_t tmpreg; \
  761. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  762. /* Delay after an RCC peripheral clock enabling */ \
  763. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_SPDIFRXEN);\
  764. UNUSED(tmpreg); \
  765. } while(0)
  766. #define __HAL_RCC_USART2_CLK_ENABLE() do { \
  767. __IO uint32_t tmpreg; \
  768. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
  769. /* Delay after an RCC peripheral clock enabling */ \
  770. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART2EN);\
  771. UNUSED(tmpreg); \
  772. } while(0)
  773. #define __HAL_RCC_USART3_CLK_ENABLE() do { \
  774. __IO uint32_t tmpreg; \
  775. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  776. /* Delay after an RCC peripheral clock enabling */ \
  777. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_USART3EN);\
  778. UNUSED(tmpreg); \
  779. } while(0)
  780. #define __HAL_RCC_UART4_CLK_ENABLE() do { \
  781. __IO uint32_t tmpreg; \
  782. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  783. /* Delay after an RCC peripheral clock enabling */ \
  784. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART4EN);\
  785. UNUSED(tmpreg); \
  786. } while(0)
  787. #define __HAL_RCC_UART5_CLK_ENABLE() do { \
  788. __IO uint32_t tmpreg; \
  789. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  790. /* Delay after an RCC peripheral clock enabling */ \
  791. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART5EN);\
  792. UNUSED(tmpreg); \
  793. } while(0)
  794. #define __HAL_RCC_I2C1_CLK_ENABLE() do { \
  795. __IO uint32_t tmpreg; \
  796. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
  797. /* Delay after an RCC peripheral clock enabling */ \
  798. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C1EN);\
  799. UNUSED(tmpreg); \
  800. } while(0)
  801. #define __HAL_RCC_I2C2_CLK_ENABLE() do { \
  802. __IO uint32_t tmpreg; \
  803. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
  804. /* Delay after an RCC peripheral clock enabling */ \
  805. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C2EN);\
  806. UNUSED(tmpreg); \
  807. } while(0)
  808. #define __HAL_RCC_I2C3_CLK_ENABLE() do { \
  809. __IO uint32_t tmpreg; \
  810. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  811. /* Delay after an RCC peripheral clock enabling */ \
  812. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C3EN);\
  813. UNUSED(tmpreg); \
  814. } while(0)
  815. #define __HAL_RCC_I2C4_CLK_ENABLE() do { \
  816. __IO uint32_t tmpreg; \
  817. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C4EN);\
  818. /* Delay after an RCC peripheral clock enabling */ \
  819. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_I2C4EN);\
  820. UNUSED(tmpreg); \
  821. } while(0)
  822. #define __HAL_RCC_CAN1_CLK_ENABLE() do { \
  823. __IO uint32_t tmpreg; \
  824. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  825. /* Delay after an RCC peripheral clock enabling */ \
  826. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN1EN);\
  827. UNUSED(tmpreg); \
  828. } while(0)
  829. #define __HAL_RCC_CAN2_CLK_ENABLE() do { \
  830. __IO uint32_t tmpreg; \
  831. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  832. /* Delay after an RCC peripheral clock enabling */ \
  833. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CAN2EN);\
  834. UNUSED(tmpreg); \
  835. } while(0)
  836. #define __HAL_RCC_CEC_CLK_ENABLE() do { \
  837. __IO uint32_t tmpreg; \
  838. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  839. /* Delay after an RCC peripheral clock enabling */ \
  840. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_CECEN);\
  841. UNUSED(tmpreg); \
  842. } while(0)
  843. #define __HAL_RCC_DAC_CLK_ENABLE() do { \
  844. __IO uint32_t tmpreg; \
  845. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  846. /* Delay after an RCC peripheral clock enabling */ \
  847. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_DACEN);\
  848. UNUSED(tmpreg); \
  849. } while(0)
  850. #define __HAL_RCC_UART7_CLK_ENABLE() do { \
  851. __IO uint32_t tmpreg; \
  852. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  853. /* Delay after an RCC peripheral clock enabling */ \
  854. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART7EN);\
  855. UNUSED(tmpreg); \
  856. } while(0)
  857. #define __HAL_RCC_UART8_CLK_ENABLE() do { \
  858. __IO uint32_t tmpreg; \
  859. SET_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  860. /* Delay after an RCC peripheral clock enabling */ \
  861. tmpreg = READ_BIT(RCC->APB1ENR, RCC_APB1ENR_UART8EN);\
  862. UNUSED(tmpreg); \
  863. } while(0)
  864. #define __HAL_RCC_TIM2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM2EN))
  865. #define __HAL_RCC_TIM3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM3EN))
  866. #define __HAL_RCC_TIM4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM4EN))
  867. #define __HAL_RCC_TIM5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM5EN))
  868. #define __HAL_RCC_TIM6_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM6EN))
  869. #define __HAL_RCC_TIM7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM7EN))
  870. #define __HAL_RCC_TIM12_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM12EN))
  871. #define __HAL_RCC_TIM13_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM13EN))
  872. #define __HAL_RCC_TIM14_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_TIM14EN))
  873. #define __HAL_RCC_LPTIM1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_LPTIM1EN))
  874. #define __HAL_RCC_SPI2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI2EN))
  875. #define __HAL_RCC_SPI3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_SPI3EN))
  876. #define __HAL_RCC_SPDIFRX_CLK_DISABLE()(RCC->APB1ENR &= ~(RCC_APB1ENR_SPDIFRXEN))
  877. #define __HAL_RCC_USART2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART2EN))
  878. #define __HAL_RCC_USART3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_USART3EN))
  879. #define __HAL_RCC_UART4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART4EN))
  880. #define __HAL_RCC_UART5_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART5EN))
  881. #define __HAL_RCC_I2C1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C1EN))
  882. #define __HAL_RCC_I2C2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C2EN))
  883. #define __HAL_RCC_I2C3_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C3EN))
  884. #define __HAL_RCC_I2C4_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_I2C4EN))
  885. #define __HAL_RCC_CAN1_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN1EN))
  886. #define __HAL_RCC_CAN2_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CAN2EN))
  887. #define __HAL_RCC_CEC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_CECEN))
  888. #define __HAL_RCC_DAC_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_DACEN))
  889. #define __HAL_RCC_UART7_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART7EN))
  890. #define __HAL_RCC_UART8_CLK_DISABLE() (RCC->APB1ENR &= ~(RCC_APB1ENR_UART8EN))
  891. /** @brief Enable or disable the High Speed APB (APB2) peripheral clock.
  892. * @note After reset, the peripheral clock (used for registers read/write access)
  893. * is disabled and the application software has to enable this clock before
  894. * using it.
  895. */
  896. #define __HAL_RCC_TIM1_CLK_ENABLE() do { \
  897. __IO uint32_t tmpreg; \
  898. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
  899. /* Delay after an RCC peripheral clock enabling */ \
  900. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM1EN);\
  901. UNUSED(tmpreg); \
  902. } while(0)
  903. #define __HAL_RCC_TIM8_CLK_ENABLE() do { \
  904. __IO uint32_t tmpreg; \
  905. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  906. /* Delay after an RCC peripheral clock enabling */ \
  907. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM8EN);\
  908. UNUSED(tmpreg); \
  909. } while(0)
  910. #define __HAL_RCC_USART1_CLK_ENABLE() do { \
  911. __IO uint32_t tmpreg; \
  912. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
  913. /* Delay after an RCC peripheral clock enabling */ \
  914. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
  915. UNUSED(tmpreg); \
  916. } while(0)
  917. #define __HAL_RCC_USART6_CLK_ENABLE() do { \
  918. __IO uint32_t tmpreg; \
  919. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\
  920. /* Delay after an RCC peripheral clock enabling */ \
  921. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART6EN);\
  922. UNUSED(tmpreg); \
  923. } while(0)
  924. #define __HAL_RCC_ADC1_CLK_ENABLE() do { \
  925. __IO uint32_t tmpreg; \
  926. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
  927. /* Delay after an RCC peripheral clock enabling */ \
  928. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC1EN);\
  929. UNUSED(tmpreg); \
  930. } while(0)
  931. #define __HAL_RCC_ADC2_CLK_ENABLE() do { \
  932. __IO uint32_t tmpreg; \
  933. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  934. /* Delay after an RCC peripheral clock enabling */ \
  935. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC2EN);\
  936. UNUSED(tmpreg); \
  937. } while(0)
  938. #define __HAL_RCC_ADC3_CLK_ENABLE() do { \
  939. __IO uint32_t tmpreg; \
  940. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  941. /* Delay after an RCC peripheral clock enabling */ \
  942. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_ADC3EN);\
  943. UNUSED(tmpreg); \
  944. } while(0)
  945. #define __HAL_RCC_SDMMC1_CLK_ENABLE() do { \
  946. __IO uint32_t tmpreg; \
  947. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN);\
  948. /* Delay after an RCC peripheral clock enabling */ \
  949. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SDMMC1EN);\
  950. UNUSED(tmpreg); \
  951. } while(0)
  952. #define __HAL_RCC_SPI1_CLK_ENABLE() do { \
  953. __IO uint32_t tmpreg; \
  954. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
  955. /* Delay after an RCC peripheral clock enabling */ \
  956. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI1EN);\
  957. UNUSED(tmpreg); \
  958. } while(0)
  959. #define __HAL_RCC_SPI4_CLK_ENABLE() do { \
  960. __IO uint32_t tmpreg; \
  961. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  962. /* Delay after an RCC peripheral clock enabling */ \
  963. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI4EN);\
  964. UNUSED(tmpreg); \
  965. } while(0)
  966. #define __HAL_RCC_TIM9_CLK_ENABLE() do { \
  967. __IO uint32_t tmpreg; \
  968. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
  969. /* Delay after an RCC peripheral clock enabling */ \
  970. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM9EN);\
  971. UNUSED(tmpreg); \
  972. } while(0)
  973. #define __HAL_RCC_TIM10_CLK_ENABLE() do { \
  974. __IO uint32_t tmpreg; \
  975. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  976. /* Delay after an RCC peripheral clock enabling */ \
  977. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM10EN);\
  978. UNUSED(tmpreg); \
  979. } while(0)
  980. #define __HAL_RCC_TIM11_CLK_ENABLE() do { \
  981. __IO uint32_t tmpreg; \
  982. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
  983. /* Delay after an RCC peripheral clock enabling */ \
  984. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_TIM11EN);\
  985. UNUSED(tmpreg); \
  986. } while(0)
  987. #define __HAL_RCC_SPI5_CLK_ENABLE() do { \
  988. __IO uint32_t tmpreg; \
  989. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  990. /* Delay after an RCC peripheral clock enabling */ \
  991. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI5EN);\
  992. UNUSED(tmpreg); \
  993. } while(0)
  994. #define __HAL_RCC_SPI6_CLK_ENABLE() do { \
  995. __IO uint32_t tmpreg; \
  996. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  997. /* Delay after an RCC peripheral clock enabling */ \
  998. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SPI6EN);\
  999. UNUSED(tmpreg); \
  1000. } while(0)
  1001. #define __HAL_RCC_SAI1_CLK_ENABLE() do { \
  1002. __IO uint32_t tmpreg; \
  1003. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1004. /* Delay after an RCC peripheral clock enabling */ \
  1005. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI1EN);\
  1006. UNUSED(tmpreg); \
  1007. } while(0)
  1008. #define __HAL_RCC_SAI2_CLK_ENABLE() do { \
  1009. __IO uint32_t tmpreg; \
  1010. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  1011. /* Delay after an RCC peripheral clock enabling */ \
  1012. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SAI2EN);\
  1013. UNUSED(tmpreg); \
  1014. } while(0)
  1015. #if defined(STM32F756xx) || defined(STM32F746xx)
  1016. #define __HAL_RCC_LTDC_CLK_ENABLE() do { \
  1017. __IO uint32_t tmpreg; \
  1018. SET_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1019. /* Delay after an RCC peripheral clock enabling */ \
  1020. tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_LTDCEN);\
  1021. UNUSED(tmpreg); \
  1022. } while(0)
  1023. #endif /* STM32F756xx || STM32F746xx */
  1024. #define __HAL_RCC_TIM1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM1EN))
  1025. #define __HAL_RCC_TIM8_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM8EN))
  1026. #define __HAL_RCC_USART1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART1EN))
  1027. #define __HAL_RCC_USART6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_USART6EN))
  1028. #define __HAL_RCC_ADC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC1EN))
  1029. #define __HAL_RCC_ADC2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC2EN))
  1030. #define __HAL_RCC_ADC3_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_ADC3EN))
  1031. #define __HAL_RCC_SDMMC1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SDMMC1EN))
  1032. #define __HAL_RCC_SPI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI1EN))
  1033. #define __HAL_RCC_SPI4_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI4EN))
  1034. #define __HAL_RCC_TIM9_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM9EN))
  1035. #define __HAL_RCC_TIM10_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM10EN))
  1036. #define __HAL_RCC_TIM11_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_TIM11EN))
  1037. #define __HAL_RCC_SPI5_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI5EN))
  1038. #define __HAL_RCC_SPI6_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SPI6EN))
  1039. #define __HAL_RCC_SAI1_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI1EN))
  1040. #define __HAL_RCC_SAI2_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_SAI2EN))
  1041. #if defined(STM32F756xx) || defined(STM32F746xx)
  1042. #define __HAL_RCC_LTDC_CLK_DISABLE() (RCC->APB2ENR &= ~(RCC_APB2ENR_LTDCEN))
  1043. #endif /* STM32F756xx || STM32F746xx */
  1044. /**
  1045. * @}
  1046. */
  1047. /** @defgroup RCCEx_Peripheral_Clock_Enable_Disable_Status Peripheral Clock Enable Disable Status
  1048. * @brief Get the enable or disable status of the AHB/APB peripheral clock.
  1049. * @note After reset, the peripheral clock (used for registers read/write access)
  1050. * is disabled and the application software has to enable this clock before
  1051. * using it.
  1052. * @{
  1053. */
  1054. /** @brief Get the enable or disable status of the AHB1 peripheral clock.
  1055. * @note After reset, the peripheral clock (used for registers read/write access)
  1056. * is disabled and the application software has to enable this clock before
  1057. * using it.
  1058. */
  1059. #define __HAL_RCC_BKPSRAM_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) != RESET)
  1060. #define __HAL_RCC_DTCMRAMEN_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DTCMRAMEN)) != RESET)
  1061. #define __HAL_RCC_DMA2_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2EN)) != RESET)
  1062. #define __HAL_RCC_DMA2D_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) != RESET)
  1063. #define __HAL_RCC_USB_OTG_HS_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) != RESET)
  1064. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) != RESET)
  1065. #define __HAL_RCC_GPIOA_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOAEN)) != RESET)
  1066. #define __HAL_RCC_GPIOB_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOBEN)) != RESET)
  1067. #define __HAL_RCC_GPIOC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOCEN)) != RESET)
  1068. #define __HAL_RCC_GPIOD_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) != RESET)
  1069. #define __HAL_RCC_GPIOE_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) != RESET)
  1070. #define __HAL_RCC_GPIOF_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) != RESET)
  1071. #define __HAL_RCC_GPIOG_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) != RESET)
  1072. #define __HAL_RCC_GPIOH_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOHEN)) != RESET)
  1073. #define __HAL_RCC_GPIOI_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) != RESET)
  1074. #define __HAL_RCC_GPIOJ_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) != RESET)
  1075. #define __HAL_RCC_GPIOK_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) != RESET)
  1076. #define __HAL_RCC_BKPSRAM_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_BKPSRAMEN)) == RESET)
  1077. #define __HAL_RCC_DTCMRAMEN_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DTCMRAMEN)) == RESET)
  1078. #define __HAL_RCC_DMA2_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2EN)) == RESET)
  1079. #define __HAL_RCC_DMA2D_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_DMA2DEN)) == RESET)
  1080. #define __HAL_RCC_USB_OTG_HS_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSEN)) == RESET)
  1081. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_OTGHSULPIEN)) == RESET)
  1082. #define __HAL_RCC_GPIOA_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOAEN)) == RESET)
  1083. #define __HAL_RCC_GPIOB_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOBEN)) == RESET)
  1084. #define __HAL_RCC_GPIOC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOCEN)) == RESET)
  1085. #define __HAL_RCC_GPIOD_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIODEN)) == RESET)
  1086. #define __HAL_RCC_GPIOE_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOEEN)) == RESET)
  1087. #define __HAL_RCC_GPIOF_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOFEN)) == RESET)
  1088. #define __HAL_RCC_GPIOG_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOGEN)) == RESET)
  1089. #define __HAL_RCC_GPIOH_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOHEN)) == RESET)
  1090. #define __HAL_RCC_GPIOI_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOIEN)) == RESET)
  1091. #define __HAL_RCC_GPIOJ_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOJEN)) == RESET)
  1092. #define __HAL_RCC_GPIOK_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_GPIOKEN)) == RESET)
  1093. /**
  1094. * @brief Enable ETHERNET clock.
  1095. */
  1096. #define __HAL_RCC_ETHMAC_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) != RESET)
  1097. #define __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) != RESET)
  1098. #define __HAL_RCC_ETHMACRX_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) != RESET)
  1099. #define __HAL_RCC_ETHMACPTP_IS_CLK_ENABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) != RESET)
  1100. #define __HAL_RCC_ETH_IS_CLK_ENABLED() (__HAL_RCC_ETHMAC_IS_CLK_ENABLED() && \
  1101. __HAL_RCC_ETHMACTX_IS_CLK_ENABLED() && \
  1102. __HAL_RCC_ETHMACRX_IS_CLK_ENABLED())
  1103. /**
  1104. * @brief Disable ETHERNET clock.
  1105. */
  1106. #define __HAL_RCC_ETHMAC_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACEN)) == RESET)
  1107. #define __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACTXEN)) == RESET)
  1108. #define __HAL_RCC_ETHMACRX_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACRXEN)) == RESET)
  1109. #define __HAL_RCC_ETHMACPTP_IS_CLK_DISABLED() ((RCC->AHB1ENR & (RCC_AHB1ENR_ETHMACPTPEN)) == RESET)
  1110. #define __HAL_RCC_ETH_IS_CLK_DISABLED() (__HAL_RCC_ETHMAC_IS_CLK_DISABLED() && \
  1111. __HAL_RCC_ETHMACTX_IS_CLK_DISABLED() && \
  1112. __HAL_RCC_ETHMACRX_IS_CLK_DISABLED())
  1113. /** @brief Get the enable or disable status of the AHB2 peripheral clock.
  1114. * @note After reset, the peripheral clock (used for registers read/write access)
  1115. * is disabled and the application software has to enable this clock before
  1116. * using it.
  1117. */
  1118. #define __HAL_RCC_DCMI_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) != RESET)
  1119. #define __HAL_RCC_RNG_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) != RESET)
  1120. #define __HAL_RCC_USB_OTG_FS_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) != RESET)
  1121. #define __HAL_RCC_DCMI_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_DCMIEN)) == RESET)
  1122. #define __HAL_RCC_RNG_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_RNGEN)) == RESET)
  1123. #define __HAL_RCC_USB_IS_OTG_FS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_OTGFSEN)) == RESET)
  1124. #if defined(STM32F756xx)
  1125. #define __HAL_RCC_CRYP_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) != RESET)
  1126. #define __HAL_RCC_HASH_IS_CLK_ENABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) != RESET)
  1127. #define __HAL_RCC_CRYP_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_CRYPEN)) == RESET)
  1128. #define __HAL_RCC_HASH_IS_CLK_DISABLED() ((RCC->AHB2ENR & (RCC_AHB2ENR_HASHEN)) == RESET)
  1129. #endif /* STM32F756x */
  1130. /** @brief Get the enable or disable status of the AHB3 peripheral clock.
  1131. * @note After reset, the peripheral clock (used for registers read/write access)
  1132. * is disabled and the application software has to enable this clock before
  1133. * using it.
  1134. */
  1135. #define __HAL_RCC_FMC_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) != RESET)
  1136. #define __HAL_RCC_QSPI_IS_CLK_ENABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) != RESET)
  1137. #define __HAL_RCC_FMC_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_FMCEN)) == RESET)
  1138. #define __HAL_RCC_QSPI_IS_CLK_DISABLED() ((RCC->AHB3ENR & (RCC_AHB3ENR_QSPIEN)) == RESET)
  1139. /** @brief Get the enable or disable status of the APB1 peripheral clock.
  1140. * @note After reset, the peripheral clock (used for registers read/write access)
  1141. * is disabled and the application software has to enable this clock before
  1142. * using it.
  1143. */
  1144. #define __HAL_RCC_TIM2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) != RESET)
  1145. #define __HAL_RCC_TIM3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) != RESET)
  1146. #define __HAL_RCC_TIM4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) != RESET)
  1147. #define __HAL_RCC_TIM5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) != RESET)
  1148. #define __HAL_RCC_TIM6_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) != RESET)
  1149. #define __HAL_RCC_TIM7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) != RESET)
  1150. #define __HAL_RCC_TIM12_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) != RESET)
  1151. #define __HAL_RCC_TIM13_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) != RESET)
  1152. #define __HAL_RCC_TIM14_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) != RESET)
  1153. #define __HAL_RCC_LPTIM1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) != RESET)
  1154. #define __HAL_RCC_SPI2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) != RESET)
  1155. #define __HAL_RCC_SPI3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) != RESET)
  1156. #define __HAL_RCC_SPDIFRX_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) != RESET)
  1157. #define __HAL_RCC_USART2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) != RESET)
  1158. #define __HAL_RCC_USART3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) != RESET)
  1159. #define __HAL_RCC_UART4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) != RESET)
  1160. #define __HAL_RCC_UART5_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) != RESET)
  1161. #define __HAL_RCC_I2C1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) != RESET)
  1162. #define __HAL_RCC_I2C2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) != RESET)
  1163. #define __HAL_RCC_I2C3_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) != RESET)
  1164. #define __HAL_RCC_I2C4_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C4EN)) != RESET)
  1165. #define __HAL_RCC_CAN1_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) != RESET)
  1166. #define __HAL_RCC_CAN2_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) != RESET)
  1167. #define __HAL_RCC_CEC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) != RESET)
  1168. #define __HAL_RCC_DAC_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) != RESET)
  1169. #define __HAL_RCC_UART7_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) != RESET)
  1170. #define __HAL_RCC_UART8_IS_CLK_ENABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) != RESET)
  1171. #define __HAL_RCC_TIM2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM2EN)) == RESET)
  1172. #define __HAL_RCC_TIM3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM3EN)) == RESET)
  1173. #define __HAL_RCC_TIM4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM4EN)) == RESET)
  1174. #define __HAL_RCC_TIM5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM5EN)) == RESET)
  1175. #define __HAL_RCC_TIM6_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM6EN)) == RESET)
  1176. #define __HAL_RCC_TIM7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM7EN)) == RESET)
  1177. #define __HAL_RCC_TIM12_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM12EN)) == RESET)
  1178. #define __HAL_RCC_TIM13_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM13EN)) == RESET)
  1179. #define __HAL_RCC_TIM14_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_TIM14EN)) == RESET)
  1180. #define __HAL_RCC_LPTIM1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_LPTIM1EN)) == RESET)
  1181. #define __HAL_RCC_SPI2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI2EN)) == RESET)
  1182. #define __HAL_RCC_SPI3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_SPI3EN)) == RESET)
  1183. #define __HAL_RCC_SPDIFRX_IS_CLK_DISABLED()((RCC->APB1ENR & (RCC_APB1ENR_SPDIFRXEN)) == RESET)
  1184. #define __HAL_RCC_USART2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART2EN)) == RESET)
  1185. #define __HAL_RCC_USART3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_USART3EN)) == RESET)
  1186. #define __HAL_RCC_UART4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART4EN)) == RESET)
  1187. #define __HAL_RCC_UART5_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART5EN)) == RESET)
  1188. #define __HAL_RCC_I2C1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C1EN)) == RESET)
  1189. #define __HAL_RCC_I2C2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C2EN)) == RESET)
  1190. #define __HAL_RCC_I2C3_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C3EN)) == RESET)
  1191. #define __HAL_RCC_I2C4_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_I2C4EN)) == RESET)
  1192. #define __HAL_RCC_CAN1_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN1EN)) == RESET)
  1193. #define __HAL_RCC_CAN2_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CAN2EN)) == RESET)
  1194. #define __HAL_RCC_CEC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_CECEN)) == RESET)
  1195. #define __HAL_RCC_DAC_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_DACEN)) == RESET)
  1196. #define __HAL_RCC_UART7_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART7EN)) == RESET)
  1197. #define __HAL_RCC_UART8_IS_CLK_DISABLED() ((RCC->APB1ENR & (RCC_APB1ENR_UART8EN)) == RESET)
  1198. /** @brief Get the enable or disable status of the APB2 peripheral clock.
  1199. * @note After reset, the peripheral clock (used for registers read/write access)
  1200. * is disabled and the application software has to enable this clock before
  1201. * using it.
  1202. */
  1203. #define __HAL_RCC_TIM1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) != RESET)
  1204. #define __HAL_RCC_TIM8_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) != RESET)
  1205. #define __HAL_RCC_USART1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) != RESET)
  1206. #define __HAL_RCC_USART6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART6EN)) != RESET)
  1207. #define __HAL_RCC_ADC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) != RESET)
  1208. #define __HAL_RCC_ADC2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) != RESET)
  1209. #define __HAL_RCC_ADC3_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) != RESET)
  1210. #define __HAL_RCC_SDMMC1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC1EN)) != RESET)
  1211. #define __HAL_RCC_SPI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) != RESET)
  1212. #define __HAL_RCC_SPI4_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) != RESET)
  1213. #define __HAL_RCC_TIM9_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) != RESET)
  1214. #define __HAL_RCC_TIM10_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) != RESET)
  1215. #define __HAL_RCC_TIM11_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) != RESET)
  1216. #define __HAL_RCC_SPI5_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) != RESET)
  1217. #define __HAL_RCC_SPI6_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) != RESET)
  1218. #define __HAL_RCC_SAI1_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) != RESET)
  1219. #define __HAL_RCC_SAI2_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) != RESET)
  1220. #if defined(STM32F756xx) || defined(STM32F746xx)
  1221. #define __HAL_RCC_LTDC_IS_CLK_ENABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) != RESET)
  1222. #endif /* STM32F756xx || STM32F746xx */
  1223. #define __HAL_RCC_TIM1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM1EN)) == RESET)
  1224. #define __HAL_RCC_TIM8_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM8EN)) == RESET)
  1225. #define __HAL_RCC_USART1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART1EN)) == RESET)
  1226. #define __HAL_RCC_USART6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_USART6EN)) == RESET)
  1227. #define __HAL_RCC_ADC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC1EN)) == RESET)
  1228. #define __HAL_RCC_ADC2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC2EN)) == RESET)
  1229. #define __HAL_RCC_ADC3_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_ADC3EN)) == RESET)
  1230. #define __HAL_RCC_SDMMC1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SDMMC1EN)) == RESET)
  1231. #define __HAL_RCC_SPI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI1EN)) == RESET)
  1232. #define __HAL_RCC_SPI4_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI4EN)) == RESET)
  1233. #define __HAL_RCC_TIM9_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM9EN)) == RESET)
  1234. #define __HAL_RCC_TIM10_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM10EN)) == RESET)
  1235. #define __HAL_RCC_TIM11_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_TIM11EN)) == RESET)
  1236. #define __HAL_RCC_SPI5_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI5EN)) == RESET)
  1237. #define __HAL_RCC_SPI6_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SPI6EN)) == RESET)
  1238. #define __HAL_RCC_SAI1_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI1EN)) == RESET)
  1239. #define __HAL_RCC_SAI2_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_SAI2EN)) == RESET)
  1240. #if defined(STM32F756xx) || defined(STM32F746xx)
  1241. #define __HAL_RCC_LTDC_IS_CLK_DISABLED() ((RCC->APB2ENR & (RCC_APB2ENR_LTDCEN)) == RESET)
  1242. #endif /* STM32F756xx || STM32F746xx */
  1243. /**
  1244. * @}
  1245. */
  1246. /** @defgroup RCCEx_Force_Release_Peripheral_Reset RCCEx Force Release Peripheral Reset
  1247. * @brief Forces or releases AHB/APB peripheral reset.
  1248. * @{
  1249. */
  1250. /** @brief Force or release AHB1 peripheral reset.
  1251. */
  1252. #define __HAL_RCC_DMA2_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2RST))
  1253. #define __HAL_RCC_DMA2D_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_DMA2DRST))
  1254. #define __HAL_RCC_ETHMAC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_ETHMACRST))
  1255. #define __HAL_RCC_USB_OTG_HS_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_OTGHRST))
  1256. #define __HAL_RCC_GPIOA_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOARST))
  1257. #define __HAL_RCC_GPIOB_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOBRST))
  1258. #define __HAL_RCC_GPIOC_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOCRST))
  1259. #define __HAL_RCC_GPIOD_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIODRST))
  1260. #define __HAL_RCC_GPIOE_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOERST))
  1261. #define __HAL_RCC_GPIOF_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOFRST))
  1262. #define __HAL_RCC_GPIOG_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOGRST))
  1263. #define __HAL_RCC_GPIOH_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOHRST))
  1264. #define __HAL_RCC_GPIOI_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOIRST))
  1265. #define __HAL_RCC_GPIOJ_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOJRST))
  1266. #define __HAL_RCC_GPIOK_FORCE_RESET() (RCC->AHB1RSTR |= (RCC_AHB1RSTR_GPIOKRST))
  1267. #define __HAL_RCC_DMA2_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2RST))
  1268. #define __HAL_RCC_DMA2D_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_DMA2DRST))
  1269. #define __HAL_RCC_ETHMAC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_ETHMACRST))
  1270. #define __HAL_RCC_USB_OTG_HS_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_OTGHRST))
  1271. #define __HAL_RCC_GPIOA_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOARST))
  1272. #define __HAL_RCC_GPIOB_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOBRST))
  1273. #define __HAL_RCC_GPIOC_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOCRST))
  1274. #define __HAL_RCC_GPIOD_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIODRST))
  1275. #define __HAL_RCC_GPIOE_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOERST))
  1276. #define __HAL_RCC_GPIOF_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOFRST))
  1277. #define __HAL_RCC_GPIOG_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOGRST))
  1278. #define __HAL_RCC_GPIOH_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOHRST))
  1279. #define __HAL_RCC_GPIOI_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOIRST))
  1280. #define __HAL_RCC_GPIOJ_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOJRST))
  1281. #define __HAL_RCC_GPIOK_RELEASE_RESET() (RCC->AHB1RSTR &= ~(RCC_AHB1RSTR_GPIOKRST))
  1282. /** @brief Force or release AHB2 peripheral reset.
  1283. */
  1284. #define __HAL_RCC_AHB2_FORCE_RESET() (RCC->AHB2RSTR = 0xFFFFFFFF)
  1285. #define __HAL_RCC_DCMI_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_DCMIRST))
  1286. #define __HAL_RCC_RNG_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_RNGRST))
  1287. #define __HAL_RCC_USB_OTG_FS_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_OTGFSRST))
  1288. #define __HAL_RCC_AHB2_RELEASE_RESET() (RCC->AHB2RSTR = 0x00)
  1289. #define __HAL_RCC_DCMI_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_DCMIRST))
  1290. #define __HAL_RCC_RNG_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_RNGRST))
  1291. #define __HAL_RCC_USB_OTG_FS_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_OTGFSRST))
  1292. #if defined(STM32F756xx)
  1293. #define __HAL_RCC_CRYP_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_CRYPRST))
  1294. #define __HAL_RCC_HASH_FORCE_RESET() (RCC->AHB2RSTR |= (RCC_AHB2RSTR_HASHRST))
  1295. #define __HAL_RCC_CRYP_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_CRYPRST))
  1296. #define __HAL_RCC_HASH_RELEASE_RESET() (RCC->AHB2RSTR &= ~(RCC_AHB2RSTR_HASHRST))
  1297. #endif /* STM32F756xx */
  1298. /** @brief Force or release AHB3 peripheral reset
  1299. */
  1300. #define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR = 0xFFFFFFFF)
  1301. #define __HAL_RCC_FMC_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_FMCRST))
  1302. #define __HAL_RCC_QSPI_FORCE_RESET() (RCC->AHB3RSTR |= (RCC_AHB3RSTR_QSPIRST))
  1303. #define __HAL_RCC_AHB3_RELEASE_RESET() (RCC->AHB3RSTR = 0x00)
  1304. #define __HAL_RCC_FMC_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_FMCRST))
  1305. #define __HAL_RCC_QSPI_RELEASE_RESET() (RCC->AHB3RSTR &= ~(RCC_AHB3RSTR_QSPIRST))
  1306. /** @brief Force or release APB1 peripheral reset.
  1307. */
  1308. #define __HAL_RCC_TIM2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM2RST))
  1309. #define __HAL_RCC_TIM3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM3RST))
  1310. #define __HAL_RCC_TIM4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM4RST))
  1311. #define __HAL_RCC_TIM5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM5RST))
  1312. #define __HAL_RCC_TIM6_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM6RST))
  1313. #define __HAL_RCC_TIM7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM7RST))
  1314. #define __HAL_RCC_TIM12_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM12RST))
  1315. #define __HAL_RCC_TIM13_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM13RST))
  1316. #define __HAL_RCC_TIM14_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_TIM14RST))
  1317. #define __HAL_RCC_LPTIM1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_LPTIM1RST))
  1318. #define __HAL_RCC_SPI2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI2RST))
  1319. #define __HAL_RCC_SPI3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPI3RST))
  1320. #define __HAL_RCC_SPDIFRX_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_SPDIFRXRST))
  1321. #define __HAL_RCC_USART2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART2RST))
  1322. #define __HAL_RCC_USART3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_USART3RST))
  1323. #define __HAL_RCC_UART4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART4RST))
  1324. #define __HAL_RCC_UART5_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART5RST))
  1325. #define __HAL_RCC_I2C1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C1RST))
  1326. #define __HAL_RCC_I2C2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C2RST))
  1327. #define __HAL_RCC_I2C3_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C3RST))
  1328. #define __HAL_RCC_I2C4_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_I2C4RST))
  1329. #define __HAL_RCC_CAN1_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN1RST))
  1330. #define __HAL_RCC_CAN2_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CAN2RST))
  1331. #define __HAL_RCC_CEC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_CECRST))
  1332. #define __HAL_RCC_DAC_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_DACRST))
  1333. #define __HAL_RCC_UART7_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART7RST))
  1334. #define __HAL_RCC_UART8_FORCE_RESET() (RCC->APB1RSTR |= (RCC_APB1RSTR_UART8RST))
  1335. #define __HAL_RCC_TIM2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM2RST))
  1336. #define __HAL_RCC_TIM3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM3RST))
  1337. #define __HAL_RCC_TIM4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM4RST))
  1338. #define __HAL_RCC_TIM5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM5RST))
  1339. #define __HAL_RCC_TIM6_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM6RST))
  1340. #define __HAL_RCC_TIM7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM7RST))
  1341. #define __HAL_RCC_TIM12_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM12RST))
  1342. #define __HAL_RCC_TIM13_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM13RST))
  1343. #define __HAL_RCC_TIM14_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_TIM14RST))
  1344. #define __HAL_RCC_LPTIM1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_LPTIM1RST))
  1345. #define __HAL_RCC_SPI2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI2RST))
  1346. #define __HAL_RCC_SPI3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPI3RST))
  1347. #define __HAL_RCC_SPDIFRX_RELEASE_RESET()(RCC->APB1RSTR &= ~(RCC_APB1RSTR_SPDIFRXRST))
  1348. #define __HAL_RCC_USART2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART2RST))
  1349. #define __HAL_RCC_USART3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_USART3RST))
  1350. #define __HAL_RCC_UART4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART4RST))
  1351. #define __HAL_RCC_UART5_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART5RST))
  1352. #define __HAL_RCC_I2C1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C1RST))
  1353. #define __HAL_RCC_I2C2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C2RST))
  1354. #define __HAL_RCC_I2C3_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C3RST))
  1355. #define __HAL_RCC_I2C4_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_I2C4RST))
  1356. #define __HAL_RCC_CAN1_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN1RST))
  1357. #define __HAL_RCC_CAN2_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CAN2RST))
  1358. #define __HAL_RCC_CEC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_CECRST))
  1359. #define __HAL_RCC_DAC_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_DACRST))
  1360. #define __HAL_RCC_UART7_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART7RST))
  1361. #define __HAL_RCC_UART8_RELEASE_RESET() (RCC->APB1RSTR &= ~(RCC_APB1RSTR_UART8RST))
  1362. /** @brief Force or release APB2 peripheral reset.
  1363. */
  1364. #define __HAL_RCC_TIM1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM1RST))
  1365. #define __HAL_RCC_TIM8_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM8RST))
  1366. #define __HAL_RCC_USART1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART1RST))
  1367. #define __HAL_RCC_USART6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_USART6RST))
  1368. #define __HAL_RCC_ADC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_ADCRST))
  1369. #define __HAL_RCC_SDMMC1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SDMMC1RST))
  1370. #define __HAL_RCC_SPI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI1RST))
  1371. #define __HAL_RCC_SPI4_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI4RST))
  1372. #define __HAL_RCC_TIM9_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM9RST))
  1373. #define __HAL_RCC_TIM10_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM10RST))
  1374. #define __HAL_RCC_TIM11_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_TIM11RST))
  1375. #define __HAL_RCC_SPI5_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI5RST))
  1376. #define __HAL_RCC_SPI6_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SPI6RST))
  1377. #define __HAL_RCC_SAI1_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI1RST))
  1378. #define __HAL_RCC_SAI2_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_SAI2RST))
  1379. #if defined(STM32F756xx) || defined(STM32F746xx)
  1380. #define __HAL_RCC_LTDC_FORCE_RESET() (RCC->APB2RSTR |= (RCC_APB2RSTR_LTDCRST))
  1381. #endif /* STM32F756xx || STM32F746xx */
  1382. #define __HAL_RCC_TIM1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM1RST))
  1383. #define __HAL_RCC_TIM8_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM8RST))
  1384. #define __HAL_RCC_USART1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART1RST))
  1385. #define __HAL_RCC_USART6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_USART6RST))
  1386. #define __HAL_RCC_ADC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_ADCRST))
  1387. #define __HAL_RCC_SDMMC1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SDMMC1RST))
  1388. #define __HAL_RCC_SPI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI1RST))
  1389. #define __HAL_RCC_SPI4_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI4RST))
  1390. #define __HAL_RCC_TIM9_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM9RST))
  1391. #define __HAL_RCC_TIM10_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM10RST))
  1392. #define __HAL_RCC_TIM11_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_TIM11RST))
  1393. #define __HAL_RCC_SPI5_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI5RST))
  1394. #define __HAL_RCC_SPI6_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SPI6RST))
  1395. #define __HAL_RCC_SAI1_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI1RST))
  1396. #define __HAL_RCC_SAI2_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_SAI2RST))
  1397. #if defined(STM32F756xx) || defined(STM32F746xx)
  1398. #define __HAL_RCC_LTDC_RELEASE_RESET() (RCC->APB2RSTR &= ~(RCC_APB2RSTR_LTDCRST))
  1399. #endif /* STM32F756xx || STM32F746xx */
  1400. /**
  1401. * @}
  1402. */
  1403. /** @defgroup RCCEx_Peripheral_Clock_Sleep_Enable_Disable RCCEx Peripheral Clock Sleep Enable Disable
  1404. * @brief Enables or disables the AHB/APB peripheral clock during Low Power (Sleep) mode.
  1405. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1406. * power consumption.
  1407. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1408. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1409. * @{
  1410. */
  1411. /** @brief Enable or disable the AHB1 peripheral clock during Low Power (Sleep) mode.
  1412. */
  1413. #define __HAL_RCC_FLITF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_FLITFLPEN))
  1414. #define __HAL_RCC_AXI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_AXILPEN))
  1415. #define __HAL_RCC_SRAM1_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM1LPEN))
  1416. #define __HAL_RCC_SRAM2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_SRAM2LPEN))
  1417. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_BKPSRAMLPEN))
  1418. #define __HAL_RCC_DTCM_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DTCMLPEN))
  1419. #define __HAL_RCC_DMA2_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2LPEN))
  1420. #define __HAL_RCC_DMA2D_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_DMA2DLPEN))
  1421. #define __HAL_RCC_ETHMAC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACLPEN))
  1422. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACTXLPEN))
  1423. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACRXLPEN))
  1424. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_ETHMACPTPLPEN))
  1425. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSLPEN))
  1426. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_OTGHSULPILPEN))
  1427. #define __HAL_RCC_GPIOA_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOALPEN))
  1428. #define __HAL_RCC_GPIOB_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOBLPEN))
  1429. #define __HAL_RCC_GPIOC_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOCLPEN))
  1430. #define __HAL_RCC_GPIOD_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIODLPEN))
  1431. #define __HAL_RCC_GPIOE_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOELPEN))
  1432. #define __HAL_RCC_GPIOF_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOFLPEN))
  1433. #define __HAL_RCC_GPIOG_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOGLPEN))
  1434. #define __HAL_RCC_GPIOH_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOHLPEN))
  1435. #define __HAL_RCC_GPIOI_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOILPEN))
  1436. #define __HAL_RCC_GPIOJ_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOJLPEN))
  1437. #define __HAL_RCC_GPIOK_CLK_SLEEP_ENABLE() (RCC->AHB1LPENR |= (RCC_AHB1LPENR_GPIOKLPEN))
  1438. #define __HAL_RCC_FLITF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_FLITFLPEN))
  1439. #define __HAL_RCC_AXI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_AXILPEN))
  1440. #define __HAL_RCC_SRAM1_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM1LPEN))
  1441. #define __HAL_RCC_SRAM2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_SRAM2LPEN))
  1442. #define __HAL_RCC_BKPSRAM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_BKPSRAMLPEN))
  1443. #define __HAL_RCC_DTCM_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DTCMLPEN))
  1444. #define __HAL_RCC_DMA2_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2LPEN))
  1445. #define __HAL_RCC_DMA2D_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_DMA2DLPEN))
  1446. #define __HAL_RCC_ETHMAC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACLPEN))
  1447. #define __HAL_RCC_ETHMACTX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACTXLPEN))
  1448. #define __HAL_RCC_ETHMACRX_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACRXLPEN))
  1449. #define __HAL_RCC_ETHMACPTP_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_ETHMACPTPLPEN))
  1450. #define __HAL_RCC_USB_OTG_HS_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSLPEN))
  1451. #define __HAL_RCC_USB_OTG_HS_ULPI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_OTGHSULPILPEN))
  1452. #define __HAL_RCC_GPIOA_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOALPEN))
  1453. #define __HAL_RCC_GPIOB_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOBLPEN))
  1454. #define __HAL_RCC_GPIOC_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOCLPEN))
  1455. #define __HAL_RCC_GPIOD_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIODLPEN))
  1456. #define __HAL_RCC_GPIOE_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOELPEN))
  1457. #define __HAL_RCC_GPIOF_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOFLPEN))
  1458. #define __HAL_RCC_GPIOG_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOGLPEN))
  1459. #define __HAL_RCC_GPIOH_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOHLPEN))
  1460. #define __HAL_RCC_GPIOI_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOILPEN))
  1461. #define __HAL_RCC_GPIOJ_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOJLPEN))
  1462. #define __HAL_RCC_GPIOK_CLK_SLEEP_DISABLE() (RCC->AHB1LPENR &= ~(RCC_AHB1LPENR_GPIOKLPEN))
  1463. /** @brief Enable or disable the AHB2 peripheral clock during Low Power (Sleep) mode.
  1464. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1465. * power consumption.
  1466. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1467. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1468. */
  1469. #define __HAL_RCC_DCMI_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_DCMILPEN))
  1470. #define __HAL_RCC_DCMI_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_DCMILPEN))
  1471. #define __HAL_RCC_RNG_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_RNGLPEN))
  1472. #define __HAL_RCC_RNG_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_RNGLPEN))
  1473. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_OTGFSLPEN))
  1474. #define __HAL_RCC_USB_OTG_FS_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_OTGFSLPEN))
  1475. #if defined(STM32F756xx)
  1476. #define __HAL_RCC_CRYP_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_CRYPLPEN))
  1477. #define __HAL_RCC_HASH_CLK_SLEEP_ENABLE() (RCC->AHB2LPENR |= (RCC_AHB2LPENR_HASHLPEN))
  1478. #define __HAL_RCC_CRYP_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_CRYPLPEN))
  1479. #define __HAL_RCC_HASH_CLK_SLEEP_DISABLE() (RCC->AHB2LPENR &= ~(RCC_AHB2LPENR_HASHLPEN))
  1480. #endif /* STM32F756xx */
  1481. /** @brief Enable or disable the AHB3 peripheral clock during Low Power (Sleep) mode.
  1482. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1483. * power consumption.
  1484. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1485. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1486. */
  1487. #define __HAL_RCC_FMC_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_FMCLPEN))
  1488. #define __HAL_RCC_FMC_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_FMCLPEN))
  1489. #define __HAL_RCC_QSPI_CLK_SLEEP_ENABLE() (RCC->AHB3LPENR |= (RCC_AHB3LPENR_QSPILPEN))
  1490. #define __HAL_RCC_QSPI_CLK_SLEEP_DISABLE() (RCC->AHB3LPENR &= ~(RCC_AHB3LPENR_QSPILPEN))
  1491. /** @brief Enable or disable the APB1 peripheral clock during Low Power (Sleep) mode.
  1492. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1493. * power consumption.
  1494. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1495. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1496. */
  1497. #define __HAL_RCC_TIM2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM2LPEN))
  1498. #define __HAL_RCC_TIM3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM3LPEN))
  1499. #define __HAL_RCC_TIM4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM4LPEN))
  1500. #define __HAL_RCC_TIM5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM5LPEN))
  1501. #define __HAL_RCC_TIM6_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM6LPEN))
  1502. #define __HAL_RCC_TIM7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM7LPEN))
  1503. #define __HAL_RCC_TIM12_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM12LPEN))
  1504. #define __HAL_RCC_TIM13_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM13LPEN))
  1505. #define __HAL_RCC_TIM14_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_TIM14LPEN))
  1506. #define __HAL_RCC_LPTIM1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_LPTIM1LPEN))
  1507. #define __HAL_RCC_SPI2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI2LPEN))
  1508. #define __HAL_RCC_SPI3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPI3LPEN))
  1509. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_SPDIFRXLPEN))
  1510. #define __HAL_RCC_USART2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART2LPEN))
  1511. #define __HAL_RCC_USART3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_USART3LPEN))
  1512. #define __HAL_RCC_UART4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART4LPEN))
  1513. #define __HAL_RCC_UART5_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART5LPEN))
  1514. #define __HAL_RCC_I2C1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C1LPEN))
  1515. #define __HAL_RCC_I2C2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C2LPEN))
  1516. #define __HAL_RCC_I2C3_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C3LPEN))
  1517. #define __HAL_RCC_I2C4_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_I2C4LPEN))
  1518. #define __HAL_RCC_CAN1_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN1LPEN))
  1519. #define __HAL_RCC_CAN2_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CAN2LPEN))
  1520. #define __HAL_RCC_CEC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_CECLPEN))
  1521. #define __HAL_RCC_DAC_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_DACLPEN))
  1522. #define __HAL_RCC_UART7_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART7LPEN))
  1523. #define __HAL_RCC_UART8_CLK_SLEEP_ENABLE() (RCC->APB1LPENR |= (RCC_APB1LPENR_UART8LPEN))
  1524. #define __HAL_RCC_TIM2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM2LPEN))
  1525. #define __HAL_RCC_TIM3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM3LPEN))
  1526. #define __HAL_RCC_TIM4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM4LPEN))
  1527. #define __HAL_RCC_TIM5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM5LPEN))
  1528. #define __HAL_RCC_TIM6_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM6LPEN))
  1529. #define __HAL_RCC_TIM7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM7LPEN))
  1530. #define __HAL_RCC_TIM12_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM12LPEN))
  1531. #define __HAL_RCC_TIM13_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM13LPEN))
  1532. #define __HAL_RCC_TIM14_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_TIM14LPEN))
  1533. #define __HAL_RCC_LPTIM1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_LPTIM1LPEN))
  1534. #define __HAL_RCC_SPI2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI2LPEN))
  1535. #define __HAL_RCC_SPI3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPI3LPEN))
  1536. #define __HAL_RCC_SPDIFRX_CLK_SLEEP_DISABLE()(RCC->APB1LPENR &= ~(RCC_APB1LPENR_SPDIFRXLPEN))
  1537. #define __HAL_RCC_USART2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART2LPEN))
  1538. #define __HAL_RCC_USART3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_USART3LPEN))
  1539. #define __HAL_RCC_UART4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART4LPEN))
  1540. #define __HAL_RCC_UART5_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART5LPEN))
  1541. #define __HAL_RCC_I2C1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C1LPEN))
  1542. #define __HAL_RCC_I2C2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C2LPEN))
  1543. #define __HAL_RCC_I2C3_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C3LPEN))
  1544. #define __HAL_RCC_I2C4_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_I2C4LPEN))
  1545. #define __HAL_RCC_CAN1_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN1LPEN))
  1546. #define __HAL_RCC_CAN2_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CAN2LPEN))
  1547. #define __HAL_RCC_CEC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_CECLPEN))
  1548. #define __HAL_RCC_DAC_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_DACLPEN))
  1549. #define __HAL_RCC_UART7_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART7LPEN))
  1550. #define __HAL_RCC_UART8_CLK_SLEEP_DISABLE() (RCC->APB1LPENR &= ~(RCC_APB1LPENR_UART8LPEN))
  1551. /** @brief Enable or disable the APB2 peripheral clock during Low Power (Sleep) mode.
  1552. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1553. * power consumption.
  1554. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1555. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1556. */
  1557. #define __HAL_RCC_TIM1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM1LPEN))
  1558. #define __HAL_RCC_TIM8_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM8LPEN))
  1559. #define __HAL_RCC_USART1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_USART1LPEN))
  1560. #define __HAL_RCC_USART6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_USART6LPEN))
  1561. #define __HAL_RCC_ADC1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC1LPEN))
  1562. #define __HAL_RCC_ADC2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC2LPEN))
  1563. #define __HAL_RCC_ADC3_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_ADC3LPEN))
  1564. #define __HAL_RCC_SDMMC1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SDMMC1LPEN))
  1565. #define __HAL_RCC_SPI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI1LPEN))
  1566. #define __HAL_RCC_SPI4_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI4LPEN))
  1567. #define __HAL_RCC_TIM9_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM9LPEN))
  1568. #define __HAL_RCC_TIM10_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM10LPEN))
  1569. #define __HAL_RCC_TIM11_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_TIM11LPEN))
  1570. #define __HAL_RCC_SPI5_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI5LPEN))
  1571. #define __HAL_RCC_SPI6_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SPI6LPEN))
  1572. #define __HAL_RCC_SAI1_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI1LPEN))
  1573. #define __HAL_RCC_SAI2_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_SAI2LPEN))
  1574. #if defined(STM32F756xx) || defined(STM32F746xx)
  1575. #define __HAL_RCC_LTDC_CLK_SLEEP_ENABLE() (RCC->APB2LPENR |= (RCC_APB2LPENR_LTDCLPEN))
  1576. #endif /* STM32F756xx || STM32F746xx */
  1577. #define __HAL_RCC_TIM1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM1LPEN))
  1578. #define __HAL_RCC_TIM8_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM8LPEN))
  1579. #define __HAL_RCC_USART1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_USART1LPEN))
  1580. #define __HAL_RCC_USART6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_USART6LPEN))
  1581. #define __HAL_RCC_ADC1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC1LPEN))
  1582. #define __HAL_RCC_ADC2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC2LPEN))
  1583. #define __HAL_RCC_ADC3_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_ADC3LPEN))
  1584. #define __HAL_RCC_SDMMC1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SDMMC1LPEN))
  1585. #define __HAL_RCC_SPI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI1LPEN))
  1586. #define __HAL_RCC_SPI4_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI4LPEN))
  1587. #define __HAL_RCC_TIM9_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM9LPEN))
  1588. #define __HAL_RCC_TIM10_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM10LPEN))
  1589. #define __HAL_RCC_TIM11_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_TIM11LPEN))
  1590. #define __HAL_RCC_SPI5_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI5LPEN))
  1591. #define __HAL_RCC_SPI6_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SPI6LPEN))
  1592. #define __HAL_RCC_SAI1_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI1LPEN))
  1593. #define __HAL_RCC_SAI2_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_SAI2LPEN))
  1594. #if defined(STM32F756xx) || defined(STM32F746xx)
  1595. #define __HAL_RCC_LTDC_CLK_SLEEP_DISABLE() (RCC->APB2LPENR &= ~(RCC_APB2LPENR_LTDCLPEN))
  1596. #endif /* STM32F756xx || STM32F746xx */
  1597. /**
  1598. * @}
  1599. */
  1600. /** @defgroup RCC_Clock_Sleep_Enable_Disable_Status AHB/APB Peripheral Clock Sleep Enable Disable Status
  1601. * @brief Get the enable or disable status of the AHB/APB peripheral clock during Low Power (Sleep) mode.
  1602. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1603. * power consumption.
  1604. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1605. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1606. * @{
  1607. */
  1608. /** @brief Get the enable or disable status of the AHB1 peripheral clock during Low Power (Sleep) mode.
  1609. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1610. * power consumption.
  1611. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1612. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1613. */
  1614. #define __HAL_RCC_FLITF_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_FLITFLPEN)) != RESET)
  1615. #define __HAL_RCC_AXI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_AXILPEN)) != RESET)
  1616. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM1LPEN)) != RESET)
  1617. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM2LPEN)) != RESET)
  1618. #define __HAL_RCC_BKPSRAM_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_BKPSRAMLPEN)) != RESET)
  1619. #define __HAL_RCC_DTCM_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DTCMLPEN)) != RESET)
  1620. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2LPEN)) != RESET)
  1621. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2DLPEN)) != RESET)
  1622. #define __HAL_RCC_ETHMAC_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACLPEN)) != RESET)
  1623. #define __HAL_RCC_ETHMACTX_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACTXLPEN)) != RESET)
  1624. #define __HAL_RCC_ETHMACRX_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACRXLPEN)) != RESET)
  1625. #define __HAL_RCC_ETHMACPTP_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACPTPLPEN)) != RESET)
  1626. #define __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSLPEN)) != RESET)
  1627. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSULPILPEN)) != RESET)
  1628. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOALPEN)) != RESET)
  1629. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOBLPEN)) != RESET)
  1630. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOCLPEN)) != RESET)
  1631. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIODLPEN)) != RESET)
  1632. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOELPEN)) != RESET)
  1633. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOFLPEN)) != RESET)
  1634. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOGLPEN)) != RESET)
  1635. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOHLPEN)) != RESET)
  1636. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOILPEN)) != RESET)
  1637. #define __HAL_RCC_GPIOJ_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOJLPEN)) != RESET)
  1638. #define __HAL_RCC_GPIOK_IS_CLK_SLEEP_ENABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOKLPEN)) != RESET)
  1639. #define __HAL_RCC_FLITF_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_FLITFLPEN)) == RESET)
  1640. #define __HAL_RCC_AXI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_AXILPEN)) == RESET)
  1641. #define __HAL_RCC_SRAM1_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM1LPEN)) == RESET)
  1642. #define __HAL_RCC_SRAM2_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_SRAM2LPEN)) == RESET)
  1643. #define __HAL_RCC_BKPSRAM_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_BKPSRAMLPEN)) == RESET)
  1644. #define __HAL_RCC_DTCM_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DTCMLPEN)) == RESET)
  1645. #define __HAL_RCC_DMA2_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2LPEN)) == RESET)
  1646. #define __HAL_RCC_DMA2D_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_DMA2DLPEN)) == RESET)
  1647. #define __HAL_RCC_ETHMAC_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACLPEN)) == RESET)
  1648. #define __HAL_RCC_ETHMACTX_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACTXLPEN)) == RESET)
  1649. #define __HAL_RCC_ETHMACRX_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACRXLPEN)) == RESET)
  1650. #define __HAL_RCC_ETHMACPTP_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_ETHMACPTPLPEN)) == RESET)
  1651. #define __HAL_RCC_USB_OTG_HS_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSLPEN)) == RESET)
  1652. #define __HAL_RCC_USB_OTG_HS_ULPI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_OTGHSULPILPEN)) == RESET)
  1653. #define __HAL_RCC_GPIOA_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOALPEN)) == RESET)
  1654. #define __HAL_RCC_GPIOB_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOBLPEN)) == RESET)
  1655. #define __HAL_RCC_GPIOC_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOCLPEN)) == RESET)
  1656. #define __HAL_RCC_GPIOD_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIODLPEN)) == RESET)
  1657. #define __HAL_RCC_GPIOE_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOELPEN)) == RESET)
  1658. #define __HAL_RCC_GPIOF_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOFLPEN)) == RESET)
  1659. #define __HAL_RCC_GPIOG_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOGLPEN)) == RESET)
  1660. #define __HAL_RCC_GPIOH_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOHLPEN)) == RESET)
  1661. #define __HAL_RCC_GPIOI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOILPEN)) == RESET)
  1662. #define __HAL_RCC_GPIOJ_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOJLPEN)) == RESET)
  1663. #define __HAL_RCC_GPIOK_IS_CLK_SLEEP_DISABLED() ((RCC->AHB1LPENR & (RCC_AHB1LPENR_GPIOKLPEN)) == RESET)
  1664. /** @brief Get the enable or disable status of the AHB2 peripheral clock during Low Power (Sleep) mode.
  1665. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1666. * power consumption.
  1667. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1668. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1669. */
  1670. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_DCMILPEN)) != RESET)
  1671. #define __HAL_RCC_DCMI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_DCMILPEN)) == RESET)
  1672. #define __HAL_RCC_RNG_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_RNGLPEN)) != RESET)
  1673. #define __HAL_RCC_RNG_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_RNGLPEN)) == RESET)
  1674. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_OTGFSLPEN)) != RESET)
  1675. #define __HAL_RCC_USB_OTG_FS_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_OTGFSLPEN)) == RESET)
  1676. #if defined(STM32F756xx)
  1677. #define __HAL_RCC_CRYP_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_CRYPLPEN)) != RESET)
  1678. #define __HAL_RCC_HASH_IS_CLK_SLEEP_ENABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_HASHLPEN)) != RESET)
  1679. #define __HAL_RCC_CRYP_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_CRYPLPEN)) == RESET)
  1680. #define __HAL_RCC_HASH_IS_CLK_SLEEP_DISABLED() ((RCC->AHB2LPENR & (RCC_AHB2LPENR_HASHLPEN)) == RESET)
  1681. #endif /* STM32F756xx */
  1682. /** @brief Get the enable or disable status of the AHB3 peripheral clock during Low Power (Sleep) mode.
  1683. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1684. * power consumption.
  1685. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1686. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1687. */
  1688. #define __HAL_RCC_FMC_IS_CLK_SLEEP_ENABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_FMCLPEN)) != RESET)
  1689. #define __HAL_RCC_FMC_IS_CLK_SLEEP_DISABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_FMCLPEN)) == RESET)
  1690. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_ENABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_QSPILPEN)) != RESET)
  1691. #define __HAL_RCC_QSPI_IS_CLK_SLEEP_DISABLED() ((RCC->AHB3LPENR & (RCC_AHB3LPENR_QSPILPEN)) == RESET)
  1692. /** @brief Get the enable or disable status of the APB1 peripheral clock during Low Power (Sleep) mode.
  1693. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1694. * power consumption.
  1695. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1696. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1697. */
  1698. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) != RESET)
  1699. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) != RESET)
  1700. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) != RESET)
  1701. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM5LPEN)) != RESET)
  1702. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) != RESET)
  1703. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) != RESET)
  1704. #define __HAL_RCC_TIM12_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM12LPEN)) != RESET)
  1705. #define __HAL_RCC_TIM13_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM13LPEN)) != RESET)
  1706. #define __HAL_RCC_TIM14_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM14LPEN)) != RESET)
  1707. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_LPTIM1LPEN)) != RESET)
  1708. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) != RESET)
  1709. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI3LPEN)) != RESET)
  1710. #define __HAL_RCC_SPDIFRX_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPDIFRXLPEN)) != RESET)
  1711. #define __HAL_RCC_USART2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) != RESET)
  1712. #define __HAL_RCC_USART3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) != RESET)
  1713. #define __HAL_RCC_UART4_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART4LPEN)) != RESET)
  1714. #define __HAL_RCC_UART5_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART5LPEN)) != RESET)
  1715. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) != RESET)
  1716. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) != RESET)
  1717. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C3LPEN)) != RESET)
  1718. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C4LPEN)) != RESET)
  1719. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN1LPEN)) != RESET)
  1720. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN2LPEN)) != RESET)
  1721. #define __HAL_RCC_CEC_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CECLPEN)) != RESET)
  1722. #define __HAL_RCC_DAC_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) != RESET)
  1723. #define __HAL_RCC_UART7_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART7LPEN)) != RESET)
  1724. #define __HAL_RCC_UART8_IS_CLK_SLEEP_ENABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART8LPEN)) != RESET)
  1725. #define __HAL_RCC_TIM2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM2LPEN)) == RESET)
  1726. #define __HAL_RCC_TIM3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM3LPEN)) == RESET)
  1727. #define __HAL_RCC_TIM4_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM4LPEN)) == RESET)
  1728. #define __HAL_RCC_TIM5_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM5LPEN)) == RESET)
  1729. #define __HAL_RCC_TIM6_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM6LPEN)) == RESET)
  1730. #define __HAL_RCC_TIM7_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM7LPEN)) == RESET)
  1731. #define __HAL_RCC_TIM12_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM12LPEN)) == RESET)
  1732. #define __HAL_RCC_TIM13_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM13LPEN)) == RESET)
  1733. #define __HAL_RCC_TIM14_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_TIM14LPEN)) == RESET)
  1734. #define __HAL_RCC_LPTIM1_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_LPTIM1LPEN)) == RESET)
  1735. #define __HAL_RCC_SPI2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI2LPEN)) == RESET)
  1736. #define __HAL_RCC_SPI3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_SPI3LPEN)) == RESET)
  1737. #define __HAL_RCC_SPDIFRX_IS_CLK_SLEEP_DISABLED()((RCC->APB1LPENR & (RCC_APB1LPENR_SPDIFRXLPEN)) == RESET)
  1738. #define __HAL_RCC_USART2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART2LPEN)) == RESET)
  1739. #define __HAL_RCC_USART3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_USART3LPEN)) == RESET)
  1740. #define __HAL_RCC_UART4_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART4LPEN)) == RESET)
  1741. #define __HAL_RCC_UART5_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART5LPEN)) == RESET)
  1742. #define __HAL_RCC_I2C1_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C1LPEN)) == RESET)
  1743. #define __HAL_RCC_I2C2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C2LPEN)) == RESET)
  1744. #define __HAL_RCC_I2C3_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C3LPEN)) == RESET)
  1745. #define __HAL_RCC_I2C4_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_I2C4LPEN)) == RESET)
  1746. #define __HAL_RCC_CAN1_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN1LPEN)) == RESET)
  1747. #define __HAL_RCC_CAN2_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CAN2LPEN)) == RESET)
  1748. #define __HAL_RCC_CEC_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_CECLPEN)) == RESET)
  1749. #define __HAL_RCC_DAC_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_DACLPEN)) == RESET)
  1750. #define __HAL_RCC_UART7_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART7LPEN)) == RESET)
  1751. #define __HAL_RCC_UART8_IS_CLK_SLEEP_DISABLED() ((RCC->APB1LPENR & (RCC_APB1LPENR_UART8LPEN)) == RESET)
  1752. /** @brief Get the enable or disable status of the APB2 peripheral clock during Low Power (Sleep) mode.
  1753. * @note Peripheral clock gating in SLEEP mode can be used to further reduce
  1754. * power consumption.
  1755. * @note After wakeup from SLEEP mode, the peripheral clock is enabled again.
  1756. * @note By default, all peripheral clocks are enabled during SLEEP mode.
  1757. */
  1758. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM1LPEN)) != RESET)
  1759. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM8LPEN)) != RESET)
  1760. #define __HAL_RCC_USART1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) != RESET)
  1761. #define __HAL_RCC_USART6_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART6LPEN)) != RESET)
  1762. #define __HAL_RCC_ADC1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) != RESET)
  1763. #define __HAL_RCC_ADC2_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC2LPEN)) != RESET)
  1764. #define __HAL_RCC_ADC3_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC3LPEN)) != RESET)
  1765. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC1LPEN)) != RESET)
  1766. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) != RESET)
  1767. #define __HAL_RCC_SPI4_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI4LPEN)) != RESET)
  1768. #define __HAL_RCC_TIM9_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) != RESET)
  1769. #define __HAL_RCC_TIM10_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) != RESET)
  1770. #define __HAL_RCC_TIM11_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) != RESET)
  1771. #define __HAL_RCC_SPI5_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI5LPEN)) != RESET)
  1772. #define __HAL_RCC_SPI6_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI6LPEN)) != RESET)
  1773. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI1LPEN)) != RESET)
  1774. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI2LPEN)) != RESET)
  1775. #if defined(STM32F756xx) || defined(STM32F746xx)
  1776. #define __HAL_RCC_LTDC_IS_CLK_SLEEP_ENABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_LTDCLPEN)) != RESET)
  1777. #endif /* STM32F756xx || STM32F746xx */
  1778. #define __HAL_RCC_TIM1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM1LPEN)) == RESET)
  1779. #define __HAL_RCC_TIM8_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM8LPEN)) == RESET)
  1780. #define __HAL_RCC_USART1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART1LPEN)) == RESET)
  1781. #define __HAL_RCC_USART6_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_USART6LPEN)) == RESET)
  1782. #define __HAL_RCC_ADC1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC1LPEN)) == RESET)
  1783. #define __HAL_RCC_ADC2_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC2LPEN)) == RESET)
  1784. #define __HAL_RCC_ADC3_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_ADC3LPEN)) == RESET)
  1785. #define __HAL_RCC_SDMMC1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SDMMC1LPEN)) == RESET)
  1786. #define __HAL_RCC_SPI1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI1LPEN)) == RESET)
  1787. #define __HAL_RCC_SPI4_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI4LPEN)) == RESET)
  1788. #define __HAL_RCC_TIM9_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM9LPEN)) == RESET)
  1789. #define __HAL_RCC_TIM10_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM10LPEN)) == RESET)
  1790. #define __HAL_RCC_TIM11_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_TIM11LPEN)) == RESET)
  1791. #define __HAL_RCC_SPI5_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI5LPEN)) == RESET)
  1792. #define __HAL_RCC_SPI6_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SPI6LPEN)) == RESET)
  1793. #define __HAL_RCC_SAI1_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI1LPEN)) == RESET)
  1794. #define __HAL_RCC_SAI2_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_SAI2LPEN)) == RESET)
  1795. #if defined(STM32F756xx) || defined(STM32F746xx)
  1796. #define __HAL_RCC_LTDC_IS_CLK_SLEEP_DISABLED() ((RCC->APB2LPENR & (RCC_APB2LPENR_LTDCLPEN)) == RESET)
  1797. #endif /* STM32F756xx || STM32F746xx */
  1798. /**
  1799. * @}
  1800. */
  1801. /*---------------------------------------------------------------------------------------------*/
  1802. /** @brief Macro to configure the Timers clocks prescalers
  1803. * @param __PRESC__ : specifies the Timers clocks prescalers selection
  1804. * This parameter can be one of the following values:
  1805. * @arg RCC_TIMPRES_DESACTIVATED: The Timers kernels clocks prescaler is
  1806. * equal to HPRE if PPREx is corresponding to division by 1 or 2,
  1807. * else it is equal to [(HPRE * PPREx) / 2] if PPREx is corresponding to
  1808. * division by 4 or more.
  1809. * @arg RCC_TIMPRES_ACTIVATED: The Timers kernels clocks prescaler is
  1810. * equal to HPRE if PPREx is corresponding to division by 1, 2 or 4,
  1811. * else it is equal to [(HPRE * PPREx) / 4] if PPREx is corresponding
  1812. * to division by 8 or more.
  1813. */
  1814. #define __HAL_RCC_TIMCLKPRESCALER(__PRESC__) do {RCC->DCKCFGR1 &= ~(RCC_DCKCFGR1_TIMPRE);\
  1815. RCC->DCKCFGR1 |= (__PRESC__);\
  1816. }while(0)
  1817. /** @brief Macros to Enable or Disable the PLLISAI.
  1818. * @note The PLLSAI is disabled by hardware when entering STOP and STANDBY modes.
  1819. */
  1820. #define __HAL_RCC_PLLSAI_ENABLE() (RCC->CR |= (RCC_CR_PLLSAION))
  1821. #define __HAL_RCC_PLLSAI_DISABLE() (RCC->CR &= ~(RCC_CR_PLLSAION))
  1822. /** @brief Macro to configure the PLLSAI clock multiplication and division factors.
  1823. * @note This function must be used only when the PLLSAI is disabled.
  1824. * @note PLLSAI clock source is common with the main PLL (configured in
  1825. * RCC_PLLConfig function )
  1826. * @param __PLLSAIN__: specifies the multiplication factor for PLLSAI VCO output clock.
  1827. * This parameter must be a number between Min_Data = 49 and Max_Data = 432.
  1828. * @note You have to set the PLLSAIN parameter correctly to ensure that the VCO
  1829. * output frequency is between Min_Data = 49 and Max_Data = 432 MHz.
  1830. * @param __PLLSAIQ__: specifies the division factor for SAI clock
  1831. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  1832. * @param __PLLSAIR__: specifies the division factor for LTDC clock
  1833. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  1834. * @param __PLLSAIP__: specifies the division factor for USB, RNG, SDMMC clocks
  1835. * This parameter can be a value of @ref RCCEx_PLLSAIP_Clock_Divider .
  1836. */
  1837. #define __HAL_RCC_PLLSAI_CONFIG(__PLLSAIN__, __PLLSAIP__, __PLLSAIQ__, __PLLSAIR__) (RCC->PLLSAICFGR = ((__PLLSAIN__) << 6) | ((__PLLSAIP__) << 16) | ((__PLLSAIQ__) << 24) | ((__PLLSAIR__) << 28))
  1838. /** @brief Macro used by the SAI HAL driver to configure the PLLI2S clock multiplication and division factors.
  1839. * @note This macro must be used only when the PLLI2S is disabled.
  1840. * @note PLLI2S clock source is common with the main PLL (configured in
  1841. * HAL_RCC_ClockConfig() API)
  1842. * @param __PLLI2SN__: specifies the multiplication factor for PLLI2S VCO output clock.
  1843. * This parameter must be a number between Min_Data = 192 and Max_Data = 432.
  1844. * @note You have to set the PLLI2SN parameter correctly to ensure that the VCO
  1845. * output frequency is between Min_Data = 192 and Max_Data = 432 MHz.
  1846. * @param __PLLI2SQ__: specifies the division factor for SAI clock.
  1847. * This parameter must be a number between Min_Data = 2 and Max_Data = 15.
  1848. * @param __PLLI2SR__: specifies the division factor for I2S clock
  1849. * This parameter must be a number between Min_Data = 2 and Max_Data = 7.
  1850. * @note You have to set the PLLI2SR parameter correctly to not exceed 192 MHz
  1851. * on the I2S clock frequency.
  1852. * @param __PLLI2SP__: specifies the division factor for SPDDIF-RX clock.
  1853. * This parameter can be a number between 0 and 3 for respective values 2, 4, 6 and 8
  1854. */
  1855. #define __HAL_RCC_PLLI2S_CONFIG(__PLLI2SN__, __PLLI2SP__, __PLLI2SQ__, __PLLI2SR__) (RCC->PLLI2SCFGR = ((__PLLI2SN__) << 6) | ((__PLLI2SP__) << 16) | ((__PLLI2SQ__) << 24) | ((__PLLI2SR__) << 28))
  1856. /** @brief Macro to configure the SAI clock Divider coming from PLLI2S.
  1857. * @note This function must be called before enabling the PLLI2S.
  1858. * @param __PLLI2SDivQ__: specifies the PLLI2S division factor for SAI1 clock .
  1859. * This parameter must be a number between 1 and 32.
  1860. * SAI1 clock frequency = f(PLLI2SQ) / __PLLI2SDivQ__
  1861. */
  1862. #define __HAL_RCC_PLLI2S_PLLSAICLKDIVQ_CONFIG(__PLLI2SDivQ__) (MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_PLLI2SDIVQ, (__PLLI2SDivQ__)-1))
  1863. /** @brief Macro to configure the SAI clock Divider coming from PLLSAI.
  1864. * @note This function must be called before enabling the PLLSAI.
  1865. * @param __PLLSAIDivQ__: specifies the PLLSAI division factor for SAI1 clock .
  1866. * This parameter must be a number between Min_Data = 1 and Max_Data = 32.
  1867. * SAI1 clock frequency = f(PLLSAIQ) / __PLLSAIDivQ__
  1868. */
  1869. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVQ_CONFIG(__PLLSAIDivQ__) (MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_PLLSAIDIVQ, ((__PLLSAIDivQ__)-1)<<8))
  1870. /** @brief Macro to configure the LTDC clock Divider coming from PLLSAI.
  1871. *
  1872. * @note This function must be called before enabling the PLLSAI.
  1873. * @param __PLLSAIDivR__: specifies the PLLSAI division factor for LTDC clock .
  1874. * This parameter must be a number between Min_Data = 2 and Max_Data = 16.
  1875. * LTDC clock frequency = f(PLLSAIR) / __PLLSAIDivR__
  1876. */
  1877. #define __HAL_RCC_PLLSAI_PLLSAICLKDIVR_CONFIG(__PLLSAIDivR__)\
  1878. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_PLLSAIDIVR, (uint32_t)(__PLLSAIDivR__))
  1879. /** @brief Macro to configure SAI1 clock source selection.
  1880. * @note This function must be called before enabling PLLSAI, PLLI2S and
  1881. * the SAI clock.
  1882. * @param __SOURCE__: specifies the SAI1 clock source.
  1883. * This parameter can be one of the following values:
  1884. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  1885. * as SAI1 clock.
  1886. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  1887. * as SAI1 clock.
  1888. * @arg RCC_SAI1CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  1889. * used as SAI1 clock.
  1890. */
  1891. #define __HAL_RCC_SAI1_CONFIG(__SOURCE__)\
  1892. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI1SEL, (uint32_t)(__SOURCE__))
  1893. /** @brief Macro to get the SAI1 clock source.
  1894. * @retval The clock source can be one of the following values:
  1895. * @arg RCC_SAI1CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  1896. * as SAI1 clock.
  1897. * @arg RCC_SAI1CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  1898. * as SAI1 clock.
  1899. * @arg RCC_SAI1CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  1900. * used as SAI1 clock.
  1901. */
  1902. #define __HAL_RCC_GET_SAI1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI1SEL)))
  1903. /** @brief Macro to configure SAI2 clock source selection.
  1904. * @note This function must be called before enabling PLLSAI, PLLI2S and
  1905. * the SAI clock.
  1906. * @param __SOURCE__: specifies the SAI2 clock source.
  1907. * This parameter can be one of the following values:
  1908. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  1909. * as SAI2 clock.
  1910. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  1911. * as SAI2 clock.
  1912. * @arg RCC_SAI2CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  1913. * used as SAI2 clock.
  1914. */
  1915. #define __HAL_RCC_SAI2_CONFIG(__SOURCE__)\
  1916. MODIFY_REG(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI2SEL, (uint32_t)(__SOURCE__))
  1917. /** @brief Macro to get the SAI2 clock source.
  1918. * @retval The clock source can be one of the following values:
  1919. * @arg RCC_SAI2CLKSOURCE_PLLI2S: PLLI2S_Q clock divided by PLLI2SDIVQ used
  1920. * as SAI2 clock.
  1921. * @arg RCC_SAI2CLKSOURCE_PLLSAI: PLLISAI_Q clock divided by PLLSAIDIVQ used
  1922. * as SAI2 clock.
  1923. * @arg RCC_SAI2CLKSOURCE_PIN: External clock mapped on the I2S_CKIN pin
  1924. * used as SAI2 clock.
  1925. */
  1926. #define __HAL_RCC_GET_SAI2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR1, RCC_DCKCFGR1_SAI2SEL)))
  1927. /** @brief Enable PLLSAI_RDY interrupt.
  1928. */
  1929. #define __HAL_RCC_PLLSAI_ENABLE_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYIE))
  1930. /** @brief Disable PLLSAI_RDY interrupt.
  1931. */
  1932. #define __HAL_RCC_PLLSAI_DISABLE_IT() (RCC->CIR &= ~(RCC_CIR_PLLSAIRDYIE))
  1933. /** @brief Clear the PLLSAI RDY interrupt pending bits.
  1934. */
  1935. #define __HAL_RCC_PLLSAI_CLEAR_IT() (RCC->CIR |= (RCC_CIR_PLLSAIRDYF))
  1936. /** @brief Check the PLLSAI RDY interrupt has occurred or not.
  1937. * @retval The new state (TRUE or FALSE).
  1938. */
  1939. #define __HAL_RCC_PLLSAI_GET_IT() ((RCC->CIR & (RCC_CIR_PLLSAIRDYIE)) == (RCC_CIR_PLLSAIRDYIE))
  1940. /** @brief Check PLLSAI RDY flag is set or not.
  1941. * @retval The new state (TRUE or FALSE).
  1942. */
  1943. #define __HAL_RCC_PLLSAI_GET_FLAG() ((RCC->CR & (RCC_CR_PLLSAIRDY)) == (RCC_CR_PLLSAIRDY))
  1944. /** @brief Macro to Get I2S clock source selection.
  1945. * @retval The clock source can be one of the following values:
  1946. * @arg RCC_I2SCLKSOURCE_PLLI2S: PLLI2S VCO output clock divided by PLLI2SR used as I2S clock.
  1947. * @arg RCC_I2SCLKSOURCE_EXT: External clock mapped on the I2S_CKIN pin used as I2S clock source
  1948. */
  1949. #define __HAL_RCC_GET_I2SCLKSOURCE() (READ_BIT(RCC->CFGR, RCC_CFGR_I2SSRC))
  1950. /** @brief Macro to configure the I2C1 clock (I2C1CLK).
  1951. *
  1952. * @param __I2C1_CLKSOURCE__: specifies the I2C1 clock source.
  1953. * This parameter can be one of the following values:
  1954. * @arg RCC_I2C1CLKSOURCE_PCLK1: PCLK1 selected as I2C1 clock
  1955. * @arg RCC_I2C1CLKSOURCE_HSI: HSI selected as I2C1 clock
  1956. * @arg RCC_I2C1CLKSOURCE_SYSCLK: System Clock selected as I2C1 clock
  1957. */
  1958. #define __HAL_RCC_I2C1_CONFIG(__I2C1_CLKSOURCE__) \
  1959. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C1SEL, (uint32_t)(__I2C1_CLKSOURCE__))
  1960. /** @brief Macro to get the I2C1 clock source.
  1961. * @retval The clock source can be one of the following values:
  1962. * @arg RCC_I2C1CLKSOURCE_PCLK1: PCLK1 selected as I2C1 clock
  1963. * @arg RCC_I2C1CLKSOURCE_HSI: HSI selected as I2C1 clock
  1964. * @arg RCC_I2C1CLKSOURCE_SYSCLK: System Clock selected as I2C1 clock
  1965. */
  1966. #define __HAL_RCC_GET_I2C1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C1SEL)))
  1967. /** @brief Macro to configure the I2C2 clock (I2C2CLK).
  1968. *
  1969. * @param __I2C2_CLKSOURCE__: specifies the I2C2 clock source.
  1970. * This parameter can be one of the following values:
  1971. * @arg RCC_I2C2CLKSOURCE_PCLK1: PCLK1 selected as I2C2 clock
  1972. * @arg RCC_I2C2CLKSOURCE_HSI: HSI selected as I2C2 clock
  1973. * @arg RCC_I2C2CLKSOURCE_SYSCLK: System Clock selected as I2C2 clock
  1974. */
  1975. #define __HAL_RCC_I2C2_CONFIG(__I2C2_CLKSOURCE__) \
  1976. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C2SEL, (uint32_t)(__I2C2_CLKSOURCE__))
  1977. /** @brief Macro to get the I2C2 clock source.
  1978. * @retval The clock source can be one of the following values:
  1979. * @arg RCC_I2C2CLKSOURCE_PCLK1: PCLK1 selected as I2C2 clock
  1980. * @arg RCC_I2C2CLKSOURCE_HSI: HSI selected as I2C2 clock
  1981. * @arg RCC_I2C2CLKSOURCE_SYSCLK: System Clock selected as I2C2 clock
  1982. */
  1983. #define __HAL_RCC_GET_I2C2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C2SEL)))
  1984. /** @brief Macro to configure the I2C3 clock (I2C3CLK).
  1985. *
  1986. * @param __I2C3_CLKSOURCE__: specifies the I2C3 clock source.
  1987. * This parameter can be one of the following values:
  1988. * @arg RCC_I2C3CLKSOURCE_PCLK1: PCLK1 selected as I2C3 clock
  1989. * @arg RCC_I2C3CLKSOURCE_HSI: HSI selected as I2C3 clock
  1990. * @arg RCC_I2C3CLKSOURCE_SYSCLK: System Clock selected as I2C3 clock
  1991. */
  1992. #define __HAL_RCC_I2C3_CONFIG(__I2C3_CLKSOURCE__) \
  1993. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C3SEL, (uint32_t)(__I2C3_CLKSOURCE__))
  1994. /** @brief macro to get the I2C3 clock source.
  1995. * @retval The clock source can be one of the following values:
  1996. * @arg RCC_I2C3CLKSOURCE_PCLK1: PCLK1 selected as I2C3 clock
  1997. * @arg RCC_I2C3CLKSOURCE_HSI: HSI selected as I2C3 clock
  1998. * @arg RCC_I2C3CLKSOURCE_SYSCLK: System Clock selected as I2C3 clock
  1999. */
  2000. #define __HAL_RCC_GET_I2C3_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C3SEL)))
  2001. /** @brief Macro to configure the I2C4 clock (I2C4CLK).
  2002. *
  2003. * @param __I2C4_CLKSOURCE__: specifies the I2C4 clock source.
  2004. * This parameter can be one of the following values:
  2005. * @arg RCC_I2C4CLKSOURCE_PCLK1: PCLK1 selected as I2C4 clock
  2006. * @arg RCC_I2C4CLKSOURCE_HSI: HSI selected as I2C4 clock
  2007. * @arg RCC_I2C4CLKSOURCE_SYSCLK: System Clock selected as I2C4 clock
  2008. */
  2009. #define __HAL_RCC_I2C4_CONFIG(__I2C4_CLKSOURCE__) \
  2010. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C4SEL, (uint32_t)(__I2C4_CLKSOURCE__))
  2011. /** @brief macro to get the I2C4 clock source.
  2012. * @retval The clock source can be one of the following values:
  2013. * @arg RCC_I2C4CLKSOURCE_PCLK1: PCLK1 selected as I2C4 clock
  2014. * @arg RCC_I2C4CLKSOURCE_HSI: HSI selected as I2C4 clock
  2015. * @arg RCC_I2C4CLKSOURCE_SYSCLK: System Clock selected as I2C4 clock
  2016. */
  2017. #define __HAL_RCC_GET_I2C4_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_I2C4SEL)))
  2018. /** @brief Macro to configure the USART1 clock (USART1CLK).
  2019. *
  2020. * @param __USART1_CLKSOURCE__: specifies the USART1 clock source.
  2021. * This parameter can be one of the following values:
  2022. * @arg RCC_USART1CLKSOURCE_PCLK2: PCLK2 selected as USART1 clock
  2023. * @arg RCC_USART1CLKSOURCE_HSI: HSI selected as USART1 clock
  2024. * @arg RCC_USART1CLKSOURCE_SYSCLK: System Clock selected as USART1 clock
  2025. * @arg RCC_USART1CLKSOURCE_LSE: LSE selected as USART1 clock
  2026. */
  2027. #define __HAL_RCC_USART1_CONFIG(__USART1_CLKSOURCE__) \
  2028. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART1SEL, (uint32_t)(__USART1_CLKSOURCE__))
  2029. /** @brief macro to get the USART1 clock source.
  2030. * @retval The clock source can be one of the following values:
  2031. * @arg RCC_USART1CLKSOURCE_PCLK2: PCLK2 selected as USART1 clock
  2032. * @arg RCC_USART1CLKSOURCE_HSI: HSI selected as USART1 clock
  2033. * @arg RCC_USART1CLKSOURCE_SYSCLK: System Clock selected as USART1 clock
  2034. * @arg RCC_USART1CLKSOURCE_LSE: LSE selected as USART1 clock
  2035. */
  2036. #define __HAL_RCC_GET_USART1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART1SEL)))
  2037. /** @brief Macro to configure the USART2 clock (USART2CLK).
  2038. *
  2039. * @param __USART2_CLKSOURCE__: specifies the USART2 clock source.
  2040. * This parameter can be one of the following values:
  2041. * @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
  2042. * @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
  2043. * @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
  2044. * @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
  2045. */
  2046. #define __HAL_RCC_USART2_CONFIG(__USART2_CLKSOURCE__) \
  2047. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART2SEL, (uint32_t)(__USART2_CLKSOURCE__))
  2048. /** @brief macro to get the USART2 clock source.
  2049. * @retval The clock source can be one of the following values:
  2050. * @arg RCC_USART2CLKSOURCE_PCLK1: PCLK1 selected as USART2 clock
  2051. * @arg RCC_USART2CLKSOURCE_HSI: HSI selected as USART2 clock
  2052. * @arg RCC_USART2CLKSOURCE_SYSCLK: System Clock selected as USART2 clock
  2053. * @arg RCC_USART2CLKSOURCE_LSE: LSE selected as USART2 clock
  2054. */
  2055. #define __HAL_RCC_GET_USART2_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART2SEL)))
  2056. /** @brief Macro to configure the USART3 clock (USART3CLK).
  2057. *
  2058. * @param __USART3_CLKSOURCE__: specifies the USART3 clock source.
  2059. * This parameter can be one of the following values:
  2060. * @arg RCC_USART3CLKSOURCE_PCLK1: PCLK1 selected as USART3 clock
  2061. * @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock
  2062. * @arg RCC_USART3CLKSOURCE_SYSCLK: System Clock selected as USART3 clock
  2063. * @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock
  2064. */
  2065. #define __HAL_RCC_USART3_CONFIG(__USART3_CLKSOURCE__) \
  2066. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART3SEL, (uint32_t)(__USART3_CLKSOURCE__))
  2067. /** @brief macro to get the USART3 clock source.
  2068. * @retval The clock source can be one of the following values:
  2069. * @arg RCC_USART3CLKSOURCE_PCLK1: PCLK1 selected as USART3 clock
  2070. * @arg RCC_USART3CLKSOURCE_HSI: HSI selected as USART3 clock
  2071. * @arg RCC_USART3CLKSOURCE_SYSCLK: System Clock selected as USART3 clock
  2072. * @arg RCC_USART3CLKSOURCE_LSE: LSE selected as USART3 clock
  2073. */
  2074. #define __HAL_RCC_GET_USART3_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART3SEL)))
  2075. /** @brief Macro to configure the UART4 clock (UART4CLK).
  2076. *
  2077. * @param __UART4_CLKSOURCE__: specifies the UART4 clock source.
  2078. * This parameter can be one of the following values:
  2079. * @arg RCC_UART4CLKSOURCE_PCLK1: PCLK1 selected as UART4 clock
  2080. * @arg RCC_UART4CLKSOURCE_HSI: HSI selected as UART4 clock
  2081. * @arg RCC_UART4CLKSOURCE_SYSCLK: System Clock selected as UART4 clock
  2082. * @arg RCC_UART4CLKSOURCE_LSE: LSE selected as UART4 clock
  2083. */
  2084. #define __HAL_RCC_UART4_CONFIG(__UART4_CLKSOURCE__) \
  2085. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART4SEL, (uint32_t)(__UART4_CLKSOURCE__))
  2086. /** @brief macro to get the UART4 clock source.
  2087. * @retval The clock source can be one of the following values:
  2088. * @arg RCC_UART4CLKSOURCE_PCLK1: PCLK1 selected as UART4 clock
  2089. * @arg RCC_UART4CLKSOURCE_HSI: HSI selected as UART4 clock
  2090. * @arg RCC_UART4CLKSOURCE_SYSCLK: System Clock selected as UART4 clock
  2091. * @arg RCC_UART4CLKSOURCE_LSE: LSE selected as UART4 clock
  2092. */
  2093. #define __HAL_RCC_GET_UART4_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART4SEL)))
  2094. /** @brief Macro to configure the UART5 clock (UART5CLK).
  2095. *
  2096. * @param __UART5_CLKSOURCE__: specifies the UART5 clock source.
  2097. * This parameter can be one of the following values:
  2098. * @arg RCC_UART5CLKSOURCE_PCLK1: PCLK1 selected as UART5 clock
  2099. * @arg RCC_UART5CLKSOURCE_HSI: HSI selected as UART5 clock
  2100. * @arg RCC_UART5CLKSOURCE_SYSCLK: System Clock selected as UART5 clock
  2101. * @arg RCC_UART5CLKSOURCE_LSE: LSE selected as UART5 clock
  2102. */
  2103. #define __HAL_RCC_UART5_CONFIG(__UART5_CLKSOURCE__) \
  2104. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART5SEL, (uint32_t)(__UART5_CLKSOURCE__))
  2105. /** @brief macro to get the UART5 clock source.
  2106. * @retval The clock source can be one of the following values:
  2107. * @arg RCC_UART5CLKSOURCE_PCLK1: PCLK1 selected as UART5 clock
  2108. * @arg RCC_UART5CLKSOURCE_HSI: HSI selected as UART5 clock
  2109. * @arg RCC_UART5CLKSOURCE_SYSCLK: System Clock selected as UART5 clock
  2110. * @arg RCC_UART5CLKSOURCE_LSE: LSE selected as UART5 clock
  2111. */
  2112. #define __HAL_RCC_GET_UART5_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART5SEL)))
  2113. /** @brief Macro to configure the USART6 clock (USART6CLK).
  2114. *
  2115. * @param __USART6_CLKSOURCE__: specifies the USART6 clock source.
  2116. * This parameter can be one of the following values:
  2117. * @arg RCC_USART6CLKSOURCE_PCLK1: PCLK1 selected as USART6 clock
  2118. * @arg RCC_USART6CLKSOURCE_HSI: HSI selected as USART6 clock
  2119. * @arg RCC_USART6CLKSOURCE_SYSCLK: System Clock selected as USART6 clock
  2120. * @arg RCC_USART6CLKSOURCE_LSE: LSE selected as USART6 clock
  2121. */
  2122. #define __HAL_RCC_USART6_CONFIG(__USART6_CLKSOURCE__) \
  2123. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_USART6SEL, (uint32_t)(__USART6_CLKSOURCE__))
  2124. /** @brief macro to get the USART6 clock source.
  2125. * @retval The clock source can be one of the following values:
  2126. * @arg RCC_USART6CLKSOURCE_PCLK1: PCLK1 selected as USART6 clock
  2127. * @arg RCC_USART6CLKSOURCE_HSI: HSI selected as USART6 clock
  2128. * @arg RCC_USART6CLKSOURCE_SYSCLK: System Clock selected as USART6 clock
  2129. * @arg RCC_USART6CLKSOURCE_LSE: LSE selected as USART6 clock
  2130. */
  2131. #define __HAL_RCC_GET_USART6_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_USART6SEL)))
  2132. /** @brief Macro to configure the UART7 clock (UART7CLK).
  2133. *
  2134. * @param __UART7_CLKSOURCE__: specifies the UART7 clock source.
  2135. * This parameter can be one of the following values:
  2136. * @arg RCC_UART7CLKSOURCE_PCLK1: PCLK1 selected as UART7 clock
  2137. * @arg RCC_UART7CLKSOURCE_HSI: HSI selected as UART7 clock
  2138. * @arg RCC_UART7CLKSOURCE_SYSCLK: System Clock selected as UART7 clock
  2139. * @arg RCC_UART7CLKSOURCE_LSE: LSE selected as UART7 clock
  2140. */
  2141. #define __HAL_RCC_UART7_CONFIG(__UART7_CLKSOURCE__) \
  2142. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART7SEL, (uint32_t)(__UART7_CLKSOURCE__))
  2143. /** @brief macro to get the UART7 clock source.
  2144. * @retval The clock source can be one of the following values:
  2145. * @arg RCC_UART7CLKSOURCE_PCLK1: PCLK1 selected as UART7 clock
  2146. * @arg RCC_UART7CLKSOURCE_HSI: HSI selected as UART7 clock
  2147. * @arg RCC_UART7CLKSOURCE_SYSCLK: System Clock selected as UART7 clock
  2148. * @arg RCC_UART7CLKSOURCE_LSE: LSE selected as UART7 clock
  2149. */
  2150. #define __HAL_RCC_GET_UART7_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART7SEL)))
  2151. /** @brief Macro to configure the UART8 clock (UART8CLK).
  2152. *
  2153. * @param __UART8_CLKSOURCE__: specifies the UART8 clock source.
  2154. * This parameter can be one of the following values:
  2155. * @arg RCC_UART8CLKSOURCE_PCLK1: PCLK1 selected as UART8 clock
  2156. * @arg RCC_UART8CLKSOURCE_HSI: HSI selected as UART8 clock
  2157. * @arg RCC_UART8CLKSOURCE_SYSCLK: System Clock selected as UART8 clock
  2158. * @arg RCC_UART8CLKSOURCE_LSE: LSE selected as UART8 clock
  2159. */
  2160. #define __HAL_RCC_UART8_CONFIG(__UART8_CLKSOURCE__) \
  2161. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_UART8SEL, (uint32_t)(__UART8_CLKSOURCE__))
  2162. /** @brief macro to get the UART8 clock source.
  2163. * @retval The clock source can be one of the following values:
  2164. * @arg RCC_UART8CLKSOURCE_PCLK1: PCLK1 selected as UART8 clock
  2165. * @arg RCC_UART8CLKSOURCE_HSI: HSI selected as UART8 clock
  2166. * @arg RCC_UART8CLKSOURCE_SYSCLK: System Clock selected as UART8 clock
  2167. * @arg RCC_UART8CLKSOURCE_LSE: LSE selected as UART8 clock
  2168. */
  2169. #define __HAL_RCC_GET_UART8_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_UART8SEL)))
  2170. /** @brief Macro to configure the LPTIM1 clock (LPTIM1CLK).
  2171. *
  2172. * @param __LPTIM1_CLKSOURCE__: specifies the LPTIM1 clock source.
  2173. * This parameter can be one of the following values:
  2174. * @arg RCC_LPTIM1CLKSOURCE_PCLK: PCLK selected as LPTIM1 clock
  2175. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI selected as LPTIM1 clock
  2176. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  2177. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  2178. */
  2179. #define __HAL_RCC_LPTIM1_CONFIG(__LPTIM1_CLKSOURCE__) \
  2180. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL, (uint32_t)(__LPTIM1_CLKSOURCE__))
  2181. /** @brief macro to get the LPTIM1 clock source.
  2182. * @retval The clock source can be one of the following values:
  2183. * @arg RCC_LPTIM1CLKSOURCE_PCLK: PCLK selected as LPTIM1 clock
  2184. * @arg RCC_LPTIM1CLKSOURCE_HSI: HSI selected as LPTIM1 clock
  2185. * @arg RCC_LPTIM1CLKSOURCE_LSI: LSI selected as LPTIM1 clock
  2186. * @arg RCC_LPTIM1CLKSOURCE_LSE: LSE selected as LPTIM1 clock
  2187. */
  2188. #define __HAL_RCC_GET_LPTIM1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_LPTIM1SEL)))
  2189. /** @brief Macro to configure the CEC clock (CECCLK).
  2190. *
  2191. * @param __CEC_CLKSOURCE__: specifies the CEC clock source.
  2192. * This parameter can be one of the following values:
  2193. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  2194. * @arg RCC_CECCLKSOURCE_HSI: HSI selected as CEC clock
  2195. */
  2196. #define __HAL_RCC_CEC_CONFIG(__CEC_CLKSOURCE__) \
  2197. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL, (uint32_t)(__CEC_CLKSOURCE__))
  2198. /** @brief macro to get the CEC clock source.
  2199. * @retval The clock source can be one of the following values:
  2200. * @arg RCC_CECCLKSOURCE_LSE: LSE selected as CEC clock
  2201. * @arg RCC_CECCLKSOURCE_HSI: HSI selected as CEC clock
  2202. */
  2203. #define __HAL_RCC_GET_CEC_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CECSEL)))
  2204. /** @brief Macro to configure the CLK48 source (CLK48CLK).
  2205. *
  2206. * @param __CLK48_SOURCE__: specifies the CLK48 clock source.
  2207. * This parameter can be one of the following values:
  2208. * @arg RCC_CLK48SOURCE_PLL: PLL selected as CLK48 source
  2209. * @arg RCC_CLK48SOURCE_PLSAI1: PLLSAI1 selected as CLK48 source
  2210. */
  2211. #define __HAL_RCC_CLK48_CONFIG(__CLK48_SOURCE__) \
  2212. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL, (uint32_t)(__CLK48_SOURCE__))
  2213. /** @brief macro to get the CLK48 source.
  2214. * @retval The clock source can be one of the following values:
  2215. * @arg RCC_CLK48SOURCE_PLL: PLL used as CLK48 source
  2216. * @arg RCC_CLK48SOURCE_PLSAI1: PLLSAI1 used as CLK48 source
  2217. */
  2218. #define __HAL_RCC_GET_CLK48_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_CK48MSEL)))
  2219. /** @brief Macro to configure the SDMMC1 clock (SDMMC1CLK).
  2220. *
  2221. * @param __SDMMC1_CLKSOURCE__: specifies the SDMMC1 clock source.
  2222. * This parameter can be one of the following values:
  2223. * @arg RCC_SDMMC1CLKSOURCE_CLK48: CLK48 selected as SDMMC clock
  2224. * @arg RCC_SDMMC1CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC clock
  2225. */
  2226. #define __HAL_RCC_SDMMC1_CONFIG(__SDMMC1_CLKSOURCE__) \
  2227. MODIFY_REG(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC1SEL, (uint32_t)(__SDMMC1_CLKSOURCE__))
  2228. /** @brief macro to get the SDMMC1 clock source.
  2229. * @retval The clock source can be one of the following values:
  2230. * @arg RCC_SDMMC1CLKSOURCE_CLK48: CLK48 selected as SDMMC1 clock
  2231. * @arg RCC_SDMMC1CLKSOURCE_SYSCLK: SYSCLK selected as SDMMC1 clock
  2232. */
  2233. #define __HAL_RCC_GET_SDMMC1_SOURCE() ((uint32_t)(READ_BIT(RCC->DCKCFGR2, RCC_DCKCFGR2_SDMMC1SEL)))
  2234. /**
  2235. * @}
  2236. */
  2237. /* Exported functions --------------------------------------------------------*/
  2238. /** @addtogroup RCCEx_Exported_Functions_Group1
  2239. * @{
  2240. */
  2241. HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  2242. void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit);
  2243. uint32_t HAL_RCCEx_GetPeriphCLKFreq(uint32_t PeriphClk);
  2244. /**
  2245. * @}
  2246. */
  2247. /* Private macros ------------------------------------------------------------*/
  2248. /** @addtogroup RCCEx_Private_Macros RCCEx Private Macros
  2249. * @{
  2250. */
  2251. /** @defgroup RCCEx_IS_RCC_Definitions RCC Private macros to check input parameters
  2252. * @{
  2253. */
  2254. #if defined(STM32F756xx) || defined(STM32F746xx)
  2255. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2256. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2257. (((SELECTION) & RCC_PERIPHCLK_LTDC) == RCC_PERIPHCLK_LTDC) || \
  2258. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2259. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  2260. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  2261. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  2262. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  2263. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  2264. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  2265. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  2266. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  2267. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  2268. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  2269. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  2270. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  2271. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  2272. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  2273. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  2274. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  2275. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  2276. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  2277. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  2278. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  2279. #elif defined(STM32F745xx)
  2280. #define IS_RCC_PERIPHCLOCK(SELECTION) \
  2281. ((((SELECTION) & RCC_PERIPHCLK_I2S) == RCC_PERIPHCLK_I2S) || \
  2282. (((SELECTION) & RCC_PERIPHCLK_TIM) == RCC_PERIPHCLK_TIM) || \
  2283. (((SELECTION) & RCC_PERIPHCLK_USART1) == RCC_PERIPHCLK_USART1) || \
  2284. (((SELECTION) & RCC_PERIPHCLK_USART2) == RCC_PERIPHCLK_USART2) || \
  2285. (((SELECTION) & RCC_PERIPHCLK_USART3) == RCC_PERIPHCLK_USART3) || \
  2286. (((SELECTION) & RCC_PERIPHCLK_UART4) == RCC_PERIPHCLK_UART4) || \
  2287. (((SELECTION) & RCC_PERIPHCLK_UART5) == RCC_PERIPHCLK_UART5) || \
  2288. (((SELECTION) & RCC_PERIPHCLK_USART6) == RCC_PERIPHCLK_USART6) || \
  2289. (((SELECTION) & RCC_PERIPHCLK_UART7) == RCC_PERIPHCLK_UART7) || \
  2290. (((SELECTION) & RCC_PERIPHCLK_UART8) == RCC_PERIPHCLK_UART8) || \
  2291. (((SELECTION) & RCC_PERIPHCLK_I2C1) == RCC_PERIPHCLK_I2C1) || \
  2292. (((SELECTION) & RCC_PERIPHCLK_I2C2) == RCC_PERIPHCLK_I2C2) || \
  2293. (((SELECTION) & RCC_PERIPHCLK_I2C3) == RCC_PERIPHCLK_I2C3) || \
  2294. (((SELECTION) & RCC_PERIPHCLK_I2C4) == RCC_PERIPHCLK_I2C4) || \
  2295. (((SELECTION) & RCC_PERIPHCLK_LPTIM1) == RCC_PERIPHCLK_LPTIM1) || \
  2296. (((SELECTION) & RCC_PERIPHCLK_SAI1) == RCC_PERIPHCLK_SAI1) || \
  2297. (((SELECTION) & RCC_PERIPHCLK_SAI2) == RCC_PERIPHCLK_SAI2) || \
  2298. (((SELECTION) & RCC_PERIPHCLK_CLK48) == RCC_PERIPHCLK_CLK48) || \
  2299. (((SELECTION) & RCC_PERIPHCLK_CEC) == RCC_PERIPHCLK_CEC) || \
  2300. (((SELECTION) & RCC_PERIPHCLK_SDMMC1) == RCC_PERIPHCLK_SDMMC1) || \
  2301. (((SELECTION) & RCC_PERIPHCLK_SPDIFRX) == RCC_PERIPHCLK_SPDIFRX) || \
  2302. (((SELECTION) & RCC_PERIPHCLK_RTC) == RCC_PERIPHCLK_RTC))
  2303. #endif /* STM32F756xx || STM32F746xx */
  2304. #define IS_RCC_PLLI2SN_VALUE(VALUE) ((49 <= (VALUE)) && ((VALUE) <= 432))
  2305. #define IS_RCC_PLLI2SP_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 8))
  2306. #define IS_RCC_PLLI2SQ_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 15))
  2307. #define IS_RCC_PLLI2SR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))
  2308. #define IS_RCC_PLLSAIN_VALUE(VALUE) ((49 <= (VALUE)) && ((VALUE) <= 432))
  2309. #define IS_RCC_PLLSAIP_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 8))
  2310. #define IS_RCC_PLLSAIQ_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 15))
  2311. #define IS_RCC_PLLSAIR_VALUE(VALUE) ((2 <= (VALUE)) && ((VALUE) <= 7))
  2312. #define IS_RCC_PLLSAI_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))
  2313. #define IS_RCC_PLLI2S_DIVQ_VALUE(VALUE) ((1 <= (VALUE)) && ((VALUE) <= 32))
  2314. #define IS_RCC_PLLSAI_DIVR_VALUE(VALUE) (((VALUE) == RCC_PLLSAIDIVR_2) ||\
  2315. ((VALUE) == RCC_PLLSAIDIVR_4) ||\
  2316. ((VALUE) == RCC_PLLSAIDIVR_8) ||\
  2317. ((VALUE) == RCC_PLLSAIDIVR_16))
  2318. #define IS_RCC_I2SCLKSOURCE(SOURCE) (((SOURCE) == RCC_I2SCLKSOURCE_PLLI2S) || \
  2319. ((SOURCE) == RCC_I2SCLKSOURCE_EXT))
  2320. #define IS_RCC_SAI1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI1CLKSOURCE_PLLSAI) || \
  2321. ((SOURCE) == RCC_SAI1CLKSOURCE_PLLI2S) || \
  2322. ((SOURCE) == RCC_SAI1CLKSOURCE_PIN))
  2323. #define IS_RCC_SAI2CLKSOURCE(SOURCE) (((SOURCE) == RCC_SAI2CLKSOURCE_PLLSAI) || \
  2324. ((SOURCE) == RCC_SAI2CLKSOURCE_PLLI2S) || \
  2325. ((SOURCE) == RCC_SAI2CLKSOURCE_PIN))
  2326. #define IS_RCC_SDMMC1CLKSOURCE(SOURCE) (((SOURCE) == RCC_SDMMC1CLKSOURCE_SYSCLK) || \
  2327. ((SOURCE) == RCC_SDMMC1CLKSOURCE_CLK48))
  2328. #define IS_RCC_CECCLKSOURCE(SOURCE) (((SOURCE) == RCC_CECCLKSOURCE_HSI) || \
  2329. ((SOURCE) == RCC_CECCLKSOURCE_LSE))
  2330. #define IS_RCC_USART1CLKSOURCE(SOURCE) \
  2331. (((SOURCE) == RCC_USART1CLKSOURCE_PCLK2) || \
  2332. ((SOURCE) == RCC_USART1CLKSOURCE_SYSCLK) || \
  2333. ((SOURCE) == RCC_USART1CLKSOURCE_LSE) || \
  2334. ((SOURCE) == RCC_USART1CLKSOURCE_HSI))
  2335. #define IS_RCC_USART2CLKSOURCE(SOURCE) \
  2336. (((SOURCE) == RCC_USART2CLKSOURCE_PCLK1) || \
  2337. ((SOURCE) == RCC_USART2CLKSOURCE_SYSCLK) || \
  2338. ((SOURCE) == RCC_USART2CLKSOURCE_LSE) || \
  2339. ((SOURCE) == RCC_USART2CLKSOURCE_HSI))
  2340. #define IS_RCC_USART3CLKSOURCE(SOURCE) \
  2341. (((SOURCE) == RCC_USART3CLKSOURCE_PCLK1) || \
  2342. ((SOURCE) == RCC_USART3CLKSOURCE_SYSCLK) || \
  2343. ((SOURCE) == RCC_USART3CLKSOURCE_LSE) || \
  2344. ((SOURCE) == RCC_USART3CLKSOURCE_HSI))
  2345. #define IS_RCC_UART4CLKSOURCE(SOURCE) \
  2346. (((SOURCE) == RCC_UART4CLKSOURCE_PCLK1) || \
  2347. ((SOURCE) == RCC_UART4CLKSOURCE_SYSCLK) || \
  2348. ((SOURCE) == RCC_UART4CLKSOURCE_LSE) || \
  2349. ((SOURCE) == RCC_UART4CLKSOURCE_HSI))
  2350. #define IS_RCC_UART5CLKSOURCE(SOURCE) \
  2351. (((SOURCE) == RCC_UART5CLKSOURCE_PCLK1) || \
  2352. ((SOURCE) == RCC_UART5CLKSOURCE_SYSCLK) || \
  2353. ((SOURCE) == RCC_UART5CLKSOURCE_LSE) || \
  2354. ((SOURCE) == RCC_UART5CLKSOURCE_HSI))
  2355. #define IS_RCC_USART6CLKSOURCE(SOURCE) \
  2356. (((SOURCE) == RCC_USART6CLKSOURCE_PCLK2) || \
  2357. ((SOURCE) == RCC_USART6CLKSOURCE_SYSCLK) || \
  2358. ((SOURCE) == RCC_USART6CLKSOURCE_LSE) || \
  2359. ((SOURCE) == RCC_USART6CLKSOURCE_HSI))
  2360. #define IS_RCC_UART7CLKSOURCE(SOURCE) \
  2361. (((SOURCE) == RCC_UART7CLKSOURCE_PCLK1) || \
  2362. ((SOURCE) == RCC_UART7CLKSOURCE_SYSCLK) || \
  2363. ((SOURCE) == RCC_UART7CLKSOURCE_LSE) || \
  2364. ((SOURCE) == RCC_UART7CLKSOURCE_HSI))
  2365. #define IS_RCC_UART8CLKSOURCE(SOURCE) \
  2366. (((SOURCE) == RCC_UART8CLKSOURCE_PCLK1) || \
  2367. ((SOURCE) == RCC_UART8CLKSOURCE_SYSCLK) || \
  2368. ((SOURCE) == RCC_UART8CLKSOURCE_LSE) || \
  2369. ((SOURCE) == RCC_UART8CLKSOURCE_HSI))
  2370. #define IS_RCC_I2C1CLKSOURCE(SOURCE) \
  2371. (((SOURCE) == RCC_I2C1CLKSOURCE_PCLK1) || \
  2372. ((SOURCE) == RCC_I2C1CLKSOURCE_SYSCLK)|| \
  2373. ((SOURCE) == RCC_I2C1CLKSOURCE_HSI))
  2374. #define IS_RCC_I2C2CLKSOURCE(SOURCE) \
  2375. (((SOURCE) == RCC_I2C2CLKSOURCE_PCLK1) || \
  2376. ((SOURCE) == RCC_I2C2CLKSOURCE_SYSCLK)|| \
  2377. ((SOURCE) == RCC_I2C2CLKSOURCE_HSI))
  2378. #define IS_RCC_I2C3CLKSOURCE(SOURCE) \
  2379. (((SOURCE) == RCC_I2C3CLKSOURCE_PCLK1) || \
  2380. ((SOURCE) == RCC_I2C3CLKSOURCE_SYSCLK)|| \
  2381. ((SOURCE) == RCC_I2C3CLKSOURCE_HSI))
  2382. #define IS_RCC_I2C4CLKSOURCE(SOURCE) \
  2383. (((SOURCE) == RCC_I2C4CLKSOURCE_PCLK1) || \
  2384. ((SOURCE) == RCC_I2C4CLKSOURCE_SYSCLK)|| \
  2385. ((SOURCE) == RCC_I2C4CLKSOURCE_HSI))
  2386. #define IS_RCC_LPTIM1CLK(SOURCE) \
  2387. (((SOURCE) == RCC_LPTIM1CLKSOURCE_PCLK) || \
  2388. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSI) || \
  2389. ((SOURCE) == RCC_LPTIM1CLKSOURCE_HSI) || \
  2390. ((SOURCE) == RCC_LPTIM1CLKSOURCE_LSE))
  2391. #define IS_RCC_CLK48SOURCE(SOURCE) \
  2392. (((SOURCE) == RCC_CLK48SOURCE_PLLSAIP) || \
  2393. ((SOURCE) == RCC_CLK48SOURCE_PLL))
  2394. #define IS_RCC_TIMPRES(VALUE) \
  2395. (((VALUE) == RCC_TIMPRES_DESACTIVATED) || \
  2396. ((VALUE) == RCC_TIMPRES_ACTIVATED))
  2397. /**
  2398. * @}
  2399. */
  2400. /**
  2401. * @}
  2402. */
  2403. /**
  2404. * @}
  2405. */
  2406. /**
  2407. * @}
  2408. */
  2409. #ifdef __cplusplus
  2410. }
  2411. #endif
  2412. #endif /* __STM32F7xx_HAL_RCC_EX_H */
  2413. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/