avr: Fix documentation for Bus
[avr-sim.git] / tools / registers.awk
blobd2783796c22a414ed589f4b9cf4a3c40b06f9357
1 BEGIN { print "<ioregisters>" }
2 END { print "</ioregisters>" }
4 function xml(addr, name, comment) {
5 if( name != "Reserved" )
6 print "\t<ioreg address=\"" addr "\" name=\"" name "\"> <!-- " comment " --></ioreg>"
9 $1 ~ /0x[0-9A-F][0-9A-F]/ && $2 ~ /\(0x[0-9A-F][0-9A-F]\)/ {
10 where = match($1, /0x[0-9A-F][0-9A-F]/)
11 if( where ) {
12 addr = substr($1, where, 4)
13 comment = ""
14 for(x = 4; x <= NF; ++x) {
15 sub(/[^a-zA-Z0-9]/, "", $x)
16 comment = comment " " $x
18 xml(addr, $3, comment)
20 next
23 $1 ~ /\(?0x[0-9A-F][0-9A-F]\)?/ {
24 where = match($1, /0x[0-9A-F][0-9A-F]/)
25 if( where ) {
26 addr = substr($1, where, 4)
27 comment = ""
28 for(x = 3; x <= NF; ++x) {
29 sub(/[^a-zA-Z0-9]/, "", $x)
30 comment = comment " " $x
32 xml(addr, $2, comment)
34 next