From 7a310935d845918904eed0340c7f0df2377ba6bb Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Fri, 22 Nov 2013 15:54:06 +0100 Subject: [PATCH] An implementation of the mc1322x watchdog --- cpu/mc1322x/watchdog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cpu/mc1322x/watchdog.c b/cpu/mc1322x/watchdog.c index 7c25f449b..542a68022 100644 --- a/cpu/mc1322x/watchdog.c +++ b/cpu/mc1322x/watchdog.c @@ -34,30 +34,38 @@ */ #include "dev/watchdog.h" +#include +#include /*---------------------------------------------------------------------------*/ void watchdog_init(void) { + cop_timeout_ms(1000); } /*---------------------------------------------------------------------------*/ void watchdog_start(void) { + CRM->COP_CNTLbits.COP_EN = 1; } /*---------------------------------------------------------------------------*/ void watchdog_periodic(void) { + cop_service(); } /*---------------------------------------------------------------------------*/ void watchdog_stop(void) { + CRM->COP_CNTLbits.COP_EN = 0; } /*---------------------------------------------------------------------------*/ void watchdog_reboot(void) { + watchdog_start(); + while(1); } /*---------------------------------------------------------------------------*/