mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
Dev/xilinx defaults and pattern (#888)
* implemented testbus, testfpga, set/get #frames, triggers, allowed that and for connection to client, also allowed, getnumchannels, configuremac, getrunstatus, setdetectorposition with dummy values * connected kernelversion, hardwareversion, versions, framesl, triggersl, dr, timingmode, pattern (except patioctrl) thats there for altera ctb * replaced set/get64Bit to set/getU64bit in all loadpattern.c for (ctb and m3 also)
This commit is contained in:
@ -585,7 +585,7 @@ patioctrl:
|
||||
function: setPatternIOControl
|
||||
|
||||
patmask:
|
||||
help: "[64 bit mask]\n\t[Ctb][Mythen3] Selects the bits that will have a pattern mask applied to the selected patmask for every pattern."
|
||||
help: "[64 bit mask]\n\t[Ctb][Mythen3][Xilinx Ctb] Selects the bits that will have a pattern mask applied to the selected patmask for every pattern."
|
||||
inherit_actions: INTEGER_COMMAND_HEX_WIDTH16
|
||||
actions:
|
||||
GET:
|
||||
@ -594,7 +594,7 @@ patmask:
|
||||
function: setPatternMask
|
||||
|
||||
patsetbit:
|
||||
help: "[64 bit mask]\n\t[Ctb][Mythen3] Sets the mask applied to every pattern to the selected bits."
|
||||
help: "[64 bit mask]\n\t[Ctb][Mythen3][Xilinx Ctb] Sets the mask applied to every pattern to the selected bits."
|
||||
inherit_actions: INTEGER_COMMAND_HEX_WIDTH16
|
||||
actions:
|
||||
GET:
|
||||
@ -688,7 +688,7 @@ column:
|
||||
function: setColumn
|
||||
|
||||
timing:
|
||||
help: "[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2] [auto|trigger]\n\t[Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger] [auto|trigger|gating|burst_trigger]"
|
||||
help: "[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger]\n\t[Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger] [auto|trigger|gating|burst_trigger]"
|
||||
inherit_actions: INTEGER_COMMAND_VEC_ID
|
||||
actions:
|
||||
GET:
|
||||
@ -1506,7 +1506,7 @@ triggers:
|
||||
|
||||
dr:
|
||||
inherit_actions: INTEGER_COMMAND_SET_NOID_GET_ID
|
||||
help: "[value]\n\tDynamic Range or number of bits per pixel in detector.\n\t[Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets clkdivider to 2, else to 0.\n\t[Mythen3] Options: 8, 16, 32\n\t[Jungfrau][Moench][Gotthard][Ctb][Mythen3][Gotthard2] 16"
|
||||
help: "[value]\n\tDynamic Range or number of bits per pixel in detector.\n\t[Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets clkdivider to 2, else to 0.\n\t[Mythen3] Options: 8, 16, 32\n\t[Jungfrau][Moench][Gotthard][Ctb][Mythen3][Gotthard2][Xilinx Ctb] 16"
|
||||
actions:
|
||||
GET:
|
||||
function: getDynamicRange
|
||||
@ -1835,7 +1835,7 @@ parameters:
|
||||
|
||||
savepattern:
|
||||
inherit_actions: EXECUTE_SET_COMMAND_NOID_1ARG
|
||||
help: "\n\t[Ctb][Mythen3] Saves pattern to file (ascii). \n\t[Ctb] Also executes pattern."
|
||||
help: "\n\t[Ctb][Mythen3][Xilinx Ctb] Saves pattern to file (ascii). \n\t[Ctb] Also executes pattern."
|
||||
actions:
|
||||
PUT:
|
||||
function: savePattern
|
||||
@ -1850,7 +1850,7 @@ detectorserverversion:
|
||||
|
||||
hardwareversion:
|
||||
inherit_actions: GET_COMMAND
|
||||
help: "\n\t[Jungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] Hardware version of detector. \n\t[Eiger] Hardware version of front FPGA on detector."
|
||||
help: "\n\tHardware version of detector. \n\t[Eiger] Hardware version of front FPGA on detector."
|
||||
actions:
|
||||
GET:
|
||||
function: getHardwareVersion
|
||||
@ -1885,14 +1885,14 @@ type:
|
||||
|
||||
framesl:
|
||||
inherit_actions: GET_COMMAND
|
||||
help: "\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Number of frames left in acquisition. \n\t[Gotthard2] only in continuous auto mode."
|
||||
help: "\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Number of frames left in acquisition. \n\t[Gotthard2] only in continuous auto mode."
|
||||
actions:
|
||||
GET:
|
||||
function: getNumberOfFramesLeft
|
||||
|
||||
triggersl:
|
||||
inherit_actions: GET_COMMAND
|
||||
help: "\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Number of triggers left in acquisition. Only when external trigger used."
|
||||
help: "\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Number of triggers left in acquisition. Only when external trigger used."
|
||||
actions:
|
||||
GET:
|
||||
function: getNumberOfTriggersLeft
|
||||
@ -1997,7 +1997,7 @@ syncclk:
|
||||
|
||||
patfname:
|
||||
inherit_actions: GET_COMMAND
|
||||
help: "\n\t[Ctb][Mythen3] Gets the pattern file name including path of the last pattern uploaded. Returns an empty if nothing was uploaded or via a server default file"
|
||||
help: "\n\t[Ctb][Mythen3][Xilinx Ctb] Gets the pattern file name including path of the last pattern uploaded. Returns an empty if nothing was uploaded or via a server default file"
|
||||
actions:
|
||||
GET:
|
||||
function: getPatterFileName
|
||||
@ -3842,7 +3842,7 @@ diodelay:
|
||||
|
||||
# pattern is a keyword in yaml, so patternX is used to avoid it
|
||||
patternX:
|
||||
help: "[fname]\n\t[Mythen3][Ctb] Loads ASCII pattern file directly to server (instead of executing line by line)"
|
||||
help: "[fname]\n\t[Mythen3][Ctb][Xilinx Ctb] Loads ASCII pattern file directly to server (instead of executing line by line)"
|
||||
command_name: "pattern"
|
||||
actions:
|
||||
PUT:
|
||||
@ -3855,7 +3855,7 @@ patternX:
|
||||
output: [ 'args.front()' ]
|
||||
|
||||
patword:
|
||||
help: "[step or address] [64 bit mask]\n\t[Ctb][Mythen3] 64 bit pattern at address of pattern memory.\n\t[Ctb] read is same as executing pattern"
|
||||
help: "[step or address] [64 bit mask]\n\t[Ctb][Mythen3][Xilinx Ctb] 64 bit pattern at address of pattern memory.\n\t[Ctb] read is same as executing pattern"
|
||||
actions:
|
||||
GET:
|
||||
argc: 1
|
||||
@ -3875,7 +3875,7 @@ patword:
|
||||
output: [ "'['", "ToStringHex(arg0, 4)", '", "', "ToStringHex(arg1, 16)", '"]"' ]
|
||||
|
||||
patlimits:
|
||||
help: "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of complete pattern"
|
||||
help: "[start addr] [stop addr] \n\t[Ctb][Mythen3][Xilinx Ctb] Limits of complete pattern"
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
@ -3895,7 +3895,7 @@ patlimits:
|
||||
output: [ "'['" , "ToStringHex(arg1, 4)" , '", "' , "ToStringHex(arg2, 4)", "']'" ]
|
||||
|
||||
patloop:
|
||||
help: "[0-6] [start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of the loop level provided.\n\t[Mythen3] Level options: 0-3 only."
|
||||
help: "[0-6] [start addr] [stop addr] \n\t[Ctb][Mythen3][Xilinx Ctb] Limits of the loop level provided.\n\t[Mythen3] Level options: 0-3 only."
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
@ -3944,7 +3944,7 @@ patloop2:
|
||||
inherit_actions: patloop0
|
||||
|
||||
patnloop:
|
||||
help: "[0-6] [n_cycles] \n\t[Ctb][Mythen3] Number of cycles of the loop level provided.\n\t[Mythen3] Level options: 0-3 only."
|
||||
help: "[0-6] [n_cycles] \n\t[Ctb][Mythen3][Xilinx Ctb] Number of cycles of the loop level provided.\n\t[Mythen3] Level options: 0-3 only."
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
@ -3991,7 +3991,7 @@ patnloop2:
|
||||
inherit_actions: patnloop0
|
||||
|
||||
patwait:
|
||||
help: "[0-6] [addr] \n\t[Ctb][Mythen3] Wait address for loop level provided. \n\t[Mythen3] Level options: 0-3 only."
|
||||
help: "[0-6] [addr] \n\t[Ctb][Mythen3][Xilinx Ctb] Wait address for loop level provided. \n\t[Mythen3] Level options: 0-3 only."
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
@ -4037,7 +4037,7 @@ patwait2:
|
||||
inherit_actions: patwait0
|
||||
|
||||
patwaittime:
|
||||
help: "[0-6] [n_clk] \n\t[Ctb][Mythen3] Wait time in clock cycles for the loop provided.\n\t[Mythen3] Level options: 0-3 only."
|
||||
help: "[0-6] [n_clk] \n\t[Ctb][Mythen3][Xilinx Ctb] Wait time in clock cycles for the loop provided.\n\t[Mythen3] Level options: 0-3 only."
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
|
@ -322,11 +322,11 @@ class Detector {
|
||||
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] */
|
||||
void setDelayAfterTrigger(ns value, Positions pos = {});
|
||||
|
||||
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3]
|
||||
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Xilinx CTB]
|
||||
* [Gotthard2] only in continuous auto mode */
|
||||
Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3]
|
||||
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Xilinx CTB]
|
||||
* Only when external trigger used */
|
||||
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
|
||||
|
||||
@ -343,7 +343,7 @@ class Detector {
|
||||
/**
|
||||
* [Eiger] Options: 4, 8, 12, 16, 32. If i is 32, also sets clkdivider to 2,
|
||||
* else sets clkdivider to 1 \n [Mythen3] Options: 8, 16, 32 \n
|
||||
* [Jungfrau][Moench][Gotthard][Ctb][Mythen3][Gotthard2] 16
|
||||
* [Jungfrau][Moench][Gotthard][CTB][Mythen3][Gotthard2][Xilinx CTB] 16
|
||||
*/
|
||||
void setDynamicRange(int value);
|
||||
|
||||
@ -353,7 +353,7 @@ class Detector {
|
||||
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* [Gotthard][Jungfrau][Moench][Gotthard][CTB][Gotthard2] Options:
|
||||
* [Gotthard][Jungfrau][Moench][Gotthard][CTB][Gotthard2][Xilinx CTB] Options:
|
||||
* AUTO_TIMING, TRIGGER_EXPOSURE \n
|
||||
* [Mythen3] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED \n
|
||||
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
|
||||
@ -1846,20 +1846,20 @@ class Detector {
|
||||
* Pattern *
|
||||
* *
|
||||
* ************************************************/
|
||||
/** [CTB][Mythen3] Gets the pattern file name including path of the last
|
||||
/** [CTB][Mythen3][Xilinx CTB] Gets the pattern file name including path of the last
|
||||
* pattern uploaded. \n Returns an empty if nothing was uploaded or via a
|
||||
* server default file*/
|
||||
Result<std::string> getPatterFileName(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Mythen3] Loads ASCII pattern file directly to server
|
||||
/** [CTB][Mythen3][Xilinx CTB] Loads ASCII pattern file directly to server
|
||||
* (instead of executing line by line)*/
|
||||
void setPattern(const std::string &fname, Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3] Loads pattern parameters structure directly to
|
||||
/** [CTB][Mythen3][Xilinx CTB] Loads pattern parameters structure directly to
|
||||
* server */
|
||||
void setPattern(const Pattern &pat, Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3] [Ctb][Mythen3] Saves pattern to file
|
||||
/** [CTB][Mythen3][Xilinx CTB] Saves pattern to file
|
||||
* (ascii). \n [Ctb] Also executes pattern.*/
|
||||
void savePattern(const std::string &fname);
|
||||
|
||||
@ -1872,57 +1872,57 @@ class Detector {
|
||||
/** [CTB] */
|
||||
void setPatternIOControl(uint64_t word, Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3] same as executing for ctb */
|
||||
/** [CTB][Mythen3][Xilinx CTB] same as executing for ctb */
|
||||
Result<uint64_t> getPatternWord(int addr, Positions pos = {});
|
||||
|
||||
/** [CTB] Caution: If word is -1 reads the addr (same as
|
||||
/** [CTB][Xilinx CTB] Caution: If word is -1 reads the addr (same as
|
||||
* executing the pattern)
|
||||
* [Mythen3] */
|
||||
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
||||
|
||||
/**[CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2
|
||||
/**[CTB][Mythen3][Xilinx CTB] Options: level: -1 (complete pattern) and 0-2
|
||||
* levels
|
||||
* @returns array of start address and stop address
|
||||
*/
|
||||
Result<std::array<int, 2>>
|
||||
getPatternLoopAddresses(int level, Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2
|
||||
/** [CTB][Mythen3][Xilinx CTB] Options: level: -1 (complete pattern) and 0-2
|
||||
* levels */
|
||||
void setPatternLoopAddresses(int level, int start, int stop,
|
||||
Positions pos = {});
|
||||
|
||||
/**[CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2
|
||||
/**[CTB][Mythen3][Xilinx CTB] Options: level: -1 (complete pattern) and 0-2
|
||||
* levels */
|
||||
Result<int> getPatternLoopCycles(int level, Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Mythen3] n: 0-2, level: -1 (complete pattern) and 0-2
|
||||
/** [CTB][Mythen3][Xilinx CTB] n: 0-2, level: -1 (complete pattern) and 0-2
|
||||
* levels */
|
||||
void setPatternLoopCycles(int level, int n, Positions pos = {});
|
||||
|
||||
/**[CTB][Mythen3] */
|
||||
/**[CTB][Mythen3][Xilinx CTB] */
|
||||
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Mythen3] Options: level 0-2 */
|
||||
/** [CTB][Mythen3][Xilinx CTB] Options: level 0-2 */
|
||||
void setPatternWaitAddr(int level, int addr, Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3] */
|
||||
/** [CTB][Mythen3][Xilinx CTB] */
|
||||
Result<uint64_t> getPatternWaitTime(int level, Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Mythen3] Options: level 0-2 */
|
||||
/** [CTB][Mythen3][Xilinx CTB] Options: level 0-2 */
|
||||
void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3] */
|
||||
/** [CTB][Mythen3][Xilinx CTB] */
|
||||
Result<uint64_t> getPatternMask(Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3] Selects the bits that will have a pattern mask
|
||||
/** [CTB][Mythen3][Xilinx CTB] Selects the bits that will have a pattern mask
|
||||
* applied to the selected patmask for every pattern. */
|
||||
void setPatternMask(uint64_t mask, Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3] */
|
||||
/** [CTB][Mythen3][Xilinx CTB] */
|
||||
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Mythen3] Sets the mask applied to every pattern to the
|
||||
/** [CTB][Mythen3][Xilinx CTB] Sets the mask applied to every pattern to the
|
||||
* selected bits */
|
||||
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
||||
|
||||
|
@ -23,7 +23,7 @@ TEST_CASE("Caller::patfname", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
REQUIRE_THROWS(caller.call("patfname", {}, -1, PUT));
|
||||
REQUIRE_NOTHROW(caller.call("patfname", {}, -1, GET));
|
||||
} else {
|
||||
@ -35,7 +35,7 @@ TEST_CASE("Caller::pattern", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
// no proper test for put
|
||||
REQUIRE_THROWS(caller.call("pattern", {}, -1, GET));
|
||||
} else {
|
||||
@ -47,7 +47,7 @@ TEST_CASE("Caller::savepattern", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
REQUIRE_THROWS(
|
||||
caller.call("savepattern", {"/tmp/pattern.txt"}, -1, GET));
|
||||
if (det.size() == 1) {
|
||||
@ -108,7 +108,7 @@ TEST_CASE("Caller::patword", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
int addr = 0x23;
|
||||
std::string saddr = ToStringHex(addr, 4);
|
||||
auto prev_val = det.getPatternWord(addr);
|
||||
@ -118,6 +118,12 @@ TEST_CASE("Caller::patword", "[.cmdcall]") {
|
||||
REQUIRE(oss.str() ==
|
||||
"patword [" + saddr + ", 0xc15004808d0a21a4]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("patword", {saddr, "0x815004808d0a21a4"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() ==
|
||||
"patword [" + saddr + ", 0x815004808d0a21a4]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("patword", {saddr, "0xaadf0"}, -1, PUT, oss);
|
||||
@ -143,7 +149,7 @@ TEST_CASE("Caller::patlimits", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopAddresses(-1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -169,7 +175,7 @@ TEST_CASE("Caller::patloop", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
@ -217,7 +223,7 @@ TEST_CASE("Caller::patnloop", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
@ -262,7 +268,7 @@ TEST_CASE("Caller::patwait", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
@ -307,7 +313,7 @@ TEST_CASE("Caller::patwaittime", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
@ -352,7 +358,7 @@ TEST_CASE("Caller::patmask", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternMask();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -377,7 +383,7 @@ TEST_CASE("Caller::patsetbit", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::XILINX_CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternBitMask();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
@ -87,13 +87,8 @@ TEST_CASE("CALLER::virtual", "[.cmdcall]") {
|
||||
TEST_CASE("CALLER::versions", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(caller.call("versions", {}, -1, GET));
|
||||
REQUIRE_THROWS(caller.call("versions", {"0"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("versions", {}, -1, GET));
|
||||
}
|
||||
REQUIRE_NOTHROW(caller.call("versions", {}, -1, GET));
|
||||
REQUIRE_THROWS(caller.call("versions", {"0"}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("CALLER::packageversion", "[.cmdcall]") {
|
||||
@ -127,25 +122,15 @@ TEST_CASE("CALLER::detectorserverversion", "[.cmdcall]") {
|
||||
TEST_CASE("CALLER::hardwareversion", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(caller.call("hardwareversion", {}, -1, GET));
|
||||
REQUIRE_THROWS(caller.call("hardwareversion", {"0"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("hardwareversion", {}, -1, GET));
|
||||
}
|
||||
REQUIRE_NOTHROW(caller.call("hardwareversion", {}, -1, GET));
|
||||
REQUIRE_THROWS(caller.call("hardwareversion", {"0"}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("CALLER::kernelversion", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
REQUIRE_NOTHROW(caller.call("kernelversion", {}, -1, GET));
|
||||
REQUIRE_THROWS(caller.call("kernelversion", {"0"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("kernelversion", {}, -1, GET));
|
||||
}
|
||||
REQUIRE_NOTHROW(caller.call("kernelversion", {}, -1, GET));
|
||||
REQUIRE_THROWS(caller.call("kernelversion", {"0"}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("CALLER::serialnumber", "[.cmdcall]") {
|
||||
@ -959,7 +944,7 @@ TEST_CASE("CALLER::framesl", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::EIGER) {
|
||||
REQUIRE_THROWS(caller.call("framesl", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_NOTHROW(caller.call("framesl", {}, -1, GET));
|
||||
@ -970,7 +955,7 @@ TEST_CASE("CALLER::triggersl", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER || det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::EIGER) {
|
||||
REQUIRE_THROWS(caller.call("triggersl", {}, -1, GET));
|
||||
} else {
|
||||
REQUIRE_NOTHROW(caller.call("triggersl", {}, -1, GET));
|
||||
@ -1017,45 +1002,41 @@ TEST_CASE("CALLER::dr", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::EIGER) {
|
||||
auto dr = det.getDynamicRange().squash();
|
||||
std::array<int, 4> vals{4, 8, 16, 32};
|
||||
for (const auto val : vals) {
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("dr", {std::to_string(val)}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "dr " + std::to_string(val) + '\n');
|
||||
caller.call("dr", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "dr " + std::to_string(val) + '\n');
|
||||
}
|
||||
det.setDynamicRange(dr);
|
||||
} else if (det_type == defs::MYTHEN3) {
|
||||
auto dr = det.getDynamicRange().squash();
|
||||
// not updated in firmware to support dr 1
|
||||
std::array<int, 3> vals{8, 16, 32};
|
||||
for (const auto val : vals) {
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("dr", {std::to_string(val)}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "dr " + std::to_string(val) + '\n');
|
||||
caller.call("dr", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "dr " + std::to_string(val) + '\n');
|
||||
}
|
||||
det.setDynamicRange(dr);
|
||||
} else {
|
||||
// For the other detectors we should get an error message
|
||||
// except for dr 16
|
||||
REQUIRE_THROWS(caller.call("dr", {"4"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("dr", {"8"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("dr", {"32"}, -1, PUT));
|
||||
|
||||
if (det_type == defs::EIGER) {
|
||||
auto dr = det.getDynamicRange().squash();
|
||||
std::array<int, 4> vals{4, 8, 16, 32};
|
||||
for (const auto val : vals) {
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("dr", {"16"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "dr 16\n");
|
||||
caller.call("dr", {"16"}, -1, PUT, oss2);
|
||||
REQUIRE(oss2.str() == "dr 16\n");
|
||||
caller.call("dr", {std::to_string(val)}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "dr " + std::to_string(val) + '\n');
|
||||
caller.call("dr", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "dr " + std::to_string(val) + '\n');
|
||||
}
|
||||
det.setDynamicRange(dr);
|
||||
} else if (det_type == defs::MYTHEN3) {
|
||||
auto dr = det.getDynamicRange().squash();
|
||||
// not updated in firmware to support dr 1
|
||||
std::array<int, 3> vals{8, 16, 32};
|
||||
for (const auto val : vals) {
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("dr", {std::to_string(val)}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "dr " + std::to_string(val) + '\n');
|
||||
caller.call("dr", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "dr " + std::to_string(val) + '\n');
|
||||
}
|
||||
det.setDynamicRange(dr);
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("dr", {}, -1, GET));
|
||||
// For the other detectors we should get an error message
|
||||
// except for dr 16
|
||||
REQUIRE_THROWS(caller.call("dr", {"4"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("dr", {"8"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("dr", {"32"}, -1, PUT));
|
||||
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("dr", {"16"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "dr 16\n");
|
||||
caller.call("dr", {"16"}, -1, PUT, oss2);
|
||||
REQUIRE(oss2.str() == "dr 16\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1070,66 +1051,61 @@ TEST_CASE("CALLER::timing", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val = det.getTimingMode();
|
||||
det.setTimingMode(defs::AUTO_TIMING);
|
||||
auto prev_val = det.getTimingMode();
|
||||
det.setTimingMode(defs::AUTO_TIMING);
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"auto"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing auto\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing auto\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"trigger"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing trigger\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing trigger\n");
|
||||
}
|
||||
if (det_type == defs::EIGER) {
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"auto"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing auto\n");
|
||||
caller.call("timing", {"gating"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing gating\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing auto\n");
|
||||
REQUIRE(oss2.str() == "timing gating\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"trigger"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing trigger\n");
|
||||
caller.call("timing", {"burst_trigger"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing burst_trigger\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing trigger\n");
|
||||
REQUIRE(oss2.str() == "timing burst_trigger\n");
|
||||
}
|
||||
if (det_type == defs::EIGER) {
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"gating"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing gating\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing gating\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"burst_trigger"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing burst_trigger\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing burst_trigger\n");
|
||||
}
|
||||
REQUIRE_THROWS(caller.call("timing", {"trigger_gating"}, -1, PUT));
|
||||
} else if (det_type == defs::MYTHEN3) {
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"gating"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing gating\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing gating\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"trigger_gating"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing trigger_gating\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing trigger_gating\n");
|
||||
}
|
||||
REQUIRE_THROWS(caller.call("timing", {"burst_trigger"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("timing", {"gating"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("timing", {"burst_trigger"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("timing", {"trigger_gating"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("timing", {"trigger_gating"}, -1, PUT));
|
||||
} else if (det_type == defs::MYTHEN3) {
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"gating"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing gating\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing gating\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTimingMode(prev_val[i], {i});
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("timing", {"trigger_gating"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing trigger_gating\n");
|
||||
caller.call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing trigger_gating\n");
|
||||
}
|
||||
REQUIRE_THROWS(caller.call("timing", {"burst_trigger"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("timing", {}, -1, GET));
|
||||
|
||||
REQUIRE_THROWS(caller.call("timing", {"gating"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("timing", {"burst_trigger"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("timing", {"trigger_gating"}, -1, PUT));
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTimingMode(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user