Unifying External Interrupt System (#51)
[lunaix-os.git] / lunaix-os / hal / devtree / devtree.h
1 #ifndef __LUNAIX_DEVTREE_INTERNAL_H
2 #define __LUNAIX_DEVTREE_INTERNAL_H
3
4 #include <hal/devtree.h>
5
6 #include <klibc/string.h>
7
8 static inline bool
9 propeq(struct fdt_blob* fdt, fdt_loc_t loc, const char* key)
10 {
11     return streq(fdt_prop_key(fdt, loc), key);
12 }
13
14 static inline ptr_t
15 __prop_val_ptr(struct fdt_prop* prop)
16 {
17     return __ptr(prop) + sizeof(struct fdt_prop);
18 }
19
20 static inline void
21 __mkprop_ptr(fdt_loc_t loc, struct dtp_val* val)
22 {
23     val->ptr_val = __prop_val_ptr(loc.prop);
24     val->size = loc.prop->len;
25 }
26
27 static inline u32_t
28 __prop_getu32(fdt_loc_t loc)
29 {
30     return loc.prop->val[0];
31 }
32
33 bool
34 parse_stdintr_prop(struct fdt_blob*, fdt_loc_t, struct dtn_intr*);
35
36 #endif /* __LUNAIX_DEVTREE_H */