From a9e69d935cb5c2e5ffca1bbc977252ce7661d343 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Mon, 27 Oct 2008 16:30:24 +0000 Subject: Strange little kernel optimization to ease targeting the timer tick and to limit the number of loops in the tick function to the number of tasks added rather than always looping the max number. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18893 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/kernel.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'firmware/export/kernel.h') diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 51eb635..9438f6d 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h @@ -207,6 +207,18 @@ int tick_add_task(void (*f)(void)); int tick_remove_task(void (*f)(void)); extern void tick_start(unsigned int interval_in_ms); +/* inline helper for implementing target interrupt handler */ +static inline void call_tick_tasks(void) +{ + extern void (*tick_funcs[MAX_NUM_TICK_TASKS+1])(void); + int i; + + current_tick++; + + for (i = 0; tick_funcs[i] != NULL; i++) + tick_funcs[i](); +} + struct timeout; /* timeout callback type -- cgit v1.1