X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/2236410f4582ab45ae8c384dd6eeeef5d10aab15..78cd005fac540973751b5a108c37a715bc64b5a2:/lunaix-os/includes/lunaix/device.h diff --git a/lunaix-os/includes/lunaix/device.h b/lunaix-os/includes/lunaix/device.h index f650821..affdb10 100644 --- a/lunaix-os/includes/lunaix/device.h +++ b/lunaix-os/includes/lunaix/device.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -95,13 +96,16 @@ struct device { + /* -- device structing -- */ + u32_t magic; struct llist_header siblings; struct llist_header children; struct device* parent; - mutex_t lock; - // TODO investigate event polling + /* -- device state -- */ + + mutex_t lock; struct hstr name; struct devident ident; @@ -111,6 +115,10 @@ struct device char name_val[DEVICE_NAME_SIZE]; void* underlay; + /* -- polling -- */ + int poll_evflags; + poll_evt_q pollers; + struct { // TODO Think about where will they fit. @@ -122,6 +130,7 @@ struct device int (*read_page)(struct device* dev, void* buf, size_t offset); int (*write_page)(struct device* dev, void* buf, size_t offset); int (*exec_cmd)(struct device* dev, u32_t req, va_list args); + int (*poll)(struct device* dev); } ops; };