u-boot-brain/tools/dtoc/fdt_util.py
Simon Glass bc1dea3656 dtoc: Move BytesToValue() and GetEmpty() into PropBase
These functions are currently in a separate fdt_util file. Since they are
only used from PropBase and subclasses, it makes sense for them to be in the
PropBase class.

Move these functions into fdt.py along with the list of types.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18 21:04:38 -06:00

21 lines
412 B
Python

#!/usr/bin/python
#
# Copyright (C) 2016 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
# SPDX-License-Identifier: GPL-2.0+
#
import struct
def fdt32_to_cpu(val):
"""Convert a device tree cell to an integer
Args:
Value to convert (4-character string representing the cell value)
Return:
A native-endian integer value
"""
return struct.unpack(">I", val)[0]