From 0d4b90c42b161c277f051f13a50d83135a87cf2d Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 27 Apr 2012 11:47:50 +0100 Subject: [PATCH] cc2530 watchdog improvements and cleanup --- cpu/cc253x/8051def.h | 5 +++++ cpu/cc253x/dev/watchdog.c | 15 ++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cpu/cc253x/8051def.h b/cpu/cc253x/8051def.h index 7785d0bec..a8cc59a81 100644 --- a/cpu/cc253x/8051def.h +++ b/cpu/cc253x/8051def.h @@ -14,6 +14,11 @@ #include +/* In watchdog mode, our WDT can't be stopped once started + * Include watchdog_stop()'s declaration and then trash it */ +#include "dev/watchdog.h" +#define watchdog_stop() watchdog_periodic() + /* * lint - style defines to help syntax parsers with sdcc-specific 8051 code * They don't interfere with actual compilation diff --git a/cpu/cc253x/dev/watchdog.c b/cpu/cc253x/dev/watchdog.c index 92cf40f16..8f35142fc 100644 --- a/cpu/cc253x/dev/watchdog.c +++ b/cpu/cc253x/dev/watchdog.c @@ -39,7 +39,6 @@ * George Oikonomou - */ -#include "sys/energest.h" #include "cc253x.h" #include "sfr-bits.h" #include "contiki-conf.h" @@ -67,22 +66,16 @@ watchdog_periodic(void) } /*---------------------------------------------------------------------------*/ void -watchdog_stop(void) -{ - /* In watchdog mode, stopping is impossible so we just reset the timer */ - watchdog_periodic(); -} -/*---------------------------------------------------------------------------*/ -void watchdog_reboot(void) { WDCTL = WDT_TIMEOUT_MIN; /* Dis-acknowledge all interrupts while we wait for the dog to bark */ DISABLE_INTERRUPTS(); + + WDCTL |= WDCTL_MODE1; /* Just in case it's not started... */ + /* NOP till the dog barks... */ while(1) { - __asm - nop - __endasm; + ASM(nop); } }