|
4 | 4 | #include <drivers/dt/dt_node.h> |
5 | 5 | #include <stdbigos/types.h> |
6 | 6 |
|
| 7 | +// Can be used to check for bool-type props |
7 | 8 | // Find a property of node by a name, dt_prop_t ptr if success, nullptr if error |
8 | 9 | dt_prop_t* dt_find_prop(const dt_node_t* node, const char* name); |
9 | 10 |
|
10 | | -// Read a single 32-bit value from a node's name prop and write it to out, 0 if success, <0 if error |
11 | | -int dt_prop_read_u32(const dt_node_t* node, const char* name, u32* out); |
12 | | - |
13 | | -// Read a single 64-bit value from a node's name prop and write it to out, 0 if success, <0 if error |
14 | | -int dt_prop_read_u64(const dt_node_t* node, const char* name, u64* out); |
15 | | - |
16 | | -// Read a single 32-bit value from a node's name prop's id index and write it to out, 0 if success, <0 if error |
17 | | -int dt_prop_read_by_id_u32(const dt_node_t* node, const char* name, u32 index, u32* out); |
18 | | - |
19 | | -// Read an array of up to out_size node's name prop values and write them to out |
20 | | -// number of successfully read values if success, <0 if error |
21 | | -int dt_prop_read_array_u32(const dt_node_t* node, const char* name, u32 out[], u32 out_size); |
22 | | - |
23 | | -// Read a null-terminated string from node's name prop, const char ptr if succes, nullptr if error |
24 | | -const char* dt_prop_read_str(const dt_node_t* node, const char* name); |
25 | | - |
26 | | -// Read an array of up to out_size node's name prop strings and write them to out |
27 | | -// number of successfully read strings if success, <0 if error |
28 | | -int dt_prop_read_array_str(const dt_node_t* node, const char* name, const char* out[], u32 out_size); |
29 | | - |
30 | | -// Read a bool ean value of node's name prop, 1 if exists or prop empty, 0 if doesn't exist, -1 if error |
31 | | -int dt_prop_read_bool(const dt_node_t* node, const char* name); |
32 | | - |
33 | | -// Read a node's name phandle (a handle to a different node) and write it to out, 0 if success, -1 if error |
34 | | -int dt_prop_read_phandle(const dt_node_t* node, const char* name, u32* out); |
| 11 | +// Get a buffer of node's name value, the buffer's BUFFER_ERROR field will have any potential errors |
| 12 | +buffer_t dt_prop_get_buffer(const dt_node_t* node, const char* name); |
35 | 13 |
|
36 | 14 | // Print the node's properties |
37 | 15 | void dt_print_props(const dt_node_t* node, u8 depth); |
|
0 commit comments