summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-01-31 08:09:05 +0100
committerHarald Welte <laforge@gnumonks.org>2012-02-07 20:03:02 +0100
commit565840008b8c12a58466b4da1545d6e42670a610 (patch)
tree8b49964fd0133710c77455d839b8d3130a078f87
parent6efc1f395e591e19b78a3a31105ffe2b795a9d53 (diff)
firmware/timer: Added HZ as global defintion for jiffies per second
-rw-r--r--src/target/firmware/comm/timer.c8
-rw-r--r--src/target/firmware/include/comm/timer.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/target/firmware/comm/timer.c b/src/target/firmware/comm/timer.c
index b2026b9..ce4f06d 100644
--- a/src/target/firmware/comm/timer.c
+++ b/src/target/firmware/comm/timer.c
@@ -33,8 +33,6 @@ static LLIST_HEAD(timer_list);
unsigned long volatile jiffies;
-#define TIMER_HZ 100
-
#define time_after(a,b) \
(typecheck(unsigned long, a) && \
typecheck(unsigned long, b) && \
@@ -59,7 +57,7 @@ void osmo_timer_add(struct osmo_timer_list *timer)
void osmo_timer_schedule(struct osmo_timer_list *timer, int milliseconds)
{
- timer->expires = jiffies + ((milliseconds * TIMER_HZ) / 1000);
+ timer->expires = jiffies + ((milliseconds * HZ) / 1000);
osmo_timer_add(timer);
}
@@ -200,10 +198,10 @@ void timer_init(void)
/* configure TIMER2 for our purpose */
hwtimer_enable(2, 1);
/* The timer runs at 13MHz / 32, i.e. 406.25kHz */
-#if (TIMER_HZ == 100)
+#if (HZ == 100)
hwtimer_load(2, 4062);
hwtimer_config(2, 0, 1);
-#elif (TIMER_HZ == 10)
+#elif (HZ == 10)
/* prescaler 4, 1015 ticks until expiry */
hwtimer_load(2, 1015);
hwtimer_config(2, 4, 1);
diff --git a/src/target/firmware/include/comm/timer.h b/src/target/firmware/include/comm/timer.h
index 877d47b..1996f66 100644
--- a/src/target/firmware/include/comm/timer.h
+++ b/src/target/firmware/include/comm/timer.h
@@ -25,6 +25,8 @@
#include <osmocom/core/linuxlist.h>
+#define HZ 100
+
/**
* Timer management:
* - Create a struct osmo_timer_list