Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Task Watchdog APIs

Task Watchdog APIs. More...

Typedefs

typedef void(* task_wdt_callback_t) (int channel_id, void *user_data)
 Task watchdog callback.
 

Functions

int task_wdt_init (const struct device *hw_wdt)
 Initialize task watchdog.
 
int task_wdt_add (uint32_t reload_period, task_wdt_callback_t callback, void *user_data)
 Install new timeout.
 
int task_wdt_delete (int channel_id)
 Delete task watchdog channel.
 
int task_wdt_feed (int channel_id)
 Feed specified watchdog channel.
 

Detailed Description

Task Watchdog APIs.

Since
2.5
Version
0.8.0

Typedef Documentation

◆ task_wdt_callback_t

typedef void(* task_wdt_callback_t) (int channel_id, void *user_data)

#include <zephyr/task_wdt/task_wdt.h>

Task watchdog callback.

Function Documentation

◆ task_wdt_add()

int task_wdt_add ( uint32_t  reload_period,
task_wdt_callback_t  callback,
void *  user_data 
)

#include <zephyr/task_wdt/task_wdt.h>

Install new timeout.

Adds a new timeout to the list of task watchdog channels.

Parameters
reload_periodPeriod in milliseconds used to reset the timeout
callbackFunction to be called when watchdog timer expired. Pass NULL to use system reset handler.
user_dataUser data to associate with the watchdog channel.
Return values
channel_idIf successful, a non-negative value indicating the index of the channel to which the timeout was assigned. This ID is supposed to be used as the parameter in calls to task_wdt_feed().
-EINVALIf the reload_period is invalid.
-ENOMEMIf no more timeouts can be installed.

◆ task_wdt_delete()

int task_wdt_delete ( int  channel_id)

#include <zephyr/task_wdt/task_wdt.h>

Delete task watchdog channel.

Deletes the specified channel from the list of task watchdog channels. The channel is now available again for other tasks via task_wdt_add() function.

Parameters
channel_idIndex of the channel as returned by task_wdt_add().
Return values
0If successful.
-EINVALIf there is no installed timeout for supplied channel.

◆ task_wdt_feed()

int task_wdt_feed ( int  channel_id)

#include <zephyr/task_wdt/task_wdt.h>

Feed specified watchdog channel.

This function loops through all installed task watchdogs and updates the internal kernel timer used as for the software watchdog with the next due timeout.

Parameters
channel_idIndex of the fed channel as returned by task_wdt_add().
Return values
0If successful.
-EINVALIf there is no installed timeout for supplied channel.

◆ task_wdt_init()

int task_wdt_init ( const struct device hw_wdt)

#include <zephyr/task_wdt/task_wdt.h>

Initialize task watchdog.

This function sets up necessary kernel timers and the hardware watchdog (if desired as fallback). It has to be called before task_wdt_add() and task_wdt_feed().

Parameters
hw_wdtPointer to the hardware watchdog device used as fallback. Pass NULL if no hardware watchdog fallback is desired.
Return values
0If successful.
-ENOTSUPIf assigning a hardware watchdog is not supported.
-ErrnoNegative errno if the fallback hw_wdt is used and the install timeout API fails. See wdt_install_timeout() API for possible return values.