summaryrefslogtreecommitdiffstats
path: root/src/broadcom/cle/gen_pack_header.py
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-12-30 11:07:34 -0800
committerEric Anholt <[email protected]>2017-07-13 11:28:28 -0700
commitee170c9d83e623e19fb07fed50f3d82b8a035bf4 (patch)
treee7709e657e91ea566228cdae0a22c3d10411344d /src/broadcom/cle/gen_pack_header.py
parent655a32f729a46176c1fc0c1727b33c15c69cad78 (diff)
broadcom/genxml: Support unpacking fixed-point fractional values.
This was an oversight in the original XML support, because unpacking wasn't used much. The new XML-based CL dumper will want it, though.
Diffstat (limited to 'src/broadcom/cle/gen_pack_header.py')
-rw-r--r--src/broadcom/cle/gen_pack_header.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/broadcom/cle/gen_pack_header.py b/src/broadcom/cle/gen_pack_header.py
index d9ead68749e..528ff8fa439 100644
--- a/src/broadcom/cle/gen_pack_header.py
+++ b/src/broadcom/cle/gen_pack_header.py
@@ -326,6 +326,11 @@ class Group(object):
if field.type != "mbo":
convert = None
+ args = []
+ args.append('cl')
+ args.append(str(start + field.start))
+ args.append(str(start + field.end))
+
if field.type == "address":
convert = "__gen_unpack_address"
elif field.type == "uint":
@@ -339,17 +344,17 @@ class Group(object):
elif field.type == "offset":
convert = "__gen_unpack_offset"
elif field.type == 'ufixed':
+ args.append(str(field.fractional_size))
convert = "__gen_unpack_ufixed"
elif field.type == 'sfixed':
+ args.append(str(field.fractional_size))
convert = "__gen_unpack_sfixed"
else:
print("/* unhandled field %s, type %s */\n" % (name, field.type))
s = None
- print(" values->%s = %s(cl, %s, %s);" % \
- (field.name, convert, \
- start + field.start, start + field.end))
-
+ print(" values->%s = %s(%s);" % \
+ (field.name, convert, ', '.join(args)))
class Value(object):
def __init__(self, attrs):