fdt_wrappers.h 784 Bytes
Newer Older
1
2
3
4
5
6
7
8
/*
 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/* Helper functions to offer easier navigation of Device Tree Blob */

9
10
#ifndef FDT_WRAPPERS_H
#define FDT_WRAPPERS_H
11
12

/* Number of cells, given total length in bytes. Each cell is 4 bytes long */
13
#define NCELLS(len) ((len) / 4U)
14
15
16

int fdtw_read_cells(const void *dtb, int node, const char *prop,
		unsigned int cells, void *value);
17
18
int fdtw_read_array(const void *dtb, int node, const char *prop,
		unsigned int cells, void *value);
19
20
int fdtw_read_string(const void *dtb, int node, const char *prop,
		char *str, size_t size);
21
22
int fdtw_write_inplace_cells(void *dtb, int node, const char *prop,
		unsigned int cells, void *value);
23

24
#endif /* FDT_WRAPPERS_H */