summaryrefslogtreecommitdiffstats
path: root/include/watchdog.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/watchdog.h')
-rw-r--r--include/watchdog.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/watchdog.h b/include/watchdog.h
index 105b7ca810..5790205a48 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -16,6 +16,10 @@
#include <poller.h>
#include <driver.h>
+enum wdog_hw_runnning {
+ WDOG_HW_RUNNING_UNSUPPORTED, WDOG_HW_RUNNING, WDOG_HW_NOT_RUNNING
+};
+
struct watchdog {
int (*set_timeout)(struct watchdog *, unsigned);
const char *name;
@@ -27,8 +31,21 @@ struct watchdog {
unsigned int poller_enable;
struct poller_async poller;
struct list_head list;
+ int running; /* enum wdog_hw_running */
};
+/*
+ * Use the following function to check whether or not the hardware watchdog
+ * is running
+ */
+static inline int watchdog_hw_running(struct watchdog *w)
+{
+ if (w->running == WDOG_HW_RUNNING_UNSUPPORTED)
+ return -ENOSYS;
+
+ return w->running == WDOG_HW_RUNNING;
+}
+
#ifdef CONFIG_WATCHDOG
int watchdog_register(struct watchdog *);
int watchdog_deregister(struct watchdog *);