#!/usr/bin/perl
use warnings;
+
+use lib ".";
+
use File::chdir;
use XML::LibXML;
use Getopt::Long;
}
foreach my $cfg ($cursensor->findnodes('JtagConf')) {
- print STDERR " Found config\n" if $verbose;
+ print STDERR " Found config ".$cfg->textContent()."\n" if $verbose;
push(@{$JtagCommands->{$ctrladdr}},"./ui.pl -b $ctrlname -o ".$cfg->textContent());
}
}
foreach my $cfg ($curchain->findnodes('JtagConf')) {
- print STDERR " Found config\n" if $verbose;
+ print STDERR " Found config ".$cfg->textContent()."\n" if $verbose;
push(@{$JtagCommands->{$ctrladdr}},"./ui.pl -b $ctrlname -c $chainname -o ".$cfg->textContent());
}
sensorini(\@sfile);
}
foreach my $cfg ($curctrl->findnodes('JtagConf')) {
- print STDERR " Found config\n" if $verbose;
+ print STDERR " Found config ".$cfg->textContent()."\n" if $verbose;
push(@{$JtagCommands->{$ctrladdr}},"./ui.pl -b $ctrlname -o ".$cfg->textContent());
}
} # end of curctl loop
# configure Converter Boards
+print STDERR "Starting to configure Converter Boards\n" if $verbose;
local $CWD = XMLDBPATH;
delete $ENV{'QUERY_STRING'}; # make sure put.pl is used in a command line and not in a web context
foreach my $cmd (@CbCommands){
execute("echo put.pl $entity $addr $fieldname $value");
execute("./put.pl $entity $addr $fieldname $value");
}
+print STDERR "Done configuring Converter Boards\n" if $verbose;
+print STDERR "Taking care of JtagCommands\n" if $verbose;
foreach my $ctrladdr (keys %$JtagCommands) {
###############################
## Write ini files
###############################
+ print STDERR "Creating file ".$defaultIniPath."/boards.ini\n" if $verbose;
my $boardsinifile = FileHandle->new($defaultIniPath."/boards.ini", 'w');
print $boardsinifile $boardsini->{$ctrladdr};
$boardsinifile->close();
+ print STDERR "Creating file ".$defaultIniPath."/chains.ini\n" if $verbose;
my $chainsinifile = FileHandle->new($defaultIniPath."/chains.ini", 'w');
print $chainsinifile $chainsini->{$ctrladdr};
$chainsinifile->close();
local $CWD = $ENV{'JTAGPATH'};
foreach my $cmd (@{$JtagCommands->{$ctrladdr}}) {
- execute($cmd);
+ print STDERR "Executing the following command now:\n".$cmd."\n" if $verbose;
+ print execute($cmd);
+ #execute($cmd);
}
}
+print STDERR "Done taking care of JtagCommands\n" if $verbose;
execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time
execute("trbcmd setbit 0x$cts 0xa101 0x1");# enable CTS trigger source
execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time
## Just another execute sub
###############################
sub execute {
+ # my $cmd = $_[0]." 2>&1";
my @o;
@o = qx($_[0]) unless $dryrun;
print "Not running> $_[0]\n" if $dryrun;
+# print "running> $_[0]\n" if !$dryrun;
printreturn(@o) if $verbose;
}