mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
add rtimers for cxmac
This commit is contained in:
parent
fee5efb141
commit
a83381de30
@ -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 <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
@ -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 <avr/interrupt.h>
|
||||
|
||||
/* 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
|
||||
|
Loading…
Reference in New Issue
Block a user