jf: timing info decoder (#987)

* timing_info_decoder command with options swissfel (default) and shine. added to python, command line generation, autocomplete, tostring, tests.
This commit is contained in:
maliakal_d 2024-10-01 11:17:35 +02:00 committed by GitHub
parent 8a7ed30676
commit f43bb8eea4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 23282 additions and 20749 deletions

View File

@ -2910,6 +2910,18 @@ class Detector(CppDetectorApi):
def pedestalmode(self, value): def pedestalmode(self, value):
ut.set_using_dict(self.setPedestalMode, value) ut.set_using_dict(self.setPedestalMode, value)
@property
@element
def timing_info_decoder(self):
"""[Jungfrau] [Jungfrau] Advanced Command and only for SWISSFEL and SHINE. Sets the bunch id or timing info decoder. Default is SWISSFEL.
Enum: timingInfoDecoder
"""
return self.getTimingInfoDecoder()
@timing_info_decoder.setter
def timing_info_decoder(self, value):
ut.set_using_dict(self.setTimingInfoDecoder, value)
@property @property
@element @element
def collectionmode(self): def collectionmode(self):

View File

@ -1271,6 +1271,16 @@ void init_det(py::module &m) {
(void (Detector::*)(const defs::pedestalParameters, sls::Positions)) & (void (Detector::*)(const defs::pedestalParameters, sls::Positions)) &
Detector::setPedestalMode, Detector::setPedestalMode,
py::arg(), py::arg() = Positions{}); py::arg(), py::arg() = Positions{});
CppDetectorApi.def(
"getTimingInfoDecoder",
(Result<defs::timingInfoDecoder>(Detector::*)(sls::Positions) const) &
Detector::getTimingInfoDecoder,
py::arg() = Positions{});
CppDetectorApi.def(
"setTimingInfoDecoder",
(void (Detector::*)(defs::timingInfoDecoder, sls::Positions)) &
Detector::setTimingInfoDecoder,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def( CppDetectorApi.def(
"getCollectionMode", "getCollectionMode",
(Result<defs::collectionMode>(Detector::*)(sls::Positions) const) & (Result<defs::collectionMode>(Detector::*)(sls::Positions) const) &

View File

@ -39,6 +39,11 @@ void init_enums(py::module &m) {
.value("STOPPED", slsDetectorDefs::runStatus::STOPPED) .value("STOPPED", slsDetectorDefs::runStatus::STOPPED)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::dimension>(Defs, "dimension")
.value("X", slsDetectorDefs::dimension::X)
.value("Y", slsDetectorDefs::dimension::Y)
.export_values();
py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy") py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy")
.value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD) .value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD)
.value("DISCARD_EMPTY_FRAMES", .value("DISCARD_EMPTY_FRAMES",
@ -56,11 +61,6 @@ void init_enums(py::module &m) {
slsDetectorDefs::fileFormat::NUM_FILE_FORMATS) slsDetectorDefs::fileFormat::NUM_FILE_FORMATS)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::dimension>(Defs, "dimension")
.value("X", slsDetectorDefs::dimension::X)
.value("Y", slsDetectorDefs::dimension::Y)
.export_values();
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag") py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
.value("TRIGGER_IN_RISING_EDGE", .value("TRIGGER_IN_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE) slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE)
@ -328,6 +328,11 @@ void init_enums(py::module &m) {
.value("NEGATIVE", slsDetectorDefs::polarity::NEGATIVE) .value("NEGATIVE", slsDetectorDefs::polarity::NEGATIVE)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::timingInfoDecoder>(Defs, "timingInfoDecoder")
.value("SWISSFEL", slsDetectorDefs::timingInfoDecoder::SWISSFEL)
.value("SHINE", slsDetectorDefs::timingInfoDecoder::SHINE)
.export_values();
py::enum_<slsDetectorDefs::collectionMode>(Defs, "collectionMode") py::enum_<slsDetectorDefs::collectionMode>(Defs, "collectionMode")
.value("HOLE", slsDetectorDefs::collectionMode::HOLE) .value("HOLE", slsDetectorDefs::collectionMode::HOLE)
.value("ELECTRON", slsDetectorDefs::collectionMode::ELECTRON) .value("ELECTRON", slsDetectorDefs::collectionMode::ELECTRON)

View File

@ -213,6 +213,9 @@
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST) #define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
#define EXT_SYNC_OFST (4) #define EXT_SYNC_OFST (4)
#define EXT_SYNC_MSK (0x00000001 << EXT_SYNC_OFST) #define EXT_SYNC_MSK (0x00000001 << EXT_SYNC_OFST)
#define EXT_TIMING_INFO_DECODER_OFST (12)
#define EXT_TIMING_INFO_DECODER_MSK (0x00000001 << EXT_TIMING_INFO_DECODER_OFST)
/* Control Register */ /* Control Register */
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT) #define CONTROL_REG (0x4F << MEM_MAP_SHIFT)

View File

@ -572,6 +572,7 @@ void setupDetector() {
#endif #endif
setPedestalMode(DEFAULT_PEDESTAL_MODE, DEFAULT_PEDESTAL_FRAMES, setPedestalMode(DEFAULT_PEDESTAL_MODE, DEFAULT_PEDESTAL_FRAMES,
DEFAULT_PEDESTAL_LOOPS); DEFAULT_PEDESTAL_LOOPS);
setTimingInfoDecoder(DEFAULT_TIMING_INFO_DECODER);
setElectronCollectionMode(DEFAULT_ELECTRON_COLLECTION_MODE); setElectronCollectionMode(DEFAULT_ELECTRON_COLLECTION_MODE);
} }
@ -2616,6 +2617,41 @@ void setPedestalMode(int enable, uint8_t frames, uint16_t loops) {
} }
} }
int setTimingInfoDecoder(enum timingInfoDecoder val) {
switch (val) {
case SWISSFEL:
LOG(logINFO, ("Setting Timing Info Decoder to SWISSFEL\n"));
break;
case SHINE:
LOG(logINFO, ("Setting Timing Info Decoder to SHINE\n"));
break;
default:
LOG(logERROR, ("Unknown Timing Info Decoder %d\n", val));
return FAIL;
}
int decodeValue = (int)val;
uint32_t addr = EXT_SIGNAL_REG;
bus_w(addr, bus_r(addr) & ~EXT_TIMING_INFO_DECODER_MSK);
bus_w(addr, bus_r(addr) | ((decodeValue << EXT_TIMING_INFO_DECODER_OFST) &
EXT_TIMING_INFO_DECODER_MSK));
return OK;
}
int getTimingInfoDecoder(enum timingInfoDecoder *retval) {
int decodeValue = ((bus_r(EXT_SIGNAL_REG) & EXT_TIMING_INFO_DECODER_MSK) >>
EXT_TIMING_INFO_DECODER_OFST);
if (decodeValue == (int)SWISSFEL) {
*retval = SWISSFEL;
} else if (decodeValue == (int)SHINE) {
*retval = SHINE;
} else {
return FAIL;
}
return OK;
}
int getElectronCollectionMode() { int getElectronCollectionMode() {
return ((bus_r(DAQ_REG) & DAQ_ELCTRN_CLLCTN_MDE_MSK) >> return ((bus_r(DAQ_REG) & DAQ_ELCTRN_CLLCTN_MDE_MSK) >>
DAQ_ELCTRN_CLLCTN_MDE_OFST); DAQ_ELCTRN_CLLCTN_MDE_OFST);

View File

@ -5,8 +5,8 @@
#include "sls/sls_detector_defs.h" #include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x171220 #define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWRE_VRSN_BOARD2 0x230920 // 1.0 pcb (version = 010) #define REQRD_FRMWRE_VRSN_BOARD2 0x241001 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x230921 // 2.0 pcb (version = 011) #define REQRD_FRMWRE_VRSN 0x241001 // 2.0 pcb (version = 011)
#define NUM_HARDWARE_VERSIONS (2) #define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \ #define HARDWARE_VERSION_NUMBERS \
@ -59,6 +59,7 @@
#define DEFAULT_PEDESTAL_MODE (0) #define DEFAULT_PEDESTAL_MODE (0)
#define DEFAULT_PEDESTAL_FRAMES (1) #define DEFAULT_PEDESTAL_FRAMES (1)
#define DEFAULT_PEDESTAL_LOOPS (1) #define DEFAULT_PEDESTAL_LOOPS (1)
#define DEFAULT_TIMING_INFO_DECODER (SWISSFEL)
#define DEFAULT_ELECTRON_COLLECTION_MODE (0) #define DEFAULT_ELECTRON_COLLECTION_MODE (0)
#define HIGHVOLTAGE_MIN (60) #define HIGHVOLTAGE_MIN (60)

View File

@ -607,6 +607,8 @@ uint64_t getSelectCurrentSource();
int getPedestalMode(); int getPedestalMode();
void getPedestalParameters(uint8_t *frames, uint16_t *loops); void getPedestalParameters(uint8_t *frames, uint16_t *loops);
void setPedestalMode(int enable, uint8_t frames, uint16_t loops); void setPedestalMode(int enable, uint8_t frames, uint16_t loops);
int setTimingInfoDecoder(enum timingInfoDecoder val);
int getTimingInfoDecoder(enum timingInfoDecoder *retval);
int getElectronCollectionMode(); int getElectronCollectionMode();
void setElectronCollectionMode(int enable); void setElectronCollectionMode(int enable);
#endif #endif

View File

@ -330,5 +330,7 @@ int setColumn(int);
int get_pedestal_mode(int); int get_pedestal_mode(int);
int set_pedestal_mode(int); int set_pedestal_mode(int);
int config_transceiver(int); int config_transceiver(int);
int get_timing_info_decoder(int);
int set_timing_info_decoder(int);
int get_collection_mode(int); int get_collection_mode(int);
int set_collection_mode(int); int set_collection_mode(int);

View File

@ -492,6 +492,8 @@ void function_table() {
flist[F_GET_PEDESTAL_MODE] = &get_pedestal_mode; flist[F_GET_PEDESTAL_MODE] = &get_pedestal_mode;
flist[F_SET_PEDESTAL_MODE] = &set_pedestal_mode; flist[F_SET_PEDESTAL_MODE] = &set_pedestal_mode;
flist[F_CONFIG_TRANSCEIVER] = &config_transceiver; flist[F_CONFIG_TRANSCEIVER] = &config_transceiver;
flist[F_GET_TIMING_INFO_DECODER] = &get_timing_info_decoder;
flist[F_SET_TIMING_INFO_DECODER] = &set_timing_info_decoder;
flist[F_GET_COLLECTION_MODE] = &get_collection_mode; flist[F_GET_COLLECTION_MODE] = &get_collection_mode;
flist[F_SET_COLLECTION_MODE] = &set_collection_mode; flist[F_SET_COLLECTION_MODE] = &set_collection_mode;
@ -11092,6 +11094,73 @@ int config_transceiver(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }
int get_timing_info_decoder(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
enum timingInfoDecoder retval = SWISSFEL;
LOG(logDEBUG1, ("Getting timing info decoder\n"));
#ifndef JUNGFRAUD
functionNotImplemented();
#else
// get only
ret = getTimingInfoDecoder(&retval);
LOG(logDEBUG1, ("retval timing info decoder: %d\n", retval));
if (ret == FAIL) {
strcpy(mess, "Could not get timing info decoder\n");
LOG(logERROR, (mess));
}
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_timing_info_decoder(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
enum timingInfoDecoder arg = SWISSFEL;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
LOG(logDEBUG1, ("Setting timing info decoder: %u\n", (int)arg));
#ifndef JUNGFRAUD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
switch (arg) {
case SWISSFEL:
case SHINE:
break;
default:
modeNotImplemented("Timing info decoder index", (int)arg);
break;
}
if (ret == OK) {
ret = setTimingInfoDecoder(arg);
if (ret == FAIL) {
sprintf(mess, "Could not set timing info decoder\n");
LOG(logERROR, (mess));
} else {
enum timingInfoDecoder retval = SWISSFEL;
ret = getTimingInfoDecoder(&retval);
if (ret == FAIL) {
strcpy(mess, "Could not get timing info decoder\n");
LOG(logERROR, (mess));
} else {
LOG(logDEBUG1,
("timing info decoder retval: %u\n", retval));
validate(&ret, mess, (int)arg, (int)retval,
"set timing info decoder", DEC);
}
}
}
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_collection_mode(int file_des) { int get_collection_mode(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
@ -11123,29 +11192,22 @@ int set_collection_mode(int file_des) {
#else #else
// only set // only set
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
if (getChipVersion() == 11) { switch (arg) {
ret = FAIL; case HOLE:
sprintf(mess, setElectronCollectionMode(0);
"Cannot set addl. number of storage cells for chip v1.1\n"); break;
LOG(logERROR, (mess)); case ELECTRON:
} else { setElectronCollectionMode(1);
switch (arg) { break;
case HOLE: default:
setElectronCollectionMode(0); modeNotImplemented("Collection mode index", (int)arg);
break; break;
case ELECTRON:
setElectronCollectionMode(1);
break;
default:
modeNotImplemented("Collection mode index", (int)arg);
break;
}
enum collectionMode retval =
getElectronCollectionMode() ? ELECTRON : HOLE;
validate(&ret, mess, (int)arg, (int)retval, "set collection mode",
DEC);
LOG(logDEBUG1, ("collection mode retval: %u\n", retval));
} }
enum collectionMode retval =
getElectronCollectionMode() ? ELECTRON : HOLE;
validate(&ret, mess, (int)arg, (int)retval, "set collection mode",
DEC);
LOG(logDEBUG1, ("collection mode retval: %u\n", retval));
} }
#endif #endif
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);

View File

@ -80,7 +80,7 @@ _sd() {
local IS_PATH=0 local IS_PATH=0
local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clearroi clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 exptimel extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit patternX patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga roi romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport " local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clearroi clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 exptimel extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit patternX patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga roi romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport "
__acquire() { __acquire() {
FCN_RETURN="" FCN_RETURN=""
return 0 return 0
@ -2296,6 +2296,26 @@ fi
fi fi
return 0 return 0
} }
__sleep() {
FCN_RETURN=""
if [[ ${IS_GET} -eq 1 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
fi
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN="ms ns s us"
fi
fi
return 0
}
__slowadc() { __slowadc() {
FCN_RETURN="" FCN_RETURN=""
if [[ ${IS_GET} -eq 1 ]]; then if [[ ${IS_GET} -eq 1 ]]; then
@ -2572,6 +2592,15 @@ fi
fi fi
return 0 return 0
} }
__timing_info_decoder() {
FCN_RETURN=""
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN="shine swissfel"
fi
fi
return 0
}
__timinglist() { __timinglist() {
FCN_RETURN="" FCN_RETURN=""
return 0 return 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
_sd() { _sd() {
local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clearroi clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 exptimel extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit patternX patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga roi romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport " local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clearroi clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 exptimel extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit patternX patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga roi romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport "
__acquire() { __acquire() {
FCN_RETURN="" FCN_RETURN=""
return 0 return 0
@ -2220,6 +2220,26 @@ fi
fi fi
return 0 return 0
} }
__sleep() {
FCN_RETURN=""
if [[ ${IS_GET} -eq 1 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
fi
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN="ms ns s us"
fi
fi
return 0
}
__slowadc() { __slowadc() {
FCN_RETURN="" FCN_RETURN=""
if [[ ${IS_GET} -eq 1 ]]; then if [[ ${IS_GET} -eq 1 ]]; then
@ -2496,6 +2516,15 @@ fi
fi fi
return 0 return 0
} }
__timing_info_decoder() {
FCN_RETURN=""
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN="shine swissfel"
fi
fi
return 0
}
__timinglist() { __timinglist() {
FCN_RETURN="" FCN_RETURN=""
return 0 return 0

View File

@ -1209,6 +1209,16 @@ polarity:
function: setPolarity function: setPolarity
input_types: [ defs::polarity ] input_types: [ defs::polarity ]
timing_info_decoder:
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel."
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:
function: getTimingInfoDecoder
PUT:
function: setTimingInfoDecoder
input_types: [ defs::timingInfoDecoder ]
collectionmode: collectionmode:
help: "[hole|electron]\n\t[Jungfrau] Sets collection mode to hole or electron. Default is hole." help: "[hole|electron]\n\t[Jungfrau] Sets collection mode to hole or electron. Default is hole."
inherit_actions: INTEGER_COMMAND_VEC_ID inherit_actions: INTEGER_COMMAND_VEC_ID

View File

@ -1292,8 +1292,9 @@ clkdiv:
store_result_in_t: false store_result_in_t: false
command_name: clkdiv command_name: clkdiv
function_alias: clkdiv function_alias: clkdiv
help: "[n_clock (0-5)] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock\ help: "[n_clock] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock.\
\ n_clock. Must be greater than 1." \ Must be greater than 1.n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock\
\ index range: 0"
infer_action: true infer_action: true
clkfreq: clkfreq:
actions: actions:
@ -1324,8 +1325,9 @@ clkfreq:
store_result_in_t: true store_result_in_t: true
command_name: clkfreq command_name: clkfreq
function_alias: clkfreq function_alias: clkfreq
help: "[n_clock (0-5)] [freq_in_Hz]\n\t[Gotthard2][Mythen3] Frequency of clock n_clock\ help: "[n_clock] [freq_in_Hz]\n\t[Gotthard2][Mythen3] Frequency of clock n_clock\
\ in Hz. Use clkdiv to set frequency." \ in Hz. Use clkdiv to set frequency.\n\t[Gotthard2] Clock index range: 0-5\n\t\
[Mythen3] Clock index range: 0"
infer_action: true infer_action: true
clkphase: clkphase:
actions: actions:
@ -1444,9 +1446,9 @@ clkphase:
store_result_in_t: false store_result_in_t: false
command_name: clkphase command_name: clkphase
function_alias: clkphase function_alias: clkphase
help: "[n_clock (0-5)] [phase] [deg (optional)]\n\t[Gotthard2][Mythen3] Phase of\ help: "[n_clock] [phase] [deg (optional)]\n\t[Gotthard2][Mythen3] Phase of clock\
\ clock n_clock. If deg, then phase shift in degrees, else absolute phase shift\ \ n_clock. If deg, then phase shift in degrees, else absolute phase shift values.n\t\
\ values." [Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0"
infer_action: true infer_action: true
collectionmode: collectionmode:
actions: actions:
@ -5424,8 +5426,8 @@ maxclkphaseshift:
store_result_in_t: true store_result_in_t: true
command_name: maxclkphaseshift command_name: maxclkphaseshift
function_alias: maxclkphaseshift function_alias: maxclkphaseshift
help: "[n_clock (0-5)]\n\t[Gotthard2][Mythen3] Absolute Maximum Phase shift of clock\ help: "[n_clock]\n\t[Gotthard2][Mythen3] Absolute Maximum Phase shift of clock n_clock.n\t\
\ n_clock." [Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0"
infer_action: true infer_action: true
maxdbitphaseshift: maxdbitphaseshift:
actions: actions:
@ -7974,12 +7976,12 @@ readoutspeed:
store_result_in_t: false store_result_in_t: false
command_name: readoutspeed command_name: readoutspeed
function_alias: readoutspeed function_alias: readoutspeed
help: "\n\t[0 or full_speed|1 or half_speed|2 or quarter_speed]\n\t[Eiger][Jungfrau][Moench]\ help: "\n\t[0 or full_speed|1 or half_speed|2 or quarter_speed]\n\t[Eiger][Jungfrau][Moench][Mythen3]\
\ Readout speed of chip.\n\t[Eiger][Moench] Default speed is full_speed.\n\t[Jungfrau]\ \ Readout speed of chip.\n\t[Eiger][Moench] Default speed is full_speed.\n\t[Jungfrau][Mythen3]\
\ Default speed is half_speed. full_speed option only available from v2.0 boards\ \ Default speed is half_speed. \n\t[Jungfrau] full_speed option only available\
\ and is recommended to set number of interfaces to 2. Also overwrites adcphase\ \ from v2.0 boards and is recommended to set number of interfaces to 2. Also overwrites\
\ to recommended default.\n\t [144|108]\n\t\t[Gotthard2] Readout speed of chip\ \ adcphase to recommended default.\n\t [144|108]\n\t\t[Gotthard2] Readout speed\
\ in MHz. Default is 108." \ of chip in MHz. Default is 108."
infer_action: true infer_action: true
readoutspeedlist: readoutspeedlist:
actions: actions:
@ -11447,6 +11449,46 @@ timing:
\ [auto|trigger|gating|burst_trigger]" \ [auto|trigger|gating|burst_trigger]"
infer_action: true infer_action: true
template: true template: true
timing_info_decoder:
actions:
GET:
args:
- arg_types: []
argc: 0
cast_input: []
check_det_id: false
convert_det_id: true
function: getTimingInfoDecoder
input: []
input_types: []
output:
- OutString(t)
require_det_id: true
store_result_in_t: true
PUT:
args:
- arg_types:
- defs::timingInfoDecoder
argc: 1
cast_input:
- true
check_det_id: false
convert_det_id: true
function: setTimingInfoDecoder
input:
- args[0]
input_types:
- defs::timingInfoDecoder
output:
- args.front()
require_det_id: true
store_result_in_t: false
command_name: timing_info_decoder
function_alias: timing_info_decoder
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and\
\ Shine. Sets the bunch id or timing info decoder. Default is swissfel."
infer_action: true
template: true
timinglist: timinglist:
actions: actions:
GET: GET:

View File

@ -27,15 +27,15 @@ The dump.json is the AST of the file `slsDetectorPackage/slsSupportLib/src/ToStr
```sh ```sh
# to generate the dump.json file # to generate the dump.json file
cd slsSupportLib/src/ToString.cpp cd slsSupportLib/src
clang++ -Xclang -ast-dump=json -Xclang -ast-dump-filter -Xclang StringTo -c ToString.cpp -I ../include/ -std=gnu++11 clang++ -Xclang -ast-dump=json -Xclang -ast-dump-filter -Xclang StringTo -c ToString.cpp -I ../include/ -std=gnu++11 > ../../slsDetectorSoftware/generator/autocomplete/dump.json
# clang version used: 14.0.0-1ubuntu1.1 # clang version used: 14.0.0-1ubuntu1.1
``` ```
the `dump.json` file produced by clang is not a correct json file because we used the `-ast-dump-filter`. autocomplete.py can be used to fix the format of `dump.json` and produce a new file called `fixed.json` that is json format. the `dump.json` file produced by clang is not a correct json file because we used the `-ast-dump-filter`. autocomplete.py can be used to fix the format of `dump.json` and produce a new file called `fixed.json` that is json format.
``` ```
# to convert dump.json into correct json format. # to convert dump.json into correct json format.
python autocomplete.py -f # produces the file fixed.json python autocomplete.py -f # produces/updates the file fixed.json
``` ```
### Code components ### Code components

View File

@ -1372,6 +1372,14 @@ class Detector {
void setPedestalMode(const defs::pedestalParameters par, void setPedestalMode(const defs::pedestalParameters par,
Positions pos = {}); Positions pos = {});
/** [Jungfrau] */
Result<defs::timingInfoDecoder>
getTimingInfoDecoder(Positions pos = {}) const;
/** [Jungfrau] Advanced Command! */
void setTimingInfoDecoder(defs::timingInfoDecoder value,
Positions pos = {});
/** [Jungfrau] */ /** [Jungfrau] */
Result<defs::collectionMode> getCollectionMode(Positions pos = {}) const; Result<defs::collectionMode> getCollectionMode(Positions pos = {}) const;

View File

@ -1698,8 +1698,9 @@ std::string Caller::clkdiv(int action) {
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: clkdiv" << std::endl; os << "Command: clkdiv" << std::endl;
os << R"V0G0N([n_clock (0-5)] [n_divider] os << R"V0G0N([n_clock] [n_divider]
[Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1. )V0G0N" [Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1.n [Gotthard2] Clock index range: 0-5
[Mythen3] Clock index range: 0 )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -1791,8 +1792,10 @@ std::string Caller::clkfreq(int action) {
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: clkfreq" << std::endl; os << "Command: clkfreq" << std::endl;
os << R"V0G0N([n_clock (0-5)] [freq_in_Hz] os << R"V0G0N([n_clock] [freq_in_Hz]
[Gotthard2][Mythen3] Frequency of clock n_clock in Hz. Use clkdiv to set frequency. )V0G0N" [Gotthard2][Mythen3] Frequency of clock n_clock in Hz. Use clkdiv to set frequency.
[Gotthard2] Clock index range: 0-5
[Mythen3] Clock index range: 0 )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -1847,8 +1850,9 @@ std::string Caller::clkphase(int action) {
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: clkphase" << std::endl; os << "Command: clkphase" << std::endl;
os << R"V0G0N([n_clock (0-5)] [phase] [deg (optional)] os << R"V0G0N([n_clock] [phase] [deg (optional)]
[Gotthard2][Mythen3] Phase of clock n_clock. If deg, then phase shift in degrees, else absolute phase shift values. )V0G0N" [Gotthard2][Mythen3] Phase of clock n_clock. If deg, then phase shift in degrees, else absolute phase shift values.n [Gotthard2] Clock index range: 0-5
[Mythen3] Clock index range: 0 )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -7135,8 +7139,9 @@ std::string Caller::maxclkphaseshift(int action) {
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: maxclkphaseshift" << std::endl; os << "Command: maxclkphaseshift" << std::endl;
os << R"V0G0N([n_clock (0-5)] os << R"V0G0N([n_clock]
[Gotthard2][Mythen3] Absolute Maximum Phase shift of clock n_clock. )V0G0N" [Gotthard2][Mythen3] Absolute Maximum Phase shift of clock n_clock.n [Gotthard2] Clock index range: 0-5
[Mythen3] Clock index range: 0 )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -10246,9 +10251,10 @@ std::string Caller::readoutspeed(int action) {
os << "Command: readoutspeed" << std::endl; os << "Command: readoutspeed" << std::endl;
os << R"V0G0N( os << R"V0G0N(
[0 or full_speed|1 or half_speed|2 or quarter_speed] [0 or full_speed|1 or half_speed|2 or quarter_speed]
[Eiger][Jungfrau][Moench] Readout speed of chip. [Eiger][Jungfrau][Moench][Mythen3] Readout speed of chip.
[Eiger][Moench] Default speed is full_speed. [Eiger][Moench] Default speed is full_speed.
[Jungfrau] Default speed is half_speed. full_speed option only available from v2.0 boards and is recommended to set number of interfaces to 2. Also overwrites adcphase to recommended default. [Jungfrau][Mythen3] Default speed is half_speed.
[Jungfrau] full_speed option only available from v2.0 boards and is recommended to set number of interfaces to 2. Also overwrites adcphase to recommended default.
[144|108] [144|108]
[Gotthard2] Readout speed of chip in MHz. Default is 108. )V0G0N" [Gotthard2] Readout speed of chip in MHz. Default is 108. )V0G0N"
<< std::endl; << std::endl;
@ -14948,6 +14954,70 @@ std::string Caller::timing(int action) {
return os.str(); return os.str();
} }
std::string Caller::timing_info_decoder(int action) {
std::ostringstream os;
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: timing_info_decoder" << std::endl;
os << R"V0G0N([swissfel|shine]
[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. )V0G0N"
<< std::endl;
return os.str();
}
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
if (1 && args.size() != 0) {
throw RuntimeError("Wrong number of arguments for action GET");
}
if (args.size() == 0) {
}
}
else if (action == slsDetectorDefs::PUT_ACTION) {
if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
if (args.size() == 1) {
try {
StringTo<defs::timingInfoDecoder>(args[0]);
} catch (...) {
throw RuntimeError(
"Could not convert argument 0 to defs::timingInfoDecoder");
}
}
}
else {
throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
"are ['GET', 'PUT']");
}
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
if (args.size() == 0) {
auto t = det->getTimingInfoDecoder(std::vector<int>{det_id});
os << OutString(t) << '\n';
}
}
if (action == slsDetectorDefs::PUT_ACTION) {
if (args.size() == 1) {
auto arg0 = StringTo<defs::timingInfoDecoder>(args[0]);
det->setTimingInfoDecoder(arg0, std::vector<int>{det_id});
os << args.front() << '\n';
}
}
return os.str();
}
std::string Caller::timinglist(int action) { std::string Caller::timinglist(int action) {
std::ostringstream os; std::ostringstream os;

View File

@ -320,6 +320,7 @@ class Caller {
std::string tengiga(int action); std::string tengiga(int action);
std::string threshold(int action); std::string threshold(int action);
std::string timing(int action); std::string timing(int action);
std::string timing_info_decoder(int action);
std::string timinglist(int action); std::string timinglist(int action);
std::string timingsource(int action); std::string timingsource(int action);
std::string top(int action); std::string top(int action);
@ -669,6 +670,7 @@ class Caller {
{"threshold", &Caller::threshold}, {"threshold", &Caller::threshold},
{"thresholdnotb", &Caller::threshold}, {"thresholdnotb", &Caller::threshold},
{"timing", &Caller::timing}, {"timing", &Caller::timing},
{"timing_info_decoder", &Caller::timing_info_decoder},
{"timinglist", &Caller::timinglist}, {"timinglist", &Caller::timinglist},
{"timingsource", &Caller::timingsource}, {"timingsource", &Caller::timingsource},
{"top", &Caller::top}, {"top", &Caller::top},

View File

@ -1772,6 +1772,16 @@ void Detector::setPedestalMode(const defs::pedestalParameters par,
pimpl->Parallel(&Module::setPedestalMode, pos, par); pimpl->Parallel(&Module::setPedestalMode, pos, par);
} }
Result<defs::timingInfoDecoder>
Detector::getTimingInfoDecoder(Positions pos) const {
return pimpl->Parallel(&Module::getTimingInfoDecoder, pos);
}
void Detector::setTimingInfoDecoder(defs::timingInfoDecoder value,
Positions pos) {
pimpl->Parallel(&Module::setTimingInfoDecoder, pos, value);
}
Result<defs::collectionMode> Detector::getCollectionMode(Positions pos) const { Result<defs::collectionMode> Detector::getCollectionMode(Positions pos) const {
return pimpl->Parallel(&Module::getCollectionMode, pos); return pimpl->Parallel(&Module::getCollectionMode, pos);
} }

View File

@ -1940,6 +1940,14 @@ void Module::setPedestalMode(const defs::pedestalParameters par) {
} }
} }
defs::timingInfoDecoder Module::getTimingInfoDecoder() const {
return sendToDetector<defs::timingInfoDecoder>(F_GET_TIMING_INFO_DECODER);
}
void Module::setTimingInfoDecoder(const defs::timingInfoDecoder value) {
sendToDetector(F_SET_TIMING_INFO_DECODER, static_cast<int>(value), nullptr);
}
defs::collectionMode Module::getCollectionMode() const { defs::collectionMode Module::getCollectionMode() const {
return sendToDetector<defs::collectionMode>(F_GET_COLLECTION_MODE); return sendToDetector<defs::collectionMode>(F_GET_COLLECTION_MODE);
} }

View File

@ -419,6 +419,8 @@ class Module : public virtual slsDetectorDefs {
void setNumberOfFilterCells(int value); void setNumberOfFilterCells(int value);
defs::pedestalParameters getPedestalMode() const; defs::pedestalParameters getPedestalMode() const;
void setPedestalMode(defs::pedestalParameters par); void setPedestalMode(defs::pedestalParameters par);
defs::timingInfoDecoder getTimingInfoDecoder() const;
void setTimingInfoDecoder(const defs::timingInfoDecoder enable);
defs::collectionMode getCollectionMode() const; defs::collectionMode getCollectionMode() const;
void setCollectionMode(const defs::collectionMode enable); void setCollectionMode(const defs::collectionMode enable);

View File

@ -3737,6 +3737,22 @@ int InferAction::timing() {
} }
} }
int InferAction::timing_info_decoder() {
if (args.size() == 0) {
return slsDetectorDefs::GET_ACTION;
}
if (args.size() == 1) {
return slsDetectorDefs::PUT_ACTION;
}
else {
throw RuntimeError("Could not infer action: Wrong number of arguments");
}
}
int InferAction::timinglist() { int InferAction::timinglist() {
if (args.size() == 0) { if (args.size() == 0) {

View File

@ -275,6 +275,7 @@ class InferAction {
int tengiga(); int tengiga();
int threshold(); int threshold();
int timing(); int timing();
int timing_info_decoder();
int timinglist(); int timinglist();
int timingsource(); int timingsource();
int top(); int top();
@ -612,6 +613,7 @@ class InferAction {
{"threshold", &InferAction::threshold}, {"threshold", &InferAction::threshold},
{"thresholdnotb", &InferAction::threshold}, {"thresholdnotb", &InferAction::threshold},
{"timing", &InferAction::timing}, {"timing", &InferAction::timing},
{"timing_info_decoder", &InferAction::timing_info_decoder},
{"timinglist", &InferAction::timinglist}, {"timinglist", &InferAction::timinglist},
{"timingsource", &InferAction::timingsource}, {"timingsource", &InferAction::timingsource},
{"top", &InferAction::top}, {"top", &InferAction::top},

View File

@ -667,6 +667,34 @@ TEST_CASE("Caller::pedestalmode", "[.cmdcall]") {
} }
} }
TEST_CASE("Caller::timing_info_decoder", "[.cmdcall]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::JUNGFRAU) {
auto prev_val = det.getTimingInfoDecoder();
{
std::ostringstream oss;
caller.call("timing_info_decoder", {"shine"}, -1, PUT, oss);
REQUIRE(oss.str() == "timing_info_decoder shine\n");
}
{
std::ostringstream oss;
caller.call("timing_info_decoder", {"swissfel"}, -1, PUT, oss);
REQUIRE(oss.str() == "timing_info_decoder swissfel\n");
}
{
std::ostringstream oss;
caller.call("timing_info_decoder", {}, -1, GET, oss);
REQUIRE(oss.str() == "timing_info_decoder swissfel\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setTimingInfoDecoder(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(caller.call("timing_info_decoder", {}, -1, GET));
}
}
TEST_CASE("Caller::collectionmode", "[.cmdcall]") { TEST_CASE("Caller::collectionmode", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);

View File

@ -44,6 +44,7 @@ std::string ToString(const defs::streamingInterface s);
std::string ToString(const defs::vetoAlgorithm s); std::string ToString(const defs::vetoAlgorithm s);
std::string ToString(const defs::gainMode s); std::string ToString(const defs::gainMode s);
std::string ToString(const defs::polarity s); std::string ToString(const defs::polarity s);
std::string ToString(const defs::timingInfoDecoder s);
std::string ToString(const defs::collectionMode s); std::string ToString(const defs::collectionMode s);
std::string ToString(const slsDetectorDefs::xy &coord); std::string ToString(const slsDetectorDefs::xy &coord);
@ -319,6 +320,7 @@ template <> defs::streamingInterface StringTo(const std::string &s);
template <> defs::vetoAlgorithm StringTo(const std::string &s); template <> defs::vetoAlgorithm StringTo(const std::string &s);
template <> defs::gainMode StringTo(const std::string &s); template <> defs::gainMode StringTo(const std::string &s);
template <> defs::polarity StringTo(const std::string &s); template <> defs::polarity StringTo(const std::string &s);
template <> defs::timingInfoDecoder StringTo(const std::string &s);
template <> defs::collectionMode StringTo(const std::string &s); template <> defs::collectionMode StringTo(const std::string &s);
template <> uint8_t StringTo(const std::string &s); template <> uint8_t StringTo(const std::string &s);

View File

@ -519,7 +519,7 @@ enum streamingInterface {
}; };
enum polarity { POSITIVE, NEGATIVE }; enum polarity { POSITIVE, NEGATIVE };
enum timingInfoDecoder { SWISSFEL, SHINE };
enum collectionMode { HOLE, ELECTRON }; enum collectionMode { HOLE, ELECTRON };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -293,6 +293,8 @@ enum detFuncs {
F_GET_PEDESTAL_MODE, F_GET_PEDESTAL_MODE,
F_SET_PEDESTAL_MODE, F_SET_PEDESTAL_MODE,
F_CONFIG_TRANSCEIVER, F_CONFIG_TRANSCEIVER,
F_GET_TIMING_INFO_DECODER,
F_SET_TIMING_INFO_DECODER,
F_GET_COLLECTION_MODE, F_GET_COLLECTION_MODE,
F_SET_COLLECTION_MODE, F_SET_COLLECTION_MODE,
@ -695,6 +697,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_PEDESTAL_MODE: return "F_GET_PEDESTAL_MODE"; case F_GET_PEDESTAL_MODE: return "F_GET_PEDESTAL_MODE";
case F_SET_PEDESTAL_MODE: return "F_SET_PEDESTAL_MODE"; case F_SET_PEDESTAL_MODE: return "F_SET_PEDESTAL_MODE";
case F_CONFIG_TRANSCEIVER: return "F_CONFIG_TRANSCEIVER"; case F_CONFIG_TRANSCEIVER: return "F_CONFIG_TRANSCEIVER";
case F_GET_TIMING_INFO_DECODER: return "F_GET_TIMING_INFO_DECODER";
case F_SET_TIMING_INFO_DECODER: return "F_SET_TIMING_INFO_DECODER";
case F_GET_COLLECTION_MODE: return "F_GET_COLLECTION_MODE"; case F_GET_COLLECTION_MODE: return "F_GET_COLLECTION_MODE";
case F_SET_COLLECTION_MODE: return "F_SET_COLLECTION_MODE"; case F_SET_COLLECTION_MODE: return "F_SET_COLLECTION_MODE";

View File

@ -10,5 +10,5 @@
#define APIMOENCH "developer 0x240918" #define APIMOENCH "developer 0x240918"
#define APIXILINXCTB "developer 0x240918" #define APIXILINXCTB "developer 0x240918"
#define APIEIGER "developer 0x240918" #define APIEIGER "developer 0x240918"
#define APIJUNGFRAU "developer 0x240930" #define APIJUNGFRAU "developer 0x241001"
#define APIMYTHEN3 "developer 0x240930" #define APIMYTHEN3 "developer 0x241001"

View File

@ -679,6 +679,17 @@ std::string ToString(const defs::polarity s) {
} }
} }
std::string ToString(const defs::timingInfoDecoder s) {
switch (s) {
case defs::SWISSFEL:
return std::string("swissfel");
case defs::SHINE:
return std::string("shine");
default:
return std::string("Unknown");
}
}
std::string ToString(const defs::collectionMode s) { std::string ToString(const defs::collectionMode s) {
switch (s) { switch (s) {
case defs::HOLE: case defs::HOLE:
@ -1115,6 +1126,14 @@ template <> defs::polarity StringTo(const std::string &s) {
throw RuntimeError("Unknown polarity mode " + s); throw RuntimeError("Unknown polarity mode " + s);
} }
template <> defs::timingInfoDecoder StringTo(const std::string &s) {
if (s == "swissfel")
return defs::SWISSFEL;
if (s == "shine")
return defs::SHINE;
throw RuntimeError("Unknown Timing Info Decoder " + s);
}
template <> defs::collectionMode StringTo(const std::string &s) { template <> defs::collectionMode StringTo(const std::string &s) {
if (s == "hole") if (s == "hole")
return defs::HOLE; return defs::HOLE;

View File

@ -357,4 +357,17 @@ TEST_CASE("string to speedLevel") {
REQUIRE(StringTo<defs::speedLevel>("144") == defs::speedLevel::G2_144MHZ); REQUIRE(StringTo<defs::speedLevel>("144") == defs::speedLevel::G2_144MHZ);
} }
// Timing Info Decoder
TEST_CASE("timingInfoDecoder to string") {
REQUIRE(ToString(defs::timingInfoDecoder::SWISSFEL) == "swissfel");
REQUIRE(ToString(defs::timingInfoDecoder::SHINE) == "shine");
}
TEST_CASE("string to timingInfoDecoder") {
REQUIRE(StringTo<defs::timingInfoDecoder>("swissfel") ==
defs::timingInfoDecoder::SWISSFEL);
REQUIRE(StringTo<defs::timingInfoDecoder>("shine") ==
defs::timingInfoDecoder::SHINE);
}
} // namespace sls } // namespace sls