From: hadaq Date: Wed, 1 Dec 2021 15:16:42 +0000 (+0100) Subject: add a couple of changes X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=161c5ec0b64797a504d6a5ae7b135a154da80f0e;p=daqtools.git add a couple of changes --- diff --git a/AFTER_GIT_UPDATE.txt b/AFTER_GIT_UPDATE.txt new file mode 100644 index 0000000..61233e5 --- /dev/null +++ b/AFTER_GIT_UPDATE.txt @@ -0,0 +1,14 @@ +If some scripts fail with a message regarding trbnetd not found: + +Make sure that the DAQOPSERVER-environment is set correctly in: + +xml-db/get.pl +xml-db/put.pl +web/htdocs/apacheEnv.pm + +When run in httpi, the normal environment variable is used, only when running the web server on Apache these might not be set. +You might set it in your main Apache configuration file as well: + SetEnv DAQOPSERVER name_of_trbnetd + + +And don't forget to run cd xml-db;./xml-db.pl diff --git a/base/serials_dirich.db b/base/serials_dirich.db index b03f471..e90e083 100644 --- a/base/serials_dirich.db +++ b/base/serials_dirich.db @@ -159,6 +159,7 @@ 1551 0x8800000a49c06228 # dirich3 untested 1561 0xf500000a4931cf28 # dirich3 untested 1571 0x0a00000a48b56428 # dirich3 untested +1581 0x1d00000a48b66728 # new 26.5.2020 1591 0x5f00000a49dfb228 # dirich3 untested 1601 0x4600000a493fd228 # dirich3 untested 1611 0x4700000a49769028 # dirich3 untested @@ -1282,11 +1283,11 @@ - - - - - +50001 0x2500000bb7328028 # dirich4, untested +50011 0x1e00000bb793d528 # dirich4, untested, mounted in HADES +50021 0xbb00000bb7548e28 # dirich4, untested, mounted in HADES +50031 0x8000000bb732ae28 # dirich4, untested, mounted in HADES +50041 0x3d00000bb7093528 # dirich4, untested, mounted in HADES diff --git a/tools/check_ping.pl b/tools/check_ping.pl index bfcc610..bde6d66 100755 --- a/tools/check_ping.pl +++ b/tools/check_ping.pl @@ -4,38 +4,86 @@ use warnings; use strict; use Parallel::ForkManager; use Net::Ping; +use Getopt::Long; use Data::Dumper; -my @trbs = (78, 84, 101, 102); +my $power; +my $reboot; +my $help; -my $map = { - 1 => { trb => 84, sys => "TDC 00"}, - 2 => { trb => 101, sys => "TDC 01"}, - 3 => { trb => 78, sys => "TDC 02"}, - 4 => { trb => 102, sys => "TDC 03"}, - 0 => { trb => 61, sys => "CTS"}, -}; +my $result = GetOptions ( + "h|help" => \$help, + "p|powercycle" => \$power, + "r|reboot" => \$reboot + ); +my @trbs = (142,134,"009",130,128,131,129,158,144,139,138,164,166,137,163,153,136,162); + +my $map = { }; + +my $i = 0; +foreach my $cur_trb (@trbs) { + $map->{$i} = { trb => $cur_trb, addr => "0xdead", sys => "no assigned system" }; + $i++; +} +#print Dumper $map; + +#my $map = { +# 0 => { trb => 84, addr => "0xc001", sys => "CTS"}, +# 1 => { trb => 61, addr => "0x8610", sys => "TOF"}, +# 2 => { trb => 113, addr => "0x8113", sys => "TOF"}, +# 3 => { trb => 158, addr => "0x8158", sys => "TOF"}, +#}; + my $MAX_PROCESSES=50; my $pm = Parallel::ForkManager->new($MAX_PROCESSES); +my $maximal_reboot_counter = 4; +my $number_of_reboots_done = 0; + +my $rh_unsuccessful = {}; + +$pm->run_on_finish( + sub { my ($pid, $exit_code, $ident, $exit_signal, $core_dump, $data_structure_reference) = @_; + #print "** $ident just got out of the pool ". + # "with PID $pid and exit code: $exit_code\n"; + #print Dumper ($pid, $exit_code, $ident, $exit_signal, $core_dump, $data_structure_reference); + if ($exit_code == 0 && defined $data_structure_reference) { + $rh_unsuccessful->{$ident} = $$data_structure_reference; + } + } + ); #my $p = Net::Ping->new(); -#print Dumper keys %$map; -#exit; -foreach my $ct (keys %$map) { +my $first_iteration = 1; + +#print Dumper keys %$rh_unsuccessful; + +while ( (($first_iteration == 1) || keys %$rh_unsuccessful) && + ($number_of_reboots_done < $maximal_reboot_counter) ) { + #print Dumper $rh_unsuccessful; + #print Dumper keys %$rh_unsuccessful; + + $rh_unsuccessful = {}; + $first_iteration = 0; + foreach my $ct (keys %$map) { + my $success = 0; #my $num = sprintf "%3.3d", $ct; my $trbnum= $map->{$ct}->{trb}; my $num = sprintf "%3.3d", $trbnum; - my $host= "trb" . $num; + my $host= "trb3sc" . $num; + #my $host= "trb" . $num ."b"; my $system = $map->{$ct}->{sys}; #print "192.168.0.$ct $host.gsi.de $host\n"; #my $r = $p->ping($host,1); - my $c= "ping -W1 -c1 $host"; + my $c= "ping -W1 -i0.2 -c4 $host"; - my $pid = $pm->start and next; + # my $sysnum = sprintf "0x80%.2x", $ct; + my $sysnum = $map->{$ct}->{addr}; + #$sysnum = "0x7999" if $ct == -1; + my $pid = $pm->start("$sysnum") and next; #my $p = Net::Ping->new("udp", 1); #my $r = $p->ping("192.168.0.56"); @@ -43,19 +91,73 @@ foreach my $ct (keys %$map) { #print "result: $r\n"; my $r = qx($c); - my $sysnum = sprintf "0x80%.2x", $ct; - $sysnum = "0x7999" if $ct == -1; #printf "$sysnum, system: %-8s, trb: $host ", $system; printf "$sysnum $host %-8s ", $system; if (grep /64 bytes/, $r) { - print "is alive.\n"; + print "is alive.\n"; + $success = $trbnum; + } else { + print "is not alive.\n"; + } + + my $str = "jhhj"; + $pm->finish($success, \$host); # Terminates the child process + } + + $pm->wait_all_children; + + #$rh_unsuccessful = { "0x8007"=>"hh", "0x8001"=>"jjhj"} ; + + if ($reboot && ($number_of_reboots_done < $maximal_reboot_counter) && keys %$rh_unsuccessful) { + #print Dumper $rh_unsuccessful; + print "have to reboot FPGAs, first make a reset and reassign the addresses.\n"; + my $cmd = 'trbcmd reset; sleep 2; ~/trbsoft/daqtools/merge_serial_address.pl $DAQ_TOOLS_PATH/base/serials_trb3.db $USER_DIR/db/addresses_trb3.db'; + qx($cmd); + sleep 3; + # test trbnet: + my $error_str = "ERROR: read_uid failed: Termination Status Error"; + $cmd = "trbcmd i 0xffff 2>&1"; + my $r = qx($cmd); + if ($r=~/$error_str/) { + print "could not access trbnet, so have to reboot all FPGAs.\n"; + $rh_unsuccessful = { "0xffff"=>"all"} ; + } + + my $ctsnum = $map->{0}->{addr}; + if ($rh_unsuccessful->{ $ctsnum } || (scalar keys %$rh_unsuccessful) > 5) { + print "many TRBs (or CTS: ". $ctsnum . ") are not alive, so let us make a reload of all FPGAs.\n"; + $rh_unsuccessful = { "0xffff"=>"all"} ; } - else { - print "is not alive.\n"; - } - $pm->finish; # Terminates the child process + foreach my $cur (keys %$rh_unsuccessful) { + my $host = $rh_unsuccessful->{$cur}; + #my $cmd = "trbcmd reload " . $cur; + $cmd = "trbcmd reload $cur"; + print "rebooting: $cur\n"; + #print "$cmd\n"; + qx($cmd); + #print "number of reboots done: $number_of_reboots_done\n"; + } + print "wait 9 seconds\n"; + sleep 9; + $number_of_reboots_done++; + } + + + } -$pm->wait_all_children; +exit 1 if(scalar keys %$rh_unsuccessful > 0); + #$p->close(); + + + + + + + + + + + diff --git a/tools/spi_slave.pl b/tools/spi_slave.pl index 39b6f62..4485e8c 100755 --- a/tools/spi_slave.pl +++ b/tools/spi_slave.pl @@ -37,6 +37,7 @@ my $erasecfgflash; my $writecfgflash; my $verifycfgflash; my $verify; +my $fastcheck = 0; my $dumpuserflash; my $writeuserflash; my $rr; @@ -74,6 +75,7 @@ my $result = GetOptions ( "writecfgflash" => \$writecfgflash, "verifycfgflash" => \$verifycfgflash, "verifypage" => \$verify, + "fastcheck=i" => \$fastcheck, "dumpuserflash:s" => \$dumpuserflash, "writeuserflash:s" => \$writeuserflash, "eraseuserflash" => \$eraseuserflash, @@ -571,7 +573,7 @@ if ($execute eq "writecfgflash" | defined $writecfgflash) { if ($execute eq "verifycfgflash" | defined $verifycfgflash) { checkcfgflash(); - printf("Verify with file: %s \n", $filename); + printf("Verify %x with file: %s \n", $endpoint, $filename); if (!defined($filename)) {$filename=$verifycfgflash;} if (!defined $filename) { die "for the command verifycfgflash an option or --filename is missing.\n"; @@ -592,6 +594,7 @@ if ($execute eq "verifycfgflash" | defined $verifycfgflash) { my $p = 0; my $ok = 1; + # while (my $s = && ($fastcheck eq 0 || $p < $fastcheck)) { while (my $s = ) { my @t = split(' ',$s); @@ -603,7 +606,7 @@ if ($execute eq "verifycfgflash" | defined $verifycfgflash) { foreach my $e (sort keys %$b) { if (($b->{$e} & 0xff) ne (hex($t[$i+1]) & 0xff)) { printf("\nByte %i differs in page %x: flash: %02x file: %02x\n", $i, $p, $b->{$e}&0xff, hex($t[$i+1]) & 0xff); - $ok = 0; + $ok = 0; exit 1; } } } @@ -616,9 +619,14 @@ if ($execute eq "verifycfgflash" | defined $verifycfgflash) { # } $p++; + if ($fastcheck > 0 && $p > $fastcheck) { + last; + } + } if ($ok eq 0) { printf("\nVerification failed!!!\n"); + exit 1; } else { printf("\nVerification OK\n"); } diff --git a/users/giessen_lab/showMagParserValues.pl b/users/giessen_lab/showMagParserValues.pl index 6c949d3..835bf48 100755 --- a/users/giessen_lab/showMagParserValues.pl +++ b/users/giessen_lab/showMagParserValues.pl @@ -105,8 +105,7 @@ sub printOneLine { while(1) { #loop over all boards foreach my $board (1..$numberOfBoards) { - my $serialNumber = trb_register_read($boardAddress,0xe000 + $board); - + my $serialNumber = trb_register_read($boardAddress,0xe000 + $board); #loop over all sensors on each board foreach my $sensorNo (0..$numberOfSensors - 1) { @@ -140,6 +139,7 @@ sub printOneLine { } my $value = trb_register_read($boardAddress, (0xe000 + ($board * 16) + ($sensorNo * $numberOfSensors + $axis))); + printf("%x\n",$value->{$boardAddress}); my $sign = ($value->{$boardAddress} >> 27) & 0x1; $value = ($value->{$boardAddress} & 0b11111111111111111111111111)/100; if ($sign > 0) { diff --git a/web/htdocs/tools/beamabort.pl b/web/htdocs/tools/beamabort.pl index 211cb0e..85808bb 100755 --- a/web/htdocs/tools/beamabort.pl +++ b/web/htdocs/tools/beamabort.pl @@ -26,13 +26,13 @@ my @setup; my $i = 0; $setup[$i]->{name} = "Monitoring"; -$setup[$i]->{cmd} = "Shutdown2-0xfb35-RegisterMonitoring"; +$setup[$i]->{cmd} = "Shutdown2-0x0130-RegisterMonitoring"; $setup[$i]->{period} = 1000; $setup[$i]->{address} = 1; $i++; $setup[$i]->{name} = "Expert"; -$setup[$i]->{cmd} = "ShutdownLogic-0xfb35-ConfigRegisters"; +$setup[$i]->{cmd} = "ShutdownLogic-0x0130-ConfigRegisters"; $setup[$i]->{period} = 10000; $setup[$i]->{address} = 1; diff --git a/web/htdocs/tools/pwr/pwr_hmp.htm b/web/htdocs/tools/pwr/pwr_hmp.htm index 8a59298..ba65f44 100644 --- a/web/htdocs/tools/pwr/pwr_hmp.htm +++ b/web/htdocs/tools/pwr/pwr_hmp.htm @@ -122,13 +122,17 @@ function turn_off(chan) { function globalOn() { if(type=="HMP") new_commands.push("OUTP:GEN ON"); if(type=="HMC") new_commands.push("OUTP:MAST ON"); + forceShowReadings = 1; + updateTask = setTimeout("communication()",100); + } function globalOff() { if(type=="HMP") new_commands.push("OUTP:GEN OFF"); if(type=="HMC") new_commands.push("OUTP:MAST OFF"); - forceShowReadings = 1; + forceShowReadings = 1; + updateTask = setTimeout("communication()",100); } function update(data) {