my $defaultIniPath = JTAGCONFIGPATH;
my $defaultXmlPath = CONFDIR;
mkdir($defaultIniPath) unless (-e $defaultIniPath);
+my $systemDir = SYSTEMDIR;
###############################
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');
# parse <CbConf> 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')) {
# parse <CbConf> 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())
+ });
+ }
}
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
+