mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #919 from haukepetersen/hwtimer_cleanup
core/cpu: renamed ARCH_MAXTIMERS to HWTIMER_MAXTIMERS
This commit is contained in:
commit
79837f9038
@ -43,8 +43,8 @@ typedef struct hwtimer_t {
|
||||
void *data;
|
||||
} hwtimer_t;
|
||||
|
||||
static hwtimer_t timer[ARCH_MAXTIMERS];
|
||||
static int lifo[ARCH_MAXTIMERS + 1];
|
||||
static hwtimer_t timer[HWTIMER_MAXTIMERS];
|
||||
static int lifo[HWTIMER_MAXTIMERS + 1];
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -100,9 +100,9 @@ void hwtimer_init_comp(uint32_t fcpu)
|
||||
{
|
||||
hwtimer_arch_init(multiplexer, fcpu);
|
||||
|
||||
lifo_init(lifo, ARCH_MAXTIMERS);
|
||||
lifo_init(lifo, HWTIMER_MAXTIMERS);
|
||||
|
||||
for (int i = 0; i < ARCH_MAXTIMERS; i++) {
|
||||
for (int i = 0; i < HWTIMER_MAXTIMERS; i++) {
|
||||
lifo_insert(lifo, i);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef HWTIMER_CPU_H_
|
||||
#define HWTIMER_CPU_H_
|
||||
|
||||
#define ARCH_MAXTIMERS 4
|
||||
#define HWTIMER_MAXTIMERS 4
|
||||
#define HWTIMER_SPEED 1000000
|
||||
#define HWTIMER_MAXTICKS (0xFFFFFFFF)
|
||||
|
||||
|
@ -43,7 +43,7 @@ void timerA_init(void)
|
||||
volatile unsigned int *ccr = &TA0CCR0;
|
||||
volatile unsigned int *ctl = &TA0CCTL0;
|
||||
|
||||
for (int i = 0; i < ARCH_MAXTIMERS; i++) {
|
||||
for (int i = 0; i < HWTIMER_MAXTIMERS; i++) {
|
||||
*(ccr + i) = 0;
|
||||
*(ctl + i) &= ~(CCIFG);
|
||||
*(ctl + i) &= ~(CCIE);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef HWTIMER_CPU_H_
|
||||
#define HWTIMER_CPU_H_
|
||||
|
||||
#define ARCH_MAXTIMERS 3
|
||||
#define HWTIMER_MAXTIMERS 3
|
||||
#define HWTIMER_SPEED 1000000
|
||||
#define HWTIMER_MAXTICKS (0xFFFFFFFF)
|
||||
|
||||
|
@ -22,7 +22,7 @@ See the file LICENSE in the top level directory for more details.
|
||||
|
||||
void (*int_handler)(int);
|
||||
extern void timerA_init(void);
|
||||
uint16_t overflow_interrupt[ARCH_MAXTIMERS+1];
|
||||
uint16_t overflow_interrupt[HWTIMER_MAXTIMERS+1];
|
||||
uint16_t timer_round;
|
||||
|
||||
#ifdef CC430
|
||||
@ -87,14 +87,14 @@ void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu)
|
||||
|
||||
void hwtimer_arch_enable_interrupt(void)
|
||||
{
|
||||
for (int i = 0; i < ARCH_MAXTIMERS; i++) {
|
||||
for (int i = 0; i < HWTIMER_MAXTIMERS; i++) {
|
||||
timer_enable_interrupt(i);
|
||||
}
|
||||
}
|
||||
|
||||
void hwtimer_arch_disable_interrupt(void)
|
||||
{
|
||||
for (int i = 0; i < ARCH_MAXTIMERS; i++) {
|
||||
for (int i = 0; i < HWTIMER_MAXTIMERS; i++) {
|
||||
timer_disable_interrupt(i);
|
||||
}
|
||||
}
|
||||
|
@ -18,19 +18,19 @@ See the file LICENSE in the top level directory for more details.
|
||||
#include "cpu.h"
|
||||
|
||||
#ifdef __MSP430_HAS_TA2__
|
||||
#define ARCH_MAXTIMERS 2
|
||||
#define HWTIMER_MAXTIMERS 2
|
||||
#endif
|
||||
#ifdef __MSP430_HAS_TA3__
|
||||
#define ARCH_MAXTIMERS 3
|
||||
#define HWTIMER_MAXTIMERS 3
|
||||
#endif
|
||||
#ifdef __MSP430_HAS_T0A5__
|
||||
#define ARCH_MAXTIMERS 5
|
||||
#define HWTIMER_MAXTIMERS 5
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ARCH_MAXTIMERS
|
||||
#warning "ARCH_MAXTIMERS UNSET!"
|
||||
#define ARCH_MAXTIMERS 0
|
||||
#ifndef HWTIMER_MAXTIMERS
|
||||
#warning "HWTIMER_MAXTIMERS UNSET!"
|
||||
#define HWTIMER_MAXTIMERS 0
|
||||
#endif
|
||||
|
||||
#define HWTIMER_SPEED (F_RC_OSCILLATOR)
|
||||
|
@ -28,7 +28,7 @@ static uint32_t ticks = 0;
|
||||
|
||||
extern void (*int_handler)(int);
|
||||
extern void timer_unset(short timer);
|
||||
extern uint16_t overflow_interrupt[ARCH_MAXTIMERS+1];
|
||||
extern uint16_t overflow_interrupt[HWTIMER_MAXTIMERS+1];
|
||||
extern uint16_t timer_round;
|
||||
|
||||
void timerA_init(void)
|
||||
@ -41,7 +41,7 @@ void timerA_init(void)
|
||||
TACTL &= ~TAIFG; // Clear the IFG
|
||||
TACTL &= ~TAIE; // Clear the IFG
|
||||
|
||||
for (int i = 0; i < ARCH_MAXTIMERS; i++) {
|
||||
for (int i = 0; i < HWTIMER_MAXTIMERS; i++) {
|
||||
ccr = &TACCR0 + (i);
|
||||
ctl = &TACCTL0 + (i);
|
||||
*ccr = 0;
|
||||
|
@ -51,8 +51,8 @@
|
||||
static unsigned long native_hwtimer_now;
|
||||
static unsigned long time_null;
|
||||
|
||||
static struct itimerval native_hwtimer[ARCH_MAXTIMERS];
|
||||
static int native_hwtimer_isset[ARCH_MAXTIMERS];
|
||||
static struct itimerval native_hwtimer[HWTIMER_MAXTIMERS];
|
||||
static int native_hwtimer_isset[HWTIMER_MAXTIMERS];
|
||||
|
||||
static int next_timer = -1;
|
||||
static void (*int_handler)(int);
|
||||
@ -126,7 +126,7 @@ void schedule_timer(void)
|
||||
{
|
||||
/* try to find *an active* timer */
|
||||
next_timer = -1;
|
||||
for (int i = 0; i < ARCH_MAXTIMERS; i++) {
|
||||
for (int i = 0; i < HWTIMER_MAXTIMERS; i++) {
|
||||
if (native_hwtimer_isset[i] == 1) {
|
||||
next_timer = i;
|
||||
break;
|
||||
@ -139,7 +139,7 @@ void schedule_timer(void)
|
||||
}
|
||||
|
||||
/* find the next pending timer (next_timer now points to *a* valid pending timer) */
|
||||
for (int i = 0; i < ARCH_MAXTIMERS; i++) {
|
||||
for (int i = 0; i < HWTIMER_MAXTIMERS; i++) {
|
||||
if (
|
||||
(native_hwtimer_isset[i] == 1) &&
|
||||
(tv2ticks(&(native_hwtimer[i].it_value)) < tv2ticks(&(native_hwtimer[next_timer].it_value)))
|
||||
@ -315,7 +315,7 @@ void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu)
|
||||
hwtimer_arch_disable_interrupt();
|
||||
int_handler = handler;
|
||||
|
||||
for (int i = 0; i < ARCH_MAXTIMERS; i++) {
|
||||
for (int i = 0; i < HWTIMER_MAXTIMERS; i++) {
|
||||
native_hwtimer_isset[i] = 0;
|
||||
native_hwtimer[i].it_interval.tv_sec = 0;
|
||||
native_hwtimer[i].it_interval.tv_usec = 0;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define HWTIMER_CPU_H_
|
||||
|
||||
/* TODO: choose more appropriate values here? */
|
||||
#define ARCH_MAXTIMERS 4
|
||||
#define HWTIMER_MAXTIMERS 4
|
||||
#define HWTIMER_SPEED 1000000
|
||||
#define HWTIMER_MAXTICKS (0xFFFFFFFF)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user