Dev/reg bit change no validate (#970)

- do not validate write reg, setbit and clearbit by default anymore
- --validate will force validation on the bitmask or entire reg
- remove return value for write reg (across server to client, but thankfully not in the Detector class)
- extend validation into writereg, setbit and clearbit for Eiger (always special)
-  need to check python (TODO)
- missed the rx_zmqip implementations in detector.h and python bindings
This commit is contained in:
2024-09-30 16:54:12 +02:00
committed by GitHub
parent a44ba4dc35
commit 2dc0963c56
33 changed files with 499 additions and 171 deletions

View File

@ -21,8 +21,8 @@ type_values = {
"special::currentSourceFix": ["fix", "nofix"],
"special::currentSourceLow": ["normal", "low"],
"special::path": [],
"special::pedestal_parameters" : ["", "0"]
"special::pedestal_parameters" : ["", "0"],
"special::validate": ["--validate"]
}

View File

@ -330,6 +330,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
return 0
}
@ -342,6 +345,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
return 0
}
@ -1814,6 +1820,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
return 0
}
@ -1826,6 +1835,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
@ -2211,6 +2223,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
return 0
}

View File

@ -254,6 +254,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
return 0
}
@ -266,6 +269,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
return 0
}
@ -1738,6 +1744,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
return 0
}
@ -1750,6 +1759,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
@ -2135,6 +2147,9 @@ fi
if [[ "${cword}" == "3" ]]; then
FCN_RETURN=""
fi
if [[ "${cword}" == "4" ]]; then
FCN_RETURN="--validate"
fi
fi
return 0
}

View File

@ -4173,7 +4173,7 @@ update:
output: [ '"successful"' ]
reg:
help: "[address] [32 bit value]\n\t[Mythen3][Gotthard2] Reads/writes to a 32 bit register in hex. Advanced Function!\n\tGoes to stop server. Hence, can be called while calling blocking acquire().\n\t[Eiger] +0x100 for only left, +0x200 for only right."
help: "[address] [32 bit value][(optional)--validate]\n\t[Mythen3][Gotthard2] Reads/writes to a 32 bit register in hex. Advanced Function!\n\tGoes to stop server. Hence, can be called while calling blocking acquire().\n\t\t Use --validate to force validation when writing to it.\n\t[Eiger] +0x100 for only left, +0x200 for only right."
actions:
GET:
argc: 1
@ -4184,13 +4184,23 @@ reg:
cast_input: [ true ]
output: [ OutStringHex(t) ]
PUT:
argc: 2
require_det_id: true
function: writeRegister
input: [ 'args[0]', 'args[1]' ]
input_types: [ uint32_t, uint32_t ]
cast_input: [ true, true ]
output: [ ToString(args) ]
output: [ '"["', 'args[0]', '", "', 'args[1]', '"]"' ]
args:
- argc: 2
input: [ 'args[0]', 'args[1]', '"0"' ]
input_types: [ uint32_t, uint32_t, bool ]
arg_types: [ uint32_t, uint32_t ]
cast_input: [ true, true, true ]
- argc: 3
arg_types: [ uint32_t, uint32_t, special::validate ]
exceptions:
- condition: 'args[2] != "--validate"'
message: '"Could not scan third argument. Did you mean --validate?"'
input: [ 'args[0]', 'args[1]', '"1"' ]
input_types: [ uint32_t, uint32_t, bool ]
cast_input: [ true, true, true ]
adcreg:
help: "[address] [value]\n\t[Jungfrau][Moench][Ctb][Gotthard] Writes to an adc register in hex. Advanced user Function!"
@ -4223,27 +4233,40 @@ Setbit:
template: true
actions:
PUT:
argc: 2
exceptions:
- condition: 'StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31'
message: '"Bit number out of range: " + args[1]'
require_det_id: true
function: setBit
input: [ 'args[0]', 'args[1]' ]
input_types: [ uint32_t, int ]
cast_input: [ true, true ]
output: [ ToString(args) ]
output: [ '"["', 'args[0]', '", "', 'args[1]', '"]"' ]
args:
- argc: 2
exceptions:
- condition: 'StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31'
message: '"Bit number out of range: " + args[1]'
input: [ 'args[0]', 'args[1]', '"0"' ]
input_types: [ uint32_t, int, bool ]
arg_types: [ uint32_t, int ]
cast_input: [ true, true, true ]
- argc: 3
arg_types: [ uint32_t, int, special::validate ]
exceptions:
- condition: 'StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31'
message: '"Bit number out of range: " + args[1]'
- condition: 'args[2] != "--validate"'
message: '"Could not scan third argument. Did you mean --validate?"'
input: [ 'args[0]', 'args[1]', '"1"' ]
input_types: [ uint32_t, int, bool ]
cast_input: [ true, true, true ]
setbit:
inherit_actions: Setbit
help: "[reg address in hex] [bit index]\n\tSets bit in address."
help: "[reg address in hex] [bit index]\n\tSets bit in address.\n\tUse --validate to force validation."
actions:
PUT:
function: setBit
clearbit:
inherit_actions: Setbit
help: "[reg address in hex] [bit index]\n\tClears bit in address."
help: "[reg address in hex] [bit index]\n\tClears bit in address.\n\tUse --validate to force validation."
actions:
PUT:
function: clearBit

View File

@ -1104,6 +1104,7 @@ clearbit:
cast_input:
- true
- true
- true
check_det_id: false
convert_det_id: true
exceptions:
@ -1113,16 +1114,56 @@ clearbit:
input:
- args[0]
- args[1]
- '"0"'
input_types:
- uint32_t
- int
- bool
output:
- ToString(args)
- '"["'
- args[0]
- '", "'
- args[1]
- '"]"'
require_det_id: true
store_result_in_t: false
- arg_types:
- uint32_t
- int
- special::validate
argc: 3
cast_input:
- true
- true
- true
check_det_id: false
convert_det_id: true
exceptions:
- condition: StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31
message: '"Bit number out of range: " + args[1]'
- condition: args[2] != "--validate"
message: '"Could not scan third argument. Did you mean --validate?"'
function: clearBit
input:
- args[0]
- args[1]
- '"1"'
input_types:
- uint32_t
- int
- bool
output:
- '"["'
- args[0]
- '", "'
- args[1]
- '"]"'
require_det_id: true
store_result_in_t: false
command_name: clearbit
function_alias: clearbit
help: "[reg address in hex] [bit index]\n\tClears bit in address."
help: "[reg address in hex] [bit index]\n\tClears bit in address.\n\tUse --validate\
\ to force validation."
infer_action: true
template: true
clearbusy:
@ -7973,25 +8014,64 @@ reg:
cast_input:
- true
- true
- true
check_det_id: false
convert_det_id: true
function: writeRegister
input:
- args[0]
- args[1]
- '"0"'
input_types:
- uint32_t
- uint32_t
- bool
output:
- ToString(args)
- '"["'
- args[0]
- '", "'
- args[1]
- '"]"'
require_det_id: true
store_result_in_t: false
- arg_types:
- uint32_t
- uint32_t
- special::validate
argc: 3
cast_input:
- true
- true
- true
check_det_id: false
convert_det_id: true
exceptions:
- condition: args[2] != "--validate"
message: '"Could not scan third argument. Did you mean --validate?"'
function: writeRegister
input:
- args[0]
- args[1]
- '"1"'
input_types:
- uint32_t
- uint32_t
- bool
output:
- '"["'
- args[0]
- '", "'
- args[1]
- '"]"'
require_det_id: true
store_result_in_t: false
command_name: reg
function_alias: reg
help: "[address] [32 bit value]\n\t[Mythen3][Gotthard2] Reads/writes to a 32 bit\
\ register in hex. Advanced Function!\n\tGoes to stop server. Hence, can be called\
\ while calling blocking acquire().\n\t[Eiger] +0x100 for only left, +0x200 for\
\ only right."
help: "[address] [32 bit value][(optional)--validate]\n\t[Mythen3][Gotthard2] Reads/writes\
\ to a 32 bit register in hex. Advanced Function!\n\tGoes to stop server. Hence,\
\ can be called while calling blocking acquire().\n\t\t Use --validate to force\
\ validation when writing to it.\n\t[Eiger] +0x100 for only left, +0x200 for only\
\ right."
infer_action: true
resetdacs:
actions:
@ -9646,6 +9726,7 @@ setbit:
cast_input:
- true
- true
- true
check_det_id: false
convert_det_id: true
exceptions:
@ -9655,16 +9736,56 @@ setbit:
input:
- args[0]
- args[1]
- '"0"'
input_types:
- uint32_t
- int
- bool
output:
- ToString(args)
- '"["'
- args[0]
- '", "'
- args[1]
- '"]"'
require_det_id: true
store_result_in_t: false
- arg_types:
- uint32_t
- int
- special::validate
argc: 3
cast_input:
- true
- true
- true
check_det_id: false
convert_det_id: true
exceptions:
- condition: StringTo<int>(args[1]) < 0 || StringTo<int>(args[1]) > 31
message: '"Bit number out of range: " + args[1]'
- condition: args[2] != "--validate"
message: '"Could not scan third argument. Did you mean --validate?"'
function: setBit
input:
- args[0]
- args[1]
- '"1"'
input_types:
- uint32_t
- int
- bool
output:
- '"["'
- args[0]
- '", "'
- args[1]
- '"]"'
require_det_id: true
store_result_in_t: false
command_name: setbit
function_alias: setbit
help: "[reg address in hex] [bit index]\n\tSets bit in address."
help: "[reg address in hex] [bit index]\n\tSets bit in address.\n\tUse --validate\
\ to force validation."
infer_action: true
template: true
settings: