hot fix: remove outdated objcpy
[lunaix-os.git] / lunaix-os / includes / hal / hwrtc.h
index b43a2ff9304b21ec7f7994dfe24d2c76a78425d8..c0186ff7cd14b363ba3b0b66d36347e0937d00d3 100644 (file)
@@ -1,33 +1,42 @@
 #ifndef __LUNAIX_HWRTC_H
 #define __LUNAIX_HWRTC_H
 
+#include <lunaix/device.h>
+#include <lunaix/ds/ldga.h>
+#include <lunaix/ds/llist.h>
 #include <lunaix/time.h>
 
+#define RTC_STATE_MASKED 0x1
+
+#define EXPORT_RTC_DEVICE(id, init_fn)                                         \
+    export_ldga_el(rtcdev, id, ptr_t, init_fn)
+
 struct hwrtc
 {
+    struct llist_header rtc_list;
+    struct device* rtc_dev;
+
+    int id;
     char* name;
     void* data;
-
     ticks_t base_freq;
-
-    int (*supported)(struct hwrtc*);
-    void (*init)(struct hwrtc*);
+    int state;
 
     void (*get_walltime)(struct hwrtc*, datetime_t*);
-
-    void (*do_ticking)(struct hwrtc*, void (*on_tick)());
-    void (*end_ticking)(struct hwrtc*);
+    void (*set_walltime)(struct hwrtc*, datetime_t*);
+    void (*set_mask)(struct hwrtc*);
+    void (*cls_mask)(struct hwrtc*);
+    int (*get_counts)(struct hwrtc*);
+    int (*chfreq)(struct hwrtc*, int);
 };
 
-extern const struct hwrtc* current_rtc;
-
-void
-hwrtc_init();
-
 struct hwrtc*
-hwrtc_choose();
+hwrtc_alloc_new(char* name);
 
 void
 hwrtc_walltime(datetime_t* dt);
 
+void
+hwrtc_register(struct devclass* class, struct hwrtc* rtc);
+
 #endif /* __LUNAIX_HWRTC_H */