From 5e3b60b3af1b6ba688d7ddba4e740f6dfbed5fe1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 Jan 2024 15:56:03 +0100 Subject: [PATCH] cleaned up PLOC SUPV a bit --- CHANGELOG.md | 6 + eive_tmtc/tmtc/payload/ploc_supervisor.py | 134 ++++++++-------------- 2 files changed, 53 insertions(+), 87 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 416b2ce..0d723b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ list yields a list of all related PRs for each release. # [unreleased] +# [v6.0.0] 2024-01-31 + +## Changed + +- Added new PLOC SUPV commands to test sets, cleaned up PLOC SUPV commanding. + # [v5.13.0] 2024-01-30 ## Added diff --git a/eive_tmtc/tmtc/payload/ploc_supervisor.py b/eive_tmtc/tmtc/payload/ploc_supervisor.py index 62973a1..3227006 100644 --- a/eive_tmtc/tmtc/payload/ploc_supervisor.py +++ b/eive_tmtc/tmtc/payload/ploc_supervisor.py @@ -134,19 +134,24 @@ class OpCode: ON = "on" NORMAL = "nml" HK_TO_OBC = "hk_to_obc" - REQUEST_HK_SET_FROM_DEV = "req_hk_from_dev" - REQUEST_HK_SET = "req_hk" + REQUEST_GENERIC_HK_SET = "req_generic_hk" START_MPSOC = "start_mpsoc" SHUTDOWN_MPSOC = "stop_mpsoc" SEL_NVM = "sel_nvm" SET_TIME_REF = "set_time_ref" FACTORY_FLASH = "factory_flash" - REQ_BOOT_STATUS_REPORT = "boot_report" START_UPDATE = "start_update" PERFORM_UPDATE = "update" FACTORY_RESET = "factory_reset" MEM_CHECK = "mem_check" RESET_MPSOC = "reset_mpsoc" + SET_GPIO = "set_gpio" + READ_GPIO = "read_gpio" + READ_STATUS_REPORT = "read_hk_set" + READ_BOOT_STATUS_REPORT = "boot_report" + READ_LATCHUP_STATUS_REPORT = "read_latchup_status_report" + READ_ADC_STATUS_REPORT = "read_adc_status_report" + READ_COUNTERS_REPORT = "read_counters_report" class Info(str, enum.Enum): @@ -154,17 +159,22 @@ class Info(str, enum.Enum): ON = "Switch On" NML = "Switch Normal" HK_TO_OBC = "Request HK from PLOC SUPV" - REQUEST_HK_SET_FROM_DEV = "Request HK set from the device to the PLOC Handler" - REQUEST_HK_SET = "Request HK set from PLOC Handler" + REQUEST_GENERIC_HK_SET = "Request prompted 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" 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" RESET_MPSOC = "Reset MPSoC" + SET_GPIO = "Set GPIO" + READ_GPIO = "Read GPIO" + READ_STATUS_REPORT = "Read HK status report" + READ_LATCHUP_STATUS_REPORT = "Read Latchup status report" + READ_BOOT_STATUS_REPORT = "Read boot status report" + READ_ADC_STATUS_REPORT = "Read ADC status report" + READ_COUNTERS_REPORT = "Read Data Logger counters report" @tmtc_definitions_provider @@ -174,8 +184,7 @@ 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_SET) - oce.add(OpCode.REQUEST_HK_SET_FROM_DEV, Info.REQUEST_HK_SET_FROM_DEV) + oce.add(OpCode.REQUEST_GENERIC_HK_SET, Info.REQUEST_GENERIC_HK_SET) 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) @@ -184,11 +193,7 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper): oce.add(OpCode.RESET_MPSOC, Info.RESET_MPSOC) oce.add("8", "PLOC Supervisor: Set max restart tries") oce.add("11", "PLOC Supervisor: Set boot timeout") - oce.add("12", "PLOC Supervisor: Disable Hk") - oce.add(OpCode.REQ_BOOT_STATUS_REPORT, Info.REQ_BOOT_STATUS_REPORT) - oce.add("17", "PLOC Supervisor: Enable latchup alert") - oce.add("18", "PLOC Supervisor: Disable latchup alert") - oce.add("20", "PLOC Supervisor: Set alert limit") + oce.add(OpCode.READ_BOOT_STATUS_REPORT, Info.READ_BOOT_STATUS_REPORT) oce.add("23", "PLOC Supervisor: Set ADC enabled channels") oce.add("24", "PLOC Supervisor: Set ADC window and stride") oce.add("25", "PLOC Supervisor: Set ADC threshold") @@ -196,26 +201,26 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper): oce.add("27", "PLOC Supervisor: Copy ADC data to MRAM") oce.add("30", "PLOC Supervisor: Run auto EM tests") oce.add("31", "PLOC Supervisor: MRAM Wipe") - oce.add("35", "PLOC Supervisor: Set GPIO") - oce.add("36", "PLOC Supervisor: Read GPIO") + oce.add(OpCode.SET_GPIO, Info.SET_GPIO) + oce.add(OpCode.READ_GPIO, Info.READ_GPIO) oce.add("37", "PLOC Supervisor: Restart supervisor") oce.add(OpCode.PERFORM_UPDATE, Info.PERFORM_UPDATE) oce.add(OpCode.START_UPDATE, Info.START_UPDATE) oce.add("43", "PLOC Supervisor: Terminate supervisor process") - oce.add("44", "PLOC Supervisor: Start MPSoC quiet") oce.add("45", "PLOC Supervisor: Set shutdown timeout") oce.add(OpCode.FACTORY_FLASH, Info.FACTORY_FLASH) - oce.add("47", "PLOC Supervisor: Enable auto TM") - oce.add("48", "PLOC Supervisor: Disable auto TM") - oce.add("51", "PLOC Supervisor: Logging request event buffers") oce.add("52", "PLOC Supervisor: Logging clear counters") oce.add("53", "PLOC Supervisor: Logging set topic") - oce.add("54", "PLOC Supervisor: Logging request counters") - oce.add("55", "PLOC Supervisor: Request ADC Report") oce.add("56", "PLOC Supervisor: Reset PL") oce.add("57", "PLOC Supervisor: Enable NVMs") oce.add("58", "PLOC Supervisor: Continue update") oce.add(OpCode.MEM_CHECK, Info.MEM_CHECK) + + oce.add(OpCode.READ_STATUS_REPORT, Info.READ_STATUS_REPORT) + oce.add(OpCode.READ_ADC_STATUS_REPORT, Info.READ_ADC_STATUS_REPORT) + oce.add(OpCode.READ_LATCHUP_STATUS_REPORT, Info.READ_LATCHUP_STATUS_REPORT) + oce.add(OpCode.READ_BOOT_STATUS_REPORT, Info.READ_BOOT_STATUS_REPORT) + oce.add(OpCode.READ_COUNTERS_REPORT, Info.READ_COUNTERS_REPORT) defs.add_service(CustomServiceList.PLOC_SUPV.value, "PLOC Supervisor", oce) @@ -244,15 +249,16 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901 q.add_log_cmd(f"{prefix}: {Info.HK_TO_OBC}") 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_SET}") + if op_code == OpCode.REQUEST_GENERIC_HK_SET: + q.add_log_cmd(f"{prefix}: {Info.REQUEST_GENERIC_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}") + if op_code == OpCode.READ_STATUS_REPORT: + q.add_log_cmd(f"{prefix}: {Info.READ_STATUS_REPORT}") set_id = prompt_set_id() action_cmd = None + # First read the set from the device. if set_id == SetId.HK_REPORT: action_cmd = create_action_cmd(PLOC_SUPV_ID, SupvActionId.REQUEST_HK_REPORT) if set_id == SetId.ADC_REPORT: @@ -263,6 +269,20 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901 action_cmd = create_action_cmd( PLOC_SUPV_ID, SupvActionId.REQUEST_LOGGING_COUNTERS ) + if set_id == SetId.LATCHUP_REPORT: + action_cmd = create_action_cmd( + PLOC_SUPV_ID, SupvActionId.GET_LATCHUP_STATUS_REPORT + ) + if set_id == SetId.BOOT_STATUS_REPORT: + action_cmd = create_action_cmd( + PLOC_SUPV_ID, SupvActionId.GET_BOOT_STATUS_REPORT + ) + q.add_wait_seconds(2.0) + + # Now dump the HK set. + sid = make_sid(object_id.as_bytes, set_id) + req_hk = generate_one_hk_command(sid) + q.add_pus_tc(req_hk) assert action_cmd is not None q.add_pus_tc(action_cmd) elif op_code == OpCode.START_MPSOC: @@ -324,28 +344,6 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901 + struct.pack("!I", boot_timeout) ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "12": - q.add_log_cmd("PLOC Supervisor: Disable HK") - command = object_id.as_bytes + struct.pack("!I", SupvActionId.DISABLE_HK) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code in OpCode.REQ_BOOT_STATUS_REPORT: - q.add_log_cmd(f"{prefix}: {Info.REQ_BOOT_STATUS_REPORT}") - command = object_id.as_bytes + struct.pack( - "!I", SupvActionId.GET_BOOT_STATUS_REPORT - ) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - q.add_wait_seconds(2.0) - sid = make_sid(object_id.as_bytes, SetId.BOOT_STATUS_REPORT) - req_hk = generate_one_hk_command(sid) - q.add_pus_tc(req_hk) - if op_code == "17": - q.add_log_cmd("PLOC Supervisor: Enable latchup alert") - command = pack_lachtup_alert_cmd(object_id.as_bytes, True) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "18": - q.add_log_cmd("PLOC Supervisor: Disable latchup alert") - command = pack_lachtup_alert_cmd(object_id.as_bytes, False) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) if op_code == "20": q.add_log_cmd("PLOC Supervisor: Set alert limit") command = pack_set_alert_limit_cmd(object_id.as_bytes) @@ -362,31 +360,15 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901 q.add_log_cmd("PLOC Supervisor: Set ADC threshold") command = pack_set_adc_threshold_cmd(object_id.as_bytes) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "26": - q.add_log_cmd("PLOC Supervisor: Request latchup status report") - command = object_id.as_bytes + struct.pack( - "!I", SupvActionId.GET_LATCHUP_STATUS_REPORT - ) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "27": - q.add_log_cmd("PLOC Supervisor: Copy ADC data to MRAM") - command = object_id.as_bytes + struct.pack( - "!I", SupvActionId.COPY_ADC_DATA_TO_MRAM - ) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "30": - q.add_log_cmd("PLOC Supervisor: Run auto EM tests") - command = pack_auto_em_tests_cmd(object_id.as_bytes) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) if op_code == "31": q.add_log_cmd("PLOC Supervisor: Wipe MRAM") command = pack_mram_wipe_cmd(object_id.as_bytes) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "35": + if op_code == OpCode.SET_GPIO: q.add_log_cmd("PLOC Supervisor: Set GPIO command") command = pack_set_gpio_cmd(object_id.as_bytes) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "36": + if op_code == OpCode.READ_GPIO: q.add_log_cmd("PLOC Supervisor: Read GPIO command") command = pack_read_gpio_cmd(object_id.as_bytes) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) @@ -422,40 +404,18 @@ def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901 q.add_log_cmd(f"{prefix}: {Info.FACTORY_FLASH}") command = object_id.as_bytes + struct.pack("!I", SupvActionId.FACTORY_FLASH) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "47": - q.add_log_cmd("PLOC Supervisor: Enable auto TM") - command = object_id.as_bytes + struct.pack("!I", SupvActionId.ENABLE_AUTO_TM) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "48": - q.add_log_cmd("PLOC Supervisor: Disable auto TM") - command = object_id.as_bytes + struct.pack("!I", SupvActionId.DISABLE_AUTO_TM) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "51": - q.add_log_cmd("PLOC Supervisor: Logging request event buffers") - command = pack_logging_buffer_request(object_id.as_bytes) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) if op_code == "52": q.add_log_cmd("PLOC Supervisor: Logging clear counters") command = object_id.as_bytes + struct.pack( "!I", SupvActionId.LOGGING_CLEAR_COUNTERS ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "53": - q.add_log_cmd("PLOC Supervisor: Logging set topic") - command = pack_logging_set_topic(object_id.as_bytes) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) if op_code == "54": q.add_log_cmd("PLOC Supervisor: Logging request counters") command = object_id.as_bytes + struct.pack( "!I", SupvActionId.REQUEST_LOGGING_COUNTERS ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) - if op_code == "55": - q.add_log_cmd("PLOC Supervisor: Request ADC report") - command = object_id.as_bytes + struct.pack( - "!I", SupvActionId.REQUEST_ADC_REPORT - ) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command)) if op_code == "56": q.add_log_cmd("PLOC Supervisor: Reset PL") command = object_id.as_bytes + struct.pack("!I", SupvActionId.RESET_PL)