X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/1fe5f5eb5378a47bf0f3451762743c162e40faad..7e13988c1113d38bec17bd79b71757d78d977e76:/lunaix-os/includes/hal/hwrtc.h diff --git a/lunaix-os/includes/hal/hwrtc.h b/lunaix-os/includes/hal/hwrtc.h index b43a2ff..37a1877 100644 --- a/lunaix-os/includes/hal/hwrtc.h +++ b/lunaix-os/includes/hal/hwrtc.h @@ -1,33 +1,45 @@ #ifndef __LUNAIX_HWRTC_H #define __LUNAIX_HWRTC_H +#include +#include +#include #include -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 */