34 #include "sys/clock.h"
36 #include "rtimer-arch.h"
37 #include "dev/watchdog.h"
38 #include "isr_compat.h"
40 #define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND)
42 #define MAX_TICKS (~((clock_time_t)0) / 2)
44 static volatile unsigned long seconds;
46 static volatile clock_time_t count = 0;
48 static volatile uint16_t last_tar = 0;
52 ENERGEST_ON(ENERGEST_TYPE_IRQ);
60 while(TACTL & MC1 && TACCR1 - TAR == 1);
71 #if (CLOCK_CONF_SECOND & (CLOCK_CONF_SECOND - 1)) != 0
72 #error CLOCK_CONF_SECOND must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...).
73 #error Change CLOCK_CONF_SECOND in contiki-conf.h.
75 if(count % CLOCK_CONF_SECOND == 0) {
79 }
while((TACCR1 - TAR) > INTERVAL);
96 ENERGEST_OFF(ENERGEST_TYPE_IRQ);
111 clock_set(clock_time_t clock, clock_time_t fclock)
114 TACCR1 = fclock + INTERVAL;
131 return (
unsigned short) (TAR - t);
148 #if INTERVAL==32768/CLOCK_SECOND
149 TACTL = TASSEL0 | TACLR;
150 #elif INTERVAL==16384/CLOCK_SECOND
151 TACTL = TASSEL0 | TACLR | ID_1;
153 #error NEED TO UPDATE clock.c to match interval!
194 while(
clock_time() - start < (clock_time_t)i);
209 unsigned long t1, t2;
220 rtimer_clock_t t1, t2;