improve MPSoC commands
This commit is contained in:
parent
ab42ec65ff
commit
4bf3e2e5e2
@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="PLOC MPSoC" type="PythonConfigurationType" factoryName="Python" folderName="PLOC">
|
||||
<configuration default="false" name="PLOC MPSoC with Listener" type="PythonConfigurationType" factoryName="Python" folderName="PLOC">
|
||||
<module name="tmtc" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
@ -13,7 +13,7 @@
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="-s ploc_mpsoc -d 6" />
|
||||
<option name="PARAMETERS" value="-s ploc_mpsoc -l" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="true" />
|
||||
<option name="MODULE_MODE" value="false" />
|
@ -64,6 +64,19 @@ class CommandIds(enum.IntEnum):
|
||||
RELEASE_UART_TX = 21
|
||||
|
||||
|
||||
class OpCodes:
|
||||
ON = ["on"]
|
||||
OFF = ["off"]
|
||||
NORMAL = ["normal"]
|
||||
VERIFY_BOOT = ["verify_boot"]
|
||||
|
||||
|
||||
class Info:
|
||||
ON = "On"
|
||||
OFF = "Off"
|
||||
NORMAL = "Normal"
|
||||
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
|
||||
|
||||
class MemAddresses(enum.IntEnum):
|
||||
DEADBEEF = 0x40000004
|
||||
|
||||
@ -76,9 +89,9 @@ class PlocReplyIds(enum.IntEnum):
|
||||
@tmtc_definitions_provider
|
||||
def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add("0", "Ploc MPSoC: Set mode off")
|
||||
oce.add("1", "Ploc MPSoC: Set mode on")
|
||||
oce.add("2", "Ploc MPSoC: Set mode normal")
|
||||
oce.add(OpCodes.OFF, Info.OFF)
|
||||
oce.add(OpCodes.ON, Info.ON)
|
||||
oce.add(OpCodes.NORMAL, Info.NORMAL)
|
||||
oce.add("3", "Ploc MPSoC: Memory write")
|
||||
oce.add("4", "Ploc MPSoC: Memory read")
|
||||
oce.add("5", "Ploc MPSoC: Flash write")
|
||||
@ -89,7 +102,7 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add("10", "Ploc MPSoC: Downlink pwr off")
|
||||
oce.add("11", "Ploc MPSoC: Replay write sequence")
|
||||
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
|
||||
oce.add("13", "Ploc MPSoC: Read DEADBEEF address")
|
||||
oce.add(OpCodes.VERIFY_BOOT, "Ploc MPSoC: Read DEADBEEF address")
|
||||
oce.add("14", "Ploc MPSoC: Mode replay")
|
||||
oce.add("15", "Ploc MPSoC: Mode idle")
|
||||
oce.add("16", "Ploc MPSoC: Tc cam command send")
|
||||
@ -102,21 +115,22 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||
def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
||||
object_id = get_object_ids().get(PLOC_MPSOC_ID)
|
||||
q = p.queue_helper
|
||||
prefix = "PLOC SUPV:"
|
||||
op_code = p.op_code
|
||||
q.add_log_cmd(
|
||||
f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
obyt = object_id.as_bytes
|
||||
if op_code == "0":
|
||||
q.add_log_cmd("PLOC MPSoC: Set mode off")
|
||||
if op_code in OpCodes.OFF:
|
||||
q.add_log_cmd(f"{prefix} {Info.OFF}")
|
||||
command = pack_mode_data(obyt, Modes.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||
if op_code == "1":
|
||||
q.add_log_cmd("PLOC MPSoC: Set mode on")
|
||||
if op_code in OpCodes.ON:
|
||||
q.add_log_cmd(f"{prefix} {Info.ON}")
|
||||
data = pack_mode_data(obyt, Modes.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "2":
|
||||
q.add_log_cmd("PLOC MPSoC: Mode Normal")
|
||||
if op_code in OpCodes.NORMAL:
|
||||
q.add_log_cmd(f"{prefix} {Info.NORMAL}")
|
||||
data = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||
if op_code == "3":
|
||||
@ -167,9 +181,9 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
||||
q.add_log_cmd("PLOC MPSoC: Reset OBSW sequence count")
|
||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.OBSW_RESET_SEQ_COUNT)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if op_code == "13":
|
||||
if op_code in OpCodes.VERIFY_BOOT:
|
||||
num_words = 1
|
||||
q.add_log_cmd("PLOC MPSoC: Read DEADBEEF address")
|
||||
q.add_log_cmd(f"{prefix} {Info.VERIFY_BOOT}")
|
||||
data = (
|
||||
object_id.as_bytes
|
||||
+ struct.pack("!I", CommandIds.TC_MEM_READ)
|
||||
|
Loading…
x
Reference in New Issue
Block a user