Watchdog¶
API for configuring watchdog timers.
Enums
-
enum
metal_watchdog_run_option
¶ List of watchdog timer count behaviors.
Values:
-
enumerator
METAL_WATCHDOG_STOP
¶ Stop the watchdog
-
enumerator
METAL_WATCHDOG_RUN_ALWAYS
¶ Run the watchdog continuously, even during sleep
-
enumerator
METAL_WATCHDOG_RUN_AWAKE
¶ Run the watchdog only while the CPU is awake
-
enumerator
-
enum
metal_watchdog_result
¶ List of behaviors when a watchdog triggers.
Values:
-
enumerator
METAL_WATCHDOG_NO_RESULT
¶ When the watchdog triggers, do nothing
-
enumerator
METAL_WATCHDOG_INTERRUPT
¶ When the watchdog triggers, fire an interrupt
-
enumerator
METAL_WATCHDOG_FULL_RESET
¶ When the watchdog triggers, cause a full system reset
-
enumerator
Functions
-
int
metal_watchdog_feed
(const struct metal_watchdog *const wdog)¶ Feed the watchdog timer.
-
long int
metal_watchdog_get_rate
(const struct metal_watchdog *const wdog)¶ Get the rate of the watchdog timer in Hz.
- Return
the rate of the watchdog timer
-
long int
metal_watchdog_set_rate
(const struct metal_watchdog *const wdog, const long int rate)¶ Set the rate of the watchdog timer in Hz.
There is no guarantee that the new rate will match the requested rate.
- Return
the new rate of the watchdog timer
-
long int
metal_watchdog_get_timeout
(const struct metal_watchdog *const wdog)¶ Get the timeout of the watchdog timer.
- Return
the watchdog timeout value
-
long int
metal_watchdog_set_timeout
(const struct metal_watchdog *const wdog, const long int timeout)¶ Set the timeout of the watchdog timer.
The set rate will be the minimimum of the requested and maximum supported rates.
- Return
the new watchdog timeout value
-
int
metal_watchdog_set_result
(const struct metal_watchdog *const wdog, const enum metal_watchdog_result result)¶ Sets the result behavior of a watchdog timer timeout.
- Return
0 if the requested result behavior is supported
-
int
metal_watchdog_run
(const struct metal_watchdog *const wdog, const enum metal_watchdog_run_option option)¶ Set the run behavior of the watchdog.
Used to enable/disable the watchdog timer
- Return
0 if the watchdog was successfully started/stopped
-
struct metal_interrupt *
metal_watchdog_get_interrupt
(const struct metal_watchdog *const wdog)¶ Get the interrupt controller for the watchdog interrupt.
-
int
metal_watchdog_get_interrupt_id
(const struct metal_watchdog *const wdog)¶ Get the interrupt id for the watchdog interrupt
-
int
metal_watchdog_clear_interrupt
(const struct metal_watchdog *const wdog)¶ Clear the watchdog interrupt.
-
struct metal_watchdog *
metal_watchdog_get_device
(const int index)¶ Get a watchdog handle.
-
struct
metal_watchdog
¶ - #include <watchdog.h>
Handle for a Watchdog Timer.