projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lm3s1968: integrate the hardware timer driver into the main timer module.
[bertos.git]
/
bertos
/
cpu
/
cortex-m3
/
drv
/
timer_lm3s.c
diff --git
a/bertos/cpu/cortex-m3/drv/timer_lm3s.c
b/bertos/cpu/cortex-m3/drv/timer_lm3s.c
index 2d6ee89ac554519d29e6a5455a6da83548ee0235..ed432e9f6e7b1ef4fa42464997b50159a9d910e2 100644
(file)
--- a/
bertos/cpu/cortex-m3/drv/timer_lm3s.c
+++ b/
bertos/cpu/cortex-m3/drv/timer_lm3s.c
@@
-42,17
+42,12
@@
#include "irq_lm3s.h"
#include "timer_lm3s.h"
#include "irq_lm3s.h"
#include "timer_lm3s.h"
-
unsigned long ticks
;
+
ISR_PROTO_CONTEXT_SWITCH(timer_handler)
;
INLINE void timer_hw_setPeriod(unsigned long period)
{
ASSERT(period < (1 << 24));
INLINE void timer_hw_setPeriod(unsigned long period)
{
ASSERT(period < (1 << 24));
- HWREG(NVIC_ST_RELOAD) = period;
-}
-
-static void timer_hw_handler(void)
-{
- ticks++;
+ HWREG(NVIC_ST_RELOAD) = period - 1;
}
static void timer_hw_enable(void)
}
static void timer_hw_enable(void)
@@
-68,8
+63,8
@@
static void timer_hw_disable(void)
void timer_hw_init(void)
{
void timer_hw_init(void)
{
- timer_hw_setPeriod(
1000000
);
- sysirq_setHandler(FAULT_SYSTICK, timer_h
w_h
andler);
+ timer_hw_setPeriod(
CPU_FREQ / TIMER_TICKS_PER_SEC
);
+ sysirq_setHandler(FAULT_SYSTICK, timer_handler);
timer_hw_enable();
}
timer_hw_enable();
}