dtoc: Move BytesToValue() and GetEmpty() into PropBase
[platform/kernel/u-boot.git] / tools / dtoc / fdt_util.py
1 #!/usr/bin/python
2 #
3 # Copyright (C) 2016 Google, Inc
4 # Written by Simon Glass <sjg@chromium.org>
5 #
6 # SPDX-License-Identifier:      GPL-2.0+
7 #
8
9 import struct
10
11 def fdt32_to_cpu(val):
12     """Convert a device tree cell to an integer
13
14     Args:
15         Value to convert (4-character string representing the cell value)
16
17     Return:
18         A native-endian integer value
19     """
20     return struct.unpack(">I", val)[0]