ploc supervisor tests

This commit is contained in:
Jakob.Meier 2021-07-23 13:40:27 +02:00
parent d55a12a100
commit b0ef4446d5
4 changed files with 89 additions and 3 deletions

View File

@ -6,9 +6,9 @@
<envs> <envs>
<env name="PYTHONUNBUFFERED" value="1" /> <env name="PYTHONUNBUFFERED" value="1" />
</envs> </envs>
<option name="SDK_HOME" value="C:\Users\jakob\AppData\Local\Programs\Python\Python39\python.exe" /> <option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />

View File

@ -86,6 +86,15 @@ class EiveHookObject(TmTcHookBase):
"1": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), "1": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("PLOC Supervisor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), "2": ("PLOC Supervisor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("PLOC Supervisor: Get HK Report", {OpCodeDictKeys.TIMEOUT: 2.0}), "3": ("PLOC Supervisor: Get HK Report", {OpCodeDictKeys.TIMEOUT: 2.0}),
"4": ("PLOC Supervisor: Restart MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("PLOC Supervisor: Shutdown MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"7": ("PLOC Supervisor: Select MPSoC boot image", {OpCodeDictKeys.TIMEOUT: 2.0}),
"8": ("PLOC Supervisor: Set max restart tries", {OpCodeDictKeys.TIMEOUT: 2.0}),
"9": ("PLOC Supervisor: Reset MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"10": ("PLOC Supervisor: Set time reference", {OpCodeDictKeys.TIMEOUT: 2.0}),
"11": ("PLOC Supervisor: Set boot timeout", {OpCodeDictKeys.TIMEOUT: 2.0}),
"12": ("PLOC Supervisor: Disable Hk", {OpCodeDictKeys.TIMEOUT: 2.0}),
} }
service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv) service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv)

View File

@ -27,6 +27,15 @@ class PlocTestProcedure:
class SupvActionIds: class SupvActionIds:
HK_REPORT = 1 HK_REPORT = 1
RESTART_MPSOC = 2
START_MPSOC = 3
SHUTWOWN_MPSOC = 4
SEL_MPSOC_BOOT_IMAGE = 5
SET_BOOT_TIMEOUT = 6
SET_MAX_RESTART_TRIES = 7
RESET_MPSOC = 8
SET_TIME_REF = 9
DISABLE_HK = 10
class SupvHkIds: class SupvHkIds:
@ -44,5 +53,73 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
command = object_id + struct.pack('!I', SupvActionIds.HK_REPORT) command = object_id + struct.pack('!I', SupvActionIds.HK_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Restart MPSoC"))
command = object_id + struct.pack('!I', SupvActionIds.RESTART_MPSOC)
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Start MPSoC"))
command = object_id + struct.pack('!I', SupvActionIds.START_MPSOC)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Shutdown MPSoC"))
command = object_id + struct.pack('!I', SupvActionIds.SHUTWOWN_MPSOC)
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Select MPSoC boot image"))
mem = int(input("MEM (NVM0 - 0 or NVM1 - 1):"))
bp0 = int(input("BP0 (0 or 1):"))
bp1 = int(input("BP1 (0 or 1):"))
bp2 = int(input("BP2 (0 or 1):"))
command = pack_sel_boot_image_cmd(object_id, mem, bp0, bp1, bp2)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set max restart tries"))
restart_tries = int(input("Set maximum restart tries:"))
command = object_id + struct.pack('!I', SupvActionIds.SET_MAX_RESTART_TRIES) + struct.pack('!B', restart_tries)
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "9":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Reset MPSoC"))
command = object_id + struct.pack('!I', SupvActionIds.RESET_MPSOC)
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "10":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set time reference"))
command = object_id + struct.pack('!I', SupvActionIds.SET_TIME_REF)
command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "11":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set boot timeout"))
boot_timeout = int(input("Specify boot timeout [ms]:"))
command = object_id + struct.pack('!I', SupvActionIds.SET_BOOT_TIMEOUT) + struct.pack('!I', boot_timeout)
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "12":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable HK"))
command = object_id + struct.pack('!I', SupvActionIds.DISABLE_HK)
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue return tc_queue
def pack_sel_boot_image_cmd(object_id: bytearray, mem: int, bp0: int, bp1: int, bp2: int) -> bytearray:
""" This function can be used to generate the command to select the image from which the MPSoC will boot
@param object_id The object id of the PLOC supervisor handler.
@param mem The memory from which the MPSoC shall boot (NVM0 - 0, NVM1 - 1)
@param bp0 Partition pin 0
@param bp1 Partition pin 1
@param bp2 Partition pin 2
"""
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SEL_MPSOC_BOOT_IMAGE)
command = command + struct.pack('!B', mem)
command = command + struct.pack('!B', bp0)
command = command + struct.pack('!B', bp1)
command = command + struct.pack('!B', bp2)
return command

View File

@ -71,7 +71,7 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
return pack_imtq_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_imtq_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.PLOC.value: if service == CustomServiceList.PLOC.value:
object_id = PLOC_MPSOC_ID object_id = PLOC_MPSOC_ID
return pack_ploc_test_into(object_id=object_id, tc_queue=service_queue) return pack_ploc_mpsoc_test_into(object_id=object_id, tc_queue=service_queue)
if service == CustomServiceList.REACTION_WHEEL_1.value: if service == CustomServiceList.REACTION_WHEEL_1.value:
object_id = RW1_ID object_id = RW1_ID
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)