mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
Dev/xilinx acq (#901)
* period and exptime(patternwaittime level 0) * added new regsieterdefs and updated api version and fixedpattern reg * autogenerate commands * formatting * minor * wip resetflow, readout mode, transceiver mask, transceiver enable * acquisition, but streaming done bit and busy (exposing + read chip to fifo) not known yet from fw * programming fpga and device tree done * most configuration done, need to connect configuretransceiver to client * stuck at resetting transciever timed out * minor * fixed virtual, added chip busyto fifo, streaming busy, set/getnext framenumber * configuretransceiver from client, added help in client * make formatt and command generation * tests for xilinx ctb works * command generation * dacs added and tested, power not done * power added * added temp_fpga * binaries in * ctrlreg is 0 to enable chip=fixed, high dac val = min val= fixed, power regulators in weird order=fixed, device tree could be loaded with dacs before adcs=fixed * start works * virtual server sends * receiver works * tests * python function and enum generation, commands generatorn and autocomplete, formatting, tests * tests fail at start(transceiver not aligned) * tests passed * all binaries compiled * eiger binary in * added --nomodule cehck for xilinx
This commit is contained in:
@ -2247,6 +2247,46 @@ std::string Caller::config(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::configtransceiver(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: configtransceiver" << std::endl;
|
||||
os << R"V0G0N(
|
||||
[Xilinx Ctb] Waits for transceiver to be aligned. Chip had to be configured (powered on) before this. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (1 && args.size() != 0) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 0) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError(
|
||||
"INTERNAL ERROR: Invalid action: supported actions are ['PUT']");
|
||||
}
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (args.size() == 0) {
|
||||
det->configureTransceiver(std::vector<int>{det_id});
|
||||
os << "successful" << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::dac(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
@ -3161,7 +3201,7 @@ std::string Caller::delay(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: delay" << std::endl;
|
||||
os << R"V0G0N([duration] [(optional unit) ns|us|ms|s]
|
||||
[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Moench] Delay after trigger )V0G0N"
|
||||
[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Moench][Xilinx Ctb] Delay after trigger )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -3250,7 +3290,7 @@ std::string Caller::delayl(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: delayl" << std::endl;
|
||||
os << R"V0G0N(
|
||||
[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Delay Left in Acquisition.
|
||||
[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Delay Left in Acquisition.
|
||||
[Gotthard2] only in continuous mode. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
@ -3685,7 +3725,7 @@ std::string Caller::exptime(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: exptime" << std::endl;
|
||||
os << R"V0G0N([duration] [(optional unit) ns|us|ms|s]
|
||||
[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Ctb] Exposure time
|
||||
[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Ctb][Xilinx Ctb] Exposure time
|
||||
[Mythen3] Exposure time of all gate signals in auto and trigger mode (internal gating). To specify gate index, use exptime1, exptime2, exptime3. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
@ -4666,7 +4706,7 @@ std::string Caller::firmwaretest(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: firmwaretest" << std::endl;
|
||||
os << R"V0G0N(
|
||||
[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb] Firmware test, ie. reads a read fixed pattern from a register. )V0G0N"
|
||||
[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Firmware test, ie. reads a read fixed pattern from a register. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -5132,7 +5172,7 @@ std::string Caller::framecounter(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: framecounter" << std::endl;
|
||||
os << R"V0G0N(
|
||||
[Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Number of frames from start run control.
|
||||
[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Number of frames from start run control.
|
||||
[Gotthard2] only in continuous mode. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
@ -5283,7 +5323,7 @@ std::string Caller::frametime(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: frametime" << std::endl;
|
||||
os << R"V0G0N([(optional unit) ns|us|ms|s]
|
||||
[Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Timestamp at a frame start.
|
||||
[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Timestamp at a frame start.
|
||||
[Gotthard2] not in burst and auto mode. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
@ -7224,7 +7264,7 @@ std::string Caller::nextframenumber(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: nextframenumber" << std::endl;
|
||||
os << R"V0G0N([n_value]
|
||||
[Eiger][Jungfrau][Moench][Ctb] Next frame number. Stopping acquisition might result in different frame numbers for different modules. )V0G0N"
|
||||
[Eiger][Jungfrau][Moench][Ctb][Xilinx Ctb] Next frame number. Stopping acquisition might result in different frame numbers for different modules. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -9141,7 +9181,7 @@ std::string Caller::periodl(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: periodl" << std::endl;
|
||||
os << R"V0G0N(
|
||||
[Gotthard][Jungfrau][Moench][Ctb][Mythen3][Gotthard2] Period left for current frame.
|
||||
[Gotthard][Jungfrau][Moench][Ctb][Mythen3][Gotthard2][Xilinx Ctb] Period left for current frame.
|
||||
[Gotthard2] only in continuous mode. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
@ -9317,9 +9357,10 @@ std::string Caller::powerchip(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: powerchip" << std::endl;
|
||||
os << R"V0G0N([0, 1]
|
||||
[Jungfrau][Moench][Mythen3][Gotthard2] Power the chip.
|
||||
[Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb] Power the chip.
|
||||
[Jungfrau][Moench] Default is 0. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1)
|
||||
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail. )V0G0N"
|
||||
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.
|
||||
[Xilinx Ctb] Default is 0. Also configures the chip if powered on. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -10230,7 +10271,7 @@ std::string Caller::rebootcontroller(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: rebootcontroller" << std::endl;
|
||||
os << R"V0G0N(
|
||||
[Jungfrau][Moench][Ctb][Gotthard][Mythen3][Gotthard2] Reboot controller of detector. )V0G0N"
|
||||
[Jungfrau][Moench][Ctb][Gotthard][Mythen3][Gotthard2][Xilinx Ctb] Reboot controller of detector. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -10399,7 +10440,7 @@ std::string Caller::resetfpga(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: resetfpga" << std::endl;
|
||||
os << R"V0G0N(
|
||||
[Jungfrau][Moench][Ctb] Reset FPGA. )V0G0N"
|
||||
[Jungfrau][Moench][Ctb][Xilinx Ctb] Reset FPGA. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -10505,7 +10546,7 @@ std::string Caller::romode(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: romode" << std::endl;
|
||||
os << R"V0G0N([analog|digital|analog_digital|transceiver|digital_transceiver]
|
||||
[Ctb] Readout mode. Default is analog. )V0G0N"
|
||||
[Ctb][xilinx Ctb] Readout mode. [Ctb] Default is analog. [Xilinx Ctb] Default is Transceiver (only one implemented so far) )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -10696,7 +10737,7 @@ std::string Caller::runtime(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: runtime" << std::endl;
|
||||
os << R"V0G0N([(optional unit) ns|us|ms|s]
|
||||
[Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Time from detector start up.
|
||||
[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Time from detector start up.
|
||||
[Gotthard2] not in burst and auto mode. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
@ -13298,7 +13339,7 @@ std::string Caller::slowadcvalues(int action) {
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (args.size() == 0) {
|
||||
|
||||
std::string suffix = " mV";
|
||||
std::string suffix = " uV";
|
||||
auto t = det->getSlowADCList();
|
||||
|
||||
auto names = det->getSlowADCNames();
|
||||
@ -14215,7 +14256,7 @@ std::string Caller::temp_fpga(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: temp_fpga" << std::endl;
|
||||
os << R"V0G0N([n_value]
|
||||
[Eiger][Jungfrau][Moench][Gotthard][Mythen3][Gotthard2] FPGA Temperature )V0G0N"
|
||||
[Eiger][Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Xilinx CTB] FPGA Temperature )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -14960,7 +15001,7 @@ std::string Caller::transceiverenable(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: transceiverenable" << std::endl;
|
||||
os << R"V0G0N([bitmask]
|
||||
[Ctb] Transceiver Enable Mask. Enable for each 4 Transceiver channel. )V0G0N"
|
||||
[Ctb][Xilinx Ctb] Transceiver Enable Mask. Enable for each 4 Transceiver channel. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -15294,7 +15335,7 @@ std::string Caller::tsamples(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: tsamples" << std::endl;
|
||||
os << R"V0G0N([n_value]
|
||||
[Ctb] Number of transceiver samples expected. )V0G0N"
|
||||
[Ctb][Xilinx Ctb] Number of transceiver samples expected. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -16568,7 +16609,7 @@ std::string Caller::v_a(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: v_a" << std::endl;
|
||||
os << R"V0G0N([n_value]
|
||||
[Ctb] Power supply a in mV. )V0G0N"
|
||||
[Ctb][Xilinx Ctb] Power supply a in mV. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -16631,7 +16672,7 @@ std::string Caller::v_b(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: v_b" << std::endl;
|
||||
os << R"V0G0N([n_value]
|
||||
[Ctb] Power supply b in mV. )V0G0N"
|
||||
[Ctb][Xilinx Ctb] Power supply b in mV. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -16694,7 +16735,7 @@ std::string Caller::v_c(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: v_c" << std::endl;
|
||||
os << R"V0G0N([n_value]
|
||||
[Ctb] Power supply c in mV. )V0G0N"
|
||||
[Ctb][Xilinx Ctb] Power supply c in mV. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -16821,7 +16862,7 @@ std::string Caller::v_d(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: v_d" << std::endl;
|
||||
os << R"V0G0N([n_value]
|
||||
[Ctb] Power supply d in mV. )V0G0N"
|
||||
[Ctb][Xilinx Ctb] Power supply d in mV. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -16884,7 +16925,7 @@ std::string Caller::v_io(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: v_io" << std::endl;
|
||||
os << R"V0G0N([n_value]
|
||||
[Ctb] Power supply io in mV. Minimum 1200 mV. Must be the first power regulator to be set after fpga reset (on-board detector server start up). )V0G0N"
|
||||
[Ctb][Xilinx Ctb] Power supply io in mV. Minimum 1200 mV. Must be the first power regulator to be set after fpga reset (on-board detector server start up). )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@ -16947,7 +16988,7 @@ std::string Caller::v_limit(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << "Command: v_limit" << std::endl;
|
||||
os << R"V0G0N([n_value]
|
||||
[Ctb] Soft limit for power supplies (ctb only) and DACS in mV. )V0G0N"
|
||||
[Ctb][Xilinx Ctb] Soft limit for power supplies (ctb only) and DACS in mV. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ class Caller {
|
||||
std::string compdisabletime(int action);
|
||||
std::string confadc(int action);
|
||||
std::string config(int action);
|
||||
std::string configtransceiver(int action);
|
||||
std::string counters(int action);
|
||||
std::string currentsource(int action);
|
||||
std::string dac(int action);
|
||||
@ -435,6 +436,7 @@ class Caller {
|
||||
{"compdisabletime", &Caller::compdisabletime},
|
||||
{"confadc", &Caller::confadc},
|
||||
{"config", &Caller::config},
|
||||
{"configtransceiver", &Caller::configtransceiver},
|
||||
{"counters", &Caller::counters},
|
||||
{"currentsource", &Caller::currentsource},
|
||||
{"dac", &Caller::dac},
|
||||
|
@ -232,7 +232,6 @@ std::string Caller::acquire(int action) {
|
||||
if (det_id >= 0) {
|
||||
throw RuntimeError("Individual detectors not allowed for readout.");
|
||||
}
|
||||
|
||||
det->acquire();
|
||||
|
||||
if (det->getUseReceiverFlag().squash(false)) {
|
||||
|
@ -667,6 +667,7 @@ std::vector<defs::dacIndex> Detector::getTemperatureList() const {
|
||||
defs::TEMPERATURE_FPGA2, defs::TEMPERATURE_FPGA3};
|
||||
case defs::MYTHEN3:
|
||||
case defs::GOTTHARD2:
|
||||
case defs::XILINX_CHIPTESTBOARD:
|
||||
return std::vector<defs::dacIndex>{defs::TEMPERATURE_FPGA};
|
||||
default:
|
||||
return std::vector<defs::dacIndex>{};
|
||||
@ -697,6 +698,7 @@ Result<int> Detector::getTemperature(defs::dacIndex index,
|
||||
case defs::MOENCH:
|
||||
case defs::MYTHEN3:
|
||||
case defs::GOTTHARD2:
|
||||
case defs::XILINX_CHIPTESTBOARD:
|
||||
for (auto &it : res) {
|
||||
it /= 1000;
|
||||
}
|
||||
@ -2486,6 +2488,12 @@ std::string Detector::getSlowADCName(const defs::dacIndex i) const {
|
||||
return pimpl->getCtbSlowADCName(i);
|
||||
}
|
||||
|
||||
// Xilinx Ctb Specific
|
||||
|
||||
void Detector::configureTransceiver(Positions pos) {
|
||||
pimpl->Parallel(&Module::configureTransceiver, pos);
|
||||
}
|
||||
|
||||
// Pattern
|
||||
|
||||
Result<std::string> Detector::getPatterFileName(Positions pos) const {
|
||||
|
@ -1375,7 +1375,7 @@ void DetectorImpl::stopDetector(Positions pos) {
|
||||
|
||||
void DetectorImpl::printProgress(double progress) {
|
||||
// spaces for python printout
|
||||
std::cout << " " << std::fixed << std::setprecision(2) << std::setw(6)
|
||||
std::cout << " " << std::fixed << std::setprecision(2) << std::setw(10)
|
||||
<< progress << " \%";
|
||||
std::cout << '\r' << std::flush;
|
||||
}
|
||||
|
@ -2383,6 +2383,7 @@ void Module::setNumberOfAnalogSamples(int value) {
|
||||
// update #nchan, as it depends on #samples, adcmask
|
||||
updateNumberOfChannels();
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logINFORED) << "receiver up!";
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr);
|
||||
}
|
||||
}
|
||||
@ -2531,6 +2532,13 @@ void Module::setLEDEnable(bool enable) {
|
||||
sendToDetector<int>(F_LED, static_cast<int>(enable));
|
||||
}
|
||||
|
||||
// Xilinx Ctb Specific
|
||||
void Module::configureTransceiver() {
|
||||
sendToDetector(F_CONFIG_TRANSCEIVER);
|
||||
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
||||
<< "): Transceiver configured successfully!";
|
||||
}
|
||||
|
||||
// Pattern
|
||||
std::string Module::getPatterFileName() const {
|
||||
char retval[MAX_STR_LENGTH]{};
|
||||
|
@ -528,6 +528,13 @@ class Module : public virtual slsDetectorDefs {
|
||||
bool getLEDEnable() const;
|
||||
void setLEDEnable(bool enable);
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Xilinx Ctb Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
void configureTransceiver();
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Pattern *
|
||||
|
@ -562,6 +562,18 @@ int InferAction::config() {
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::configtransceiver() {
|
||||
|
||||
if (args.size() == 0) {
|
||||
return slsDetectorDefs::PUT_ACTION;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::counters() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: counters. Use "
|
||||
|
@ -48,6 +48,7 @@ class InferAction {
|
||||
int compdisabletime();
|
||||
int confadc();
|
||||
int config();
|
||||
int configtransceiver();
|
||||
int counters();
|
||||
int currentsource();
|
||||
int dac();
|
||||
@ -381,6 +382,7 @@ class InferAction {
|
||||
{"compdisabletime", &InferAction::compdisabletime},
|
||||
{"confadc", &InferAction::confadc},
|
||||
{"config", &InferAction::config},
|
||||
{"configtransceiver", &InferAction::configtransceiver},
|
||||
{"counters", &InferAction::counters},
|
||||
{"currentsource", &InferAction::currentsource},
|
||||
{"dac", &InferAction::dac},
|
||||
|
Reference in New Issue
Block a user