]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
moved database, schema and setup to directories. Adjusted relative paths accordingly.
authorJan Michel <j.michel@gsi.de>
Tue, 2 Jul 2013 09:27:29 +0000 (11:27 +0200)
committerJan Michel <j.michel@gsi.de>
Tue, 2 Jul 2013 09:27:29 +0000 (11:27 +0200)
12 files changed:
xml-db/database/CTS.xml
xml-db/database/HUB.xml
xml-db/database/JtagController.xml
xml-db/database/RDO.xml
xml-db/database/TDC.xml
xml-db/database/TrbNet.xml
xml-db/schema/TrbNetCommon.xsd [moved from xml-db/database/TrbNetCommon.xsd with 100% similarity]
xml-db/schema/TrbNetEntity.xsd [moved from xml-db/database/TrbNetEntity.xsd with 100% similarity]
xml-db/schema/TrbNetSetup.xsd [moved from xml-db/database/TrbNetSetup.xsd with 100% similarity]
xml-db/setup/trb-setup-default.xml [new file with mode: 0644]
xml-db/trb-setup.xml [changed from file to symlink]
xml-db/xml-db.pl

index ed6fc523181f45c692eb5fb020e4908c19d3edd3..642637a0291a8f3b44ff93a265ccd80cced7508b 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"  encoding="utf-8" ?>
 <TrbNetEntity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-              xsi:noNamespaceSchemaLocation="TrbNetEntity.xsd"
+              xsi:noNamespaceSchemaLocation="../schema/TrbNetEntity.xsd"
               name="CTS"
               address="a000"
               >
index 4a7597d14122b8076ba9f2f70c13cca2510d8cb6..6585a375c5990bc68f8a83cd16b6c326d9d9b675 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"  encoding="utf-8" ?>
 <TrbNetEntity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-              xsi:noNamespaceSchemaLocation="TrbNetEntity.xsd"
+              xsi:noNamespaceSchemaLocation="../schema/TrbNetEntity.xsd"
               name="Hub"
               address="0000"
               >
index 4982cf49cf134f974f1833e134d16e81d096eb08..eea44c5bacb5d933747097a587875808dddf0e7e 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"  encoding="utf-8" ?>
 <TrbNetEntity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:noNamespaceSchemaLocation="TrbNetEntity.xsd"
+        xsi:noNamespaceSchemaLocation="../schema/TrbNetEntity.xsd"
         name="JtagController"
         address="a000"
         >
index e5cc890346f17d1d6058be327c4c881a4a3a93e2..16a89b97730eeee3068bd2eabd4408dc414b71fb 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"  encoding="utf-8" ?>
 <TrbNetEntity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-              xsi:noNamespaceSchemaLocation="TrbNetEntity.xsd"
+              xsi:noNamespaceSchemaLocation="../schema/TrbNetEntity.xsd"
               name="TrgRdo"
               address="7000"
               >
index 2dd89ecd102a1ff9c8a78a2e87905332d927e19a..7eecb3efdd4e93c2e90e7c20e32a69eeef4a4111 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"  encoding="utf-8" ?>
 <TrbNetEntity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-              xsi:noNamespaceSchemaLocation="TrbNetEntity.xsd"
+              xsi:noNamespaceSchemaLocation="../schema/TrbNetEntity.xsd"
               name="TDC"
               address="c000"
               >
index 2b435c426db28d21ac72ab5e744e6a98d20ce4fb..2c2f28bbef22972d1816f2f4e9d9c16a959520cf 100644 (file)
@@ -1,23 +1,17 @@
 <?xml version="1.0"  encoding="utf-8" ?>
 <TrbNetEntity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-              xsi:noNamespaceSchemaLocation="TrbNetEntity.xsd"
+              xsi:noNamespaceSchemaLocation="../schema/TrbNetEntity.xsd"
               name="TrbNet"
-              address="7000"
+              address="0000"
               >
   <description>Common Registers on allmost all endpoints</description>
 
   <!-- this is just a very minimal version -->
 
-  <register name="IPUHandlerStatus" address="0202" purpose="status">
-    <description>IPU handler status register</description>
-    <field name="IPUHandlerStatusState" start="0" size="4" format="enum">
-      <description>FSM state bits</description>
-      <enumItem value="0">IDLE</enumItem>
-      <enumItem value="1">WaitForLength</enumItem>
-      <enumItem value="2">GotLength</enumItem>
-      <enumItem value="3">SendDHDR</enumItem>
-      <enumItem value="4">ReadData</enumItem>
-      <enumItem value="5">EndReadout</enumItem>
+  <register name="CommonStatus0" address="0000" purpose="status">
+    <description>Common Status Register 0</description>
+    <field name="Temperature" start="20" size="12" format="integer" unit="°C" scale=".0625" >
+      <description>Board temperature</description>
     </field>
   </register>
 
diff --git a/xml-db/setup/trb-setup-default.xml b/xml-db/setup/trb-setup-default.xml
new file mode 100644 (file)
index 0000000..eed3e98
--- /dev/null
@@ -0,0 +1,101 @@
+<?xml version="1.0"  encoding="utf-8" ?>
+<TrbNetSetup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xsi:noNamespaceSchemaLocation="../schema/TrbNetSetup.xsd"
+             creator="Andreas Neiser"
+             date="2013-06-30T16:11:56"
+             version="0.1"
+             >
+  <!-- The order of the trb elements is respected and their content is
+       evaluated after each one (if they specify a value). This is important if the resulting
+       changes to the TrbNet must happen in a certain way. -->
+
+  <!-- also note the different uses of the address attribute:
+       sometimes it's a register address, sometimes a trbnet endpoint
+       address, or sometimes it specifies the chain number of the
+       external PaDiWa frontend -->
+
+  
+  <!-- this specifies the trbaddress from uid's, it can be omitted if
+       the TrbNet is already set-up -->
+  <uidMap>
+    <uid address="0200" endpoint="0">5900000337e29728</uid>
+    <uid address="0201" endpoint="1">cf00000337e29e28</uid>
+    <uid address="0202" endpoint="2">ad00000338175028</uid>
+    <uid address="0203" endpoint="3">0e00000338174b28</uid>
+    <uid address="8000" endpoint="5">4400000338174628</uid>
+  </uidMap>
+
+  <!-- we configure the trb endpoint with address 0x8000 -->
+  <trb address="8000">
+    <broadcast address="fffe" />
+    <broadcast address="ff7f" />
+    <broadcast address="ff7e" />
+    <broadcast address="fe35" />
+    
+    <entity ref="TrbNet" />
+
+    <!-- it has a TDC (at default register address) -->
+    <entity ref="TDC">
+      <!-- this way we modify the number of channels to 5. This works
+           since group/register/memory/fifo have unique names. It
+           might be that there are several places where one should
+           change the "repeat" to get a consistent entity model, but
+           how does one know that programmitcally??? -->
+      <register name="Channel" repeat="5" />
+    </entity>
+
+    <!-- and it has a CTS -->
+    <entity ref="CTS" />
+  </trb>
+
+
+  <trb address="0200">
+    <broadcast address="ff48" />
+
+    <!-- Standard TrbNet enpoint with standard 65ch TDC... -->
+    <entity ref="TrbNet" />
+    <entity ref="TDC" />
+    <!-- ...but also some "external" PaDiWa frontends connected at
+         chain 0 and 2. The fronend has some more registers which can
+         be accessed via SPI. The idea is that there's also a
+         PaDiWa.pm in the database which handles this access, usually
+         via conventional TrbNet registers
+         -->
+    <external ref="PaDiWa" address="0000" />
+    <external ref="PaDiWa" address="0002" />
+  </trb>
+
+
+  <!-- An example how to execute a setting. In general, the entities
+       are identified by their type and address (if specified) -->
+  <trb address="0200">
+    <broadcast address="ff48" />
+
+    <entity ref="TDC">
+      <!-- this field is a bitmask, so there's a converter to easily
+           set single bits -->
+      <field name="ChannelEnable">
+        0-15 => 1, <!-- enables channels 0-15 -->
+        34 => 1, <!-- enables channel 34 -->
+      </field>
+    </entity>
+  </trb>
+
+
+  <trb address="0200">
+    <broadcast address="ff48" />
+    <entity ref="TDC">
+      <!-- this field is a bitmask, so there's a converter to easily
+           set single bits -->
+      <field name="ReadoutFSM">
+        <enumItem value="0">Bla</enumItem>
+        0-15 => 1, <!-- enables channels 0-15 -->
+        34 => 5, <!-- enables channel 34 -->
+      </field>
+    </entity>
+  </trb>
+  
+  
+  
+  
+</TrbNetSetup>
deleted file mode 100644 (file)
index c7d54bc67c2f8cbb4684652c0cbc42d142186151..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0"  encoding="utf-8" ?>
-<TrbNetSetup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-             xsi:noNamespaceSchemaLocation="TrbNetSetup.xsd"
-             creator="Andreas Neiser"
-             date="2013-06-30T16:11:56"
-             version="0.1"
-             >
-  <!-- The order of the trb elements is respected and their content is
-       evaluated after each one (if they specify a value). This is important if the resulting
-       changes to the TrbNet must happen in a certain way. -->
-
-  <!-- also note the different uses of the address attribute:
-       sometimes it's a register address, sometimes a trbnet endpoint
-       address, or sometimes it specifies the chain number of the
-       external PaDiWa frontend -->
-
-  
-  <!-- this specifies the trbaddress from uid's, it can be omitted if
-       the TrbNet is already set-up -->
-  <uidMap>
-    <uid address="0200" endpoint="0">5900000337e29728</uid>
-    <uid address="0201" endpoint="1">cf00000337e29e28</uid>
-    <uid address="0202" endpoint="2">ad00000338175028</uid>
-    <uid address="0203" endpoint="3">0e00000338174b28</uid>
-    <uid address="8000" endpoint="5">4400000338174628</uid>
-  </uidMap>
-
-  <!-- we configure the trb endpoint with address 0x8000 -->
-  <trb address="8000">
-    <broadcast address="fffe" />
-    <broadcast address="ff7f" />
-    <broadcast address="ff7e" />
-    <broadcast address="fe35" />
-    
-    <entity ref="TrbNet" />
-
-    <!-- it has a TDC (at default register address) -->
-    <entity ref="TDC">
-      <!-- this way we modify the number of channels to 5. This works
-           since group/register/memory/fifo have unique names. It
-           might be that there are several places where one should
-           change the "repeat" to get a consistent entity model, but
-           how does one know that programmitcally??? -->
-      <register name="Channel" repeat="5" />
-    </entity>
-
-    <!-- and it has a CTS -->
-    <entity ref="CTS" />
-  </trb>
-
-
-  <trb address="0200">
-    <broadcast address="ff48" />
-
-    <!-- Standard TrbNet enpoint with standard 65ch TDC... -->
-    <entity ref="TrbNet" />
-    <entity ref="TDC" />
-    <!-- ...but also some "external" PaDiWa frontends connected at
-         chain 0 and 2. The fronend has some more registers which can
-         be accessed via SPI. The idea is that there's also a
-         PaDiWa.pm in the database which handles this access, usually
-         via conventional TrbNet registers
-         -->
-    <external ref="PaDiWa" address="0000" />
-    <external ref="PaDiWa" address="0002" />
-  </trb>
-
-
-  <!-- An example how to execute a setting. In general, the entities
-       are identified by their type and address (if specified) -->
-  <trb address="0200">
-    <broadcast address="ff48" />
-
-    <entity ref="TDC">
-      <!-- this field is a bitmask, so there's a converter to easily
-           set single bits -->
-      <field name="ChannelEnable">
-        0-15 => 1, <!-- enables channels 0-15 -->
-        34 => 1, <!-- enables channel 34 -->
-      </field>
-    </entity>
-  </trb>
-
-
-  <trb address="0200">
-    <broadcast address="ff48" />
-    <entity ref="TDC">
-      <!-- this field is a bitmask, so there's a converter to easily
-           set single bits -->
-      <field name="ReadoutFSM">
-        <enumItem value="0">Bla</enumItem>
-        0-15 => 1, <!-- enables channels 0-15 -->
-        34 => 5, <!-- enables channel 34 -->
-      </field>
-    </entity>
-  </trb>
-  
-  
-  
-  
-</TrbNetSetup>
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..3c8d56f6747bf9d607dcdebb7e0dea6191b96515
--- /dev/null
@@ -0,0 +1 @@
+setup/trb-setup-default.xml
\ No newline at end of file
index 5f547965d1258a736d68466b790af1d0b0b73afc..54af5870bb62b87806c6aa630faab8bd1cc70e4c 100755 (executable)
@@ -22,6 +22,7 @@ my $help = 0;
 my $verbose = 0;
 my $warnings = 1;
 my $db_dir = "$RealBin/database";
+my $schema_dir = "$RealBin/schema";
 my $dump_database = 0;
 
 Getopt::Long::Configure(qw(gnu_getopt));
@@ -31,6 +32,7 @@ GetOptions(
            'verbose|v+' => \$verbose,
            'warnings|w!' => \$warnings,
            'db-dir=s' => \$db_dir,
+           'schema-dir=s' => \$schema_dir,
            'dump' => \$dump_database
           ) or pod2usage(2);
 pod2usage(1) if $help;
@@ -39,6 +41,7 @@ pod2usage(-exitval => 0, -verbose => 2) if $man;
 # tell something about the configuration
 if ($verbose) {
   print STDERR "Database directory: $db_dir\n";
+  print STDERR "Schema directory: $schema_dir\n";
   # always enable warnings if verbose
   $warnings = 1;
 }
@@ -290,8 +293,8 @@ sub LoadDBAndFiles {
   my $parser = XML::LibXML->new(line_numbers => 1);
 
   {
-    # change to the db_dir in the first part
-    local $CWD = $db_dir;
+    # change to the schema_dir in the first part
+    local $CWD = $schema_dir;
 
 
     # we first load the schemas and parse them
@@ -302,6 +305,8 @@ sub LoadDBAndFiles {
     }
 
     # load the xml files in the database
+    # change to the db_dir in the first part
+    local $CWD = $db_dir;
     while (<*.xml>) {
       my $doc = $parser->parse_file($_);
       my $schema = ValidateXML($doc, $schemas);
@@ -332,6 +337,7 @@ sub ValidateXML($$) {
   my $doc = shift;
   my $schemas = shift;
   my $xsd_file = $doc->getDocumentElement->getAttribute('xsi:noNamespaceSchemaLocation');
+  ($xsd_file) = $xsd_file =~ m%.*/([^/]*)$%;
   die "Schema $xsd_file not found to validate <$_>" unless defined $schemas->{$xsd_file};
   $schemas->{$xsd_file}->validate($doc);
   return $schemas->{$xsd_file};