diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index 5f444a0b0..49397c9ad 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index 04a7b4ee4..fb05afdc4 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer index 66e24fd52..cb5703d6c 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 655cb3d1c..76bfe3fec 100755 Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer index 5ad5f6f63..8b3b64fee 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 b74809af7..43cd01807 100755 Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h index b9f931049..6c2c6b218 100644 --- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h +++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h @@ -97,6 +97,7 @@ int enable_ten_giga(int); int validateAndSetAllTrimbits(int arg); int set_all_trimbits(int); int set_pattern_io_control(int); +int get_pattern_io_control(int); int set_pattern_word(int); int set_pattern_loop_addresses(int); int set_pattern_loop_cycles(int); diff --git a/slsDetectorServers/slsDetectorServer/src/loadPattern.c b/slsDetectorServers/slsDetectorServer/src/loadPattern.c index e0e0db094..f0cf214fe 100644 --- a/slsDetectorServers/slsDetectorServer/src/loadPattern.c +++ b/slsDetectorServers/slsDetectorServer/src/loadPattern.c @@ -23,6 +23,8 @@ extern void bus_w(u_int32_t offset, u_int32_t data); extern u_int32_t bus_r(u_int32_t offset); extern int64_t get64BitReg(int aLSB, int aMSB); extern int64_t set64BitReg(int64_t value, int aLSB, int aMSB); +extern uint64_t getU64BitReg(int aLSB, int aMSB); +extern void setU64BitReg(uint64_t value, int aLSB, int aMSB); #ifdef MYTHEN3D #define MAX_LEVELS M3_MAX_PATTERN_LEVELS @@ -48,7 +50,7 @@ void initializePatternWord() { #endif uint64_t validate_readPatternIOControl() { - return get64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); + return getU64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); } int validate_writePatternIOControl(char *message, uint64_t arg) { @@ -59,14 +61,21 @@ int validate_writePatternIOControl(char *message, uint64_t arg) { LOG(logDEBUG1, ("Pattern IO Control retval: 0x%llx\n", (long long int)retval)); int ret = OK; - validate64(&ret, message, arg, retval, "set pattern IO Control", HEX); + if (retval != arg) { + ret = FAIL; + sprintf( + message, + "Could not set pattern IO Control. Set 0x%llx, but read 0x%llx\n", + (long long unsigned int)arg, (long long unsigned int)retval); + LOG(logERROR, (message)); + } return ret; } void writePatternIOControl(uint64_t word) { LOG(logINFO, ("Setting Pattern I/O Control: 0x%llx\n", (long long int)word)); - set64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); + setU64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); } #endif @@ -710,20 +719,20 @@ void setPatternLoopAddresses(int level, int startAddr, int stopAddr) { void setPatternMask(uint64_t mask) { LOG(logINFO, ("Setting pattern mask to 0x%llx\n", mask)); - set64BitReg(mask, PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG); + setU64BitReg(mask, PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG); } uint64_t getPatternMask() { - return get64BitReg(PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG); + return getU64BitReg(PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG); } void setPatternBitMask(uint64_t mask) { LOG(logINFO, ("Setting pattern bit mask to 0x%llx\n", mask)); - set64BitReg(mask, PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG); + setU64BitReg(mask, PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG); } uint64_t getPatternBitMask() { - return get64BitReg(PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG); + return getU64BitReg(PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG); } #ifdef MYTHEN3D diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index bf15413ea..8df278d70 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -272,6 +272,7 @@ void function_table() { 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; + flist[F_GET_PATTERN_IO_CONTROL] = &get_pattern_io_control; flist[F_SET_PATTERN_WORD] = &set_pattern_word; flist[F_SET_PATTERN_LOOP_ADDRESSES] = &set_pattern_loop_addresses; flist[F_SET_PATTERN_LOOP_CYCLES] = &set_pattern_loop_cycles; @@ -3154,7 +3155,6 @@ int set_pattern_io_control(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint64_t arg = -1; - uint64_t retval = -1; if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); @@ -3163,14 +3163,25 @@ int set_pattern_io_control(int file_des) { #else LOG(logDEBUG1, ("Setting Pattern IO Control to 0x%llx\n", (long long int)arg)); - if (((int64_t)arg == GET_FLAG) || (Server_VerifyLock() == OK)) { - if ((int64_t)arg != GET_FLAG) { - ret = validate_writePatternIOControl(mess, arg); - } - retval = validate_readPatternIOControl(); + if (Server_VerifyLock() == OK) { + ret = validate_writePatternIOControl(mess, arg); } #endif - return Server_SendResult(file_des, INT64, &retval, sizeof(retval)); + return Server_SendResult(file_des, INT64, NULL, 0); +} + +int get_pattern_io_control(int file_des) { + ret = OK; + memset(mess, 0, sizeof(mess)); + uint64_t retval64 = -1; + +#if !defined(CHIPTESTBOARDD) + functionNotImplemented(); +#else + LOG(logDEBUG1, ("Getting Pattern IO Control\n")); + retval64 = validate_readPatternIOControl(); +#endif + return Server_SendResult(file_des, INT64, &retval64, sizeof(retval64)); } int set_pattern_word(int file_des) { @@ -3352,7 +3363,13 @@ int set_pattern_mask(int file_des) { uint64_t retval64 = getPatternMask(); LOG(logDEBUG1, ("Pattern mask: 0x%llx\n", (long long unsigned int)retval64)); - validate64(&ret, mess, arg, retval64, "set Pattern Mask", HEX); + if (retval64 != arg) { + ret = FAIL; + sprintf( + mess, "Could not pattern mask. Set 0x%llx, but read 0x%llx\n", + (long long unsigned int)arg, (long long unsigned int)retval64); + LOG(logERROR, (mess)); + } } #endif return Server_SendResult(file_des, INT32, NULL, 0); @@ -3395,7 +3412,14 @@ int set_pattern_bit_mask(int file_des) { uint64_t retval64 = getPatternBitMask(); LOG(logDEBUG1, ("Pattern bit mask: 0x%llx\n", (long long unsigned int)retval64)); - validate64(&ret, mess, arg, retval64, "set Pattern Bit Mask", HEX); + if (retval64 != arg) { + ret = FAIL; + sprintf(mess, + "Could not pattern bit mask. Set 0x%llx, but read 0x%llx\n", + (long long unsigned int)arg, + (long long unsigned int)retval64); + LOG(logERROR, (mess)); + } } #endif return Server_SendResult(file_des, INT32, NULL, 0); diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index c783c1714..6101d5179 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -2492,12 +2492,11 @@ Pattern Module::getPattern() { void Module::loadDefaultPattern() { sendToDetector(F_LOAD_DEFAULT_PATTERN); } uint64_t Module::getPatternIOControl() const { - return sendToDetector(F_SET_PATTERN_IO_CONTROL, - int64_t(GET_FLAG)); + return sendToDetector(F_GET_PATTERN_IO_CONTROL); } void Module::setPatternIOControl(uint64_t word) { - sendToDetector(F_SET_PATTERN_IO_CONTROL, word); + sendToDetector(F_SET_PATTERN_IO_CONTROL, word, nullptr); } uint64_t Module::getPatternWord(int addr) const { diff --git a/slsSupportLib/include/sls/sls_detector_funcs.h b/slsSupportLib/include/sls/sls_detector_funcs.h index 7443af1e8..ed729d912 100755 --- a/slsSupportLib/include/sls/sls_detector_funcs.h +++ b/slsSupportLib/include/sls/sls_detector_funcs.h @@ -280,6 +280,7 @@ enum detFuncs { F_GET_BIT, F_SET_BIT, F_CLEAR_BIT, + F_GET_PATTERN_IO_CONTROL, NUM_DET_FUNCTIONS, RECEIVER_ENUM_START = 512, /**< detector function should not exceed this @@ -663,6 +664,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) { case F_GET_BIT: return "F_GET_BIT"; case F_SET_BIT: return "F_SET_BIT"; case F_CLEAR_BIT: return "F_CLEAR_BIT"; + case F_GET_PATTERN_IO_CONTROL: return "F_GET_PATTERN_IO_CONTROL"; case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS"; diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 00f22cf28..5754d5665 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -4,10 +4,10 @@ #define RELEASE "developer" #define APILIB "developer 0x230224" #define APIRECEIVER "developer 0x230224" -#define APIGOTTHARD "developer 0x230525" -#define APIGOTTHARD2 "developer 0x230525" -#define APIMYTHEN3 "developer 0x230525" -#define APIMOENCH "developer 0x230525" #define APIEIGER "developer 0x230525" -#define APIJUNGFRAU "developer 0x230525" -#define APICTB "developer 0x230605" +#define APICTB "developer 0x230615" +#define APIGOTTHARD "developer 0x230615" +#define APIGOTTHARD2 "developer 0x230615" +#define APIJUNGFRAU "developer 0x230615" +#define APIMYTHEN3 "developer 0x230615" +#define APIMOENCH "developer 0x230615"