summaryrefslogtreecommitdiffstats
path: root/src/broadcom/cle/gen_pack_header.py
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-06-27 10:46:04 -0700
committerEric Anholt <[email protected]>2018-06-29 13:36:28 -0700
commit6f7ad7ed11d92a302e309c3bc042cc76547cd2f7 (patch)
treea29dfbff969b056ac47e1f390a05bad831200f08 /src/broadcom/cle/gen_pack_header.py
parenta99c9e63a07477634ab73945e5da5b9f580e5828 (diff)
v3d: Pass the version being generated to the pack generator script.
It turns out that most V3D versions change very few packets, so keeping separate copies of the XML per version makes changing the XML a pain as you have to replicate your changes to each one. This is the start of changing it so that one XML can generate headers for multiple versions.
Diffstat (limited to 'src/broadcom/cle/gen_pack_header.py')
-rw-r--r--src/broadcom/cle/gen_pack_header.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/broadcom/cle/gen_pack_header.py b/src/broadcom/cle/gen_pack_header.py
index 5fde7bb07ad..df547fb5ab1 100644
--- a/src/broadcom/cle/gen_pack_header.py
+++ b/src/broadcom/cle/gen_pack_header.py
@@ -392,7 +392,7 @@ class Value(object):
self.value = int(attrs["value"])
class Parser(object):
- def __init__(self):
+ def __init__(self, ver):
self.parser = xml.parsers.expat.ParserCreate()
self.parser.StartElementHandler = self.start_element
self.parser.EndElementHandler = self.end_element
@@ -403,6 +403,7 @@ class Parser(object):
# Set of enum names we've seen.
self.enums = set()
self.registers = {}
+ self.ver = ver
def gen_prefix(self, name):
if name[0] == "_":
@@ -415,8 +416,7 @@ class Parser(object):
def start_element(self, name, attrs):
if name == "vcxml":
- self.platform = "V3D {}".format(attrs["gen"])
- self.ver = attrs["gen"].replace('.', '')
+ self.platform = "V3D {}.{}".format(self.ver[0], self.ver[1])
print(pack_header % {'license': license, 'platform': self.platform, 'guard': self.gen_guard()})
elif name in ("packet", "struct", "register"):
default_field = None
@@ -579,5 +579,5 @@ if len(sys.argv) < 2:
input_file = sys.argv[1]
-p = Parser()
+p = Parser(sys.argv[2])
p.parse(input_file)