X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/a2e1b0681f3f65975cb3ed2f4f9708ac8f9ff070..6942ebae59c3904674dce6b67cd07c43a3bbe00d:/lunaix-os/hal/devtree/devtree.h diff --git a/lunaix-os/hal/devtree/devtree.h b/lunaix-os/hal/devtree/devtree.h index 3b1df08..e117472 100644 --- a/lunaix-os/hal/devtree/devtree.h +++ b/lunaix-os/hal/devtree/devtree.h @@ -2,6 +2,43 @@ #define __LUNAIX_DEVTREE_INTERNAL_H #include +#include + +static inline bool +propeq(struct fdt_iter* it, const char* key) +{ + return streq(fdtit_prop_key(it), key); +} + +static inline void +__mkprop_val32(struct fdt_iter* it, struct dt_prop_val* val) +{ + val->u32_val = le(*(u32_t*)&it->prop[1]); + val->size = le(it->prop->len); +} + +static inline void +__mkprop_val64(struct fdt_iter* it, struct dt_prop_val* val) +{ + val->u64_val = le64(*(u64_t*)&it->prop[1]); + val->size = le(it->prop->len); +} + +static inline void +__mkprop_ptr(struct fdt_iter* it, struct dt_prop_val* val) +{ + val->ptr_val = __ptr(&it->prop[1]); + val->size = le(it->prop->len); +} + +static inline u32_t +__prop_getu32(struct fdt_iter* it) +{ + return le(*(u32_t*)&it->prop[1]); +} + +bool +parse_stdintr_prop(struct fdt_iter* it, struct dt_intr_node* node); bool parse_stdintr_prop(struct fdt_iter* it, struct dt_intr_node* node);