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