diff options
author | Tom Rini <trini@konsulko.com> | 2017-09-15 22:34:34 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-09-15 22:34:34 -0400 |
commit | 08cebeeaadd9192dd501308ac6a8b858ffa255c1 (patch) | |
tree | 65e037590914a47d0f3352afeb596c5cd6f238e8 /tools/dtoc/fdt_util.py | |
parent | 110ba62519909df7042cbe71824dfe3844557a85 (diff) | |
parent | ea28e488f743520f7f83b341f28818c32dae1ee3 (diff) |
Merge git://git.denx.de/u-boot-fdt
Diffstat (limited to 'tools/dtoc/fdt_util.py')
-rw-r--r-- | tools/dtoc/fdt_util.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py index b9dfae8d0e7..338d47a5e14 100644 --- a/tools/dtoc/fdt_util.py +++ b/tools/dtoc/fdt_util.py @@ -29,6 +29,22 @@ def fdt32_to_cpu(val): val = val.encode('raw_unicode_escape') return struct.unpack('>I', val)[0] +def fdt_cells_to_cpu(val, cells): + """Convert one or two cells to a long integer + + Args: + Value to convert (array of one or more 4-character strings) + + Return: + A native-endian long value + """ + if not cells: + return 0 + out = long(fdt32_to_cpu(val[0])) + if cells == 2: + out = out << 32 | fdt32_to_cpu(val[1]) + return out + def EnsureCompiled(fname): """Compile an fdt .dts source file into a .dtb binary blob if needed. |