mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
merged with g2continuous
This commit is contained in:
commit
f26d8e514b
@ -274,9 +274,12 @@ void init_enums(py::module &m) {
|
|||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
||||||
.value("BURST_OFF", slsDetectorDefs::burstMode::BURST_OFF)
|
|
||||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||||
|
.value("CONTINUOUS_INTERNAL",
|
||||||
|
slsDetectorDefs::burstMode::CONTINUOUS_INTERNAL)
|
||||||
|
.value("CONTINUOUS_EXTERNAL",
|
||||||
|
slsDetectorDefs::burstMode::CONTINUOUS_EXTERNAL)
|
||||||
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
|
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
|
@ -1664,11 +1664,6 @@ Frame period between exposures.
|
|||||||
<string>Timing Mode of the detector.
|
<string>Timing Mode of the detector.
|
||||||
#timing#</string>
|
#timing#</string>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Off</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Burst Internal</string>
|
<string>Burst Internal</string>
|
||||||
@ -1676,7 +1671,17 @@ Frame period between exposures.
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Burst external</string>
|
<string>Burst External</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Continuous Internal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Continuous External</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -152,7 +152,11 @@ void qTabMeasurement::Initialization() {
|
|||||||
void qTabMeasurement::ShowTriggerDelay() {
|
void qTabMeasurement::ShowTriggerDelay() {
|
||||||
bool showTrigger = true;
|
bool showTrigger = true;
|
||||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||||
if ((comboBurstMode->currentIndex() != slsDetectorDefs::BURST_OFF) &&
|
// burst and auto
|
||||||
|
if ((comboBurstMode->currentIndex() ==
|
||||||
|
slsDetectorDefs::BURST_INTERNAL ||
|
||||||
|
comboBurstMode->currentIndex() ==
|
||||||
|
slsDetectorDefs::BURST_EXTERNAL) &&
|
||||||
(comboTimingMode->currentIndex() == AUTO)) {
|
(comboTimingMode->currentIndex() == AUTO)) {
|
||||||
// show burst, burstperiod, not trigger or delay
|
// show burst, burstperiod, not trigger or delay
|
||||||
showTrigger = false;
|
showTrigger = false;
|
||||||
@ -368,9 +372,10 @@ void qTabMeasurement::GetBurstMode() {
|
|||||||
auto retval = det->getBurstMode().tsquash(
|
auto retval = det->getBurstMode().tsquash(
|
||||||
"Inconsistent burst mode for all detectors.");
|
"Inconsistent burst mode for all detectors.");
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
case slsDetectorDefs::BURST_OFF:
|
|
||||||
case slsDetectorDefs::BURST_INTERNAL:
|
case slsDetectorDefs::BURST_INTERNAL:
|
||||||
case slsDetectorDefs::BURST_EXTERNAL:
|
case slsDetectorDefs::BURST_EXTERNAL:
|
||||||
|
case slsDetectorDefs::CONTINUOUS_INTERNAL:
|
||||||
|
case slsDetectorDefs::CONTINUOUS_EXTERNAL:
|
||||||
comboBurstMode->setCurrentIndex((int)retval);
|
comboBurstMode->setCurrentIndex((int)retval);
|
||||||
ShowTriggerDelay();
|
ShowTriggerDelay();
|
||||||
break;
|
break;
|
||||||
|
Binary file not shown.
@ -121,9 +121,10 @@
|
|||||||
|
|
||||||
#define ASIC_CONFIG_RUN_MODE_OFST (0)
|
#define ASIC_CONFIG_RUN_MODE_OFST (0)
|
||||||
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
|
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
|
||||||
#define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL ((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
#define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL ((0x0 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
#define ASIC_CONFIG_RUN_MODE_CONT_VAL ((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
#define ASIC_CONFIG_RUN_MODE_INT_CONT_VAL ((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_EXT_CONT_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
#define ASIC_CONFIG_GAIN_OFST (4)
|
#define ASIC_CONFIG_GAIN_OFST (4)
|
||||||
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
|
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
|
||||||
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
Binary file not shown.
@ -809,11 +809,15 @@ int setDynamicRange(int dr) { return DYNAMIC_RANGE; }
|
|||||||
/* parameters - timer */
|
/* parameters - timer */
|
||||||
void setNumFrames(int64_t val) {
|
void setNumFrames(int64_t val) {
|
||||||
if (val > 0) {
|
if (val > 0) {
|
||||||
if (burstMode == BURST_OFF) {
|
// continuous
|
||||||
|
if (burstMode == CONTINUOUS_INTERNAL ||
|
||||||
|
burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Setting number of frames %lld [Continuous mode]\n", val));
|
("Setting number of frames %lld [Continuous mode]\n", val));
|
||||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Setting number of frames %d [Burst mode]\n", (int)val));
|
("Setting number of frames %d [Burst mode]\n", (int)val));
|
||||||
bus_w(ASIC_INT_FRAMES_REG,
|
bus_w(ASIC_INT_FRAMES_REG,
|
||||||
@ -826,9 +830,12 @@ void setNumFrames(int64_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t getNumFrames() {
|
int64_t getNumFrames() {
|
||||||
if (burstMode == BURST_OFF) {
|
// continuous
|
||||||
|
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
return ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
|
return ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
|
||||||
ASIC_INT_FRAMES_OFST);
|
ASIC_INT_FRAMES_OFST);
|
||||||
}
|
}
|
||||||
@ -856,9 +863,13 @@ int64_t getNumTriggers() {
|
|||||||
void setNumBursts(int64_t val) {
|
void setNumBursts(int64_t val) {
|
||||||
if (val > 0) {
|
if (val > 0) {
|
||||||
LOG(logINFO, ("Setting number of bursts %lld\n", val));
|
LOG(logINFO, ("Setting number of bursts %lld\n", val));
|
||||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
// burst and auto
|
||||||
|
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
|
||||||
|
getTiming() == AUTO_TIMING) {
|
||||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst-trigger or continuous
|
||||||
|
else {
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("\tNot (Burst and Auto mode): not writing to register\n"));
|
("\tNot (Burst and Auto mode): not writing to register\n"));
|
||||||
numBurstsReg = val;
|
numBurstsReg = val;
|
||||||
@ -867,9 +878,12 @@ void setNumBursts(int64_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t getNumBursts() {
|
int64_t getNumBursts() {
|
||||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
// burst and auto
|
||||||
|
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
|
||||||
|
getTiming() == AUTO_TIMING) {
|
||||||
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
}
|
}
|
||||||
|
// burst-trigger or continuous
|
||||||
return numBurstsReg;
|
return numBurstsReg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,11 +915,14 @@ int setPeriod(int64_t val) {
|
|||||||
LOG(logERROR, ("Invalid period: %lld ns\n", val));
|
LOG(logERROR, ("Invalid period: %lld ns\n", val));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (burstMode == BURST_OFF) {
|
// continuous
|
||||||
|
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val));
|
LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val));
|
||||||
val *= (1E-9 * systemFrequency);
|
val *= (1E-9 * systemFrequency);
|
||||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val));
|
LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val));
|
||||||
val *= (1E-9 * systemFrequency);
|
val *= (1E-9 * systemFrequency);
|
||||||
set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG);
|
set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG);
|
||||||
@ -920,10 +937,13 @@ int setPeriod(int64_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t getPeriod() {
|
int64_t getPeriod() {
|
||||||
if (burstMode == BURST_OFF) {
|
// continuous
|
||||||
|
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
||||||
(1E-9 * systemFrequency);
|
(1E-9 * systemFrequency);
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG) /
|
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG) /
|
||||||
(1E-9 * systemFrequency);
|
(1E-9 * systemFrequency);
|
||||||
}
|
}
|
||||||
@ -966,9 +986,13 @@ int setBurstPeriod(int64_t val) {
|
|||||||
}
|
}
|
||||||
LOG(logINFO, ("Setting burst period %lld ns\n", val));
|
LOG(logINFO, ("Setting burst period %lld ns\n", val));
|
||||||
val *= (1E-9 * systemFrequency);
|
val *= (1E-9 * systemFrequency);
|
||||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
// burst and auto
|
||||||
|
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
|
||||||
|
getTiming() == AUTO_TIMING) {
|
||||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst-trigger, continuous
|
||||||
|
else {
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("\tNot (Burst and Auto mode): not writing to register\n"));
|
("\tNot (Burst and Auto mode): not writing to register\n"));
|
||||||
burstPeriodReg = val;
|
burstPeriodReg = val;
|
||||||
@ -984,10 +1008,13 @@ int setBurstPeriod(int64_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t getBurstPeriod() {
|
int64_t getBurstPeriod() {
|
||||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
// burst and auto
|
||||||
|
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
|
||||||
|
getTiming() == AUTO_TIMING) {
|
||||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
||||||
(1E-9 * systemFrequency);
|
(1E-9 * systemFrequency);
|
||||||
}
|
}
|
||||||
|
// burst-trigger, continuous
|
||||||
return burstPeriodReg / (1E-9 * systemFrequency);
|
return burstPeriodReg / (1E-9 * systemFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1211,7 +1238,7 @@ void setTiming(enum timingMode arg) {
|
|||||||
get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||||
}
|
}
|
||||||
// auto and burst
|
// auto and burst
|
||||||
else if (burstMode != BURST_OFF) {
|
else if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
|
||||||
numBurstsReg = get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
numBurstsReg = get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
burstPeriodReg = get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
burstPeriodReg = get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
}
|
}
|
||||||
@ -1238,7 +1265,7 @@ void setTiming(enum timingMode arg) {
|
|||||||
LOG(logINFO, ("\tTriggers reg: %lld, Delay reg: %lldns\n",
|
LOG(logINFO, ("\tTriggers reg: %lld, Delay reg: %lldns\n",
|
||||||
getNumTriggers(), getDelayAfterTrigger()));
|
getNumTriggers(), getDelayAfterTrigger()));
|
||||||
// burst
|
// burst
|
||||||
if (burstMode != BURST_OFF) {
|
if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
|
||||||
LOG(logINFO, ("\tFrame reg: 1, Period reg: 0\n"))
|
LOG(logINFO, ("\tFrame reg: 1, Period reg: 0\n"))
|
||||||
set64BitReg(1, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(1, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
set64BitReg(0, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(0, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
@ -1250,7 +1277,7 @@ void setTiming(enum timingMode arg) {
|
|||||||
set64BitReg(1, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
set64BitReg(1, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||||
set64BitReg(0, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
set64BitReg(0, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||||
// burst
|
// burst
|
||||||
if (burstMode != BURST_OFF) {
|
if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
|
||||||
set64BitReg(numBurstsReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(numBurstsReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
set64BitReg(burstPeriodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(burstPeriodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
LOG(logINFO, ("\tFrames reg (bursts): %lld, Period reg(burst "
|
LOG(logINFO, ("\tFrames reg (bursts): %lld, Period reg(burst "
|
||||||
@ -2053,15 +2080,18 @@ int setBurstModeinFPGA(enum burstMode value) {
|
|||||||
uint32_t addr = ASIC_CONFIG_REG;
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
uint32_t runmode = 0;
|
uint32_t runmode = 0;
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case BURST_OFF:
|
|
||||||
runmode = ASIC_CONFIG_RUN_MODE_CONT_VAL;
|
|
||||||
break;
|
|
||||||
case BURST_INTERNAL:
|
case BURST_INTERNAL:
|
||||||
runmode = ASIC_CONFIG_RUN_MODE_INT_BURST_VAL;
|
runmode = ASIC_CONFIG_RUN_MODE_INT_BURST_VAL;
|
||||||
break;
|
break;
|
||||||
case BURST_EXTERNAL:
|
case BURST_EXTERNAL:
|
||||||
runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL;
|
runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL;
|
||||||
break;
|
break;
|
||||||
|
case CONTINUOUS_INTERNAL:
|
||||||
|
runmode = ASIC_CONFIG_RUN_MODE_INT_CONT_VAL;
|
||||||
|
break;
|
||||||
|
case CONTINUOUS_EXTERNAL:
|
||||||
|
runmode = ASIC_CONFIG_RUN_MODE_EXT_CONT_VAL;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR, ("Unknown burst mode %d\n", value));
|
LOG(logERROR, ("Unknown burst mode %d\n", value));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -2075,16 +2105,20 @@ int setBurstModeinFPGA(enum burstMode value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int setBurstMode(enum burstMode burst) {
|
int setBurstMode(enum burstMode burst) {
|
||||||
LOG(logINFO, ("Setting burst mode to %s\n",
|
LOG(logINFO,
|
||||||
burst == BURST_OFF
|
("Setting burst mode to %s\n",
|
||||||
? "off"
|
(burst == BURST_INTERNAL
|
||||||
: (burst == BURST_INTERNAL ? "internal" : "external")));
|
? "burst_internal"
|
||||||
|
: (burst == BURST_EXTERNAL ? "burst external"
|
||||||
|
: (burst == CONTINUOUS_INTERNAL
|
||||||
|
? "continuous internal"
|
||||||
|
: "continuous external")))));
|
||||||
|
|
||||||
// update
|
// update
|
||||||
int64_t framesReg = 0;
|
int64_t framesReg = 0;
|
||||||
int64_t periodReg = 0;
|
int64_t periodReg = 0;
|
||||||
// burst
|
// burst
|
||||||
if (burstMode != BURST_OFF) {
|
if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
|
||||||
framesReg = ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
|
framesReg = ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
|
||||||
ASIC_INT_FRAMES_OFST);
|
ASIC_INT_FRAMES_OFST);
|
||||||
periodReg =
|
periodReg =
|
||||||
@ -2108,7 +2142,7 @@ int setBurstMode(enum burstMode burst) {
|
|||||||
|
|
||||||
LOG(logINFO, ("\tUpdating registers\n"));
|
LOG(logINFO, ("\tUpdating registers\n"));
|
||||||
// continuous
|
// continuous
|
||||||
if (burstMode == BURST_OFF) {
|
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
set64BitReg(framesReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(framesReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
set64BitReg(periodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(periodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
LOG(logINFO, ("\tFrames reg: %lld, Period reg: %lldns\n",
|
LOG(logINFO, ("\tFrames reg: %lld, Period reg: %lldns\n",
|
||||||
@ -2158,14 +2192,17 @@ int configureASICGlobalSettings() {
|
|||||||
int value = ((filter << ASIC_FILTER_OFST) & ASIC_FILTER_MSK) |
|
int value = ((filter << ASIC_FILTER_OFST) & ASIC_FILTER_MSK) |
|
||||||
((cdsGain << ASIC_CDS_GAIN_OFST) & ASIC_CDS_GAIN_MSK);
|
((cdsGain << ASIC_CDS_GAIN_OFST) & ASIC_CDS_GAIN_MSK);
|
||||||
switch (burstMode) {
|
switch (burstMode) {
|
||||||
case BURST_OFF:
|
|
||||||
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
|
|
||||||
break;
|
|
||||||
case BURST_INTERNAL:
|
case BURST_INTERNAL:
|
||||||
break;
|
break;
|
||||||
case BURST_EXTERNAL:
|
case BURST_EXTERNAL:
|
||||||
value |= ASIC_EXT_TIMING_MSK;
|
value |= ASIC_EXT_TIMING_MSK;
|
||||||
break;
|
break;
|
||||||
|
case CONTINUOUS_INTERNAL:
|
||||||
|
value |= ASIC_CONT_MODE_MSK;
|
||||||
|
break;
|
||||||
|
case CONTINUOUS_EXTERNAL:
|
||||||
|
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, "
|
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, "
|
||||||
"cdsgain:%d)\n",
|
"cdsgain:%d)\n",
|
||||||
@ -2214,15 +2251,18 @@ enum burstMode getBurstMode() {
|
|||||||
uint32_t addr = ASIC_CONFIG_REG;
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
int runmode = bus_r(addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
int runmode = bus_r(addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
||||||
switch (runmode) {
|
switch (runmode) {
|
||||||
case ASIC_CONFIG_RUN_MODE_CONT_VAL:
|
|
||||||
burstMode = BURST_OFF;
|
|
||||||
break;
|
|
||||||
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
||||||
burstMode = BURST_INTERNAL;
|
burstMode = BURST_INTERNAL;
|
||||||
break;
|
break;
|
||||||
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
||||||
burstMode = BURST_EXTERNAL;
|
burstMode = BURST_EXTERNAL;
|
||||||
break;
|
break;
|
||||||
|
case ASIC_CONFIG_RUN_MODE_INT_CONT_VAL:
|
||||||
|
burstMode = CONTINUOUS_INTERNAL;
|
||||||
|
break;
|
||||||
|
case ASIC_CONFIG_RUN_MODE_EXT_CONT_VAL:
|
||||||
|
burstMode = CONTINUOUS_EXTERNAL;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode));
|
LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode));
|
||||||
return -1;
|
return -1;
|
||||||
@ -2431,9 +2471,13 @@ void *start_timer(void *arg) {
|
|||||||
|
|
||||||
int numRepeats = getNumTriggers();
|
int numRepeats = getNumTriggers();
|
||||||
if (getTiming() == AUTO_TIMING) {
|
if (getTiming() == AUTO_TIMING) {
|
||||||
if (burstMode == BURST_OFF) {
|
// continuous
|
||||||
|
if (burstMode == CONTINUOUS_INTERNAL ||
|
||||||
|
burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
numRepeats = 1;
|
numRepeats = 1;
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
numRepeats = getNumBursts();
|
numRepeats = getNumBursts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2511,8 +2555,8 @@ void *start_timer(void *arg) {
|
|||||||
sendUDPPacket(1, packetData2, vetopacketsize);
|
sendUDPPacket(1, packetData2, vetopacketsize);
|
||||||
}
|
}
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Sent frame: %d (bursts: %d) [%lld]\n", frameNr, repeatNr,
|
("Sent frame: %d (bursts/ triggers: %d) [%lld]\n", frameNr,
|
||||||
(long long unsigned int)virtual_currentFrameNumber));
|
repeatNr, (long long unsigned int)virtual_currentFrameNumber));
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||||
(end.tv_nsec - begin.tv_nsec));
|
(end.tv_nsec - begin.tv_nsec));
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1940,7 +1940,9 @@ int set_num_frames(int file_des) {
|
|||||||
} else {
|
} else {
|
||||||
#ifdef GOTTHARD2D
|
#ifdef GOTTHARD2D
|
||||||
// validate #frames in burst mode
|
// validate #frames in burst mode
|
||||||
if (getBurstMode() != BURST_OFF && arg > MAX_FRAMES_IN_BURST_MODE) {
|
enum burstMode mode = getBurstMode();
|
||||||
|
if ((mode == BURST_INTERNAL || mode == BURST_EXTERNAL) &&
|
||||||
|
arg > MAX_FRAMES_IN_BURST_MODE) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not set number of frames %lld. Must be <= %d in "
|
"Could not set number of frames %lld. Must be <= %d in "
|
||||||
@ -6494,7 +6496,7 @@ int set_veto_reference(int file_des) {
|
|||||||
int set_burst_mode(int file_des) {
|
int set_burst_mode(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
enum burstMode arg = BURST_OFF;
|
enum burstMode arg = BURST_INTERNAL;
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
@ -6506,9 +6508,10 @@ int set_burst_mode(int file_des) {
|
|||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case BURST_OFF:
|
|
||||||
case BURST_INTERNAL:
|
case BURST_INTERNAL:
|
||||||
case BURST_EXTERNAL:
|
case BURST_EXTERNAL:
|
||||||
|
case CONTINUOUS_INTERNAL:
|
||||||
|
case CONTINUOUS_EXTERNAL:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
modeNotImplemented("Burst mode", (int)arg);
|
modeNotImplemented("Burst mode", (int)arg);
|
||||||
@ -6533,7 +6536,7 @@ int set_burst_mode(int file_des) {
|
|||||||
int get_burst_mode(int file_des) {
|
int get_burst_mode(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
enum burstMode retval = BURST_OFF;
|
enum burstMode retval = BURST_INTERNAL;
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting burst mode\n"));
|
LOG(logDEBUG1, ("Getting burst mode\n"));
|
||||||
|
|
||||||
|
@ -1087,7 +1087,8 @@ class Detector {
|
|||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
Result<defs::burstMode> getBurstMode(Positions pos = {});
|
Result<defs::burstMode> getBurstMode(Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
|
/** [Gotthard2] BURST_INTERNAL (default), BURST_EXTERNAL,
|
||||||
|
* CONTINUOUS_INTERNAL, CONTINUOUS_EXTERNAL */
|
||||||
void setBurstMode(defs::burstMode value, Positions pos = {});
|
void setBurstMode(defs::burstMode value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
|
@ -1687,8 +1687,8 @@ std::string CmdProxy::BurstMode(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[off or 0, internal or 1, external or 2]\n\t[Gotthard2] Default "
|
os << "[burst_internal or 0, burst_external or 1, cw_internal or 2, "
|
||||||
"is burst internal type"
|
"cw_external or 3]\n\t[Gotthard2] Default is burst_internal type"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
@ -1706,14 +1706,17 @@ std::string CmdProxy::BurstMode(int action) {
|
|||||||
int ival = StringTo<int>(args[0]);
|
int ival = StringTo<int>(args[0]);
|
||||||
switch (ival) {
|
switch (ival) {
|
||||||
case 0:
|
case 0:
|
||||||
t = defs::BURST_OFF;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
t = defs::BURST_INTERNAL;
|
t = defs::BURST_INTERNAL;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 1:
|
||||||
t = defs::BURST_EXTERNAL;
|
t = defs::BURST_EXTERNAL;
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
t = defs::CONTINUOUS_INTERNAL;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
t = defs::CONTINUOUS_EXTERNAL;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError("Unknown burst mode " + args[0]);
|
throw sls::RuntimeError("Unknown burst mode " + args[0]);
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ TEST_CASE("bursts", "[.cmd][.new]") {
|
|||||||
}
|
}
|
||||||
// continuous mode: reg set to #frames,
|
// continuous mode: reg set to #frames,
|
||||||
// but bursts should return same value
|
// but bursts should return same value
|
||||||
det.setBurstMode(defs::BURST_OFF);
|
det.setBurstMode(defs::CONTINUOUS_INTERNAL);
|
||||||
det.setNumberOfFrames(2);
|
det.setNumberOfFrames(2);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@ -370,18 +370,18 @@ TEST_CASE("burstmode", "[.cmd][.new]") {
|
|||||||
auto burststr = sls::ToString(burst);
|
auto burststr = sls::ToString(burst);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("burstmode", {"internal"}, -1, PUT, oss);
|
proxy.Call("burstmode", {"burst_internal"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "burstmode internal\n");
|
REQUIRE(oss.str() == "burstmode burst_internal\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("burstmode", {"off"}, -1, PUT, oss);
|
proxy.Call("burstmode", {"cw_internal"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "burstmode off\n");
|
REQUIRE(oss.str() == "burstmode cw_internal\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("burstmode", {}, -1, GET, oss);
|
proxy.Call("burstmode", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "burstmode off\n");
|
REQUIRE(oss.str() == "burstmode cw_internal\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setBurstMode(burst[i], {i});
|
det.setBurstMode(burst[i], {i});
|
||||||
|
@ -1125,9 +1125,9 @@ void Implementation::updateTotalNumberOfFrames() {
|
|||||||
int64_t repeats = numberOfTriggers;
|
int64_t repeats = numberOfTriggers;
|
||||||
// gotthard2: auto mode
|
// gotthard2: auto mode
|
||||||
// burst mode: (bursts instead of triggers)
|
// burst mode: (bursts instead of triggers)
|
||||||
// non burst mode: no bursts or triggers
|
// continuous mode: no bursts or triggers
|
||||||
if (myDetectorType == GOTTHARD2 && timingMode == AUTO_TIMING) {
|
if (myDetectorType == GOTTHARD2 && timingMode == AUTO_TIMING) {
|
||||||
if (burstMode != BURST_OFF) {
|
if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
|
||||||
repeats = numberOfBursts;
|
repeats = numberOfBursts;
|
||||||
} else {
|
} else {
|
||||||
repeats = 1;
|
repeats = 1;
|
||||||
|
@ -391,9 +391,10 @@ typedef struct {
|
|||||||
* burst mode for gotthard2
|
* burst mode for gotthard2
|
||||||
*/
|
*/
|
||||||
enum burstMode {
|
enum burstMode {
|
||||||
BURST_OFF,
|
|
||||||
BURST_INTERNAL,
|
BURST_INTERNAL,
|
||||||
BURST_EXTERNAL,
|
BURST_EXTERNAL,
|
||||||
|
CONTINUOUS_INTERNAL,
|
||||||
|
CONTINUOUS_EXTERNAL,
|
||||||
NUM_BURST_MODES
|
NUM_BURST_MODES
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -471,7 +472,7 @@ typedef struct {
|
|||||||
uint32_t adc10gMask{0};
|
uint32_t adc10gMask{0};
|
||||||
ROI roi;
|
ROI roi;
|
||||||
uint32_t countermask{0};
|
uint32_t countermask{0};
|
||||||
burstMode burstType{BURST_OFF};
|
burstMode burstType{BURST_INTERNAL};
|
||||||
int64_t expTime1Ns{0};
|
int64_t expTime1Ns{0};
|
||||||
int64_t expTime2Ns{0};
|
int64_t expTime2Ns{0};
|
||||||
int64_t expTime3Ns{0};
|
int64_t expTime3Ns{0};
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
#define APILIB 0x200810
|
#define APILIB 0x200810
|
||||||
#define APIRECEIVER 0x200810
|
#define APIRECEIVER 0x200810
|
||||||
#define APIGUI 0x200804
|
#define APIGUI 0x200804
|
||||||
#define APICTB 0x200828
|
|
||||||
#define APIGOTTHARD 0x200828
|
|
||||||
#define APIGOTTHARD2 0x200908
|
|
||||||
#define APIJUNGFRAU 0x200828
|
|
||||||
#define APIMYTHEN3 0x200908
|
|
||||||
#define APIMOENCH 0x200828
|
|
||||||
#define APIEIGER 0x200908
|
#define APIEIGER 0x200908
|
||||||
|
#define APICTB 0x200908
|
||||||
|
#define APIGOTTHARD 0x200908
|
||||||
|
#define APIGOTTHARD2 0x200908
|
||||||
|
#define APIJUNGFRAU 0x200908
|
||||||
|
#define APIMYTHEN3 0x200908
|
||||||
|
#define APIMOENCH 0x200908
|
||||||
|
@ -559,12 +559,14 @@ std::string ToString(const std::vector<defs::dacIndex> &vec) {
|
|||||||
|
|
||||||
std::string ToString(const defs::burstMode s) {
|
std::string ToString(const defs::burstMode s) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case defs::BURST_OFF:
|
|
||||||
return std::string("off");
|
|
||||||
case defs::BURST_INTERNAL:
|
case defs::BURST_INTERNAL:
|
||||||
return std::string("internal");
|
return std::string("burst_internal");
|
||||||
case defs::BURST_EXTERNAL:
|
case defs::BURST_EXTERNAL:
|
||||||
return std::string("external");
|
return std::string("burst_external");
|
||||||
|
case defs::CONTINUOUS_INTERNAL:
|
||||||
|
return std::string("cw_internal");
|
||||||
|
case defs::CONTINUOUS_EXTERNAL:
|
||||||
|
return std::string("cw_external");
|
||||||
default:
|
default:
|
||||||
return std::string("Unknown");
|
return std::string("Unknown");
|
||||||
}
|
}
|
||||||
@ -922,12 +924,14 @@ template <> defs::dacIndex StringTo(const std::string &s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <> defs::burstMode StringTo(const std::string &s) {
|
template <> defs::burstMode StringTo(const std::string &s) {
|
||||||
if (s == "off")
|
if (s == "burst_internal")
|
||||||
return defs::BURST_OFF;
|
|
||||||
if (s == "internal")
|
|
||||||
return defs::BURST_INTERNAL;
|
return defs::BURST_INTERNAL;
|
||||||
if (s == "external")
|
if (s == "burst_external")
|
||||||
return defs::BURST_EXTERNAL;
|
return defs::BURST_EXTERNAL;
|
||||||
|
if (s == "cw_internal")
|
||||||
|
return defs::CONTINUOUS_INTERNAL;
|
||||||
|
if (s == "cw_external")
|
||||||
|
return defs::CONTINUOUS_EXTERNAL;
|
||||||
throw sls::RuntimeError("Unknown burst mode " + s);
|
throw sls::RuntimeError("Unknown burst mode " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user