From d37bca9f1b1f9c26acec786167f1efad45d4f9e4 Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L15 Date: Thu, 24 Mar 2022 17:39:05 +0100 Subject: [PATCH] mode replay command --- pus_tc/cmd_definitions.py | 2 ++ pus_tc/devs/ploc_mpsoc.py | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 89fce30..1241d6a 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -467,6 +467,8 @@ def add_ploc_mpsoc_cmds(cmd_dict: ServiceOpCodeDictT): "6": ("Ploc MPSoC: Downlink pwr on", {OpCodeDictKeys.TIMEOUT: 2.0}), "7": ("Ploc MPSoC: Downlink pwr off", {OpCodeDictKeys.TIMEOUT: 2.0}), "8": ("Ploc MPSoC: Replay write sequence", {OpCodeDictKeys.TIMEOUT: 2.0}), + "9": ("Ploc MPSoC: Read DEADBEEF address", {OpCodeDictKeys.TIMEOUT: 2.0}), + "10": ("Ploc MPSoC: Mode replay", {OpCodeDictKeys.TIMEOUT: 2.0}), } service_ploc_mpsoc_tuple = ("Ploc MPSoC", op_code_dict_srv_ploc_mpsoc) cmd_dict[CustomServiceList.PLOC_MPSOC.value] = service_ploc_mpsoc_tuple diff --git a/pus_tc/devs/ploc_mpsoc.py b/pus_tc/devs/ploc_mpsoc.py index 0d82cba..72d0f8d 100644 --- a/pus_tc/devs/ploc_mpsoc.py +++ b/pus_tc/devs/ploc_mpsoc.py @@ -26,6 +26,7 @@ flash_write_file_dict = { } mpsoc_file_dict = { + "1": ["0:/EM16/231", "0:/EM16/231"], MANUAL_INPUT: ["manual input", ""], } @@ -40,6 +41,11 @@ class CommandIds(enum.IntEnum): TC_REPLAY_WRITE_SEQUENCE = 13 TC_DOWNLINK_PWR_ON = 14 TC_DOWNLINK_PWR_OFF = 15 + TC_MODE_REPLAY = 16 + + +class MemAddresses(enum.IntEnum): + DEADBEEF = 0x40000000 class PlocReplyIds: @@ -107,6 +113,18 @@ def pack_ploc_mpsoc_commands( command = prepare_replay_write_sequence_cmd(object_id) command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == "9": + num_words = 1 + tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Read DEADBEEF address")) + command = object_id + struct.pack('!I', CommandIds.TC_MEM_READ) + struct.pack("!I", MemAddresses.DEADBEEF) + \ + struct.pack('!H', num_words) + command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == "10": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Tc mode replay")) + command = object_id + struct.pack('!I', CommandIds.TC_MODE_REPLAY) + command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) return tc_queue @@ -166,10 +184,11 @@ def prepare_downlink_pwr_on_cmd(object_id: bytearray) -> bytearray: def prepare_replay_write_sequence_cmd(object_id: bytearray) -> bytearray: + null_terminator = 0 use_decoding = int(input("Use decoding (set to 1): ")) file = get_mpsoc_file() command = object_id + struct.pack('!I', CommandIds.TC_REPLAY_WRITE_SEQUENCE) + struct.pack('!B', use_decoding) + \ - bytearray(file, 'utf-8') + bytearray(file, 'utf-8') + struct.pack('!B', null_terminator) return command