feat: fstat now handle symbolic link
[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 extern struct hwtimer* current_timer;
26
27 void
28 hwtimer_init(u32_t hertz, void* tick_callback);
29
30 struct hwtimer*
31 hwtimer_choose();
32
33 ticks_t
34 hwtimer_base_frequency();
35
36 ticks_t
37 hwtimer_current_systicks();
38
39 ticks_t
40 hwtimer_to_ticks(u32_t value, int unit);
41
42 #endif /* __LUNAIX_HWTIMER_H */