blob: f467958b7f9f83b63168b1464b73d2cd1e067ee0 [file] [log] [blame]
Soby Mathewe5674e12017-11-06 13:56:40 +00001/*
Alexei Fedorov0a2ab6e2020-01-29 16:21:28 +00002 * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
Soby Mathewe5674e12017-11-06 13:56:40 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/* Helper functions to offer easier navigation of Device Tree Blob */
8
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +00009#ifndef FDT_WRAPPERS_H
10#define FDT_WRAPPERS_H
Soby Mathewe5674e12017-11-06 13:56:40 +000011
12/* Number of cells, given total length in bytes. Each cell is 4 bytes long */
Antonio Nino Diaz81542c02018-10-04 09:55:23 +010013#define NCELLS(len) ((len) / 4U)
Soby Mathewe5674e12017-11-06 13:56:40 +000014
15int fdtw_read_cells(const void *dtb, int node, const char *prop,
16 unsigned int cells, void *value);
Antonio Nino Diaz73f1ac62018-06-26 10:34:10 +010017int fdtw_read_array(const void *dtb, int node, const char *prop,
18 unsigned int cells, void *value);
Antonio Nino Diaz27473622018-06-26 10:34:07 +010019int fdtw_read_string(const void *dtb, int node, const char *prop,
20 char *str, size_t size);
Soby Mathewe5674e12017-11-06 13:56:40 +000021int fdtw_write_inplace_cells(void *dtb, int node, const char *prop,
22 unsigned int cells, void *value);
Alexei Fedorov0a2ab6e2020-01-29 16:21:28 +000023int fdtw_read_bytes(const void *dtb, int node, const char *prop,
24 unsigned int length, void *value);
25int fdtw_write_inplace_bytes(void *dtb, int node, const char *prop,
26 unsigned int length, const void *data);
Antonio Nino Diaz27473622018-06-26 10:34:07 +010027
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +000028#endif /* FDT_WRAPPERS_H */