contiki/cpu/at91sam7s/rtimer-arch-interrupt.c
ksb 792eae91c6 rtimer implementation (not well tested)
sprintf that use strformat, so there's no need to pull in the newlib
implementation.
Build system improvements.
2007-08-21 09:03:55 +00:00

35 lines
680 B
C

#include "rtimer-arch-interrupt.h"
#include "rtimer-arch.h"
#include <interrupt-utils.h>
#include <AT91SAM7S64.h>
#define DEBUG 1
#if DEBUG
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#else
#define PRINTF(...)
#endif
/* Here we have a proper stack frame and can use local variables */
static void rtimer_int_safe() __attribute((noinline));
static void
rtimer_int_safe()
{
unsigned int status;
status = RTIMER_ARCH_TIMER_BASE->TC_SR;
if (status & AT91C_TC_CPAS) {
rtimer_run_next();
}
*AT91C_AIC_EOICR = 0;
}
void NACKEDFUNC
rtimer_interrupt (void) {
ISR_STORE();
ISR_ENABLE_NEST();
rtimer_int_safe();
ISR_DISABLE_NEST();
ISR_RESTORE();
}