From: Andreas Neiser Date: Fri, 28 Jun 2013 14:30:56 +0000 (+0200) Subject: Loading and validating all *.xml files X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=e95945c1b9a6cf0345e1f70c9a91e75ccfd573b7;p=daqtools.git Loading and validating all *.xml files --- diff --git a/xml-db/database/TDC.xml b/xml-db/database/TDC.xml new file mode 100644 index 0000000..51fde5c --- /dev/null +++ b/xml-db/database/TDC.xml @@ -0,0 +1,207 @@ + + + + + + + + Wait time between write sequence and start signal. + + The number of MAPS clock cycles to wait after last write before sending the start signal. + + + + Trigger the init sequence. + + A bitmask to trigger the init sequence on individual JTAG chains. + + + + Trigger the init sequence. + + A bitmask to trigger sending a reset pulse on individual JTAG chains + + + + Trigger sending a start pulse. + + A bitmask to trigger sending a start pulse on individual JTAG chains + + + + Trigger running JTAG write. + + A bitmask to trigger writing the JTAG registers three times on individual JTAG chains + + + + Generate a reset before doing init sequence + + Enable to send a reset pulse before starting init sequence + + + + Generate a reset after first register write sequence + + Enable to send a reset pulse after the first writing of JTAG registers + + + + Trigger writing all JTAG registers once + + Trigger writing all JTAG registers once on individual JTAG chains + + + + Sets fixed values for all outputs for JTAG and sensor control and inverts the outputs if needed. One register for each JTAG chain. + + Sets fixed values for all outputs for JTAG and sensor control and inverts the outputs if needed. One register for each JTAG chain. + + Invert TDO input signal + + + Invert TDI output signal + + + Invert TMS output signal + + + Invert TCK output signal + + + Invert Start output signal + + + Invert Reset output signal + + + Invert Clock output signal + + + Enable TDO input signal + + + Enable TDI output signal + + + Enable TMS output signal + + + Enable TCK output signal + + + Enable Start output signal + + + Enable Reset output signal + + + Enable Clock output signal + + + + + + + + + + + + Number of read errors during "read id" operation + + + Number of read errors during write operation + + + + + Number of times data read back from the sensor was not identical to the data written to the sensor. + + + Number of sampling errors of TDI signal. The signal from the sensor is sampled three times for each bit, all occurrences must be equal. + + + + + Number of times the JTAG controller run a full sequence + + + + + JTAG has been started + + + Last JTAG run was successful + + + Data in the sensor was corrupted at last JTAG run + + + Last run had a JTAG write error + + + Last run had a JTAG read error + + + Last run had a JTAG CRC error + + + + + + diff --git a/xml-db/database/testing.xml b/xml-db/database/testing.xml index 183bf34..1ab8a24 100644 --- a/xml-db/database/testing.xml +++ b/xml-db/database/testing.xml @@ -15,7 +15,7 @@ Wait time between write sequence and start signal. diff --git a/xml-db/xml-db.pl b/xml-db/xml-db.pl index eb10576..eaf8086 100755 --- a/xml-db/xml-db.pl +++ b/xml-db/xml-db.pl @@ -5,11 +5,13 @@ use warnings; use XML::LibXML; use Getopt::Long; use Pod::Usage; +use File::chdir; use FindBin qw($RealBin); use Data::Dumper; # some default config options # and provide nice help documentation +# some global variables, needed everywhere my $man = 0; my $help = 0; @@ -24,13 +26,56 @@ GetOptions( pod2usage(1) if $help; pod2usage(-exitval => 0, -verbose => 2) if $man; -print "Database: $db_dir\n" if $verbose; +# tell something about the configuration +if($verbose) { + print "Database directory: $db_dir\n"; +} + +# jump to subroutine which handles the job, +# depending on the options +&main; + +sub main { + # load the unmerged database + my $db = &LoadDB; +} + +sub LoadDB { + # change to he db_dir here in this subroutine + local $CWD = $db_dir; + + # we first load the schemas and parse them + # so we can validate the XML files + my %schemas = (); + while(<*.xsd>) { + $schemas{$_} = XML::LibXML::Schema->new(location => $_); + print "Loaded schema $_\n" if $verbose; + } + + # load the xml files + my $parser = XML::LibXML->new(line_numbers => 1); + my $db = {}; + while(<*.xml>) { + my $doc = $parser->parse_file($_); + my $xsd_file = $doc->getDocumentElement->getAttribute('xsi:noNamespaceSchemaLocation'); + die "Schema $xsd_file not found to validate $_" unless defined $schemas{$xsd_file}; + $schemas{$xsd_file}->validate($doc); + $db->{$_} = $doc; + print "Loaded and validated database file $_\n" if $verbose; + } + # $parser->parse_file("$db_dir/testing.xml"); + + # my $xmlschema = XML::LibXML::Schema->new('location' => "$db_dir/". + # $doc->getDocumentElement->getAttribute('xsi:noNamespaceSchemaLocation')); + + # + return $db; +} + + + -my $doc = XML::LibXML->new->parse_file("$db_dir/testing.xml"); -my $xmlschema = XML::LibXML::Schema->new('location' => "$db_dir/". - $doc->getDocumentElement->getAttribute('xsi:noNamespaceSchemaLocation')); -$xmlschema->validate($doc); #print $xsd; @@ -46,7 +91,7 @@ xml-db.pl - Access the TRB XML Database xml-db.pl [options] [config file] Options: - -h, --help brief help message + -h, --help brief help message --xml-db_dir database directory =head1 OPTIONS