From: Hades DAQ Date: Mon, 29 May 2017 20:21:32 +0000 (+0200) Subject: new tools, new dirich serials, mt X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=e7afded357fed158dc546a6c309cce47185f3abf;p=daqtools.git new tools, new dirich serials, mt --- diff --git a/base/serials_dirich.db b/base/serials_dirich.db index 50c12a2..520244a 100644 --- a/base/serials_dirich.db +++ b/base/serials_dirich.db @@ -12,3 +12,39 @@ 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 index 0000000..16b680f --- /dev/null +++ b/tools/dirich_scan_backplane.pl @@ -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 index 0000000..71f9ce8 --- /dev/null +++ b/tools/switch_power_dirich.pl @@ -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 \n"; +} diff --git a/users/gsi_ee_trb84/db/addresses_dirich.db b/users/gsi_ee_trb84/db/addresses_dirich.db index c9da922..2c67829 100644 --- a/users/gsi_ee_trb84/db/addresses_dirich.db +++ b/users/gsi_ee_trb84/db/addresses_dirich.db @@ -13,3 +13,35 @@ 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 diff --git a/users/gsi_ee_trb84/first.C b/users/gsi_ee_trb84/first.C index 4633435..66418bf 100644 --- a/users/gsi_ee_trb84/first.C +++ b/users/gsi_ee_trb84/first.C @@ -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.);