summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/apps
diff options
context:
space:
mode:
authorHarald Welte2010-03-07 01:29:47 +0100
committerHarald Welte2010-03-07 01:29:47 +0100
commitf216bb3024f1b557d73af459c999f53feb483baf (patch)
tree12930f6696a7db5051bf1ee1b26d8f8c51bc1048 /src/target/firmware/apps
parentosmocon: we don't want to write to serial FD after download completed (diff)
downloadosmocom-f216bb3024f1b557d73af459c999f53feb483baf.tar.gz
osmocom-f216bb3024f1b557d73af459c999f53feb483baf.tar.xz
osmocom-f216bb3024f1b557d73af459c999f53feb483baf.zip
add 'struct timer_list' timer code similar to linux + OpenBSC
We now support arbitrary timers by means of 'struct timer_list'. Any part of the program can register such a callback by means of schedule_timer() on a millisecond-granularity. However, there is no guarantee on the timer precision. It will not execute before the timer expires - but it might expire quite a bit later than we have asked it for, depending on how busy the cpu is with other work. The timer code is in the 'comm/' directory, as it is intended to be migrated into libosmocore soon. Furthermore, as we currently don't yet have a scheduler or tasks, the main() routine explicitly has to call update_timers() to check for any expired timers and run them.
Diffstat (limited to 'src/target/firmware/apps')
-rw-r--r--src/target/firmware/apps/compal_dsp_dump/main.c5
-rw-r--r--src/target/firmware/apps/compal_dump/main.c5
-rw-r--r--src/target/firmware/apps/hello_world/main.c2
-rw-r--r--src/target/firmware/apps/l1test/main.c5
-rw-r--r--src/target/firmware/apps/layer1/main.c5
5 files changed, 18 insertions, 4 deletions
diff --git a/src/target/firmware/apps/compal_dsp_dump/main.c b/src/target/firmware/apps/compal_dsp_dump/main.c
index 7d83b6b..3c9a1db 100644
--- a/src/target/firmware/apps/compal_dsp_dump/main.c
+++ b/src/target/firmware/apps/compal_dsp_dump/main.c
@@ -35,6 +35,7 @@
#include <calypso/tsp.h>
#include <calypso/dsp.h>
#include <calypso/irq.h>
+#include <comm/timer.h>
/* FIXME: We need proper calibrated delay loops at some point! */
void delay_us(unsigned int us)
@@ -72,6 +73,8 @@ void main(void)
/* Dump DSP content */
dsp_dump();
- while (1) {}
+ while (1) {
+ update_timers();
+ }
}
diff --git a/src/target/firmware/apps/compal_dump/main.c b/src/target/firmware/apps/compal_dump/main.c
index 444dfd4..f728728 100644
--- a/src/target/firmware/apps/compal_dump/main.c
+++ b/src/target/firmware/apps/compal_dump/main.c
@@ -28,6 +28,7 @@
#include <calypso/clock.h>
#include <calypso/timer.h>
#include <calypso/misc.h>
+#include <comm/timer.h>
/* FIXME: We need proper calibrated delay loops at some point! */
void delay_us(unsigned int us)
@@ -85,6 +86,8 @@ int main(void)
/* Power down */
twl3025_power_off();
- while (1) {}
+ while (1) {
+ update_timers();
+ }
}
diff --git a/src/target/firmware/apps/hello_world/main.c b/src/target/firmware/apps/hello_world/main.c
index 7f6aeef..b6f22fc 100644
--- a/src/target/firmware/apps/hello_world/main.c
+++ b/src/target/firmware/apps/hello_world/main.c
@@ -39,6 +39,7 @@
#include <calypso/irq.h>
#include <calypso/misc.h>
#include <comm/sercomm.h>
+#include <comm/timer.h>
/* FIXME: We need proper calibrated delay loops at some point! */
void delay_us(unsigned int us)
@@ -107,6 +108,7 @@ int main(void)
/* beyond this point we only react to interrupts */
puts("entering interrupt loop\n");
while (1) {
+ update_timers();
}
twl3025_power_off();
diff --git a/src/target/firmware/apps/l1test/main.c b/src/target/firmware/apps/l1test/main.c
index b19f72c..392aa9a 100644
--- a/src/target/firmware/apps/l1test/main.c
+++ b/src/target/firmware/apps/l1test/main.c
@@ -35,6 +35,7 @@
#include <rf/trf6151.h>
#include <comm/sercomm.h>
+#include <comm/timer.h>
#include <calypso/clock.h>
#include <calypso/tpu.h>
@@ -209,7 +210,9 @@ int main(void)
#endif
tpu_frame_irq_en(1, 1);
- while (1) {}
+ while (1) {
+ update_timers();
+ }
/* NOT REACHED */
diff --git a/src/target/firmware/apps/layer1/main.c b/src/target/firmware/apps/layer1/main.c
index 6247543..d1dae5b 100644
--- a/src/target/firmware/apps/layer1/main.c
+++ b/src/target/firmware/apps/layer1/main.c
@@ -35,6 +35,7 @@
#include <rf/trf6151.h>
#include <comm/sercomm.h>
+#include <comm/timer.h>
#include <calypso/clock.h>
#include <calypso/tpu.h>
@@ -103,7 +104,9 @@ int main(void)
tpu_frame_irq_en(1, 1);
- while (1) {}
+ while (1) {
+ update_timers();
+ }
/* NOT REACHED */