gr55xx_hal_pwr.h
Go to the documentation of this file.
1
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_PWR_H__
53 #define __GR55xx_HAL_PWR_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_ll_pwr.h"
61 #include "gr55xx_hal_def.h"
62
63 /* Exported types ------------------------------------------------------------*/
64
77 typedef void (*pwr_slp_elapsed_handler_t)(void);
78
89 typedef struct _hal_pwr_handler
90 {
91 pwr_slp_elapsed_handler_t pwr_slp_elapsed_hander;
92 } hal_pwr_handler_t;
93
103 /* Exported constants --------------------------------------------------------*/
111 #define PWR_EXTWKUP_PIN0 LL_PWR_EXTWKUP_PIN0
112 #define PWR_EXTWKUP_PIN1 LL_PWR_EXTWKUP_PIN1
113 #define PWR_EXTWKUP_PIN2 LL_PWR_EXTWKUP_PIN2
114 #define PWR_EXTWKUP_PIN3 LL_PWR_EXTWKUP_PIN3
115 #define PWR_EXTWKUP_PIN4 LL_PWR_EXTWKUP_PIN4
116 #define PWR_EXTWKUP_PIN5 LL_PWR_EXTWKUP_PIN5
117 #define PWR_EXTWKUP_PIN6 LL_PWR_EXTWKUP_PIN6
118 #define PWR_EXTWKUP_PIN7 LL_PWR_EXTWKUP_PIN7
119 #define PWR_EXTWKUP_PIN_ALL LL_PWR_EXTWKUP_PIN_ALL
125 #define PWR_WKUP_COND_EXT LL_PWR_WKUP_COND_EXT
126 #define PWR_WKUP_COND_TIMER LL_PWR_WKUP_COND_TIMER
127 #define PWR_WKUP_COND_BLE LL_PWR_WKUP_COND_BLE
128 #define PWR_WKUP_COND_CALENDAR LL_PWR_WKUP_COND_CALENDAR
129 #define PWR_WKUP_COND_BOD_FEDGE LL_PWR_WKUP_COND_BOD_FEDGE
130 #define PWR_WKUP_COND_MSIO_COMP LL_PWR_WKUP_COND_MSIO_COMP
131 #define PWR_WKUP_COND_ALL LL_PWR_WKUP_COND_ALL
138 #define PWR_EXTWKUP_TYPE_LOW LL_PWR_EXTWKUP_TYPE_LOW
139 #define PWR_EXTWKUP_TYPE_HIGH LL_PWR_EXTWKUP_TYPE_HIGH
140 #define PWR_EXTWKUP_TYPE_RISING LL_PWR_EXTWKUP_TYPE_RISING
141 #define PWR_EXTWKUP_TYPE_FALLING LL_PWR_EXTWKUP_TYPE_FALLING
147 #define PWR_SLP_TIMER_MODE_NORMAL 0x0U
148 #define PWR_SLP_TIMER_MODE_SINGLE 0x1U
149 #define PWR_SLP_TIMER_MODE_RELOAD 0x2U
150 #define PWR_SLP_TIMER_MODE_DISABLE 0x3U
157 #define PWR_TIMER_TYPE_CAL_TIMER LL_PWR_TIMER_READ_SEL_CAL_TIMER
158 #define PWR_TIMER_TYPE_AON_WDT LL_PWR_TIMER_READ_SEL_AON_WDT
159 #define PWR_TIMER_TYPE_SLP_TIMER LL_PWR_TIMER_READ_SEL_SLP_TIMER
160 #define PWR_TIMER_TYPE_CAL_ALARM LL_PWR_TIMER_READ_SEL_CAL_ALARM
167 #define PWR_MEM_POWER_OFF LL_PWR_MEM_POWER_OFF
168 #define PWR_MEM_POWER_FULL LL_PWR_MEM_POWER_FULL
169 #define PWR_MEM_POWER_RETENTION LL_PWR_MEM_POWER_RETENTION
175 #define PWR_COMM_TIMER_POWER_DOWN 0x0U
176 #define PWR_COMM_TIMER_POWER_UP 0x1U
177 #define PWR_COMM_CORE_POWER_DOWN 0x0U
178 #define PWR_COMM_CORE_POWER_UP 0x1U
184 #define PWR_COMM_TIMER_MODE_RESET 0x0U
185 #define PWR_COMM_TIMER_MODE_RUNNING 0x1U
186 #define PWR_COMM_CORE_MODE_RESET 0x0U
187 #define PWR_COMM_CORE_MODE_RUNNING 0x1U
193 #define HAL_PWR_TIMEOUT_DEFAULT_VALUE ((uint32_t)0x000FFFFF)
198 /* Exported macro ------------------------------------------------------------*/
199 /* Private macros ------------------------------------------------------------*/
209 #define IS_PWR_WAKEUP_CONDITION(__COND__) ((((__COND__) & PWR_WKUP_COND_ALL) != 0x00U) &&\
210 (((__COND__) & ~PWR_WKUP_COND_ALL) == 0x00U))
211
217 #define IS_PWR_EXT_WAKEUP_PIN(__PIN__) ((((__PIN__) & PWR_EXTWKUP_PIN_ALL) != 0x00U) &&\
218 (((__PIN__) & ~PWR_EXTWKUP_PIN_ALL) == 0x00U))
219
225 #define IS_PWR_SLP_TIMER_MODE(__MODE__) (((__MODE__) == PWR_SLP_TIMER_MODE_NORMAL) || \
226 ((__MODE__) == PWR_SLP_TIMER_MODE_SINGLE) || \
227 ((__MODE__) == PWR_SLP_TIMER_MODE_RELOAD) || \
228 ((__MODE__) == PWR_SLP_TIMER_MODE_DISABLE))
229
235 #define IS_PWR_EXTWKUP_TYPE(__TYPE__) (((__TYPE__) == PWR_EXTWKUP_TYPE_LOW) || \
236 ((__TYPE__) == PWR_EXTWKUP_TYPE_HIGH) || \
237 ((__TYPE__) == PWR_EXTWKUP_TYPE_RISING) || \
238 ((__TYPE__) == PWR_EXTWKUP_TYPE_FALLING))
239
245 #define IS_PWR_MEM_BLOCK(__BLOCK__) ((((__BLOCK__) & PWR_MEM_ALL) != 0x00U) &&\
246 (((__BLOCK__) & ~PWR_MEM_ALL) == 0x00U))
247
253 #define IS_PWR_MEM_POWER_STAT(__STATE__) (((__STATE__) == PWR_MEM_POWER_OFF) || \
254 ((__STATE__) == PWR_MEM_POWER_FULL) || \
255 ((__STATE__) == PWR_MEM_POWER_RETENTION))
256
262 #define IS_PWR_COMM_TIMER_POWER_STAT(__STATE__) (((__STATE__) == PWR_COMM_TIMER_POWER_DOWN) || \
263 ((__STATE__) == PWR_COMM_TIMER_POWER_UP))
264
270 #define IS_PWR_COMM_CORE_POWER_STAT(__STATE__) (((__STATE__) == PWR_COMM_CORE_POWER_DOWN) || \
271 ((__STATE__) == PWR_COMM_CORE_POWER_UP))
272
278 #define IS_PWR_COMM_TIMER_MODE(__MODE__) (((__MODE__) == PWR_COMM_TIMER_MODE_RESET) || \
279 ((__MODE__) == PWR_COMM_TIMER_MODE_RUNNING))
280
286 #define IS_PWR_COMM_CORE_MODE(__MODE__) (((__MODE__) == PWR_COMM_CORE_MODE_RESET) || \
287 ((__MODE__) == PWR_COMM_CORE_MODE_RUNNING))
288
294 #define IS_PWR_PWR_TIMER_TYPE(__TYPE__) (((__TYPE__) == PWR_TIMER_TYPE_CAL_TIMER) || \
295 ((__TYPE__) == PWR_TIMER_TYPE_AON_WDT) || \
296 ((__TYPE__) == PWR_TIMER_TYPE_SLP_TIMER) || \
297 ((__TYPE__) == PWR_TIMER_TYPE_CAL_ALARM))
298
303 /* Exported functions --------------------------------------------------------*/
329 void hal_pwr_set_wakeup_condition(uint32_t condition);
330
344 void hal_pwr_config_timer_wakeup(uint8_t timer_mode, uint32_t load_count);
345
366 void hal_pwr_config_ext_wakeup(uint32_t ext_wakeup_pinx, uint32_t ext_wakeup_type);
367
381 void hal_pwr_disable_ext_wakeup(uint32_t disable_wakeup_pinx);
382
389 void hal_pwr_enter_chip_deepsleep(void);
390
408 void hal_pwr_set_comm_power(uint32_t timer_power_state, uint32_t core_power_state);
409
421 void hal_pwr_set_comm_mode(uint32_t timer_mode, uint32_t core_mode);
422
439 hal_status_t hal_pwr_get_timer_current_value(uint32_t timer_type, uint32_t *p_value);
440
454 void hal_pwr_sleep_timer_irq_handler(void);
455
456
465 void hal_pwr_sleep_timer_elapsed_callback(void);
466
467
468
473 #ifdef __cplusplus
474 }
475 #endif
476
477
478 #endif /* __GR55xx_HAL_PWR_H__ */
479
hal_pwr_config_ext_wakeup
void hal_pwr_config_ext_wakeup(uint32_t ext_wakeup_pinx, uint32_t ext_wakeup_type)
Configure the External AON GPIO pins and pin trigger type that is used to wakeup MCU.
_hal_pwr_handler
PWR callback handle Structure definition.
Definition: gr55xx_hal_pwr.h:90
hal_pwr_get_timer_current_value
hal_status_t hal_pwr_get_timer_current_value(uint32_t timer_type, uint32_t *p_value)
Get the current value of specified timer.
hal_pwr_disable_ext_wakeup
void hal_pwr_disable_ext_wakeup(uint32_t disable_wakeup_pinx)
Disable the interrupt wake-up function of the specified AON GPIO pin.
hal_pwr_set_wakeup_condition
void hal_pwr_set_wakeup_condition(uint32_t condition)
Set the DeepSleep WakeUp Condition.
hal_pwr_config_timer_wakeup
void hal_pwr_config_timer_wakeup(uint8_t timer_mode, uint32_t load_count)
Configure the AON Sleep Timer mode and count used to wakeup MCU.
hal_pwr_sleep_timer_elapsed_callback
void hal_pwr_sleep_timer_elapsed_callback(void)
PWR Sleep Timer Elapsed callback.
hal_pwr_handler_t
struct _hal_pwr_handler hal_pwr_handler_t
PWR callback handle Structure definition.
hal_pwr_sleep_timer_irq_handler
void hal_pwr_sleep_timer_irq_handler(void)
Handle PWR Sleep Timer interrupt request.
hal_pwr_enter_chip_deepsleep
void hal_pwr_enter_chip_deepsleep(void)
Enters DeepSleep mode.
pwr_slp_elapsed_handler_t
void(* pwr_slp_elapsed_handler_t)(void)
PWR Sleep Timer Elapsed callback.
Definition: gr55xx_hal_pwr.h:77
hal_pwr_set_comm_power
void hal_pwr_set_comm_power(uint32_t timer_power_state, uint32_t core_power_state)
Set the power state of communication timer and communication core in running mode.
_hal_pwr_handler::pwr_slp_elapsed_hander
pwr_slp_elapsed_handler_t pwr_slp_elapsed_hander
Definition: gr55xx_hal_pwr.h:91
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
hal_pwr_set_comm_mode
void hal_pwr_set_comm_mode(uint32_t timer_mode, uint32_t core_mode)
Set the work mode of communication timer and communication core.
gr55xx_ll_pwr.h
Header file containing functions prototypes of PWR LL library.
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.