ld-tool portability fix: MacOS build experience
[lunaix-os.git] / lunaix-os / includes / hal / hwtimer.h
1 #ifndef __LUNAIX_HWTIMER_H
2 #define __LUNAIX_HWTIMER_H
3
4 #include <lunaix/device.h>
5 #include <lunaix/time.h>
6 #include <lunaix/types.h>
7
8 typedef void (*timer_tick_cb)();
9
10 struct hwtimer
11 {
12     char* name;
13     void* data;
14
15     struct devclass class;
16     struct device* timer_dev;
17
18     int (*supported)(struct hwtimer*);
19     void (*init)(struct hwtimer*, u32_t hertz, timer_tick_cb);
20     ticks_t (*systicks)();
21     ticks_t base_freq;
22     ticks_t running_freq;
23 };
24
25 void
26 hwtimer_init(u32_t hertz, void* tick_callback);
27
28 struct hwtimer*
29 select_platform_timer();
30
31 ticks_t
32 hwtimer_base_frequency();
33
34 ticks_t
35 hwtimer_current_systicks();
36
37 ticks_t
38 hwtimer_to_ticks(u32_t value, int unit);
39
40 #endif /* __LUNAIX_HWTIMER_H */