use Dmon;
use HPlot;
use Data::Dumper;
+use Perl2Epics;
my %config = Dmon::StartUp();
my $t0;
+for(my $i = 1; $i<=20; $i++) {
+ my $name = sprintf('CBM:PWRSWITCH:GetCurrent%02x',$i);
+ Perl2Epics::Connect("C".$i,$name);
+}
+
while(1) {
+# update billboard
+ my @billboardValues = ();
+ my $reg;
+
+ my $epicsData = Perl2Epics::GetAll();
+
+ # temp & pressure
+ $billboardValues[0] = 0xdeadc0de;
+
+ # currents
+ for(my $i = 1; $i<=20; $i++) {
+ my $milAmp = $epicsData->{"C".$i}->{"val"} * 1000;
+ $reg = 0 unless $i & 1;
+ $reg |= ($milAmp & 0xffff) << (16 * ($i&1));
+ $billboardValues[$i / 2 + 1] = $reg;
+ }
+
+ trb_register_write_mem($config{BillboardAddress}, 0xb100, 0, \@billboardValues, scalar @billboardValues); # copy data
+ trb_register_write($config{BillboardAddress}, 0xb000, scalar @billboardValues); # commit
+
+# build statistics
my $title = "Billboard";
my $longtext='';
my $value='';
my $status = Dmon::OK;
my $regs = trb_registertime_read_mem($config{BillboardAddress},0xb000, 0, 5);
-
if(defined $regs->{$config{BillboardAddress}}) {
my $rates = Dmon::MakeRate(0,32,0,$regs);
if (defined($rates->{$config{BillboardAddress}}{rate}) && $t0) {
$t0 = [gettimeofday];
Dmon::WriteQALog($config{flog},"billboard",6,$status,$title,$value,$longtext) if ($longtext);
- usleep(5e6);
+ usleep(5e5);
}
$max = $temp;
$maxboard = $b;
}
- elsif ($min > $temp) {
+ if ($min > $temp) {
$min = $temp;
$minboard = $b;
}
use warnings;
use Data::Dumper;
+use lib "/home/hadaq/trbsoft/daqtools/dmon/code";
+use Dmon;
use Getopt::Long;
use Log::Log4perl qw(get_logger);
my $uid;
foreach my $i (reverse (0..3)) {
#print "send command: $endpoint , i: $i\n";
- $rh_res = send_command($endpoint, $chain, 0x10000000 | $i * 0x10000);
+ $rh_res = Dmon::PadiwaSendCmd($endpoint, $chain, 0x10000000 | $i * 0x10000);
$uid .= sprintf("%04x", $rh_res->{$endpoint} &0xffff);
#print $uid;
}
die "could not lock shared element";
}
- my $rh_res = trb_register_write($endpoint,0xd410, 1 << $chain);
+# my $rh_res = trb_register_write($endpoint,0xd410, 1 << $chain);
foreach my $current_channel (0..15) {
}
$command = $fixed_bits | ($current_channel << 16) ;
- my $rh_res = send_command($endpoint, $chain, $command);
+ my $rh_res = Dmon::PadiwaSendCmd($endpoint, $chain, $command);
push (@thresh , $rh_res->{$endpoint});
}
}
$command = $fixed_bits | ($current_channel << 16) | ($ra_thresh->[$current_channel] << $shift_bits);
- send_command($endpoint, $chain, $command);
+ Dmon::PadiwaSendCmd($endpoint, $chain, $command);
}
use warnings;
use Data::Dumper;
+use lib "/home/hadaq/trbsoft/daqtools/dmon/code";
+use Dmon;
+
use Getopt::Long;
use HADES::TrbNet;
$shift_bits = 4;
}
- my $command= $fixed_bits | ($current_channel<<16) | ($thresh << $shift_bits);
+ my $command= $fixed_bits | ($current_channel << 16) | ($thresh << $shift_bits);
- send_command($endpoint, $chain, $command);
+ Dmon::PadiwaSendCmd($endpoint, $chain, $command);
}
0x00d0,0x00d1,0x00d2,0x00d3,
0x00e0,0x00e1,0x00e2,0x00e3,
0x00f0,0x00f1,0x00f2,0x00f3,
- 0x0100,0x0101,0x0102,0x0103],
+ 0x0100,0x0101,0x0102,0x0103,
+ 0x0111],
HubTrbAdresses => [0x7005,0x7000,0x7001,0x7002,0x7003,
0x0015,
0x0102 0 0xffffffff 0x00000000
0x0103 0 0x00000000 0x00000000
-#for now: disable TDC for beam counter
-
- 0x0110 0 0x0000ffff 0x00000000
- 0x0111 0 0x00000000 0x00000000
- 0x0112 0 0x00000000 0x00000000
- 0x0113 0 0x00000000 0x00000000
+ 0x0110 0 0x0000ffff 0x00000000 #gpin
+ 0x0111 0 0xffffffff 0x00000000 #padiwa amps
+ #0x0112 0 0x00000000 0x00000000 #billboard
+ #0x0113 0 0x00000000 0x00000000
# Hub # Type # C0 # C1 # C2 # C3 # C4 # C5 # C6 # C7 # C8 #
########################################################################################################################################
- 0x7005 0 0x7e344bb9 0x4016 0xc0a80003 0xc350 0xdead8000 0x001b 0xc0a80000 0xc350 0x0578
- 0x8015 0 0x7e344bb9 0x4016 0xc0a80003 0xc351 0xdead8001 0x001b 0xc0a80001 0xc351 0x0578
- 0x8025 0 0x7e344bb9 0x4016 0xc0a80003 0xc352 0xdead8002 0x001b 0xc0a80002 0xc352 0x0578
- 0x8035 0 0x7e344bb9 0x4016 0xc0a80003 0xc353 0xdead8003 0x001b 0xc0a80003 0xc353 0x0578
- 0x8045 0 0x7e344bb9 0x4016 0xc0a80003 0xc354 0xdead8004 0x001b 0xc0a80004 0xc354 0x0578
- 0x8055 0 0x7e344bb9 0x4016 0xc0a80003 0xc355 0xdead8005 0x001b 0xc0a80005 0xc355 0x0578
- 0x8065 0 0x7e344bb9 0x4016 0xc0a80003 0xc356 0xdead8006 0x001b 0xc0a80006 0xc356 0x0578
- 0x8075 0 0x7e344bb9 0x4016 0xc0a80003 0xc357 0xdead8007 0x001b 0xc0a80007 0xc357 0x0578
- 0x8085 0 0x7e344bb9 0x4016 0xc0a80003 0xc358 0xdead8008 0x001b 0xc0a80008 0xc358 0x0578
- 0x8095 0 0x7e344bb9 0x4016 0xc0a80003 0xc359 0xdead8009 0x001b 0xc0a80009 0xc359 0x0578
- 0x80a5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35a 0xdead8010 0x001b 0xc0a80010 0xc35a 0x0578
- 0x80b5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35b 0xdead8011 0x001b 0xc0a80011 0xc35b 0x0578
- 0x80c5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35c 0xdead8012 0x001b 0xc0a80012 0xc35c 0x0578
- 0x80d5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35d 0xdead8013 0x001b 0xc0a80013 0xc35d 0x0578
- 0x80e5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35e 0xdead8014 0x001b 0xc0a80014 0xc35e 0x0578
- 0x80f5 0 0x7e344bb9 0x4016 0xc0a80003 0xc35f 0xdead8015 0x001b 0xc0a80015 0xc35f 0x0578
- 0x8105 0 0x7e344bb9 0x4016 0xc0a80003 0xc360 0xdead8016 0x001b 0xc0a80016 0xc360 0x0578
- 0x8115 0 0x7e344bb9 0x4016 0xc0a80003 0xc361 0xdead8017 0x001b 0xc0a80017 0xc361 0x0578
+ 0x7005 0 0x7e344bb9 0x4016 0x0aa0004d 0xc350 0xdead8000 0x001b 0xc0a80000 0xc350 0x0578
+ 0x8015 0 0x7e344bb9 0x4016 0x0aa0004d 0xc351 0xdead8001 0x001b 0xc0a80001 0xc351 0x0578
+ 0x8025 0 0x7e344bb9 0x4016 0x0aa0004d 0xc352 0xdead8002 0x001b 0xc0a80002 0xc352 0x0578
+ 0x8035 0 0x7e344bb9 0x4016 0x0aa0004d 0xc353 0xdead8003 0x001b 0xc0a80003 0xc353 0x0578
+ 0x8045 0 0x7e344bb9 0x4016 0x0aa0004d 0xc354 0xdead8004 0x001b 0xc0a80004 0xc354 0x0578
+ 0x8055 0 0x7e344bb9 0x4016 0x0aa0004d 0xc355 0xdead8005 0x001b 0xc0a80005 0xc355 0x0578
+ 0x8065 0 0x7e344bb9 0x4016 0x0aa0004d 0xc356 0xdead8006 0x001b 0xc0a80006 0xc356 0x0578
+ 0x8075 0 0x7e344bb9 0x4016 0x0aa0004d 0xc357 0xdead8007 0x001b 0xc0a80007 0xc357 0x0578
+ 0x8085 0 0x7e344bb9 0x4016 0x0aa0004d 0xc358 0xdead8008 0x001b 0xc0a80008 0xc358 0x0578
+ 0x8095 0 0x7e344bb9 0x4016 0x0aa0004d 0xc359 0xdead8009 0x001b 0xc0a80009 0xc359 0x0578
+ 0x80a5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35a 0xdead8010 0x001b 0xc0a80010 0xc35a 0x0578
+ 0x80b5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35b 0xdead8011 0x001b 0xc0a80011 0xc35b 0x0578
+ 0x80c5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35c 0xdead8012 0x001b 0xc0a80012 0xc35c 0x0578
+ 0x80d5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35d 0xdead8013 0x001b 0xc0a80013 0xc35d 0x0578
+ 0x80e5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35e 0xdead8014 0x001b 0xc0a80014 0xc35e 0x0578
+ 0x80f5 0 0x7e344bb9 0x4016 0x0aa0004d 0xc35f 0xdead8015 0x001b 0xc0a80015 0xc35f 0x0578
+ 0x8105 0 0x7e344bb9 0x4016 0x0aa0004d 0xc360 0xdead8016 0x001b 0xc0a80016 0xc360 0x0578
+ 0x8115 0 0x7e344bb9 0x4016 0x0aa0004d 0xc361 0xdead8017 0x001b 0xc0a80017 0xc361 0x0578
#0x8125 0 0x7e344bb9 0x4016 0xc0a80002 0xc362 0xdead8018 0x001b 0xc0a80018 0xc362 0x0578
#0x8135 0 0x7e344bb9 0x4016 0xc0a80002 0xc363 0xdead8019 0x001b 0xc0a80019 0xc363 0x0578
#0x8145 0 0x7e344bb9 0x4016 0xc0a80002 0xc364 0xdead8020 0x001b 0xc0a80020 0xc364 0x0578
fi
#export TRB3_SERVER=trb056
-export DAQOPSERVER=localhost:56
+export DAQOPSERVER=10.160.0.77:56
+
-echo -n "- number of trb endpoints in the system: "
-trbcmd i 0xffff | wc -l
##################################################
## System Reset
##################################################
+echo "Doing reset"
trbcmd reset
+echo -n "- number of trb endpoints in the system: "
+trbcmd i 0xffff | wc -l
##################################################
## Set addresses
##################################################
0x00d0 0x00d1 0x00d2 0x00d3 \
0x00e0 0x00e1 0x00e2 0x00e3 \
0x00f0 0x00f1 0x00f2 0x00f3 \
-0x0100 0x0101 0x0102 0x0103 "
+0x0100 0x0101 0x0102 0x0103 0x111"
echo "done..."
# enable used channels
--- /dev/null
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 00 threshold: 0x06F6, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 01 threshold: 0xDB23, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 02 threshold: 0x077D, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 03 threshold: 0xDC50, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 04 threshold: 0x0672, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 05 threshold: 0xDC50, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 06 threshold: 0xffff, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 07 threshold: 0x0000, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 08 threshold: 0xffff, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 09 threshold: 0x0000, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 10 threshold: 0xffff, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 11 threshold: 0x0000, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 12 threshold: 0xffff, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 13 threshold: 0x0000, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 14 threshold: 0xffff, uid: 0
+2014/10/20 00:00:00 endpoint: 0x0111, chain: 00, channel: 15 threshold: 0x0000, uid: 0
\ No newline at end of file