3 #include "dev/clock-avr.h"
7 #include <avr/interrupt.h>
24 static volatile clock_time_t count;
26 static volatile uint8_t scount;
28 volatile unsigned long seconds;
33 #if RF230BB && AVR_WEBSERVER
38 static volatile uint8_t rcount;
39 volatile unsigned long radioontime;
40 extern uint8_t RF230_receive_on;
48 #if RADIO_CONF_CALIBRATE_INTERVAL
49 extern volatile uint8_t rf230_calibrate;
50 static uint8_t calibrate_interval;
58 void clock_adjust_seconds(uint8_t howmany) {
60 sleepseconds +=howmany;
63 if (RF230_receive_on) radioontime += howmany;
71 void clock_adjust_ticks(uint16_t howmany) {
74 while(scount >= CLOCK_SECOND) {
79 if (RF230_receive_on) radioontime += 1;
85 ISR(AVR_OUTPUT_COMPARE_INT)
88 if(++scount == CLOCK_SECOND) {
92 #if RADIO_CONF_CALIBRATE_INTERVAL
93 if (++calibrate_interval==0) {
98 if (RF230_receive_on) {
99 if (++rcount == CLOCK_SECOND) {
113 extern struct etimer *timerlist;
114 extern volatile unsigned char poll_requested;
116 #define PROCESS_STATE_NONE 0
117 #define PROCESS_STATE_RUNNING 1
118 #define PROCESS_STATE_CALLED 2
121 if(etimer_process.state == PROCESS_STATE_RUNNING ||
122 etimer_process.state == PROCESS_STATE_CALLED) {
123 etimer_process.needspoll = 1;
144 return AVR_CLOCK_COUNTER;
151 return AVR_CLOCK_MAX;
161 }
while(tmp != count);
174 for (j = 5; j > 0; j--)
191 while(
clock_time() - start < (clock_time_t)i);
195 clock_set_seconds(
unsigned long sec)
207 }
while(tmp != seconds);
211 #ifdef HANG_ON_UNKNOWN_INTERRUPT
216 static volatile uint8_t x;
217 ISR( _VECTOR(0)) {
while (1) x++;}
218 ISR( _VECTOR(1)) {
while (1) x++;}
219 ISR( _VECTOR(2)) {
while (1) x++;}
220 ISR( _VECTOR(3)) {
while (1) x++;}
221 ISR( _VECTOR(4)) {
while (1) x++;}
222 ISR( _VECTOR(5)) {
while (1) x++;}
223 ISR( _VECTOR(6)) {
while (1) x++;}
224 ISR( _VECTOR(7)) {
while (1) x++;}
225 ISR( _VECTOR(8)) {
while (1) x++;}
226 ISR( _VECTOR(9)) {
while (1) x++;}
227 ISR( _VECTOR(10)) {
while (1) x++;}
228 ISR( _VECTOR(11)) {
while (1) x++;}
229 ISR( _VECTOR(12)) {
while (1) x++;}
230 ISR( _VECTOR(13)) {
while (1) x++;}
231 ISR( _VECTOR(14)) {
while (1) x++;}
232 ISR( _VECTOR(15)) {
while (1) x++;}
233 ISR( _VECTOR(16)) {
while (1) x++;}
234 ISR( _VECTOR(17)) {
while (1) x++;}
235 ISR( _VECTOR(18)) {
while (1) x++;}
236 ISR( _VECTOR(19)) {
while (1) x++;}
239 ISR( _VECTOR(22)) {
while (1) x++;}
240 ISR( _VECTOR(23)) {
while (1) x++;}
241 ISR( _VECTOR(24)) {
while (1) x++;}
243 ISR( _VECTOR(26)) {
while (1) x++;}
245 ISR( _VECTOR(28)) {
while (1) x++;}
246 ISR( _VECTOR(29)) {
while (1) x++;}
247 ISR( _VECTOR(30)) {
while (1) x++;}
248 ISR( _VECTOR(31)) {
while (1) x++;}
250 ISR( _VECTOR(33)) {
while (1) x++;}
251 ISR( _VECTOR(34)) {
while (1) x++;}
252 ISR( _VECTOR(35)) {
while (1) x++;}
254 ISR( _VECTOR(37)) {
while (1) x++;}
256 ISR( _VECTOR(39)) {
while (1) x++;}
257 ISR( _VECTOR(40)) {
while (1) x++;}
258 ISR( _VECTOR(41)) {
while (1) x++;}
259 ISR( _VECTOR(42)) {
while (1) x++;}
260 ISR( _VECTOR(43)) {
while (1) x++;}
261 ISR( _VECTOR(44)) {
while (1) x++;}
262 ISR( _VECTOR(45)) {
while (1) x++;}
263 ISR( _VECTOR(46)) {
while (1) x++;}
264 ISR( _VECTOR(47)) {
while (1) x++;}
265 ISR( _VECTOR(48)) {
while (1) x++;}
266 ISR( _VECTOR(49)) {
while (1) x++;}
267 ISR( _VECTOR(50)) {
while (1) x++;}
268 ISR( _VECTOR(51)) {
while (1) x++;}
269 ISR( _VECTOR(52)) {
while (1) x++;}
270 ISR( _VECTOR(53)) {
while (1) x++;}
271 ISR( _VECTOR(54)) {
while (1) x++;}
272 ISR( _VECTOR(55)) {
while (1) x++;}
273 ISR( _VECTOR(56)) {
while (1) x++;}
278 ISR( _VECTOR(61)) {
while (1) x++;}
279 ISR( _VECTOR(62)) {
while (1) x++;}
280 ISR( _VECTOR(63)) {
while (1) x++;}
281 ISR( _VECTOR(64)) {
while (1) x++;}
282 ISR( _VECTOR(65)) {
while (1) x++;}
283 ISR( _VECTOR(66)) {
while (1) x++;}
284 ISR( _VECTOR(67)) {
while (1) x++;}
285 ISR( _VECTOR(68)) {
while (1) x++;}
286 ISR( _VECTOR(69)) {
while (1) x++;}
287 ISR( _VECTOR(70)) {
while (1) x++;}
288 ISR( _VECTOR(71)) {
while (1) x++;}
289 ISR( _VECTOR(72)) {
while (1) x++;}
290 ISR( _VECTOR(73)) {
while (1) x++;}
291 ISR( _VECTOR(74)) {
while (1) x++;}
292 ISR( _VECTOR(75)) {
while (1) x++;}
293 ISR( _VECTOR(76)) {
while (1) x++;}
294 ISR( _VECTOR(77)) {
while (1) x++;}
295 ISR( _VECTOR(78)) {
while (1) x++;}
296 ISR( _VECTOR(79)) {
while (1) x++;}