K-FSW ec10f94
Modular flight software on Zephyr, for small satellites
Loading...
Searching...
No Matches
K-FSW platform watchdog

Data Structures

struct  kfsw_platform_watchdog_info
 

Enumerations

enum  kfsw_platform_watchdog_state { KFSW_PLATFORM_WATCHDOG_UNCONFIGURED = 0 , KFSW_PLATFORM_WATCHDOG_CONFIGURED = 1 , KFSW_PLATFORM_WATCHDOG_RUNNING = 2 , KFSW_PLATFORM_WATCHDOG_STARVED = 3 }
 

Functions

uint32_t kfsw_platform_watchdog_feed_interval_ms (uint32_t timeout_ms)
 
uint32_t kfsw_platform_watchdog_configured_timeout_ms (void)
 
int kfsw_platform_watchdog_init (void)
 
int kfsw_platform_watchdog_start (void)
 
int kfsw_platform_watchdog_feed (void)
 
int kfsw_platform_watchdog_release (void)
 
int kfsw_platform_watchdog_stop_feeding (void)
 
int kfsw_platform_watchdog_get_info (struct kfsw_platform_watchdog_info *info)
 

Description

Arm, feed and stop feeding a hardware watchdog.

The health service can take over the feeding. Most parts, including the STM32 independent watchdog, can't be disarmed once started.

Enumeration Documentation

◆ kfsw_platform_watchdog_state

#include <watchdog.h>

Watchdog lifecycle state.

Enumerator
KFSW_PLATFORM_WATCHDOG_UNCONFIGURED 

No device bound, or initialization has not run.

KFSW_PLATFORM_WATCHDOG_CONFIGURED 

Timeout installed; hardware not yet armed.

KFSW_PLATFORM_WATCHDOG_RUNNING 

Hardware armed and the keep-alive is feeding it.

KFSW_PLATFORM_WATCHDOG_STARVED 

Hardware armed and no longer fed; a reset is expected.

Function Documentation

◆ kfsw_platform_watchdog_configured_timeout_ms()

uint32_t kfsw_platform_watchdog_configured_timeout_ms ( void  )

#include <watchdog.h>

Watchdog timeout selected for this board, available before init.

Returns
Configured milliseconds, or zero when no device is selected.

◆ kfsw_platform_watchdog_feed()

int kfsw_platform_watchdog_feed ( void  )

#include <watchdog.h>

Feed the watchdog once.

A starved watchdog can't be fed again.

Return values
0The watchdog was fed.
-ENODEVNo watchdog device is bound.
-EINVALThe watchdog is not running.
-EPERMFeeding was stopped.
Returns
A negative errno value from the driver on failure.

◆ kfsw_platform_watchdog_feed_interval_ms()

uint32_t kfsw_platform_watchdog_feed_interval_ms ( uint32_t  timeout_ms)

#include <watchdog.h>

Feed interval for a timeout: a third of it, at least 1 ms.

Parameters
timeout_msConfigured timeout in milliseconds.
Returns
The feed interval in milliseconds.

◆ kfsw_platform_watchdog_get_info()

int kfsw_platform_watchdog_get_info ( struct kfsw_platform_watchdog_info *  info)

#include <watchdog.h>

Read a consistent snapshot of watchdog state.

Parameters
[out]infoDestination snapshot.
Return values
0The snapshot was written.
-EINVALinfo is NULL.

◆ kfsw_platform_watchdog_init()

int kfsw_platform_watchdog_init ( void  )

#include <watchdog.h>

Bind the watchdog device and install the configured timeout.

Does not arm the hardware; call kfsw_platform_watchdog_start for that.

Return values
0The timeout was installed.
-ENODEVNo watchdog device is bound to the kfsw,watchdog chosen property, or the device is not ready.
-EALREADYInitialization has already run.
Returns
A negative errno value from the driver on failure.

◆ kfsw_platform_watchdog_release()

int kfsw_platform_watchdog_release ( void  )

#include <watchdog.h>

Stop the built-in keep-alive and let the caller feed the watchdog.

The watchdog stays armed. The caller must feed it at least every kfsw_platform_watchdog_feed_interval_ms or the part resets.

Return values
0The keep-alive stopped.
-EWOULDBLOCKCalled outside a preemptible thread or from the system workqueue.
-ENODEVNo watchdog device is bound.
-EINVALThe watchdog is not running.

◆ kfsw_platform_watchdog_start()

int kfsw_platform_watchdog_start ( void  )

#include <watchdog.h>

Arm the hardware and start the keep-alive.

Return values
0The watchdog is running.
-ENODEVNo watchdog device is bound.
-EINVALInitialization has not run.
Returns
A negative errno value from the driver on failure.

◆ kfsw_platform_watchdog_stop_feeding()

int kfsw_platform_watchdog_stop_feeding ( void  )

#include <watchdog.h>

Stop feeding the watchdog so that it expires.

The part resets within one timeout, and this can't be undone.

Return values
0The keep-alive was stopped.
-ENODEVNo watchdog device is bound.
-EINVALThe watchdog is not running.