stm32h7xx_hal_pwr.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx_hal_pwr.h
  4. * @author MCD Application Team
  5. * @brief Header file of PWR HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32H7xx_HAL_PWR_H
  20. #define STM32H7xx_HAL_PWR_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif /* __cplusplus */
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32h7xx_hal_def.h"
  26. /** @addtogroup STM32H7xx_HAL_Driver
  27. * @{
  28. */
  29. /** @addtogroup PWR
  30. * @{
  31. */
  32. /* Exported types ------------------------------------------------------------*/
  33. /** @defgroup PWR_Exported_Types PWR Exported Types
  34. * @{
  35. */
  36. /**
  37. * @brief PWR PVD configuration structure definition
  38. */
  39. typedef struct
  40. {
  41. uint32_t PVDLevel; /*!< PVDLevel: Specifies the PVD detection level. This
  42. parameter can be a value of @ref
  43. PWR_PVD_detection_level.
  44. */
  45. uint32_t Mode; /*!< Mode: Specifies the EXTI operating mode for the PVD
  46. event. This parameter can be a value of @ref
  47. PWR_PVD_Mode.
  48. */
  49. }PWR_PVDTypeDef;
  50. /**
  51. * @}
  52. */
  53. /* Exported constants --------------------------------------------------------*/
  54. /** @defgroup PWR_Exported_Constants PWR Exported Constants
  55. * @{
  56. */
  57. /** @defgroup PWR_PVD_detection_level PWR PVD detection level
  58. * @{
  59. */
  60. #define PWR_PVDLEVEL_0 PWR_CR1_PLS_LEV0 /*!< Programmable voltage detector
  61. level 0 selection : 1V95 */
  62. #define PWR_PVDLEVEL_1 PWR_CR1_PLS_LEV1 /*!< Programmable voltage detector
  63. level 1 selection : 2V1 */
  64. #define PWR_PVDLEVEL_2 PWR_CR1_PLS_LEV2 /*!< Programmable voltage detector
  65. level 2 selection : 2V25 */
  66. #define PWR_PVDLEVEL_3 PWR_CR1_PLS_LEV3 /*!< Programmable voltage detector
  67. level 3 selection : 2V4 */
  68. #define PWR_PVDLEVEL_4 PWR_CR1_PLS_LEV4 /*!< Programmable voltage detector
  69. level 4 selection : 2V55 */
  70. #define PWR_PVDLEVEL_5 PWR_CR1_PLS_LEV5 /*!< Programmable voltage detector
  71. level 5 selection : 2V7 */
  72. #define PWR_PVDLEVEL_6 PWR_CR1_PLS_LEV6 /*!< Programmable voltage detector
  73. level 6 selection : 2V85 */
  74. #define PWR_PVDLEVEL_7 PWR_CR1_PLS_LEV7 /*!< External input analog voltage
  75. (Compare internally to VREF) */
  76. /**
  77. * @}
  78. */
  79. /** @defgroup PWR_PVD_Mode PWR PVD Mode
  80. * @{
  81. */
  82. #define PWR_PVD_MODE_NORMAL (0x00000000U) /*!< Basic mode is used */
  83. #define PWR_PVD_MODE_IT_RISING (0x00010001U) /*!< Interrupt Mode with Rising edge trigger detection */
  84. #define PWR_PVD_MODE_IT_FALLING (0x00010002U) /*!< Interrupt Mode with Falling edge trigger detection */
  85. #define PWR_PVD_MODE_IT_RISING_FALLING (0x00010003U) /*!< Interrupt Mode with Rising/Falling edge trigger detection */
  86. #define PWR_PVD_MODE_EVENT_RISING (0x00020001U) /*!< Event Mode with Rising edge trigger detection */
  87. #define PWR_PVD_MODE_EVENT_FALLING (0x00020002U) /*!< Event Mode with Falling edge trigger detection */
  88. #define PWR_PVD_MODE_EVENT_RISING_FALLING (0x00020003U) /*!< Event Mode with Rising/Falling edge trigger detection */
  89. /**
  90. * @}
  91. */
  92. /** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in SLEEP/STOP mode
  93. * @{
  94. */
  95. #define PWR_MAINREGULATOR_ON (0U)
  96. #define PWR_LOWPOWERREGULATOR_ON PWR_CR1_LPDS
  97. /**
  98. * @}
  99. */
  100. /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry
  101. * @{
  102. */
  103. #define PWR_SLEEPENTRY_WFI (0x01U)
  104. #define PWR_SLEEPENTRY_WFE (0x02U)
  105. /**
  106. * @}
  107. */
  108. /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry
  109. * @{
  110. */
  111. #define PWR_STOPENTRY_WFI (0x01U)
  112. #define PWR_STOPENTRY_WFE (0x02U)
  113. /**
  114. * @}
  115. */
  116. /** @defgroup PWR_Regulator_Voltage_Scale PWR Regulator Voltage Scale
  117. * @{
  118. */
  119. #if defined(PWR_SRDCR_VOS)
  120. #define PWR_REGULATOR_VOLTAGE_SCALE0 (PWR_SRDCR_VOS_1 | PWR_SRDCR_VOS_0)
  121. #define PWR_REGULATOR_VOLTAGE_SCALE1 (PWR_SRDCR_VOS_1)
  122. #define PWR_REGULATOR_VOLTAGE_SCALE2 (PWR_SRDCR_VOS_0)
  123. #define PWR_REGULATOR_VOLTAGE_SCALE3 (0U)
  124. #else
  125. #define PWR_REGULATOR_VOLTAGE_SCALE0 (0U)
  126. #define PWR_REGULATOR_VOLTAGE_SCALE1 (PWR_D3CR_VOS_1 | PWR_D3CR_VOS_0)
  127. #define PWR_REGULATOR_VOLTAGE_SCALE2 (PWR_D3CR_VOS_1)
  128. #define PWR_REGULATOR_VOLTAGE_SCALE3 (PWR_D3CR_VOS_0)
  129. #endif /* PWR_SRDCR_VOS */
  130. /**
  131. * @}
  132. */
  133. /** @defgroup PWR_Flag PWR Flag
  134. * @{
  135. */
  136. /* PWR CPU flag */
  137. #define PWR_FLAG_STOP (0x01U)
  138. #if defined (PWR_CPUCR_SBF_D2)
  139. #define PWR_FLAG_SB_D1 (0x02U)
  140. #define PWR_FLAG_SB_D2 (0x03U)
  141. #endif /* defined (PWR_CPUCR_SBF_D2) */
  142. #define PWR_FLAG_SB (0x04U)
  143. #if defined (DUAL_CORE)
  144. #define PWR_FLAG_CPU_HOLD (0x05U)
  145. #define PWR_FLAG_CPU2_HOLD (0x06U)
  146. #define PWR_FLAG2_STOP (0x07U)
  147. #define PWR_FLAG2_SB_D1 (0x08U)
  148. #define PWR_FLAG2_SB_D2 (0x09U)
  149. #define PWR_FLAG2_SB (0x0AU)
  150. #endif /* defined (DUAL_CORE) */
  151. #define PWR_FLAG_PVDO (0x0BU)
  152. #define PWR_FLAG_AVDO (0x0CU)
  153. #define PWR_FLAG_ACTVOSRDY (0x0DU)
  154. #define PWR_FLAG_ACTVOS (0x0EU)
  155. #define PWR_FLAG_BRR (0x0FU)
  156. #define PWR_FLAG_VOSRDY (0x10U)
  157. #if defined (SMPS)
  158. #define PWR_FLAG_SMPSEXTRDY (0x11U)
  159. #else
  160. #define PWR_FLAG_SCUEN (0x11U)
  161. #endif /* defined (SMPS) */
  162. #if defined (PWR_CSR1_MMCVDO)
  163. #define PWR_FLAG_MMCVDO (0x12U)
  164. #endif /* defined (PWR_CSR1_MMCVDO) */
  165. #define PWR_FLAG_USB33RDY (0x13U)
  166. #define PWR_FLAG_TEMPH (0x14U)
  167. #define PWR_FLAG_TEMPL (0x15U)
  168. #define PWR_FLAG_VBATH (0x16U)
  169. #define PWR_FLAG_VBATL (0x17U)
  170. /* PWR Wake up flag */
  171. #define PWR_FLAG_WKUP1 PWR_WKUPCR_WKUPC1
  172. #define PWR_FLAG_WKUP2 PWR_WKUPCR_WKUPC2
  173. #define PWR_FLAG_WKUP3 PWR_WKUPCR_WKUPC3
  174. #define PWR_FLAG_WKUP4 PWR_WKUPCR_WKUPC4
  175. #define PWR_FLAG_WKUP5 PWR_WKUPCR_WKUPC5
  176. #define PWR_FLAG_WKUP6 PWR_WKUPCR_WKUPC6
  177. /**
  178. * @}
  179. */
  180. /** @defgroup PWR_ENABLE_WUP_Mask PWR Enable WUP Mask
  181. * @{
  182. */
  183. #define PWR_EWUP_MASK (0x0FFF3F3FU)
  184. /**
  185. * @}
  186. */
  187. /**
  188. * @}
  189. */
  190. /* Exported macro ------------------------------------------------------------*/
  191. /** @defgroup PWR_Exported_Macro PWR Exported Macro
  192. * @{
  193. */
  194. /** @brief Configure the main internal regulator output voltage.
  195. * @param __REGULATOR__ : Specifies the regulator output voltage to achieve a
  196. * trade-off between performance and power consumption
  197. * when the device does not operate at the maximum
  198. * frequency (refer to the datasheet for more details).
  199. * This parameter can be one of the following values:
  200. * @arg PWR_REGULATOR_VOLTAGE_SCALE0 : Regulator voltage output
  201. * Scale 0 mode.
  202. * @arg PWR_REGULATOR_VOLTAGE_SCALE1 : Regulator voltage output
  203. * Scale 1 mode.
  204. * @arg PWR_REGULATOR_VOLTAGE_SCALE2 : Regulator voltage output
  205. * Scale 2 mode.
  206. * @arg PWR_REGULATOR_VOLTAGE_SCALE3 : Regulator voltage output
  207. * Scale 3 mode.
  208. * @note For STM32H74x and STM32H75x lines, configuring Voltage Scale 0 is
  209. * only possible when Vcore is supplied from LDO (Low DropOut). The
  210. * SYSCFG Clock must be enabled through __HAL_RCC_SYSCFG_CLK_ENABLE()
  211. * macro before configuring Voltage Scale 0 using
  212. * __HAL_PWR_VOLTAGESCALING_CONFIG().
  213. * Transition to Voltage Scale 0 is only possible when the system is
  214. * already in Voltage Scale 1.
  215. * Transition from Voltage Scale 0 is only possible to Voltage Scale 1
  216. * then once in Voltage Scale 1 it is possible to switch to another
  217. * voltage scale.
  218. * After each regulator voltage setting, wait on VOSRDY flag to be set
  219. * using macro __HAL_PWR_GET_FLAG().
  220. * To enter low power mode , and if current regulator voltage is
  221. * Voltage Scale 0 then first switch to Voltage Scale 1 before entering
  222. * low power mode.
  223. * @retval None.
  224. */
  225. #if defined (PWR_SRDCR_VOS) /* STM32H7Axxx and STM32H7Bxxx lines */
  226. #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) \
  227. do { \
  228. __IO uint32_t tmpreg = 0x00; \
  229. /* Configure the Voltage Scaling */ \
  230. MODIFY_REG(PWR->SRDCR, PWR_SRDCR_VOS, (__REGULATOR__)); \
  231. /* Delay after setting the voltage scaling */ \
  232. tmpreg = READ_BIT(PWR->SRDCR, PWR_SRDCR_VOS); \
  233. UNUSED(tmpreg); \
  234. } while(0)
  235. #else /* 3 power domains devices */
  236. #if defined(SYSCFG_PWRCR_ODEN) /* STM32H74xxx and STM32H75xxx lines */
  237. #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) \
  238. do { \
  239. __IO uint32_t tmpreg = 0x00; \
  240. /* Check the voltage scaling to be configured */ \
  241. if((__REGULATOR__) == PWR_REGULATOR_VOLTAGE_SCALE0) \
  242. { \
  243. /* Configure the Voltage Scaling 1 */ \
  244. MODIFY_REG(PWR->D3CR, PWR_D3CR_VOS, PWR_REGULATOR_VOLTAGE_SCALE1); \
  245. /* Delay after setting the voltage scaling */ \
  246. tmpreg = READ_BIT(PWR->D3CR, PWR_D3CR_VOS); \
  247. /* Enable the PWR overdrive */ \
  248. SET_BIT(SYSCFG->PWRCR, SYSCFG_PWRCR_ODEN); \
  249. /* Delay after setting the syscfg boost setting */ \
  250. tmpreg = READ_BIT(SYSCFG->PWRCR, SYSCFG_PWRCR_ODEN); \
  251. } \
  252. else \
  253. { \
  254. /* Disable the PWR overdrive */ \
  255. CLEAR_BIT(SYSCFG->PWRCR, SYSCFG_PWRCR_ODEN); \
  256. /* Delay after setting the syscfg boost setting */ \
  257. tmpreg = READ_BIT(SYSCFG->PWRCR, SYSCFG_PWRCR_ODEN); \
  258. /* Configure the Voltage Scaling x */ \
  259. MODIFY_REG(PWR->D3CR, PWR_D3CR_VOS, (__REGULATOR__)); \
  260. /* Delay after setting the voltage scaling */ \
  261. tmpreg = READ_BIT(PWR->D3CR, PWR_D3CR_VOS); \
  262. } \
  263. UNUSED(tmpreg); \
  264. } while(0)
  265. #else /* STM32H72xxx and STM32H73xxx lines */
  266. #define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__) \
  267. do { \
  268. __IO uint32_t tmpreg = 0x00; \
  269. /* Configure the Voltage Scaling */ \
  270. MODIFY_REG (PWR->D3CR, PWR_D3CR_VOS, (__REGULATOR__)); \
  271. /* Delay after setting the voltage scaling */ \
  272. tmpreg = READ_BIT(PWR->D3CR, PWR_D3CR_VOS); \
  273. UNUSED(tmpreg); \
  274. } while(0)
  275. #endif /* defined(SYSCFG_PWRCR_ODEN) */
  276. #endif /* defined (PWR_SRDCR_VOS) */
  277. /** @brief Check PWR flags are set or not.
  278. * @param __FLAG__ : Specifies the flag to check.
  279. * This parameter can be one of the following values:
  280. * @arg PWR_FLAG_PVDO : PVD Output. This flag is valid only if PVD
  281. * is enabled by the HAL_PWR_EnablePVD()
  282. * function.
  283. * The PVD is stopped by STANDBY mode. For this
  284. * reason, this bit is equal to 0 after STANDBY
  285. * or reset until the PVDE bit is set.
  286. * @arg PWR_FLAG_AVDO : AVD Output. This flag is valid only if AVD
  287. * is enabled by the HAL_PWREx_EnableAVD()
  288. * function. The AVD is stopped by STANDBY mode.
  289. * For this reason, this bit is equal to 0
  290. * after STANDBY or reset until the AVDE bit
  291. * is set.
  292. * @arg PWR_FLAG_ACTVOSRDY : This flag indicates that the Regulator
  293. * voltage scaling output selection is
  294. * ready.
  295. * @arg PWR_FLAG_BRR : Backup regulator ready flag. This bit is not
  296. * reset when the device wakes up from STANDBY
  297. * mode or by a system reset or power-on reset.
  298. * @arg PWR_FLAG_VOSRDY : This flag indicates that the Regulator
  299. * voltage scaling output selection is ready.
  300. * mode or by a system reset or power-on reset.
  301. * @arg PWR_FLAG_USB33RDY : This flag indicates that the USB supply
  302. * from regulator is ready.
  303. * @arg PWR_FLAG_TEMPH : This flag indicates that the temperature
  304. * equal or above high threshold level.
  305. * @arg PWR_FLAG_TEMPL : This flag indicates that the temperature
  306. * equal or below low threshold level.
  307. * @arg PWR_FLAG_VBATH : This flag indicates that VBAT level equal
  308. * or above high threshold level.
  309. * @arg PWR_FLAG_VBATL : This flag indicates that VBAT level equal
  310. * or below low threshold level.
  311. * @arg PWR_FLAG_STOP : This flag indicates that the system entered
  312. * in STOP mode.
  313. * @arg PWR_FLAG_SB : This flag indicates that the system entered in
  314. * STANDBY mode.
  315. * @arg PWR_FLAG_SB_D1 : This flag indicates that the D1 domain
  316. * entered in STANDBY mode.
  317. * @arg PWR_FLAG_SB_D2 : This flag indicates that the D2 domain
  318. * entered in STANDBY mode.
  319. * @arg PWR_FLAG2_STOP : This flag indicates that the system entered
  320. * in STOP mode.
  321. * @arg PWR_FLAG2_SB : This flag indicates that the system entered
  322. * in STANDBY mode.
  323. * @arg PWR_FLAG2_SB_D1 : This flag indicates that the D1 domain
  324. * entered in STANDBY mode.
  325. * @arg PWR_FLAG2_SB_D2 : This flag indicates that the D2 domain
  326. * entered in STANDBY mode.
  327. * @arg PWR_FLAG_CPU_HOLD : This flag indicates that the CPU1 wakes
  328. * up with hold.
  329. * @arg PWR_FLAG_CPU2_HOLD : This flag indicates that the CPU2 wakes
  330. * up with hold.
  331. * @arg PWR_FLAG_SMPSEXTRDY : This flag indicates that the SMPS
  332. * External supply is sready.
  333. * @arg PWR_FLAG_SCUEN : This flag indicates that the supply
  334. * configuration update is enabled.
  335. * @arg PWR_FLAG_MMCVDO : This flag indicates that the VDDMMC is
  336. * above or equal to 1.2 V.
  337. * @note The PWR_FLAG_PVDO, PWR_FLAG_AVDO, PWR_FLAG_ACTVOSRDY, PWR_FLAG_BRR,
  338. * PWR_FLAG_VOSRDY, PWR_FLAG_USB33RDY, PWR_FLAG_TEMPH, PWR_FLAG_TEMPL,
  339. * PWR_FLAG_VBATH, PWR_FLAG_VBATL, PWR_FLAG_STOP and PWR_FLAG_SB flags
  340. * are used for all H7 family lines.
  341. * The PWR_FLAG2_STOP, PWR_FLAG2_SB, PWR_FLAG2_SB_D1, PWR_FLAG2_SB_D2,
  342. * PWR_FLAG_CPU_HOLD and PWR_FLAG_CPU2_HOLD flags are used only for H7
  343. * dual core lines.
  344. * The PWR_FLAG_SB_D1 and PWR_FLAG_SB_D2 flags are used for all H7
  345. * family except STM32H7Axxx and STM32H7Bxxx lines.
  346. * The PWR_FLAG_MMCVDO flag is used only for STM32H7Axxx and
  347. * STM32H7Bxxx lines.
  348. * The PWR_FLAG_SCUEN flag is used for devices that support only LDO
  349. * regulator.
  350. * The PWR_FLAG_SMPSEXTRDY flag is used for devices that support LDO
  351. * and SMPS regulators.
  352. * @retval The (__FLAG__) state (TRUE or FALSE).
  353. */
  354. #if defined (DUAL_CORE) /* Dual core lines */
  355. #define __HAL_PWR_GET_FLAG(__FLAG__) \
  356. (((__FLAG__) == PWR_FLAG_PVDO) ? ((PWR->CSR1 & PWR_CSR1_PVDO) == PWR_CSR1_PVDO) :\
  357. ((__FLAG__) == PWR_FLAG_AVDO) ? ((PWR->CSR1 & PWR_CSR1_AVDO) == PWR_CSR1_AVDO) :\
  358. ((__FLAG__) == PWR_FLAG_ACTVOSRDY) ? ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == PWR_CSR1_ACTVOSRDY) :\
  359. ((__FLAG__) == PWR_FLAG_VOSRDY) ? ((PWR->D3CR & PWR_D3CR_VOSRDY) == PWR_D3CR_VOSRDY) :\
  360. ((__FLAG__) == PWR_FLAG_SMPSEXTRDY) ? ((PWR->CR3 & PWR_CR3_SMPSEXTRDY) == PWR_CR3_SMPSEXTRDY) :\
  361. ((__FLAG__) == PWR_FLAG_BRR) ? ((PWR->CR2 & PWR_CR2_BRRDY) == PWR_CR2_BRRDY) :\
  362. ((__FLAG__) == PWR_FLAG_CPU_HOLD) ? ((PWR->CPU2CR & PWR_CPU2CR_HOLD1F) == PWR_CPU2CR_HOLD1F) :\
  363. ((__FLAG__) == PWR_FLAG_CPU2_HOLD) ? ((PWR->CPUCR & PWR_CPUCR_HOLD2F) == PWR_CPUCR_HOLD2F) :\
  364. ((__FLAG__) == PWR_FLAG_SB) ? ((PWR->CPUCR & PWR_CPUCR_SBF) == PWR_CPUCR_SBF) :\
  365. ((__FLAG__) == PWR_FLAG2_SB) ? ((PWR->CPU2CR & PWR_CPU2CR_SBF) == PWR_CPU2CR_SBF) :\
  366. ((__FLAG__) == PWR_FLAG_STOP) ? ((PWR->CPUCR & PWR_CPUCR_STOPF) == PWR_CPUCR_STOPF) :\
  367. ((__FLAG__) == PWR_FLAG2_STOP) ? ((PWR->CPU2CR & PWR_CPU2CR_STOPF) == PWR_CPU2CR_STOPF) :\
  368. ((__FLAG__) == PWR_FLAG_SB_D1) ? ((PWR->CPUCR & PWR_CPUCR_SBF_D1) == PWR_CPUCR_SBF_D1) :\
  369. ((__FLAG__) == PWR_FLAG2_SB_D1) ? ((PWR->CPU2CR & PWR_CPU2CR_SBF_D1) == PWR_CPU2CR_SBF_D1) :\
  370. ((__FLAG__) == PWR_FLAG_SB_D2) ? ((PWR->CPUCR & PWR_CPUCR_SBF_D2) == PWR_CPUCR_SBF_D2) :\
  371. ((__FLAG__) == PWR_FLAG2_SB_D2) ? ((PWR->CPU2CR & PWR_CPU2CR_SBF_D2) == PWR_CPU2CR_SBF_D2) :\
  372. ((__FLAG__) == PWR_FLAG_USB33RDY) ? ((PWR->CR3 & PWR_CR3_USB33RDY) == PWR_CR3_USB33RDY) :\
  373. ((__FLAG__) == PWR_FLAG_TEMPH) ? ((PWR->CR2 & PWR_CR2_TEMPH) == PWR_CR2_TEMPH) :\
  374. ((__FLAG__) == PWR_FLAG_TEMPL) ? ((PWR->CR2 & PWR_CR2_TEMPL) == PWR_CR2_TEMPL) :\
  375. ((__FLAG__) == PWR_FLAG_VBATH) ? ((PWR->CR2 & PWR_CR2_VBATH) == PWR_CR2_VBATH) :\
  376. ((PWR->CR2 & PWR_CR2_VBATL) == PWR_CR2_VBATL))
  377. #else /* Single core lines */
  378. #if defined (PWR_CPUCR_SBF_D2) /* STM32H72x, STM32H73x, STM32H74x and STM32H75x lines */
  379. #if defined (SMPS) /* STM32H725 and STM32H735 lines */
  380. #define __HAL_PWR_GET_FLAG(__FLAG__) \
  381. (((__FLAG__) == PWR_FLAG_PVDO) ? ((PWR->CSR1 & PWR_CSR1_PVDO) == PWR_CSR1_PVDO) :\
  382. ((__FLAG__) == PWR_FLAG_AVDO) ? ((PWR->CSR1 & PWR_CSR1_AVDO) == PWR_CSR1_AVDO) :\
  383. ((__FLAG__) == PWR_FLAG_ACTVOSRDY) ? ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == PWR_CSR1_ACTVOSRDY) :\
  384. ((__FLAG__) == PWR_FLAG_VOSRDY) ? ((PWR->D3CR & PWR_D3CR_VOSRDY) == PWR_D3CR_VOSRDY) :\
  385. ((__FLAG__) == PWR_FLAG_SMPSEXTRDY) ? ((PWR->CR3 & PWR_FLAG_SMPSEXTRDY) == PWR_FLAG_SMPSEXTRDY) :\
  386. ((__FLAG__) == PWR_FLAG_BRR) ? ((PWR->CR2 & PWR_CR2_BRRDY) == PWR_CR2_BRRDY) :\
  387. ((__FLAG__) == PWR_FLAG_SB) ? ((PWR->CPUCR & PWR_CPUCR_SBF) == PWR_CPUCR_SBF) :\
  388. ((__FLAG__) == PWR_FLAG_STOP) ? ((PWR->CPUCR & PWR_CPUCR_STOPF) == PWR_CPUCR_STOPF) :\
  389. ((__FLAG__) == PWR_FLAG_SB_D1) ? ((PWR->CPUCR & PWR_CPUCR_SBF_D1) == PWR_CPUCR_SBF_D1) :\
  390. ((__FLAG__) == PWR_FLAG_SB_D2) ? ((PWR->CPUCR & PWR_CPUCR_SBF_D2) == PWR_CPUCR_SBF_D2) :\
  391. ((__FLAG__) == PWR_FLAG_USB33RDY) ? ((PWR->CR3 & PWR_CR3_USB33RDY) == PWR_CR3_USB33RDY) :\
  392. ((__FLAG__) == PWR_FLAG_TEMPH) ? ((PWR->CR2 & PWR_CR2_TEMPH) == PWR_CR2_TEMPH) :\
  393. ((__FLAG__) == PWR_FLAG_TEMPL) ? ((PWR->CR2 & PWR_CR2_TEMPL) == PWR_CR2_TEMPL) :\
  394. ((__FLAG__) == PWR_FLAG_VBATH) ? ((PWR->CR2 & PWR_CR2_VBATH) == PWR_CR2_VBATH) :\
  395. ((PWR->CR2 & PWR_CR2_VBATL) == PWR_CR2_VBATL))
  396. #else /* STM32H723, STM32H733, STM32H742, STM32H743, STM32H750 and STM32H753 lines */
  397. #define __HAL_PWR_GET_FLAG(__FLAG__) \
  398. (((__FLAG__) == PWR_FLAG_PVDO) ? ((PWR->CSR1 & PWR_CSR1_PVDO) == PWR_CSR1_PVDO) :\
  399. ((__FLAG__) == PWR_FLAG_AVDO) ? ((PWR->CSR1 & PWR_CSR1_AVDO) == PWR_CSR1_AVDO) :\
  400. ((__FLAG__) == PWR_FLAG_ACTVOSRDY) ? ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == PWR_CSR1_ACTVOSRDY) :\
  401. ((__FLAG__) == PWR_FLAG_VOSRDY) ? ((PWR->D3CR & PWR_D3CR_VOSRDY) == PWR_D3CR_VOSRDY) :\
  402. ((__FLAG__) == PWR_FLAG_SCUEN) ? ((PWR->CR3 & PWR_CR3_SCUEN) == PWR_CR3_SCUEN) :\
  403. ((__FLAG__) == PWR_FLAG_BRR) ? ((PWR->CR2 & PWR_CR2_BRRDY) == PWR_CR2_BRRDY) :\
  404. ((__FLAG__) == PWR_FLAG_SB) ? ((PWR->CPUCR & PWR_CPUCR_SBF) == PWR_CPUCR_SBF) :\
  405. ((__FLAG__) == PWR_FLAG_STOP) ? ((PWR->CPUCR & PWR_CPUCR_STOPF) == PWR_CPUCR_STOPF) :\
  406. ((__FLAG__) == PWR_FLAG_SB_D1) ? ((PWR->CPUCR & PWR_CPUCR_SBF_D1) == PWR_CPUCR_SBF_D1) :\
  407. ((__FLAG__) == PWR_FLAG_SB_D2) ? ((PWR->CPUCR & PWR_CPUCR_SBF_D2) == PWR_CPUCR_SBF_D2) :\
  408. ((__FLAG__) == PWR_FLAG_USB33RDY) ? ((PWR->CR3 & PWR_CR3_USB33RDY) == PWR_CR3_USB33RDY) :\
  409. ((__FLAG__) == PWR_FLAG_TEMPH) ? ((PWR->CR2 & PWR_CR2_TEMPH) == PWR_CR2_TEMPH) :\
  410. ((__FLAG__) == PWR_FLAG_TEMPL) ? ((PWR->CR2 & PWR_CR2_TEMPL) == PWR_CR2_TEMPL) :\
  411. ((__FLAG__) == PWR_FLAG_VBATH) ? ((PWR->CR2 & PWR_CR2_VBATH) == PWR_CR2_VBATH) :\
  412. ((PWR->CR2 & PWR_CR2_VBATL) == PWR_CR2_VBATL))
  413. #endif /* defined (SMPS) */
  414. #else /* STM32H7Axxx and STM32H7Bxxx lines */
  415. #if defined (SMPS) /* STM32H7AxxQ and STM32H7BxxQ lines */
  416. #define __HAL_PWR_GET_FLAG(__FLAG__) \
  417. (((__FLAG__) == PWR_FLAG_PVDO) ? ((PWR->CSR1 & PWR_CSR1_PVDO) == PWR_CSR1_PVDO) :\
  418. ((__FLAG__) == PWR_FLAG_AVDO) ? ((PWR->CSR1 & PWR_CSR1_AVDO) == PWR_CSR1_AVDO) :\
  419. ((__FLAG__) == PWR_FLAG_ACTVOSRDY) ? ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == PWR_CSR1_ACTVOSRDY) :\
  420. ((__FLAG__) == PWR_FLAG_BRR) ? ((PWR->CR2 & PWR_CR2_BRRDY) == PWR_CR2_BRRDY) :\
  421. ((__FLAG__) == PWR_FLAG_VOSRDY) ? ((PWR->SRDCR & PWR_SRDCR_VOSRDY) == PWR_SRDCR_VOSRDY) :\
  422. ((__FLAG__) == PWR_FLAG_STOP) ? ((PWR->CPUCR & PWR_CPUCR_STOPF) == PWR_CPUCR_STOPF) :\
  423. ((__FLAG__) == PWR_FLAG_SB) ? ((PWR->CPUCR & PWR_CPUCR_SBF) == PWR_CPUCR_SBF) :\
  424. ((__FLAG__) == PWR_FLAG_MMCVDO) ? ((PWR->CSR1 & PWR_CSR1_MMCVDO) == PWR_CSR1_MMCVDO) :\
  425. ((__FLAG__) == PWR_FLAG_SMPSEXTRDY) ? ((PWR->CR3 & PWR_CR3_SMPSEXTRDY) == PWR_CR3_SMPSEXTRDY) :\
  426. ((__FLAG__) == PWR_FLAG_USB33RDY) ? ((PWR->CR3 & PWR_CR3_USB33RDY) == PWR_CR3_USB33RDY) :\
  427. ((__FLAG__) == PWR_FLAG_TEMPH) ? ((PWR->CR2 & PWR_CR2_TEMPH) == PWR_CR2_TEMPH) :\
  428. ((__FLAG__) == PWR_FLAG_TEMPL) ? ((PWR->CR2 & PWR_CR2_TEMPL) == PWR_CR2_TEMPL) :\
  429. ((__FLAG__) == PWR_FLAG_VBATH) ? ((PWR->CR2 & PWR_CR2_VBATH) == PWR_CR2_VBATH) :\
  430. ((PWR->CR2 & PWR_CR2_VBATL) == PWR_CR2_VBATL))
  431. #else /* STM32H7Axx and STM32H7Bxx lines */
  432. #define __HAL_PWR_GET_FLAG(__FLAG__) \
  433. (((__FLAG__) == PWR_FLAG_PVDO) ? ((PWR->CSR1 & PWR_CSR1_PVDO) == PWR_CSR1_PVDO) :\
  434. ((__FLAG__) == PWR_FLAG_AVDO) ? ((PWR->CSR1 & PWR_CSR1_AVDO) == PWR_CSR1_AVDO) :\
  435. ((__FLAG__) == PWR_FLAG_ACTVOSRDY) ? ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == PWR_CSR1_ACTVOSRDY) :\
  436. ((__FLAG__) == PWR_FLAG_BRR) ? ((PWR->CR2 & PWR_CR2_BRRDY) == PWR_CR2_BRRDY) :\
  437. ((__FLAG__) == PWR_FLAG_VOSRDY) ? ((PWR->SRDCR & PWR_SRDCR_VOSRDY) == PWR_SRDCR_VOSRDY) :\
  438. ((__FLAG__) == PWR_FLAG_SCUEN) ? ((PWR->CR3 & PWR_CR3_SCUEN) == PWR_CR3_SCUEN) :\
  439. ((__FLAG__) == PWR_FLAG_STOP) ? ((PWR->CPUCR & PWR_CPUCR_STOPF) == PWR_CPUCR_STOPF) :\
  440. ((__FLAG__) == PWR_FLAG_SB) ? ((PWR->CPUCR & PWR_CPUCR_SBF) == PWR_CPUCR_SBF) :\
  441. ((__FLAG__) == PWR_FLAG_MMCVDO) ? ((PWR->CSR1 & PWR_CSR1_MMCVDO) == PWR_CSR1_MMCVDO) :\
  442. ((__FLAG__) == PWR_FLAG_USB33RDY) ? ((PWR->CR3 & PWR_CR3_USB33RDY) == PWR_CR3_USB33RDY) :\
  443. ((__FLAG__) == PWR_FLAG_TEMPH) ? ((PWR->CR2 & PWR_CR2_TEMPH) == PWR_CR2_TEMPH) :\
  444. ((__FLAG__) == PWR_FLAG_TEMPL) ? ((PWR->CR2 & PWR_CR2_TEMPL) == PWR_CR2_TEMPL) :\
  445. ((__FLAG__) == PWR_FLAG_VBATH) ? ((PWR->CR2 & PWR_CR2_VBATH) == PWR_CR2_VBATH) :\
  446. ((PWR->CR2 & PWR_CR2_VBATL) == PWR_CR2_VBATL))
  447. #endif /* SMPS */
  448. #endif /* PWR_CPUCR_SBF_D2 */
  449. #endif /* DUAL_CORE */
  450. /** @brief Check PWR wake up flags are set or not.
  451. * @param __FLAG__: specifies the wake up flag to check.
  452. * This parameter can be one of the following values:
  453. * @arg PWR_FLAG_WKUP1 : This parameter clear Wake up line 1 flag.
  454. * @arg PWR_FLAG_WKUP2 : This parameter clear Wake up line 2 flag.
  455. * @arg PWR_FLAG_WKUP3 : This parameter clear Wake up line 3 flag.
  456. * @arg PWR_FLAG_WKUP4 : This parameter clear Wake up line 4 flag.
  457. * @arg PWR_FLAG_WKUP5 : This parameter clear Wake up line 5 flag.
  458. * @arg PWR_FLAG_WKUP6 : This parameter clear Wake up line 6 flag.
  459. * @note The PWR_FLAG_WKUP3 and PWR_FLAG_WKUP5 are available only for devices
  460. * that support GPIOI port.
  461. * @retval The (__FLAG__) state (TRUE or FALSE).
  462. */
  463. #define __HAL_PWR_GET_WAKEUPFLAG(__FLAG__) ((PWR->WKUPFR & (__FLAG__)) ? 0 : 1)
  464. #if defined (DUAL_CORE)
  465. /** @brief Clear CPU PWR flags.
  466. * @param __FLAG__ : Specifies the flag to clear.
  467. * @note This parameter is not used for the STM32H7 family and is kept as
  468. * parameter just to maintain compatibility with other families.
  469. * @note This macro clear all CPU flags STOPF, SBF, SBF_D1, and SBF_D2.
  470. * This parameter can be one of the following values :
  471. * @arg PWR_CPU_FLAGS : Clear HOLD2F, STOPF, SBF, SBF_D1, and SBF_D2
  472. * CPU flags.
  473. * @retval None.
  474. */
  475. #define __HAL_PWR_CLEAR_FLAG(__FLAG__) \
  476. do { \
  477. SET_BIT(PWR->CPUCR, PWR_CPUCR_CSSF); \
  478. SET_BIT(PWR->CPU2CR, PWR_CPU2CR_CSSF); \
  479. } while(0)
  480. #else
  481. /** @brief Clear CPU PWR flags.
  482. * @param __FLAG__ : Specifies the flag to clear.
  483. * @note This parameter is not used for the STM32H7 family and is kept as
  484. * parameter just to maintain compatibility with other families.
  485. * @note This macro clear all CPU flags.
  486. * For single core devices except STM32H7Axxx and STM32H7Bxxx, CPU
  487. * flags are STOPF, SBF, SBF_D1 and SBF_D2.
  488. * For STM32H7Axxx and STM32H7Bxxx lines, CPU flags are STOPF and SBF.
  489. * @retval None.
  490. */
  491. #define __HAL_PWR_CLEAR_FLAG(__FLAG__) SET_BIT(PWR->CPUCR, PWR_CPUCR_CSSF)
  492. #endif /* defined (DUAL_CORE) */
  493. /** @brief Clear PWR wake up flags.
  494. * @param __FLAG__ : Specifies the wake up flag to be cleared.
  495. * This parameter can be one of the following values :
  496. * @arg PWR_FLAG_WKUP1 : This parameter clear Wake up line 1 flag.
  497. * @arg PWR_FLAG_WKUP2 : This parameter clear Wake up line 2 flag.
  498. * @arg PWR_FLAG_WKUP3 : This parameter clear Wake up line 3 flag.
  499. * @arg PWR_FLAG_WKUP4 : This parameter clear Wake up line 4 flag.
  500. * @arg PWR_FLAG_WKUP5 : This parameter clear Wake up line 5 flag.
  501. * @arg PWR_FLAG_WKUP6 : This parameter clear Wake up line 6 flag.
  502. * @note The PWR_FLAG_WKUP3 and PWR_FLAG_WKUP5 are available only for devices
  503. * that support GPIOI port.
  504. * @retval None.
  505. */
  506. #define __HAL_PWR_CLEAR_WAKEUPFLAG(__FLAG__) SET_BIT(PWR->WKUPCR, (__FLAG__))
  507. /**
  508. * @brief Enable the PVD EXTI Line 16.
  509. * @retval None.
  510. */
  511. #define __HAL_PWR_PVD_EXTI_ENABLE_IT() SET_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD)
  512. #if defined (DUAL_CORE)
  513. /**
  514. * @brief Enable the PVD EXTI D2 Line 16.
  515. * @retval None.
  516. */
  517. #define __HAL_PWR_PVD_EXTID2_ENABLE_IT() SET_BIT(EXTI_D2->IMR1, PWR_EXTI_LINE_PVD)
  518. #endif /* defined (DUAL_CORE) */
  519. /**
  520. * @brief Disable the PVD EXTI Line 16.
  521. * @retval None.
  522. */
  523. #define __HAL_PWR_PVD_EXTI_DISABLE_IT() CLEAR_BIT(EXTI->IMR1, PWR_EXTI_LINE_PVD)
  524. #if defined (DUAL_CORE)
  525. /**
  526. * @brief Disable the PVD EXTI D2 Line 16.
  527. * @retval None.
  528. */
  529. #define __HAL_PWR_PVD_EXTID2_DISABLE_IT() CLEAR_BIT(EXTI_D2->IMR1, PWR_EXTI_LINE_PVD)
  530. #endif /* defined (DUAL_CORE) */
  531. /**
  532. * @brief Enable event on PVD EXTI Line 16.
  533. * @retval None.
  534. */
  535. #define __HAL_PWR_PVD_EXTI_ENABLE_EVENT() SET_BIT(EXTI->EMR1, PWR_EXTI_LINE_PVD)
  536. #if defined (DUAL_CORE)
  537. /**
  538. * @brief Enable event on PVD EXTI D2 Line.
  539. * @retval None.
  540. */
  541. #define __HAL_PWR_PVD_EXTID2_ENABLE_EVENT() SET_BIT(EXTI_D2->EMR1, PWR_EXTI_LINE_PVD)
  542. #endif /* defined (DUAL_CORE) */
  543. /**
  544. * @brief Disable event on PVD EXTI Line 16.
  545. * @retval None.
  546. */
  547. #define __HAL_PWR_PVD_EXTI_DISABLE_EVENT() CLEAR_BIT(EXTI->EMR1, PWR_EXTI_LINE_PVD)
  548. #if defined (DUAL_CORE)
  549. /**
  550. * @brief Disable event on PVD EXTI D2 Line.
  551. * @retval None.
  552. */
  553. #define __HAL_PWR_PVD_EXTID2_DISABLE_EVENT() CLEAR_BIT(EXTI_D2->EMR1, PWR_EXTI_LINE_PVD)
  554. #endif /* defined (DUAL_CORE) */
  555. /**
  556. * @brief Enable the PVD Rising Interrupt Trigger.
  557. * @retval None.
  558. */
  559. #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE() SET_BIT(EXTI->RTSR1, PWR_EXTI_LINE_PVD)
  560. /**
  561. * @brief Disable the PVD Rising Interrupt Trigger.
  562. * @retval None.
  563. */
  564. #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE() CLEAR_BIT(EXTI->RTSR1, PWR_EXTI_LINE_PVD)
  565. /**
  566. * @brief Enable the PVD Falling Interrupt Trigger.
  567. * @retval None.
  568. */
  569. #define __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE() SET_BIT(EXTI->FTSR1, PWR_EXTI_LINE_PVD)
  570. /**
  571. * @brief Disable the PVD Falling Interrupt Trigger.
  572. * @retval None.
  573. */
  574. #define __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE() CLEAR_BIT(EXTI->FTSR1, PWR_EXTI_LINE_PVD)
  575. /**
  576. * @brief Enable the PVD Rising & Falling Interrupt Trigger.
  577. * @retval None.
  578. */
  579. #define __HAL_PWR_PVD_EXTI_ENABLE_RISING_FALLING_EDGE() \
  580. do { \
  581. __HAL_PWR_PVD_EXTI_ENABLE_RISING_EDGE(); \
  582. __HAL_PWR_PVD_EXTI_ENABLE_FALLING_EDGE(); \
  583. } while(0);
  584. /**
  585. * @brief Disable the PVD Rising & Falling Interrupt Trigger.
  586. * @retval None.
  587. */
  588. #define __HAL_PWR_PVD_EXTI_DISABLE_RISING_FALLING_EDGE() \
  589. do { \
  590. __HAL_PWR_PVD_EXTI_DISABLE_RISING_EDGE(); \
  591. __HAL_PWR_PVD_EXTI_DISABLE_FALLING_EDGE(); \
  592. } while(0);
  593. /**
  594. * @brief Check whether the specified PVD EXTI interrupt flag is set or not.
  595. * @retval EXTI PVD Line Status.
  596. */
  597. #define __HAL_PWR_PVD_EXTI_GET_FLAG() ((READ_BIT(EXTI->PR1, PWR_EXTI_LINE_PVD) == PWR_EXTI_LINE_PVD) ? 1UL : 0UL)
  598. #if defined (DUAL_CORE)
  599. /**
  600. * @brief Checks whether the specified PVD EXTI interrupt flag is set or not.
  601. * @retval EXTI D2 PVD Line Status.
  602. */
  603. #define __HAL_PWR_PVD_EXTID2_GET_FLAG() ((READ_BIT(EXTI_D2->PR1, PWR_EXTI_LINE_PVD) == PWR_EXTI_LINE_PVD) ? 1UL : 0UL)
  604. #endif /* defined (DUAL_CORE) */
  605. /**
  606. * @brief Clear the PVD EXTI flag.
  607. * @retval None.
  608. */
  609. #define __HAL_PWR_PVD_EXTI_CLEAR_FLAG() SET_BIT(EXTI->PR1, PWR_EXTI_LINE_PVD)
  610. #if defined (DUAL_CORE)
  611. /**
  612. * @brief Clear the PVD EXTI D2 flag.
  613. * @retval None.
  614. */
  615. #define __HAL_PWR_PVD_EXTID2_CLEAR_FLAG() SET_BIT(EXTI_D2->PR1, PWR_EXTI_LINE_PVD)
  616. #endif /* defined (DUAL_CORE) */
  617. /**
  618. * @brief Generates a Software interrupt on PVD EXTI line.
  619. * @retval None.
  620. */
  621. #define __HAL_PWR_PVD_EXTI_GENERATE_SWIT() SET_BIT(EXTI->SWIER1, PWR_EXTI_LINE_PVD)
  622. /**
  623. * @}
  624. */
  625. /* Include PWR HAL Extension module */
  626. #include "stm32h7xx_hal_pwr_ex.h"
  627. /* Exported functions --------------------------------------------------------*/
  628. /** @addtogroup PWR_Exported_Functions PWR Exported Functions
  629. * @{
  630. */
  631. /** @addtogroup PWR_Exported_Functions_Group1 Initialization and De-Initialization Functions
  632. * @{
  633. */
  634. /* Initialization and de-initialization functions *****************************/
  635. void HAL_PWR_DeInit (void);
  636. void HAL_PWR_EnableBkUpAccess (void);
  637. void HAL_PWR_DisableBkUpAccess (void);
  638. /**
  639. * @}
  640. */
  641. /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control Functions
  642. * @{
  643. */
  644. /* Peripheral Control functions **********************************************/
  645. /* PVD configuration */
  646. void HAL_PWR_ConfigPVD (PWR_PVDTypeDef *sConfigPVD);
  647. void HAL_PWR_EnablePVD (void);
  648. void HAL_PWR_DisablePVD (void);
  649. /* WakeUp pins configuration */
  650. void HAL_PWR_EnableWakeUpPin (uint32_t WakeUpPinPolarity);
  651. void HAL_PWR_DisableWakeUpPin (uint32_t WakeUpPinx);
  652. /* Low Power modes entry */
  653. void HAL_PWR_EnterSTOPMode (uint32_t Regulator, uint8_t STOPEntry);
  654. void HAL_PWR_EnterSLEEPMode (uint32_t Regulator, uint8_t SLEEPEntry);
  655. void HAL_PWR_EnterSTANDBYMode (void);
  656. /* Power PVD IRQ Handler */
  657. void HAL_PWR_PVD_IRQHandler (void);
  658. void HAL_PWR_PVDCallback (void);
  659. /* Cortex System Control functions *******************************************/
  660. void HAL_PWR_EnableSleepOnExit (void);
  661. void HAL_PWR_DisableSleepOnExit (void);
  662. void HAL_PWR_EnableSEVOnPend (void);
  663. void HAL_PWR_DisableSEVOnPend (void);
  664. /**
  665. * @}
  666. */
  667. /**
  668. * @}
  669. */
  670. /* Private types -------------------------------------------------------------*/
  671. /* Private variables ---------------------------------------------------------*/
  672. /* Private constants ---------------------------------------------------------*/
  673. /** @defgroup PWR_Private_Constants PWR Private Constants
  674. * @{
  675. */
  676. /** @defgroup PWR_PVD_EXTI_Line PWR PVD EXTI Line
  677. * @{
  678. */
  679. #define PWR_EXTI_LINE_PVD EXTI_IMR1_IM16 /*!< External interrupt line 16
  680. Connected to the PVD EXTI Line */
  681. /**
  682. * @}
  683. */
  684. /**
  685. * @}
  686. */
  687. /* Private macros ------------------------------------------------------------*/
  688. /** @defgroup PWR_Private_Macros PWR Private Macros
  689. * @{
  690. */
  691. /** @defgroup PWR_IS_PWR_Definitions PWR Private macros to check input parameters
  692. * @{
  693. */
  694. /* Check PVD level parameter */
  695. #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLEVEL_0) ||\
  696. ((LEVEL) == PWR_PVDLEVEL_1) ||\
  697. ((LEVEL) == PWR_PVDLEVEL_2) ||\
  698. ((LEVEL) == PWR_PVDLEVEL_3) ||\
  699. ((LEVEL) == PWR_PVDLEVEL_4) ||\
  700. ((LEVEL) == PWR_PVDLEVEL_5) ||\
  701. ((LEVEL) == PWR_PVDLEVEL_6) ||\
  702. ((LEVEL) == PWR_PVDLEVEL_7))
  703. /* Check PVD mode parameter */
  704. #define IS_PWR_PVD_MODE(MODE) (((MODE) == PWR_PVD_MODE_IT_RISING) ||\
  705. ((MODE) == PWR_PVD_MODE_IT_FALLING) ||\
  706. ((MODE) == PWR_PVD_MODE_IT_RISING_FALLING) ||\
  707. ((MODE) == PWR_PVD_MODE_EVENT_RISING) ||\
  708. ((MODE) == PWR_PVD_MODE_EVENT_FALLING) ||\
  709. ((MODE) == PWR_PVD_MODE_EVENT_RISING_FALLING) ||\
  710. ((MODE) == PWR_PVD_MODE_NORMAL))
  711. /* Check low power regulator parameter */
  712. #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) ||\
  713. ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON))
  714. /* Check low power mode entry parameter */
  715. #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) ||\
  716. ((ENTRY) == PWR_SLEEPENTRY_WFE))
  717. /* Check low power mode entry parameter */
  718. #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) ||\
  719. ((ENTRY) == PWR_STOPENTRY_WFE))
  720. /* Check voltage scale level parameter */
  721. #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE0) || \
  722. ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE1) || \
  723. ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE2) || \
  724. ((VOLTAGE) == PWR_REGULATOR_VOLTAGE_SCALE3))
  725. /**
  726. * @}
  727. */
  728. /**
  729. * @}
  730. */
  731. /**
  732. * @}
  733. */
  734. /**
  735. * @}
  736. */
  737. #ifdef __cplusplus
  738. }
  739. #endif /* __cplusplus */
  740. #endif /* STM32H7xx_HAL_PWR_H */