]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
current status, mt
authorHades User <M.Traxler@gsi.de>
Wed, 25 Oct 2017 09:10:32 +0000 (11:10 +0200)
committerHades User <M.Traxler@gsi.de>
Wed, 25 Oct 2017 09:10:32 +0000 (11:10 +0200)
base/serials_dirich_concentrator.db
thresholds/run_thresh_on_system.pl
thresholds/thresholds_automatic.pl
tools/dirich_power_switch_serdes_polarity_and_default_dirich_off.txt
tools/power_cycle
web/htdocs/tdc/tdc.htm

index ed97313ecce8ccf2afd74228db5bdd36b301fa83..d805085c5ef7751f3bf9b88b201047b70e23735a 100644 (file)
@@ -2,5 +2,5 @@
    0010      0xca00000712ac3228
    0020      0x3c00000711e47628
    0030      0xfd00000712ac3328
-
+   0999             0x7400000712a1eb28
 
index 2018d0daad04910ff392d4e914169e4f43692652..c2ae259458989871f01c32170b06fc51f5a309d2 100755 (executable)
@@ -20,6 +20,7 @@ my $opt_polarity = 0;
 my $opt_32channel = 0;
 my $opt_finetune = false;
 my $opt_sequential = false;
+my $mode = "padiwa";
 my $opt_verb;
 my $tool = "./thresholds_automatic.pl";
 #my $tool = "./thresholds_automatic_jan.pl";
@@ -33,10 +34,16 @@ GetOptions ('h|help'        => \$opt_help,
             'f|finetune'    => \$opt_finetune,
             's|sequential'    => \$opt_sequential,
             't|tool=s'      => \$tool,
+            'm|mode=s'      => \$mode,
             'v|verb'        => \$opt_verb);
 
 
 my $endpoints = get_ranges(\@opt_endpoints);
+
+if ($mode eq "dirich2") {
+  @opt_chains=(0);
+}
+
 my $chains    = get_ranges(\@opt_chains);
 
 if( $opt_help ) {
@@ -45,8 +52,8 @@ if( $opt_help ) {
 }
 
 
-#print Dumper $endpoints;
-#print Dumper $chains;
+print Dumper $endpoints;
+print Dumper $chains;
 
 if($opt_32channel == 1) {
     $opt_32channel="--32channel";
@@ -72,7 +79,7 @@ my %pids;
 foreach my $endpoint (@$endpoints) {
   foreach my $chain (@$chains) {
     my $endpoint = sprintf("0x%04x", $endpoint);
-    $command = "$tool -e $endpoint -o $opt_offset -c $chain -p $opt_polarity $opt_32channel $opt_finetune";
+    $command = "$tool --endpoint $endpoint --offset $opt_offset --chain $chain --polarity $opt_polarity --mode=$mode $opt_32channel $opt_finetune";
     print "command: $command\n";
 
     if($opt_sequential) {
index d8e229a0e82b14b2fbaa18f84571a0ee671db84c..7fab87ea2a6734165504d7cb65b5ec3f808f146a 100755 (executable)
@@ -30,7 +30,7 @@ my $USE_LOCK = 0;
 
 my $hitregister = 0xc001;
 
-my @valid_interval = (0x5000, 0xc000);
+my @valid_interval = (0x4000, 0xc000);
 my $interval_step = ($valid_interval[1] - $valid_interval[0])/2;
 my $start_value = int ( ($valid_interval[1] + $valid_interval[0])/2 );
 
@@ -123,13 +123,13 @@ $logger->info($startup_str);
 
 trb_init_ports() or die trb_strerror();
 
-my @current_thresh = ($start_value) x 16;
-my @best_thresh = (0) x 16;
-my @hit_diff = (0) x 16;
-my @crossed_thresh = (0) x 16;
-my @interval_step = ($interval_step) x 16;
+my @current_thresh = ($start_value) x 32;
+my @best_thresh = (0) x 32;
+my @hit_diff = (0) x 32;
+my @crossed_thresh = (0) x 32;
+my @interval_step = ($interval_step) x 32;
 
-if (defined $opt_skip && $opt_skip < 15) {
+if (defined $opt_skip && $opt_skip < 32) {
   $best_thresh[$opt_skip] = 0x7000;
 }
 
@@ -152,11 +152,12 @@ my $old_rh_res;
 my $outermost_channel_loop_counter = 0;
 
 #set default values
-my @zero_array = (0) x 16;
+my @zero_array = ($mode eq "dirich2") ? (0) x 32  : (0) x 16 ;
+
 write_thresholds($mode, $chain, \@zero_array);
 
 if($channel_by_channel == true) {
-    $outermost_channel_loop_counter = 15;
+    $outermost_channel_loop_counter = ($mode eq "dirich2") ? 31 : 15 ;
 }
 
 my @outermost_channel_loop = (0);
@@ -198,7 +199,7 @@ while ($number_of_steps < $number_of_iterations ||
     #print Dumper $rh_res;
     #print Dumper $old_rh_res;
 
-    my @iterate_loop = (0..15);
+    my @iterate_loop = ($mode eq "dirich2") ? (0 .. 31) : (0 .. 15);
     if($channel_by_channel) {
        @iterate_loop = ($current_channel_outer_loop);
     }
@@ -275,12 +276,12 @@ while ($number_of_steps < $number_of_iterations ||
 map { $_-= ($offset * $default_direction) } @best_thresh;
 write_thresholds($mode, $chain, \@best_thresh, $channel_to_set);
 
-my $uid;
+my $uid = 0;
 foreach my $i (reverse (0 .. 3)) {
   #print "send command: $endpoint , i: $i\n";
   # read uids
-  $rh_res = Dmon::PadiwaSendCmd(0x10000000 | $i * 0x10000, $endpoint, $chain);
-  $uid .= sprintf("%04x", $rh_res->{$endpoint} &0xffff);
+  #$rh_res = Dmon::PadiwaSendCmd(0x10000000 | $i * 0x10000, $endpoint, $chain);
+  #$uid .= sprintf("%04x", $rh_res->{$endpoint} &0xffff);
   #print $uid;
 }
 
@@ -289,7 +290,7 @@ my $str;
 #$logger_data->info(sprintf "endpoint: %04x, chain: %02d, uid: $uid", $endpoint, $chain);
 #$logger_data->info("\t".time);
 
-my @range = (0 .. 15);
+my @range = ($mode eq "dirich2") ? (0 .. 31) : (0 .. 15);
 
 if($channel_by_channel) {
     @range = ($current_channel_outer_loop .. $current_channel_outer_loop);
@@ -334,7 +335,8 @@ sub read_thresholds {
 my $rh_res;
 #    $rh_res = trb_register_write($endpoint,0xd410, 1 << $chain);
 
-  foreach my $current_channel (0 .. 15) {
+  my @range = ($mode eq "dirich2") ? (0 .. 31) : (0 .. 15);
+  foreach my $current_channel (@range) {
 
     my $command;
     my $fixed_bits;
@@ -382,10 +384,11 @@ sub write_thresholds {
   }
   ### old and wrong way #my $rh_res = trb_register_write($endpoint,0xd410, 1 << $chain);
 
-  my @range = (0 .. 15);
-  if (defined $channel_to_set && $channel_to_set <16 ) {
-      @range = ($channel_to_set .. $channel_to_set);
-      #print "range: \n";
+  my @range = ($mode eq "dirich2") ? (0 .. 31) : (0 .. 15);
+
+  if (defined $channel_to_set && $channel_to_set <32 ) {
+    @range = ($channel_to_set .. $channel_to_set);
+    #print "range: \n";
   }
 
   #print Dumper \@range;
@@ -407,13 +410,24 @@ sub write_thresholds {
       $channel_shift = 16;
     }
     elsif ($mode eq "dirich2") {
-      $fixed_bits = 0x00800000;
+      $fixed_bits = 0x8 << 20;
       $shift_bits = 0;
       $channel_shift = 24;
     }
 
     $command = $fixed_bits | ($current_channel << $channel_shift) | ($ra_thresh->[$current_channel] << $shift_bits);
-    Dmon::PadiwaSendCmd($command,$endpoint, $chain);
+
+    if ($mode eq "dirich2") {
+      if ($current_channel<16) {
+        Dmon::PadiwaSendCmd($command,$endpoint, 0);
+      } else {
+        Dmon::PadiwaSendCmd($command,$endpoint, 1);
+      }
+
+    } elsif ($mode eq "padiwa") {
+      Dmon::PadiwaSendCmd($command,$endpoint, $chain);
+    }
+
   }
 
   #sleep 10 if($current_channel == 15 && $chain==1);
@@ -421,7 +435,6 @@ sub write_thresholds {
   if($USE_LOCK) {
       $share->unlock();
   }
-      
 }
 
 sub send_command {
index 10f1d7b5d213501fccb24d18c50f1ba15e4fd5ab..9da786d3352828e9183a3efe1210c5e6c04d6164 100644 (file)
@@ -1,2 +1,2 @@
 0xb6c1 2
-0xd580 0xffffffff
+#0xd580 0xffffffff
index 19b44b0ba7fff3f0492d94359706c25de7a85c35..329d0e212cf09d9a662975ac56b40c4c8f9f039a 100755 (executable)
@@ -13,7 +13,7 @@ my $ra_setup = [ { host => "wiznet02:5000",
                   ##idn => "HAMEG,HMP4040,021527872,HW50020001/SW2.41",
                    idn => "HAMEG,HMP4040,103161,HW50020001/SW2.51",
                   channels => [ 'clock', 'TDB', 'TBD', 'dirich'],
-                  commands => {status => 'OUTPUT:STATE?', off => 'OUTPUT:SEL OFF', on => 'OUTPUT:SEL ON'}
+                  commands => {status => 'OUTPUT:STATE?', off => 'OUTPUT:SEL OFF', on => 'OUTPUT:SEL ON', select_channel => 'INST OUT4'}
                 },
                 { host => "wiznet03:5000",
                   idn => "RIGOL TECHNOLOGIES,DP712,DP7B182500302,00.01.02",
@@ -59,6 +59,9 @@ sub main {
   my $current_status = write_and_read($actual_setup->{commands}->{status});
   print "current status: $current_status\n";
 
+  print "select channel if appropriate for the device\n";
+  write_and_read($actual_setup->{commands}->{select_channel}) if (defined $actual_setup->{commands}->{select_channel});
+
   print "turn off power supply channel\n";
   write_and_read($actual_setup->{commands}->{off});
 
index 8b0a1f78789014878002303827adbc8c6d220008..f01a42d8254be61722ab755e90f37500b1f24bdd 100644 (file)
@@ -138,9 +138,9 @@ function update(data) {
     for(j=0;j<b.length-1;j++) {
       if(isShown[j]) {
         enabled = (enableGroup[j][Math.floor((i-2)/32)]&1<<(i-2)%32)?"checked":"";
-        if(showhitrate == 0 && enabled == 0 && i != 1) 
-          val = 0x0;
-        else {
+//        if(showhitrate == 0 && enabled == 0 && i != 1) 
+//          val = 0x0;
+//        else {
           if(differences) {
             val = (c[j][i] & 0x7FFFFFFF)- ((oldvalues[j][i]||0) & 0x7FFFFFFF);
             if (val < 0) {
@@ -150,7 +150,7 @@ function update(data) {
           else {
             val = c[j][i] & 0x7FFFFFFF;
             }
-          }
+//          }
         if(showstatus && enabled)
           o += "<td title="+tooltipstatus+" class=\""+((c[j][i] &0x80000000)?"over":"under")+"\">";
         else