mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
updates on servers (mainly virtual): indices, dbit clock not allowed for moench anymore
This commit is contained in:
parent
03af145ee8
commit
f2dd146e56
@ -1386,12 +1386,6 @@ int getADC(enum ADCINDEX ind){
|
||||
|
||||
|
||||
int setHighVoltage(int val){
|
||||
#ifdef VIRTUAL
|
||||
if (val >= 0)
|
||||
highvoltage = val;
|
||||
return highvoltage;
|
||||
#endif
|
||||
|
||||
// setting hv
|
||||
if (val >= 0) {
|
||||
LOG(logINFO, ("Setting High voltage: %d V\n", val));
|
||||
@ -1400,7 +1394,7 @@ int setHighVoltage(int val){
|
||||
// switch to external high voltage
|
||||
bus_w(addr, bus_r(addr) & (~POWER_HV_INTERNAL_SLCT_MSK));
|
||||
|
||||
MAX1932_Set(val);
|
||||
MAX1932_Set(&val);
|
||||
|
||||
// switch on internal high voltage, if set
|
||||
if (val > 0)
|
||||
|
@ -388,7 +388,6 @@ void setupDetector() {
|
||||
}
|
||||
|
||||
|
||||
#ifndef VIRTUAL
|
||||
// pll defines
|
||||
ALTERA_PLL_C10_SetDefines(REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL, PLL_RESET_REG, PLL_RESET_REG, PLL_RESET_READOUT_MSK, PLL_RESET_SYSTEM_MSK, READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
ALTERA_PLL_C10_ResetPLL(READOUT_PLL);
|
||||
@ -399,7 +398,6 @@ void setupDetector() {
|
||||
LTC2620_D_SetDefines(DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC);
|
||||
// on chip dacs
|
||||
ASIC_Driver_SetDefines(ONCHIP_DAC_DRIVER_FILE_NAME);
|
||||
#endif
|
||||
setTimingSource(DEFAULT_TIMING_SOURCE);
|
||||
|
||||
// Default values
|
||||
|
@ -921,16 +921,10 @@ int getADC(enum ADCINDEX ind){
|
||||
|
||||
|
||||
int setHighVoltage(int val){
|
||||
#ifdef VIRTUAL
|
||||
if (val >= 0)
|
||||
highvoltage = val;
|
||||
return highvoltage;
|
||||
#endif
|
||||
|
||||
// setting hv
|
||||
if (val >= 0) {
|
||||
LOG(logINFO, ("Setting High voltage: %d V", val));
|
||||
MAX1932_Set(val);
|
||||
MAX1932_Set(&val);
|
||||
highvoltage = val;
|
||||
}
|
||||
return highvoltage;
|
||||
|
@ -1049,12 +1049,6 @@ void setVLimit(int l) {
|
||||
|
||||
|
||||
int setHighVoltage(int val){
|
||||
#ifdef VIRTUAL
|
||||
if (val >= 0)
|
||||
highvoltage = val;
|
||||
return highvoltage;
|
||||
#endif
|
||||
|
||||
// setting hv
|
||||
if (val >= 0) {
|
||||
LOG(logINFO, ("Setting High voltage: %d V\n", val));
|
||||
@ -1063,7 +1057,7 @@ int setHighVoltage(int val){
|
||||
// switch to external high voltage
|
||||
bus_w(addr, bus_r(addr) & (~POWER_HV_INTERNAL_SLCT_MSK));
|
||||
|
||||
MAX1932_Set(val);
|
||||
MAX1932_Set(&val);
|
||||
|
||||
// switch on internal high voltage, if set
|
||||
if (val > 0)
|
||||
|
@ -349,7 +349,6 @@ void setupDetector() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef VIRTUAL
|
||||
// pll defines
|
||||
ALTERA_PLL_C10_SetDefines(REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL, PLL_RESET_REG, PLL_RESET_REG, PLL_RESET_READOUT_MSK, PLL_RESET_SYSTEM_MSK, READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
ALTERA_PLL_C10_ResetPLL(READOUT_PLL);
|
||||
@ -358,7 +357,6 @@ void setupDetector() {
|
||||
DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME);
|
||||
//dac
|
||||
LTC2620_D_SetDefines(DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC);
|
||||
#endif
|
||||
|
||||
resetCore();
|
||||
resetPeripheral();
|
||||
|
@ -21,11 +21,11 @@ void MAX1932_SetDefines(uint32_t reg, uint32_t cmsk, uint32_t clkmsk, uint32_t d
|
||||
void MAX1932_Disable();
|
||||
|
||||
/**
|
||||
* Set value
|
||||
* @param val value to set
|
||||
* Set value (value is updated to correct range)
|
||||
* @param val pointer to value to set
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int MAX1932_Set (int val) ;
|
||||
int MAX1932_Set (int* val) ;
|
||||
|
||||
|
||||
|
||||
|
@ -42,9 +42,7 @@ int ASIC_Driver_Set (int index, int length, char* buffer) {
|
||||
LOG(logDEBUG2, ("\t]\n"));
|
||||
}
|
||||
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
#ifndef VIRTUAL
|
||||
int fd=open(fname, O_RDWR);
|
||||
if (fd == -1) {
|
||||
LOG(logERROR, ("Could not open file %s for writing to control ASIC (%d)\n", fname, index));
|
||||
@ -66,6 +64,7 @@ int ASIC_Driver_Set (int index, int length, char* buffer) {
|
||||
return FAIL;
|
||||
}
|
||||
close(fd);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ int DAC6571_Set (int val) {
|
||||
|
||||
LOG(logINFO, ("\t%dV (dacval %d)\n", val, dacvalue));
|
||||
|
||||
#ifndef VIRTUAL
|
||||
//open file
|
||||
FILE* fd=fopen(DAC6571_DriverFileName,"w");
|
||||
if (fd==NULL) {
|
||||
@ -45,6 +46,7 @@ int DAC6571_Set (int val) {
|
||||
//convert to string, add 0 and write to file
|
||||
fprintf(fd, "%d\n", dacvalue);
|
||||
fclose(fd);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -72,6 +72,8 @@ int LTC2620_D_SetDACValue (int dacnum, int val, int mV, char* dacname, int* dacv
|
||||
if ( (*dacval >= 0) || (*dacval == LTC2620_D_PWR_DOWN_VAL)) {
|
||||
LOG(logINFO, ("Setting DAC %2d [%-12s] : %d dac (%d mV)\n",dacnum, dacname, *dacval, dacmV));
|
||||
|
||||
|
||||
#ifndef VIRTUAL
|
||||
char fname[MAX_STR_LENGTH];
|
||||
strcpy(fname, LTC2620_D_DriverFileName);
|
||||
char temp[20];
|
||||
@ -89,6 +91,8 @@ int LTC2620_D_SetDACValue (int dacnum, int val, int mV, char* dacname, int* dacv
|
||||
//convert to string, add 0 and write to file
|
||||
fprintf(fd, "%d\n", *dacval);
|
||||
fclose(fd);
|
||||
#endif
|
||||
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
@ -43,33 +43,33 @@ void MAX1932_Disable() {
|
||||
& ~(MAX1932_DigMask));
|
||||
}
|
||||
|
||||
int MAX1932_Set (int val) {
|
||||
LOG(logDEBUG1, ("Setting high voltage to %d\n", val));
|
||||
if (val < 0)
|
||||
int MAX1932_Set (int* val) {
|
||||
LOG(logDEBUG1, ("Setting high voltage to %d\n", *val));
|
||||
if (*val < 0)
|
||||
return FAIL;
|
||||
|
||||
int dacvalue = 0;
|
||||
|
||||
// limit values (normally < 60 => 0 (off))
|
||||
if (val < MAX1932_MinVoltage) {
|
||||
if (*val < MAX1932_MinVoltage) {
|
||||
dacvalue = MAX1932_POWER_OFF_DAC_VAL;
|
||||
val = 0;
|
||||
*val = 0;
|
||||
}
|
||||
// limit values (normally > 200 => 0x1 (max))
|
||||
else if (val > MAX1932_MaxVoltage) {
|
||||
else if (*val > MAX1932_MaxVoltage) {
|
||||
dacvalue = MAX1932_MAX_DAC_VAL;
|
||||
val = MAX1932_MaxVoltage;
|
||||
*val = MAX1932_MaxVoltage;
|
||||
}
|
||||
// convert value
|
||||
else {
|
||||
// no failure in conversion as limits handled (range from 0x1 to 0xFF)
|
||||
ConvertToDifferentRange(MAX1932_MinVoltage, MAX1932_MaxVoltage,
|
||||
MAX1932_MIN_DAC_VAL, MAX1932_MAX_DAC_VAL,
|
||||
val, &dacvalue);
|
||||
*val, &dacvalue);
|
||||
dacvalue &= MAX1932_HV_DATA_MSK;
|
||||
}
|
||||
|
||||
LOG(logINFO, ("\t%dV (dacval %d)\n", val, dacvalue));
|
||||
LOG(logINFO, ("\t%dV (dacval %d)\n", *val, dacvalue));
|
||||
serializeToSPI(MAX1932_Reg, dacvalue, MAX1932_CsMask, MAX1932_HV_NUMBITS,
|
||||
MAX1932_ClkMask, MAX1932_DigMask, MAX1932_DigOffset, 0);
|
||||
return OK;
|
||||
|
@ -5804,9 +5804,11 @@ int set_clock_frequency(int file_des) {
|
||||
case ADC_CLOCK:
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#ifdef CHIPTESTBOARDD
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
#endif
|
||||
case RUN_CLOCK:
|
||||
c = RUN_CLK;
|
||||
break;
|
||||
@ -5860,9 +5862,11 @@ int get_clock_frequency(int file_des) {
|
||||
case ADC_CLOCK:
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#ifdef CHIPTESTBOARDD
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
#endif
|
||||
case RUN_CLOCK:
|
||||
c = RUN_CLK;
|
||||
break;
|
||||
@ -5916,14 +5920,14 @@ int set_clock_phase(int file_des) {
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(JUNGFRAUD)
|
||||
#if defined(CHIPTESTBOARDD) || defined(JUNGFRAUD)
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
#if defined(GOTTHARD2D) || defined(MYTHEN3D)
|
||||
if (c < NUM_CLOCKS) {
|
||||
if (ind < NUM_CLOCKS) {
|
||||
c = (enum CLKINDEX)ind;
|
||||
break;
|
||||
}
|
||||
@ -5995,7 +5999,7 @@ int get_clock_phase(int file_des) {
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Getting clock (%d) phase %s \n", args[0], (args[1] == 0 ? "" : "in degrees")));
|
||||
LOG(logINFOBLUE, ("Getting clock (%d) phase %s \n", args[0], (args[1] == 0 ? "" : "in degrees")));
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(JUNGFRAUD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
@ -6009,14 +6013,17 @@ int get_clock_phase(int file_des) {
|
||||
case ADC_CLOCK:
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(JUNGFRAUD)
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
#if defined(GOTTHARD2D) || defined(MYTHEN3D)
|
||||
if (c < NUM_CLOCKS) {
|
||||
if (ind < NUM_CLOCKS) {
|
||||
c = (enum CLKINDEX)ind;
|
||||
LOG(logINFOBLUE, ("NUMclocks:%d c:%d\n", NUM_CLOCKS, c));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -6053,13 +6060,15 @@ int get_max_clock_phase_shift(int file_des) {
|
||||
case ADC_CLOCK:
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(JUNGFRAUD)
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
#if defined(GOTTHARD2D) || defined(MYTHEN3D)
|
||||
if (c < NUM_CLOCKS) {
|
||||
if (arg < NUM_CLOCKS) {
|
||||
c = (enum CLKINDEX)arg;
|
||||
break;
|
||||
}
|
||||
@ -6104,7 +6113,7 @@ int set_clock_divider(int file_des) {
|
||||
default:
|
||||
// any clock index
|
||||
#if defined(GOTTHARD2D) || defined(MYTHEN3D)
|
||||
if (c < NUM_CLOCKS) {
|
||||
if (ind < NUM_CLOCKS) {
|
||||
c = (enum CLKINDEX)ind;
|
||||
break;
|
||||
}
|
||||
@ -6187,7 +6196,7 @@ int get_clock_divider(int file_des) {
|
||||
#endif
|
||||
default:
|
||||
#if defined(GOTTHARD2D) || defined(MYTHEN3D)
|
||||
if (c < NUM_CLOCKS) {
|
||||
if (arg < NUM_CLOCKS) {
|
||||
c = (enum CLKINDEX)arg;
|
||||
break;
|
||||
}
|
||||
@ -6272,9 +6281,11 @@ int get_pipeline(int file_des) {
|
||||
case ADC_CLOCK:
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#ifdef CHIPTESTBOARDD
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
modeNotImplemented("clock index (pipeline get)", arg);
|
||||
break;
|
||||
|
@ -402,37 +402,45 @@ std::string CmdProxy::Adcphase(int action) {
|
||||
"resets adcphase and sets it to previous values.\n\t[Gotthard] "
|
||||
"Relative phase shift"
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
Result<int> t;
|
||||
if (args.empty()) {
|
||||
t = det->getADCPhase({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
if (args[0] != "deg") {
|
||||
throw sls::RuntimeError("Unknown adcphase argument " + args[0] +
|
||||
". Did you mean deg?");
|
||||
} else {
|
||||
auto det_type = det->getDetectorType().squash(defs::GENERIC);
|
||||
if (det_type == defs::EIGER ||
|
||||
det_type == defs::MYTHEN3 ||
|
||||
det_type == defs::GOTTHARD2) {
|
||||
throw sls::RuntimeError("adcphase not implemented for this detector");
|
||||
}
|
||||
t = det->getADCPhaseInDegrees({det_id});
|
||||
os << OutString(t) << " deg\n";
|
||||
} else {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setADCPhase(StringTo<int>(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else if (args.size() == 2) {
|
||||
if (args[1] != "deg") {
|
||||
throw sls::RuntimeError("Unknown adcphase 2nd argument " +
|
||||
args[1] + ". Did you mean deg?");
|
||||
if (action == defs::GET_ACTION) {
|
||||
Result<int> t;
|
||||
if (args.empty()) {
|
||||
t = det->getADCPhase({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
if (args[0] != "deg") {
|
||||
throw sls::RuntimeError("Unknown adcphase argument " + args[0] +
|
||||
". Did you mean deg? ");
|
||||
}
|
||||
t = det->getADCPhaseInDegrees({det_id});
|
||||
os << OutString(t) << " deg\n";
|
||||
} else {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setADCPhase(StringTo<int>(args[0]), {det_id} );
|
||||
os << args.front() << '\n';
|
||||
} else if (args.size() == 2) {
|
||||
if (args[1] != "deg") {
|
||||
throw sls::RuntimeError("Unknown adcphase 2nd argument " +
|
||||
args[1] + ". Did you mean deg?");
|
||||
}
|
||||
det->setADCPhaseInDegrees(StringTo<int>(args[0]) , {det_id});
|
||||
os << args[0] << " " << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setADCPhaseInDegrees(StringTo<int>(args[0]), {det_id});
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
@ -446,37 +454,45 @@ std::string CmdProxy::Dbitphase(int action) {
|
||||
"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 {
|
||||
auto det_type = det->getDetectorType().squash(defs::GENERIC);
|
||||
if (det_type == defs::EIGER ||
|
||||
det_type == defs::MYTHEN3 ||
|
||||
det_type == defs::GOTTHARD2) {
|
||||
throw sls::RuntimeError("dbitphase not implemented for this detector");
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setDBITPhase(StringTo<int>(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?");
|
||||
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(StringTo<int>(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(StringTo<int>(args[0]), {det_id} );
|
||||
os << args[0] << " " << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setDBITPhaseInDegrees(StringTo<int>(args[0]), {det_id});
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
@ -538,7 +554,7 @@ std::string CmdProxy::ClockPhase(int action) {
|
||||
}
|
||||
auto t =
|
||||
det->getClockPhaseinDegrees(StringTo<int>(args[0]), {det_id});
|
||||
os << OutString(t) << '\n';
|
||||
os << OutString(t) << " deg\n";
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
@ -554,7 +570,7 @@ std::string CmdProxy::ClockPhase(int action) {
|
||||
}
|
||||
det->setClockPhaseinDegrees(StringTo<int>(args[0]),
|
||||
StringTo<int>(args[1]), {det_id});
|
||||
os << args[1] << '\n';
|
||||
os << args[1] << " " << args[2] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
|
@ -87,89 +87,6 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("clkfreq", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("clkfreq", {"0", "2"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("clkfreq", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("clkfreq", {"7"}, -1, GET));
|
||||
|
||||
auto value = det.getClockFrequency(0).squash(-1);
|
||||
std::ostringstream oss_set, oss_get;
|
||||
proxy.Call("clkfreq", {"0"}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() == "clkfreq " + std::to_string(value) + "\n");
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("clkfreq", {"0"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("clkphase", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("clkphase", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("clkphase", {"7"}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("clkphase", {"4"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("clkphase", {"7", "4"}, -1, PUT));
|
||||
|
||||
auto previous = det.getClockFrequency(0).squash(-1);
|
||||
auto previous_string = std::to_string(previous);
|
||||
std::ostringstream oss_set, oss_get, oss_get2;
|
||||
proxy.Call("clkfreq", {"0", previous_string}, -1, PUT, oss_set);
|
||||
REQUIRE(oss_set.str() == "clkfreq" + previous_string + "\n");
|
||||
proxy.Call("clkfreq", {"0"}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() == "clkfreq " + previous_string + "\n");
|
||||
REQUIRE_NOTHROW(proxy.Call("clkphase", {"0", "deg"}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("clkphase", {"0"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("clkdiv", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("clkdiv", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("clkdiv", {"7"}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("clkdiv", {"7", "4"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("clkdiv", {"7", "4"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("clkdiv", {"0", "1"}, -1, PUT));
|
||||
|
||||
auto previous = det.getClockDivider(0).squash(-1);
|
||||
auto previous_string = std::to_string(previous);
|
||||
std::ostringstream oss_set, oss_get;
|
||||
proxy.Call("clkdiv", {"0", previous_string}, -1, PUT, oss_set);
|
||||
REQUIRE(oss_set.str() == "clkdiv" + previous_string + "\n");
|
||||
proxy.Call("clkdiv", {"0"}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() == "clkdiv " + previous_string + "\n");
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("clkdiv", {"0"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("maxclkphaseshift", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("maxclkphaseshift", {"0", "2"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("maxclkphaseshift", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("maxclkphaseshift", {"7"}, -1, GET));
|
||||
|
||||
auto value = det.getMaxClockPhaseShift(0).squash(-1);
|
||||
std::ostringstream oss_set, oss_get;
|
||||
proxy.Call("maxclkphaseshift", {"0"}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() ==
|
||||
"maxclkphaseshift " + std::to_string(value) + "\n");
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("maxclkphaseshift", {"0"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("counters", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user