diff options
author | Anton Staff <robotboy@chromium.org> | 2012-04-17 09:01:28 +0000 |
---|---|---|
committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2012-05-15 08:31:39 +0200 |
commit | bed4d89277629904bfcefa37589c71e4b7424bea (patch) | |
tree | fb96d19d9a5484a4a3098c8e12095bfd77a6ac74 /include/fdtdec.h | |
parent | 649d0ffbc1eca693726937ff40e7d7ab852f4ae9 (diff) | |
download | u-boot-imx-bed4d89277629904bfcefa37589c71e4b7424bea.zip u-boot-imx-bed4d89277629904bfcefa37589c71e4b7424bea.tar.gz u-boot-imx-bed4d89277629904bfcefa37589c71e4b7424bea.tar.bz2 |
fdt: Add fdtdec functions to read byte array
Sometimes we don't need a full cell for each value. This provides
a simple function to read a byte array, both with and without
copying it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'include/fdtdec.h')
-rw-r--r-- | include/fdtdec.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/fdtdec.h b/include/fdtdec.h index 49251d5..b6db027 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -349,3 +349,35 @@ int fdtdec_decode_gpio(const void *blob, int node, const char *prop_name, * @return 0 if all ok or gpio was FDT_GPIO_NONE; -1 on error */ int fdtdec_setup_gpio(struct fdt_gpio_state *gpio); + +/* + * Look up a property in a node and return its contents in a byte + * array of given length. The property must have at least enough data for + * the array (count bytes). It may have more, but this will be ignored. + * + * @param blob FDT blob + * @param node node to examine + * @param prop_name name of property to find + * @param array array to fill with data + * @param count number of array elements + * @return 0 if ok, or -FDT_ERR_MISSING if the property is not found, + * or -FDT_ERR_BADLAYOUT if not enough data + */ +int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name, + u8 *array, int count); + +/** + * Look up a property in a node and return a pointer to its contents as a + * byte array of given length. The property must have at least enough data + * for the array (count bytes). It may have more, but this will be ignored. + * The data is not copied. + * + * @param blob FDT blob + * @param node node to examine + * @param prop_name name of property to find + * @param count number of array elements + * @return pointer to byte array if found, or NULL if the property is not + * found or there is not enough data + */ +const u8 *fdtdec_locate_byte_array(const void *blob, int node, + const char *prop_name, int count); |