From 36d9323b5722bae50fd723a1f308d282ad968758 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 25 Apr 2024 12:11:18 +0200 Subject: [PATCH] added commands for flash formatting --- eive_tmtc/tmtc/payload/ploc_mpsoc.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/eive_tmtc/tmtc/payload/ploc_mpsoc.py b/eive_tmtc/tmtc/payload/ploc_mpsoc.py index ee63c4b..404256b 100644 --- a/eive_tmtc/tmtc/payload/ploc_mpsoc.py +++ b/eive_tmtc/tmtc/payload/ploc_mpsoc.py @@ -90,6 +90,8 @@ class ActionId(enum.IntEnum): TC_FLASH_READ_FULL_FILE = 30 TC_SIMPLEX_STORE_FILE = 31 TC_VERIFY_BOOT = 32 + TC_ENABLE_FLASH_TC_EXECUTION = 33 + TC_FLASH_MKFS = 34 class Submode(enum.IntEnum): @@ -128,6 +130,8 @@ class OpCode: MODE_IDLE = "mode_idle" MODE_REPLAY = "mode_replay" MODE_SNAPSHOT = "mode_snapshot" + ENABLE_FLASH_TC_EXECUTION = "enable_flash_tc_exec" + FLASH_MKFS = "flash_mkfs" class Info: @@ -158,6 +162,8 @@ class Info: DISABLE_PLOC_SUPV_COMMANDING_TO_ON = ( "Disable PLOC SUPV commanding when switching ON" ) + ENABLE_FLASH_TC_EXECUTION = "Enable execution of Flash MKFS command" + FLASH_MKFS = "Flash MKFS command" class MemAddresses(enum.IntEnum): @@ -271,6 +277,25 @@ def pack_ploc_mpsoc_commands( + bytearray(cam_cmd, "utf-8") ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) + if cmd_str == OpCode.ENABLE_FLASH_TC_EXECUTION: + q.add_log_cmd(Info.ENABLE_FLASH_TC_EXECUTION) + q.add_pus_tc( + create_action_cmd(PLOC_MPSOC_ID, ActionId.TC_ENABLE_FLASH_TC_EXECUTION) + ) + if cmd_str == OpCode.FLASH_MKFS: + q.add_log_cmd(Info.FLASH_MKFS) + while True: + flash_select = int(input("Please select the flash ID (0 or 1): ")) + if flash_select != 0 and flash_select != 1: + _LOGGER.warn("invalid flash select") + continue + break + q.add_pus_tc( + create_action_cmd( + PLOC_MPSOC_ID, ActionId.TC_FLASH_MKFS, bytes([flash_select]) + ) + ) + if cmd_str == "17": q.add_log_cmd("PLOC MPSoC: Set UART TX tristate") data = object_id.as_bytes + struct.pack("!I", ActionId.SET_UART_TX_TRISTATE)