Jungfraufix (#84)

* jungfrau: added dbitphase, different pll clkindex 0 with different wr bit
This commit is contained in:
Dhanya Thattil
2020-03-04 17:06:18 +01:00
committed by GitHub
parent 4e2f685b76
commit c64b09ee79
12 changed files with 179 additions and 125 deletions

View File

@ -209,6 +209,21 @@ class Detector {
/** [Gotthard][Jungfrau][CTB][Moench] */
void setADCPhaseInDegrees(int value, Positions pos = {});
/** [CTB][Jungfrau] */
Result<int> getDBITPhase(Positions pos = {}) const;
/** [CTB][Jungfrau] */
void setDBITPhase(int value, Positions pos = {});
/** [CTB][Jungfrau] */
Result<int> getMaxDBITPhaseShift(Positions pos = {}) const;
/** [CTB][Jungfrau] */
Result<int> getDBITPhaseInDegrees(Positions pos = {}) const;
/** [CTB][Jungfrau] */
void setDBITPhaseInDegrees(int value, Positions pos = {});
/** [Mythen3][Gotthard2] Hz */
Result<int> getClockFrequency(int clkIndex, Positions pos = {});
@ -1035,21 +1050,6 @@ class Detector {
/** [CTB] */
void setDBITClock(int value_in_MHz, Positions pos = {});
/** [CTB] */
Result<int> getDBITPhase(Positions pos = {}) const;
/** [CTB] */
void setDBITPhase(int value, Positions pos = {});
/** [CTB] */
Result<int> getMaxDBITPhaseShift(Positions pos = {}) const;
/** [CTB] */
Result<int> getDBITPhaseInDegrees(Positions pos = {}) const;
/** [CTB] */
void setDBITPhaseInDegrees(int value, Positions pos = {});
/** [CTB] */
Result<int> getDBITPipeline(Positions pos = {}) const;

View File

@ -438,6 +438,50 @@ std::string CmdProxy::Adcphase(int action) {
return os.str();
}
std::string CmdProxy::Dbitphase(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[n_value] [(optional)deg]\n\t[Ctb][Jungfrau] Phase shift of clock to "
"latch digital bits. Absolute phase shift. If deg used, then "
"shift in degrees. \n\t[Ctb]Changing dbitclk also resets dbitphase and "
"sets to previous values."
<< '\n';
} else if (action == defs::GET_ACTION) {
Result<int> t;
if (args.empty()) {
t = det->getDBITPhase({det_id});
os << OutString(t) << '\n';
} else if (args.size() == 1) {
if (args[0] != "deg") {
throw sls::RuntimeError("Unknown dbitphase argument " +
args[0] + ". Did you mean deg?");
}
t = det->getDBITPhaseInDegrees({det_id});
os << OutString(t) << " deg\n";
} else {
WrongNumberOfParameters(0);
}
} else if (action == defs::PUT_ACTION) {
if (args.size() == 1) {
det->setDBITPhase(std::stoi(args[0]), {det_id});
os << args.front() << '\n';
} else if (args.size() == 2) {
if (args[1] != "deg") {
throw sls::RuntimeError("Unknown dbitphase 2nd argument " +
args[1] + ". Did you mean deg?");
}
det->setDBITPhaseInDegrees(std::stoi(args[0]), {det_id});
os << args[0] << args[1] << '\n';
} else {
WrongNumberOfParameters(1);
}
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::ClockFrequency(int action) {
std::ostringstream os;
os << cmd << ' ';
@ -1366,50 +1410,6 @@ std::string CmdProxy::Samples(int action) {
/* CTB Specific */
std::string CmdProxy::Dbitphase(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[n_value] [(optional)deg]\n\t[Ctb] Phase shift of clock to "
"latch digital bits. Absolute phase shift. If deg used, then "
"shift in degrees. Changing dbitclk also resets dbitphase and "
"sets to previous values."
<< '\n';
} else if (action == defs::GET_ACTION) {
Result<int> t;
if (args.empty()) {
t = det->getDBITPhase({det_id});
os << OutString(t) << '\n';
} else if (args.size() == 1) {
if (args[0] != "deg") {
throw sls::RuntimeError("Unknown dbitphase argument " +
args[0] + ". Did you mean deg?");
}
t = det->getDBITPhaseInDegrees({det_id});
os << OutString(t) << " deg\n";
} else {
WrongNumberOfParameters(0);
}
} else if (action == defs::PUT_ACTION) {
if (args.size() == 1) {
det->setDBITPhase(std::stoi(args[0]), {det_id});
os << args.front() << '\n';
} else if (args.size() == 2) {
if (args[1] != "deg") {
throw sls::RuntimeError("Unknown dbitphase 2nd argument " +
args[1] + ". Did you mean deg?");
}
det->setDBITPhaseInDegrees(std::stoi(args[0]), {det_id});
os << args[0] << args[1] << '\n';
} else {
WrongNumberOfParameters(1);
}
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::SlowAdc(int action) {
std::ostringstream os;
os << cmd << ' ';

View File

@ -585,6 +585,8 @@ class CmdProxy {
{"speed", &CmdProxy::Speed},
{"adcphase", &CmdProxy::Adcphase},
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
{"dbitphase", &CmdProxy::Dbitphase},
{"maxdbitphaseshift", &CmdProxy::maxdbitphaseshift},
{"clkfreq", &CmdProxy::ClockFrequency},
{"clkphase", &CmdProxy::ClockPhase},
{"maxclkphaseshift", &CmdProxy::MaxClockPhaseShift},
@ -817,8 +819,6 @@ class CmdProxy {
{"dsamples", &CmdProxy::dsamples},
{"romode", &CmdProxy::romode},
{"dbitclk", &CmdProxy::dbitclk},
{"dbitphase", &CmdProxy::Dbitphase},
{"maxdbitphaseshift", &CmdProxy::maxdbitphaseshift},
{"dbitpipeline", &CmdProxy::dbitpipeline},
{"v_a", &CmdProxy::v_a},
{"v_b", &CmdProxy::v_b},
@ -923,6 +923,7 @@ class CmdProxy {
std::string acquire(int action);
std::string Speed(int action);
std::string Adcphase(int action);
std::string Dbitphase(int action);
std::string ClockFrequency(int action);
std::string ClockPhase(int action);
std::string MaxClockPhaseShift(int action);
@ -966,7 +967,6 @@ class CmdProxy {
/* CTB/ Moench Specific */
std::string Samples(int action);
/* CTB Specific */
std::string Dbitphase(int action);
std::string SlowAdc(int action);
std::string ReceiverDbitList(int action);
std::string DigitalIODelay(int action);
@ -1074,6 +1074,9 @@ class CmdProxy {
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of ADC clock.");
GET_COMMAND(maxdbitphaseshift, getMaxDBITPhaseShift,
"\n\t[CTB][Jungfrau] Absolute maximum Phase shift of of the clock to latch digital bits.");
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, std::stoi,
"[n_value]\n\tHigh voltage to the sensor in Voltage."
"\n\t[Gotthard] [0|90|110|120|150|180|200]"
@ -1640,9 +1643,6 @@ class CmdProxy {
INTEGER_COMMAND(dbitclk, getDBITClock, setDBITClock, std::stoi,
"[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.");
GET_COMMAND(maxdbitphaseshift, getMaxDBITPhaseShift,
"\n\t[CTB] Absolute maximum Phase shift of of the clock to latch digital bits.");
INTEGER_COMMAND(dbitpipeline, getDBITPipeline, setDBITPipeline, std::stoi,
"[n_value]\n\t[Ctb] Pipeline of the clock for latching digital bits.");

View File

@ -273,6 +273,31 @@ void Detector::setADCPhaseInDegrees(int value, Positions pos) {
true);
}
Result<int> Detector::getDBITPhase(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
false);
}
void Detector::setDBITPhase(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
false);
}
Result<int> Detector::getMaxDBITPhaseShift(Positions pos) const {
return pimpl->Parallel(&slsDetector::getMaxClockPhaseShift, pos,
defs::DBIT_CLOCK);
}
Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
true);
}
void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
true);
}
Result<int> Detector::getClockFrequency(int clkIndex, Positions pos) {
return pimpl->Parallel(&slsDetector::getClockFrequency, pos, clkIndex);
}
@ -1355,32 +1380,6 @@ void Detector::setDBITClock(int value_in_MHz, Positions pos) {
value_in_MHz);
}
Result<int> Detector::getDBITPhase(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
false);
}
void Detector::setDBITPhase(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
false);
}
Result<int> Detector::getMaxDBITPhaseShift(Positions pos) const {
return pimpl->Parallel(&slsDetector::getMaxClockPhaseShift, pos,
defs::DBIT_CLOCK);
}
Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClockPhase, pos, defs::DBIT_CLOCK,
true);
}
void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setClockPhase, pos, defs::DBIT_CLOCK, value,
true);
}
void Detector::setDBITPipeline(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setPipeline, pos, defs::DBIT_CLOCK, value);
}