trb_init_ports() or
die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}");
-my @regs = (0,1,2,4,5,6,8,9,10,12,13,14,0x31,0x32,0x33,0x34,0x35);
+my @regs = (0,1,2,4,5,6,8,9,10,12,13,14,0x31,0x32,0x33,0x34,0x35,0x37,0x38,0x39,0x3a,0x3b
+);
my $setups = {
}
sub convbox {
- my $tmp = $_[0];
- my $multtmp = $_[1];
-
- my @t = split('',$tmp);
- my @m = split('',$multtmp);
+ my @t = split('',$_[0]);
+ my @m0 = split('',$_[1]);
+ my @m1 = split('',$_[2]);
+ my @m2 = split('',$_[3]);
+ my $length = $_[4];
my $out = "";
- foreach my $i (0..(scalar @t)-1) {
- $out .= "<font style=\"color:#0a0;\">◼</font>" if (($m[$i] ==1) && ($t[$i] eq '0'));
- $out .= "<font style=\"color:#0a0;\">◼</font>" if (($m[$i] ==1) && ($t[$i] eq '1'));
- $out .= "<font style=\"color:black\">◼</font>" if (($m[$i] ==0) && ($t[$i] eq '1'));
- $out .= "<font style=\"color:black\">◻</font>" if (($m[$i] ==0) && ($t[$i] eq '0'));
-
-
+ foreach my $i (0..$length-1) {
+ if($m0[$i] == 1) {
+ $out .= "<font style=\"color:#0a0;\">◼</font>";
+ }
+ elsif($m1[$i] == 1) {
+ $out .= "<font style=\"color:#0da;\">◼</font>";
+ }
+ elsif($m2[$i] == 1) {
+ $out .= "<font style=\"color:#aa0;\">◼</font>";
+ }
+ else {
+ $out .= "<font style=\"color:black\">◼</font>" if (($t[$i] eq '1'));
+ $out .= "<font style=\"color:black\">◻</font>" if (($t[$i] eq '0'));
+ }
+
if ($i%4 == 3) {$out .=' ';}
}
sub makeinputbits {
my ($d,$s) = @_;
my $o = "";
- my $multtmp = $d->{0x33};
- $multtmp = 0 if (! ($d->{0x34} & (1 << (8+$s))));
-
- $multtmp = sprintf("%032b", $multtmp);
- my $tmp = sprintf("%032b",$d->{$s*4});
- $tmp = convbox($tmp,$multtmp);
- $o .= $tmp."<br>";
+ my $length = $d->{0x31} & 0x3f;
+ $length = 32 if $length > 32;
+
+ my $tmp = sprintf("%0".$length."b",$d->{$s*4});
+ my $multtmp0 = $d->{0x33};
+ $multtmp0 = 0 if (! ($d->{0x34} & (1 << (8+$s))));
+ $multtmp0 = sprintf("%0".$length."b", $multtmp0);
+ my $multtmp1 = $d->{0x38};
+ $multtmp1 = 0 if (! ($d->{0x37} & (1 << (0+$s))));
+ $multtmp1 = sprintf("%0".$length."b", $multtmp1);
+ my $multtmp2 = $d->{0x3a};
+ $multtmp2 = 0 if (! ($d->{0x37} & (1 << (8+$s))));
+ $multtmp2 = sprintf("%0".$length."b", $multtmp2);
+
+ $o .= convbox($tmp,$multtmp0,$multtmp1,$multtmp2,$length)."<br>";
+ $length = ($d->{0x31} & 0x3f) - 32;
+ return $o if $length <= 0;
- $multtmp = $d->{0x35};
- $multtmp = 0 if (! ($d->{0x34} & (1 << (8+$s))));
- $multtmp = sprintf("%032b", $multtmp);
- $tmp = sprintf("%032b",$d->{$s*4+1});
- $tmp = convbox($tmp,$multtmp);
- $o .= $tmp;
+ $tmp = sprintf("%0".$length."b",$d->{$s*4+1});
+ $multtmp0 = $d->{0x35};
+ $multtmp0 = 0 if (! ($d->{0x34} & (1 << (8+$s))));
+ $multtmp0 = sprintf("%0".$length."b", $multtmp0);
+ $multtmp1 = $d->{0x39};
+ $multtmp1 = 0 if (! ($d->{0x37} & (1 << (0+$s))));
+ $multtmp1 = sprintf("%0".$length."b", $multtmp1);
+ $multtmp2 = $d->{0x3b};
+ $multtmp2 = 0 if (! ($d->{0x37} & (1 << (8+$s))));
+ $multtmp2 = sprintf("%0".$length."b", $multtmp2);
+
+ $o .= convbox($tmp,$multtmp0,$multtmp1,$multtmp2,$length);
return $o;
}
$multtmp = sprintf("%04b", $multtmp);
$tmp = sprintf("%04b", $tmp);
- $tmp = convbox($tmp,$multtmp);
+ $tmp = convbox($tmp,$multtmp,0,0,4);
$o .= $tmp."<br>";
$multtmp = sprintf("%04b",0);
$tmp = ($data->{$outp*4+1} >> (4*$slice)) & 0xF;
$tmp = sprintf("%04b",$tmp);
- $tmp = convbox($tmp,$multtmp);
+ $tmp = convbox($tmp,$multtmp,0,0,4);
$o .= $tmp;
return $o;
my $val = ($data->{$outp*4}>>22) | ($data->{$outp*4+1} << 10);
my $tmp = sprintf("%016b",$val & 0xFFFF);
- $tmp = convbox($tmp,0);
+ $tmp = convbox($tmp,0,0,0,16);
$o .= $tmp."<br>";
$tmp = sprintf("%016b",$val>>16 & 0xFFFF);
- $tmp = convbox($tmp,0);
+ $tmp = convbox($tmp,0,0,0,16);
$o .= $tmp;
}
if($t eq 'trb3sc') {
$o .= "<font style=\"color:red\" title=\"for output 1\">".(($d->{0} & (1<<($i*2+$s)))?'➊':'◻')."</font> ";
$o .= "<font style=\"color:blue\" title=\"for output 2\">".(($d->{4} & (1<<($i*2+$s)))?'➋':'◻')."</font><br>";
- $o .= "<font style=\"color:#0a0\" title=\"for mult\">".(($d->{0x33} & (1<<($i*2+$s)))?'◼':'◻')."</font><br>";
+ $o .= "<font style=\"color:#0a0\" title=\"for mult 0\">".(($d->{0x33} & (1<<($i*2+$s)))?'◼':'◻')."</font>";
+ $o .= "<font style=\"color:#0da\" title=\"for mult 1\">".(($d->{0x33} & (1<<($i*2+$s)))?'◼':'◻')."</font>";
+ $o .= "<font style=\"color:#aa0\" title=\"for mult 2\">".(($d->{0x33} & (1<<($i*2+$s)))?'◼':'◻')."</font>";
}
if($t eq 'trb3') {
$o .= "<font style=\"color:red\" title=\"for output 1\">".(($d->{0} & (1<<($i*4+$s)))?'➊':'◻')."</font> ";
if($type eq 'trb3sc') {
$out .= "<table class=\"triggermap\">";
- $out .= "<tr><th>Board<th colspan=\"2\">Output 1<th colspan=\"2\">Output 2";
+ $out .= "<tr><th>Board
+ <th colspan=\"2\"><font style=\"color:red\">Output 0 (RJ-3)
+ <th colspan=\"2\"><font style=\"color:blue\">Output 1 (RJ-4)
+ <th colspan=\"2\"><font style=\"color:magenta\">Output 2 (RJ-1, BKPL-0)
+ <th colspan=\"2\"><font style=\"color:purple\">Output 3 (RJ-2, BKPL-1)
+ <th> ";
foreach my $i (0..8) {
my $b = $boards->[0];
if($i==4) {
- $out .= sprintf("<tr class=\"master\"><td>0x%4x",$b);
- $out .= "<td colspan=\"2\">".makemasterkel($data->{$b},0);
- $out .= "<td colspan=\"2\">".makemasterkel($data->{$b},1);
-
+ $out .= sprintf("<tr class=\"master\"><td><a href=\"../tdc/inputmonitor.pl?Trb3scTrigger#&address=0x%04x&period=1000&cache=false&rate=false&inline=false\" target=\"_blank\">0x%04x</a>",$b,$b);
+ $out .= "<td colspan=\"2\"><font style=\"color:red\">".makemasterkel($data->{$b},0);
+ $out .= "<td colspan=\"2\"><font style=\"color:blue\">".makemasterkel($data->{$b},1);
+ $out .= "<td colspan=\"2\"> <td colspan=\"2\"> ";
+
$out .= "<td >";
if ($data->{$b}{0x33} != 0) {
$out .= "mult >=".(($data->{$boards->[0]}{0x32} >> 16)&0xFF)." ";
}
$b = $pos->{$i};
- if($b) {
- $out .= sprintf("<tr><td>0x%04x",$b);
+ if($b && defined $data->{$b}{0}) {
+ $out .= sprintf("<tr><td><a href=\"../tdc/inputmonitor.pl?Trb3scTrigger#&address=0x%4x&period=1000&cache=false&rate=false&inline=false\" target=\"_blank\">0x%04x</a>",$b,$b);
+ $out .= "<td>".makeinputbits($data->{$b},0);
+ $out .= "<td class=\"master\">";
+ $out .= "<td>".makeinputbits($data->{$b},1);
+ $out .= "<td class=\"master\">";
$out .= "<td>".makeinputbits($data->{$b},2);
$out .= "<td class=\"master\">".makemasterbits($data->{$boards->[0]},$i,0,$type);
$out .= "<td>".makeinputbits($data->{$b},3);
$out .= "<td class=\"master\">".makemasterbits($data->{$boards->[0]},$i,1,$type);
$out .= "<td>";
- if ($data->{$b}{0x33} != 0) {
- $out .= "mult >=".(($data->{$b}{0x32} >> 16)&0xFF)."<br>"
+ if ($data->{$b}{0x33} != 0 || $data->{$b}{0x35} != 0) {
+ $out .= "<font style=\"color:#0a0;\">mult 0 >=".(($data->{$b}{0x32} >> 16)&0xFF)."<br>"
+ }
+ if ($data->{$b}{0x38} != 0 || $data->{$b}{0x39} != 0) {
+ $out .= "<font style=\"color:#0da;\">mult 1 >=".(($data->{$b}{0x32} >> 8)&0xFF)."<br>"
+ }
+ if ($data->{$b}{0x3a} != 0 || $data->{$b}{0x3b} != 0) {
+ $out .= "<font style=\"color:#aa0;\">mult 2 >=".(($data->{$b}{0x32} >> 24)&0xFF)."<br>"
}
}
- elsif(!$b) {
- $out .= "<tr class=\"empty\"><td >empty<td>";
+ else {
+ if(!$b) {
+ $out .= "<tr class=\"empty\"><td >empty";
+ }
+ else {
+ $out .= sprintf("<tr><td>0x%04x",$b);
+ }
+ $out .= "<td>";
+ $out .= "<td class=\"master\">";
+ $out .= "<td>";
+ $out .= "<td class=\"master\">";
+ $out .= "<td>";
$out .= "<td class=\"master\">".makemasterbits($data->{$boards->[0]},$i,0,$type);
$out .= "<td>";
$out .= "<td class=\"master\">".makemasterbits($data->{$boards->[0]},$i,1,$type);
}
}
$out .= "</table>";
- $out .= qq#<table><tr><th>Red<td>selected in 'or' for output 1 on master
- <tr><th>Blue<td>selected in 'or' for output 2 on master
- <tr><th>Green<td>selected for multiplicity logic
+ $out .= qq%<table>
+ <tr><th><font style=\"color:#0a0\">Green<td>selected for multiplicity logic 0
+ <tr><th><font style=\"color:#0da\">Green<td>selected for multiplicity logic 1
+ <tr><th><font style=\"color:#aa0\">Green<td>selected for multiplicity logic 2
<tr><th>Black<td>enabled in 'or'
- </table>#;
+ </table>%;
}
if($type eq 'trb3') {
address => 1,
norate => 1,
nocache => 1,}));
-push(@setup,({name => "EC0",
- cmd => "getmap-0x8a00",
- period => -1,
- noaddress => 1,
- norate => 1,
- nocache => 1,}));
-push(@setup,({name => "EC1",
- cmd => "getmap-0x8a01",
- period => -1,
- noaddress => 1,
- norate => 1,
- nocache => 1,}));
-push(@setup,({name => "EC2",
- cmd => "getmap-0x8a02",
- period => -1,
- noaddress => 1,
- norate => 1,
- nocache => 1,}));
-push(@setup,({name => "EC3",
- cmd => "getmap-0x8a03",
- period => -1,
- noaddress => 1,
- norate => 1,
- nocache => 1,}));
-push(@setup,({name => "EC4",
- cmd => "getmap-0x8a04",
- period => -1,
- noaddress => 1,
- norate => 1,
- nocache => 1,}));
-push(@setup,({name => "EC5",
- cmd => "getmap-0x8a05",
- period => -1,
- noaddress => 1,
- norate => 1,
- nocache => 1,}));
-push(@setup,({name => "Start",
- cmd => "getmap-0x8880",
- period => -1,
- noaddress => 1,
- norate => 1,
- nocache => 1,}));
+
xmlpage::initPage(\@setup,$page);
}