PLOC SUPV Extensions #258
@ -85,7 +85,7 @@ FACTORY_RESET_OPS = {
|
||||
|
||||
|
||||
class SupvActionId(enum.IntEnum):
|
||||
HK_REPORT = 1
|
||||
REQUEST_HK_REPORT = 1
|
||||
START_MPSOC = 3
|
||||
SHUTWOWN_MPSOC = 4
|
||||
SEL_MPSOC_BOOT_IMAGE = 5
|
||||
@ -112,7 +112,7 @@ class SupvActionId(enum.IntEnum):
|
||||
SET_GPIO = 34
|
||||
READ_GPIO = 35
|
||||
RESTART_SUPERVISOR = 36
|
||||
LOGGING_REQUEST_COUNTERS = 38
|
||||
REQUEST_LOGGING_COUNTERS = 38
|
||||
FACTORY_RESET = 39
|
||||
START_MPSOC_QUIET = 45
|
||||
SET_SHUTDOWN_TIMEOUT = 46
|
||||
@ -145,7 +145,7 @@ class OpCode:
|
||||
ON = "on"
|
||||
NORMAL = "nml"
|
||||
HK_TO_OBC = "hk_to_obc"
|
||||
REQUEST_HK_SET = "req_hk_from_dev"
|
||||
REQUEST_HK_SET_FROM_DEV = "req_hk_from_dev"
|
||||
REQUEST_HK_SET = "req_hk"
|
||||
START_MPSOC = "start_mpsoc"
|
||||
SHUTDOWN_MPSOC = "stop_mpsoc"
|
||||
@ -166,7 +166,8 @@ class Info(str, enum.Enum):
|
||||
ON = "Switch On"
|
||||
NML = "Switch Normal"
|
||||
HK_TO_OBC = "Request HK from PLOC SUPV"
|
||||
REQUEST_HK = "Request HK set from PLOC Handler"
|
||||
REQUEST_HK_SET_FROM_DEV = "Request HK set from the device to the PLOC Handler"
|
||||
REQUEST_HK_SET = "Request HK set from PLOC Handler"
|
||||
SET_TIME_REF = "Set time reference"
|
||||
FACTORY_FLASH = "Factory Flash Mode"
|
||||
PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes"
|
||||
@ -185,7 +186,8 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add(OpCode.ON, Info.ON)
|
||||
oce.add(OpCode.NORMAL, Info.NML)
|
||||
oce.add(OpCode.HK_TO_OBC, Info.HK_TO_OBC)
|
||||
oce.add(OpCode.REQUEST_HK_SET, Info.REQUEST_HK)
|
||||
oce.add(OpCode.REQUEST_HK_SET, Info.REQUEST_HK_SET)
|
||||
oce.add(OpCode.REQUEST_HK_SET_FROM_DEV, Info.REQUEST_HK_SET_FROM_DEV)
|
||||
oce.add(OpCode.START_MPSOC, "PLOC Supervisor: Start MPSoC")
|
||||
oce.add(OpCode.SHUTDOWN_MPSOC, "PLOC Supervisor: Shutdown MPSoC")
|
||||
oce.add(OpCode.SEL_NVM, Info.SEL_NVM)
|
||||
@ -252,13 +254,29 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code == OpCode.HK_TO_OBC:
|
||||
q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}")
|
||||
command = obyt + struct.pack("!I", SupvActionId.HK_REPORT)
|
||||
command = obyt + struct.pack("!I", SupvActionId.REQUEST_HK_REPORT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == OpCode.REQUEST_HK_SET:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK}")
|
||||
sid = make_sid(object_id.as_bytes, SetId.HK_REPORT)
|
||||
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK_SET}")
|
||||
sid = make_sid(object_id.as_bytes, prompt_set_id())
|
||||
cmd = generate_one_hk_command(sid)
|
||||
q.add_pus_tc(cmd)
|
||||
if op_code == OpCode.REQUEST_HK_SET_FROM_DEV:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REQUEST_HK_SET_FROM_DEV}")
|
||||
set_id = prompt_set_id()
|
||||
action_cmd = None
|
||||
if set_id == SetId.HK_REPORT:
|
||||
action_cmd = create_action_cmd(PLOC_SUPV_ID, SupvActionId.REQUEST_HK_REPORT)
|
||||
if set_id == SetId.ADC_REPORT:
|
||||
action_cmd = create_action_cmd(
|
||||
PLOC_SUPV_ID, SupvActionId.REQUEST_ADC_REPORT
|
||||
)
|
||||
if set_id == SetId.COUNTERS_REPORT:
|
||||
action_cmd = create_action_cmd(
|
||||
PLOC_SUPV_ID, SupvActionId.REQUEST_LOGGING_COUNTERS
|
||||
)
|
||||
assert action_cmd is not None
|
||||
q.add_pus_tc(action_cmd)
|
||||
elif op_code == OpCode.START_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Start MPSoC")
|
||||
command = obyt + struct.pack("!I", SupvActionId.START_MPSOC)
|
||||
@ -441,7 +459,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
||||
if op_code == "54":
|
||||
q.add_log_cmd("PLOC Supervisor: Logging request counters")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionId.LOGGING_REQUEST_COUNTERS
|
||||
"!I", SupvActionId.REQUEST_LOGGING_COUNTERS
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "55":
|
||||
@ -488,6 +506,20 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
||||
q.add_pus_tc(command)
|
||||
|
||||
|
||||
def prompt_set_id() -> SetId:
|
||||
for set_id in SetId:
|
||||
print(f"{set_id}: {set_id.name}")
|
||||
while True:
|
||||
set_id = int(input("Please select the set ID to request"))
|
||||
try:
|
||||
set_id_typed = SetId(set_id)
|
||||
except ValueError:
|
||||
_LOGGER.warning("invalid set ID, try again")
|
||||
continue
|
||||
break
|
||||
return set_id_typed
|
||||
|
||||
|
||||
def pack_sel_boot_image_cmd(
|
||||
object_id: bytes, mem: int, bp0: int, bp1: int, bp2: int
|
||||
) -> bytearray:
|
||||
|
Loading…
Reference in New Issue
Block a user