Changes to support the Atmel AVR Raven port
This commit is contained in:
parent
db7d9bb131
commit
cdb6226598
2 changed files with 38 additions and 12 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: rtimer-arch.c,v 1.2 2007/12/11 17:21:14 joxe Exp $
|
||||
* $Id: rtimer-arch.c,v 1.3 2008/10/14 09:44:12 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -48,10 +48,21 @@
|
|||
#include "lib/energest.h"
|
||||
#include "sys/rtimer.h"
|
||||
#include "rtimer-arch.h"
|
||||
|
||||
#if defined(__AVR_ATmega1284P__)
|
||||
#define ETIMSK TIMSK3
|
||||
#define ETIFR TIFR3
|
||||
#define TICIE3 ICIE3
|
||||
|
||||
//Has no 'C', so we just set it to B. The code doesn't really use C so this
|
||||
//is safe to do but lets it compile
|
||||
#define OCIE3C OCIE3B
|
||||
#define OCF3C OCF3B
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef TCNT3
|
||||
SIGNAL (SIG_OUTPUT_COMPARE3A) {
|
||||
ISR (TIMER3_COMPA_vect) {
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
ETIMSK &= ~((1 << OCIE3A) | (1 << OCIE3B) | (1 << TOIE3) |
|
||||
|
@ -61,7 +72,11 @@ SIGNAL (SIG_OUTPUT_COMPARE3A) {
|
|||
rtimer_run_next();
|
||||
|
||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#error "No Timer3 in rtimer-arch.c"
|
||||
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
@ -88,7 +103,10 @@ rtimer_arch_init(void)
|
|||
TCNT3 = 0;
|
||||
|
||||
/* Maximum prescaler */
|
||||
TCCR3B |= 5;
|
||||
TCCR3B |= 5;
|
||||
|
||||
#else
|
||||
#error "No Timer3 in rtimer-arch.c"
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -109,7 +127,10 @@ rtimer_arch_schedule(rtimer_clock_t t)
|
|||
OCR3A = t;
|
||||
ETIFR |= (1 << ICF3) | (1 << OCF3A) | (1 << OCF3B) | (1 << TOV3) |
|
||||
(1 << OCF3C);
|
||||
ETIMSK |= (1 << OCIE3A);
|
||||
ETIMSK |= (1 << OCIE3A);
|
||||
|
||||
#else
|
||||
#error "No Timer3 in rtimer-arch.c"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue