From: Maps Date: Tue, 9 May 2017 08:10:48 +0000 (+0200) Subject: PK: multi TRB support (hierarchy system XML files) X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=d5701bcf7aa50b91884760068873e3018b9bbecc;p=mvdsensorcontrol.git PK: multi TRB support (hierarchy system XML files) --- diff --git a/tools/init_setup.pl b/tools/init_setup.pl index 2f2ddc4..7b95e7f 100755 --- a/tools/init_setup.pl +++ b/tools/init_setup.pl @@ -73,11 +73,11 @@ my $systemName = $db->findvalue("/setup/system/\@name"); my $systemFile = $systemDir.$systemName.".xml"; my $dbsys = $parser->parse_file($systemFile); my $name = $db->getDocumentElement->getAttribute('name'); -my $ccu = $dbsys->getDocumentElement->findnodes('ccu')->[0]->getAttribute('address'); +my $cts = $dbsys->getDocumentElement->findnodes('cts')->[0]->getAttribute('address'); print STDERR "Loading setup $name from file $setupFile\n" if $verbose; print STDERR "Stop CTS trigger source\n" if $verbose; -execute("trbcmd clearbit 0x$ccu 0xa101 0x1"); +execute("trbcmd clearbit 0x$cts 0xa101 0x1"); @@ -203,7 +203,7 @@ foreach my $ctrladdr (keys %$JtagCommands) { } } execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time -execute("trbcmd setbit 0x$ccu 0xa101 0x1");# enable CTS trigger source +execute("trbcmd setbit 0x$cts 0xa101 0x1");# enable CTS trigger source execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time diff --git a/tools/init_system.pl b/tools/init_system.pl index 1a54f7c..ff12b84 100755 --- a/tools/init_system.pl +++ b/tools/init_system.pl @@ -47,10 +47,18 @@ unless(-e $systemFile) {die "System file $systemFile not found\n";} my $parser = XML::LibXML->new(line_numbers => 1); my $db = $parser->parse_file($systemFile); -my $ccu = hex($db->findvalue("/system/ccu/\@address")); +my $cts = hex($db->findvalue("/system/cts/\@address")); my(@hub,@gbe,@roc); +my $r; + for my $n ($db->findnodes("//hub")) { - push(@hub,hex($n->findvalue("./\@address"))); + my $hubaddr = hex($n->findvalue("./\@address")); + push(@hub,$hubbaddr); + + for my $m ($n->findnodes("roc")) { + my $rocaddr = hex($m->findvalue("./\@address")); + $r->{hubs}{$hubaddr}{$rocaddr} = 1; + } } for my $n ($db->findnodes("//gbe")) { push(@gbe,hex($n->findvalue("./\@address"))); @@ -62,7 +70,7 @@ my $daqopserver = $db->findvalue("//daqopserver"); $ENV{'DAQOPSERVER'} = $daqopserver if (defined($daqopserver)); print "DAQOPSERVER:\t$daqopserver\n"; -printf("CCU:\t%04x\n",$ccu); +printf("CCU:\t%04x\n",$cts); print("ROC:\t".join(", ", map {sprintf("%04x",$_)} @roc)."\n"); print("HUB:\t".join(", ", map {sprintf("%04x",$_)} @hub)."\n"); print("GBE:\t".join(", ", map {sprintf("%04x",$_)} @gbe)."\n"); @@ -84,18 +92,21 @@ trb_write(0xfffe,0x00c5,0x20ff); #Timeouts # deactivate all peripheral FPGAs by default in the TrbNet hub # activate peripheral FPGAs only, when you find a entry in system file -my $hub_active_mask = 0; -for my $addr (@roc){ - $hub_active_mask |= 1<<($addr & 0xF); #last hex digit gives FPGA number -} -trb_write($ccu,0x00c0,0x00f0|$hub_active_mask); -trb_write($ccu,0x00c1,0x00f0|$hub_active_mask); -trb_write($ccu,0x00c3,0x00f0|$hub_active_mask); - +for my $hub (keys %{$r->{hubs}}){ + my $hub_active_mask = 0; + for my $addr (keys %{$r->{hubs}{$hub}}){ + $hub_active_mask |= 1<<($addr & 0xF); #last hex digit gives FPGA number + } +# print " $hub_active_mask \n"; + trb_write($hub,0x00c0,0x00f0|$hub_active_mask); + trb_write($hub,0x00c1,0x00f0|$hub_active_mask); + trb_write($hub,0x00c3,0x00f0|$hub_active_mask); + } trb_write($_,0x8041,0x8d00) for @roc; #set buffer delete time +trb_write($_,0x8441,0x8d00) for @roc; #set buffer delete time -my $systems_w_ccu = { +my $systems_w_cts = { ProbeStation_scurve => 1, ProbeStation_readout => 1, Vacuum_scurve => 1, @@ -105,16 +116,16 @@ my $systems_w_ccu = { PRESTO_scurve => 1, }; -if($systems_w_ccu->{$system}) { +if($systems_w_cts->{$system}) { #ProbeStation continues to use the CCU #Send arbiter start signal print "System uses the old CCU\n"; - trb_write($ccu,0xa000,0x00000001); + trb_write($cts,0xa000,0x00000001); } else { #newer set-ups use the CTS print "System uses the new CTS\n"; - trb_write($ccu,0xa150,0x2cff); #115.19us - trb_write($ccu,0xa101,0x00000001); + trb_write($cts,0xa150,0x2cff); #115.19us + trb_write($cts,0xa101,0x00000001); }