From a4d5ca833c2557f16e99eeda9111a870ed866f97 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Mon, 21 Jan 2008 10:39:23 +0000 Subject: [PATCH] Update the periodic watchdog only if it is not stopped --- cpu/msp430/watchdog.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cpu/msp430/watchdog.c b/cpu/msp430/watchdog.c index 55e42f135..4a59a37c5 100644 --- a/cpu/msp430/watchdog.c +++ b/cpu/msp430/watchdog.c @@ -28,11 +28,12 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: watchdog.c,v 1.3 2008/01/08 08:03:02 adamdunkels Exp $ + * @(#)$Id: watchdog.c,v 1.4 2008/01/21 10:39:23 adamdunkels Exp $ */ #include #include "dev/watchdog.h" +static int stopped = 0; /*---------------------------------------------------------------------------*/ void watchdog_init(void) @@ -48,6 +49,7 @@ watchdog_start(void) /* We setup the watchdog to reset the device after one second, unless watchdog_periodic() is called. */ WDTCTL = WDTPW | WDTCNTCL | WDT_ARST_1000; + stopped = 0; } /*---------------------------------------------------------------------------*/ void @@ -55,13 +57,16 @@ watchdog_periodic(void) { /* This function is called periodically to restart the watchdog timer. */ - WDTCTL = (WDTCTL & 0xff) | WDTPW | WDTCNTCL; + if(!stopped) { + WDTCTL = (WDTCTL & 0xff) | WDTPW | WDTCNTCL; + } } /*---------------------------------------------------------------------------*/ void watchdog_stop(void) { WDTCTL = WDTPW | WDTHOLD; + stopped = 1; } /*---------------------------------------------------------------------------*/ void