mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-17 07:21:30 +01:00
ctb: patwaittime and exptime (#1076)
* cli: patwaittime also takes time argument, api: patwaitclocks and patwaitinterval, tcp: patwaitinterval is 2 functions for set and get, patwaitclocks remains a single for backward compatibility with -1 for get, server (loadpattern): clks using member names (needs to be refactored). needs tobe discussed what to do with pattern files. * all tests passed * fixed test * exptime deprecated for ctb and xilinx * pyctbgui..not there yet * fixed in pyctbgui * removed redundant warning for ctb and xilinx exptime in Detector class (already in module class handling all exptime signatures), patwait, patloop and patnloop have to be non inferrable commands because of support for old commands (level as suffix) * fix formatting error from command line parsing * fix tests for patwaittime
This commit is contained in:
@@ -19,10 +19,7 @@ class Caller {
|
||||
IpAddr getDstIpFromAuto();
|
||||
IpAddr getSrcIpFromAuto();
|
||||
UdpDestination getUdpEntry();
|
||||
void GetLevelAndUpdateArgIndex(int action,
|
||||
std::string levelSeparatedCommand,
|
||||
int &level, int &iArg, size_t nGetArgs,
|
||||
size_t nPutArgs);
|
||||
int GetLevelAndInsertIntoArgs(std::string levelSeparatedCommand);
|
||||
void WrongNumberOfParameters(size_t expected);
|
||||
|
||||
template <typename V> std::string OutStringHex(const V &value) {
|
||||
|
||||
@@ -2656,6 +2656,44 @@ slowadc:
|
||||
argc: 1
|
||||
arg_types: [ int ]
|
||||
|
||||
patwaittime:
|
||||
is_description: true
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
PUT:
|
||||
argc: -1
|
||||
|
||||
patwaittime0:
|
||||
is_description: true
|
||||
duplicate_function: true
|
||||
function_alias: patwaittime
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
PUT:
|
||||
argc: -1
|
||||
|
||||
patwaittime1:
|
||||
is_description: true
|
||||
duplicate_function: true
|
||||
function_alias: patwaittime
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
PUT:
|
||||
argc: -1
|
||||
|
||||
patwaittime2:
|
||||
is_description: true
|
||||
duplicate_function: true
|
||||
function_alias: patwaittime
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
PUT:
|
||||
argc: -1
|
||||
|
||||
rx_dbitlist:
|
||||
is_description: true
|
||||
actions:
|
||||
@@ -3930,34 +3968,34 @@ patlimits:
|
||||
|
||||
patloop:
|
||||
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."
|
||||
infer_action: false
|
||||
pattern_command: patloop
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
pattern_command:
|
||||
command_name: patloop
|
||||
nGetArgs: 0
|
||||
nPutArgs: 2
|
||||
argc: 1
|
||||
require_det_id: true
|
||||
function: getPatternLoopAddresses
|
||||
extra_variables:
|
||||
- name: level
|
||||
type: int
|
||||
value: "StringTo<int>(args[0])"
|
||||
input: [ level ]
|
||||
input_types: [ int ]
|
||||
cast_input: [ false ]
|
||||
output: [level,"' '" ,"OutStringHex(t, 4)" ]
|
||||
PUT:
|
||||
argc: -1
|
||||
extra_variables:
|
||||
- name: start
|
||||
type: int
|
||||
value: "StringTo<int>(args[iArg++])"
|
||||
- name: stop
|
||||
type: int
|
||||
value: "StringTo<int>(args[iArg++])"
|
||||
pattern_command:
|
||||
command_name: patloop
|
||||
nGetArgs: 0
|
||||
nPutArgs: 2
|
||||
argc: 3
|
||||
require_det_id: true
|
||||
function: setPatternLoopAddresses
|
||||
extra_variables:
|
||||
- name: level
|
||||
type: int
|
||||
value: "StringTo<int>(args[0])"
|
||||
- name: start
|
||||
type: int
|
||||
value: "StringTo<int>(args[1])"
|
||||
- name: stop
|
||||
type: int
|
||||
value: "StringTo<int>(args[2])"
|
||||
input: [ level, start, stop ]
|
||||
input_types: [ int, int, int ]
|
||||
output: [level,"' '" , "'['" , "ToStringHex(start, 4)" , '", "' , "ToStringHex(stop, 4)", "']'" ]
|
||||
@@ -3979,34 +4017,33 @@ patloop2:
|
||||
|
||||
patnloop:
|
||||
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."
|
||||
infer_action: false
|
||||
pattern_command: patnloop
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
pattern_command:
|
||||
command_name: patnloop
|
||||
nGetArgs: 0
|
||||
nPutArgs: 1
|
||||
argc: 1
|
||||
require_det_id: true
|
||||
function: getPatternLoopCycles
|
||||
extra_variables:
|
||||
- name: level
|
||||
type: int
|
||||
value: "StringTo<int>(args[0])"
|
||||
input: [ level ]
|
||||
input_types: [ int ]
|
||||
cast_input: [ false ]
|
||||
output: [ level,"' '" , "OutString(t)" ]
|
||||
PUT:
|
||||
argc: -1
|
||||
extra_variables:
|
||||
- name: nloops
|
||||
type: std::string
|
||||
value: "args[iArg++]"
|
||||
pattern_command:
|
||||
command_name: patnloop
|
||||
nGetArgs: 0
|
||||
nPutArgs: 1
|
||||
argc: 2
|
||||
require_det_id: true
|
||||
function: setPatternLoopCycles
|
||||
extra_variables:
|
||||
- name: level
|
||||
type: int
|
||||
value: "StringTo<int>(args[0])"
|
||||
- name: nloops
|
||||
type: int
|
||||
value: "StringTo<int>(args[1])"
|
||||
input: [ level, nloops ]
|
||||
input_types: [ int, int ]
|
||||
cast_input: [ false, true ]
|
||||
output: [ level,"' '" , nloops ]
|
||||
|
||||
patnloop0:
|
||||
@@ -4014,9 +4051,9 @@ patnloop0:
|
||||
inherit_actions: patnloop
|
||||
actions:
|
||||
GET:
|
||||
output: [ "OutString(t)" ]
|
||||
output: [ OutString(t) ]
|
||||
PUT:
|
||||
output: [ "nloops" ]
|
||||
output: [ nloops ]
|
||||
|
||||
patnloop1:
|
||||
inherit_actions: patnloop0
|
||||
@@ -4026,31 +4063,31 @@ patnloop2:
|
||||
|
||||
patwait:
|
||||
help: "[0-6] [addr] \n\t[Ctb][Mythen3][Xilinx Ctb] Wait address for loop level provided. \n\t[Mythen3] Level options: 0-3 only."
|
||||
infer_action: false
|
||||
pattern_command: patwait
|
||||
actions:
|
||||
GET:
|
||||
argc: -1
|
||||
pattern_command:
|
||||
command_name: patwait
|
||||
nGetArgs: 0
|
||||
nPutArgs: 1
|
||||
argc: 1
|
||||
require_det_id: true
|
||||
function: getPatternWaitAddr
|
||||
extra_variables:
|
||||
- name: level
|
||||
type: int
|
||||
value: "StringTo<int>(args[0])"
|
||||
input: [ level ]
|
||||
input_types: [ int ]
|
||||
cast_input: [ false ]
|
||||
output: [level,"' '" , "OutStringHex(t, 4)" ]
|
||||
PUT:
|
||||
argc: -1
|
||||
extra_variables:
|
||||
- name: addr
|
||||
type: int
|
||||
value: "StringTo<int>(args[iArg++])"
|
||||
pattern_command:
|
||||
command_name: patwait
|
||||
nGetArgs: 0
|
||||
nPutArgs: 1
|
||||
argc: 2
|
||||
require_det_id: true
|
||||
function: setPatternWaitAddr
|
||||
extra_variables:
|
||||
- name: level
|
||||
type: int
|
||||
value: "StringTo<int>(args[0])"
|
||||
- name: addr
|
||||
type: int
|
||||
value: "StringTo<int>(args[1])"
|
||||
input: [ level, addr ]
|
||||
input_types: [ int, int ]
|
||||
output: [level,"' '" , "ToStringHex(addr, 4)" ]
|
||||
@@ -4070,52 +4107,6 @@ patwait1:
|
||||
patwait2:
|
||||
inherit_actions: patwait0
|
||||
|
||||
patwaittime:
|
||||
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
|
||||
pattern_command:
|
||||
command_name: patwaittime
|
||||
nGetArgs: 0
|
||||
nPutArgs: 1
|
||||
require_det_id: true
|
||||
function: getPatternWaitTime
|
||||
input: [ level ]
|
||||
input_types: [ int ]
|
||||
cast_input: [ false ]
|
||||
output: [ level,"' '" , "OutString(t)" ]
|
||||
PUT:
|
||||
argc: -1
|
||||
extra_variables:
|
||||
- name: waittime
|
||||
type: uint64_t
|
||||
value: "StringTo<uint64_t>(args[iArg++])"
|
||||
pattern_command:
|
||||
command_name: patwaittime
|
||||
nGetArgs: 0
|
||||
nPutArgs: 1
|
||||
require_det_id: true
|
||||
function: setPatternWaitTime
|
||||
input: [ level, waittime ]
|
||||
input_types: [ int, int ]
|
||||
output: [level,"' '" , "waittime" ]
|
||||
|
||||
patwaittime0:
|
||||
help: "\n\tDeprecated command. Use patwaittime."
|
||||
inherit_actions: patwaittime
|
||||
actions:
|
||||
GET:
|
||||
output: [ "OutString(t)" ]
|
||||
PUT:
|
||||
output: [ "waittime" ]
|
||||
|
||||
patwaittime1:
|
||||
inherit_actions: patwaittime0
|
||||
|
||||
patwaittime2:
|
||||
inherit_actions: patwaittime0
|
||||
|
||||
rx_jsonpara:
|
||||
help: "[key1] [value1]\n\t[Receiver] Additional json header parameter streamed out from receiver. If not found in header, the pair is appended. An empty values deletes parameter. Max 20 characters for each key/value."
|
||||
actions:
|
||||
|
||||
@@ -119,17 +119,11 @@ class CodeGenerator:
|
||||
def write_check_arg(self):
|
||||
pass
|
||||
|
||||
|
||||
def write_arg(self, args, action, command_name):
|
||||
for arg in args:
|
||||
if arg['argc'] != -1:
|
||||
if_block(f'args.size() == {arg["argc"]}',).__enter__()
|
||||
if 'pattern_command' in arg and arg['pattern_command']:
|
||||
self.write_line(f'int level = -1, iArg = 0, '
|
||||
f'nGetArgs = {arg["pattern_command"]["nGetArgs"]},'
|
||||
f' nPutArgs = {arg["pattern_command"]["nPutArgs"]};\nGetLevelAndUpdateArgIndex(action, '
|
||||
f'"{arg["pattern_command"]["command_name"]}", level, iArg, nGetArgs,nPutArgs);'
|
||||
)
|
||||
|
||||
if 'extra_variables' in arg:
|
||||
for var in arg['extra_variables']:
|
||||
codegen.write_line(f'{var["type"]} {var["name"]} = {var["value"]};')
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,6 +63,11 @@ def generate(
|
||||
codegen.write_line(f'os << R"V0G0N({command["help"]} )V0G0N" << std::endl;')
|
||||
codegen.write_line('return os.str();')
|
||||
|
||||
|
||||
# inserting arguments if needed
|
||||
if 'pattern_command' in command and command['pattern_command']:
|
||||
codegen.write_line(f'GetLevelAndInsertIntoArgs("{command["pattern_command"]}");')
|
||||
|
||||
# check if action and arguments are valid
|
||||
|
||||
codegen.write_line('// check if action and arguments are valid')
|
||||
|
||||
@@ -1930,10 +1930,15 @@ class Detector {
|
||||
void setPatternWaitAddr(int level, int addr, Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3][Xilinx CTB] */
|
||||
Result<uint64_t> getPatternWaitTime(int level, Positions pos = {}) const;
|
||||
Result<uint64_t> getPatternWaitClocks(int level, Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Mythen3][Xilinx CTB] Options: level 0-2 */
|
||||
void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
|
||||
void setPatternWaitClocks(int level, uint64_t t, Positions pos = {});
|
||||
|
||||
Result<ns> getPatternWaitInterval(int level, Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Mythen3][Xilinx CTB] Options: level 0-2 */
|
||||
void setPatternWaitInterval(int level, ns t, Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3][Xilinx CTB] */
|
||||
Result<uint64_t> getPatternMask(Positions pos = {});
|
||||
|
||||
@@ -7859,19 +7859,30 @@ std::string Caller::patloop(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patloop");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 3) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 3) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int start = StringTo<int>(args[1]);
|
||||
int stop = StringTo<int>(args[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -7882,23 +7893,24 @@ std::string Caller::patloop(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << level << ' ' << OutStringHex(t, 4) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t =
|
||||
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << level << ' ' << OutStringHex(t, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
int start = StringTo<int>(args[iArg++]);
|
||||
int stop = StringTo<int>(args[iArg++]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
os << level << ' ' << '[' << ToStringHex(start, 4) << ", "
|
||||
<< ToStringHex(stop, 4) << ']' << '\n';
|
||||
if (args.size() == 3) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int start = StringTo<int>(args[1]);
|
||||
int stop = StringTo<int>(args[2]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
os << level << ' ' << '[' << ToStringHex(start, 4) << ", "
|
||||
<< ToStringHex(stop, 4) << ']' << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -7915,19 +7927,30 @@ std::string Caller::patloop0(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patloop");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 3) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 3) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int start = StringTo<int>(args[1]);
|
||||
int stop = StringTo<int>(args[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -7938,23 +7961,24 @@ std::string Caller::patloop0(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t =
|
||||
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
int start = StringTo<int>(args[iArg++]);
|
||||
int stop = StringTo<int>(args[iArg++]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||
<< ']' << '\n';
|
||||
if (args.size() == 3) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int start = StringTo<int>(args[1]);
|
||||
int stop = StringTo<int>(args[2]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||
<< ']' << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -7971,19 +7995,30 @@ std::string Caller::patloop1(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patloop");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 3) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 3) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int start = StringTo<int>(args[1]);
|
||||
int stop = StringTo<int>(args[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -7994,23 +8029,24 @@ std::string Caller::patloop1(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t =
|
||||
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
int start = StringTo<int>(args[iArg++]);
|
||||
int stop = StringTo<int>(args[iArg++]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||
<< ']' << '\n';
|
||||
if (args.size() == 3) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int start = StringTo<int>(args[1]);
|
||||
int stop = StringTo<int>(args[2]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||
<< ']' << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -8027,19 +8063,30 @@ std::string Caller::patloop2(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patloop");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 3) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 3) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int start = StringTo<int>(args[1]);
|
||||
int stop = StringTo<int>(args[2]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -8050,23 +8097,24 @@ std::string Caller::patloop2(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t =
|
||||
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
int start = StringTo<int>(args[iArg++]);
|
||||
int stop = StringTo<int>(args[iArg++]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||
<< ']' << '\n';
|
||||
if (args.size() == 3) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int start = StringTo<int>(args[1]);
|
||||
int stop = StringTo<int>(args[2]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||
<< ']' << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -8146,19 +8194,29 @@ std::string Caller::patnloop(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patnloop");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 2) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int nloops = StringTo<int>(args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -8169,21 +8227,20 @@ std::string Caller::patnloop(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << level << ' ' << OutString(t) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << level << ' ' << OutString(t) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
std::string nloops = args[iArg++];
|
||||
auto arg1 = StringTo<int>(nloops);
|
||||
det->setPatternLoopCycles(level, arg1, std::vector<int>{det_id});
|
||||
os << level << ' ' << nloops << '\n';
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int nloops = StringTo<int>(args[1]);
|
||||
det->setPatternLoopCycles(level, nloops, std::vector<int>{det_id});
|
||||
os << level << ' ' << nloops << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -8200,19 +8257,29 @@ std::string Caller::patnloop0(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patnloop");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 2) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int nloops = StringTo<int>(args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -8223,21 +8290,20 @@ std::string Caller::patnloop0(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
std::string nloops = args[iArg++];
|
||||
auto arg1 = StringTo<int>(nloops);
|
||||
det->setPatternLoopCycles(level, arg1, std::vector<int>{det_id});
|
||||
os << nloops << '\n';
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int nloops = StringTo<int>(args[1]);
|
||||
det->setPatternLoopCycles(level, nloops, std::vector<int>{det_id});
|
||||
os << nloops << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -8254,19 +8320,29 @@ std::string Caller::patnloop1(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patnloop");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 2) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int nloops = StringTo<int>(args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -8277,21 +8353,20 @@ std::string Caller::patnloop1(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
std::string nloops = args[iArg++];
|
||||
auto arg1 = StringTo<int>(nloops);
|
||||
det->setPatternLoopCycles(level, arg1, std::vector<int>{det_id});
|
||||
os << nloops << '\n';
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int nloops = StringTo<int>(args[1]);
|
||||
det->setPatternLoopCycles(level, nloops, std::vector<int>{det_id});
|
||||
os << nloops << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -8308,19 +8383,29 @@ std::string Caller::patnloop2(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patnloop");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 2) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int nloops = StringTo<int>(args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -8331,21 +8416,20 @@ std::string Caller::patnloop2(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
std::string nloops = args[iArg++];
|
||||
auto arg1 = StringTo<int>(nloops);
|
||||
det->setPatternLoopCycles(level, arg1, std::vector<int>{det_id});
|
||||
os << nloops << '\n';
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int nloops = StringTo<int>(args[1]);
|
||||
det->setPatternLoopCycles(level, nloops, std::vector<int>{det_id});
|
||||
os << nloops << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -8503,19 +8587,29 @@ std::string Caller::patwait(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patwait");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 2) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int addr = StringTo<int>(args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -8526,20 +8620,20 @@ std::string Caller::patwait(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << level << ' ' << OutStringHex(t, 4) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << level << ' ' << OutStringHex(t, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
int addr = StringTo<int>(args[iArg++]);
|
||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||
os << level << ' ' << ToStringHex(addr, 4) << '\n';
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int addr = StringTo<int>(args[1]);
|
||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||
os << level << ' ' << ToStringHex(addr, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -8556,19 +8650,29 @@ std::string Caller::patwait0(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patwait");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 2) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int addr = StringTo<int>(args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -8579,20 +8683,20 @@ std::string Caller::patwait0(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
int addr = StringTo<int>(args[iArg++]);
|
||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||
os << ToStringHex(addr, 4) << '\n';
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int addr = StringTo<int>(args[1]);
|
||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||
os << ToStringHex(addr, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -8609,19 +8713,29 @@ std::string Caller::patwait1(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patwait");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 2) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int addr = StringTo<int>(args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -8632,20 +8746,20 @@ std::string Caller::patwait1(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
int addr = StringTo<int>(args[iArg++]);
|
||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||
os << ToStringHex(addr, 4) << '\n';
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int addr = StringTo<int>(args[1]);
|
||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||
os << ToStringHex(addr, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
@@ -8662,19 +8776,29 @@ std::string Caller::patwait2(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
GetLevelAndInsertIntoArgs("patwait");
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
if (1 && args.size() != 2) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int addr = StringTo<int>(args[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
@@ -8685,233 +8809,20 @@ std::string Caller::patwait2(int action) {
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
if (args.size() == 1) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
int addr = StringTo<int>(args[iArg++]);
|
||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||
os << ToStringHex(addr, 4) << '\n';
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::patwaittime(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N([0-6] [n_clk]
|
||||
[Ctb][Mythen3][Xilinx Ctb] Wait time in clock cycles for the loop provided.
|
||||
[Mythen3] Level options: 0-3 only. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
if (args.size() == 2) {
|
||||
int level = StringTo<int>(args[0]);
|
||||
int addr = StringTo<int>(args[1]);
|
||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||
os << ToStringHex(addr, 4) << '\n';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
|
||||
"are ['GET', 'PUT']");
|
||||
}
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
|
||||
os << level << ' ' << OutString(t) << '\n';
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
uint64_t waittime = StringTo<uint64_t>(args[iArg++]);
|
||||
det->setPatternWaitTime(level, waittime, std::vector<int>{det_id});
|
||||
os << level << ' ' << waittime << '\n';
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::patwaittime0(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N(
|
||||
Deprecated command. Use patwaittime. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
|
||||
"are ['GET', 'PUT']");
|
||||
}
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
uint64_t waittime = StringTo<uint64_t>(args[iArg++]);
|
||||
det->setPatternWaitTime(level, waittime, std::vector<int>{det_id});
|
||||
os << waittime << '\n';
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::patwaittime1(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N(
|
||||
Deprecated command. Use patwaittime. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
|
||||
"are ['GET', 'PUT']");
|
||||
}
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
uint64_t waittime = StringTo<uint64_t>(args[iArg++]);
|
||||
det->setPatternWaitTime(level, waittime, std::vector<int>{det_id});
|
||||
os << waittime << '\n';
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::patwaittime2(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N(
|
||||
Deprecated command. Use patwaittime. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
if (0) {
|
||||
throw RuntimeError("Wrong number of arguments for action GET");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (0) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
|
||||
"are ['GET', 'PUT']");
|
||||
}
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::GET_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
|
||||
nPutArgs);
|
||||
uint64_t waittime = StringTo<uint64_t>(args[iArg++]);
|
||||
det->setPatternWaitTime(level, waittime, std::vector<int>{det_id});
|
||||
os << waittime << '\n';
|
||||
}
|
||||
|
||||
return os.str();
|
||||
|
||||
@@ -19,10 +19,7 @@ class Caller {
|
||||
IpAddr getDstIpFromAuto();
|
||||
IpAddr getSrcIpFromAuto();
|
||||
UdpDestination getUdpEntry();
|
||||
void GetLevelAndUpdateArgIndex(int action,
|
||||
std::string levelSeparatedCommand,
|
||||
int &level, int &iArg, size_t nGetArgs,
|
||||
size_t nPutArgs);
|
||||
int GetLevelAndInsertIntoArgs(std::string levelSeparatedCommand);
|
||||
void WrongNumberOfParameters(size_t expected);
|
||||
|
||||
template <typename V> std::string OutStringHex(const V &value) {
|
||||
@@ -207,9 +204,6 @@ class Caller {
|
||||
std::string patwait1(int action);
|
||||
std::string patwait2(int action);
|
||||
std::string patwaittime(int action);
|
||||
std::string patwaittime0(int action);
|
||||
std::string patwaittime1(int action);
|
||||
std::string patwaittime2(int action);
|
||||
std::string patword(int action);
|
||||
std::string pedestalmode(int action);
|
||||
std::string period(int action);
|
||||
@@ -556,9 +550,9 @@ class Caller {
|
||||
{"patwait1", &Caller::patwait1},
|
||||
{"patwait2", &Caller::patwait2},
|
||||
{"patwaittime", &Caller::patwaittime},
|
||||
{"patwaittime0", &Caller::patwaittime0},
|
||||
{"patwaittime1", &Caller::patwaittime1},
|
||||
{"patwaittime2", &Caller::patwaittime2},
|
||||
{"patwaittime0", &Caller::patwaittime},
|
||||
{"patwaittime1", &Caller::patwaittime},
|
||||
{"patwaittime2", &Caller::patwaittime},
|
||||
{"patword", &Caller::patword},
|
||||
{"pedestalmode", &Caller::pedestalmode},
|
||||
{"period", &Caller::period},
|
||||
|
||||
@@ -175,28 +175,16 @@ void Caller::WrongNumberOfParameters(size_t expected) {
|
||||
std::to_string(args.size()) + "\n");
|
||||
}
|
||||
|
||||
void Caller::GetLevelAndUpdateArgIndex(int action,
|
||||
std::string levelSeparatedCommand,
|
||||
int &level, int &iArg, size_t nGetArgs,
|
||||
size_t nPutArgs) {
|
||||
if (cmd == levelSeparatedCommand) {
|
||||
++nGetArgs;
|
||||
++nPutArgs;
|
||||
} else {
|
||||
int Caller::GetLevelAndInsertIntoArgs(std::string levelSeparatedCommand) {
|
||||
if (cmd != levelSeparatedCommand) {
|
||||
LOG(logWARNING) << "This command is deprecated and will be removed. "
|
||||
"Please migrate to "
|
||||
<< levelSeparatedCommand;
|
||||
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||
args.insert(args.begin(), std::to_string(level));
|
||||
return true;
|
||||
}
|
||||
if (action == defs::GET_ACTION && args.size() != nGetArgs) {
|
||||
WrongNumberOfParameters(nGetArgs);
|
||||
} else if (action == defs::PUT_ACTION && args.size() != nPutArgs) {
|
||||
WrongNumberOfParameters(nPutArgs);
|
||||
}
|
||||
if (cmd == levelSeparatedCommand) {
|
||||
level = StringTo<int>(args[iArg++]);
|
||||
} else {
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string Caller::free(int action) {
|
||||
@@ -1017,6 +1005,81 @@ std::string Caller::slowadc(int action) {
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
std::string Caller::patwaittime(int action) {
|
||||
std::ostringstream os;
|
||||
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[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."
|
||||
<< '\n';
|
||||
return os.str();
|
||||
}
|
||||
|
||||
// parse level
|
||||
bool deprecated_cmd = GetLevelAndInsertIntoArgs("patwaittime");
|
||||
int level = 0;
|
||||
try {
|
||||
if (args.size() > 0)
|
||||
level = StringTo<int>(args[0]);
|
||||
} catch (const std::exception &e) {
|
||||
LOG(logERROR) << "Could not scan level.";
|
||||
throw;
|
||||
}
|
||||
if (!deprecated_cmd && args.size() >= 1)
|
||||
os << args[0] << ' ';
|
||||
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 1 && args.size() != 2)
|
||||
WrongNumberOfParameters(1);
|
||||
// with time unit
|
||||
if (args.size() == 2) {
|
||||
auto t =
|
||||
det->getPatternWaitInterval(level, std::vector<int>{det_id});
|
||||
os << OutString(t, args[1]) << '\n';
|
||||
}
|
||||
// in clocks
|
||||
else {
|
||||
auto t = det->getPatternWaitClocks(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2 && args.size() != 3)
|
||||
WrongNumberOfParameters(2);
|
||||
// clocks (all digits)
|
||||
if (args.size() == 2 &&
|
||||
std::all_of(args[1].begin(), args[1].end(), ::isdigit)) {
|
||||
uint64_t waittime = StringTo<uint64_t>(args[1]);
|
||||
det->setPatternWaitClocks(level, waittime,
|
||||
std::vector<int>{det_id});
|
||||
os << waittime << '\n';
|
||||
}
|
||||
// time
|
||||
else {
|
||||
time::ns converted_time{0};
|
||||
try {
|
||||
if (args.size() == 2) {
|
||||
std::string tmp_time(args[1]);
|
||||
std::string unit = RemoveUnit(tmp_time);
|
||||
converted_time = StringTo<time::ns>(tmp_time, unit);
|
||||
} else {
|
||||
converted_time = StringTo<time::ns>(args[1], args[2]);
|
||||
}
|
||||
} catch (...) {
|
||||
throw RuntimeError("Could not convert argument to time::ns");
|
||||
}
|
||||
det->setPatternWaitInterval(level, converted_time,
|
||||
std::vector<int>{det_id});
|
||||
os << args[1];
|
||||
if (args.size() == 3)
|
||||
os << ' ' << args[2];
|
||||
os << '\n';
|
||||
}
|
||||
} else {
|
||||
throw RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
std::string Caller::rx_dbitlist(int action) {
|
||||
std::ostringstream os;
|
||||
if (action == defs::HELP_ACTION) {
|
||||
|
||||
@@ -2593,12 +2593,21 @@ void Detector::setPatternWaitAddr(int level, int addr, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPatternWaitAddr, pos, level, addr);
|
||||
}
|
||||
|
||||
Result<uint64_t> Detector::getPatternWaitTime(int level, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getPatternWaitTime, pos, level);
|
||||
Result<uint64_t> Detector::getPatternWaitClocks(int level,
|
||||
Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getPatternWaitClocks, pos, level);
|
||||
}
|
||||
|
||||
void Detector::setPatternWaitTime(int level, uint64_t t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPatternWaitTime, pos, level, t);
|
||||
void Detector::setPatternWaitClocks(int level, uint64_t t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPatternWaitClocks, pos, level, t);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getPatternWaitInterval(int level, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getPatternWaitInterval, pos, level);
|
||||
}
|
||||
|
||||
void Detector::setPatternWaitInterval(int level, ns t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPatternWaitInterval, pos, level, t.count());
|
||||
}
|
||||
|
||||
Result<uint64_t> Detector::getPatternMask(Positions pos) {
|
||||
|
||||
@@ -634,10 +634,22 @@ void Module::setNumberOfTriggers(int64_t value) {
|
||||
}
|
||||
|
||||
int64_t Module::getExptime(int gateIndex) const {
|
||||
if (shm()->detType == CHIPTESTBOARD ||
|
||||
shm()->detType == XILINX_CHIPTESTBOARD) {
|
||||
LOG(logWARNING)
|
||||
<< "Exposure time is deprecated and will be removed for this "
|
||||
"detector. Please migrate to patwaittime.";
|
||||
}
|
||||
return sendToDetector<int64_t>(F_GET_EXPTIME, gateIndex);
|
||||
}
|
||||
|
||||
void Module::setExptime(int gateIndex, int64_t value) {
|
||||
if (shm()->detType == CHIPTESTBOARD ||
|
||||
shm()->detType == XILINX_CHIPTESTBOARD) {
|
||||
LOG(logWARNING)
|
||||
<< "Exposure time is deprecated and will be removed for this "
|
||||
"detector. Please migrate to patwaittime.";
|
||||
}
|
||||
int64_t prevVal = value;
|
||||
if (shm()->detType == EIGER) {
|
||||
prevVal = getExptime(-1);
|
||||
@@ -2621,15 +2633,23 @@ void Module::setPatternWaitAddr(int level, int addr) {
|
||||
sendToDetector<int>(F_SET_PATTERN_WAIT_ADDR, args);
|
||||
}
|
||||
|
||||
uint64_t Module::getPatternWaitTime(int level) const {
|
||||
uint64_t Module::getPatternWaitClocks(int level) const {
|
||||
uint64_t args[]{static_cast<uint64_t>(level),
|
||||
static_cast<uint64_t>(GET_FLAG)};
|
||||
return sendToDetector<uint64_t>(F_SET_PATTERN_WAIT_TIME, args);
|
||||
return sendToDetector<uint64_t>(F_SET_PATTERN_WAIT_CLOCKS, args);
|
||||
}
|
||||
|
||||
void Module::setPatternWaitTime(int level, uint64_t t) {
|
||||
void Module::setPatternWaitClocks(int level, uint64_t t) {
|
||||
uint64_t args[]{static_cast<uint64_t>(level), t};
|
||||
sendToDetector<uint64_t>(F_SET_PATTERN_WAIT_TIME, args);
|
||||
sendToDetector<uint64_t>(F_SET_PATTERN_WAIT_CLOCKS, args);
|
||||
}
|
||||
|
||||
uint64_t Module::getPatternWaitInterval(int level) const {
|
||||
return sendToDetector<uint64_t>(F_GET_PATTERN_WAIT_INTERVAL, level);
|
||||
}
|
||||
void Module::setPatternWaitInterval(int level, uint64_t t) {
|
||||
uint64_t args[]{static_cast<uint64_t>(level), t};
|
||||
sendToDetector(F_SET_PATTERN_WAIT_INTERVAL, args, nullptr);
|
||||
}
|
||||
|
||||
uint64_t Module::getPatternMask() const {
|
||||
|
||||
@@ -550,8 +550,10 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setPatternLoopCycles(int level, int n);
|
||||
int getPatternWaitAddr(int level) const;
|
||||
void setPatternWaitAddr(int level, int addr);
|
||||
uint64_t getPatternWaitTime(int level) const;
|
||||
void setPatternWaitTime(int level, uint64_t t);
|
||||
uint64_t getPatternWaitClocks(int level) const;
|
||||
void setPatternWaitClocks(int level, uint64_t t);
|
||||
uint64_t getPatternWaitInterval(int level) const;
|
||||
void setPatternWaitInterval(int level, uint64_t t);
|
||||
uint64_t getPatternMask() const;
|
||||
void setPatternMask(uint64_t mask);
|
||||
uint64_t getPatternBitMask() const;
|
||||
|
||||
@@ -2012,29 +2012,13 @@ int InferAction::patlimits() {
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patloop() {
|
||||
int InferAction::patloop() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patloop. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
int InferAction::patloop0() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
int InferAction::patloop0() {
|
||||
int InferAction::patloop1() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patloop0. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patloop1() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patloop1. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patloop2() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patloop2. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
int InferAction::patloop2() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
int InferAction::patmask() {
|
||||
|
||||
@@ -2052,29 +2036,13 @@ int InferAction::patmask() {
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::patnloop() {
|
||||
int InferAction::patnloop() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patnloop. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
int InferAction::patnloop0() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
int InferAction::patnloop0() {
|
||||
int InferAction::patnloop1() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patnloop0. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patnloop1() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patnloop1. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patnloop2() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patnloop2. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
int InferAction::patnloop2() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
int InferAction::patsetbit() {
|
||||
|
||||
@@ -2116,29 +2084,13 @@ int InferAction::patternstart() {
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::patwait() {
|
||||
int InferAction::patwait() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patwait. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
int InferAction::patwait0() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
int InferAction::patwait0() {
|
||||
int InferAction::patwait1() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patwait0. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patwait1() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patwait1. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patwait2() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patwait2. Use "
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
int InferAction::patwait2() { throw RuntimeError("infer_action is disabled"); }
|
||||
|
||||
int InferAction::patwaittime() {
|
||||
|
||||
@@ -2146,24 +2098,6 @@ int InferAction::patwaittime() {
|
||||
"sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patwaittime0() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patwaittime0. "
|
||||
"Use sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patwaittime1() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patwaittime1. "
|
||||
"Use sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patwaittime2() {
|
||||
|
||||
throw RuntimeError("sls_detector is disabled for command: patwaittime2. "
|
||||
"Use sls_detector_get or sls_detector_put");
|
||||
}
|
||||
|
||||
int InferAction::patword() {
|
||||
|
||||
if (args.size() == 1) {
|
||||
|
||||
@@ -161,9 +161,6 @@ class InferAction {
|
||||
int patwait1();
|
||||
int patwait2();
|
||||
int patwaittime();
|
||||
int patwaittime0();
|
||||
int patwaittime1();
|
||||
int patwaittime2();
|
||||
int patword();
|
||||
int pedestalmode();
|
||||
int period();
|
||||
@@ -498,9 +495,9 @@ class InferAction {
|
||||
{"patwait1", &InferAction::patwait1},
|
||||
{"patwait2", &InferAction::patwait2},
|
||||
{"patwaittime", &InferAction::patwaittime},
|
||||
{"patwaittime0", &InferAction::patwaittime0},
|
||||
{"patwaittime1", &InferAction::patwaittime1},
|
||||
{"patwaittime2", &InferAction::patwaittime2},
|
||||
{"patwaittime0", &InferAction::patwaittime},
|
||||
{"patwaittime1", &InferAction::patwaittime},
|
||||
{"patwaittime2", &InferAction::patwaittime},
|
||||
{"patword", &InferAction::patword},
|
||||
{"pedestalmode", &InferAction::pedestalmode},
|
||||
{"period", &InferAction::period},
|
||||
|
||||
@@ -329,7 +329,7 @@ TEST_CASE("patwaittime", "[.cmdcall]") {
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
continue;
|
||||
}
|
||||
auto prev_val = det.getPatternWaitTime(iLoop);
|
||||
auto prev_val = det.getPatternWaitClocks(iLoop);
|
||||
std::string sLoop = ToString(iLoop);
|
||||
if (iLoop < 3) {
|
||||
std::string deprecatedCmd = "patwaittime" + sLoop;
|
||||
@@ -354,8 +354,24 @@ TEST_CASE("patwaittime", "[.cmdcall]") {
|
||||
caller.call("patwaittime", {sLoop}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwaittime " + sLoop + " 8589936640\n");
|
||||
}
|
||||
// time units
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("patwaittime", {sLoop, "50us"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwaittime " + sLoop + " 50us\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call("patwaittime", {sLoop, "us"}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwaittime " + sLoop + " 50us\n");
|
||||
if (iLoop == 0 && det_type != defs::MYTHEN3) {
|
||||
std::ostringstream oss;
|
||||
caller.call("exptime", {"us"}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "exptime 50us\n");
|
||||
}
|
||||
}
|
||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
||||
det.setPatternWaitTime(iLoop, prev_val[iDet], {iDet});
|
||||
det.setPatternWaitClocks(iLoop, prev_val[iDet], {iDet});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user