From: www@jspc55 Date: Tue, 3 Jun 2014 13:48:12 +0000 (+0200) Subject: added functionality: settings in CbConf nodes in the setup files are now programmed... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=e45489f86011b8192e6a3b6a3fd9ae8e2d52c520;p=mvdsensorcontrol.git added functionality: settings in CbConf nodes in the setup files are now programmed to the converter board during startup --- diff --git a/Environment.pm b/Environment.pm index 5f808e3..6b3d977 100644 --- a/Environment.pm +++ b/Environment.pm @@ -25,7 +25,8 @@ use constant SHAREPATH => JTAGROOTPATH."share/"; #path for ic use constant SETUPFILE => SETUPDIR."testsetup.xml"; use constant SHMSYMLINK => JTAGROOTPATH."shm/"; -use constant XML_CBCTRL_ENTITY => JTAGROOTPATH."../daqtools/xml-db/cache/CbController.entity"; +use constant XMLDBPATH => DAQTOOLSPATH."/xml-db"; +use constant XML_CBCTRL_ENTITY => DAQTOOLSPATH."/xml-db/cache/CbController.entity"; diff --git a/layout/styles.css b/layout/styles.css index ec4b8aa..3755da2 100644 --- a/layout/styles.css +++ b/layout/styles.css @@ -177,10 +177,10 @@ table.content tr:hover td.under { background:#dfd; border-color:#dfd; } - +/* input[type="text"]{ width:182px; -} +}*/ input.small { width:90px; diff --git a/tools/adcread.pl b/tools/adcread.pl index 35fef3b..ecac69e 100755 --- a/tools/adcread.pl +++ b/tools/adcread.pl @@ -25,8 +25,7 @@ use FindBin; use lib "$FindBin::Bin/.."; -my $entityFile = "../../daqtools/xml-db/cache/CbController.entity"; -my $xmldb = AccessXmlDb->new( entityFile => $entityFile ); +my $xmldb = AccessXmlDb->new( entityFile => XML_CBCTRL_ENTITY ); my $isHttpReq = $ENV{HTTP_USER_AGENT}; diff --git a/tools/plotService.pl b/tools/plotService.pl index 2d01435..f0dd387 100755 --- a/tools/plotService.pl +++ b/tools/plotService.pl @@ -23,6 +23,7 @@ use PlotScheduler; use FindBin; use lib "$FindBin::Bin/.."; +use Environment; my $shm = "/dev/null"; my $timeout = 5; @@ -41,7 +42,7 @@ GetOptions( daemonize() if $daemonize; -PlotJob::initXmlDb("../../daqtools/xml-db/cache/CbController.entity"); +PlotJob::initXmlDb(XML_CBCTRL_ENTITY); PlotJob::initTrbNet(); diff --git a/tools/startup.pl b/tools/startup.pl index e28ca22..06a1981 100755 --- a/tools/startup.pl +++ b/tools/startup.pl @@ -9,10 +9,11 @@ use FileHandle; use Pod::Usage; $Data::Dumper::Terse = 1; $Data::Dumper::Useqq = 0; - +use Cwd; use FindBin; use lib "$FindBin::Bin/.."; use Environment; +require Common; my ($help, $man, $verbose, $setup, $dryrun); @@ -66,6 +67,7 @@ my $db = $parser->parse_file($setupFile); my $name = $db->getDocumentElement->getAttribute('name'); print STDERR "Loading setup $name from file $setupFile\n" if $verbose; +my @CbCommands; foreach my $curctrl ($db->getDocumentElement->findnodes('controller')) { my $ctrlname = $curctrl->getAttribute('name'); @@ -91,16 +93,48 @@ foreach my $curctrl ($db->getDocumentElement->findnodes('controller')) { push(@sname,$sensname); push(@sfile,$sensfile); push(@senable,$sensena); + + + # 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 $cfg ($cursensor->findnodes('config')) { print STDERR " Found config\n" if $verbose; push(@commands,"./ui.pl -b $ctrlname -o ".$cfg->textContent()); } } + + # 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 $cfg ($curchain->findnodes('config')) { print STDERR " Found config\n" if $verbose; push(@commands,"./ui.pl -b $ctrlname -c $chainname -o ".$cfg->textContent()); } + $chainsini .= proto_chainsini($chainname,$chainid,$ctrladdr,\@sname,\@sfile,\@senable); sensorini(\@sfile); } @@ -123,10 +157,26 @@ print $chainsinifile $chainsini; $chainsinifile->close(); +print Dumper @CbCommands; ############################### ## Do whatever has to be done ############################### + +# configure Converter Boards +my $here = cwd(); +chdir(XMLDBPATH); +foreach my $cmd (@CbCommands){ + my $entity = "CbController"; + my $addr = $cmd->{addr}; + my $value = $cmd->{value}; + my $fieldname = $cmd->{name}; + execute("./put.pl $entity $addr $fieldname $value"); + +} +chdir($here); + + local $CWD = $ENV{'JTAGPATH'}; foreach my $cmd (@commands) { execute($cmd);