X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=kitten%2Finclude%2Flwk%2Ftimer.h;fp=kitten%2Finclude%2Flwk%2Ftimer.h;h=64333bc6c184eb48dda5414f6cbfaf4f9ff2e40f;hb=6299cb929a586fd8debcc316c1ede714d5b95979;hp=0000000000000000000000000000000000000000;hpb=e9e3ee43cb302909917b5919f6043347b73c6995;p=palacios.releases.git diff --git a/kitten/include/lwk/timer.h b/kitten/include/lwk/timer.h new file mode 100644 index 0000000..64333bc --- /dev/null +++ b/kitten/include/lwk/timer.h @@ -0,0 +1,40 @@ +#ifndef _LWK_TIMER_H +#define _LWK_TIMER_H + +#include +#include + +/** + * This structure defines a timer, including when the timer should expire + * and the callback function to call when it expires. The callback function + * runs in interrupt context with interrupts disabled. + */ +struct timer { + struct list_head link; + id_t cpu; /* CPU this timer is installed on */ + uint64_t expires; /* Time when this timer expires */ + uintptr_t data; /* arg to pass to function */ + void (*function)(uintptr_t); /* executed when timer expires */ +}; + +/** + * Core timer API. + */ +void timer_add(struct timer *timer); +void timer_del(struct timer *timer); +uint64_t timer_sleep_until(uint64_t when); + +/** + * Internal timer-subsystem functions. + * Normal kernel code and drivers should not call these. + */ +int timer_subsys_init(void); +void expire_timers(void); +void schedule_next_wakeup(void); + +/** + * Architecture-dependent timer functions. + */ +void arch_schedule_next_wakeup(uint64_t when); + +#endif