From 7ef678203d8498ff5205254ca6febab92b3a4b4c Mon Sep 17 00:00:00 2001 From: Michael Wiebusch Date: Fri, 15 May 2015 13:58:26 +0200 Subject: [PATCH] init_setup.pl from now on only uses one input argument, which is the setup file --- tools/init_setup.pl | 49 +++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/tools/init_setup.pl b/tools/init_setup.pl index 3ee6a7b..a5807b6 100755 --- a/tools/init_setup.pl +++ b/tools/init_setup.pl @@ -53,6 +53,7 @@ pod2usage(-exitval => 0, -verbose => 2) if $man; my $defaultIniPath = JTAGCONFIGPATH; my $defaultXmlPath = CONFDIR; mkdir($defaultIniPath) unless (-e $defaultIniPath); +my $systemDir = SYSTEMDIR; ############################### @@ -65,12 +66,17 @@ my @CbCommands; my $boardsini = {}; my $chainsini = {}; my $setupFile = $ARGV[0]; -my $systemFile = $ARGV[1]; +# my $systemFile = $ARGV[1]; my $parser = XML::LibXML->new(line_numbers => 1); my $db = $parser->parse_file($setupFile); +my $systemName = $db->findvalue("/setup/system/\@name"); +my $systemFile = $systemDir.$systemName.".xml"; +my $dbsys = $parser->parse_file($systemFile); my $name = $db->getDocumentElement->getAttribute('name'); +my $ccu = $dbsys->getDocumentElement->findnodes('ccu')->[0]->getAttribute('address'); print STDERR "Loading setup $name from file $setupFile\n" if $verbose; +execute("trbcmd clearbit 0x$ccu 0xa101 0x1"); foreach my $curctrl ($db->getDocumentElement->findnodes('controller')) { my $ctrlname = $curctrl->getAttribute('name'); @@ -107,15 +113,15 @@ foreach my $curctrl ($db->getDocumentElement->findnodes('controller')) { # parse configuration and set settings in converter board my $CbConf = $cursensor->findnodes('CbConf')->shift(); if (defined($CbConf)){ - foreach my $attr ($CbConf->findnodes('@*')){ -# print $ctrladdr." ".$attr->getName()." ".$attr->getValue()."\n"; - push(@CbCommands,{ - addr => "0x".$ctrladdr, - name => $attr->getName().".".sprintf("%d",$sensid), - # sensor id is used to addres the xml-db data slice - value => any2hex($attr->getValue()) - }); - } + foreach my $attr ($CbConf->findnodes('@*')){ +# print $ctrladdr." ".$attr->getName()." ".$attr->getValue()."\n"; + push(@CbCommands,{ + addr => "0x".$ctrladdr, + name => $attr->getName().".".sprintf("%d",$sensid), + # sensor id is used to addres the xml-db data slice + value => any2hex($attr->getValue()) + }); + } } foreach my $cfg ($cursensor->findnodes('JtagConf')) { @@ -127,15 +133,15 @@ foreach my $curctrl ($db->getDocumentElement->findnodes('controller')) { # parse configuration and set settings in converter board my $CbConf = $curchain->findnodes('CbConf')->shift(); if (defined($CbConf)){ - foreach my $attr ($CbConf->findnodes('@*')){ -# print $ctrladdr." ".$attr->getName()." ".$attr->getValue()."\n"; - push(@CbCommands,{ - addr => "0x".$ctrladdr, - name => $attr->getName(), - # sensor id is used to addres the xml-db data slice - value => any2hex($attr->getValue()) - }); - } + foreach my $attr ($CbConf->findnodes('@*')){ +# print $ctrladdr." ".$attr->getName()." ".$attr->getValue()."\n"; + push(@CbCommands,{ + addr => "0x".$ctrladdr, + name => $attr->getName(), + # sensor id is used to addres the xml-db data slice + value => any2hex($attr->getValue()) + }); + } } @@ -191,7 +197,10 @@ foreach my $ctrladdr (keys %$JtagCommands) { execute($cmd); } } - +execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time +execute("trbcmd setbit 0x$ccu 0xa101 0x1"); +execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time + -- 2.43.0