mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
gotthard2: disentangled burst mode #frames, exptime, period from start of acquisition, order dependent now for debugging
This commit is contained in:
parent
c4559fadb3
commit
d3dc9a7690
Binary file not shown.
@ -47,9 +47,6 @@ int injectedChannelsIncrement = 0;
|
||||
int vetoReference[NCHIP][NCHAN];
|
||||
uint8_t adcConfiguration[NCHIP][NADC];
|
||||
int burstMode = BURST_INTERNAL;
|
||||
int64_t exptime_ns = 0;
|
||||
int64_t period_ns = 0;
|
||||
int64_t nframes = 0;
|
||||
int detPos[2] = {};
|
||||
|
||||
int isInitCheckDone() {
|
||||
@ -353,9 +350,6 @@ void setupDetector() {
|
||||
injectedChannelsOffset = 0;
|
||||
injectedChannelsIncrement = 0;
|
||||
burstMode = BURST_INTERNAL;
|
||||
exptime_ns = 0;
|
||||
period_ns = 0;
|
||||
nframes = 0;
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||
@ -732,12 +726,23 @@ int setDynamicRange(int dr){
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld [local]\n", (long long int)val));
|
||||
nframes = val;
|
||||
// continuous mode
|
||||
if (burstMode != BURST_OFF) {
|
||||
setNumFramesCont(val);
|
||||
setNumFramesBurst(1);
|
||||
} else {
|
||||
setNumFramesBurst(val);
|
||||
setNumFramesCont(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumFrames() {
|
||||
return nframes;
|
||||
if (burstMode != BURST_OFF) {
|
||||
return getNumFramesCont();
|
||||
} else {
|
||||
return getNumFramesBurst();
|
||||
}
|
||||
}
|
||||
|
||||
void setNumTriggers(int64_t val) {
|
||||
@ -757,12 +762,16 @@ int setExpTime(int64_t val) {
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [local]\n", (long long int)val));
|
||||
exptime_ns = val;
|
||||
return OK;
|
||||
// continuous mode
|
||||
if (burstMode != BURST_OFF) {
|
||||
return setExptimeCont(val);
|
||||
} else {
|
||||
return setExptimeBurst(val);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
return exptime_ns;
|
||||
return getExptimeBoth();
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
@ -771,12 +780,22 @@ int setPeriod(int64_t val) {
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [local]\n", (long long int)val));
|
||||
period_ns = val;
|
||||
return OK;
|
||||
// continuous mode
|
||||
if (burstMode != BURST_OFF) {
|
||||
setPeriodBurst(0);
|
||||
return setPeriodCont(val);
|
||||
} else {
|
||||
setPeriodCont(0);
|
||||
return setPeriodBurst(val);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getPeriod() {
|
||||
return period_ns;
|
||||
if (burstMode != BURST_OFF) {
|
||||
return getPeriodCont();
|
||||
} else {
|
||||
return getPeriodBurst();
|
||||
}
|
||||
}
|
||||
|
||||
void setNumFramesBurst(int64_t val) {
|
||||
@ -1829,84 +1848,21 @@ enum burstMode getBurstMode() {
|
||||
int runmode = bus_r (addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
||||
switch (runmode) {
|
||||
case ASIC_CONFIG_RUN_MODE_CONT_VAL:
|
||||
return BURST_OFF;
|
||||
burstMode = BURST_OFF;
|
||||
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
||||
return BURST_INTERNAL;
|
||||
burstMode = BURST_INTERNAL;
|
||||
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
||||
return BURST_EXTERNAL;
|
||||
burstMode = BURST_EXTERNAL;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode));
|
||||
return -1;
|
||||
}
|
||||
return burstMode;
|
||||
}
|
||||
|
||||
|
||||
/* aquisition */
|
||||
|
||||
int updateAcquisitionRegisters(char* mess) {
|
||||
// burst mode
|
||||
if (burstMode != BURST_OFF) {
|
||||
// validate #frames in burst mode
|
||||
if (nframes > MAX_FRAMES_IN_BURST_MODE) {
|
||||
sprintf(mess, "Could not start acquisition because number of frames %lld must be <= %d in burst mode.\n", (long long unsigned int)nframes, MAX_FRAMES_IN_BURST_MODE);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
setNumFramesBurst(nframes);
|
||||
// exptime
|
||||
if (setExptimeBurst(exptime_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because exptime could not be set in burst mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)exptime_ns, getExptimeBoth());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
// period
|
||||
if (setPeriodBurst(period_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)period_ns, getPeriodBurst());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// set continuous values to default (exptime same register)
|
||||
FILE_LOG(logINFO, ("Setting continuous mode registers to defaults\n"));
|
||||
// frames
|
||||
setNumFramesCont(1);
|
||||
// period
|
||||
if (setPeriodCont(0) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in continuous mode. Set 0 ns, got %lld ns.\n", getPeriodCont());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
// continuous
|
||||
else {
|
||||
// frames
|
||||
setNumFramesCont(nframes);
|
||||
// exptime
|
||||
if (setExptimeCont(exptime_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because exptime could not be set in continuous mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)exptime_ns, getExptimeBoth());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
// period
|
||||
if (setPeriodCont(period_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in continuous mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)period_ns, getPeriodCont());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// set burst values to default (exptime same register)
|
||||
FILE_LOG(logINFO, ("Setting burst mode registers to defaults\n"));
|
||||
setNumFramesBurst(1);
|
||||
// period
|
||||
if (setPeriodBurst(0) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set 0 ns, got %lld ns.\n", getPeriodBurst());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int startStateMachine(){
|
||||
#ifdef VIRTUAL
|
||||
// create udp socket
|
||||
|
@ -508,9 +508,6 @@ int setTransmissionDelayRight(int value);
|
||||
|
||||
|
||||
// aquisition
|
||||
#ifdef GOTTHARD2D
|
||||
int updateAcquisitionRegisters(char* mess);
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
int prepareAcquisition();
|
||||
#endif
|
||||
|
@ -1769,12 +1769,6 @@ int start_acquisition(int file_des) {
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef GOTTHARD2D
|
||||
if (updateAcquisitionRegisters(mess) == FAIL) {
|
||||
ret = FAIL;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
@ -1905,12 +1899,6 @@ int start_and_read_all(int file_des) {
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef GOTTHARD2D
|
||||
if (updateAcquisitionRegisters(mess) == FAIL) {
|
||||
ret = FAIL;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
@ -1977,11 +1965,21 @@ int set_num_frames(int file_des) {
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
#ifdef GOTTHARD2D
|
||||
// validate #frames in burst mode
|
||||
if (getBurstMode() != BURST_OFF && arg > MAX_FRAMES_IN_BURST_MODE) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set number of frames %lld. Must be <= %d in burst mode.\n", (long long unsigned int)arg, MAX_FRAMES_IN_BURST_MODE);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
#endif
|
||||
if (ret == OK) {
|
||||
setNumFrames(arg);
|
||||
int64_t retval = getNumFrames();
|
||||
FILE_LOG(logDEBUG1, ("retval num frames %lld\n", (long long int)retval));
|
||||
validate64(arg, retval, "set number of frames", DEC);
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ class CmdProxy {
|
||||
INTEGER_COMMAND_NOID(frames, getNumberOfFrames, setNumberOfFrames,
|
||||
std::stol,
|
||||
"[n_frames]\n\tNumber of frames per aquire. In trigger mode, number of frames per trigger."
|
||||
"\n\t[Gotthard2] Burst mode has a maximum of 2720 frames. Frames number for both modes are uploaded to detector just before acquisition starts");
|
||||
"\n\t[Gotthard2] Burst mode has a maximum of 2720 frames.");
|
||||
|
||||
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
|
||||
std::stol,
|
||||
|
Loading…
x
Reference in New Issue
Block a user