SmartSnippets DA1459x SDK
Files | Functions
Watchdog Service

Watchdog service. More...

Files

file  sys_watchdog.h
 Watchdog header file.
 

Functions

void sys_watchdog_init (void)
 
int8_t sys_watchdog_register (bool notify_trigger)
 
void sys_watchdog_unregister (int8_t id)
 
void sys_watchdog_suspend (int8_t id)
 
void sys_watchdog_resume (int8_t id)
 
__RETAINED_HOT_CODE void sys_watchdog_notify (int8_t id)
 
void sys_watchdog_notify_and_resume (int8_t id)
 
void sys_watchdog_set_latency (int8_t id, uint8_t latency)
 
__RETAINED_HOT_CODE void sys_watchdog_idle_task_notify ()
 

Detailed Description

Watchdog service.

Function Documentation

◆ sys_watchdog_idle_task_notify()

__RETAINED_HOT_CODE void sys_watchdog_idle_task_notify ( )

Notify sys_watchdog module about the idle task being alive

The idle task must use this to notify sys_watchdog module that it's alive. This should be done in application level and frequently enough to fit into hw_watchdog interval set by dg_configWDOG_RESET_VALUE. The idle task monitoring is controlled via

See also
dg_configWDOG_GUARD_IDLE_TASK When any other registered task notifies the service about its presence, the service assumes that the idle task is also alive. When no task has notified the service during dg_configWDOG_RESET_VALUE period, then it is expected that at least the idle task should be able to notify. In case this fails to happen, the platform is reset.
Note
When the idle task is monitored, it reserves the service id = 0.
The idle task is excluded from the timer notification trigger mechanism.

◆ sys_watchdog_init()

void sys_watchdog_init ( void  )

Initialize sys_watchdog module

This should be called before using sys_watchdog module, preferably as early as possible.

Note
For OS-based applications, the service is initialized by the system. The application must NOT call this function.

◆ sys_watchdog_notify()

__RETAINED_HOT_CODE void sys_watchdog_notify ( int8_t  id)

Notify sys_watchdog module about a task being alive

Registered task must use this periodically to notify sys_watchdog module that it's alive. This should be done frequently enough to fit into hw_watchdog interval set by dg_configWDOG_RESET_VALUE.

Parameters
[in]ididentifier from the task's registration to the service
See also
sys_watchdog_set_latency
Note
This function is not designed to be called safely from interrupt context.

◆ sys_watchdog_notify_and_resume()

void sys_watchdog_notify_and_resume ( int8_t  id)

Notify sys_watchdog module for task with handle id and resume its monitoring

This function combines the functionality of sys_watchdog_notify() and sys_watchdog_resume().

Parameters
[in]ididentifier from the task's registration to the service
See also
sys_watchdog_notify()
sys_watchdog_resume()
Note
This function is not designed to be called safely from interrupt context.

◆ sys_watchdog_register()

int8_t sys_watchdog_register ( bool  notify_trigger)

Register the calling task

Returned identifier shall be used in all other calls to sys_watchdog. Once registered, task must notify sys_watchdog periodically using sys_watchdog_notify() to prevent watchdog expiration. Notifications are decided in application level. However, a task can request to be triggered periodically using OS task notify feature. In this case it is expected to notify-back sys_watchdog as a response, calling sys_watchdog_notify().

Note
dg_configWDOG_NOTIFY_TRIGGER_TMO shall be set to non-zero for notify_trigger to have any effect.
Parameters
[in]notify_triggertrue if task notify should be triggered periodically
Returns
identifier on success, -1 on failure
See also
sys_watchdog_notify

◆ sys_watchdog_resume()

void sys_watchdog_resume ( int8_t  id)

Resume a task to be monitored again

Resumes a task monitoring, that was previously suspended by sys_watchdog_suspend().

Parameters
[in]ididentifier from the task's registration to the service
Note
This function does not notify the watchdog service for this task. It is possible that monitor resuming occurs too close to the time that the watchdog expires, before the task has a chance to explicitly send a notification. This can lead to an unwanted reset. Therefore, either call sys_watchdog_notify() before calling sys_watchdog_resume(), or use sys_watchdog_notify_and_resume() instead.
See also
sys_watchdog_suspend
sys_watchdog_notify_and_resume

◆ sys_watchdog_set_latency()

void sys_watchdog_set_latency ( int8_t  id,
uint8_t  latency 
)

Set watchdog latency for task

This allows task to miss given number of notifications to sys_watchdog without triggering platform reset. Once set, it's allowed that task does not notify sys_watchdog for latency consecutive hw_watchdog intervals (as set by dg_configWDOG_RESET_VALUE) which can be used to allow for parts of code which are known to block for long period of time (i.e. computation). This value is set once and does not reload automatically, thus it shall be set every time increased latency is required.

Parameters
[in]ididentifier from the task's registration to the service
[in]latencylatency
Note
Calling sys_watchdog_notify() / sys_watchdog_notify_and_resume() cancels any latency setting for the given task.

◆ sys_watchdog_suspend()

void sys_watchdog_suspend ( int8_t  id)

Suspend a task from being monitored

Suspended task is not unregistered entirely but will not be monitored by watchdog until resumed. It's faster than unregistering and registering task again.

Parameters
[in]ididentifier from the task's registration to the service
See also
sys_watchdog_resume

◆ sys_watchdog_unregister()

void sys_watchdog_unregister ( int8_t  id)

Stop monitoring a task

Parameters
[in]ididentifier from the task's registration to the service
See also
sys_watchdog_register