summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/regtools/desc/XML.txt13
-rw-r--r--utils/regtools/lib/soc_desc.cpp15
2 files changed, 26 insertions, 2 deletions
diff --git a/utils/regtools/desc/XML.txt b/utils/regtools/desc/XML.txt
index d4dc73cc64..15164a43b9 100644
--- a/utils/regtools/desc/XML.txt
+++ b/utils/regtools/desc/XML.txt
@@ -61,12 +61,25 @@ The following properties are defined:
61- "name" (mandatory,string): the mnemonic of the register. 61- "name" (mandatory,string): the mnemonic of the register.
62- "sct" (optional,"yes" or "no"): STMP specific attribute to specify the existence 62- "sct" (optional,"yes" or "no"): STMP specific attribute to specify the existence
63 of the SCT variants of this register. 63 of the SCT variants of this register.
64As a shortcut, in the case the register has a single address, one can add one more
65property:
66- "addr" (optional,integer): base address of this instance of the register.
64 67
65Example: 68Example:
66<reg name="TIMCTRLn" sct="yes"> 69<reg name="TIMCTRLn" sct="yes">
67<!-- reg desc --> 70<!-- reg desc -->
68</reg> 71</reg>
69 72
73The address shortcut has the following standard translation:
74<reg name="GPIO_PADR" addr="0x00">
75<!-- bla -->
76</reg>
77is equivalent to:
78<reg name="GPIO_PADR">
79<addr name="GPIO_PADR" addr="0x00">
80<!-- bla -->
81</reg>
82
70Element: soc.dev.reg.addr 83Element: soc.dev.reg.addr
71------------------------- 84-------------------------
72Each device can have one or more addresses associated with it. Each address 85Each device can have one or more addresses associated with it. Each address
diff --git a/utils/regtools/lib/soc_desc.cpp b/utils/regtools/lib/soc_desc.cpp
index 413c30936f..4b9f51b9ae 100644
--- a/utils/regtools/lib/soc_desc.cpp
+++ b/utils/regtools/lib/soc_desc.cpp
@@ -102,8 +102,8 @@ bool validate_uint32_hook(const std::string& str, uint32_t& s)
102{ 102{
103 unsigned long u; 103 unsigned long u;
104 if(!validate_unsigned_long_hook(str, u)) return false; 104 if(!validate_unsigned_long_hook(str, u)) return false;
105#if ULONG_MAX > UINT32_MAX 105#if ULONG_MAX > 0xffffffff
106 if(u > UINT32_MAX) return false; 106 if(u > 0xffffffff) return false;
107#endif 107#endif
108 s = u; 108 s = u;
109 return true; 109 return true;
@@ -177,12 +177,23 @@ bool parse_reg_formula_elem(xmlNode *node, soc_reg_formula_t& formula)
177 return true; 177 return true;
178} 178}
179 179
180bool parse_add_trivial_addr(const std::string& str, soc_reg_t& reg)
181{
182 soc_reg_addr_t a;
183 a.name = reg.name;
184 if(!validate_uint32_hook(str, a.addr))
185 return false;
186 reg.addr.push_back(a);
187 return true;
188}
189
180bool parse_reg_elem(xmlNode *node, soc_reg_t& reg) 190bool parse_reg_elem(xmlNode *node, soc_reg_t& reg)
181{ 191{
182 std::vector< soc_reg_formula_t > formulas; 192 std::vector< soc_reg_formula_t > formulas;
183 BEGIN_ATTR_MATCH(node->properties) 193 BEGIN_ATTR_MATCH(node->properties)
184 MATCH_TEXT_ATTR("name", reg.name) 194 MATCH_TEXT_ATTR("name", reg.name)
185 SOFT_MATCH_SCT_ATTR("sct", reg.flags) 195 SOFT_MATCH_SCT_ATTR("sct", reg.flags)
196 SOFT_MATCH_X_ATTR("addr", parse_add_trivial_addr, reg)
186 END_ATTR_MATCH() 197 END_ATTR_MATCH()
187 198
188 BEGIN_NODE_MATCH(node->children) 199 BEGIN_NODE_MATCH(node->children)