From: Jan Michel Date: Thu, 4 Apr 2019 15:36:03 +0000 (+0200) Subject: add trigger.pl option to automatically scan network with any base address X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=8fef6f9ea364d16ff6d666c8383f7de80985eb7b;p=daqtools.git add trigger.pl option to automatically scan network with any base address --- diff --git a/web/htdocs/network/trigger.pl b/web/htdocs/network/trigger.pl index 10ab828..d50790d 100755 --- a/web/htdocs/network/trigger.pl +++ b/web/htdocs/network/trigger.pl @@ -24,6 +24,30 @@ use Data::Dumper; my @regs = (0,1,2,4,5,6,8,9,10,12,13,14,0x31,0x32,0x33,0x34); + +my $setups = { +# '0x8a00' => [0x8a00,0x6010,0x6011,0x6012,0x6003,0x6004,0x6005,0x6006], +# '0x8a01' => [0x8a01,0x6020,0x6021,0x6022,0x6013,0x6014,0x6015,0x6016], +# '0x8a02' => [0x8a02,0x6030,0x6031,0x6032,0x6023,0x6024,0x6025,0x6026], +# '0x8a03' => [0x8a03,0x6040,0x6041,0x6042,0x6033,0x6034,0x6035,0x6036], +# '0x8a04' => [0x8a04,0x6050,0x6051,0x6052,0x6043,0x6044,0x6045,0x6046], +# '0x8a05' => [0x8a05,0x6000,0x6001,0x6002,0x6053,0x6054,0x6055,0x6056], + '0x0100' => [0x0100], +# '0x8880' => [0x8880,0x5000,0x5001,0x5002,0x5003], +}; + +my $types = { +# '0x8a00' => 'trb3sc', +# '0x8a01' => 'trb3sc', +# '0x8a02' => 'trb3sc', +# '0x8a03' => 'trb3sc', +# '0x8a04' => 'trb3sc', +# '0x8a05' => 'trb3sc', + '0x0100' => 'rjkel', +# '0x8880' => 'trb3', +}; + + sub getdata { my @boards = @_; my $data; @@ -47,10 +71,11 @@ sub getdata { sub getposition { my @boards = @_; my $pos; - shift @boards; + my $master = shift @boards; foreach my $b (@boards) { my @path = trb_nettrace($b); if (scalar @path) { + next unless ($path[-1][-1]->{address} == $master); $pos->{$path[-1][-1]->{port}} = $b; } } @@ -219,38 +244,40 @@ sub gettable { Blueselected in 'or' for output 2 on master board Greenselected for multiplicity logic BlackEnabled in 'or' + GenericThe generic tab only works for TRB3 central and TRB3sc crate master FPGA! #; } return $out; + } + +sub createsetup { + my $masterstring = shift @_; + $masterstring =~ /0x(\w\w\w\w)/; + my $master = hex($1); + my $o = trb_register_read(0xffff,0x42); + unless ($o->{$master}) {print "Master not found.\n"; return;} + if (($o->{$master}>>24 & 0xff) == 0x90) {$types->{$masterstring} = 'trb3';} + if (($o->{$master}>>24 & 0xff) == 0x95) {$types->{$masterstring} = 'trb3sc';} + + my @list = ($master); + foreach my $b (keys %{$o}) { + push(@list,$b); + } + push(@{$setups->{$masterstring}},$master); + my $pos = getposition(@list); + foreach my $b (keys %{$pos}) { + push(@{$setups->{$masterstring}},$pos->{$b}); + } } -my $setups = { - '0x8a00' => [0x8a00,0x6010,0x6011,0x6012,0x6003,0x6004,0x6005,0x6006], - '0x8a01' => [0x8a01,0x6020,0x6021,0x6022,0x6013,0x6014,0x6015,0x6016], - '0x8a02' => [0x8a02,0x6030,0x6031,0x6032,0x6023,0x6024,0x6025,0x6026], - '0x8a03' => [0x8a03,0x6040,0x6041,0x6042,0x6033,0x6034,0x6035,0x6036], - '0x8a04' => [0x8a04,0x6050,0x6051,0x6052,0x6043,0x6044,0x6045,0x6046], - '0x8a05' => [0x8a05,0x6000,0x6001,0x6002,0x6053,0x6054,0x6055,0x6056], - '0x0100' => [0x0100], - '0x8880' => [0x8880,0x5000,0x5001,0x5002,0x5003], -}; -my $types = { - '0x8a00' => 'trb3sc', - '0x8a01' => 'trb3sc', - '0x8a02' => 'trb3sc', - '0x8a03' => 'trb3sc', - '0x8a04' => 'trb3sc', - '0x8a05' => 'trb3sc', - '0x0100' => 'rjkel', - '0x8880' => 'trb3', -}; if($ENV{'QUERY_STRING'} =~ /getmap/) { my ($cmd,$setup) = split('-',$ENV{'QUERY_STRING'}); + createsetup($setup) unless($setups->{$setup}); print gettable($types->{$setup},$setups->{$setup}); } @@ -304,7 +331,12 @@ push(@setup,({name => "Start", noaddress => 1, norate => 1, nocache => 1,})); - +push(@setup,({name => "Generic", + cmd => "getmap-0x8000", + period => -1, + address => 1, + norate => 1, + nocache => 1,})); xmlpage::initPage(\@setup,$page); }