use constant SPECDIR => JTAGROOTPATH."specs/";
use constant PICTUREPATH => TEMPDIR."prevImgs/"; #path for images on webserver (absolute path)
use constant PICTUREPATHREL => "../temp/prevImgs/"; #path for images on webserver relative to tools/
-use constant DUMPPATH => "/tmp/MAPS_PREV/"; #path for small hld dumps
-use constant SHAREPATH => JTAGROOTPATH."share/"; #path for icons and misc stuff
+use constant DUMPPATH => "/local.1/tmp/MAPS_PREV/"; #path for small hld dumps
+use constant SHAREPATH => JTAGROOTPATH."share/"; #path for icons and misc stuff
use constant SETUPFILE => SETUPDIR."testsetup.xml";
use constant SHMSYMLINK => JTAGROOTPATH."shm/";
my $ccu = $dbsys->getDocumentElement->findnodes('ccu')->[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");
+
+
+
foreach my $curctrl ($db->getDocumentElement->findnodes('controller')) {
my $ctrlname = $curctrl->getAttribute('name');
my $ctrlid = $curctrl->getAttribute('id');
}
}
execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time
-execute("trbcmd setbit 0x$ccu 0xa101 0x1");
+execute("trbcmd setbit 0x$ccu 0xa101 0x1");# enable CTS trigger source
execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time
trb_write(0xfffe,0x00c5,0x20ff); #Timeouts
-#Send arbiter start signal
-#trb_write($ccu,0xa000,0x00000001);
-
-
# deactivate all peripheral FPGAs by default in the TrbNet hub
# activate peripheral FPGAs only, when you find a <roc/> entry in system file
trb_write($ccu,0x00c3,0x00f0|$hub_active_mask);
-trb_write($_,0x8041,0x8d00) for @roc;
+trb_write($_,0x8041,0x8d00) for @roc; #set buffer delete time
+
+my $systems_w_ccu = {
+ ProbeStation_scurve => 1,
+ ProbeStation_readout => 1,
+ Vacuum_scurve => 1,
+ Vacuum_readout => 1,
+ ELab => 1,
+ PRESTO_readout => 1,
+ PRESTO_scurve => 1,
+};
+
+if($systems_w_ccu->{$system}) {
+ #ProbeStation continues to use the CCU
+ #Send arbiter start signal
+ print "System uses the old CCU\n";
+ trb_write($ccu,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($ccu,0xa150,0x2cff); #115.19us
-trb_write($ccu,0xa101,0x00000001);
chdir($opt_path);
-$thr1 = threads->new(\&execute, "timeout -s SIGINT ".($time+1.5)." daq_evtbuild -m $c -q 32 -d file -x te -Se -S $opt_system");
+$thr1 = threads->new(\&execute, "timeout -k 2 -s SIGINT ".($time+1.5)." daq_evtbuild -m $c -q 32 -d file -x te -Se -S $opt_system");
sleep 1;
-$thr2 = threads->new(\&execute, "timeout -s SIGINT ".$time." daq_netmem -m $c -q 32 $portoption -S $opt_system");
+$thr2 = threads->new(\&execute, "timeout -k 2 -s SIGINT ".$time." daq_netmem -m $c -q 32 $portoption -S $opt_system");
$thr1->join();
$thr2->join();
my $dummy;
print_exec "date";
-print_exec "./init_setup.pl $setupFile";
+print_exec "./init_setup.pl $setupFile $systemFile";
unless($q->param('startupOnly') eq 'true'){
### ------------ Interpret the command line arguments ------------
-usage () { echo -e "\nUsage: ./scurve_control.sh [ELab/Vacuum] [Number of Runs] [Step Size]\n"; }
+usage () { echo -e "\nUsage: ./scurve_control.sh [ELab/Vacuum_scurve/ProbeStation_scurve PRESTO_scurve] [Number of Runs] [Step Size]\n"; }
if [ -z "$1" ] # check if first parameter is empty
then
usage
- echo Error: Specify the system! Use Vacuum or ELab as first parameter.
+ echo Error: Specify the system! Use Vacuum, ELab, ProbeStation, or PRESTO_scurve as first parameter.
exit -1
fi
export DAQOPSERVER=localhost:88
JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml
SETUP_FILE=/local.1/htdocs/mvdconfig/setup/scurve2_setup_ELab2.xml
-elif [ $1 == 'Vacuum' ]
+elif [ $1 == 'PRESTO_scurve' ]
then
- PERIPH_ROC='0xd000'
- CCU='0x8000'
+ PERIPH_ROC='0xd882'
+ CCU='0x8880'
+ export DAQOPSERVER=localhost:88
+ JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml
+ SETUP_FILE=/local.1/htdocs/mvdconfig/setup/scurve2_setup_ELab2.xml
+elif [ $1 == 'Vacuum_scurve' ]
+then
+ PERIPH_ROC='0xd011'
+ CCU='0xc010'
+ export DAQOPSERVER=localhost:1
+ JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensor_Vacuum_scurve.xml
+ SETUP_FILE=/local.1/htdocs/mvdconfig/setup/Vacuum_scurve.xml
+elif [ $1 == 'ProbeStation_scurve' ]
+then
+ PERIPH_ROC='0xd072'
+ CCU='0xc070'
export DAQOPSERVER=localhost:7
- JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensorE0scurve.xml
- SETUP_FILE=/local.1/htdocs/mvdconfig/setup/scurve2_setup.xml
+ JTAG_CONFIG_FILE=/local.1/htdocs/mvdconfig/config/sensorE0scurve2.xml
+ SETUP_FILE=/local.1/htdocs/mvdconfig/setup/ProbeStation_scurve.xml
else
- echo Error: system unspecified! Use ELab or Vacuum as the first parameter.
+ echo Error: system unspecified! Use ELab, Vacuum, ProbeStation, or PRESTO_scurve as the first parameter.
exit -1
fi
for BANK in 0 1 2 3
do
-echo -e "\nBank $BANK"
-for i in $(seq 101 $stepsize 255)
+echo -e "\nNow scanning bank $BANK"
+ for i in $(seq 0 $stepsize 255)
+# for i in 0 255
do
- echo Threshold $i
+ echo "Setting threshold $i"
printf -v threshhex '%02x' $i
# Start taking data and cycle through runs:
for j in $(seq 1 1 $numruns) # for all runs, to gather statistics
do
- echo "run $j"
+ echo "Bank $BANK Threshold $i run $j"
printf -v runhex '%05x' $j
check="0"
trbcmd w $PERIPH_ROC 0x8002 0x1 # reset the FPGA buffers was 8005
# result=$(trbcmd r $PERIPH_ROC 0x8005)
# check=${result:17:1}
- echo "attempting soft-reset..."
+ #echo "attempting soft-reset..."
#done
trbcmd w $PERIPH_ROC 0x8002 0x0 # clear the previous reset was 8005
trbcmd w $PERIPH_ROC 0x8003 0x$threshhex$BANK$runhex # write current scan parameters to ROC-FPGA (later in data) was 8007
print "<p id='show_advanced_options' class='quasibutton' >advanced options</p>";
- print "<div id='advancedOptionsContainer' class='stylishBox hidden_by_default'>";
+ print "<div id='advancedOptionsContainer' class='stylishBox'>";
print "<div class='header'>advanced options</div>";
print "<div id='advancedOptions'>";
print "<p id='show_theConsole' class='quasibutton' >show debug output</p>";
- print "<div id='theConsoleContainer' class='stylishBox hidden_by_default'>";
+ print "<div id='theConsoleContainer' class='stylishBox'>";
print "<div class='header'>debug output</div>";
print "<div id='theConsole'>[the \"console\"]</div>";
print "</div>";
my $sensorPosition = $sensor->findnodes("./position")->shift();
my $sensorDescription = $sensor->findvalue("./description");
+ my $adcmon_info = {
+ FPGA => $controllerAddress,
+ DAQOPSERVER => $daqopserver,
+ CB => $chain->findvalue("./\@id"),
+ chip => $sensor->findvalue("./\@id")
+ };
+
$sensorAreaId = $sensorId;
print "<div class='sensorAreaDiv' id='".$sensorAreaId."'>";
print "<td class='previewArea stylishBox'>";
print "<div class='header' title='$sensorDescription'>$sensorName (id=$sensorId)</div>";
print "<div id='".$previewAreaId."' class='prevImgContainer'><div>[not run yet]</div></div>";
-
print "</td>";
$quickEditAreaId = "quickEdit_".$sensorId;
print "<td id='".$quickEditAreaId."' class='quickEditArea stylishBox'>";
- print_quickEditArea($sensorConfig);
+ print_quickEditArea($sensorConfig,$adcmon_info);
print "</td>";
print "</tr>";
sub print_quickEditArea {
my $argumentConfigFile = $_[0];
-
+ my $adcmon_info = $_[1];
parseConfigAndSpec($argumentConfigFile);
print "<div align=center><a title='open config file with the full featured JTAG editor' href='jtageditor.pl?edit=".getConfigFileName()."'>".getConfigFileName()."</a></div>";
setEditorRefreshCommand("reloadQuickEditArea(\"".getConfigFileName()."\",\"$quickEditAreaId\")");
print_registers(getConfigFile());
-
-
+ print "<hr>";
+# print "<p> DAQOPSERVER: ".
+# $adcmon_info->{DAQOPSERVER}
+# ."</p>";
+# print "<p> FPGA: ".
+# $adcmon_info->{FPGA}
+# ."</p>";
+# print "<p> CB: ".
+# $adcmon_info->{CB}
+# ."</p>";
+# print "<p> CHIP: ".
+# $adcmon_info->{chip}
+# ."</p>";
+
+ print "<div align=center><a title='open ADC monitor for this chip'
+ href='adcmon.pl?DAQOPSERVER=".$adcmon_info->{DAQOPSERVER}
+ ."&FPGA=0x".$adcmon_info->{FPGA}
+ ."&CB=".$adcmon_info->{CB}
+ ."&chip=".($adcmon_info->{chip}&0xF)
+ ."&channel=CurrentDigital,CurrentAnalog'>ADC monitor</a>";
+ print q% - <input type='button' onClick='run(document.getElementById("runtime").value)' value='run'>%;
+ print "</div>";
}
unsigned pixelcount[MAX_SENSORS][1153] = {{0}};
unsigned statistics[MAX_SENSORS][4] = {{0}};
unsigned numSensors = 0;
+unsigned long numSubevents = 0;
unsigned countMarkedFrames = 0;
unsigned sensors[MAX_SENSORS];
void readSubEvents(hadaq::RawEvent* evnt) {
hadaq::RawSubevent* sub = 0;
while ((sub=evnt->NextSubevent(sub))!=0) {
+ numSubevents++;
unsigned trbSubEvSize = sub->GetSize() / 4 - 4;
-#if DEBUG>=2
- printf("Subevent Size\t%08x\n",
+#if DEBUG>=1
+ printf("Subevent no. %d Size\t%08x\n",
+ numSubevents,
trbSubEvSize);
#endif
unsigned pos = 0;
#endif
if (sub->Data(pdata) != 0x55555555) {
+#if DEBUG>=1
printf("ERROR: Sensor Header (0x55555555) Not Found! (got: %08x)\n",sub->Data(pdata));
+#endif
continue;
}
unsigned sensorIsValid = 0;
if (v1 == 1){
- if(frame_status == 0xf000000f) {
+ if((frame_status & 0xf000000f) == 0xf000000f) {
sensorIsValid = 1;
}
else{
}
}
else if (v3 == 1){
- if (frame_status == 0x0) {
- sensorIsValid = 1;
- }
- else{
+ if (frame_status & ((1<<14) | (1<<1) | (1<<2) | (1<<3) | (1<<4))) {
sensorIsValid = 0;
statistics[mySensor][FRBROKEN]++;
}
+ else{
+ sensorIsValid = 1;
+ }
}
if(sensorIsValid && frame_length>0x0){
}
}
- #if DEBUG>=2
+ #if DEBUG>=3
printf("\tdx >>> %04x\n",d);
#endif
else {
pixels = (d & 0x3);
column = (d >> 2) & 0x7FF;
- #if DEBUG>=2
+ #if DEBUG>=3
printf("\t%d, %d x %d\n",line,column,pixels+1);
#endif
pixelcount[mySensor][column] += pixels+1;
//Something is really wrong with data. Skip SubEvent!
printf("Broken Sensor Header\n");
statistics[mySensor][FRREALBROKEN]++;
- #if DEBUG==0
+ #if DEBUG>=0
printf("Head\t%08x\tID\t%08x\tStatus\t%08x\tError\t%08x\tDebug\t%08x\n",
sensorHead, sensorId, sensorStatus, sensorError, sensorDebug);
#endif