cc2530 watchdog improvements and cleanup

This commit is contained in:
George Oikonomou 2012-04-27 11:47:50 +01:00
parent 274a5ebb9c
commit 0d4b90c42b
2 changed files with 9 additions and 11 deletions

View File

@ -14,6 +14,11 @@
#include <stdint.h> #include <stdint.h>
/* 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 * lint - style defines to help syntax parsers with sdcc-specific 8051 code
* They don't interfere with actual compilation * They don't interfere with actual compilation

View File

@ -39,7 +39,6 @@
* George Oikonomou - <oikonomou@users.sourceforge.net> * George Oikonomou - <oikonomou@users.sourceforge.net>
*/ */
#include "sys/energest.h"
#include "cc253x.h" #include "cc253x.h"
#include "sfr-bits.h" #include "sfr-bits.h"
#include "contiki-conf.h" #include "contiki-conf.h"
@ -67,22 +66,16 @@ watchdog_periodic(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
watchdog_stop(void)
{
/* In watchdog mode, stopping is impossible so we just reset the timer */
watchdog_periodic();
}
/*---------------------------------------------------------------------------*/
void
watchdog_reboot(void) watchdog_reboot(void)
{ {
WDCTL = WDT_TIMEOUT_MIN; WDCTL = WDT_TIMEOUT_MIN;
/* Dis-acknowledge all interrupts while we wait for the dog to bark */ /* Dis-acknowledge all interrupts while we wait for the dog to bark */
DISABLE_INTERRUPTS(); DISABLE_INTERRUPTS();
WDCTL |= WDCTL_MODE1; /* Just in case it's not started... */
/* NOP till the dog barks... */ /* NOP till the dog barks... */
while(1) { while(1) {
__asm ASM(nop);
nop
__endasm;
} }
} }