1 /**
2   ******************************************************************************
3   * @file    stm32mp1xx_hal_pwr_ex.h
4   * @author  MCD Application Team
5   * @brief   Header file of PWR HAL Extension module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2019 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 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef __STM32MP1xx_HAL_PWR_EX_H
21 #define __STM32MP1xx_HAL_PWR_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32mp1xx_hal_def.h"
29 
30 
31 
32 /** @addtogroup STM32MP1xx_HAL_Driver
33  * @{
34  */
35 
36 /** @addtogroup PWREx
37  * @{
38  */
39 
40 /* Exported types ------------------------------------------------------------*/
41 /** @defgroup PWREx_Exported_Types PWREx Exported Types
42   * @{
43   */
44 /**
45   * @brief  PWREx AVD configuration structure definition
46   */
47 typedef struct
48 {
49   uint32_t AVDLevel;       /*!<   AVDLevel: Specifies the AVD detection level.
50                                   This parameter can be a value of @ref PWREx AVD detection level */
51   uint32_t Mode;            /*!< Mode: Specifies the operating mode for the selected pins.
52                                   This parameter can be a value of @ref PWREx AVD Mode */
53 } PWREx_AVDTypeDef;
54 /**
55   * @}
56   */
57 
58 
59 /* Exported constants --------------------------------------------------------*/
60 
61 /** @defgroup PWREx_Exported_Constants PWREx Exported Constants
62   * @{
63   */
64 
65 /** @defgroup PWREx_Exported_Constants_Group1 PWREx_WakeUp_Pins
66  * @{
67  */
68 
69 #ifdef CORE_CA7
70 /* Defines for legacy purpose */
71 #define PWR_WAKEUP_PIN_MASK            PWR_MPUWKUPENR_WKUPEN
72 #define PWR_WAKEUP_PIN6                PWR_MPUWKUPENR_WKUPEN_6
73 #define PWR_WAKEUP_PIN5                PWR_MPUWKUPENR_WKUPEN_5
74 #define PWR_WAKEUP_PIN4                PWR_MPUWKUPENR_WKUPEN_4
75 #define PWR_WAKEUP_PIN3                PWR_MPUWKUPENR_WKUPEN_3
76 #define PWR_WAKEUP_PIN2                PWR_MPUWKUPENR_WKUPEN_2
77 #define PWR_WAKEUP_PIN1                PWR_MPUWKUPENR_WKUPEN_1
78 /* Defines for legacy purpose */
79 
80 /* High level + No pull */
81 #define PWR_WAKEUP_PIN6_HIGH            PWR_MPUWKUPENR_WKUPEN_6
82 #define PWR_WAKEUP_PIN5_HIGH            PWR_MPUWKUPENR_WKUPEN_5
83 #define PWR_WAKEUP_PIN4_HIGH            PWR_MPUWKUPENR_WKUPEN_4
84 #define PWR_WAKEUP_PIN3_HIGH            PWR_MPUWKUPENR_WKUPEN_3
85 #define PWR_WAKEUP_PIN2_HIGH            PWR_MPUWKUPENR_WKUPEN_2
86 #define PWR_WAKEUP_PIN1_HIGH            PWR_MPUWKUPENR_WKUPEN_1
87 /* Low level + No pull */
88 #define PWR_WAKEUP_PIN6_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_6 | PWR_MPUWKUPENR_WKUPEN_6)
89 #define PWR_WAKEUP_PIN5_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_5 | PWR_MPUWKUPENR_WKUPEN_5)
90 #define PWR_WAKEUP_PIN4_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_4 | PWR_MPUWKUPENR_WKUPEN_4)
91 #define PWR_WAKEUP_PIN3_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_3 | PWR_MPUWKUPENR_WKUPEN_3)
92 #define PWR_WAKEUP_PIN2_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_2 | PWR_MPUWKUPENR_WKUPEN_2)
93 #define PWR_WAKEUP_PIN1_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_1 | PWR_MPUWKUPENR_WKUPEN_1)
94 #endif /*CORE_CA7*/
95 
96 #ifdef CORE_CM4
97 /* Defines for legacy purpose */
98 #define PWR_WAKEUP_PIN_MASK            PWR_MCUWKUPENR_WKUPEN
99 #define PWR_WAKEUP_PIN6                PWR_MCUWKUPENR_WKUPEN6
100 #define PWR_WAKEUP_PIN5                PWR_MCUWKUPENR_WKUPEN5
101 #define PWR_WAKEUP_PIN4                PWR_MCUWKUPENR_WKUPEN4
102 #define PWR_WAKEUP_PIN3                PWR_MCUWKUPENR_WKUPEN3
103 #define PWR_WAKEUP_PIN2                PWR_MCUWKUPENR_WKUPEN2
104 #define PWR_WAKEUP_PIN1                PWR_MCUWKUPENR_WKUPEN1
105 /* Defines for legacy purpose */
106 
107 /* High level + No pull */
108 #define PWR_WAKEUP_PIN6_HIGH            PWR_MCUWKUPENR_WKUPEN6
109 #define PWR_WAKEUP_PIN5_HIGH            PWR_MCUWKUPENR_WKUPEN5
110 #define PWR_WAKEUP_PIN4_HIGH            PWR_MCUWKUPENR_WKUPEN4
111 #define PWR_WAKEUP_PIN3_HIGH            PWR_MCUWKUPENR_WKUPEN3
112 #define PWR_WAKEUP_PIN2_HIGH            PWR_MCUWKUPENR_WKUPEN2
113 #define PWR_WAKEUP_PIN1_HIGH            PWR_MCUWKUPENR_WKUPEN1
114 /* Low level + No pull */
115 #define PWR_WAKEUP_PIN6_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_6 | PWR_MCUWKUPENR_WKUPEN6)
116 #define PWR_WAKEUP_PIN5_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_5 | PWR_MCUWKUPENR_WKUPEN5)
117 #define PWR_WAKEUP_PIN4_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_4 | PWR_MCUWKUPENR_WKUPEN4)
118 #define PWR_WAKEUP_PIN3_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_3 | PWR_MCUWKUPENR_WKUPEN3)
119 #define PWR_WAKEUP_PIN2_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_2 | PWR_MCUWKUPENR_WKUPEN2)
120 #define PWR_WAKEUP_PIN1_LOW             (uint32_t)(PWR_WKUPCR_WKUPP_1 | PWR_MCUWKUPENR_WKUPEN1)
121 #endif /*CORE_CM4*/
122 
123 /* High level + Pull-up */
124 #define PWR_WAKEUP_PIN6_HIGH_PULLUP     (uint32_t)(PWR_MPUWKUPENR_WKUPEN_6 | PWR_WKUPCR_WKUPPUPD6_0 )
125 #define PWR_WAKEUP_PIN5_HIGH_PULLUP     (uint32_t)(PWR_MPUWKUPENR_WKUPEN_5 | PWR_WKUPCR_WKUPPUPD5_0 )
126 #define PWR_WAKEUP_PIN4_HIGH_PULLUP     (uint32_t)(PWR_MPUWKUPENR_WKUPEN_4 | PWR_WKUPCR_WKUPPUPD4_0 )
127 #define PWR_WAKEUP_PIN3_HIGH_PULLUP     (uint32_t)(PWR_MPUWKUPENR_WKUPEN_3 | PWR_WKUPCR_WKUPPUPD3_0 )
128 #define PWR_WAKEUP_PIN2_HIGH_PULLUP     (uint32_t)(PWR_MPUWKUPENR_WKUPEN_2 | PWR_WKUPCR_WKUPPUPD2_0 )
129 #define PWR_WAKEUP_PIN1_HIGH_PULLUP     (uint32_t)(PWR_MPUWKUPENR_WKUPEN_1 | PWR_WKUPCR_WKUPPUPD1_0 )
130 /* Low level + Pull-up */
131 #define PWR_WAKEUP_PIN6_LOW_PULLUP      (uint32_t)(PWR_WKUPCR_WKUPP_6 | PWR_MPUWKUPENR_WKUPEN_6 | PWR_WKUPCR_WKUPPUPD6_0)
132 #define PWR_WAKEUP_PIN5_LOW_PULLUP      (uint32_t)(PWR_WKUPCR_WKUPP_5 | PWR_MPUWKUPENR_WKUPEN_5 | PWR_WKUPCR_WKUPPUPD5_0)
133 #define PWR_WAKEUP_PIN4_LOW_PULLUP      (uint32_t)(PWR_WKUPCR_WKUPP_4 | PWR_MPUWKUPENR_WKUPEN_4 | PWR_WKUPCR_WKUPPUPD4_0)
134 #define PWR_WAKEUP_PIN3_LOW_PULLUP      (uint32_t)(PWR_WKUPCR_WKUPP_3 | PWR_MPUWKUPENR_WKUPEN_3 | PWR_WKUPCR_WKUPPUPD3_0)
135 #define PWR_WAKEUP_PIN2_LOW_PULLUP      (uint32_t)(PWR_WKUPCR_WKUPP_2 | PWR_MPUWKUPENR_WKUPEN_2 | PWR_WKUPCR_WKUPPUPD2_0)
136 #define PWR_WAKEUP_PIN1_LOW_PULLUP      (uint32_t)(PWR_WKUPCR_WKUPP_1 | PWR_MPUWKUPENR_WKUPEN_1 | PWR_WKUPCR_WKUPPUPD1_0)
137 /* High level + Pull-down */
138 #define PWR_WAKEUP_PIN6_HIGH_PULLDOWN   (uint32_t)(PWR_MPUWKUPENR_WKUPEN_6 | PWR_WKUPCR_WKUPPUPD6_1 )
139 #define PWR_WAKEUP_PIN5_HIGH_PULLDOWN   (uint32_t)(PWR_MPUWKUPENR_WKUPEN_5 | PWR_WKUPCR_WKUPPUPD5_1 )
140 #define PWR_WAKEUP_PIN4_HIGH_PULLDOWN   (uint32_t)(PWR_MPUWKUPENR_WKUPEN_4 | PWR_WKUPCR_WKUPPUPD4_1 )
141 #define PWR_WAKEUP_PIN3_HIGH_PULLDOWN   (uint32_t)(PWR_MPUWKUPENR_WKUPEN_3 | PWR_WKUPCR_WKUPPUPD3_1 )
142 #define PWR_WAKEUP_PIN2_HIGH_PULLDOWN   (uint32_t)(PWR_MPUWKUPENR_WKUPEN_2 | PWR_WKUPCR_WKUPPUPD2_1 )
143 #define PWR_WAKEUP_PIN1_HIGH_PULLDOWN   (uint32_t)(PWR_MPUWKUPENR_WKUPEN_1 | PWR_WKUPCR_WKUPPUPD1_1 )
144 /* Low level + Pull-down */
145 #define PWR_WAKEUP_PIN6_LOW_PULLDOWN    (uint32_t)(PWR_WKUPCR_WKUPP_6 | PWR_MPUWKUPENR_WKUPEN_6 | PWR_WKUPCR_WKUPPUPD6_1)
146 #define PWR_WAKEUP_PIN5_LOW_PULLDOWN    (uint32_t)(PWR_WKUPCR_WKUPP_5 | PWR_MPUWKUPENR_WKUPEN_5 | PWR_WKUPCR_WKUPPUPD5_1)
147 #define PWR_WAKEUP_PIN4_LOW_PULLDOWN    (uint32_t)(PWR_WKUPCR_WKUPP_4 | PWR_MPUWKUPENR_WKUPEN_4 | PWR_WKUPCR_WKUPPUPD4_1)
148 #define PWR_WAKEUP_PIN3_LOW_PULLDOWN    (uint32_t)(PWR_WKUPCR_WKUPP_3 | PWR_MPUWKUPENR_WKUPEN_3 | PWR_WKUPCR_WKUPPUPD3_1)
149 #define PWR_WAKEUP_PIN2_LOW_PULLDOWN    (uint32_t)(PWR_WKUPCR_WKUPP_2 | PWR_MPUWKUPENR_WKUPEN_2 | PWR_WKUPCR_WKUPPUPD2_1)
150 #define PWR_WAKEUP_PIN1_LOW_PULLDOWN    (uint32_t)(PWR_WKUPCR_WKUPP_1 | PWR_MPUWKUPENR_WKUPEN_1 | PWR_WKUPCR_WKUPPUPD1_1)
151 /**
152   * @}
153   */
154 
155 /** @defgroup PWREx_Exported_Constants_Group2 PWREx Wakeup Pins Flags
156  * @{
157  */
158 #define PWR_WAKEUP_PIN_FLAG1            PWR_WKUPFR_WKUPF1 /*!< Wakeup event on pin 1 */
159 #define PWR_WAKEUP_PIN_FLAG2            PWR_WKUPFR_WKUPF2 /*!< Wakeup event on pin 2 */
160 #define PWR_WAKEUP_PIN_FLAG3            PWR_WKUPFR_WKUPF3 /*!< Wakeup event on pin 3 */
161 #define PWR_WAKEUP_PIN_FLAG4            PWR_WKUPFR_WKUPF4 /*!< Wakeup event on pin 4 */
162 #define PWR_WAKEUP_PIN_FLAG5            PWR_WKUPFR_WKUPF5 /*!< Wakeup event on pin 5 */
163 #define PWR_WAKEUP_PIN_FLAG6            PWR_WKUPFR_WKUPF6 /*!< Wakeup event on pin 6 */
164 /**
165  * @}
166  */
167 
168 
169 /** @defgroup PWREx_Exported_Constants_Group3 PWREx Core definition
170  * @{
171  */
172 #define PWR_CORE_CPU1               ((uint32_t)0x00)
173 #define PWR_CORE_CPU2               ((uint32_t)0x01)
174 /**
175  * @}
176  */
177 
178 
179 /** @defgroup PWREx_Exported_Constants_Group4 PWREx AVD detection level
180   * @{
181   */
182 #define PWR_AVDLEVEL_0  PWR_CR1_ALS_LEV0 /* 1.7 V */
183 #define PWR_AVDLEVEL_1  PWR_CR1_ALS_LEV1 /* 2.1 V */
184 #define PWR_AVDLEVEL_2  PWR_CR1_ALS_LEV2 /* 2.5 V */
185 #define PWR_AVDLEVEL_3  PWR_CR1_ALS_LEV3 /* 2.8 V */
186 /**
187   * @}
188   */
189 
190 /** @defgroup PWREx_Exported_Constants_Group5 PWREx AVD Mode
191   * @{
192   */
193 #define PWR_AVD_MODE_NORMAL                ((uint32_t)0x00000000U)   /*!< Basic mode is used */
194 #define PWR_AVD_MODE_IT_RISING             ((uint32_t)0x00010001U)   /*!< External Interrupt Mode with Rising edge trigger detection */
195 #define PWR_AVD_MODE_IT_FALLING            ((uint32_t)0x00010002U)   /*!< External Interrupt Mode with Falling edge trigger detection */
196 #define PWR_AVD_MODE_IT_RISING_FALLING     ((uint32_t)0x00010003U)   /*!< External Interrupt Mode with Rising/Falling edge trigger detection */
197 /**
198   * @}
199   */
200 
201 /** @defgroup PWREx_Exported_Constants_Group6 PWR battery charging resistor selection
202   * @{
203   */
204 #define PWR_BATTERY_CHARGING_RESISTOR_5    ((uint32_t)0x00000000U) /*!< VBAT charging through a 5 kOhm resistor   */
205 #define PWR_BATTERY_CHARGING_RESISTOR_1_5  PWR_CR3_VBRS            /*!< VBAT charging through a 1.5 kOhm resistor */
206 /**
207   * @}
208   */
209 
210 /** @defgroup PWREx_Exported_Constants_Group7 PWREx VBAT Thresholds
211   * @{
212   */
213 #define PWR_VBAT_BETWEEN_HIGH_LOW_THRESHOLD  ((uint32_t)0x00000000U)
214 #define PWR_VBAT_BELOW_LOW_THRESHOLD         PWR_CR2_VBATL  /*!< Vsw low threshold is ~1.35V */
215 #define PWR_VBAT_ABOVE_HIGH_THRESHOLD        PWR_CR2_VBATH  /*!< Vsw high threshold is ~3.6V */
216 /**
217   * @}
218   */
219 
220 /** @defgroup PWREx_Exported_Constants_Group8 PWREx Temperature Thresholds
221   * @{
222   */
223 #define PWR_TEMP_BETWEEN_HIGH_LOW_THRESHOLD  ((uint32_t)0x00000000U)
224 #define PWR_TEMP_BELOW_LOW_THRESHOLD         PWR_CR2_TEMPL
225 #define PWR_TEMP_ABOVE_HIGH_THRESHOLD        PWR_CR2_TEMPH
226 /**
227   * @}
228   */
229 
230 /**
231  * @}
232  */
233 
234 /* Exported macro ------------------------------------------------------------*/
235 /** @defgroup PWREx_Exported_Macro PWREx Exported Macro
236   *  @{
237   */
238 
239 /** @brief  Check Wake Up flag is set or not.
240  * @param  __WUFLAG__: specifies the Wake Up flag to check.
241  *          This parameter can be one of the following values:
242  *            @arg PWR_WAKEUP_PIN_FLAG1: Wakeup Pin Flag 1
243  *            @arg PWR_WAKEUP_PIN_FLAG2: Wakeup Pin Flag 2
244  *            @arg PWR_WAKEUP_PIN_FLAG3: Wakeup Pin Flag 3
245  *            @arg PWR_WAKEUP_PIN_FLAG4: Wakeup Pin Flag 4
246  *            @arg PWR_WAKEUP_PIN_FLAG5: Wakeup Pin Flag 5
247  *            @arg PWR_WAKEUP_PIN_FLAG6: Wakeup Pin Flag 6
248  */
249 #define __HAL_PWR_GET_WAKEUP_FLAG(__WUFLAG__) (PWR->WKUPFR & (__WUFLAG__))
250 
251 /** @brief  Clear the WakeUp pins flags.
252  * @param  __WUFLAG__: specifies the Wake Up pin flag to clear.
253  *          This parameter can be one of the following values:
254  *            @arg PWR_WAKEUP_PIN_FLAG1: Wakeup Pin Flag 1
255  *            @arg PWR_WAKEUP_PIN_FLAG2: Wakeup Pin Flag 2
256  *            @arg PWR_WAKEUP_PIN_FLAG3: Wakeup Pin Flag 3
257  *            @arg PWR_WAKEUP_PIN_FLAG4: Wakeup Pin Flag 4
258  *            @arg PWR_WAKEUP_PIN_FLAG5: Wakeup Pin Flag 5
259  *            @arg PWR_WAKEUP_PIN_FLAG6: Wakeup Pin Flag 6
260  */
261 #define __HAL_PWR_CLEAR_WAKEUP_FLAG(__WUFLAG__)   SET_BIT(PWR->WKUPCR, (__WUFLAG__))
262 
263 /**
264  * @}
265  */
266 
267 /* Exported functions --------------------------------------------------------*/
268 /** @defgroup PWREx_Exported_Functions PWREx Exported Functions
269   * @{
270   */
271 
272 /** @defgroup PWREx_Exported_Functions_Group1 Low power control functions
273   * @{
274   */
275 /* Power core holding functions */
276 HAL_StatusTypeDef HAL_PWREx_HoldCore(uint32_t CPU);
277 void              HAL_PWREx_ReleaseCore(uint32_t CPU);
278 
279 
280 /* Power Wakeup PIN IRQ Handler */
281 void HAL_PWREx_WAKEUP_PIN_IRQHandler(void);
282 void HAL_PWREx_WKUP1_Callback(void);
283 void HAL_PWREx_WKUP2_Callback(void);
284 void HAL_PWREx_WKUP3_Callback(void);
285 void HAL_PWREx_WKUP4_Callback(void);
286 void HAL_PWREx_WKUP5_Callback(void);
287 void HAL_PWREx_WKUP6_Callback(void);
288 
289 
290 /**
291  * @}
292  */
293 
294 /** @defgroup PWREx_Exported_Functions_Group2 Peripherals control functions
295   * @{
296   */
297 /* Backup regulator control functions */
298 HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void);
299 HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void);
300 
301 /* Retention regulator control functions */
302 HAL_StatusTypeDef HAL_PWREx_EnableRetReg(void);
303 HAL_StatusTypeDef HAL_PWREx_DisableRetReg(void);
304 
305 /* 1V1 regulator control functions */
306 HAL_StatusTypeDef HAL_PWREx_Enable1V1Reg(void);
307 HAL_StatusTypeDef HAL_PWREx_Disable1V1Reg(void);
308 
309 /* 1V8 regulator control functions */
310 HAL_StatusTypeDef HAL_PWREx_Enable1V8Reg(void);
311 HAL_StatusTypeDef HAL_PWREx_Disable1V8Reg(void);
312 
313 /* Battery control functions */
314 void HAL_PWREx_EnableBatteryCharging(uint32_t ResistorValue);
315 void HAL_PWREx_DisableBatteryCharging(void);
316 /**
317  * @}
318  */
319 
320 /** @defgroup PWREx_Exported_Functions_Group3 Power Monitoring functions
321   * @{
322   */
323 /* Power VBAT/Temperature monitoring functions */
324 void HAL_PWREx_EnableMonitoring(void);
325 void HAL_PWREx_DisableMonitoring(void);
326 uint32_t HAL_PWREx_GetTemperatureLevel(void);
327 uint32_t HAL_PWREx_GetVBATLevel(void);
328 
329 /* USB Voltage level detector functions */
330 HAL_StatusTypeDef HAL_PWREx_EnableUSBVoltageDetector(void);
331 HAL_StatusTypeDef HAL_PWREx_DisableUSBVoltageDetector(void);
332 
333 /* Power AVD configuration functions */
334 void HAL_PWREx_ConfigAVD(PWREx_AVDTypeDef *sConfigAVD);
335 void HAL_PWREx_EnableAVD(void);
336 void HAL_PWREx_DisableAVD(void);
337 
338 /* Power PVD/AVD IRQ Handler */
339 void HAL_PWREx_PVD_AVD_IRQHandler(void);
340 void HAL_PWREx_AVDCallback(void);
341 /**
342  * @}
343  */
344 
345 /**
346  * @}
347  */
348 
349 
350 /* Private types -------------------------------------------------------------*/
351 /* Private variables ---------------------------------------------------------*/
352 /* Private constants ---------------------------------------------------------*/
353 /* Private macros ------------------------------------------------------------*/
354 /** @defgroup PWREx_Private_Macros PWREx Private Macros
355   * @{
356   */
357 
358 /** @defgroup PWREx_IS_PWR_Definitions PWREx Private macros to check input parameters
359   * @{
360   */
361 
362 #define IS_PWR_WAKEUP_PIN(__PIN__)         (((__PIN__) == PWR_WAKEUP_PIN1)       || \
363                                            ((__PIN__) == PWR_WAKEUP_PIN2)       || \
364                                            ((__PIN__) == PWR_WAKEUP_PIN3)       || \
365                                            ((__PIN__) == PWR_WAKEUP_PIN4)       || \
366                                            ((__PIN__) == PWR_WAKEUP_PIN5)       || \
367                                            ((__PIN__) == PWR_WAKEUP_PIN6)       || \
368                                            ((__PIN__) == PWR_WAKEUP_PIN1_HIGH)  || \
369                                            ((__PIN__) == PWR_WAKEUP_PIN2_HIGH)  || \
370                                            ((__PIN__) == PWR_WAKEUP_PIN3_HIGH)  || \
371                                            ((__PIN__) == PWR_WAKEUP_PIN4_HIGH)  || \
372                                            ((__PIN__) == PWR_WAKEUP_PIN5_HIGH)  || \
373                                            ((__PIN__) == PWR_WAKEUP_PIN6_HIGH)  || \
374                                            ((__PIN__) == PWR_WAKEUP_PIN1_LOW)   || \
375                                            ((__PIN__) == PWR_WAKEUP_PIN2_LOW)   || \
376                                            ((__PIN__) == PWR_WAKEUP_PIN3_LOW)   || \
377                                            ((__PIN__) == PWR_WAKEUP_PIN4_LOW)   || \
378                                            ((__PIN__) == PWR_WAKEUP_PIN5_LOW)   || \
379                                            ((__PIN__) == PWR_WAKEUP_PIN6_LOW)    || \
380                                            ((__PIN__) == PWR_WAKEUP_PIN6_HIGH_PULLUP)  || \
381                                            ((__PIN__) == PWR_WAKEUP_PIN5_HIGH_PULLUP)  || \
382                                            ((__PIN__) == PWR_WAKEUP_PIN4_HIGH_PULLUP)  || \
383                                            ((__PIN__) == PWR_WAKEUP_PIN3_HIGH_PULLUP)  || \
384                                            ((__PIN__) == PWR_WAKEUP_PIN2_HIGH_PULLUP)  || \
385                                            ((__PIN__) == PWR_WAKEUP_PIN1_HIGH_PULLUP)  || \
386                                            ((__PIN__) == PWR_WAKEUP_PIN6_LOW_PULLUP)   || \
387                                            ((__PIN__) == PWR_WAKEUP_PIN5_LOW_PULLUP)   || \
388                                            ((__PIN__) == PWR_WAKEUP_PIN4_LOW_PULLUP)   || \
389                                            ((__PIN__) == PWR_WAKEUP_PIN3_LOW_PULLUP)   || \
390                                            ((__PIN__) == PWR_WAKEUP_PIN2_LOW_PULLUP)  || \
391                                            ((__PIN__) == PWR_WAKEUP_PIN1_LOW_PULLUP)   || \
392                                            ((__PIN__) == PWR_WAKEUP_PIN6_HIGH_PULLDOWN)   || \
393                                            ((__PIN__) == PWR_WAKEUP_PIN5_HIGH_PULLDOWN)   || \
394                                            ((__PIN__) == PWR_WAKEUP_PIN4_HIGH_PULLDOWN)   || \
395                                            ((__PIN__) == PWR_WAKEUP_PIN3_HIGH_PULLDOWN)   || \
396                                            ((__PIN__) == PWR_WAKEUP_PIN2_HIGH_PULLDOWN)   || \
397                                            ((__PIN__) == PWR_WAKEUP_PIN1_HIGH_PULLDOWN)   || \
398                                            ((__PIN__) == PWR_WAKEUP_PIN6_LOW_PULLDOWN)   || \
399                                            ((__PIN__) == PWR_WAKEUP_PIN5_LOW_PULLDOWN)   || \
400                                            ((__PIN__) == PWR_WAKEUP_PIN4_LOW_PULLDOWN)   || \
401                                            ((__PIN__) == PWR_WAKEUP_PIN3_LOW_PULLDOWN)   || \
402                                            ((__PIN__) == PWR_WAKEUP_PIN2_LOW_PULLDOWN)  || \
403                                            ((__PIN__) == PWR_WAKEUP_PIN1_LOW_PULLDOWN))
404 
405 #define IS_PWR_AVD_LEVEL(LEVEL)  (((LEVEL) == PWR_AVDLEVEL_0) || ((LEVEL) == PWR_AVDLEVEL_1) || \
406                                   ((LEVEL) == PWR_AVDLEVEL_2) || ((LEVEL) == PWR_AVDLEVEL_3))
407 
408 #define IS_PWR_AVD_MODE(MODE)  (((MODE) == PWR_AVD_MODE_IT_RISING)|| ((MODE) == PWR_AVD_MODE_IT_FALLING) || \
409                                 ((MODE) == PWR_AVD_MODE_IT_RISING_FALLING) || ((MODE) == PWR_AVD_MODE_NORMAL))
410 
411 #define IS_PWR_BATTERY_RESISTOR_SELECT(RESISTOR)  (((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_5) ||\
412                                                    ((RESISTOR) == PWR_BATTERY_CHARGING_RESISTOR_1_5))
413 
414 #define IS_PWR_CORE(CPU)  (((CPU) == PWR_CORE_CPU1) || ((CPU) == PWR_CORE_CPU2))
415 /**
416  * @}
417  */
418 
419 /**
420  * @}
421  */
422 
423 
424 /**
425  * @}
426  */
427 
428 /**
429  * @}
430  */
431 
432 #ifdef __cplusplus
433 }
434 #endif
435 
436 
437 #endif /* __STM32MP1xx_HAL_PWR_EX_H */
438