blob: 79d001d285c5653eed04a4f279dab4ab9285adf8 [file] [log] [blame]
Soby Mathewb9fccca2017-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
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00009#ifndef FDT_WRAPPERS_H
10#define FDT_WRAPPERS_H
Soby Mathewb9fccca2017-11-06 13:56:40 +000011
12/* Number of cells, given total length in bytes. Each cell is 4 bytes long */
Antonio Nino Diazf0b14cf2018-10-04 09:55:23 +010013#define NCELLS(len) ((len) / 4U)
Soby Mathewb9fccca2017-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 Diaz3fddfbb2018-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 Diazd85c8782018-06-26 10:34:07 +010019int fdtw_read_string(const void *dtb, int node, const char *prop,
20 char *str, size_t size);
Soby Mathewb9fccca2017-11-06 13:56:40 +000021int fdtw_write_inplace_cells(void *dtb, int node, const char *prop,
22 unsigned int cells, void *value);
Antonio Nino Diazd85c8782018-06-26 10:34:07 +010023
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000024#endif /* FDT_WRAPPERS_H */