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.
 
 
 

3243 lines
201 KiB

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