mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
ofnode: add read_u64_array and count_elems_of_size
These are similar to their Linux counterparts, adding helpers for reading arrays of 64-bit values with of_access and fdtdec implementations. Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
This commit is contained in:
18
lib/fdtdec.c
18
lib/fdtdec.c
@@ -714,6 +714,24 @@ int fdtdec_get_int_array(const void *blob, int node, const char *prop_name,
|
||||
return err;
|
||||
}
|
||||
|
||||
int fdtdec_get_long_array(const void *blob, int node, const char *prop_name,
|
||||
u64 *array, int count)
|
||||
{
|
||||
const u64 *cell;
|
||||
int err = 0;
|
||||
|
||||
debug("%s: %s\n", __func__, prop_name);
|
||||
cell = get_prop_check_min_len(blob, node, prop_name,
|
||||
sizeof(u64) * count, &err);
|
||||
if (!err) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
array[i] = fdt64_to_cpu(cell[i]);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
int fdtdec_get_int_array_count(const void *blob, int node,
|
||||
const char *prop_name, u32 *array, int count)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user