mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
timer split up
This commit is contained in:
parent
f9fff97f8a
commit
031241ae28
@ -102,8 +102,8 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||
|
||||
// Setting and reading exposure time
|
||||
auto t = 1000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
d.setExptime(t);
|
||||
CHECK(d.getExptime() == t);
|
||||
|
||||
// size of an eiger half module with and without gap pixels
|
||||
CHECK(d.getTotalNumberOfChannels() == 256 * 256 * 4);
|
||||
@ -143,8 +143,8 @@ TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||
|
||||
// Can we still access the detector while it's locked
|
||||
auto t = 1300000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
d.setExptime(t);
|
||||
CHECK(d.getExptime() == t);
|
||||
|
||||
// unlock again and free
|
||||
d.lockServer(0);
|
||||
@ -190,49 +190,38 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
|
||||
// Number of frames
|
||||
auto frames = 5;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, frames);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER) == frames);
|
||||
d.setNumberOfFrames(frames);
|
||||
CHECK(d.getNumberOfFrames() == frames);
|
||||
|
||||
auto exptime = 2000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == exptime);
|
||||
d.setExptime(exptime);
|
||||
CHECK(d.getExptime() == exptime);
|
||||
|
||||
auto period = 2000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD) == period);
|
||||
d.setPeriod(period);
|
||||
CHECK(d.getPeriod() == period);
|
||||
|
||||
if (test::type != dt::EIGER) {
|
||||
auto delay = 10000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER, delay);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER) ==
|
||||
d.setDelayAfterTrigger(delay);
|
||||
CHECK(d.getDelayAfterTrigger() ==
|
||||
delay);
|
||||
}
|
||||
|
||||
if (test::type != dt::EIGER) {
|
||||
auto gates = 1;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, gates);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER) == gates);
|
||||
}
|
||||
|
||||
auto triggers = 2;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::TRIGGER_NUMBER, triggers);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::TRIGGER_NUMBER) == triggers);
|
||||
d.setNumberOfTriggers(triggers);
|
||||
CHECK(d.getNumberOfTriggers() == triggers);
|
||||
|
||||
if (test::type == dt::EIGER) {
|
||||
auto subtime = 200;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME,
|
||||
subtime);
|
||||
CHECK(d.setTimer(
|
||||
slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME) ==
|
||||
subtime);
|
||||
d.setSubExptime(subtime);
|
||||
CHECK(d.getSubExptime() == subtime);
|
||||
}
|
||||
// for (int i =0; i!=frames; ++i)
|
||||
d.startAndReadAll();
|
||||
|
||||
d.freeSharedMemory();
|
||||
|
||||
// If we add a timer we should add tests for the timer
|
||||
CHECK(slsDetectorDefs::MAX_TIMERS == 19);
|
||||
}
|
||||
|
||||
// TEST_CASE("Aquire", "[.integration][eiger]"){
|
||||
@ -243,13 +232,13 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
|
||||
// auto period = 1000000000;
|
||||
// auto exptime = 100000000;
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, 5);
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||
// d.setNumberOfFrames(5);
|
||||
// d.setExptime(exptime);
|
||||
// d.setPeriod(period);
|
||||
// d.startAndReadAll();
|
||||
|
||||
// auto rperiod =
|
||||
// d.getTimeLeft(slsDetectorDefs::timerIndex::MEASURED_PERIOD);
|
||||
// d.getMeasuredPeriod();
|
||||
// CHECK(rperiod == 0.1);
|
||||
|
||||
// d.freeSharedMemory();
|
||||
@ -474,7 +463,7 @@ TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegr
|
||||
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
|
||||
REQUIRE(m.getHostname() == c.hostname);
|
||||
|
||||
CHECK(m.setTimer(slsDetectorDefs::FRAME_NUMBER, 1) == 1);
|
||||
CHECK(m.setNumberOfFrames(1) == 1);
|
||||
|
||||
// starting fnum
|
||||
uint64_t val = 8;
|
||||
|
Binary file not shown.
@ -556,13 +556,13 @@ void setupDetector() {
|
||||
enableTenGigabitEthernet(0);
|
||||
|
||||
//Initialization of acquistion parameters
|
||||
setTimer(ANALOG_SAMPLES, DEFAULT_NUM_SAMPLES);
|
||||
setTimer(DIGITAL_SAMPLES, DEFAULT_NUM_SAMPLES); // update databytes and allocate ram
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
|
||||
setNumAnalogSamples(DEFAULT_NUM_SAMPLES);
|
||||
setNumDigitalSamples(DEFAULT_NUM_SAMPLES); // update databytes and allocate ram
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setDelayAfterTrigger(DEFAULT_DELAY);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
setReadoutMode(ANALOG_ONLY);
|
||||
|
||||
@ -863,176 +863,161 @@ int getReadoutMode() {
|
||||
|
||||
|
||||
/* parameters - timer */
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
int64_t retval = -1;
|
||||
switch(ind){
|
||||
|
||||
case FRAME_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #frames: %lld\n",(long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, FRAMES_LSB_REG, FRAMES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("\tGetting #frames: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACQUISITION_TIME:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting exptime (pattern wait time level 0): %lldns\n",(long long int)val));
|
||||
val *= (1E-3 * clkDivider[RUN_CLK]);
|
||||
setPatternWaitTime(0, val);
|
||||
}
|
||||
retval = setPatternWaitTime(0, -1) / (1E-3 * clkDivider[RUN_CLK]);
|
||||
FILE_LOG(logINFO, ("\tGetting exptime (pattern wait time level 0): %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAME_PERIOD:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting period: %lldns\n",(long long int)val));
|
||||
val *= (1E-3 * clkDivider[SYNC_CLK]);
|
||||
}
|
||||
retval = set64BitReg(val, PERIOD_LSB_REG, PERIOD_MSB_REG )/ (1E-3 * clkDivider[SYNC_CLK]);
|
||||
FILE_LOG(logINFO, ("\tGetting period: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting delay: %lldns\n", (long long int)val));
|
||||
val *= (1E-3 * clkDivider[SYNC_CLK]);
|
||||
}
|
||||
retval = set64BitReg(val, DELAY_LSB_REG, DELAY_MSB_REG) / (1E-3 * clkDivider[SYNC_CLK]);
|
||||
FILE_LOG(logINFO, ("\tGetting delay: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, CYCLES_LSB_REG, CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("\tGetting #triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ANALOG_SAMPLES:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #analog samples: %lld\n", (long long int)val));
|
||||
naSamples = val;
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_ANALOG_MSK);
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) | ((val << SAMPLES_ANALOG_OFST) & SAMPLES_ANALOG_MSK));
|
||||
if (allocateRAM() == FAIL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
retval = naSamples;
|
||||
FILE_LOG(logINFO, ("\tGetting #analog samples: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case DIGITAL_SAMPLES:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #digital samples: %lld\n", (long long int)val));
|
||||
ndSamples = val;
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_DIGITAL_MSK);
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) | ((val << SAMPLES_DIGITAL_OFST) & SAMPLES_DIGITAL_MSK));
|
||||
|
||||
if (allocateRAM() == FAIL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
retval = ndSamples;
|
||||
FILE_LOG(logINFO, ("\tGetting #digital samples: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Timer Index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
||||
set64BitReg(val, FRAMES_LSB_REG, FRAMES_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int64_t getTimeLeft(enum timerIndex ind){
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#endif
|
||||
int64_t retval = -1;
|
||||
switch(ind){
|
||||
|
||||
case FRAME_NUMBER:
|
||||
retval = get64BitReg(FRAMES_LEFT_LSB_REG, FRAMES_LEFT_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of frames left: %lld\n",(long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAME_PERIOD:
|
||||
retval = get64BitReg(PERIOD_LEFT_LSB_REG, PERIOD_LEFT_MSB_REG) / (1E-3 * clkDivider[SYNC_CLK]);
|
||||
FILE_LOG(logINFO, ("Getting period left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
retval = get64BitReg(DELAY_LEFT_LSB_REG, DELAY_LEFT_MSB_REG) / (1E-3 * clkDivider[SYNC_CLK]);
|
||||
FILE_LOG(logINFO, ("Getting delay left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(CYCLES_LEFT_LSB_REG, CYCLES_LEFT_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACTUAL_TIME:
|
||||
retval = get64BitReg(TIME_FROM_START_LSB_REG, TIME_FROM_START_MSB_REG) / (1E-3 * CLK_FREQ);
|
||||
FILE_LOG(logINFO, ("Getting actual time (time from start): %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case MEASUREMENT_TIME:
|
||||
retval = get64BitReg(START_FRAME_TIME_LSB_REG, START_FRAME_TIME_MSB_REG) / (1E-3 * CLK_FREQ);
|
||||
FILE_LOG(logINFO, ("Getting measurement time (timestamp/ start frame time): %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAMES_FROM_START:
|
||||
case FRAMES_FROM_START_PG:
|
||||
retval = get64BitReg(FRAMES_FROM_START_PG_LSB_REG, FRAMES_FROM_START_PG_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting frames from start run control %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Remaining Timer index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
int64_t getNumFrames() {
|
||||
return get64BitReg(FRAMES_LSB_REG, FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
void setNumTriggers(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
set64BitReg(val, CYCLES_LSB_REG, CYCLES_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
int validateTimer(enum timerIndex ind, int64_t val, int64_t retval) {
|
||||
if (val < 0)
|
||||
return OK;
|
||||
switch(ind) {
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
// convert to freq
|
||||
val *= (1E-3 * clkDivider[SYNC_CLK]);
|
||||
// convert back to timer
|
||||
val = (val) / (1E-3 * clkDivider[SYNC_CLK]);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
break;
|
||||
case ACQUISITION_TIME:
|
||||
// convert to freq
|
||||
val *= (1E-3 * clkDivider[RUN_CLK]);
|
||||
// convert back to timer
|
||||
val = (val) / (1E-3 * clkDivider[RUN_CLK]);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
int64_t getNumTriggers() {
|
||||
return get64BitReg(CYCLES_LSB_REG, CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
int setNumAnalogSamples(int val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid analog samples: %d\n", val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting number of analog samples %d\n", val));
|
||||
naSamples = val;
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_ANALOG_MSK);
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) | ((val << SAMPLES_ANALOG_OFST) & SAMPLES_ANALOG_MSK));
|
||||
if (allocateRAM() == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getNumAnalogSamples() {
|
||||
return naSamples;
|
||||
}
|
||||
|
||||
int setNumDigitalSamples(int val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid digital samples: %d\n", val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting number of digital samples %d\n", val));
|
||||
ndSamples = val;
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_DIGITAL_MSK);
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) | ((val << SAMPLES_DIGITAL_OFST) & SAMPLES_DIGITAL_MSK));
|
||||
if (allocateRAM() == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getNumDigitalSamples() {
|
||||
return ndSamples;
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * clkDivider[RUN_CLK]);
|
||||
setPatternWaitTime(0, val);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getExpTime();
|
||||
val /= (1E-3 * clkDivider[RUN_CLK]);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
return setPatternWaitTime(0, -1) / (1E-3 * clkDivider[RUN_CLK]);
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * clkDivider[SYNC_CLK]);
|
||||
set64BitReg(val, PERIOD_LSB_REG, PERIOD_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getPeriod();
|
||||
val /= (1E-3 * clkDivider[SYNC_CLK]);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getPeriod() {
|
||||
return get64BitReg(PERIOD_LSB_REG, PERIOD_MSB_REG)/ (1E-3 * clkDivider[SYNC_CLK]);
|
||||
}
|
||||
|
||||
int setDelayAfterTrigger(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * clkDivider[SYNC_CLK]);
|
||||
set64BitReg(val, DELAY_LSB_REG, DELAY_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getDelayAfterTrigger();
|
||||
val /= (1E-3 * clkDivider[SYNC_CLK]);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTrigger() {
|
||||
return get64BitReg(DELAY_LSB_REG, DELAY_MSB_REG) / (1E-3 * clkDivider[SYNC_CLK]);
|
||||
}
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
return get64BitReg(FRAMES_LEFT_LSB_REG, FRAMES_LEFT_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getNumTriggersLeft() {
|
||||
return get64BitReg(CYCLES_LEFT_LSB_REG, CYCLES_LEFT_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTriggerLeft() {
|
||||
return get64BitReg(DELAY_LEFT_LSB_REG, DELAY_LEFT_MSB_REG) / (1E-3 * clkDivider[SYNC_CLK]);
|
||||
}
|
||||
|
||||
int64_t getPeriodLeft() {
|
||||
return get64BitReg(PERIOD_LEFT_LSB_REG, PERIOD_LEFT_MSB_REG) / (1E-3 * clkDivider[SYNC_CLK]);
|
||||
}
|
||||
|
||||
int64_t getFramesFromStart() {
|
||||
return get64BitReg(FRAMES_FROM_START_PG_LSB_REG, FRAMES_FROM_START_PG_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getActualTime() {
|
||||
return get64BitReg(TIME_FROM_START_LSB_REG, TIME_FROM_START_MSB_REG) / (1E-3 * CLK_FREQ);
|
||||
}
|
||||
|
||||
int64_t getMeasurementTime() {
|
||||
return get64BitReg(START_FRAME_TIME_LSB_REG, START_FRAME_TIME_MSB_REG) / (1E-3 * CLK_FREQ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* parameters - settings */
|
||||
enum detectorSettings getSettings() {
|
||||
@ -2199,9 +2184,9 @@ int startStateMachine(){
|
||||
|
||||
#ifdef VIRTUAL
|
||||
void* start_timer(void* arg) {
|
||||
int wait_in_s = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(TRIGGER_NUMBER, -1) *
|
||||
(setTimer(FRAME_PERIOD, -1)/(1E9)));
|
||||
int wait_in_s = (getNumFrames() *
|
||||
getNumTriggers() *
|
||||
(getPeriod()/(1E9)));
|
||||
FILE_LOG(logDEBUG1, ("going to wait for %d s\n", wait_in_s));
|
||||
while(!virtual_stop && (wait_in_s >= 0)) {
|
||||
usleep(1000 * 1000);
|
||||
@ -2341,7 +2326,7 @@ void readFrame(int *ret, char *mess) {
|
||||
// ret could be fail in 1gudp for not creating udp sockets
|
||||
if (*ret != FAIL) {
|
||||
// frames left to give status
|
||||
int64_t retval = getTimeLeft(FRAME_NUMBER) + 2;
|
||||
int64_t retval = getNumFramesLeft() + 2;
|
||||
if ( retval > 1) {
|
||||
sprintf(mess,"No data and run stopped: %lld frames left\n",(long long int)retval);
|
||||
FILE_LOG(logERROR, (mess));
|
||||
|
@ -1363,14 +1363,14 @@ int Feb_Control_SetNExposures(unsigned int n_images) {
|
||||
}
|
||||
|
||||
Feb_Control_nimages = n_images;
|
||||
FILE_LOG(logINFO, ("Number of images set to %d\n",Feb_Control_nimages));
|
||||
FILE_LOG(logDEBUG1, ("Number of images set to %d\n",Feb_Control_nimages));
|
||||
return 1;
|
||||
}
|
||||
unsigned int Feb_Control_GetNExposures() {return Feb_Control_nimages;}
|
||||
|
||||
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec) {
|
||||
Feb_Control_exposure_time_in_sec = the_exposure_time_in_sec;
|
||||
FILE_LOG(logINFO, ("Exposure time set to %fs\n",Feb_Control_exposure_time_in_sec));
|
||||
FILE_LOG(logDEBUG1, ("Exposure time set to %fs\n",Feb_Control_exposure_time_in_sec));
|
||||
return 1;
|
||||
}
|
||||
double Feb_Control_GetExposureTime() {return Feb_Control_exposure_time_in_sec;}
|
||||
@ -1378,14 +1378,14 @@ int64_t Feb_Control_GetExposureTime_in_nsec() {return (int64_t)(Feb_Control_expo
|
||||
|
||||
int Feb_Control_SetSubFrameExposureTime(int64_t the_subframe_exposure_time_in_10nsec) {
|
||||
Feb_Control_subframe_exposure_time_in_10nsec = the_subframe_exposure_time_in_10nsec;
|
||||
FILE_LOG(logINFO, ("Sub Frame Exposure time set to %lldns\n",(long long int)Feb_Control_subframe_exposure_time_in_10nsec * 10));
|
||||
FILE_LOG(logDEBUG1, ("Sub Frame Exposure time set to %lldns\n",(long long int)Feb_Control_subframe_exposure_time_in_10nsec * 10));
|
||||
return 1;
|
||||
}
|
||||
int64_t Feb_Control_GetSubFrameExposureTime() {return Feb_Control_subframe_exposure_time_in_10nsec*10;}
|
||||
|
||||
int Feb_Control_SetSubFramePeriod(int64_t the_subframe_period_in_10nsec) {
|
||||
Feb_Control_subframe_period_in_10nsec = the_subframe_period_in_10nsec;
|
||||
FILE_LOG(logINFO, ("Sub Frame Period set to %lldns\n",(long long int)Feb_Control_subframe_period_in_10nsec * 10));
|
||||
FILE_LOG(logDEBUG1, ("Sub Frame Period set to %lldns\n",(long long int)Feb_Control_subframe_period_in_10nsec * 10));
|
||||
return 1;
|
||||
}
|
||||
int64_t Feb_Control_GetSubFramePeriod() {return Feb_Control_subframe_period_in_10nsec*10;}
|
||||
@ -1393,7 +1393,7 @@ int64_t Feb_Control_GetSubFramePeriod() {return Feb_Control_subframe_period_in_1
|
||||
|
||||
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec) {
|
||||
Feb_Control_exposure_period_in_sec = the_exposure_period_in_sec;
|
||||
FILE_LOG(logINFO, ("Exposure period set to %fs\n",Feb_Control_exposure_period_in_sec));
|
||||
FILE_LOG(logDEBUG1, ("Exposure period set to %fs\n",Feb_Control_exposure_period_in_sec));
|
||||
return 1;
|
||||
}
|
||||
double Feb_Control_GetExposurePeriod() {return Feb_Control_exposure_period_in_sec;}
|
||||
|
Binary file not shown.
@ -436,12 +436,12 @@ void setupDetector() {
|
||||
|
||||
FILE_LOG(logINFOBLUE, ("Setting Default Parameters\n"));
|
||||
//setting default measurement parameters
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(SUBFRAME_ACQUISITION_TIME, DEFAULT_SUBFRAME_EXPOSURE);
|
||||
setTimer(SUBFRAME_DEADTIME, DEFAULT_SUBFRAME_DEADTIME);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setSubExpTime(DEFAULT_SUBFRAME_EXPOSURE);
|
||||
getSubExpTime(DEFAULT_SUBFRAME_DEADTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
|
||||
setParallelMode(DEFAULT_PARALLEL_MODE);
|
||||
@ -609,155 +609,164 @@ int getStartingFrameNumber(uint64_t* retval) {
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
|
||||
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
int64_t subdeadtime = 0;
|
||||
#endif
|
||||
int64_t subexptime = 0;
|
||||
switch(ind) {
|
||||
case FRAME_NUMBER:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG1, ("Setting number of frames: %d * %d\n", (unsigned int)val, eiger_ntriggers));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetNExposures((unsigned int)val*eiger_ntriggers)) {
|
||||
eiger_nexposures = val;
|
||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfTriggers());
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
ndsts_in_use = 1;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
}
|
||||
#else
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_ntriggers)) {
|
||||
eiger_nexposures = val;
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
ndsts_in_use = 1;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
}return eiger_nexposures;
|
||||
|
||||
case ACQUISITION_TIME:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG1, ("Setting exp time: %fs\n", val/(1E9)));
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetExposureTime(val/(1E9));
|
||||
#else
|
||||
eiger_virtual_exptime = (val/(1E9));
|
||||
#endif
|
||||
}
|
||||
#ifndef VIRTUAL
|
||||
return (Feb_Control_GetExposureTime()*(1E9));
|
||||
#else
|
||||
return eiger_virtual_exptime*1e9;
|
||||
#endif
|
||||
eiger_nexposures = val;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG1, ("Setting sub exp time: %lldns\n", (long long int)val));
|
||||
int64_t getNumFrames() {
|
||||
return eiger_nexposures;
|
||||
}
|
||||
|
||||
void setNumTriggers(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
// calculate subdeadtime before settings subexptime
|
||||
subdeadtime = Feb_Control_GetSubFramePeriod() -
|
||||
Feb_Control_GetSubFrameExposureTime();
|
||||
|
||||
Feb_Control_SetSubFrameExposureTime(val/10);
|
||||
// set subperiod
|
||||
Feb_Control_SetSubFramePeriod((val+subdeadtime)/10);
|
||||
#else
|
||||
int64_t subdeadtime = eiger_virtual_subperiod*10 -
|
||||
eiger_virtual_subexptime*10;
|
||||
eiger_virtual_subexptime = (val/(10));
|
||||
eiger_virtual_subperiod = (val+subdeadtime/10);
|
||||
#endif
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_nexposures)) {
|
||||
eiger_ntriggers = val;
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
}
|
||||
#ifndef VIRTUAL
|
||||
return (Feb_Control_GetSubFrameExposureTime());
|
||||
#else
|
||||
return eiger_virtual_subexptime*10;
|
||||
eiger_ntriggers = val;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
case SUBFRAME_DEADTIME:
|
||||
int64_t getNumTriggers() {
|
||||
return eiger_ntriggers;
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
// get subexptime
|
||||
subexptime = Feb_Control_GetSubFrameExposureTime();
|
||||
Feb_Control_SetExposureTime(val/(1E9));
|
||||
#else
|
||||
subexptime = eiger_virtual_subexptime*10;
|
||||
eiger_virtual_exptime = (val/(1E9));
|
||||
#endif
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting sub period (subdeadtime(%lld)): %lldns\n",
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
#ifndef VIRTUAL
|
||||
return (Feb_Control_GetExposureTime()*(1E9));
|
||||
#else
|
||||
return eiger_virtual_exptime*1e9;
|
||||
#endif
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetExposurePeriod(val/(1E9));
|
||||
#else
|
||||
eiger_virtual_period = (val/(1E9));
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getPeriod() {
|
||||
#ifndef VIRTUAL
|
||||
return (Feb_Control_GetExposurePeriod()*(1E9));
|
||||
#else
|
||||
return eiger_virtual_period*1e9;
|
||||
#endif
|
||||
}
|
||||
|
||||
int setSubExpTime(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting subexptime %lld ns\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
// calculate subdeadtime before settings subexptime
|
||||
int64_t subdeadtime = Feb_Control_GetSubFramePeriod() - Feb_Control_GetSubFrameExposureTime();
|
||||
Feb_Control_SetSubFrameExposureTime(val / 10);
|
||||
// set subperiod
|
||||
Feb_Control_SetSubFramePeriod((val+subdeadtime) / 10);
|
||||
#else
|
||||
int64_t subdeadtime = eiger_virtual_subperiod * 10 -
|
||||
eiger_virtual_subexptime * 10;
|
||||
eiger_virtual_subexptime = (val / (10));
|
||||
eiger_virtual_subperiod = (val + subdeadtime/10);
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t getSubExpTime() {
|
||||
#ifndef VIRTUAL
|
||||
return (Feb_Control_GetSubFrameExposureTime());
|
||||
#else
|
||||
return eiger_virtual_subexptime*10;
|
||||
#endif
|
||||
}
|
||||
|
||||
int setDeadTime(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting subdeadtime %lld ns\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
// get subexptime
|
||||
int64_t subexptime = Feb_Control_GetSubFrameExposureTime();
|
||||
#else
|
||||
int64_t subexptime = eiger_virtual_subexptime * 10;
|
||||
#endif
|
||||
FILE_LOG(logINFO, ("Setting sub period (subdeadtime(%lld)): %lldns\n",
|
||||
(long long int)subexptime,
|
||||
(long long int)val),
|
||||
(long long int)(val + subexptime));
|
||||
//calculate subperiod
|
||||
val += subexptime;
|
||||
//calculate subperiod
|
||||
val += subexptime;
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetSubFramePeriod(val/10);
|
||||
Feb_Control_SetSubFramePeriod(val/10);
|
||||
#else
|
||||
eiger_virtual_subperiod = (val/10);
|
||||
eiger_virtual_subperiod = (val/10);
|
||||
#endif
|
||||
}
|
||||
#ifndef VIRTUAL
|
||||
return (Feb_Control_GetSubFramePeriod() - subexptime);
|
||||
#else
|
||||
return (eiger_virtual_subperiod*10 - subexptime);
|
||||
#endif
|
||||
|
||||
case FRAME_PERIOD:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG1, ("Setting acq period: %fs\n", val/(1E9)));
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetExposurePeriod(val/(1E9));
|
||||
#else
|
||||
eiger_virtual_period = (val/(1E9));
|
||||
#endif
|
||||
}
|
||||
#ifndef VIRTUAL
|
||||
return (Feb_Control_GetExposurePeriod()*(1E9));
|
||||
#else
|
||||
return eiger_virtual_period*1e9;
|
||||
#endif
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG1, ("Setting number of triggers: %d * %d\n",
|
||||
(unsigned int)val,eiger_nexposures));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetNExposures((unsigned int)val*eiger_nexposures)) {
|
||||
eiger_ntriggers = val;
|
||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfTriggers());
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
}
|
||||
#else
|
||||
eiger_ntriggers = val;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
}
|
||||
return eiger_ntriggers;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Timer Index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int64_t getDeadTime() {
|
||||
#ifndef VIRTUAL
|
||||
// get subexptime
|
||||
int64_t subexptime = Feb_Control_GetSubFrameExposureTime();
|
||||
#else
|
||||
int64_t subexptime = eiger_virtual_subexptime * 10;
|
||||
#endif
|
||||
#ifndef VIRTUAL
|
||||
return (Feb_Control_GetSubFramePeriod() - subexptime);
|
||||
#else
|
||||
return (eiger_virtual_subperiod*10 - subexptime);
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t getTimeLeft(enum timerIndex ind) {
|
||||
int64_t getMeasuredPeriod() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#else
|
||||
switch(ind) {
|
||||
case MEASURED_PERIOD: return Feb_Control_GetMeasuredPeriod();
|
||||
case MEASURED_SUBPERIOD: return Feb_Control_GetSubMeasuredPeriod();
|
||||
return 0;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("This timer left index (%d) not defined for Eiger\n", ind));
|
||||
return -1;
|
||||
}
|
||||
return Feb_Control_GetMeasuredPeriod();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int64_t getMeasuredSubPeriod() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#else
|
||||
return Feb_Control_GetSubMeasuredPeriod();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* parameters - channel, module, settings */
|
||||
|
Binary file not shown.
@ -373,10 +373,10 @@ void setupDetector() {
|
||||
// Default values
|
||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||
setDefaultDacs();
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_PERIOD);
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
}
|
||||
|
||||
int setDefaultDacs() {
|
||||
@ -403,101 +403,78 @@ int setDynamicRange(int dr){
|
||||
|
||||
|
||||
/* parameters */
|
||||
|
||||
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
int64_t retval = -1;
|
||||
|
||||
switch(ind) {
|
||||
|
||||
case FRAME_NUMBER: // defined in sls_detector_defs.h (general)
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #frames: %lld\n",(long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); // defined in my RegisterDefs.h
|
||||
FILE_LOG(logDEBUG1, ("Getting #frames: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACQUISITION_TIME:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting exptime: %lldns\n", (long long int)val));
|
||||
val *= (1E-9 * READOUT_C0); //TODO
|
||||
}
|
||||
retval = set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) / (1E-9 * READOUT_C0); //TODO
|
||||
FILE_LOG(logDEBUG1, ("Getting exptime: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAME_PERIOD:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting period: %lldns\n",(long long int)val));
|
||||
val *= (1E-9 * SYSTEM_C0);//TODO
|
||||
}
|
||||
retval = set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG )/ (1E-9 * SYSTEM_C0); //TODO
|
||||
FILE_LOG(logDEBUG1, ("Getting period: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("Getting #triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Timer Index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
int validateTimer(enum timerIndex ind, int64_t val, int64_t retval) {
|
||||
if (val < 0)
|
||||
return OK;
|
||||
switch(ind) {
|
||||
case ACQUISITION_TIME:
|
||||
// convert to freq
|
||||
val *= (1E-9 * READOUT_C0);//TODO
|
||||
// convert back to timer
|
||||
val = (val) / (1E-9 * READOUT_C0);//TODO
|
||||
if (val != retval)
|
||||
return FAIL;
|
||||
break;
|
||||
case FRAME_PERIOD:
|
||||
// convert to freq
|
||||
val *= (1E-9 * SYSTEM_C0);//TODO
|
||||
// convert back to timer
|
||||
val = (val) / (1E-9 * SYSTEM_C0);//TODO
|
||||
if (val != retval)
|
||||
return FAIL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
int64_t getNumFrames() {
|
||||
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
void setNumTriggers(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumTriggers() {
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
||||
val *= (1E-9 * READOUT_C0);
|
||||
set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getExpTime();
|
||||
val /= (1E-9 * READOUT_C0);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
return get64BitReg(SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) / (1E-9 * READOUT_C0);
|
||||
}
|
||||
|
||||
int64_t getTimeLeft(enum timerIndex ind){
|
||||
int64_t retval = -1;
|
||||
switch(ind){
|
||||
int setPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
val *= (1E-9 * SYSTEM_C0);
|
||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||
|
||||
case FRAME_NUMBER:
|
||||
retval = get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of frames left: %lld\n",(long long int)retval));
|
||||
break;
|
||||
// validate for tolerance
|
||||
int64_t retval = getPeriod();
|
||||
val /= (1E-9 * SYSTEM_C0);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
int64_t getPeriod() {
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * SYSTEM_C0);
|
||||
}
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Remaining Timer index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
int64_t getNumFramesLeft() {
|
||||
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getNumTriggersLeft() {
|
||||
return get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
|
||||
@ -868,10 +845,10 @@ int startStateMachine(){
|
||||
|
||||
#ifdef VIRTUAL
|
||||
void* start_timer(void* arg) {
|
||||
int64_t periodns = setTimer(FRAME_PERIOD, -1);
|
||||
int numFrames = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(TRIGGER_NUMBER, -1) );
|
||||
int64_t exp_ns = setTimer(ACQUISITION_TIME, -1);
|
||||
int64_t periodns = getPeriod();
|
||||
int numFrames = (getNumFrames() *
|
||||
getNumTriggers() );
|
||||
int64_t exp_ns = getExpTime();
|
||||
|
||||
|
||||
int frameNr = 0;
|
||||
|
Binary file not shown.
@ -420,11 +420,11 @@ void setupDetector() {
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
setExtSignal(DEFAULT_TRIGGER_MODE);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setDelayAfterTrigger(DEFAULT_DELAY);
|
||||
|
||||
}
|
||||
|
||||
@ -692,7 +692,7 @@ void setMasterSlaveConfiguration() {
|
||||
// master configuration
|
||||
if (masterflags == IS_MASTER) {
|
||||
// master default delay set, so reset delay
|
||||
setTimer(DELAY_AFTER_TRIGGER, 0);
|
||||
setDelayAfterTrigger(0);
|
||||
|
||||
// Set pattern phase for the master module
|
||||
u_int32_t val = (bus_r(MULTI_PURPOSE_REG) & (~(PLL_CLK_SL_MSK))); // unset mask
|
||||
@ -800,153 +800,130 @@ int getSpeed(enum speedVariable ind) {
|
||||
}
|
||||
|
||||
/* parameters - timer */
|
||||
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
int64_t retval = -1;
|
||||
switch(ind){
|
||||
|
||||
case FRAME_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting Frames: %lld\n",(long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("\tGetting Frames: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACQUISITION_TIME:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting Exptime: %lld ns\n", (long long int)val));
|
||||
val = (val * 1E-3 * CLK_FREQ) + 0.5;
|
||||
}
|
||||
retval = (set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) /
|
||||
(1E-3 * CLK_FREQ)) + 0.5;
|
||||
FILE_LOG(logINFO, ("\tGetting Exptime: %lld ns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAME_PERIOD:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting Period: %lld ns\n",(long long int)val));
|
||||
val = (val * 1E-3 * CLK_FREQ) + 0.5;
|
||||
}
|
||||
retval = (set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
||||
(1E-3 * CLK_FREQ)) + 0.5;
|
||||
FILE_LOG(logINFO, ("\tGetting Period: %lld ns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting Delay: %lld ns\n", (long long int)val));
|
||||
if (masterflags == IS_MASTER) {
|
||||
val += masterdefaultdelay;
|
||||
FILE_LOG(logINFO, ("\tActual Delay (master): %lld\n", (long long int) val));
|
||||
}
|
||||
val = (val * 1E-3 * CLK_FREQ) + 0.5;
|
||||
}
|
||||
retval = (set64BitReg(val, SET_DELAY_LSB_REG, SET_DELAY_MSB_REG) /
|
||||
(1E-3 * CLK_FREQ)) + 0.5;
|
||||
FILE_LOG(logINFO, ("\tGetting Delay: %lld ns\n", (long long int)retval));
|
||||
if (masterflags == IS_MASTER) {
|
||||
FILE_LOG(logDEBUG1, ("\tActual Delay read (master): %lld\n", (long long int) retval));
|
||||
retval -= masterdefaultdelay;
|
||||
}
|
||||
break;
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting Triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("\tGetting Triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Timer Index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int64_t getTimeLeft(enum timerIndex ind){
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#endif
|
||||
int64_t retval = -1;
|
||||
switch(ind){
|
||||
|
||||
case FRAME_NUMBER:
|
||||
retval = get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of frames left: %lld\n",(long long int)retval));
|
||||
break;
|
||||
|
||||
case ACQUISITION_TIME:
|
||||
retval = (get64BitReg(GET_EXPTIME_LSB_REG, GET_EXPTIME_MSB_REG) /
|
||||
(1E-3 * CLK_FREQ)) + 0.5;
|
||||
FILE_LOG(logINFO, ("Getting exptime left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAME_PERIOD:
|
||||
retval = (get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) /
|
||||
(1E-3 * CLK_FREQ)) + 0.5;
|
||||
FILE_LOG(logINFO, ("Getting period left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
retval = (get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) /
|
||||
(1E-3 * CLK_FREQ)) + 0.5;
|
||||
FILE_LOG(logINFO, ("Getting delay left: %lldns\n", (long long int)retval));
|
||||
if (masterflags == IS_MASTER) {
|
||||
FILE_LOG(logDEBUG1, ("\tGetting Actual delay (master): %lld\n", (long long int) retval));
|
||||
retval -= masterdefaultdelay;
|
||||
}
|
||||
break;
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(GET_TRAINS_LSB_REG, GET_TRAINS_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Remaining Timer index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
int64_t getNumFrames() {
|
||||
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
int validateTimer(enum timerIndex ind, int64_t val, int64_t retval) {
|
||||
if (val < 0)
|
||||
return OK;
|
||||
switch(ind) {
|
||||
case ACQUISITION_TIME:
|
||||
case FRAME_PERIOD:
|
||||
val = (val * 1E-3 * CLK_FREQ) + 0.5; // convert to freq
|
||||
val = (val / (1E-3 * CLK_FREQ)) + 0.5; // convert back to timer
|
||||
if (val != retval)
|
||||
return FAIL;
|
||||
break;
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
if (masterflags == IS_MASTER) {
|
||||
val += masterdefaultdelay;
|
||||
}
|
||||
val = (val * 1E-3 * CLK_FREQ) + 0.5; // convert to freq
|
||||
val = (val / (1E-3 * CLK_FREQ)) + 0.5; // convert back to timer
|
||||
if (masterflags == IS_MASTER) {
|
||||
val -= masterdefaultdelay;
|
||||
}
|
||||
if (val != retval)
|
||||
return FAIL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
void setNumTriggers(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumTriggers() {
|
||||
return get64BitReg(SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG);
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
||||
val = (val * 1E-9 * CLK_FREQ) + 0.5;
|
||||
set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getExpTime();
|
||||
val /= (1E-9 * CLK_FREQ);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
return get64BitReg(SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) / (1E-9 * CLK_FREQ);
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
val = (val * 1E-9 * CLK_FREQ) + 0.5;
|
||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getPeriod();
|
||||
val /= (1E-9 * CLK_FREQ);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getPeriod() {
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * CLK_FREQ);
|
||||
}
|
||||
|
||||
int setDelayAfterTrigger(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||
if (masterflags == IS_MASTER) {
|
||||
val += masterdefaultdelay;
|
||||
FILE_LOG(logINFO, ("\tActual Delay (master): %lld\n", (long long int) val));
|
||||
}
|
||||
val = (val * 1E-9 * CLK_FREQ) + 0.5; //because of the master delay of 62 ns (not really double of clkfreq), losing precision and 0 delay becomes -31ns, so adding +0.5. Also adding +0.5 for more tolerance for gotthard1.
|
||||
set64BitReg(val, SET_DELAY_LSB_REG, SET_DELAY_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getDelayAfterTrigger();
|
||||
val /= (1E-9 * CLK_FREQ);
|
||||
val -= masterdefaultdelay;
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTrigger() {
|
||||
int64_t retval = get64BitReg(SET_DELAY_LSB_REG, SET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ);
|
||||
if (masterflags == IS_MASTER) {
|
||||
FILE_LOG(logDEBUG1, ("\tActual Delay read (master): %lld\n", (long long int) retval));
|
||||
retval -= masterdefaultdelay;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getNumTriggersLeft() {
|
||||
return get64BitReg(GET_TRAINS_LSB_REG, GET_TRAINS_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getPeriodLeft() {
|
||||
return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / (1E-9 * CLK_FREQ);
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTriggerLeft() {
|
||||
int64_t retval = get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ);
|
||||
if (masterflags == IS_MASTER) {
|
||||
FILE_LOG(logDEBUG1, ("\tGetting Actual delay (master): %lld\n", (long long int) retval));
|
||||
retval -= masterdefaultdelay;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t getExpTimeLeft() {
|
||||
return get64BitReg(GET_EXPTIME_LSB_REG, GET_EXPTIME_MSB_REG) / (1E-9 * CLK_FREQ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* parameters - channel, chip, module, settings */
|
||||
|
||||
@ -1465,10 +1442,10 @@ int configureMAC() {
|
||||
FILE_LOG(logINFOBLUE, ("Sending an image to counter the packet numbers\n"));
|
||||
// remember old parameters
|
||||
enum timingMode oldtiming = getTiming();
|
||||
uint64_t oldframes = setTimer(FRAME_NUMBER, -1);
|
||||
uint64_t oldtriggers = setTimer(TRIGGER_NUMBER, -1);
|
||||
uint64_t oldPeriod = setTimer(FRAME_PERIOD, -1);
|
||||
uint64_t oldExptime = setTimer(ACQUISITION_TIME, -1);
|
||||
uint64_t oldframes = getNumFrames();
|
||||
uint64_t oldtriggers = getNumTriggers();
|
||||
uint64_t oldPeriod = getPeriod();
|
||||
uint64_t oldExptime = getExpTime();
|
||||
|
||||
// set to basic parameters
|
||||
FILE_LOG(logINFO, ("\tSetting basic parameters\n"
|
||||
@ -1478,10 +1455,10 @@ int configureMAC() {
|
||||
"\tperiod: 1s\n"
|
||||
"\texptime: 900ms\n"));
|
||||
setTiming(AUTO_TIMING);
|
||||
setTimer(FRAME_NUMBER, 1);
|
||||
setTimer(TRIGGER_NUMBER, 1);
|
||||
setTimer(FRAME_PERIOD, 1e9); // important to keep this until we have to wait for acquisition to start
|
||||
setTimer(ACQUISITION_TIME, 900 * 1000);
|
||||
setNumFrames(1);
|
||||
setNumTriggers(1);
|
||||
setPeriod(1e9); // important to keep this until we have to wait for acquisition to start
|
||||
setExpTime(900 * 1000);
|
||||
|
||||
// take an image
|
||||
if (masterflags == IS_MASTER)
|
||||
@ -1497,7 +1474,7 @@ int configureMAC() {
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("\twaited %d loops to start\n", loop));
|
||||
FILE_LOG(logINFO, ("\tWaiting for acquisition to end (frames left: %lld)\n", (long long int)getTimeLeft(FRAME_NUMBER)));
|
||||
FILE_LOG(logINFO, ("\tWaiting for acquisition to end (frames left: %lld)\n", (long long int)getNumFramesLeft()));
|
||||
// wait for status to be done
|
||||
while(runBusy()){
|
||||
usleep(500);
|
||||
@ -1513,10 +1490,10 @@ int configureMAC() {
|
||||
(int)oldtiming, (long long int)oldframes, (long long int)oldtriggers,
|
||||
(long long int)oldPeriod, (long long int)oldExptime));
|
||||
setTiming(oldtiming);
|
||||
setTimer(FRAME_NUMBER, oldframes);
|
||||
setTimer(TRIGGER_NUMBER, oldtriggers);
|
||||
setTimer(FRAME_PERIOD, oldPeriod);
|
||||
setTimer(ACQUISITION_TIME, oldExptime);
|
||||
setNumFrames(oldframes);
|
||||
setNumTriggers(oldtriggers);
|
||||
setPeriod(oldPeriod);
|
||||
setExpTime(oldExptime);
|
||||
FILE_LOG(logINFOBLUE, ("Done sending a frame at configuration\n"));
|
||||
}
|
||||
return OK;
|
||||
@ -1552,7 +1529,7 @@ int startStateMachine(){
|
||||
return OK;
|
||||
#endif
|
||||
FILE_LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||
FILE_LOG(logINFO, ("#frames to acquire:%lld\n", (long long int)setTimer(FRAME_NUMBER, -1)));
|
||||
FILE_LOG(logINFO, ("#frames to acquire:%lld\n", (long long int)getNumFrames()));
|
||||
|
||||
cleanFifos();
|
||||
|
||||
@ -1565,9 +1542,9 @@ int startStateMachine(){
|
||||
|
||||
#ifdef VIRTUAL
|
||||
void* start_timer(void* arg) {
|
||||
int wait_in_s = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(TRIGGER_NUMBER, -1) *
|
||||
(setTimer(FRAME_PERIOD, -1)/(1E9)));
|
||||
int wait_in_s = (getNumFrames() *
|
||||
getNumTriggers() *
|
||||
(getPeriod()/(1E9)));
|
||||
FILE_LOG(logDEBUG1, ("going to wait for %d s\n", wait_in_s));
|
||||
while(!virtual_stop && (wait_in_s >= 0)) {
|
||||
usleep(1000 * 1000);
|
||||
@ -1697,7 +1674,7 @@ void readFrame(int *ret, char *mess){
|
||||
|
||||
// frames left to give status
|
||||
*ret = (int)OK;
|
||||
int64_t retval = getTimeLeft(FRAME_NUMBER) + 1;
|
||||
int64_t retval = getNumFramesLeft() + 1;
|
||||
if ( retval > -1) {
|
||||
FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval));
|
||||
} else {
|
||||
|
@ -28,7 +28,7 @@ enum DACINDEX {G_VREF_DS, G_VCASCN_PB, G_VCASCP_PB, G_VOUT_CM, G_VCAS
|
||||
#define DYNAMIC_RANGE (16)
|
||||
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
|
||||
#define CLK_FREQ (32.007729) /* MHz */
|
||||
#define CLK_FREQ (32007729) /* Hz */
|
||||
|
||||
/** Firmware Definitions */
|
||||
#define IP_PACKET_SIZE_NO_ROI (NCHIP * (NCHAN / 2) * 2 + 14 + 20) // 2 packets, so divide by 2
|
||||
|
Binary file not shown.
@ -444,13 +444,13 @@ void setupDetector() {
|
||||
//Initialization of acquistion parameters
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
|
||||
setTimer(STORAGE_CELL_NUMBER, DEFAULT_NUM_STRG_CLLS);
|
||||
setTimer(STORAGE_CELL_DELAY, DEFAULT_STRG_CLL_DLY);
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setDelayAfterTrigger(DEFAULT_DELAY);
|
||||
setNumAdditionalStorageCells(DEFAULT_NUM_STRG_CLLS);
|
||||
setStorageCellDelay(DEFAULT_STRG_CLL_DLY);
|
||||
selectStoragecellStart(DEFAULT_STRG_CLL_STRT);
|
||||
/*setClockDivider(HALF_SPEED); depends if all the previous stuff works*/
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
@ -598,180 +598,165 @@ int getStartingFrameNumber(uint64_t* retval) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
int64_t retval = -1;
|
||||
switch(ind){
|
||||
|
||||
case FRAME_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #frames: %lld\n",(long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("Getting #frames: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACQUISITION_TIME:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting exptime: %lldns\n", (long long int)val));
|
||||
val *= (1E-3 * CLK_RUN);
|
||||
val -= ACQ_TIME_MIN_CLOCK;
|
||||
if(val < 0) val = 0;
|
||||
}
|
||||
retval = (set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) + ACQ_TIME_MIN_CLOCK) / (1E-3 * CLK_RUN);
|
||||
FILE_LOG(logDEBUG1, ("Getting exptime: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAME_PERIOD:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting period: %lldns\n",(long long int)val));
|
||||
val *= (1E-3 * CLK_SYNC);
|
||||
}
|
||||
retval = set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG )/ (1E-3 * CLK_SYNC);
|
||||
FILE_LOG(logDEBUG1, ("Getting period: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting delay: %lldns\n", (long long int)val));
|
||||
val *= (1E-3 * CLK_SYNC);
|
||||
}
|
||||
retval = set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
FILE_LOG(logDEBUG1, ("Getting delay: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("Getting #triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case STORAGE_CELL_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #storage cells: %lld\n", (long long int)val));
|
||||
bus_w(CONTROL_REG, (bus_r(CONTROL_REG) & ~CONTROL_STORAGE_CELL_NUM_MSK) |
|
||||
((val << CONTROL_STORAGE_CELL_NUM_OFST) & CONTROL_STORAGE_CELL_NUM_MSK));
|
||||
}
|
||||
retval = ((bus_r(CONTROL_REG) & CONTROL_STORAGE_CELL_NUM_MSK) >> CONTROL_STORAGE_CELL_NUM_OFST);
|
||||
FILE_LOG(logDEBUG1, ("Getting #storage cells: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case STORAGE_CELL_DELAY:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting storage cell delay: %lldns\n", (long long int)val));
|
||||
val *= (1E-3 * CLK_RUN);
|
||||
bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_EXPSRE_TMR_MSK) |
|
||||
((val << ASIC_CTRL_EXPSRE_TMR_OFST) & ASIC_CTRL_EXPSRE_TMR_MSK));
|
||||
}
|
||||
|
||||
retval = (((int64_t)((bus_r(ASIC_CTRL_REG) & ASIC_CTRL_EXPSRE_TMR_MSK) >> ASIC_CTRL_EXPSRE_TMR_OFST))/ (1E-3 * CLK_RUN));
|
||||
FILE_LOG(logDEBUG1, ("Getting storage cell delay: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Timer Index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int64_t getTimeLeft(enum timerIndex ind){
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#endif
|
||||
int64_t retval = -1;
|
||||
switch(ind){
|
||||
|
||||
case FRAME_NUMBER:
|
||||
retval = get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of frames left: %lld\n",(long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAME_PERIOD:
|
||||
retval = get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
FILE_LOG(logINFO, ("Getting period left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
retval = get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
FILE_LOG(logINFO, ("Getting delay left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACTUAL_TIME:
|
||||
retval = get64BitReg(TIME_FROM_START_LSB_REG, TIME_FROM_START_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
FILE_LOG(logINFO, ("Getting actual time (time from start): %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case MEASUREMENT_TIME:
|
||||
retval = get64BitReg(START_FRAME_TIME_LSB_REG, START_FRAME_TIME_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
FILE_LOG(logINFO, ("Getting measurement time (timestamp/ start frame time): %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAMES_FROM_START:
|
||||
case FRAMES_FROM_START_PG:
|
||||
retval = get64BitReg(FRAMES_FROM_START_LSB_REG, FRAMES_FROM_START_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting frames from start run control %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Remaining Timer index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
int64_t getNumFrames() {
|
||||
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
void setNumTriggers(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
int validateTimer(enum timerIndex ind, int64_t val, int64_t retval) {
|
||||
if (val < 0)
|
||||
return OK;
|
||||
switch(ind) {
|
||||
case ACQUISITION_TIME:
|
||||
// convert to freq
|
||||
val *= (1E-3 * CLK_RUN);
|
||||
val -= ACQ_TIME_MIN_CLOCK;
|
||||
if(val < 0) val = 0;
|
||||
// convert back to timer
|
||||
val = (val + ACQ_TIME_MIN_CLOCK) / (1E-3 * CLK_RUN);
|
||||
if (val != retval)
|
||||
return FAIL;
|
||||
break;
|
||||
case STORAGE_CELL_DELAY:
|
||||
// convert to freq
|
||||
val *= (1E-3 * CLK_RUN);
|
||||
if(val < 0) val = 0;
|
||||
// convert back to timer
|
||||
val = val / (1E-3 * CLK_RUN);
|
||||
if (val != retval)
|
||||
return FAIL;
|
||||
break;
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
// convert to freq
|
||||
val *= (1E-3 * CLK_SYNC);
|
||||
// convert back to timer
|
||||
val = (val) / (1E-3 * CLK_SYNC);
|
||||
if (val != retval)
|
||||
return FAIL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
int64_t getNumTriggers() {
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * CLK_RUN);
|
||||
val -= ACQ_TIME_MIN_CLOCK;
|
||||
if (val < 0) {
|
||||
val = 0;
|
||||
}
|
||||
set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
val += ACQ_TIME_MIN_CLOCK;
|
||||
int64_t retval = getExpTime();
|
||||
val /= (1E-3 * CLK_RUN);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
return (get64BitReg(SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) + ACQ_TIME_MIN_CLOCK) / (1E-3 * CLK_RUN);
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * CLK_SYNC);
|
||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getPeriod();
|
||||
val /= (1E-3 * CLK_SYNC);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getPeriod() {
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-3 * CLK_SYNC);
|
||||
}
|
||||
|
||||
int setDelayAfterTrigger(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * CLK_SYNC);
|
||||
set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getDelayAfterTrigger();
|
||||
val /= (1E-3 * CLK_SYNC);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTrigger() {
|
||||
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
|
||||
}
|
||||
|
||||
void setNumAdditionalStorageCells(int val) {
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of addl. storage cells %d\n", val));
|
||||
bus_w(CONTROL_REG, (bus_r(CONTROL_REG) & ~CONTROL_STORAGE_CELL_NUM_MSK) |
|
||||
((val << CONTROL_STORAGE_CELL_NUM_OFST) & CONTROL_STORAGE_CELL_NUM_MSK));
|
||||
}
|
||||
}
|
||||
|
||||
int getNumAdditionalStorageCells() {
|
||||
return ((bus_r(CONTROL_REG) & CONTROL_STORAGE_CELL_NUM_MSK) >> CONTROL_STORAGE_CELL_NUM_OFST);
|
||||
}
|
||||
|
||||
int setStorageCellDelay(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting storage cell delay %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * CLK_RUN);
|
||||
bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_EXPSRE_TMR_MSK) |
|
||||
((val << ASIC_CTRL_EXPSRE_TMR_OFST) & ASIC_CTRL_EXPSRE_TMR_MSK));
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getStorageCellDelay();
|
||||
val /= (1E-3 * CLK_RUN);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getStorageCellDelay() {
|
||||
return (((int64_t)((bus_r(ASIC_CTRL_REG) & ASIC_CTRL_EXPSRE_TMR_MSK) >> ASIC_CTRL_EXPSRE_TMR_OFST))/ (1E-3 * CLK_RUN));
|
||||
|
||||
}
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getNumTriggersLeft() {
|
||||
return get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getPeriodLeft() {
|
||||
return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTriggerLeft() {
|
||||
return get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
}
|
||||
|
||||
int64_t getFramesFromStart() {
|
||||
return get64BitReg(FRAMES_FROM_START_LSB_REG, FRAMES_FROM_START_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getActualTime() {
|
||||
return get64BitReg(TIME_FROM_START_LSB_REG, TIME_FROM_START_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
}
|
||||
|
||||
int64_t getMeasurementTime() {
|
||||
return get64BitReg(START_FRAME_TIME_LSB_REG, START_FRAME_TIME_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* parameters - channel, chip, module, settings */
|
||||
@ -1688,11 +1673,11 @@ int startStateMachine(){
|
||||
|
||||
#ifdef VIRTUAL
|
||||
void* start_timer(void* arg) {
|
||||
int64_t periodns = setTimer(FRAME_PERIOD, -1);
|
||||
int numFrames = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(TRIGGER_NUMBER, -1) *
|
||||
(setTimer(STORAGE_CELL_NUMBER, -1) + 1));
|
||||
int64_t exp_ns = setTimer(ACQUISITION_TIME, -1);
|
||||
int64_t periodns = getPeriod();
|
||||
int numFrames = (getNumFrames() *
|
||||
getNumTriggers() *
|
||||
(getNumAdditionalStorageCells() + 1));
|
||||
int64_t exp_ns = getExpTime();
|
||||
|
||||
//TODO: Generate data
|
||||
char imageData[DATA_BYTES];
|
||||
@ -1839,7 +1824,7 @@ void readFrame(int *ret, char *mess){
|
||||
|
||||
*ret = (int)OK;
|
||||
// frames left to give status
|
||||
int64_t retval = getTimeLeft(FRAME_NUMBER) + 1;
|
||||
int64_t retval = getNumFramesLeft() + 1;
|
||||
|
||||
if ( retval > 0) {
|
||||
FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval));
|
||||
|
Binary file not shown.
@ -359,12 +359,11 @@ void setupDetector() {
|
||||
setDefaultDacs();
|
||||
|
||||
// Initialization of acquistion parameters
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY_AFTER_TRIGGER);
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setDelayAfterTrigger(DEFAULT_DELAY_AFTER_TRIGGER);
|
||||
}
|
||||
|
||||
int setDefaultDacs() {
|
||||
@ -397,118 +396,104 @@ int getSpeed(enum speedVariable ind) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
|
||||
int64_t retval = -1;
|
||||
|
||||
switch(ind){
|
||||
|
||||
case FRAME_NUMBER: // defined in sls_detector_defs.h (general)
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #frames: %lld\n",(long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); // defined in my RegisterDefs.h
|
||||
FILE_LOG(logDEBUG1, ("Getting #frames: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACQUISITION_TIME:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting exptime (pattern wait time level 0): %lldns\n",(long long int)val));
|
||||
val *= (1E-3 * clkDivider[RUN_CLK]);
|
||||
setPatternWaitTime(0, val);
|
||||
}
|
||||
retval = setPatternWaitTime(0, -1) / (1E-3 * clkDivider[RUN_CLK]);
|
||||
FILE_LOG(logINFO, ("\tGetting exptime (pattern wait time level 0): %lldns\n", (long long int)retval));
|
||||
FILE_LOG(logDEBUG1, ("Getting exptime (pattern wait time level 0): %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case FRAME_PERIOD:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting period: %lldns\n",(long long int)val));
|
||||
val *= (1E-3 * TICK_CLK);
|
||||
}
|
||||
retval = set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG )/ (1E-3 * TICK_CLK);
|
||||
FILE_LOG(logDEBUG1, ("Getting period: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
if(val >= 0){
|
||||
FILE_LOG(logINFO, ("Setting delay: %lldns\n", (long long int)val));
|
||||
val *= (1E-3 * clkDivider[TICK_CLK]);
|
||||
}
|
||||
retval = set64BitReg(val, GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-3 * clkDivider[TICK_CLK]);
|
||||
FILE_LOG(logINFO, ("\tGetting delay: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("Getting #triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Timer Index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
int validateTimer(enum timerIndex ind, int64_t val, int64_t retval) {
|
||||
if (val < 0)
|
||||
return OK;
|
||||
switch(ind) {
|
||||
case ACQUISITION_TIME:
|
||||
// convert to freq
|
||||
val *= (1E-3 * RUN_CLK);
|
||||
// convert back to timer
|
||||
val = (val) / (1E-3 * RUN_CLK);
|
||||
if (val != retval)
|
||||
return FAIL;
|
||||
break;
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
// convert to freq
|
||||
val *= (1E-3 * TICK_CLK);
|
||||
// convert back to timer
|
||||
val = (val) / (1E-3 * TICK_CLK);
|
||||
if (val != retval)
|
||||
return FAIL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getNumFrames() {
|
||||
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
void setNumTriggers(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumTriggers() {
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * clkDivider[RUN_CLK]);
|
||||
setPatternWaitTime(0, val);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getExpTime();
|
||||
val /= (1E-3 * clkDivider[RUN_CLK]);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
return setPatternWaitTime(0, -1) / (1E-3 * clkDivider[RUN_CLK]);
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * clkDivider[TICK_CLK]);
|
||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getPeriod();
|
||||
val /= (1E-3 * clkDivider[TICK_CLK]);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getPeriod() {
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-3 * clkDivider[TICK_CLK]);
|
||||
}
|
||||
|
||||
int setDelayAfterTrigger(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||
val *= (1E-3 * clkDivider[TICK_CLK]);
|
||||
set64BitReg(val, SET_DELAY_LSB_REG, SET_DELAY_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getDelayAfterTrigger();
|
||||
val /= (1E-3 * clkDivider[TICK_CLK]);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTrigger() {
|
||||
return get64BitReg(SET_DELAY_LSB_REG, SET_DELAY_MSB_REG) / (1E-3 * clkDivider[TICK_CLK]);
|
||||
|
||||
}
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getNumTriggersLeft() {
|
||||
return get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
|
||||
int64_t getTimeLeft(enum timerIndex ind){
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#endif
|
||||
int64_t retval = -1;
|
||||
switch(ind){
|
||||
|
||||
case FRAME_NUMBER:
|
||||
retval = get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of frames left: %lld\n",(long long int)retval));
|
||||
break;
|
||||
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Remaining Timer index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/* parameters - dac, hv */
|
||||
@ -958,10 +943,10 @@ int startStateMachine(){
|
||||
|
||||
#ifdef VIRTUAL
|
||||
void* start_timer(void* arg) {
|
||||
int64_t periodns = setTimer(FRAME_PERIOD, -1);
|
||||
int numFrames = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(TRIGGER_NUMBER, -1) );
|
||||
int64_t exp_ns = setTimer(ACQUISITION_TIME, -1);
|
||||
int64_t periodns = getPeriod();
|
||||
int numFrames = (getNumFrames() *
|
||||
getNumTriggers() );
|
||||
int64_t exp_ns = getExpTime();
|
||||
|
||||
|
||||
int frameNr = 0;
|
||||
@ -1049,7 +1034,7 @@ void readFrame(int *ret, char *mess){
|
||||
|
||||
*ret = (int)OK;
|
||||
// frames left to give status
|
||||
int64_t retval = getTimeLeft(FRAME_NUMBER) + 1;
|
||||
int64_t retval = getNumFramesLeft() + 1;
|
||||
|
||||
if ( retval > 0) {
|
||||
FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval));
|
||||
|
@ -182,11 +182,56 @@ int selectStoragecellStart(int pos);
|
||||
int setStartingFrameNumber(uint64_t value);
|
||||
int getStartingFrameNumber(uint64_t* value);
|
||||
#endif
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||
int64_t getTimeLeft(enum timerIndex ind);
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
int validateTimer(enum timerIndex ind, int64_t val, int64_t retval);
|
||||
void setNumFrames(int64_t val);
|
||||
int64_t getNumFrames();
|
||||
void setNumTriggers(int64_t val);
|
||||
int64_t getNumTriggers();
|
||||
int setExpTime(int64_t val);
|
||||
int64_t getExpTime();
|
||||
int setPeriod(int64_t val);
|
||||
int64_t getPeriod();
|
||||
#ifdef EIGERD
|
||||
int setSubExpTime(int64_t val);
|
||||
int64_t getSubExpTime();
|
||||
int setDeadTime(int64_t val);
|
||||
int64_t getDeadTime();
|
||||
int64_t getMeasuredPeriod();
|
||||
int64_t getMeasuredSubPeriod();
|
||||
#endif
|
||||
#ifdef JUNGFRAUD
|
||||
void setNumAdditionalStorageCells(int val);
|
||||
int getNumAdditionalStorageCells();
|
||||
int setStorageCellDelay(int64_t val);
|
||||
int64_t getStorageCellDelay();
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
int setNumAnalogSamples(int val);
|
||||
int getNumAnalogSamples();
|
||||
int setNumDigitalSamples(int val);
|
||||
int getNumDigitalSamples();
|
||||
#endif
|
||||
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
||||
int setDelayAfterTrigger(int64_t val);
|
||||
int64_t getDelayAfterTrigger();
|
||||
#endif
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
int64_t getNumFramesLeft();
|
||||
int64_t getNumTriggersLeft();
|
||||
#endif
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
int64_t getDelayAfterTriggerLeft();
|
||||
int64_t getPeriodLeft();
|
||||
#endif
|
||||
#ifdef GOTTHARDD
|
||||
int64_t getExpTimeLeft();
|
||||
#endif
|
||||
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
int64_t getFramesFromStart();
|
||||
int64_t getActualTime();
|
||||
int64_t getMeasurementTime();
|
||||
#endif
|
||||
|
||||
|
||||
// parameters - module, settings
|
||||
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D)) && (!defined(GOTTHARD2D))
|
||||
|
@ -11,7 +11,6 @@ int printSocketReadError();
|
||||
void init_detector();
|
||||
int decode_function(int);
|
||||
const char* getRetName();
|
||||
const char* getTimerName(enum timerIndex ind);
|
||||
const char* getSpeedName(enum speedVariable ind);
|
||||
const char* getFunctionName(enum detFuncs func);
|
||||
void function_table();
|
||||
@ -44,8 +43,38 @@ int start_readout(int);
|
||||
int get_run_status(int);
|
||||
int start_and_read_all(int);
|
||||
int read_all(int);
|
||||
int set_timer(int);
|
||||
int get_time_left(int);
|
||||
int get_num_frames(int);
|
||||
int set_num_frames(int);
|
||||
int get_num_triggers(int);
|
||||
int set_num_triggers(int);
|
||||
int get_num_additional_storage_cells(int);
|
||||
int set_num_additional_storage_cells(int);
|
||||
int get_num_analog_samples(int);
|
||||
int set_num_analog_samples(int);
|
||||
int get_num_digital_samples(int);
|
||||
int set_num_digital_samples(int);
|
||||
int get_exptime(int);
|
||||
int set_exptime(int);
|
||||
int get_period(int);
|
||||
int set_period(int);
|
||||
int get_delay_after_trigger(int);
|
||||
int set_delay_after_trigger(int);
|
||||
int get_sub_exptime(int);
|
||||
int set_sub_exptime(int);
|
||||
int get_sub_deadtime(int);
|
||||
int set_sub_deadtime(int);
|
||||
int get_storage_cell_delay(int);
|
||||
int set_storage_cell_delay(int);
|
||||
int get_frames_left(int);
|
||||
int get_triggers_left(int);
|
||||
int get_exptime_left(int);
|
||||
int get_period_left(int);
|
||||
int get_delay_after_trigger_left(int);
|
||||
int get_measured_period(int);
|
||||
int get_measured_subperiod(int);
|
||||
int get_frames_from_start(int);
|
||||
int get_actual_time(int);
|
||||
int get_measurement_time(int);
|
||||
int set_dynamic_range(int);
|
||||
int set_roi(int);
|
||||
int get_roi(int);
|
||||
|
@ -114,29 +114,6 @@ const char* getRetName() {
|
||||
}
|
||||
}
|
||||
|
||||
const char* getTimerName(enum timerIndex ind) {
|
||||
switch (ind) {
|
||||
case FRAME_NUMBER: return "frame_number";
|
||||
case ACQUISITION_TIME: return "acquisition_time";
|
||||
case FRAME_PERIOD: return "frame_period";
|
||||
case DELAY_AFTER_TRIGGER: return "delay_after_trigger";
|
||||
case TRIGGER_NUMBER: return "triggers_number";
|
||||
case ACTUAL_TIME: return "actual_time";
|
||||
case MEASUREMENT_TIME: return "measurement_time";
|
||||
case PROGRESS: return "progress";
|
||||
case FRAMES_FROM_START: return "frames_from_start";
|
||||
case FRAMES_FROM_START_PG: return "frames_from_start_pg";
|
||||
case ANALOG_SAMPLES: return "analog_samples";
|
||||
case DIGITAL_SAMPLES: return "digital_samples";
|
||||
case SUBFRAME_ACQUISITION_TIME: return "subframe_acquisition_time";
|
||||
case SUBFRAME_DEADTIME: return "subframe_deadtime";
|
||||
case STORAGE_CELL_NUMBER: return "storage_cell_number";
|
||||
case STORAGE_CELL_DELAY: return "storage_cell_delay";
|
||||
default: return "unknown_timer";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char* getSpeedName(enum speedVariable ind) {
|
||||
switch (ind) {
|
||||
case CLOCK_DIVIDER: return "clock_divider";
|
||||
@ -188,8 +165,38 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
case F_GET_RUN_STATUS: return "F_GET_RUN_STATUS";
|
||||
case F_START_AND_READ_ALL: return "F_START_AND_READ_ALL";
|
||||
case F_READ_ALL: return "F_READ_ALL";
|
||||
case F_SET_TIMER: return "F_SET_TIMER";
|
||||
case F_GET_TIME_LEFT: return "F_GET_TIME_LEFT";
|
||||
case F_GET_NUM_FRAMES: return "F_GET_NUM_FRAMES";
|
||||
case F_SET_NUM_FRAMES: return "F_SET_NUM_FRAMES";
|
||||
case F_GET_NUM_TRIGGERS: return "F_GET_NUM_TRIGGERS";
|
||||
case F_SET_NUM_TRIGGERS: return "F_SET_NUM_TRIGGERS";
|
||||
case F_GET_NUM_ADDITIONAL_STORAGE_CELLS:return "F_GET_NUM_ADDITIONAL_STORAGE_CELLS";
|
||||
case F_SET_NUM_ADDITIONAL_STORAGE_CELLS:return "F_SET_NUM_ADDITIONAL_STORAGE_CELLS";
|
||||
case F_GET_NUM_ANALOG_SAMPLES: return "F_GET_NUM_ANALOG_SAMPLES";
|
||||
case F_SET_NUM_ANALOG_SAMPLES: return "F_SET_NUM_ANALOG_SAMPLES";
|
||||
case F_GET_NUM_DIGITAL_SAMPLES: return "F_GET_NUM_DIGITAL_SAMPLES";
|
||||
case F_SET_NUM_DIGITAL_SAMPLES: return "F_SET_NUM_DIGITAL_SAMPLES";
|
||||
case F_GET_EXPTIME: return "F_GET_EXPTIME";
|
||||
case F_SET_EXPTIME: return "F_SET_EXPTIME";
|
||||
case F_GET_PERIOD: return "F_GET_PERIOD";
|
||||
case F_SET_PERIOD: return "F_SET_PERIOD";
|
||||
case F_GET_DELAY_AFTER_TRIGGER: return "F_GET_DELAY_AFTER_TRIGGER";
|
||||
case F_SET_DELAY_AFTER_TRIGGER: return "F_SET_DELAY_AFTER_TRIGGER";
|
||||
case F_GET_SUB_EXPTIME: return "F_GET_SUB_EXPTIME";
|
||||
case F_SET_SUB_EXPTIME: return "F_SET_SUB_EXPTIME";
|
||||
case F_GET_SUB_DEADTIME: return "F_GET_SUB_DEADTIME";
|
||||
case F_SET_SUB_DEADTIME: return "F_SET_SUB_DEADTIME";
|
||||
case F_GET_STORAGE_CELL_DELAY: return "F_GET_STORAGE_CELL_DELAY";
|
||||
case F_SET_STORAGE_CELL_DELAY: return "F_SET_STORAGE_CELL_DELAY";
|
||||
case F_GET_FRAMES_LEFT: return "F_GET_FRAMES_LEFT";
|
||||
case F_GET_TRIGGERS_LEFT: return "F_GET_TRIGGERS_LEFT";
|
||||
case F_GET_EXPTIME_LEFT: return "F_GET_EXPTIME_LEFT";
|
||||
case F_GET_PERIOD_LEFT: return "F_GET_PERIOD_LEFT";
|
||||
case F_GET_DELAY_AFTER_TRIGGER_LEFT: return "F_GET_DELAY_AFTER_TRIGGER_LEFT";
|
||||
case F_GET_MEASURED_PERIOD: return "F_GET_MEASURED_PERIOD";
|
||||
case F_GET_MEASURED_SUBPERIOD: return "F_GET_MEASURED_SUBPERIOD";
|
||||
case F_GET_FRAMES_FROM_START: return "F_GET_FRAMES_FROM_START";
|
||||
case F_GET_ACTUAL_TIME: return "F_GET_ACTUAL_TIME";
|
||||
case F_GET_MEASUREMENT_TIME: return "F_GET_MEASUREMENT_TIME";
|
||||
case F_SET_DYNAMIC_RANGE: return "F_SET_DYNAMIC_RANGE";
|
||||
case F_SET_ROI: return "F_SET_ROI";
|
||||
case F_GET_ROI: return "F_GET_ROI";
|
||||
@ -317,8 +324,38 @@ void function_table() {
|
||||
flist[F_GET_RUN_STATUS] = &get_run_status;
|
||||
flist[F_START_AND_READ_ALL] = &start_and_read_all;
|
||||
flist[F_READ_ALL] = &read_all;
|
||||
flist[F_SET_TIMER] = &set_timer;
|
||||
flist[F_GET_TIME_LEFT] = &get_time_left;
|
||||
flist[F_GET_NUM_FRAMES] = &get_num_frames;
|
||||
flist[F_SET_NUM_FRAMES] = &set_num_frames;
|
||||
flist[F_GET_NUM_TRIGGERS] = &get_num_triggers;
|
||||
flist[F_SET_NUM_TRIGGERS] = &set_num_triggers;
|
||||
flist[F_GET_NUM_ADDITIONAL_STORAGE_CELLS] = &get_num_additional_storage_cells;
|
||||
flist[F_SET_NUM_ADDITIONAL_STORAGE_CELLS] = &set_num_additional_storage_cells;
|
||||
flist[F_GET_NUM_ANALOG_SAMPLES] = &get_num_analog_samples;
|
||||
flist[F_SET_NUM_ANALOG_SAMPLES] = &set_num_analog_samples;
|
||||
flist[F_GET_NUM_DIGITAL_SAMPLES] = &get_num_digital_samples;
|
||||
flist[F_SET_NUM_DIGITAL_SAMPLES] = &set_num_digital_samples;
|
||||
flist[F_GET_EXPTIME] = &get_exptime;
|
||||
flist[F_SET_EXPTIME] = &set_exptime;
|
||||
flist[F_GET_PERIOD] = &get_period;
|
||||
flist[F_SET_PERIOD] = &set_period;
|
||||
flist[F_GET_DELAY_AFTER_TRIGGER] = &get_delay_after_trigger;
|
||||
flist[F_SET_DELAY_AFTER_TRIGGER] = &set_delay_after_trigger;
|
||||
flist[F_GET_SUB_EXPTIME] = &get_sub_exptime;
|
||||
flist[F_SET_SUB_EXPTIME] = &set_sub_exptime;
|
||||
flist[F_GET_SUB_DEADTIME] = &get_sub_deadtime;
|
||||
flist[F_SET_SUB_DEADTIME] = &set_sub_deadtime;
|
||||
flist[F_GET_STORAGE_CELL_DELAY] = &get_storage_cell_delay;
|
||||
flist[F_SET_STORAGE_CELL_DELAY] = &set_storage_cell_delay;
|
||||
flist[F_GET_FRAMES_LEFT] = &get_frames_left;
|
||||
flist[F_GET_TRIGGERS_LEFT] = &get_triggers_left;
|
||||
flist[F_GET_EXPTIME_LEFT] = &get_exptime_left;
|
||||
flist[F_GET_PERIOD_LEFT] = &get_period_left;
|
||||
flist[F_GET_DELAY_AFTER_TRIGGER_LEFT] = &get_delay_after_trigger_left;
|
||||
flist[F_GET_MEASURED_PERIOD] = &get_measured_period;
|
||||
flist[F_GET_MEASURED_SUBPERIOD] = &get_measured_subperiod;
|
||||
flist[F_GET_FRAMES_FROM_START] = &get_frames_from_start;
|
||||
flist[F_GET_ACTUAL_TIME] = &get_actual_time;
|
||||
flist[F_GET_MEASUREMENT_TIME] = &get_measurement_time;
|
||||
flist[F_SET_DYNAMIC_RANGE] = &set_dynamic_range;
|
||||
flist[F_SET_ROI] = &set_roi;
|
||||
flist[F_GET_ROI] = &get_roi;
|
||||
@ -1845,219 +1882,599 @@ int read_all(int file_des) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int set_timer(int file_des) {
|
||||
int get_num_frames(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t args[2] = {-1,-1};
|
||||
int64_t retval = -1;
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
enum timerIndex ind = (int)args[0];
|
||||
int64_t tns = args[1];
|
||||
char timerName[50] = {0};
|
||||
strcpy(timerName, getTimerName(ind));
|
||||
#ifdef EIGERD
|
||||
int64_t subexptime = 0;
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("Setting timer %s(%d) to %lld ns\n", timerName, (int)ind, tns));
|
||||
|
||||
// set & get
|
||||
if ((tns == -1) || (Server_VerifyLock() == OK)) {
|
||||
|
||||
// check index
|
||||
switch (ind) {
|
||||
case FRAME_NUMBER:
|
||||
case ACQUISITION_TIME:
|
||||
case FRAME_PERIOD:
|
||||
case TRIGGER_NUMBER:
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
case ANALOG_SAMPLES:
|
||||
case DIGITAL_SAMPLES:
|
||||
#endif
|
||||
#if !defined(EIGERD) && !defined(GOTTHARD2D)
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
#endif
|
||||
retval = setTimer(ind, tns);
|
||||
break;
|
||||
#ifdef JUNGFRAUD
|
||||
case STORAGE_CELL_NUMBER:
|
||||
if (tns > MAX_STORAGE_CELL_VAL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Max Storage cell number should not exceed 15\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
break;
|
||||
}
|
||||
retval = setTimer(ind,tns);
|
||||
break;
|
||||
|
||||
case STORAGE_CELL_DELAY:
|
||||
if (tns > MAX_STORAGE_CELL_DLY_NS_VAL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Max Storage cell delay value should not exceed %lld ns\n", (long long unsigned int)MAX_STORAGE_CELL_DLY_NS_VAL);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
break;
|
||||
}
|
||||
retval = setTimer(ind,tns);
|
||||
break;
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
if (tns > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Sub Frame exposure time should not exceed 5.368 seconds\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
break;
|
||||
}
|
||||
retval = setTimer(ind,tns);
|
||||
break;
|
||||
case SUBFRAME_DEADTIME:
|
||||
subexptime = setTimer(SUBFRAME_ACQUISITION_TIME, -1);
|
||||
if ((tns + subexptime) > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Sub Frame Period should not exceed 5.368 seconds. "
|
||||
"So sub frame dead time should not exceed %lfu seconds "
|
||||
"(subexptime = %lf seconds)\n",
|
||||
((((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) - subexptime)/1E9),
|
||||
(subexptime/1E9));
|
||||
FILE_LOG(logERROR,(mess));
|
||||
break;
|
||||
}
|
||||
retval = setTimer(ind,tns);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
modeNotImplemented(timerName, (int)ind);
|
||||
break;
|
||||
}
|
||||
|
||||
// validate
|
||||
if (ret != FAIL) {
|
||||
char vtimerName[50] = {0};
|
||||
sprintf(vtimerName, "set %s", timerName);
|
||||
#ifdef EIGERD
|
||||
validate64(tns, retval, vtimerName, DEC); // copied to server, not read from detector register
|
||||
#else
|
||||
switch(ind) {
|
||||
case FRAME_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
case STORAGE_CELL_NUMBER:
|
||||
validate64(tns, retval, vtimerName, DEC); // no conversion, so all good
|
||||
break;
|
||||
case ANALOG_SAMPLES:
|
||||
case DIGITAL_SAMPLES:
|
||||
if (retval == -1) {
|
||||
ret = FAIL;
|
||||
retval = setTimer(ind, -1);
|
||||
sprintf(mess, "Could not %s to %lld. Could not allocate RAM\n",
|
||||
vtimerName, (long long unsigned int)tns);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else
|
||||
validate64(tns, retval, vtimerName, DEC); // no conversion, so all good
|
||||
case ACQUISITION_TIME:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
case SUBFRAME_DEADTIME:
|
||||
case STORAGE_CELL_DELAY:
|
||||
// losing precision due to conversion to clock (also gotthard master delay is different)
|
||||
if (validateTimer(ind, tns, retval) == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not %s. Set %lld, but read %lld\n", vtimerName,
|
||||
(long long unsigned int)tns, (long long unsigned int)retval);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (ret != FAIL) {
|
||||
FILE_LOG(logDEBUG1, ("Timer index %d: %lld\n", ind, retval));
|
||||
}
|
||||
// get only
|
||||
retval = getNumFrames();
|
||||
FILE_LOG(logDEBUG1, ("retval num frames %lld\n", (long long int)retval));
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_num_frames(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting number of frames %lld\n", (long long int)arg));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int get_time_left(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum timerIndex ind = -1;
|
||||
int64_t retval = -1;
|
||||
|
||||
if (receiveData(file_des, &ind, sizeof(ind), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Getting timer left index %d\n", ind));
|
||||
|
||||
// only get
|
||||
// check index
|
||||
if (ret == OK) {
|
||||
switch(ind) {
|
||||
#ifdef EIGERD
|
||||
case MEASURED_PERIOD:
|
||||
case MEASURED_SUBPERIOD:
|
||||
#elif JUNGFRAUD
|
||||
case FRAMES_FROM_START:
|
||||
case FRAMES_FROM_START_PG:
|
||||
case ACTUAL_TIME:
|
||||
case MEASUREMENT_TIME:
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif GOTTHARDD
|
||||
case ACQUISITION_TIME:
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif CHIPTESTBOARDD
|
||||
case FRAMES_FROM_START:
|
||||
case FRAMES_FROM_START_PG:
|
||||
case ACTUAL_TIME:
|
||||
case MEASUREMENT_TIME:
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif MOENCHD
|
||||
case FRAMES_FROM_START:
|
||||
case FRAMES_FROM_START_PG:
|
||||
case ACTUAL_TIME:
|
||||
case MEASUREMENT_TIME:
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif MYTHEN3D
|
||||
case FRAME_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif GOTTHARD2D
|
||||
case FRAME_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
#endif
|
||||
retval = getTimeLeft(ind);
|
||||
FILE_LOG(logDEBUG1, ("Timer left index %d: %lld\n", ind, retval));
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("Timer left index", (int)ind);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
// only set
|
||||
if (Server_VerifyLock() == 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);
|
||||
}
|
||||
|
||||
int get_num_triggers(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
// get only
|
||||
retval = getNumTriggers();
|
||||
FILE_LOG(logDEBUG1, ("retval num triggers %lld\n", (long long int)retval));
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_num_triggers(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting number of triggers %lld\n", (long long int)arg));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
setNumTriggers(arg);
|
||||
int64_t retval = getNumTriggers();
|
||||
FILE_LOG(logDEBUG1, ("retval num triggers %lld\n", (long long int)retval));
|
||||
validate64(arg, retval, "set number of triggers", DEC);
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_num_additional_storage_cells(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getNumAdditionalStorageCells();
|
||||
FILE_LOG(logDEBUG1, ("retval num addl. storage cells %d\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_num_additional_storage_cells(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting number of addl. storage cells %d\n", arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (arg > MAX_STORAGE_CELL_VAL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Max Storage cell number should not exceed %d\n", MAX_STORAGE_CELL_VAL);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
setNumAdditionalStorageCells(arg);
|
||||
int retval = getNumAdditionalStorageCells();
|
||||
FILE_LOG(logDEBUG1, ("retval num addl. storage cells %d\n", retval));
|
||||
validate(arg, retval, "set number of additional storage cells", DEC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_num_analog_samples(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getNumAnalogSamples();
|
||||
FILE_LOG(logDEBUG1, ("retval num analog samples %d\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_num_analog_samples(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting number of analog samples %d\n", arg));
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = setNumAnalogSamples(arg);
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set number of analog samples to %d. Could not allocate RAM\n", arg);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
int retval = getNumAnalogSamples();
|
||||
FILE_LOG(logDEBUG1, ("retval num analog samples %d\n", retval));
|
||||
validate(arg, retval, "set number of analog samples", DEC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_num_digital_samples(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getNumDigitalSamples();
|
||||
FILE_LOG(logDEBUG1, ("retval num digital samples %d\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_num_digital_samples(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting number of digital samples %d\n", arg));
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = setNumDigitalSamples(arg);
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set number of digital samples to %d. Could not allocate RAM\n", arg);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
int retval = getNumDigitalSamples();
|
||||
FILE_LOG(logDEBUG1, ("retval num digital samples %d\n", retval));
|
||||
validate(arg, retval, "set number of digital samples", DEC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_exptime(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
// get only
|
||||
retval = getExpTime();
|
||||
FILE_LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval));
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_exptime(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting exptime %lld ns\n", (long long int)arg));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = setExpTime(arg);
|
||||
int64_t retval = getExpTime();
|
||||
FILE_LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set exposure time. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_period(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
// get only
|
||||
retval = getPeriod();
|
||||
FILE_LOG(logDEBUG1, ("retval period %lld ns\n", (long long int)retval));
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_period(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting period %lld ns\n", (long long int)arg));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = setPeriod(arg);
|
||||
int64_t retval = getPeriod();
|
||||
FILE_LOG(logDEBUG1, ("retval period %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set period. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_delay_after_trigger(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getDelayAfterTrigger();
|
||||
FILE_LOG(logDEBUG1, ("retval delay after trigger %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_delay_after_trigger(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting delay after trigger %lld ns\n", (long long int)arg));
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = setDelayAfterTrigger(arg);
|
||||
int64_t retval = getDelayAfterTrigger();
|
||||
FILE_LOG(logDEBUG1, ("retval delay after trigger %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set delay after trigger. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_sub_exptime(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifndef EIGERD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getSubExpTime();
|
||||
FILE_LOG(logDEBUG1, ("retval subexptime %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_sub_exptime(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting subexptime %lld ns\n", (long long int)arg));
|
||||
|
||||
#ifndef EIGERD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (arg > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Sub Frame exposure time should not exceed %lf seconds\n", ((double)((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS * 10)/ (double)(1E9)));
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
ret = setSubExpTime(arg);
|
||||
int64_t retval = getSubExpTime();
|
||||
FILE_LOG(logDEBUG1, ("retval subexptime %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set subframe exposure time. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_sub_deadtime(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifndef EIGERD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getDeadTime();
|
||||
FILE_LOG(logDEBUG1, ("retval subdeadtime %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_sub_deadtime(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting subdeadtime %lld ns\n", (long long int)arg));
|
||||
|
||||
#ifndef EIGERD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
int64_t subexptime = getSubExpTime();
|
||||
if ((arg + subexptime) > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Sub Frame Period should not exceed %lf seconds. "
|
||||
"So sub frame dead time should not exceed %lf seconds "
|
||||
"(subexptime = %lf seconds)\n",
|
||||
((double)((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS * 10)/ (double)(1E9)),
|
||||
((double)(((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) - subexptime)/(double)1E9),
|
||||
((double)subexptime/(double)1E9));
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
ret = setDeadTime(arg);
|
||||
int64_t retval = getDeadTime();
|
||||
FILE_LOG(logDEBUG1, ("retval subdeadtime %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set subframe dead time. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_storage_cell_delay(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getStorageCellDelay();
|
||||
FILE_LOG(logDEBUG1, ("retval storage cell delay %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_storage_cell_delay(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting storage cell delay %lld ns\n", (long long int)arg));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (arg > MAX_STORAGE_CELL_DLY_NS_VAL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Max Storage cell delay value should not exceed %lld ns\n", (long long unsigned int)MAX_STORAGE_CELL_DLY_NS_VAL);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
ret = setStorageCellDelay(arg);
|
||||
int64_t retval = getStorageCellDelay();
|
||||
FILE_LOG(logDEBUG1, ("retval storage cell delay %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set storage cell delay. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_frames_left(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getNumFramesLeft();
|
||||
FILE_LOG(logDEBUG1, ("retval num frames left %lld\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_triggers_left(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getNumTriggersLeft();
|
||||
FILE_LOG(logDEBUG1, ("retval num triggers left %lld\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_exptime_left(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifndef GOTTHARDD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getExpTimeLeft();
|
||||
FILE_LOG(logDEBUG1, ("retval exptime left %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_period_left(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getPeriodLeft();
|
||||
FILE_LOG(logDEBUG1, ("retval period left %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_delay_after_trigger_left(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getDelayAfterTriggerLeft();
|
||||
FILE_LOG(logDEBUG1, ("retval delay after trigger left %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_measured_period(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifndef EIGERD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getMeasuredPeriod();
|
||||
FILE_LOG(logDEBUG1, ("retval measured period %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_measured_subperiod(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifndef EIGERD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getMeasuredSubPeriod();
|
||||
FILE_LOG(logDEBUG1, ("retval measured sub period %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_frames_from_start(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getFramesFromStart();
|
||||
FILE_LOG(logDEBUG1, ("retval frames from start %lld\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_actual_time(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getActualTime();
|
||||
FILE_LOG(logDEBUG1, ("retval actual time %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_measurement_time(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getMeasurementTime();
|
||||
FILE_LOG(logDEBUG1, ("retval measurement time %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2416,51 +2833,19 @@ int send_update(int file_des) {
|
||||
#endif
|
||||
|
||||
// #frames
|
||||
i64 = setTimer(FRAME_NUMBER,GET_FLAG);
|
||||
i64 = getNumFrames();
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// exptime
|
||||
i64 = setTimer(ACQUISITION_TIME,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// subexptime, subdeadtime
|
||||
#ifdef EIGERD
|
||||
i64 = setTimer(SUBFRAME_ACQUISITION_TIME,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
i64 = setTimer(SUBFRAME_DEADTIME,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// period
|
||||
i64 = setTimer(FRAME_PERIOD,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// delay
|
||||
#if !defined(EIGERD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||
i64 = setTimer(DELAY_AFTER_TRIGGER,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// #storage cell, storage_cell_delay
|
||||
#ifdef JUNGFRAUD
|
||||
i64 = setTimer(STORAGE_CELL_NUMBER,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
i64 = setTimer(STORAGE_CELL_DELAY,GET_FLAG);
|
||||
i64 = getNumAdditionalStorageCells();
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// #triggers
|
||||
i64 = setTimer(TRIGGER_NUMBER,GET_FLAG);
|
||||
i64 = getNumTriggers();
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
@ -2479,16 +2864,6 @@ int send_update(int file_des) {
|
||||
#endif
|
||||
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
// #analog samples
|
||||
i64 = setTimer(ANALOG_SAMPLES,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// #digital samples
|
||||
i64 = setTimer(DIGITAL_SAMPLES,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// adcmask
|
||||
i32 = getADCEnableMask();
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
|
@ -544,10 +544,10 @@ class CmdProxy {
|
||||
{"exptime", &CmdProxy::exptime},
|
||||
{"period", &CmdProxy::period},
|
||||
{"delay", &CmdProxy::delay},
|
||||
{"delay", &CmdProxy::delay},
|
||||
{"framesl", &CmdProxy::framesl},
|
||||
{"triggersl", &CmdProxy::triggersl},
|
||||
{"delayl", &CmdProxy::delayl},
|
||||
{"periodl", &CmdProxy::periodl},
|
||||
{"speed", &CmdProxy::Speed},
|
||||
{"adcphase", &CmdProxy::Adcphase},
|
||||
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
|
||||
@ -739,7 +739,6 @@ class CmdProxy {
|
||||
{"roi", &CmdProxy::ROI},
|
||||
{"clearroi", &CmdProxy::ClearROI},
|
||||
{"exptimel", &CmdProxy::exptimel},
|
||||
{"periodl", &CmdProxy::periodl},
|
||||
{"extsig", &CmdProxy::extsig},
|
||||
{"imagetest", &CmdProxy::imagetest},
|
||||
|
||||
@ -958,17 +957,20 @@ class CmdProxy {
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames");
|
||||
|
||||
TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Ctb] Delay after trigger");
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Ctb][Mythen3] Delay after trigger");
|
||||
|
||||
GET_COMMAND(framesl, getNumberOfFramesLeft,
|
||||
"\n\t[Gotthard][Jungfrau][CTB] Number of frames left in acquisition.");
|
||||
"\n\t[Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] Number of frames left in acquisition.");
|
||||
|
||||
GET_COMMAND(triggersl, getNumberOfTriggersLeft,
|
||||
"\n\t[Gotthard][Jungfrau][CTB] Number of triggers left in acquisition.");
|
||||
"\n\t[Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] Number of triggers left in acquisition.");
|
||||
|
||||
TIME_GET_COMMAND(delayl, getDelayAfterTriggerLeft,
|
||||
"[(optional unit) ns|us|ms|s]\n\t[Gotthard][Jungfrau][CTB] DelayLeft Delay Left in Acquisition.");
|
||||
|
||||
"\n\t[Gotthard][Jungfrau][CTB] DelayLeft Delay Left in Acquisition.");
|
||||
|
||||
TIME_GET_COMMAND(periodl, getPeriodLeft,
|
||||
"\n\t[Gotthard][Jungfrau][CTB] Period left for current frame.");
|
||||
|
||||
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
||||
"\n\t[Jungfrau][CTB] Absolute maximum Phase shift of ADC clock.");
|
||||
|
||||
@ -1441,9 +1443,6 @@ class CmdProxy {
|
||||
TIME_GET_COMMAND(exptimel, getExptimeLeft,
|
||||
"[(optional unit) ns|us|ms|s]\n\t[Gotthard] Exposure time left for current frame. ");
|
||||
|
||||
TIME_GET_COMMAND(periodl, getPeriodLeft,
|
||||
"[(optional unit) ns|us|ms|s]\n\t[Gotthard] Period left for current frame.");
|
||||
|
||||
INTEGER_COMMAND(extsig, getExternalSignalFlags, setExternalSignalFlags, sls::StringTo<slsDetectorDefs::externalSignalFlag>,
|
||||
"[trigger_in_rising_edge|trigger_in_falling_edge]\n\t[Gotthard] External signal mode for trigger timing mode.");
|
||||
|
||||
|
@ -128,11 +128,11 @@ class Detector {
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
Result<int64_t> getNumberOfFrames() const;
|
||||
Result<int64_t> getNumberOfFrames(Positions pos = {}) const;
|
||||
|
||||
void setNumberOfFrames(int64_t value);
|
||||
|
||||
Result<int64_t> getNumberOfTriggers() const;
|
||||
Result<int64_t> getNumberOfTriggers(Positions pos = {}) const;
|
||||
|
||||
void setNumberOfTriggers(int64_t value);
|
||||
|
||||
@ -144,21 +144,24 @@ class Detector {
|
||||
|
||||
void setPeriod(ns t, Positions pos = {});
|
||||
|
||||
/** [Gotthard][Jungfrau] */
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
||||
Result<ns> getDelayAfterTrigger(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard][Jungfrau] */
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
||||
void setDelayAfterTrigger(ns value, Positions pos = {});
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB] */
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
||||
Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB] */
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
||||
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB] */
|
||||
Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB] */
|
||||
Result<ns> getPeriodLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger][Jungfrau] */
|
||||
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
|
||||
|
||||
@ -277,7 +280,7 @@ class Detector {
|
||||
|
||||
Result<defs::runStatus> getReceiverStatus(Positions pos = {}) const;
|
||||
|
||||
Result<int> getFramesCaught(Positions pos = {}) const;
|
||||
Result<int64_t> getFramesCaught(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger][Jungfrau] */
|
||||
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
|
||||
@ -806,10 +809,10 @@ class Detector {
|
||||
void setAutoCompDisable(bool value, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] Advanced TODO naming */
|
||||
Result<int64_t> getNumberOfAdditionalStorageCells() const;
|
||||
Result<int> getNumberOfAdditionalStorageCells(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Advanced */
|
||||
void setNumberOfAdditionalStorageCells(int64_t value);
|
||||
void setNumberOfAdditionalStorageCells(int value);
|
||||
|
||||
/** [Jungfrau] Advanced */
|
||||
Result<int> getStorageCellStart(Positions pos = {}) const;
|
||||
@ -849,9 +852,6 @@ class Detector {
|
||||
/** [Gotthard] */
|
||||
Result<ns> getExptimeLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard] */
|
||||
Result<ns> getPeriodLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard] */
|
||||
Result<defs::externalSignalFlag>
|
||||
getExternalSignalFlags(Positions pos = {}) const;
|
||||
@ -874,16 +874,16 @@ class Detector {
|
||||
* ************************************************/
|
||||
|
||||
/** [CTB] */
|
||||
Result<int64_t> getNumberOfAnalogSamples(Positions pos = {}) const;
|
||||
Result<int> getNumberOfAnalogSamples(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] */
|
||||
void setNumberOfAnalogSamples(int64_t value, Positions pos = {});
|
||||
void setNumberOfAnalogSamples(int value, Positions pos = {});
|
||||
|
||||
/** [CTB] */
|
||||
Result<int64_t> getNumberOfDigitalSamples(Positions pos = {}) const;
|
||||
Result<int> getNumberOfDigitalSamples(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] */
|
||||
void setNumberOfDigitalSamples(int64_t value, Positions pos = {});
|
||||
void setNumberOfDigitalSamples(int value, Positions pos = {});
|
||||
|
||||
/** [CTB] */
|
||||
Result<defs::readoutMode> getReadoutMode(Positions pos = {}) const;
|
||||
|
@ -386,13 +386,13 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int processImageWithGapPixels(char *image, char *&gpImage, bool quadEnable);
|
||||
|
||||
int setTotalProgress();
|
||||
double setTotalProgress();
|
||||
|
||||
double getCurrentProgress();
|
||||
|
||||
void incrementProgress();
|
||||
|
||||
void setCurrentProgress(int i = 0);
|
||||
void setCurrentProgress(int64_t i = 0);
|
||||
|
||||
void startProcessingThread();
|
||||
|
||||
@ -446,10 +446,10 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
sem_t sem_endRTAcquisition;
|
||||
|
||||
/** Total number of frames/images for next acquisition */
|
||||
int totalProgress{0};
|
||||
double totalProgress{0};
|
||||
|
||||
/** Current progress or frames/images processed in current acquisition */
|
||||
int progressIndex{0};
|
||||
double progressIndex{0};
|
||||
|
||||
/** mutex to synchronize main and data processing threads */
|
||||
mutable std::mutex mp;
|
||||
|
@ -13,7 +13,7 @@
|
||||
class ServerInterface;
|
||||
|
||||
#define SLS_SHMAPIVERSION 0x190726
|
||||
#define SLS_SHMVERSION 0x190830
|
||||
#define SLS_SHMVERSION 0x191030
|
||||
|
||||
/**
|
||||
* @short structure allocated in shared memory to store detector settings for
|
||||
@ -77,8 +77,14 @@ struct sharedSlsDetector {
|
||||
/** detector threshold (eV) */
|
||||
int currentThresholdEV;
|
||||
|
||||
/** timer values */
|
||||
int64_t timerValue[slsDetectorDefs::timerIndex::MAX_TIMERS];
|
||||
/** number of frames */
|
||||
int64_t nFrames;
|
||||
|
||||
/** number of triggers */
|
||||
int64_t nTriggers;
|
||||
|
||||
/** number of additional storage cells */
|
||||
int nAddStorageCells;
|
||||
|
||||
/** rate correction in ns */
|
||||
int64_t deadTime;
|
||||
@ -510,24 +516,103 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint64_t getStartingFrameNumber();
|
||||
|
||||
/**
|
||||
* Set/get timer value (not all implemented for all detectors)
|
||||
* @param index timer index
|
||||
* @param t time in ns or number of...(e.g. frames, probes)
|
||||
* @returns timer set value in ns or number of...(e.g. frames,
|
||||
* probes)
|
||||
*/
|
||||
int64_t setTimer(timerIndex index, int64_t t = -1);
|
||||
void sendTotalNumFramestoReceiver();
|
||||
|
||||
/**
|
||||
* Set/get timer value left in acquisition (not all implemented for all
|
||||
* detectors)
|
||||
* @param index timer index
|
||||
* @param t time in ns or number of...(e.g. frames, probes)
|
||||
* @returns timer set value in ns or number of...(e.g. frames,
|
||||
* probes)
|
||||
*/
|
||||
int64_t getTimeLeft(timerIndex index) const;
|
||||
int64_t getNumberOfFramesFromShm();
|
||||
|
||||
int64_t getNumberOfFrames();
|
||||
|
||||
void setNumberOfFrames(int64_t value);
|
||||
|
||||
int64_t getNumberOfTriggersFromShm();
|
||||
|
||||
int64_t getNumberOfTriggers();
|
||||
|
||||
void setNumberOfTriggers(int64_t value);
|
||||
|
||||
/** [Jungfrau] Advanced */
|
||||
int getNumberOfAdditionalStorageCellsFromShm();
|
||||
|
||||
/** [Jungfrau] Advanced */
|
||||
int getNumberOfAdditionalStorageCells();
|
||||
|
||||
/** [Jungfrau] Advanced */
|
||||
void setNumberOfAdditionalStorageCells(int value);
|
||||
|
||||
/** [CTB] */
|
||||
int getNumberOfAnalogSamples();
|
||||
|
||||
/** [CTB] */
|
||||
void setNumberOfAnalogSamples(int value);
|
||||
|
||||
/** [CTB] */
|
||||
int getNumberOfDigitalSamples();
|
||||
|
||||
/** [CTB] */
|
||||
void setNumberOfDigitalSamples(int value);
|
||||
|
||||
int64_t getExptime();
|
||||
|
||||
void setExptime(int64_t value);
|
||||
|
||||
int64_t getPeriod();
|
||||
|
||||
void setPeriod(int64_t value);
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
||||
int64_t getDelayAfterTrigger();
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
||||
void setDelayAfterTrigger(int64_t value);
|
||||
|
||||
/** [Eiger] in 32 bit mode */
|
||||
int64_t getSubExptime();
|
||||
|
||||
/** [Eiger] in 32 bit mode */
|
||||
void setSubExptime(int64_t value);
|
||||
|
||||
/** [Eiger] in 32 bit mode */
|
||||
int64_t getSubDeadTime();
|
||||
|
||||
/** [Eiger] in 32 bit mode */
|
||||
void setSubDeadTime(int64_t value);
|
||||
|
||||
/** [Jungfrau] Advanced*/
|
||||
int64_t getStorageCellDelay();
|
||||
|
||||
/** [Jungfrau] Advanced
|
||||
* Options: (0-1638375 ns (resolution of 25ns) */
|
||||
void setStorageCellDelay(int64_t value);
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
||||
int64_t getNumberOfFramesLeft() const;
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
||||
int64_t getNumberOfTriggersLeft() const;
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB] */
|
||||
int64_t getDelayAfterTriggerLeft() const;
|
||||
|
||||
/** [Gotthard] */
|
||||
int64_t getExptimeLeft() const;
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB] */
|
||||
int64_t getPeriodLeft() const;
|
||||
|
||||
/** [Eiger] minimum two frames */
|
||||
int64_t getMeasuredPeriod() const;
|
||||
|
||||
/** [Eiger] */
|
||||
int64_t getMeasuredSubFramePeriod() const;
|
||||
|
||||
/** [Jungfrau][CTB] */
|
||||
int64_t getNumberOfFramesFromStart() const;
|
||||
|
||||
/** [Jungfrau][CTB] Get time from detector start */
|
||||
int64_t getActualTime() const;
|
||||
|
||||
/** [Jungfrau][CTB] Get timestamp at a frame start */
|
||||
int64_t getMeasurementTime() const;
|
||||
|
||||
/**
|
||||
* Set speed
|
||||
@ -1475,7 +1560,7 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
* Gets the number of frames caught by receiver
|
||||
* @returns number of frames caught by receiver
|
||||
*/
|
||||
int getFramesCaughtByReceiver() const;
|
||||
int64_t getFramesCaughtByReceiver() const;
|
||||
|
||||
/**
|
||||
* Gets the current frame index of receiver
|
||||
|
@ -112,61 +112,60 @@ void Detector::registerDataCallback(void (*func)(detectorData *, uint64_t,
|
||||
|
||||
// Acquisition Parameters
|
||||
|
||||
Result<int64_t> Detector::getNumberOfFrames() const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, {}, defs::FRAME_NUMBER, -1);
|
||||
Result<int64_t> Detector::getNumberOfFrames(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getNumberOfFrames, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfFrames(int64_t value) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, {}, defs::FRAME_NUMBER, value);
|
||||
pimpl->Parallel(&slsDetector::setNumberOfFrames, {}, value);
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfTriggers() const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, {}, defs::TRIGGER_NUMBER, -1);
|
||||
Result<int64_t> Detector::getNumberOfTriggers(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getNumberOfTriggers, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfTriggers(int64_t value) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, {}, defs::TRIGGER_NUMBER, value);
|
||||
pimpl->Parallel(&slsDetector::setNumberOfTriggers, {}, value);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME,
|
||||
-1);
|
||||
return pimpl->Parallel(&slsDetector::getExptime, pos);
|
||||
}
|
||||
|
||||
void Detector::setExptime(ns t, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME,
|
||||
t.count());
|
||||
pimpl->Parallel(&slsDetector::setExptime, pos, t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getPeriod(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, -1);
|
||||
return pimpl->Parallel(&slsDetector::getPeriod, pos);
|
||||
}
|
||||
|
||||
void Detector::setPeriod(ns t, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::FRAME_PERIOD, t.count());
|
||||
pimpl->Parallel(&slsDetector::setPeriod, pos, t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getDelayAfterTrigger(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::DELAY_AFTER_TRIGGER, -1);
|
||||
return pimpl->Parallel(&slsDetector::getDelayAfterTrigger, pos);
|
||||
}
|
||||
|
||||
void Detector::setDelayAfterTrigger(ns value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::DELAY_AFTER_TRIGGER,
|
||||
value.count());
|
||||
pimpl->Parallel(&slsDetector::setDelayAfterTrigger, pos, value.count());
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfFramesLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::FRAME_NUMBER);
|
||||
return pimpl->Parallel(&slsDetector::getNumberOfFramesLeft, pos);
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfTriggersLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::TRIGGER_NUMBER);
|
||||
return pimpl->Parallel(&slsDetector::getNumberOfTriggersLeft, pos);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getDelayAfterTriggerLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||
defs::DELAY_AFTER_TRIGGER);
|
||||
return pimpl->Parallel(&slsDetector::getDelayAfterTriggerLeft, pos);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getPeriodLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getPeriodLeft, pos);
|
||||
}
|
||||
|
||||
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
||||
@ -332,7 +331,7 @@ Result<defs::runStatus> Detector::getReceiverStatus(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverStatus, pos);
|
||||
}
|
||||
|
||||
Result<int> Detector::getFramesCaught(Positions pos) const {
|
||||
Result<int64_t> Detector::getFramesCaught(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos);
|
||||
}
|
||||
|
||||
@ -787,23 +786,19 @@ void Detector::setDynamicRange(int value) {
|
||||
}
|
||||
|
||||
Result<ns> Detector::getSubExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::SUBFRAME_ACQUISITION_TIME, -1);
|
||||
return pimpl->Parallel(&slsDetector::getSubExptime, pos);
|
||||
}
|
||||
|
||||
void Detector::setSubExptime(ns t, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::SUBFRAME_ACQUISITION_TIME, t.count());
|
||||
pimpl->Parallel(&slsDetector::setSubExptime, pos, t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getSubDeadTime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::SUBFRAME_DEADTIME,
|
||||
-1);
|
||||
return pimpl->Parallel(&slsDetector::getSubDeadTime, pos);
|
||||
}
|
||||
|
||||
void Detector::setSubDeadTime(ns value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::SUBFRAME_DEADTIME,
|
||||
value.count());
|
||||
pimpl->Parallel(&slsDetector::setSubDeadTime, pos, value.count());
|
||||
}
|
||||
|
||||
Result<int> Detector::getThresholdEnergy(Positions pos) const {
|
||||
@ -915,13 +910,11 @@ void Detector::setInterruptSubframe(const bool enable, Positions pos) {
|
||||
}
|
||||
|
||||
Result<ns> Detector::getMeasuredPeriod(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||
defs::MEASURED_PERIOD);
|
||||
return pimpl->Parallel(&slsDetector::getMeasuredPeriod, pos);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getMeasuredSubFramePeriod(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||
defs::MEASURED_SUBPERIOD);
|
||||
return pimpl->Parallel(&slsDetector::getMeasuredSubFramePeriod, pos);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getActive(Positions pos) const {
|
||||
@ -1033,14 +1026,12 @@ void Detector::setAutoCompDisable(bool value, Positions pos) {
|
||||
static_cast<int>(value));
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfAdditionalStorageCells() const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, {},
|
||||
defs::STORAGE_CELL_NUMBER, -1);
|
||||
Result<int> Detector::getNumberOfAdditionalStorageCells(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getNumberOfAdditionalStorageCells, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfAdditionalStorageCells(int64_t value) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, {}, defs::STORAGE_CELL_NUMBER,
|
||||
value);
|
||||
void Detector::setNumberOfAdditionalStorageCells(int value) {
|
||||
pimpl->Parallel(&slsDetector::setNumberOfAdditionalStorageCells, {}, value);
|
||||
}
|
||||
|
||||
Result<int> Detector::getStorageCellStart(Positions pos) const {
|
||||
@ -1052,13 +1043,11 @@ void Detector::setStoragecellStart(int cell, Positions pos) {
|
||||
}
|
||||
|
||||
Result<ns> Detector::getStorageCellDelay(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::STORAGE_CELL_DELAY, -1);
|
||||
return pimpl->Parallel(&slsDetector::getStorageCellDelay, pos);
|
||||
}
|
||||
|
||||
void Detector::setStorageCellDelay(ns value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::STORAGE_CELL_DELAY,
|
||||
value.count());
|
||||
pimpl->Parallel(&slsDetector::setStorageCellDelay, pos, value.count());
|
||||
}
|
||||
|
||||
// Gotthard Specific
|
||||
@ -1079,12 +1068,7 @@ void Detector::clearROI(Positions pos) {
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptimeLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||
defs::ACQUISITION_TIME);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getPeriodLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::FRAME_PERIOD);
|
||||
return pimpl->Parallel(&slsDetector::getExptimeLeft, pos);
|
||||
}
|
||||
|
||||
Result<defs::externalSignalFlag>
|
||||
@ -1110,22 +1094,20 @@ Result<int> Detector::setImageTestMode(int value, Positions pos) {
|
||||
|
||||
// CTB Specific
|
||||
|
||||
Result<int64_t> Detector::getNumberOfAnalogSamples(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ANALOG_SAMPLES,
|
||||
-1);
|
||||
Result<int> Detector::getNumberOfAnalogSamples(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getNumberOfAnalogSamples, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfAnalogSamples(int64_t value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::ANALOG_SAMPLES, value);
|
||||
void Detector::setNumberOfAnalogSamples(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setNumberOfAnalogSamples, pos, value);
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfDigitalSamples(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES,
|
||||
-1);
|
||||
Result<int> Detector::getNumberOfDigitalSamples(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getNumberOfDigitalSamples, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfDigitalSamples(int64_t value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES, value);
|
||||
void Detector::setNumberOfDigitalSamples(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setNumberOfDigitalSamples, pos, value);
|
||||
}
|
||||
|
||||
Result<defs::readoutMode> Detector::getReadoutMode(Positions pos) const {
|
||||
@ -1605,17 +1587,15 @@ void Detector::executeCommand(const std::string &value, Positions pos) {
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfFramesFromStart(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||
defs::FRAMES_FROM_START);
|
||||
return pimpl->Parallel(&slsDetector::getNumberOfFramesFromStart, pos);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getActualTime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::ACTUAL_TIME);
|
||||
return pimpl->Parallel(&slsDetector::getActualTime, pos);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getMeasurementTime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos,
|
||||
defs::MEASUREMENT_TIME);
|
||||
return pimpl->Parallel(&slsDetector::getMeasurementTime, pos);
|
||||
}
|
||||
|
||||
std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); }
|
||||
|
@ -1006,10 +1006,10 @@ void multiSlsDetector::registerDataCallback(
|
||||
}
|
||||
}
|
||||
|
||||
int multiSlsDetector::setTotalProgress() {
|
||||
int nf = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1)
|
||||
double multiSlsDetector::setTotalProgress() {
|
||||
int64_t nf = Parallel(&slsDetector::getNumberOfFramesFromShm, {})
|
||||
.tsquash("Inconsistent number of frames");
|
||||
int nc = Parallel(&slsDetector::setTimer, {}, TRIGGER_NUMBER, -1)
|
||||
int64_t nc = Parallel(&slsDetector::getNumberOfTriggersFromShm, {})
|
||||
.tsquash("Inconsistent number of triggers");
|
||||
if (nf == 0 || nc == 0) {
|
||||
throw RuntimeError("Number of frames or triggers is 0");
|
||||
@ -1017,7 +1017,7 @@ int multiSlsDetector::setTotalProgress() {
|
||||
|
||||
int ns = 1;
|
||||
if (multi_shm()->multiDetectorType == JUNGFRAU) {
|
||||
ns = Parallel(&slsDetector::setTimer, {}, STORAGE_CELL_NUMBER, -1)
|
||||
ns = Parallel(&slsDetector::getNumberOfAdditionalStorageCellsFromShm, {})
|
||||
.tsquash("Inconsistent number of additional storage cells");
|
||||
++ns;
|
||||
}
|
||||
@ -1030,23 +1030,23 @@ int multiSlsDetector::setTotalProgress() {
|
||||
|
||||
double multiSlsDetector::getCurrentProgress() {
|
||||
std::lock_guard<std::mutex> lock(mp);
|
||||
return 100. * ((double)progressIndex) / ((double)totalProgress);
|
||||
return 100. * progressIndex / totalProgress;
|
||||
}
|
||||
|
||||
void multiSlsDetector::incrementProgress() {
|
||||
std::lock_guard<std::mutex> lock(mp);
|
||||
progressIndex++;
|
||||
progressIndex += 1;
|
||||
std::cout << std::fixed << std::setprecision(2) << std::setw(6)
|
||||
<< 100. * ((double)progressIndex) / ((double)totalProgress)
|
||||
<< 100. * progressIndex / totalProgress
|
||||
<< " \%";
|
||||
std::cout << '\r' << std::flush;
|
||||
}
|
||||
|
||||
void multiSlsDetector::setCurrentProgress(int i) {
|
||||
void multiSlsDetector::setCurrentProgress(int64_t i) {
|
||||
std::lock_guard<std::mutex> lock(mp);
|
||||
progressIndex = i;
|
||||
progressIndex = (double)i;
|
||||
std::cout << std::fixed << std::setprecision(2) << std::setw(6)
|
||||
<< 100. * ((double)progressIndex) / ((double)totalProgress)
|
||||
<< 100. * progressIndex / totalProgress
|
||||
<< " \%";
|
||||
std::cout << '\r' << std::flush;
|
||||
}
|
||||
@ -1148,7 +1148,7 @@ void multiSlsDetector::processData() {
|
||||
}
|
||||
// only update progress
|
||||
else {
|
||||
int caught = -1;
|
||||
int64_t caught = -1;
|
||||
while (true) {
|
||||
// to exit acquire by typing q
|
||||
if (kbhit() != 0) {
|
||||
|
@ -322,21 +322,9 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
shm()->roMode = ANALOG_ONLY;
|
||||
shm()->currentSettings = UNINITIALIZED;
|
||||
shm()->currentThresholdEV = -1;
|
||||
shm()->timerValue[FRAME_NUMBER] = 1;
|
||||
shm()->timerValue[ACQUISITION_TIME] = 0;
|
||||
shm()->timerValue[FRAME_PERIOD] = 0;
|
||||
shm()->timerValue[DELAY_AFTER_TRIGGER] = 0;
|
||||
shm()->timerValue[TRIGGER_NUMBER] = 1;
|
||||
shm()->timerValue[ACTUAL_TIME] = 0;
|
||||
shm()->timerValue[MEASUREMENT_TIME] = 0;
|
||||
shm()->timerValue[PROGRESS] = 0;
|
||||
shm()->timerValue[FRAMES_FROM_START] = 0;
|
||||
shm()->timerValue[FRAMES_FROM_START_PG] = 0;
|
||||
shm()->timerValue[ANALOG_SAMPLES] = 1;
|
||||
shm()->timerValue[DIGITAL_SAMPLES] = 1;
|
||||
shm()->timerValue[SUBFRAME_ACQUISITION_TIME] = 0;
|
||||
shm()->timerValue[STORAGE_CELL_NUMBER] = 0;
|
||||
shm()->timerValue[SUBFRAME_DEADTIME] = 0;
|
||||
shm()->nFrames = 1;
|
||||
shm()->nTriggers = 1;
|
||||
shm()->nAddStorageCells = 0;
|
||||
shm()->deadTime = 0;
|
||||
sls::strcpy_safe(shm()->rxHostname, "none");
|
||||
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
|
||||
@ -751,44 +739,17 @@ void slsDetector::updateCachedDetectorVariables() {
|
||||
|
||||
// frame number
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[FRAME_NUMBER] = i64;
|
||||
|
||||
// exptime
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[ACQUISITION_TIME] = i64;
|
||||
|
||||
// subexptime, subdeadtime
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[SUBFRAME_ACQUISITION_TIME] = i64;
|
||||
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[SUBFRAME_DEADTIME] = i64;
|
||||
}
|
||||
|
||||
// period
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[FRAME_PERIOD] = i64;
|
||||
|
||||
// delay
|
||||
if (shm()->myDetectorType != EIGER && shm()->myDetectorType != MYTHEN3 && shm()->myDetectorType != GOTTHARD2) {
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[DELAY_AFTER_TRIGGER] = i64;
|
||||
}
|
||||
shm()->nFrames = i64;
|
||||
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
// storage cell
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[STORAGE_CELL_NUMBER] = i64;
|
||||
|
||||
// storage cell delay
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[STORAGE_CELL_DELAY] = i64;
|
||||
shm()->nAddStorageCells = i64;
|
||||
}
|
||||
|
||||
// triggers
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[TRIGGER_NUMBER] = i64;
|
||||
shm()->nTriggers = i64;
|
||||
|
||||
// readout mode
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD) {
|
||||
@ -806,18 +767,6 @@ void slsDetector::updateCachedDetectorVariables() {
|
||||
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD ||
|
||||
shm()->myDetectorType == MOENCH) {
|
||||
// analog samples
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
if (i64 >= 0) {
|
||||
shm()->timerValue[ANALOG_SAMPLES] = i64;
|
||||
}
|
||||
|
||||
// digital samples
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
if (i64 >= 0) {
|
||||
shm()->timerValue[DIGITAL_SAMPLES] = i64;
|
||||
}
|
||||
|
||||
// adcmask
|
||||
uint32_t u32 = 0;
|
||||
n += client.Receive(&u32, sizeof(u32));
|
||||
@ -1220,87 +1169,295 @@ uint64_t slsDetector::getStartingFrameNumber() {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
||||
int64_t args[]{static_cast<int64_t>(index), t};
|
||||
int64_t retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Setting " << sls::ToString(index) << " to " << t
|
||||
<< " ns/value";
|
||||
|
||||
// send to detector
|
||||
int64_t oldtimer = shm()->timerValue[index];
|
||||
sendToDetector(F_SET_TIMER, args, retval);
|
||||
FILE_LOG(logDEBUG1) << sls::ToString(index) << ": " << retval;
|
||||
shm()->timerValue[index] = retval;
|
||||
// update #nchan, as it depends on #samples, adcmask,
|
||||
if (index == ANALOG_SAMPLES || index == DIGITAL_SAMPLES) {
|
||||
updateNumberOfChannels();
|
||||
}
|
||||
|
||||
// setting timers consequences (eiger (ratecorr) )
|
||||
// (a get can also change timer value, hence check difference)
|
||||
if (oldtimer != shm()->timerValue[index]) {
|
||||
// eiger: change exptime/subexptime, set rate correction to update table
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
int dr = shm()->dynamicRange;
|
||||
if ((dr == 32 && index == SUBFRAME_ACQUISITION_TIME) ||
|
||||
(dr == 16 && index == ACQUISITION_TIME)) {
|
||||
int r = getRateCorrection();
|
||||
if (r != 0) {
|
||||
setRateCorrection(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// send to reciever
|
||||
void slsDetector::sendTotalNumFramestoReceiver() {
|
||||
if (shm()->useReceiverFlag) {
|
||||
timerIndex rt[]{FRAME_NUMBER,
|
||||
FRAME_PERIOD,
|
||||
TRIGGER_NUMBER,
|
||||
ACQUISITION_TIME,
|
||||
SUBFRAME_ACQUISITION_TIME,
|
||||
SUBFRAME_DEADTIME,
|
||||
ANALOG_SAMPLES,
|
||||
DIGITAL_SAMPLES,
|
||||
STORAGE_CELL_NUMBER};
|
||||
|
||||
// if in list (lambda)
|
||||
if (std::any_of(std::begin(rt), std::end(rt),
|
||||
[index](timerIndex t) { return t == index; })) {
|
||||
args[1] = shm()->timerValue[index];
|
||||
retval = -1;
|
||||
|
||||
// rewrite args
|
||||
if ((index == FRAME_NUMBER) || (index == TRIGGER_NUMBER) ||
|
||||
(index == STORAGE_CELL_NUMBER)) {
|
||||
args[1] = shm()->timerValue[FRAME_NUMBER] *
|
||||
((shm()->timerValue[TRIGGER_NUMBER] > 0)
|
||||
? (shm()->timerValue[TRIGGER_NUMBER])
|
||||
: 1) *
|
||||
((shm()->timerValue[STORAGE_CELL_NUMBER] > 0)
|
||||
? (shm()->timerValue[STORAGE_CELL_NUMBER]) + 1
|
||||
: 1);
|
||||
}
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Sending "
|
||||
<< (((index == FRAME_NUMBER) || (index == TRIGGER_NUMBER) ||
|
||||
(index == STORAGE_CELL_NUMBER))
|
||||
? "(#Frames) * (#triggers) * (#storage cells)"
|
||||
: sls::ToString(index))
|
||||
<< " to receiver: " << args[1];
|
||||
|
||||
sendToReceiver(F_SET_RECEIVER_TIMER, args, retval);
|
||||
}
|
||||
int64_t arg = shm()->nFrames * shm()->nTriggers * (shm()->nAddStorageCells + 1);
|
||||
FILE_LOG(logDEBUG1) << "Sending total number of frames (#f x #t x #s) to Receiver: " << arg;
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_FRAMES, arg, nullptr);
|
||||
}
|
||||
return shm()->timerValue[index];
|
||||
}
|
||||
|
||||
int64_t slsDetector::getTimeLeft(timerIndex index) const {
|
||||
int64_t slsDetector::getNumberOfFramesFromShm() {
|
||||
return shm()->nFrames;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfFrames() {
|
||||
int64_t prevVal = shm()->nFrames;
|
||||
int64_t retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Getting " << sls::ToString(index) << " left";
|
||||
sendToDetectorStop(F_GET_TIME_LEFT, index, retval);
|
||||
FILE_LOG(logDEBUG1) << sls::ToString(index) << " left: " << retval;
|
||||
return retval;
|
||||
sendToDetector(F_GET_NUM_FRAMES, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of frames :" << retval;
|
||||
shm()->nFrames = retval;
|
||||
if (prevVal != retval) {
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nFrames;
|
||||
}
|
||||
|
||||
void slsDetector::setNumberOfFrames(int64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting number of frames to " << value;
|
||||
sendToDetector(F_SET_NUM_FRAMES, value, nullptr);
|
||||
shm()->nFrames = value;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfTriggersFromShm() {
|
||||
return shm()->nTriggers;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfTriggers() {
|
||||
int64_t prevVal = shm()->nTriggers;
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_NUM_TRIGGERS, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of triggers :" << retval;
|
||||
shm()->nTriggers = retval;
|
||||
if (prevVal != retval) {
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nTriggers;
|
||||
}
|
||||
|
||||
void slsDetector::setNumberOfTriggers(int64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting number of triggers to " << value;
|
||||
sendToDetector(F_SET_NUM_TRIGGERS, value, nullptr);
|
||||
shm()->nTriggers = value;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
|
||||
int slsDetector::getNumberOfAdditionalStorageCellsFromShm() {
|
||||
return shm()->nAddStorageCells;
|
||||
}
|
||||
|
||||
int slsDetector::getNumberOfAdditionalStorageCells() {
|
||||
int prevVal = shm()->nAddStorageCells;
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_NUM_ADDITIONAL_STORAGE_CELLS, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of storage cells :" << retval;
|
||||
shm()->nAddStorageCells = retval;
|
||||
if (prevVal != retval) {
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nAddStorageCells;
|
||||
}
|
||||
|
||||
void slsDetector::setNumberOfAdditionalStorageCells(int value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting number of storage cells to " << value;
|
||||
sendToDetector(F_SET_NUM_ADDITIONAL_STORAGE_CELLS, value, nullptr);
|
||||
shm()->nAddStorageCells = value;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
|
||||
int slsDetector::getNumberOfAnalogSamples() {
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_NUM_ANALOG_SAMPLES, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of analog samples :" << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setNumberOfAnalogSamples(int value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting number of analog samples to " << value;
|
||||
sendToDetector(F_SET_NUM_ANALOG_SAMPLES, value, nullptr);
|
||||
// update #nchan, as it depends on #samples, adcmask
|
||||
updateNumberOfChannels();
|
||||
if (shm()->useReceiverFlag) {
|
||||
FILE_LOG(logDEBUG1) << "Sending number of analog samples to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int slsDetector::getNumberOfDigitalSamples() {
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_NUM_DIGITAL_SAMPLES, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of digital samples :" << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setNumberOfDigitalSamples(int value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting number of digital samples to " << value;
|
||||
sendToDetector(F_SET_NUM_DIGITAL_SAMPLES, value, nullptr);
|
||||
// update #nchan, as it depends on #samples, adcmask
|
||||
updateNumberOfChannels();
|
||||
if (shm()->useReceiverFlag) {
|
||||
FILE_LOG(logDEBUG1) << "Sending number of digital samples to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_DIGITAL_SAMPLES, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t slsDetector::getExptime() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_EXPTIME, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "exptime :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setExptime(int64_t value) {
|
||||
int64_t prevVal = value;
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
prevVal = getExptime();
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "Setting exptime to " << value << "ns";
|
||||
sendToDetector(F_SET_EXPTIME, value, nullptr);
|
||||
if (shm()->myDetectorType == EIGER && prevVal != value && shm()->dynamicRange == 16) {
|
||||
int r = getRateCorrection();
|
||||
if (r != 0) {
|
||||
setRateCorrection(r);
|
||||
}
|
||||
}
|
||||
if (shm()->useReceiverFlag) {
|
||||
FILE_LOG(logDEBUG1) << "Sending exptime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_EXPTIME, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t slsDetector::getPeriod() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_PERIOD, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "period :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setPeriod(int64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting period to " << value << "ns";
|
||||
sendToDetector(F_SET_PERIOD, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
FILE_LOG(logDEBUG1) << "Sending period to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_PERIOD, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t slsDetector::getDelayAfterTrigger() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_DELAY_AFTER_TRIGGER, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "delay after trigger :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setDelayAfterTrigger(int64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting delay after trigger to " << value << "ns";
|
||||
sendToDetector(F_SET_DELAY_AFTER_TRIGGER, value, nullptr);
|
||||
}
|
||||
|
||||
int64_t slsDetector::getSubExptime() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_SUB_EXPTIME, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "sub exptime :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setSubExptime(int64_t value) {
|
||||
int64_t prevVal = value;
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
prevVal = getSubExptime();
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "Setting sub exptime to " << value << "ns";
|
||||
sendToDetector(F_SET_SUB_EXPTIME, value, nullptr);
|
||||
if (shm()->myDetectorType == EIGER && prevVal != value && shm()->dynamicRange == 32) {
|
||||
int r = getRateCorrection();
|
||||
if (r != 0) {
|
||||
setRateCorrection(r);
|
||||
}
|
||||
}
|
||||
if (shm()->useReceiverFlag) {
|
||||
FILE_LOG(logDEBUG1) << "Sending sub exptime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_SUB_EXPTIME, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t slsDetector::getSubDeadTime() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_SUB_DEADTIME, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "sub deadtime :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setSubDeadTime(int64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting sub deadtime to " << value << "ns";
|
||||
sendToDetector(F_SET_SUB_DEADTIME, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
FILE_LOG(logDEBUG1) << "Sending sub deadtime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_SUB_DEADTIME, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t slsDetector::getStorageCellDelay() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_STORAGE_CELL_DELAY, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "storage cell delay :" << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setStorageCellDelay(int64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting storage cell delay to " << value << "ns";
|
||||
sendToDetector(F_SET_STORAGE_CELL_DELAY, value, nullptr);
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfFramesLeft() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_FRAMES_LEFT, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of frames left :" << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfTriggersLeft() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_TRIGGERS_LEFT, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of triggers left :" << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getDelayAfterTriggerLeft() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_DELAY_AFTER_TRIGGER_LEFT, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "delay after trigger left :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getExptimeLeft() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_EXPTIME_LEFT, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "exptime left :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getPeriodLeft() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_PERIOD_LEFT, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "period left :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getMeasuredPeriod() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_MEASURED_PERIOD, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "measured period :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getMeasuredSubFramePeriod() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_MEASURED_SUBPERIOD, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "exptime :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfFramesFromStart() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_FRAMES_FROM_START, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of frames from start :" << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getActualTime() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_ACTUAL_TIME, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "actual time :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getMeasurementTime() const {
|
||||
int64_t retval = -1;
|
||||
sendToDetectorStop(F_GET_MEASUREMENT_TIME, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "measurement time :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
int slsDetector::setSpeed(speedVariable sp, int value, int mode) {
|
||||
@ -1551,15 +1708,6 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
<< "\nwrite enable:" << shm()->rxFileWrite
|
||||
<< "\nmaster write enable:" << shm()->rxMasterFileWrite
|
||||
<< "\noverwrite enable:" << shm()->rxFileOverWrite
|
||||
<< "\nframe index needed:"
|
||||
<< ((shm()->timerValue[FRAME_NUMBER] *
|
||||
shm()->timerValue[TRIGGER_NUMBER]) > 1)
|
||||
<< "\nframe period:" << (shm()->timerValue[FRAME_PERIOD])
|
||||
<< "\nframe number:" << (shm()->timerValue[FRAME_NUMBER])
|
||||
<< "\nsub exp time:" << (shm()->timerValue[SUBFRAME_ACQUISITION_TIME])
|
||||
<< "\nsub dead time:" << (shm()->timerValue[SUBFRAME_DEADTIME])
|
||||
<< "\nasamples:" << (shm()->timerValue[ANALOG_SAMPLES])
|
||||
<< "\ndsamples:" << (shm()->timerValue[DIGITAL_SAMPLES])
|
||||
<< "\ndynamic range:" << shm()->dynamicRange
|
||||
<< "\nflippeddatax:" << (shm()->flippedDataX)
|
||||
<< "\nactivated: " << shm()->activated
|
||||
@ -1603,17 +1751,16 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
setFileWrite(shm()->rxFileWrite);
|
||||
setMasterFileWrite(shm()->rxMasterFileWrite);
|
||||
setFileOverWrite(shm()->rxFileOverWrite);
|
||||
setTimer(FRAME_PERIOD, shm()->timerValue[FRAME_PERIOD]);
|
||||
setTimer(FRAME_NUMBER, shm()->timerValue[FRAME_NUMBER]);
|
||||
setTimer(ACQUISITION_TIME, shm()->timerValue[ACQUISITION_TIME]);
|
||||
sendTotalNumFramestoReceiver();
|
||||
setExptime(getExptime());
|
||||
setPeriod(getPeriod());
|
||||
|
||||
// detector specific
|
||||
switch (shm()->myDetectorType) {
|
||||
|
||||
case EIGER:
|
||||
setTimer(SUBFRAME_ACQUISITION_TIME,
|
||||
shm()->timerValue[SUBFRAME_ACQUISITION_TIME]);
|
||||
setTimer(SUBFRAME_DEADTIME, shm()->timerValue[SUBFRAME_DEADTIME]);
|
||||
setSubExptime(getSubExptime());
|
||||
setSubDeadTime(getSubDeadTime());
|
||||
setDynamicRange(shm()->dynamicRange);
|
||||
setFlippedDataX(-1);
|
||||
activate(-1);
|
||||
@ -1625,8 +1772,8 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
break;
|
||||
|
||||
case CHIPTESTBOARD:
|
||||
setTimer(ANALOG_SAMPLES, shm()->timerValue[ANALOG_SAMPLES]);
|
||||
setTimer(DIGITAL_SAMPLES, shm()->timerValue[DIGITAL_SAMPLES]);
|
||||
setNumberOfAnalogSamples(getNumberOfAnalogSamples());
|
||||
setNumberOfDigitalSamples(getNumberOfDigitalSamples());
|
||||
enableTenGigabitEthernet(shm()->tenGigaEnable);
|
||||
setReadoutMode(shm()->roMode);
|
||||
setADCEnableMask(shm()->adcEnableMask);
|
||||
@ -1635,8 +1782,8 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
break;
|
||||
|
||||
case MOENCH:
|
||||
setTimer(ANALOG_SAMPLES, shm()->timerValue[ANALOG_SAMPLES]);
|
||||
setTimer(DIGITAL_SAMPLES, shm()->timerValue[DIGITAL_SAMPLES]);
|
||||
setNumberOfAnalogSamples(getNumberOfAnalogSamples());
|
||||
setNumberOfDigitalSamples(getNumberOfDigitalSamples());
|
||||
enableTenGigabitEthernet(shm()->tenGigaEnable);
|
||||
setADCEnableMask(shm()->adcEnableMask);
|
||||
break;
|
||||
@ -3074,8 +3221,8 @@ slsDetectorDefs::runStatus slsDetector::getReceiverStatus() const {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int slsDetector::getFramesCaughtByReceiver() const {
|
||||
int retval = -1;
|
||||
int64_t slsDetector::getFramesCaughtByReceiver() const {
|
||||
int64_t retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Getting Frames Caught by Receiver";
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_GET_RECEIVER_FRAMES_CAUGHT, nullptr, retval);
|
||||
|
@ -1973,7 +1973,7 @@ TEST_CASE("extsamplingsrc", "[.cmd][.ctb]") {
|
||||
|
||||
|
||||
TEST_CASE("adcinvert", "[.cmd][.ctb]") {
|
||||
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
if (test::type == slsDetectorDefs::CHIPTESTBOARD || test::type == slsDetectorDefs::JUNGFRAU) {
|
||||
std::string s;
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -4451,13 +4451,6 @@ TEST_CASE("rx_lastclient", "[.cmd]") {
|
||||
|
||||
|
||||
|
||||
TEST_CASE("rx_checkversion", "[.cmd]") {
|
||||
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(multiSlsDetectorClient("rx_checkversion", GET, nullptr, oss));
|
||||
REQUIRE(oss.str() == "rx_checkversion compatible\n");
|
||||
}
|
||||
|
||||
TEST_CASE("exptime", "[.cmd]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
@ -201,7 +201,7 @@ public:
|
||||
* @param f readout flags
|
||||
* @returns analog data bytes
|
||||
*/
|
||||
virtual int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readoutMode) {
|
||||
virtual int setImageSize(uint32_t a, uint32_t as, uint32_t ds, bool t, slsDetectorDefs::readoutMode) {
|
||||
FILE_LOG(logERROR) << "setImageSize is a generic function that should be overloaded by a derived class";
|
||||
return 0;
|
||||
};
|
||||
@ -577,7 +577,7 @@ public:
|
||||
* @param f readout flags
|
||||
* @returns analog data bytes
|
||||
*/
|
||||
int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readoutMode f) {
|
||||
int setImageSize(uint32_t a, uint32_t as, uint32_t ds, bool t, slsDetectorDefs::readoutMode f) {
|
||||
int nachans = 0, ndchans = 0;
|
||||
int adatabytes = 0, ddatabytes = 0;
|
||||
|
||||
@ -692,7 +692,7 @@ public:
|
||||
* @param f readout flags
|
||||
* @returns analog data bytes
|
||||
*/
|
||||
int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readoutMode) {
|
||||
int setImageSize(uint32_t a, uint32_t as, uint32_t ds, bool t, slsDetectorDefs::readoutMode) {
|
||||
int nachans = 0;
|
||||
int adatabytes = 0;
|
||||
|
||||
|
@ -267,14 +267,14 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
||||
* test board and moench only)
|
||||
* @return number of Analog samples expected
|
||||
*/
|
||||
uint64_t getNumberofAnalogSamples() const;
|
||||
uint32_t getNumberofAnalogSamples() const;
|
||||
|
||||
/*
|
||||
* Get Number of Digital Samples expected by receiver from detector (for
|
||||
* chip test board and moench only)
|
||||
* @return number of Digital samples expected
|
||||
*/
|
||||
uint64_t getNumberofDigitalSamples() const;
|
||||
uint32_t getNumberofDigitalSamples() const;
|
||||
|
||||
/**
|
||||
* Get Dynamic Range or Number of Bits Per Pixel
|
||||
@ -575,16 +575,14 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
||||
/**
|
||||
* Set Acquisition Period
|
||||
* @param i acquisition period
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setAcquisitionPeriod(const uint64_t i);
|
||||
void setAcquisitionPeriod(const uint64_t i);
|
||||
|
||||
/**
|
||||
* Set Acquisition Time
|
||||
* @param i acquisition time
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setAcquisitionTime(const uint64_t i);
|
||||
void setAcquisitionTime(const uint64_t i);
|
||||
|
||||
/**
|
||||
* Set Sub Exposure Time
|
||||
@ -613,14 +611,14 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
||||
* @param i number of Analog Samples expected
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setNumberofAnalogSamples(const uint64_t i);
|
||||
int setNumberofAnalogSamples(const uint32_t i);
|
||||
|
||||
/**
|
||||
* Set Number of Digital Samples expected by receiver from detector
|
||||
* @param i number of Digital Samples expected
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setNumberofDigitalSamples(const uint64_t i);
|
||||
int setNumberofDigitalSamples(const uint32_t i);
|
||||
|
||||
/**
|
||||
* Set Dynamic Range or Number of Bits Per Pixel
|
||||
|
@ -159,8 +159,26 @@ class slsReceiverTCPIPInterface : private virtual slsDetectorDefs {
|
||||
/** set roi */
|
||||
int set_roi(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set acquisition period, frame number etc */
|
||||
int set_timer(sls::ServerInterface2 &socket);
|
||||
/** set num frames */
|
||||
int set_num_frames(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set num analog samples */
|
||||
int set_num_analog_samples(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set num digital samples */
|
||||
int set_num_digital_samples(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set exptime */
|
||||
int set_exptime(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set period */
|
||||
int set_period(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set subexptime */
|
||||
int set_subexptime(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set subdeadtime */
|
||||
int set_subdeadtime(sls::ServerInterface2 &socket);
|
||||
|
||||
/** set dynamic range */
|
||||
int set_dynamic_range(sls::ServerInterface2 &socket);
|
||||
|
@ -337,12 +337,12 @@ uint64_t slsReceiverImplementation::getNumberOfFrames() const {
|
||||
return numberOfFrames;
|
||||
}
|
||||
|
||||
uint64_t slsReceiverImplementation::getNumberofAnalogSamples() const {
|
||||
uint32_t slsReceiverImplementation::getNumberofAnalogSamples() const {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return numberOfAnalogSamples;
|
||||
}
|
||||
|
||||
uint64_t slsReceiverImplementation::getNumberofDigitalSamples() const {
|
||||
uint32_t slsReceiverImplementation::getNumberofDigitalSamples() const {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return numberOfDigitalSamples;
|
||||
}
|
||||
@ -924,24 +924,20 @@ void slsReceiverImplementation::setAdditionalJsonHeader(const char c[]) {
|
||||
FILE_LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader;
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i) {
|
||||
void slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
acquisitionPeriod = i;
|
||||
FILE_LOG(logINFO) << "Acquisition Period: "
|
||||
<< (double)acquisitionPeriod / (1E9) << "s";
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setAcquisitionTime(const uint64_t i) {
|
||||
void slsReceiverImplementation::setAcquisitionTime(const uint64_t i) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
acquisitionTime = i;
|
||||
FILE_LOG(logINFO) << "Acquisition Time: " << (double)acquisitionTime / (1E9)
|
||||
<< "s";
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setSubExpTime(const uint64_t i) {
|
||||
@ -967,7 +963,7 @@ void slsReceiverImplementation::setNumberOfFrames(const uint64_t i) {
|
||||
FILE_LOG(logINFO) << "Number of Frames: " << numberOfFrames;
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setNumberofAnalogSamples(const uint64_t i) {
|
||||
int slsReceiverImplementation::setNumberofAnalogSamples(const uint32_t i) {
|
||||
if (numberOfAnalogSamples != i) {
|
||||
numberOfAnalogSamples = i;
|
||||
|
||||
@ -986,7 +982,7 @@ int slsReceiverImplementation::setNumberofAnalogSamples(const uint64_t i) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setNumberofDigitalSamples(const uint64_t i) {
|
||||
int slsReceiverImplementation::setNumberofDigitalSamples(const uint32_t i) {
|
||||
if (numberOfDigitalSamples != i) {
|
||||
numberOfDigitalSamples = i;
|
||||
|
||||
|
@ -157,7 +157,13 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_GET_RECEIVER_TYPE] = &slsReceiverTCPIPInterface::set_detector_type;
|
||||
flist[F_SEND_RECEIVER_DETHOSTNAME] = &slsReceiverTCPIPInterface::set_detector_hostname;
|
||||
flist[F_RECEIVER_SET_ROI] = &slsReceiverTCPIPInterface::set_roi;
|
||||
flist[F_SET_RECEIVER_TIMER] = &slsReceiverTCPIPInterface::set_timer;
|
||||
flist[F_RECEIVER_SET_NUM_FRAMES] = &slsReceiverTCPIPInterface::set_num_frames;
|
||||
flist[F_RECEIVER_SET_NUM_ANALOG_SAMPLES]= &slsReceiverTCPIPInterface::set_num_analog_samples;
|
||||
flist[F_RECEIVER_SET_NUM_DIGITAL_SAMPLES]= &slsReceiverTCPIPInterface::set_num_digital_samples;
|
||||
flist[F_RECEIVER_SET_EXPTIME] = &slsReceiverTCPIPInterface::set_exptime;
|
||||
flist[F_RECEIVER_SET_PERIOD] = &slsReceiverTCPIPInterface::set_period;
|
||||
flist[F_RECEIVER_SET_SUB_EXPTIME] = &slsReceiverTCPIPInterface::set_subexptime;
|
||||
flist[F_RECEIVER_SET_SUB_DEADTIME] = &slsReceiverTCPIPInterface::set_subdeadtime;
|
||||
flist[F_SET_RECEIVER_DYNAMIC_RANGE] = &slsReceiverTCPIPInterface::set_dynamic_range;
|
||||
flist[F_RECEIVER_STREAMING_FREQUENCY] = &slsReceiverTCPIPInterface::set_streaming_frequency;
|
||||
flist[F_GET_RECEIVER_STATUS] = &slsReceiverTCPIPInterface::get_status;
|
||||
@ -208,8 +214,8 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_SET_RECEIVER_NUM_INTERFACES] = &slsReceiverTCPIPInterface::set_num_interfaces;
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
getFunctionNameFromEnum((enum detFuncs)i) << ") located at " << flist[i];
|
||||
// FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
// getFunctionNameFromEnum((enum detFuncs)i) << ") located at " << flist[i];
|
||||
}
|
||||
|
||||
return OK;
|
||||
@ -222,21 +228,21 @@ int slsReceiverTCPIPInterface::decode_function(Interface &socket) {
|
||||
throw RuntimeError("Unrecognized Function enum " +
|
||||
std::to_string(fnum) + "\n");
|
||||
} else {
|
||||
FILE_LOG(logDEBUG1) << "calling function fnum: " << fnum << " ("
|
||||
<< getFunctionNameFromEnum((enum detFuncs)fnum)
|
||||
<< ")";
|
||||
// FILE_LOG(logDEBUG1) << "calling function fnum: " << fnum << " ("
|
||||
// << getFunctionNameFromEnum((enum detFuncs)fnum)
|
||||
// << ")";
|
||||
ret = (this->*flist[fnum])(socket);
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Function " << getFunctionNameFromEnum((enum detFuncs)fnum)
|
||||
<< " finished";
|
||||
// FILE_LOG(logDEBUG1)
|
||||
// << "Function " << getFunctionNameFromEnum((enum detFuncs)fnum)
|
||||
// << " finished";
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void slsReceiverTCPIPInterface::functionNotImplemented() {
|
||||
std::ostringstream os;
|
||||
os << "Function: " << getFunctionNameFromEnum((enum detFuncs)fnum)
|
||||
<< ", is is not implemented for this detector";
|
||||
// os << "Function: " << getFunctionNameFromEnum((enum detFuncs)fnum)
|
||||
// << ", is is not implemented for this detector";
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
|
||||
@ -268,8 +274,8 @@ void slsReceiverTCPIPInterface::VerifyLock() {
|
||||
|
||||
void slsReceiverTCPIPInterface::VerifyIdle(Interface &socket) {
|
||||
if (impl()->getStatus() != IDLE) {
|
||||
sprintf(mess, "Can not execute %s when receiver is not idle\n",
|
||||
getFunctionNameFromEnum((enum detFuncs)fnum));
|
||||
// sprintf(mess, "Can not execute %s when receiver is not idle\n",
|
||||
// getFunctionNameFromEnum((enum detFuncs)fnum));
|
||||
throw sls::SocketError(mess);
|
||||
}
|
||||
}
|
||||
@ -529,94 +535,61 @@ int slsReceiverTCPIPInterface::set_roi(Interface &socket) {
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_timer(Interface &socket) {
|
||||
auto ind = socket.Receive<int64_t>();
|
||||
slsDetectorDefs::timerIndex index = static_cast<slsDetectorDefs::timerIndex>(ind);
|
||||
int slsReceiverTCPIPInterface::set_num_frames(Interface &socket) {
|
||||
auto value = socket.Receive<int64_t>();
|
||||
if (value >= 0) {
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Setting timer index " << index << " to " << value;
|
||||
switch (index) {
|
||||
case ACQUISITION_TIME:
|
||||
ret = impl()->setAcquisitionTime(value);
|
||||
break;
|
||||
case FRAME_PERIOD:
|
||||
ret = impl()->setAcquisitionPeriod(value);
|
||||
break;
|
||||
case FRAME_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
case STORAGE_CELL_NUMBER:
|
||||
impl()->setNumberOfFrames(value);
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
impl()->setSubExpTime(value);
|
||||
break;
|
||||
case SUBFRAME_DEADTIME:
|
||||
impl()->setSubPeriod(value + impl()->getSubExpTime());
|
||||
break;
|
||||
case ANALOG_SAMPLES:
|
||||
if (myDetectorType != CHIPTESTBOARD && myDetectorType != MOENCH) {
|
||||
modeNotImplemented("(Analog Samples) Timer index",
|
||||
static_cast<int>(index));
|
||||
break;
|
||||
}
|
||||
impl()->setNumberofAnalogSamples(value);
|
||||
break;
|
||||
case DIGITAL_SAMPLES:
|
||||
if (myDetectorType != CHIPTESTBOARD && myDetectorType != MOENCH) {
|
||||
modeNotImplemented("(Digital Samples) Timer index",
|
||||
static_cast<int>(index));
|
||||
break;
|
||||
}
|
||||
impl()->setNumberofDigitalSamples(value);
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("Timer index", static_cast<int>(index));
|
||||
break;
|
||||
}
|
||||
}
|
||||
// get
|
||||
int64_t retval = -1;
|
||||
switch (index) {
|
||||
case ACQUISITION_TIME:
|
||||
retval = impl()->getAcquisitionTime();
|
||||
break;
|
||||
case FRAME_PERIOD:
|
||||
retval = impl()->getAcquisitionPeriod();
|
||||
break;
|
||||
case FRAME_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
case STORAGE_CELL_NUMBER:
|
||||
retval = impl()->getNumberOfFrames();
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
retval = impl()->getSubExpTime();
|
||||
break;
|
||||
case SUBFRAME_DEADTIME:
|
||||
retval = impl()->getSubPeriod() - impl()->getSubExpTime();
|
||||
break;
|
||||
case ANALOG_SAMPLES:
|
||||
if (myDetectorType != CHIPTESTBOARD && myDetectorType != MOENCH) {
|
||||
throw RuntimeError("This timer mode (" + sls::ToString(index) +
|
||||
") does not exist for this receiver type");
|
||||
}
|
||||
retval = impl()->getNumberofAnalogSamples();
|
||||
break;
|
||||
case DIGITAL_SAMPLES:
|
||||
if (myDetectorType != CHIPTESTBOARD && myDetectorType != MOENCH) {
|
||||
throw RuntimeError("This timer mode (" + sls::ToString(index) +
|
||||
") does not exist for this receiver type");
|
||||
}
|
||||
retval = impl()->getNumberofDigitalSamples();
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("Timer index", static_cast<int>(index));
|
||||
break;
|
||||
}
|
||||
validate(value, retval, "set timer", DEC);
|
||||
FILE_LOG(logDEBUG1) << sls::ToString((index))
|
||||
<< ":" << retval;
|
||||
return socket.sendResult(retval);
|
||||
FILE_LOG(logDEBUG1) << "Setting num frames to " << value;
|
||||
impl()->setNumberOfFrames(value);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_num_analog_samples(Interface &socket) {
|
||||
auto value = socket.Receive<int>();
|
||||
FILE_LOG(logDEBUG1) << "Setting num analog samples to " << value;
|
||||
if (myDetectorType != CHIPTESTBOARD && myDetectorType != MOENCH) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
ret = impl()->setNumberofAnalogSamples(value);
|
||||
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_num_digital_samples(Interface &socket) {
|
||||
auto value = socket.Receive<int>();
|
||||
FILE_LOG(logDEBUG1) << "Setting num digital samples to " << value;
|
||||
if (myDetectorType != CHIPTESTBOARD && myDetectorType != MOENCH) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
ret = impl()->setNumberofDigitalSamples(value);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_exptime(Interface &socket) {
|
||||
auto value = socket.Receive<int64_t>();
|
||||
FILE_LOG(logDEBUG1) << "Setting exptime to " << value << "ns";
|
||||
impl()->setAcquisitionTime(value);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_period(Interface &socket) {
|
||||
auto value = socket.Receive<int64_t>();
|
||||
FILE_LOG(logDEBUG1) << "Setting period to " << value << "ns";
|
||||
impl()->setAcquisitionPeriod(value);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_subexptime(Interface &socket) {
|
||||
auto value = socket.Receive<int64_t>();
|
||||
FILE_LOG(logDEBUG1) << "Setting period to " << value << "ns";
|
||||
impl()->setSubExpTime(value);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_subdeadtime(Interface &socket) {
|
||||
auto value = socket.Receive<int64_t>();
|
||||
FILE_LOG(logDEBUG1) << "Setting sub deadtime to " << value << "ns";
|
||||
impl()->setSubPeriod(value + impl()->getSubExpTime());
|
||||
FILE_LOG(logDEBUG1) << "Setting sub period to " << impl()->getSubPeriod() << "ns";
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_dynamic_range(Interface &socket) {
|
||||
@ -757,7 +730,7 @@ int slsReceiverTCPIPInterface::get_frame_index(Interface &socket) {
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::get_frames_caught(Interface &socket) {
|
||||
int retval = impl()->getFramesCaught();
|
||||
int64_t retval = impl()->getFramesCaught();
|
||||
FILE_LOG(logDEBUG1) << "frames caught:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
@ -204,44 +204,6 @@ inline std::string ToString(const defs::detectorModeType s) {
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string ToString(const defs::timerIndex t) {
|
||||
switch (t) {
|
||||
case defs::FRAME_NUMBER:
|
||||
return std::string("frame_number");
|
||||
case defs::ACQUISITION_TIME:
|
||||
return std::string("acquisition_time");
|
||||
case defs::FRAME_PERIOD:
|
||||
return std::string("frame_period");
|
||||
case defs::DELAY_AFTER_TRIGGER:
|
||||
return std::string("delay_after_trigger");
|
||||
case defs::TRIGGER_NUMBER:
|
||||
return std::string("triggers_number");
|
||||
case defs::ACTUAL_TIME:
|
||||
return std::string("actual_time");
|
||||
case defs::MEASUREMENT_TIME:
|
||||
return std::string("measurement_time");
|
||||
case defs::PROGRESS:
|
||||
return std::string("progress");
|
||||
case defs::FRAMES_FROM_START:
|
||||
return std::string("frames_from_start");
|
||||
case defs::FRAMES_FROM_START_PG:
|
||||
return std::string("frames_from_start_pg");
|
||||
case defs::ANALOG_SAMPLES:
|
||||
return std::string("analog_samples");
|
||||
case defs::DIGITAL_SAMPLES:
|
||||
return std::string("digital_samples");
|
||||
case defs::SUBFRAME_ACQUISITION_TIME:
|
||||
return std::string("subframe_acquisition_time");
|
||||
case defs::SUBFRAME_DEADTIME:
|
||||
return std::string("subframe_deadtime");
|
||||
case defs::STORAGE_CELL_NUMBER:
|
||||
return std::string("storage_cell_number");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// in case we already have a string
|
||||
// causes a copy but might be needed in generic code
|
||||
inline std::string ToString(const std::string& s) {
|
||||
|
@ -68,9 +68,6 @@
|
||||
|
||||
#define DEFAULT_STREAMING_TIMER_IN_MS 200
|
||||
|
||||
// typedef char mystring[MAX_STR_LENGTH];
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
class slsDetectorDefs {
|
||||
@ -78,9 +75,7 @@ class slsDetectorDefs {
|
||||
slsDetectorDefs(){};
|
||||
#endif
|
||||
|
||||
/**
|
||||
Type of the detector
|
||||
*/
|
||||
/** Type of the detector */
|
||||
enum detectorType {
|
||||
GET_DETECTOR_TYPE = -1,
|
||||
GENERIC,
|
||||
@ -93,48 +88,14 @@ class slsDetectorDefs {
|
||||
GOTTHARD2,
|
||||
};
|
||||
|
||||
/**
|
||||
return values
|
||||
*/
|
||||
/** return values */
|
||||
enum {
|
||||
OK, /**< function succeeded */
|
||||
FAIL, /**< function failed */
|
||||
FORCE_UPDATE
|
||||
};
|
||||
|
||||
/**
|
||||
indexes for the acquisition timers
|
||||
*/
|
||||
enum timerIndex {
|
||||
FRAME_NUMBER, /**< number of real time frames: total number of
|
||||
acquisitions is number or frames*number of triggers */
|
||||
ACQUISITION_TIME, /**< exposure time */
|
||||
FRAME_PERIOD, /**< period between exposures */
|
||||
DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or
|
||||
readout (in triggered mode) */
|
||||
TRIGGER_NUMBER, /**< number of triggers: total number of acquisitions is
|
||||
number or frames*number of triggers (* number of storage cells [jungfrau]) */
|
||||
ACTUAL_TIME, /**< Actual time of the detector's internal timer */
|
||||
MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo)
|
||||
*/
|
||||
|
||||
PROGRESS, /**< fraction of measurement elapsed - only get! */
|
||||
FRAMES_FROM_START,
|
||||
FRAMES_FROM_START_PG,
|
||||
ANALOG_SAMPLES,
|
||||
DIGITAL_SAMPLES,
|
||||
SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */
|
||||
STORAGE_CELL_NUMBER, /**<number of storage cells */
|
||||
SUBFRAME_DEADTIME, /**< subframe deadtime */
|
||||
MEASURED_PERIOD, /**< measured period */
|
||||
MEASURED_SUBPERIOD, /**< measured subperiod */
|
||||
STORAGE_CELL_DELAY, /**< storage cell delay */
|
||||
MAX_TIMERS
|
||||
};
|
||||
|
||||
/**
|
||||
staus mask
|
||||
*/
|
||||
/** staus mask */
|
||||
enum runStatus {
|
||||
IDLE, /**< detector ready to start acquisition - no data in memory */
|
||||
ERROR, /**< error i.e. normally fifo full */
|
||||
|
@ -10,80 +10,110 @@
|
||||
|
||||
|
||||
enum detFuncs{
|
||||
F_EXEC_COMMAND=0, /**< command is executed */
|
||||
F_GET_DETECTOR_TYPE, /**< return detector type */
|
||||
F_SET_EXTERNAL_SIGNAL_FLAG, /**< set/get flag for external signal */
|
||||
F_SET_TIMING_MODE, /**< set/get external communication mode (obsolete) */
|
||||
F_GET_ID, /**< get detector id of version */
|
||||
F_DIGITAL_TEST, /**< digital test of the detector */
|
||||
F_SET_DAC, /**< set DAC value */
|
||||
F_GET_ADC, /**< get ADC value */
|
||||
F_WRITE_REGISTER, /**< write to register */
|
||||
F_READ_REGISTER, /**< read register */
|
||||
F_SET_MODULE, /**< initialize module */
|
||||
F_GET_MODULE, /**< get module status */
|
||||
F_SET_SETTINGS, /**< set detector settings */
|
||||
F_GET_THRESHOLD_ENERGY, /**< get detector threshold (in eV) */
|
||||
F_START_ACQUISITION, /**< start acquisition */
|
||||
F_STOP_ACQUISITION, /**< stop acquisition */
|
||||
F_START_READOUT, /**< start readout */
|
||||
F_GET_RUN_STATUS, /**< get acquisition status */
|
||||
F_START_AND_READ_ALL, /**< start acquisition and read all frames*/
|
||||
F_READ_ALL, /**< read alla frames */
|
||||
F_SET_TIMER, /**< set/get timer value */
|
||||
F_GET_TIME_LEFT, /**< get current value of the timer (time left) */
|
||||
F_SET_DYNAMIC_RANGE, /**< set/get detector dynamic range */
|
||||
F_SET_ROI, /**< set/get region of interest */
|
||||
F_EXEC_COMMAND=0,
|
||||
F_GET_DETECTOR_TYPE,
|
||||
F_SET_EXTERNAL_SIGNAL_FLAG,
|
||||
F_SET_TIMING_MODE,
|
||||
F_GET_ID,
|
||||
F_DIGITAL_TEST,
|
||||
F_SET_DAC,
|
||||
F_GET_ADC,
|
||||
F_WRITE_REGISTER,
|
||||
F_READ_REGISTER,
|
||||
F_SET_MODULE,
|
||||
F_GET_MODULE,
|
||||
F_SET_SETTINGS,
|
||||
F_GET_THRESHOLD_ENERGY,
|
||||
F_START_ACQUISITION,
|
||||
F_STOP_ACQUISITION,
|
||||
F_START_READOUT,
|
||||
F_GET_RUN_STATUS,
|
||||
F_START_AND_READ_ALL,
|
||||
F_READ_ALL,
|
||||
F_GET_NUM_FRAMES,
|
||||
F_SET_NUM_FRAMES,
|
||||
F_GET_NUM_TRIGGERS,
|
||||
F_SET_NUM_TRIGGERS,
|
||||
F_GET_NUM_ADDITIONAL_STORAGE_CELLS,
|
||||
F_SET_NUM_ADDITIONAL_STORAGE_CELLS,
|
||||
F_GET_NUM_ANALOG_SAMPLES,
|
||||
F_SET_NUM_ANALOG_SAMPLES,
|
||||
F_GET_NUM_DIGITAL_SAMPLES,
|
||||
F_SET_NUM_DIGITAL_SAMPLES,
|
||||
F_GET_EXPTIME,
|
||||
F_SET_EXPTIME,
|
||||
F_GET_PERIOD,
|
||||
F_SET_PERIOD,
|
||||
F_GET_DELAY_AFTER_TRIGGER,
|
||||
F_SET_DELAY_AFTER_TRIGGER,
|
||||
F_GET_SUB_EXPTIME,
|
||||
F_SET_SUB_EXPTIME,
|
||||
F_GET_SUB_DEADTIME,
|
||||
F_SET_SUB_DEADTIME,
|
||||
F_GET_STORAGE_CELL_DELAY,
|
||||
F_SET_STORAGE_CELL_DELAY,
|
||||
F_GET_FRAMES_LEFT,
|
||||
F_GET_TRIGGERS_LEFT,
|
||||
F_GET_EXPTIME_LEFT,
|
||||
F_GET_PERIOD_LEFT,
|
||||
F_GET_DELAY_AFTER_TRIGGER_LEFT,
|
||||
F_GET_MEASURED_PERIOD,
|
||||
F_GET_MEASURED_SUBPERIOD,
|
||||
F_GET_FRAMES_FROM_START,
|
||||
F_GET_ACTUAL_TIME,
|
||||
F_GET_MEASUREMENT_TIME,
|
||||
F_SET_DYNAMIC_RANGE,
|
||||
F_SET_ROI,
|
||||
F_GET_ROI,
|
||||
F_SET_SPEED, /**< set/get readout speed parameters */
|
||||
F_EXIT_SERVER, /**< turn off detector server */
|
||||
F_LOCK_SERVER, /**< Locks/Unlocks server communication to the given client */
|
||||
F_GET_LAST_CLIENT_IP, /**< returns the IP of the client last connected to the detector */
|
||||
F_SET_PORT, /**< Changes communication port of the server */
|
||||
F_UPDATE_CLIENT, /**< Returns all the important parameters to update the shared memory of the client */
|
||||
F_ENABLE_TEN_GIGA, /**< enable 10Gbe */
|
||||
F_SET_ALL_TRIMBITS, /** < set all trimbits to this value */
|
||||
F_SET_PATTERN_IO_CONTROL, /** < set pattern i/o control */
|
||||
F_SET_PATTERN_CLOCK_CONTROL, /** < set pattern clock control */
|
||||
F_SET_PATTERN_WORD, /** < sets pattern word */
|
||||
F_SET_PATTERN_LOOP_ADDRESSES, /** < sets pattern loop */
|
||||
F_SET_SPEED,
|
||||
F_EXIT_SERVER,
|
||||
F_LOCK_SERVER,
|
||||
F_GET_LAST_CLIENT_IP,
|
||||
F_SET_PORT,
|
||||
F_UPDATE_CLIENT,
|
||||
F_ENABLE_TEN_GIGA,
|
||||
F_SET_ALL_TRIMBITS,
|
||||
F_SET_PATTERN_IO_CONTROL,
|
||||
F_SET_PATTERN_CLOCK_CONTROL,
|
||||
F_SET_PATTERN_WORD,
|
||||
F_SET_PATTERN_LOOP_ADDRESSES,
|
||||
F_SET_PATTERN_LOOP_CYCLES,
|
||||
F_SET_PATTERN_WAIT_ADDR, /** < sets pattern wait addr */
|
||||
F_SET_PATTERN_WAIT_TIME, /** < sets pattern wait time */
|
||||
F_SET_PATTERN_MASK, /** < loads a pattern mask */
|
||||
F_GET_PATTERN_MASK, /** < retrieves pattern mask */
|
||||
F_SET_PATTERN_BIT_MASK, /** < loads bitmask for the pattern */
|
||||
F_GET_PATTERN_BIT_MASK, /** < retrieves bitmask for the pattern */
|
||||
F_WRITE_ADC_REG, /** < writes an ADC register */
|
||||
F_SET_COUNTER_BIT, /** < set/reset counter bit in detector for eiger */
|
||||
F_PULSE_PIXEL,/** < pulse pixel n number of times in eiger at (x,y) */
|
||||
F_PULSE_PIXEL_AND_MOVE,/** < pulse pixel n number of times and move relatively by x and y */
|
||||
F_PULSE_CHIP, /** < pulse chip n number of times */
|
||||
F_SET_RATE_CORRECT,/** < set/reset rate correction tau */
|
||||
F_GET_RATE_CORRECT,/** < get rate correction tau */
|
||||
F_SET_NETWORK_PARAMETER,/**< set network parameters such as transmission delay, flow control */
|
||||
F_PROGRAM_FPGA,/**< program FPGA */
|
||||
F_RESET_FPGA, /**< reset FPGA */
|
||||
F_POWER_CHIP, /**< power chip */
|
||||
F_ACTIVATE,/** < activate */
|
||||
F_PREPARE_ACQUISITION,/** < prepare acquisition */
|
||||
F_THRESHOLD_TEMP, /** < set threshold temperature */
|
||||
F_TEMP_CONTROL, /** < set temperature control */
|
||||
F_TEMP_EVENT, /** < set temperature event */
|
||||
F_AUTO_COMP_DISABLE, /** < auto comp disable mode */
|
||||
F_STORAGE_CELL_START, /** < storage cell start */
|
||||
F_CHECK_VERSION,/** < check version compatibility */
|
||||
F_SOFTWARE_TRIGGER,/** < software trigger */
|
||||
F_LED, /** < switch on/off led */
|
||||
F_DIGITAL_IO_DELAY, /** < digital IO delay */
|
||||
F_COPY_DET_SERVER, /** < copy detector server & respawn */
|
||||
F_REBOOT_CONTROLLER, /** < reboot detector controller (blackfin/ powerpc) */
|
||||
F_SET_ADC_ENABLE_MASK, /** < setting ADC enable mask */
|
||||
F_GET_ADC_ENABLE_MASK, /** < setting ADC enable mask */
|
||||
F_SET_ADC_INVERT, /** < set adc invert reg */
|
||||
F_GET_ADC_INVERT, /** < get adc invert reg */
|
||||
F_EXTERNAL_SAMPLING_SOURCE, /** < set/get external sampling source for ctb */
|
||||
F_EXTERNAL_SAMPLING, /**< enable/disable external sampling for ctb */
|
||||
F_SET_PATTERN_WAIT_ADDR,
|
||||
F_SET_PATTERN_WAIT_TIME,
|
||||
F_SET_PATTERN_MASK,
|
||||
F_GET_PATTERN_MASK,
|
||||
F_SET_PATTERN_BIT_MASK,
|
||||
F_GET_PATTERN_BIT_MASK,
|
||||
F_WRITE_ADC_REG,
|
||||
F_SET_COUNTER_BIT,
|
||||
F_PULSE_PIXEL,
|
||||
F_PULSE_PIXEL_AND_MOVE,
|
||||
F_PULSE_CHIP,
|
||||
F_SET_RATE_CORRECT,
|
||||
F_GET_RATE_CORRECT,
|
||||
F_SET_NETWORK_PARAMETER,
|
||||
F_PROGRAM_FPGA,
|
||||
F_RESET_FPGA,
|
||||
F_POWER_CHIP,
|
||||
F_ACTIVATE,
|
||||
F_PREPARE_ACQUISITION,
|
||||
F_THRESHOLD_TEMP,
|
||||
F_TEMP_CONTROL,
|
||||
F_TEMP_EVENT,
|
||||
F_AUTO_COMP_DISABLE,
|
||||
F_STORAGE_CELL_START,
|
||||
F_CHECK_VERSION,
|
||||
F_SOFTWARE_TRIGGER,
|
||||
F_LED,
|
||||
F_DIGITAL_IO_DELAY,
|
||||
F_COPY_DET_SERVER,
|
||||
F_REBOOT_CONTROLLER,
|
||||
F_SET_ADC_ENABLE_MASK,
|
||||
F_GET_ADC_ENABLE_MASK,
|
||||
F_SET_ADC_INVERT,
|
||||
F_GET_ADC_INVERT,
|
||||
F_EXTERNAL_SAMPLING_SOURCE,
|
||||
F_EXTERNAL_SAMPLING,
|
||||
F_SET_STARTING_FRAME_NUMBER,
|
||||
F_GET_STARTING_FRAME_NUMBER,
|
||||
F_SET_QUAD,
|
||||
@ -134,59 +164,65 @@ enum detFuncs{
|
||||
F_GET_CLOCK_DIVIDER,
|
||||
NUM_DET_FUNCTIONS,
|
||||
|
||||
RECEIVER_ENUM_START = 128, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||
F_EXEC_RECEIVER_COMMAND,/**< command is executed */
|
||||
F_EXIT_RECEIVER,/**< turn off receiver server */
|
||||
F_LOCK_RECEIVER,/**< Locks/Unlocks server communication to the given client */
|
||||
F_GET_LAST_RECEIVER_CLIENT_IP,/**< returns the IP of the client last connected to the receiver */
|
||||
F_SET_RECEIVER_PORT, /**< Changes communication port of the receiver */
|
||||
F_UPDATE_RECEIVER_CLIENT, /**< Returns all the important parameters to update the shared memory of the client */
|
||||
F_GET_RECEIVER_ID, /**< get receiver id of version */
|
||||
F_GET_RECEIVER_TYPE, /**< return receiver type */
|
||||
F_SEND_RECEIVER_DETHOSTNAME, /**< set detector hostname to receiver */
|
||||
F_RECEIVER_SET_ROI, /**< Sets receiver ROI */
|
||||
F_SET_RECEIVER_TIMER, /**< set/get timer value */
|
||||
F_SET_RECEIVER_DYNAMIC_RANGE, /**< set/get detector dynamic range */
|
||||
F_RECEIVER_STREAMING_FREQUENCY, /**< sets the frequency of receiver sending frames to gui */
|
||||
F_GET_RECEIVER_STATUS, /**< gets the status of receiver listening mode */
|
||||
F_START_RECEIVER, /**< starts the receiver listening mode */
|
||||
F_STOP_RECEIVER, /**< stops the receiver listening mode */
|
||||
F_SET_RECEIVER_FILE_PATH, /**< sets receiver file directory */
|
||||
F_SET_RECEIVER_FILE_NAME, /**< sets receiver file name */
|
||||
F_SET_RECEIVER_FILE_INDEX, /**< sets receiver file index */
|
||||
F_GET_RECEIVER_FRAME_INDEX, /**< gets the receiver frame index */
|
||||
F_GET_RECEIVER_FRAMES_CAUGHT, /**< gets the number of frames caught by receiver */
|
||||
F_ENABLE_RECEIVER_FILE_WRITE, /**< sets the receiver file write */
|
||||
F_ENABLE_RECEIVER_MASTER_FILE_WRITE, /**< sets the receiver master file write */
|
||||
F_ENABLE_RECEIVER_OVERWRITE, /**< set overwrite flag in receiver */
|
||||
F_ENABLE_RECEIVER_TEN_GIGA, /**< enable 10Gbe in receiver */
|
||||
F_SET_RECEIVER_FIFO_DEPTH, /**< set receiver fifo depth */
|
||||
F_RECEIVER_ACTIVATE, /** < activate/deactivate readout */
|
||||
F_STREAM_DATA_FROM_RECEIVER, /**< stream data from receiver to client */
|
||||
F_RECEIVER_STREAMING_TIMER, /** < sets the timer between each data stream in receiver */
|
||||
F_SET_FLIPPED_DATA_RECEIVER, /** < sets the enable to flip data across x/y axis (bottom/top) */
|
||||
F_SET_RECEIVER_FILE_FORMAT, /** < sets the receiver file format */
|
||||
F_SEND_RECEIVER_DETPOSID, /** < sets the detector position id in the reveiver */
|
||||
F_SEND_RECEIVER_MULTIDETSIZE, /** < sets the multi detector size to the receiver */
|
||||
F_SET_RECEIVER_STREAMING_PORT, /** < sets the receiver streaming port */
|
||||
F_RECEIVER_STREAMING_SRC_IP, /** < sets the receiver streaming source IP */
|
||||
F_SET_RECEIVER_SILENT_MODE, /** < sets the receiver silent mode */
|
||||
F_ENABLE_GAPPIXELS_IN_RECEIVER, /** < sets gap pixels in the receiver */
|
||||
F_RESTREAM_STOP_FROM_RECEIVER, /** < restream stop from receiver */
|
||||
F_ADDITIONAL_JSON_HEADER, /** < additional json header */
|
||||
F_GET_ADDITIONAL_JSON_HEADER,/** < get additional json header */
|
||||
F_RECEIVER_UDP_SOCK_BUF_SIZE, /** < UDP socket buffer size */
|
||||
F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE, /** < real UDP socket buffer size */
|
||||
F_SET_RECEIVER_FRAMES_PER_FILE, /** < receiver frames per file */
|
||||
F_RECEIVER_CHECK_VERSION, /** < check receiver version compatibility */
|
||||
F_RECEIVER_DISCARD_POLICY, /** < frames discard policy */
|
||||
F_RECEIVER_PADDING_ENABLE, /** < partial frames padding enable */
|
||||
F_RECEIVER_DEACTIVATED_PADDING_ENABLE, /** < deactivated receiver padding enable */
|
||||
F_RECEIVER_SET_READOUT_MODE, /**< set/get receiver readout mode */
|
||||
F_RECEIVER_SET_ADC_MASK, /**< set adc mask */
|
||||
F_SET_RECEIVER_DBIT_LIST, /** < set receiver digital bit list */
|
||||
F_GET_RECEIVER_DBIT_LIST, /** < get receiver digital bit list */
|
||||
F_RECEIVER_DBIT_OFFSET, /** < set/get reciever digital bit offset */
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||
F_EXEC_RECEIVER_COMMAND,
|
||||
F_EXIT_RECEIVER,
|
||||
F_LOCK_RECEIVER,
|
||||
F_GET_LAST_RECEIVER_CLIENT_IP,
|
||||
F_SET_RECEIVER_PORT,
|
||||
F_UPDATE_RECEIVER_CLIENT,
|
||||
F_GET_RECEIVER_ID,
|
||||
F_GET_RECEIVER_TYPE,
|
||||
F_SEND_RECEIVER_DETHOSTNAME,
|
||||
F_RECEIVER_SET_ROI,
|
||||
F_RECEIVER_SET_NUM_FRAMES,
|
||||
F_RECEIVER_SET_NUM_ANALOG_SAMPLES,
|
||||
F_RECEIVER_SET_NUM_DIGITAL_SAMPLES,
|
||||
F_RECEIVER_SET_EXPTIME,
|
||||
F_RECEIVER_SET_PERIOD,
|
||||
F_RECEIVER_SET_SUB_EXPTIME,
|
||||
F_RECEIVER_SET_SUB_DEADTIME,
|
||||
F_SET_RECEIVER_DYNAMIC_RANGE,
|
||||
F_RECEIVER_STREAMING_FREQUENCY,
|
||||
F_GET_RECEIVER_STATUS,
|
||||
F_START_RECEIVER,
|
||||
F_STOP_RECEIVER,
|
||||
F_SET_RECEIVER_FILE_PATH,
|
||||
F_SET_RECEIVER_FILE_NAME,
|
||||
F_SET_RECEIVER_FILE_INDEX,
|
||||
F_GET_RECEIVER_FRAME_INDEX,
|
||||
F_GET_RECEIVER_FRAMES_CAUGHT,
|
||||
F_ENABLE_RECEIVER_FILE_WRITE,
|
||||
F_ENABLE_RECEIVER_MASTER_FILE_WRITE,
|
||||
F_ENABLE_RECEIVER_OVERWRITE,
|
||||
F_ENABLE_RECEIVER_TEN_GIGA,
|
||||
F_SET_RECEIVER_FIFO_DEPTH,
|
||||
F_RECEIVER_ACTIVATE,
|
||||
F_STREAM_DATA_FROM_RECEIVER,
|
||||
F_RECEIVER_STREAMING_TIMER,
|
||||
F_SET_FLIPPED_DATA_RECEIVER,
|
||||
F_SET_RECEIVER_FILE_FORMAT,
|
||||
F_SEND_RECEIVER_DETPOSID,
|
||||
F_SEND_RECEIVER_MULTIDETSIZE,
|
||||
F_SET_RECEIVER_STREAMING_PORT,
|
||||
F_RECEIVER_STREAMING_SRC_IP,
|
||||
F_SET_RECEIVER_SILENT_MODE,
|
||||
F_ENABLE_GAPPIXELS_IN_RECEIVER,
|
||||
F_RESTREAM_STOP_FROM_RECEIVER,
|
||||
F_ADDITIONAL_JSON_HEADER,
|
||||
F_GET_ADDITIONAL_JSON_HEADER,
|
||||
F_RECEIVER_UDP_SOCK_BUF_SIZE,
|
||||
F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE,
|
||||
F_SET_RECEIVER_FRAMES_PER_FILE,
|
||||
F_RECEIVER_CHECK_VERSION,
|
||||
F_RECEIVER_DISCARD_POLICY,
|
||||
F_RECEIVER_PADDING_ENABLE,
|
||||
F_RECEIVER_DEACTIVATED_PADDING_ENABLE,
|
||||
F_RECEIVER_SET_READOUT_MODE,
|
||||
F_RECEIVER_SET_ADC_MASK,
|
||||
F_SET_RECEIVER_DBIT_LIST,
|
||||
F_GET_RECEIVER_DBIT_LIST,
|
||||
F_RECEIVER_DBIT_OFFSET,
|
||||
F_SET_RECEIVER_QUAD,
|
||||
F_SET_RECEIVER_READ_N_LINES,
|
||||
F_SET_RECEIVER_UDP_IP,
|
||||
@ -220,8 +256,38 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_RUN_STATUS: return "F_GET_RUN_STATUS";
|
||||
case F_START_AND_READ_ALL: return "F_START_AND_READ_ALL";
|
||||
case F_READ_ALL: return "F_READ_ALL";
|
||||
case F_SET_TIMER: return "F_SET_TIMER";
|
||||
case F_GET_TIME_LEFT: return "F_GET_TIME_LEFT";
|
||||
case F_GET_NUM_FRAMES: return "F_GET_NUM_FRAMES";
|
||||
case F_SET_NUM_FRAMES: return "F_SET_NUM_FRAMES";
|
||||
case F_GET_NUM_TRIGGERS: return "F_GET_NUM_TRIGGERS";
|
||||
case F_SET_NUM_TRIGGERS: return "F_SET_NUM_TRIGGERS";
|
||||
case F_GET_NUM_ADDITIONAL_STORAGE_CELLS:return "F_GET_NUM_ADDITIONAL_STORAGE_CELLS";
|
||||
case F_SET_NUM_ADDITIONAL_STORAGE_CELLS:return "F_SET_NUM_ADDITIONAL_STORAGE_CELLS";
|
||||
case F_GET_NUM_ANALOG_SAMPLES: return "F_GET_NUM_ANALOG_SAMPLES";
|
||||
case F_SET_NUM_ANALOG_SAMPLES: return "F_SET_NUM_ANALOG_SAMPLES";
|
||||
case F_GET_NUM_DIGITAL_SAMPLES: return "F_GET_NUM_DIGITAL_SAMPLES";
|
||||
case F_SET_NUM_DIGITAL_SAMPLES: return "F_SET_NUM_DIGITAL_SAMPLES";
|
||||
case F_GET_EXPTIME: return "F_GET_EXPTIME";
|
||||
case F_SET_EXPTIME: return "F_SET_EXPTIME";
|
||||
case F_GET_PERIOD: return "F_GET_PERIOD";
|
||||
case F_SET_PERIOD: return "F_SET_PERIOD";
|
||||
case F_GET_DELAY_AFTER_TRIGGER: return "F_GET_DELAY_AFTER_TRIGGER";
|
||||
case F_SET_DELAY_AFTER_TRIGGER: return "F_SET_DELAY_AFTER_TRIGGER";
|
||||
case F_GET_SUB_EXPTIME: return "F_GET_SUB_EXPTIME";
|
||||
case F_SET_SUB_EXPTIME: return "F_SET_SUB_EXPTIME";
|
||||
case F_GET_SUB_DEADTIME: return "F_GET_SUB_DEADTIME";
|
||||
case F_SET_SUB_DEADTIME: return "F_SET_SUB_DEADTIME";
|
||||
case F_GET_STORAGE_CELL_DELAY: return "F_GET_STORAGE_CELL_DELAY";
|
||||
case F_SET_STORAGE_CELL_DELAY: return "F_SET_STORAGE_CELL_DELAY";
|
||||
case F_GET_FRAMES_LEFT: return "F_GET_FRAMES_LEFT";
|
||||
case F_GET_TRIGGERS_LEFT: return "F_GET_TRIGGERS_LEFT";
|
||||
case F_GET_EXPTIME_LEFT: return "F_GET_EXPTIME_LEFT";
|
||||
case F_GET_PERIOD_LEFT: return "F_GET_PERIOD_LEFT";
|
||||
case F_GET_DELAY_AFTER_TRIGGER_LEFT: return "F_GET_DELAY_AFTER_TRIGGER_LEFT";
|
||||
case F_GET_MEASURED_PERIOD: return "F_GET_MEASURED_PERIOD";
|
||||
case F_GET_MEASURED_SUBPERIOD: return "F_GET_MEASURED_SUBPERIOD";
|
||||
case F_GET_FRAMES_FROM_START: return "F_GET_FRAMES_FROM_START";
|
||||
case F_GET_ACTUAL_TIME: return "F_GET_ACTUAL_TIME";
|
||||
case F_GET_MEASUREMENT_TIME: return "F_GET_MEASUREMENT_TIME";
|
||||
case F_SET_DYNAMIC_RANGE: return "F_SET_DYNAMIC_RANGE";
|
||||
case F_SET_ROI: return "F_SET_ROI";
|
||||
case F_GET_ROI: return "F_GET_ROI";
|
||||
@ -336,7 +402,13 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_RECEIVER_TYPE: return "F_GET_RECEIVER_TYPE";
|
||||
case F_SEND_RECEIVER_DETHOSTNAME: return "F_SEND_RECEIVER_DETHOSTNAME";
|
||||
case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI";
|
||||
case F_SET_RECEIVER_TIMER: return "F_SET_RECEIVER_TIMER";
|
||||
case F_RECEIVER_SET_NUM_FRAMES: return "F_RECEIVER_SET_NUM_FRAMES";
|
||||
case F_RECEIVER_SET_NUM_ANALOG_SAMPLES: return "F_RECEIVER_SET_NUM_ANALOG_SAMPLES";
|
||||
case F_RECEIVER_SET_NUM_DIGITAL_SAMPLES:return "F_RECEIVER_SET_NUM_DIGITAL_SAMPLES";
|
||||
case F_RECEIVER_SET_EXPTIME: return "F_RECEIVER_SET_EXPTIME";
|
||||
case F_RECEIVER_SET_PERIOD: return "F_RECEIVER_SET_PERIOD";
|
||||
case F_RECEIVER_SET_SUB_EXPTIME: return "F_RECEIVER_SET_SUB_EXPTIME";
|
||||
case F_RECEIVER_SET_SUB_DEADTIME: return "F_RECEIVER_SET_SUB_DEADTIME";
|
||||
case F_SET_RECEIVER_DYNAMIC_RANGE: return "F_SET_RECEIVER_DYNAMIC_RANGE";
|
||||
case F_RECEIVER_STREAMING_FREQUENCY: return "F_RECEIVER_STREAMING_FREQUENCY";
|
||||
case F_GET_RECEIVER_STATUS: return "F_GET_RECEIVER_STATUS";
|
||||
|
@ -4,9 +4,9 @@
|
||||
#define APIRECEIVER 0x190722
|
||||
#define APIGUI 0x190723
|
||||
#define APIMOENCH 0x190820
|
||||
#define APIJUNGFRAU 0x191030
|
||||
#define APIEIGER 0x191030
|
||||
#define APIGOTTHARD 0x191030
|
||||
#define APIGOTTHARD2 0x191030
|
||||
#define APICTB 0x191030
|
||||
#define APIMYTHEN3 0x191031
|
||||
#define APICTB 0x191104
|
||||
#define APIGOTTHARD 0x191104
|
||||
#define APIJUNGFRAU 0x191104
|
||||
#define APIGOTTHARD2 0x191104
|
||||
#define APIMYTHEN3 0x191104
|
||||
#define APIEIGER 0x191104
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "sls_detector_defs.h"
|
||||
using dt = slsDetectorDefs::detectorType;
|
||||
using di = slsDetectorDefs::dacIndex;
|
||||
using ti = slsDetectorDefs::timerIndex;
|
||||
// using ro = slsDetectorDefs::readOutFlags;
|
||||
using sv = slsDetectorDefs::speedVariable;
|
||||
using defs = slsDetectorDefs;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user