X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/1fe5f5eb5378a47bf0f3451762743c162e40faad..2b0380cba5e5adc73299bbaccdc7d20b84825cc1:/lunaix-os/includes/hal/hwtimer.h diff --git a/lunaix-os/includes/hal/hwtimer.h b/lunaix-os/includes/hal/hwtimer.h index efa72d8..e7a22a7 100644 --- a/lunaix-os/includes/hal/hwtimer.h +++ b/lunaix-os/includes/hal/hwtimer.h @@ -1,36 +1,48 @@ #ifndef __LUNAIX_HWTIMER_H #define __LUNAIX_HWTIMER_H +#include #include #include typedef void (*timer_tick_cb)(); -struct hwtimer_context +#define HWTIMER_MIN_PRECEDENCE 0 +#define HWTIMER_MAX_PRECEDENCE 15 + +struct hwtimer_pot; +struct hwtimer_pot_ops { - char* name; - void* data; + void (*calibrate)(struct hwtimer_pot*, u32_t hertz); +}; - int (*supported)(struct hwtimer_context*); - void (*init)(struct hwtimer_context*, u32_t hertz, timer_tick_cb); - ticks_t (*systicks)(); +struct hwtimer_pot +{ + POTENS_META; + + struct llist_header timers; + + int precedence; + timer_tick_cb callback; ticks_t base_freq; ticks_t running_freq; + volatile ticks_t systick_raw; + + struct hwtimer_pot_ops* ops; }; void hwtimer_init(u32_t hertz, void* tick_callback); -struct hwtimer_context* -hwtimer_choose(); - -ticks_t -hwtimer_base_frequency(); - ticks_t hwtimer_current_systicks(); ticks_t hwtimer_to_ticks(u32_t value, int unit); +struct hwtimer_pot* +hwtimer_attach_potens(struct device* dev, int precedence, + struct hwtimer_pot_ops* ops); + + #endif /* __LUNAIX_HWTIMER_H */