Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Infuse watchdog APIs

Infuse watchdog API . More...

Macros

#define INFUSE_WATCHDOG_DEV   DEVICE_DT_GET(DT_ALIAS(watchdog0))
 Infuse watchdog device.
 
#define INFUSE_WATCHDOG_FEED_PERIOD    K_MSEC(CONFIG_INFUSE_WATCHDOG_PERIOD_MS - CONFIG_INFUSE_WATCHDOG_FEED_EARLY_MS)
 Maximum duration to sleep before waking up to feed watchdog.
 
#define INFUSE_WATCHDOG_DEFAULT_TIMEOUT_CFG
 Default timeout configuration for subsystems.
 
#define INFUSE_WATCHDOG_REGISTER_SYS_INIT(name, dependency, chan_name, period_name)
 Install a watchdog timeout at boot.
 

Functions

void infuse_watchdog_warning (const struct device *dev, int channel_id)
 Function that is called just prior to watchdog expiry.
 
void infuse_watchdog_expired (const struct device *dev, int channel_id)
 Function that is called on watchdog expiry.
 
int infuse_watchdog_install (k_timeout_t *feed_period)
 Install an Infuse watchdog channel.
 
void infuse_watchdog_thread_register (int wdog_channel, k_tid_t thread)
 Register a watchdog channel against a thread.
 
int infuse_watchdog_thread_state_lookup (int wdog_channel, uint32_t *info1, uint32_t *info2)
 Determine state of the thread responsible for watchdog channel.
 
int infuse_watchdog_start (void)
 Start the Infuse watchdog.
 
void infuse_watchdog_feed (int wdog_channel)
 Feed an Infuse watchdog channel.
 
void infuse_watchdog_feed_all (void)
 Feed all Infuse watchdog channels.
 

Detailed Description

Infuse watchdog API .

Macro Definition Documentation

◆ INFUSE_WATCHDOG_DEFAULT_TIMEOUT_CFG

#define INFUSE_WATCHDOG_DEFAULT_TIMEOUT_CFG

#include <infuse/drivers/watchdog.h>

Value:
(struct wdt_timeout_cfg) \
{ \
.window = \
{ \
.min = 0, \
.max = CONFIG_INFUSE_WATCHDOG_PERIOD_MS, \
}, \
.flags = WDT_FLAG_RESET_SOC, .callback = _INFUSE_WATCHDOG_CB, \
}

Default timeout configuration for subsystems.

◆ INFUSE_WATCHDOG_DEV

#define INFUSE_WATCHDOG_DEV   DEVICE_DT_GET(DT_ALIAS(watchdog0))

#include <infuse/drivers/watchdog.h>

Infuse watchdog device.

◆ INFUSE_WATCHDOG_FEED_PERIOD

#define INFUSE_WATCHDOG_FEED_PERIOD    K_MSEC(CONFIG_INFUSE_WATCHDOG_PERIOD_MS - CONFIG_INFUSE_WATCHDOG_FEED_EARLY_MS)

#include <infuse/drivers/watchdog.h>

Maximum duration to sleep before waking up to feed watchdog.

◆ INFUSE_WATCHDOG_REGISTER_SYS_INIT

#define INFUSE_WATCHDOG_REGISTER_SYS_INIT ( name,
dependency,
chan_name,
period_name )

#include <infuse/drivers/watchdog.h>

Value:
static k_timeout_t period_name = K_FOREVER; \
static int chan_name; \
static int name##_register(void) \
{ \
(void)period_name; \
chan_name = \
IS_ENABLED(dependency) ? infuse_watchdog_install(&period_name) : -ENODEV; \
return 0; \
} \
SYS_INIT(name##_register, POST_KERNEL, 0);
int infuse_watchdog_install(k_timeout_t *feed_period)
Install an Infuse watchdog channel.

Install a watchdog timeout at boot.

Parameters
nameUnique prefix for constructed variables
dependencyTimeout only installed if IS_ENABLED(dependency)
chan_nameName of the variable for the channel ID
period_nameName of the variable for the channel feed period

Function Documentation

◆ infuse_watchdog_expired()

void infuse_watchdog_expired ( const struct device * dev,
int channel_id )

#include <infuse/drivers/watchdog.h>

Function that is called on watchdog expiry.

The standard implementation of this function is in lib/reboot.c

Note
With multiple channels installed with INFUSE_WATCHDOG_REGISTER_SYS_INIT this function will be called multiple times.
Parameters
devWatchdog instance that expired
channel_idChannel ID that expired

◆ infuse_watchdog_feed()

void infuse_watchdog_feed ( int wdog_channel)

#include <infuse/drivers/watchdog.h>

Feed an Infuse watchdog channel.

Parameters
wdog_channelChannel from infuse_watchdog_install

◆ infuse_watchdog_feed_all()

void infuse_watchdog_feed_all ( void )

#include <infuse/drivers/watchdog.h>

Feed all Infuse watchdog channels.

Note
Should only be used in situations where the action of one thread could impact the timing of all watchdog channels. One example of this is erasing internal flash on nRF SoCs.

◆ infuse_watchdog_install()

int infuse_watchdog_install ( k_timeout_t * feed_period)

#include <infuse/drivers/watchdog.h>

Install an Infuse watchdog channel.

Returns
value from wdt_install_timeout

◆ infuse_watchdog_start()

int infuse_watchdog_start ( void )

#include <infuse/drivers/watchdog.h>

Start the Infuse watchdog.

Returns
value from wdt_setup

◆ infuse_watchdog_thread_register()

void infuse_watchdog_thread_register ( int wdog_channel,
k_tid_t thread )

#include <infuse/drivers/watchdog.h>

Register a watchdog channel against a thread.

This allows thread state to be determined by infuse_watchdog_thread_state_lookup in the event that the channel expires.

Note
Also feeds the watchdog channel
Parameters
wdog_channelWatchdog channel to register
threadThread responsible for feeding the channel

◆ infuse_watchdog_thread_state_lookup()

int infuse_watchdog_thread_state_lookup ( int wdog_channel,
uint32_t * info1,
uint32_t * info2 )

#include <infuse/drivers/watchdog.h>

Determine state of the thread responsible for watchdog channel.

Data format, compatible with the Infuse Reboot API.

info1: bits 16-31: Reserved for future use bits 8-15: Common thread state bits (_THREAD_PENDING, etc) bits 0- 7: Watchdog channel ID

info2: If thread is pending on an object (_THREAD_PENDING), address of that object 0 otherwise

Parameters
wdog_channelWatchdog channel to lookup thread state for
info1Thread info per above
info2Thread info per above
Return values
0on success
-EINVALwdog_channel has not been associated with a thread

◆ infuse_watchdog_warning()

void infuse_watchdog_warning ( const struct device * dev,
int channel_id )

#include <infuse/drivers/watchdog.h>

Function that is called just prior to watchdog expiry.

The standard implementation of this function is in lib/reboot.c

Parameters
devWatchdog instance that is about to expire
channel_idChannel ID that is about to expire