From 73db73dbd3c5c6a27e022a5c724136ca6fc2ffe8 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 13 Jun 2013 01:50:14 +0200 Subject: regtools: modify description format and refactor tools Change the XML description to unify multi dev/reg in a clean fashion. Move the description parser to its own library. Fix the tester and headergen tools to work with the new format and library. Move the STMP3700/3780 descriptions to the new format (and fixes many errors as well). Drop the hwemulgen tool in favor on the upcoming hwstub tools revamp. Change-Id: I7119a187aab5c8b083cc5228cb1b248ee29f184d --- utils/regtools/Makefile | 33 +- utils/regtools/desc/XML.txt | 120 + utils/regtools/desc/regs-stmp3700.xml | 3326 +++++++++------------- utils/regtools/desc/regs-stmp3780.xml | 4965 ++++++++++++++------------------- utils/regtools/desc_parser.cpp | 265 -- utils/regtools/desc_parser.hpp | 108 - utils/regtools/headergen.cpp | 311 ++- utils/regtools/hwemulgen.cpp | 387 --- utils/regtools/lib/Makefile | 23 + utils/regtools/lib/soc_desc.cpp | 268 ++ utils/regtools/lib/soc_desc.hpp | 147 + utils/regtools/tester.cpp | 77 +- 12 files changed, 4219 insertions(+), 5811 deletions(-) create mode 100644 utils/regtools/desc/XML.txt delete mode 100644 utils/regtools/desc_parser.cpp delete mode 100644 utils/regtools/desc_parser.hpp delete mode 100644 utils/regtools/hwemulgen.cpp create mode 100644 utils/regtools/lib/Makefile create mode 100644 utils/regtools/lib/soc_desc.cpp create mode 100644 utils/regtools/lib/soc_desc.hpp (limited to 'utils') diff --git a/utils/regtools/Makefile b/utils/regtools/Makefile index 5dad380e7b..6ed827e257 100644 --- a/utils/regtools/Makefile +++ b/utils/regtools/Makefile @@ -2,27 +2,24 @@ DEFINES= CC=gcc CXX=g++ LD=g++ -CFLAGS=-g -std=c99 -W -Wall `xml2-config --cflags` $(DEFINES) -CXXFLAGS=-g -W -Wall `xml2-config --cflags` $(DEFINES) -LDFLAGS=`xml2-config --libs` -BINS= tester headergen hwemulgen +CFLAGS=-g -std=c99 -Wall $(DEFINES) -Ilib +CXXFLAGS=-g -Wall $(DEFINES) -Ilib +LDFLAGS=-Llib -lsocdesc `xml2-config --libs` +SRC=$(wildcard *.c) +SRCXX=$(wildcard *.cpp) +EXEC=$(SRC:.c=) $(SRCXX:.cpp=) +LIB=lib/libsocdesc.a -all: $(BINS) +all: $(EXEC) -%.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< +$(LIB): + make -C lib -%.o: %.cpp - $(CXX) $(CXXFLAGS) -c -o $@ $< +%: %.c $(LIB) + $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -headergen: headergen.o desc_parser.o - $(LD) -o $@ $^ $(LDFLAGS) - -hwemulgen: hwemulgen.o desc_parser.o - $(LD) -o $@ $^ $(LDFLAGS) - -tester: tester.o desc_parser.o - $(LD) -o $@ $^ $(LDFLAGS) +%: %.cpp $(LIB) + $(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) clean: - rm -fr *.o $(BINS) + rm -fr $(EXEC) diff --git a/utils/regtools/desc/XML.txt b/utils/regtools/desc/XML.txt new file mode 100644 index 0000000000..d4dc73cc64 --- /dev/null +++ b/utils/regtools/desc/XML.txt @@ -0,0 +1,120 @@ +This file describes the format of the register map based on XML. + +Root +---- +As any XML document, the content of the file should be enclosed in a "xml" tag. + +Example: + + + + +Element: soc +------------ +The XML can contain one or more SoC description. Each description is enclosed in +a "soc" tag. The following properties are defined: +- "name" (mandatory,string): the mnemonic of the SoC. +- "desc" (optional,string): a textual description of the SoC. + +Example: + + + + +Element: soc.dev +---------------- +Each SoC can contain any number of devices. Each device is enclosed in a "dev" +tag. A device is logical group of registers and doesn't have a precise meaning. +If a SoC has several copies of the same device at different addresses (SSP1, SSP2 +for example), then only one copy has to be described since a device can have +several address (see soc.dev.addr section). The following properties are defined: +- "name" (mandatory,string): the mnemonic of the device. +- "long_name" (optional,string): a short description of the device. +- "desc" (optional,string): a long description of the SoC. +- "version" (optional,string): version of the register description for this device. + +Example: + + + + +Element: soc.dev.reg.addr +------------------------- +Each device can have one or more addresses associated with it. Each address +is enclosed in a "addr" tag. This allows to describe several register at once on +SoCs where a similar register is replicated several times. +The following properties are defined: +- "name" (mandatory,string): unique name of this instance of the register. +- "addr" (mandatory,integer): base address of this instance of the register. + +Example: + + + + +Element: soc.dev.reg.formula +---------------------------- +In the special case where the addresses of the register follow a pattern, an +explicit formula can be described as part of the format. There is no specific +requirement on the formula except that the register addresses be indexed by +a variable "n" which range from 0 to N-1 where N is the number of address. +The following properties are defined: +- "string" (mandatory,string): the equation describing the addresses. + +Example: + + +Element: soc.dev.reg.field +-------------------------- +Each register can be further divided into disjoints fields. Each field +is enclosed in a "field" tag. A field is defined as a contiguous set +of bits in the register. The following properties are defined: +- "name" (mandatory,string): the mnemonic of field +- "bitrange" (mandatory,string): the bit range of the field written as + "n-m" where n and m are integers giving the most (resp. least) significant + bit of the field. + +Example: + + + + +Element: soc.dev.reg.field.value +-------------------------------- +Each field can describe a list of named values in cases where this is appropriate. +Each value is enclosed in a "value" tag. The following properties are defined: +- "name" (mandatory,string): the mnemonic of the value. +- "value" (mandatory,integer): the associated value. + +Example: + + \ No newline at end of file diff --git a/utils/regtools/desc/regs-stmp3700.xml b/utils/regtools/desc/regs-stmp3700.xml index 0bd55ffb95..8af3843265 100644 --- a/utils/regtools/desc/regs-stmp3700.xml +++ b/utils/regtools/desc/regs-stmp3700.xml @@ -17,8 +17,10 @@ This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. --> - - + + + + @@ -78,57 +80,17 @@ KIND, either express or implied. - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + @@ -146,63 +108,42 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -231,66 +172,45 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -345,30 +265,24 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - + + + @@ -377,8 +291,10 @@ KIND, either express or implied. - - + + + + @@ -432,57 +348,17 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + @@ -512,63 +388,42 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -589,66 +444,45 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -703,30 +537,24 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - + + + @@ -735,8 +563,10 @@ KIND, either express or implied. - - + + + + @@ -766,11 +596,13 @@ KIND, either express or implied. - + + - + + @@ -792,7 +624,8 @@ KIND, either express or implied. - + + @@ -804,7 +637,8 @@ KIND, either express or implied. - + + @@ -816,7 +650,8 @@ KIND, either express or implied. - + + @@ -832,7 +667,8 @@ KIND, either express or implied. - + + @@ -840,15 +676,32 @@ KIND, either express or implied. + + + + + + + + + + + + + + + + - + + @@ -860,15 +713,18 @@ KIND, either express or implied. - + + - - + + + + @@ -898,11 +754,13 @@ KIND, either express or implied. - + + - + + @@ -924,7 +782,8 @@ KIND, either express or implied. - + + @@ -940,7 +799,8 @@ KIND, either express or implied. - + + @@ -958,7 +818,8 @@ KIND, either express or implied. - + + @@ -972,9 +833,11 @@ KIND, either express or implied. - + + - + + @@ -990,7 +853,8 @@ KIND, either express or implied. - + + @@ -1018,7 +882,8 @@ KIND, either express or implied. - + + @@ -1036,7 +901,8 @@ KIND, either express or implied. - + + @@ -1060,7 +926,8 @@ KIND, either express or implied. - + + @@ -1070,17 +937,20 @@ KIND, either express or implied. - + + - + + - + + @@ -1088,13 +958,15 @@ KIND, either express or implied. - + + - + + @@ -1112,7 +984,8 @@ KIND, either express or implied. - + + @@ -1121,8 +994,10 @@ KIND, either express or implied. - - + + + + @@ -1158,7 +1033,8 @@ KIND, either express or implied. - + + @@ -1166,7 +1042,8 @@ KIND, either express or implied. - + + @@ -1182,7 +1059,8 @@ KIND, either express or implied. - + + @@ -1218,7 +1096,8 @@ KIND, either express or implied. - + + @@ -1226,7 +1105,8 @@ KIND, either express or implied. - + + @@ -1242,7 +1122,8 @@ KIND, either express or implied. - + + @@ -1252,7 +1133,8 @@ KIND, either express or implied. - + + @@ -1262,7 +1144,8 @@ KIND, either express or implied. - + + @@ -1272,11 +1155,13 @@ KIND, either express or implied. - + + - + + @@ -1292,7 +1177,8 @@ KIND, either express or implied. - + + @@ -1306,7 +1192,8 @@ KIND, either express or implied. - + + @@ -1316,7 +1203,8 @@ KIND, either express or implied. - + + @@ -1342,7 +1230,8 @@ KIND, either express or implied. - + + @@ -1358,13 +1247,15 @@ KIND, either express or implied. - + + - + + @@ -1373,8 +1264,10 @@ KIND, either express or implied. - - + + + + @@ -1412,7 +1305,8 @@ KIND, either express or implied. - + + @@ -1448,7 +1342,8 @@ KIND, either express or implied. - + + @@ -1486,13 +1381,15 @@ KIND, either express or implied. - + + - + + @@ -1504,25 +1401,30 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -1582,7 +1484,8 @@ KIND, either express or implied. - + + @@ -1604,57 +1507,52 @@ KIND, either express or implied. - + + - + + - + + - + + - - - - - - - - - + + + + + + - - - - - - - - - + + + + + + - - - - - - - - - + + + + + + @@ -1679,20 +1577,18 @@ KIND, either express or implied. - - - - - - - - - + + + + + + - - + + + @@ -1720,7 +1616,8 @@ KIND, either express or implied. - + + @@ -1740,33 +1637,40 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + @@ -1774,19 +1678,22 @@ KIND, either express or implied. - + + - + + - + + @@ -1794,7 +1701,8 @@ KIND, either express or implied. - + + @@ -1802,7 +1710,8 @@ KIND, either express or implied. - + + @@ -1818,11 +1727,13 @@ KIND, either express or implied. - + + - + + @@ -1831,8 +1742,10 @@ KIND, either express or implied. - - + + + + @@ -1906,7 +1819,8 @@ KIND, either express or implied. - + + @@ -1928,37 +1842,45 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + - + + @@ -1978,19 +1900,23 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -2004,63 +1930,76 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + @@ -2070,7 +2009,8 @@ KIND, either express or implied. - + + @@ -2080,15 +2020,18 @@ KIND, either express or implied. - + + - + + - + + @@ -2096,25 +2039,30 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -2138,97 +2086,97 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + + - - + + + + @@ -2238,7 +2186,8 @@ KIND, either express or implied. - + + @@ -2248,7 +2197,8 @@ KIND, either express or implied. - + + @@ -2258,7 +2208,8 @@ KIND, either express or implied. - + + @@ -2268,7 +2219,8 @@ KIND, either express or implied. - + + @@ -2278,7 +2230,8 @@ KIND, either express or implied. - + + @@ -2288,7 +2241,8 @@ KIND, either express or implied. - + + @@ -2298,7 +2252,8 @@ KIND, either express or implied. - + + @@ -2308,7 +2263,8 @@ KIND, either express or implied. - + + @@ -2318,7 +2274,8 @@ KIND, either express or implied. - + + @@ -2328,7 +2285,8 @@ KIND, either express or implied. - + + @@ -2338,7 +2296,8 @@ KIND, either express or implied. - + + @@ -2348,7 +2307,8 @@ KIND, either express or implied. - + + @@ -2356,7 +2316,8 @@ KIND, either express or implied. - + + @@ -2366,7 +2327,8 @@ KIND, either express or implied. - + + @@ -2376,7 +2338,8 @@ KIND, either express or implied. - + + @@ -2386,7 +2349,8 @@ KIND, either express or implied. - + + @@ -2396,7 +2360,8 @@ KIND, either express or implied. - + + @@ -2406,7 +2371,8 @@ KIND, either express or implied. - + + @@ -2416,7 +2382,8 @@ KIND, either express or implied. - + + @@ -2426,7 +2393,8 @@ KIND, either express or implied. - + + @@ -2436,83 +2404,99 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + @@ -2522,33 +2506,39 @@ KIND, either express or implied. - + + - + + - + + - + + - - + + + + @@ -2630,13 +2620,15 @@ KIND, either express or implied. - + + - + + @@ -2664,11 +2656,13 @@ KIND, either express or implied. - + + - + + @@ -2690,7 +2684,8 @@ KIND, either express or implied. - + + @@ -2724,7 +2719,8 @@ KIND, either express or implied. - + + @@ -2733,8 +2729,10 @@ KIND, either express or implied. - - + + + + @@ -2770,7 +2768,8 @@ KIND, either express or implied. - + + @@ -2808,7 +2807,8 @@ KIND, either express or implied. - + + @@ -3018,7 +3018,8 @@ KIND, either express or implied. - + + @@ -3064,27 +3065,33 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + @@ -3093,8 +3100,10 @@ KIND, either express or implied. - - + + + + @@ -3118,7 +3127,8 @@ KIND, either express or implied. - + + @@ -3138,7 +3148,8 @@ KIND, either express or implied. - + + @@ -3148,33 +3159,40 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + @@ -3183,56 +3201,70 @@ KIND, either express or implied. - - + + + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + @@ -3244,57 +3276,71 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - - + + + + @@ -3364,13 +3410,15 @@ KIND, either express or implied. - + + - + + @@ -3410,19 +3458,23 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -3462,7 +3514,8 @@ KIND, either express or implied. - + + @@ -3470,11 +3523,13 @@ KIND, either express or implied. - + + - + + @@ -3484,11 +3539,13 @@ KIND, either express or implied. - + + - + + @@ -3522,7 +3579,8 @@ KIND, either express or implied. - + + @@ -3608,7 +3666,8 @@ KIND, either express or implied. - + + @@ -3617,8 +3676,10 @@ KIND, either express or implied. - - + + + + @@ -3704,25 +3765,29 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -3828,7 +3893,8 @@ KIND, either express or implied. - + + @@ -3946,11 +4012,13 @@ KIND, either express or implied. - + + - + + @@ -3976,7 +4044,8 @@ KIND, either express or implied. - + + @@ -4010,7 +4079,8 @@ KIND, either express or implied. - + + @@ -4019,12 +4089,15 @@ KIND, either express or implied. - - + + + + - + + @@ -4036,7 +4109,8 @@ KIND, either express or implied. - + + @@ -4146,51 +4220,36 @@ KIND, either express or implied. - + + - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -4279,12 +4338,14 @@ KIND, either express or implied. - - + + + - + + @@ -4352,27 +4413,30 @@ KIND, either express or implied. - + + - + + - + + - - - - - + + + + - - + + + @@ -4381,8 +4445,10 @@ KIND, either express or implied. - - + + + + @@ -4464,7 +4530,8 @@ KIND, either express or implied. - + + @@ -4486,13 +4553,15 @@ KIND, either express or implied. - + + - + + @@ -4524,7 +4593,8 @@ KIND, either express or implied. - + + @@ -4610,11 +4680,13 @@ KIND, either express or implied. - + + - + + @@ -4686,7 +4758,8 @@ KIND, either express or implied. - + + @@ -4710,13 +4783,15 @@ KIND, either express or implied. - + + - + + @@ -4730,7 +4805,8 @@ KIND, either express or implied. - + + @@ -4739,8 +4815,10 @@ KIND, either express or implied. - - + + + + @@ -4796,7 +4874,8 @@ KIND, either express or implied. - + + @@ -4856,7 +4935,8 @@ KIND, either express or implied. - + + @@ -4866,7 +4946,8 @@ KIND, either express or implied. - + + @@ -4892,13 +4973,15 @@ KIND, either express or implied. - + + - + + @@ -4906,7 +4989,8 @@ KIND, either express or implied. - + + @@ -4914,7 +4998,8 @@ KIND, either express or implied. - + + @@ -4922,7 +5007,8 @@ KIND, either express or implied. - + + @@ -4930,7 +5016,8 @@ KIND, either express or implied. - + + @@ -4938,13 +5025,15 @@ KIND, either express or implied. - + + - + + @@ -4954,7 +5043,8 @@ KIND, either express or implied. - + + @@ -4972,7 +5062,8 @@ KIND, either express or implied. - + + @@ -4980,7 +5071,8 @@ KIND, either express or implied. - + + @@ -5005,8 +5097,10 @@ KIND, either express or implied. - - + + + + @@ -5050,7 +5144,8 @@ KIND, either express or implied. - + + @@ -5160,7 +5255,8 @@ KIND, either express or implied. - + + @@ -5270,7 +5366,8 @@ KIND, either express or implied. - + + @@ -5324,7 +5421,8 @@ KIND, either express or implied. - + + @@ -5354,43 +5452,18 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - @@ -5398,15 +5471,12 @@ KIND, either express or implied. - - - - - - - - - + + + + + + @@ -5417,14 +5487,16 @@ KIND, either express or implied. - - + + + - + + @@ -5448,7 +5520,8 @@ KIND, either express or implied. - + + @@ -5468,7 +5541,8 @@ KIND, either express or implied. - + + @@ -5742,7 +5816,8 @@ KIND, either express or implied. - + + @@ -5751,8 +5826,10 @@ KIND, either express or implied. - - + + + + @@ -5768,59 +5845,52 @@ KIND, either express or implied. - + + - - - - - - - - - + + + + + + - - - - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + - - + + + - + + - + + @@ -5876,49 +5946,38 @@ KIND, either express or implied. - - - - - - - - - + + + + + + - - - - - - - + + + + + - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + @@ -5927,8 +5986,10 @@ KIND, either express or implied. - - + + + + @@ -5950,909 +6011,117 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + - - + + + + + + + - - + + + + + + - - + + + + + + - - + + + + + + - - + + + + + + - - + + + + + + - - + + + + + + - - + + + + + + - - + + + + + + - - + + + + @@ -6902,7 +6171,8 @@ KIND, either express or implied. - + + @@ -6924,7 +6194,8 @@ KIND, either express or implied. - + + @@ -6950,7 +6221,8 @@ KIND, either express or implied. - + + @@ -6964,7 +6236,8 @@ KIND, either express or implied. - + + @@ -6984,7 +6257,8 @@ KIND, either express or implied. - + + @@ -6998,7 +6272,8 @@ KIND, either express or implied. - + + @@ -7012,13 +6287,15 @@ KIND, either express or implied. - + + - + + @@ -7030,7 +6307,8 @@ KIND, either express or implied. - + + @@ -7038,7 +6316,8 @@ KIND, either express or implied. - + + @@ -7062,7 +6341,8 @@ KIND, either express or implied. - + + @@ -7104,13 +6384,15 @@ KIND, either express or implied. - + + - + + @@ -7122,7 +6404,8 @@ KIND, either express or implied. - + + @@ -7132,7 +6415,8 @@ KIND, either express or implied. - + + @@ -7142,11 +6426,13 @@ KIND, either express or implied. - + + - + + @@ -7155,8 +6441,10 @@ KIND, either express or implied. - - + + + + @@ -7184,33 +6472,25 @@ KIND, either express or implied. - - - - - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + @@ -7249,8 +6529,9 @@ KIND, either express or implied. - - + + + @@ -7259,8 +6540,10 @@ KIND, either express or implied. - - + + + + @@ -7280,7 +6563,8 @@ KIND, either express or implied. - + + @@ -7296,23 +6580,28 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -7342,7 +6631,8 @@ KIND, either express or implied. - + + @@ -7376,29 +6666,35 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + @@ -7407,12 +6703,11 @@ KIND, either express or implied. - - - - - - + + + + + @@ -7450,7 +6745,8 @@ KIND, either express or implied. - + + @@ -7464,13 +6760,15 @@ KIND, either express or implied. - + + - + + @@ -7478,9 +6776,11 @@ KIND, either express or implied. - - - + + + + + @@ -7500,13 +6800,15 @@ KIND, either express or implied. - + + - + + @@ -7528,25 +6830,29 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -7555,12 +6861,11 @@ KIND, either express or implied. - - - - - - + + + + + @@ -7600,7 +6905,8 @@ KIND, either express or implied. - + + @@ -7744,19 +7050,23 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -7764,7 +7074,8 @@ KIND, either express or implied. - + + @@ -7840,27 +7151,33 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + @@ -7908,7 +7225,8 @@ KIND, either express or implied. - + + @@ -8016,7 +7334,8 @@ KIND, either express or implied. - + + @@ -8024,9 +7343,11 @@ KIND, either express or implied. - - - + + + + + @@ -8098,17 +7419,16 @@ KIND, either express or implied. - + + - - - - - - - + + + + + @@ -8157,20 +7477,19 @@ KIND, either express or implied. - - - - - - - + + + + + - - + + + @@ -8252,13 +7571,15 @@ KIND, either express or implied. - + + - + + @@ -8267,12 +7588,11 @@ KIND, either express or implied. - - - - - - + + + + + @@ -8288,13 +7608,15 @@ KIND, either express or implied. - + + - + + @@ -8374,7 +7696,8 @@ KIND, either express or implied. - + + @@ -8394,7 +7717,8 @@ KIND, either express or implied. - + + @@ -8412,7 +7736,8 @@ KIND, either express or implied. - + + @@ -8458,11 +7783,13 @@ KIND, either express or implied. - + + - + + @@ -8500,7 +7827,8 @@ KIND, either express or implied. - + + @@ -8514,7 +7842,8 @@ KIND, either express or implied. - + + @@ -8522,9 +7851,11 @@ KIND, either express or implied. - - - + + + + + @@ -8540,7 +7871,8 @@ KIND, either express or implied. - + + @@ -8554,7 +7886,8 @@ KIND, either express or implied. - + + @@ -8578,19 +7911,22 @@ KIND, either express or implied. - + + - + + - + + @@ -8598,7 +7934,8 @@ KIND, either express or implied. - + + @@ -8618,7 +7955,8 @@ KIND, either express or implied. - + + @@ -8648,7 +7986,8 @@ KIND, either express or implied. - + + @@ -8690,7 +8029,8 @@ KIND, either express or implied. - + + @@ -8718,7 +8058,8 @@ KIND, either express or implied. - + + @@ -8746,7 +8087,8 @@ KIND, either express or implied. - + + @@ -8774,7 +8116,8 @@ KIND, either express or implied. - + + @@ -8802,7 +8145,8 @@ KIND, either express or implied. - + + @@ -8815,8 +8159,10 @@ KIND, either express or implied. - - + + + + @@ -8824,7 +8170,8 @@ KIND, either express or implied. - + + @@ -8838,7 +8185,8 @@ KIND, either express or implied. - + + @@ -8848,13 +8196,15 @@ KIND, either express or implied. - + + - + + @@ -8864,27 +8214,32 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -8900,7 +8255,8 @@ KIND, either express or implied. - + + @@ -8910,11 +8266,13 @@ KIND, either express or implied. - + + - + + @@ -8922,7 +8280,8 @@ KIND, either express or implied. - + + @@ -8950,7 +8309,8 @@ KIND, either express or implied. - + + @@ -8982,7 +8342,8 @@ KIND, either express or implied. - + + @@ -9006,35 +8367,42 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + @@ -9042,11 +8410,13 @@ KIND, either express or implied. - + + - + + @@ -9066,27 +8436,32 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -9180,7 +8555,8 @@ KIND, either express or implied. - + + @@ -9240,7 +8616,8 @@ KIND, either express or implied. - + + @@ -9256,45 +8633,46 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - - - - - - - - - - - + + + + + + + @@ -9321,10 +8699,12 @@ KIND, either express or implied. - + - - + + + + @@ -9344,7 +8724,8 @@ KIND, either express or implied. - + + @@ -9366,7 +8747,8 @@ KIND, either express or implied. - + + @@ -9374,7 +8756,8 @@ KIND, either express or implied. - + + @@ -9408,7 +8791,8 @@ KIND, either express or implied. - + + @@ -9418,7 +8802,8 @@ KIND, either express or implied. - + + @@ -9442,7 +8827,8 @@ KIND, either express or implied. - + + @@ -9450,7 +8836,8 @@ KIND, either express or implied. - + + @@ -9460,7 +8847,8 @@ KIND, either express or implied. - + + diff --git a/utils/regtools/desc/regs-stmp3780.xml b/utils/regtools/desc/regs-stmp3780.xml index 9d042ce5a0..f6f9b3f646 100644 --- a/utils/regtools/desc/regs-stmp3780.xml +++ b/utils/regtools/desc/regs-stmp3780.xml @@ -16,9 +16,11 @@ of the License, or (at your option) any later version. This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. --> - - - + + + + + @@ -78,115 +80,30 @@ KIND, either express or implied. - + + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - + + @@ -204,63 +121,42 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -291,44 +187,30 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -337,24 +219,17 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -421,30 +296,24 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - + + + @@ -453,8 +322,10 @@ KIND, either express or implied. - - + + + + @@ -462,203 +333,22 @@ KIND, either express or implied. - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + @@ -716,7 +406,8 @@ KIND, either express or implied. - + + @@ -758,111 +449,66 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -889,118 +535,73 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1059,46 +660,32 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + + @@ -1107,8 +694,10 @@ KIND, either express or implied. - - + + + + @@ -1142,13 +731,15 @@ KIND, either express or implied. - + + - + + @@ -1176,7 +767,8 @@ KIND, either express or implied. - + + @@ -1198,7 +790,8 @@ KIND, either express or implied. - + + @@ -1212,7 +805,8 @@ KIND, either express or implied. - + + @@ -1236,7 +830,8 @@ KIND, either express or implied. - + + @@ -1250,6 +845,14 @@ KIND, either express or implied. + + + + + + + + @@ -1262,9 +865,18 @@ KIND, either express or implied. + + + + + + + + - + + @@ -1284,15 +896,18 @@ KIND, either express or implied. - + + - - + + + + @@ -1330,13 +945,15 @@ KIND, either express or implied. - + + - + + @@ -1364,7 +981,8 @@ KIND, either express or implied. - + + @@ -1388,7 +1006,8 @@ KIND, either express or implied. - + + @@ -1410,7 +1029,8 @@ KIND, either express or implied. - + + @@ -1434,11 +1054,13 @@ KIND, either express or implied. - + + - + + @@ -1468,7 +1090,8 @@ KIND, either express or implied. - + + @@ -1504,7 +1127,8 @@ KIND, either express or implied. - + + @@ -1538,7 +1162,8 @@ KIND, either express or implied. - + + @@ -1572,7 +1197,8 @@ KIND, either express or implied. - + + @@ -1584,13 +1210,15 @@ KIND, either express or implied. - + + - + + @@ -1600,7 +1228,8 @@ KIND, either express or implied. - + + @@ -1612,13 +1241,15 @@ KIND, either express or implied. - + + - + + @@ -1636,7 +1267,8 @@ KIND, either express or implied. - + + @@ -1645,8 +1277,10 @@ KIND, either express or implied. - - + + + + @@ -1690,7 +1324,8 @@ KIND, either express or implied. - + + @@ -1722,25 +1357,30 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -1774,7 +1414,8 @@ KIND, either express or implied. - + + @@ -1806,7 +1447,8 @@ KIND, either express or implied. - + + @@ -1836,7 +1478,8 @@ KIND, either express or implied. - + + @@ -1868,7 +1511,8 @@ KIND, either express or implied. - + + @@ -1898,7 +1542,8 @@ KIND, either express or implied. - + + @@ -1930,7 +1575,8 @@ KIND, either express or implied. - + + @@ -1960,7 +1606,8 @@ KIND, either express or implied. - + + @@ -1992,7 +1639,8 @@ KIND, either express or implied. - + + @@ -2022,7 +1670,8 @@ KIND, either express or implied. - + + @@ -2076,27 +1725,33 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + @@ -2105,8 +1760,10 @@ KIND, either express or implied. - - + + + + @@ -2154,7 +1811,8 @@ KIND, either express or implied. - + + @@ -2164,7 +1822,8 @@ KIND, either express or implied. - + + @@ -2190,7 +1849,8 @@ KIND, either express or implied. - + + @@ -2236,7 +1896,8 @@ KIND, either express or implied. - + + @@ -2246,7 +1907,8 @@ KIND, either express or implied. - + + @@ -2264,7 +1926,8 @@ KIND, either express or implied. - + + @@ -2278,7 +1941,8 @@ KIND, either express or implied. - + + @@ -2292,7 +1956,8 @@ KIND, either express or implied. - + + @@ -2306,13 +1971,15 @@ KIND, either express or implied. - + + - + + @@ -2340,7 +2007,8 @@ KIND, either express or implied. - + + @@ -2360,7 +2028,8 @@ KIND, either express or implied. - + + @@ -2374,7 +2043,8 @@ KIND, either express or implied. - + + @@ -2382,7 +2052,8 @@ KIND, either express or implied. - + + @@ -2396,7 +2067,8 @@ KIND, either express or implied. - + + @@ -2422,7 +2094,8 @@ KIND, either express or implied. - + + @@ -2430,7 +2103,8 @@ KIND, either express or implied. - + + @@ -2452,7 +2126,8 @@ KIND, either express or implied. - + + @@ -2460,13 +2135,15 @@ KIND, either express or implied. - + + - + + @@ -2475,8 +2152,10 @@ KIND, either express or implied. - - + + + + @@ -2516,7 +2195,8 @@ KIND, either express or implied. - + + @@ -2554,7 +2234,8 @@ KIND, either express or implied. - + + @@ -2590,7 +2271,8 @@ KIND, either express or implied. - + + @@ -2602,7 +2284,8 @@ KIND, either express or implied. - + + @@ -2614,11 +2297,13 @@ KIND, either express or implied. - + + - + + @@ -2630,15 +2315,18 @@ KIND, either express or implied. - + + - + + - + + @@ -2698,7 +2386,8 @@ KIND, either express or implied. - + + @@ -2722,43 +2411,41 @@ KIND, either express or implied. - + + - + + - + + - + + - - - - - - - - - + + + + + + - - - - - - - - - + + + + + + @@ -2767,16 +2454,13 @@ KIND, either express or implied. - - - - - - - - - + + + + + + @@ -2807,22 +2491,20 @@ KIND, either express or implied. - - - - - - - - - + + + + + + - - + + + @@ -2858,7 +2540,8 @@ KIND, either express or implied. - + + @@ -2888,7 +2571,8 @@ KIND, either express or implied. - + + @@ -2896,29 +2580,35 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + @@ -2928,7 +2618,8 @@ KIND, either express or implied. - + + @@ -2938,7 +2629,8 @@ KIND, either express or implied. - + + @@ -2948,7 +2640,8 @@ KIND, either express or implied. - + + @@ -2956,7 +2649,8 @@ KIND, either express or implied. - + + @@ -2966,7 +2660,8 @@ KIND, either express or implied. - + + @@ -2976,7 +2671,8 @@ KIND, either express or implied. - + + @@ -2992,11 +2688,13 @@ KIND, either express or implied. - + + - + + @@ -3004,7 +2702,8 @@ KIND, either express or implied. - + + @@ -3013,8 +2712,10 @@ KIND, either express or implied. - - + + + + @@ -3108,7 +2809,8 @@ KIND, either express or implied. - + + @@ -3138,11 +2840,13 @@ KIND, either express or implied. - + + - + + @@ -3152,31 +2856,37 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + @@ -3200,19 +2910,23 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -3232,39 +2946,48 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + - + + - + + @@ -3274,7 +2997,8 @@ KIND, either express or implied. - + + @@ -3284,7 +3008,8 @@ KIND, either express or implied. - + + @@ -3294,7 +3019,8 @@ KIND, either express or implied. - + + @@ -3304,7 +3030,8 @@ KIND, either express or implied. - + + @@ -3322,7 +3049,8 @@ KIND, either express or implied. - + + @@ -3340,15 +3068,18 @@ KIND, either express or implied. - + + - + + - + + @@ -3370,19 +3101,23 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -3390,7 +3125,8 @@ KIND, either express or implied. - + + @@ -3422,101 +3158,101 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + + - - + + + + @@ -3534,7 +3270,8 @@ KIND, either express or implied. - + + @@ -3552,7 +3289,8 @@ KIND, either express or implied. - + + @@ -3570,7 +3308,8 @@ KIND, either express or implied. - + + @@ -3588,7 +3327,8 @@ KIND, either express or implied. - + + @@ -3606,7 +3346,8 @@ KIND, either express or implied. - + + @@ -3624,7 +3365,8 @@ KIND, either express or implied. - + + @@ -3642,7 +3384,8 @@ KIND, either express or implied. - + + @@ -3660,7 +3403,8 @@ KIND, either express or implied. - + + @@ -3678,7 +3422,8 @@ KIND, either express or implied. - + + @@ -3696,7 +3441,8 @@ KIND, either express or implied. - + + @@ -3714,7 +3460,8 @@ KIND, either express or implied. - + + @@ -3732,7 +3479,8 @@ KIND, either express or implied. - + + @@ -3748,7 +3496,8 @@ KIND, either express or implied. - + + @@ -3766,7 +3515,8 @@ KIND, either express or implied. - + + @@ -3784,7 +3534,8 @@ KIND, either express or implied. - + + @@ -3802,7 +3553,8 @@ KIND, either express or implied. - + + @@ -3820,7 +3572,8 @@ KIND, either express or implied. - + + @@ -3832,7 +3585,8 @@ KIND, either express or implied. - + + @@ -3850,7 +3604,8 @@ KIND, either express or implied. - + + @@ -3862,7 +3617,8 @@ KIND, either express or implied. - + + @@ -3874,7 +3630,8 @@ KIND, either express or implied. - + + @@ -3884,7 +3641,8 @@ KIND, either express or implied. - + + @@ -3894,7 +3652,8 @@ KIND, either express or implied. - + + @@ -3904,7 +3663,8 @@ KIND, either express or implied. - + + @@ -3914,7 +3674,8 @@ KIND, either express or implied. - + + @@ -3924,7 +3685,8 @@ KIND, either express or implied. - + + @@ -3932,57 +3694,67 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + - + + - + + - + + - + + @@ -4000,7 +3772,8 @@ KIND, either express or implied. - + + @@ -4012,7 +3785,8 @@ KIND, either express or implied. - + + @@ -4022,7 +3796,8 @@ KIND, either express or implied. - + + @@ -4032,7 +3807,8 @@ KIND, either express or implied. - + + @@ -4041,8 +3817,10 @@ KIND, either express or implied. - - + + + + @@ -4132,7 +3910,8 @@ KIND, either express or implied. - + + @@ -4142,7 +3921,8 @@ KIND, either express or implied. - + + @@ -4176,11 +3956,13 @@ KIND, either express or implied. - + + - + + @@ -4202,7 +3984,8 @@ KIND, either express or implied. - + + @@ -4238,7 +4021,8 @@ KIND, either express or implied. - + + @@ -4247,8 +4031,10 @@ KIND, either express or implied. - - + + + + @@ -4290,7 +4076,8 @@ KIND, either express or implied. - + + @@ -4332,7 +4119,8 @@ KIND, either express or implied. - + + @@ -4542,7 +4330,8 @@ KIND, either express or implied. - + + @@ -4592,27 +4381,33 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + @@ -4621,8 +4416,10 @@ KIND, either express or implied. - - + + + + @@ -4734,7 +4531,8 @@ KIND, either express or implied. - + + @@ -4756,7 +4554,8 @@ KIND, either express or implied. - + + @@ -4774,7 +4573,8 @@ KIND, either express or implied. - + + @@ -4782,33 +4582,39 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + @@ -4817,8 +4623,10 @@ KIND, either express or implied. - - + + + + @@ -4888,13 +4696,15 @@ KIND, either express or implied. - + + - + + @@ -4942,25 +4752,29 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -5018,7 +4832,8 @@ KIND, either express or implied. - + + @@ -5028,13 +4843,15 @@ KIND, either express or implied. - + + - + + @@ -5044,11 +4861,13 @@ KIND, either express or implied. - + + - + + @@ -5084,7 +4903,8 @@ KIND, either express or implied. - + + @@ -5170,7 +4990,8 @@ KIND, either express or implied. - + + @@ -5178,7 +4999,8 @@ KIND, either express or implied. - + + @@ -5198,15 +5020,18 @@ KIND, either express or implied. - + + - - + + + + @@ -5294,7 +5119,8 @@ KIND, either express or implied. - + + @@ -5304,7 +5130,8 @@ KIND, either express or implied. - + + @@ -5314,7 +5141,8 @@ KIND, either express or implied. - + + @@ -5324,7 +5152,8 @@ KIND, either express or implied. - + + @@ -5448,7 +5277,8 @@ KIND, either express or implied. - + + @@ -5574,11 +5404,13 @@ KIND, either express or implied. - + + - + + @@ -5606,7 +5438,8 @@ KIND, either express or implied. - + + @@ -5644,7 +5477,8 @@ KIND, either express or implied. - + + @@ -5653,14 +5487,17 @@ KIND, either express or implied. - - + + + + - + + @@ -5674,7 +5511,8 @@ KIND, either express or implied. - + + @@ -5736,287 +5574,159 @@ KIND, either express or implied. - + + - + + - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6047,8 +5757,9 @@ KIND, either express or implied. - - + + + @@ -6120,33 +5831,34 @@ KIND, either express or implied. - + + - + + - + + - - - - - - - - - + + + + + + - - + + + @@ -6155,8 +5867,10 @@ KIND, either express or implied. - - + + + + @@ -6242,7 +5956,8 @@ KIND, either express or implied. - + + @@ -6266,7 +5981,8 @@ KIND, either express or implied. - + + @@ -6274,7 +5990,8 @@ KIND, either express or implied. - + + @@ -6308,7 +6025,8 @@ KIND, either express or implied. - + + @@ -6398,11 +6116,13 @@ KIND, either express or implied. - + + - + + @@ -6478,7 +6198,8 @@ KIND, either express or implied. - + + @@ -6504,7 +6225,8 @@ KIND, either express or implied. - + + @@ -6512,7 +6234,8 @@ KIND, either express or implied. - + + @@ -6528,7 +6251,8 @@ KIND, either express or implied. - + + @@ -6537,8 +6261,10 @@ KIND, either express or implied. - - + + + + @@ -6644,7 +6370,8 @@ KIND, either express or implied. - + + @@ -6732,21 +6459,25 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -6756,7 +6487,8 @@ KIND, either express or implied. - + + @@ -6766,7 +6498,8 @@ KIND, either express or implied. - + + @@ -6798,11 +6531,13 @@ KIND, either express or implied. - + + - + + @@ -6810,7 +6545,8 @@ KIND, either express or implied. - + + @@ -6822,7 +6558,8 @@ KIND, either express or implied. - + + @@ -6830,7 +6567,8 @@ KIND, either express or implied. - + + @@ -6840,7 +6578,8 @@ KIND, either express or implied. - + + @@ -6850,7 +6589,8 @@ KIND, either express or implied. - + + @@ -6860,7 +6600,8 @@ KIND, either express or implied. - + + @@ -6870,7 +6611,8 @@ KIND, either express or implied. - + + @@ -6880,7 +6622,8 @@ KIND, either express or implied. - + + @@ -6898,7 +6641,8 @@ KIND, either express or implied. - + + @@ -6908,7 +6652,8 @@ KIND, either express or implied. - + + @@ -6918,7 +6663,8 @@ KIND, either express or implied. - + + @@ -6928,7 +6674,8 @@ KIND, either express or implied. - + + @@ -6938,7 +6685,8 @@ KIND, either express or implied. - + + @@ -6948,7 +6696,8 @@ KIND, either express or implied. - + + @@ -6958,7 +6707,8 @@ KIND, either express or implied. - + + @@ -6984,15 +6734,18 @@ KIND, either express or implied. - + + - + + - + + @@ -7002,11 +6755,13 @@ KIND, either express or implied. - + + - + + @@ -7026,7 +6781,8 @@ KIND, either express or implied. - + + @@ -7034,7 +6790,8 @@ KIND, either express or implied. - + + @@ -7070,15 +6827,18 @@ KIND, either express or implied. - + + - - + + + + @@ -7126,7 +6886,8 @@ KIND, either express or implied. - + + @@ -7240,7 +7001,8 @@ KIND, either express or implied. - + + @@ -7354,7 +7116,8 @@ KIND, either express or implied. - + + @@ -7418,7 +7181,8 @@ KIND, either express or implied. - + + @@ -7452,23 +7216,16 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -7481,16 +7238,13 @@ KIND, either express or implied. - - - - - - - - - + + + + + + @@ -7503,8 +7257,9 @@ KIND, either express or implied. - - + + + @@ -7512,7 +7267,8 @@ KIND, either express or implied. - + + @@ -7542,7 +7298,8 @@ KIND, either express or implied. - + + @@ -7568,7 +7325,8 @@ KIND, either express or implied. - + + @@ -7842,7 +7600,8 @@ KIND, either express or implied. - + + @@ -7851,8 +7610,10 @@ KIND, either express or implied. - - + + + + @@ -7874,55 +7635,47 @@ KIND, either express or implied. - + + - - - - - - - - - + + + + + + - - - - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + - - + + + - + + @@ -7940,7 +7693,8 @@ KIND, either express or implied. - + + @@ -7998,131 +7752,38 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + + + + + - + + + + + + + + + + - - - - - + + @@ -8131,8 +7792,10 @@ KIND, either express or implied. - - + + + + @@ -8156,1101 +7819,117 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + + + + + + - - + + + + + + - - + + + + + + - + + + + + + + - - + + + + + + - - + + + + + + - - + + + + + + - + + + + + + + - - + + + + + + - - + + + + @@ -9312,7 +7991,8 @@ KIND, either express or implied. - + + @@ -9350,7 +8030,8 @@ KIND, either express or implied. - + + @@ -9384,7 +8065,8 @@ KIND, either express or implied. - + + @@ -9414,7 +8096,8 @@ KIND, either express or implied. - + + @@ -9440,7 +8123,8 @@ KIND, either express or implied. - + + @@ -9464,7 +8148,8 @@ KIND, either express or implied. - + + @@ -9490,7 +8175,8 @@ KIND, either express or implied. - + + @@ -9504,7 +8190,8 @@ KIND, either express or implied. - + + @@ -9532,7 +8219,8 @@ KIND, either express or implied. - + + @@ -9546,7 +8234,8 @@ KIND, either express or implied. - + + @@ -9558,7 +8247,8 @@ KIND, either express or implied. - + + @@ -9588,7 +8278,8 @@ KIND, either express or implied. - + + @@ -9636,7 +8327,8 @@ KIND, either express or implied. - + + @@ -9646,7 +8338,8 @@ KIND, either express or implied. - + + @@ -9664,7 +8357,8 @@ KIND, either express or implied. - + + @@ -9676,7 +8370,8 @@ KIND, either express or implied. - + + @@ -9688,11 +8383,13 @@ KIND, either express or implied. - + + - + + @@ -9701,8 +8398,10 @@ KIND, either express or implied. - - + + + + @@ -9734,33 +8433,25 @@ KIND, either express or implied. - - - - - - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + @@ -9803,8 +8494,9 @@ KIND, either express or implied. - - + + + @@ -9813,8 +8505,10 @@ KIND, either express or implied. - - + + + + @@ -9904,7 +8598,8 @@ KIND, either express or implied. - + + @@ -9922,15 +8617,18 @@ KIND, either express or implied. - + + - + + - + + @@ -9938,19 +8636,23 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -9960,11 +8662,13 @@ KIND, either express or implied. - + + - + + @@ -9974,7 +8678,8 @@ KIND, either express or implied. - + + @@ -9984,7 +8689,8 @@ KIND, either express or implied. - + + @@ -9994,7 +8700,8 @@ KIND, either express or implied. - + + @@ -10006,7 +8713,8 @@ KIND, either express or implied. - + + @@ -10016,7 +8724,8 @@ KIND, either express or implied. - + + @@ -10026,7 +8735,8 @@ KIND, either express or implied. - + + @@ -10034,7 +8744,8 @@ KIND, either express or implied. - + + @@ -10044,31 +8755,36 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -10094,11 +8810,13 @@ KIND, either express or implied. - + + - + + @@ -10106,43 +8824,29 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -10151,24 +8855,17 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -10225,30 +8922,25 @@ KIND, either express or implied. - - - - - - - - - - - - - - - - - + + + + + + + + + + - + - - + + + + @@ -10270,7 +8962,8 @@ KIND, either express or implied. - + + @@ -10290,23 +8983,28 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -10336,7 +9034,8 @@ KIND, either express or implied. - + + @@ -10352,23 +9051,28 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -10376,7 +9080,8 @@ KIND, either express or implied. - + + @@ -10385,12 +9090,11 @@ KIND, either express or implied. - - - - - - + + + + + @@ -10432,7 +9136,8 @@ KIND, either express or implied. - + + @@ -10452,13 +9157,15 @@ KIND, either express or implied. - + + - + + @@ -10466,9 +9173,11 @@ KIND, either express or implied. - - - + + + + + @@ -10492,7 +9201,8 @@ KIND, either express or implied. - + + @@ -10500,7 +9210,8 @@ KIND, either express or implied. - + + @@ -10528,7 +9239,8 @@ KIND, either express or implied. - + + @@ -10538,7 +9250,8 @@ KIND, either express or implied. - + + @@ -10546,13 +9259,15 @@ KIND, either express or implied. - + + - + + @@ -10561,12 +9276,11 @@ KIND, either express or implied. - - - - - - + + + + + @@ -10606,7 +9320,8 @@ KIND, either express or implied. - + + @@ -10756,19 +9471,23 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -10776,7 +9495,8 @@ KIND, either express or implied. - + + @@ -10852,27 +9572,33 @@ KIND, either express or implied. - + + - + + - + + - + + - + + - + + @@ -10926,7 +9652,8 @@ KIND, either express or implied. - + + @@ -11034,7 +9761,8 @@ KIND, either express or implied. - + + @@ -11042,9 +9770,11 @@ KIND, either express or implied. - - - + + + + + @@ -11078,19 +9808,23 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -11114,7 +9848,8 @@ KIND, either express or implied. - + + @@ -11122,19 +9857,23 @@ KIND, either express or implied. - + + - + + - + + - + + @@ -11143,8 +9882,10 @@ KIND, either express or implied. - - + + + + @@ -11222,19 +9963,18 @@ KIND, either express or implied. - + + - - - - - - - + + + + + @@ -11287,20 +10027,19 @@ KIND, either express or implied. - - - - - - - + + + + + - - + + + @@ -11386,13 +10125,15 @@ KIND, either express or implied. - + + - + + @@ -11401,8 +10142,10 @@ KIND, either express or implied. - - + + + + @@ -11428,7 +10171,8 @@ KIND, either express or implied. - + + @@ -11470,7 +10214,8 @@ KIND, either express or implied. - + + @@ -11498,7 +10243,8 @@ KIND, either express or implied. - + + @@ -11508,7 +10254,8 @@ KIND, either express or implied. - + + @@ -11518,7 +10265,8 @@ KIND, either express or implied. - + + @@ -11528,7 +10276,8 @@ KIND, either express or implied. - + + @@ -11538,7 +10287,8 @@ KIND, either express or implied. - + + @@ -11548,13 +10298,15 @@ KIND, either express or implied. - + + - + + @@ -11568,7 +10320,8 @@ KIND, either express or implied. - + + @@ -11582,7 +10335,8 @@ KIND, either express or implied. - + + @@ -11606,15 +10360,18 @@ KIND, either express or implied. - + + - + + - + + @@ -11624,7 +10381,8 @@ KIND, either express or implied. - + + @@ -11634,7 +10392,8 @@ KIND, either express or implied. - + + @@ -11644,23 +10403,28 @@ KIND, either express or implied. - + + - + + - + + - + + - + + @@ -11670,7 +10434,8 @@ KIND, either express or implied. - + + @@ -11728,7 +10493,8 @@ KIND, either express or implied. - + + @@ -11758,7 +10524,8 @@ KIND, either express or implied. - + + @@ -11772,7 +10539,8 @@ KIND, either express or implied. - + + @@ -11781,12 +10549,11 @@ KIND, either express or implied. - - - - - - + + + + + @@ -11802,7 +10569,8 @@ KIND, either express or implied. - + + @@ -11812,7 +10580,8 @@ KIND, either express or implied. - + + @@ -11898,7 +10667,8 @@ KIND, either express or implied. - + + @@ -11920,7 +10690,8 @@ KIND, either express or implied. - + + @@ -11942,7 +10713,8 @@ KIND, either express or implied. - + + @@ -11992,11 +10764,13 @@ KIND, either express or implied. - + + - + + @@ -12034,7 +10808,8 @@ KIND, either express or implied. - + + @@ -12054,7 +10829,8 @@ KIND, either express or implied. - + + @@ -12062,7 +10838,8 @@ KIND, either express or implied. - + + @@ -12080,11 +10857,318 @@ KIND, either express or implied. - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -12102,7 +11186,8 @@ KIND, either express or implied. - + + @@ -12118,7 +11203,8 @@ KIND, either express or implied. - + + @@ -12130,7 +11216,8 @@ KIND, either express or implied. - + + @@ -12138,7 +11225,8 @@ KIND, either express or implied. - + + @@ -12150,7 +11238,8 @@ KIND, either express or implied. - + + @@ -12158,13 +11247,15 @@ KIND, either express or implied. - + + - + + @@ -12188,13 +11279,15 @@ KIND, either express or implied. - + + - + + @@ -12218,7 +11311,8 @@ KIND, either express or implied. - + + @@ -12240,7 +11334,8 @@ KIND, either express or implied. - + + @@ -12248,7 +11343,8 @@ KIND, either express or implied. - + + @@ -12270,7 +11366,8 @@ KIND, either express or implied. - + + @@ -12286,13 +11383,15 @@ KIND, either express or implied. - + + - + + @@ -12304,7 +11403,8 @@ KIND, either express or implied. - + + @@ -12356,7 +11456,8 @@ KIND, either express or implied. - + + @@ -12406,7 +11507,8 @@ KIND, either express or implied. - + + @@ -12448,7 +11550,8 @@ KIND, either express or implied. - + + @@ -12472,13 +11575,15 @@ KIND, either express or implied. - + + - + + @@ -12486,19 +11591,22 @@ KIND, either express or implied. - + + - + + - + + @@ -12506,7 +11614,8 @@ KIND, either express or implied. - + + @@ -12514,7 +11623,8 @@ KIND, either express or implied. - + + @@ -12528,7 +11638,8 @@ KIND, either express or implied. - + + @@ -12552,7 +11663,8 @@ KIND, either express or implied. - + + @@ -12572,7 +11684,8 @@ KIND, either express or implied. - + + @@ -12582,7 +11695,8 @@ KIND, either express or implied. - + + @@ -12592,7 +11706,8 @@ KIND, either express or implied. - + + @@ -12690,7 +11805,8 @@ KIND, either express or implied. - + + @@ -12756,7 +11872,8 @@ KIND, either express or implied. - + + @@ -12776,13 +11893,15 @@ KIND, either express or implied. - + + - + + @@ -12792,7 +11911,8 @@ KIND, either express or implied. - + + @@ -12802,7 +11922,8 @@ KIND, either express or implied. - + + @@ -12812,7 +11933,8 @@ KIND, either express or implied. - + + @@ -12822,17 +11944,13 @@ KIND, either express or implied. - - - - - - - - - - - + + + + + + + @@ -12881,10 +11999,12 @@ KIND, either express or implied. - + - - + + + + @@ -12906,7 +12026,8 @@ KIND, either express or implied. - + + @@ -12936,7 +12057,8 @@ KIND, either express or implied. - + + @@ -12950,7 +12072,8 @@ KIND, either express or implied. - + + @@ -12990,7 +12113,8 @@ KIND, either express or implied. - + + @@ -13010,7 +12134,8 @@ KIND, either express or implied. - + + @@ -13042,7 +12167,8 @@ KIND, either express or implied. - + + @@ -13050,7 +12176,8 @@ KIND, either express or implied. - + + @@ -13062,7 +12189,8 @@ KIND, either express or implied. - + + @@ -13070,7 +12198,8 @@ KIND, either express or implied. - + + diff --git a/utils/regtools/desc_parser.cpp b/utils/regtools/desc_parser.cpp deleted file mode 100644 index 940a619f5c..0000000000 --- a/utils/regtools/desc_parser.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Amaury Pouly - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#include "desc_parser.hpp" -#include -#include -#include -#include - -#define XML_CHAR_TO_CHAR(s) ((const char *)(s)) - -#define BEGIN_ATTR_MATCH(attr) \ - for(xmlAttr *a = attr; a; a = a->next) { - -#define MATCH_X_ATTR(attr_name, hook, ...) \ - if(strcmp(XML_CHAR_TO_CHAR(a->name), attr_name) == 0) { \ - std::string s; \ - if(!parse_text_attr(a, s) || !hook(s, __VA_ARGS__)) \ - return false; \ - } - -#define SOFT_MATCH_X_ATTR(attr_name, hook, ...) \ - if(strcmp(XML_CHAR_TO_CHAR(a->name), attr_name) == 0) { \ - std::string s; \ - if(parse_text_attr(a, s)) \ - hook(s, __VA_ARGS__); \ - } - -#define SOFT_MATCH_SCT_ATTR(attr_name, var) \ - SOFT_MATCH_X_ATTR(attr_name, validate_sct_hook, var) - -#define MATCH_TEXT_ATTR(attr_name, var) \ - MATCH_X_ATTR(attr_name, validate_string_hook, var) - -#define MATCH_UINT32_ATTR(attr_name, var) \ - MATCH_X_ATTR(attr_name, validate_uint32_hook, var) - -#define MATCH_BITRANGE_ATTR(attr_name, first, last) \ - MATCH_X_ATTR(attr_name, validate_bitrange_hook, first, last) - -#define END_ATTR_MATCH() \ - } - -#define BEGIN_NODE_MATCH(node) \ - for(xmlNode *sub = node; sub; sub = sub->next) { - -#define MATCH_ELEM_NODE(node_name, array, parse_fn) \ - if(sub->type == XML_ELEMENT_NODE && strcmp(XML_CHAR_TO_CHAR(sub->name), node_name) == 0) { \ - array.resize(array.size() + 1); \ - if(!parse_fn(sub, array[array.size() - 1])) \ - return false; \ - } - -#define SOFT_MATCH_ELEM_NODE(node_name, array, parse_fn) \ - if(sub->type == XML_ELEMENT_NODE && strcmp(XML_CHAR_TO_CHAR(sub->name), node_name) == 0) { \ - array.resize(array.size() + 1); \ - if(!parse_fn(sub, array[array.size() - 1])) \ - array.pop_back(); \ - } - -#define END_NODE_MATCH() \ - } - -bool validate_string_hook(const std::string& str, std::string& s) -{ - s = str; - return true; -} - -bool validate_sct_hook(const std::string& str, soc_reg_flags_t& flags) -{ - if(str == "yes") flags |= REG_HAS_SCT; - else if(str != "no") return false; - return true; -} - -bool validate_unsigned_long_hook(const std::string& str, unsigned long& s) -{ - char *end; - s = strtoul(str.c_str(), &end, 0); - return *end == 0; -} - -bool validate_uint32_hook(const std::string& str, uint32_t& s) -{ - unsigned long u; - if(!validate_unsigned_long_hook(str, u)) return false; -#if ULONG_MAX > UINT32_MAX - if(u > UINT32_MAX) return false; -#endif - s = u; - return true; -} - -bool validate_bitrange_hook(const std::string& str, unsigned& first, unsigned& last) -{ - unsigned long a, b; - size_t sep = str.find(':'); - if(sep == std::string::npos) return false; - if(!validate_unsigned_long_hook(str.substr(0, sep), a)) return false; - if(!validate_unsigned_long_hook(str.substr(sep + 1), b)) return false; - if(a > 31 || b > 31 || a < b) return false; - first = b; - last = a; - return true; -} - -bool parse_text_attr(xmlAttr *attr, std::string& s) -{ - if(attr->children != attr->last) - return false; - if(attr->children->type != XML_TEXT_NODE) - return false; - s = XML_CHAR_TO_CHAR(attr->children->content); - return true; -} - -bool parse_value_elem(xmlNode *node, soc_reg_field_value_t& value) -{ - BEGIN_ATTR_MATCH(node->properties) - MATCH_TEXT_ATTR("name", value.name) - MATCH_UINT32_ATTR("value", value.value) - END_ATTR_MATCH() - - return true; -} - -bool parse_field_elem(xmlNode *node, soc_reg_field_t& field) -{ - BEGIN_ATTR_MATCH(node->properties) - MATCH_TEXT_ATTR("name", field.name) - MATCH_BITRANGE_ATTR("bitrange", field.first_bit, field.last_bit) - END_ATTR_MATCH() - - BEGIN_NODE_MATCH(node->children) - SOFT_MATCH_ELEM_NODE("value", field.values, parse_value_elem) - END_NODE_MATCH() - - return true; -} - -bool parse_reg_elem(xmlNode *node, soc_reg_t& reg) -{ - BEGIN_ATTR_MATCH(node->properties) - MATCH_TEXT_ATTR("name", reg.name) - MATCH_UINT32_ATTR("addr", reg.addr) - SOFT_MATCH_SCT_ATTR("sct", reg.flags) - END_ATTR_MATCH() - - BEGIN_NODE_MATCH(node->children) - MATCH_ELEM_NODE("field", reg.fields, parse_field_elem) - END_NODE_MATCH() - - return true; -} - -bool parse_multireg_elem(xmlNode *node, soc_multireg_t& mreg) -{ - BEGIN_ATTR_MATCH(node->properties) - MATCH_TEXT_ATTR("name", mreg.name) - MATCH_UINT32_ATTR("base", mreg.base) - MATCH_UINT32_ATTR("count", mreg.count) - MATCH_UINT32_ATTR("offset", mreg.offset) - SOFT_MATCH_SCT_ATTR("sct", mreg.flags) - END_ATTR_MATCH() - - BEGIN_NODE_MATCH(node->children) - MATCH_ELEM_NODE("reg", mreg.regs, parse_reg_elem) - MATCH_ELEM_NODE("field", mreg.fields, parse_field_elem) - END_NODE_MATCH() - - return true; -} - -bool parse_dev_elem(xmlNode *node, soc_dev_t& dev) -{ - BEGIN_ATTR_MATCH(node->properties) - MATCH_TEXT_ATTR("name", dev.name) - MATCH_UINT32_ATTR("addr", dev.addr) - MATCH_TEXT_ATTR("long_name", dev.long_name) - MATCH_TEXT_ATTR("desc", dev.desc) - END_ATTR_MATCH() - - BEGIN_NODE_MATCH(node->children) - MATCH_ELEM_NODE("multireg", dev.multiregs, parse_multireg_elem) - MATCH_ELEM_NODE("reg", dev.regs, parse_reg_elem) - END_NODE_MATCH() - - return true; -} - -bool parse_multidev_elem(xmlNode *node, soc_multidev_t& dev) -{ - BEGIN_ATTR_MATCH(node->properties) - MATCH_TEXT_ATTR("name", dev.name) - MATCH_TEXT_ATTR("long_name", dev.long_name) - MATCH_TEXT_ATTR("desc", dev.desc) - END_ATTR_MATCH() - - BEGIN_NODE_MATCH(node->children) - MATCH_ELEM_NODE("dev", dev.devs, parse_dev_elem) - MATCH_ELEM_NODE("multireg", dev.multiregs, parse_multireg_elem) - MATCH_ELEM_NODE("reg", dev.regs, parse_reg_elem) - END_NODE_MATCH() - - return true; -} - -bool parse_soc_elem(xmlNode *node, soc_t& soc) -{ - BEGIN_ATTR_MATCH(node->properties) - MATCH_TEXT_ATTR("name", soc.name) - MATCH_TEXT_ATTR("desc", soc.desc) - END_ATTR_MATCH() - - BEGIN_NODE_MATCH(node->children) - MATCH_ELEM_NODE("dev", soc.devs, parse_dev_elem) - MATCH_ELEM_NODE("multidev", soc.multidevs, parse_multidev_elem) - END_NODE_MATCH() - - return true; -} - -bool parse_root_elem(xmlNode *node, std::vector< soc_t >& socs) -{ - BEGIN_NODE_MATCH(node) - MATCH_ELEM_NODE("soc", socs, parse_soc_elem) - END_NODE_MATCH() - return true; -} - -bool parse_soc_desc(const std::string& filename, std::vector< soc_t >& socs) -{ - LIBXML_TEST_VERSION - - xmlDoc *doc = xmlReadFile(filename.c_str(), NULL, 0); - if(doc == NULL) - return false; - - xmlNode *root_element = xmlDocGetRootElement(doc); - - bool ret = parse_root_elem(root_element, socs); - - xmlFreeDoc(doc); - xmlCleanupParser(); - - return ret; -} \ No newline at end of file diff --git a/utils/regtools/desc_parser.hpp b/utils/regtools/desc_parser.hpp deleted file mode 100644 index 908cff8940..0000000000 --- a/utils/regtools/desc_parser.hpp +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Amaury Pouly - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef __DESC_PARSER__ -#define __DESC_PARSER__ - -#include -#include -#include - -typedef uint32_t soc_addr_t; -typedef uint32_t soc_word_t; -typedef uint32_t soc_reg_flags_t; - -const soc_addr_t SOC_NO_ADDR = 0xffffffff; -const soc_reg_flags_t REG_HAS_SCT = 1 << 0; - -struct soc_reg_field_value_t -{ - std::string name; - soc_word_t value; -}; - -struct soc_reg_field_t -{ - std::string name; - unsigned first_bit, last_bit; - - soc_word_t bitmask() const - { - return ((1 << (last_bit - first_bit + 1)) - 1) << first_bit; - } - - std::vector< soc_reg_field_value_t > values; -}; - -struct soc_reg_t -{ - std::string name; - soc_addr_t addr; - soc_reg_flags_t flags; - - std::vector< soc_reg_field_t > fields; -}; - -struct soc_multireg_t -{ - std::string name; - soc_addr_t base; - unsigned count; - soc_addr_t offset; - soc_reg_flags_t flags; - - std::vector< soc_reg_t > regs; - std::vector< soc_reg_field_t > fields; -}; - -struct soc_dev_t -{ - std::string name; - std::string long_name; - std::string desc; - soc_addr_t addr; - - std::vector< soc_multireg_t > multiregs; - std::vector< soc_reg_t > regs; -}; - -struct soc_multidev_t -{ - std::string name; - std::string long_name; - std::string desc; - - std::vector< soc_dev_t > devs; - std::vector< soc_multireg_t > multiregs; - std::vector< soc_reg_t > regs; -}; - -struct soc_t -{ - std::string name; - std::string desc; - - std::vector< soc_dev_t > devs; - std::vector< soc_multidev_t > multidevs; -}; - -bool parse_soc_desc(const std::string& filename, std::vector< soc_t >& soc); - -#endif /* __DESC_PARSER__ */ \ No newline at end of file diff --git a/utils/regtools/headergen.cpp b/utils/regtools/headergen.cpp index b6905363d8..fc1ce6fba6 100644 --- a/utils/regtools/headergen.cpp +++ b/utils/regtools/headergen.cpp @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Copyright (C) 2002 by Amaury Pouly + * Copyright (C) 2013 by Amaury Pouly * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -18,22 +18,26 @@ * KIND, either express or implied. * ****************************************************************************/ -#include "desc_parser.hpp" +#include "soc_desc.hpp" #include #include #include #include +#include +#include +#include + +#define HEADERGEN_VERSION "2.1.7" #define error(...) do{ fprintf(stderr, __VA_ARGS__); exit(1); } while(0) std::string g_soc_name; std::string g_soc_dev; std::string g_soc_reg; +std::string g_soc_field; std::string g_soc_dev_regs_base; -std::string g_soc_dev_reg_core_name; namespace { - std::string tolower(const std::string s) { std::string res = s; @@ -47,11 +51,32 @@ std::string toupper(const std::string& s) std::transform(res.begin(), res.end(), res.begin(), ::toupper); return res; } +} + +template< typename T > +std::string to_str(const T& v) +{ + std::ostringstream oss; + oss << v; + return oss.str(); +} +template< typename T > +std::string to_hex(const T& v) +{ + std::ostringstream oss; + oss << std::hex << v; + return oss.str(); } -void fprint_copyright(FILE *f) +typedef std::pair< std::string, std::string > xml_ver_t; + +void fprint_copyright(FILE *f, const std::vector< xml_ver_t >& versions) { + std::ostringstream ver; + for(size_t i = 0; i < versions.size(); i++) + ver << " " << versions[i].first << ":" << versions[i].second; + fprintf(f,"\ /***************************************************************************\n\ * __________ __ ___.\n\ @@ -61,8 +86,10 @@ void fprint_copyright(FILE *f) * Firmware |____|_ /\\____/ \\___ >__|_ \\|___ /\\____/__/\\_ \\\n\ * \\/ \\/ \\/ \\/ \\/\n\ * This file was automatically generated by headergen, DO NOT EDIT it.\n\ + * headergen version: " HEADERGEN_VERSION "\n\ + * XML versions:%s\n\ *\n\ - * Copyright (C) 2012 by Amaury Pouly\n\ + * Copyright (C) 2013 by Amaury Pouly\n\ *\n\ * This program is free software; you can redistribute it and/or\n\ * modify it under the terms of the GNU General Public License\n\ @@ -72,7 +99,13 @@ void fprint_copyright(FILE *f) * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n\ * KIND, either express or implied.\n\ *\n\ - ****************************************************************************/\n"); + ****************************************************************************/\n", +ver.str().c_str()); +} + +void fprint_copyright(FILE *f, const xml_ver_t& version) +{ + fprint_copyright(f, std::vector< xml_ver_t >(1, version)); } void fprint_include_guard_ex(FILE *f, bool begin, const std::string& name) @@ -81,7 +114,6 @@ void fprint_include_guard_ex(FILE *f, bool begin, const std::string& name) { fprintf(f, "#ifndef %s\n", name.c_str()); fprintf(f, "#define %s\n", name.c_str()); - fprintf(f, "\n#include \"imx233.h\"\n"); } else fprintf(f, "#endif /* %s */\n", name.c_str()); @@ -89,108 +121,188 @@ void fprint_include_guard_ex(FILE *f, bool begin, const std::string& name) void fprint_include_guard(FILE *f, bool begin) { - std::string name = "__" + toupper(g_soc_name) + "__" + toupper(g_soc_dev) + std::string name = "__HEADERGEN__" + toupper(g_soc_name) + "__" + toupper(g_soc_dev) + "__H__"; fprint_include_guard_ex(f, begin, name); } -void fprint_fields(FILE *f, const std::vector< soc_reg_field_t >& fields) +struct define_align_context_t { - for(size_t i = 0; i < fields.size(); i++) + define_align_context_t():m_max_name(0) {} + void add(const std::string& name, const std::string& val) { - fprintf(f, "#define BM_%s_%s %#x\n", g_soc_dev_reg_core_name.c_str(), - fields[i].name.c_str(), fields[i].bitmask()); - fprintf(f, "#define BP_%s_%s %d\n", g_soc_dev_reg_core_name.c_str(), - fields[i].name.c_str(), fields[i].first_bit); - fprintf(f, "#define BF_%s_%s(v) (((v) << %d) & %#x)\n", - g_soc_dev_reg_core_name.c_str(), fields[i].name.c_str(), - fields[i].first_bit, fields[i].bitmask()); - if(fields[i].values.size() > 0) - { - fprintf(f, "#define BF_%s_%s_V(sym) ((BV_%s_%s__##sym << %d) & %#x)\n", - g_soc_dev_reg_core_name.c_str(), fields[i].name.c_str(), - g_soc_dev_reg_core_name.c_str(), fields[i].name.c_str(), - fields[i].first_bit, fields[i].bitmask()); - } - for(size_t j = 0; j < fields[i].values.size(); j++) + m_lines.push_back(std::make_pair(name, val)); + m_max_name = std::max(m_max_name, name.size()); + } + + void print(FILE *f) + { + std::string define = "#define "; + size_t align = define.size() + m_max_name + 1; + align = ((align + 3) / 4) * 4; + + for(size_t i = 0; i < m_lines.size(); i++) { - fprintf(f, "#define BV_%s_%s__%s %#x\n", g_soc_dev_reg_core_name.c_str(), - fields[i].name.c_str(), fields[i].values[j].name.c_str(), - fields[i].values[j].value); + std::string name = m_lines[i].first; + name.insert(name.end(), align - define.size() - name.size(), ' '); + fprintf(f, "%s%s%s\n", define.c_str(), name.c_str(), m_lines[i].second.c_str()); } } + + size_t m_max_name; + std::vector< std::pair< std::string, std::string > > m_lines; +}; + +void gen_soc_field(define_align_context_t& ctx, bool multidev, bool multireg, const soc_reg_field_t& field) +{ + std::string prefix = g_soc_dev + "_" + g_soc_reg + "_" + g_soc_field; + ctx.add("BP_" + prefix, to_str(field.first_bit)); + ctx.add("BM_" + prefix, "0x" + to_hex(field.bitmask())); + + for(size_t i = 0; i < field.value.size(); i++) + ctx.add("BV_" + prefix + "__" + field.value[i].name, "0x" + to_hex(field.value[i].value)); + + ctx.add("BF_" + prefix + "(v)", "(((v) << " + to_str(field.first_bit) + ") & 0x" + to_hex(field.bitmask()) + ")"); + + if(field.value.size() > 0) + ctx.add("BF_" + prefix + "_V(v)", "((BV_" + prefix + "__##v" + " << " + to_str(field.first_bit) + ") & 0x" + to_hex(field.bitmask()) + ")"); } -void fprint_reg(FILE *f, const soc_reg_t& reg) +void gen_soc_reg(FILE *f, bool multidev, const soc_reg_t& reg) { - g_soc_dev_reg_core_name = toupper(g_soc_dev) + "_" + toupper(reg.name); + bool multireg = reg.addr.size() > 1; - fprintf(f, "#define RA_%s %#x\n", g_soc_dev_reg_core_name.c_str(), reg.addr); - fprintf(f, "#define HW_%s HW_REG(%s, %s)\n", g_soc_dev_reg_core_name.c_str(), - toupper(g_soc_dev).c_str(), toupper(reg.name).c_str()); - if(reg.flags & REG_HAS_SCT) + static const char *suffix[] = {"", "_SET", "_CLR", "_TOG"}; + bool sct = !!(reg.flags & REG_HAS_SCT); + + fprintf(f, "/**\n"); + fprintf(f, " * Register: HW_%s_%s\n", g_soc_dev.c_str(), g_soc_reg.c_str()); + fprintf(f, " * Address:"); + if(multireg && reg.formula.type == REG_FORMULA_STRING) { - fprintf(f, "#define HW_%s_SET HW_SET(%s, %s)\n", g_soc_dev_reg_core_name.c_str(), - toupper(g_soc_dev).c_str(), toupper(reg.name).c_str()); - fprintf(f, "#define HW_%s_CLR HW_CLR(%s, %s)\n", g_soc_dev_reg_core_name.c_str(), - toupper(g_soc_dev).c_str(), toupper(reg.name).c_str()); - fprintf(f, "#define HW_%s_TOG HW_TOG(%s, %s)\n", g_soc_dev_reg_core_name.c_str(), - toupper(g_soc_dev).c_str(), toupper(reg.name).c_str()); + fprintf(f, " %s\n", reg.formula.string.c_str()); } - fprint_fields(f, reg.fields); - fprintf(f, "\n"); -} + else + { + for(size_t i = 0; i < reg.addr.size(); i++) + fprintf(f, " %#x", reg.addr[i].addr); + fprintf(f, "\n"); + } + fprintf(f, " * SCT: %s\n", sct ? "yes" : "no"); -void fprint_mreg(FILE *f, const soc_multireg_t& mreg) -{ + fprintf(f, "*/\n"); + + define_align_context_t ctx; + + for(int i = 0; i < (sct ? 4 : 1); i++) + { + std::ostringstream name; + name << "HW_" << g_soc_dev << "_" << g_soc_reg << suffix[i]; + if(multidev || multireg) + { + name << "("; + if(multidev) + name << "d"; + if(multidev && multireg) + name << ","; + if(multireg) + name << "n"; + name << ")"; + } + std::ostringstream value; + value << "(*(volatile unsigned long *)(" << g_soc_dev_regs_base; + if(multidev) + value << "(d)"; + value << " + "; + if(multireg) + { + if(reg.formula.type != REG_FORMULA_STRING) + printf("Warning: register HW_%s_%s has no formula !\n", g_soc_dev.c_str(), g_soc_reg.c_str()); + std::string formula = reg.formula.string.c_str(); + size_t pos = formula.find("n"); + while(pos != std::string::npos) + { + formula.replace(pos, 1, "(n)"); + pos = formula.find("n", pos + 2); + } + value << formula; + } + else + value << "0x" << std::hex << reg.addr[0].addr; + + if(sct) + value << " + 0x" << std::hex << (i * 4); + value << "))"; + + ctx.add(name.str(), value.str()); + } + + for(size_t i = 0; i < reg.field.size(); i++) + { + g_soc_field = reg.field[i].name; + gen_soc_field(ctx, multidev, multireg, reg.field[i]); + } + + ctx.print(f); + + fprintf(f, "\n"); } -void gen_dev_header(const std::string& filename, const soc_dev_t& dev) +void gen_soc_dev_header(const std::string& filename, const xml_ver_t& ver, const soc_dev_t& dev) { - g_soc_dev = dev.name; - printf(" Generate header for device %s: write to %s\n", dev.name.c_str(), - filename.c_str()); + /* + printf("Generate headers for soc %s, dev %s: use file %s\n", g_soc_name.c_str(), + g_soc_dev.c_str(), filename.c_str()); + */ FILE *f = fopen(filename.c_str(), "w"); if(f == NULL) - error("Cannot open file %s\n", filename.c_str()); - fprint_copyright(f); + { + printf("Cannot open %s for writing: %m\n", filename.c_str()); + return; + } + fprint_copyright(f, ver); fprint_include_guard(f, true); + + /* print base */ fprintf(f, "\n"); - g_soc_dev_regs_base = "RB_" + toupper(dev.name); - fprintf(f, "#define %s %#x\n", g_soc_dev_regs_base.c_str(), dev.addr); - fprintf(f, "\n"); + g_soc_dev_regs_base = "REGS_" + g_soc_dev + "_BASE"; + fprintf(f, "#define %s", g_soc_dev_regs_base.c_str()); - for(size_t i = 0; i < dev.regs.size(); i++) - fprint_reg(f, dev.regs[i]); - for(size_t i = 0; i < dev.multiregs.size(); i++) - fprint_mreg(f, dev.multiregs[i]); + if(dev.addr.size() > 1) + fprintf(f, "(i)"); + fprintf(f, " ("); + for(size_t i = 0; i < dev.addr.size() - 1; i++) + fprintf(f, "(i) == %d ? %#x : ", (int)i + 1, dev.addr[i].addr); + + fprintf(f, "%#x)\n", dev.addr[dev.addr.size() - 1].addr); + + fprintf(f, "\n"); + + /* print version */ + fprintf(f, "#define REGS_%s_VERSION \"%s\"\n\n", g_soc_dev.c_str(), dev.version.c_str()); + + for(size_t i = 0; i < dev.reg.size(); i++) + { + g_soc_reg = dev.reg[i].name; + gen_soc_reg(f, dev.addr.size() > 1, dev.reg[i]); + } + fprint_include_guard(f, false); fclose(f); } -void gen_mdev_header(const std::string& filename, const soc_multidev_t& dev) -{ - g_soc_dev = dev.name; - printf(" Generate header for multi device %s: write to %s\n", dev.name.c_str(), - filename.c_str()); -} - void gen_soc_headers(const std::string& prefix, const soc_t& soc) { - printf("Generate headers for soc %s: use directory %s (must exists)\n", soc.desc.c_str(), + printf("Generate headers for soc %s: use directory %s\n", soc.desc.c_str(), prefix.c_str()); - for(size_t i = 0; i < soc.devs.size(); i++) - { - std::string name = soc.devs[i].name; - name = tolower(name); - gen_dev_header(prefix + "/regs-" + name + ".h", soc.devs[i]); - } - for(size_t i = 0; i < soc.multidevs.size(); i++) + mkdir(prefix.c_str(), 0770); + + for(size_t i = 0; i < soc.dev.size(); i++) { - std::string name = soc.multidevs[i].name; - name = tolower(name); - gen_mdev_header(prefix + "/regs-" + name + ".h", soc.multidevs[i]); + g_soc_dev = soc.dev[i].name; + xml_ver_t ver(soc.name, soc.dev[i].version); + gen_soc_dev_header(prefix + "/regs-" + tolower(g_soc_dev.c_str()) + ".h", ver, soc.dev[i]); } } @@ -203,31 +315,30 @@ void gen_headers(const std::string& prefix, const std::vector< soc_t >& socs) } } -typedef std::map< std::string, std::vector< std::string > > general_dev_list_t; +typedef std::map< std::string, std::vector< std::pair< size_t, size_t > > > general_dev_list_t; general_dev_list_t build_general_dev_list(const std::vector< soc_t >& socs) { general_dev_list_t map; for(size_t i = 0; i < socs.size(); i++) { - for(size_t j = 0; j < socs[i].devs.size(); j++) - map[tolower(socs[i].devs[j].name)].push_back(socs[i].name); - for(size_t j = 0; j < socs[i].multidevs.size(); j++) - map[tolower(socs[i].multidevs[j].name)].push_back(socs[i].name); + for(size_t j = 0; j < socs[i].dev.size(); j++) + map[tolower(socs[i].dev[j].name)].push_back(std::make_pair(i,j)); } return map; } void gen_select_header(const std::string& filename, const std::string& dev, - const std::vector< std::string >& socs) + const std::vector< std::string >& socs, const std::vector< xml_ver_t >& ver) { + /* printf("Generate select header for device %s: write to %s\n", dev.c_str(), filename.c_str()); - + */ std::string guard = "__SELECT__" + toupper(dev) + "__H__"; FILE *f = fopen(filename.c_str(), "w"); if(f == NULL) error("Cannot open file %s\n", filename.c_str()); - fprint_copyright(f); + fprint_copyright(f, ver); fprint_include_guard_ex(f, true, guard); fprintf(f, "\n"); @@ -251,24 +362,38 @@ void gen_selectors(const std::string& prefix, const std::vector< soc_t >& socs) { general_dev_list_t map = build_general_dev_list(socs); for(general_dev_list_t::iterator it = map.begin(); it != map.end(); ++it) - gen_select_header(prefix + "/regs-" + it->first + ".h", it->first, it->second); + { + std::vector< xml_ver_t > ver; + std::vector< std::string > names; + for(size_t i = 0; i < it->second.size(); i++) + { + size_t soc_nr = it->second[i].first; + size_t dev_in_soc_nr = it->second[i].second; + ver.push_back(std::make_pair(socs[soc_nr].name, socs[soc_nr].dev[dev_in_soc_nr].version)); + names.push_back(socs[soc_nr].name); + } + gen_select_header(prefix + "/regs-" + it->first + ".h", it->first, names, ver); + } } void usage() { - printf("usage: headergen \n"); + printf("usage: headergen \n"); exit(1); } int main(int argc, char **argv) { - if(argc != 3) + if(argc < 3) usage(); std::vector< soc_t > socs; - bool ret = parse_soc_desc(argv[1], socs); - printf("parse result: %d\n", ret); - if(!ret) return 1; - gen_headers(argv[2], socs); - gen_selectors(argv[2], socs); + for(int i = 1; i < argc - 1; i++) + if(!soc_desc_parse_xml(argv[i], socs)) + { + printf("Cannot parse %s\n", argv[i]); + return 1; + } + gen_headers(argv[argc - 1], socs); + gen_selectors(argv[argc - 1], socs); return 0; } \ No newline at end of file diff --git a/utils/regtools/hwemulgen.cpp b/utils/regtools/hwemulgen.cpp deleted file mode 100644 index ae8b9dbec5..0000000000 --- a/utils/regtools/hwemulgen.cpp +++ /dev/null @@ -1,387 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Amaury Pouly - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#include "desc_parser.hpp" -#include -#include -#include -#include - -#define error(...) do{ fprintf(stderr, __VA_ARGS__); exit(1); } while(0) - -int g_soc_count; -int g_reg_count; -int g_field_count; - -namespace { - -std::string tolower(const std::string s) -{ - std::string res = s; - std::transform(res.begin(), res.end(), res.begin(), ::tolower); - return res; -} - -std::string toupper(const std::string& s) -{ - std::string res = s; - std::transform(res.begin(), res.end(), res.begin(), ::toupper); - return res; -} - -bool lex_comp(const std::string& a, const std::string& b) -{ - return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end()); -} - -} - -void fprint_copyright(FILE *f) -{ - fprintf(f,"\ -/***************************************************************************\n\ - * __________ __ ___.\n\ - * Open \\______ \\ ____ ____ | | _\\_ |__ _______ ___\n\ - * Source | _// _ \\_/ ___\\| |/ /| __ \\ / _ \\ \\/ /\n\ - * Jukebox | | ( <_> ) \\___| < | \\_\\ ( <_> > < <\n\ - * Firmware |____|_ /\\____/ \\___ >__|_ \\|___ /\\____/__/\\_ \\\n\ - * \\/ \\/ \\/ \\/ \\/\n\ - * This file was automatically generated by hwemulgen, DO NOT EDIT it.\n\ - *\n\ - * Copyright (C) 2012 by Amaury Pouly\n\ - *\n\ - * This program is free software; you can redistribute it and/or\n\ - * modify it under the terms of the GNU General Public License\n\ - * as published by the Free Software Foundation; either version 2\n\ - * of the License, or (at your option) any later version.\n\ - *\n\ - * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY\n\ - * KIND, either express or implied.\n\ - *\n\ - ****************************************************************************/\n"); -} - -void gen_header(const std::string& filename) -{ - FILE *f = fopen(filename.c_str(), "w"); - if(f == NULL) - error("Cannot open file %s\n", filename.c_str()); - fprint_copyright(f); - fprintf(f, "#ifndef __HWEMUL_SOC_HEADER__\n"); - fprintf(f, "#define __HWEMUL_SOC_HEADER__\n"); - fprintf(f, "\n"); - fprintf(f, "#include \"stddef.h\"\n"); - fprintf(f, "#include \"stdint.h\"\n"); - - fprintf(f, "\n\ -#define HWEMUL_SOC_REG_HAS_SCT (1 << 0)\n\ -\n\ -struct hwemul_soc_reg_field_t\n\ -{\n\ - const char *name;\n\ - unsigned short first_bit, last_bit;\n\ -};\n\ -\n\ -struct hwemul_soc_reg_t\n\ -{\n\ - const char *name;\n\ - uint32_t addr;\n\ - uint32_t flags;\n\ - size_t nr_fields;\n\ - struct hwemul_soc_reg_field_t *fields_by_name[]; /* ordered by lexicographic order */\n\ -};\n\ -\n\ -struct hwemul_soc_t\n\ -{\n\ - const char *name;\n\ - size_t nr_regs;\n\ - struct hwemul_soc_reg_t *regs_by_name[]; /* ordered by lexicographic order */\n\ -};\n\ -\n\ -struct hwemul_soc_list_t\n\ -{\n\ - size_t nr_socs;\n\ - struct hwemul_soc_t *socs[];\n\ -};\n\ -\n\ -struct hwemul_soc_list_t *hwemul_get_soc_list(void);\n\ -\n"); - - fprintf(f, "#endif\n"); - fclose(f); -} - -std::string extract_last_part(std::string s) -{ - size_t pos = s.find_last_of("/\\"); - if(pos != std::string::npos) - s = s.substr(pos + 1); - pos = s.find_last_of("."); - if(pos != std::string::npos) - s = s.substr(0, pos); - return s; -} - -std::vector< std::string > gen_fields(FILE *f, std::string prefix, - const std::vector< soc_reg_field_t >& fields) -{ - std::vector< std::string > list; - - for(size_t i = 0; i < fields.size(); i++) - { - g_field_count++; - std::string var_name = prefix + tolower(fields[i].name); - list.push_back(var_name); - - fprintf(f, "\ -static struct hwemul_soc_reg_field_t %s =\n\ -{\n\ - \"%s\",\n\ - %d, %d\n\ -};\n\ -\n", var_name.c_str(), fields[i].name.c_str(), fields[i].first_bit, fields[i].last_bit); - } - - return list; -} - -std::vector< std::string > gen_common_regs(FILE *f, std::string prefix, std::string devname, - soc_addr_t devaddr, const std::vector< soc_reg_t >& regs, - const std::vector< soc_multireg_t >& multiregs) -{ - std::vector< std::string > list; - - for(size_t i = 0; i < regs.size(); i++) - { - g_reg_count++; - std::string var_name = prefix + tolower(regs[i].name); - - list.push_back(var_name); - - std::vector< std::string > field_vars = gen_fields(f, var_name + "_", - regs[i].fields); - - std::sort(field_vars.begin(), field_vars.end(), lex_comp); - - fprintf(f, "\ -static struct hwemul_soc_reg_t %s =\n\ -{\n\ - \"HW_%s_%s\",\n\ - %#x,\n\ - 0", var_name.c_str(), devname.c_str(), regs[i].name.c_str(), devaddr + regs[i].addr); - if(regs[i].flags & REG_HAS_SCT) - fprintf(f, " | HWEMUL_SOC_REG_HAS_SCT"); - fprintf(f, ",\n"); - fprintf(f, "\ - %u,\n\ - {", (unsigned)field_vars.size()); - if(field_vars.size() != 0) - fprintf(f, "\n"); - for(size_t j = 0; j < field_vars.size(); j++) - fprintf(f, " &%s,\n", field_vars[j].c_str()); - if(field_vars.size() != 0) - fprintf(f, " "); - fprintf(f,"\ -}\n};\n\ -\n"); - } - - for(size_t i = 0; i < multiregs.size(); i++) - { - g_reg_count++; - std::vector< std::string > field_vars = gen_fields(f, - prefix + tolower(multiregs[i].name) + "_", multiregs[i].fields); - std::sort(field_vars.begin(), field_vars.end(), lex_comp); - - for(size_t j = 0; j < multiregs[i].regs.size(); j++) - { - g_reg_count++; - std::string var_name = prefix + tolower(multiregs[i].regs[j].name); - - list.push_back(var_name); - - fprintf(f, "\ -static struct hwemul_soc_reg_t %s =\n\ -{\n\ - \"HW_%s_%s\",\n\ - %#x,\n\ - 0", var_name.c_str(), devname.c_str(), multiregs[i].regs[j].name.c_str(), devaddr + multiregs[i].regs[j].addr); - if(multiregs[i].flags & REG_HAS_SCT) - fprintf(f, " | HWEMUL_SOC_REG_HAS_SCT"); - fprintf(f, ",\n"); - fprintf(f,"\ - %u,\n\ - {", (unsigned)field_vars.size()); - if(field_vars.size() != 0) - fprintf(f, "\n"); - for(size_t k = 0; k < field_vars.size(); k++) - fprintf(f, " &%s,\n", field_vars[k].c_str()); - if(field_vars.size() != 0) - fprintf(f, " "); - fprintf(f,"\ -}\n};\n\ -\n"); - } - } - - return list; -} - -std::vector< std::string > gen_dev_regs(FILE *f, std::string prefix, const soc_dev_t& dev) -{ - return gen_common_regs(f, prefix + tolower(dev.name) + "_", dev.name, dev.addr, - dev.regs, dev.multiregs); -} - -std::vector< std::string > gen_multidev_regs(FILE *f, std::string prefix, const soc_multidev_t& mdev) -{ - std::vector< std::string > list; - - for(size_t i = 0; i < mdev.devs.size(); i++) - { - std::vector< std::string > sub_list = gen_common_regs(f, - prefix + tolower(mdev.devs[i].name) + "_", mdev.devs[i].name, - mdev.devs[i].addr, mdev.regs, mdev.multiregs); - list.insert(list.end(), sub_list.begin(), sub_list.end()); - } - - return list; -} - -std::vector< std::string > gen_regs(FILE *f, std::string prefix, const soc_t& soc) -{ - std::vector< std::string > list; - - for(size_t i = 0; i < soc.devs.size(); i++) - { - std::vector< std::string > sub_list = gen_dev_regs(f, - prefix, soc.devs[i]); - list.insert(list.end(), sub_list.begin(), sub_list.end()); - } - - for(size_t i = 0; i < soc.multidevs.size(); i++) - { - std::vector< std::string > sub_list = gen_multidev_regs(f, - prefix, soc.multidevs[i]); - list.insert(list.end(), sub_list.begin(), sub_list.end()); - } - - return list; -} - -std::vector< std::string > gen_socs(FILE *f, std::string prefix, const std::vector< soc_t >& socs) -{ - std::vector< std::string > list; - for(size_t i = 0; i < socs.size(); i++) - { - g_soc_count++; - std::string var_name = prefix + socs[i].name; - list.push_back(var_name); - - std::vector< std::string > reg_vars = gen_regs(f, var_name + "_", socs[i]); - - std::sort(reg_vars.begin(), reg_vars.end(), lex_comp); - - fprintf(f, "\ -static struct hwemul_soc_t %s =\n\ -{\n\ - \"%s\",\n\ - %u,\n\ - {\n", var_name.c_str(), socs[i].name.c_str(), (unsigned)reg_vars.size()); - - for(size_t j = 0; j < reg_vars.size(); j++) - fprintf(f, " &%s,\n", reg_vars[j].c_str()); - fprintf(f, "\ - }\n\ -};\n\ -\n"); - } - - return list; -} - -void gen_impl(const std::string& filename, const std::vector< soc_t >& socs) -{ - FILE *f = fopen(filename.c_str(), "w"); - if(f == NULL) - error("Cannot open file %s\n", filename.c_str()); - fprint_copyright(f); - std::string last_part = extract_last_part(filename); - fprintf(f, "#include \"%s.h\"\n\n", last_part.c_str()); - - std::vector< std::string > socs_var = gen_socs(f, "soc_", socs); - - fprintf(f, "\ -static struct hwemul_soc_list_t hwemul_soc_list =\n\ -{\n\ - %u,\n\ - {", (unsigned) socs_var.size()); - - for(size_t i = 0; i < socs_var.size(); i++) - { - fprintf(f, "&%s", socs_var[i].c_str()); - if(i + 1 != socs_var.size()) - fprintf(f, ", "); - } - fprintf(f, "\ -}\n\ -};\n\ -\n"); - - fprintf(f,"\ -struct hwemul_soc_list_t *hwemul_get_soc_list(void)\n\ -{\n\ - return &hwemul_soc_list;\n\ -}\n\ -\n"); - - fclose(f); -} - -void gen_files(const std::string& output, const std::vector< soc_t >& socs) -{ - gen_header(output + ".h"); - gen_impl(output + ".c", socs); -} - -void usage() -{ - printf("usage: headergen \n"); - exit(1); -} - -int main(int argc, char **argv) -{ - if(argc < 3) - usage(); - std::vector< soc_t > socs; - for(int i = 1; i < argc - 1; i++) - { - bool ret = parse_soc_desc(argv[i], socs); - if(!ret) - { - printf("Cannot parse '%s'\n", argv[i]); - return 1; - } - } - gen_files(argv[argc - 1], socs); - printf("%d socs, %d registers and %d fields dumped!\n", g_soc_count, g_reg_count, g_field_count); - return 0; -} \ No newline at end of file diff --git a/utils/regtools/lib/Makefile b/utils/regtools/lib/Makefile new file mode 100644 index 0000000000..ef8d4c0533 --- /dev/null +++ b/utils/regtools/lib/Makefile @@ -0,0 +1,23 @@ +CC=gcc +CXX=g++ +AR=ar +CFLAGS=-Wall -O2 `xml2-config --cflags` -std=c99 -g -fPIC +CXXFLAGS=-Wall -O2 `xml2-config --cflags` -g -fPIC +LIB=libsocdesc.a +SRC=$(wildcard *.c) +SRCXX=$(wildcard *.cpp) +OBJ=$(SRC:.c=.o) $(SRCXX:.cpp=.o) + +all: $(LIB) $(EXEC) + +%.o: %.c + $(CC) $(CFLAGS) -c -o $@ $< + +%.o: %.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +$(LIB): $(OBJ) + $(AR) rcs $@ $^ + +clean: + rm -rf $(OBJ) $(LIB) \ No newline at end of file diff --git a/utils/regtools/lib/soc_desc.cpp b/utils/regtools/lib/soc_desc.cpp new file mode 100644 index 0000000000..413c30936f --- /dev/null +++ b/utils/regtools/lib/soc_desc.cpp @@ -0,0 +1,268 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2012 by Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "soc_desc.hpp" +#include +#include +#include +#include + +#define XML_CHAR_TO_CHAR(s) ((const char *)(s)) + +#define BEGIN_ATTR_MATCH(attr) \ + for(xmlAttr *a = attr; a; a = a->next) { + +#define MATCH_X_ATTR(attr_name, hook, ...) \ + if(strcmp(XML_CHAR_TO_CHAR(a->name), attr_name) == 0) { \ + std::string s; \ + if(!parse_text_attr(a, s) || !hook(s, __VA_ARGS__)) \ + return false; \ + } + +#define SOFT_MATCH_X_ATTR(attr_name, hook, ...) \ + if(strcmp(XML_CHAR_TO_CHAR(a->name), attr_name) == 0) { \ + std::string s; \ + if(parse_text_attr(a, s)) \ + hook(s, __VA_ARGS__); \ + } + +#define SOFT_MATCH_SCT_ATTR(attr_name, var) \ + SOFT_MATCH_X_ATTR(attr_name, validate_sct_hook, var) + +#define MATCH_TEXT_ATTR(attr_name, var) \ + MATCH_X_ATTR(attr_name, validate_string_hook, var) + +#define MATCH_UINT32_ATTR(attr_name, var) \ + MATCH_X_ATTR(attr_name, validate_uint32_hook, var) + +#define MATCH_BITRANGE_ATTR(attr_name, first, last) \ + MATCH_X_ATTR(attr_name, validate_bitrange_hook, first, last) + +#define END_ATTR_MATCH() \ + } + +#define BEGIN_NODE_MATCH(node) \ + for(xmlNode *sub = node; sub; sub = sub->next) { + +#define MATCH_ELEM_NODE(node_name, array, parse_fn) \ + if(sub->type == XML_ELEMENT_NODE && strcmp(XML_CHAR_TO_CHAR(sub->name), node_name) == 0) { \ + array.resize(array.size() + 1); \ + if(!parse_fn(sub, array[array.size() - 1])) \ + return false; \ + } + +#define SOFT_MATCH_ELEM_NODE(node_name, array, parse_fn) \ + if(sub->type == XML_ELEMENT_NODE && strcmp(XML_CHAR_TO_CHAR(sub->name), node_name) == 0) { \ + array.resize(array.size() + 1); \ + if(!parse_fn(sub, array[array.size() - 1])) \ + array.pop_back(); \ + } + +#define END_NODE_MATCH() \ + } + +bool validate_string_hook(const std::string& str, std::string& s) +{ + s = str; + return true; +} + +bool validate_sct_hook(const std::string& str, soc_reg_flags_t& flags) +{ + if(str == "yes") flags |= REG_HAS_SCT; + else if(str != "no") return false; + return true; +} + +bool validate_unsigned_long_hook(const std::string& str, unsigned long& s) +{ + char *end; + s = strtoul(str.c_str(), &end, 0); + return *end == 0; +} + +bool validate_uint32_hook(const std::string& str, uint32_t& s) +{ + unsigned long u; + if(!validate_unsigned_long_hook(str, u)) return false; +#if ULONG_MAX > UINT32_MAX + if(u > UINT32_MAX) return false; +#endif + s = u; + return true; +} + +bool validate_bitrange_hook(const std::string& str, unsigned& first, unsigned& last) +{ + unsigned long a, b; + size_t sep = str.find(':'); + if(sep == std::string::npos) return false; + if(!validate_unsigned_long_hook(str.substr(0, sep), a)) return false; + if(!validate_unsigned_long_hook(str.substr(sep + 1), b)) return false; + if(a > 31 || b > 31 || a < b) return false; + first = b; + last = a; + return true; +} + +bool parse_text_attr(xmlAttr *attr, std::string& s) +{ + if(attr->children != attr->last) + return false; + if(attr->children->type != XML_TEXT_NODE) + return false; + s = XML_CHAR_TO_CHAR(attr->children->content); + return true; +} + +bool parse_value_elem(xmlNode *node, soc_reg_field_value_t& value) +{ + BEGIN_ATTR_MATCH(node->properties) + MATCH_TEXT_ATTR("name", value.name) + MATCH_UINT32_ATTR("value", value.value) + END_ATTR_MATCH() + + return true; +} + +bool parse_field_elem(xmlNode *node, soc_reg_field_t& field) +{ + BEGIN_ATTR_MATCH(node->properties) + MATCH_TEXT_ATTR("name", field.name) + MATCH_BITRANGE_ATTR("bitrange", field.first_bit, field.last_bit) + END_ATTR_MATCH() + + BEGIN_NODE_MATCH(node->children) + SOFT_MATCH_ELEM_NODE("value", field.value, parse_value_elem) + END_NODE_MATCH() + + return true; +} + +bool parse_reg_addr_elem(xmlNode *node, soc_reg_addr_t& addr) +{ + BEGIN_ATTR_MATCH(node->properties) + MATCH_TEXT_ATTR("name", addr.name) + MATCH_UINT32_ATTR("addr", addr.addr) + END_ATTR_MATCH() + + return true; +} + +bool parse_reg_formula_elem(xmlNode *node, soc_reg_formula_t& formula) +{ + BEGIN_ATTR_MATCH(node->properties) + MATCH_TEXT_ATTR("string", formula.string) + END_ATTR_MATCH() + + formula.type = REG_FORMULA_STRING; + + return true; +} + +bool parse_reg_elem(xmlNode *node, soc_reg_t& reg) +{ + std::vector< soc_reg_formula_t > formulas; + BEGIN_ATTR_MATCH(node->properties) + MATCH_TEXT_ATTR("name", reg.name) + SOFT_MATCH_SCT_ATTR("sct", reg.flags) + END_ATTR_MATCH() + + BEGIN_NODE_MATCH(node->children) + MATCH_ELEM_NODE("addr", reg.addr, parse_reg_addr_elem) + MATCH_ELEM_NODE("formula", formulas, parse_reg_formula_elem) + MATCH_ELEM_NODE("field", reg.field, parse_field_elem) + END_NODE_MATCH() + + if(formulas.size() > 1) + { + fprintf(stderr, "Only one formula is allowed per register\n"); + return false; + } + if(formulas.size() == 1) + reg.formula = formulas[0]; + + return true; +} + +bool parse_dev_addr_elem(xmlNode *node, soc_dev_addr_t& addr) +{ + BEGIN_ATTR_MATCH(node->properties) + MATCH_TEXT_ATTR("name", addr.name) + MATCH_UINT32_ATTR("addr", addr.addr) + END_ATTR_MATCH() + + return true; +} + +bool parse_dev_elem(xmlNode *node, soc_dev_t& dev) +{ + BEGIN_ATTR_MATCH(node->properties) + MATCH_TEXT_ATTR("name", dev.name) + MATCH_TEXT_ATTR("version", dev.version) + END_ATTR_MATCH() + + BEGIN_NODE_MATCH(node->children) + MATCH_ELEM_NODE("addr", dev.addr, parse_dev_addr_elem) + MATCH_ELEM_NODE("reg", dev.reg, parse_reg_elem) + END_NODE_MATCH() + + return true; +} + +bool parse_soc_elem(xmlNode *node, soc_t& soc) +{ + BEGIN_ATTR_MATCH(node->properties) + MATCH_TEXT_ATTR("name", soc.name) + MATCH_TEXT_ATTR("desc", soc.desc) + END_ATTR_MATCH() + + BEGIN_NODE_MATCH(node->children) + MATCH_ELEM_NODE("dev", soc.dev, parse_dev_elem) + END_NODE_MATCH() + + return true; +} + +bool parse_root_elem(xmlNode *node, std::vector< soc_t >& soc) +{ + BEGIN_NODE_MATCH(node) + MATCH_ELEM_NODE("soc", soc, parse_soc_elem) + END_NODE_MATCH() + return true; +} + +bool soc_desc_parse_xml(const std::string& filename, std::vector< soc_t >& socs) +{ + LIBXML_TEST_VERSION + + xmlDoc *doc = xmlReadFile(filename.c_str(), NULL, 0); + if(doc == NULL) + return false; + + xmlNode *root_element = xmlDocGetRootElement(doc); + + bool ret = parse_root_elem(root_element, socs); + + xmlFreeDoc(doc); + xmlCleanupParser(); + + return ret; +} \ No newline at end of file diff --git a/utils/regtools/lib/soc_desc.hpp b/utils/regtools/lib/soc_desc.hpp new file mode 100644 index 0000000000..476ea1d242 --- /dev/null +++ b/utils/regtools/lib/soc_desc.hpp @@ -0,0 +1,147 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2012 by Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef __SOC_DESC__ +#define __SOC_DESC__ + +#include +#include +#include + +/** + * These data structures represent the SoC register in a convenient way. + * The basic structure is the following: + * - each SoC has several devices + * - each device has a generic name, a list of {name,address} and several registers + * - each register has a generic name, a list of {name,address}, flags, + * several fields + * - each field has a name, a first and last bit position, can apply either + * to all addresses of a register or be specific to one only and has several values + * - each field value has a name and a value + * + * All addresses, values and names are relative to the parents. For example a field + * value BV_LCDIF_CTRL_WORD_LENGTH_18_BIT is represented has: + * - device LCDIF, register CTRL, field WORD_LENGTH, value 16_BIT + * The address of CTRL is related to the address of LCDIF, the value of 16_BIT + * ignores the position of the WORD_LENGTH field in the register. + */ + +/** + * Typedef for SoC types: word, address and flags */ +typedef uint32_t soc_addr_t; +typedef uint32_t soc_word_t; +typedef uint32_t soc_reg_flags_t; + +/** SoC register generic formula */ +enum soc_reg_formula_type_t +{ + REG_FORMULA_NONE, /// register has no generic formula + REG_FORMULA_STRING, /// register has a generic formula represented by a string +}; + +/** . values */ +const soc_reg_flags_t REG_HAS_SCT = 1 << 0; /// register SCT variants + +/** SoC register field named value */ +struct soc_reg_field_value_t +{ + std::string name; + soc_word_t value; +}; + +/** SoC register field */ +struct soc_reg_field_t +{ + std::string name; + unsigned first_bit, last_bit; + + soc_word_t bitmask() const + { + // WARNING beware of the case where first_bit=0 and last_bit=31 + if(first_bit == 0 && last_bit == 31) + return 0xffffffff; + else + return ((1 << (last_bit - first_bit + 1)) - 1) << first_bit; + } + + bool is_reserved() const + { + return name.substr(0, 4) == "RSVD" || name.substr(0, 5) == "RSRVD"; + } + + std::vector< soc_reg_field_value_t > value; +}; + +/** SoC register address */ +struct soc_reg_addr_t +{ + std::string name; /// actual register name + soc_addr_t addr; +}; + +/** SoC register formula */ +struct soc_reg_formula_t +{ + enum soc_reg_formula_type_t type; + std::string string; /// for STRING +}; + +/** SoC register */ +struct soc_reg_t +{ + std::string name; /// generic name (for multi registers) or actual name + std::vector< soc_reg_addr_t > addr; + soc_reg_formula_t formula; + soc_reg_flags_t flags; /// ORed value + + std::vector< soc_reg_field_t > field; +}; + +/** Soc device address */ +struct soc_dev_addr_t +{ + std::string name; /// actual device name + soc_addr_t addr; +}; + +/** SoC device */ +struct soc_dev_t +{ + std::string name; /// generic name (of multi devices) or actual name + std::string version; /// description version + std::vector< soc_dev_addr_t > addr; + + std::vector< soc_reg_t > reg; +}; + +/** SoC */ +struct soc_t +{ + std::string name; /// codename (rockbox) + std::string desc; /// SoC name + + std::vector< soc_dev_t > dev; +}; + +/** Parse a SoC description from a XML file, append it to . A file + * can contain multiple SoC descriptions */ +bool soc_desc_parse_xml(const std::string& filename, std::vector< soc_t >& soc); + +#endif /* __SOC_DESC__ */ \ No newline at end of file diff --git a/utils/regtools/tester.cpp b/utils/regtools/tester.cpp index a46d310f2a..1fa21c6894 100644 --- a/utils/regtools/tester.cpp +++ b/utils/regtools/tester.cpp @@ -7,7 +7,7 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Copyright (C) 2002 by Amaury Pouly + * Copyright (C) 2012 by Amaury Pouly * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -18,7 +18,7 @@ * KIND, either express or implied. * ****************************************************************************/ -#include "desc_parser.hpp" +#include "soc_desc.hpp" #include #include @@ -31,8 +31,8 @@ void print_field_desc(const soc_reg_field_t& field) { printf(" FIELD %s (%d:%d)\n", field.name.c_str(), field.last_bit, field.first_bit); - for(size_t i = 0; i < field.values.size(); i++) - print_value_desc(field.values[i]); + for(size_t i = 0; i < field.value.size(); i++) + print_value_desc(field.value[i]); } std::string compute_sct(soc_reg_flags_t f) @@ -41,69 +41,40 @@ std::string compute_sct(soc_reg_flags_t f) else return ""; } -void print_reg_desc(const soc_reg_t& reg, bool in_multi) +void print_reg_addr_desc(const soc_reg_addr_t& reg) { - if(in_multi) - { - printf(" REG %s (%#x)\n", reg.name.c_str(), reg.addr); - } - else - { - std::string sct = compute_sct(reg.flags); - printf(" REG %s %s(%#x)\n", reg.name.c_str(), sct.c_str(), reg.addr); - for(size_t i = 0; i < reg.fields.size(); i++) - print_field_desc(reg.fields[i]); - } + printf(" ADDR %s %#x\n", reg.name.c_str(), reg.addr); } -void print_multireg_desc(const soc_multireg_t& mreg) +void print_reg_desc(const soc_reg_t& reg) { - std::string sct = compute_sct(mreg.flags); - printf(" MULTIREG %s %s(%#x * %d, +%#x)\n", mreg.name.c_str(), sct.c_str(), - mreg.base, mreg.count, mreg.offset); - for(size_t i = 0; i < mreg.regs.size(); i++) - print_reg_desc(mreg.regs[i], true); - for(size_t i = 0; i < mreg.fields.size(); i++) - print_field_desc(mreg.fields[i]); + std::string sct = compute_sct(reg.flags); + printf(" REG %s %s\n", reg.name.c_str(), sct.c_str()); + for(size_t i = 0; i < reg.addr.size(); i++) + print_reg_addr_desc(reg.addr[i]); + for(size_t i = 0; i < reg.field.size(); i++) + print_field_desc(reg.field[i]); } - -void print_dev_desc(const soc_dev_t& dev, bool in_multi) +void print_dev_addr_desc(const soc_dev_addr_t& dev) { - if(in_multi) - { - printf(" DEV %s (%#x)\n", dev.name.c_str(), dev.addr); - } - else - { - printf(" DEV %s (%#x, %s, %s)\n", dev.name.c_str(), dev.addr, - dev.long_name.c_str(), dev.desc.c_str()); - for(size_t i = 0; i < dev.multiregs.size(); i++) - print_multireg_desc(dev.multiregs[i]); - for(size_t i = 0; i < dev.regs.size(); i++) - print_reg_desc(dev.regs[i], false); - } + printf(" ADDR %s %#x\n", dev.name.c_str(), dev.addr); } -void print_multidev_desc(const soc_multidev_t& dev) +void print_dev_desc(const soc_dev_t& dev) { - printf(" MULTIDEV %s (%s, %s)\n", dev.name.c_str(), dev.long_name.c_str(), - dev.desc.c_str()); - for(size_t i = 0; i < dev.devs.size(); i++) - print_dev_desc(dev.devs[i], true); - for(size_t i = 0; i < dev.multiregs.size(); i++) - print_multireg_desc(dev.multiregs[i]); - for(size_t i = 0; i < dev.regs.size(); i++) - print_reg_desc(dev.regs[i], false); + printf(" DEV %s\n", dev.name.c_str()); + for(size_t i = 0; i < dev.addr.size(); i++) + print_dev_addr_desc(dev.addr[i]); + for(size_t i = 0; i < dev.reg.size(); i++) + print_reg_desc(dev.reg[i]); } void print_soc_desc(const soc_t& soc) { printf("SOC %s (%s)\n", soc.name.c_str(), soc.desc.c_str()); - for(size_t i = 0; i < soc.devs.size(); i++) - print_dev_desc(soc.devs[i], false); - for(size_t i = 0; i < soc.multidevs.size(); i++) - print_multidev_desc(soc.multidevs[i]); + for(size_t i = 0; i < soc.dev.size(); i++) + print_dev_desc(soc.dev[i]); } void usage() @@ -117,7 +88,7 @@ int main(int argc, char **argv) if(argc != 2) usage(); std::vector< soc_t > socs; - bool ret = parse_soc_desc(argv[1], socs); + bool ret = soc_desc_parse_xml(argv[1], socs); printf("parse result: %d\n", ret); if(ret) for(size_t i = 0; i < socs.size(); i++) -- cgit v1.2.3