diff --git a/cpu/msp430/clock.c b/cpu/msp430/clock.c index d4a9141a7..696cce1ef 100644 --- a/cpu/msp430/clock.c +++ b/cpu/msp430/clock.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: clock.c,v 1.25 2010/04/04 12:29:50 adamdunkels Exp $ + * @(#)$Id: clock.c,v 1.26 2010/12/16 22:50:21 adamdunkels Exp $ */ @@ -49,12 +49,14 @@ static volatile unsigned long seconds; static volatile clock_time_t count = 0; -/* last_tar is used for calculating clock_fine, last_ccr might be better? */ -static unsigned short last_tar = 0; +/* last_tar is used for calculating clock_fine */ +static volatile uint16_t last_tar = 0; /*---------------------------------------------------------------------------*/ interrupt(TIMERA1_VECTOR) timera1 (void) { ENERGEST_ON(ENERGEST_TYPE_IRQ); + watchdog_start(); + if(TAIV == 2) { /* HW timer bug fix: Interrupt handler called before TR==CCR. @@ -63,9 +65,7 @@ interrupt(TIMERA1_VECTOR) timera1 (void) { /* Make sure interrupt time is future */ do { - /* TACTL &= ~MC1;*/ TACCR1 += INTERVAL; - /* TACTL |= MC1;*/ ++count; /* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure @@ -94,7 +94,9 @@ interrupt(TIMERA1_VECTOR) timera1 (void) { /* if(process_nevents() >= 0) { LPM4_EXIT; }*/ - + + watchdog_stop(); + ENERGEST_OFF(ENERGEST_TYPE_IRQ); } /*---------------------------------------------------------------------------*/ @@ -142,7 +144,10 @@ clock_init(void) /* TACTL = TASSEL1 | TACLR | ID_3; */ /* Select ACLK 32768Hz clock, divide by 2 */ - TACTL = TASSEL0 | TACLR | ID_1; + /* TACTL = TASSEL0 | TACLR | ID_1;*/ + + /* Select ACLK 32768Hz clock */ + TACTL = TASSEL0 | TACLR; /* Initialize ccr1 to create the X ms interval. */ /* CCR1 interrupt enabled, interrupt occurs when timer equals CCR1. */ diff --git a/cpu/msp430/rtimer-arch.h b/cpu/msp430/rtimer-arch.h index 4c4947761..52c96502c 100644 --- a/cpu/msp430/rtimer-arch.h +++ b/cpu/msp430/rtimer-arch.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rtimer-arch.h,v 1.8 2010/09/13 20:51:10 nifi Exp $ + * $Id: rtimer-arch.h,v 1.9 2010/12/16 22:50:21 adamdunkels Exp $ */ /** @@ -44,7 +44,7 @@ #include #include "sys/rtimer.h" -#define RTIMER_ARCH_SECOND (4096U*4) +#define RTIMER_ARCH_SECOND (4096U*8) rtimer_clock_t rtimer_arch_now(void);