mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-09 11:30:43 +02:00
gotthard2: bursttype to burstmode
This commit is contained in:
parent
f881133795
commit
a9e375ed34
Binary file not shown.
@ -46,8 +46,7 @@ int injectedChannelsOffset = 0;
|
|||||||
int injectedChannelsIncrement = 0;
|
int injectedChannelsIncrement = 0;
|
||||||
int vetoReference[NCHIP][NCHAN];
|
int vetoReference[NCHIP][NCHAN];
|
||||||
uint8_t adcConfiguration[NCHIP][NADC];
|
uint8_t adcConfiguration[NCHIP][NADC];
|
||||||
int burstMode = 0;
|
int burstMode = BURST_INTERNAL;
|
||||||
enum burstModeType burstType = INTERNAL;
|
|
||||||
int64_t exptime_ns = 0;
|
int64_t exptime_ns = 0;
|
||||||
int64_t period_ns = 0;
|
int64_t period_ns = 0;
|
||||||
int64_t nframes = 0;
|
int64_t nframes = 0;
|
||||||
@ -349,8 +348,7 @@ void setupDetector() {
|
|||||||
highvoltage = 0;
|
highvoltage = 0;
|
||||||
injectedChannelsOffset = 0;
|
injectedChannelsOffset = 0;
|
||||||
injectedChannelsIncrement = 0;
|
injectedChannelsIncrement = 0;
|
||||||
burstMode = 0;
|
burstMode = BURST_INTERNAL;
|
||||||
burstType = INTERNAL;
|
|
||||||
exptime_ns = 0;
|
exptime_ns = 0;
|
||||||
period_ns = 0;
|
period_ns = 0;
|
||||||
nframes = 0;
|
nframes = 0;
|
||||||
@ -431,8 +429,6 @@ void setupDetector() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// set burst mode will take in burstType and also set it
|
|
||||||
burstType = DEFAULT_BURST_TYPE;
|
|
||||||
setBurstMode(DEFAULT_BURST_MODE);
|
setBurstMode(DEFAULT_BURST_MODE);
|
||||||
setSettings(DEFAULT_SETTINGS);
|
setSettings(DEFAULT_SETTINGS);
|
||||||
|
|
||||||
@ -1667,10 +1663,10 @@ int configureSingleADCDriver(int chipIndex) {
|
|||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; i < NADC; ++i) {
|
for (i = 0; i < NADC; ++i) {
|
||||||
if (!burstMode) {
|
if (burstMode == BURST_OFF) {
|
||||||
values[i] |= ASIC_CONTINUOUS_MODE_MSK;
|
values[i] |= ASIC_CONTINUOUS_MODE_MSK;
|
||||||
}
|
}
|
||||||
FILE_LOG(logDEBUG1, ("Value %d: 0x%02hhx\n", i, values[i]));
|
FILE_LOG(logDEBUG2, ("Value %d: 0x%02hhx\n", i, values[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1746,14 +1742,39 @@ int configureADC() {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setBurstModeinFPGA(enum burstMode value) {
|
||||||
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
|
uint32_t runmode = 0;
|
||||||
|
switch (value) {
|
||||||
|
case BURST_OFF:
|
||||||
|
runmode = ASIC_CONFIG_RUN_MODE_CONT_VAL;
|
||||||
|
break;
|
||||||
|
case BURST_INTERNAL:
|
||||||
|
runmode = ASIC_CONFIG_RUN_MODE_INT_BURST_VAL;
|
||||||
|
break;
|
||||||
|
case BURST_EXTERNAL:
|
||||||
|
runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FILE_LOG(logERROR, ("Unknown burst mode %d\n", value));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
FILE_LOG(logDEBUG1, ("Run mode (FPGA val): %d\n", runmode));
|
||||||
|
bus_w(addr, bus_r(addr) &~ ASIC_CONFIG_RUN_MODE_MSK);
|
||||||
|
bus_w(addr, bus_r(addr) | ((runmode << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK));
|
||||||
|
burstMode = value;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int setBurstMode(int burst) {
|
int setBurstMode(enum burstMode burst) {
|
||||||
FILE_LOG(logINFO, ("Setting %s Mode\n", burst == 1 ? "Burst" : "Continuous"));
|
FILE_LOG(logINFO, ("Setting burst mode to %s\n", burst == BURST_OFF ? "off" : (burst == BURST_INTERNAL ? "internal" : "external")));
|
||||||
burstMode = burst;
|
|
||||||
setBurstType(burstType);
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting %s Mode in Chip\n", burst == 1 ? "Burst" : "Continuous"));
|
if (setBurstModeinFPGA(burst) == FAIL) {
|
||||||
int value = burst ? ASIC_GLOBAL_BURST_VALUE : ASIC_GLOBAL_CONT_VALUE;
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE_LOG(logINFO, ("\tSetting %s Mode in Chip\n", burstMode == BURST_OFF ? "Continuous" : "Burst"));
|
||||||
|
int value = burstMode ? ASIC_GLOBAL_BURST_VALUE : ASIC_GLOBAL_CONT_VALUE;
|
||||||
|
|
||||||
const int padding = 6; // due to address (4) to make it byte aligned
|
const int padding = 6; // due to address (4) to make it byte aligned
|
||||||
const int lenTotalBits = padding + ASIC_GLOBAL_SETT_MAX_BITS + ASIC_ADDR_MAX_BITS; // 4 + 6 + 4 = 16
|
const int lenTotalBits = padding + ASIC_GLOBAL_SETT_MAX_BITS + ASIC_ADDR_MAX_BITS; // 4 + 6 + 4 = 16
|
||||||
@ -1794,58 +1815,28 @@ int setBurstMode(int burst) {
|
|||||||
return configureADC();
|
return configureADC();
|
||||||
}
|
}
|
||||||
|
|
||||||
int getBurstMode() {
|
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:
|
||||||
|
return BURST_OFF;
|
||||||
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
||||||
|
return BURST_INTERNAL;
|
||||||
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
||||||
return 1;
|
return BURST_EXTERNAL;
|
||||||
default:
|
default:
|
||||||
return 0;
|
FILE_LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setBurstType(enum burstModeType val) {
|
|
||||||
uint32_t addr = ASIC_CONFIG_REG;
|
|
||||||
uint32_t runmode = ASIC_CONFIG_RUN_MODE_CONT_VAL;
|
|
||||||
if (burstMode) {
|
|
||||||
switch (val) {
|
|
||||||
case INTERNAL:
|
|
||||||
runmode = ASIC_CONFIG_RUN_MODE_INT_BURST_VAL;
|
|
||||||
break;
|
|
||||||
case EXTERNAL:
|
|
||||||
runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
FILE_LOG(logERROR, ("Unknown burst type %d\n", val));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
FILE_LOG(logDEBUG1, ("Run mode: %d\n", runmode));
|
|
||||||
bus_w(addr, bus_r(addr) &~ ASIC_CONFIG_RUN_MODE_MSK);
|
|
||||||
bus_w(addr, bus_r(addr) | ((runmode << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum burstModeType getBurstType() {
|
|
||||||
uint32_t addr = ASIC_CONFIG_REG;
|
|
||||||
int runmode = bus_r (addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
|
||||||
switch (runmode) {
|
|
||||||
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
|
||||||
return INTERNAL;
|
|
||||||
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
|
||||||
return EXTERNAL;
|
|
||||||
default:
|
|
||||||
FILE_LOG(logERROR, ("Unknown burst type read from FPGA: %d\n", runmode));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* aquisition */
|
/* aquisition */
|
||||||
|
|
||||||
int updateAcquisitionRegisters(char* mess) {
|
int updateAcquisitionRegisters(char* mess) {
|
||||||
// burst mode
|
// burst mode
|
||||||
if (burstMode) {
|
if (burstMode != BURST_OFF) {
|
||||||
// validate #frames in burst mode
|
// validate #frames in burst mode
|
||||||
if (nframes > MAX_FRAMES_IN_BURST_MODE) {
|
if (nframes > MAX_FRAMES_IN_BURST_MODE) {
|
||||||
sprintf(mess, "Could not start acquisition because number of frames %lld must be <= %d in burst mode.\n", (long long unsigned int)nframes, MAX_FRAMES_IN_BURST_MODE);
|
sprintf(mess, "Could not start acquisition because number of frames %lld must be <= %d in burst mode.\n", (long long unsigned int)nframes, MAX_FRAMES_IN_BURST_MODE);
|
||||||
|
@ -29,8 +29,7 @@
|
|||||||
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||||
|
|
||||||
/** Default Parameters */
|
/** Default Parameters */
|
||||||
#define DEFAULT_BURST_MODE (1)
|
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
|
||||||
#define DEFAULT_BURST_TYPE (INTERNAL)
|
|
||||||
#define DEFAULT_NUM_FRAMES (1)
|
#define DEFAULT_NUM_FRAMES (1)
|
||||||
#define DEFAULT_NUM_CYCLES (1)
|
#define DEFAULT_NUM_CYCLES (1)
|
||||||
#define DEFAULT_EXPTIME (1 * 1000 * 1000) // 1 ms
|
#define DEFAULT_EXPTIME (1 * 1000 * 1000) // 1 ms
|
||||||
|
@ -474,10 +474,9 @@ int setVetoPhoton(int chipIndex, int gainIndex, int* values);
|
|||||||
int getVetoPhoton(int chipIndex, int* retvals);
|
int getVetoPhoton(int chipIndex, int* retvals);
|
||||||
int configureSingleADCDriver(int chipIndex);
|
int configureSingleADCDriver(int chipIndex);
|
||||||
int configureADC();
|
int configureADC();
|
||||||
int setBurstMode(int burst);
|
int setBurstModeinFPGA(enum burstMode value);
|
||||||
int getBurstMode();
|
int setBurstMode(enum burstMode burst);
|
||||||
void setBurstType(enum burstModeType val);
|
enum burstMode getBurstMode();
|
||||||
enum burstModeType getBurstType();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,5 +206,3 @@ int set_adc_enable_mask_10g(int);
|
|||||||
int get_adc_enable_mask_10g(int);
|
int get_adc_enable_mask_10g(int);
|
||||||
int set_counter_mask(int);
|
int set_counter_mask(int);
|
||||||
int get_counter_mask(int);
|
int get_counter_mask(int);
|
||||||
int set_burst_type(int);
|
|
||||||
int get_burst_type(int);
|
|
||||||
|
@ -308,8 +308,6 @@ const char* getFunctionName(enum detFuncs func) {
|
|||||||
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
||||||
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
||||||
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
||||||
case F_SET_BURST_TYPE: return "F_SET_BURST_TYPE";
|
|
||||||
case F_GET_BURST_TYPE: return "F_GET_BURST_TYPE";
|
|
||||||
|
|
||||||
default: return "Unknown Function";
|
default: return "Unknown Function";
|
||||||
}
|
}
|
||||||
@ -494,8 +492,6 @@ void function_table() {
|
|||||||
flist[F_GET_ADC_ENABLE_MASK_10G] = &get_adc_enable_mask_10g;
|
flist[F_GET_ADC_ENABLE_MASK_10G] = &get_adc_enable_mask_10g;
|
||||||
flist[F_SET_COUNTER_MASK] = &set_counter_mask;
|
flist[F_SET_COUNTER_MASK] = &set_counter_mask;
|
||||||
flist[F_GET_COUNTER_MASK] = &get_counter_mask;
|
flist[F_GET_COUNTER_MASK] = &get_counter_mask;
|
||||||
flist[F_SET_BURST_TYPE] = &set_burst_type;
|
|
||||||
flist[F_GET_BURST_TYPE] = &get_burst_type;
|
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||||
@ -6499,22 +6495,35 @@ 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));
|
||||||
int arg = -1;
|
enum burstMode arg = BURST_OFF;
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logINFO, ("Setting burst mode: %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Setting burst mode: %d\n", arg));
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
#ifndef GOTTHARD2D
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
arg = arg == 0 ? 0 : 1;
|
switch (arg) {
|
||||||
ret = setBurstMode(arg);
|
case BURST_OFF:
|
||||||
if (ret == FAIL) {
|
case BURST_INTERNAL:
|
||||||
sprintf(mess, "Could not set burst mode to %d\n", arg);
|
case BURST_EXTERNAL:
|
||||||
FILE_LOG(logERROR, (mess));
|
break;
|
||||||
|
default:
|
||||||
|
modeNotImplemented("Burst mode", (int)arg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ret == OK) {
|
||||||
|
setBurstMode(arg);
|
||||||
|
enum burstMode retval = getBurstMode();
|
||||||
|
FILE_LOG(logDEBUG, ("burst mode retval: %d\n", retval));
|
||||||
|
if (retval != arg) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not set burst type. Set %d, got %d\n", arg, retval);
|
||||||
|
FILE_LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -6525,7 +6534,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));
|
||||||
int retval = -1;
|
enum burstMode retval = BURST_OFF;
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1, ("Getting burst mode\n"));
|
FILE_LOG(logDEBUG1, ("Getting burst mode\n"));
|
||||||
|
|
||||||
@ -6534,7 +6543,7 @@ int get_burst_mode(int file_des) {
|
|||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
retval = getBurstMode();
|
retval = getBurstMode();
|
||||||
FILE_LOG(logDEBUG1, ("Get burst mode:%d\n", retval));
|
FILE_LOG(logDEBUG1, ("Get burst mode retval:%d\n", retval));
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
@ -6594,60 +6603,3 @@ int get_counter_mask(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int set_burst_type(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
enum burstModeType arg = 0;
|
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("Setting burst type: %d\n", arg));
|
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// only set
|
|
||||||
if (Server_VerifyLock() == OK) {
|
|
||||||
switch (arg) {
|
|
||||||
case INTERNAL:
|
|
||||||
case EXTERNAL:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
modeNotImplemented("Burst type", (int)arg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (ret == OK) {
|
|
||||||
setBurstType(arg);
|
|
||||||
enum burstModeType retval = getBurstType();
|
|
||||||
FILE_LOG(logDEBUG, ("burst type retval: %d\n", retval));
|
|
||||||
if (retval != arg) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess, "Could not set burst type. Set %s, got %s\n", (arg == 0 ? "internal" : "external"), (retval == 0 ? "internal" : "external"));
|
|
||||||
FILE_LOG(logERROR, (mess));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_burst_type(int file_des) {
|
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
enum burstModeType retval = 0;
|
|
||||||
FILE_LOG(logDEBUG1, ("Getting burst type\n"));
|
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
// get only
|
|
||||||
retval = getBurstType();
|
|
||||||
FILE_LOG(logDEBUG, ("burst type retval: %d\n", retval));
|
|
||||||
#endif
|
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
|
||||||
}
|
|
@ -916,16 +916,10 @@ class Detector {
|
|||||||
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
|
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
Result<bool> getBurstMode(Positions pos = {});
|
Result<defs::burstMode> getBurstMode(Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] true = burst mode or false = continuous mode */
|
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
|
||||||
void setBurstMode(bool enable, Positions pos = {});
|
void setBurstMode(defs::burstMode value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
|
||||||
Result<defs::burstModeType> getBurstType(Positions pos = {});
|
|
||||||
|
|
||||||
/** [Gotthard2] Options: INTERNAL, EXTERNAL */
|
|
||||||
void setBurstType(defs::burstModeType val, Positions pos = {});
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
|
@ -1225,6 +1225,51 @@ std::string CmdProxy::VetoReference(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::BurstMode(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[off or 0, internal or 1, external or 2]\n\t[Gotthard2] Default is burst internal type"
|
||||||
|
<< '\n';
|
||||||
|
} else {
|
||||||
|
if (action == defs::GET_ACTION) {
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
auto t = det->getBurstMode({det_id});
|
||||||
|
os << OutString(t) << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (args.size() != 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
defs::burstMode t;
|
||||||
|
try {
|
||||||
|
int ival = std::stoi(args[0]);
|
||||||
|
switch (ival) {
|
||||||
|
case 0:
|
||||||
|
t = defs::BURST_OFF;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
t = defs::BURST_INTERNAL;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
t = defs::BURST_EXTERNAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw sls::RuntimeError("Unknown burst mode " + args[0]);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
t = sls::StringTo<defs::burstMode>(args[0]);
|
||||||
|
}
|
||||||
|
det->setBurstMode(t, {det_id});
|
||||||
|
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
|
|
||||||
std::string CmdProxy::Counters(int action) {
|
std::string CmdProxy::Counters(int action) {
|
||||||
|
@ -787,8 +787,7 @@ class CmdProxy {
|
|||||||
{"inj_ch", &CmdProxy::InjectChannel},
|
{"inj_ch", &CmdProxy::InjectChannel},
|
||||||
{"vetophoton", &CmdProxy::VetoPhoton},
|
{"vetophoton", &CmdProxy::VetoPhoton},
|
||||||
{"vetoref", &CmdProxy::VetoReference},
|
{"vetoref", &CmdProxy::VetoReference},
|
||||||
{"burstmode", &CmdProxy::burstmode},
|
{"burstmode", &CmdProxy::BurstMode},
|
||||||
{"bursttype", &CmdProxy::bursttype},
|
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
{"counters", &CmdProxy::Counters},
|
{"counters", &CmdProxy::Counters},
|
||||||
@ -948,6 +947,7 @@ class CmdProxy {
|
|||||||
std::string InjectChannel(int action);
|
std::string InjectChannel(int action);
|
||||||
std::string VetoPhoton(int action);
|
std::string VetoPhoton(int action);
|
||||||
std::string VetoReference(int action);
|
std::string VetoReference(int action);
|
||||||
|
std::string BurstMode(int action);
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
std::string Counters(int action);
|
std::string Counters(int action);
|
||||||
/* CTB Specific */
|
/* CTB Specific */
|
||||||
@ -1554,12 +1554,6 @@ class CmdProxy {
|
|||||||
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated values when taking an acquisition. Default is 0.");
|
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated values when taking an acquisition. Default is 0.");
|
||||||
|
|
||||||
/* Gotthard2 Specific */
|
/* Gotthard2 Specific */
|
||||||
INTEGER_COMMAND(burstmode, getBurstMode, setBurstMode, std::stoi,
|
|
||||||
"[0, 1]\n\t[Gotthard2] 1 sets to burst mode. 0 sets to continuous mode. Default is burst mode.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND(bursttype, getBurstType, setBurstType, sls::StringTo<slsDetectorDefs::burstModeType>,
|
|
||||||
"[internal, external]\n\t[Gotthard2] Default is internal type.");
|
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
|
|
||||||
/* CTB Specific */
|
/* CTB Specific */
|
||||||
|
@ -1180,20 +1180,12 @@ void Detector::setVetoReference(const int gainIndex, const int value, Positions
|
|||||||
pimpl->Parallel(&slsDetector::setVetoReference, pos, gainIndex, value);
|
pimpl->Parallel(&slsDetector::setVetoReference, pos, gainIndex, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getBurstMode(Positions pos) {
|
Result<defs::burstMode> Detector::getBurstMode(Positions pos) {
|
||||||
return pimpl->Parallel(&slsDetector::getBurstMode, pos);
|
return pimpl->Parallel(&slsDetector::getBurstMode, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setBurstMode(bool enable, Positions pos) {
|
void Detector::setBurstMode(defs::burstMode value, Positions pos) {
|
||||||
pimpl->Parallel(&slsDetector::setBurstMode, pos, enable);
|
pimpl->Parallel(&slsDetector::setBurstMode, pos, value);
|
||||||
}
|
|
||||||
|
|
||||||
Result<defs::burstModeType> Detector::getBurstType(Positions pos) {
|
|
||||||
return pimpl->Parallel(&slsDetector::getBurstType, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setBurstType(defs::burstModeType value, Positions pos) {
|
|
||||||
pimpl->Parallel(&slsDetector::setBurstType, pos, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mythen3 Specific
|
// Mythen3 Specific
|
||||||
|
@ -2476,32 +2476,19 @@ void slsDetector::setVetoReference(const int gainIndex, const int value) {
|
|||||||
sendToDetector(F_SET_VETO_REFERENCE, args, nullptr);
|
sendToDetector(F_SET_VETO_REFERENCE, args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool slsDetector::getBurstMode() {
|
slsDetectorDefs::burstMode slsDetector::getBurstMode() {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
sendToDetector(F_GET_BURST_MODE, nullptr, retval);
|
sendToDetector(F_GET_BURST_MODE, nullptr, retval);
|
||||||
FILE_LOG(logDEBUG1) << "Burst mode:" << retval;
|
FILE_LOG(logDEBUG1) << "Burst mode:" << retval;
|
||||||
return static_cast<bool>(retval);
|
return static_cast<slsDetectorDefs::burstMode>(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void slsDetector::setBurstMode(bool enable) {
|
void slsDetector::setBurstMode(slsDetectorDefs::burstMode value) {
|
||||||
int arg = static_cast<int>(enable);
|
int arg = static_cast<int>(value);
|
||||||
FILE_LOG(logDEBUG1) << "Setting burst mode to " << arg;
|
FILE_LOG(logDEBUG1) << "Setting burst mode to " << arg;
|
||||||
sendToDetector(F_SET_BURST_MODE, arg, nullptr);
|
sendToDetector(F_SET_BURST_MODE, arg, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::burstModeType slsDetector::getBurstType() {
|
|
||||||
int retval = -1;
|
|
||||||
sendToDetector(F_GET_BURST_TYPE, nullptr, retval);
|
|
||||||
FILE_LOG(logDEBUG1) << "Burst mode:" << retval;
|
|
||||||
return static_cast<burstModeType>(retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
void slsDetector::setBurstType (burstModeType val) {
|
|
||||||
int arg = static_cast<int>(val);
|
|
||||||
FILE_LOG(logDEBUG1) << "Setting burst type to " << ToString(val);
|
|
||||||
sendToDetector(F_SET_BURST_TYPE, arg, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsDetector::setCounterBit(int cb) {
|
int slsDetector::setCounterBit(int cb) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
FILE_LOG(logDEBUG1) << "Sending counter bit " << cb;
|
FILE_LOG(logDEBUG1) << "Sending counter bit " << cb;
|
||||||
|
@ -1131,16 +1131,10 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
void setVetoReference(const int gainIndex, const int value);
|
void setVetoReference(const int gainIndex, const int value);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
bool getBurstMode();
|
burstMode getBurstMode();
|
||||||
|
|
||||||
/** [Gotthard2] true = burst mode or false = continuous mode */
|
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
|
||||||
void setBurstMode(bool enable);
|
void setBurstMode(burstMode value);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
|
||||||
burstModeType getBurstType();
|
|
||||||
|
|
||||||
/** [Gotthard2] Options: INTERNAL, EXTERNAL */
|
|
||||||
void setBurstType(burstModeType val);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get counter bit in detector (Gotthard)
|
* Set/get counter bit in detector (Gotthard)
|
||||||
|
@ -204,11 +204,13 @@ inline std::string ToString(const defs::detectorModeType s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string ToString(const defs::burstModeType s) {
|
inline std::string ToString(const defs::burstMode s) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case defs::INTERNAL:
|
case defs::BURST_OFF:
|
||||||
|
return std::string("off");
|
||||||
|
case defs::BURST_INTERNAL:
|
||||||
return std::string("internal");
|
return std::string("internal");
|
||||||
case defs::EXTERNAL:
|
case defs::BURST_EXTERNAL:
|
||||||
return std::string("external");
|
return std::string("external");
|
||||||
default:
|
default:
|
||||||
return std::string("Unknown");
|
return std::string("Unknown");
|
||||||
@ -562,12 +564,14 @@ inline defs::dacIndex StringTo(const std::string& s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline defs::burstModeType StringTo(const std::string& s) {
|
inline defs::burstMode StringTo(const std::string& s) {
|
||||||
|
if (s == "off")
|
||||||
|
return defs::BURST_OFF;
|
||||||
if (s == "internal")
|
if (s == "internal")
|
||||||
return defs::INTERNAL;
|
return defs::BURST_INTERNAL;
|
||||||
if (s == "external")
|
if (s == "external")
|
||||||
return defs::EXTERNAL;
|
return defs::BURST_EXTERNAL;
|
||||||
throw sls::RuntimeError("Unknown burst mode type" + s);
|
throw sls::RuntimeError("Unknown burst mode " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -439,11 +439,12 @@ class slsDetectorDefs {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* burst mode type for gotthard2
|
* burst mode for gotthard2
|
||||||
*/
|
*/
|
||||||
enum burstModeType {
|
enum burstMode {
|
||||||
INTERNAL,
|
BURST_OFF,
|
||||||
EXTERNAL,
|
BURST_INTERNAL,
|
||||||
|
BURST_EXTERNAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,8 +188,6 @@ enum detFuncs{
|
|||||||
F_GET_ADC_ENABLE_MASK_10G,
|
F_GET_ADC_ENABLE_MASK_10G,
|
||||||
F_SET_COUNTER_MASK,
|
F_SET_COUNTER_MASK,
|
||||||
F_GET_COUNTER_MASK,
|
F_GET_COUNTER_MASK,
|
||||||
F_SET_BURST_TYPE,
|
|
||||||
F_GET_BURST_TYPE,
|
|
||||||
NUM_DET_FUNCTIONS,
|
NUM_DET_FUNCTIONS,
|
||||||
|
|
||||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||||
@ -445,8 +443,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
||||||
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
||||||
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
||||||
case F_SET_BURST_TYPE: return "F_SET_BURST_TYPE";
|
|
||||||
case F_GET_BURST_TYPE: return "F_GET_BURST_TYPE";
|
|
||||||
|
|
||||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
#define APIJUNGFRAU 0x200122
|
#define APIJUNGFRAU 0x200122
|
||||||
#define APIMYTHEN3 0x200122
|
#define APIMYTHEN3 0x200122
|
||||||
#define APIEIGER 0x200122
|
#define APIEIGER 0x200122
|
||||||
#define APIGOTTHARD2 0x200122
|
#define APIGOTTHARD2 0x200123
|
||||||
|
Loading…
x
Reference in New Issue
Block a user