1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Amaury Pouly 2013-06-13 01:50:14 +02:00
parent 7143ea681c
commit 73db73dbd3
11 changed files with 4003 additions and 5595 deletions

View file

@ -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 <stdio.h>
#include <stdlib.h>
@ -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++)