mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 00:58:01 +02: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')
|
||||
|
Reference in New Issue
Block a user