git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: cut off some bloats in intr_ctx
[lunaix-os.git]
/
lunaix-os
/
includes
/
lunaix
/
device.h
diff --git
a/lunaix-os/includes/lunaix/device.h
b/lunaix-os/includes/lunaix/device.h
index c0ed9896382ef901e0fb676d224187b33a033520..ee56b1da9d9a19592fa0274b5de5c733e87fea32 100644
(file)
--- a/
lunaix-os/includes/lunaix/device.h
+++ b/
lunaix-os/includes/lunaix/device.h
@@
-5,6
+5,9
@@
#include <lunaix/ds/hstr.h>
#include <lunaix/ds/llist.h>
#include <lunaix/ds/hstr.h>
#include <lunaix/ds/llist.h>
+#include <lunaix/types.h>
+
+#define DEV_STRUCT_MAGIC 0x5645444c
#define DEV_MSKIF 0x00000003
#define DEV_MSKIF 0x00000003
@@
-16,7
+19,9
@@
typedef unsigned int dev_t;
struct device
{
struct device
{
+ u32_t magic;
struct llist_header siblings;
struct llist_header siblings;
+ struct llist_header children;
struct device* parent;
struct hstr name;
dev_t dev_id;
struct device* parent;
struct hstr name;
dev_t dev_id;
@@
-25,8
+30,18
@@
struct device
void* underlay;
int (*read)(struct device* dev, void* buf, size_t offset, size_t len);
int (*write)(struct device* dev, void* buf, size_t offset, size_t len);
void* underlay;
int (*read)(struct device* dev, void* buf, size_t offset, size_t len);
int (*write)(struct device* dev, void* buf, size_t offset, size_t len);
+ 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);
};
};
+struct device*
+device_add(struct device* parent,
+ void* underlay,
+ char* name_fmt,
+ u32_t type,
+ va_list args);
+
struct device*
device_addseq(struct device* parent, void* underlay, char* name_fmt, ...);
struct device*
device_addseq(struct device* parent, void* underlay, char* name_fmt, ...);
@@
-43,9
+58,15
@@
struct device*
device_getbyid(struct llist_header* devlist, dev_t id);
struct device*
device_getbyid(struct llist_header* devlist, dev_t id);
struct device*
-device_getby
name(struct llist_header* devlist
, struct hstr* name);
+device_getby
hname(struct device* root_dev
, struct hstr* name);
struct device*
struct device*
-device_getbyoffset(struct llist_header* devlist, int pos);
+device_getbyname(struct device* root_dev, const char* name, size_t len);
+
+struct device*
+device_getbyoffset(struct device* root_dev, int pos);
+
+void
+device_init_builtin();
#endif /* __LUNAIX_DEVICE_H */
#endif /* __LUNAIX_DEVICE_H */