X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/f6ab9c9ababa2cf6e5c723b83ffb9362094054e8..35a7d633d3f16c1e0539af6ca5d8e7482926cd93:/lunaix-os/includes/hal/hwrtc.h diff --git a/lunaix-os/includes/hal/hwrtc.h b/lunaix-os/includes/hal/hwrtc.h index fcd4d48..37a1877 100644 --- a/lunaix-os/includes/hal/hwrtc.h +++ b/lunaix-os/includes/hal/hwrtc.h @@ -8,36 +8,38 @@ #define RTC_STATE_MASKED 0x1 -#define EXPORT_RTC_DEVICE(id, init_fn) \ - export_ldga_el(rtcdev, id, ptr_t, init_fn) +struct hwrtc_potens; +struct hwrtc_potens_ops +{ + 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); + + int (*calibrate)(struct hwrtc_potens*); +}; -struct hwrtc +struct hwrtc_potens { - struct llist_header rtc_list; - struct device* rtc_dev; + POTENS_META; + + struct llist_header rtc_potentes; + struct device* rtc_proxy; - char* name; - void* data; ticks_t base_freq; + volatile ticks_t live; int state; - void (*get_walltime)(struct hwrtc*, datetime_t*); - 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); + struct hwrtc_potens_ops* ops; }; -extern const struct hwrtc* primary_rtc; - void hwrtc_init(); -struct hwrtc* -hwrtc_alloc_new(char* driver_id); - 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 */