xref: /rk3399_rockchip-uboot/tools/dtoc/fdt_util.py (revision bc1dea3656e55d91f7a3c1339d53fc9def3bbf31)
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
9import struct
10
11def 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]
21