ploc supervisor mode commands

This commit is contained in:
2022-03-28 11:40:13 +02:00
14 changed files with 283 additions and 88 deletions

View File

@ -25,6 +25,11 @@ flash_write_file_dict = {
}
mpsoc_file_dict = {
MANUAL_INPUT: ["manual input", ""],
"2": ["0:/flash", "0:/flash"],
}
sequence_file_dict = {
MANUAL_INPUT: ["manual input", ""],
"2": ["0:/EM16/231", "0:/EM16/231"],
}
@ -45,7 +50,7 @@ class CommandIds(enum.IntEnum):
class MemAddresses(enum.IntEnum):
DEADBEEF = 0x40000000
DEADBEEF = 0x40000004
class PlocReplyIds:
@ -123,12 +128,12 @@ def pack_ploc_mpsoc_commands(
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)
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "11":
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)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
@ -163,10 +168,10 @@ def prepare_mem_read_command(object_id: bytearray) -> bytearray:
def prepare_flash_write_cmd(object_id: bytearray) -> bytearray:
obcFile = get_flash_write_file()
obcFile = get_obc_file()
mpsocFile = get_mpsoc_file()
command = object_id + struct.pack('!I', CommandIds.FLASH_WRITE) + bytearray(obcFile, 'utf-8') + \
struct.pack('B', 0) + bytearray(mpsocFile, 'utf-8')
command = object_id + struct.pack('!I', CommandIds.FLASH_WRITE) + bytearray(obcFile, 'utf-8') + bytearray(mpsocFile,
'utf-8')
return command
@ -177,7 +182,7 @@ def prepare_flash_delete_cmd(object_id: bytearray) -> bytearray:
def prepare_replay_start_cmd(object_id: bytearray) -> bytearray:
replay = int(input("Specify replay mode (0 - repeated, 1 - once): "))
replay = int(input("Specify replay mode (0 - once, 1 - repeated): "))
command = object_id + struct.pack('!I', CommandIds.TC_REPLAY_START) + struct.pack('!B', replay)
return command
@ -193,14 +198,14 @@ 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()
file = get_sequence_file()
command = object_id + struct.pack('!I', CommandIds.TC_REPLAY_WRITE_SEQUENCE) + struct.pack('!B', use_decoding) + \
bytearray(file, 'utf-8') + struct.pack('!B', null_terminator)
bytearray(file, 'utf-8')
return command
def get_flash_write_file() -> str:
LOGGER.info("Specify flash file")
def get_obc_file() -> str:
LOGGER.info("Specify OBC file ")
input_helper = InputHelper(flash_write_file_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
@ -211,7 +216,7 @@ def get_flash_write_file() -> str:
def get_mpsoc_file() -> str:
LOGGER.info("Specify flash file to write to")
LOGGER.info("Specify MPSoC file")
input_helper = InputHelper(mpsoc_file_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
@ -219,3 +224,14 @@ def get_mpsoc_file() -> str:
else:
file = mpsoc_file_dict[key][1]
return file
def get_sequence_file() -> str:
LOGGER.info("Specify sequence file")
input_helper = InputHelper(sequence_file_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
file = input("Ploc MPSoC: Specify absolute name file: ")
else:
file = mpsoc_file_dict[key][1]
return file