PLOC control #43
@ -1,5 +1,5 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="PLOC Test UDP Local" type="PythonConfigurationType" factoryName="Python" folderName="Devices">
|
<configuration default="false" name="PLOC MPSoC" type="PythonConfigurationType" factoryName="Python" folderName="Devices">
|
||||||
<module name="tmtc" />
|
<module name="tmtc" />
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
<option name="PARENT_ENVS" value="true" />
|
<option name="PARENT_ENVS" value="true" />
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<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" />
|
||||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
|
||||||
<option name="PARAMETERS" value="-m 1 -c 2 -s PLOC -l" />
|
<option name="PARAMETERS" value="-s ploc_mpsoc -l -t 6" />
|
||||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
<option name="EMULATE_TERMINAL" value="true" />
|
<option name="EMULATE_TERMINAL" value="true" />
|
||||||
<option name="MODULE_MODE" value="false" />
|
<option name="MODULE_MODE" value="false" />
|
24
.idea/runConfigurations/PLOC_Test_UDP_Flatsat.xml
generated
24
.idea/runConfigurations/PLOC_Test_UDP_Flatsat.xml
generated
@ -1,24 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="PLOC Test UDP Flatsat" type="PythonConfigurationType" factoryName="Python" folderName="Devices">
|
|
||||||
<module name="tmtc" />
|
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
|
||||||
<option name="PARENT_ENVS" value="true" />
|
|
||||||
<envs>
|
|
||||||
<env name="PYTHONUNBUFFERED" value="1" />
|
|
||||||
</envs>
|
|
||||||
<option name="SDK_HOME" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
||||||
<option name="IS_MODULE_SDK" value="true" />
|
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
||||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
|
||||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
|
|
||||||
<option name="PARAMETERS" value="-m 1 -c 2 -s PLOC -l" />
|
|
||||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
||||||
<option name="EMULATE_TERMINAL" value="true" />
|
|
||||||
<option name="MODULE_MODE" value="false" />
|
|
||||||
<option name="REDIRECT_INPUT" value="false" />
|
|
||||||
<option name="INPUT_FILE" value="" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
@ -22,7 +22,8 @@ class CustomServiceList(enum.Enum):
|
|||||||
TMP1075_2 = "tmp1075_2"
|
TMP1075_2 = "tmp1075_2"
|
||||||
HEATER = "heater"
|
HEATER = "heater"
|
||||||
IMTQ = "imtq"
|
IMTQ = "imtq"
|
||||||
PLOC = "ploc"
|
PLOC_SUPV = "ploc_supv"
|
||||||
|
PLOC_MPSOC = "ploc_mpsoc"
|
||||||
PCDU = "pcdu"
|
PCDU = "pcdu"
|
||||||
PL_PCDU = "plpcdu"
|
PL_PCDU = "plpcdu"
|
||||||
SA_DEPLYOMENT = "sa_depl"
|
SA_DEPLYOMENT = "sa_depl"
|
||||||
@ -31,7 +32,6 @@ class CustomServiceList(enum.Enum):
|
|||||||
REACTION_WHEEL_3 = "reaction_wheel_3"
|
REACTION_WHEEL_3 = "reaction_wheel_3"
|
||||||
REACTION_WHEEL_4 = "reaction_wheel_4"
|
REACTION_WHEEL_4 = "reaction_wheel_4"
|
||||||
RAD_SENSOR = "rad_sensor"
|
RAD_SENSOR = "rad_sensor"
|
||||||
PLOC_SUPV = "ploc_supv"
|
|
||||||
PLOC_UPDATER = "ploc_updater"
|
PLOC_UPDATER = "ploc_updater"
|
||||||
GPS_0 = "gps0"
|
GPS_0 = "gps0"
|
||||||
GPS_1 = "gps1"
|
GPS_1 = "gps1"
|
||||||
|
@ -124,7 +124,8 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
|||||||
add_imtq_cmds,
|
add_imtq_cmds,
|
||||||
add_rw_cmds,
|
add_rw_cmds,
|
||||||
add_rad_sens_cmds,
|
add_rad_sens_cmds,
|
||||||
add_ploc_cmds,
|
add_ploc_mpsoc_cmds,
|
||||||
|
add_ploc_supv_cmds,
|
||||||
add_system_cmds,
|
add_system_cmds,
|
||||||
)
|
)
|
||||||
from pus_tc.devs.gps import GpsOpCodes
|
from pus_tc.devs.gps import GpsOpCodes
|
||||||
@ -136,7 +137,8 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
|||||||
add_imtq_cmds(cmd_dict=service_op_code_dict)
|
add_imtq_cmds(cmd_dict=service_op_code_dict)
|
||||||
add_rad_sens_cmds(cmd_dict=service_op_code_dict)
|
add_rad_sens_cmds(cmd_dict=service_op_code_dict)
|
||||||
add_rw_cmds(cmd_dict=service_op_code_dict)
|
add_rw_cmds(cmd_dict=service_op_code_dict)
|
||||||
add_ploc_cmds(cmd_dict=service_op_code_dict)
|
add_ploc_mpsoc_cmds(cmd_dict=service_op_code_dict)
|
||||||
|
add_ploc_supv_cmds(cmd_dict=service_op_code_dict)
|
||||||
add_system_cmds(cmd_dict=service_op_code_dict)
|
add_system_cmds(cmd_dict=service_op_code_dict)
|
||||||
|
|
||||||
op_code_dict = {
|
op_code_dict = {
|
||||||
|
@ -392,7 +392,17 @@ def add_rad_sens_cmds(cmd_dict: ServiceOpCodeDictT):
|
|||||||
cmd_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple
|
cmd_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple
|
||||||
|
|
||||||
|
|
||||||
def add_ploc_cmds(cmd_dict: ServiceOpCodeDictT):
|
def add_ploc_mpsoc_cmds(cmd_dict: ServiceOpCodeDictT):
|
||||||
|
op_code_dict_srv_ploc_mpsoc = {
|
||||||
|
"0": ("Ploc MPSoC: Memory write", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"1": ("Ploc MPSoC: Memory read", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
|
"2": ("Ploc MPSoC: Flash write", {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
|
||||||
|
|
||||||
|
|
||||||
|
def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT):
|
||||||
op_code_dict_ploc_mem_dumper = {
|
op_code_dict_ploc_mem_dumper = {
|
||||||
"0": ("PLOC Memory Dumper: MRAM dump", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
"0": ("PLOC Memory Dumper: MRAM dump", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||||
}
|
}
|
||||||
|
@ -9,61 +9,68 @@
|
|||||||
import struct
|
import struct
|
||||||
|
|
||||||
from tmtccmd.config.definitions import QueueCommands
|
from tmtccmd.config.definitions import QueueCommands
|
||||||
|
from tmtccmd.utility.logger import get_console_logger
|
||||||
from tmtccmd.tc.packer import TcQueueT
|
from tmtccmd.tc.packer import TcQueueT
|
||||||
from spacepackets.ecss.tc import PusTelecommand
|
from spacepackets.ecss.tc import PusTelecommand
|
||||||
|
|
||||||
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
class PlocTestProcedure:
|
MANUAL_INPUT = "3"
|
||||||
"""
|
|
||||||
@brief Use this class to define the tests to perform for the PLOC.
|
|
||||||
@details Setting all to True will run all tests.
|
|
||||||
Setting all to False will only run the tests set to True.
|
|
||||||
"""
|
|
||||||
|
|
||||||
all = False
|
flash_write_dict = {
|
||||||
test_tc_mem_write = False
|
"1": ["q7s test file", "/mnt/sd0/ploc-mpsoc/flashwrite.bin"],
|
||||||
test_tc_mem_read = True
|
"2": ["te0720-1cfa test file", "/mnt/sd0/ploc-mpsoc/flashwrite.bin"],
|
||||||
|
MANUAL_INPUT: ["manual input", ""],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class PlocActionIds:
|
class CommandIds:
|
||||||
tc_mem_write = bytearray([0x0, 0x0, 0x0, 0x1])
|
tc_mem_write = 1
|
||||||
tc_mem_read = bytearray([0x0, 0x0, 0x0, 0x2])
|
tc_mem_read = 2
|
||||||
|
flash_write = 3
|
||||||
|
|
||||||
|
|
||||||
class PlocReplyIds:
|
class PlocReplyIds:
|
||||||
tm_mem_read_report = 6
|
tm_mem_read_report = 6
|
||||||
|
|
||||||
|
|
||||||
def pack_ploc_mpsoc_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
def pack_ploc_mpsoc_commands(
|
||||||
|
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||||
|
) -> TcQueueT:
|
||||||
tc_queue.appendleft(
|
tc_queue.appendleft(
|
||||||
(QueueCommands.PRINT, "Testing PLOC MPSoC with object id: 0x" + object_id.hex())
|
(
|
||||||
|
QueueCommands.PRINT,
|
||||||
|
"Generate command for PLOC MPSoC with object id: 0x" + object_id.hex(),
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_write:
|
if op_code == "0":
|
||||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Write Test"))
|
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: TC mem write test"))
|
||||||
memory_address = int(input("PLOC Tc Mem Write: Type memory address: 0x"), 16)
|
memory_address = int(input("PLOC MPSoC: Tc Mem Write: Type memory address: 0x"), 16)
|
||||||
memory_data = int(input("PLOC Tc Mem Write: Type memory data: 0x"), 16)
|
memory_data = int(input("PLOC MPSoC: Tc Mem Write: Type memory data: 0x"), 16)
|
||||||
|
# TODO: implement variable length mem write command
|
||||||
|
mem_len = 1 # 1 32-bit word
|
||||||
command = generate_write_mem_command(
|
command = generate_write_mem_command(
|
||||||
object_id, struct.pack("!I", memory_address), memory_data
|
object_id, memory_address, memory_data, mem_len
|
||||||
)
|
)
|
||||||
command = PusTelecommand(service=8, subservice=128, ssc=23, 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 == "1":
|
||||||
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_read:
|
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: TC mem read test"))
|
||||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Read Test"))
|
command = prepare_mem_read_command(object_id)
|
||||||
memory_address = int(input("PLOC Tc Mem Read: Type memory address: 0x"), 16)
|
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
|
||||||
command = (
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
object_id + PlocActionIds.tc_mem_read + struct.pack("!I", memory_address)
|
elif op_code == "2":
|
||||||
)
|
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Flash write"))
|
||||||
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
command = prepare_flash_write_cmd(object_id)
|
||||||
|
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
|
||||||
return tc_queue
|
return tc_queue
|
||||||
|
|
||||||
|
|
||||||
def generate_write_mem_command(
|
def generate_write_mem_command(
|
||||||
object_id: bytearray, memory_address: bytes, memory_data: int
|
object_id: bytearray, memory_address: int, memory_data: int, mem_len: int
|
||||||
) -> bytearray:
|
) -> bytearray:
|
||||||
"""This function generates the command to write to a memory address within the PLOC
|
"""This function generates the command to write to a memory address within the PLOC
|
||||||
@param object_id The object id of the PlocHandler
|
@param object_id The object id of the PlocHandler
|
||||||
@ -71,9 +78,37 @@ def generate_write_mem_command(
|
|||||||
@param memory_data The data to write to the memory address specified by the bytearray memory_address.
|
@param memory_data The data to write to the memory address specified by the bytearray memory_address.
|
||||||
"""
|
"""
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ PlocActionIds.tc_mem_write
|
+ struct.pack('!I', CommandIds.tc_mem_write)
|
||||||
+ memory_address
|
+ struct.pack('!I', memory_address)
|
||||||
+ struct.pack("!I", memory_data)
|
+ struct.pack('!H', mem_len)
|
||||||
|
+ struct.pack("!I", memory_data)
|
||||||
)
|
)
|
||||||
return command
|
return command
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_mem_read_command(object_id: bytearray) -> bytearray:
|
||||||
|
memory_address = int(input("PLOC MPSoC Tc Mem Read: Type memory address: 0x"), 16)
|
||||||
|
num_words = int(input("PLOC MPSoC specify number of words (32-bit) to read: "))
|
||||||
|
command = (
|
||||||
|
object_id + struct.pack('!I', CommandIds.tc_mem_read) + struct.pack("!I", memory_address) + struct.pack(
|
||||||
|
'!H', num_words)
|
||||||
|
)
|
||||||
|
return command
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_flash_write_cmd(object_id: bytearray) -> bytearray:
|
||||||
|
file = get_flash_write_file()
|
||||||
|
command = object_id + struct.pack('I', CommandIds.flash_write) + bytearray(file, 'utf-8')
|
||||||
|
return command
|
||||||
|
|
||||||
|
|
||||||
|
def get_flash_write_file() -> str:
|
||||||
|
LOGGER.info("Specify json file")
|
||||||
|
input_helper = InputHelper(json_dict)
|
||||||
|
key = input_helper.get_key()
|
||||||
|
if key == MANUAL_INPUT:
|
||||||
|
file = input("Ploc MPSoC: Specify absolute name of flash write file: ")
|
||||||
|
else:
|
||||||
|
file = json_dict[key][1]
|
||||||
|
return file
|
||||||
|
@ -75,7 +75,7 @@ class SupvHkIds:
|
|||||||
BOOT_STATUS_REPORT = 53
|
BOOT_STATUS_REPORT = 53
|
||||||
|
|
||||||
|
|
||||||
def pack_ploc_supv_test_into(
|
def pack_ploc_supv_commands(
|
||||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||||
) -> TcQueueT:
|
) -> TcQueueT:
|
||||||
tc_queue.appendleft(
|
tc_queue.appendleft(
|
||||||
|
@ -15,6 +15,7 @@ from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
|
|||||||
from tmtccmd.utility.logger import get_console_logger
|
from tmtccmd.utility.logger import get_console_logger
|
||||||
from utility.input_helper import InputHelper
|
from utility.input_helper import InputHelper
|
||||||
|
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ from pus_tc.devs.bpx_batt import pack_bpx_commands
|
|||||||
from pus_tc.devs.acu import pack_acu_test_into
|
from pus_tc.devs.acu import pack_acu_test_into
|
||||||
from pus_tc.devs.imtq import pack_imtq_test_into
|
from pus_tc.devs.imtq import pack_imtq_test_into
|
||||||
from pus_tc.devs.tmp1075 import pack_tmp1075_test_into
|
from pus_tc.devs.tmp1075 import pack_tmp1075_test_into
|
||||||
from pus_tc.devs.ploc_mpsoc import pack_ploc_mpsoc_test_into
|
from pus_tc.devs.ploc_mpsoc import pack_ploc_mpsoc_commands
|
||||||
from pus_tc.devs.ploc_supervisor import pack_ploc_supv_test_into
|
from pus_tc.devs.ploc_supervisor import pack_ploc_supv_commands
|
||||||
from pus_tc.devs.heater import pack_heater_test_into
|
from pus_tc.devs.heater import pack_heater_test_into
|
||||||
from pus_tc.devs.reaction_wheels import pack_single_rw_test_into
|
from pus_tc.devs.reaction_wheels import pack_single_rw_test_into
|
||||||
from pus_tc.devs.rad_sensor import pack_rad_sensor_test_into
|
from pus_tc.devs.rad_sensor import pack_rad_sensor_test_into
|
||||||
@ -116,9 +116,9 @@ def pack_service_queue_user(
|
|||||||
return pack_imtq_test_into(
|
return pack_imtq_test_into(
|
||||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||||
)
|
)
|
||||||
if service == CustomServiceList.PLOC.value:
|
if service == CustomServiceList.PLOC_MPSOC.value:
|
||||||
object_id = PLOC_MPSOC_ID
|
object_id = PLOC_MPSOC_ID
|
||||||
return pack_ploc_mpsoc_test_into(object_id=object_id, tc_queue=service_queue)
|
return pack_ploc_mpsoc_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||||
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(
|
return pack_single_rw_test_into(
|
||||||
@ -146,7 +146,7 @@ def pack_service_queue_user(
|
|||||||
)
|
)
|
||||||
if service == CustomServiceList.PLOC_SUPV.value:
|
if service == CustomServiceList.PLOC_SUPV.value:
|
||||||
object_id = PLOC_SUPV_ID
|
object_id = PLOC_SUPV_ID
|
||||||
return pack_ploc_supv_test_into(
|
return pack_ploc_supv_commands(
|
||||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||||
)
|
)
|
||||||
if service == CustomServiceList.PLOC_UPDATER.value:
|
if service == CustomServiceList.PLOC_UPDATER.value:
|
||||||
|
@ -69,7 +69,8 @@ def handle_ploc_replies(action_id: int, custom_data: bytearray) -> DataReplyUnpa
|
|||||||
"PLOC Mem Len",
|
"PLOC Mem Len",
|
||||||
"PLOC Read Memory Data",
|
"PLOC Read Memory Data",
|
||||||
]
|
]
|
||||||
reply.content_list = [custom_data[:4], custom_data[4:6], custom_data[6:10]]
|
reply.content_list = ["0x" + custom_data[:4].hex(), struct.unpack('!H', custom_data[4:6])[0],
|
||||||
|
"0x" + custom_data[6:10].hex()]
|
||||||
return reply
|
return reply
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user