diff --git a/RELEASE.txt b/RELEASE.txt index 672a4700e..dcd4f14d8 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -160,6 +160,10 @@ This document describes the differences between 6.0.0 and 5.2.0 releases. Command line: datastream, API: getDataStream/ setDataStream Enable or disable each port. Default: enabled + 25. Changing TCP ports + This will only affect shared memory and will not try to change the + current tcp port of the control/stop server in detector. + Detector servers ---------------- @@ -184,6 +188,11 @@ This document describes the differences between 6.0.0 and 5.2.0 releases. Frames caught by the master receiver is added to master file metadata. Hdf5 and Binary version numbers changed to 6.3 + 2. Removed Padding option for Deactivated half modules. + + 3. Changing Receiver TCP ports + This will only affect shared memory and will not try to change the + current tcp port of the receiver. Gui ---- diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 615aa2ba8..8337a811b 100755 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -6,6 +6,7 @@ pybind11_add_module(_slsdet src/network.cpp src/pattern.cpp src/scan.cpp + src/current.cpp ) target_link_libraries(_slsdet PUBLIC diff --git a/python/examples/use_currentsource.py b/python/examples/use_currentsource.py new file mode 100644 index 000000000..a895126b0 --- /dev/null +++ b/python/examples/use_currentsource.py @@ -0,0 +1,11 @@ +from slsdet import Detector, currentSrcParameters + +s = currentSrcParameters() +s.enable_ = 1 +s.fix_= 1 +s.normal_ = 1 +s.select_ = 10 + + +d = Detector() +d.currentsource = s \ No newline at end of file diff --git a/python/examples/using_scan.py b/python/examples/using_scan.py index 612cae754..2d8f5a74a 100644 --- a/python/examples/using_scan.py +++ b/python/examples/using_scan.py @@ -15,5 +15,7 @@ sp.dacSettleTime_ns = int(1e9) d = Mythen3() d.setScan(sp) +#or d.scan = sp + diff --git a/python/slsdet/__init__.py b/python/slsdet/__init__.py index 0d98b6f6d..698224525 100755 --- a/python/slsdet/__init__.py +++ b/python/slsdet/__init__.py @@ -20,4 +20,5 @@ from .enums import * IpAddr = _slsdet.IpAddr MacAddr = _slsdet.MacAddr -scanParameters = _slsdet.scanParameters \ No newline at end of file +scanParameters = _slsdet.scanParameters +currentSrcParameters = _slsdet.currentSrcParameters \ No newline at end of file diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 12449391e..94f9ec483 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -362,6 +362,21 @@ class Detector(CppDetectorApi): """ return self.getNumberOfFramesFromStart() + + @property + @element + def scan(self): + """ + Pass in a scanParameters object + see python/examples/use_scan.py + + """ + return self.getScan() + + @scan.setter + def scan(self, s): + ut.set_using_dict(self.setScan, s) + @property @element def powerchip(self): @@ -1991,7 +2006,7 @@ class Detector(CppDetectorApi): return ut.reduce_time(self.getMeasuredSubFramePeriod()) """ - Jungfrau specific + ------------------<<>>------------------------- """ @property @@ -2212,6 +2227,20 @@ class Detector(CppDetectorApi): def gainmode(self, value): self.setGainMode(value) + @property + @element + def currentsource(self): + """ + Pass in a currentSrcParameters object + see python/examples/use_currentsource.py + + """ + return self.getCurrentSource() + + @currentsource.setter + def currentsource(self, cs): + ut.set_using_dict(self.setCurrentSource, cs) + """ ---------------------------<<>>--------------------------- """ diff --git a/python/src/current.cpp b/python/src/current.cpp new file mode 100644 index 000000000..e6d0d62b7 --- /dev/null +++ b/python/src/current.cpp @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include + +// #include "sls/Pattern.h" +#include "sls/ToString.h" +#include "sls/sls_detector_defs.h" + +namespace py = pybind11; +void init_source(py::module &m) { + + using src = slsDetectorDefs::currentSrcParameters; + py::class_ currentSrcParameters(m, "currentSrcParameters"); + + currentSrcParameters.def(py::init()); + currentSrcParameters.def_readwrite("enable_", &src::enable_); + currentSrcParameters.def_readwrite("fix_", &src::fix_); + currentSrcParameters.def_readwrite("normal_", &src::normal_); + currentSrcParameters.def_readwrite("select_", &src::select_); + currentSrcParameters.def(pybind11::self == pybind11::self); + + currentSrcParameters.def("__repr__", + [](const src &a) { return sls::ToString(a); }); +} diff --git a/python/src/detector.cpp b/python/src/detector.cpp index f34c141fd..b68758577 100644 --- a/python/src/detector.cpp +++ b/python/src/detector.cpp @@ -160,6 +160,13 @@ void init_det(py::module &m) { (void (Detector::*)(const bool)) & Detector::setGapPixelsinCallback, py::arg()) + .def("getFlipRows", + (Result(Detector::*)(sls::Positions) const) & + Detector::getFlipRows, + py::arg() = Positions{}) + .def("setFlipRows", + (void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows, + py::arg(), py::arg() = Positions{}) .def("isVirtualDetectorServer", (Result(Detector::*)(sls::Positions) const) & Detector::isVirtualDetectorServer, @@ -416,6 +423,39 @@ void init_det(py::module &m) { (void (Detector::*)(bool, sls::Positions)) & Detector::setParallelMode, py::arg(), py::arg() = Positions{}) + .def("getFilterResistor", + (Result(Detector::*)(sls::Positions) const) & + Detector::getFilterResistor, + py::arg() = Positions{}) + .def("setFilterResistor", + (void (Detector::*)(int, sls::Positions)) & + Detector::setFilterResistor, + py::arg(), py::arg() = Positions{}) + .def("getCurrentSource", + (Result(Detector::*)(sls::Positions) + const) & + Detector::getCurrentSource, + py::arg() = Positions{}) + .def("setCurrentSource", + (void (Detector::*)(defs::currentSrcParameters, sls::Positions)) & + Detector::setCurrentSource, + py::arg(), py::arg() = Positions{}) + .def("getDBITPipeline", + (Result(Detector::*)(sls::Positions) const) & + Detector::getDBITPipeline, + py::arg() = Positions{}) + .def("setDBITPipeline", + (void (Detector::*)(int, sls::Positions)) & + Detector::setDBITPipeline, + py::arg(), py::arg() = Positions{}) + .def("getReadNRows", + (Result(Detector::*)(sls::Positions) const) & + Detector::getReadNRows, + py::arg() = Positions{}) + .def("setReadNRows", + (void (Detector::*)(const int, sls::Positions)) & + Detector::setReadNRows, + py::arg(), py::arg() = Positions{}) .def("acquire", (void (Detector::*)()) & Detector::acquire) .def("clearAcquiringFlag", (void (Detector::*)()) & Detector::clearAcquiringFlag) @@ -516,6 +556,31 @@ void init_det(py::module &m) { (void (Detector::*)(const sls::MacAddr, sls::Positions)) & Detector::setSourceUDPMAC2, py::arg(), py::arg() = Positions{}) + .def("getDestinationUDPList", + (Result(Detector::*)(const uint32_t, + sls::Positions) const) & + Detector::getDestinationUDPList, + py::arg(), py::arg() = Positions{}) + .def("setDestinationUDPList", + (void (Detector::*)(const sls::UdpDestination, const int)) & + Detector::setDestinationUDPList, + py::arg(), py::arg()) + .def("getNumberofUDPDestinations", + (Result(Detector::*)(sls::Positions) const) & + Detector::getNumberofUDPDestinations, + py::arg() = Positions{}) + .def("clearUDPDestinations", + (void (Detector::*)(sls::Positions)) & + Detector::clearUDPDestinations, + py::arg() = Positions{}) + .def("getFirstUDPDestination", + (Result(Detector::*)(sls::Positions) const) & + Detector::getFirstUDPDestination, + py::arg() = Positions{}) + .def("setFirstUDPDestination", + (void (Detector::*)(const int, sls::Positions)) & + Detector::setFirstUDPDestination, + py::arg(), py::arg() = Positions{}) .def("getDestinationUDPIP", (Result(Detector::*)(sls::Positions) const) & Detector::getDestinationUDPIP, @@ -852,13 +917,6 @@ void init_det(py::module &m) { (void (Detector::*)(bool, sls::Positions)) & Detector::setOverFlowMode, py::arg(), py::arg() = Positions{}) - .def("getFlipRows", - (Result(Detector::*)(sls::Positions) const) & - Detector::getFlipRows, - py::arg() = Positions{}) - .def("setFlipRows", - (void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows, - py::arg(), py::arg() = Positions{}) .def("getRateCorrection", (Result(Detector::*)(sls::Positions) const) & Detector::getRateCorrection, @@ -871,14 +929,6 @@ void init_det(py::module &m) { (void (Detector::*)(sls::ns, sls::Positions)) & Detector::setRateCorrection, py::arg(), py::arg() = Positions{}) - .def("getReadNRows", - (Result(Detector::*)(sls::Positions) const) & - Detector::getReadNRows, - py::arg() = Positions{}) - .def("setReadNRows", - (void (Detector::*)(const int, sls::Positions)) & - Detector::setReadNRows, - py::arg(), py::arg() = Positions{}) .def("getInterruptSubframe", (Result(Detector::*)(sls::Positions) const) & Detector::getInterruptSubframe, @@ -903,14 +953,6 @@ void init_det(py::module &m) { (void (Detector::*)(const bool, sls::Positions)) & Detector::setActive, py::arg(), py::arg() = Positions{}) - .def("getRxPadDeactivatedMode", - (Result(Detector::*)(sls::Positions) const) & - Detector::getRxPadDeactivatedMode, - py::arg() = Positions{}) - .def("setRxPadDeactivatedMode", - (void (Detector::*)(bool, sls::Positions)) & - Detector::setRxPadDeactivatedMode, - py::arg(), py::arg() = Positions{}) .def("getPartialReset", (Result(Detector::*)(sls::Positions) const) & Detector::getPartialReset, @@ -1022,9 +1064,17 @@ void init_det(py::module &m) { Detector::getGainMode, py::arg() = Positions{}) .def("setGainMode", - (void (Detector::*)(defs::gainMode, sls::Positions)) & + (void (Detector::*)(const defs::gainMode, sls::Positions)) & Detector::setGainMode, py::arg(), py::arg() = Positions{}) + .def("getFilterCell", + (Result(Detector::*)(sls::Positions) const) & + Detector::getFilterCell, + py::arg() = Positions{}) + .def("setFilterCell", + (void (Detector::*)(int, sls::Positions)) & + Detector::setFilterCell, + py::arg(), py::arg() = Positions{}) .def("getROI", (Result(Detector::*)(sls::Positions) const) & Detector::getROI, @@ -1100,30 +1150,6 @@ void init_det(py::module &m) { .def("setCDSGain", (void (Detector::*)(bool, sls::Positions)) & Detector::setCDSGain, py::arg(), py::arg() = Positions{}) - .def("getFilterResistor", - (Result(Detector::*)(sls::Positions) const) & - Detector::getFilterResistor, - py::arg() = Positions{}) - .def("setFilterResistor", - (void (Detector::*)(int, sls::Positions)) & - Detector::setFilterResistor, - py::arg(), py::arg() = Positions{}) - .def("getFilterCell", - (Result(Detector::*)(sls::Positions) const) & - Detector::getFilterCell, - py::arg() = Positions{}) - .def("setFilterCell", - (void (Detector::*)(int, sls::Positions)) & - Detector::setFilterCell, - py::arg(), py::arg() = Positions{}) - .def("getCurrentSource", - (Result(Detector::*)(sls::Positions) const) & - Detector::getCurrentSource, - py::arg() = Positions{}) - .def("setCurrentSource", - (void (Detector::*)(bool, sls::Positions)) & - Detector::setCurrentSource, - py::arg(), py::arg() = Positions{}) .def("getTimingSource", (Result(Detector::*)(sls::Positions) const) & @@ -1315,14 +1341,6 @@ void init_det(py::module &m) { .def("setDBITClock", (void (Detector::*)(int, sls::Positions)) & Detector::setDBITClock, py::arg(), py::arg() = Positions{}) - .def("getDBITPipeline", - (Result(Detector::*)(sls::Positions) const) & - Detector::getDBITPipeline, - py::arg() = Positions{}) - .def("setDBITPipeline", - (void (Detector::*)(int, sls::Positions)) & - Detector::setDBITPipeline, - py::arg(), py::arg() = Positions{}) .def("getMeasuredVoltage", (Result(Detector::*)(defs::dacIndex, sls::Positions) const) & Detector::getMeasuredVoltage, diff --git a/python/src/main.cpp b/python/src/main.cpp index 291752c34..7afa194b2 100755 --- a/python/src/main.cpp +++ b/python/src/main.cpp @@ -21,6 +21,7 @@ void init_det(py::module &); void init_network(py::module &); void init_pattern(py::module &); void init_scan(py::module &); +void init_source(py::module &); PYBIND11_MODULE(_slsdet, m) { m.doc() = R"pbdoc( C/C++ API @@ -37,6 +38,7 @@ PYBIND11_MODULE(_slsdet, m) { init_network(m); init_pattern(m); init_scan(m); + init_source(m); // init_experimental(m); diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index c4aaa97ce..f5ef865e4 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer index 50f115276..ed694dfd8 100755 Binary files a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer and b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer differ diff --git a/slsDetectorServers/eigerDetectorServer/detid.txt b/slsDetectorServers/eigerDetectorServer/detid.txt index b21aaed88..0f3016682 100755 --- a/slsDetectorServers/eigerDetectorServer/detid.txt +++ b/slsDetectorServers/eigerDetectorServer/detid.txt @@ -1 +1 @@ -beb001 \ No newline at end of file +001 \ No newline at end of file diff --git a/slsDetectorServers/eigerDetectorServer/detid_eiger.txt b/slsDetectorServers/eigerDetectorServer/detid_eiger.txt index b21aaed88..0d21a3cda 100755 --- a/slsDetectorServers/eigerDetectorServer/detid_eiger.txt +++ b/slsDetectorServers/eigerDetectorServer/detid_eiger.txt @@ -1 +1 @@ -beb001 \ No newline at end of file +031 \ No newline at end of file diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index 8a41eab16..44269428c 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 0920aa394..9d7fd73bb 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -288,7 +288,7 @@ u_int32_t getDetectorNumber() { } int getModuleId(int *ret, char *mess) { - return ((bus_r(MOD_ID_REG) & ~MOD_ID_MSK) >> MOD_ID_OFST); + return ((bus_r(MOD_ID_REG) & MOD_ID_MSK) >> MOD_ID_OFST); } void setModuleId(int modid) { diff --git a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer index 7c4f1e21a..4fad0385a 100755 Binary files a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer and b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index 1768fadbd..89b848b5b 100755 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index 52fc32058..5ffd80ed3 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -300,7 +300,7 @@ int isHardwareVersion2() { int getChipVersion() { // chip v1.1 - if (bus_r(DAQ_REG | DAQ_CHIP11_VRSN_MSK)) { + if (bus_r(DAQ_REG) & DAQ_CHIP11_VRSN_MSK) { return 11; } // chip v1.0 @@ -470,6 +470,7 @@ void setupDetector() { initReadoutConfiguration(); // Initialization of acquistion parameters + disableCurrentSource(); setSettings(DEFAULT_SETTINGS); setGainMode(DEFAULT_GAINMODE); @@ -499,7 +500,6 @@ void setupDetector() { setFilterResistor(DEFAULT_FILTER_RESISTOR); setFilterCell(DEFAULT_FILTER_CELL); } - disableCurrentSource(); setReadNRows(MAX_ROWS_PER_READOUT); } @@ -1106,10 +1106,8 @@ enum detectorSettings setSettings(enum detectorSettings sett) { setDAC(specialDacs[i], dacVals[i], 0); } - // if chip 1.1, and power chip on, configure chip - if (getChipVersion() == 11 && powerChip(-1)) { - configureChip(); - } + // if chipv1.1 and powered on + configureChip(); return getSettings(); } @@ -1726,8 +1724,8 @@ int powerChip(int on) { LOG(logINFOBLUE, ("Powering chip: on\n")); bus_w(CHIP_POWER_REG, bus_r(CHIP_POWER_REG) | CHIP_POWER_ENABLE_MSK); - - configureChip(); + + configureChip(); } else { LOG(logINFOBLUE, ("Powering chip: off\n")); bus_w(CHIP_POWER_REG, @@ -1749,14 +1747,26 @@ int isChipConfigured() { } void configureChip() { - // only for chipv1.1 - if (getChipVersion() == 11) { - LOG(logINFOBLUE, ("Configuring chip\n")); + // only for chipv1.1 and chip is powered on + if (getChipVersion() == 11 && powerChip(-1)) { + LOG(logINFOBLUE, ("\tConfiguring chip\n")); + + // waiting 500 ms before configuring selection + usleep(500 * 1000); + + // write same values to configure selection + // if (chip was powered off earlier) + LOG(logINFO, ("\tSetting default values for selection\n")) + bus_w(CRRNT_SRC_COL_LSB_REG, bus_r(CRRNT_SRC_COL_LSB_REG)); + bus_w(CRRNT_SRC_COL_MSB_REG, bus_r(CRRNT_SRC_COL_MSB_REG)); + + // waiting 500 ms before configuring chip + usleep(500 * 1000); + // write same register values back to configure chip bus_w(CONFIG_V11_REG, bus_r(CONFIG_V11_REG)); - // default values for current source - bus_w(CRRNT_SRC_COL_LSB_REG, BIT32_MASK); - bus_w(CRRNT_SRC_COL_MSB_REG, BIT32_MASK); + + LOG(logINFOBLUE, ("\tChip configured\n")); chipConfigured = 1; } } @@ -2203,7 +2213,18 @@ void setFilterCell(int iCell) { void disableCurrentSource() { LOG(logINFO, ("Disabling Current Source\n")); + + // set default values for current source first + if (getChipVersion() == 11) { + LOG(logINFO, ("\tSetting default values for selection\n")) + bus_w(CRRNT_SRC_COL_LSB_REG, BIT32_MASK); + bus_w(CRRNT_SRC_COL_MSB_REG, BIT32_MASK); + } + bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_ENBL_MSK); + LOG(logINFO, ("\tCurrent Source disabled\n")); + + configureChip(); } void enableCurrentSource(int fix, uint64_t select, int normal) { @@ -2216,15 +2237,17 @@ void enableCurrentSource(int fix, uint64_t select, int normal) { fix, (long long int)select, normal)); } disableCurrentSource(); - LOG(logINFO, ("\tSetting current source parameters\n")); // fix if (fix) { + LOG(logINFO, ("\tEnabling fix\n")); bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_CRRNT_SRC_CLMN_FIX_MSK); } else { + LOG(logINFO, ("\tDisabling fix\n")); bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_CLMN_FIX_MSK); } if (getChipVersion() == 10) { // select + LOG(logINFO, ("\tSetting selection\n")) bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_CLMN_SLCT_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) | ((select << DAQ_CRRNT_SRC_CLMN_SLCT_OFST) & @@ -2232,12 +2255,15 @@ void enableCurrentSource(int fix, uint64_t select, int normal) { } else { // select + LOG(logINFO, ("\tSetting selection\n")) set64BitReg(select, CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG); // normal if (normal) { + LOG(logINFO, ("\tEnabling normal\n")) bus_w(CONFIG_V11_REG, bus_r(CONFIG_V11_REG) & ~CONFIG_V11_CRRNT_SRC_LOW_MSK); } else { + LOG(logINFO, ("\tEnabling low\n")) bus_w(CONFIG_V11_REG, bus_r(CONFIG_V11_REG) | CONFIG_V11_CRRNT_SRC_LOW_MSK); } @@ -2252,8 +2278,10 @@ void enableCurrentSource(int fix, uint64_t select, int normal) { // acquisition // enabling current source - LOG(logINFO, ("Enabling Current Source\n")); + LOG(logINFO, ("\tEnabling Current Source\n")); bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_CRRNT_SRC_ENBL_MSK); + + configureChip(); } int getCurrentSource() { diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer index e56a97196..76bd9cefb 100755 Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer index 932f13252..3d102c2df 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ diff --git a/slsDetectorServers/mythen3DetectorServer/detid_mythen3.txt b/slsDetectorServers/mythen3DetectorServer/detid_mythen3.txt index 274c0052d..c22708346 100755 --- a/slsDetectorServers/mythen3DetectorServer/detid_mythen3.txt +++ b/slsDetectorServers/mythen3DetectorServer/detid_mythen3.txt @@ -1 +1 @@ -1234 \ No newline at end of file +0 \ No newline at end of file diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 71b62a216..b70da61c7 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -283,7 +283,7 @@ u_int32_t getDetectorNumber() { int getModuleId(int *ret, char *mess) { - return ((bus_r(MOD_ID_REG) & ~MOD_ID_MSK) >> MOD_ID_OFST); + return ((bus_r(MOD_ID_REG) & MOD_ID_MSK) >> MOD_ID_OFST); } void setModuleId(int modid) { diff --git a/slsDetectorServers/slsDetectorServer/include/common.h b/slsDetectorServers/slsDetectorServer/include/common.h index a05e77bd1..5b6c98a41 100644 --- a/slsDetectorServers/slsDetectorServer/include/common.h +++ b/slsDetectorServers/slsDetectorServer/include/common.h @@ -32,7 +32,6 @@ void validate64(int *ret, char *mess, int64_t arg, int64_t retval, char *modename, enum numberMode nummode); int getModuleIdInFile(int *ret, char *mess, char *fileName); -int setModuleIdInFile(char *mess, int arg, char *fileName); int verifyChecksumFromBuffer(char *mess, char *clientChecksum, char *buffer, ssize_t bytes); int verifyChecksumFromFile(char *mess, char *clientChecksum, char *fname); diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h index 14df33e2b..bedad75f6 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h @@ -87,7 +87,6 @@ int set_roi(int); int get_roi(int); int lock_server(int); int get_last_client_ip(int); -int set_port(int); int calibrate_pedestal(int); int enable_ten_giga(int); int validateAndSetAllTrimbits(int arg); diff --git a/slsDetectorServers/slsDetectorServer/src/common.c b/slsDetectorServers/slsDetectorServer/src/common.c index 85ac9009b..618187215 100644 --- a/slsDetectorServers/slsDetectorServer/src/common.c +++ b/slsDetectorServers/slsDetectorServer/src/common.c @@ -120,7 +120,7 @@ int getModuleIdInFile(int *ret, char *mess, char *fileName) { LOG(logERROR, ("%s\n\n", mess)); return -1; } - LOG(logDEBUG1, ("Reading det id file %s\n", fileName)); + LOG(logINFOBLUE, ("Reading det id file %s\n", fileName)); // read line const size_t len = 256; @@ -134,7 +134,7 @@ int getModuleIdInFile(int *ret, char *mess, char *fileName) { } // read id int retval = 0; - if (sscanf(line, "%x", &retval) != 1) { + if (sscanf(line, "%u", &retval) != 1) { *ret = FAIL; sprintf(mess, "Could not scan det id from on-board server " @@ -143,43 +143,10 @@ int getModuleIdInFile(int *ret, char *mess, char *fileName) { LOG(logERROR, ("%s\n\n", mess)); return -1; } - LOG(logINFOBLUE, ("Module Id: 0x%x (File)\n", retval)); + LOG(logINFOBLUE, ("Module Id: %d (File)\n", retval)); return retval; } -int setModuleIdInFile(char *mess, int arg, char *fileName) { - LOG(logINFOBLUE, ("Setting Module Id: 0x%x (File)\n", arg)); - - const int fileNameSize = 128; - char fname[fileNameSize]; - if (getAbsPath(fname, fileNameSize, fileName) == FAIL) { - strcpy(mess, "Could not find detid file\n"); - LOG(logERROR, (mess)); - return FAIL; - } - - // open id file - FILE *fd = fopen(fname, "r"); - if (fd == NULL) { - strcpy(mess, "Could not find detid file\n"); - LOG(logERROR, (mess)); - return FAIL; - } - LOG(logDEBUG1, ("Writing det id to file %s\n", fileName)); - - // write id - const size_t len = 256; - char line[len]; - memset(line, 0, len); - sprintf(line, "%x", arg); - if (EOF == fputs(line, fd)) { - strcpy(mess, "Could not write to detid file\n"); - LOG(logERROR, (mess)); - return FAIL; - } - return OK; -} - int verifyChecksumFromBuffer(char *mess, char *clientChecksum, char *buffer, ssize_t bytes) { LOG(logINFO, ("\tVerifying Checksum...\n")); diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index a3936c5e8..5c724b10e 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -230,7 +230,6 @@ void function_table() { flist[F_GET_ROI] = &get_roi; flist[F_LOCK_SERVER] = &lock_server; flist[F_GET_LAST_CLIENT_IP] = &get_last_client_ip; - flist[F_SET_PORT] = &set_port; flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga; flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits; flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control; @@ -2880,43 +2879,6 @@ int get_last_client_ip(int file_des) { return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); } -int set_port(int file_des) { - ret = OK; - memset(mess, 0, sizeof(mess)); - int p_number = -1; - uint32_t oldLastClientIP = 0; - - if (receiveData(file_des, &p_number, sizeof(p_number), INT32) < 0) - return printSocketReadError(); - - // set only - int sd = -1; - if ((Server_VerifyLock() == OK)) { - // port number too low - if (p_number < 1024) { - ret = FAIL; - sprintf(mess, "%s port Number (%d) too low\n", - (isControlServer ? "control" : "stop"), p_number); - LOG(logERROR, (mess)); - } else { - LOG(logINFO, ("Setting %s port to %d\n", - (isControlServer ? "control" : "stop"), p_number)); - oldLastClientIP = lastClientIP; - sd = bindSocket(p_number); - } - } - - Server_SendResult(file_des, INT32, &p_number, sizeof(p_number)); - // delete old socket - if (ret != FAIL) { - closeConnection(file_des); - exitServer(sockfd); - sockfd = sd; - lastClientIP = oldLastClientIP; - } - return ret; -} - int enable_ten_giga(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index b69f156a6..e35bd4739 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -1108,12 +1108,6 @@ class Detector { * send data or communicated with FEB or BEB */ void setActive(const bool active, Positions pos = {}); - /** [Eiger] */ - Result getRxPadDeactivatedMode(Positions pos = {}) const; - - /** [Eiger] Pad deactivated modules in receiver. Enabled by default */ - void setRxPadDeactivatedMode(bool pad, Positions pos = {}); - /** [Eiger] Advanced */ Result getPartialReset(Positions pos = {}) const; diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index 5f4842a9a..1cfff609d 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -207,7 +207,8 @@ std::string CmdProxy::Acquire(int action) { "detector acquisition for number of frames set\n\t- monitors " "detector status from running to idle\n\t- stops the receiver " "listener (if enabled)\n\t- increments file index if file write " - "enabled\n\t- resets acquiring flag"; + "enabled\n\t- resets acquiring flag" + << '\n'; } else { if (det->empty()) { throw sls::RuntimeError( @@ -964,9 +965,9 @@ std::string CmdProxy::CurrentSource(int action) { std::ostringstream os; os << cmd << ' '; if (action == defs::HELP_ACTION) { - os << "[0|1]\n\t[Gotthard2] Enable or disable current source. Default " - "is disabled.\n[0|1] [fix|nofix] [select source] [(only for " - "chipv1.1)normal|low]\n\t[Jungfrau] Disable or enable current " + os << "\n\t[0|1]\n\t\t[Gotthard2] Enable or disable current source. Default " + "is disabled.\n\t[0|1] [fix|nofix] [select source] [(only for " + "chipv1.1)normal|low]\n\t\t[Jungfrau] Disable or enable current " "source with some parameters. The select source is 0-63 for " "chipv1.0 and a 64 bit mask for chipv1.1. To disable, one needs " "only one argument '0'." @@ -1337,9 +1338,9 @@ std::string CmdProxy::Trigger(int action) { os << cmd << ' '; if (action == defs::HELP_ACTION) { if (cmd == "trigger") { - os << "[Eiger][Mythen3] Sends software trigger signal to detector"; + os << "\n\t[Eiger][Mythen3] Sends software trigger signal to detector"; } else if (cmd == "blockingtrigger") { - os << "[Eiger] Sends software trigger signal to detector and " + os << "\n\t[Eiger] Sends software trigger signal to detector and " "blocks till " "the frames are sent out for that trigger."; } else { @@ -1423,9 +1424,9 @@ std::string CmdProxy::UDPDestinationList(int action) { std::ostringstream os; os << cmd << ' '; if (action == defs::HELP_ACTION) { - os << "[entry=n_val] [ip=x.x.x.x] [(optional)ip2=x.x.x.x] " - "\n[mac=xx:xx:xx:xx:xx:xx] " - "[(optional)mac2=xx:xx:xx:xx:xx:xx]\n[port=value] " + os << "[ip=x.x.x.x] [(optional)ip2=x.x.x.x] " + "\n\t[mac=xx:xx:xx:xx:xx:xx] " + "[(optional)mac2=xx:xx:xx:xx:xx:xx]\n\t[port=value] " "[(optional)port2=value\n\tThe order of ip, mac and port does " "not matter. entry_value can be >0 only for Eiger and Jungfrau " "where round robin is implemented. If 'auto' used, then ip is " @@ -1607,8 +1608,8 @@ std::string CmdProxy::ZMQHWM(int action) { if (action == defs::HELP_ACTION) { os << "[n_limit] \n\tClient's zmq receive high water mark. Default is " "the zmq library's default (1000), can also be set here using " - "-1. \n This is a high number and can be set to 2 for gui " - "purposes. \n One must also set the receiver's send high water " + "-1. \n\tThis is a high number and can be set to 2 for gui " + "purposes. \n\tOne must also set the receiver's send high water " "mark to similar value. Final effect is sum of them.\n\t Setting " "it via command line is useful only before zmq enabled (before " "opening gui)." @@ -1668,50 +1669,6 @@ std::string CmdProxy::RateCorrection(int action) { return os.str(); } -std::string CmdProxy::Activate(int action) { - std::ostringstream os; - os << cmd << ' '; - if (action == defs::HELP_ACTION) { - os << "[0, 1] [(optional) padding|nopadding]\n\t[Eiger] 1 is default. " - "0 deactivates readout and does not send data. \n\tPadding will " - "pad data files for deactivates readouts." - << '\n'; - } else if (action == defs::GET_ACTION) { - if (!args.empty()) { - WrongNumberOfParameters(0); - } - auto t = det->getActive(std::vector{det_id}); - auto p = det->getRxPadDeactivatedMode(std::vector{det_id}); - Result pResult(p.size()); - for (unsigned int i = 0; i < p.size(); ++i) { - pResult[i] = p[i] ? "padding" : "nopadding"; - } - os << OutString(t) << ' ' << OutString(pResult) << '\n'; - } else if (action == defs::PUT_ACTION) { - if (args.empty() || args.size() > 2) { - WrongNumberOfParameters(2); - } - int t = StringTo(args[0]); - det->setActive(t, std::vector{det_id}); - os << args[0]; - if (args.size() == 2) { - bool p = true; - if (args[1] == "nopadding") { - p = false; - } else if (args[1] != "padding") { - throw sls::RuntimeError( - "Unknown argument for deactivated padding."); - } - det->setRxPadDeactivatedMode(p, std::vector{det_id}); - os << ' ' << args[1]; - } - os << '\n'; - } else { - throw sls::RuntimeError("Unknown action"); - } - return os.str(); -} - std::string CmdProxy::PulsePixel(int action) { std::ostringstream os; os << cmd << ' '; diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index 7f89cc65b..2424f89cd 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -925,7 +925,7 @@ class CmdProxy { {"interruptsubframe", &CmdProxy::interruptsubframe}, {"measuredperiod", &CmdProxy::measuredperiod}, {"measuredsubperiod", &CmdProxy::measuredsubperiod}, - {"activate", &CmdProxy::Activate}, + {"activate", &CmdProxy::activate}, {"partialreset", &CmdProxy::partialreset}, {"pulse", &CmdProxy::PulsePixel}, {"pulsenmove", &CmdProxy::PulsePixelAndMove}, @@ -1131,7 +1131,6 @@ class CmdProxy { std::string ZMQHWM(int action); /* Eiger Specific */ std::string RateCorrection(int action); - std::string Activate(int action); std::string PulsePixel(int action); std::string PulsePixelAndMove(int action); std::string PulseChip(int action); @@ -1206,7 +1205,7 @@ class CmdProxy { "\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]" "Serial number of detector."); - GET_COMMAND_HEX( + GET_COMMAND( moduleid, getModuleId, "\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) " "that is streamed out in the UDP header of the detector. Picked up from a file on the module."); @@ -1381,9 +1380,9 @@ class CmdProxy { INTEGER_COMMAND_VEC_ID( readnrows, getReadNRows, setReadNRows, StringTo, - "[1 - 256]\n\t[Eiger] Number of rows to readout per half module " + "\n\t[1-256]\n\t\t[Eiger] Number of rows to readout per half module " "starting from the centre. Options: 0 - 256. 256 is default. The " - "permissible values depend on dynamic range and 10Gbe enabled.\n[8-512 (multiple of 8)]\n\t[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512."); + "permissible values depend on dynamic range and 10Gbe enabled.\n\t[8-512 (multiple of 8)]\n\t\t[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512."); /** temperature */ GET_COMMAND_NOID( @@ -1857,6 +1856,11 @@ class CmdProxy { "[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub " "frame period between last sub frame and previous one."); + + INTEGER_COMMAND_VEC_ID( + activate, getActive, setActive, StringTo, + "[0, 1] \n\t[Eiger] 1 is default. 0 deactivates readout and does not send data."); + INTEGER_COMMAND_VEC_ID( partialreset, getPartialReset, setPartialReset, StringTo, "[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at " diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 26ad92ec4..ccb8e8b40 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -1450,13 +1450,6 @@ void Detector::setActive(const bool active, Positions pos) { pimpl->Parallel(&Module::setActivate, pos, active); } -Result Detector::getRxPadDeactivatedMode(Positions pos) const { - return pimpl->Parallel(&Module::getDeactivatedRxrPaddingMode, pos); -} - -void Detector::setRxPadDeactivatedMode(bool pad, Positions pos) { - pimpl->Parallel(&Module::setDeactivatedRxrPaddingMode, pos, pad); -} Result Detector::getPartialReset(Positions pos) const { return pimpl->Parallel(&Module::getCounterBit, pos); @@ -2158,6 +2151,7 @@ void Detector::setAdditionalJsonParameter(const std::string &key, void Detector::programFPGA(const std::string &fname, Positions pos) { std::vector buffer = pimpl->readProgrammingFile(fname); pimpl->Parallel(&Module::programFPGA, pos, buffer); + rebootController(pos); } void Detector::resetFPGA(Positions pos) { @@ -2180,7 +2174,6 @@ void Detector::updateFirmwareAndServer(const std::string &sname, Positions pos) { pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname); programFPGA(fname, pos); - rebootController(pos); } Result Detector::readRegister(uint32_t addr, Positions pos) const { diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index efbff8a2a..f80b383a1 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -1312,12 +1312,7 @@ int Module::getReceiverPort(const int rxIndex) const { return shm()->receivers[r int Module::setReceiverPort(int port_number, const int rxIndex) { if (port_number >= 0 && port_number != shm()->receivers[rxIndex].tcpPort) { - if (shm()->useReceiverFlag) { - shm()->receivers[rxIndex].tcpPort = - sendToReceiver(rxIndex, F_SET_RECEIVER_PORT, port_number); - } else { - shm()->receivers[rxIndex].tcpPort = port_number; - } + shm()->receivers[rxIndex].tcpPort = port_number; } return shm()->receivers[rxIndex].tcpPort; } @@ -1707,17 +1702,6 @@ void Module::setActivate(const bool enable) { } } -bool Module::getDeactivatedRxrPaddingMode() const { - const int rxIndex = 0; - return sendToReceiver(rxIndex, F_GET_RECEIVER_DEACTIVATED_PADDING); -} - -void Module::setDeactivatedRxrPaddingMode(bool padding) { - const int rxIndex = -1; - sendToReceiver(rxIndex, F_SET_RECEIVER_DEACTIVATED_PADDING, - static_cast(padding), nullptr); -} - bool Module::getCounterBit() const { return ( !static_cast(sendToDetector(F_SET_COUNTER_BIT, GET_FLAG))); @@ -2738,21 +2722,13 @@ void Module::setADCInvert(uint32_t value) { int Module::getControlPort() const { return shm()->controlPort; } void Module::setControlPort(int port_number) { - if (strlen(shm()->hostname) > 0) { - shm()->controlPort = sendToDetector(F_SET_PORT, port_number); - } else { - shm()->controlPort = port_number; - } + shm()->controlPort = port_number; } int Module::getStopPort() const { return shm()->stopPort; } void Module::setStopPort(int port_number) { - if (strlen(shm()->hostname) > 0) { - shm()->stopPort = sendToDetectorStop(F_SET_PORT, port_number); - } else { - shm()->stopPort = port_number; - } + shm()->stopPort = port_number; } bool Module::getLockDetector() const { @@ -3712,12 +3688,7 @@ void Module::programFPGAviaBlackfin(std::vector buffer) { << " returned error: " << client.readErrorMessage(); throw RuntimeError(os.str()); } - if (moduleIndex == 0) { - LOG(logINFO) << "Copied to flash and checksum verified"; - } - LOG(logINFO) << "FPGA programmed successfully"; - rebootController(); } void Module::programFPGAviaNios(std::vector buffer) { @@ -3795,6 +3766,5 @@ void Module::programFPGAviaNios(std::vector buffer) { throw RuntimeError(os.str()); } LOG(logINFO) << "FPGA programmed successfully"; - rebootController(); } } // namespace sls diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 276f655c8..1647ebcff 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -357,8 +357,6 @@ class Module : public virtual slsDetectorDefs { int64_t getMeasuredSubFramePeriod() const; bool getActivate() const; void setActivate(const bool enable); - bool getDeactivatedRxrPaddingMode() const; - void setDeactivatedRxrPaddingMode(bool padding); bool getCounterBit() const; void setCounterBit(bool cb); void pulsePixel(int n = 0, int x = 0, int y = 0); diff --git a/slsDetectorSoftware/tests/test-CmdProxy-pattern.cpp b/slsDetectorSoftware/tests/test-CmdProxy-pattern.cpp index 1f7d4db45..611cc9163 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-pattern.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-pattern.cpp @@ -55,7 +55,7 @@ TEST_CASE("defaultpattern", "[.cmd]") { REQUIRE_NOTHROW(proxy.Call("defaultpattern", {}, -1, PUT)); } else { REQUIRE_THROWS(proxy.Call("defaultpattern", {}, -1, GET)); - REQUIRE_NOTHROW(proxy.Call("defaultpattern", {}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("defaultpattern", {}, -1, PUT)); } } diff --git a/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp b/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp index 02eca29d5..ed4f1ce7b 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp @@ -190,7 +190,6 @@ TEST_CASE("rx_tcpport", "[.cmd][.rx]") { proxy.Call("rx_tcpport", {}, i, GET, oss); REQUIRE(oss.str() == "rx_tcpport " + std::to_string(port + i) + '\n'); } - REQUIRE_THROWS(proxy.Call("rx_tcpport", {"15"}, -1, PUT)); port = 5754; proxy.Call("rx_tcpport", {std::to_string(port)}, -1, PUT); for (int i = 0; i != det.size(); ++i) { diff --git a/slsDetectorSoftware/tests/test-CmdProxy.cpp b/slsDetectorSoftware/tests/test-CmdProxy.cpp index 5351f5570..e72ae63ba 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy.cpp @@ -1754,29 +1754,29 @@ TEST_CASE("defaultdac", "[.cmd]") { } } if (det_type == defs::JUNGFRAU) { - std::vector daclist = {defs::VB_COMP, defs::VREF_DS, + std::vector daclist = {defs::VREF_PRECH, defs::VREF_DS, defs::VREF_COMP}; for (auto it : daclist) { auto dacname = sls::ToString(it); - auto prev_val = det.getDefaultDac(it, defs::DYNAMICGAIN); + auto prev_val = det.getDefaultDac(it, defs::GAIN0); { std::ostringstream oss; - proxy.Call("defaultdac", {dacname, "1000", "dynamicgain"}, -1, + proxy.Call("defaultdac", {dacname, "1000", "gain0"}, -1, PUT, oss); REQUIRE(oss.str() == std::string("defaultdac ") + dacname + - std::string(" dynamicgain 1000\n")); + std::string(" gain0 1000\n")); } { std::ostringstream oss; - proxy.Call("defaultdac", {dacname, "dynamicgain"}, -1, GET, + proxy.Call("defaultdac", {dacname, "gain0"}, -1, GET, oss); REQUIRE(oss.str() == std::string("defaultdac ") + dacname + - std::string(" dynamicgain 1000\n")); + std::string(" gain0 1000\n")); } for (int i = 0; i != det.size(); ++i) { - det.setDefaultDac(it, prev_val[i], defs::DYNAMICGAIN, {i}); + det.setDefaultDac(it, prev_val[i], defs::GAIN0, {i}); } } } @@ -2240,7 +2240,8 @@ TEST_CASE("udp_cleardst", "[.cmd]") { Detector det; CmdProxy proxy(&det); REQUIRE_THROWS(proxy.Call("udp_cleardst", {}, -1, GET)); - REQUIRE_NOTHROW(proxy.Call("udp_cleardst", {}, -1, PUT)); + /* dont clear all udp destinations */ + /*REQUIRE_NOTHROW(proxy.Call("udp_cleardst", {}, -1, PUT));*/ } TEST_CASE("udp_firstdst", "[.cmd]") { @@ -2252,18 +2253,20 @@ TEST_CASE("udp_firstdst", "[.cmd]") { { std::ostringstream oss; proxy.Call("udp_firstdst", {"0"}, -1, PUT, oss); - REQUIRE(oss.str() == "udp_firstdst 10\n"); + REQUIRE(oss.str() == "udp_firstdst 0\n"); } { std::ostringstream oss; proxy.Call("udp_firstdst", {}, -1, GET, oss); REQUIRE(oss.str() == "udp_firstdst 0\n"); } + /* { std::ostringstream oss; proxy.Call("udp_firstdst", {"1"}, -1, PUT, oss); REQUIRE(oss.str() == "udp_firstdst 1\n"); } + */ REQUIRE_THROWS(proxy.Call("udp_firstdst", {"33"}, -1, PUT)); for (int i = 0; i != det.size(); ++i) { @@ -2291,7 +2294,9 @@ TEST_CASE("udp_srcmac", "[.cmd]") { REQUIRE(oss.str() == "udp_srcmac 00:50:c2:42:34:12\n"); } for (int i = 0; i != det.size(); ++i) { - det.setSourceUDPMAC(prev_val[i], {i}); + if (prev_val[i].str() != "00:00:00:00:00:00") { + det.setSourceUDPMAC(prev_val[i], {i}); + } } } @@ -2361,7 +2366,9 @@ TEST_CASE("udp_srcmac2", "[.cmd]") { REQUIRE(oss.str() == "udp_srcmac2 00:50:c2:42:34:12\n"); } for (int i = 0; i != det.size(); ++i) { - det.setSourceUDPMAC2(prev_val[i], {i}); + if (prev_val[i].str() != "00:00:00:00:00:00") { + det.setSourceUDPMAC2(prev_val[i], {i}); + } } } else { REQUIRE_THROWS(proxy.Call("udp_srcmac2", {}, -1, GET)); diff --git a/slsReceiverSoftware/src/ClientInterface.cpp b/slsReceiverSoftware/src/ClientInterface.cpp index 12b1a3c35..b6cb23af2 100644 --- a/slsReceiverSoftware/src/ClientInterface.cpp +++ b/slsReceiverSoftware/src/ClientInterface.cpp @@ -113,7 +113,6 @@ void ClientInterface::startTCPServer() { int ClientInterface::functionTable(){ flist[F_LOCK_RECEIVER] = &ClientInterface::lock_receiver; flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip; - flist[F_SET_RECEIVER_PORT] = &ClientInterface::set_port; flist[F_GET_RECEIVER_VERSION] = &ClientInterface::get_version; flist[F_SETUP_RECEIVER] = &ClientInterface::setup_receiver; flist[F_RECEIVER_SET_ROI] = &ClientInterface::set_roi; @@ -178,8 +177,6 @@ int ClientInterface::functionTable(){ flist[F_GET_RECEIVER_DISCARD_POLICY] = &ClientInterface::get_discard_policy; flist[F_SET_RECEIVER_PADDING] = &ClientInterface::set_padding_enable; flist[F_GET_RECEIVER_PADDING] = &ClientInterface::get_padding_enable; - flist[F_SET_RECEIVER_DEACTIVATED_PADDING] = &ClientInterface::set_deactivated_padding_enable; - flist[F_GET_RECEIVER_DEACTIVATED_PADDING] = &ClientInterface::get_deactivated_padding_enable; flist[F_RECEIVER_SET_READOUT_MODE] = &ClientInterface::set_readout_mode; flist[F_RECEIVER_SET_ADC_MASK] = &ClientInterface::set_adc_mask; flist[F_SET_RECEIVER_DBIT_LIST] = &ClientInterface::set_dbit_list; @@ -302,21 +299,6 @@ int ClientInterface::get_last_client_ip(Interface &socket) { return socket.sendResult(server.getLastClient()); } -int ClientInterface::set_port(Interface &socket) { - auto p_number = socket.Receive(); - if (p_number < 1024) - throw RuntimeError("Port Number: " + std::to_string(p_number) + - " is too low (<1024)"); - - LOG(logINFO) << "TCP port set to " << p_number << std::endl; - sls::ServerSocket new_server(p_number); - new_server.setLockedBy(server.getLockedBy()); - new_server.setLastClient(server.getThisClient()); - server = std::move(new_server); - socket.sendResult(p_number); - return OK; -} - int ClientInterface::get_version(Interface &socket) { return socket.sendResult(getReceiverVersion()); } @@ -1275,29 +1257,6 @@ int ClientInterface::get_padding_enable(Interface &socket) { return socket.sendResult(retval); } -int ClientInterface::set_deactivated_padding_enable(Interface &socket) { - auto enable = socket.Receive(); - if (detType != EIGER) { - functionNotImplemented(); - } - if (enable < 0) { - throw RuntimeError("Invalid Deactivated padding: " + - std::to_string(enable)); - } - verifyIdle(socket); - LOG(logDEBUG1) << "Setting deactivated padding enable: " << enable; - impl()->setDeactivatedPadding(enable > 0); - return socket.Send(OK); -} - -int ClientInterface::get_deactivated_padding_enable(Interface &socket) { - if (detType != EIGER) - functionNotImplemented(); - auto retval = static_cast(impl()->getDeactivatedPadding()); - LOG(logDEBUG1) << "Deactivated Padding Enable: " << retval; - return socket.sendResult(retval); -} - int ClientInterface::set_readout_mode(Interface &socket) { auto arg = socket.Receive(); diff --git a/slsReceiverSoftware/src/ClientInterface.h b/slsReceiverSoftware/src/ClientInterface.h index 41b94b70a..d362edabd 100644 --- a/slsReceiverSoftware/src/ClientInterface.h +++ b/slsReceiverSoftware/src/ClientInterface.h @@ -62,7 +62,6 @@ class ClientInterface : private virtual slsDetectorDefs { int lock_receiver(sls::ServerInterface &socket); int get_last_client_ip(sls::ServerInterface &socket); - int set_port(sls::ServerInterface &socket); int get_version(sls::ServerInterface &socket); int setup_receiver(sls::ServerInterface &socket); void setDetectorType(detectorType arg); @@ -129,8 +128,6 @@ class ClientInterface : private virtual slsDetectorDefs { int get_discard_policy(sls::ServerInterface &socket); int set_padding_enable(sls::ServerInterface &socket); int get_padding_enable(sls::ServerInterface &socket); - int set_deactivated_padding_enable(sls::ServerInterface &socket); - int get_deactivated_padding_enable(sls::ServerInterface &socket); int set_readout_mode(sls::ServerInterface &socket); int set_adc_mask(sls::ServerInterface &socket); int set_dbit_list(sls::ServerInterface &socket); diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index 699657b0f..2a420f924 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -27,8 +27,7 @@ const std::string DataProcessor::typeName_ = "DataProcessor"; DataProcessor::DataProcessor(int index, detectorType detectorType, Fifo *fifo, - bool *activated, bool *deactivatedPaddingEnable, - bool *dataStreamEnable, + bool *activated, bool *dataStreamEnable, uint32_t *streamingFrequency, uint32_t *streamingTimerInMs, uint32_t *streamingStartFnum, bool *framePadding, @@ -36,7 +35,6 @@ DataProcessor::DataProcessor(int index, detectorType detectorType, Fifo *fifo, int *ctbAnalogDataBytes, std::mutex *hdf5Lib) : ThreadObject(index, typeName_), fifo_(fifo), detectorType_(detectorType), dataStreamEnable_(dataStreamEnable), activated_(activated), - deactivatedPaddingEnable_(deactivatedPaddingEnable), streamingFrequency_(streamingFrequency), streamingTimerInMs_(streamingTimerInMs), streamingStartFnum_(streamingStartFnum), framePadding_(framePadding), @@ -169,13 +167,8 @@ void DataProcessor::CreateFirstFiles( overWriteEnable, silentMode, attr); } - // deactivated with padding enabled, dont write file - if (!*activated_ && !*deactivatedPaddingEnable_) { - return; - } - - // deactivated port, dont write file - if (!detectorDataStream) { + // deactivated (half module/ single port), dont write file + if ((!*activated_) || (!detectorDataStream)) { return; } @@ -372,10 +365,6 @@ uint64_t DataProcessor::ProcessAnImage(char *buf) { if (*activated_ && *framePadding_ && nump < generalData_->packetsPerFrame) PadMissingPackets(buf); - // deactivated and padding enabled - else if (!*activated_ && *deactivatedPaddingEnable_) - PadMissingPackets(buf); - // rearrange ctb digital bits (if ctbDbitlist is not empty) if (!(*ctbDbitList_).empty()) { RearrangeDbitData(buf); diff --git a/slsReceiverSoftware/src/DataProcessor.h b/slsReceiverSoftware/src/DataProcessor.h index 7b8db99f8..0d51e6a14 100644 --- a/slsReceiverSoftware/src/DataProcessor.h +++ b/slsReceiverSoftware/src/DataProcessor.h @@ -26,8 +26,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject { public: DataProcessor(int index, detectorType detectorType, Fifo *fifo, - bool *activated, bool *deactivatedPaddingEnable, - bool *dataStreamEnable, uint32_t *streamingFrequency, + bool *activated, bool *dataStreamEnable, uint32_t *streamingFrequency, uint32_t *streamingTimerInMs, uint32_t *streamingStartFnum, bool *framePadding, std::vector *ctbDbitList, int *ctbDbitOffset, int *ctbAnalogDataBytes, @@ -161,7 +160,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject { detectorType detectorType_; bool *dataStreamEnable_; bool *activated_; - bool *deactivatedPaddingEnable_; /** if 0, sending random images with a timer */ uint32_t *streamingFrequency_; uint32_t *streamingTimerInMs_; diff --git a/slsReceiverSoftware/src/Implementation.cpp b/slsReceiverSoftware/src/Implementation.cpp index 0e665708c..8e4976d54 100644 --- a/slsReceiverSoftware/src/Implementation.cpp +++ b/slsReceiverSoftware/src/Implementation.cpp @@ -167,9 +167,9 @@ void Implementation::setDetectorType(const detectorType d) { i, detType, fifo_ptr, &status, &udpPortNum[i], ð[i], &numberOfTotalFrames, &udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode, - &activated, &detectorDataStream[i], &deactivatedPaddingEnable, &silentMode)); + &activated, &detectorDataStream[i], &silentMode)); dataProcessor.push_back(sls::make_unique( - i, detType, fifo_ptr, &activated, &deactivatedPaddingEnable, + i, detType, fifo_ptr, &activated, &dataStreamEnable, &streamingFrequency, &streamingTimerInMs, &streamingStartFnum, &framePadding, &ctbDbitList, &ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib)); @@ -880,12 +880,11 @@ void Implementation::setNumberofUDPInterfaces(const int n) { i, detType, fifo_ptr, &status, &udpPortNum[i], ð[i], &numberOfTotalFrames, &udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile, - &frameDiscardMode, &activated, &detectorDataStream[i], &deactivatedPaddingEnable, - &silentMode)); + &frameDiscardMode, &activated, &detectorDataStream[i], &silentMode)); listener[i]->SetGeneralData(generalData); dataProcessor.push_back(sls::make_unique( - i, detType, fifo_ptr, &activated, &deactivatedPaddingEnable, + i, detType, fifo_ptr, &activated, &dataStreamEnable, &streamingFrequency, &streamingTimerInMs, &streamingStartFnum, &framePadding, &ctbDbitList, &ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib)); @@ -1530,16 +1529,6 @@ void Implementation::setDetectorDataStream(const portPosition port, << " Port): " << sls::ToString(detectorDataStream[index]); } -bool Implementation::getDeactivatedPadding() const { - return deactivatedPaddingEnable; -} - -void Implementation::setDeactivatedPadding(bool enable) { - deactivatedPaddingEnable = enable; - LOG(logINFO) << "Deactivated Padding Enable: " - << (deactivatedPaddingEnable ? "enabled" : "disabled"); -} - int Implementation::getReadNRows() const { return readNRows; } void Implementation::setReadNRows(const int value) { diff --git a/slsReceiverSoftware/src/Implementation.h b/slsReceiverSoftware/src/Implementation.h index 4d7093b3c..99708fb86 100644 --- a/slsReceiverSoftware/src/Implementation.h +++ b/slsReceiverSoftware/src/Implementation.h @@ -215,9 +215,6 @@ class Implementation : private virtual slsDetectorDefs { /** [Eiger] If datastream is disabled, receiver will create dummy data if deactivated * padding for that port is enabled (as it will receive nothing from detector) */ void setDetectorDataStream(const portPosition port, const bool enable); - bool getDeactivatedPadding() const; - /* [Eiger] */ - void setDeactivatedPadding(const bool enable); int getReadNRows() const; /* [Eiger][Jungfrau] */ void setReadNRows(const int value); @@ -351,7 +348,6 @@ class Implementation : private virtual slsDetectorDefs { bool quadEnable{false}; bool activated{true}; std::array detectorDataStream = {{true, true}}; - bool deactivatedPaddingEnable{true}; int readNRows{0}; int thresholdEnergyeV{-1}; std::array thresholdAllEnergyeV = {{-1, -1, -1}}; diff --git a/slsReceiverSoftware/src/Listener.cpp b/slsReceiverSoftware/src/Listener.cpp index c275cf941..0a907f786 100644 --- a/slsReceiverSoftware/src/Listener.cpp +++ b/slsReceiverSoftware/src/Listener.cpp @@ -22,11 +22,11 @@ const std::string Listener::TypeName = "Listener"; Listener::Listener(int ind, detectorType dtype, Fifo *f, std::atomic *s, uint32_t *portno, std::string *e, uint64_t *nf, int *us, int *as, uint32_t *fpf, - frameDiscardPolicy *fdp, bool *act, bool* detds, bool *depaden, bool *sm) + frameDiscardPolicy *fdp, bool *act, bool* detds, bool *sm) : ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), status(s), udpPortNumber(portno), eth(e), numImages(nf), udpSocketBufferSize(us), actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp), - activated(act), detectorDataStream(detds), deactivatedPaddingEnable(depaden), silentMode(sm) { + activated(act), detectorDataStream(detds), silentMode(sm) { LOG(logDEBUG) << "Listener " << ind << " created"; } @@ -299,24 +299,7 @@ uint32_t Listener::ListenToAnImage(char *buf) { } // deactivated (eiger) if (!(*activated)) { - // no padding - if (!(*deactivatedPaddingEnable)) - return 0; - // padding without setting bitmask (all missing packets padded in - // dataProcessor) - if (currentFrameIndex >= *numImages) - return 0; - - //(eiger) first fnum starts at 1 - if (!currentFrameIndex) { - ++currentFrameIndex; - } - new_header->detHeader.frameNumber = currentFrameIndex; - new_header->detHeader.row = row; - new_header->detHeader.column = column; - new_header->detHeader.detType = (uint8_t)generalData->myDetectorType; - new_header->detHeader.version = (uint8_t)SLS_DETECTOR_HEADER_VERSION; - return imageSize; + return 0; } // look for carry over diff --git a/slsReceiverSoftware/src/Listener.h b/slsReceiverSoftware/src/Listener.h index eff5800dc..a7e432aa6 100644 --- a/slsReceiverSoftware/src/Listener.h +++ b/slsReceiverSoftware/src/Listener.h @@ -38,13 +38,11 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject { * @param fdp frame discard policy * @param act pointer to activated * @param detds pointer to detector data stream - * @param depaden pointer to deactivated padding enable * @param sm pointer to silent mode */ Listener(int ind, detectorType dtype, Fifo *f, std::atomic *s, uint32_t *portno, std::string *e, uint64_t *nf, int *us, int *as, - uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, bool* detds, bool *depaden, - bool *sm); + uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, bool* detds, bool *sm); /** * Destructor @@ -191,9 +189,6 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject { /** detector data stream */ bool* detectorDataStream; - /** Deactivated padding enable */ - bool *deactivatedPaddingEnable; - /** Silent Mode */ bool *silentMode; diff --git a/slsSupportLib/include/sls/sls_detector_funcs.h b/slsSupportLib/include/sls/sls_detector_funcs.h index cd0fe477e..f6215dce6 100755 --- a/slsSupportLib/include/sls/sls_detector_funcs.h +++ b/slsSupportLib/include/sls/sls_detector_funcs.h @@ -69,7 +69,6 @@ enum detFuncs { F_GET_ROI, F_LOCK_SERVER, F_GET_LAST_CLIENT_IP, - F_SET_PORT, F_ENABLE_TEN_GIGA, F_SET_ALL_TRIMBITS, F_SET_PATTERN_IO_CONTROL, @@ -258,7 +257,6 @@ enum detFuncs { F_EXEC_RECEIVER_COMMAND, F_LOCK_RECEIVER, F_GET_LAST_RECEIVER_CLIENT_IP, - F_SET_RECEIVER_PORT, F_GET_RECEIVER_VERSION, F_RECEIVER_SET_ROI, F_RECEIVER_SET_NUM_FRAMES, @@ -322,8 +320,6 @@ enum detFuncs { F_GET_RECEIVER_DISCARD_POLICY, F_SET_RECEIVER_PADDING, F_GET_RECEIVER_PADDING, - F_SET_RECEIVER_DEACTIVATED_PADDING, - F_GET_RECEIVER_DEACTIVATED_PADDING, F_RECEIVER_SET_READOUT_MODE, F_RECEIVER_SET_ADC_MASK, F_SET_RECEIVER_DBIT_LIST, @@ -427,7 +423,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_GET_ROI: return "F_GET_ROI"; case F_LOCK_SERVER: return "F_LOCK_SERVER"; case F_GET_LAST_CLIENT_IP: return "F_GET_LAST_CLIENT_IP"; - case F_SET_PORT: return "F_SET_PORT"; case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA"; case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS"; case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL"; @@ -614,7 +609,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_EXEC_RECEIVER_COMMAND: return "F_EXEC_RECEIVER_COMMAND"; case F_LOCK_RECEIVER: return "F_LOCK_RECEIVER"; case F_GET_LAST_RECEIVER_CLIENT_IP: return "F_GET_LAST_RECEIVER_CLIENT_IP"; - case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT"; case F_GET_RECEIVER_VERSION: return "F_GET_RECEIVER_VERSION"; case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI"; case F_RECEIVER_SET_NUM_FRAMES: return "F_RECEIVER_SET_NUM_FRAMES"; @@ -678,8 +672,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_GET_RECEIVER_DISCARD_POLICY: return "F_GET_RECEIVER_DISCARD_POLICY"; case F_SET_RECEIVER_PADDING: return "F_SET_RECEIVER_PADDING"; case F_GET_RECEIVER_PADDING: return "F_GET_RECEIVER_PADDING"; - case F_SET_RECEIVER_DEACTIVATED_PADDING: return "F_SET_RECEIVER_DEACTIVATED_PADDING"; - case F_GET_RECEIVER_DEACTIVATED_PADDING: return "F_GET_RECEIVER_DEACTIVATED_PADDING"; case F_RECEIVER_SET_READOUT_MODE: return "F_RECEIVER_SET_READOUT_MODE"; case F_RECEIVER_SET_ADC_MASK: return "F_RECEIVER_SET_ADC_MASK"; case F_SET_RECEIVER_DBIT_LIST: return "F_SET_RECEIVER_DBIT_LIST"; diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 11cb0f33e..0bd059325 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -1,13 +1,13 @@ /** API versions */ #define GITBRANCH "udp_numdst" -#define APICTB 0x210917 -#define APIGOTTHARD 0x210917 -#define APIMYTHEN3 0x210917 -#define APIMOENCH 0x210917 -#define APIEIGER 0x210917 #define APILIB 0x210917 #define APIRECEIVER 0x210917 #define APIGUI 0x210819 -#define APIJUNGFRAU 0x210927 -#define APIGOTTHARD2 0x210927 +#define APICTB 0x211005 +#define APIGOTTHARD 0x211005 +#define APIGOTTHARD2 0x211005 +#define APIMYTHEN3 0x211005 +#define APIMOENCH 0x210927 +#define APIEIGER 0x211005 +#define APIJUNGFRAU 0x211007