improve ploc mpsoc commanding
This commit is contained in:
parent
5c675560ea
commit
a7326b95c4
@ -23,6 +23,7 @@ from tmtccmd.tc.decorator import ServiceProviderParams
|
|||||||
from eive_tmtc.utility.input_helper import InputHelper
|
from eive_tmtc.utility.input_helper import InputHelper
|
||||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||||
|
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
MANUAL_INPUT = "1"
|
MANUAL_INPUT = "1"
|
||||||
@ -70,6 +71,10 @@ class OpCodes:
|
|||||||
NORMAL = ["normal"]
|
NORMAL = ["normal"]
|
||||||
VERIFY_BOOT = ["verify_boot"]
|
VERIFY_BOOT = ["verify_boot"]
|
||||||
MODE_REPLAY = ["mode_replay"]
|
MODE_REPLAY = ["mode_replay"]
|
||||||
|
MODE_IDLE = ["mode_idle"]
|
||||||
|
REPLAY_WRITE_SEQ = ["replay_write"]
|
||||||
|
DOWNLINK_PWR_ON = ["downlink_pwr_on"]
|
||||||
|
REPLAY_START = ["replay_start"]
|
||||||
|
|
||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
@ -78,6 +83,10 @@ class Info:
|
|||||||
NORMAL = "Normal"
|
NORMAL = "Normal"
|
||||||
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
|
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
|
||||||
MODE_REPLAY = "Switch to REPLAY mode"
|
MODE_REPLAY = "Switch to REPLAY mode"
|
||||||
|
MODE_IDLE = "Switch to IDLE mode"
|
||||||
|
REPLAY_WRITE_SEQ = "Replay write sequence"
|
||||||
|
DOWNLINK_PWR_ON = "Downlink Power On"
|
||||||
|
REPLAY_START = "Replay Start"
|
||||||
|
|
||||||
|
|
||||||
class MemAddresses(enum.IntEnum):
|
class MemAddresses(enum.IntEnum):
|
||||||
@ -99,15 +108,15 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
oce.add("4", "Ploc MPSoC: Memory read")
|
oce.add("4", "Ploc MPSoC: Memory read")
|
||||||
oce.add("5", "Ploc MPSoC: Flash write")
|
oce.add("5", "Ploc MPSoC: Flash write")
|
||||||
oce.add("6", "Ploc MPSoC: Flash delete")
|
oce.add("6", "Ploc MPSoC: Flash delete")
|
||||||
oce.add("7", "Ploc MPSoC: Replay start")
|
oce.add(OpCodes.REPLAY_START, Info.REPLAY_START)
|
||||||
oce.add("8", "Ploc MPSoC: Replay stop")
|
oce.add("8", "Ploc MPSoC: Replay stop")
|
||||||
oce.add("9", "Ploc MPSoC: Downlink pwr on")
|
oce.add(OpCodes.DOWNLINK_PWR_ON, Info.DOWNLINK_PWR_ON)
|
||||||
oce.add("10", "Ploc MPSoC: Downlink pwr off")
|
oce.add("10", "Ploc MPSoC: Downlink pwr off")
|
||||||
oce.add("11", "Ploc MPSoC: Replay write sequence")
|
oce.add(OpCodes.REPLAY_WRITE_SEQ, Info.REPLAY_WRITE_SEQ)
|
||||||
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
|
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
|
||||||
oce.add(OpCodes.VERIFY_BOOT, "Ploc MPSoC: Read DEADBEEF address")
|
oce.add(OpCodes.VERIFY_BOOT, "Ploc MPSoC: Read DEADBEEF address")
|
||||||
oce.add(OpCodes.MODE_REPLAY, Info.MODE_REPLAY)
|
oce.add(OpCodes.MODE_REPLAY, Info.MODE_REPLAY)
|
||||||
oce.add("15", "Ploc MPSoC: Mode IDLE")
|
oce.add(OpCodes.MODE_IDLE, Info.MODE_IDLE)
|
||||||
oce.add("16", "Ploc MPSoC: Tc cam command send")
|
oce.add("16", "Ploc MPSoC: Tc cam command send")
|
||||||
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
|
oce.add("17", "Ploc MPSoC: Set UART TX tristate")
|
||||||
oce.add("18", "Ploc MPSoC: Relesase UART TX")
|
oce.add("18", "Ploc MPSoC: Relesase UART TX")
|
||||||
@ -118,22 +127,22 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
||||||
object_id = get_object_ids().get(PLOC_MPSOC_ID)
|
object_id = get_object_ids().get(PLOC_MPSOC_ID)
|
||||||
q = p.queue_helper
|
q = p.queue_helper
|
||||||
prefix = "PLOC SUPV:"
|
prefix = "PLOC MPSoC"
|
||||||
op_code = p.op_code
|
op_code = p.op_code
|
||||||
q.add_log_cmd(
|
q.add_log_cmd(
|
||||||
f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
|
f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
|
||||||
)
|
)
|
||||||
obyt = object_id.as_bytes
|
obyt = object_id.as_bytes
|
||||||
if op_code in OpCodes.OFF:
|
if op_code in OpCodes.OFF:
|
||||||
q.add_log_cmd(f"{prefix} {Info.OFF}")
|
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||||
command = pack_mode_data(obyt, Modes.OFF, 0)
|
command = pack_mode_data(obyt, Modes.OFF, 0)
|
||||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||||
if op_code in OpCodes.ON:
|
if op_code in OpCodes.ON:
|
||||||
q.add_log_cmd(f"{prefix} {Info.ON}")
|
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||||
data = pack_mode_data(obyt, Modes.ON, 0)
|
data = pack_mode_data(obyt, Modes.ON, 0)
|
||||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||||
if op_code in OpCodes.NORMAL:
|
if op_code in OpCodes.NORMAL:
|
||||||
q.add_log_cmd(f"{prefix} {Info.NORMAL}")
|
q.add_log_cmd(f"{prefix}: {Info.NORMAL}")
|
||||||
data = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
|
data = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0)
|
||||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||||
if op_code == "3":
|
if op_code == "3":
|
||||||
@ -160,24 +169,24 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
|||||||
q.add_log_cmd("PLOC MPSoC: Flash delete")
|
q.add_log_cmd("PLOC MPSoC: Flash delete")
|
||||||
data = prepare_flash_delete_cmd(object_id.as_bytes)
|
data = prepare_flash_delete_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "7":
|
if op_code in OpCodes.REPLAY_START:
|
||||||
q.add_log_cmd("PLOC MPSoC: Replay start")
|
q.add_log_cmd(f"{prefix}: {Info.REPLAY_START}")
|
||||||
data = prepare_replay_start_cmd(object_id.as_bytes)
|
data = prepare_replay_start_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "8":
|
if op_code == "8":
|
||||||
q.add_log_cmd("PLOC MPSoC: Replay stop")
|
q.add_log_cmd("PLOC MPSoC: Replay stop")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_REPLAY_STOP)
|
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_REPLAY_STOP)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "9":
|
if op_code in OpCodes.DOWNLINK_PWR_ON:
|
||||||
q.add_log_cmd("PLOC MPSoC: Downlink pwr on")
|
q.add_log_cmd(f"{prefix}: {OpCodes.DOWNLINK_PWR_ON}")
|
||||||
data = prepare_downlink_pwr_on_cmd(object_id.as_bytes)
|
data = prepare_downlink_pwr_on_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "10":
|
if op_code == "10":
|
||||||
q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
|
q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_DOWNLINK_PWR_OFF)
|
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_DOWNLINK_PWR_OFF)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "11":
|
if op_code in OpCodes.REPLAY_WRITE_SEQ:
|
||||||
q.add_log_cmd("PLOC MPSoC: Replay write sequence")
|
q.add_log_cmd(f"{prefix}: {Info.REPLAY_WRITE_SEQ}")
|
||||||
data = prepare_replay_write_sequence_cmd(object_id.as_bytes)
|
data = prepare_replay_write_sequence_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "12":
|
if op_code == "12":
|
||||||
@ -194,11 +203,11 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
|||||||
+ struct.pack("!H", num_words)
|
+ struct.pack("!H", num_words)
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "14":
|
if op_code in OpCodes.MODE_REPLAY:
|
||||||
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
|
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_REPLAY)
|
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_REPLAY)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "15":
|
if op_code in OpCodes.MODE_IDLE:
|
||||||
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
|
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_IDLE)
|
data = object_id.as_bytes + struct.pack("!I", CommandIds.TC_MODE_IDLE)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
|
Loading…
Reference in New Issue
Block a user