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");
}
}
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
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")));
$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");
# deactivate all peripheral FPGAs by default in the TrbNet hub
# activate peripheral FPGAs only, when you find a <roc/> 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,
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);
}