mode replay command

This commit is contained in:
Robin Müller 2022-03-24 17:39:05 +01:00
parent b96ecce483
commit d37bca9f1b
2 changed files with 22 additions and 1 deletions

View File

@ -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

View File

@ -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