From 5f9cc9abd8265b9d48093faa625ff3bf8e93e289 Mon Sep 17 00:00:00 2001 From: dak664 Date: Thu, 18 Feb 2010 17:21:44 +0000 Subject: [PATCH] add rtimers for cxmac --- cpu/avr/rtimer-arch.c | 10 +++++++--- cpu/avr/rtimer-arch.h | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cpu/avr/rtimer-arch.c b/cpu/avr/rtimer-arch.c index ba2aba4f..0898248e 100644 --- a/cpu/avr/rtimer-arch.c +++ b/cpu/avr/rtimer-arch.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rtimer-arch.c,v 1.6 2010/02/16 21:48:38 dak664 Exp $ + * $Id: rtimer-arch.c,v 1.7 2010/02/18 17:21:44 dak664 Exp $ */ /** @@ -44,6 +44,7 @@ #include #include +#include #include "sys/energest.h" #include "sys/rtimer.h" @@ -68,7 +69,7 @@ #define ETIFR TIFR3 #define TICIE3 ICIE3 #endif - +uint8_t rtimerworks; /*---------------------------------------------------------------------------*/ #ifdef TCNT3 ISR (TIMER3_COMPA_vect) { @@ -76,7 +77,7 @@ ISR (TIMER3_COMPA_vect) { ETIMSK &= ~((1 << OCIE3A) | (1 << OCIE3B) | (1 << TOIE3) | (1 << TICIE3) | (1 << OCIE3C)); - +rtimerworks++; /* Call rtimer callback */ rtimer_run_next(); @@ -97,6 +98,7 @@ rtimer_arch_init(void) cli (); #ifdef TCNT3 +rtimerworks=240; ETIMSK &= ~((1 << OCIE3A) | (1 << OCIE3B) | (1 << TOIE3) | (1 << TICIE3) | (1 << OCIE3C)); @@ -132,6 +134,7 @@ rtimer_arch_schedule(rtimer_clock_t t) cli (); #ifdef TCNT3 +rtimerworks=250; /* Set compare register */ OCR3A = t; ETIFR |= (1 << ICF3) | (1 << OCF3A) | (1 << OCF3B) | (1 << TOV3) | @@ -145,4 +148,5 @@ rtimer_arch_schedule(rtimer_clock_t t) /* Restore interrupt state */ SREG = sreg; + printf("rs%d",t); } diff --git a/cpu/avr/rtimer-arch.h b/cpu/avr/rtimer-arch.h index 93319edf..89f0431f 100644 --- a/cpu/avr/rtimer-arch.h +++ b/cpu/avr/rtimer-arch.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * $Id: rtimer-arch.h,v 1.4 2007/12/11 17:21:14 joxe Exp $ + * $Id: rtimer-arch.h,v 1.5 2010/02/18 17:21:44 dak664 Exp $ */ #ifndef __RTIMER_ARCH_H__ @@ -36,8 +36,11 @@ #include +/* Will affect radio on/off timing for cx-mac */ #define RTIMER_ARCH_SECOND (8192) + + /* Handle that not all AVRs have TCNT3 - this should be configuratble in contiki-conf later! */ #ifdef TCNT3 -- 2.11.4.GIT