xref: /rk3399_ARM-atf/include/common/fdt_wrappers.h (revision 81542c00d0d3d0609cfedf91f8d6f455672af684)
1e5674e1fSSoby Mathew /*
2e5674e1fSSoby Mathew  * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3e5674e1fSSoby Mathew  *
4e5674e1fSSoby Mathew  * SPDX-License-Identifier: BSD-3-Clause
5e5674e1fSSoby Mathew  */
6e5674e1fSSoby Mathew 
7e5674e1fSSoby Mathew /* Helper functions to offer easier navigation of Device Tree Blob */
8e5674e1fSSoby Mathew 
9e5674e1fSSoby Mathew #ifndef __FDT_WRAPPERS__
10e5674e1fSSoby Mathew #define __FDT_WRAPPERS__
11e5674e1fSSoby Mathew 
12e5674e1fSSoby Mathew /* Number of cells, given total length in bytes. Each cell is 4 bytes long */
13*81542c00SAntonio Nino Diaz #define NCELLS(len) ((len) / 4U)
14e5674e1fSSoby Mathew 
15e5674e1fSSoby Mathew int fdtw_read_cells(const void *dtb, int node, const char *prop,
16e5674e1fSSoby Mathew 		unsigned int cells, void *value);
17e5674e1fSSoby Mathew int fdtw_write_inplace_cells(void *dtb, int node, const char *prop,
18e5674e1fSSoby Mathew 		unsigned int cells, void *value);
19e5674e1fSSoby Mathew #endif /* __FDT_WRAPPERS__ */
20