gr55xx_ll_aon_wdt.h
Go to the documentation of this file.
1 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55XX_LL_AON_WDT_H__
53 #define __GR55XX_LL_AON_WDT_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx.h"
61 
62 #if defined (AON)
63 
64 /* Exported functions --------------------------------------------------------*/
82 __STATIC_INLINE void ll_aon_wdt_enable(void)
83 {
84  SET_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_EN);
85 }
86 
96 __STATIC_INLINE void ll_aon_wdt_disable(void)
97 {
98  CLEAR_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_EN);
99 }
100 
110 __STATIC_INLINE uint32_t ll_aon_wdt_is_enabled(void)
111 {
112  return (READ_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_EN) == (AON_EXT_WKUP_CTL_WDT_EN));
113 }
114 
125 __STATIC_INLINE void ll_aon_wdt_set_reload_counter(uint32_t counter)
126 {
127  WRITE_REG(AON->TIMER_VALUE, counter);
128 }
129 
142 __STATIC_INLINE void ll_aon_wdt_reload_counter(void)
143 {
144  SET_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_RELOAD);
145 }
146 
157 __STATIC_INLINE uint32_t ll_aon_wdt_get_counter(void)
158 {
159  MODIFY_REG(AON->AON_PAD_CTL1, AON_PAD_CTL1_TIMER_READ_SEL, AON_PAD_CTL1_TIMER_READ_SEL_AON_WDT);
160  return (uint32_t)READ_REG(AON->TIMER_VAL);
161 }
162 
175 __STATIC_INLINE void ll_aon_wdt_set_alarm_counter(uint32_t counter)
176 {
177  MODIFY_REG(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_ALARM, (counter << AON_EXT_WKUP_CTL_WDT_ALARM_Pos) & AON_EXT_WKUP_CTL_WDT_ALARM);
178 }
179 
189 __STATIC_INLINE uint32_t ll_aon_wdt_get_alarm_counter(void)
190 {
191  return (uint32_t)(READ_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_ALARM) >> AON_EXT_WKUP_CTL_WDT_ALARM_Pos);
192 }
193 
210 __STATIC_INLINE uint32_t ll_aon_wdt_is_active_flag_running(void)
211 {
212  return (uint32_t)(READ_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_RUNNING) == (AON_EXT_WKUP_CTL_WDT_RUNNING));
213 }
214 
226 __STATIC_INLINE uint32_t ll_aon_wdt_is_active_flag_reboot(void)
227 {
228  return (uint32_t)(READ_BITS(AON->SLP_EVENT, AON_SLP_EVENT_WDT_REBOOT) == AON_SLP_EVENT_WDT_REBOOT);
229 }
230 
240 __STATIC_INLINE void ll_aon_wdt_clear_flag_reboot(void)
241 {
242  WRITE_REG(AON->SLP_EVENT, ~AON_SLP_EVENT_WDT_REBOOT);
243 }
244 
249 #endif /* AON_WDT */
250 
251 #ifdef __cplusplus
252 }
253 #endif
254 
255 #endif /* __GR55XX_LL_AON_WDT_H__ */
256 
ll_aon_wdt_get_counter
__STATIC_INLINE uint32_t ll_aon_wdt_get_counter(void)
Read the AON WDT counter current value.
Definition: gr55xx_ll_aon_wdt.h:157
ll_aon_wdt_set_alarm_counter
__STATIC_INLINE void ll_aon_wdt_set_alarm_counter(uint32_t counter)
Specify the AON_WDT down-counter alarm value.
Definition: gr55xx_ll_aon_wdt.h:175
ll_aon_wdt_reload_counter
__STATIC_INLINE void ll_aon_wdt_reload_counter(void)
Reloads AON WDT counter.
Definition: gr55xx_ll_aon_wdt.h:142
ll_aon_wdt_is_enabled
__STATIC_INLINE uint32_t ll_aon_wdt_is_enabled(void)
Check if the AON_WDT peripheral is enabled or disabled.
Definition: gr55xx_ll_aon_wdt.h:110
ll_aon_wdt_clear_flag_reboot
__STATIC_INLINE void ll_aon_wdt_clear_flag_reboot(void)
Clear Interrupt Status flag.
Definition: gr55xx_ll_aon_wdt.h:240
ll_aon_wdt_is_active_flag_running
__STATIC_INLINE uint32_t ll_aon_wdt_is_active_flag_running(void)
Indicate if the AON Watchdog Running Flag is set or not.
Definition: gr55xx_ll_aon_wdt.h:210
ll_aon_wdt_enable
__STATIC_INLINE void ll_aon_wdt_enable(void)
Enable AON watchdog counter and interrupt event.
Definition: gr55xx_ll_aon_wdt.h:82
ll_aon_wdt_get_alarm_counter
__STATIC_INLINE uint32_t ll_aon_wdt_get_alarm_counter(void)
Get the AON_WDT down-counter alarm value.
Definition: gr55xx_ll_aon_wdt.h:189
ll_aon_wdt_set_reload_counter
__STATIC_INLINE void ll_aon_wdt_set_reload_counter(uint32_t counter)
Specify the AON WDT down-counter reload value.
Definition: gr55xx_ll_aon_wdt.h:125
ll_aon_wdt_disable
__STATIC_INLINE void ll_aon_wdt_disable(void)
Disable AON watchdog counter and interrupt event.
Definition: gr55xx_ll_aon_wdt.h:96
ll_aon_wdt_is_active_flag_reboot
__STATIC_INLINE uint32_t ll_aon_wdt_is_active_flag_reboot(void)
Indicate if the AON WDT Reboot Event Flag is set or not.
Definition: gr55xx_ll_aon_wdt.h:226