blob: a0fe6b753098405b8738f520c63dbe6b7ae7deb0 [file] [log] [blame]
Soby Mathewe5674e12017-11-06 13:56:40 +00001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/* Helper functions to offer easier navigation of Device Tree Blob */
8
9#ifndef __FDT_WRAPPERS__
10#define __FDT_WRAPPERS__
11
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 Diaz27473622018-06-26 10:34:07 +010017int fdtw_read_string(const void *dtb, int node, const char *prop,
18 char *str, size_t size);
Soby Mathewe5674e12017-11-06 13:56:40 +000019int fdtw_write_inplace_cells(void *dtb, int node, const char *prop,
20 unsigned int cells, void *value);
Antonio Nino Diaz27473622018-06-26 10:34:07 +010021
Soby Mathewe5674e12017-11-06 13:56:40 +000022#endif /* __FDT_WRAPPERS__ */