gr55xx_ll_wdt.h
Go to the documentation of this file.
1 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55XX_LL_WDT_H__
53 #define __GR55XX_LL_WDT_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx.h"
61 
62 #if defined (WDT)
63 
69 /* Private constants ---------------------------------------------------------*/
77 #define LL_WDT_LOCK_WR_ACCESS_ENABLE 0x1ACCE551
78 #define LL_WDT_LOCK_WR_ACCESS_DISABLE (~0x1ACCE551)
83 /* Exported macro ------------------------------------------------------------*/
84 
99 #define LL_WDT_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__))
100 
107 #define LL_WDT_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__)
108 
114 /* Exported functions --------------------------------------------------------*/
133 __STATIC_INLINE void ll_wdt_enable_write_access(wdt_regs_t *WDTx)
134 {
135  WRITE_REG(WDTx->LOCK, LL_WDT_LOCK_WR_ACCESS_ENABLE);
136 }
137 
148 __STATIC_INLINE void ll_wdt_disable_write_access(wdt_regs_t *WDTx)
149 {
150  WRITE_REG(WDTx->LOCK, LL_WDT_LOCK_WR_ACCESS_DISABLE);
151 }
152 
163 __STATIC_INLINE void ll_wdt_enable(wdt_regs_t *WDTx)
164 {
165  SET_BITS(WDTx->CTRL, WDT_CTRL_INTEN);
166 }
167 
178 __STATIC_INLINE void ll_wdt_disable(wdt_regs_t *WDTx)
179 {
180  CLEAR_BITS(WDTx->CTRL, WDT_CTRL_INTEN);
181 }
182 
193 __STATIC_INLINE uint32_t ll_wdt_is_enabled(wdt_regs_t *WDTx)
194 {
195  return (READ_BITS(WDTx->CTRL, WDT_CTRL_INTEN) == (WDT_CTRL_INTEN));
196 }
197 
209 __STATIC_INLINE void ll_wdt_enable_reset(wdt_regs_t *WDTx)
210 {
211  SET_BITS(WDTx->CTRL, WDT_CTRL_RSTEN);
212 }
213 
224 __STATIC_INLINE void ll_wdt_disable_reset(wdt_regs_t *WDTx)
225 {
226  CLEAR_BITS(WDTx->CTRL, WDT_CTRL_RSTEN);
227 }
228 
239 __STATIC_INLINE uint32_t ll_wdt_is_enabled_reset(wdt_regs_t *WDTx)
240 {
241  return (READ_BITS(WDTx->CTRL, WDT_CTRL_RSTEN) == (WDT_CTRL_RSTEN));
242 }
243 
255 __STATIC_INLINE void ll_wdt_set_counter_load(wdt_regs_t *WDTx, uint32_t counter)
256 {
257  WRITE_REG(WDTx->LOAD, counter);
258 }
259 
270 __STATIC_INLINE uint32_t ll_wdt_get_counter_load(wdt_regs_t *WDTx)
271 {
272  return (uint32_t)(READ_REG(WDTx->LOAD));
273 }
274 
285 __STATIC_INLINE uint32_t ll_wdt_get_counter_value(wdt_regs_t *WDTx)
286 {
287  return (uint32_t)(READ_REG(WDTx->VALUE));
288 }
289 
300 __STATIC_INLINE void ll_wdt_reload_counter(wdt_regs_t *WDTx)
301 {
302  WRITE_REG(WDTx->INTCLR, WDT_INTCLR);
303 }
304 
323 __STATIC_INLINE uint32_t ll_wdt_is_active_flag_it(wdt_regs_t *WDTx)
324 {
325  return (READ_BITS(WDTx->MIS, WDT_MIS_INTSTAT) == (WDT_MIS_INTSTAT));
326 }
327 
338 __STATIC_INLINE void ll_wdt_clear_flag_it(wdt_regs_t *WDTx)
339 {
340  WRITE_REG(WDTx->INTCLR, WDT_INTCLR);
341 }
342 
347 #endif /* WDT */
348 
349 #ifdef __cplusplus
350 }
351 #endif
352 
353 #endif /* __GR55XX_LL_WDT_H__ */
354 
ll_wdt_set_counter_load
__STATIC_INLINE void ll_wdt_set_counter_load(wdt_regs_t *WDTx, uint32_t counter)
Specify the WDT down-counter reload value.
Definition: gr55xx_ll_wdt.h:255
ll_wdt_enable_reset
__STATIC_INLINE void ll_wdt_enable_reset(wdt_regs_t *WDTx)
Enable reset output.
Definition: gr55xx_ll_wdt.h:209
ll_wdt_enable
__STATIC_INLINE void ll_wdt_enable(wdt_regs_t *WDTx)
Enable watchdog counter and interrupt event.
Definition: gr55xx_ll_wdt.h:163
ll_wdt_is_enabled
__STATIC_INLINE uint32_t ll_wdt_is_enabled(wdt_regs_t *WDTx)
Check if the WDT peripheral is enabled or disabled.
Definition: gr55xx_ll_wdt.h:193
ll_wdt_disable_reset
__STATIC_INLINE void ll_wdt_disable_reset(wdt_regs_t *WDTx)
Disable reset output.
Definition: gr55xx_ll_wdt.h:224
ll_wdt_get_counter_value
__STATIC_INLINE uint32_t ll_wdt_get_counter_value(wdt_regs_t *WDTx)
Get current value of the specified WDT decrementing down-counter.
Definition: gr55xx_ll_wdt.h:285
ll_wdt_disable_write_access
__STATIC_INLINE void ll_wdt_disable_write_access(wdt_regs_t *WDTx)
Disable write access to WDT_LOAD, WDT_CTRL and WDT_INTCLR registers.
Definition: gr55xx_ll_wdt.h:148
ll_wdt_is_active_flag_it
__STATIC_INLINE uint32_t ll_wdt_is_active_flag_it(wdt_regs_t *WDTx)
Indicate if the WDT Interrupt Flag is set or not.
Definition: gr55xx_ll_wdt.h:323
ll_wdt_clear_flag_it
__STATIC_INLINE void ll_wdt_clear_flag_it(wdt_regs_t *WDTx)
Clear Interrupt Status flag.
Definition: gr55xx_ll_wdt.h:338
ll_wdt_get_counter_load
__STATIC_INLINE uint32_t ll_wdt_get_counter_load(wdt_regs_t *WDTx)
Get the specified WDT down-counter reload value.
Definition: gr55xx_ll_wdt.h:270
ll_wdt_is_enabled_reset
__STATIC_INLINE uint32_t ll_wdt_is_enabled_reset(wdt_regs_t *WDTx)
Check if the WDT reset is enabled or disabled.
Definition: gr55xx_ll_wdt.h:239
ll_wdt_disable
__STATIC_INLINE void ll_wdt_disable(wdt_regs_t *WDTx)
Disable watchdog counter and interrupt event.
Definition: gr55xx_ll_wdt.h:178
LL_WDT_LOCK_WR_ACCESS_ENABLE
#define LL_WDT_LOCK_WR_ACCESS_ENABLE
Definition: gr55xx_ll_wdt.h:77
ll_wdt_enable_write_access
__STATIC_INLINE void ll_wdt_enable_write_access(wdt_regs_t *WDTx)
Enable write access to WDT_LOAD, WDT_CTRL and WDT_INTCLR registers.
Definition: gr55xx_ll_wdt.h:133
ll_wdt_reload_counter
__STATIC_INLINE void ll_wdt_reload_counter(wdt_regs_t *WDTx)
Reloads WDT counter with value defined in the reload register.
Definition: gr55xx_ll_wdt.h:300
LL_WDT_LOCK_WR_ACCESS_DISABLE
#define LL_WDT_LOCK_WR_ACCESS_DISABLE
Definition: gr55xx_ll_wdt.h:78