]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
new tools, new dirich serials, mt
authorHades DAQ <hadaq@hades39.gsi.de>
Mon, 29 May 2017 20:21:32 +0000 (22:21 +0200)
committerHades DAQ <hadaq@hades39.gsi.de>
Mon, 29 May 2017 20:21:32 +0000 (22:21 +0200)
base/serials_dirich.db
tools/dirich_scan_backplane.pl [new file with mode: 0755]
tools/switch_power_dirich.pl [new file with mode: 0755]
users/gsi_ee_trb84/db/addresses_dirich.db
users/gsi_ee_trb84/first.C

index 50c12a2f9fb79647179297c8c73c2c80c042ef63..520244a7400f6a1fad067a8f9db5689f50e2a5cb 100644 (file)
 0071   0x5800000711e42b28
 0081   0x85000007122da928
 0091    0xfa000007122db628
+
+#dirich2
+0121    0x9f000007127ce828
+
+
+0131    0xa800000712858028
+0141    0x330000071288d328
+0151    0x83000007129a7d28
+0161    0xef000007124c8928
+0171    0x7000000712af5328
+0181    0x22000007121e3d28
+0191    #ffm
+0201    #ffm
+0211    #ffm
+0221    #ffm
+0231    0x7a000007124d0f28
+0241    0xc9000007124c9528
+0251    0x83000007124c9828
+0261    0xca00000712ac3228
+0271    0xe300000712a35528
+0281    0x2900000712a3fc28
+0291    0xbb000007121bb528
+0301    0x4a000007123b7c28
+0311    0x44000007126ee728 # 47pF     
+0321    0x49000007125cb828 # 47pF
+0331    0x6000000712804728 # 22pF
+0341    0x530000071273f328 # 22pF
+0351    0xdb000007125c9728 # 10pF
+0361    0xdf000007125cb128 # 10pF
+0371    0x06000007121e3228
+0381    0x58000007124d3528
+0391    0x1300000712a20b28
+0401    0xa0000007124d3e28
+0411    0xba00000712a35628
+0421
+
diff --git a/tools/dirich_scan_backplane.pl b/tools/dirich_scan_backplane.pl
new file mode 100755 (executable)
index 0000000..16b680f
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Data::Dumper;
+
+my $dirich_concentrator_address = $ARGV[0];
+
+my $c;
+
+#($dirich_concentrator_address) = $dirich_concentrator_address =~ /0x([\w\d]+)/;
+
+$c= "./switch_power_dirich.pl $dirich_concentrator_address all off"; qx($c);
+qx($c);
+
+sleep 1;
+
+foreach my $cur_position (1..12) {
+  $c = "./switch_power_dirich.pl $dirich_concentrator_address $cur_position on";
+  #print $c . "\n";
+  qx($c);
+  sleep 4;
+  $c = "~/trbsoft/daqtools/merge_serial_address.pl $ENV{DAQ_TOOLS_PATH}/base/serials_dirich.db $ENV{USER_DIR}/db/addresses_dirich.db";
+
+  qx($c);
+  $c = "trbcmd reset; sleep 1; trbcmd i 0xffff | grep ^0x12";
+  my $r = qx($c);
+
+  print "position: $cur_position: $r\n";
+  $c = "./switch_power_dirich.pl $dirich_concentrator_address $cur_position off";
+  qx($c);
+}
diff --git a/tools/switch_power_dirich.pl b/tools/switch_power_dirich.pl
new file mode 100755 (executable)
index 0000000..71f9ce8
--- /dev/null
@@ -0,0 +1,87 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use HADES::TrbNet;
+use Time::HiRes qw(usleep);
+use Data::Dumper;
+
+my $dirich = 0x1208;
+my $dirich_power_module_offset = 0xd580;
+
+my @res; my $res; my $rh_res;
+
+my @dirich_powerbit_mapping = (1, 23, 17, 24, 18, 26, 20, 25, 19, 28, 22, 27,21);
+
+my $dirich_concentrator_address = $ARGV[0];
+my $position = $ARGV[1];
+my $state = $ARGV[2];
+my $positions_pattern = 1;
+
+
+if (!$position || !$state || ! ($state=~/(on|off|toggle)/)  )  {
+  usage();
+  exit;
+}
+
+#($dirich_concentrator_address) = $dirich_concentrator_address =~ /0x([\w\d]+)/;
+$dirich_concentrator_address = hex($dirich_concentrator_address);
+#print $dirich_concentrator_address;
+
+
+if ($position eq "all") {
+  $position = 0;
+  $positions_pattern = 0xffffffff;
+}
+
+my $new_state=($state eq "on") ? 0 : 1;
+
+trb_init_ports() or die trb_strerror();
+
+$res = trb_register_write($dirich, 0xdf80 , 0xffffffff);
+if(!defined $res) {
+    $res = trb_strerror();
+    print "error output: $res\n";
+}
+
+$rh_res = trb_register_read($dirich_concentrator_address, $dirich_power_module_offset);
+my $bitmap = $rh_res->{$dirich_concentrator_address};
+if (! defined $bitmap) {
+  printf "could not read bitmap from 0x%x TRBNet down?\n", $dirich_concentrator_address;
+  exit;
+}
+
+
+#printf "old bitmap: 0x%x\n", $bitmap;
+
+my $mask = $positions_pattern << ($dirich_powerbit_mapping[$position]-1);
+
+if ($state eq "on") {
+  $bitmap &= ~$mask;
+}
+elsif ($state eq "off") {
+  $bitmap |= $mask;
+}
+elsif ($state eq "toggle") {
+  my $old_bitmap = $bitmap;
+  $bitmap ^= $mask;
+  print "turned module $position ";
+  my $diff = $old_bitmap ^ $bitmap;
+
+  if ($bitmap & $mask) {
+    print "off\n";
+  }
+  else {
+    print "on\n";
+  }
+}
+
+#printf "new bitmap: 0x%x\n", $bitmap;
+trb_register_write($dirich_concentrator_address, $dirich_power_module_offset , $bitmap);
+
+usleep (1E5);
+exit;
+
+
+sub usage {
+  print "switch_power_dirich.pl <position in backplane> <on|off|toggle>\n";
+}
index c9da9227c08e45a450faf42c12a45efc044c1ccc..2c6782931d57a3b5f154f5150250bd9176ea6920 100644 (file)
 0x1208             0081     1
 0x1209             0091     1
 
+0x1210      0101     1
+0x1211      0111     1
+0x1212      0121     1
+0x1213      0131     1
+0x1214      0141     1
+0x1215      0151     1
+0x1216      0161     1
+0x1217      0171     1
+0x1218      0181     1
+0x1219      0191     1
+0x1220      0201     1
+0x1221      0211     1
+0x1222      0221     1
+0x1223      0231     1
+0x1224      0241     1
+0x1225      0251     1
+0x1226      0261     1
+0x1227      0271     1
+0x1228      0281     1
+0x1229      0291     1
+0x1230      0301     1
+0x1231      0311     1
+0x1232      0321     1
+0x1233      0331     1
+0x1234      0341     1
+0x1235      0351     1
+0x1236      0361     1
+0x1237      0371     1
+0x1238      0381     1
+0x1239      0391     1
+0x1240      0401     1
+0x1241      0411     1
index 4633435dcf3946af6b5b74c92c84a23f678d8eee..66418bfde1a9c986f5de404ef2a32eed7a8abe60 100644 (file)
@@ -16,7 +16,7 @@ void first()
    hadaq::TdcMessage::SetFineLimits(81, 464);
 
    // default channel numbers and edges mask
-   hadaq::TrbProcessor::SetDefaults(32, 1);
+   hadaq::TrbProcessor::SetDefaults(33, 2);
 
    // [min..max] range for TDC ids
    hadaq::TrbProcessor::SetTDCRange(0x1200, 0x15FF);
@@ -103,13 +103,11 @@ extern "C" void after_create(hadaq::HldProcessor* hld)
       //  tdc->SetRefChannel(nch, nch-1, 0xffff, 10000,  -90., 90.);
       //}
 
-      tdc->SetRefChannel(2, 1, 0xffff, 10000,  -20., 20.);
-      tdc->SetRefChannel(3, 1, 0xffff, 10000,  -20., 20.);
-      tdc->SetRefChannel(4, 1, 0xffff, 10000,  -20., 20.);
-      tdc->SetRefChannel(5, 1, 0xffff, 10000,  -20., 20.);
-      tdc->SetRefChannel(6, 1, 0xffff, 10000,  -20., 20.);
-      tdc->SetRefChannel(7, 1, 0xffff, 10000,  -20., 20.);
-      tdc->SetRefChannel(8, 1, 0xffff, 10000,  -20., 20.);
+      for (unsigned j=0; j<33; j++) {
+        tdc->SetRefChannel(j, 1, 0xffff, 10000,  -40., 40.);
+      }
+
+      //tdc->SetRefChannel(0, 0, 0x1202, 10000,  -20., 20.);
       //tdc->SetRefChannel(4, 2, 0xffff, 10000,  -20., 20.);
       //tdc->SetRefChannel(1, tdc->NumChannels() -1 , 0xffff, 20000,  -10., 10.);