summaryrefslogtreecommitdiff
path: root/tools/dtoc/dtoc.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-07-25 18:59:05 -0600
committerSimon Glass <sjg@chromium.org>2016-09-18 21:04:38 -0600
commitbc1dea3656e55d91f7a3c1339d53fc9def3bbf31 (patch)
tree0f3b8398e8eee593473695feb9d6f25ec97bf807 /tools/dtoc/dtoc.py
parenta06a34b2031e0797892e188595bfb305cd9719ab (diff)
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>
Diffstat (limited to 'tools/dtoc/dtoc.py')
-rwxr-xr-xtools/dtoc/dtoc.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py
index 10f6a12578..518aa51216 100755
--- a/tools/dtoc/dtoc.py
+++ b/tools/dtoc/dtoc.py
@@ -16,6 +16,7 @@ import sys
our_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(our_path, '../patman'))
+import fdt
import fdt_select
import fdt_util
@@ -33,10 +34,10 @@ PROP_IGNORE_LIST = [
# C type declarations for the tyues we support
TYPE_NAMES = {
- fdt_util.TYPE_INT: 'fdt32_t',
- fdt_util.TYPE_BYTE: 'unsigned char',
- fdt_util.TYPE_STRING: 'const char *',
- fdt_util.TYPE_BOOL: 'bool',
+ fdt.TYPE_INT: 'fdt32_t',
+ fdt.TYPE_BYTE: 'unsigned char',
+ fdt.TYPE_STRING: 'const char *',
+ fdt.TYPE_BOOL: 'bool',
};
STRUCT_PREFIX = 'dtd_'
@@ -138,13 +139,13 @@ class DtbPlatdata:
type: Data type (fdt_util)
value: Data value, as a string of bytes
"""
- if type == fdt_util.TYPE_INT:
+ if type == fdt.TYPE_INT:
return '%#x' % fdt_util.fdt32_to_cpu(value)
- elif type == fdt_util.TYPE_BYTE:
+ elif type == fdt.TYPE_BYTE:
return '%#x' % ord(value[0])
- elif type == fdt_util.TYPE_STRING:
+ elif type == fdt.TYPE_STRING:
return '"%s"' % value
- elif type == fdt_util.TYPE_BOOL:
+ elif type == fdt.TYPE_BOOL:
return 'true'
def GetCompatName(self, node):