b43a2ff9304b21ec7f7994dfe24d2c76a78425d8
[lunaix-os.git] / lunaix-os / includes / hal / hwrtc.h
1 #ifndef __LUNAIX_HWRTC_H
2 #define __LUNAIX_HWRTC_H
3
4 #include <lunaix/time.h>
5
6 struct hwrtc
7 {
8     char* name;
9     void* data;
10
11     ticks_t base_freq;
12
13     int (*supported)(struct hwrtc*);
14     void (*init)(struct hwrtc*);
15
16     void (*get_walltime)(struct hwrtc*, datetime_t*);
17
18     void (*do_ticking)(struct hwrtc*, void (*on_tick)());
19     void (*end_ticking)(struct hwrtc*);
20 };
21
22 extern const struct hwrtc* current_rtc;
23
24 void
25 hwrtc_init();
26
27 struct hwrtc*
28 hwrtc_choose();
29
30 void
31 hwrtc_walltime(datetime_t* dt);
32
33 #endif /* __LUNAIX_HWRTC_H */