gotthard2: first edit

This commit is contained in:
maliakal_d 2020-01-20 12:13:23 +01:00
parent 6e47f0b7f7
commit 6cfd0f8962
17 changed files with 322 additions and 53 deletions

View File

@ -144,10 +144,22 @@
#define ASIC_INT_EXPTIME_MSB_REG (0x05 * REG_OFFSET + BASE_ASIC)
/* Packetizer -------------------------------------------------------------*/
/* Packetizer Config Register*/
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
#define PKT_CONFIG_NRXR_MAX_OFST (0)
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
#define PKT_CONFIG_RXR_START_ID_OFST (8)
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
/* Flow control registers --------------------------------------------------*/
/* Flow status Register*/
#define FLOW_STATUS_REG (0x00 * REG_OFFSET + BASE_FLOW_CONTROL)
#define FLOW_STATUS_RUN_BUSY_OFST (0)
#define FLOW_STATUS_RUN_BUSY_MSK (0x00000001 << FLOW_STATUS_RUN_BUSY_OFST)
#define FLOW_STATUS_WAIT_FOR_TRGGR_OFST (3)

View File

@ -22,6 +22,7 @@
// Global variable from slsDetectorServer_funcs
extern int debugflag;
extern int checkModuleFlag;
extern udpStruct udpDetails;
int initError = OK;
@ -44,6 +45,7 @@ int injectedChannelsIncrement = 0;
int vetoReference[NCHIP][NCHAN];
uint8_t adcConfiguration[NCHIP][NADC];
int burstMode = 0;
enum burstModeType burstType = INTERNAL;
int64_t exptime_ns = 0;
int64_t period_ns = 0;
int64_t nframes = 0;
@ -345,7 +347,10 @@ void setupDetector() {
injectedChannelsOffset = 0;
injectedChannelsIncrement = 0;
burstMode = 0;
burstType = INTERNAL;
exptime_ns = 0;
period_ns = 0;
nframes = 0;
{
int i, j;
for (i = 0; i < NUM_CLOCKS; ++i) {
@ -385,11 +390,45 @@ void setupDetector() {
// Default values
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
// also sets default dac and on chip dac values
// check module type attached if not in debug mode
{
int ret = checkDetectorType();
if (checkModuleFlag) {
switch (ret) {
case -1:
sprintf(initErrorMessage, "Could not get the module type attached.\n");
initError = FAIL;
FILE_LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage));
return;
case -2:
sprintf(initErrorMessage, "No Module attached! Run server with -nomodule.\n");
initError = FAIL;
FILE_LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage));
return;
case FAIL:
sprintf(initErrorMessage, "Wrong Module (Not Gotthard2) attached!\n");
initError = FAIL;
FILE_LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage));
return;
default:
break;
}
} else {
FILE_LOG(logINFOBLUE, ("In No-Module mode: Ignoring module type. Continuing.\n"));
}
}
// power on chip
powerChip(1);
// also sets default dac and on chip dac values
if (readConfigFile() == FAIL) {
return;
}
setBurstMode(1);
// set burst mode will take in burstType and also set it
burstType = DEFAULT_BURST_TYPE;
setBurstMode(DEFAULT_BURST_MODE);
// Initialization of acquistion parameters
setNumFrames(DEFAULT_NUM_FRAMES);
@ -406,6 +445,10 @@ int readConfigFile() {
return initError;
}
// inform FPGA that onchip dacs will be configured soon
FILE_LOG(logINFO, ("Setting configuration starting bit\n"));
bus_w(ASIC_CONFIG_REG, bus_r(ASIC_CONFIG_REG) | ASIC_CONFIG_RST_DAC_MSK);
FILE* fd = fopen(CONFIG_FILE, "r");
if(fd == NULL) {
sprintf(initErrorMessage, "Could not open on-board detector server config file [%s].\n", CONFIG_FILE);
@ -623,7 +666,7 @@ int readConfigFile() {
int i = 0, j = 0;
for (i = 0; i < NCHIP; ++i) {
for (j = 0; j < NADC; ++j) {
FILE_LOG(logDEBUG1, ("adc read %d %d: 0x%02hhx\n", i, j, adcConfiguration[i][j]));
FILE_LOG(logDEBUG2, ("adc read %d %d: 0x%02hhx\n", i, j, adcConfiguration[i][j]));
}
}
}
@ -633,6 +676,10 @@ int readConfigFile() {
FILE_LOG(logERROR, ("%s\n\n", initErrorMessage));
} else {
FILE_LOG(logINFOBLUE, ("Successfully read config file\n"));
// inform FPGA that onchip dacs will be configured soon
FILE_LOG(logINFO, ("Setting configuration done bit\n"));
bus_w(ASIC_CONFIG_REG, bus_r(ASIC_CONFIG_REG) | ASIC_CONFIG_DONE_MSK);
}
return initError;
}
@ -723,6 +770,7 @@ int64_t getPeriod() {
void setNumFramesBurst(int64_t val) {
FILE_LOG(logINFO, ("Setting number of frames %d [Burst mode]\n", (int)val));
bus_w(ASIC_INT_FRAMES_REG, bus_r(ASIC_INT_FRAMES_REG) &~ ASIC_INT_FRAMES_MSK);
bus_w(ASIC_INT_FRAMES_REG, bus_r(ASIC_INT_FRAMES_REG) | (((int)val << ASIC_INT_FRAMES_OFST) & ASIC_INT_FRAMES_MSK));
}
@ -750,12 +798,12 @@ int setExptimeCont(int64_t val) {
}
int setExptimeBoth(int64_t val) {
val *= (1E-9 * SYSTEM_C0);
val *= (1E-9 * clkFrequency[SYSTEM_C0]);
set64BitReg(val, ASIC_INT_EXPTIME_LSB_REG, ASIC_INT_EXPTIME_MSB_REG);
// validate for tolerance
int64_t retval = getExptimeBoth();
val /= (1E-9 * SYSTEM_C0);
val /= (1E-9 * clkFrequency[SYSTEM_C0]);
if (val != retval) {
return FAIL;
}
@ -763,18 +811,18 @@ int setExptimeBoth(int64_t val) {
}
int64_t getExptimeBoth() {
return get64BitReg(ASIC_INT_EXPTIME_LSB_REG, ASIC_INT_EXPTIME_MSB_REG) / (1E-9 * SYSTEM_C0);
return get64BitReg(ASIC_INT_EXPTIME_LSB_REG, ASIC_INT_EXPTIME_MSB_REG) / (1E-9 * clkFrequency[SYSTEM_C0]);
}
int setPeriodBurst(int64_t val) {
FILE_LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", (long long int)val));
val *= (1E-9 * SYSTEM_C0);
val *= (1E-9 * clkFrequency[SYSTEM_C0]);
set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG);
// validate for tolerance
int64_t retval = getPeriod();
val /= (1E-9 * SYSTEM_C0);
int64_t retval = getPeriodBurst();
val /= (1E-9 * clkFrequency[SYSTEM_C0]);
if (val != retval) {
return FAIL;
}
@ -782,16 +830,16 @@ int setPeriodBurst(int64_t val) {
}
int64_t getPeriodBurst() {
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG)/ (1E-9 * SYSTEM_C0);
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG)/ (1E-9 * clkFrequency[SYSTEM_C0]);
}
int setPeriodCont(int64_t val) {
FILE_LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", (long long int)val));
val *= (1E-9 * FIXED_PLL_FREQUENCY);
set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG);
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
// validate for tolerance
int64_t retval = getPeriod();
int64_t retval = getPeriodCont();
val /= (1E-9 * FIXED_PLL_FREQUENCY);
if (val != retval) {
return FAIL;
@ -800,7 +848,7 @@ int setPeriodCont(int64_t val) {
}
int64_t getPeriodCont() {
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG)/ (1E-9 * FIXED_PLL_FREQUENCY);
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * FIXED_PLL_FREQUENCY);
}
int setDelayAfterTrigger(int64_t val) {
@ -1018,7 +1066,7 @@ int configureMAC() {
return OK;
#endif
FILE_LOG(logINFOBLUE, ("Configuring MAC\n"));
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n",
(srcip>>24)&0xff,(srcip>>16)&0xff,(srcip>>8)&0xff,(srcip)&0xff, srcip));
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
@ -1424,11 +1472,11 @@ int setVetoPhoton(int chipIndex, int gainIndex, int* values) {
FILE_LOG(logERROR, ("Unknown gain index %d\n", gainIndex));
return FAIL;
}
FILE_LOG(logDEBUG1, ("Adding gain bits\n"));
FILE_LOG(logDEBUG2, ("Adding gain bits\n"));
int i = 0;
for (i = 0; i < NCHAN; ++i) {
values[i] |= gainValue;
FILE_LOG(logDEBUG1, ("Value %d: 0x%x\n", i, values[i]));
FILE_LOG(logDEBUG2, ("Value %d: 0x%x\n", i, values[i]));
}
}
@ -1606,6 +1654,10 @@ int configureADC() {
int setBurstMode(int burst) {
FILE_LOG(logINFO, ("Setting %s Mode\n", burst == 1 ? "Burst" : "Continuous"));
burstMode = burst;
setBurstType(burstType);
FILE_LOG(logINFO, ("\tSetting %s Mode in Chip\n", burst == 1 ? "Burst" : "Continuous"));
int value = burst ? ASIC_GLOBAL_BURST_VALUE : ASIC_GLOBAL_CONT_VALUE;
const int padding = 6; // due to address (4) to make it byte aligned
@ -1644,22 +1696,59 @@ int setBurstMode(int burst) {
return FAIL;
}
burstMode = burst;
return configureADC();
}
int getBurstMode() {
return burstMode;
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:
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
return 1;
default:
return 0;
}
}
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;
}
}
/* aquisition */
int updateAcquisitionRegisters(char* mess) {
int64_t exptime_ns = 0;
int64_t period_ns = 0;
int64_t nframes = 0;
// burst mode
if (burstMode) {
// validate #frames in burst mode
@ -1680,7 +1769,18 @@ int64_t nframes = 0;
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)period_ns, getPeriodBurst());
FILE_LOG(logERROR,(mess));
return FAIL;
}
}
// set continuous values to default (exptime same register)
FILE_LOG(logINFO, ("Setting continuous mode registers to defaults\n"));
// frames
setNumFramesCont(1);
// period
if (setPeriodCont(0) == FAIL) {
sprintf(mess, "Could not start acquisition because period could not be set in continuous mode. Set 0 ns, got %lld ns.\n", getPeriodCont());
FILE_LOG(logERROR,(mess));
return FAIL;
}
}
// continuous
else {
@ -1698,6 +1798,16 @@ int64_t nframes = 0;
FILE_LOG(logERROR,(mess));
return FAIL;
}
// set burst values to default (exptime same register)
FILE_LOG(logINFO, ("Setting burst mode registers to defaults\n"));
setNumFramesBurst(1);
// period
if (setPeriodBurst(0) == FAIL) {
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set 0 ns, got %lld ns.\n", getPeriodBurst());
FILE_LOG(logERROR,(mess));
return FAIL;
}
}
return OK;
}

View File

@ -29,6 +29,8 @@
#define TYPE_NO_MODULE_STARTING_VAL (800)
/** Default Parameters */
#define DEFAULT_BURST_MODE (1)
#define DEFAULT_BURST_TYPE (INTERNAL)
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_EXPTIME (1 * 1000 * 1000) // 1 ms

View File

@ -470,6 +470,8 @@ int configureSingleADCDriver(int chipIndex);
int configureADC();
int setBurstMode(int burst);
int getBurstMode();
void setBurstType(enum burstModeType val);
enum burstModeType getBurstType();
#endif

View File

@ -205,4 +205,6 @@ int set_burst_mode(int);
int set_adc_enable_mask_10g(int);
int get_adc_enable_mask_10g(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);

View File

@ -19,6 +19,8 @@ extern int ret;
// Global variables from slsDetectorServer_funcs
extern int sockfd;
extern int debugflag;
extern int checkModuleFlag;
// Global variables from slsDetectorFunctionList
#ifdef GOTTHARDD
@ -67,7 +69,11 @@ int main(int argc, char *argv[]){
FILE_LOG(logINFO, ("Detected developer mode\n"));
debugflag = 1;
}
else if(!strcasecmp(argv[i],"--port")){
else if(!strcasecmp(argv[i],"-nomodule")){
FILE_LOG(logINFO, ("Detected No Module mode\n"));
checkModuleFlag = 0;
}
else if(!strcasecmp(argv[i],"-port")){
if ((i + 1) >= argc) {
FILE_LOG(logERROR, ("no port value given. Exiting.\n"));
return -1;
@ -105,7 +111,7 @@ int main(int argc, char *argv[]){
int i;
for (i = 0; i < argc; ++i)
sprintf(cmd, "%s %s", cmd, argv[i]);
sprintf(cmd,"%s -stopserver --port %d &", cmd, portno + 1);
sprintf(cmd,"%s -stopserver -port %d &", cmd, portno + 1);
FILE_LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd));
system(cmd);
}

View File

@ -39,6 +39,7 @@ extern char mess[MAX_STR_LENGTH];
// Variables that will be exported
int sockfd = 0;
int debugflag = 0;
int checkModuleFlag = 1;
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
int configured = FAIL;
char configureMessage[MAX_STR_LENGTH]="udp parameters not configured yet";
@ -307,6 +308,8 @@ const char* getFunctionName(enum detFuncs func) {
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_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";
}
@ -491,6 +494,8 @@ void function_table() {
flist[F_GET_ADC_ENABLE_MASK_10G] = &get_adc_enable_mask_10g;
flist[F_SET_COUNTER_MASK] = &set_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
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -3843,19 +3848,23 @@ int power_chip(int file_des) {
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
// check only when powering on
if (arg != -1 && arg != 0) {
int type_ret = checkDetectorType();
if (type_ret == -1) {
ret = FAIL;
sprintf(mess, "Could not power on chip. Could not open file to get type of module attached.\n");
FILE_LOG(logERROR,(mess));
} else if (type_ret == -2) {
ret = FAIL;
sprintf(mess, "Could not power on chip. No module attached!\n");
FILE_LOG(logERROR,(mess));
} else if (type_ret == FAIL) {
ret = FAIL;
sprintf(mess, "Could not power on chip. Wrong module attached!\n");
FILE_LOG(logERROR,(mess));
if (checkModuleFlag) {
int type_ret = checkDetectorType();
if (type_ret == -1) {
ret = FAIL;
sprintf(mess, "Could not power on chip. Could not open file to get type of module attached.\n");
FILE_LOG(logERROR,(mess));
} else if (type_ret == -2) {
ret = FAIL;
sprintf(mess, "Could not power on chip. No module attached!\n");
FILE_LOG(logERROR,(mess));
} else if (type_ret == FAIL) {
ret = FAIL;
sprintf(mess, "Could not power on chip. Wrong module attached!\n");
FILE_LOG(logERROR,(mess));
}
} else {
FILE_LOG(logINFOBLUE, ("In No-Module mode: Ignoring module type. Continuing.\n"));
}
}
#endif
@ -6579,4 +6588,61 @@ int get_counter_mask(int file_des) {
FILE_LOG(logDEBUG, ("counter mask retval: 0x%x\n", retval));
#endif
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));
}

View File

@ -173,8 +173,8 @@ class Detector {
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
/**
* [Gotthard, Jungfrau, CTB Options: AUTO_TIMING, TRIGGER_EXPOSURE]
* [Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER]
* [Gotthard][Jungfrau][CTB] Options: AUTO_TIMING, TRIGGER_EXPOSURE
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
*/
void setTimingMode(defs::timingMode value, Positions pos = {});
@ -906,12 +906,18 @@ class Detector {
/** [Gotthard2] */
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
/** [Gotthard2] burst mode or continuous mode */
void setBurstMode(bool enable, Positions pos = {});
/** [Gotthard2] */
Result<bool> getBurstMode(Positions pos = {});
/** [Gotthard2] true = burst mode or false = continuous mode */
void setBurstMode(bool enable, Positions pos = {});
/** [Gotthard2] */
Result<defs::burstModeType> getBurstType(Positions pos = {});
/** [Gotthard2] Options: INTERNAL, EXTERNAL */
void setBurstType(defs::burstModeType val, Positions pos = {});
/**************************************************
* *
* Mythen3 Specific *

View File

@ -788,6 +788,7 @@ class CmdProxy {
{"vetophoton", &CmdProxy::VetoPhoton},
{"vetoref", &CmdProxy::VetoReference},
{"burstmode", &CmdProxy::burstmode},
{"bursttype", &CmdProxy::bursttype},
/* Mythen3 Specific */
{"counters", &CmdProxy::Counters},
@ -1547,6 +1548,9 @@ class CmdProxy {
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 */
/* CTB Specific */

View File

@ -1180,13 +1180,21 @@ void Detector::setVetoReference(const int gainIndex, const int value, Positions
pimpl->Parallel(&slsDetector::setVetoReference, pos, gainIndex, value);
}
Result<bool> Detector::getBurstMode(Positions pos) {
return pimpl->Parallel(&slsDetector::getBurstMode, pos);
}
void Detector::setBurstMode(bool enable, Positions pos) {
pimpl->Parallel(&slsDetector::setBurstMode, pos, enable);
}
Result<bool> Detector::getBurstMode(Positions pos) {
return pimpl->Parallel(&slsDetector::getBurstMode, pos);
}
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

View File

@ -2488,6 +2488,19 @@ void slsDetector::setBurstMode(bool enable) {
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 retval = -1;
FILE_LOG(logDEBUG1) << "Sending counter bit " << cb;

View File

@ -1125,12 +1125,18 @@ class slsDetector : public virtual slsDetectorDefs {
void setVetoReference(const int gainIndex, const int value);
/** [Gotthard2] burst mode or continuous mode */
void setBurstMode(bool enable);
/** [Gotthard2] */
bool getBurstMode();
/** [Gotthard2] true = burst mode or false = continuous mode */
void setBurstMode(bool enable);
/** [Gotthard2] */
burstModeType getBurstType();
/** [Gotthard2] Options: INTERNAL, EXTERNAL */
void setBurstType(burstModeType val);
/**
* Set/get counter bit in detector (Gotthard)
* @param i is -1 to get, 0 to reset and any other value to set the counter

View File

@ -204,6 +204,17 @@ inline std::string ToString(const defs::detectorModeType s) {
}
}
inline std::string ToString(const defs::burstModeType s) {
switch (s) {
case defs::INTERNAL:
return std::string("internal");
case defs::EXTERNAL:
return std::string("external");
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) {
@ -550,6 +561,16 @@ inline defs::dacIndex StringTo(const std::string& s) {
throw sls::RuntimeError("Unknown dac Index " + s);
}
template <>
inline defs::burstModeType StringTo(const std::string& s) {
if (s == "internal")
return defs::INTERNAL;
if (s == "external")
return defs::EXTERNAL;
throw sls::RuntimeError("Unknown burst mode type" + s);
}
/** For types with a .str() method use this for conversion */
template <typename T>
typename std::enable_if<has_str<T>::value, std::string>::type

View File

@ -436,6 +436,14 @@ class slsDetectorDefs {
ANALOG /** < analog */
};
/**
* burst mode type for gotthard2
*/
enum burstModeType {
INTERNAL,
EXTERNAL,
};
#ifdef __cplusplus
protected:

View File

@ -188,6 +188,8 @@ enum detFuncs{
F_GET_ADC_ENABLE_MASK_10G,
F_SET_COUNTER_MASK,
F_GET_COUNTER_MASK,
F_SET_BURST_TYPE,
F_GET_BURST_TYPE,
NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
@ -443,7 +445,8 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
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_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 RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";

View File

@ -9,4 +9,4 @@
#define APICTB 0x191210
#define APIEIGER 0x200110
#define APIMYTHEN3 0x200120
#define APIGOTTHARD2 0x200116
#define APIGOTTHARD2 0x200120