|
SmartSnippets DA1459x SDK
|
Go to the documentation of this file.
42 #ifndef HW_WATCHDOG_H_
43 #define HW_WATCHDOG_H_
50 #define NMI_MAGIC_NUMBER 0xDEADBEEF
101 return (!!(
REG_GETF(SYS_WDOG, WATCHDOG_CTRL_REG, WRITE_BUSY)));
119 REG_SETF(SYS_WDOG, WATCHDOG_REG, WDOG_WEN, 0x0);
122 REG_SETF(SYS_WDOG, WATCHDOG_REG, WDOG_WEN, 0xff);
141 ASSERT_WARNING(!
REG_GETF(SYS_WDOG, WATCHDOG_REG, WDOG_WEN));
142 tmp = SYS_WDOG->WATCHDOG_REG;
150 SYS_WDOG->WATCHDOG_REG = tmp;
167 ASSERT_WARNING(!
REG_GETF(SYS_WDOG, WATCHDOG_REG, WDOG_WEN));
168 tmp = SYS_WDOG->WATCHDOG_REG;
176 SYS_WDOG->WATCHDOG_REG = tmp;
189 return REG_GETF(SYS_WDOG, WATCHDOG_REG, WDOG_VAL);
224 REG_SET_BIT(SYS_WDOG, WATCHDOG_CTRL_REG, WDOG_FREEZE_EN);
227 REG_CLR_BIT(SYS_WDOG, WATCHDOG_CTRL_REG, WDOG_FREEZE_EN);
__STATIC_FORCEINLINE bool hw_watchdog_check_write_busy(void)
Check if watchdog is busy writing the watchdog counter.
Definition: hw_watchdog.h:99
__ALWAYS_RETAINED_CODE bool hw_watchdog_freeze(void)
Freeze the watchdog.
#define REG_SETF(base, reg, field, new_val)
Set the value of a register field.
Definition: sdk_defs.h:738
#define REG_CLR_BIT(base, reg, field)
Clear a bit of a register.
Definition: sdk_defs.h:781
#define REG_SET_BIT(base, reg, field)
Set a bit of a register.
Definition: sdk_defs.h:766
void(* hw_watchdog_interrupt_cb)(unsigned long *exception_args)
Watchdog timer interrupt callback.
Definition: hw_watchdog.h:77
__STATIC_INLINE uint16_t hw_watchdog_get_val(void)
Get reload value of the watchdog timer.
Definition: hw_watchdog.h:184
Definition: hw_watchdog.h:67
Central include header file with platform definitions.
HW_WDG_RESET hw_watchdog_is_irq_or_rst_gen(void)
Check what is generated when watchdog reaches 0 value.
HW_WDG_RESET
Types of generated states if reload value is 0.
Definition: hw_watchdog.h:66
__STATIC_INLINE void hw_watchdog_freeze_ctrl(bool enable)
Enable/disable Watchdog freeze functionality.
Definition: hw_watchdog.h:221
__STATIC_FORCEINLINE void hw_watchdog_set_pos_val(uint16_t value)
Set positive reload value of the watchdog timer.
Definition: hw_watchdog.h:136
void hw_watchdog_register_int(hw_watchdog_interrupt_cb handler)
Register an interrupt handler.
#define SYS_WDOG_WATCHDOG_REG_WDOG_VAL_Msk
Definition: DA1459x-00.h:4957
Definition: hw_watchdog.h:68
volatile uint32_t nmi_event_data[9]
Holds the stack contents when an NMI occurs.
__RETAINED_CODE bool hw_watchdog_unfreeze(void)
Unfreeze the watchdog.
__STATIC_INLINE void hw_watchdog_write_value_ctrl(bool enable)
Enable/disable writing the Watchdog timer reload value. This filter prevents unintentionally setting ...
Definition: hw_watchdog.h:115
__STATIC_FORCEINLINE void hw_watchdog_gen_NMI(void)
Generate an NMI when reload value reaches 0.
Definition: hw_watchdog.h:205
#define REG_GETF(base, reg, field)
Return the value of a register field.
Definition: sdk_defs.h:711
#define REG_SET_FIELD(base, reg, field, var, val)
Set register field value.
Definition: sdk_defs.h:626
__STATIC_INLINE void hw_watchdog_set_neg_val(uint16_t value)
Set negative reload value of the watchdog timer.
Definition: hw_watchdog.h:162
__STATIC_FORCEINLINE void hw_watchdog_gen_RST(void)
Generate a reset signal of the system when reload value reaches 0.
Definition: hw_watchdog.h:196
__RETAINED_CODE void hw_watchdog_handle_int(unsigned long *hardfault_args)
Handle NMI interrupt.
__RETAINED_CODE void hw_watchdog_unregister_int(void)
Unregister an interrupt handler.