set starting frame number of next acquisition for both jungfrau and e… (#27)

* set starting frame number of next acquisition for both jungfrau and eiger. firmware has not implemented a get, so workaround. tests included. frame number 0 not allowed due to Eiger. Eiger max frame is 48 bit, while jungfrau is 64 bit

* made argument of setstartingframenumber const
This commit is contained in:
Dhanya Thattil
2019-06-03 11:07:53 +02:00
committed by GitHub
parent 894cc1c9e0
commit 29141ac1a6
26 changed files with 398 additions and 40 deletions

View File

@ -388,6 +388,10 @@
#define SET_EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT)
#define SET_EXPTIME_MSB_REG (0x69 << MEM_MAP_SHIFT)
/* Frame number 64 bit register */
#define FRAME_NUMBER_LSB_REG (0x6A << MEM_MAP_SHIFT)
#define FRAME_NUMBER_MSB_REG (0x6B << MEM_MAP_SHIFT)
/* Trigger Delay 32 bit register */
#define SET_TRIGGER_DELAY_LSB_REG (0x70 << MEM_MAP_SHIFT)
#define SET_TRIGGER_DELAY_MSB_REG (0x71 << MEM_MAP_SHIFT)

View File

@ -441,6 +441,7 @@ void setupDetector() {
selectStoragecellStart(DEFAULT_STRG_CLL_STRT);
/*setClockDivider(HALF_SPEED); depends if all the previous stuff works*/
setTiming(DEFAULT_TIMING_MODE);
setStartingFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
// temp threshold and reset event
@ -555,6 +556,20 @@ int selectStoragecellStart(int pos) {
return ((bus_r(DAQ_REG) & DAQ_STRG_CELL_SLCT_MSK) >> DAQ_STRG_CELL_SLCT_OFST);
}
int setStartingFrameNumber(uint64_t value) {
FILE_LOG(logINFO, ("Setting starting frame number: %llu\n",(long long unsigned int)value));
// decrement is for firmware
setU64BitReg(value - 1, FRAME_NUMBER_LSB_REG, FRAME_NUMBER_MSB_REG);
// need to set it twice for the firmware to catch
setU64BitReg(value - 1, FRAME_NUMBER_LSB_REG, FRAME_NUMBER_MSB_REG);
return OK;
}
int getStartingFrameNumber(uint64_t* retval) {
// increment is for firmware
*retval = (getU64BitReg(FRAME_NUMBER_LSB_REG, FRAME_NUMBER_MSB_REG) + 1);
return OK;
}
int64_t setTimer(enum timerIndex ind, int64_t val) {

View File

@ -63,6 +63,7 @@ enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
/** Default Parameters */
#define DEFAULT_NUM_FRAMES (100*1000*1000)
#define DEFAULT_STARTING_FRAME_NUMBER (1)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_EXPTIME (10*1000) //ns
#define DEFAULT_PERIOD (2*1000*1000) //ns