46 #include "sys/clock.h"
53 #define TICK_VAL (32768/128)
55 #define MAX_TICKS (~((clock_time_t)0) / 2)
58 static unsigned long timer_value;
60 static volatile clock_time_t count = 0;
62 static volatile clock_time_t seconds = 0;
72 for(i = 0; i< len; i++) {
106 CLKCON = OSC32K | TICKSPD2|TICKSPD1|TICKSPD0;
110 timer_value += ((
unsigned long int)ST1) << 8;
111 timer_value += ((
unsigned long int)ST2) << 16;
113 ST2 = (
unsigned char) (timer_value >> 16);
114 ST1 = (
unsigned char) (timer_value >> 8);
115 ST0 = (
unsigned char) timer_value;
121 cc2430_clock_ISR(
void ) __interrupt (ST_VECTOR)
130 timer_value += ((
unsigned long int)ST1) << 8;
131 timer_value += ((
unsigned long int)ST2) << 16;
133 ST2 = (
unsigned char) (timer_value >> 16);
134 ST1 = (
unsigned char) (timer_value >> 8);
135 ST0 = (
unsigned char) timer_value;
143 #if (CLOCK_CONF_SECOND & (CLOCK_CONF_SECOND - 1)) != 0
144 #error CLOCK_CONF_SECOND must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...).
145 #error Change CLOCK_CONF_SECOND in contiki-conf.h.
147 if(count % CLOCK_CONF_SECOND == 0) {