]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
Schema for trb-setup.xml completed based on TrbNetCommon. It's hopefully not too...
authorAndreas Neiser <neiser@kph.uni-mainz.de>
Mon, 1 Jul 2013 06:39:13 +0000 (08:39 +0200)
committerAndreas Neiser <neiser@kph.uni-mainz.de>
Mon, 1 Jul 2013 06:39:13 +0000 (08:39 +0200)
xml-db/database/TrbNetCommon.xsd
xml-db/database/TrbNetEntity.xsd
xml-db/database/TrbNetSetup.xsd
xml-db/xml-db.pl

index e195800c9b30a52ab321729e55e5f45500c60716..327dc65770d0fb5f9209fe6ef05521eac5eb2e38 100644 (file)
   </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" />
index 25ba769d6715a2d1ef357de6265350993562ba67..0162560133d2fa7bf5fcf6a5fd500abded690456 100644 (file)
@@ -26,7 +26,7 @@
       </xs:complexContent>
     </xs:complexType>
   </xs:redefine>
-  
+
   <xs:redefine schemaLocation="TrbNetCommon.xsd">
     <xs:complexType name="fieldtype">
       <xs:complexContent>
@@ -36,7 +36,7 @@
       </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">
index ed72878ad113ac9e218612f106da9bf450978d0f..d5716e1084cd72cc10dcd89561166e17de483455 100644 (file)
   </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>
index 271846e58d81c72ef8a2706b96e0d75782822743..aac9e0a907e605d3ded3982c18ee09e862d34bc2 100755 (executable)
@@ -42,6 +42,10 @@ sub Main {
   # 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);
@@ -57,11 +61,11 @@ sub DumpDatabase($) {
   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'};
@@ -93,7 +97,9 @@ sub DumpDatabaseFile($) {
         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";
       }
     }