]> jspc29.x-matter.uni-frankfurt.de Git - mvdsensorcontrol.git/commitdiff
Latest changes (testgui.pl, unpacker.cxx) in FFM
authorMaps <maps@ikf>
Thu, 9 Jun 2016 14:05:05 +0000 (16:05 +0200)
committerMaps <maps@ikf>
Thu, 9 Jun 2016 14:05:05 +0000 (16:05 +0200)
Environment.pm
tools/init_setup.pl
tools/init_system.pl
tools/preview/exec_evtbuild_t.pl
tools/run.pl
tools/scurve_control.sh
tools/test.txt [deleted file]
tools/testgui.pl
tools/unpacker/unpacker.cxx

index 6b3d9777260eb4bbdf59252450351918cea2ff81..8f0f1c260135c055157f65ae6ef7df0e29117107 100644 (file)
@@ -19,8 +19,8 @@ use constant CONFDIR          => JTAGROOTPATH."../mvdconfig/config/";
 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/";
index a5807b6a1d8d93d8b62486c26afca87e696d445b..7db514b74b92659041ca6fce69f418fb9a57a0fd 100755 (executable)
@@ -76,8 +76,12 @@ my $name = $db->getDocumentElement->getAttribute('name');
 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');
@@ -198,7 +202,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");
+execute("trbcmd setbit 0x$ccu 0xa101 0x1");# enable CTS trigger source
 execute("trbcmd w 0xfe4d 0xb00b 1"); #Enable start sensors on next reference time
 
   
index 6bc7e3ef5a1a84192f2870cff233f43916134348..1a54f7cf6d217fb36861ece1d06ea54e6eb8a68d 100755 (executable)
@@ -81,10 +81,6 @@ run(DAQTOOLSPATH."/tools/loadregisterdb.pl ".CONFIGPATH."/network/register_confi
 
 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
@@ -97,10 +93,30 @@ trb_write($ccu,0x00c1,0x00f0|$hub_active_mask);
 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);
 
 
 
index 35eb5edc60f21d921d0a1e80f7aa08bbec2dd0f8..599d83cb9657eee3d64645cccaea8129f60bd8f1 100755 (executable)
@@ -70,9 +70,9 @@ else {
 
 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();
index ec91bb95f8f7f348f6d2013dfd934fe5ab6461ef..fbb06cfdfb8e8fd7201a4fabe111ec5cdef010e8 100755 (executable)
@@ -92,7 +92,7 @@ unless(-e $picPath) {
 
 my $dummy;
 print_exec "date";
-print_exec "./init_setup.pl $setupFile";
+print_exec "./init_setup.pl $setupFile $systemFile";
 
 
 unless($q->param('startupOnly') eq 'true'){
index a147aa37f369f15aea25b49627bcdd096fc60b19..112383bc3981b084815416317ba5b4d52d33f176 100755 (executable)
@@ -5,12 +5,12 @@
 
 ### ------------ 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
 
@@ -21,15 +21,29 @@ then
   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
 
@@ -83,10 +97,11 @@ trbcmd w $PERIPH_ROC 0x8001 0x1 # set testmode   was 8006
 
 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
 
@@ -111,7 +126,7 @@ do
   # 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"
@@ -119,7 +134,7 @@ do
       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
diff --git a/tools/test.txt b/tools/test.txt
deleted file mode 100644 (file)
index e69de29..0000000
index 25e09c0e7ee69939b1f57511405dd58a2e618e64..01b063dd8b2989c1a6adff2f4e8b987c240ca763 100755 (executable)
@@ -235,7 +235,7 @@ sub init_html{
  
  
   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'>";
   
@@ -255,7 +255,7 @@ sub init_html{
   
   
   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>";
@@ -342,6 +342,13 @@ sub print_sensorArea {
   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."'>";
@@ -352,11 +359,10 @@ sub print_sensorArea {
   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>";
 
@@ -372,7 +378,7 @@ sub print_sensorArea {
 sub print_quickEditArea {
 
   my $argumentConfigFile = $_[0];
-
+  my $adcmon_info = $_[1];
 
   
   parseConfigAndSpec($argumentConfigFile);
@@ -381,8 +387,28 @@ sub print_quickEditArea {
   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>";
 }
 
 
index 6bd2d94dcfe563f38087a35bfe2a2751c782ee1f..fb7fda42a5d85cdf2750c5b784adb814f36259f6 100644 (file)
@@ -14,6 +14,7 @@ unsigned pixelMap[MAX_SENSORS][576][1152] = {{0}};
 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];
 
@@ -61,9 +62,11 @@ unsigned getSensor(unsigned sensorId) {
 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;
@@ -186,13 +189,15 @@ signed analyzeSubEvent(hadaq::RawSubevent* sub, unsigned pos, unsigned datalen,
 #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{
@@ -210,13 +215,13 @@ signed analyzeSubEvent(hadaq::RawSubevent* sub, unsigned pos, unsigned datalen,
                                }
                        }
                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){
@@ -268,7 +273,7 @@ signed analyzeSubEvent(hadaq::RawSubevent* sub, unsigned pos, unsigned datalen,
                                                        }
                                                }
 
-                                       #if DEBUG>=2
+                                       #if DEBUG>=3
                                        printf("\tdx >>> %04x\n",d);
                                        #endif
 
@@ -281,7 +286,7 @@ signed analyzeSubEvent(hadaq::RawSubevent* sub, unsigned pos, unsigned datalen,
                                        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;
@@ -373,7 +378,7 @@ signed analyzeData(hadaq::RawSubevent* sub, unsigned ix, unsigned datalen, unsig
                //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