summaryrefslogtreecommitdiff
path: root/include/common/fdt_wrappers.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/common/fdt_wrappers.h')
-rw-r--r--include/common/fdt_wrappers.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/common/fdt_wrappers.h b/include/common/fdt_wrappers.h
new file mode 100644
index 00000000..db72f180
--- /dev/null
+++ b/include/common/fdt_wrappers.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/* Helper functions to offer easier navigation of Device Tree Blob */
+
+#ifndef __FDT_WRAPPERS__
+#define __FDT_WRAPPERS__
+
+/* Number of cells, given total length in bytes. Each cell is 4 bytes long */
+#define NCELLS(l) (l / 4)
+
+int fdtw_read_cells(const void *dtb, int node, const char *prop,
+ unsigned int cells, void *value);
+int fdtw_write_inplace_cells(void *dtb, int node, const char *prop,
+ unsigned int cells, void *value);
+#endif /* __FDT_WRAPPERS__ */