picofuse

watchdog.h
Go to the documentation of this file.
1 
25 #pragma once
26 
27 #include <stdbool.h>
28 #include <stdint.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
35 // CONSTANTS
36 
45 #ifndef HW_WATCHDOG_DEFAULT_DEVICE
46 #define HW_WATCHDOG_DEFAULT_DEVICE "/dev/watchdog0"
47 #endif
48 
50 // TYPES
51 
58 
65 
78 hw_watchdog_t *hw_watchdog_init_device(const char *device);
79 
88 void hw_watchdog_deinit(hw_watchdog_t *watchdog);
89 
95 uint32_t hw_watchdog_maxtimeout_ms(void);
96 
104 bool hw_watchdog_did_reset(hw_watchdog_t *watchdog);
105 
116 void hw_watchdog_enable(hw_watchdog_t *watchdog, bool enable);
117 
127 void hw_watchdog_reset(hw_watchdog_t *watchdog, uint32_t delay_ms);
128 
129 #ifdef __cplusplus
130 }
131 #endif
struct hw_watchdog_t hw_watchdog_t
Watchdog adapter handle.
Definition: watchdog.h:57
uint32_t hw_watchdog_maxtimeout_ms(void)
Return the maximum supported watchdog timeout in milliseconds.
hw_watchdog_t * hw_watchdog_init(void)
Initialize the watchdog singleton.
void hw_watchdog_enable(hw_watchdog_t *watchdog, bool enable)
Enable or disable watchdog feeding mode.
hw_watchdog_t * hw_watchdog_init_device(const char *device)
Initialize the watchdog singleton for a specific device path.
void hw_watchdog_reset(hw_watchdog_t *watchdog, uint32_t delay_ms)
Trigger a delayed device reset (reboot).
void hw_watchdog_deinit(hw_watchdog_t *watchdog)
Deinitialize the watchdog singleton.
bool hw_watchdog_did_reset(hw_watchdog_t *watchdog)
Report whether the last reboot/reset was caused by the watchdog.