]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
*** empty log message ***
authorhadeshyp <hadeshyp>
Fri, 7 Dec 2012 18:09:46 +0000 (18:09 +0000)
committerhadeshyp <hadeshyp>
Fri, 7 Dec 2012 18:09:46 +0000 (18:09 +0000)
cts/htdocs/commands/getpadiwa.pl
dac_program.pl
padiwadump.pl [new file with mode: 0755]

index 3d882e70bd31130261aeceaa691ab2b3e7bf7ab1..856d962b57ad7cac4cf0f538be1a850acc835e9e 100755 (executable)
@@ -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;
index a629818cd511910fa60088f2202efae378e13247..bcc33f5ba4833c4d525cdc9c53499d7d14331aae 100755 (executable)
@@ -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 (executable)
index 0000000..ad4aac9
--- /dev/null
@@ -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")