SmartSnippets DA1459x SDK
Files | Typedefs | Enumerations | Functions | Variables

Watchdog Timer. More...

Files

file  hw_watchdog.h
 Definition of API for the Watchdog timer Low Level Driver.
 

Typedefs

typedef void(* hw_watchdog_interrupt_cb) (unsigned long *exception_args)
 Watchdog timer interrupt callback. More...
 

Enumerations

enum  HW_WDG_RESET { HW_WDG_RESET_NMI = 0, HW_WDG_RESET_RST = 1 }
 Types of generated states if reload value is 0. More...
 

Functions

__ALWAYS_RETAINED_CODE bool hw_watchdog_freeze (void)
 Freeze the watchdog. More...
 
__RETAINED_CODE bool hw_watchdog_unfreeze (void)
 Unfreeze the watchdog. More...
 
__STATIC_FORCEINLINE bool hw_watchdog_check_write_busy (void)
 Check if watchdog is busy writing the watchdog counter.
 
__STATIC_INLINE void hw_watchdog_write_value_ctrl (bool enable)
 Enable/disable writing the Watchdog timer reload value. This filter prevents unintentionally setting the watchdog with a SW run-away. More...
 
__STATIC_FORCEINLINE void hw_watchdog_set_pos_val (uint16_t value)
 Set positive reload value of the watchdog timer. More...
 
__STATIC_INLINE void hw_watchdog_set_neg_val (uint16_t value)
 Set negative reload value of the watchdog timer. More...
 
__STATIC_INLINE uint16_t hw_watchdog_get_val (void)
 Get reload value of the watchdog timer. More...
 
__STATIC_FORCEINLINE void hw_watchdog_gen_RST (void)
 Generate a reset signal of the system when reload value reaches 0. More...
 
__STATIC_FORCEINLINE void hw_watchdog_gen_NMI (void)
 Generate an NMI when reload value reaches 0. More...
 
__STATIC_INLINE void hw_watchdog_freeze_ctrl (bool enable)
 Enable/disable Watchdog freeze functionality. More...
 
void hw_watchdog_register_int (hw_watchdog_interrupt_cb handler)
 Register an interrupt handler. More...
 
__RETAINED_CODE void hw_watchdog_unregister_int (void)
 Unregister an interrupt handler. More...
 
__RETAINED_CODE void hw_watchdog_handle_int (unsigned long *hardfault_args)
 Handle NMI interrupt. More...
 
HW_WDG_RESET hw_watchdog_is_irq_or_rst_gen (void)
 Check what is generated when watchdog reaches 0 value. More...
 

Variables

volatile uint32_t nmi_event_data [9]
 Holds the stack contents when an NMI occurs. More...
 

Detailed Description

Watchdog Timer.

Typedef Documentation

◆ hw_watchdog_interrupt_cb

typedef void(* hw_watchdog_interrupt_cb) (unsigned long *exception_args)

Watchdog timer interrupt callback.

Parameters
[in]hardfault_argspointer to call stack

Enumeration Type Documentation

◆ HW_WDG_RESET

Types of generated states if reload value is 0.

Generate NMI (non-maskable interrupt) or RST (reset of the system)

Enumerator
HW_WDG_RESET_NMI 

Generate NMI if the watchdog reaches 0 and WDOG reset if the counter become less or equal to -16

HW_WDG_RESET_RST 

Generate WDOG reset it the counter becomes less or equal than 0

Function Documentation

◆ hw_watchdog_freeze()

__ALWAYS_RETAINED_CODE bool hw_watchdog_freeze ( void  )

Freeze the watchdog.

Returns
true if operation is allowed, else false

◆ hw_watchdog_freeze_ctrl()

__STATIC_INLINE void hw_watchdog_freeze_ctrl ( bool  enable)

Enable/disable Watchdog freeze functionality.

Parameters
[in]enabletrue = Watchdog timer can not be frozen when NMI_RST=0. false = Watchdog timer can be frozen/resumed when NMI_RST=0
See also
hw_watchdog_freeze
hw_watchdog_unfreeze
hw_watchdog_gen_RST

◆ hw_watchdog_gen_NMI()

__STATIC_FORCEINLINE void hw_watchdog_gen_NMI ( void  )

Generate an NMI when reload value reaches 0.

◆ hw_watchdog_gen_RST()

__STATIC_FORCEINLINE void hw_watchdog_gen_RST ( void  )

Generate a reset signal of the system when reload value reaches 0.

◆ hw_watchdog_get_val()

__STATIC_INLINE uint16_t hw_watchdog_get_val ( void  )

Get reload value of the watchdog timer.

◆ hw_watchdog_handle_int()

__RETAINED_CODE void hw_watchdog_handle_int ( unsigned long *  hardfault_args)

Handle NMI interrupt.

Parameters
[in]hardfault_argspointer to call stack

◆ hw_watchdog_is_irq_or_rst_gen()

HW_WDG_RESET hw_watchdog_is_irq_or_rst_gen ( void  )

Check what is generated when watchdog reaches 0 value.

If it is NMI (interrupt) or RST (system/wdog reset).

Returns
HW_WDG_RESET_NMI if NMI interrupt is generated, otherwise HW_WDG_RESET_RST

◆ hw_watchdog_register_int()

void hw_watchdog_register_int ( hw_watchdog_interrupt_cb  handler)

Register an interrupt handler.

Parameters
[in]handlerfunction pointer to handler to call when an interrupt occurs

◆ hw_watchdog_set_neg_val()

__STATIC_INLINE void hw_watchdog_set_neg_val ( uint16_t  value)

Set negative reload value of the watchdog timer.

Parameters
[in]valuereload value from 0x1FFF to 0x00
See also
hw_watchdog_write_value_ctrl

◆ hw_watchdog_set_pos_val()

__STATIC_FORCEINLINE void hw_watchdog_set_pos_val ( uint16_t  value)

Set positive reload value of the watchdog timer.

Parameters
[in]valuereload value for 13 bits down counter in the PD_AON power domain which is running on either a 10,24 ms clock or a 20,5 ms clock period and can operate for 84 sec or 3 minutes (depending on the clock).
See also
hw_watchdog_write_value_ctrl

◆ hw_watchdog_unfreeze()

__RETAINED_CODE bool hw_watchdog_unfreeze ( void  )

Unfreeze the watchdog.

Returns
true if operation is allowed, else false

◆ hw_watchdog_unregister_int()

__RETAINED_CODE void hw_watchdog_unregister_int ( void  )

Unregister an interrupt handler.

◆ hw_watchdog_write_value_ctrl()

__STATIC_INLINE void hw_watchdog_write_value_ctrl ( bool  enable)

Enable/disable writing the Watchdog timer reload value. This filter prevents unintentionally setting the watchdog with a SW run-away.

Parameters
[in]enabletrue = write enable for Watchdog reload value false = write disable for Watchdog reload value
See also
hw_watchdog_set_pos_val
hw_watchdog_set_neg_val

Variable Documentation

◆ nmi_event_data

volatile uint32_t nmi_event_data[9]

Holds the stack contents when an NMI occurs.

The stack contents are copied at this variable when an NMI occurs. The first position is marked with a special "flag" (0xDEADBEEF) to indicate that the data that follow are valid.