diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer index 0bc288af1..f38294ae6 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 de94d8dcc..b1919fd4e 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -2260,8 +2260,19 @@ void enableCurrentSource(int fix, uint64_t select, int normal) { } else { // select - LOG(logINFO, ("\tSetting selection to 0x%lx\n", (long unsigned int)select)); - set64BitReg(select, CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG); + // invert select first + uint64_t tmp = select; + uint64_t inverted = 0; + for (int i = 0; i != 64; ++i) { + // get each bit from LSB side + uint64_t bit = (tmp >> i) & 0x1; + // push the bit into MSB side + inverted |= (bit << (63 - i)); + } + LOG(logINFO, ("\tSetting selection to 0x%lx (inverted from 0x%lx)\n", + (long unsigned int) inverted, (long unsigned int)select)); + set64BitReg(inverted, CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG); + // normal if (normal) { LOG(logINFO, ("\tEnabling normal\n")) @@ -2314,7 +2325,18 @@ uint64_t getSelectCurrentSource() { return ((bus_r(DAQ_REG) & DAQ_CRRNT_SRC_CLMN_SLCT_MSK) >> DAQ_CRRNT_SRC_CLMN_SLCT_OFST); } else { - return get64BitReg(CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG); + // invert the select + uint64_t retval = get64BitReg(CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG); + + uint64_t tmp = retval; + uint64_t inverted = 0; + for (int i = 0; i != 64; ++i) { + // get each bit from LSB side + uint64_t bit = (tmp >> i) & 0x1; + // push the bit into MSB side + inverted |= (bit << (63 - i)); + } + return inverted; } } diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 30bad18b9..3c6eed92a 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -9,7 +9,7 @@ #define APICTB 0x211019 #define APIGOTTHARD 0x211019 #define APIGOTTHARD2 0x211019 -#define APIJUNGFRAU 0x211019 #define APIMYTHEN3 0x211019 #define APIMOENCH 0x211019 #define APIEIGER 0x211019 +#define APIJUNGFRAU 0x211019