refactor: use a more decent physical memory map
[lunaix-os.git] / lunaix-os / includes / hal / hwtimer.h
1 #ifndef __LUNAIX_HWTIMER_H
2 #define __LUNAIX_HWTIMER_H
3
4 #include <lunaix/time.h>
5 #include <lunaix/types.h>
6
7 typedef void (*timer_tick_cb)();
8
9 struct hwtimer_context
10 {
11     char* name;
12     void* data;
13
14     int (*supported)(struct hwtimer_context*);
15     void (*init)(struct hwtimer_context*, u32_t hertz, timer_tick_cb);
16     ticks_t (*systicks)();
17     ticks_t base_freq;
18     ticks_t running_freq;
19 };
20
21 extern struct hwtimer_context* current_timer;
22
23 void
24 hwtimer_init(u32_t hertz, void* tick_callback);
25
26 struct hwtimer_context*
27 hwtimer_choose();
28
29 ticks_t
30 hwtimer_base_frequency();
31
32 ticks_t
33 hwtimer_current_systicks();
34
35 ticks_t
36 hwtimer_to_ticks(u32_t value, int unit);
37
38 #endif /* __LUNAIX_HWTIMER_H */