diff --git a/slsDetectorServers/CMakeLists.txt b/slsDetectorServers/CMakeLists.txt index 9d1db734c..19aa10162 100644 --- a/slsDetectorServers/CMakeLists.txt +++ b/slsDetectorServers/CMakeLists.txt @@ -11,7 +11,7 @@ install(TARGETS slsProjectCSettings PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) add_subdirectory(ctbDetectorServer) -add_subdirectory(xilinx_ctbDetectorServer) +#add_subdirectory(xilinx_ctbDetectorServer) add_subdirectory(eigerDetectorServer) add_subdirectory(jungfrauDetectorServer) add_subdirectory(mythen3DetectorServer) diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index ebb2ec921..34f4f1a43 100644 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -1284,7 +1284,7 @@ int validateDACValue(enum DACINDEX ind, int voltage, char *mess) { return OK; } // power dacs - if (validatePowerDACVoltage(ind, voltage, mess) == FAIL) + if (validatePower(ind, voltage, mess) == FAIL) return FAIL; return OK; } @@ -1512,7 +1512,7 @@ int getVchipToSet(enum DACINDEX ind, int pwr_val, int *retval_vchip, if (ipwr == (int)ind) { val = pwr_val; } else { - if (getPower(ind, &val, mess) == FAIL) + if ((getDAC, ind, true, &val, mess) == FAIL) return FAIL; } if (val > max) @@ -1665,8 +1665,8 @@ int isPowerRailEnabled(enum DACINDEX ind, bool *retval, char *mess) { if (getPowerIndexFromDACIndex(ind, &pwrIndex, mess) == FAIL) return FAIL; - int mask = 0; - if (getPowerRailMask(ind, &mask, mess) == FAIL) + uint32_t mask = 0; + if (getPowerRailMask(pwrIndex, &mask, mess) == FAIL) return FAIL; *retval = (bus_r(POWER_REG) & mask) != 0; diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 15af49ac2..39761d91f 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -497,7 +497,7 @@ void setupDetector() { } // power on chip - initError = powerChip(1, initErrorMessage); + initError = powerChip(true, initErrorMessage); if (initError == FAIL) return; @@ -2352,7 +2352,7 @@ int checkDetectorType(char *mess) { return OK; } -int powerChip(int on, char *mess) { +int powerChip(bool on, char *mess) { if (on) { LOG(logINFO, ("Powering chip: on\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PWR_CHIP_MSK); diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.h index 4f84a1307..7c442f7b1 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.h @@ -153,7 +153,7 @@ int *getDetectorPosition(); // very detector specific int checkDetectorType(char *mess); -int powerChip(int on, char *mess); +int powerChip(bool on, char *mess); int getPowerChip(); int isChipConfigured(); int configureChip(char *mess); diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 618dd90b1..de08beaf1 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -1368,9 +1368,8 @@ int processDACEnums(enum dacIndex ind, int val, bool mV) { if (!mV) { ret = FAIL; sprintf(mess, - "Could not set power. Can get Vchip only in mV and not dac " - "units.\n", - ind); + "Could not get vchip. Can get Vchip only in mV and not dac " + "units.\n"); LOG(logERROR, (mess)); return retval; } @@ -1406,6 +1405,7 @@ int processDACEnums(enum dacIndex ind, int val, bool mV) { LOG(logERROR, (mess)); return retval; } + [[fallthrough]]; // actual dacs default: serverDacIndex = getDACIndex(ind); @@ -4034,7 +4034,11 @@ int power_chip(int file_des) { sprintf(mess, "Power chip %d should be 0 or 1\n", arg); LOG(logERROR, (mess)); } else { - ret = powerChip(arg, mess); +#ifdef GOTTHARD2D + powerChip(arg, mess); +#else + powerChip(arg); +#endif } } if (ret == OK) { @@ -11376,24 +11380,26 @@ int spi_write(int file_des) { int get_power(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - int arg = -1; int retval = -1; #if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) functionNotImplemented(); #else // index + int arg = -1; if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); LOG(logDEBUG1, ("Getting power rail enable for power %d\n", arg)); - enum dacIndex serverDacIndex = getDACIndex(dacIndex(arg)); + enum DACINDEX serverDacIndex = getDACIndex((enum dacIndex)arg); if (ret == FAIL) { return Server_SendResult(file_des, INT32, NULL, 0); } - ret = isPowerRailEnabled(serverDacIndex, &retval, mess); + bool b_retval = false; + ret = isPowerRailEnabled(serverDacIndex, &b_retval, mess); + retval = (int)b_retval; #endif return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); } @@ -11422,9 +11428,9 @@ int set_power(int file_des) { if (Server_VerifyLock() == OK) { - enum dacIndex serverDacIndices[count] = {0}; + enum DACINDEX serverDacIndices[count] = {}; for (int iPower = 0; iPower != count; ++iPower) { - enum dacIndex ind = (dacIndex)args[iPower]; + enum dacIndex ind = (enum dacIndex)args[iPower]; serverDacIndices[iPower] = getDACIndex(ind); if (ret == FAIL) { return Server_SendResult(file_des, INT32, NULL, 0);