summaryrefslogtreecommitdiffstats
path: root/utils/regtools/lib
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-11-25 23:22:28 +0000
committerAmaury Pouly <amaury.pouly@gmail.com>2013-11-26 00:29:48 +0100
commitf04d3c518a3c26def9a003a108bec254499c7c90 (patch)
treea32a8022ad9c7d6de94bc031dcbd0e12278a1e57 /utils/regtools/lib
parentef2b6db066dc1b25863887eec0b65dadc8e54bb3 (diff)
downloadrockbox-f04d3c518a3c26def9a003a108bec254499c7c90.tar.gz
rockbox-f04d3c518a3c26def9a003a108bec254499c7c90.tar.bz2
rockbox-f04d3c518a3c26def9a003a108bec254499c7c90.zip
regtools: add shortcut notation for simple register in the desc files
Change-Id: I2745287844ad0a47dd41ba4dae5e1f7218ae5814 Reviewed-on: http://gerrit.rockbox.org/679 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
Diffstat (limited to 'utils/regtools/lib')
-rw-r--r--utils/regtools/lib/soc_desc.cpp15
1 files changed, 13 insertions, 2 deletions
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)
{
unsigned long u;
if(!validate_unsigned_long_hook(str, u)) return false;
-#if ULONG_MAX > UINT32_MAX
- if(u > UINT32_MAX) return false;
+#if ULONG_MAX > 0xffffffff
+ if(u > 0xffffffff) return false;
#endif
s = u;
return true;
@@ -177,12 +177,23 @@ bool parse_reg_formula_elem(xmlNode *node, soc_reg_formula_t& formula)
return true;
}
+bool parse_add_trivial_addr(const std::string& str, soc_reg_t& reg)
+{
+ soc_reg_addr_t a;
+ a.name = reg.name;
+ if(!validate_uint32_hook(str, a.addr))
+ return false;
+ reg.addr.push_back(a);
+ 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)
+ SOFT_MATCH_X_ATTR("addr", parse_add_trivial_addr, reg)
END_ATTR_MATCH()
BEGIN_NODE_MATCH(node->children)