summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/watchdog.c
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/watchdog.c')
-rw-r--r--FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/watchdog.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/watchdog.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/watchdog.c
new file mode 100644
index 000000000..5e9bc4965
--- /dev/null
+++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/watchdog.c
@@ -0,0 +1,37 @@
+/* Copyright 2019 SiFive, Inc */
+/* SPDX-License-Identifier: Apache-2.0 */
+
+#include <metal/machine.h>
+#include <metal/watchdog.h>
+
+extern inline int metal_watchdog_feed(const struct metal_watchdog *const wdog);
+extern inline long int
+metal_watchdog_get_rate(const struct metal_watchdog *const wdog);
+extern inline long int
+metal_watchdog_set_rate(const struct metal_watchdog *const wdog,
+ const long int rate);
+extern inline long int
+metal_watchdog_get_timeout(const struct metal_watchdog *const wdog);
+extern inline long int
+metal_watchdog_set_timeout(const struct metal_watchdog *const wdog,
+ const long int timeout);
+extern inline int
+metal_watchdog_set_result(const struct metal_watchdog *const wdog,
+ const enum metal_watchdog_result result);
+extern inline int
+metal_watchdog_run(const struct metal_watchdog *const wdog,
+ const enum metal_watchdog_run_option option);
+extern inline struct metal_interrupt *
+metal_watchdog_get_interrupt(const struct metal_watchdog *const wdog);
+extern inline int
+metal_watchdog_get_interrupt_id(const struct metal_watchdog *const wdog);
+extern inline int
+metal_watchdog_clear_interrupt(const struct metal_watchdog *const wdog);
+
+struct metal_watchdog *metal_watchdog_get_device(const int index) {
+ if (index > __METAL_DT_MAX_WDOGS) {
+ return NULL;
+ }
+
+ return (struct metal_watchdog *)__metal_wdog_table[index];
+}