1e5674e1fSSoby Mathew /* 2*0a2ab6e6SAlexei Fedorov * Copyright (c) 2018-2020, 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 9c3cf06f1SAntonio Nino Diaz #ifndef FDT_WRAPPERS_H 10c3cf06f1SAntonio Nino Diaz #define FDT_WRAPPERS_H 11e5674e1fSSoby Mathew 12e5674e1fSSoby Mathew /* Number of cells, given total length in bytes. Each cell is 4 bytes long */ 1381542c00SAntonio 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); 1773f1ac6cSAntonio Nino Diaz int fdtw_read_array(const void *dtb, int node, const char *prop, 1873f1ac6cSAntonio Nino Diaz unsigned int cells, void *value); 1927473620SAntonio Nino Diaz int fdtw_read_string(const void *dtb, int node, const char *prop, 2027473620SAntonio Nino Diaz char *str, size_t size); 21e5674e1fSSoby Mathew int fdtw_write_inplace_cells(void *dtb, int node, const char *prop, 22e5674e1fSSoby Mathew unsigned int cells, void *value); 23*0a2ab6e6SAlexei Fedorov int fdtw_read_bytes(const void *dtb, int node, const char *prop, 24*0a2ab6e6SAlexei Fedorov unsigned int length, void *value); 25*0a2ab6e6SAlexei Fedorov int fdtw_write_inplace_bytes(void *dtb, int node, const char *prop, 26*0a2ab6e6SAlexei Fedorov unsigned int length, const void *data); 2727473620SAntonio Nino Diaz 28c3cf06f1SAntonio Nino Diaz #endif /* FDT_WRAPPERS_H */ 29