avr: clockticks missing in long_options
[avr-sim.git] / tools / convert.xsl
blobf22d2462e78b16a96e79e05a95f630bd4dbaee52
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3 <xsl:output method="xml" indent="yes" doctype-system="device.dtd"/>
5 <xsl:template match="AVRPART">
6 <device>
7 <xsl:apply-templates select="MEMORY"/>
8 <xsl:apply-templates select="INTERRUPT_VECTOR"/>
9 <xsl:apply-templates select="PACKAGE"/>
10 <xsl:apply-templates select="V2"/>
11 </device>
12 </xsl:template>
14 <xsl:template match="MEMORY">
15 <memory>
16 <flash>
17 <xsl:attribute name="size">
18 <xsl:value-of select="PROG_FLASH/text()"/>
19 </xsl:attribute>
20 <xsl:attribute name="page">
21 <xsl:value-of select="/AVRPART/PROGRAMMING/FlashPageSize/text()"/>
22 </xsl:attribute>
23 </flash>
25 <iospace>
26 <xsl:attribute name="start">
27 <xsl:value-of
28 select="IO_MEMORY/MEM_START_ADDR/text()"/>
29 </xsl:attribute>
30 <xsl:attribute name="stop">
31 <xsl:value-of
32 select="IO_MEMORY/MEM_STOP_ADDR/text()"/>
33 </xsl:attribute>
34 </iospace>
36 <sram>
37 <xsl:attribute name="size">
38 <xsl:value-of select="INT_SRAM/SIZE/text()"/>
39 </xsl:attribute>
40 </sram>
42 <eram>
43 <xsl:attribute name="size">
44 <xsl:value-of select="EXT_SRAM/SIZE/text()"/>
45 </xsl:attribute>
46 </eram>
47 </memory>
49 <xsl:apply-templates select="IO_MEMORY"/>
50 </xsl:template>
52 <xsl:template match="IO_MEMORY">
53 <ioregisters>
54 <xsl:for-each select="*">
55 <xsl:sort select="MEM_ADDR/text()"/>
56 <xsl:if test="not( contains(name(), 'ADDR') )">
57 <ioreg>
58 <xsl:attribute name="name">
59 <xsl:value-of select="name()"/>
60 </xsl:attribute>
62 <xsl:attribute name="address">
63 <xsl:value-of select="MEM_ADDR/text()"/>
64 </xsl:attribute>
65 </ioreg>
66 </xsl:if>
67 </xsl:for-each>
68 </ioregisters>
69 </xsl:template>
71 <xsl:template match="PACKAGE">
72 <packages>
73 <xsl:for-each select="PDIP | TQFP | MLF">
74 <package>
75 <xsl:attribute name="name">
76 <xsl:value-of select="name()"/>
77 </xsl:attribute>
79 <xsl:attribute name="pins">
80 <xsl:value-of select="NMB_PIN/text()"/>
81 </xsl:attribute>
83 <xsl:for-each select="*">
84 <xsl:if test="starts-with(name(), 'PIN')">
85 <pin>
86 <xsl:attribute name="id">
87 <xsl:value-of select="substring(name(), 4)"/>
88 </xsl:attribute>
90 <xsl:attribute name="name">
91 <xsl:value-of select="NAME/text()"/>
92 </xsl:attribute>
94 <xsl:value-of select="TEXT/text()"/>
95 </pin>
96 </xsl:if>
97 </xsl:for-each>
98 </package>
99 </xsl:for-each>
100 </packages>
101 </xsl:template>
103 <xsl:template match="INTERRUPT_VECTOR">
104 <interrupts>
105 <xsl:attribute name="num">
106 <xsl:value-of select="NMB_VECTORS/text()"/>
107 </xsl:attribute>
109 <xsl:for-each select="*">
110 <xsl:if test="starts-with(name(), 'VECTOR')">
111 <interrupt>
112 <xsl:attribute name="vector">
113 <xsl:value-of select="substring(name(), 7)"/>
114 </xsl:attribute>
116 <xsl:attribute name="address">
117 <xsl:value-of select="PROGRAM_ADDRESS/text()"/>
118 </xsl:attribute>
120 <xsl:attribute name="name">
121 <xsl:value-of select="SOURCE/text()"/>
122 </xsl:attribute>
124 <xsl:value-of select="DEFINITION/text()"/>
125 </interrupt>
126 </xsl:if>
127 </xsl:for-each>
128 </interrupts>
129 </xsl:template>
131 <xsl:template match="module">
132 <module>
133 <xsl:attribute name="class">
134 <xsl:value-of select="@class"/>
135 </xsl:attribute>
137 <xsl:copy-of select="registers"/>
138 </module>
139 </xsl:template>
141 <xsl:template match="V2">
142 <hardware>
143 <xsl:comment>Everything after this needs editing!!!</xsl:comment>
144 <xsl:apply-templates select="templates/module"/>
145 </hardware>
146 </xsl:template>
148 </xsl:stylesheet>