From 2b2533f465cce3a41725a19291b331d135c3b1bf Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 22 Feb 2022 15:23:04 +0100 Subject: [PATCH] allowing setmaster for eiger --- RELEASE.txt | 1 + slsDetectorServers/eigerDetectorServer/Beb.c | 4 +- slsDetectorServers/eigerDetectorServer/Beb.h | 2 +- .../eigerDetectorServer/FebControl.c | 23 ++- .../eigerDetectorServer/FebControl.h | 2 +- .../slsDetectorFunctionList.c | 183 ++++++++++++------ .../slsDetectorFunctionList.c | 5 +- .../slsDetectorFunctionList.c | 8 +- .../include/slsDetectorFunctionList.h | 14 +- .../include/slsDetectorServer_funcs.h | 1 + .../src/slsDetectorServer_funcs.c | 47 ++++- slsDetectorSoftware/include/sls/Detector.h | 9 +- slsDetectorSoftware/src/CmdProxy.h | 1 + slsDetectorSoftware/src/Detector.cpp | 15 +- slsDetectorSoftware/src/Module.cpp | 8 +- slsDetectorSoftware/src/Module.h | 5 +- .../include/sls/sls_detector_funcs.h | 2 + 17 files changed, 247 insertions(+), 83 deletions(-) diff --git a/RELEASE.txt b/RELEASE.txt index 84b3f2e9e..3ec22a1ef 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -40,6 +40,7 @@ This document describes the differences between v7.0.0 and v6.x.x - when in discard partial frames or empty mode, the frame number doesnt increase by 1, it increases to that number (so its faster) - file write disabled by default - start non blocking acquisition at modular level +- connect master commands to api (allow set master for eiger) 2. Resolved Issues diff --git a/slsDetectorServers/eigerDetectorServer/Beb.c b/slsDetectorServers/eigerDetectorServer/Beb.c index 90512c7b1..f1e756b82 100644 --- a/slsDetectorServers/eigerDetectorServer/Beb.c +++ b/slsDetectorServers/eigerDetectorServer/Beb.c @@ -177,7 +177,7 @@ void Beb_AdjustIPChecksum(struct udp_header_type *ip) { ip->ip_header_checksum[1] = ip_checksum & 0xff; } -void Beb_GetModuleConfiguration(int *master, int *top, int *normal) { +int Beb_GetModuleConfiguration(int *master, int *top, int *normal) { *top = 0; *master = 0; // mapping new memory to read master top module configuration @@ -187,6 +187,7 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) { int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR); if (fd < 0) { LOG(logERROR, ("Module Configuration FAIL\n")); + return FAIL; } else { // read data ret = Beb_Read32(csp0base, BEB_CONFIG_RD_OFST); @@ -202,6 +203,7 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) { // close file pointer Beb_close(fd, csp0base); } + return OK; } int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) { diff --git a/slsDetectorServers/eigerDetectorServer/Beb.h b/slsDetectorServers/eigerDetectorServer/Beb.h index a238c1529..ab84584ea 100644 --- a/slsDetectorServers/eigerDetectorServer/Beb.h +++ b/slsDetectorServers/eigerDetectorServer/Beb.h @@ -15,7 +15,7 @@ int Beb_SetHeaderData(uint64_t src_mac, uint32_t src_ip, uint16_t src_port, uint64_t dst_mac, uint32_t dst_ip, uint16_t dst_port); void Beb_AdjustIPChecksum(struct udp_header_type *ip); -void Beb_GetModuleConfiguration(int *master, int *top, int *normal); +int Beb_GetModuleConfiguration(int *master, int *top, int *normal); int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay); void Beb_SetTopVariable(int val); diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c index 27d98a30a..c6c3dec64 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.c +++ b/slsDetectorServers/eigerDetectorServer/FebControl.c @@ -1490,9 +1490,8 @@ int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right) { return 1; } -void Feb_Control_SetMasterVariable(int val) { Feb_Control_master = val; } - int Feb_Control_SetMaster(enum MASTERINDEX ind) { + uint32_t offset = DAQ_REG_HRDWRE; unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress}; char *master_names[] = {MASTER_NAMES}; @@ -1529,9 +1528,29 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) { LOG(logINFOBLUE, ("%s Master flag to %s Feb\n", (ind == MASTER_HARDWARE ? "Resetting" : "Overwriting"), master_names[ind])); + return 1; } +void Feb_Control_SetMasterEffects(int master) { + int prevMaster = Feb_Control_master; + + Feb_Control_master = master; + // change in master for 9m + if (prevMaster != Feb_Control_master && !Feb_Control_normal) { + if (prevMaster) { + Feb_Control_CloseSerialCommunication(); + } + if (Feb_Control_master) { + if (!Feb_Control_OpenSerialCommunication()) { + LOG(logERROR, ("Could not intitalize feb control serial " + "communication\n")); + return FAIL; + } + } + } +} + int Feb_Control_SetQuad(int val) { LOG(logINFO, ("Setting Quad to %d in Feb\n", val)); Feb_Control_quadMode = val; diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.h b/slsDetectorServers/eigerDetectorServer/FebControl.h index 7ede407ad..313900a85 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.h +++ b/slsDetectorServers/eigerDetectorServer/FebControl.h @@ -86,8 +86,8 @@ int Feb_Control_Get_Counter_Bit(); int Feb_Control_SetInterruptSubframe(int val); int Feb_Control_GetInterruptSubframe(); int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right); -void Feb_Control_SetMasterVariable(int val); int Feb_Control_SetMaster(enum MASTERINDEX ind); +int Feb_Control_SetMasterEffects(int master); int Feb_Control_SetQuad(int val); int Feb_Control_SetChipSignalsToTrimQuad(int enable); int Feb_Control_SetReadNRows(int value); diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index 0955523a1..cc3cab7ca 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -312,10 +312,10 @@ void initControlServer() { if (initError == FAIL) { return; } - getModuleConfiguration(); + if (updateModuleConfiguration() == FAIL) + return; #ifndef VIRTUAL sharedMemory_lockLocalLink(); - Feb_Control_SetMasterVariable(master); Feb_Interface_FebInterface(); Feb_Control_FebControl(); // same addresses for top and bottom @@ -354,20 +354,20 @@ void initControlServer() { } void initStopServer() { -#ifdef VIRTUAL - LOG(logINFOBLUE, ("Configuring Stop server\n")); - getModuleConfiguration(); - sharedMemory_setStop(0); - // get top/master in virtual - readConfigFile(); -#else // wait a few s (control server is setting top/master from config file) usleep(WAIT_STOP_SERVER_START); LOG(logINFOBLUE, ("Configuring Stop server\n")); - // exit(-1); - getModuleConfiguration(); + if (updateModuleConfiguration() == FAIL) + return; + +#ifdef VIRTUAL + sharedMemory_setStop(0); + // get top/master in virtual + if (readConfigFile() == FAIL) { + return; + } +#else sharedMemory_lockLocalLink(); - Feb_Control_SetMasterVariable(master); Feb_Interface_FebInterface(); Feb_Control_FebControl(); // same addresses for top and bottom @@ -381,10 +381,7 @@ void initStopServer() { } } -void getModuleConfiguration() { - if (initError == FAIL) { - return; - } +void setVirtualDefaultModuleConfigurations() { #ifdef VIRTUAL #ifdef VIRTUAL_MASTER master = 1; @@ -403,15 +400,41 @@ void getModuleConfiguration() { #else normal = 1; #endif +} +int updateModuleConfiguration() { +#ifdef VIRTUAL + setVirtualDefaultModuleConfigurations(); #else - Beb_GetModuleConfiguration(&master, &top, &normal); + if (getModuleConfiguration(&master, &top, &normal) == FAIL) { + return FAIL; + } +#endif + return OK; +} + +int getModuleConfiguration(int *m, int *t, int *n) { + if (initError == FAIL) { + return FAIL; + } +#ifdef VIRTUAL + *m = master; + *t = top; + *n = nomal; +#else + if (Beb_GetModuleConfiguration(&m, &t, &n) == FAIL) { + initError = FAIL; + strcpy(initErrorMessage, ("Could not get module configuration\n")); + LOG(logERROR, (mess)); + return FAIL; + } #endif if (isControlServer) { LOG(logINFOBLUE, - ("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"), - (master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL"))); + ("Module: %s %s %s\n", (*t ? "TOP" : "BOTTOM"), + (*m ? "MASTER" : "SLAVE"), (*n ? "NORMAL" : "SPECIAL"))); } + return OK; } int readConfigFile() { @@ -502,7 +525,14 @@ int readConfigFile() { sharedMemory_unlockLocalLink(); // validate change int actual_top = -1, temp = -1, temp2 = -1; - Beb_GetModuleConfiguration(&temp, &actual_top, &temp2); + if (Beb_GetModuleConfiguration(&temp, &actual_top, &temp2) == + FAIL) { + sprintf(initErrorMessage, + "Could not get module configuration. Failed to load " + "config file in server. Line:[%s].\n", + line); + break; + } if (actual_top != top) { sprintf(initErrorMessage, "Could not set top to %d. Read %d\n", top, actual_top); @@ -514,48 +544,28 @@ int readConfigFile() { // master command else if (!strncmp(line, "master", strlen("master"))) { + int m = -1; // cannot scan values - if (sscanf(line, "%s %d", command, &master) != 2) { + if (sscanf(line, "%s %d", command, &m) != 2) { sprintf(initErrorMessage, "Could not scan master commands from on-board server " "config file. Line:[%s].\n", line); break; } -#ifndef VIRTUAL - enum MASTERINDEX ind = (master == 1 ? OW_MASTER : OW_SLAVE); - if (!Beb_SetMaster(ind)) { + if (m != 0 && m != 1)) { + sprintf(initErrorMessage, + "Invalid master argument from on-board server " + "config file. Line:[%s].\n", + line); + break; + } + if (setMaster(m) == FAIL) { sprintf(initErrorMessage, - "Could not overwrite master to %d in Beb from on-board " - "server " - "config file. Line:[%s].\n", - master, line); + "Could not set master from config file. Line:[%s].\n", + line); break; } - sharedMemory_lockLocalLink(); - if (!Feb_Control_SetMaster(ind)) { - sprintf(initErrorMessage, - "Could not overwrite master to %d in Feb from on-board " - "server " - "config file. Line:[%s].\n", - master, line); - sharedMemory_unlockLocalLink(); - break; - } - sharedMemory_unlockLocalLink(); - // validate change - int actual_master = -1, temp = -1, temp2 = -1; - Beb_GetModuleConfiguration(&actual_master, &temp, &temp2); - if (actual_master != master) { - sprintf(initErrorMessage, - "Could not set master to %d. Read %d\n", master, - actual_master); - break; - } - sharedMemory_lockLocalLink(); - Feb_Control_SetMasterVariable(master); - sharedMemory_unlockLocalLink(); -#endif } // other commands @@ -607,12 +617,18 @@ void resetToHardwareSettings() { } sharedMemory_unlockLocalLink(); int temp = -1, temp2 = -1; - Beb_GetModuleConfiguration(&temp, &top, &temp2); + if (Beb_GetModuleConfiguration(&temp, &top, &temp2) == FAIL) { + initError = FAIL; + strcpy(initErrorMessage, "Could not get module configuration after " + "resetting top to hardware settings.\n"); + LOG(logERROR, ("%s\n\n", initErrorMessage)); + return; + } Beb_SetTopVariable(top); } // master not set in config file if (master == -1) { - if (!Beb_SetMaster(TOP_HARDWARE)) { + if (!Beb_SetMaster(MASTER_HARDWARE)) { initError = FAIL; strcpy(initErrorMessage, "Could not reset Master flag to Beb hardware settings.\n"); @@ -620,7 +636,7 @@ void resetToHardwareSettings() { return; } sharedMemory_lockLocalLink(); - if (!Feb_Control_SetMaster(TOP_HARDWARE)) { + if (!Feb_Control_SetMaster(MASTER_HARDWARE)) { initError = FAIL; strcpy(initErrorMessage, "Could not reset Master flag to Feb hardware settings.\n"); @@ -630,10 +646,14 @@ void resetToHardwareSettings() { } sharedMemory_unlockLocalLink(); int temp = -1, temp2 = -1; - Beb_GetModuleConfiguration(&master, &temp, &temp2); - sharedMemory_lockLocalLink(); - Feb_Control_SetMasterVariable(master); - sharedMemory_unlockLocalLink(); + if (Beb_GetModuleConfiguration(&temp, &top, &temp2) == FAIL) { + initError = FAIL; + strcpy(initErrorMessage, + "Could not get module configuration after " + "resetting master to hardware settings.\n"); + LOG(logERROR, ("%s\n\n", initErrorMessage)); + return; + } } #endif } @@ -1450,7 +1470,50 @@ int setHighVoltage(int val) { /* parameters - timing, extsig */ -int isMaster() { return master; } +int setMaster(int m) { +#ifdef VIRTUAL + master = m; +#else + if(!Beb_SetMaster((m == 1 ? OW_MASTER : OW_SLAVE)) { + return FAIL; + } + + sharedMemory_lockLocalLink(); + if (!Feb_Control_SetMaster((m == 1 ? OW_MASTER : OW_SLAVE))) { + sharedMemory_unlockLocalLink(); + return FAIL; + } + sharedMemory_unlockLocalLink(); + + // set master variable + if (isMaster(master) == FAIL) { + return FAIL; + } + + // feb variable and hv comms (9m) + sharedMemory_lockLocalLink(); + if (Feb_Control_SetMasterEffects(master) == FAIL) { + return FAIL; + } + sharedMemory_unlockLocalLink(); +#endif + return OK; +} + +int isMaster(int *retval) { + int m = -1, t = -1, n = -1; + if (getModuleConfiguration(&m, &t, &n) == FAIL) { + return FAIL; + } + if (m != master) { + LOG(logERROR, + ("master value retrieved %d and local value %d do not match\n", + master, m)); + return FAIL; + } + *retval = m; + return OK; +} void setTiming(enum timingMode arg) { int ret = 0; diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c index 362bf2079..b8fa95f0b 100644 --- a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c @@ -1238,7 +1238,10 @@ int setHighVoltage(int val) { /* parameters - timing, extsig */ -int isMaster() { return master; } +int isMaster(int *retval) { + *retval = master; + return OK; +} void setTiming(enum timingMode arg) { u_int32_t addr = EXT_SIGNAL_REG; diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index f4b40499e..29c448f4a 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -1545,9 +1545,11 @@ int setHighVoltage(int val) { /* parameters - timing */ -int isMaster() { - return !((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >> - SYSTEM_STATUS_SLV_BRD_DTCT_OFST); +int isMaster(int *retval) { + int slave = ((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >> + SYSTEM_STATUS_SLV_BRD_DTCT_OFST); + *retval = (slave == 0 ? 1 : 0); + return OK; } void setTiming(enum timingMode arg) { diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h index 955f35e6b..0ef99858f 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h @@ -110,7 +110,11 @@ u_int32_t getBoardRevision(); void initControlServer(); void initStopServer(); #ifdef EIGERD -void getModuleConfiguration(); +int updateModuleConfiguration(); +int getModuleConfiguration(int *m, int *t, int *n); +#ifdef VIRTUAL +void setVirtualDefaultModuleConfigurations(); +#endif #endif // set up detector @@ -362,9 +366,13 @@ int getADC(enum ADCINDEX ind); int setHighVoltage(int val); // parameters - timing, extsig -#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) -int isMaster(); +#ifdef EIGERD +int setMaster(int m); #endif +#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) +int isMaster(int *retval); +#endif + #ifdef GOTTHARD2D void updatingRegisters(); #endif diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h index 8948e19d4..61f136e74 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h @@ -245,6 +245,7 @@ int get_pattern(int); int load_default_pattern(int); int get_all_threshold_energy(int); int get_master(int); +int set_master(int); int get_csr(); int set_gain_caps(int); int get_gain_caps(int); diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 80c7e003c..a90d65d10 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -464,6 +464,7 @@ void function_table() { flist[F_UPDATE_DETECTOR_SERVER] = &update_detector_server; flist[F_GET_UPDATE_MODE] = &get_update_mode; flist[F_SET_UPDATE_MODE] = &set_update_mode; + flist[F_SET_MASTER]] = &set_master; // check if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) { @@ -8192,11 +8193,55 @@ int get_master(int file_des) { #if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD) functionNotImplemented(); #else - retval = isMaster(); + ret = isMaster(&retval); + if (ret == FAIL) { + strcpy(mess, "Could not get master\n"); + LOG(logERROR, (mess)); + } #endif return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); } +int set_master(int file_des) { + ret = OK; + memset(mess, 0, sizeof(mess)); + int arg = -1; + + if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) + return printSocketReadError(); + LOG(logDEBUG1, ("Setting master: %u\n", (int)arg)); + +#ifndef EIGERD + functionNotImplemented(); +#else + // only set + if (Server_VerifyLock() == OK) { + if ((check_detector_idle("set master") == OK) && + (arg != 0 && arg != 1)) { + ret = FAIL; + sprintf(mess, "Could not set master. Invalid argument %d.\n", arg); + LOG(logERROR, (mess)); + } else { + ret = setMaster(arg); + if (ret == FAIL) { + strcpy("Could not set master\n"); + LOG(logERROR, (mess)); + } else { + ret = isMaster(&retval); + if (ret == FAIL) { + strcpy(mess, "Could not get master\n"); + LOG(logERROR, (mess)); + } else { + LOG(logDEBUG1, ("master retval: %u\n", retval)); + validate(&ret, mess, arg, retval, "set master", DEC); + } + } + } + } +#endif + return Server_SendResult(file_des, INT32, NULL, 0); +} + int get_csr(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 4123d0284..ee98ce792 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -193,6 +193,12 @@ class Detector { */ void setFlipRows(bool value, Positions pos = {}); + /** [Eiger][Mythen3][Gotthard1] via stop server **/ + Result getMaster(Positions pos = {}) const; + + /** [Eiger] Set master */ + void setMaster(bool value, int pos); + Result isVirtualDetectorServer(Positions pos = {}) const; ///@} @@ -1450,9 +1456,6 @@ class Detector { * (internal gating). Gate index: 0-2, -1 for all */ Result> getGateDelayForAllGates(Positions pos = {}) const; - /** [Eiger][Mythen3][Gotthard1] via stop server **/ - Result getMaster(Positions pos = {}) const; - // TODO! check if we really want to expose this !!!!! Result getChipStatusRegister(Positions pos = {}) const; diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index b9c813f47..724e781dd 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -784,6 +784,7 @@ class CmdProxy { {"trimen", &CmdProxy::TrimEnergies}, {"gappixels", &CmdProxy::GapPixels}, {"fliprows", &CmdProxy::fliprows}, + {"master", &CmdProxy::master}, /* acquisition parameters */ {"acquire", &CmdProxy::Acquire}, diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index f31349ad4..e08721ea8 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -298,6 +298,17 @@ void Detector::setFlipRows(bool value, Positions pos) { pimpl->Parallel(&Module::setFlipRows, pos, value); } +Result Detector::getMaster(Positions pos) const { + return pimpl->Parallel(&Module::isMaster, pos); +} + +void Detector::setMaster(bool master, int pos) { + if (pos == -1)) { + throw RuntimeError("Master can be set only to a single module"); + } + pimpl->Parallel(&Module::setMaster, {pos}, value); +} + Result Detector::isVirtualDetectorServer(Positions pos) const { return pimpl->Parallel(&Module::isVirtualDetectorServer, pos); } @@ -1808,10 +1819,6 @@ Detector::getGateDelayForAllGates(Positions pos) const { return pimpl->Parallel(&Module::getGateDelayForAllGates, pos); } -Result Detector::getMaster(Positions pos) const { - return pimpl->Parallel(&Module::isMaster, pos); -} - Result Detector::getChipStatusRegister(Positions pos) const { return pimpl->Parallel(&Module::getChipStatusRegister, pos); } diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index e36f69c1c..98b12c2f8 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -509,6 +509,12 @@ void Module::setFlipRows(bool value) { } } +bool Module::isMaster() const { return sendToDetectorStop(F_GET_MASTER); } + +void Module::setMaster(const bool master) { + sendToDetector(F_SET_MASTER, static_cast(master), nullptr); +} + bool Module::isVirtualDetectorServer() const { return sendToDetector(F_IS_VIRTUAL); } @@ -2197,8 +2203,6 @@ std::array Module::getGateDelayForAllGates() const { return sendToDetector>(F_GET_GATE_DELAY_ALL_GATES); } -bool Module::isMaster() const { return sendToDetectorStop(F_GET_MASTER); } - int Module::getChipStatusRegister() const { return sendToDetector(F_GET_CSR); } diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 22ea7b030..6406481a7 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -120,6 +120,9 @@ class Module : public virtual slsDetectorDefs { int setTrimEn(const std::vector &energies = {}); bool getFlipRows() const; void setFlipRows(bool value); + bool isMaster() const; + void setMaster(const bool master); + bool isVirtualDetectorServer() const; /************************************************** @@ -184,6 +187,7 @@ class Module : public virtual slsDetectorDefs { void setDBITPipeline(int value); int getReadNRows() const; void setReadNRows(const int value); + /************************************************** * * * Acquisition * @@ -456,7 +460,6 @@ class Module : public virtual slsDetectorDefs { int64_t getGateDelay(int gateIndex) const; void setGateDelay(int gateIndex, int64_t value); std::array getGateDelayForAllGates() const; - bool isMaster() const; int getChipStatusRegister() const; void setGainCaps(int caps); int getGainCaps(); diff --git a/slsSupportLib/include/sls/sls_detector_funcs.h b/slsSupportLib/include/sls/sls_detector_funcs.h index ca7a19de2..ab2697dbb 100755 --- a/slsSupportLib/include/sls/sls_detector_funcs.h +++ b/slsSupportLib/include/sls/sls_detector_funcs.h @@ -258,6 +258,7 @@ enum detFuncs { F_UPDATE_DETECTOR_SERVER, F_GET_UPDATE_MODE, F_SET_UPDATE_MODE, + F_SET_MASTER, NUM_DET_FUNCTIONS, RECEIVER_ENUM_START = 256, /**< detector function should not exceed this @@ -619,6 +620,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_UPDATE_DETECTOR_SERVER: return "F_UPDATE_DETECTOR_SERVER"; case F_GET_UPDATE_MODE: return "F_GET_UPDATE_MODE"; case F_SET_UPDATE_MODE: return "F_SET_UPDATE_MODE"; + case F_SET_MASTER: return "F_SET_MASTER"; case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS"; case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";