update fac reset cmd

This commit is contained in:
Robin Müller 2022-12-23 10:12:30 +01:00
parent 00991b92f1
commit 20c2f61555

View File

@ -64,6 +64,23 @@ event_buffer_path_dict = {
}
FactoryResetOp = {
0x00: "CLEAR_MRAM_EVENT_BUF",
0x01: "CLEAR_MRAM_ADC_BUF",
0x02: "FACTORY_DEFAULT_MRAM_SYS_CFG",
0x03: "FACTORY_DEFAULT_MRAM_DBG_CFG",
0x04: "FACTORY_DEFAULT_BOOTMAN_CFG",
0x05: "FACTORY_DEFAULT_DATA_LOGGER",
0x06: "DATA_LOGGER_OP_DATA_TO_ZERO",
0x07: "FACTORY_DEFAULT_MRAM_LATCHUP_MON",
0x08: "FACTORY_DEFAULT_ADC_MON_CFG",
0x09: "FACTORY_DEFAULT_WATCHDOG_MON_CFG",
0x0A: "FACTORY_DEFAULT_HK_CFG",
0x0B: "FACTORY_DEFAULT_MEM_MAN_CFG",
0x10: "REDWIRE_TASK_1",
0x11: "REDWIRE_TASK_2",
0x12: "REDWIRE_TASK_3",
}
class SupvActionIds:
HK_REPORT = 1
START_MPSOC = 3
@ -92,11 +109,8 @@ class SupvActionIds:
SET_GPIO = 34
READ_GPIO = 35
RESTART_SUPERVISOR = 36
FACTORY_RESET_CLEAR_ALL = 37
LOGGING_REQUEST_COUNTERS = 38
UPDATE_IMAGE_DATA = 39
FACTORY_RESET_CLEAR_MIRROR = 40
FACTORY_RESET_CLEAR_CIRCULAR = 41
FACTORY_RESET = 39
START_MPSOC_QUIET = 45
SET_SHUTDOWN_TIMEOUT = 46
FACTORY_FLASH = 47
@ -133,6 +147,7 @@ class OpCodes:
REQ_BOOT_STATUS_REPORT = ["13", "boot_report"]
START_UPDATE = ["42", "start_update"]
PERFORM_UPDATE = ["update"]
FACTORY_RESET = ["factory_reset"]
MEM_CHECK = ["mem_check"]
@ -147,6 +162,7 @@ class Info(str, enum.Enum):
FACTORY_FLASH = "Factory Flash Mode"
PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes"
START_UPDATE = "Start new MPSoC SW update"
FACTORY_RESET = "Factory Reset of loggers"
REQ_BOOT_STATUS_REPORT = "Request boot status report and HK"
MEM_CHECK = "Memory Check"
SEL_NVM = "Select NVM"
@ -165,6 +181,7 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCodes.SHUTDOWN_MPSOC, "PLOC Supervisor: Shutdown MPSoC")
oce.add(OpCodes.SEL_NVM, Info.SEL_NVM)
oce.add(OpCodes.SET_TIME_REF, Info.SET_TIME_REF)
oce.add(OpCodes.FACTORY_RESET, Info.FACTORY_RESET)
oce.add("8", "PLOC Supervisor: Set max restart tries")
oce.add("9", "PLOC Supervisor: Reset MPSoC")
oce.add("11", "PLOC Supervisor: Set boot timeout")
@ -183,9 +200,6 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
oce.add("35", "PLOC Supervisor: Set GPIO")
oce.add("36", "PLOC Supervisor: Read GPIO")
oce.add("37", "PLOC Supervisor: Restart supervisor")
oce.add("38", "PLOC Supervisor: Factory reset clear all")
oce.add("39", "PLOC Supervisor: Factory reset clear mirror entries")
oce.add("40", "PLOC Supervisor: Factory reset clear circular entries")
oce.add(OpCodes.PERFORM_UPDATE, Info.PERFORM_UPDATE)
oce.add(OpCodes.START_UPDATE, Info.START_UPDATE)
oce.add("43", "PLOC Supervisor: Terminate supervisor process")
@ -251,6 +265,8 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
bp2 = int(input("BP2 (0 or 1): "))
command = pack_sel_boot_image_cmd(object_id.as_bytes, mem, bp0, bp1, bp2)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code in OpCodes.FACTORY_RESET:
q.add_log_cmd(f"{prefix}: {Info.FACTORY_RESET}")
if op_code == "8":
q.add_log_cmd("PLOC Supervisor: Set max restart tries")
restart_tries = int(input("Specify maximum restart tries: "))
@ -349,24 +365,6 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
"!I", SupvActionIds.RESTART_SUPERVISOR
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "38":
q.add_log_cmd("PLOC Supervisor: Factory reset clear all")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "39":
q.add_log_cmd("PLOC Supervisor: Factory reset clear mirror entries")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_MIRROR
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "40":
q.add_log_cmd("PLOC Supervisor: Factory reset clear circular entries")
command = object_id.as_bytes + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code in OpCodes.START_UPDATE:
q.add_log_cmd("PLOC Supversior: Start new MPSoC SW update")
command = pack_update_command(object_id.as_bytes, True)