diff --git a/slsDetectorGui/include/qDacWidget.h b/slsDetectorGui/include/qDacWidget.h index 55a6df219..d96aa8c21 100644 --- a/slsDetectorGui/include/qDacWidget.h +++ b/slsDetectorGui/include/qDacWidget.h @@ -16,6 +16,7 @@ class qDacWidget : public QWidget, private Ui::WidgetDacObject { slsDetectorDefs::dacIndex i); ~qDacWidget(); void SetDetectorIndex(int id); + void Refresh(); private slots: void SetDac(); @@ -25,7 +26,6 @@ class qDacWidget : public QWidget, private Ui::WidgetDacObject { void Initialization(); void GetDac(); void GetAdc(); - void Refresh(); Detector *det; bool isDac{true}; diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h index c672bc69f..978385d83 100644 --- a/slsDetectorGui/include/qTabDeveloper.h +++ b/slsDetectorGui/include/qTabDeveloper.h @@ -20,16 +20,27 @@ class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject { public slots: void Refresh(); + private slots: + void setDetectorIndex(); + private: void SetupWidgetWindow(); void Initialization(); void PopulateDetectors(); - slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType, - int index); Detector *det; std::vector dacWidgets; std::vector adcWidgets; + + const std::vector eiger_adcs = { + slsDetectorDefs::TEMPERATURE_FPGA, + slsDetectorDefs::TEMPERATURE_FPGAEXT, + slsDetectorDefs::TEMPERATURE_10GE, + slsDetectorDefs::TEMPERATURE_DCDC, + slsDetectorDefs::TEMPERATURE_SODL, + slsDetectorDefs::TEMPERATURE_SODR, + slsDetectorDefs::TEMPERATURE_FPGA2, + slsDetectorDefs::TEMPERATURE_FPGA3}; }; } // namespace sls diff --git a/slsDetectorGui/src/qDacWidget.cpp b/slsDetectorGui/src/qDacWidget.cpp index df3591bdb..cd2489707 100644 --- a/slsDetectorGui/src/qDacWidget.cpp +++ b/slsDetectorGui/src/qDacWidget.cpp @@ -34,10 +34,7 @@ void qDacWidget::Initialization() { } } -void qDacWidget::SetDetectorIndex(int id) { - detectorIndex = id; - Refresh(); -} +void qDacWidget::SetDetectorIndex(int id) { detectorIndex = id; } void qDacWidget::GetDac() { LOG(logDEBUG) << "Getting Dac " << index; diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index f2fde92a9..7acfb5585 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -16,180 +16,52 @@ qTabDeveloper::qTabDeveloper(QWidget *parent, Detector *detector) qTabDeveloper::~qTabDeveloper() {} void qTabDeveloper::SetupWidgetWindow() { - int tempid = 0; - try { + // dacs + auto daclist = det->getDacList(); + for (auto it : daclist) { + dacWidgets.push_back( + new qDacWidget(this, det, true, sls::ToString(it), it)); + } + + // adcs slsDetectorDefs::detectorType detType = det->getDetectorType().squash(); + slsDetectorDefs::dacIndex ind = slsDetectorDefs::DAC_0; switch (detType) { case slsDetectorDefs::EIGER: - dacWidgets.push_back(new qDacWidget( - this, det, true, "vsvp: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vsvn ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vrpreamp: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vrshaper: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vtrim: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vtgstv: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vcal: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vcp ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vcn: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vishaper: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "rxb_lb: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "rxb_rb: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vcmp_ll: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vcmp_lr: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vcmp_rl: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vcmp_rr: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "vthreshold: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature FPGA Ext: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature 10GE: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature DCDC: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature SODL: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature SODR: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature FPGA: ", getSLSIndex(detType, tempid++))); + for (auto it : eiger_adcs) { + adcWidgets.push_back( + new qDacWidget(this, det, false, sls::ToString(it), it)); + } break; - case slsDetectorDefs::GOTTHARD: - dacWidgets.push_back(new qDacWidget( - this, det, true, - "v Reference: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "v Cascode n: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "v Cascode p: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "v Comp. Output: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, "v Cascode out ", - getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "v Comp. Input: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "v Comp. Ref: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "i Base Test: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature ADC: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature FPGA: ", getSLSIndex(detType, tempid++))); + ind = slsDetectorDefs::TEMPERATURE_ADC; + adcWidgets.push_back( + new qDacWidget(this, det, false, sls::ToString(ind), ind)); + ind = slsDetectorDefs::TEMPERATURE_FPGA; + adcWidgets.push_back( + new qDacWidget(this, det, false, sls::ToString(ind), ind)); break; case slsDetectorDefs::JUNGFRAU: - case slsDetectorDefs::MOENCH: - dacWidgets.push_back( - new qDacWidget(this, det, true, - "v vb comp: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "v vdd prot: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "v vin com: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "v vref prech: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "v vb pixbuf: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "v vb ds: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "v vref ds: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "i vref comp: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature ADC: ", getSLSIndex(detType, tempid++))); + ind = slsDetectorDefs::TEMPERATURE_ADC; + adcWidgets.push_back( + new qDacWidget(this, det, false, sls::ToString(ind), ind)); break; case slsDetectorDefs::GOTTHARD2: - dacWidgets.push_back( - new qDacWidget(this, det, true, - "vref_h_adc: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "vb_comp_fe: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "vb_comp_adc: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vcom_cds: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "vref_rstore: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "vb_opa_1st: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, - "vref_comp_fe: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "vcom_adc1: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "vref_prech: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "vref_l_adc: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vref_cds: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back(new qDacWidget( - this, det, true, "vb_cs: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "vb_opa_fd: ", getSLSIndex(detType, tempid++))); - dacWidgets.push_back( - new qDacWidget(this, det, true, - "vcom_adc2: ", getSLSIndex(detType, tempid++))); - adcWidgets.push_back(new qDacWidget( - this, det, false, - "Temperature FPGA: ", getSLSIndex(detType, tempid++))); + case slsDetectorDefs::MYTHEN3: + case slsDetectorDefs::MOENCH: + ind = slsDetectorDefs::TEMPERATURE_FPGA; + adcWidgets.push_back( + new qDacWidget(this, det, false, sls::ToString(ind), ind)); break; + default: break; } } - CATCH_DISPLAY(std::string("Could not get dac/ adc index ") + - std::to_string(tempid), + CATCH_DISPLAY("Could not get dac/ adc index ", "qTabDeveloper::SetupWidgetWindow") for (size_t i = 0; i < dacWidgets.size(); ++i) { @@ -214,7 +86,7 @@ void qTabDeveloper::SetupWidgetWindow() { void qTabDeveloper::Initialization() { connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, - SLOT(Refresh())); + SLOT(setDetectorIndex())); } void qTabDeveloper::PopulateDetectors() { @@ -230,218 +102,31 @@ void qTabDeveloper::PopulateDetectors() { } } comboDetector->setCurrentIndex(0); + setDetectorIndex(); } CATCH_DISPLAY("Could not populate readouts for dacs/adcs", "qTabDeveloper::PopulateDetectors") } -slsDetectorDefs::dacIndex -qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) { - switch (detType) { - - case slsDetectorDefs::EIGER: - switch (index) { - case 0: - return slsDetectorDefs::VSVP; - case 1: - return slsDetectorDefs::VSVN; - case 2: - return slsDetectorDefs::VRPREAMP; - case 3: - return slsDetectorDefs::VRSHAPER; - case 4: - return slsDetectorDefs::VTRIM; - case 5: - return slsDetectorDefs::VTGSTV; - case 6: - return slsDetectorDefs::VCAL; - case 7: - return slsDetectorDefs::VCP; - case 8: - return slsDetectorDefs::VCN; - case 9: - return slsDetectorDefs::VISHAPER; - case 10: - return slsDetectorDefs::RXB_LB; - case 11: - return slsDetectorDefs::RXB_RB; - case 12: - return slsDetectorDefs::VCMP_LL; - case 13: - return slsDetectorDefs::VCMP_LR; - case 14: - return slsDetectorDefs::VCMP_RL; - case 15: - return slsDetectorDefs::VCMP_RR; - case 16: - return slsDetectorDefs::VTHRESHOLD; - case 17: - return slsDetectorDefs::TEMPERATURE_FPGAEXT; - case 18: - return slsDetectorDefs::TEMPERATURE_10GE; - case 19: - return slsDetectorDefs::TEMPERATURE_DCDC; - case 20: - return slsDetectorDefs::TEMPERATURE_SODL; - case 21: - return slsDetectorDefs::TEMPERATURE_SODR; - case 22: - return slsDetectorDefs::TEMPERATURE_FPGA; - default: - throw RuntimeError(std::string("Unknown dac/adc index") + - std::to_string(index)); - } - break; - case slsDetectorDefs::GOTTHARD: - switch (index) { - case 0: - return slsDetectorDefs::VREF_DS; - case 1: - return slsDetectorDefs::VCASCN_PB; - case 2: - return slsDetectorDefs::VCASCP_PB; - case 3: - return slsDetectorDefs::VOUT_CM; - case 4: - return slsDetectorDefs::VCASC_OUT; - case 5: - return slsDetectorDefs::VIN_CM; - case 6: - return slsDetectorDefs::VREF_COMP; - case 7: - return slsDetectorDefs::IB_TESTC; - case 8: - return slsDetectorDefs::TEMPERATURE_ADC; - case 9: - return slsDetectorDefs::TEMPERATURE_FPGA; - default: - throw RuntimeError(std::string("Unknown dac/adc index") + - std::to_string(index)); - } - break; - - case slsDetectorDefs::JUNGFRAU: - case slsDetectorDefs::MOENCH: - switch (index) { - case 0: - return slsDetectorDefs::VB_COMP; - case 1: - return slsDetectorDefs::VDD_PROT; - case 2: - return slsDetectorDefs::VIN_COM; - case 3: - return slsDetectorDefs::VREF_PRECH; - case 4: - return slsDetectorDefs::VB_PIXBUF; - case 5: - return slsDetectorDefs::VB_DS; - case 6: - return slsDetectorDefs::VREF_DS; - case 7: - return slsDetectorDefs::VREF_COMP; - case 8: - return slsDetectorDefs::TEMPERATURE_ADC; - default: - throw RuntimeError(std::string("Unknown dac/adc index") + - std::to_string(index)); - } - break; - - case slsDetectorDefs::MYTHEN3: - switch (index) { - case 0: - return slsDetectorDefs::VCASSH; - case 1: - return slsDetectorDefs::VTH2; - case 2: - return slsDetectorDefs::VRSHAPER; - case 3: - return slsDetectorDefs::VRSHAPER_N; - case 4: - return slsDetectorDefs::VIPRE_OUT; - case 5: - return slsDetectorDefs::VTH3; - case 6: - return slsDetectorDefs::VTH1; - case 7: - return slsDetectorDefs::VICIN; - case 8: - return slsDetectorDefs::VCAS; - case 9: - return slsDetectorDefs::VRPREAMP; - case 10: - return slsDetectorDefs::VCAL_P; - case 11: - return slsDetectorDefs::VIPRE; - case 12: - return slsDetectorDefs::VISHAPER; - case 13: - return slsDetectorDefs::VCAL_N; - case 14: - return slsDetectorDefs::VTRIM; - case 15: - return slsDetectorDefs::VDCSH; - case 16: - return slsDetectorDefs::VTHRESHOLD; - case 17: - return slsDetectorDefs::TEMPERATURE_FPGA; - default: - throw RuntimeError(std::string("Unknown dac/adc index") + - std::to_string(index)); - } - break; - - case slsDetectorDefs::GOTTHARD2: - switch (index) { - case 0: - return slsDetectorDefs::VREF_H_ADC; - case 1: - return slsDetectorDefs::VB_COMP_FE; - case 2: - return slsDetectorDefs::VB_COMP_ADC; - case 3: - return slsDetectorDefs::VCOM_CDS; - case 4: - return slsDetectorDefs::VREF_RSTORE; - case 5: - return slsDetectorDefs::VB_OPA_1ST; - case 6: - return slsDetectorDefs::VREF_COMP_FE; - case 7: - return slsDetectorDefs::VCOM_ADC1; - case 8: - return slsDetectorDefs::VREF_PRECH; - case 9: - return slsDetectorDefs::VREF_L_ADC; - case 10: - return slsDetectorDefs::VREF_CDS; - case 11: - return slsDetectorDefs::VB_CS; - case 12: - return slsDetectorDefs::VB_OPA_FD; - case 13: - return slsDetectorDefs::VCOM_ADC2; - case 14: - return slsDetectorDefs::TEMPERATURE_FPGA; - default: - throw RuntimeError(std::string("Unknown dac/adc index") + - std::to_string(index)); - } - break; - - default: - throw RuntimeError(std::string("Unknown detector type")); - } -} - -void qTabDeveloper::Refresh() { - LOG(logDEBUG) << "**Updating Developer Tab\n"; +void qTabDeveloper::setDetectorIndex() { + LOG(logDEBUG) << "set detector index"; for (const auto &it : dacWidgets) { it->SetDetectorIndex(comboDetector->currentIndex() - 1); } for (const auto &it : adcWidgets) { it->SetDetectorIndex(comboDetector->currentIndex() - 1); } + Refresh(); +} + +void qTabDeveloper::Refresh() { + LOG(logDEBUG) << "**Updating Developer Tab\n"; + for (const auto &it : dacWidgets) { + it->Refresh(); + } + for (const auto &it : adcWidgets) { + it->Refresh(); + } LOG(logDEBUG) << "**Updated Developer Tab"; } diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index b0658857b..2b21140d0 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index b391db150..2419197f5 100755 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/moenchDetectorServer/RegisterDefs.h b/slsDetectorServers/moenchDetectorServer/RegisterDefs.h index 506dfda90..23d3daf8f 100644 --- a/slsDetectorServers/moenchDetectorServer/RegisterDefs.h +++ b/slsDetectorServers/moenchDetectorServer/RegisterDefs.h @@ -385,7 +385,7 @@ #define ASIC_CTRL_BOTSRTESTTOP_OFST (31) #define ASIC_CTRL_BOTSRTESTTOP_MSK (0x00000001 << ASIC_CTRL_BOTSRTESTTOP_OFST) -#define ASIC_CTRL_DEFAULT_VAL (ASIC_CTRL_INTRFCE_CLK_PLRTY_MSK | ASIC_CTRL_DSG1_BOT_MSK | \ +#define ASIC_CTRL_DEFAULT_VAL (ASIC_CTRL_DSG1_BOT_MSK | \ ASIC_CTRL_HG_BOT_MSK | ASIC_CTRL_STO2TOP_MSK | \ ASIC_CTRL_CONNCDSTOP_MSK | ASIC_CTRL_STO1TOP_MSK | \ ASIC_CTRL_BOTSRTESTBOT_MSK | ASIC_CTRL_PULSEOFFTOP_MSK | \ diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer index c726809b0..551eafc95 100755 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c index 02c59eacf..88db419d9 100644 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c @@ -1382,6 +1382,16 @@ int *getDetectorPosition() { return detPos; } /* moench specific - powerchip, clockdiv, pll, * flashing fpga */ +void setADCPipeline(int val) { + if (val < 0) { + return; + } + LOG(logINFO, ("Setting adc pipeline to %d\n", val)); + bus_w(ADC_OFST_REG, val); +} + +int getADCPipeline() { return bus_r(ADC_OFST_REG); } + int setReadNRows(int value) { if (value < 0 || (value % READ_N_ROWS_MULTIPLE != 0)) { LOG(logERROR, ("Invalid number of rows %d\n", value)); @@ -1492,6 +1502,8 @@ int setReadoutSpeed(int val) { uint32_t config = 0; uint32_t sampleAdcDecimationFactor = 0; + int adcPhase = 0; + int adcOffset = 0; switch (val) { @@ -1500,13 +1512,17 @@ int setReadoutSpeed(int val) { config = CONFIG_FULL_SPEED_40MHZ_VAL; sampleAdcDecimationFactor = ADC_DECMT_FULL_SPEED << SAMPLE_ADC_DECMT_FACTOR_OFST; + adcOffset = ADC_OFST_FULL_SPEED; + adcPhase = ADC_PHASE_DEG_FULL_SPEED; break; case HALF_SPEED: - LOG(logINFO, ("Setting Speed Speed (20 MHz):\n")); + LOG(logINFO, ("Setting Half Speed (20 MHz):\n")); config = CONFIG_HALF_SPEED_20MHZ_VAL; sampleAdcDecimationFactor = ADC_DECMT_HALF_SPEED << SAMPLE_ADC_DECMT_FACTOR_OFST; + adcOffset = ADC_OFST_HALF_SPEED; + adcPhase = ADC_PHASE_DEG_HALF_SPEED; break; case QUARTER_SPEED: @@ -1514,6 +1530,8 @@ int setReadoutSpeed(int val) { config = CONFIG_QUARTER_SPEED_10MHZ_VAL; sampleAdcDecimationFactor = ADC_DECMT_QUARTER_SPEED << SAMPLE_ADC_DECMT_FACTOR_OFST; + adcOffset = ADC_OFST_QUARTER_SPEED; + adcPhase = ADC_PHASE_DEG_QUARTER_SPEED; break; default: @@ -1529,7 +1547,13 @@ int setReadoutSpeed(int val) { bus_w(SAMPLE_REG, bus_r(SAMPLE_REG) | sampleAdcDecimationFactor); LOG(logINFO, ("\tSet Sample Reg to 0x%x\n", bus_r(SAMPLE_REG))); - // TODO: adcofst, adcphase? + setADCPipeline(adcOffset); + LOG(logINFO, ("\tSet ADC offset to 0x%x (%d)\n", getADCPipeline(), + getADCPipeline())); + + setPhase(ADC_CLK, adcPhase, 1); + LOG(logINFO, ("\tSet ADC Phase to %d degrees\n", adcPhase)); + return OK; } diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h index 08cb366f1..4eecb9264 100644 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h @@ -41,7 +41,7 @@ #define DEFAULT_TX_UDP_PORT (0x7e9a) #define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius #define DEFAULT_FLIP_ROWS (0) -#define DEFAULT_SPEED (FULL_SPEED) +#define DEFAULT_SPEED (HALF_SPEED) #define DEFAULT_PARALLEL_ENABLE (0) #define HIGHVOLTAGE_MIN (60) @@ -69,13 +69,19 @@ #define ADC_DECMT_HALF_SPEED (0x1) #define ADC_DECMT_FULL_SPEED (0x0) +#define ADC_PHASE_DEG_QUARTER_SPEED (0) +#define ADC_PHASE_DEG_HALF_SPEED (0) +#define ADC_PHASE_DEG_FULL_SPEED (300) + +#define ADC_OFST_QUARTER_SPEED (0x12) +#define ADC_OFST_HALF_SPEED (0x12) +#define ADC_OFST_FULL_SPEED (0x12) + // pipeline #define ADC_PORT_INVERT_VAL (0x55555555) #define SAMPLE_ADC_FULL_SPEED \ (SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL) // 0x0 -#define ADC_PHASE_DEG_FULL_SPEED (140) -#define ADC_OFST_FULL_SPEED_VAL (0xf) /* Struct Definitions */ typedef struct udp_header_struct { @@ -107,29 +113,29 @@ typedef struct udp_header_struct { /* Enums */ enum ADCINDEX { TEMP_FPGA, TEMP_ADC }; enum DACINDEX { - J_VB_COMP, - J_VDD_PROT, - J_VIN_COM, - J_VREF_PRECH, - J_VB_PIXBUF, - J_VB_DS, - J_VREF_DS, - J_VREF_COMP + 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 \ - "vb_comp", "vdd_prot", "vin_com", "vref_prech", "vb_pixbuf", "vb_ds", \ - "vref_ds", "vref_comp" + "vbp_colbuf", "vipre", "vin_cm", "vb_sda", "vcasc_sfp", "vout_cm", \ + "vipre_cds", "ibias_sfp" #define DEFAULT_DAC_VALS \ { \ - 1220, /* J_VB_COMP */ \ - 3000, /* J_VDD_PROT */ \ - 1053, /* J_VIN_COM */ \ - 1450, /* J_VREF_PRECH */ \ - 750, /* J_VB_PIXBUF */ \ - 1000, /* J_VB_DS */ \ - 480, /* J_VREF_DS */ \ - 420 /* J_VREF_COMP */ \ + 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 MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE }; diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h index 52bc97bfa..fbb399ff9 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h @@ -508,9 +508,6 @@ int getFrequency(enum CLKINDEX ind); void configureSyncFrequency(enum CLKINDEX ind); void setADCPipeline(int val); int getADCPipeline(); -#endif - -#ifdef CHIPTESTBOARDD void setDBITPipeline(int val); int getDBITPipeline(); int setLEDEnable(int enable); @@ -519,6 +516,10 @@ void setDigitalIODelay(uint64_t pinMask, int delay); // jungfrau/moench specific - powerchip, autocompdisable, clockdiv, asictimer, // clock, pll, flashing firmware +#if defined(MOENCHED) +void setADCPipeline(int val); +int getADCPipeline(); +#endif #if defined(JUNGFRAUD) || defined(MOENCHD) int setReadNRows(int value); int getReadNRows(); diff --git a/slsDetectorServers/slsDetectorServer/src/AD9257.c b/slsDetectorServers/slsDetectorServer/src/AD9257.c index 20502922d..7d49d4f0e 100644 --- a/slsDetectorServers/slsDetectorServer/src/AD9257.c +++ b/slsDetectorServers/slsDetectorServer/src/AD9257.c @@ -300,7 +300,7 @@ void AD9257_Configure() { AD9257_CLK_CH_IFCO_MSK); // vref -#ifdef GOTTHARDD +#if defined(GOTTHARDD) || defined(MOENCHD) LOG(logINFO, ("\tVref default at 2.0\n")); AD9257_SetVrefVoltage(AD9257_VREF_DEFAULT_VAL, 0); #else diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index b0041377d..3a4015767 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -1049,7 +1049,7 @@ enum DACINDEX getDACIndex(enum dacIndex ind) { case VCOM_ADC2: serverDacIndex = G2_VCOM_ADC2; break; -#elif defined(JUNGFRAUD) || defined(MOENCHD) +#elif JUNGFRAUD case HIGH_VOLTAGE: break; case VB_COMP: @@ -1076,6 +1076,33 @@ enum DACINDEX getDACIndex(enum dacIndex ind) { case VREF_COMP: serverDacIndex = J_VREF_COMP; break; +#elif MOENCHD + case HIGH_VOLTAGE: + break; + 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; #endif default: @@ -9053,7 +9080,7 @@ int set_adc_pipeline(int file_des) { return printSocketReadError(); LOG(logDEBUG1, ("Setting adc pipeline : %u\n", arg)); -#if !defined(CHIPTESTBOARDD) +#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) functionNotImplemented(); #else @@ -9075,7 +9102,7 @@ int get_adc_pipeline(int file_des) { LOG(logDEBUG1, ("Getting adc pipeline\n")); -#if !defined(CHIPTESTBOARDD) +#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) functionNotImplemented(); #else // get only diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 4dce32fb1..fc0f1e311 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -1615,12 +1615,6 @@ class Detector { /** [CTB] in MHZ */ Result getSYNCClock(Positions pos = {}) const; - /** [CTB] */ - Result getADCPipeline(Positions pos = {}) const; - - /** [CTB] */ - void setADCPipeline(int value, Positions pos = {}); - /** gets list of voltage enums */ std::vector getVoltageList() const; @@ -1959,6 +1953,12 @@ class Detector { * * * ************************************************/ + /** [CTB][Moench] */ + Result getADCPipeline(Positions pos = {}) const; + + /** [CTB][Moench] */ + void setADCPipeline(int value, Positions pos = {}); + /** [Jungfrau][Moench][Gotthard][CTB][Mythen3][Gotthard2] * Advanced user Function! * Program firmware from command line, after which detector controller is diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index 340804b54..dff178822 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -2992,6 +2992,8 @@ std::string CmdProxy::PatternWaitTime(int action) { return os.str(); } +/* Advanced */ + std::string CmdProxy::AdditionalJsonHeader(int action) { std::ostringstream os; os << cmd << ' '; @@ -3067,8 +3069,6 @@ std::string CmdProxy::JsonParameter(int action) { return os.str(); } -/* Advanced */ - std::string CmdProxy::ProgramFpga(int action) { std::ostringstream os; os << cmd << ' '; diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index 75df55ae6..f89360cc6 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -1233,7 +1233,6 @@ class CmdProxy { {"adcclk", &CmdProxy::adcclk}, {"runclk", &CmdProxy::runclk}, {"syncclk", &CmdProxy::syncclk}, - {"adcpipeline", &CmdProxy::adcpipeline}, {"v_limit", &CmdProxy::v_limit}, {"adcenable", &CmdProxy::adcenable}, {"adcenable10g", &CmdProxy::adcenable10g}, @@ -1296,10 +1295,11 @@ class CmdProxy { {"patternstart", &CmdProxy::patternstart}, /* Moench */ - {"rx_jsonaddheader", &CmdProxy::AdditionalJsonHeader}, - {"rx_jsonpara", &CmdProxy::JsonParameter}, /* Advanced */ + {"adcpipeline", &CmdProxy::adcpipeline}, + {"rx_jsonaddheader", &CmdProxy::AdditionalJsonHeader}, + {"rx_jsonpara", &CmdProxy::JsonParameter}, {"programfpga", &CmdProxy::ProgramFpga}, {"resetfpga", &CmdProxy::resetfpga}, {"updatedetectorserver", &CmdProxy::UpdateDetectorServer}, @@ -2425,10 +2425,6 @@ class CmdProxy { GET_COMMAND(syncclk, getSYNCClock, "[n_clk in MHz]\n\t[Ctb] Sync clock in MHz."); - INTEGER_COMMAND_VEC_ID(adcpipeline, getADCPipeline, setADCPipeline, - StringTo, - "[n_value]\n\t[Ctb] Pipeline for ADC clock."); - INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, StringTo, defs::V_LIMIT, "[n_value]\n\t[Ctb] Soft limit for power " @@ -2587,6 +2583,10 @@ class CmdProxy { /* Moench */ /* Advanced */ + INTEGER_COMMAND_VEC_ID( + adcpipeline, getADCPipeline, setADCPipeline, StringTo, + "[n_value]\n\t[Ctb][Moench] Pipeline for ADC clock."); + EXECUTE_SET_COMMAND(resetfpga, resetFPGA, "\n\t[Jungfrau][Moench][Ctb] Reset FPGA."); diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 1c70a7326..5e63c8b71 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -718,7 +718,6 @@ std::vector Detector::getDacList() const { defs::VREF_DS, defs::VCASCN_PB, defs::VCASCP_PB, defs::VOUT_CM, defs::VCASC_OUT, defs::VIN_CM, defs::VREF_COMP, defs::IB_TESTC}; case defs::JUNGFRAU: - case defs::MOENCH: return std::vector{ defs::VB_COMP, defs::VDD_PROT, defs::VIN_COM, defs::VREF_PRECH, defs::VB_PIXBUF, defs::VB_DS, defs::VREF_DS, defs::VREF_COMP}; @@ -736,6 +735,10 @@ std::vector Detector::getDacList() const { defs::VCAS, defs::VRPREAMP, defs::VCAL_N, defs::VIPRE, defs::VISHAPER, defs::VCAL_P, defs::VTRIM, defs::VDCSH, defs::VTHRESHOLD}; + case defs::MOENCH: + return std::vector{ + defs::VBP_COLBUF, defs::VIPRE, defs::VIN_CM, defs::VB_SDA, + defs::VCASC_SFP, defs::VOUT_CM, defs::VIPRE_CDS, defs::IBIAS_SFP}; case defs::CHIPTESTBOARD: for (int i = 0; i != 18; ++i) { retval.push_back(static_cast(i)); @@ -2048,14 +2051,6 @@ Result Detector::getSYNCClock(Positions pos) const { return pimpl->Parallel(&Module::getClockFrequency, pos, defs::SYNC_CLOCK); } -Result Detector::getADCPipeline(Positions pos) const { - return pimpl->Parallel(&Module::getADCPipeline, pos); -} - -void Detector::setADCPipeline(int value, Positions pos) { - pimpl->Parallel(&Module::setADCPipeline, pos, value); -} - std::vector Detector::getVoltageList() const { if (getDetectorType().squash() != defs::CHIPTESTBOARD) { throw RuntimeError("Voltage list not implemented for this detector"); @@ -2533,6 +2528,8 @@ void Detector::startPattern(Positions pos) { pimpl->Parallel(&Module::startPattern, pos); } +// Json Header specific + Result> Detector::getAdditionalJsonHeader(Positions pos) const { return pimpl->Parallel(&Module::getAdditionalJsonHeader, pos); @@ -2556,6 +2553,14 @@ void Detector::setAdditionalJsonParameter(const std::string &key, // Advanced +Result Detector::getADCPipeline(Positions pos) const { + return pimpl->Parallel(&Module::getADCPipeline, pos); +} + +void Detector::setADCPipeline(int value, Positions pos) { + pimpl->Parallel(&Module::setADCPipeline, pos, value); +} + void Detector::programFPGA(const std::string &fname, const bool forceDeleteNormalFile, Positions pos) { LOG(logINFO) << "Updating Firmware..."; diff --git a/slsDetectorSoftware/src/HelpDacs.h b/slsDetectorSoftware/src/HelpDacs.h index 793038f81..75c87710e 100644 --- a/slsDetectorSoftware/src/HelpDacs.h +++ b/slsDetectorSoftware/src/HelpDacs.h @@ -91,7 +91,7 @@ std::string GetHelpDac(std::string dac) { } if (dac == "vref_ds") { return std::string("[dac or mV value][(optional unit) mV] " - "\n\t[Gotthard][Jungfrau][Moench] Dac for ??"); + "\n\t[Gotthard][Jungfrau] Dac for ??"); } if (dac == "vcascn_pb") { return std::string( @@ -103,7 +103,7 @@ std::string GetHelpDac(std::string dac) { } if (dac == "vout_cm") { return std::string("[dac or mV value][(optional unit) mV] " - "\n\t[Gotthard] Dac for ??"); + "\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 5"); } if (dac == "vcasc_out") { return std::string( @@ -111,11 +111,11 @@ std::string GetHelpDac(std::string dac) { } if (dac == "vin_cm") { return std::string("[dac or mV value][(optional unit) mV] " - "\n\t[Gotthard] Dac for ??"); + "\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 2"); } if (dac == "vref_comp") { return std::string("[dac or mV value][(optional unit) mV] " - "\n\t[Gotthard][Jungfrau][Moench] Dac for ??"); + "\n\t[Gotthard][Jungfrau] Dac for ??"); } if (dac == "ib_test_c") { return std::string( @@ -129,7 +129,7 @@ std::string GetHelpDac(std::string dac) { if (dac == "vipre") { return std::string( "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the " - "preamplifier's input transistor current."); + "preamplifier's input transistor current.\n\t[Moench] Dac for 1"); } if (dac == "vdcsh") { return std::string( @@ -225,7 +225,7 @@ std::string GetHelpDac(std::string dac) { if (dac == "vref_prech") { return std::string( "[dac or mV value][(optional unit) mV] " - "\n\t[Gotthard2][Jungfrau][Moench] " + "\n\t[Gotthard2][Jungfrau] " "Dac for reference votlage for precharing the preamplifier."); } if (dac == "vref_l_adc") { @@ -256,38 +256,43 @@ std::string GetHelpDac(std::string dac) { } if (dac == "vb_ds") { return std::string("[dac or mV value][(optional unit) mV] " - "\n\t[Jungfrau][Moench] Dac for ??"); + "\n\t[Jungfrau] Dac for ??"); } if (dac == "vb_comp") { return std::string("[dac or mV value][(optional unit) mV] " - "\n\t[Jungfrau][Moench] Dac for ??"); + "\n\t[Jungfrau] Dac for ??"); } if (dac == "vb_pixbuf") { return std::string("[dac or mV value][(optional unit) mV] " - "\n\t[Jungfrau][Moench] Dac for ??"); + "\n\t[Jungfrau] Dac for ??"); } if (dac == "vin_com") { return std::string("[dac or mV value][(optional unit) mV] " - "\n\t[Jungfrau][Moench] Dac for ??"); + "\n\t[Jungfrau] Dac for ??"); } if (dac == "vdd_prot") { return std::string("[dac or mV value][(optional unit) mV] " - "\n\t[Jungfrau][Moench] Dac for ??"); + "\n\t[Jungfrau] Dac for ??"); } if (dac == "vbp_colbuf") { - return std::string("[dac or mV value][(optional unit) mV] \n"); + return std::string( + "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0"); } if (dac == "vb_sda") { - return std::string("[dac or mV value][(optional unit) mV] \n"); + return std::string( + "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3"); } if (dac == "vcasc_sfp") { - return std::string("[dac or mV value][(optional unit) mV] \n"); + return std::string( + "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4"); } if (dac == "vipre_cds") { - return std::string("[dac or mV value][(optional unit) mV] \n"); + return std::string( + "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6"); } if (dac == "ibias_sfp") { - return std::string("[dac or mV value][(optional unit) mV] \n"); + return std::string( + "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 7"); } // clang-format off diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index b7a42459d..9e47652a7 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -2370,14 +2370,6 @@ void Module::setNumberOfAnalogSamples(int value) { } } -int Module::getADCPipeline() const { - return sendToDetector(F_GET_ADC_PIPELINE); -} - -void Module::setADCPipeline(int value) { - sendToDetector(F_SET_ADC_PIPELINE, value, nullptr); -} - uint32_t Module::getADCEnableMask() const { return sendToDetector(F_GET_ADC_ENABLE_MASK); } @@ -2630,6 +2622,8 @@ void Module::setPatternBitMask(uint64_t mask) { void Module::startPattern() { sendToDetector(F_START_PATTERN); } +// Json Header specific + std::map Module::getAdditionalJsonHeader() const { // TODO, refactor this function with a more robust sending. // Now assuming whitespace separated key value @@ -2718,6 +2712,15 @@ void Module::setAdditionalJsonParameter(const std::string &key, } // Advanced + +int Module::getADCPipeline() const { + return sendToDetector(F_GET_ADC_PIPELINE); +} + +void Module::setADCPipeline(int value) { + sendToDetector(F_SET_ADC_PIPELINE, value, nullptr); +} + void Module::programFPGA(std::vector buffer, const bool forceDeleteNormalFile) { switch (shm()->detType) { diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 6a15b91b1..fd0b99eda 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -502,8 +502,6 @@ class Module : public virtual slsDetectorDefs { * ************************************************/ int getNumberOfAnalogSamples() const; void setNumberOfAnalogSamples(int value); - int getADCPipeline() const; - void setADCPipeline(int value); uint32_t getADCEnableMask() const; void setADCEnableMask(uint32_t mask); uint32_t getTenGigaADCEnableMask() const; @@ -557,7 +555,7 @@ class Module : public virtual slsDetectorDefs { /************************************************** * * - * Moench * + * Json Header specific * * * * ************************************************/ std::map getAdditionalJsonHeader() const; @@ -572,6 +570,8 @@ class Module : public virtual slsDetectorDefs { * Advanced * * * * ************************************************/ + int getADCPipeline() const; + void setADCPipeline(int value); void programFPGA(std::vector buffer, const bool forceDeleteNormalFile); void resetFPGA(); diff --git a/slsDetectorSoftware/tests/test-CmdProxy-chiptestboard.cpp b/slsDetectorSoftware/tests/test-CmdProxy-chiptestboard.cpp index 6b18ace3d..d23ec6a6b 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-chiptestboard.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-chiptestboard.cpp @@ -727,41 +727,6 @@ TEST_CASE("syncclk", "[.cmd]") { } } -TEST_CASE("adcpipeline", "[.cmd]") { - Detector det; - CmdProxy proxy(&det); - auto det_type = det.getDetectorType().squash(); - - if (det_type == defs::CHIPTESTBOARD) { - auto prev_val = det.getADCPipeline(); - { - std::ostringstream oss; - proxy.Call("adcpipeline", {"1"}, -1, PUT, oss); - REQUIRE(oss.str() == "adcpipeline 1\n"); - } - { - std::ostringstream oss; - proxy.Call("adcpipeline", {"0"}, -1, PUT, oss); - REQUIRE(oss.str() == "adcpipeline 0\n"); - } - { - std::ostringstream oss; - proxy.Call("adcpipeline", {"15"}, -1, PUT, oss); - REQUIRE(oss.str() == "adcpipeline 15\n"); - } - { - std::ostringstream oss; - proxy.Call("adcpipeline", {}, -1, GET, oss); - REQUIRE(oss.str() == "adcpipeline 15\n"); - } - for (int i = 0; i != det.size(); ++i) { - det.setADCPipeline(prev_val[i], {i}); - } - } else { - REQUIRE_THROWS(proxy.Call("adcpipeline", {}, -1, GET)); - } -} - TEST_CASE("v_limit", "[.cmd]") { Detector det; CmdProxy proxy(&det); diff --git a/slsDetectorSoftware/tests/test-CmdProxy.cpp b/slsDetectorSoftware/tests/test-CmdProxy.cpp index afbea7f0a..c52353805 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy.cpp @@ -3055,6 +3055,41 @@ TEST_CASE("zmqhwm", "[.cmd]") { /* Advanced */ +TEST_CASE("adcpipeline", "[.cmd]") { + Detector det; + CmdProxy proxy(&det); + auto det_type = det.getDetectorType().squash(); + + if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) { + auto prev_val = det.getADCPipeline(); + { + std::ostringstream oss; + proxy.Call("adcpipeline", {"1"}, -1, PUT, oss); + REQUIRE(oss.str() == "adcpipeline 1\n"); + } + { + std::ostringstream oss; + proxy.Call("adcpipeline", {"0"}, -1, PUT, oss); + REQUIRE(oss.str() == "adcpipeline 0\n"); + } + { + std::ostringstream oss; + proxy.Call("adcpipeline", {"15"}, -1, PUT, oss); + REQUIRE(oss.str() == "adcpipeline 15\n"); + } + { + std::ostringstream oss; + proxy.Call("adcpipeline", {}, -1, GET, oss); + REQUIRE(oss.str() == "adcpipeline 15\n"); + } + for (int i = 0; i != det.size(); ++i) { + det.setADCPipeline(prev_val[i], {i}); + } + } else { + REQUIRE_THROWS(proxy.Call("adcpipeline", {}, -1, GET)); + } +} + TEST_CASE("programfpga", "[.cmd]") { Detector det; CmdProxy proxy(&det); diff --git a/slsReceiverSoftware/src/GeneralData.h b/slsReceiverSoftware/src/GeneralData.h index be88309a2..12a46f7a2 100644 --- a/slsReceiverSoftware/src/GeneralData.h +++ b/slsReceiverSoftware/src/GeneralData.h @@ -65,6 +65,8 @@ class GeneralData { slsDetectorDefs::ROI detectorRoi{}; uint32_t counterMask{0}; uint32_t transceiverMask{0}; + slsDetectorDefs::frameDiscardPolicy frameDiscardMode{ + slsDetectorDefs::NO_DISCARD}; GeneralData(){}; virtual ~GeneralData(){}; @@ -384,6 +386,7 @@ class MoenchData : public GeneralData { fifoDepth = 1000; standardheader = true; maxRowsPerReadout = 400; + frameDiscardMode = slsDetectorDefs::DISCARD_PARTIAL_FRAMES; UpdateImageSize(); }; diff --git a/slsReceiverSoftware/src/Implementation.cpp b/slsReceiverSoftware/src/Implementation.cpp index 197236e50..5548fc685 100644 --- a/slsReceiverSoftware/src/Implementation.cpp +++ b/slsReceiverSoftware/src/Implementation.cpp @@ -186,7 +186,6 @@ void Implementation::SetupListener(int i) { listener[i]->SetActivate(activated); listener[i]->SetNoRoi(portRois[i].noRoi()); listener[i]->SetDetectorDatastream(detectorDataStream[i]); - listener[i]->SetFrameDiscardPolicy(frameDiscardMode); listener[i]->SetSilentMode(silentMode); } @@ -327,14 +326,13 @@ void Implementation::setFifoDepth(const uint32_t i) { slsDetectorDefs::frameDiscardPolicy Implementation::getFrameDiscardPolicy() const { - return frameDiscardMode; + return generalData->frameDiscardMode; } void Implementation::setFrameDiscardPolicy(const frameDiscardPolicy i) { - frameDiscardMode = i; - for (const auto &it : listener) - it->SetFrameDiscardPolicy(frameDiscardMode); - LOG(logINFO) << "Frame Discard Policy: " << ToString(frameDiscardMode); + generalData->frameDiscardMode = i; + LOG(logINFO) << "Frame Discard Policy: " + << ToString(generalData->frameDiscardMode); } bool Implementation::getFramePaddingEnable() const { return framePadding; } @@ -931,7 +929,7 @@ void Implementation::StartMasterWriter() { masterAttributes.nPixels = xy(generalData->nPixelsX, generalData->nPixelsY); masterAttributes.maxFramesPerFile = generalData->framesPerFile; - masterAttributes.frameDiscardMode = frameDiscardMode; + masterAttributes.frameDiscardMode = generalData->frameDiscardMode; masterAttributes.framePadding = framePadding; masterAttributes.scanParams = scanParams; masterAttributes.totalFrames = numberOfTotalFrames; diff --git a/slsReceiverSoftware/src/Implementation.h b/slsReceiverSoftware/src/Implementation.h index 0aa5cc6fa..0e00d131a 100644 --- a/slsReceiverSoftware/src/Implementation.h +++ b/slsReceiverSoftware/src/Implementation.h @@ -312,7 +312,6 @@ class Implementation : private virtual slsDetectorDefs { int modulePos{0}; std::string detHostname; bool silentMode{false}; - frameDiscardPolicy frameDiscardMode{NO_DISCARD}; bool framePadding{true}; pid_t parentThreadId; pid_t tcpThreadId; diff --git a/slsReceiverSoftware/src/Listener.cpp b/slsReceiverSoftware/src/Listener.cpp index ef2aa3736..bb5a9a0c6 100644 --- a/slsReceiverSoftware/src/Listener.cpp +++ b/slsReceiverSoftware/src/Listener.cpp @@ -102,10 +102,6 @@ void Listener::SetNoRoi(bool enable) { disabledPort = (!activated || !detectorDataStream || noRoi); } -void Listener::SetFrameDiscardPolicy(frameDiscardPolicy value) { - frameDiscardMode = value; -} - void Listener::SetSilentMode(bool enable) { silentMode = enable; } void Listener::ResetParametersforNewAcquisition() { @@ -419,7 +415,7 @@ size_t Listener::HandleFuturePacket(bool EOA, uint32_t numpackets, uint64_t fnum, bool isHeaderEmpty, size_t imageSize, sls_receiver_header &dstHeader) { - switch (frameDiscardMode) { + switch (generalData->frameDiscardMode) { case DISCARD_EMPTY_FRAMES: if (!numpackets) { if (!EOA) { diff --git a/slsReceiverSoftware/src/Listener.h b/slsReceiverSoftware/src/Listener.h index fd1f8e00a..9b78ec95a 100644 --- a/slsReceiverSoftware/src/Listener.h +++ b/slsReceiverSoftware/src/Listener.h @@ -44,7 +44,6 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject { void SetActivate(bool enable); void SetDetectorDatastream(bool enable); void SetNoRoi(bool enable); - void SetFrameDiscardPolicy(frameDiscardPolicy value); void SetSilentMode(bool enable); void ResetParametersforNewAcquisition(); @@ -115,7 +114,6 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject { uint32_t udpPortNumber{0}; std::string eth; - frameDiscardPolicy frameDiscardMode; bool activated{false}; bool detectorDataStream{true}; bool noRoi{false}; diff --git a/slsReceiverSoftware/src/receiver_defs.h b/slsReceiverSoftware/src/receiver_defs.h index e649e2ea8..2a7a4d1ed 100644 --- a/slsReceiverSoftware/src/receiver_defs.h +++ b/slsReceiverSoftware/src/receiver_defs.h @@ -26,7 +26,7 @@ namespace sls { #define SHORT_MAX_FRAMES_PER_FILE 100000 #define EIGER_MAX_FRAMES_PER_FILE 10000 #define JFRAU_MAX_FRAMES_PER_FILE 10000 -#define MOENCH_MAX_FRAMES_PER_FILE 10000 +#define MOENCH_MAX_FRAMES_PER_FILE 100000 #define CTB_MAX_FRAMES_PER_FILE 20000 #define MYTHEN3_MAX_FRAMES_PER_FILE 10000 #define GOTTHARD2_MAX_FRAMES_PER_FILE 20000 diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 493e3ecaf..e7ce03cff 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -8,6 +8,6 @@ #define APIGOTTHARD "developer 0x230615" #define APIGOTTHARD2 "developer 0x230615" #define APIMYTHEN3 "developer 0x230621" -#define APIMOENCH "developer 0x230707" -#define APIJUNGFRAU "developer 0x230720" -#define APICTB "developer 0x230720" +#define APIJUNGFRAU "developer 0x230720" +#define APIMOENCH "developer 0x230725" +#define APICTB "developer 0x230720"