mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 00:00:02 +02:00
Merge pull request #73 from slsdetectorgroup/mythen3
mythen3: virtual server, connected timing mode, row and col in header…
This commit is contained in:
commit
688e4e84d9
@ -10,7 +10,7 @@ pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
|
|||||||
|
|
||||||
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
||||||
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
||||||
'rxb_lb', 'vref_prech', 'vref_restore', 'vref_cds',
|
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
|
||||||
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
|
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
|
||||||
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
|
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
|
||||||
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
|
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
|
||||||
|
@ -9,19 +9,7 @@ enums.cpp
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from parse import remove_comments
|
||||||
# def remove_comments(text):
|
|
||||||
# def replacer(match):
|
|
||||||
# s = match.group(0)
|
|
||||||
# if s.startswith('/'):
|
|
||||||
# return " " # note: a space and not an empty string
|
|
||||||
# else:
|
|
||||||
# return s
|
|
||||||
# pattern = re.compile(
|
|
||||||
# r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
|
|
||||||
# re.DOTALL | re.MULTILINE
|
|
||||||
# )
|
|
||||||
# return re.sub(pattern, replacer, text)
|
|
||||||
|
|
||||||
def extract_enums(lines):
|
def extract_enums(lines):
|
||||||
line_iter = iter(lines)
|
line_iter = iter(lines)
|
||||||
|
@ -74,9 +74,12 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getNumberOfTriggersLeft", &Detector::getNumberOfTriggersLeft,
|
.def("getNumberOfTriggersLeft", &Detector::getNumberOfTriggersLeft,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getPeriodLeft", &Detector::getPeriodLeft, py::arg() = Positions{})
|
||||||
.def("getDelayAfterTriggerLeft", &Detector::getDelayAfterTriggerLeft,
|
.def("getDelayAfterTriggerLeft", &Detector::getDelayAfterTriggerLeft,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getPeriodLeft", &Detector::getPeriodLeft, py::arg() = Positions{})
|
.def("getTimingMode", &Detector::getTimingMode, py::arg() = Positions{})
|
||||||
|
.def("setTimingMode", &Detector::setTimingMode, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getSpeed", &Detector::getSpeed, py::arg() = Positions{})
|
.def("getSpeed", &Detector::getSpeed, py::arg() = Positions{})
|
||||||
.def("setSpeed", &Detector::setSpeed, py::arg(),
|
.def("setSpeed", &Detector::setSpeed, py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
@ -109,6 +112,9 @@ void init_det(py::module &m) {
|
|||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getHighVoltage", &Detector::getHighVoltage,
|
.def("getHighVoltage", &Detector::getHighVoltage,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getPowerChip", &Detector::getPowerChip, py::arg() = Positions{})
|
||||||
|
.def("setPowerChip", &Detector::setPowerChip, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("setHighVoltage", &Detector::setHighVoltage, py::arg(),
|
.def("setHighVoltage", &Detector::setHighVoltage, py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getTemperature", &Detector::getTemperature, py::arg(),
|
.def("getTemperature", &Detector::getTemperature, py::arg(),
|
||||||
@ -121,9 +127,6 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setOnChipDAC", &Detector::setOnChipDAC, py::arg(), py::arg(),
|
.def("setOnChipDAC", &Detector::setOnChipDAC, py::arg(), py::arg(),
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getTimingMode", &Detector::getTimingMode, py::arg() = Positions{})
|
|
||||||
.def("setTimingMode", &Detector::setTimingMode, py::arg(),
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("acquire", &Detector::acquire)
|
.def("acquire", &Detector::acquire)
|
||||||
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
||||||
.def("startReceiver", &Detector::startReceiver)
|
.def("startReceiver", &Detector::startReceiver)
|
||||||
@ -395,9 +398,6 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("resetTemperatureEvent", &Detector::resetTemperatureEvent,
|
.def("resetTemperatureEvent", &Detector::resetTemperatureEvent,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getPowerChip", &Detector::getPowerChip, py::arg() = Positions{})
|
|
||||||
.def("setPowerChip", &Detector::setPowerChip, py::arg(),
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("getAutoCompDisable", &Detector::getAutoCompDisable,
|
.def("getAutoCompDisable", &Detector::getAutoCompDisable,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setAutoCompDisable", &Detector::setAutoCompDisable, py::arg(),
|
.def("setAutoCompDisable", &Detector::setAutoCompDisable, py::arg(),
|
||||||
@ -438,9 +438,9 @@ void init_det(py::module &m) {
|
|||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("setVetoReference", &Detector::setVetoReference, py::arg(),
|
.def("setVetoReference", &Detector::setVetoReference, py::arg(),
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
||||||
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
|
||||||
.def("getCounterMask", &Detector::getCounterMask,
|
.def("getCounterMask", &Detector::getCounterMask,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
||||||
|
@ -169,7 +169,7 @@ void init_enums(py::module &m) {
|
|||||||
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
|
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
|
||||||
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
|
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
|
||||||
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
|
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
|
||||||
.value("VREF_RESTORE", slsDetectorDefs::dacIndex::VREF_RESTORE)
|
.value("VREF_RSTORE", slsDetectorDefs::dacIndex::VREF_RSTORE)
|
||||||
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
|
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
|
||||||
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
|
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
|
||||||
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
|
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
|
||||||
@ -278,4 +278,10 @@ void init_enums(py::module &m) {
|
|||||||
slsDetectorDefs::detectorModeType::INTERPOLATING)
|
slsDetectorDefs::detectorModeType::INTERPOLATING)
|
||||||
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
|
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
|
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
||||||
|
.value("BURST_OFF", slsDetectorDefs::burstMode::BURST_OFF)
|
||||||
|
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||||
|
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||||
|
.export_values();
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -1418,8 +1418,6 @@ int setHighVoltage(int val){
|
|||||||
|
|
||||||
|
|
||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
|
|
||||||
if(arg != GET_TIMING_MODE){
|
|
||||||
switch(arg){
|
switch(arg){
|
||||||
case AUTO_TIMING:
|
case AUTO_TIMING:
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
@ -1431,8 +1429,6 @@ void setTiming( enum timingMode arg){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1106,13 +1106,23 @@ int setHighVoltage(int val) {
|
|||||||
/* parameters - timing, extsig */
|
/* parameters - timing, extsig */
|
||||||
|
|
||||||
void setTiming( enum timingMode arg) {
|
void setTiming( enum timingMode arg) {
|
||||||
enum timingMode ret=GET_TIMING_MODE;
|
int ret = 0;
|
||||||
if (arg != GET_TIMING_MODE) {
|
|
||||||
switch(arg) {
|
switch(arg) {
|
||||||
case AUTO_TIMING: ret = 0; break;
|
case AUTO_TIMING:
|
||||||
case TRIGGER_EXPOSURE: ret = 2; break;
|
ret = 0;
|
||||||
case BURST_TRIGGER: ret = 1; break;
|
break;
|
||||||
case GATED: ret = 3; break;
|
case TRIGGER_EXPOSURE:
|
||||||
|
ret = 2;
|
||||||
|
break;
|
||||||
|
case BURST_TRIGGER:
|
||||||
|
ret = 1;
|
||||||
|
break;
|
||||||
|
case GATED:
|
||||||
|
ret = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
FILE_LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
FILE_LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
@ -1120,22 +1130,22 @@ void setTiming( enum timingMode arg) {
|
|||||||
#endif
|
#endif
|
||||||
eiger_triggermode = ret;
|
eiger_triggermode = ret;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
enum timingMode getTiming() {
|
enum timingMode getTiming() {
|
||||||
enum timingMode ret = GET_TIMING_MODE;
|
switch(eiger_triggermode) {
|
||||||
ret = eiger_triggermode;
|
case 0:
|
||||||
switch((int)ret) {
|
return AUTO_TIMING;
|
||||||
case 0: ret = AUTO_TIMING; break;
|
case 2:
|
||||||
case 2: ret = TRIGGER_EXPOSURE; break;
|
return TRIGGER_EXPOSURE;
|
||||||
case 1: ret = BURST_TRIGGER; break;
|
case 1:
|
||||||
case 3: ret = GATED; break;
|
return BURST_TRIGGER;
|
||||||
|
case 3:
|
||||||
|
return GATED;
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logERROR, ("Unknown trigger mode found %d\n", ret));
|
FILE_LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode));
|
||||||
ret = 0;
|
return GET_TIMING_MODE;
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -11,7 +11,7 @@ vref_h_adc 2099
|
|||||||
vb_comp_fe 0
|
vb_comp_fe 0
|
||||||
vb_comp_adc 0
|
vb_comp_adc 0
|
||||||
vcom_cds 1400
|
vcom_cds 1400
|
||||||
vref_restore 640
|
vref_rstore 640
|
||||||
vb_opa_1st 0
|
vb_opa_1st 0
|
||||||
vref_comp_fe 0
|
vref_comp_fe 0
|
||||||
vcom_adc1 1400
|
vcom_adc1 1400
|
||||||
|
@ -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);
|
||||||
|
|
||||||
@ -626,8 +622,8 @@ int readConfigFile() {
|
|||||||
idac = G2_VB_COMP_ADC;
|
idac = G2_VB_COMP_ADC;
|
||||||
} else if (!strcasecmp(command,"vcom_cds")) {
|
} else if (!strcasecmp(command,"vcom_cds")) {
|
||||||
idac = G2_VCOM_CDS;
|
idac = G2_VCOM_CDS;
|
||||||
} else if (!strcasecmp(command,"vref_restore")) {
|
} else if (!strcasecmp(command,"vref_rstore")) {
|
||||||
idac = G2_VREF_RESTORE;
|
idac = G2_VREF_RSTORE;
|
||||||
} else if (!strcasecmp(command,"vb_opa_1st")) {
|
} else if (!strcasecmp(command,"vb_opa_1st")) {
|
||||||
idac = G2_VB_OPA_1ST;
|
idac = G2_VB_OPA_1ST;
|
||||||
} else if (!strcasecmp(command,"vref_comp_fe")) {
|
} else if (!strcasecmp(command,"vref_comp_fe")) {
|
||||||
@ -1091,7 +1087,6 @@ int setHighVoltage(int val){
|
|||||||
|
|
||||||
/* parameters - timing */
|
/* parameters - timing */
|
||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
if(arg != GET_TIMING_MODE){
|
|
||||||
switch(arg){
|
switch(arg){
|
||||||
case AUTO_TIMING:
|
case AUTO_TIMING:
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
@ -1103,8 +1098,6 @@ void setTiming( enum timingMode arg){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1670,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]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1749,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
|
||||||
@ -1797,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);
|
||||||
@ -1945,9 +1933,19 @@ void* start_timer(void* arg) {
|
|||||||
int numFrames = (getNumFrames() *
|
int numFrames = (getNumFrames() *
|
||||||
getNumTriggers() );
|
getNumTriggers() );
|
||||||
int64_t exp_ns = getExpTime();
|
int64_t exp_ns = getExpTime();
|
||||||
int datasize = 2560;
|
int imagesize = NCHAN * NCHIP * 2;
|
||||||
|
int datasize = imagesize;
|
||||||
int packetsize = datasize + sizeof(sls_detector_header);
|
int packetsize = datasize + sizeof(sls_detector_header);
|
||||||
|
|
||||||
|
// Generate data
|
||||||
|
char imageData[imagesize];
|
||||||
|
memset(imageData, 0, imagesize);
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for (i = 0; i < imagesize; i += sizeof(uint8_t)) {
|
||||||
|
*((uint8_t*)(imageData + i)) = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int frameNr = 0;
|
int frameNr = 0;
|
||||||
// loop over number of frames
|
// loop over number of frames
|
||||||
@ -1976,6 +1974,9 @@ void* start_timer(void* arg) {
|
|||||||
header->detType = (uint16_t)myDetectorType;
|
header->detType = (uint16_t)myDetectorType;
|
||||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||||
|
|
||||||
|
// fill data
|
||||||
|
memcpy(packetData + sizeof(sls_detector_header), imageData, datasize);
|
||||||
|
|
||||||
// send 1 packet = 1 frame
|
// send 1 packet = 1 frame
|
||||||
sendUDPPacket(0, packetData, packetsize);
|
sendUDPPacket(0, packetData, packetsize);
|
||||||
FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||||
|
@ -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
|
||||||
@ -61,7 +60,7 @@ enum DACINDEX {G2_VREF_H_ADC, /* 0 */ \
|
|||||||
G2_VB_COMP_FE, /* 2 */ \
|
G2_VB_COMP_FE, /* 2 */ \
|
||||||
G2_VB_COMP_ADC, /* 3 */ \
|
G2_VB_COMP_ADC, /* 3 */ \
|
||||||
G2_VCOM_CDS, /* 4 */ \
|
G2_VCOM_CDS, /* 4 */ \
|
||||||
G2_VREF_RESTORE,/* 5 */ \
|
G2_VREF_RSTORE,/* 5 */ \
|
||||||
G2_VB_OPA_1ST, /* 6 */ \
|
G2_VB_OPA_1ST, /* 6 */ \
|
||||||
G2_VREF_COMP_FE,/* 7 */ \
|
G2_VREF_COMP_FE,/* 7 */ \
|
||||||
G2_VCOM_ADC1, /* 8 */ \
|
G2_VCOM_ADC1, /* 8 */ \
|
||||||
@ -73,7 +72,7 @@ enum DACINDEX {G2_VREF_H_ADC, /* 0 */ \
|
|||||||
G2_DAC_UNUSED2, /* 14 */ \
|
G2_DAC_UNUSED2, /* 14 */ \
|
||||||
G2_VCOM_ADC2 /* 15*/ \
|
G2_VCOM_ADC2 /* 15*/ \
|
||||||
};
|
};
|
||||||
#define DAC_NAMES "vref_h_adc", "dac_unused", "vb_comp_fe", "vb_comp_adc", "vcom_cds", "vref_restore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1", "vref_prech", "vref_l_adc", "vref_cds", "vb_cs", "vb_opa_fd", "dac_unused2", "vcom_adc2"
|
#define DAC_NAMES "vref_h_adc", "dac_unused", "vb_comp_fe", "vb_comp_adc", "vcom_cds", "vref_rstore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1", "vref_prech", "vref_l_adc", "vref_cds", "vb_cs", "vb_opa_fd", "dac_unused2", "vcom_adc2"
|
||||||
|
|
||||||
enum ONCHIP_DACINDEX {G2_VCHIP_COMP_FE, /* 0 */ \
|
enum ONCHIP_DACINDEX {G2_VCHIP_COMP_FE, /* 0 */ \
|
||||||
G2_VCHIP_OPA_1ST, /* 1 */ \
|
G2_VCHIP_OPA_1ST, /* 1 */ \
|
||||||
|
Binary file not shown.
@ -1178,8 +1178,6 @@ int setHighVoltage(int val){
|
|||||||
|
|
||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
u_int32_t addr = EXT_SIGNAL_REG;
|
u_int32_t addr = EXT_SIGNAL_REG;
|
||||||
|
|
||||||
if (arg != GET_TIMING_MODE){
|
|
||||||
switch(arg) {
|
switch(arg) {
|
||||||
case AUTO_TIMING:
|
case AUTO_TIMING:
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
@ -1196,8 +1194,6 @@ void setTiming( enum timingMode arg){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logERROR, ("Unknown timing mode %d for this detector\n", (int)arg));
|
FILE_LOG(logERROR, ("Unknown timing mode %d for this detector\n", (int)arg));
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -919,8 +919,6 @@ int setHighVoltage(int val){
|
|||||||
|
|
||||||
|
|
||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
|
|
||||||
if(arg != GET_TIMING_MODE){
|
|
||||||
switch(arg){
|
switch(arg){
|
||||||
case AUTO_TIMING:
|
case AUTO_TIMING:
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
@ -932,8 +930,6 @@ void setTiming( enum timingMode arg){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
/* Formatting of data core */
|
/* Formatting of data core */
|
||||||
#define BASE_FMT (0x0120) // 0x1806_0120 - 0x1806_012F
|
#define BASE_FMT (0x0120) // 0x1806_0120 - 0x1806_012F
|
||||||
|
|
||||||
|
/* Packetizer */
|
||||||
|
#define BASE_PKT (0x0140) // 0x1806_0140 - 0x1806_014F
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/pkt/pkt_ctrl.vhd
|
||||||
|
|
||||||
/* Pattern control and status registers */
|
/* Pattern control and status registers */
|
||||||
#define BASE_PATTERN_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
|
#define BASE_PATTERN_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
|
||||||
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/pattern_flow/pattern_flow_ctrl.vhd
|
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/pattern_flow/pattern_flow_ctrl.vhd
|
||||||
@ -128,6 +132,30 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
|
||||||
|
/* Module Coordinates Register */
|
||||||
|
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
|
||||||
|
#define COORD_ROW_OFST (0)
|
||||||
|
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
|
||||||
|
#define COORD_COL_OFST (16)
|
||||||
|
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
|
||||||
|
|
||||||
|
/* Module ID Register */
|
||||||
|
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
|
||||||
|
#define COORD_RESERVED_OFST (0)
|
||||||
|
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
|
||||||
|
#define COORD_ID_OFST (16) // Not connected in firmware TODO
|
||||||
|
#define COORD_ID_MSK (0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
|
||||||
|
|
||||||
|
|
||||||
/* Pattern Control registers --------------------------------------------------*/
|
/* Pattern Control registers --------------------------------------------------*/
|
||||||
|
|
||||||
|
Binary file not shown.
@ -21,6 +21,7 @@
|
|||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
int initError = OK;
|
int initError = OK;
|
||||||
int initCheckDone = 0;
|
int initCheckDone = 0;
|
||||||
@ -846,6 +847,43 @@ void calcChecksum(udp_header* udp) {
|
|||||||
udp->ip_checksum = checksum;
|
udp->ip_checksum = checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setDetectorPosition(int pos[]) {
|
||||||
|
memcpy(detPos, pos, sizeof(detPos));
|
||||||
|
|
||||||
|
uint32_t addr = COORD_0_REG;
|
||||||
|
int value = 0;
|
||||||
|
int valueRead = 0;
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
|
// row
|
||||||
|
value = detPos[X];
|
||||||
|
bus_w(addr, (bus_r(addr) &~COORD_ROW_MSK) | ((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
||||||
|
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
||||||
|
if (valueRead != value) {
|
||||||
|
FILE_LOG(logERROR, ("Could not set row. Set %d, read %d\n", value, valueRead));
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// col
|
||||||
|
value = detPos[Y];
|
||||||
|
bus_w(addr, (bus_r(addr) &~COORD_COL_MSK) | ((value << COORD_COL_OFST) & COORD_COL_MSK));
|
||||||
|
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
||||||
|
if (valueRead != value) {
|
||||||
|
FILE_LOG(logERROR, ("Could not set column. Set %d, read %d\n", value, valueRead));
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == OK) {
|
||||||
|
FILE_LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int* getDetectorPosition() {
|
||||||
|
return detPos;
|
||||||
|
}
|
||||||
|
|
||||||
/* pattern */
|
/* pattern */
|
||||||
|
|
||||||
uint64_t readPatternWord(int addr) {
|
uint64_t readPatternWord(int addr) {
|
||||||
@ -1063,6 +1101,22 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPatternMask(uint64_t mask) {
|
||||||
|
set64BitReg(mask, PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t getPatternMask() {
|
||||||
|
return get64BitReg(PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPatternBitMask(uint64_t mask) {
|
||||||
|
set64BitReg(mask, PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t getPatternBitMask() {
|
||||||
|
return get64BitReg(PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
int checkDetectorType() {
|
int checkDetectorType() {
|
||||||
FILE_LOG(logINFO, ("Checking type of module\n"));
|
FILE_LOG(logINFO, ("Checking type of module\n"));
|
||||||
FILE* fd = fopen(TYPE_FILE_NAME, "r");
|
FILE* fd = fopen(TYPE_FILE_NAME, "r");
|
||||||
@ -1291,15 +1345,6 @@ int getClockDivider(enum CLKINDEX ind) {
|
|||||||
|
|
||||||
/* aquisition */
|
/* aquisition */
|
||||||
|
|
||||||
int setDetectorPosition(int pos[]) {
|
|
||||||
memcpy(detPos, pos, sizeof(detPos));
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int* getDetectorPosition() {
|
|
||||||
return detPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
// create udp socket
|
// create udp socket
|
||||||
@ -1338,8 +1383,21 @@ void* start_timer(void* arg) {
|
|||||||
getNumTriggers() );
|
getNumTriggers() );
|
||||||
int64_t exp_ns = getExpTime();
|
int64_t exp_ns = getExpTime();
|
||||||
|
|
||||||
|
int imagesize = calculateDataBytes();
|
||||||
|
int datasize = imagesize / PACKETS_PER_FRAME;
|
||||||
|
int packetsize = datasize + sizeof(sls_detector_header);
|
||||||
|
|
||||||
int frameNr = 0;
|
// Generate data
|
||||||
|
char imageData[imagesize];
|
||||||
|
memset(imageData, 0, imagesize);
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for (i = 0; i < imagesize; i += sizeof(uint8_t)) {
|
||||||
|
*((uint8_t*)(imageData + i)) = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int frameNr = 1;
|
||||||
// loop over number of frames
|
// loop over number of frames
|
||||||
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
|
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||||
|
|
||||||
@ -1347,13 +1405,42 @@ void* start_timer(void* arg) {
|
|||||||
if(virtual_stop == 1){
|
if(virtual_stop == 1){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int srcOffset = 0;
|
||||||
|
|
||||||
// sleep for exposure time
|
// sleep for exposure time
|
||||||
struct timespec begin, end;
|
struct timespec begin, end;
|
||||||
clock_gettime(CLOCK_REALTIME, &begin);
|
clock_gettime(CLOCK_REALTIME, &begin);
|
||||||
usleep(exp_ns / 1000);
|
usleep(exp_ns / 1000);
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
|
||||||
|
// loop packet
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for(i = 0; i!=PACKETS_PER_FRAME; ++i) {
|
||||||
|
char packetData[packetsize];
|
||||||
|
memset(packetData, 0, packetsize);
|
||||||
|
|
||||||
|
// set header
|
||||||
|
sls_detector_header* header = (sls_detector_header*)(packetData);
|
||||||
|
header->frameNumber = frameNr + 1;
|
||||||
|
header->packetNumber = i;
|
||||||
|
header->modId = 0;
|
||||||
|
header->row = detPos[X];
|
||||||
|
header->column = detPos[Y];
|
||||||
|
header->detType = (uint16_t)myDetectorType;
|
||||||
|
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||||
|
|
||||||
|
// fill data
|
||||||
|
memcpy(packetData + sizeof(sls_detector_header), imageData + srcOffset, datasize);
|
||||||
|
srcOffset += datasize;
|
||||||
|
|
||||||
|
sendUDPPacket(0, packetData, packetsize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||||
|
|
||||||
// calculate time left in period
|
// calculate time left in period
|
||||||
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||||
(end.tv_nsec - begin.tv_nsec));
|
(end.tv_nsec - begin.tv_nsec));
|
||||||
|
|
||||||
@ -1468,14 +1555,22 @@ u_int32_t runBusy() {
|
|||||||
return virtual_status;
|
return virtual_status;
|
||||||
#endif
|
#endif
|
||||||
u_int32_t s = (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK);
|
u_int32_t s = (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK);
|
||||||
FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
//FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
|
|
||||||
int calculateDataBytes() {
|
int calculateDataBytes() {
|
||||||
return 0;
|
int numCounters = __builtin_popcount(getCounterMask());
|
||||||
|
int dr = setDynamicRange(-1);
|
||||||
|
int databytes = NCHAN_1_COUNTER * NCHIP * numCounters *
|
||||||
|
((dr > 16) ? 4 : // 32 bit
|
||||||
|
((dr > 8) ? 2 : // 16 bit
|
||||||
|
((dr > 4) ? 0.5 : // 4 bit
|
||||||
|
0.125))); // 1 bit
|
||||||
|
|
||||||
|
return databytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
/* Hardware Definitions */
|
/* Hardware Definitions */
|
||||||
#define NCOUNTERS (3)
|
#define NCOUNTERS (3)
|
||||||
#define MAX_COUNTER_MSK (0x7)
|
#define MAX_COUNTER_MSK (0x7)
|
||||||
|
#define NCHAN_1_COUNTER (128)
|
||||||
#define NCHAN (128 * NCOUNTERS)
|
#define NCHAN (128 * NCOUNTERS)
|
||||||
#define NCHIP (10)
|
#define NCHIP (10)
|
||||||
#define NDAC (16)
|
#define NDAC (16)
|
||||||
@ -96,3 +97,4 @@ typedef struct udp_header_struct {
|
|||||||
uint16_t udp_destport;
|
uint16_t udp_destport;
|
||||||
} udp_header;
|
} udp_header;
|
||||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||||
|
#define PACKETS_PER_FRAME (2)
|
||||||
|
@ -437,6 +437,10 @@ uint64_t writePatternWord(int addr, uint64_t word);
|
|||||||
int setPatternWaitAddress(int level, int addr);
|
int setPatternWaitAddress(int level, int addr);
|
||||||
uint64_t setPatternWaitTime(int level, uint64_t t);
|
uint64_t setPatternWaitTime(int level, uint64_t t);
|
||||||
void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop);
|
void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop);
|
||||||
|
void setPatternMask(uint64_t mask);
|
||||||
|
uint64_t getPatternMask();
|
||||||
|
void setPatternBitMask(uint64_t mask);
|
||||||
|
uint64_t getPatternBitMask();
|
||||||
int checkDetectorType();
|
int checkDetectorType();
|
||||||
int powerChip (int on);
|
int powerChip (int on);
|
||||||
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
||||||
@ -470,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) {
|
||||||
@ -1000,8 +996,8 @@ int set_dac(int file_des) {
|
|||||||
case VCOM_CDS:
|
case VCOM_CDS:
|
||||||
serverDacIndex = G2_VCOM_CDS;
|
serverDacIndex = G2_VCOM_CDS;
|
||||||
break;
|
break;
|
||||||
case VREF_RESTORE:
|
case VREF_RSTORE:
|
||||||
serverDacIndex = G2_VREF_RESTORE;
|
serverDacIndex = G2_VREF_RSTORE;
|
||||||
break;
|
break;
|
||||||
case VB_OPA_1ST:
|
case VB_OPA_1ST:
|
||||||
serverDacIndex = G2_VB_OPA_1ST;
|
serverDacIndex = G2_VB_OPA_1ST;
|
||||||
@ -3199,7 +3195,7 @@ int set_pattern_mask(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Set Pattern Mask to %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Set Pattern Mask to %d\n", arg));
|
||||||
|
|
||||||
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
#if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
@ -3220,7 +3216,7 @@ int get_pattern_mask(int file_des) {
|
|||||||
|
|
||||||
FILE_LOG(logDEBUG1, ("Get Pattern Mask\n"));
|
FILE_LOG(logDEBUG1, ("Get Pattern Mask\n"));
|
||||||
|
|
||||||
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
#if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only get
|
// only get
|
||||||
@ -3240,7 +3236,7 @@ int set_pattern_bit_mask(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Set Pattern Bit Mask to %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Set Pattern Bit Mask to %d\n", arg));
|
||||||
|
|
||||||
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
#if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
@ -3261,7 +3257,7 @@ int get_pattern_bit_mask(int file_des){
|
|||||||
|
|
||||||
FILE_LOG(logDEBUG1, ("Get Pattern Bit Mask\n"));
|
FILE_LOG(logDEBUG1, ("Get Pattern Bit Mask\n"));
|
||||||
|
|
||||||
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
#if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only get
|
// only get
|
||||||
@ -6499,24 +6495,37 @@ 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:
|
||||||
|
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));
|
FILE_LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||||
}
|
}
|
||||||
@ -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 = {});
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
@ -1115,52 +1109,54 @@ class Detector {
|
|||||||
/** [CTB] */
|
/** [CTB] */
|
||||||
void setPatternClockControl(uint64_t word, Positions pos = {});
|
void setPatternClockControl(uint64_t word, Positions pos = {});
|
||||||
|
|
||||||
/** [Mythen3][CTB] same as executing for CTB */
|
/** [CTB] same as executing
|
||||||
|
* [Mythen3] */
|
||||||
Result<uint64_t> getPatternWord(int addr, Positions pos = {});
|
Result<uint64_t> getPatternWord(int addr, Positions pos = {});
|
||||||
|
|
||||||
/** [Mythen3][CTB] Caution: If word is -1 reads the addr (same as
|
/** [CTB] Caution: If word is -1 reads the addr (same as
|
||||||
* executing the pattern) */
|
* executing the pattern)
|
||||||
|
* [Mythen3] */
|
||||||
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
||||||
|
|
||||||
/** [Mythen3][CTB] Options: level: -1 (complete pattern) and 0-2 levels
|
/**[CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
|
||||||
* @returns array of start address and stop address
|
* @returns array of start address and stop address
|
||||||
*/
|
*/
|
||||||
Result<std::array<int, 2>> getPatternLoopAddresses(int level,
|
Result<std::array<int, 2>> getPatternLoopAddresses(int level,
|
||||||
Positions pos = {}) const;
|
Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Mythen3][CTB] Options: level: -1 (complete pattern) and 0-2 levels */
|
/** [CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels */
|
||||||
void setPatternLoopAddresses(int level, int start, int stop, Positions pos = {});
|
void setPatternLoopAddresses(int level, int start, int stop, Positions pos = {});
|
||||||
|
|
||||||
/** [Mythen3][CTB] Options: level: -1 (complete pattern) and 0-2 levels
|
/**[CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
|
||||||
* @returns number of loops
|
* @returns number of loops
|
||||||
*/
|
*/
|
||||||
Result<int> getPatternLoopCycles(int level, Positions pos = {}) const;
|
Result<int> getPatternLoopCycles(int level, Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Mythen3][CTB] n: 0-2, level: -1 (complete pattern) and 0-2 levels */
|
/** [CTB][Mythen3] n: 0-2, level: -1 (complete pattern) and 0-2 levels */
|
||||||
void setPatternLoopCycles(int level, int n, Positions pos = {});
|
void setPatternLoopCycles(int level, int n, Positions pos = {});
|
||||||
|
|
||||||
/* [Mythen3][CTB] */
|
/* [CTB][Mythen3] */
|
||||||
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
|
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Mythen3][CTB] Options: level 0-2 */
|
/** [CTB][Mythen3] Options: level 0-2 */
|
||||||
void setPatternWaitAddr(int level, int addr, Positions pos = {});
|
void setPatternWaitAddr(int level, int addr, Positions pos = {});
|
||||||
|
|
||||||
/** [Mythen3][CTB] */
|
/** [CTB][Mythen3] */
|
||||||
Result<uint64_t> getPatternWaitTime(int level, Positions pos = {}) const;
|
Result<uint64_t> getPatternWaitTime(int level, Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Mythen3][CTB] Options: level 0-2 */
|
/** [CTB][Mythen3] Options: level 0-2 */
|
||||||
void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
|
void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB][Mythen3] */
|
||||||
Result<uint64_t> getPatternMask(Positions pos = {});
|
Result<uint64_t> getPatternMask(Positions pos = {});
|
||||||
|
|
||||||
/** [CTB] Sets the mask applied to every pattern to the selected bit mask */
|
/** [CTB][Mythen3] Sets the mask applied to every pattern to the selected bit mask */
|
||||||
void setPatternMask(uint64_t mask, Positions pos = {});
|
void setPatternMask(uint64_t mask, Positions pos = {});
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB][Mythen3] */
|
||||||
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
|
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB] Sets the bitmask that the mask will be applied to for every
|
/** [CTB][Mythen3] Sets the bitmask that the mask will be applied to for every
|
||||||
* pattern
|
* pattern
|
||||||
*/
|
*/
|
||||||
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
||||||
|
@ -697,7 +697,7 @@ std::vector<std::string> CmdProxy::DacCommands() {
|
|||||||
case defs::GOTTHARD2:
|
case defs::GOTTHARD2:
|
||||||
return std::vector<std::string>{
|
return std::vector<std::string>{
|
||||||
"vref_h_adc", "vb_comp_fe", "vb_comp_adc", "vcom_cds",
|
"vref_h_adc", "vb_comp_fe", "vb_comp_adc", "vcom_cds",
|
||||||
"vref_restore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1",
|
"vref_rstore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1",
|
||||||
"vref_prech", "vref_l_adc", "vref_cds", "vb_cs",
|
"vref_prech", "vref_l_adc", "vref_cds", "vb_cs",
|
||||||
"vb_opa_fd", "vcom_adc2"};
|
"vb_opa_fd", "vcom_adc2"};
|
||||||
break;
|
break;
|
||||||
@ -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) {
|
||||||
@ -1471,7 +1516,7 @@ std::string CmdProxy::PatternWord(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[step or address] [64 bit mask]\n\t[Mythen3][Ctb] 64 bit pattern at "
|
os << "[step or address] [64 bit mask]\n\t[Ctb][Mythen3] 64 bit pattern at "
|
||||||
"address of pattern memory."
|
"address of pattern memory."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -1497,17 +1542,17 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patlimits") {
|
if (cmd == "patlimits") {
|
||||||
os << "[start addr] [stop addr] \n\t[Mythen3][Ctb] Limits of complete "
|
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of complete "
|
||||||
"pattern."
|
"pattern."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop0") {
|
} else if (cmd == "patloop0") {
|
||||||
os << "[start addr] [stop addr] \n\t[Mythen3][Ctb] Limits of loop 0."
|
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of loop 0."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop1") {
|
} else if (cmd == "patloop1") {
|
||||||
os << "[start addr] [stop addr] \n\t[Mythen3][Ctb] Limits of loop 1."
|
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of loop 1."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop2") {
|
} else if (cmd == "patloop2") {
|
||||||
os << "[start addr] [stop addr] \n\t[Mythen3][Ctb] Limits of loop 2."
|
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of loop 2."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
@ -1552,11 +1597,11 @@ std::string CmdProxy::PatternLoopCycles(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patnloop0") {
|
if (cmd == "patnloop0") {
|
||||||
os << "[n_cycles] \n\t[Mythen3][Ctb] Number of cycles of loop 0." << '\n';
|
os << "[n_cycles] \n\t[Ctb][Mythen3] Number of cycles of loop 0." << '\n';
|
||||||
} else if (cmd == "patnloop1") {
|
} else if (cmd == "patnloop1") {
|
||||||
os << "[n_cycles] \n\t[Mythen3][Ctb] Number of cycles of loop 1." << '\n';
|
os << "[n_cycles] \n\t[Ctb][Mythen3] Number of cycles of loop 1." << '\n';
|
||||||
} else if (cmd == "patnloop2") {
|
} else if (cmd == "patnloop2") {
|
||||||
os << "[n_cycles] \n\t[Mythen3][Ctb] Number of cycles of loop 2." << '\n';
|
os << "[n_cycles] \n\t[Ctb][Mythen3] Number of cycles of loop 2." << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"Unknown command, use list to list all commands");
|
"Unknown command, use list to list all commands");
|
||||||
@ -1597,11 +1642,11 @@ std::string CmdProxy::PatternWaitAddress(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patwait0") {
|
if (cmd == "patwait0") {
|
||||||
os << "[addr] \n\t[Mythen3][Ctb] Wait 0 address." << '\n';
|
os << "[addr] \n\t[Ctb][Mythen3] Wait 0 address." << '\n';
|
||||||
} else if (cmd == "patwait1") {
|
} else if (cmd == "patwait1") {
|
||||||
os << "[addr] \n\t[Mythen3][Ctb] Wait 1 address." << '\n';
|
os << "[addr] \n\t[Ctb][Mythen3] Wait 1 address." << '\n';
|
||||||
} else if (cmd == "patwait2") {
|
} else if (cmd == "patwait2") {
|
||||||
os << "[addr] \n\t[Mythen3][Ctb] Wait 2 address." << '\n';
|
os << "[addr] \n\t[Ctb][Mythen3] Wait 2 address." << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"Unknown command, use list to list all commands");
|
"Unknown command, use list to list all commands");
|
||||||
@ -1642,11 +1687,11 @@ std::string CmdProxy::PatternWaitTime(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patwaittime0") {
|
if (cmd == "patwaittime0") {
|
||||||
os << "[n_clk] \n\t[Mythen3][Ctb] Wait 0 time in clock cycles." << '\n';
|
os << "[n_clk] \n\t[Ctb][Mythen3] Wait 0 time in clock cycles." << '\n';
|
||||||
} else if (cmd == "patwaittime1") {
|
} else if (cmd == "patwaittime1") {
|
||||||
os << "[n_clk] \n\t[Mythen3][Ctb] Wait 1 time in clock cycles." << '\n';
|
os << "[n_clk] \n\t[Ctb][Mythen3] Wait 1 time in clock cycles." << '\n';
|
||||||
} else if (cmd == "patwaittime2") {
|
} else if (cmd == "patwaittime2") {
|
||||||
os << "[n_clk] \n\t[Mythen3][Ctb] Wait 2 time in clock cycles." << '\n';
|
os << "[n_clk] \n\t[Ctb][Mythen3] Wait 2 time in clock cycles." << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"Unknown command, use list to list all commands");
|
"Unknown command, use list to list all commands");
|
||||||
|
@ -648,7 +648,7 @@ class CmdProxy {
|
|||||||
{"vb_comp_fe", &CmdProxy::vb_comp_fe},
|
{"vb_comp_fe", &CmdProxy::vb_comp_fe},
|
||||||
{"vb_comp_adc", &CmdProxy::vb_comp_adc},
|
{"vb_comp_adc", &CmdProxy::vb_comp_adc},
|
||||||
{"vcom_cds", &CmdProxy::vcom_cds},
|
{"vcom_cds", &CmdProxy::vcom_cds},
|
||||||
{"vref_restore", &CmdProxy::vref_restore},
|
{"vref_rstore", &CmdProxy::vref_rstore},
|
||||||
{"vb_opa_1st", &CmdProxy::vb_opa_1st},
|
{"vb_opa_1st", &CmdProxy::vb_opa_1st},
|
||||||
{"vref_comp_fe", &CmdProxy::vref_comp_fe},
|
{"vref_comp_fe", &CmdProxy::vref_comp_fe},
|
||||||
{"vcom_adc1", &CmdProxy::vcom_adc1},
|
{"vcom_adc1", &CmdProxy::vcom_adc1},
|
||||||
@ -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 */
|
||||||
@ -1231,7 +1231,7 @@ class CmdProxy {
|
|||||||
DAC_COMMAND(vcom_cds, getDAC, setDAC, defs::VCOM_CDS,
|
DAC_COMMAND(vcom_cds, getDAC, setDAC, defs::VCOM_CDS,
|
||||||
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for common mode voltage of CDS stage.");
|
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for common mode voltage of CDS stage.");
|
||||||
|
|
||||||
DAC_COMMAND(vref_restore, getDAC, setDAC, defs::VREF_RESTORE,
|
DAC_COMMAND(vref_rstore, getDAC, setDAC, defs::VREF_RSTORE,
|
||||||
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for reference charging voltage of temparory storage cell in high gain.");
|
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for reference charging voltage of temparory storage cell in high gain.");
|
||||||
|
|
||||||
DAC_COMMAND(vb_opa_1st, getDAC, setDAC, defs::VB_OPA_1ST,
|
DAC_COMMAND(vb_opa_1st, getDAC, setDAC, defs::VB_OPA_1ST,
|
||||||
@ -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 */
|
||||||
@ -1679,10 +1673,10 @@ class CmdProxy {
|
|||||||
"[64 bit mask]\n\t[Ctb] 64 bit mask defining output clock enable.");
|
"[64 bit mask]\n\t[Ctb] 64 bit mask defining output clock enable.");
|
||||||
|
|
||||||
INTEGER_COMMAND_HEX(patmask, getPatternMask, setPatternMask, stoulHex,
|
INTEGER_COMMAND_HEX(patmask, getPatternMask, setPatternMask, stoulHex,
|
||||||
"[64 bit mask]\n\t[Ctb] 64 bit mask applied to every pattern. Only these bits for each pattern will be masked against.");
|
"[64 bit mask]\n\t[Ctb][Mythen3] 64 bit mask applied to every pattern. Only these bits for each pattern will be masked against.");
|
||||||
|
|
||||||
INTEGER_COMMAND_HEX(patsetbit, getPatternBitMask, setPatternBitMask, stoulHex,
|
INTEGER_COMMAND_HEX(patsetbit, getPatternBitMask, setPatternBitMask, stoulHex,
|
||||||
"[64 bit mask]\n\t[Ctb] 64 bit values applied to the selected patmask for every pattern.");
|
"[64 bit mask]\n\t[Ctb][Mythen3] 64 bit values applied to the selected patmask for every pattern.");
|
||||||
|
|
||||||
/* Moench */
|
/* Moench */
|
||||||
|
|
||||||
|
@ -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)
|
||||||
@ -1764,16 +1758,16 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
uint64_t setPatternClockControl(uint64_t word = -1);
|
uint64_t setPatternClockControl(uint64_t word = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes a pattern word (CTB/ Moench)
|
* Writes a pattern word (CTB/ Moench/ Mythen3)
|
||||||
* @param addr address of the word
|
* @param addr address of the word
|
||||||
* @param word 64bit word to be written, -1 reads the addr (same as
|
* @param word 64bit word to be written, -1 reads the addr (same as
|
||||||
* executing the pattern)
|
* executing the pattern for ctb)
|
||||||
* @returns actual value
|
* @returns actual value
|
||||||
*/
|
*/
|
||||||
uint64_t setPatternWord(int addr, uint64_t word);
|
uint64_t setPatternWord(int addr, uint64_t word);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the pattern or loop limits (CTB/ Moench)
|
* Sets the pattern or loop limits (CTB/ Moench/ Mythen3)
|
||||||
* @param level -1 complete pattern, 0,1,2, loop level
|
* @param level -1 complete pattern, 0,1,2, loop level
|
||||||
* @param start start address for level 0-2, -1 gets
|
* @param start start address for level 0-2, -1 gets
|
||||||
* @param stop stop address for level 0-2, -1 gets
|
* @param stop stop address for level 0-2, -1 gets
|
||||||
@ -1783,7 +1777,7 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
int stop = -1);
|
int stop = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the pattern or loop limits (CTB/ Moench)
|
* Sets the pattern or loop limits (CTB/ Moench/ Mythen3)
|
||||||
* @param level -1 complete pattern, 0,1,2, loop level
|
* @param level -1 complete pattern, 0,1,2, loop level
|
||||||
* @param n number of loops for level 0-2, -1 gets
|
* @param n number of loops for level 0-2, -1 gets
|
||||||
* @returns number of loops
|
* @returns number of loops
|
||||||
@ -1792,7 +1786,7 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the wait address (CTB/ Moench)
|
* Sets the wait address (CTB/ Moench/ Mythen3)
|
||||||
* @param level 0,1,2, wait level
|
* @param level 0,1,2, wait level
|
||||||
* @param addr wait address, -1 gets
|
* @param addr wait address, -1 gets
|
||||||
* @returns actual value
|
* @returns actual value
|
||||||
@ -1800,7 +1794,7 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
int setPatternWaitAddr(int level, int addr = -1);
|
int setPatternWaitAddr(int level, int addr = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the wait time (CTB/ Moench)
|
* Sets the wait time (CTB/ Moench/ Mythen3)
|
||||||
* @param level 0,1,2, wait level
|
* @param level 0,1,2, wait level
|
||||||
* @param t wait time, -1 gets
|
* @param t wait time, -1 gets
|
||||||
* @returns actual value
|
* @returns actual value
|
||||||
@ -1808,27 +1802,27 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
uint64_t setPatternWaitTime(int level, uint64_t t = -1);
|
uint64_t setPatternWaitTime(int level, uint64_t t = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the mask applied to every pattern (CTB/ Moench)
|
* Sets the mask applied to every pattern (CTB/ Moench/ Mythen3)
|
||||||
* @param mask mask to be applied
|
* @param mask mask to be applied
|
||||||
*/
|
*/
|
||||||
void setPatternMask(uint64_t mask);
|
void setPatternMask(uint64_t mask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the mask applied to every pattern (CTB/ Moench)
|
* Gets the mask applied to every pattern (CTB/ Moench/ Mythen3)
|
||||||
* @returns mask set
|
* @returns mask set
|
||||||
*/
|
*/
|
||||||
uint64_t getPatternMask();
|
uint64_t getPatternMask();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects the bits that the mask will be applied to for every pattern (CTB/
|
* Selects the bits that the mask will be applied to for every pattern (CTB/
|
||||||
* Moench)
|
* Moench/ Mythen3)
|
||||||
* @param mask mask to select bits
|
* @param mask mask to select bits
|
||||||
*/
|
*/
|
||||||
void setPatternBitMask(uint64_t mask);
|
void setPatternBitMask(uint64_t mask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the bits that the mask will be applied to for every pattern (CTB/
|
* Gets the bits that the mask will be applied to for every pattern (CTB/
|
||||||
* Moench)
|
* Moench/ Mythen3)
|
||||||
* @returns mask of bits selected
|
* @returns mask of bits selected
|
||||||
*/
|
*/
|
||||||
uint64_t getPatternBitMask();
|
uint64_t getPatternBitMask();
|
||||||
|
@ -361,7 +361,7 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmd]") {
|
|||||||
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_restore", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
||||||
|
@ -69,7 +69,7 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs]") {
|
|||||||
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_restore", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
||||||
|
@ -311,7 +311,7 @@ TEST_CASE("type", "[.cmd]"){
|
|||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_fe", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_fe", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_adc", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_adc", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_cds", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_cds", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_restore", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vref_rstore", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_1st", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_1st", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_comp_fe", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vref_comp_fe", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc1", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc1", GET));
|
||||||
@ -474,7 +474,7 @@ TEST_CASE("type", "[.cmd]"){
|
|||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_fe", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_fe", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_adc", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_adc", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_cds", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_cds", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_restore", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vref_rstore", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_1st", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_1st", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_comp_fe", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vref_comp_fe", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc1", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc1", GET));
|
||||||
@ -557,7 +557,7 @@ TEST_CASE("type", "[.cmd]"){
|
|||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_fe", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_fe", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_adc", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_adc", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_cds", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_cds", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_restore", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vref_rstore", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_1st", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_1st", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_comp_fe", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vref_comp_fe", GET));
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc1", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc1", GET));
|
||||||
@ -634,17 +634,17 @@ TEST_CASE("type", "[.cmd]"){
|
|||||||
// std::to_string(prev_val), PUT));
|
// std::to_string(prev_val), PUT));
|
||||||
// {
|
// {
|
||||||
// std::ostringstream oss;
|
// std::ostringstream oss;
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_restore", GET,
|
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_rstore", GET,
|
||||||
// nullptr, oss)); std::string s = (oss.str()).erase (0,
|
// nullptr, oss)); std::string s = (oss.str()).erase (0,
|
||||||
// strlen("vref_restore ")); prev_val = std::stoi(s);
|
// strlen("vref_rstore ")); prev_val = std::stoi(s);
|
||||||
// }
|
// }
|
||||||
// {
|
// {
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_restore 1000",
|
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_rstore 1000",
|
||||||
// PUT)); std::ostringstream oss;
|
// PUT)); std::ostringstream oss;
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_restore", GET,
|
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_rstore", GET,
|
||||||
// nullptr, oss)); REQUIRE(oss.str() == "vref_restore 1000\n");
|
// nullptr, oss)); REQUIRE(oss.str() == "vref_rstore 1000\n");
|
||||||
// }
|
// }
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_restore " +
|
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_rstore " +
|
||||||
// std::to_string(prev_val), PUT));
|
// std::to_string(prev_val), PUT));
|
||||||
// {
|
// {
|
||||||
// std::ostringstream oss;
|
// std::ostringstream oss;
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ class slsDetectorDefs {
|
|||||||
VB_COMP_FE,
|
VB_COMP_FE,
|
||||||
VB_COMP_ADC,
|
VB_COMP_ADC,
|
||||||
VCOM_CDS,
|
VCOM_CDS,
|
||||||
VREF_RESTORE,
|
VREF_RSTORE,
|
||||||
VB_OPA_1ST,
|
VB_OPA_1ST,
|
||||||
VREF_COMP_FE,
|
VREF_COMP_FE,
|
||||||
VCOM_ADC1,
|
VCOM_ADC1,
|
||||||
@ -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";
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define APIMOENCH 0x190820
|
#define APIMOENCH 0x190820
|
||||||
#define APICTB 0x200122
|
#define APICTB 0x200122
|
||||||
#define APIGOTTHARD 0x200122
|
#define APIGOTTHARD 0x200122
|
||||||
#define APIGOTTHARD2 0x200122
|
|
||||||
#define APIEIGER 0x200122
|
|
||||||
#define APIJUNGFRAU 0x200122
|
#define APIJUNGFRAU 0x200122
|
||||||
#define APIMYTHEN3 0x200122
|
#define APIMYTHEN3 0x200122
|
||||||
|
#define APIEIGER 0x200122
|
||||||
|
#define APIGOTTHARD2 0x200123
|
||||||
|
Loading…
x
Reference in New Issue
Block a user