Merge pull request #323 from slsdetectorgroup/jungfraucalibfix

Jungfraucalibfix
This commit is contained in:
Dhanya Thattil 2021-10-19 11:45:43 +02:00 committed by GitHub
commit 3726ae3fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 4 deletions

View File

@ -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;
}
}

View File

@ -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