diff options
author | Gerald Van Baren <vanbaren@cideas.com> | 2007-03-31 12:13:43 -0400 |
---|---|---|
committer | Gerald Van Baren <vanbaren@cideas.com> | 2007-03-31 12:13:43 -0400 |
commit | 3af0d587d93e0be5f96e1b30fa41e662f8b0803e (patch) | |
tree | aff9722cacec7ea01fc4a8464df5a2dfce39f703 /libfdt/fdt.c | |
parent | fa3a74cec73dfd06a5ae35a9a3368200273aaa71 (diff) | |
download | u-boot-imx-3af0d587d93e0be5f96e1b30fa41e662f8b0803e.zip u-boot-imx-3af0d587d93e0be5f96e1b30fa41e662f8b0803e.tar.gz u-boot-imx-3af0d587d93e0be5f96e1b30fa41e662f8b0803e.tar.bz2 |
libfdt: Enhanced and published fdt_next_tag()
Enhanced the formerly private function _fdt_next_tag() to allow stepping
through the tree, used to produce a human-readable dump, and made
it part of the published interface.
Also added some comments.
Diffstat (limited to 'libfdt/fdt.c')
-rw-r--r-- | libfdt/fdt.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/libfdt/fdt.c b/libfdt/fdt.c index 772da46..4b1c8ab 100644 --- a/libfdt/fdt.c +++ b/libfdt/fdt.c @@ -58,45 +58,6 @@ void *fdt_offset_ptr(const void *fdt, int offset, int len) return p; } -uint32_t _fdt_next_tag(const void *fdt, int offset, int *nextoffset) -{ - const uint32_t *tagp, *lenp; - uint32_t tag; - const char *p; - - if (offset % FDT_TAGSIZE) - return -1; - - tagp = fdt_offset_ptr(fdt, offset, FDT_TAGSIZE); - if (! tagp) - return FDT_END; /* premature end */ - tag = fdt32_to_cpu(*tagp); - offset += FDT_TAGSIZE; - - switch (tag) { - case FDT_BEGIN_NODE: - /* skip name */ - do { - p = fdt_offset_ptr(fdt, offset++, 1); - } while (p && (*p != '\0')); - if (! p) - return FDT_END; - break; - case FDT_PROP: - lenp = fdt_offset_ptr(fdt, offset, sizeof(*lenp)); - if (! lenp) - return FDT_END; - /* skip name offset, length and value */ - offset += 2*FDT_TAGSIZE + fdt32_to_cpu(*lenp); - break; - } - - if (nextoffset) - *nextoffset = ALIGN(offset, FDT_TAGSIZE); - - return tag; -} - const char *_fdt_find_string(const char *strtab, int tabsize, const char *s) { int len = strlen(s) + 1; |