From: hadeshyp Date: Fri, 7 Dec 2012 18:09:46 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=ce2751aeec04422f68eb8bb5bbfde3bafd663b11;p=daqtools.git *** empty log message *** --- diff --git a/cts/htdocs/commands/getpadiwa.pl b/cts/htdocs/commands/getpadiwa.pl index 3d882e7..856d962 100755 --- a/cts/htdocs/commands/getpadiwa.pl +++ b/cts/htdocs/commands/getpadiwa.pl @@ -1,17 +1,34 @@ #!/usr/bin/perl -w -&htsponse(200, "OK"); -print "Content-type: text/html\r\n\r\n"; + +eval{ + &htsponse(200, "OK"); + print "Content-type: text/html\r\n\r\n"; + }; use HADES::TrbNet; use Data::Dumper; + + if (!defined &trb_init_ports()) { die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}"); } -my ($board,$task) = split('-',$ENV{'QUERY_STRING'}); + + +my ($board,$task); + +if(exists $ENV{'QUERY_STRING'}) { + ($board, $task) = split('-',$ENV{'QUERY_STRING'}); + } +else { + ($board, $task) = @ARGV; +} +if(!defined $board || !defined $task) { + die "Not enough parameters"; + } $board = hex($board); @@ -40,7 +57,7 @@ for(my $i=0; $i < 4; $i++) { $ret->[$i*4+2] = sendcmd(0x10020000,$i); $ret->[$i*4+3] = sendcmd(0x10030000,$i); } - elsif ($task eq "thresh") { + elsif ($task eq "thresh" || $task eq "threshdump") { $num = 16; for(my $j=0;$j<16;$j++) { $ret->[$i*16+$j] = sendcmd(0x00000000+$j*0x10000,$i); @@ -50,20 +67,28 @@ for(my $i=0; $i < 4; $i++) { - -foreach my $b (sort keys %{$ret->[0]}) { - printf ("%04x",$b); - for(my $i=0; $i < 4*$num; $i++) { - if($task eq "id"){ - printf(" %04x",$ret->[$i]->{$b} & 0xffff); - } - else { - printf(" %d",$ret->[$i]->{$b}); +if($task ne "threshdump") { + foreach my $b (sort keys %{$ret->[0]}) { + printf ("%04x",$b); + for(my $i=0; $i < 4*$num; $i++) { + if($task eq "id"){ + printf(" %04x",$ret->[$i]->{$b} & 0xffff); + } + else { + printf(" %d",$ret->[$i]->{$b}); + } } + print "&"; } - print "&"; } +else { + print "# Board\tChain\tLen\tDAC\tChannel\tCommand\tValue\n"; + foreach my $b (sort keys %{$ret->[0]}) { + for(my $i=0; $i < 4*$num; $i++) { + printf(" %04x\t0x%x\t1\t0\t%d\t8\t0x%04x\n",$b,1<<($i/16),$i%16,$ret->[$i]->{$b} & 0xffff); + } + } - - + } +# print "# Board Chain ChainLen DAC Channel Command Value\n"; exit 1; diff --git a/dac_program.pl b/dac_program.pl index a629818..bcc33f5 100755 --- a/dac_program.pl +++ b/dac_program.pl @@ -43,7 +43,7 @@ while (my $a = <$fh>) { # print $reference."\n"; } - if(my ($board,$chain,$chainlen,$dac,$chan,$cmd,$val) = $a =~ /^\s*(\w\w\w\w)\s+(\w+)\s+(\d+)\s+(\d+)\s+(\d)\s+(\w)\s+(\w+)/) { + if(my ($board,$chain,$chainlen,$dac,$chan,$cmd,$val) = $a =~ /^\s*(\w\w\w\w)\s+(\w+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\w)\s+(\w+)/) { $val = hex(substr($val,2)) if (substr($val,0,2) eq "0x"); $chain = hex(substr($chain,2)) if (substr($chain,0,2) eq "0x"); $cmd = hex($cmd); diff --git a/padiwadump.pl b/padiwadump.pl new file mode 100755 index 0000000..ad4aac9 --- /dev/null +++ b/padiwadump.pl @@ -0,0 +1,7 @@ +#!/usr/bin/perl + +if($ARGV[0] eq "") { + die "Requires four hex digit network address of board to dump"; + } + +system("./cts/htdocs/commands/getpadiwa.pl ".$ARGV[0]." threshdump")