forked from len0rd/rockbox
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>
This commit is contained in:
parent
ef2b6db066
commit
f04d3c518a
2 changed files with 26 additions and 2 deletions
|
|
@ -61,12 +61,25 @@ The following properties are defined:
|
||||||
- "name" (mandatory,string): the mnemonic of the register.
|
- "name" (mandatory,string): the mnemonic of the register.
|
||||||
- "sct" (optional,"yes" or "no"): STMP specific attribute to specify the existence
|
- "sct" (optional,"yes" or "no"): STMP specific attribute to specify the existence
|
||||||
of the SCT variants of this register.
|
of the SCT variants of this register.
|
||||||
|
As a shortcut, in the case the register has a single address, one can add one more
|
||||||
|
property:
|
||||||
|
- "addr" (optional,integer): base address of this instance of the register.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
<reg name="TIMCTRLn" sct="yes">
|
<reg name="TIMCTRLn" sct="yes">
|
||||||
<!-- reg desc -->
|
<!-- reg desc -->
|
||||||
</reg>
|
</reg>
|
||||||
|
|
||||||
|
The address shortcut has the following standard translation:
|
||||||
|
<reg name="GPIO_PADR" addr="0x00">
|
||||||
|
<!-- bla -->
|
||||||
|
</reg>
|
||||||
|
is equivalent to:
|
||||||
|
<reg name="GPIO_PADR">
|
||||||
|
<addr name="GPIO_PADR" addr="0x00">
|
||||||
|
<!-- bla -->
|
||||||
|
</reg>
|
||||||
|
|
||||||
Element: soc.dev.reg.addr
|
Element: soc.dev.reg.addr
|
||||||
-------------------------
|
-------------------------
|
||||||
Each device can have one or more addresses associated with it. Each address
|
Each device can have one or more addresses associated with it. Each address
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,8 @@ bool validate_uint32_hook(const std::string& str, uint32_t& s)
|
||||||
{
|
{
|
||||||
unsigned long u;
|
unsigned long u;
|
||||||
if(!validate_unsigned_long_hook(str, u)) return false;
|
if(!validate_unsigned_long_hook(str, u)) return false;
|
||||||
#if ULONG_MAX > UINT32_MAX
|
#if ULONG_MAX > 0xffffffff
|
||||||
if(u > UINT32_MAX) return false;
|
if(u > 0xffffffff) return false;
|
||||||
#endif
|
#endif
|
||||||
s = u;
|
s = u;
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -177,12 +177,23 @@ bool parse_reg_formula_elem(xmlNode *node, soc_reg_formula_t& formula)
|
||||||
return true;
|
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)
|
bool parse_reg_elem(xmlNode *node, soc_reg_t& reg)
|
||||||
{
|
{
|
||||||
std::vector< soc_reg_formula_t > formulas;
|
std::vector< soc_reg_formula_t > formulas;
|
||||||
BEGIN_ATTR_MATCH(node->properties)
|
BEGIN_ATTR_MATCH(node->properties)
|
||||||
MATCH_TEXT_ATTR("name", reg.name)
|
MATCH_TEXT_ATTR("name", reg.name)
|
||||||
SOFT_MATCH_SCT_ATTR("sct", reg.flags)
|
SOFT_MATCH_SCT_ATTR("sct", reg.flags)
|
||||||
|
SOFT_MATCH_X_ATTR("addr", parse_add_trivial_addr, reg)
|
||||||
END_ATTR_MATCH()
|
END_ATTR_MATCH()
|
||||||
|
|
||||||
BEGIN_NODE_MATCH(node->children)
|
BEGIN_NODE_MATCH(node->children)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue