Merge branch 'developer' into eigerserverlock

This commit is contained in:
2020-09-21 17:28:38 +02:00
11 changed files with 295 additions and 119 deletions

View File

@ -122,7 +122,9 @@ std::string CmdProxy::Hostname(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "\n\tFrees shared memory and sets hostname (or IP address) of "
"all modules concatenated by +."
"all modules concatenated by +.\n\t Virtual servers can already "
"use the port in hostname separated by ':' and ports incremented "
"by 2 to accomodate the stop server as well."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
@ -220,8 +222,8 @@ std::string CmdProxy::FirmwareVersion(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "\n\tFimware version of detector in format [0xYYMMDD] or integer "
"for Eiger."
os << "\n\tFimware version of detector in format [0xYYMMDD] or an "
"increasing 2 digit number for Eiger."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
@ -315,9 +317,9 @@ std::string CmdProxy::DetectorSize(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[nx] [ny]\n\tDetector size, ie. Number of channels in x and y "
"dim. If 0, then hostname adds all modules in y dim. This is "
"used to calculate module coordinates included in UDP data "
"packet header."
"dim. This is used to calculate module coordinates included in "
"UDP data. \n\tBy default, it adds module in y dimension for 2d "
"detectors and in x dimension for 1d detectors packet header."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
@ -480,7 +482,8 @@ std::string CmdProxy::DynamicRange(int action) {
if (action == defs::HELP_ACTION) {
os << "[value]\n\tDynamic Range or number of bits per "
"pixel in detector.\n\t"
"[Eiger] Options: 4, 8, 16, 32\n\t"
"[Eiger] Options: 4, 8, 16, 32. If set to 32, also sets "
"clkdivider to 2, else to 0.\n\t"
"[Mythen3] Options: 8, 16, 32\n\t"
"[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16"
<< '\n';
@ -838,7 +841,7 @@ std::string CmdProxy::ExternalSignal(int action) {
"[trigger_in_rising_edge|trigger_in_falling_edge|inversion_on|"
"inversion_off]\n\t where 0 is master input trigger signal, 1-3 "
"is master input gate signals, 4 is busy out signal and 5-7 is "
"master output gate signals"
"master output gate signals."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (args.size() != 1) {
@ -1584,7 +1587,7 @@ std::string CmdProxy::ClearROI(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "\n\t[Gotthard] Resets Region of interest in detector. All "
"channels enabled. Default is all channels."
"channels enabled. Default is all channels enabled."
<< '\n';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get");
@ -2450,10 +2453,9 @@ std::string CmdProxy::CopyDetectorServer(int action) {
if (action == defs::HELP_ACTION) {
os << "[server_name] "
"[pc_host_name]\n\t[Jungfrau][Ctb][Moench][Mythen3][Gotthard2] "
"Copies "
"detector "
"server via tftp from pc and changes respawn server name in "
"/etc/inittab of detector."
"Copies detector server via tftp from pc. "
"\n\t[Jungfrau][Ctb][Moench]Also changes respawn server, which "
"is effective after a reboot."
<< '\n';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get");
@ -2554,16 +2556,13 @@ std::string CmdProxy::BitOperations(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "setbit") {
os << "[address] [value\n\t[Moench] Minimum energy threshold (soft "
"setting) for processor."
os << "[reg address in hex] [bit index]\n\tSets bit in address."
<< '\n';
} else if (cmd == "clearbit") {
os << "[n_value]\n\t[Moench] Maximum energy threshold (soft "
"setting) for processor."
os << "[reg address in hex] [bit index]\n\tClears bit in address."
<< '\n';
} else if (cmd == "getbit") {
os << "[n_value]\n\t[Moench] Maximum energy threshold (soft "
"setting) for processor."
os << "[reg address in hex] [bit index]\n\tGets bit in address."
<< '\n';
} else {
throw sls::RuntimeError(
@ -2587,12 +2586,8 @@ std::string CmdProxy::BitOperations(int action) {
if (cmd == "setbit" || cmd == "clearbit") {
throw sls::RuntimeError("Cannot get");
}
auto t = det->readRegister(addr, std::vector<int>{det_id});
Result<int> result(t.size());
for (unsigned int i = 0; i < t.size(); ++i) {
result[i] = ((t[i] >> bitnr) & 0x1);
}
os << OutString(result) << '\n';
auto t = det->getBit(addr, bitnr, std::vector<int>{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (cmd == "getbit") {
throw sls::RuntimeError("Cannot put");
@ -2617,7 +2612,8 @@ std::string CmdProxy::InitialChecks(int action) {
os << "[0, 1]\n\tEnable or disable intial compatibility and other "
"checks at detector start up. It is enabled by default. Must "
"come before 'hostname' command to take effect. Can be used to "
"reprogram fpga when current firmware is incompatible."
"reprogram fpga when current firmware is "
"incompatible.\n\tAdvanced User function!"
<< '\n';
} else if (action == defs::GET_ACTION) {
if (det_id != -1) {
@ -2651,7 +2647,8 @@ std::string CmdProxy::ExecuteCommand(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[command]\n\tExecutes command on detector server." << '\n';
os << "[command]\n\tExecutes command on detector server console."
<< '\n';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get.");
} else if (action == defs::PUT_ACTION) {

View File

@ -597,6 +597,7 @@ class CmdProxy {
{"detectorversion", "firmwareversion"},
{"softwareversion", "detectorserverversion"},
{"receiverversion", "rx_version"},
{"detectornumber", "serialnumber"},
{"thisversion", "clientversion"},
{"detsizechan", "detsize"},
@ -703,7 +704,7 @@ class CmdProxy {
{"firmwareversion", &CmdProxy::FirmwareVersion},
{"detectorserverversion", &CmdProxy::detectorserverversion},
{"rx_version", &CmdProxy::rx_version},
{"detectornumber", &CmdProxy::detectornumber},
{"serialnumber", &CmdProxy::serialnumber},
{"type", &CmdProxy::type},
{"nmod", &CmdProxy::nmod},
{"detsize", &CmdProxy::DetectorSize},
@ -1176,8 +1177,8 @@ class CmdProxy {
GET_COMMAND_HEX(rx_version, getReceiverVersion,
"\n\tReceiver version in format [0xYYMMDD].");
GET_COMMAND_HEX(detectornumber, getSerialNumber,
"\n\tReceiver version in format [0xYYMMDD].");
GET_COMMAND_HEX(serialnumber, getSerialNumber,
"\n\tSerial number of detector.");
GET_COMMAND(type, getDetectorType,
"\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "
@ -1222,8 +1223,8 @@ class CmdProxy {
INTEGER_COMMAND_NOID(
frames, getNumberOfFrames, setNumberOfFrames, StringTo<int64_t>,
"[n_frames]\n\tNumber of frames per acquisition. In "
"trigger mode, number of frames per trigger. Cannot be set in modular "
"level. In scan mode, number of frames is set to number of "
"trigger mode, number of frames per trigger. \n\tCannot be set in "
"modular level. \n\tIn scan mode, number of frames is set to number of "
"steps.\n\t[Gotthard2] Burst mode has a maximum of 2720 frames.");
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
@ -1587,7 +1588,8 @@ class CmdProxy {
DAC_COMMAND(
adcvpp, getDAC, setDAC, defs::ADC_VPP,
"[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V.");
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
"\n\tAdvanced User function! ");
DAC_COMMAND(vb_ds, getDAC, setDAC, defs::VB_DS,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
@ -1667,9 +1669,10 @@ class CmdProxy {
/* acquisition */
EXECUTE_SET_COMMAND_NOID(clearbusy, clearAcquiringFlag,
"\n\tClears Acquiring Flag for unexpected acquire "
"command terminations.");
EXECUTE_SET_COMMAND_NOID(
clearbusy, clearAcquiringFlag,
"\n\tIf acquisition aborted during acquire command, use this to clear "
"acquiring flag in shared memory before starting next acquisition");
EXECUTE_SET_COMMAND_NOID(
rx_start, startReceiver,
@ -1899,10 +1902,10 @@ class CmdProxy {
"[binary|hdf5]\n\tFile format of data file. For HDF5, package must be "
"compiled with HDF5 flags. Default is binary.");
STRING_COMMAND(
fpath, getFilePath, setFilePath,
"[path]\n\tDirectory where output data files are written in receiver. "
"If path does not exist, it will try to create it.");
STRING_COMMAND(fpath, getFilePath, setFilePath,
"[path]\n\tDirectory where output data files are written in "
"receiver. Default is '/'. \n\tIf path does not exist, it "
"will try to create it.");
STRING_COMMAND(fname, getFileNamePrefix, setFileNamePrefix,
"[name]\n\tFile name prefix for output data file. Default "
@ -2012,8 +2015,9 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID(
flippeddatax, getBottom, setBottom, StringTo<int>,
"[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 "
"is top. Used to let Receivers and Gui know to flip the bottom image "
"over the x axis. Files are not written without the flip however.");
"is top. Used to let Gui (via zmq from receiver) know to flip the "
"bottom image over the x axis. Files are not written without the flip "
"however.");
INTEGER_COMMAND_VEC_ID(
readnlines, getPartialReadout, setPartialReadout, StringTo<int>,
@ -2105,9 +2109,10 @@ class CmdProxy {
"timing mode and burst mode. Use timing command to set timing mode and "
"burstmode command to set burst mode.");
TIME_COMMAND(burstperiod, getBurstPeriod, setBurstPeriod,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst "
"period. Only in burst mode and auto timing mode.");
TIME_COMMAND(
burstperiod, getBurstPeriod, setBurstPeriod,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] "
"Period between 2 bursts. Only in burst mode and auto timing mode.");
INTEGER_COMMAND_VEC_ID(
cdsgain, getCDSGain, setCDSGain, StringTo<bool>,
@ -2169,13 +2174,13 @@ class CmdProxy {
INTEGER_COMMAND_HEX(adcenable, getADCEnableMask, setADCEnableMask,
StringTo<uint32_t>,
"[bitmask]\n\t[Ctb][Moench] ADC Enable Mask for 1Gb "
"Mode for each 32 ADC channel.");
"Enable for each 32 ADC channel.");
INTEGER_COMMAND_HEX(
adcenable10g, getTenGigaADCEnableMask, setTenGigaADCEnableMask,
StringTo<uint32_t>,
"[bitmask]\n\t[Ctb][Moench] ADC Enable Mask for 10Gb mode for each 32 "
"ADC channel. However, if any of consecutive 4 bits are enabled, the "
"ADC channel. However, if any of a consecutive 4 bits are enabled, the "
"complete 4 bits are enabled.");
/* CTB Specific */
@ -2258,8 +2263,8 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID(
extsampling, getExternalSampling, setExternalSampling, StringTo<int>,
"[0, 1]\n\t[Ctb] Enable for external sampling signal to extsamplingsrc "
"signal for digital data. For advanced users only.");
"[0, 1]\n\t[Ctb] Enable for external sampling signal for digital data "
"to signal by extsampling src command. For advanced users only.");
INTEGER_COMMAND_VEC_ID(
extsamplingsrc, getExternalSamplingSource, setExternalSamplingSource,
@ -2319,7 +2324,8 @@ class CmdProxy {
EXECUTE_SET_COMMAND(
bustest, executeBusTest,
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb][Moench] Bus test, "
"ie. keeps writing and reading back different values in R/W register.");
"ie. Writes different values in a R/W register and confirms the "
"writes to check bus.\n\tAdvanced User function!");
INTEGER_COMMAND_HEX(
adcinvert, getADCInvert, setADCInvert, StringTo<uint32_t>,
@ -2355,13 +2361,13 @@ class CmdProxy {
"[(optional unit) "
"ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench]["
"CTB] Time from detector start up."
"\n\t[Gotthard2] only in continuous mode.");
"\n\t[Gotthard2] not in burst and auto mode.");
TIME_GET_COMMAND(timestamp, getMeasurementTime,
"[(optional unit) "
"ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench]["
"CTB] Timestamp at a frame start."
"\n\t[Gotthard2] only in continuous mode.");
"\n\t[Gotthard2] not in burst and auto mode.");
GET_COMMAND(
rx_frameindex, getRxCurrentFrameIndex,

View File

@ -384,7 +384,6 @@ Result<int> Detector::getClockFrequency(int clkIndex, Positions pos) {
return pimpl->Parallel(&Module::getClockFrequency, pos, clkIndex);
}
Result<int> Detector::getClockPhase(int clkIndex, Positions pos) {
return pimpl->Parallel(&Module::getClockPhase, pos, clkIndex, false);
}
@ -1883,6 +1882,10 @@ void Detector::clearBit(uint32_t addr, int bitnr, Positions pos) {
pimpl->Parallel(&Module::clearBit, pos, addr, bitnr);
}
Result<int> Detector::getBit(uint32_t addr, int bitnr, Positions pos) {
return pimpl->Parallel(&Module::getBit, pos, addr, bitnr);
}
void Detector::executeFirmwareTest(Positions pos) {
pimpl->Parallel(&Module::executeFirmwareTest, pos);
}

View File

@ -2195,21 +2195,29 @@ uint32_t Module::writeRegister(uint32_t addr, uint32_t val) {
return sendToDetectorStop<uint32_t>(F_WRITE_REGISTER, args);
}
uint32_t Module::setBit(uint32_t addr, int n) {
void Module::setBit(uint32_t addr, int n) {
if (n < 0 || n > 31) {
throw RuntimeError("Bit number " + std::to_string(n) + " out of Range");
} else {
uint32_t val = readRegister(addr);
return writeRegister(addr, val | 1 << n);
writeRegister(addr, val | 1 << n);
}
}
uint32_t Module::clearBit(uint32_t addr, int n) {
void Module::clearBit(uint32_t addr, int n) {
if (n < 0 || n > 31) {
throw RuntimeError("Bit number " + std::to_string(n) + " out of Range");
} else {
uint32_t val = readRegister(addr);
return writeRegister(addr, val & ~(1 << n));
writeRegister(addr, val & ~(1 << n));
}
}
int Module::getBit(uint32_t addr, int n) {
if (n < 0 || n > 31) {
throw RuntimeError("Bit number " + std::to_string(n) + " out of Range");
} else {
return ((readRegister(addr) >> n) & 0x1);
}
}

View File

@ -497,8 +497,9 @@ class Module : public virtual slsDetectorDefs {
void rebootController();
uint32_t readRegister(uint32_t addr) const;
uint32_t writeRegister(uint32_t addr, uint32_t val);
uint32_t setBit(uint32_t addr, int n);
uint32_t clearBit(uint32_t addr, int n);
void setBit(uint32_t addr, int n);
void clearBit(uint32_t addr, int n);
int getBit(uint32_t addr, int n);
void executeFirmwareTest();
void executeBusTest();
void writeAdcRegister(uint32_t addr, uint32_t val);