On Monday 10 August 2009 14:52:49 Michael Buesch wrote:
> On Monday 10 August 2009 14:49:31 Gábor Stefanik wrote:
> > 2009/8/10 Michael Buesch <[email protected]>:
> > > On Monday 10 August 2009 03:00:46 Gábor Stefanik wrote:
> > >> +static const u16 lpphy_sw_control_table[] = {
> > >> + 0x0128,
> > >> + 0x0128,
> > >> + 0x0009,
> > >> + 0x0009,
> > >> + 0x0028,
> > >> + 0x0028,
> > >
> > > Is it possible to use more than one value per line for all these tables?
> > > Make sure to make best use of the 80 columns limit.
> > > This would significantly decrease the patch/file length. (linewise)
> > >
> > > --
> > > Greetings, Michael.
> > >
> >
> > Well, I converted the tables directly from the Wikitext on
> > bcm-v4.sipsolutions.net using regex search&replace - if you know a
> > good regex to convert the tables to use multiple values on each line,
> > please post it.
> >
>
> I have some hacky python scripts to parse and reformat these tables.
> I will post them in a few hours. I'll have to leave now. brb.
>
Hm, I don't seem to have the scripts anymore. But python re is fairly simple.
Here's a hacky script to parse a table, perform some transformations on it and
print out the C defines:
#!/usr/bin/env python
import re
import sys
d = file(sys.argv[1]).readlines()
for line in d:
r = re.compile(r"\|\| `0x([0-9A-Fa-f]+)` \|\| ([\w\s\(\)/]+) \|\|")
m = r.match(line)
if m:
offset = int(m.group(1), 16)
name = m.group(2)
name = name.replace("workAround", "workaround")
origname = name
name = name.replace("(", " ")
name = name.replace(")", " ")
name = name.upper()
name = name.strip()
name = name.replace(" ", "_")
name = name.replace("/", "_")
name = name.replace("CONTROL", "CTL")
name = name.replace("COMMON", "COMM")
name = name.replace("CALIBRATION", "CALIB")
name = name.replace("DEBUG", "DBG")
name = name.replace("COUNTER", "CNT")
name = name.replace("POWER", "PWR")
name = name.replace("B_PHY", "B")
name = name.replace("ADDRESS", "ADDR")
name = name.replace("OUT_ENABLE", "OUTEN")
name = name.replace("THRESHOLD", "THRES")
name = name.replace("STATUS", "STAT")
name = name.replace("COEFFICIENT", "COEFF")
name = name.replace("INTERVAL", "INT")
name = name.replace("TIMEOUT", "TO")
name = name.replace("VALUE", "VAL")
name = name.replace("SAMPLE", "SMPL")
name = "B43_LPPHY_" + name
nr_tabs = 5 - (len(name) / 8)
tabs = "\t" * nr_tabs
comment = origname
if (offset & 0x400):
accessor = "B43_PHY_OFDM"
else:
accessor = "B43_PHY_CCK"
offset &= ~0x400;
if (offset & ~0xFF):
print "offset ERROR %X" % offset
sys.exit(1)
sys.stdout.write("#define %s%s%s(0x%02X)" % (name, tabs,
accessor, offset))
if comment:
sys.stdout.write(" /* %s */" % comment)
sys.stdout.write("\n")
else:
pass
print "NO match " + line
--
Greetings, Michael.
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev