move gic to new devtree interface
[lunaix-os.git] / lunaix-os / includes / hal / hwrtc.h
index b43a2ff9304b21ec7f7994dfe24d2c76a78425d8..37a1877a1738a86fe55c56543d96fca2b7a32068 100644 (file)
@@ -1,33 +1,45 @@
 #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>
 
-struct hwrtc
+#define RTC_STATE_MASKED 0x1
+
+struct hwrtc_potens;
+struct hwrtc_potens_ops
 {
-    char* name;
-    void* data;
+    void (*get_walltime)(struct hwrtc_potens*, datetime_t*);
+    void (*set_walltime)(struct hwrtc_potens*, datetime_t*);
+    void (*set_proactive)(struct hwrtc_potens*, bool);
+    int  (*chfreq)(struct hwrtc_potens*, int);
 
-    ticks_t base_freq;
+    int (*calibrate)(struct hwrtc_potens*);
+};
 
-    int (*supported)(struct hwrtc*);
-    void (*init)(struct hwrtc*);
+struct hwrtc_potens
+{
+    POTENS_META;
 
-    void (*get_walltime)(struct hwrtc*, datetime_t*);
+    struct llist_header rtc_potentes;
+    struct device* rtc_proxy;
 
-    void (*do_ticking)(struct hwrtc*, void (*on_tick)());
-    void (*end_ticking)(struct hwrtc*);
-};
+    ticks_t base_freq;
+    volatile ticks_t live;
+    int state;
 
-extern const struct hwrtc* current_rtc;
+    struct hwrtc_potens_ops* ops;
+};
 
 void
 hwrtc_init();
 
-struct hwrtc*
-hwrtc_choose();
-
 void
 hwrtc_walltime(datetime_t* dt);
 
+struct hwrtc_potens*
+hwrtc_attach_potens(struct device* raw_rtcdev, struct hwrtc_potens_ops* ops);
+
 #endif /* __LUNAIX_HWRTC_H */