changing g_108MHz enum to g2_108MHZ (similarly 144), adding readoutspeedlist command

This commit is contained in:
maliakal_d 2021-10-08 11:05:25 +02:00
parent b1ae47d189
commit 417bfbaf38
12 changed files with 37 additions and 20 deletions

View File

@ -1650,7 +1650,10 @@ class Detector(CppDetectorApi):
[Eiger][Jungfrau|Gotthard2] Readout speed of chip. Enum: speedLevel
Note
-----
[Jungfrau] FULL_SPEED option only available from v2.0 boards and with setting number of interfaces to 2. \n
[Jungfrau] FULL_SPEED, HALF_SPEED (Default), QUARTER_SPEED
[Eiger] FULL_SPEED (Default), HALF_SPEED, QUARTER_SPEED
[Gottthard2] G2_108MHZ (Default), G2_144MHZ
[Jungfrau] FULL_SPEED option only available from v2.0 boards and is recommended to set number of interfaces to 2. \n
Also overwrites adcphase to recommended default.
"""
return element_if_equal(self.getReadoutSpeed())

View File

@ -250,8 +250,8 @@ void init_enums(py::module &m) {
.value("FULL_SPEED", slsDetectorDefs::speedLevel::FULL_SPEED)
.value("HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
.value("G_108MHZ", slsDetectorDefs::speedLevel::G_108MHZ)
.value("G_144MHZ", slsDetectorDefs::speedLevel::G_144MHZ)
.value("G2_108MHZ", slsDetectorDefs::speedLevel::G2_108MHZ)
.value("G2_144MHZ", slsDetectorDefs::speedLevel::G2_144MHZ)
.export_values();
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")

View File

@ -2086,7 +2086,7 @@ int getVCOFrequency(enum CLKINDEX ind) {
int setReadoutSpeed(int val) {
switch (val) {
case G_108MHZ:
case G2_108MHZ:
LOG(logINFOBLUE, ("Setting readout speed to 108 MHz\n"));
if (setClockDivider(READOUT_C0, SPEED_108_CLKDIV_0) == FAIL) {
return FAIL;
@ -2098,7 +2098,7 @@ int setReadoutSpeed(int val) {
return FAIL;
}
break;
case G_144MHZ:
case G2_144MHZ:
LOG(logINFOBLUE, ("Setting readout speed to 144 MHz\n"));
if (setClockDivider(READOUT_C0, SPEED_144_CLKDIV_0) == FAIL) {
return FAIL;
@ -2123,13 +2123,13 @@ int getReadoutSpeed(int* retval) {
if (clkDivider[READOUT_C0] == SPEED_108_CLKDIV_0 &&
clkDivider[READOUT_C1] == SPEED_108_CLKDIV_1 &&
getPhase(READOUT_C1, 1) == SPEED_108_CLKPHASE_DEG_1) {
*retval = G_108MHZ;
*retval = G2_108MHZ;
}
else if (clkDivider[READOUT_C0] == SPEED_144_CLKDIV_0 &&
clkDivider[READOUT_C1] == SPEED_144_CLKDIV_1 &&
getPhase(READOUT_C1, 1) == SPEED_144_CLKPHASE_DEG_1) {
*retval = G_144MHZ;
*retval = G2_144MHZ;
}
else {

View File

@ -59,7 +59,7 @@
#define DEFAULT_SYSTEM_C2 (5) //(144444448) // sync_clk, 144 MHz
#define DEFAULT_SYSTEM_C3 (5) //(144444448) // str_clk, 144 MHz
#define DEFAULT_READOUT_SPEED (G_108MHZ)
#define DEFAULT_READOUT_SPEED (G2_108MHZ)
#define SPEED_144_CLKDIV_0 (6)
#define SPEED_144_CLKDIV_1 (6)
#define SPEED_144_CLKPHASE_DEG_1 (122) // 125 not possible

View File

@ -9290,8 +9290,8 @@ int set_readout_speed(int file_des) {
case HALF_SPEED:
case QUARTER_SPEED:
#elif GOTTHARD2D
case G_108MHZ:
case G_144MHZ:
case G2_108MHZ:
case G2_144MHZ:
#endif
break;
default:

View File

@ -306,8 +306,9 @@ class Detector {
/** [Eiger][Jungfrau][Gotthard2]
* [Jungfrau] Options: FULL_SPEED, HALF_SPEED (Default), QUARTER_SPEED \n
* [Eiger] Options: FULL_SPEED (Default), HALF_SPEED, QUARTER_SPEED \n
* [Gotthard2] Options: G_108MHZ (Default), G_144MHZ \n
* [Jungfrau] FULL_SPEED option only available from v2.0 boards \n Also overwrites adcphase to
* [Gotthard2] Options: G2_108MHZ (Default), G2_144MHZ \n
* [Jungfrau] FULL_SPEED option only available from v2.0 boards and is
* recommended to set number of interfaces to 2. \n Also overwrites adcphase to
* recommended default.
*/
void setReadoutSpeed(defs::speedLevel value, Positions pos = {});

View File

@ -613,7 +613,8 @@ std::string CmdProxy::ReadoutSpeed(int action) {
"quarter_speed]\n\t\t[Eiger][Jungfrau] Readout "
"speed of chip.\n\t\t[Eiger] Default speed is full_speed."
"\n\t\t[Jungfrau] Default speed is half_speed. full_speed "
"option only available from v2.0 boards. Also overwrites "
"option only available from v2.0 boards and is recommended to set "
"number of interfaces to 2. Also overwrites "
"adcphase to recommended default.\n\t [144|108]\n\t\t[Gotthard2] "
"Readout speed of chip in MHz. Default is 108."
<< '\n';

View File

@ -794,6 +794,7 @@ class CmdProxy {
{"timing", &CmdProxy::timing},
{"timinglist", &CmdProxy::timinglist},
{"readoutspeed", &CmdProxy::ReadoutSpeed},
{"readoutspeedlist", &CmdProxy::readoutspeedlist},
{"adcphase", &CmdProxy::Adcphase},
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
{"dbitphase", &CmdProxy::Dbitphase},
@ -1329,6 +1330,10 @@ class CmdProxy {
GET_COMMAND_NOID(timinglist, getTimingModeList,
"\n\tGets the list of timing modes for this detector.");
GET_COMMAND_NOID(readoutspeedlist, getReadoutSpeedList,
"\n\tList of readout speed levels implemented for this detector.");
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
"ADC clock.");

View File

@ -429,8 +429,8 @@ std::vector<defs::speedLevel> Detector::getReadoutSpeedList() const {
defs::HALF_SPEED,
defs::QUARTER_SPEED};
case defs::GOTTHARD2:
return std::vector<defs::speedLevel>{defs::G_108MHZ,
defs::G_144MHZ};
return std::vector<defs::speedLevel>{defs::G2_108MHZ,
defs::G2_144MHZ};
default:
throw RuntimeError("Readout speed not implemented for this detector");
}

View File

@ -970,6 +970,13 @@ TEST_CASE("readoutspeed", "[.cmd]") {
}
}
TEST_CASE("readoutspeedlist", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
REQUIRE_NOTHROW(proxy.Call("readoutspeedlist", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("readoutspeedlist", {}, -1, PUT));
}
TEST_CASE("adcphase", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);

View File

@ -377,7 +377,7 @@ typedef struct {
enum readoutMode { ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL };
/** chip speed */
enum speedLevel { FULL_SPEED, HALF_SPEED, QUARTER_SPEED, G_108MHZ, G_144MHZ };
enum speedLevel { FULL_SPEED, HALF_SPEED, QUARTER_SPEED, G2_108MHZ, G2_144MHZ };
/**
* burst mode for gotthard2

View File

@ -247,9 +247,9 @@ std::string ToString(const defs::speedLevel s) {
return std::string("half_speed");
case defs::QUARTER_SPEED:
return std::string("quarter_speed");
case defs::G_108MHZ:
case defs::G2_108MHZ:
return std::string("108");
case defs::G_144MHZ:
case defs::G2_144MHZ:
return std::string("144");
default:
return std::string("Unknown");
@ -718,9 +718,9 @@ template <> defs::speedLevel StringTo(const std::string &s) {
if (s == "2")
return defs::QUARTER_SPEED;
if (s == "108")
return defs::G_108MHZ;
return defs::G2_108MHZ;
if (s == "144")
return defs::G_144MHZ;
return defs::G2_144MHZ;
throw sls::RuntimeError("Unknown speed " + s);
}