diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-03-07 01:29:47 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-03-07 01:29:47 +0100 |
commit | f216bb3024f1b557d73af459c999f53feb483baf (patch) | |
tree | 12930f6696a7db5051bf1ee1b26d8f8c51bc1048 /src/target/firmware/apps/layer1/main.c | |
parent | ba82248d3398b0034102e58c2d22b12f2b4569d0 (diff) |
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/layer1/main.c')
-rw-r--r-- | src/target/firmware/apps/layer1/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/target/firmware/apps/layer1/main.c b/src/target/firmware/apps/layer1/main.c index 62475433..d1dae5b5 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 */ |