Eeprom now has a interrupt vector.
[avr-sim.git] / tools / convert.xsl
blob0dfa809f069768f7aebf302548ca16caefcbc1e4
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 | PACKAGE | INTERRUPT_VECTOR | V2"/>
8 </device>
9 </xsl:template>
11 <xsl:template match="MEMORY" priority="10">
12 <memory>
13 <flash>
14 <xsl:attribute name="size">
15 <xsl:value-of select="PROG_FLASH/text()"/>
16 </xsl:attribute>
17 </flash>
19 <iospace>
20 <xsl:attribute name="start">
21 <xsl:value-of
22 select="IO_MEMORY/MEM_START_ADDR/text()"/>
23 </xsl:attribute>
24 <xsl:attribute name="stop">
25 <xsl:value-of
26 select="IO_MEMORY/MEM_STOP_ADDR/text()"/>
27 </xsl:attribute>
28 </iospace>
30 <sram>
31 <xsl:attribute name="size">
32 <xsl:value-of select="INT_SRAM/SIZE/text()"/>
33 </xsl:attribute>
34 </sram>
36 <eram>
37 <xsl:attribute name="size">
38 <xsl:value-of select="EXT_SRAM/SIZE/text()"/>
39 </xsl:attribute>
40 </eram>
41 </memory>
43 <xsl:apply-templates select="IO_MEMORY"/>
44 </xsl:template>
46 <xsl:template match="IO_MEMORY" priority="9">
47 <ioregisters>
48 <xsl:for-each select="*">
49 <xsl:sort select="MEM_ADDR/text()"/>
50 <xsl:if test="not( contains(name(), 'ADDR') )">
51 <ioreg>
52 <xsl:attribute name="name">
53 <xsl:value-of select="name()"/>
54 </xsl:attribute>
56 <xsl:choose>
57 <xsl:when test="contains(IO_ADDR/text(), 'NA')">
58 <xsl:attribute name="address">
59 <xsl:value-of select="MEM_ADDR/text()"/>
60 </xsl:attribute>
61 </xsl:when>
62 <xsl:otherwise>
63 <xsl:attribute name="address">
64 <xsl:value-of select="IO_ADDR/text()"/>
65 </xsl:attribute>
66 </xsl:otherwise>
67 </xsl:choose>
68 </ioreg>
69 </xsl:if>
70 </xsl:for-each>
71 </ioregisters>
72 </xsl:template>
74 <xsl:template match="PACKAGE" priority="7">
75 <packages>
76 <xsl:for-each select="PDIP | TQFP | MLF">
77 <package>
78 <xsl:attribute name="name">
79 <xsl:value-of select="name()"/>
80 </xsl:attribute>
82 <xsl:attribute name="pins">
83 <xsl:value-of select="NMB_PIN/text()"/>
84 </xsl:attribute>
86 <xsl:for-each select="*">
87 <xsl:if test="starts-with(name(), 'PIN')">
88 <pin>
89 <xsl:attribute name="id">
90 <xsl:value-of select="substring(name(), 4)"/>
91 </xsl:attribute>
93 <xsl:attribute name="name">
94 <xsl:value-of select="NAME/text()"/>
95 </xsl:attribute>
97 <xsl:value-of select="TEXT/text()"/>
98 </pin>
99 </xsl:if>
100 </xsl:for-each>
101 </package>
102 </xsl:for-each>
103 </packages>
104 </xsl:template>
106 <xsl:template match="INTERRUPT_VECTOR" priority="8">
107 <interrupts>
108 <xsl:attribute name="num">
109 <xsl:value-of select="NMB_VECTORS/text()"/>
110 </xsl:attribute>
112 <xsl:for-each select="*">
113 <xsl:if test="starts-with(name(), 'VECTOR')">
114 <interrupt>
115 <xsl:attribute name="vector">
116 <xsl:value-of select="substring(name(), 7)"/>
117 </xsl:attribute>
119 <xsl:attribute name="address">
120 <xsl:value-of select="PROGRAM_ADDRESS/text()"/>
121 </xsl:attribute>
123 <xsl:attribute name="name">
124 <xsl:value-of select="SOURCE/text()"/>
125 </xsl:attribute>
127 <xsl:value-of select="DEFINITION/text()"/>
128 </interrupt>
129 </xsl:if>
130 </xsl:for-each>
131 </interrupts>
132 </xsl:template>
134 <xsl:template match="module" priority="1">
135 <module>
136 <xsl:attribute name="class">
137 <xsl:value-of select="@class"/>
138 </xsl:attribute>
140 <xsl:copy-of select="registers"/>
141 </module>
142 </xsl:template>
144 <xsl:template match="V2" priority="6">
145 <hardware>
146 <xsl:comment>Everything after this needs editing!!!</xsl:comment>
147 <xsl:apply-templates select="templates/module"/>
148 </hardware>
149 </xsl:template>
151 </xsl:stylesheet>