moved rtimer from TimerB to TimerA so that TimerB subsystem is free for other uses

This commit is contained in:
joxe 2008-12-02 12:44:48 +00:00
parent f0f9314e7e
commit 23b7db88d5
3 changed files with 11 additions and 22 deletions

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: clock.c,v 1.16 2008/10/10 12:36:58 nifi Exp $
* @(#)$Id: clock.c,v 1.17 2008/12/02 12:44:48 joxe Exp $
*/
@ -40,10 +40,11 @@
#include "sys/energest.h"
#include "sys/clock.h"
#include "sys/etimer.h"
#include "rtimer-arch.h"
/* 38400 cycles @ 2.4576MHz with divisor 8 ==> 1/8 s */
/* #define INTERVAL (307200ULL / CLOCK_SECOND) */
#define INTERVAL (4096ULL / CLOCK_SECOND)
#define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND)
#define MAX_TICKS (~((clock_time_t)0) / 2)

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rtimer-arch.c,v 1.7 2008/07/04 00:02:21 adamdunkels Exp $
* $Id: rtimer-arch.c,v 1.8 2008/12/02 12:44:48 joxe Exp $
*/
/**
@ -53,11 +53,9 @@
#endif
/*---------------------------------------------------------------------------*/
interrupt(TIMERB1_VECTOR) timerb1 (void) {
interrupt(TIMERA0_VECTOR) timera0 (void) {
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(TBIV == 2) {
rtimer_run_next();
}
rtimer_run_next();
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
@ -66,18 +64,8 @@ rtimer_arch_init(void)
{
dint();
/* Select SMCLK (2.4576MHz), clear TAR; This makes the rtimer count
the number of processor cycles executed by the CPU. */
//TBCTL = TBSSEL1 | TBCLR;
/* Select ACLK 32768Hz clock, divide by 8 */
TBCTL = TBSSEL0 | TBCLR | ID_3;
/* CCR1 interrupt enabled, interrupt occurs when timer equals CCR1. */
TBCCTL1 = CCIE;
/* Start Timer_B in continuous mode. */
TBCTL |= MC1;
/* CCR0 interrupt enabled, interrupt occurs when timer equals CCR0. */
TACCTL0 = CCIE;
/* Enable interrupts. */
eint();
@ -87,5 +75,5 @@ void
rtimer_arch_schedule(rtimer_clock_t t)
{
PRINTF("rtimer_arch_schedule time %u\n", t);
TBCCR1 = t;
TACCR0 = t;
}

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rtimer-arch.h,v 1.4 2007/11/19 22:38:57 joxe Exp $
* $Id: rtimer-arch.h,v 1.5 2008/12/02 12:44:48 joxe Exp $
*/
/**
@ -46,6 +46,6 @@
#define RTIMER_ARCH_SECOND 4096
#define rtimer_arch_now() (TBR)
#define rtimer_arch_now() (TAR)
#endif /* __RTIMER_ARCH_H__ */