</xs:element>
-<!-- we define this as mixed to provide values to be written (or
- extracted from it). It will be converted to hex (or binary)
- according to format attribute -->
- <xs:complexType name="fieldtype" mixed="true">
- <xs:sequence>
- <!-- description can be omitted if a register or alike only contains
- one or several identical fields and the description of them can
- be inherited from the register itself-->
- <xs:choice minOccurs="0">
- <xs:element ref="description"/>
- </xs:choice>
- <!-- enum items are only meaningful for format="enum" fields,
- however we don't complain if there are some for other
- formats... -->
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element ref="enumItem" />
- </xs:choice>
- </xs:sequence>
-
- <xs:attribute ref="name" use="required" />
- <!-- start is defined in TrbNetEntity -->
- <xs:attribute ref="size" />
- <xs:attribute ref="purpose" />
- <xs:attribute ref="mode" />
- <!-- if the default value of that field is not 0x0 (in the
- appropiate conversion according to format attribute), it
- can be specified here -->
- <xs:attribute ref="defaultValue" />
- <xs:attribute ref="format" />
- <xs:attribute ref="repeat" />
- <xs:attribute ref="unit" />
- <xs:attribute ref="scale" />
- <!-- if PERL evaluates this field to true,
- an error is indicated by this field -->
- <xs:attribute ref="errorflag" />
- </xs:complexType>
-
+ <xs:complexType name="grouptype">
+ <xs:attribute ref="name" use="required" />
+ <xs:attribute ref="address" />
+ <xs:attribute ref="size" />
+ <xs:attribute ref="purpose" />
+ <xs:attribute ref="continuous" />
+ <xs:attribute ref="mode" />
+ <xs:attribute ref="format" />
+ <xs:attribute ref="repeat" />
+ </xs:complexType>
- <xs:element name="field" type="fieldtype">
-
+ <!-- we define this as mixed to provide values to be written (or
+ extracted from it). It will be converted to hex (or binary)
+ according to format attribute -->
+ <xs:complexType name="fieldtype" mixed="true">
+ <xs:sequence>
+ <!-- description can be omitted if a register or alike only contains
+ one or several identical fields and the description of them can
+ be inherited from the register itself-->
+ <xs:choice minOccurs="0">
+ <xs:element ref="description"/>
+ </xs:choice>
+ <!-- enum items are only meaningful for format="enum" fields,
+ however we don't complain if there are some for other
+ formats... -->
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="enumItem" />
+ </xs:choice>
+ </xs:sequence>
+
+ <xs:attribute ref="name" use="required" />
+ <!-- start is defined in TrbNetEntity as required -->
+ <xs:attribute ref="size" />
+ <xs:attribute ref="purpose" />
+ <xs:attribute ref="mode" />
+ <!-- if the default value of that field is not 0x0 (in the
+ appropiate conversion according to format attribute), it
+ can be specified here -->
+ <xs:attribute ref="defaultValue" />
+ <xs:attribute ref="format" />
+ <xs:attribute ref="repeat" />
+ <xs:attribute ref="unit" />
+ <xs:attribute ref="scale" />
+ <!-- if PERL evaluates this field to true,
+ an error is indicated by this field -->
+ <xs:attribute ref="errorflag" />
+ </xs:complexType>
+
+ <xs:element name="field" type="fieldtype">
<xs:unique name="UniqueEnumItems">
<xs:selector xpath="enumItem" />
<xs:field xpath="@value" />
</xs:element>
<xs:complexType name="basicTrbData">
-
+
<xs:attribute ref="name" use="required" />
<!-- start is defined in TrbNetEntity as required attribute -->
<xs:attribute ref="mode" />
</xs:complexContent>
</xs:complexType>
</xs:redefine>
-
+
<xs:redefine schemaLocation="TrbNetCommon.xsd">
<xs:complexType name="fieldtype">
<xs:complexContent>
</xs:complexContent>
</xs:complexType>
</xs:redefine>
-
+
<xs:element name="TrbNetEntity">
<xs:complexType>
<xs:sequence>
</xs:unique>
</xs:element>
+
<xs:element name="group">
<xs:complexType>
- <xs:sequence>
- <!-- a group does not necessarily need a description -->
- <xs:choice minOccurs="0">
- <xs:element ref="description"/>
- </xs:choice>
- <xs:choice maxOccurs="unbounded">
- <xs:element ref="group" maxOccurs="unbounded" />
- <xs:element ref="register" maxOccurs="unbounded" />
- <xs:element ref="memory" maxOccurs="unbounded" />
- <xs:element ref="fifo" maxOccurs="unbounded" />
- </xs:choice>
- </xs:sequence>
- <xs:attribute ref="name" use="required" />
- <xs:attribute ref="address" />
- <xs:attribute ref="size" />
- <xs:attribute ref="purpose" />
- <xs:attribute ref="continuous" />
- <xs:attribute ref="mode" />
- <xs:attribute ref="format" />
- <xs:attribute ref="repeat" />
+ <xs:complexContent>
+ <xs:extension base="grouptype">
+ <xs:sequence>
+ <!-- a group does not necessarily need a description -->
+ <xs:choice minOccurs="0">
+ <xs:element ref="description"/>
+ </xs:choice>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="group" maxOccurs="unbounded" />
+ <xs:element ref="register" maxOccurs="unbounded" />
+ <xs:element ref="memory" maxOccurs="unbounded" />
+ <xs:element ref="fifo" maxOccurs="unbounded" />
+ </xs:choice>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
</xs:complexType>
+
<!-- consistency of addresses (and start, size of fields) is
checked more precisely programmatically -->
<xs:unique name="UniqueTrbDataAddressesInGroup">
</xs:element>
<xs:element name="trb">
-
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="entity" type="entitytype"/>
+ <xs:element ref="external" />
+ </xs:choice>
+ <xs:attribute ref="address" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="entitytype">
+ <!-- the entity may contain similar elements as the TrbNetEntity
+ element, but without a complex grouping mechanism. This is
+ why we defined some sparse elements in TrbNetCommon.xsd,
+ which are extended/redefined in TrbNetEntity.xsd -->
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="group" type="grouptype" />
+ <xs:element ref="register" />
+ <xs:element ref="memory" />
+ <xs:element ref="fifo" />
+ <xs:element name="field" type="fieldtype" />
+ </xs:choice>
+ <xs:attribute name="type" type="xs:string" use="required" />
+ </xs:complexType>
+
+ <xs:element name="external">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="entitytype">
+ <xs:attribute name="address" type="addresstype" use="required" />
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
</xs:element>
+ <xs:attribute name="endpoint">
+ <xs:simpleType>
+ <xs:restriction base="xs:integer">
+ <xs:pattern value="[0-3]|5"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:simpleType name="uidcontent">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[0-9a-fA-F]{16}"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:complexType name="uidtype">
+ <xs:simpleContent>
+ <xs:extension base="uidcontent">
+ <xs:attribute ref="address" />
+ <xs:attribute ref="endpoint" />
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:element name="uid" type="uidtype" />
+
<xs:element name="uidMap">
-
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="uid" />
+ </xs:choice>
+ </xs:complexType>
</xs:element>
-
+
</xs:schema>
# load the unmerged database and the provided files
my ($db,$files) = &LoadDBAndFiles;
+ foreach my $file (keys %$files) {
+ print "Working on $file...\n" if $verbose;
+
+ }
# testing...
#DumpDatabase($db);
my $db = shift;
foreach my $file (keys %$db) {
print "Dumping $file...\n";
- DumpDatabaseFile($db->{$file});
+ DumpDocument($db->{$file});
}
}
-sub DumpDatabaseFile($) {
+sub DumpDocument($) {
my $doc = shift;
#my $doc = $db->{'testing.xml'};
#my $doc = $db->{'jtag_registers_SPEC.xml'};
printf("%04x:%02d:%02d %s/%s\n", $address,
$field->getAttribute('start'),
$field->getAttribute('size') || 1,
- $name, $field->getAttribute('name'));
+ $name, $field->getAttribute('name')
+ );
+
#print $field->getAttribute('errorflag') || 'false',"\n";
}
}