revised gain plot; updated version api

This commit is contained in:
maliakal_d 2020-03-04 10:25:06 +01:00
commit 1b996d1703
37 changed files with 2667 additions and 1383 deletions

View File

@ -214,6 +214,46 @@
<string>Very Low Gain</string>
</property>
</item>
<item>
<property name="text">
<string>G1_HG</string>
</property>
</item>
<item>
<property name="text">
<string>G1_LG</string>
</property>
</item>
<item>
<property name="text">
<string>G2_HC_HG</string>
</property>
</item>
<item>
<property name="text">
<string>G2_HC_LG</string>
</property>
</item>
<item>
<property name="text">
<string>G2_LC_HG</string>
</property>
</item>
<item>
<property name="text">
<string>G2_LC_LG</string>
</property>
</item>
<item>
<property name="text">
<string>G4_HG</string>
</property>
</item>
<item>
<property name="text">
<string>G4_LG</string>
</property>
</item>
<item>
<property name="text">
<string>Undefined</string>

View File

@ -161,8 +161,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
unsigned int nPixelsX{0};
unsigned int nPixelsY{0};
const static int npixelsx_jctb = 400;
int npixelsy_jctb{0};
uint32_t pixelMask{0};
uint32_t gainMask{0};
int gainOffset{0};

View File

@ -41,6 +41,14 @@ private:
FORCESWITCHG1,
FORCESWITCHG2,
VERLOWGAIN,
G1_HIGHGAIN,
G1_LOWGAIN,
G2_HIGHCAP_HIGHGAIN,
G2_HIGHCAP_LOWGAIN,
G2_LOWCAP_HIGHGAIN,
G2_LOWCAP_LOWGAIN,
G4_HIGHGAIN,
G4_LOWGAIN,
UNDEFINED,
UNINITIALIZED,
NUMSETTINGS

View File

@ -431,8 +431,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
void qDetectorMain::ExecuteHelp(QAction *action) {
if (action == actionAbout) {
FILE_LOG(logINFO) << "About Common GUI for Eiger, Gotthard, Jungfrau "
"and Moench detectors";
FILE_LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and Moench detectors";
std::string guiVersion = std::to_string(APIGUI);
std::string clientVersion = "unknown";
@ -449,7 +448,7 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
clientVersion +
"<br><br>"
"Common GUI to control the SLS Detectors: "
"Eiger, Jungfrau, Mythen3, Gotthard, Gotthard2 and Moench.<br><br>"
"Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and Moench.<br><br>"
"It can be operated in parallel with the command "
"line interface:<br>"
"sls_detector_put,<br>sls_detector_get,<br>sls_"

View File

@ -60,7 +60,6 @@ void qDrawPlot::SetupWidgetWindow() {
detType = det->getDetectorType().squash();
switch (detType) {
case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
pixelMask = ((1 << 14) - 1);
gainMask = (3 << 14);
gainOffset = 14;
@ -111,13 +110,6 @@ void qDrawPlot::SetupPlots() {
nPixelsX = res.x;
nPixelsY = res.y;
switch(detType) {
case slsDetectorDefs::MOENCH:
try{
npixelsy_jctb = (det->getNumberOfAnalogSamples().tsquash("Inconsistent values for number of analog samples") * 2)/25;// for moench 03
nPixelsX = npixelsx_jctb;
nPixelsY = npixelsy_jctb;
} CATCH_DISPLAY ("Could not get number of analog samples.", "qDrawPlot::SetupPlots")
break;
case slsDetectorDefs::EIGER:
try{
if (det->getQuad().tsquash("Inconsistent values for quad type")) {
@ -1015,7 +1007,6 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
case 16:
if (detType == slsDetectorDefs::JUNGFRAU ||
detType == slsDetectorDefs::MOENCH ||
detType == slsDetectorDefs::GOTTHARD2) {
// show gain plot

View File

@ -82,14 +82,14 @@ void qTabDeveloper::SetupWidgetWindow() {
case slsDetectorDefs::MOENCH:
lblSpinHV->show();
spinHV->show();
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 0: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 1: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 2: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 3: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 4: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 5: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 6: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "i Dac 7: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "vbp_colbuf: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "vin_cm: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_sda: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "vcasc_sfp: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "vout_cm: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "vipre_cds: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(this, det, true, "ibias_sfp: ", getSLSIndex(detType, tempid++)));
break;
case slsDetectorDefs::MYTHEN3:
@ -343,10 +343,27 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
break;
case slsDetectorDefs::MOENCH:
if (index >= 0 && index < (int)dacWidgets.size()) {
return (slsDetectorDefs::dacIndex)index;
}
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
switch (index) {
case 0:
return slsDetectorDefs::VBP_COLBUF;
case 1:
return slsDetectorDefs::VIPRE;
case 2:
return slsDetectorDefs::VIN_CM;
case 3:
return slsDetectorDefs::VB_SDA;
case 4:
return slsDetectorDefs::VCASC_SFP;
case 5:
return slsDetectorDefs::VOUT_CM;
case 6:
return slsDetectorDefs::VIPRE_CDS;
case 7:
return slsDetectorDefs::IBIAS_SFP;
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
}
break;
case slsDetectorDefs::MYTHEN3:
switch (index) {

View File

@ -72,7 +72,6 @@ void qTabPlot::SetupWidgetWindow() {
chkGapPixels->setEnabled(true);
break;
case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
chkGainPlot->setEnabled(true);
chkGainPlot->setChecked(true);
plot->EnableGainPlot(true);
@ -585,7 +584,6 @@ void qTabPlot::Refresh() {
GetGapPixels();
break;
case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
chkGainPlot->setEnabled(true);
break;
case slsDetectorDefs::GOTTHARD2:

View File

@ -20,7 +20,6 @@ void qTabSettings::SetupWidgetWindow() {
// enabling according to det type
switch(det->getDetectorType().squash()) {
case slsDetectorDefs::MOENCH:
case slsDetectorDefs::MYTHEN3:
lblSettings->setEnabled(false);
comboSettings->setEnabled(false);
@ -83,11 +82,21 @@ void qTabSettings::SetupDetectorSettings() {
item[(int)FORCESWITCHG1]->setEnabled(true);
item[(int)FORCESWITCHG2]->setEnabled(true);
break;
case slsDetectorDefs::GOTTHARD2:
case slsDetectorDefs::GOTTHARD2:
item[(int)DYNAMICGAIN]->setEnabled(true);
item[(int)FIXGAIN1]->setEnabled(true);
item[(int)FIXGAIN2]->setEnabled(true);
break;
break;
case slsDetectorDefs::MOENCH:
item[(int)G1_HIGHGAIN]->setEnabled(true);
item[(int)G1_LOWGAIN]->setEnabled(true);
item[(int)G2_HIGHCAP_HIGHGAIN]->setEnabled(true);
item[(int)G2_HIGHCAP_LOWGAIN]->setEnabled(true);
item[(int)G2_LOWCAP_HIGHGAIN]->setEnabled(true);
item[(int)G2_LOWCAP_LOWGAIN]->setEnabled(true);
item[(int)G4_HIGHGAIN]->setEnabled(true);
item[(int)G4_LOWGAIN]->setEnabled(true);
break;
default:
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
qDefs::Message(qDefs::CRITICAL,

View File

@ -515,7 +515,7 @@ void setupDetector() {
// altera pll
ALTERA_PLL_SetDefines(PLL_CNTRL_REG, PLL_PARAM_REG, PLL_CNTRL_RCNFG_PRMTR_RST_MSK, PLL_CNTRL_WR_PRMTR_MSK, PLL_CNTRL_PLL_RST_MSK, PLL_CNTRL_ADDR_MSK, PLL_CNTRL_ADDR_OFST);
bus_w(ADC_PORT_INVERT_REG, 0);// depends on chip
setADCInvertRegister(0);// depends on chip
FILE_LOG(logINFOBLUE, ("Setting Default parameters\n"));
cleanFifos(); // FIXME: why twice?

View File

@ -107,7 +107,6 @@ enum CLKINDEX {RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS};
#define BIT32_MSK (0xFFFFFFFF)
#define BIT16_MASK (0xFFFF)
#define ADC_PORT_INVERT_VAL (0x453b2593)
#define MAXIMUM_ADC_CLK (65)
#define PLL_VCO_FREQ_MHZ (800)

View File

@ -1,7 +1,7 @@
#include "slsDetectorFunctionList.h"
#include "versionAPI.h"
#include "clogger.h"
#include <sys/select.h>
#include "AD9257.h" // commonServerFunctions.h, blackfin.h, ansi.h
#include "LTC2620.h" // dacs
#include "MAX1932.h" // hv
@ -14,6 +14,7 @@
#include <string.h>
#include <unistd.h> // usleep
#include <sys/select.h>
#ifdef VIRTUAL
#include <pthread.h>
#include <time.h>

View File

@ -12,7 +12,8 @@ add_executable(moenchDetectorServer_virtual
../slsDetectorServer/src/ALTERA_PLL.c
../slsDetectorServer/src/LTC2620.c
../slsDetectorServer/src/MAX1932.c
../slsDetectorServer/src/programFpgaBlackfin.c
../slsDetectorServer/src/programFpgaBlackfin.c
../slsDetectorServer/src/readDefaultPattern.c
)
include_directories(

View File

@ -0,0 +1,414 @@
patword 0x0000 0x0000000000000000
patword 0x0001 0x0000000000000000
patword 0x0002 0x0008000900080000
patword 0x0003 0x0008000900080000
patword 0x0004 0x0008000900080000
patword 0x0005 0x0008000900080000
patword 0x0006 0x0008000900080000
patword 0x0007 0x0008000900080000
patword 0x0008 0x0008000900080000
patword 0x0009 0x0008000900080000
patword 0x000a 0x0008000900080000
patword 0x000b 0x0008000900080000
patword 0x000c 0x0008000900080000
patword 0x000d 0x0008000900080000
patword 0x000e 0x0008000900080000
patword 0x000f 0x0008000900080000
patword 0x0010 0x0008000900080000
patword 0x0011 0x0008000900080000
patword 0x0012 0x0008000900080000
patword 0x0013 0x0008000900080000
patword 0x0014 0x0008000900080000
patword 0x0015 0x0008000900080000
patword 0x0016 0x0008400900080020
patword 0x0017 0x0008400900080020
patword 0x0018 0x0008599f0418503a
patword 0x0019 0x0008599f0418503a
patword 0x001a 0x0108599f0418503a
patword 0x001b 0x0108599f0418503a
patword 0x001c 0x0108599f0418503a
patword 0x001d 0x0108599f0418503a
patword 0x001e 0x0108599f0418503a
patword 0x001f 0x0108599f0418503a
patword 0x0020 0x0108599f0418503a
patword 0x0021 0x0108599f0418503a
patword 0x0022 0x0108599f0418503a
patword 0x0023 0x0108599f0418503a
patword 0x0024 0x0108599f0418503a
patword 0x0025 0x0108599f0418503a
patword 0x0026 0x0108599f0418503a
patword 0x0027 0x0108599f0418503a
patword 0x0028 0x0108599f0418503a
patword 0x0029 0x0108599f0418503a
patword 0x002a 0x0108599f0418503a
patword 0x002b 0x0108599f0418503a
patword 0x002c 0x0108599f0418503a
patword 0x002d 0x0108599f0418503a
patword 0x002e 0x0108599f0418503a
patword 0x002f 0x0108599f0418503a
patword 0x0030 0x0108599f0418503a
patword 0x0031 0x0108599f0418503a
patword 0x0032 0x0108599f0418503a
patword 0x0033 0x0108599f0418503a
patword 0x0034 0x0108599f0418503a
patword 0x0035 0x0108599f0418503a
patword 0x0036 0x0108599f0418503a
patword 0x0037 0x0108599f0418503a
patword 0x0038 0x0108599f0418503a
patword 0x0039 0x0108599f0418503a
patword 0x003a 0x0108599f0418503a
patword 0x003b 0x0108599f0418503a
patword 0x003c 0x0108599f0418503a
patword 0x003d 0x0108599f0418503a
patword 0x003e 0x0108599f0418503a
patword 0x003f 0x0108599f0418503a
patword 0x0040 0x0108599f0418503a
patword 0x0041 0x0108599f0418503a
patword 0x0042 0x0108599f0418503a
patword 0x0043 0x0108599f0418503a
patword 0x0044 0x0108599f0418503a
patword 0x0045 0x0108599f0418503a
patword 0x0046 0x0108599f0418503a
patword 0x0047 0x0108599f0418503a
patword 0x0048 0x0108599f0418503a
patword 0x0049 0x0108599f0418503a
patword 0x004a 0x0108599f0418503a
patword 0x004b 0x0108599f0418503a
patword 0x004c 0x0108599f0418503a
patword 0x004d 0x0108599f0418503a
patword 0x004e 0x0108599f0418503a
patword 0x004f 0x0108599f0418503a
patword 0x0050 0x0108599f0418503a
patword 0x0051 0x0108599f0418503a
patword 0x0052 0x0108599f0418503a
patword 0x0053 0x0108599f0418503a
patword 0x0054 0x0108599f0418503a
patword 0x0055 0x0108599f0418503a
patword 0x0056 0x0108599f0418503a
patword 0x0057 0x0108599f0418503a
patword 0x0058 0x0108599f0418503a
patword 0x0059 0x0108599f0418503a
patword 0x005a 0x0108599f0418503a
patword 0x005b 0x0108599f0418503a
patword 0x005c 0x0108599f0418503a
patword 0x005d 0x0108599f0418503a
patword 0x005e 0x0108599f0418503a
patword 0x005f 0x0108599f0418503a
patword 0x0060 0x0108599f0418503a
patword 0x0061 0x0108599f0418503a
patword 0x0062 0x0108599f0418503a
patword 0x0063 0x0108599f0418503a
patword 0x0064 0x0108599f0418503a
patword 0x0065 0x0108599f0418503a
patword 0x0066 0x0108599f0418503a
patword 0x0067 0x0108599f0418503a
patword 0x0068 0x0108599f0418503a
patword 0x0069 0x0108599f0418503a
patword 0x006a 0x0108599f0418503a
patword 0x006b 0x0108599f0418503a
patword 0x006c 0x0108599f0418503a
patword 0x006d 0x0108599f0418503a
patword 0x006e 0x0108599f0418503a
patword 0x006f 0x0108599f0418503a
patword 0x0070 0x0108599f0418503a
patword 0x0071 0x0108599f0418503a
patword 0x0072 0x0108599f0418503a
patword 0x0073 0x0108599f0418503a
patword 0x0074 0x0108599f0418503a
patword 0x0075 0x0108599f0418503a
patword 0x0076 0x0108599f0418503a
patword 0x0077 0x0108599f0418503a
patword 0x0078 0x0108599f0418503a
patword 0x0079 0x0108599f0418503a
patword 0x007a 0x0108599f0418503a
patword 0x007b 0x0108599f0418503a
patword 0x007c 0x0108599f0418503a
patword 0x007d 0x0108599f0418503a
patword 0x007e 0x010859960418503a
patword 0x007f 0x010859960418503a
patword 0x0080 0x010859960418503a
patword 0x0081 0x010859960418503a
patword 0x0082 0x010859960418503a
patword 0x0083 0x010859960418503a
patword 0x0084 0x010859960418503a
patword 0x0085 0x010859960418503a
patword 0x0086 0x010859960418503a
patword 0x0087 0x010859960418503a
patword 0x0088 0x010859960418503a
patword 0x0089 0x010859960418503a
patword 0x008a 0x010859960418503a
patword 0x008b 0x010859960418503a
patword 0x008c 0x010859960418503a
patword 0x008d 0x010859960418503a
patword 0x008e 0x010859960418503a
patword 0x008f 0x010859960418503a
patword 0x0090 0x010859960418503a
patword 0x0091 0x010859960418503a
patword 0x0092 0x010819960418501a
patword 0x0093 0x010819960418501a
patword 0x0094 0x010819960418501a
patword 0x0095 0x010819960418501a
patword 0x0096 0x030819960418501a
patword 0x0097 0x030819960418501a
patword 0x0098 0x030819960418501a
patword 0x0099 0x030819960418501a
patword 0x009a 0x030819960418501a
patword 0x009b 0x030819960418501a
patword 0x009c 0x030819960418501a
patword 0x009d 0x030819960418501a
patword 0x009e 0x030819960418501a
patword 0x009f 0x030819960418501a
patword 0x00a0 0x030819960418501a
patword 0x00a1 0x030819960418501a
patword 0x00a2 0x030819960418501a
patword 0x00a3 0x030819960418501a
patword 0x00a4 0x030819960418501a
patword 0x00a5 0x030819960418501a
patword 0x00a6 0x030819960418501a
patword 0x00a7 0x030819960418501a
patword 0x00a8 0x030819960418501a
patword 0x00a9 0x030819960418501a
patword 0x00aa 0x030819960418501a
patword 0x00ab 0x030819960418501a
patword 0x00ac 0x030819960008501a
patword 0x00ad 0x030819960008501a
patword 0x00ae 0x030819960008501a
patword 0x00af 0x030819960008501a
patword 0x00b0 0x030819960008501a
patword 0x00b1 0x030819960008501a
patword 0x00b2 0x030819960008501a
patword 0x00b3 0x030819960008501a
patword 0x00b4 0x030819960008501a
patword 0x00b5 0x030819960008501a
patword 0x00b6 0x030819960008501a
patword 0x00b7 0x030819960008501a
patword 0x00b8 0x030819960008501a
patword 0x00b9 0x030819960008501a
patword 0x00ba 0x030819960008501a
patword 0x00bb 0x030819960008501a
patword 0x00bc 0x030819960008501a
patword 0x00bd 0x030819960008501a
patword 0x00be 0x030819960008501a
patword 0x00bf 0x030819960008501a
patword 0x00c0 0x0308199f0008501a
patword 0x00c1 0x0308199f0008501a
patword 0x00c2 0x0308199f0008501a
patword 0x00c3 0x0308199f0008501a
patword 0x00c4 0x0308199f0008501a
patword 0x00c5 0x0308199f0008501a
patword 0x00c6 0x0308199f0008501a
patword 0x00c7 0x0308199f0008501a
patword 0x00c8 0x0308199f0008501a
patword 0x00c9 0x0308199f0008501a
patword 0x00ca 0x0308199f0008501a
patword 0x00cb 0x0308199f0008501a
patword 0x00cc 0x0308199f0008501a
patword 0x00cd 0x0308199f0008501a
patword 0x00ce 0x0308199f0008501a
patword 0x00cf 0x0308199f0008501a
patword 0x00d0 0x0308199f0008501a
patword 0x00d1 0x0308199f0008501a
patword 0x00d2 0x0308199f0008501a
patword 0x00d3 0x0308199f0008501a
patword 0x00d4 0x0308599f0008503a
patword 0x00d5 0x0308599f0008503a
patword 0x00d6 0x030c599f000850ba
patword 0x00d7 0x030c599f000850ba
patword 0x00d8 0x030c599f000850ba
patword 0x00d9 0x030c599f000850ba
patword 0x00da 0x030c599f000850ba
patword 0x00db 0x030c599f000850ba
patword 0x00dc 0x030c599f000850ba
patword 0x00dd 0x030c599f000850ba
patword 0x00de 0x030c599f000850ba
patword 0x00df 0x030c599f000850ba
patword 0x00e0 0x030c599f000850ba
patword 0x00e1 0x030c599f000850ba
patword 0x00e2 0x030c599f000850ba
patword 0x00e3 0x030c599f000850ba
patword 0x00e4 0x030c599f000850ba
patword 0x00e5 0x030c599f000850ba
patword 0x00e6 0x030c599f000850ba
patword 0x00e7 0x030c599f000850ba
patword 0x00e8 0x030c599f000850ba
patword 0x00e9 0x030c599f000850ba
patword 0x00ea 0x030c799f010858ba
patword 0x00eb 0x030c799f010858ba
patword 0x00ec 0x030c599f000850ba
patword 0x00ed 0x030c599f000850ba
patword 0x00ee 0x030c599f000850ba
patword 0x00ef 0x030c599f000850ba
patword 0x00f0 0x030c599f000850ba
patword 0x00f1 0x030c599f000850ba
patword 0x00f2 0x030c599f000850ba
patword 0x00f3 0x030c599f000850ba
patword 0x00f4 0x030c599f000850ba
patword 0x00f5 0x030c599f000850ba
patword 0x00f6 0x030c599f000850ba
patword 0x00f7 0x030c599f000850ba
patword 0x00f8 0x030c599f000850ba
patword 0x00f9 0x030c599f000850ba
patword 0x00fa 0x030c599f000850ba
patword 0x00fb 0x030c599f000850ba
patword 0x00fc 0x030c599f000850ba
patword 0x00fd 0x030c599f000850ba
patword 0x00fe 0x030c599f000850ba
patword 0x00ff 0x030c599f000850ba
patword 0x0100 0x030c599f000850ba
patword 0x0101 0x030c599f000850ba
patword 0x0102 0x030c599f400850ba
patword 0x0103 0x030c599f400850ba
patword 0x0104 0x030c599f600850ba
patword 0x0105 0x030c599f400850ba
patword 0x0106 0x030c599f400850ba
patword 0x0107 0x030c599f400850ba
patword 0x0108 0x870c599f682e50ba
patword 0x0109 0x870c599f482850ba
patword 0x010a 0x870c599f000e50ba
patword 0x010b 0x870c599f000850ba
patword 0x010c 0x870c599f000e50ba
patword 0x010d 0x870c599f000850ba
patword 0x010e 0x870c599f000e50ba
patword 0x010f 0x870c599f000850ba
patword 0x0110 0x870c599f000e50ba
patword 0x0111 0x870c599f000850ba
patword 0x0112 0x870c599f000e50ba
patword 0x0113 0x870c599f000850ba
patword 0x0114 0x870c599f000e50ba
patword 0x0115 0x870c599f000850ba
patword 0x0116 0x870c599f000e50ba
patword 0x0117 0x870c599f000850ba
patword 0x0118 0x870c599f000e50ba
patword 0x0119 0x870c599f000850ba
patword 0x011a 0x870c599f000e50ba
patword 0x011b 0x870c599f000850ba
patword 0x011c 0x870c599f000e50ba
patword 0x011d 0x870c599f000850ba
patword 0x011e 0x870c599f000e50ba
patword 0x011f 0x870c599f000850ba
patword 0x0120 0x870c599f000e50ba
patword 0x0121 0x870c599f000850ba
patword 0x0122 0x870c599f200e50ba
patword 0x0123 0x870c599f000850ba
patword 0x0124 0x870c599f000e50ba
patword 0x0125 0x870c599f000850ba
patword 0x0126 0x870c599f000e50ba
patword 0x0127 0x870c599f000850ba
patword 0x0128 0x870c599f000e50ba
patword 0x0129 0x870c599f000850ba
patword 0x012a 0x870c599f000e50ba
patword 0x012b 0x870c599f000850ba
patword 0x012c 0x870c599f000e50ba
patword 0x012d 0x870c599f000850ba
patword 0x012e 0x870c599f000e50ba
patword 0x012f 0x870c599f000850ba
patword 0x0130 0x870c599f000e50ba
patword 0x0131 0x870c599f000850ba
patword 0x0132 0x870c599f000e50ba
patword 0x0133 0x870c599f000850ba
patword 0x0134 0x870c599f000e50ba
patword 0x0135 0x870c599f000850ba
patword 0x0136 0x870c599f000e50ba
patword 0x0137 0x870c599f000850ba
patword 0x0138 0x870c599f000e50ba
patword 0x0139 0x870c599f000850ba
patword 0x013a 0x870c599f282e50ba
patword 0x013b 0x870c599f082850ba
patword 0x013c 0x870c599f000e50ba
patword 0x013d 0x870c599f000850ba
patword 0x013e 0x870c599f000e50ba
patword 0x013f 0x870c599f000850ba
patword 0x0140 0x870c599f000e50ba
patword 0x0141 0x870c599f000850ba
patword 0x0142 0x870c599f000e50ba
patword 0x0143 0x870c599f000850ba
patword 0x0144 0x870c599f000e50ba
patword 0x0145 0x870c599f000850ba
patword 0x0146 0x870c599f000e50ba
patword 0x0147 0x870c599f000850ba
patword 0x0148 0x870c599f000e50ba
patword 0x0149 0x870c599f000850ba
patword 0x014a 0x870c599f000e50ba
patword 0x014b 0x870c599f000850ba
patword 0x014c 0x870c599f000e50ba
patword 0x014d 0x870c599f000850ba
patword 0x014e 0x870c599f000e50ba
patword 0x014f 0x870c599f000850ba
patword 0x0150 0x870c599f000e50ba
patword 0x0151 0x870c599f000850ba
patword 0x0152 0x870c599f000e50ba
patword 0x0153 0x870c599f000850ba
patword 0x0154 0x870c599f200e50ba
patword 0x0155 0x870c599f000850ba
patword 0x0156 0x870c599f000e50ba
patword 0x0157 0x870c599f000850ba
patword 0x0158 0x870c599f000e50ba
patword 0x0159 0x870c599f000850ba
patword 0x015a 0x870c599f000e50ba
patword 0x015b 0x870c599f000850ba
patword 0x015c 0x870c599f000e50ba
patword 0x015d 0x870c599f000850ba
patword 0x015e 0x870c599f000e50ba
patword 0x015f 0x870c599f000850ba
patword 0x0160 0x870c599f000e50ba
patword 0x0161 0x870c599f000850ba
patword 0x0162 0x870c599f000e50ba
patword 0x0163 0x870c599f000850ba
patword 0x0164 0x870c599f000e50ba
patword 0x0165 0x870c599f000850ba
patword 0x0166 0x870c599f000e50ba
patword 0x0167 0x870c599f000850ba
patword 0x0168 0x870c599f000e50ba
patword 0x0169 0x870c599f000850ba
patword 0x016a 0x870c599f000e50ba
patword 0x016b 0x870c599f000850ba
patword 0x016c 0x070c599f000850ba
patword 0x016d 0x070c599f000850ba
patword 0x016e 0x000c599f000850ba
patword 0x016f 0x000c599f000850ba
patword 0x0170 0x0008599f200e503a
patword 0x0171 0x0008599f0008503a
patword 0x0172 0x0008599f200e503a
patword 0x0173 0x0008599f0008503a
patword 0x0174 0x0008599f0008503a
patword 0x0175 0x0008599f0008503a
patword 0x0176 0x0008599f0008503a
patword 0x0177 0x0008599f0008503a
patword 0x0178 0x0008599f0008503a
patword 0x0179 0x0008599f0008503a
patword 0x017a 0x0008599f0008503a
patword 0x017b 0x0008599f0008503a
patword 0x017c 0x0008599f0008503a
patword 0x017d 0x0008599f0008503a
patword 0x017e 0x0008599f0008503a
patword 0x017f 0x0008599f0008503a
patword 0x0180 0x0008599f0008503a
patword 0x0181 0x0008599f0008503a
patword 0x0182 0x0008599f0008503a
patword 0x0183 0x0008599f0008503a
patword 0x0184 0x0008599f0008503a
patword 0x0185 0x0008599f0008503a
patword 0x0186 0x0008599f0008503a
patword 0x0187 0x0008599f0008503a
patword 0x0188 0x0008599f0008503a
patword 0x0189 0x0008599f0008503a
patword 0x018a 0x0008599f0008503a
patword 0x018b 0x0008599f0008503a
patword 0x018c 0x0008599f0008503a
patword 0x018d 0x0008599f0008503a
patioctrl 0x8f0effff6dbffdbf
patclkctrl 0x0000000000000000
patlimits 0x0000 0x018c
patloop0 0x013a 0x016b
patnloop0 199
patloop1 0x0400 0x0400
patnloop1 0
patloop2 0x0400 0x0400
patnloop2 0
patwait0 0x00aa
patwaittime0 10000
patwait1 0x0400
patwaittime1 0
patwait2 0x0400
patwaittime2 0

View File

@ -12,7 +12,7 @@ DESTDIR ?= bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c $(main_src)readDefaultPattern.c
OBJS = $(SRCS:.c=.o)
@ -34,6 +34,7 @@ $(PROGS): $(OBJS)
mv $(PROGS) $(DESTDIR)
rm *.gdb
rm $(main_src)*.o
rm *.o
clean:
rm -rf $(DESTDIR)/$(PROGS) *.o *.gdb $(main_src)*.o

View File

@ -16,7 +16,7 @@
/* Fix pattern RO register */
#define FIX_PATT_REG (0x01 << MEM_MAP_SHIFT)
#define FIX_PATT_VAL (0xACDC2014)
#define FIX_PATT_VAL (0xACDC2016)
/* Status RO register */
#define STATUS_REG (0x02 << MEM_MAP_SHIFT)
@ -289,7 +289,7 @@
/* Configuration RW register */
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
#define CONFIG_LED_DSBL_OFST (0)
#define CONFIG_LED_DSBL_OFST (0) // Not used in firmware or software
#define CONFIG_LED_DSBL_MSK (0x00000001 << CONFIG_LED_DSBL_OFST)
#define CONFIG_DSBL_ANLG_OTPT_OFST (8)
#define CONFIG_DSBL_ANLG_OTPT_MSK (0x00000001 << CONFIG_DSBL_ANLG_OTPT_OFST)
@ -365,23 +365,23 @@
#define PATTERN_CNTRL_RD_OFST (1)
#define PATTERN_CNTRL_RD_MSK (0x00000001 << PATTERN_CNTRL_RD_OFST)
#define PATTERN_CNTRL_ADDR_OFST (16)
#define PATTERN_CNTRL_ADDR_MSK (0x0000FFFF << PATTERN_CNTRL_ADDR_OFST)
#define PATTERN_CNTRL_ADDR_MSK (0x00001FFF << PATTERN_CNTRL_ADDR_OFST)
/* Pattern Limit RW regiser */
#define PATTERN_LIMIT_REG (0x53 << MEM_MAP_SHIFT)
#define PATTERN_LIMIT_STRT_OFST (0)
#define PATTERN_LIMIT_STRT_MSK (0x0000FFFF << PATTERN_LIMIT_STRT_OFST)
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
#define PATTERN_LIMIT_STP_OFST (16)
#define PATTERN_LIMIT_STP_MSK (0x0000FFFF << PATTERN_LIMIT_STP_OFST)
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
/* Pattern Loop 0 Address RW regiser */
#define PATTERN_LOOP_0_ADDR_REG (0x54 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_0_ADDR_STRT_MSK (0x0000FFFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
#define PATTERN_LOOP_0_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x0000FFFF << PATTERN_LOOP_0_ADDR_STP_OFST)
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
/* Pattern Loop 0 Iteration RW regiser */
#define PATTERN_LOOP_0_ITERATION_REG (0x55 << MEM_MAP_SHIFT)
@ -390,9 +390,9 @@
#define PATTERN_LOOP_1_ADDR_REG (0x56 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_1_ADDR_STRT_MSK (0x0000FFFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
#define PATTERN_LOOP_1_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x0000FFFF << PATTERN_LOOP_1_ADDR_STP_OFST)
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
/* Pattern Loop 1 Iteration RW regiser */
#define PATTERN_LOOP_1_ITERATION_REG (0x57 << MEM_MAP_SHIFT)
@ -401,9 +401,9 @@
#define PATTERN_LOOP_2_ADDR_REG (0x58 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_2_ADDR_STRT_MSK (0x0000FFFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
#define PATTERN_LOOP_2_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x0000FFFF << PATTERN_LOOP_2_ADDR_STP_OFST)
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
/* Pattern Loop 2 Iteration RW regiser */
#define PATTERN_LOOP_2_ITERATION_REG (0x59 << MEM_MAP_SHIFT)
@ -412,31 +412,36 @@
#define PATTERN_WAIT_0_ADDR_REG (0x5A << MEM_MAP_SHIFT)
#define PATTERN_WAIT_0_ADDR_OFST (0)
#define PATTERN_WAIT_0_ADDR_MSK (0x0000FFFF << PATTERN_WAIT_0_ADDR_OFST)
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
//FIXME: is mask 3FF
/* Pattern Wait 1 RW regiser */
#define PATTERN_WAIT_1_ADDR_REG (0x5B << MEM_MAP_SHIFT)
#define PATTERN_WAIT_1_ADDR_OFST (0)
#define PATTERN_WAIT_1_ADDR_MSK (0x0000FFFF << PATTERN_WAIT_1_ADDR_OFST)
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
/* Pattern Wait 2 RW regiser */
#define PATTERN_WAIT_2_ADDR_REG (0x5C << MEM_MAP_SHIFT)
#define PATTERN_WAIT_2_ADDR_OFST (0)
#define PATTERN_WAIT_2_ADDR_MSK (0x0000FFFF << PATTERN_WAIT_2_ADDR_OFST)
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
/* Samples RW register */
#define SAMPLES_REG (0x5D << MEM_MAP_SHIFT)
#define SAMPLES_DIGITAL_OFST (0)
#define SAMPLES_DIGITAL_MSK (0x0000FFFF << SAMPLES_DIGITAL_OFST)
#define SAMPLES_ANALOG_OFST (16)
#define SAMPLES_ANALOG_MSK (0x0000FFFF << SAMPLES_ANALOG_OFST)
/** Power RW register */
#define POWER_REG (0x5E << MEM_MAP_SHIFT)
#define POWER_ENBL_VLTG_RGLTR_OFST (16)
#define POWER_ENBL_VLTG_RGLTR_MSK (0x0000001F << POWER_ENBL_VLTG_RGLTR_OFST)
#define POWER_HV_SLCT_OFST (31)
#define POWER_HV_SLCT_MSK (0x00000001 << POWER_HV_SLCT_OFST)
#define POWER_CHIP_OFST (16)
#define POWER_CHIP_MSK (0x00000001 << POWER_CHIP_OFST)
#define POWER_HV_INTERNAL_SLCT_OFST (31)
#define POWER_HV_INTERNAL_SLCT_MSK (0x00000001 << POWER_HV_INTERNAL_SLCT_OFST)
/* Number of Words RW register TODO */
#define NUMBER_OF_WORDS_REG (0x5F << MEM_MAP_SHIFT)
@ -493,17 +498,16 @@
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x76 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x77 << MEM_MAP_SHIFT)
/* ADC Disable RW register TODO */
#define ADC_DISABLE_REG (0x78 << MEM_MAP_SHIFT)
/* Readout enable RW register */
#define READOUT_10G_ENABLE_REG (0x79 << MEM_MAP_SHIFT)
/* DAC Value RW register TODO */
//#define DAC_VALUE_REG (0x79 << MEM_MAP_SHIFT)
/* DAC Number RW register TODO */
//#define DAC_NUMBER_REG (0x7A << MEM_MAP_SHIFT)
#define READOUT_10G_ENABLE_ANLG_OFST (0)
#define READOUT_10G_ENABLE_ANLG_MSK (0x000000FF << READOUT_10G_ENABLE_ANLG_OFST)
#define READOUT_10G_ENABLE_DGTL_OFST (8)
#define READOUT_10G_ENABLE_DGTL_MSK (0x00000001 << READOUT_10G_ENABLE_DGTL_OFST)
/* Digital Bit External Trigger RW register */
#define DBIT_EXT_TRG_REG (0x7B << MEM_MAP_SHIFT)
#define DBIT_EXT_TRG_REG (0x7B << MEM_MAP_SHIFT) // Not used in firmware or software
#define DBIT_EXT_TRG_SRC_OFST (0)
#define DBIT_EXT_TRG_SRC_MSK (0x0000003F << DBIT_EXT_TRG_SRC_OFST)
@ -511,7 +515,8 @@
#define DBIT_EXT_TRG_OPRTN_MD_MSK (0x00000001 << DBIT_EXT_TRG_OPRTN_MD_OFST)
/* Pin Delay 0 RW register */
#define OUTPUT_DELAY_0_REG (0x7C << MEM_MAP_SHIFT)
#define OUTPUT_DELAY_0_REG (0x7C << MEM_MAP_SHIFT) // Not used in firmware or software
#define OUTPUT_DELAY_0_OTPT_STTNG_STEPS (25)
#define OUTPUT_DELAY_0_OTPT_STTNG_OFST (0) //t = OTPT_STTNG * 25 ps, max for Cyclone V = 775 ps
#define OUTPUT_DELAY_0_OTPT_STTNG_MSK (0x0000001F << OUTPUT_DELAY_0_OTPT_STTNG_OFST)
@ -523,7 +528,7 @@
/* Pin Delay 1 RW register
* Each bit configured as enable for dynamic output delay configuration */
#define PIN_DELAY_1_REG (0x7D << MEM_MAP_SHIFT)
#define PIN_DELAY_1_REG (0x7D << MEM_MAP_SHIFT) // Not used in firmware or software
/** Pattern Mask 64 bit RW regiser */
#define PATTERN_MASK_LSB_REG (0x80 << MEM_MAP_SHIFT)
@ -533,7 +538,7 @@
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
/* Round Robin */
#define RXR_ENDPOINT_START_REG (0x1000 << MEM_MAP_SHIFT)

View File

@ -4,27 +4,52 @@
#define MIN_REQRD_VRSN_T_RD_API 0x180314
#define REQRD_FRMWR_VRSN 0x180314
#define REQRD_FRMWR_VRSN 0x200302
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
#define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000)
/* Struct Definitions */
typedef struct ip_header_struct {
uint16_t ip_len;
uint8_t ip_tos;
uint8_t ip_ihl:4 ,ip_ver:4;
uint16_t ip_offset:13,ip_flag:3;
uint16_t ip_ident;
uint16_t ip_chksum;
uint8_t ip_protocol;
uint8_t ip_ttl;
uint32_t ip_sourceip;
uint32_t ip_destip;
} ip_header;
typedef struct udp_header_struct {
uint32_t udp_destmac_msb;
uint16_t udp_srcmac_msb;
uint16_t udp_destmac_lsb;
uint32_t udp_srcmac_lsb;
uint8_t ip_tos;
uint8_t ip_ihl: 4, ip_ver: 4;
uint16_t udp_ethertype;
uint16_t ip_identification;
uint16_t ip_totallength;
uint8_t ip_protocol;
uint8_t ip_ttl;
uint16_t ip_fragmentoffset: 13, ip_flags: 3;
uint16_t ip_srcip_msb;
uint16_t ip_checksum;
uint16_t ip_destip_msb;
uint16_t ip_srcip_lsb;
uint16_t udp_srcport;
uint16_t ip_destip_lsb;
uint16_t udp_checksum;
uint16_t udp_destport;
} udp_header;
#define IP_HEADER_SIZE (20)
#define UDP_IP_HEADER_LENGTH_BYTES (28)
/* Enums */
enum DACINDEX {MO_VBP_COLBUF, MO_VIPRE, MO_VIN_CM, MO_VB_SDA, MO_VCASC_SFP, MO_VOUT_CM, MO_VIPRE_CDS, MO_IBIAS_SFP};
#define DAC_NAMES "vbp_colbuf", "vipre", "vin_cm", "vb_sda", "vcasc_sfp", "vout_cm", "vipre_cds", "ibias_sfp"
#define DEFAULT_DAC_VALS { 1300, /* MO_VBP_COLBUF */ \
1000, /* MO_VIPRE */ \
1400, /* MO_VIN_CM */ \
680, /* MO_VB_SDA */ \
1428, /* MO_VCASC_SFP */ \
1200, /* MO_VOUT_CM */ \
800, /* MO_VIPRE_CDS */ \
900 /* MO_IBIAS_SFP */ \
};
enum CLKINDEX {RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS};
enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7};
#define CLK_NAMES "run", "adc", "sync", "dbit"
/* Hardware Definitions */
#define NCHAN (32)
@ -33,12 +58,14 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7};
#define DYNAMIC_RANGE (16)
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
#define CLK_FREQ (156.25) /* MHz */
#define NSAMPLES_PER_ROW (25)
/** Default Parameters */
#define DEFAULT_PATTERN_FILE ("DefaultPattern.txt")
#define DEFAULT_DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
#define DEFAULT_NUM_SAMPLES (1)
#define DEFAULT_NUM_SAMPLES (5000)
#define DEFAULT_EXPTIME (0)
#define DEFAULT_NUM_FRAMES (100 * 1000 * 1000)
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_PERIOD (1 * 1000 * 1000) //ns
#define DEFAULT_DELAY (0)
@ -46,35 +73,49 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7};
#define DEFAULT_VLIMIT (-100)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_TX_UDP_PORT (0x7e9a)
#define DEFAULT_RUN_CLK (40)
#define DEFAULT_ADC_CLK (20)
#define DEFAULT_SYNC_CLK (20)
#define DEFAULT_DBIT_CLK (200)
#define DEFAULT_RUN_CLK (40)
#define DEFAULT_ADC_CLK (20)
#define DEFAULT_SYNC_CLK (20)
#define DEFAULT_DBIT_CLK (20)
#define DEFAULT_ADC_PHASE_DEG (30)
#define DEFAULT_PIPELINE (14)
#define DEFAULT_SETTINGS (G4_HIGHGAIN)
// settings
#define DEFAULT_PATSETBIT (0x40800000115ULL)
#define G1_HIGHGAIN_PATMASK (0x40800000101ULL)
#define G1_LOWGAIN_PATMASK (0x40000000100ULL)
#define G2_HIGHCAP_HIGHGAIN_PATMASK (0x00800000001ULL)
#define G2_HIGHCAP_LOWGAIN_PATMASK (0x00000000000ULL)
#define G2_LOWCAP_HIGHGAIN_PATMASK (0x40800000115ULL)
#define G2_LOWCAP_LOWGAIN_PATMASK (0x40000000114ULL)
#define G4_HIGHGAIN_PATMASK (0x00800000015ULL)
#define G4_LOWGAIN_PATMASK (0x00000000014ULL)
#define HIGHVOLTAGE_MIN (60)
#define HIGHVOLTAGE_MAX (200)
#define HIGHVOLTAGE_MAX (200) // min dac val
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2500)
/* Defines in the Firmware */
#define MAX_PATTERN_LENGTH (0x7FFF)
#define MAX_PATTERN_LENGTH (0x2000)
#define DIGITAL_IO_DELAY_MAXIMUM_PS ((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * OUTPUT_DELAY_0_OTPT_STTNG_STEPS)
#define MAX_PHASE_SHIFTS_STEPS (8)
#define WAIT_TME_US_FR_ACQDONE_REG (100) // wait time in us after acquisition done to ensure there is no data in fifo
#define WAIT_TIME_US_PLL (10 * 1000)
#define WAIT_TIME_US_STP_ACQ (100)
#define WAIT_TIME_CONFIGURE_MAC (500 * 1000)
#define WAIT_TIME_CONFIGURE_MAC (2 * 1000 * 1000)
#define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_FIFO_RD_STROBE (10)
#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin
/* MSB & LSB DEFINES */
#define MSB_OF_64_BIT_REG_OFST (32)
#define LSB_OF_64_BIT_REG_OFST (0)
#define BIT_32_MSK (0xFFFFFFFF)
#define BIT32_MSK (0xFFFFFFFF)
#define BIT16_MASK (0xFFFF)
#define IP_PACKETSIZE (0x2032)
#define ADC_PORT_INVERT_VAL (0x453b2593) //FIXME: a default value?
#define MAXIMUM_ADC_CLK (40)
#define ADC_PORT_INVERT_VAL (0x4a342593)
#define MAXIMUM_ADC_CLK (20)
#define PLL_VCO_FREQ_MHZ (800)

View File

@ -0,0 +1,22 @@
#pragma once
#include <sys/types.h>
#include <inttypes.h>
int loadDefaultPattern(char* fname);
int default_writePatternWord(char* line, uint32_t addr, uint64_t word);
int default_writePatternIOControl(char* line, uint64_t arg);
int default_writePatternClkControl(char* line, uint64_t arg);
int default_setPatternLoopLimits(char* line, uint32_t startAddr, uint32_t stopAddr);
int default_setPatternLoopAddresses(char* line, int level, uint32_t startAddr, uint32_t stopAddr);
int default_setPatternLoopCycles(char* line, int level, int numLoops);
int default_setPatternWaitAddresses(char* line, int level, uint32_t addr);
int default_setPatternWaitTime(char* line, int level, uint64_t waittime);

View File

@ -3,6 +3,14 @@
#ifdef GOTTHARDD
#include "clogger.h" // runState(enum TLogLevel)
#endif
#ifndef VIRTUAL
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
#include "programFpgaNios.h"
#elif defined(CHIPTESTBOARDD) || defined(JUNGFRAUD) || defined(MOENCHD)
#include "programFpgaBlackfin.h"
#endif
#endif
#include <stdlib.h>
#include <stdio.h> // FILE
#include <sys/types.h>
@ -84,7 +92,7 @@ int updateDatabytesandAllocateRAM();
void updateDataBytes();
#endif
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MYTHEN3D)
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MYTHEN3D) || defined(MOENCHD)
int setDefaultDacs();
#endif
#ifdef GOTTHARD2D
@ -141,6 +149,8 @@ void setADCEnableMask_10G(uint32_t mask);
uint32_t getADCEnableMask_10G();
void setADCInvertRegister(uint32_t val);
uint32_t getADCInvertRegister();
#endif
#if defined(CHIPTESTBOARDD)
int setExternalSamplingSource(int val);
int setExternalSampling(int val);
#endif
@ -213,6 +223,8 @@ int64_t getStorageCellDelay();
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
int setNumAnalogSamples(int val);
int getNumAnalogSamples();
#endif
#ifdef CHIPTESTBOARDD
int setNumDigitalSamples(int val);
int getNumDigitalSamples();
#endif
@ -245,7 +257,7 @@ int64_t getMeasurementTime();
int setModule(sls_detector_module myMod, char* mess);
int getModule(sls_detector_module *myMod);
#endif
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D))
#if (!defined(CHIPTESTBOARDD)) && (!defined(MYTHEN3D))
enum detectorSettings setSettings(enum detectorSettings sett);
#endif
#if !defined(MYTHEN3D)
@ -298,11 +310,9 @@ void setPower(enum DACINDEX ind, int val);
void powerOff();
#endif
#ifndef MOENCHD
#if !defined(MYTHEN3D) && !defined(GOTTHARD2D)
#if !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
int getADC(enum ADCINDEX ind);
#endif
#endif
int setHighVoltage(int val);
@ -358,6 +368,7 @@ int enableTenGigabitEthernet(int val);
// moench specific - powerchip
#ifdef MOENCHD
int powerChip (int on);
int setAnalogOnlyReadout();
#endif
// chip test board or moench specific - configure frequency, phase, pll, flashing firmware
@ -383,13 +394,18 @@ uint64_t writePatternWord(int addr, uint64_t word);
int setPatternWaitAddress(int level, int addr);
uint64_t setPatternWaitTime(int level, uint64_t t);
void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop);
#ifdef CHIPTESTBOARDD
int setLEDEnable(int enable);
void setDigitalIODelay(uint64_t pinMask, int delay);
#endif
void setPatternMask(uint64_t mask);
uint64_t getPatternMask();
void setPatternBitMask(uint64_t mask);
uint64_t getPatternBitMask();
#endif
#ifdef MOENCHD
extern int loadDefaultPattern(char* fname); // readDefaultPattern.h
#endif
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, pll, flashing firmware
#ifdef JUNGFRAUD

View File

@ -0,0 +1,414 @@
#include "readDefaultPattern.h"
#include "sls_detector_defs.h"
#include "slsDetectorServer_defs.h"
#include "ansi.h"
#include "clogger.h"
#include <string.h>
extern char initErrorMessage[MAX_STR_LENGTH];
extern int initError;
extern uint64_t writePatternIOControl(uint64_t word);
extern uint64_t writePatternClkControl(uint64_t word);
extern uint64_t writePatternWord(int addr, uint64_t word);
extern int setPatternWaitAddress(int level, int addr);
extern uint64_t setPatternWaitTime(int level, uint64_t t);
extern void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop);
int loadDefaultPattern(char* fname) {
if (initError == FAIL) {
return initError;
}
FILE* fd = fopen(fname, "r");
if(fd == NULL) {
sprintf(initErrorMessage, "Could not open pattern file [%s].\n", fname);
initError = FAIL;
FILE_LOG(logERROR, ("%s\n\n", initErrorMessage));
return FAIL;
}
FILE_LOG(logINFOBLUE, ("Reading default pattern file %s\n", fname));
// Initialization
const size_t LZ = 256;
char line[LZ];
memset(line, 0, LZ);
char command[LZ];
// keep reading a line
while (fgets(line, LZ, fd)) {
// ignore comments
if (line[0] == '#') {
FILE_LOG(logDEBUG1, ("Ignoring Comment\n"));
continue;
}
// ignore empty lines
if (strlen(line) <= 1) {
FILE_LOG(logDEBUG1, ("Ignoring Empty line\n"));
continue;
}
FILE_LOG(logDEBUG1, ("Command to process: (size:%d) %.*s\n",
strlen(line), strlen(line) -1, line));
memset(command, 0, LZ);
// patword
if (!strncmp(line, "patword", strlen("patword"))) {
uint32_t addr = 0;
uint64_t word = 0;
// cannot scan values
if (sscanf(line, "%s 0x%x 0x%llx", command, &addr, &word) != 3) {
sprintf(initErrorMessage, "Could not scan patword arguments from default "
"pattern file. Line:[%s].\n", line);
break;
}
if (default_writePatternWord(line, addr, word) == FAIL) {
break;
}
}
// patioctrl
if (!strncmp(line, "patioctrl", strlen("patioctrl"))) {
uint64_t arg = 0;
// cannot scan values
if (sscanf(line, "%s 0x%llx", command, &arg) != 2) {
sprintf(initErrorMessage, "Could not scan patioctrl arguments from default "
"pattern file. Line:[%s].\n", line);
break;
}
if (default_writePatternIOControl(line, arg) == FAIL) {
break;
}
}
// patclkctrl
if (!strncmp(line, "patclkctrl", strlen("patclkctrl"))) {
uint64_t arg = 0;
// cannot scan values
if (sscanf(line, "%s 0x%llx", command, &arg) != 2) {
sprintf(initErrorMessage, "Could not scan patclkctrl arguments from default "
"pattern file. Line:[%s].\n", line);
break;
}
if (default_writePatternClkControl(line, arg) == FAIL) {
break;
}
}
// patlimits
if (!strncmp(line, "patlimits", strlen("patlimits"))) {
uint32_t startAddr = 0;
uint32_t stopAddr = 0;
// cannot scan values
if (sscanf(line, "%s 0x%x 0x%x", command, &startAddr, &stopAddr) != 3) {
sprintf(initErrorMessage, "Could not scan patlimits arguments from default "
"pattern file. Line:[%s].\n", line);
break;
}
if (default_setPatternLoopLimits(line, startAddr, stopAddr) == FAIL) {
break;
}
}
// patloop
if ((!strncmp(line, "patloop0", strlen("patloop0"))) ||
(!strncmp(line, "patloop1", strlen("patloop1"))) ||
(!strncmp(line, "patloop2", strlen("patloop2")))) {
// level
int level = -1;
if (!strncmp(line, "patloop0", strlen("patloop0"))) {
level = 0;
} else if (!strncmp(line, "patloop1", strlen("patloop1"))) {
level = 1;
} else {
level = 2;
}
uint32_t startAddr = 0;
uint32_t stopAddr = 0;
// cannot scan values
if (sscanf(line, "%s 0x%x 0x%x", command, &startAddr, &stopAddr) != 3) {
sprintf(initErrorMessage, "Could not scan patloop%d arguments from default "
"pattern file. Line:[%s].\n", level, line);
break;
}
if (default_setPatternLoopAddresses(line, level, startAddr, stopAddr) == FAIL) {
break;
}
}
// patnloop
if ((!strncmp(line, "patnloop0", strlen("patnloop0"))) ||
(!strncmp(line, "patnloop1", strlen("patnloop1"))) ||
(!strncmp(line, "patnloop2", strlen("patnloop2")))) {
// level
int level = -1;
if (!strncmp(line, "patnloop0", strlen("patnloop0"))) {
level = 0;
} else if (!strncmp(line, "patnloop1", strlen("patnloop1"))) {
level = 1;
} else {
level = 2;
}
int numLoops = -1;
// cannot scan values
if (sscanf(line, "%s %d", command, &numLoops) != 2) {
sprintf(initErrorMessage, "Could not scan patnloop%d arguments from default "
"pattern file. Line:[%s].\n", level, line);
break;
}
if (default_setPatternLoopCycles(line, level, numLoops) == FAIL) {
break;
}
}
// patwait
if ((!strncmp(line, "patwait0", strlen("patwait0"))) ||
(!strncmp(line, "patwait1", strlen("patwait1"))) ||
(!strncmp(line, "patwait2", strlen("patwait2")))) {
// level
int level = -1;
if (!strncmp(line, "patwait0", strlen("patwait0"))) {
level = 0;
} else if (!strncmp(line, "patwait1", strlen("patwait1"))) {
level = 1;
} else {
level = 2;
}
uint32_t addr = 0;
// cannot scan values
if (sscanf(line, "%s 0x%x", command, &addr) != 2) {
sprintf(initErrorMessage, "Could not scan patwait%d arguments from default "
"pattern file. Line:[%s].\n", level, line);
break;
}
if (default_setPatternWaitAddresses(line, level, addr) == FAIL) {
break;
}
}
// patwaittime
if ((!strncmp(line, "patwaittime0", strlen("patwaittime0"))) ||
(!strncmp(line, "patwaittime1", strlen("patwaittime1"))) ||
(!strncmp(line, "patwaittime2", strlen("patwaittime2")))) {
// level
int level = -1;
if (!strncmp(line, "patwaittime0", strlen("patwaittime0"))) {
level = 0;
} else if (!strncmp(line, "patwaittime1", strlen("patwaittime1"))) {
level = 1;
} else {
level = 2;
}
uint64_t waittime = 0;
// cannot scan values
if (sscanf(line, "%s %lld", command, &waittime) != 2) {
sprintf(initErrorMessage, "Could not scan patwaittime%d arguments from default "
"pattern file. Line:[%s].\n", level, line);
break;
}
if (default_setPatternWaitTime(line, level, waittime) == FAIL) {
break;
}
}
memset(line, 0, LZ);
}
fclose(fd);
if (strlen(initErrorMessage)) {
initError = FAIL;
FILE_LOG(logERROR, ("%s\n\n", initErrorMessage));
} else {
FILE_LOG(logINFOBLUE, ("Successfully read default pattern file\n"));
}
return initError;
}
int default_writePatternWord(char* line, uint32_t addr, uint64_t word) {
//validations
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
sprintf(initErrorMessage, "Cannot set pattern word from default "
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
MAX_PATTERN_LENGTH, line);
return FAIL;
}
writePatternWord(addr, word);
// cannot validate for moench, ctb ( same as executing pattern word)
return OK;
}
int default_writePatternIOControl(char* line, uint64_t arg) {
uint64_t retval = writePatternIOControl(arg);
if (retval != arg) {
sprintf(initErrorMessage, "Could not set patioctrl from default pattern "
"file. Set 0x%llx, read 0x%llx. Line:[%s]\n", arg, retval, line);
return FAIL;
}
return OK;
}
int default_writePatternClkControl(char* line, uint64_t arg) {
uint64_t retval = writePatternClkControl(arg);
if (retval != arg) {
sprintf(initErrorMessage, "Could not set patclkctrl from default pattern "
"file. Set 0x%llx, read 0x%llx. Line:[%s]\n", arg, retval, line);
return FAIL;
}
return OK;
}
int default_setPatternLoopLimits(char* line, uint32_t startAddr, uint32_t stopAddr) {
//validations
if (startAddr < 0 || startAddr >= MAX_PATTERN_LENGTH ||
stopAddr < 0 || stopAddr >= MAX_PATTERN_LENGTH) {
sprintf(initErrorMessage, "Cannot set patlimits from default "
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
MAX_PATTERN_LENGTH, line);
return FAIL;
}
int numLoops = -1;
int r_startAddr = startAddr, r_stopAddr = stopAddr;
setPatternLoop(-1, &r_startAddr, &r_stopAddr, &numLoops);
// validate
if (r_startAddr != startAddr || r_stopAddr != stopAddr) {
sprintf(initErrorMessage, "Could not set patlimits from default pattern "
"file. Read start addr:0x%x, stop addr: 0x%x. Line:[%s]\n",
r_startAddr, r_stopAddr, line);
return FAIL;
}
return OK;
}
int default_setPatternLoopAddresses(char* line, int level, uint32_t startAddr, uint32_t stopAddr) {
//validations
if (level < 0 || level > 2) {
sprintf(initErrorMessage, "Cannot set patloop from default "
"pattern file. Level must be between 0 and 2. Line:[%s]\n",
line);
return FAIL;
}
if (startAddr < 0 || startAddr >= MAX_PATTERN_LENGTH ||
stopAddr < 0 || stopAddr >= MAX_PATTERN_LENGTH) {
sprintf(initErrorMessage, "Cannot set patloop (level: %d) from default "
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
level, MAX_PATTERN_LENGTH, line);
return FAIL;
}
int numLoops = -1;
int r_startAddr = startAddr, r_stopAddr = stopAddr;
setPatternLoop(level, &r_startAddr, &r_stopAddr, &numLoops);
// validate
if (r_startAddr != startAddr || r_stopAddr != stopAddr) {
sprintf(initErrorMessage, "Could not set patloop (level: %d) from default "
"pattern file. Read start addr:0x%x, stop addr: 0x%x. Line:[%s]\n",
level, r_startAddr, r_stopAddr, line);
return FAIL;
}
return OK;
}
int default_setPatternLoopCycles(char* line, int level, int numLoops) {
//validations
if (level < 0 || level > 2) {
sprintf(initErrorMessage, "Cannot set patnloop from default "
"pattern file. Level must be between 0 and 2. Line:[%s]\n",
line);
return FAIL;
}
if (numLoops < 0) {
sprintf(initErrorMessage, "Cannot set patnloop from default "
"pattern file. Iterations must be between > 0. Line:[%s]\n",
line);
return FAIL;
}
int startAddr = -1;
int stopAddr = -1;
int r_numLoops = numLoops;
setPatternLoop(level, &startAddr, &stopAddr, &r_numLoops);
// validate
if (r_numLoops != numLoops) {
sprintf(initErrorMessage, "Could not set patnloop (level: %d) from default "
"pattern file. Read %d loops. Line:[%s]\n",
level, r_numLoops, line);
return FAIL;
}
return OK;
}
int default_setPatternWaitAddresses(char* line, int level, uint32_t addr) {
//validations
if (level < 0 || level > 2) {
sprintf(initErrorMessage, "Cannot set patwait address from default "
"pattern file. Level must be between 0 and 2. Line:[%s]\n",
line);
return FAIL;
}
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
sprintf(initErrorMessage, "Cannot set patwait address (level: %d) from default "
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
level, MAX_PATTERN_LENGTH, line);
return FAIL;
}
int retval = setPatternWaitAddress(level, addr);
// validate
if (retval != addr) {
sprintf(initErrorMessage, "Could not set patwait address (level: %d) from default "
"pattern file. Read addr: 0x%x. Line:[%s]\n",
level, retval, line);
return FAIL;
}
return OK;
}
int default_setPatternWaitTime(char* line, int level, uint64_t waittime) {
//validations
if (level < 0 || level > 2) {
sprintf(initErrorMessage, "Cannot set patwaittime from default "
"pattern file. Level must be between 0 and 2. Line:[%s]\n",
line);
return FAIL;
}
uint64_t retval = setPatternWaitTime(level, waittime);
// validate
if (retval != waittime) {
sprintf(initErrorMessage, "Could not set patwaittime (level: %d) from default "
"pattern file. Read %lld wait time. Line:[%s]\n",
level, retval, line);
return FAIL;
}
return OK;
}

View File

@ -2,13 +2,6 @@
#include "slsDetectorFunctionList.h"
#include "communication_funcs.h"
#include "clogger.h"
#ifndef VIRTUAL
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
#include "programFpgaNios.h"
#elif defined(CHIPTESTBOARDD) || defined(JUNGFRAUD) || defined(MOENCHD)
#include "programFpgaBlackfin.h"
#endif
#endif
#include <string.h>
#include <arpa/inet.h>
@ -928,10 +921,35 @@ int set_dac(int file_des) {
case V_LIMIT:
break;
#elif MOENCHD
case VBP_COLBUF:
serverDacIndex = MO_VBP_COLBUF;
break;
case VIPRE:
serverDacIndex = MO_VIPRE;
break;
case VIN_CM:
serverDacIndex = MO_VIN_CM;
break;
case VB_SDA:
serverDacIndex = MO_VB_SDA;
break;
case VCASC_SFP:
serverDacIndex = MO_VCASC_SFP;
break;
case VOUT_CM:
serverDacIndex = MO_VOUT_CM;
break;
case VIPRE_CDS:
serverDacIndex = MO_VIPRE_CDS;
break;
case IBIAS_SFP:
serverDacIndex = MO_IBIAS_SFP;
break;
case ADC_VPP:
case HIGH_VOLTAGE:
case V_LIMIT:
break;
#elif MYTHEN3D
case HIGH_VOLTAGE:
break;
@ -1056,17 +1074,13 @@ int set_dac(int file_des) {
serverDacIndex = J_VREF_COMP;
break;
#endif
default:
#ifdef CHIPTESTBOARDD
if (ind < NDAC_ONLY) {
serverDacIndex = ind;
break;
}
#elif MOENCHD
if (ind < NDAC) {
serverDacIndex = ind;
break;
}
#endif
modeNotImplemented("Dac Index", (int)ind);
break;
@ -1656,7 +1670,7 @@ int set_settings(int file_des) {
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
return printSocketReadError();
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
#if defined(CHIPTESTBOARDD) || defined(MYTHEN3D)
functionNotImplemented();
#else
FILE_LOG(logDEBUG1, ("Setting settings %d\n", isett));
@ -1684,6 +1698,15 @@ int set_settings(int file_des) {
case DYNAMICGAIN:
case FIXGAIN1:
case FIXGAIN2:
#elif MOENCHD
case G1_HIGHGAIN:
case G1_LOWGAIN:
case G2_HIGHCAP_HIGHGAIN:
case G2_HIGHCAP_LOWGAIN:
case G2_LOWCAP_HIGHGAIN:
case G2_LOWCAP_LOWGAIN:
case G4_HIGHGAIN:
case G4_LOWGAIN:
#endif
break;
default:
@ -1750,18 +1773,23 @@ int start_acquisition(int file_des) {
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
// only set
if (Server_VerifyLock() == OK) {
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
int mode = getReadoutMode();
int asamples = getNumAnalogSamples();
int dsamples = getNumDigitalSamples();
if ((mode == ANALOG_AND_DIGITAL || mode == ANALOG_ONLY) && (asamples <= 0)) {
#if defined(MOENCHD)
if (getNumAnalogSamples() <= 0) {
ret = FAIL;
sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", asamples);
sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", getNumAnalogSamples());
FILE_LOG(logERROR,(mess));
}
else if ((mode == ANALOG_AND_DIGITAL || mode == DIGITAL_ONLY) && (dsamples <= 0)) {
else
#endif
#if defined(CHIPTESTBOARDD)
if ((getReadoutMode() == ANALOG_AND_DIGITAL || mode == ANALOG_ONLY) && (getNumAnalogSamples() <= 0)) {
ret = FAIL;
sprintf(mess, "Could not start acquisition. Invalid number of digital samples: %d.\n", dsamples);
sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", getNumAnalogSamples());
FILE_LOG(logERROR,(mess));
}
else if ((getReadoutMode() == ANALOG_AND_DIGITAL || mode == DIGITAL_ONLY) && (getNumDigitalSamples() <= 0)) {
ret = FAIL;
sprintf(mess, "Could not start acquisition. Invalid number of digital samples: %d.\n", getNumDigitalSamples());
FILE_LOG(logERROR,(mess));
}
else
@ -1880,18 +1908,23 @@ int start_and_read_all(int file_des) {
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
// only set
if (Server_VerifyLock() == OK) {
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
int mode = getReadoutMode();
int asamples = getNumAnalogSamples();
int dsamples = getNumDigitalSamples();
if ((mode == ANALOG_AND_DIGITAL || mode == ANALOG_ONLY) && (asamples <= 0)) {
#if defined(MOENCHD)
if (getNumAnalogSamples() <= 0) {
ret = FAIL;
sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", asamples);
sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", getNumAnalogSamples());
FILE_LOG(logERROR,(mess));
}
else if ((mode == ANALOG_AND_DIGITAL || mode == DIGITAL_ONLY) && (dsamples <= 0)) {
else
#endif
#if defined(CHIPTESTBOARDD)
if ((getReadoutMode() == ANALOG_AND_DIGITAL || mode == ANALOG_ONLY) && (getNumAnalogSamples() <= 0)) {
ret = FAIL;
sprintf(mess, "Could not start acquisition. Invalid number of digital samples: %d.\n", dsamples);
sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", getNumAnalogSamples());
FILE_LOG(logERROR,(mess));
}
else if ((getReadoutMode() == ANALOG_AND_DIGITAL || mode == DIGITAL_ONLY) && (getNumDigitalSamples() <= 0)) {
ret = FAIL;
sprintf(mess, "Could not start acquisition. Invalid number of digital samples: %d.\n", getNumDigitalSamples());
FILE_LOG(logERROR,(mess));
}
else
@ -2102,14 +2135,23 @@ int set_num_analog_samples(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
ret = setNumAnalogSamples(arg);
if (ret == FAIL) {
sprintf(mess, "Could not set number of analog samples to %d. Could not allocate RAM\n", arg);
FILE_LOG(logERROR,(mess));
} else {
int retval = getNumAnalogSamples();
FILE_LOG(logDEBUG1, ("retval num analog samples %d\n", retval));
validate(arg, retval, "set number of analog samples", DEC);
#ifdef MOENCHD
if (arg % NSAMPLES_PER_ROW != 0) {
ret = FAIL;
sprintf(mess, "Could not set number of analog samples to %d. Must be divisible by %d\n", arg, NSAMPLES_PER_ROW);
FILE_LOG(logERROR,(mess));
}
#endif
if (ret == OK) {
ret = setNumAnalogSamples(arg);
if (ret == FAIL) {
sprintf(mess, "Could not set number of analog samples to %d. Could not allocate RAM\n", arg);
FILE_LOG(logERROR,(mess));
} else {
int retval = getNumAnalogSamples();
FILE_LOG(logDEBUG1, ("retval num analog samples %d\n", retval));
validate(arg, retval, "set number of analog samples", DEC);
}
}
}
#endif
@ -2121,7 +2163,7 @@ int get_num_digital_samples(int file_des) {
memset(mess, 0, sizeof(mess));
int retval = -1;
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
#if !defined(CHIPTESTBOARDD)
functionNotImplemented();
#else
// get only
@ -2140,7 +2182,7 @@ int set_num_digital_samples(int file_des) {
return printSocketReadError();
FILE_LOG(logDEBUG1, ("Setting number of digital samples %d\n", arg));
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
#if !defined(CHIPTESTBOARDD)
functionNotImplemented();
#else
// only set
@ -2785,7 +2827,7 @@ int send_update(int file_des) {
if (n < 0) return printSocketReadError();
// settings
#if defined(EIGERD) || defined(JUNGFRAUD) || defined(GOTTHARDD)
#if defined(EIGERD) || defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(GOTTHARD2D)|| defined(MOENCHD)
i32 = (int)getSettings();
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
@ -2856,10 +2898,16 @@ int send_update(int file_des) {
#endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
// analog samples
i32 = getNumAnalogSamples();
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// 1g adcmask
i32 = getADCEnableMask();
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// 10g adc mask
i32 = getADCEnableMask_10G();
n = sendData(file_des,&i32,sizeof(i32),INT32);
@ -4237,7 +4285,7 @@ int led(int file_des) {
return printSocketReadError();
FILE_LOG(logDEBUG1, ("Setting led enable to %d\n", arg));
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
#if (!defined(CHIPTESTBOARDD))
functionNotImplemented();
#else
// set & get
@ -4262,7 +4310,7 @@ int digital_io_delay(int file_des) {
return printSocketReadError();
FILE_LOG(logDEBUG1, ("Digital IO Delay, pinMask: 0x%llx, delay:%d ps\n", args[0], (int)args[1]));
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
#if (!defined(CHIPTESTBOARDD))
functionNotImplemented();
#else
// only set
@ -6169,9 +6217,11 @@ int set_pipeline(int file_des) {
case ADC_CLOCK:
c = ADC_CLK;
break;
#ifdef CHIPTESTBOARDD
case DBIT_CLOCK:
c = DBIT_CLK;
break;
#endif
default:
modeNotImplemented("clock index (pipeline set)", ind);
break;

View File

@ -101,6 +101,8 @@ class Detector {
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
* [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN,
* G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
*/
void setSettings(defs::detectorSettings value, Positions pos = {});
@ -155,32 +157,32 @@ class Detector {
void setPeriod(ns t, Positions pos = {});
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] */
Result<ns> getDelayAfterTrigger(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] */
void setDelayAfterTrigger(ns value, Positions pos = {});
/** [Gotthard][Jungfrau][CTB][Mythen3]
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Mythen3]
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Mythen3]
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
Result<ns> getPeriodLeft(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Mythen3]
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const;
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
/**
* [Gotthard][Jungfrau][CTB] Options: AUTO_TIMING, TRIGGER_EXPOSURE
* [Gotthard][Jungfrau][CTB][Moench] Options: AUTO_TIMING, TRIGGER_EXPOSURE
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
*/
void setTimingMode(defs::timingMode value, Positions pos = {});
@ -192,19 +194,19 @@ class Detector {
* Options: FULL_SPEED, HALF_SPEED, QUARTER_SPEED */
void setSpeed(defs::speedLevel value, Positions pos = {});
/** [Gotthard][Jungfrau][CTB] */
/** [Gotthard][Jungfrau][CTB][Moench] */
Result<int> getADCPhase(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB] */
/** [Gotthard][Jungfrau][CTB][Moench] */
void setADCPhase(int value, Positions pos = {});
/** [Jungfrau][CTB] */
/** [Jungfrau][CTB][Moench] */
Result<int> getMaxADCPhaseShift(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB] */
/** [Gotthard][Jungfrau][CTB][Moench] */
Result<int> getADCPhaseInDegrees(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB] */
/** [Gotthard][Jungfrau][CTB][Moench] */
void setADCPhaseInDegrees(int value, Positions pos = {});
/** [Mythen3][Gotthard2] Hz */
@ -244,7 +246,7 @@ class Detector {
/**
* [Gotthard] Options: 0, 90, 110, 120, 150, 180, 200
* [Jungfrau], CTB Options: 0, 60 - 200
* [Jungfrau][CTB][Moench] Options: 0, 60 - 200
* [Eiger][Mythen3][Gotthard2] Options: 0 - 200
*/
void setHighVoltage(int value, Positions pos = {});
@ -415,10 +417,10 @@ class Detector {
Result<std::string> printRxConfiguration(Positions pos = {}) const;
/** [Eiger][CTB] */
/** [Eiger][CTB][Moench] */
Result<bool> getTenGiga(Positions pos = {}) const;
/** [Eiger][CTB] */
/** [Eiger][CTB][Moench] */
void setTenGiga(bool value, Positions pos = {});
/** [Eiger, Jungfrau] */
@ -954,18 +956,67 @@ class Detector {
/** [Mythen3] countermask bit set for each counter enabled */
void setCounterMask(uint32_t countermask, Positions pos = {});
/**************************************************
* *
* CTB / Moench Specific *
* *
* ************************************************/
/** [CTB][Moench] */
Result<int> getNumberOfAnalogSamples(Positions pos = {}) const;
/** [CTB][Moench] */
void setNumberOfAnalogSamples(int value, Positions pos = {});
/** [CTB][Moench] */
Result<int> getADCClock(Positions pos = {}) const;
/** [CTB][Moench] */
void setADCClock(int value_in_MHz, Positions pos = {});
/** [CTB][Moench] */
Result<int> getRUNClock(Positions pos = {}) const;
/** [CTB][Moench] */
void setRUNClock(int value_in_MHz, Positions pos = {});
/** [CTB][Moench] */
Result<int> getSYNCClock(Positions pos = {}) const;
/** [CTB][Moench] */
Result<int> getADCPipeline(Positions pos = {}) const;
/** [CTB][Moench] */
void setADCPipeline(int value, Positions pos = {});
/** [CTB][Moench] */
Result<int> getVoltage(defs::dacIndex index, Positions pos = {}) const;
/**
* [CTB][Moench] mV
* [Ctb] Options: V_LIMIT, V_POWER_A, V_POWER_B, V_POWER_C,
* V_POWER_D, V_POWER_IO, V_POWER_CHIP
* [Moench] Options: V_LIMIT
*/
void setVoltage(defs::dacIndex index, int value, Positions pos = {});
/** [CTB][Moench] */
Result<uint32_t> getADCEnableMask(Positions pos = {}) const;
/** [CTB][Moench] */
void setADCEnableMask(uint32_t mask, Positions pos = {});
/** [CTB][Moench] */
Result<uint32_t> getTenGigaADCEnableMask(Positions pos = {}) const;
/** [CTB][Moench] */
void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {});
/**************************************************
* *
* CTB Specific *
* *
* ************************************************/
/** [CTB] */
Result<int> getNumberOfAnalogSamples(Positions pos = {}) const;
/** [CTB] */
void setNumberOfAnalogSamples(int value, Positions pos = {});
/** [CTB] */
Result<int> getNumberOfDigitalSamples(Positions pos = {}) const;
@ -978,6 +1029,12 @@ class Detector {
/** [CTB] Options: ANALOG_ONLY = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL */
void setReadoutMode(defs::readoutMode value, Positions pos = {});
/** [CTB] */
Result<int> getDBITClock(Positions pos = {}) const;
/** [CTB] */
void setDBITClock(int value_in_MHz, Positions pos = {});
/** [CTB] */
Result<int> getDBITPhase(Positions pos = {}) const;
@ -993,49 +1050,12 @@ class Detector {
/** [CTB] */
void setDBITPhaseInDegrees(int value, Positions pos = {});
/** [CTB] */
Result<int> getADCClock(Positions pos = {}) const;
/** [CTB] */
void setADCClock(int value_in_MHz, Positions pos = {});
/** [CTB] */
Result<int> getDBITClock(Positions pos = {}) const;
/** [CTB] */
void setDBITClock(int value_in_MHz, Positions pos = {});
/** [CTB] */
Result<int> getRUNClock(Positions pos = {}) const;
/** [CTB] */
void setRUNClock(int value_in_MHz, Positions pos = {});
/** [CTB] */
Result<int> getSYNCClock(Positions pos = {}) const;
/** [CTB] */
Result<int> getADCPipeline(Positions pos = {}) const;
/** [CTB] */
void setADCPipeline(int value, Positions pos = {});
/** [CTB] */
Result<int> getDBITPipeline(Positions pos = {}) const;
/** [CTB] */
void setDBITPipeline(int value, Positions pos = {});
/** [CTB] */
Result<int> getVoltage(defs::dacIndex index, Positions pos = {}) const;
/**
* [CTB] mV
* Options: V_LIMIT, V_POWER_A, V_POWER_B, V_POWER_C,
* V_POWER_D, V_POWER_IO, V_POWER_CHIP
*/
void setVoltage(defs::dacIndex index, int value, Positions pos = {});
/**
* [CTB] mV
* Options: V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO */
@ -1051,24 +1071,6 @@ class Detector {
/** [CTB] Options: SLOW_ADC0 - SLOW_ADC7 in uV */
Result<int> getSlowADC(defs::dacIndex index, Positions pos = {}) const;
/** [CTB]*/
Result<uint32_t> getADCEnableMask(Positions pos = {}) const;
/** [CTB]*/
void setADCEnableMask(uint32_t mask, Positions pos = {});
/** [CTB]*/
Result<uint32_t> getTenGigaADCEnableMask(Positions pos = {}) const;
/** [CTB]*/
void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {});
/** [CTB] */
Result<uint32_t> getADCInvert(Positions pos = {}) const;
/** [CTB]*/
void setADCInvert(uint32_t value, Positions pos = {});
/** [CTB] */
Result<int> getExternalSamplingSource(Positions pos = {}) const;
@ -1113,72 +1115,71 @@ class Detector {
* *
* ************************************************/
/** [CTB] */
/** [CTB][Moench][Mythen3] */
void setPattern(const std::string &fname, Positions pos = {});
/** [CTB] */
/** [CTB][Moench][Mythen3] */
void savePattern(const std::string &fname);
/** [CTB] */
/** [CTB][Moench][Mythen3] */
Result<uint64_t> getPatternIOControl(Positions pos = {}) const;
/** [CTB] */
/** [CTB][Moench][Mythen3] */
void setPatternIOControl(uint64_t word, Positions pos = {});
/** [CTB] */
/** [CTB][Moench][Mythen3] */
Result<uint64_t> getPatternClockControl(Positions pos = {}) const;
/** [CTB] */
/** [CTB][Moench][Mythen3] */
void setPatternClockControl(uint64_t word, Positions pos = {});
/** [CTB] same as executing
* [Mythen3] */
/** [CTB][Moench][Mythen3] same as executing for ctb and moench */
Result<uint64_t> getPatternWord(int addr, Positions pos = {});
/** [CTB] Caution: If word is -1 reads the addr (same as
* executing the pattern)
* [Mythen3] */
* [Mythen3][Moench] */
void setPatternWord(int addr, uint64_t word, Positions pos = {});
/**[CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
/**[CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
* @returns array of start address and stop address
*/
Result<std::array<int, 2>> getPatternLoopAddresses(int level,
Positions pos = {}) const;
/** [CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels */
/** [CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels */
void setPatternLoopAddresses(int level, int start, int stop, Positions pos = {});
/**[CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
/**[CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
* @returns number of loops
*/
Result<int> getPatternLoopCycles(int level, Positions pos = {}) const;
/** [CTB][Mythen3] n: 0-2, level: -1 (complete pattern) and 0-2 levels */
/** [CTB][Moench][Mythen3] n: 0-2, level: -1 (complete pattern) and 0-2 levels */
void setPatternLoopCycles(int level, int n, Positions pos = {});
/* [CTB][Mythen3] */
/* [CTB][Moench][Mythen3] */
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
/** [CTB][Mythen3] Options: level 0-2 */
/** [CTB][Moench][Mythen3] Options: level 0-2 */
void setPatternWaitAddr(int level, int addr, Positions pos = {});
/** [CTB][Mythen3] */
/** [CTB][Moench][Mythen3] */
Result<uint64_t> getPatternWaitTime(int level, Positions pos = {}) const;
/** [CTB][Mythen3] Options: level 0-2 */
/** [CTB][Moench][Mythen3] Options: level 0-2 */
void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
/** [CTB][Mythen3] */
/** [CTB][Moench][Mythen3] */
Result<uint64_t> getPatternMask(Positions pos = {});
/** [CTB][Mythen3] Sets the mask applied to every pattern to the selected bit mask */
/** [CTB][Moench][Mythen3] Sets the mask applied to every pattern to the selected bit mask */
void setPatternMask(uint64_t mask, Positions pos = {});
/** [CTB][Mythen3] */
/** [CTB][Moench][Mythen3] */
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
/** [CTB][Mythen3] Sets the bitmask that the mask will be applied to for every
/** [CTB][Moench][Mythen3] Sets the bitmask that the mask will be applied to for every
* pattern
*/
void setPatternBitMask(uint64_t mask, Positions pos = {});
@ -1238,26 +1239,26 @@ class Detector {
* *
* ************************************************/
/** [Jungfrau][CTB] fname is a pof file
/** [Jungfrau][CTB][Moench] fname is a pof file
* [Mythen3][Gotthard2] fname is an rbf file
*/
void programFPGA(const std::string &fname, Positions pos = {});
/** [Jungfrau][CTB] */
/** [Jungfrau][CTB][Moench] */
void resetFPGA(Positions pos = {});
/** [Jungfrau][Gotthard][CTB]
/** [Jungfrau][Gotthard][CTB][Moench]
* Copy detector server fname from tftp folder of hostname to detector
* Also changes respawn server, which is effective after a reboot.
*/
void copyDetectorServer(const std::string &fname,
const std::string &hostname, Positions pos = {});
/** [Jungfrau][Gotthard][CTB][Mythen3][Gotthard2] */
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2] */
void rebootController(Positions pos = {});
/**
* [Jungfrau][Gotthard][CTB]
* [Jungfrau][Gotthard][CTB][Moench]
* Updates the firmware, detector server and then reboots detector
* controller blackfin.
* @param sname name of detector server binary found on tftp folder of host
@ -1278,13 +1279,13 @@ class Detector {
void clearBit(uint32_t addr, int bitnr, Positions pos = {});
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] */
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] */
void executeFirmwareTest(Positions pos = {});
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] */
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] */
void executeBusTest(Positions pos = {});
/** [Gotthard][Jungfrau][CTB] not possible to read back*/
/** [Gotthard][Jungfrau][CTB][Moench] not possible to read back*/
void writeAdcRegister(uint32_t addr, uint32_t value, Positions pos = {});
bool getInitialChecks() const;
@ -1293,6 +1294,12 @@ class Detector {
* default enabled */
void setInitialChecks(const bool value);
/** [CTB][Moench][Jungfrau] */
Result<uint32_t> getADCInvert(Positions pos = {}) const;
/** [CTB][Moench][Jungfrau] */
void setADCInvert(uint32_t value, Positions pos = {});
/**************************************************
* *
* Insignificant *
@ -1321,15 +1328,15 @@ class Detector {
/** Execute a command on the detector server console */
void executeCommand(const std::string &value, Positions pos = {});
/** [Jungfrau][Mythen3][CTB]
/** [Jungfrau][Mythen3][CTB][Moench]
* [Gotthard2] only in continuous mode */
Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const;
/** [Jungfrau][Mythen3][CTB] Get time from detector start
/** [Jungfrau][Mythen3][CTB][Moench] Get time from detector start
* [Gotthard2] only in continuous mode */
Result<ns> getActualTime(Positions pos = {}) const;
/** [Jungfrau][Mythen3][CTB] Get timestamp at a frame start
/** [Jungfrau][Mythen3][CTB][Moench] Get timestamp at a frame start
* [Gotthard2] only in continuous mode */
Result<ns> getMeasurementTime(Positions pos = {}) const;

View File

@ -395,10 +395,10 @@ std::string CmdProxy::Adcphase(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[n_value] [(optional)deg]\n\t[Jungfrau][Ctb][Gotthard] Phase "
os << "[n_value] [(optional)deg]\n\t[Jungfrau][Ctb][Moench][Moench][Gotthard] Phase "
"shift of ADC clock. \n\t[Jungfrau] Absolute phase shift. If deg "
"used, then shift in degrees. Changing Speed also resets "
"adcphase to recommended defaults.\n\t[Ctb] Absolute phase "
"adcphase to recommended defaults.\n\t[Ctb][Moench] Absolute phase "
"shift. If deg used, then shift in degrees. Changing adcclk also "
"resets adcphase and sets it to previous values.\n\t[Gotthard] "
"Relative phase shift"
@ -588,8 +588,10 @@ std::string CmdProxy::Dac(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[dac index] [dac or mv value] [(optional unit) mv] "
"\n\t[Ctb][Jungfrau] Dac."
"\n\t[Ctb] Dac."
<< '\n';
} else if (det->getDetectorType().squash(defs::GENERIC) != defs::CHIPTESTBOARD) {
throw sls::RuntimeError("Dac command can only be used for chip test board. Use daclist to get list of dac commands for current detector.");
} else if (action == defs::GET_ACTION) {
bool mv = false;
if (args.size() == 2) {
@ -707,6 +709,11 @@ std::vector<std::string> CmdProxy::DacCommands() {
"vth1", "vicin", "vcas", "vpreamp", "vpl", "vipre",
"viinsh", "vph", "vtrim", "vdcsh"};
break;
case defs::MOENCH:
return std::vector<std::string>{"vbp_colbuf", "vipre", "vin_cm",
"vb_sda", "vcasc_sfp", "vout_cm",
"vipre_cds", "ibias_sfp"};
break;
case defs::CHIPTESTBOARD:
return std::vector<std::string>{
"dac 0", "dac 1", "dac 2", "dac 3", "dac 4", "dac 5",
@ -1316,26 +1323,29 @@ std::string CmdProxy::Counters(int action) {
return os.str();
}
/* CTB Specific */
/* CTB / Moench Specific */
std::string CmdProxy::Samples(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[n_samples]\n\t[CTB] Number of samples (both analog and "
"digitial) expected."
"digitial) expected.\n\t[Moench] Number of samples (analog only)"
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto a = det->getNumberOfAnalogSamples({det_id});
auto d = det->getNumberOfDigitalSamples({det_id});
int as = a.squash(-1);
int ds = d.squash(-1);
if (as == -1 || ds == -1 || as != ds) { // check if a == d?
throw sls::RuntimeError(
// get also digital samples for ctb and compare with analog
if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) {
auto d = det->getNumberOfDigitalSamples({det_id});
int as = a.squash(-1);
int ds = d.squash(-1);
if (as == -1 || ds == -1 || as != ds) { // check if a == d?
throw sls::RuntimeError(
"Different samples. Use asamples or dsamples.");
}
}
os << OutString(a) << '\n';
} else if (action == defs::PUT_ACTION) {
@ -1343,7 +1353,10 @@ std::string CmdProxy::Samples(int action) {
WrongNumberOfParameters(1);
}
det->setNumberOfAnalogSamples(std::stoi(args[0]), {det_id});
det->setNumberOfDigitalSamples(std::stoi(args[0]), {det_id});
// set also digital samples for ctb
if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) {
det->setNumberOfDigitalSamples(std::stoi(args[0]), {det_id});
}
os << args.front() << '\n';
} else {
throw sls::RuntimeError("Unknown action");
@ -1351,6 +1364,8 @@ std::string CmdProxy::Samples(int action) {
return os.str();
}
/* CTB Specific */
std::string CmdProxy::Dbitphase(int action) {
std::ostringstream os;
os << cmd << ' ';
@ -1499,7 +1514,7 @@ std::string CmdProxy::Pattern(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[fname]\n\t[Mythen3][Ctb] Loads binary pattern file with only pattern "
os << "[fname]\n\t[Mythen3][Moench][Ctb][Moench] Loads binary pattern file with only pattern "
"words"
<< '\n';
} else if (action == defs::GET_ACTION) {
@ -1520,7 +1535,7 @@ std::string CmdProxy::PatternWord(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[step or address] [64 bit mask]\n\t[Ctb][Mythen3] 64 bit pattern at "
os << "[step or address] [64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit pattern at "
"address of pattern memory."
<< '\n';
} else if (action == defs::GET_ACTION) {
@ -1546,17 +1561,17 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "patlimits") {
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of complete "
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of complete "
"pattern."
<< '\n';
} else if (cmd == "patloop0") {
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of loop 0."
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of loop 0."
<< '\n';
} else if (cmd == "patloop1") {
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of loop 1."
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of loop 1."
<< '\n';
} else if (cmd == "patloop2") {
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of loop 2."
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of loop 2."
<< '\n';
} else {
throw sls::RuntimeError(
@ -1601,11 +1616,11 @@ std::string CmdProxy::PatternLoopCycles(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "patnloop0") {
os << "[n_cycles] \n\t[Ctb][Mythen3] Number of cycles of loop 0." << '\n';
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of loop 0." << '\n';
} else if (cmd == "patnloop1") {
os << "[n_cycles] \n\t[Ctb][Mythen3] Number of cycles of loop 1." << '\n';
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of loop 1." << '\n';
} else if (cmd == "patnloop2") {
os << "[n_cycles] \n\t[Ctb][Mythen3] Number of cycles of loop 2." << '\n';
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of loop 2." << '\n';
} else {
throw sls::RuntimeError(
"Unknown command, use list to list all commands");
@ -1646,11 +1661,11 @@ std::string CmdProxy::PatternWaitAddress(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "patwait0") {
os << "[addr] \n\t[Ctb][Mythen3] Wait 0 address." << '\n';
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 0 address." << '\n';
} else if (cmd == "patwait1") {
os << "[addr] \n\t[Ctb][Mythen3] Wait 1 address." << '\n';
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 1 address." << '\n';
} else if (cmd == "patwait2") {
os << "[addr] \n\t[Ctb][Mythen3] Wait 2 address." << '\n';
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 2 address." << '\n';
} else {
throw sls::RuntimeError(
"Unknown command, use list to list all commands");
@ -1691,11 +1706,11 @@ std::string CmdProxy::PatternWaitTime(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "patwaittime0") {
os << "[n_clk] \n\t[Ctb][Mythen3] Wait 0 time in clock cycles." << '\n';
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 0 time in clock cycles." << '\n';
} else if (cmd == "patwaittime1") {
os << "[n_clk] \n\t[Ctb][Mythen3] Wait 1 time in clock cycles." << '\n';
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 1 time in clock cycles." << '\n';
} else if (cmd == "patwaittime2") {
os << "[n_clk] \n\t[Ctb][Mythen3] Wait 2 time in clock cycles." << '\n';
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 2 time in clock cycles." << '\n';
} else {
throw sls::RuntimeError(
"Unknown command, use list to list all commands");
@ -1811,7 +1826,7 @@ std::string CmdProxy::ProgramFpga(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[fname.pof | fname.rbf]\n\t[Jungfrau][Ctb] Programs FPGA from pof file."
os << "[fname.pof | fname.rbf]\n\t[Jungfrau][Ctb][Moench] Programs FPGA from pof file."
<< "\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file."
<< '\n';
} else if (action == defs::GET_ACTION) {
@ -1832,7 +1847,7 @@ std::string CmdProxy::CopyDetectorServer(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[server_name] [pc_host_name]\n\t[Jungfrau][Ctb] Copies detector "
os << "[server_name] [pc_host_name]\n\t[Jungfrau][Ctb][Moench] Copies detector "
"server via tftp from pc and changes respawn server name in "
"/etc/inittab of detector."
<< '\n';
@ -1854,7 +1869,7 @@ std::string CmdProxy::UpdateFirmwareAndDetectorServer(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[server_name] [pc_host_name] [fname.pof]\n\t[Jungfrau][Ctb] "
os << "[server_name] [pc_host_name] [fname.pof]\n\t[Jungfrau][Ctb][Moench] "
"Updates detector server via tftp from pc, updates firmware to "
"pof file and then reboots controller (blackfin)."
<< '\n';
@ -1904,7 +1919,7 @@ std::string CmdProxy::AdcRegister(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[address] [value]\n\t[Jungfrau][Ctb][Gotthard] Writes to an adc "
os << "[address] [value]\n\t[Jungfrau][Ctb][Moench][Gotthard] Writes to an adc "
"register in hex."
<< '\n';
} else if (action == defs::GET_ACTION) {

View File

@ -666,6 +666,12 @@ class CmdProxy {
{"vb_pixbuf", &CmdProxy::vb_pixbuf},
{"vin_com", &CmdProxy::vin_com},
{"vdd_prot", &CmdProxy::vdd_prot},
{"vbp_colbuf", &CmdProxy::vbp_colbuf},
{"vb_sda", &CmdProxy::vb_sda},
{"vcasc_sfp", &CmdProxy::vcasc_sfp},
{"vipre_cds", &CmdProxy::vipre_cds},
{"ibias_sfp", &CmdProxy::ibias_sfp},
{"dac", &CmdProxy::Dac},
{"daclist", &CmdProxy::DacList},
@ -796,20 +802,24 @@ class CmdProxy {
/* Mythen3 Specific */
{"counters", &CmdProxy::Counters},
/* CTB Specific */
/* CTB/ Moench Specific */
{"samples", &CmdProxy::Samples},
{"asamples", &CmdProxy::asamples},
{"dsamples", &CmdProxy::dsamples},
{"romode", &CmdProxy::romode},
{"dbitphase", &CmdProxy::Dbitphase},
{"maxdbitphaseshift", &CmdProxy::maxdbitphaseshift},
{"adcclk", &CmdProxy::adcclk},
{"dbitclk", &CmdProxy::dbitclk},
{"runclk", &CmdProxy::runclk},
{"syncclk", &CmdProxy::syncclk},
{"adcpipeline", &CmdProxy::adcpipeline},
{"dbitpipeline", &CmdProxy::dbitpipeline},
{"v_limit", &CmdProxy::v_limit},
{"adcenable", &CmdProxy::adcenable},
{"adcenable10g", &CmdProxy::adcenable10g},
/* CTB Specific */
{"dsamples", &CmdProxy::dsamples},
{"romode", &CmdProxy::romode},
{"dbitclk", &CmdProxy::dbitclk},
{"dbitphase", &CmdProxy::Dbitphase},
{"maxdbitphaseshift", &CmdProxy::maxdbitphaseshift},
{"dbitpipeline", &CmdProxy::dbitpipeline},
{"v_a", &CmdProxy::v_a},
{"v_b", &CmdProxy::v_b},
{"v_c", &CmdProxy::v_c},
@ -827,9 +837,6 @@ class CmdProxy {
{"im_d", &CmdProxy::im_d},
{"im_io", &CmdProxy::im_io},
{"adc", &CmdProxy::SlowAdc},
{"adcenable", &CmdProxy::adcenable},
{"adcenable10g", &CmdProxy::adcenable10g},
{"adcinvert", &CmdProxy::adcinvert},
{"extsampling", &CmdProxy::extsampling},
{"extsamplingsrc", &CmdProxy::extsamplingsrc},
{"rx_dbitlist", &CmdProxy::ReceiverDbitList},
@ -881,6 +888,7 @@ class CmdProxy {
{"firmwaretest", &CmdProxy::firmwaretest},
{"bustest", &CmdProxy::bustest},
{"initialchecks", &CmdProxy::InitialChecks},
{"adcinvert", &CmdProxy::adcinvert},
/* Insignificant */
{"port", &CmdProxy::port},
@ -955,8 +963,9 @@ class CmdProxy {
std::string BurstMode(int action);
/* Mythen3 Specific */
std::string Counters(int action);
/* CTB Specific */
/* CTB/ Moench Specific */
std::string Samples(int action);
/* CTB Specific */
std::string Dbitphase(int action);
std::string SlowAdc(int action);
std::string ReceiverDbitList(int action);
@ -1004,10 +1013,14 @@ class CmdProxy {
"\n\tSerial number or MAC of detector (hex).");
INTEGER_COMMAND(settings, getSettings, setSettings, sls::StringTo<slsDetectorDefs::detectorSettings>,
"[standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, verylowgain]"
"\n\t[Jungfrau] - Detector Settings [dynamicgain | dynamichg0 | fixgain1 | fixgain2 | forceswitchg1 | forceswitchg2]"
"\n\t[Gotthard] - Detector Settings [dynamicgain | highgain | lowgain | mediumgain | veryhighgain]"
"\n\t[Gotthard2] - Detector Settings [dynamicgain | fixgain1 | fixgain2]"
"[standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, "
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, verylowgain, g1_hg, g1_lg, g2_hc_hg, g2_hc_lg, "
"g2_lc_hg, g2_lc_lg, g4_hg, g4_lg]"
"\n\t Detector Settings"
"\n\t[Jungfrau] - [dynamicgain | dynamichg0 | fixgain1 | fixgain2 | forceswitchg1 | forceswitchg2]"
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | mediumgain | veryhighgain]"
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
"\n\t[Moench] - [g1_hg | g1_lg | g2_hc_hg | g2_hc_lg | g2_lc_hg | g2_lc_lg | g4_hg | g4_lg]"
"\n\t[Eiger] Use threshold or thresholdnotb.");
/* acquisition parameters */
@ -1034,38 +1047,38 @@ class CmdProxy {
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Delay after trigger");
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb][Moench] Delay after trigger");
TIME_COMMAND(burstperiod, getBurstPeriod, setBurstPeriod,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst period. Only in burst mode and auto timing mode.");
GET_COMMAND(framesl, getNumberOfFramesLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Number of frames left in acquisition."
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Number of frames left in acquisition."
"\n\t[Gotthard2] only in continuous mode.");
GET_COMMAND(triggersl, getNumberOfTriggersLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Number of triggers left in acquisition."
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Number of triggers left in acquisition."
"\n\t[Gotthard2] only in continuous mode.");
TIME_GET_COMMAND(delayl, getDelayAfterTriggerLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] DelayLeft Delay Left in Acquisition."
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] DelayLeft Delay Left in Acquisition."
"\n\t[Gotthard2] only in continuous mode.");
TIME_GET_COMMAND(periodl, getPeriodLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Period left for current frame."
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Period left for current frame."
"\n\t[Gotthard2] only in continuous mode.");
INTEGER_COMMAND(timing, getTimingMode, setTimingMode, sls::StringTo<slsDetectorDefs::timingMode>,
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] [auto|trigger]\n\t[Eiger] [auto|trigger|gating|burst_trigger]");
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb][Moench] [auto|trigger]\n\t[Eiger] [auto|trigger|gating|burst_trigger]");
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
"\n\t[Jungfrau][CTB] Absolute maximum Phase shift of ADC clock.");
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of ADC clock.");
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, std::stoi,
"[n_value]\n\tHigh voltage to the sensor in Voltage."
"\n\t[Gotthard] [0|90|110|120|150|180|200]"
"\n\t[Eiger][Mythen3][Gotthard2] 0-200"
"\n\t[Jungfrau][Ctb] [0|60-200]");
"\n\t[Jungfrau][Ctb][Moench] [0|60-200]");
INTEGER_COMMAND(powerchip, getPowerChip, setPowerChip, std::stoi,
"[0, 1]\n\t[Jungfrau][Mythen3][Gotthard2] Power the chip. Default 0."
@ -1169,13 +1182,13 @@ class CmdProxy {
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for ?? "); //TODO
DAC_COMMAND(vout_cm, getDAC, setDAC, defs::VOUT_CM,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for ?? "); //TODO
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for ?? \n\t[Moench] Dac for 5"); //TODO
DAC_COMMAND(vcasc_out, getDAC, setDAC, defs::VCASC_OUT,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for ?? "); //TODO
DAC_COMMAND(vin_cm, getDAC, setDAC, defs::VIN_CM,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for ?? "); //TODO
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for ?? \n\t[Moench] Dac for 2"); //TODO
DAC_COMMAND(vref_comp, getDAC, setDAC, defs::VREF_COMP,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard][Jungfrau] Dac for ?? "); //TODO
@ -1193,7 +1206,7 @@ class CmdProxy {
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] voltage to define feedback resistance of the second shaper.");
DAC_COMMAND(vipre, getDAC, setDAC, defs::VIPRE,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for the preamplifier's input transistor current.");
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for the preamplifier's input transistor current.\n\t[Moench] Dac for 1");
DAC_COMMAND(viinsh, getDAC, setDAC, defs::VIINSH,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for the bias current for the shaper.");
@ -1274,7 +1287,7 @@ class CmdProxy {
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for common mode voltage of ADC DAC bank 2.");
DAC_COMMAND(adcvpp, getDAC, setDAC, defs::ADC_VPP,
"[dac or mv value][(optional unit) mv] \n\t[Ctb] Vpp of ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V.");
"[dac or mv value][(optional unit) mv] \n\t[Ctb][Moench] Vpp of ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V.");
DAC_COMMAND(vb_ds, getDAC, setDAC, defs::VB_DS,
"[dac or mv value][(optional unit) mv] \n\t[Jungfrau] Dac for ??"); //TODO
@ -1291,6 +1304,21 @@ class CmdProxy {
DAC_COMMAND(vdd_prot, getDAC, setDAC, defs::VDD_PROT,
"[dac or mv value][(optional unit) mv] \n\t[Jungfrau] Dac for ??"); //TODO
DAC_COMMAND(vbp_colbuf, getDAC, setDAC, defs::VBP_COLBUF,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 0");
DAC_COMMAND(vb_sda, getDAC, setDAC, defs::VB_SDA,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 3");
DAC_COMMAND(vcasc_sfp, getDAC, setDAC, defs::VCASC_SFP,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 4");
DAC_COMMAND(vipre_cds, getDAC, setDAC, defs::VIPRE_CDS,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 6");
DAC_COMMAND(ibias_sfp, getDAC, setDAC, defs::IBIAS_SFP,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 7");
/* on chip dacs */
INTEGER_USER_IND_COMMAND(vchip_comp_fe, getOnChipDAC, setOnChipDAC, stoiHex, defs::VB_COMP_FE,
@ -1391,7 +1419,7 @@ class CmdProxy {
"\n\tPrints the receiver configuration.");
INTEGER_COMMAND(tengiga, getTenGiga, setTenGiga, std::stoi,
"[0, 1]\n\t[Eiger][Ctb] 10GbE Enable.");
"[0, 1]\n\t[Eiger][Ctb][Moench] 10GbE Enable.");
INTEGER_COMMAND(flowcontrol10g, getTenGigaFlowControl, setTenGigaFlowControl, std::stoi,
"[0, 1]\n\t[Eiger][Jungfrau] 10GbE Flow Control.");
@ -1574,10 +1602,34 @@ class CmdProxy {
/* Mythen3 Specific */
/* CTB Specific */
/* CTB/ Moench Specific */
INTEGER_COMMAND(asamples, getNumberOfAnalogSamples, setNumberOfAnalogSamples, std::stoi,
"[0, 1]\n\t[CTB] Number of analog samples expected.");
"[0, 1]\n\t[CTB][Moench] Number of analog samples expected.");
INTEGER_COMMAND(adcclk, getADCClock, setADCClock, std::stoi,
"[n_clk in MHz]\n\t[Ctb][Moench] ADC clock frequency in MHz.");
INTEGER_COMMAND(runclk, getRUNClock, setRUNClock, std::stoi,
"[n_clk in MHz]\n\t[Ctb][Moench] Run clock in MHz.");
GET_COMMAND(syncclk, getSYNCClock,
"[n_clk in MHz]\n\t[Ctb][Moench] Sync clock in MHz.");
INTEGER_COMMAND(adcpipeline, getADCPipeline, setADCPipeline, std::stoi,
"[n_value]\n\t[Ctb][Moench] Pipeline for ADC clock.");
INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, std::stoi, defs::V_LIMIT,
"[n_value]\n\t[Ctb][Moench] Soft limit for power supplies(ctb only) and DACS in mV.");
INTEGER_COMMAND_HEX(adcenable, getADCEnableMask, setADCEnableMask, stoiHex,
"[bitmask]\n\t[Ctb][Moench] ADC Enable Mask for 1Gb Mode for each 32 ADC channel.");
INTEGER_COMMAND_HEX(adcenable10g, getTenGigaADCEnableMask, setTenGigaADCEnableMask, stoiHex,
"[bitmask]\n\t[Ctb][Moench] ADC Enable Mask for 10Gb mode for each 32 ADC channel. However, if any of consecutive 4 bits are enabled, the complete 4 bits are enabled.");
/* CTB Specific */
INTEGER_COMMAND(dsamples, getNumberOfDigitalSamples, setNumberOfDigitalSamples, std::stoi,
"[0, 1]\n\t[CTB] Number of digital samples expected.");
@ -1585,30 +1637,15 @@ class CmdProxy {
INTEGER_COMMAND(romode, getReadoutMode, setReadoutMode, sls::StringTo<slsDetectorDefs::readoutMode>,
"[analog|digital|analog_digital]\n\t[CTB] Readout mode. Default is analog.");
GET_COMMAND(maxdbitphaseshift, getMaxDBITPhaseShift,
"\n\t[CTB] Absolute maximum Phase shift of of the clock to latch digital bits.");
INTEGER_COMMAND(adcclk, getADCClock, setADCClock, std::stoi,
"[n_clk in MHz]\n\t[Ctb] ADC clock frequency in MHz.");
INTEGER_COMMAND(dbitclk, getDBITClock, setDBITClock, std::stoi,
"[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.");
INTEGER_COMMAND(runclk, getRUNClock, setRUNClock, std::stoi,
"[n_clk in MHz]\n\t[Ctb] Run clock in MHz.");
GET_COMMAND(syncclk, getSYNCClock,
"[n_clk in MHz]\n\t[Ctb] Synch clock in MHz.");
INTEGER_COMMAND(adcpipeline, getADCPipeline, setADCPipeline, std::stoi,
"[n_value]\n\t[Ctb] Pipeline for ADC clock.");
GET_COMMAND(maxdbitphaseshift, getMaxDBITPhaseShift,
"\n\t[CTB] Absolute maximum Phase shift of of the clock to latch digital bits.");
INTEGER_COMMAND(dbitpipeline, getDBITPipeline, setDBITPipeline, std::stoi,
"[n_value]\n\t[Ctb] Pipeline of the clock for latching digital bits.");
INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, std::stoi, defs::V_LIMIT,
"[n_value]\n\t[Ctb] Soft limit for power supplies and DACS in mV.");
INTEGER_IND_COMMAND(v_a, getVoltage, setVoltage, std::stoi, defs::V_POWER_A,
"[n_value]\n\t[Ctb] Voltage supply a in mV.");
@ -1655,16 +1692,7 @@ class CmdProxy {
"\n\t[Ctb] Measured current of power supply d in mA.");
GET_IND_COMMAND(im_io, getMeasuredCurrent, defs::I_POWER_IO, "",
"\n\t[Ctb] Measured current of power supply io in mA.");
INTEGER_COMMAND_HEX(adcenable, getADCEnableMask, setADCEnableMask, stoiHex,
"[bitmask]\n\t[Ctb] ADC Enable Mask for 1Gb Mode for each 32 ADC channel.");
INTEGER_COMMAND_HEX(adcenable10g, getTenGigaADCEnableMask, setTenGigaADCEnableMask, stoiHex,
"[bitmask]\n\t[Ctb] ADC Enable Mask for 10Gb mode for each 32 ADC channel. However, if any of consecutive 4 bits are enabled, the complete 4 bits are enabled.");
INTEGER_COMMAND_HEX(adcinvert, getADCInvert, setADCInvert, stoiHex,
"[bitmask]\n\t[Ctb][Jungfrau] ADC Inversion Mask.\n\t[Jungfrau] Inversions on top of the default mask.");
"\n\t[Ctb] Measured current of power supply io in mA.");
INTEGER_COMMAND(extsampling, getExternalSampling, setExternalSampling, std::stoi,
"[0, 1]\n\t[Ctb] Enable for external sampling signal to extsamplingsrc signal for digital data. For advanced users only.");
@ -1682,19 +1710,19 @@ class CmdProxy {
/* Pattern */
EXECUTE_SET_COMMAND_NOID_1ARG(savepattern, savePattern,
"[fname]\n\t[Ctb] Saves pattern to file (ascii). Also executes pattern.");
"[fname]\n\t[Ctb][Moench][Mythen3] Saves pattern to file (ascii). Also executes pattern.");
INTEGER_COMMAND_HEX(patioctrl, getPatternIOControl, setPatternIOControl, stoulHex,
"[64 bit mask]\n\t[Ctb] 64 bit mask defining input (0) and output (1) signals.");
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit mask defining input (0) and output (1) signals.");
INTEGER_COMMAND_HEX(patclkctrl, getPatternClockControl, setPatternClockControl, stoulHex,
"[64 bit mask]\n\t[Ctb] 64 bit mask defining output clock enable.");
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit mask defining output clock enable.");
INTEGER_COMMAND_HEX(patmask, getPatternMask, setPatternMask, stoulHex,
"[64 bit mask]\n\t[Ctb][Mythen3] 64 bit mask applied to every pattern. Only these bits for each pattern will be masked against.");
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit mask applied to every pattern. Only these bits for each pattern will be masked against.");
INTEGER_COMMAND_HEX(patsetbit, getPatternBitMask, setPatternBitMask, stoulHex,
"[64 bit mask]\n\t[Ctb][Mythen3] 64 bit values applied to the selected patmask for every pattern.");
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit values applied to the selected patmask for every pattern.");
/* Moench */
@ -1711,17 +1739,19 @@ class CmdProxy {
/* Advanced */
EXECUTE_SET_COMMAND(resetfpga, resetFPGA,
"\n\t[Jungfrau][Ctb] Reset FPGA.");
"\n\t[Jungfrau][Ctb][Moench] Reset FPGA.");
EXECUTE_SET_COMMAND(rebootcontroller, rebootController,
"\n\t[Jungfrau][Ctb][Gotthard][Mythen3][Gotthard2] Reboot controler (blackfin) of detector.");
"\n\t[Jungfrau][Ctb][Moench][Gotthard][Mythen3][Gotthard2] Reboot controler (blackfin) of detector.");
EXECUTE_SET_COMMAND(firmwaretest, executeFirmwareTest,
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Firmware test, ie. reads a read fixed pattern from a register.");
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb][Moench] Firmware test, ie. reads a read fixed pattern from a register.");
EXECUTE_SET_COMMAND(bustest, executeBusTest,
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Bus test, ie. keeps writing and reading back different values in R/W register.");
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb][Moench] Bus test, ie. keeps writing and reading back different values in R/W register.");
INTEGER_COMMAND_HEX(adcinvert, getADCInvert, setADCInvert, stoiHex,
"[bitmask]\n\t[Ctb][Moench][Jungfrau][Moench] ADC Inversion Mask.\n\t[Jungfrau][Moench] Inversions on top of the default mask.");
/* Insignificant */
@ -1738,7 +1768,7 @@ class CmdProxy {
"\n\tClient IP Address that last communicated with the detector.");
GET_COMMAND(nframes, getNumberOfFramesFromStart,
"\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Number of frames from start run control."
"\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB][Moench] Number of frames from start run control."
"\n\t[Gotthard2] only in continuous mode.");
TIME_GET_COMMAND(now, getActualTime,

View File

@ -1230,7 +1230,7 @@ void Detector::setCounterMask(uint32_t countermask, Positions pos) {
pimpl->Parallel(&slsDetector::setCounterMask, pos, countermask);
}
// CTB Specific
// CTB/ Moench Specific
Result<int> Detector::getNumberOfAnalogSamples(Positions pos) const {
return pimpl->Parallel(&slsDetector::getNumberOfAnalogSamples, pos);
@ -1240,46 +1240,6 @@ void Detector::setNumberOfAnalogSamples(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setNumberOfAnalogSamples, pos, value);
}
Result<int> Detector::getNumberOfDigitalSamples(Positions pos) const {
return pimpl->Parallel(&slsDetector::getNumberOfDigitalSamples, pos);
}
void Detector::setNumberOfDigitalSamples(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setNumberOfDigitalSamples, pos, value);
}
Result<defs::readoutMode> Detector::getReadoutMode(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReadoutMode, pos);
}
void Detector::setReadoutMode(defs::readoutMode value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadoutMode, pos, value);
}
Result<int> Detector::getDBITPhase(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
false);
}
void Detector::setDBITPhase(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
false);
}
Result<int> Detector::getMaxDBITPhaseShift(Positions pos) const {
return pimpl->Parallel(&slsDetector::getMaxClockPhaseShift, pos,
defs::DBIT_CLOCK);
}
Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
true);
}
void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
true);
}
Result<int> Detector::getADCClock(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockFrequency, pos,
@ -1291,16 +1251,6 @@ void Detector::setADCClock(int value_in_MHz, Positions pos) {
value_in_MHz);
}
Result<int> Detector::getDBITClock(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockFrequency, pos,
defs::DBIT_CLOCK);
}
void Detector::setDBITClock(int value_in_MHz, Positions pos) {
pimpl->Parallel(&slsDetector::setClockFrequency, pos, defs::DBIT_CLOCK,
value_in_MHz);
}
Result<int> Detector::getRUNClock(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockFrequency, pos,
defs::RUN_CLOCK);
@ -1328,10 +1278,6 @@ Result<int> Detector::getDBITPipeline(Positions pos) const {
return pimpl->Parallel(&slsDetector::getPipeline, pos, defs::DBIT_CLOCK);
}
void Detector::setDBITPipeline(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setPipeline, pos, defs::DBIT_CLOCK, value);
}
Result<int> Detector::getVoltage(defs::dacIndex index, Positions pos) const {
switch (index) {
case defs::V_LIMIT:
@ -1364,6 +1310,81 @@ void Detector::setVoltage(defs::dacIndex index, int value, Positions pos) {
pimpl->Parallel(&slsDetector::setDAC, pos, value, index, 1);
}
Result<uint32_t> Detector::getADCEnableMask(Positions pos) const {
return pimpl->Parallel(&slsDetector::getADCEnableMask, pos);
}
void Detector::setADCEnableMask(uint32_t mask, Positions pos) {
pimpl->Parallel(&slsDetector::setADCEnableMask, pos, mask);
}
Result<uint32_t> Detector::getTenGigaADCEnableMask(Positions pos) const {
return pimpl->Parallel(&slsDetector::getTenGigaADCEnableMask, pos);
}
void Detector::setTenGigaADCEnableMask(uint32_t mask, Positions pos) {
pimpl->Parallel(&slsDetector::setTenGigaADCEnableMask, pos, mask);
}
// CTB Specific
Result<int> Detector::getNumberOfDigitalSamples(Positions pos) const {
return pimpl->Parallel(&slsDetector::getNumberOfDigitalSamples, pos);
}
void Detector::setNumberOfDigitalSamples(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setNumberOfDigitalSamples, pos, value);
}
Result<defs::readoutMode> Detector::getReadoutMode(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReadoutMode, pos);
}
void Detector::setReadoutMode(defs::readoutMode value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadoutMode, pos, value);
}
Result<int> Detector::getDBITClock(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockFrequency, pos,
defs::DBIT_CLOCK);
}
void Detector::setDBITClock(int value_in_MHz, Positions pos) {
pimpl->Parallel(&slsDetector::setClockFrequency, pos, defs::DBIT_CLOCK,
value_in_MHz);
}
Result<int> Detector::getDBITPhase(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
false);
}
void Detector::setDBITPhase(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
false);
}
Result<int> Detector::getMaxDBITPhaseShift(Positions pos) const {
return pimpl->Parallel(&slsDetector::getMaxClockPhaseShift, pos,
defs::DBIT_CLOCK);
}
Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
true);
}
void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
true);
}
void Detector::setDBITPipeline(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setPipeline, pos, defs::DBIT_CLOCK, value);
}
Result<int> Detector::getMeasuredVoltage(defs::dacIndex index,
Positions pos) const {
switch (index) {
@ -1402,30 +1423,6 @@ Result<int> Detector::getSlowADC(defs::dacIndex index, Positions pos) const {
return pimpl->Parallel(&slsDetector::getADC, pos, index);
}
Result<uint32_t> Detector::getADCEnableMask(Positions pos) const {
return pimpl->Parallel(&slsDetector::getADCEnableMask, pos);
}
void Detector::setADCEnableMask(uint32_t mask, Positions pos) {
pimpl->Parallel(&slsDetector::setADCEnableMask, pos, mask);
}
Result<uint32_t> Detector::getTenGigaADCEnableMask(Positions pos) const {
return pimpl->Parallel(&slsDetector::getTenGigaADCEnableMask, pos);
}
void Detector::setTenGigaADCEnableMask(uint32_t mask, Positions pos) {
pimpl->Parallel(&slsDetector::setTenGigaADCEnableMask, pos, mask);
}
Result<uint32_t> Detector::getADCInvert(Positions pos) const {
return pimpl->Parallel(&slsDetector::getADCInvert, pos);
}
void Detector::setADCInvert(uint32_t value, Positions pos) {
pimpl->Parallel(&slsDetector::setADCInvert, pos, value);
}
Result<int> Detector::getExternalSamplingSource(Positions pos) const {
return pimpl->Parallel(&slsDetector::getExternalSamplingSource, pos);
}
@ -1747,6 +1744,14 @@ void Detector::setInitialChecks(const bool value) {
pimpl->setInitialChecks(value);
}
Result<uint32_t> Detector::getADCInvert(Positions pos) const {
return pimpl->Parallel(&slsDetector::getADCInvert, pos);
}
void Detector::setADCInvert(uint32_t value, Positions pos) {
pimpl->Parallel(&slsDetector::setADCInvert, pos, value);
}
// Insignificant
Result<int> Detector::getControlPort(Positions pos) const {

View File

@ -557,10 +557,6 @@ void DetectorImpl::readFrameFromReceiver() {
uint32_t yoffset = coordY * nPixelsY;
uint32_t singledetrowoffset = nPixelsX * bytesPerPixel;
uint32_t rowoffset = nX * singledetrowoffset;
if (multi_shm()->multiDetectorType == CHIPTESTBOARD) {
singledetrowoffset = size;
nPixelsY = 1; // TODO: nDetPixelsY is not updated.
}
FILE_LOG(logDEBUG1)
<< "Multi Image Info:"
@ -1070,6 +1066,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
switch (multi_shm()->multiDetectorType) {
case JUNGFRAU:
case CHIPTESTBOARD:
case MOENCH:
if (fname.find(".pof") == std::string::npos) {
throw RuntimeError("Programming file must be a pof file.");
}

View File

@ -336,6 +336,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->roMode = ANALOG_ONLY;
shm()->currentSettings = UNINITIALIZED;
shm()->currentThresholdEV = -1;
shm()->nASamples = 1;
shm()->nFrames = 1;
shm()->nTriggers = 1;
shm()->nBursts = 1;
@ -557,8 +558,8 @@ slsDetectorDefs::detectorType slsDetector::getDetectorType() const {
}
void slsDetector::updateNumberOfChannels() {
if (shm()->myDetectorType == CHIPTESTBOARD ||
shm()->myDetectorType == MOENCH) {
if (shm()->myDetectorType == CHIPTESTBOARD) {
int nachans = 0, ndchans = 0;
// analog channels (normal, analog/digital readout)
@ -577,15 +578,29 @@ void slsDetector::updateNumberOfChannels() {
}
// digital channels (ctb only, digital, analog/digital readout)
if (shm()->myDetectorType == CHIPTESTBOARD &&
(shm()->roMode == DIGITAL_ONLY ||
shm()->roMode == ANALOG_AND_DIGITAL)) {
if (shm()->roMode == DIGITAL_ONLY ||
shm()->roMode == ANALOG_AND_DIGITAL) {
ndchans = 64;
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans;
}
shm()->nChan.x = nachans + ndchans;
FILE_LOG(logDEBUG1) << "# Total #Channels:" << shm()->nChan.x;
}
else if (shm()->myDetectorType == MOENCH) {
uint32_t mask = shm()->tenGigaEnable ? shm()->adcEnableMaskTenGiga : shm()->adcEnableMaskOneGiga;
// count number of channels in x, each adc has 25 channels each
int nchanTop = __builtin_popcount(mask & 0xF0F0F0F0) * 25;
int nchanBot = __builtin_popcount(mask & 0x0F0F0F0F) * 25;
shm()->nChan.x = nchanTop > 0 ? nchanTop : nchanBot;
// if both top and bottom adcs enabled, rows = 2
int nrows = 1;
if (nchanTop > 0 && nchanBot > 0) {
nrows = 2;
}
shm()->nChan.y = shm()->nASamples / 25 * nrows;
}
}
slsDetectorDefs::xy slsDetector::getNumberOfChannels() const {
@ -743,8 +758,9 @@ void slsDetector::updateCachedDetectorVariables() {
shm()->dynamicRange = i32;
// settings
if (shm()->myDetectorType == EIGER ||
shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == GOTTHARD) {
if (shm()->myDetectorType == EIGER || shm()->myDetectorType == JUNGFRAU ||
shm()->myDetectorType == GOTTHARD || shm()->myDetectorType == GOTTHARD2 ||
shm()->myDetectorType == MOENCH) {
n += client.Receive(&i32, sizeof(i32));
shm()->currentSettings = static_cast<detectorSettings>(i32);
}
@ -807,11 +823,18 @@ void slsDetector::updateCachedDetectorVariables() {
shm()->tenGigaEnable = static_cast<bool>(i32);
}
// analog samples and adc enable masks
if (shm()->myDetectorType == CHIPTESTBOARD ||
shm()->myDetectorType == MOENCH) {
// 1gb adcmask
// analog samples
uint32_t u32 = 0;
n += client.Receive(&u32, sizeof(u32));
shm()->nASamples = u32;
// 1gb adcmask
u32 = 0;
n += client.Receive(&u32, sizeof(u32));
shm()->adcEnableMaskOneGiga = u32;
// 10gb adcmask
@ -1321,6 +1344,7 @@ int slsDetector::getNumberOfAnalogSamples() {
void slsDetector::setNumberOfAnalogSamples(int value) {
FILE_LOG(logDEBUG1) << "Setting number of analog samples to " << value;
sendToDetector(F_SET_NUM_ANALOG_SAMPLES, value, nullptr);
shm()->nASamples = value;
// update #nchan, as it depends on #samples, adcmask
updateNumberOfChannels();
if (shm()->useReceiverFlag) {
@ -1836,7 +1860,6 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
case MOENCH:
setNumberOfAnalogSamples(getNumberOfAnalogSamples());
setNumberOfDigitalSamples(getNumberOfDigitalSamples());
enableTenGigabitEthernet(static_cast<int>(shm()->tenGigaEnable));
setADCEnableMask(shm()->adcEnableMaskOneGiga);
setTenGigaADCEnableMask(shm()->adcEnableMaskTenGiga);
@ -2974,6 +2997,7 @@ void slsDetector::programFPGA(std::vector<char> buffer) {
switch (shm()->myDetectorType) {
case JUNGFRAU:
case CHIPTESTBOARD:
case MOENCH:
programFPGAviaBlackfin(buffer);
break;
case MYTHEN3:

View File

@ -13,7 +13,7 @@
class ServerInterface;
#define SLS_SHMAPIVERSION 0x190726
#define SLS_SHMVERSION 0x200225
#define SLS_SHMVERSION 0x200302
/**
* @short structure allocated in shared memory to store detector settings for
@ -80,6 +80,9 @@ struct sharedSlsDetector {
/** detector threshold (eV) */
int currentThresholdEV;
/** number of analog samples */
int nASamples;
/** number of frames */
int64_t nFrames;
@ -295,7 +298,7 @@ class slsDetector : public virtual slsDetectorDefs {
/**
* Update total number of channels (chiptestboard or moench)
* depending on the number of samples, adenablemask, readout flags(ctb)
* depending on the number of samples, adcenablemask, readout flags(ctb)
*/
void updateNumberOfChannels();
@ -404,6 +407,8 @@ class slsDetector : public virtual slsDetectorDefs {
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
* [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN,
* G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
* [Eiger] Only stores them locally in shm Options: STANDARD, HIGHGAIN, LOWGAIN, VERYHIGHGAIN, VERYLOWGAIN
*/
detectorSettings setSettings(detectorSettings isettings);
@ -554,10 +559,10 @@ class slsDetector : public virtual slsDetectorDefs {
/** [Jungfrau] Advanced */
void setNumberOfAdditionalStorageCells(int value);
/** [CTB] */
/** [CTB][Moench] */
int getNumberOfAnalogSamples();
/** [CTB] */
/** [CTB][Moench] */
void setNumberOfAnalogSamples(int value);
/** [CTB] */
@ -574,10 +579,10 @@ class slsDetector : public virtual slsDetectorDefs {
void setPeriod(int64_t value);
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] */
int64_t getDelayAfterTrigger();
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] */
void setDelayAfterTrigger(int64_t value);
/** [Gotthard2] only in burst mode and in auto timing mode */
@ -605,22 +610,22 @@ class slsDetector : public virtual slsDetectorDefs {
* Options: (0-1638375 ns (resolution of 25ns) */
void setStorageCellDelay(int64_t value);
/** [Gotthard][Jungfrau][CTB][Mythen3]
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
int64_t getNumberOfFramesLeft() const;
/** [Gotthard][Jungfrau][CTB][Mythen3]
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
int64_t getNumberOfTriggersLeft() const;
/** [Gotthard][Jungfrau][CTB]
/** [Gotthard][Jungfrau][CTB][Moench]
* [Gotthard2] only in continuous mode */
int64_t getDelayAfterTriggerLeft() const;
/** [Gotthard] */
int64_t getExptimeLeft() const;
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] */
int64_t getPeriodLeft() const;
/** [Eiger] minimum two frames */
@ -629,15 +634,15 @@ class slsDetector : public virtual slsDetectorDefs {
/** [Eiger] */
int64_t getMeasuredSubFramePeriod() const;
/** [Jungfrau][CTB][Mythen3]
/** [Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
int64_t getNumberOfFramesFromStart() const;
/** [Jungfrau][CTB][Mythen3] Get time from detector start
/** [Jungfrau][CTB][Moench][Mythen3] Get time from detector start
* [Gotthard2] only in continuous mode */
int64_t getActualTime() const;
/** [Jungfrau][CTB][Mythen3] Get timestamp at a frame start
/** [Jungfrau][CTB][Moench][Mythen3] Get timestamp at a frame start
* [Gotthard2] only in continuous mode */
int64_t getMeasurementTime() const;
@ -727,13 +732,13 @@ class slsDetector : public virtual slsDetectorDefs {
bool getStoreInRamMode();
/**
* Set readout mode (Only for CTB and Moench)
* [Ctb]
* @param mode readout mode Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL
*/
void setReadoutMode(const readoutMode mode);
/**
* Get readout mode(Only for CTB and Moench)
* [Ctb]
* @returns readout mode
*/
readoutMode getReadoutMode();
@ -1117,10 +1122,10 @@ class slsDetector : public virtual slsDetectorDefs {
*/
int64_t getReceiverRealUDPSocketBufferSize() const;
/** [Gotthard][Jungfrau][CTB] */
/** [Gotthard][Jungfrau][CTB][Moench] */
void executeFirmwareTest();
/** [Gotthard][Jungfrau][CTB] */
/** [Gotthard][Jungfrau][CTB][Moench] */
void executeBusTest();
/** [Gotthard] */
@ -1222,14 +1227,14 @@ class slsDetector : public virtual slsDetectorDefs {
uint32_t getTenGigaADCEnableMask();
/**
* Set ADC invert register (CTB, Moench)
* Set ADC invert register (CTB, Moench, Jungfrau)
* @param value ADC invert value
* @param detPos -1 for all detectors in list or specific detector position
*/
void setADCInvert(uint32_t value);
/**
* Get ADC invert register (CTB, Moench)
* Get ADC invert register (CTB, Moench, Jungfrau)
* @param detPos -1 for all detectors in list or specific detector position
* @returns ADC invert value
*/

View File

@ -9,6 +9,7 @@ target_sources(tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-gotthard2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-gotthard.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-chiptestboard.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-moench.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-global.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-Result.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdParser.cpp

View File

@ -0,0 +1,103 @@
#include "CmdProxy.h"
#include "Detector.h"
#include "catch.hpp"
#include "sls_detector_defs.h"
#include <sstream>
#include "Result.h"
#include "ToString.h"
#include "test-CmdProxy-global.h"
#include "tests/globals.h"
#include "versionAPI.h"
using sls::CmdProxy;
using sls::Detector;
using test::GET;
using test::PUT;
TEST_CASE("Setting and reading back MOENCH dacs", "[.cmd][.dacs]") {
// vbp_colbuf, vipre, vin_cm", vb_sda, vcasc_sfp, vout_cm, vipre_cds, ibias_sfp
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
SECTION("vbp_colbuf") { test_dac(defs::VBP_COLBUF, "vbp_colbuf", 1300); }
SECTION("vipre") { test_dac(defs::VIPRE, "vipre", 1000); }
SECTION("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1400); }
SECTION("vb_sda") { test_dac(defs::VB_SDA, "vb_sda", 680); }
SECTION("vcasc_sfp") { test_dac(defs::VCASC_SFP, "vcasc_sfp", 1428); }
SECTION("vout_cm") { test_dac(defs::VOUT_CM, "vout_cm", 1200); }
SECTION("vipre_cds") { test_dac(defs::VIPRE_CDS, "vipre_cds", 800); }
SECTION("ibias_sfp") { test_dac(defs::IBIAS_SFP, "ibias_sfp", 900); }
// eiger
REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vsvp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vsvn", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vtr", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vrf", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vrs", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vtgstv", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcmp_ll", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcmp_lr", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcal", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcmp_rl", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcmp_rr", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("rxb_rb", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("rxb_lb", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcn", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vis", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("iodelay", {}, -1, GET));
// jungfrau
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_prech", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_ds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
// gotthard
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
//REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
//REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
// mythen3
REQUIRE_THROWS(proxy.Call("vpreamp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vshaper", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vshaperneg", {}, -1, GET));
//REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("viinsh", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vth2", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vth3", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vpl", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vph", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcassh", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcas", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vicin", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vipre_out", {}, -1, GET));
// gotthard2
REQUIRE_THROWS(proxy.Call("vref_h_adc", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_l_adc", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
}
}

View File

@ -529,7 +529,7 @@ int ClientInterface::set_num_analog_samples(Interface &socket) {
int ClientInterface::set_num_digital_samples(Interface &socket) {
auto value = socket.Receive<int>();
FILE_LOG(logDEBUG1) << "Setting num digital samples to " << value;
if (myDetectorType != CHIPTESTBOARD && myDetectorType != MOENCH) {
if (myDetectorType != CHIPTESTBOARD) {
functionNotImplemented();
}
try {

View File

@ -447,6 +447,7 @@ void DataProcessor::PadMissingPackets(char* buf) {
memset(buf + fifohsize + (pnum * dsize), 0xFF, dsize+2);
break;
case CHIPTESTBOARD:
case MOENCH:
if (pnum == (pperFrame-1))
memset(buf + fifohsize + (pnum * dsize), 0xFF, corrected_dsize);
else

View File

@ -629,13 +629,6 @@ private:
/** Number of bytes per analog channel */
const int NUM_BYTES_PER_ANALOG_CHANNEL = 2;
struct ctb_10g_packet_header {
unsigned char emptyHeader[6];
unsigned char reserved[4];
uint32_t packetFrameNumber;
uint64_t bunchid;
} __attribute__((packed));
public:
@ -660,7 +653,7 @@ public:
};
/**
* Set databytes (ctb, moench)
* Set databytes
* @param a adc enable mask
* @param as analog number of samples
* @param ds digital number of samples
@ -700,50 +693,21 @@ public:
nPixelsX = nachans + ndchans;
nPixelsY = 1;
// 10G
if (t) {
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
dataSize = 8144;
packetSize = headerSizeinPacket + dataSize;
imageSize = adatabytes + ddatabytes;
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
standardheader = true;
/*
headerSizeinPacket = 22;
dataSize = 8192;
packetSize = headerSizeinPacket + dataSize;
imageSize = adatabytes + ddatabytes;
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
standardheader = false;
*/
}
// 1g udp (via fifo readout)
else {
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
dataSize = UDP_PACKET_DATA_BYTES;
packetSize = headerSizeinPacket + dataSize;
imageSize = adatabytes + ddatabytes;
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
standardheader = true;
}
return adatabytes;
}
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param oddStartingPacket odd starting packet (gotthard)
* @param frameNumber frame number
* @param packetNumber packet number
*/
void GetHeaderInfo(int index, char* packetData, bool oddStartingPacket,
uint64_t& frameNumber, uint32_t& packetNumber) const
{
auto header = reinterpret_cast<ctb_10g_packet_header*>(packetData);
frameNumber = (header->packetFrameNumber >> frameIndexOffset) & frameIndexMask;
packetNumber = header->packetFrameNumber & packetIndexMask;
packetSize = headerSizeinPacket + dataSize;
imageSize = adatabytes + ddatabytes;
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
return adatabytes;
}
};
@ -769,14 +733,14 @@ public:
imageSize = nPixelsX * nPixelsY * 2;
packetsPerFrame = ceil((double)imageSize / (double)UDP_PACKET_DATA_BYTES);
frameIndexMask = 0xFFFFFF;
maxFramesPerFile = CTB_MAX_FRAMES_PER_FILE;
maxFramesPerFile = MOENCH_MAX_FRAMES_PER_FILE;
fifoBufferHeaderSize = FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
defaultFifoDepth = 2500;
standardheader = true;
};
/**
* Set databytes (ctb, moench)
* Set databytes
* @param a adc enable mask
* @param as analog number of samples
* @param ds digital number of samples
@ -785,41 +749,37 @@ public:
* @returns analog data bytes
*/
int setImageSize(uint32_t a, uint32_t as, uint32_t ds, bool t, slsDetectorDefs::readoutMode) {
int nachans = 0;
int adatabytes = 0;
// count number of channels in x, each adc has 25 channels each
int nchanTop = __builtin_popcount(a & 0xF0F0F0F0) * 25;
int nchanBot = __builtin_popcount(a & 0x0F0F0F0F) * 25;
nPixelsX = nchanTop > 0 ? nchanTop : nchanBot;
// if both top and bottom adcs enabled, rows = 2
int nrows = 1;
if (nchanTop > 0 && nchanBot > 0) {
nrows = 2;
}
nPixelsY = as / 25 * nrows;
FILE_LOG(logINFO) << "Number of Pixels: [" << nPixelsX << ", " << nPixelsY << "]";
// analog channels (normal, analog/digital readout)
if (a == BIT32_MASK) {
nachans = 32;
} else {
for (int ich = 0; ich < 32; ++ich) {
if (a & (1 << ich))
++nachans;
}
}
adatabytes = nachans * NUM_BYTES_PER_ANALOG_CHANNEL * as;
FILE_LOG(logDEBUG1) << "Total Number of Channels:" << nachans
<< " Databytes: " << adatabytes;
nPixelsX = nachans;
nPixelsY = 1;
// 10G
if (t) {
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
dataSize = UDP_PACKET_DATA_BYTES;
packetSize = headerSizeinPacket + dataSize;
imageSize = adatabytes;
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
dataSize = 8144;
}
// 1g udp (via fifo readout)
else {
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
dataSize = UDP_PACKET_DATA_BYTES;
packetSize = headerSizeinPacket + dataSize;
imageSize = adatabytes;
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
dataSize = UDP_PACKET_DATA_BYTES;
}
return adatabytes;
imageSize = nPixelsX * nPixelsY * NUM_BYTES_PER_ANALOG_CHANNEL;
packetSize = headerSizeinPacket + dataSize;
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
FILE_LOG(logDEBUG) << "Databytes: " << imageSize;
return imageSize;
}
};

View File

@ -91,6 +91,22 @@ inline std::string ToString(const defs::detectorSettings s) {
return std::string("forceswitchg2");
case defs::VERYLOWGAIN:
return std::string("verylowgain");
case defs::G1_HIGHGAIN:
return std::string("g1_hg");
case defs::G1_LOWGAIN:
return std::string("g1_lg");
case defs::G2_HIGHCAP_HIGHGAIN:
return std::string("g2_hc_hg");
case defs::G2_HIGHCAP_LOWGAIN:
return std::string("g2_hc_lg");
case defs::G2_LOWCAP_HIGHGAIN:
return std::string("g2_lc_hg");
case defs::G2_LOWCAP_LOWGAIN:
return std::string("g2_lc_lg");
case defs::G4_HIGHGAIN:
return std::string("g4_hg");
case defs::G4_LOWGAIN:
return std::string("g4_lg");
case defs::UNDEFINED:
return std::string("undefined");
case defs::UNINITIALIZED:
@ -459,6 +475,22 @@ inline defs::detectorSettings StringTo(const std::string& s) {
return defs::FORCESWITCHG2;
if (s == "verylowgain")
return defs::VERYLOWGAIN;
if (s == "g1_hg")
return defs::G1_HIGHGAIN;
if (s == "g1_lg")
return defs::G1_LOWGAIN;
if (s == "g2_hc_hg")
return defs::G2_HIGHCAP_HIGHGAIN;
if (s == "g2_hc_lg")
return defs::G2_HIGHCAP_LOWGAIN;
if (s == "g2_lc_hg")
return defs::G2_LOWCAP_HIGHGAIN;
if (s == "g2_lc_lg")
return defs::G2_LOWCAP_LOWGAIN;
if (s == "g4_hg")
return defs::G4_HIGHGAIN;
if (s == "g4_lg")
return defs::G4_LOWGAIN;
throw sls::RuntimeError("Unknown setting " + s);
}

View File

@ -332,6 +332,11 @@ class slsDetectorDefs {
VB_PIXBUF,
VIN_COM,
VDD_PROT,
VBP_COLBUF,
VB_SDA,
VCASC_SFP,
VIPRE_CDS,
IBIAS_SFP,
V_POWER_A = 100,
V_POWER_B = 101,
V_POWER_C = 102,
@ -359,20 +364,28 @@ class slsDetectorDefs {
detector settings indexes
*/
enum detectorSettings {
GET_SETTINGS = -1, /**< return current detector settings */
STANDARD, /**< standard settings */
FAST, /**< fast settings */
HIGHGAIN, /**< highgain settings */
DYNAMICGAIN, /**< dynamic gain settings */
LOWGAIN, /**< low gain settings */
MEDIUMGAIN, /**< medium gain settings */
VERYHIGHGAIN, /**< very high gain settings */
DYNAMICHG0, /**< dynamic high gain 0 */
FIXGAIN1, /**< fix gain 1 */
FIXGAIN2, /**< fix gain 2 */
FORCESWITCHG1, /**< force switch gain 1 */
FORCESWITCHG2, /**< force switch gain 2 */
VERYLOWGAIN, /**< very low gain settings */
GET_SETTINGS = -1,
STANDARD,
FAST,
HIGHGAIN,
DYNAMICGAIN,
LOWGAIN,
MEDIUMGAIN,
VERYHIGHGAIN,
DYNAMICHG0,
FIXGAIN1,
FIXGAIN2,
FORCESWITCHG1,
FORCESWITCHG2,
VERYLOWGAIN,
G1_HIGHGAIN,
G1_LOWGAIN,
G2_HIGHCAP_HIGHGAIN,
G2_HIGHCAP_LOWGAIN,
G2_LOWCAP_HIGHGAIN,
G2_LOWCAP_LOWGAIN,
G4_HIGHGAIN,
G4_LOWGAIN,
UNDEFINED = 200, /**< undefined or custom settings */
UNINITIALIZED /**< uninitialiazed (status at startup) */
};

View File

@ -1,6 +1,5 @@
/** API versions */
#define GITBRANCH "developer"
#define APIMOENCH 0x200131
#define APIMYTHEN3 0x200226
#define APIJUNGFRAU 0x200226
#define APIEIGER 0x200226
@ -9,4 +8,5 @@
#define APIRECEIVER 0x200227
#define APIGUI 0x200227
#define APICTB 0x200227
#define APIMOENCH 0x200303
#define APIGOTTHARD2 0x200304