Merge remote-tracking branch 'origin/main' into mueller/power-cmds-update
This commit is contained in:
commit
f22aba3e65
@ -21,4 +21,26 @@
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration default="false" name="PLOC SUPV" type="PythonConfigurationType" factoryName="Python" folderName="PLOC">
|
||||
<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$/tmtcc.py" />
|
||||
<option name="PARAMETERS" value="tmtc -s ploc_supv -d 6" />
|
||||
<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>
|
@ -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="" />
|
||||
<option name="PARAMETERS" value="-d 6" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="true" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
|
@ -16,7 +16,10 @@ list yields a list of all related PRs for each release.
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/102
|
||||
- Add commands to request MGM HK or enable/disable periodic HK for it
|
||||
- Update power commands: Extend param get and set to all
|
||||
gomspace devices
|
||||
gomspace devices.
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/108
|
||||
- Update PLOC supervisor commands
|
||||
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/107
|
||||
|
||||
# [v1.12.0] 05.07.2022
|
||||
|
||||
|
@ -194,20 +194,23 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
13605;0x3525;SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL;LOW;Requesting event buffer was successful;linux/devices/ploc/PlocSupvHelper.h
|
||||
13606;0x3526;SUPV_EVENT_BUFFER_REQUEST_FAILED;LOW;Requesting event buffer failed;linux/devices/ploc/PlocSupvHelper.h
|
||||
13607;0x3527;SUPV_EVENT_BUFFER_REQUEST_TERMINATED;LOW;Terminated event buffer request by command P1: Number of packets read before process was terminated;linux/devices/ploc/PlocSupvHelper.h
|
||||
13608;0x3528;SUPV_SENDING_COMMAND_FAILED;LOW;;linux/devices/ploc/PlocSupvHelper.h
|
||||
13609;0x3529;SUPV_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13610;0x352a;SUPV_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13611;0x352b;SUPV_MISSING_ACK;LOW;Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13612;0x352c;SUPV_MISSING_EXE;LOW;Supervisor did not receive execution report P1: Number of bytes missing P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13613;0x352d;SUPV_ACK_FAILURE_REPORT;LOW;Supervisor received acknowledgment failure report P1: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13614;0x352e;SUPV_EXE_FAILURE_REPORT;LOW;Execution report failure P1:;linux/devices/ploc/PlocSupvHelper.h
|
||||
13615;0x352f;SUPV_ACK_INVALID_APID;LOW;Supervisor expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13616;0x3530;SUPV_EXE_INVALID_APID;LOW;Supervisor helper expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13617;0x3531;ACK_RECEPTION_FAILURE;LOW;Failed to receive acknowledgment report P1: Return value P2: Apid of command for which the reception of the acknowledgment report failed;linux/devices/ploc/PlocSupvHelper.h
|
||||
13618;0x3532;EXE_RECEPTION_FAILURE;LOW;Failed to receive execution report P1: Return value P2: Apid of command for which the reception of the execution report failed;linux/devices/ploc/PlocSupvHelper.h
|
||||
13619;0x3533;WRITE_MEMORY_FAILED;LOW;Update procedure failed when sending packet with number P1 P1: Packet number for which the memory write command fails;linux/devices/ploc/PlocSupvHelper.h
|
||||
13620;0x3534;SUPV_REPLY_SIZE_MISSMATCH;LOW;;linux/devices/ploc/PlocSupvHelper.h
|
||||
13621;0x3535;SUPV_REPLY_CRC_MISSMATCH;LOW;;linux/devices/ploc/PlocSupvHelper.h
|
||||
13608;0x3528;SUPV_MEM_CHECK_OK;INFO;;linux/devices/ploc/PlocSupvHelper.h
|
||||
13609;0x3529;SUPV_MEM_CHECK_FAIL;INFO;;linux/devices/ploc/PlocSupvHelper.h
|
||||
13616;0x3530;SUPV_SENDING_COMMAND_FAILED;LOW;;linux/devices/ploc/PlocSupvHelper.h
|
||||
13617;0x3531;SUPV_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13618;0x3532;SUPV_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13619;0x3533;SUPV_MISSING_ACK;LOW;Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13620;0x3534;SUPV_MISSING_EXE;LOW;Supervisor did not receive execution report P1: Number of bytes missing P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13621;0x3535;SUPV_ACK_FAILURE_REPORT;LOW;Supervisor received acknowledgment failure report P1: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13622;0x3536;SUPV_EXE_FAILURE_REPORT;LOW;Execution report failure P1:;linux/devices/ploc/PlocSupvHelper.h
|
||||
13623;0x3537;SUPV_ACK_INVALID_APID;LOW;Supervisor expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13624;0x3538;SUPV_EXE_INVALID_APID;LOW;Supervisor helper expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
|
||||
13625;0x3539;ACK_RECEPTION_FAILURE;LOW;Failed to receive acknowledgment report P1: Return value P2: Apid of command for which the reception of the acknowledgment report failed;linux/devices/ploc/PlocSupvHelper.h
|
||||
13626;0x353a;EXE_RECEPTION_FAILURE;LOW;Failed to receive execution report P1: Return value P2: Apid of command for which the reception of the execution report failed;linux/devices/ploc/PlocSupvHelper.h
|
||||
13627;0x353b;WRITE_MEMORY_FAILED;LOW;Update procedure failed when sending packet. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvHelper.h
|
||||
13628;0x353c;SUPV_REPLY_SIZE_MISSMATCH;LOW;;linux/devices/ploc/PlocSupvHelper.h
|
||||
13629;0x353d;SUPV_REPLY_CRC_MISSMATCH;LOW;;linux/devices/ploc/PlocSupvHelper.h
|
||||
13630;0x353e;SUPV_UPDATE_PROGRESS;INFO;Will be triggered every 5 percent of the update progress. P1: First byte percent, third and fourth byte Sequence Count, P2: Bytes written;linux/devices/ploc/PlocSupvHelper.h
|
||||
13700;0x3584;ALLOC_FAILURE;MEDIUM;;bsp_q7s/core/CoreController.h
|
||||
13701;0x3585;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
|
||||
13702;0x3586;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h
|
||||
|
|
@ -138,6 +138,7 @@ def pack_set_param_command(
|
||||
app_data.append(byte_three)
|
||||
app_data.append(byte_four)
|
||||
return make_fsfw_action_cmd(
|
||||
<<<<<<< HEAD
|
||||
object_id=object_id, action_id=action_id, user_data=app_data
|
||||
)
|
||||
|
||||
@ -162,6 +163,9 @@ def prompt_and_pack_set_param_command(q: DefaultPusQueueHelper, object_id: Objec
|
||||
pack_set_param_command(
|
||||
object_id.as_bytes, memory_address, parameter_size, parameter
|
||||
)
|
||||
=======
|
||||
object_id=object_id, action_id=action_id, user_data=app_data, ssc=ssc
|
||||
>>>>>>> origin/main
|
||||
)
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ import logging
|
||||
import os.path
|
||||
from datetime import datetime
|
||||
from config.object_ids import get_object_ids
|
||||
from pus_tm.defs import PrintWrapper
|
||||
|
||||
from tmtccmd.tm import Service5Tm
|
||||
from tmtccmd.logging import get_console_logger
|
||||
@ -25,12 +26,9 @@ def get_event_dict() -> EventDictT:
|
||||
return __EVENT_DICT
|
||||
|
||||
|
||||
def handle_event_packet(
|
||||
raw_tm: bytes, printer: FsfwTmTcPrinter, file_logger: logging.Logger
|
||||
) -> str:
|
||||
def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
||||
pw = PrintWrapper(printer)
|
||||
tm = Service5Tm.unpack(raw_telemetry=raw_tm)
|
||||
printer.handle_long_tm_print(packet_if=tm, info_if=tm)
|
||||
additional_event_info = ""
|
||||
event_dict = get_event_dict()
|
||||
info = event_dict.get(tm.event_id)
|
||||
if info is None:
|
||||
@ -47,15 +45,25 @@ def handle_event_packet(
|
||||
generic_event_string = (
|
||||
f"Object {obj_name} generated Event {tm.event_id} | {info.name}"
|
||||
)
|
||||
if info.info != "":
|
||||
additional_event_info = (
|
||||
f"Additional info: {info.info} | P1: {tm.param_1} | P2: {tm.param_2}"
|
||||
)
|
||||
file_logger.info(
|
||||
pw.printer.file_logger.info(
|
||||
f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
||||
)
|
||||
LOGGER.info(generic_event_string)
|
||||
if additional_event_info != "":
|
||||
file_logger.info(additional_event_info)
|
||||
print(additional_event_info)
|
||||
return generic_event_string + " | " + additional_event_info
|
||||
specific_handler = True
|
||||
if info.name == "SUPV_UPDATE_PROGRESS" or info.name == "WRITE_MEMORY_FAILED":
|
||||
additional_event_info = f"Additional info: {info.info}"
|
||||
context = (
|
||||
f"Progress Percent: {tm.param_1 >> 24 & 0xff} | Sequence Count: {tm.param_1 & 0xffff} "
|
||||
f"| Bytes Written: {tm.param_2}"
|
||||
)
|
||||
pw.dlog(additional_event_info)
|
||||
pw.dlog(context)
|
||||
else:
|
||||
specific_handler = False
|
||||
if info.info != "":
|
||||
additional_event_info = (
|
||||
f"Additional info: {info.info} | P1: {tm.param_1} | P2: {tm.param_2}"
|
||||
)
|
||||
pw.dlog(additional_event_info)
|
||||
if not specific_handler:
|
||||
printer.handle_long_tm_print(packet_if=tm, info_if=tm)
|
||||
|
@ -35,7 +35,6 @@ def pus_factory_hook(
|
||||
LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||
return
|
||||
service = tm_packet.service
|
||||
file_logger = printer.file_logger
|
||||
obj_id_dict = get_object_ids()
|
||||
dedicated_handler = True
|
||||
if service == 1:
|
||||
@ -43,7 +42,7 @@ def pus_factory_hook(
|
||||
elif service == 3:
|
||||
handle_hk_packet(printer=printer, raw_tm=packet, obj_id_dict=obj_id_dict)
|
||||
elif service == 5:
|
||||
handle_event_packet(raw_tm=packet, printer=printer, file_logger=file_logger)
|
||||
handle_event_packet(raw_tm=packet, printer=printer)
|
||||
elif service == 8:
|
||||
handle_action_reply(raw_tm=packet, printer=printer, obj_id_dict=obj_id_dict)
|
||||
elif service == 17:
|
||||
|
@ -41,7 +41,7 @@ def handle_service_1_fsfw_packet(wrapper: VerificationWrapper, raw_tm: bytes):
|
||||
)
|
||||
error_param_1_str = (
|
||||
f"Error Parameter 1: hex {fsfw_wrapper.error_param_1:#010x} "
|
||||
f"dec{fsfw_wrapper.error_param_1} "
|
||||
f"dec {fsfw_wrapper.error_param_1} "
|
||||
)
|
||||
error_param_2_str = (
|
||||
f"Error Parameter 2: hex {fsfw_wrapper.error_param_2:#010x} "
|
||||
|
@ -20,6 +20,7 @@ from tmtccmd.logging import get_console_logger
|
||||
from tmtccmd.tc import service_provider
|
||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
|
||||
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
|
||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||
from utility.input_helper import InputHelper
|
||||
|
||||
@ -107,6 +108,7 @@ class SupvActionIds:
|
||||
RESET_PL = 58
|
||||
ENABLE_NVMS = 59
|
||||
CONTINUE_UPDATE = 60
|
||||
MEM_CHECK = 61
|
||||
|
||||
|
||||
class SetIds:
|
||||
@ -114,19 +116,19 @@ class SetIds:
|
||||
BOOT_STATUS_REPORT = 103
|
||||
|
||||
|
||||
class SupvHkIds:
|
||||
HK_REPORT = 52
|
||||
BOOT_STATUS_REPORT = 53
|
||||
|
||||
|
||||
class OpCodes:
|
||||
OFF = ["0", "off"]
|
||||
ON = ["1", "on"]
|
||||
NORMAL = ["2", "nml"]
|
||||
HK_TO_OBC = ["3", "hk-to-obc"]
|
||||
REQUEST_HK = ["4", "req-hk"]
|
||||
START_MPSOC = ["5", "mpsoc-start"]
|
||||
STOP_MPSOC = ["6", "mpsoc-stop"]
|
||||
HK_TO_OBC = ["3", "hk_to_obc"]
|
||||
REQUEST_HK = ["4", "req_hk"]
|
||||
START_MPSOC = ["5", "start_mpsoc"]
|
||||
SHUTDOWN_MPSOC = ["6", "stop_mpsoc"]
|
||||
SEL_NVM = ["7", "sel_nvm"]
|
||||
REQ_BOOT_STATUS_REPORT = ["13", "boot_report"]
|
||||
START_UPDATE = ["42", "start_update"]
|
||||
PERFORM_UPDATE = ["update"]
|
||||
MEM_CHECK = ["mem_check"]
|
||||
|
||||
|
||||
class Info(str, enum.Enum):
|
||||
@ -136,6 +138,11 @@ class Info(str, enum.Enum):
|
||||
NML = "Switch Normal"
|
||||
HK_TO_OBC = "Request HK from PLOC SUPV"
|
||||
REQUEST_HK = "Request HK set from PLOC Handler"
|
||||
PERFORM_UPDATE = "Start or continue MPSoC SW update at starting bytes"
|
||||
START_UPDATE = "Start new MPSoC SW update"
|
||||
REQ_BOOT_STATUS_REPORT = "Request boot status report and HK"
|
||||
MEM_CHECK = "Memory Check"
|
||||
SEL_NVM = "Select NVM"
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
@ -148,14 +155,14 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add(OpCodes.HK_TO_OBC, Info.HK_TO_OBC)
|
||||
oce.add(OpCodes.REQUEST_HK, Info.REQUEST_HK)
|
||||
oce.add(OpCodes.START_MPSOC, "PLOC Supervisor: Start MPSoC")
|
||||
oce.add(OpCodes.STOP_MPSOC, "PLOC Supervisor: Shutdown MPSoC")
|
||||
oce.add("7", "PLOC Supervisor: Select MPSoC boot image")
|
||||
oce.add(OpCodes.SHUTDOWN_MPSOC, "PLOC Supervisor: Shutdown MPSoC")
|
||||
oce.add(OpCodes.SEL_NVM, Info.SEL_NVM)
|
||||
oce.add("8", "PLOC Supervisor: Set max restart tries")
|
||||
oce.add("9", "PLOC Supervisor: Reset MPSoC")
|
||||
oce.add("10", "PLOC Supervisor: Set time reference")
|
||||
oce.add("11", "PLOC Supervisor: Set boot timeout")
|
||||
oce.add("12", "PLOC Supervisor: Disable Hk")
|
||||
oce.add("13", "PLOC Supervisor: Request boot status report")
|
||||
oce.add(OpCodes.REQ_BOOT_STATUS_REPORT, Info.REQ_BOOT_STATUS_REPORT)
|
||||
oce.add("17", "PLOC Supervisor: Enable latchup alert")
|
||||
oce.add("18", "PLOC Supervisor: Disable latchup alert")
|
||||
oce.add("20", "PLOC Supervisor: Set alert limit")
|
||||
@ -172,7 +179,8 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add("38", "PLOC Supervisor: Factory reset clear all")
|
||||
oce.add("39", "PLOC Supervisor: Factory reset clear mirror entries")
|
||||
oce.add("40", "PLOC Supervisor: Factory reset clear circular entries")
|
||||
oce.add("42", "PLOC Supervisor: Perform update")
|
||||
oce.add(OpCodes.PERFORM_UPDATE, Info.PERFORM_UPDATE)
|
||||
oce.add(OpCodes.START_UPDATE, Info.START_UPDATE)
|
||||
oce.add("43", "PLOC Supervisor: Terminate supervisor process")
|
||||
oce.add("44", "PLOC Supervisor: Start MPSoC quiet")
|
||||
oce.add("45", "PLOC Supervisor: Set shutdown timeout")
|
||||
@ -187,6 +195,7 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce.add("56", "PLOC Supervisor: Reset PL")
|
||||
oce.add("57", "PLOC Supervisor: Enable NVMs")
|
||||
oce.add("58", "PLOC Supervisor: Continue update")
|
||||
oce.add(OpCodes.MEM_CHECK, Info.MEM_CHECK)
|
||||
defs.add_service(CustomServiceList.PLOC_SUPV.value, "PLOC Supervisor", oce)
|
||||
|
||||
|
||||
@ -219,15 +228,15 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
sid = make_sid(object_id.as_bytes, SetIds.HK_REPORT)
|
||||
cmd = generate_one_hk_command(sid)
|
||||
q.add_pus_tc(cmd)
|
||||
elif op_code == "5":
|
||||
elif op_code in OpCodes.START_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Start MPSoC")
|
||||
command = obyt + struct.pack("!I", SupvActionIds.START_MPSOC)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "6":
|
||||
if op_code in OpCodes.SHUTDOWN_MPSOC:
|
||||
q.add_log_cmd("PLOC Supervisor: Shutdown MPSoC")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.SHUTWOWN_MPSOC)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "7":
|
||||
if op_code in OpCodes.SEL_NVM:
|
||||
q.add_log_cmd("PLOC Supervisor: Select MPSoC boot image")
|
||||
mem = int(input("MEM (NVM0 - 0 or NVM1 - 1): "))
|
||||
bp0 = int(input("BP0 (0 or 1): "))
|
||||
@ -265,12 +274,16 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
q.add_log_cmd("PLOC Supervisor: Disable HK")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.DISABLE_HK)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "13":
|
||||
q.add_log_cmd("PLOC Supervisor: Request boot status report")
|
||||
if op_code in OpCodes.REQ_BOOT_STATUS_REPORT:
|
||||
q.add_log_cmd(f"{prefix}: {Info.REQ_BOOT_STATUS_REPORT}")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", SupvActionIds.GET_BOOT_STATUS_REPORT
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
q.add_wait_seconds(2.0)
|
||||
sid = make_sid(object_id.as_bytes, SetIds.BOOT_STATUS_REPORT)
|
||||
req_hk = generate_one_hk_command(sid)
|
||||
q.add_pus_tc(req_hk)
|
||||
if op_code == "17":
|
||||
q.add_log_cmd("PLOC Supervisor: Enable latchup alert")
|
||||
command = pack_lachtup_alert_cmd(object_id.as_bytes, True)
|
||||
@ -347,9 +360,13 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
"!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR
|
||||
)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "42":
|
||||
q.add_log_cmd("PLOC Supervisor: Perform update")
|
||||
command = pack_update_command(object_id.as_bytes)
|
||||
if op_code in OpCodes.START_UPDATE:
|
||||
q.add_log_cmd("PLOC Supversior: Start new MPSoC SW update")
|
||||
command = pack_update_command(object_id.as_bytes, True)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.PERFORM_UPDATE:
|
||||
q.add_log_cmd("PLOC Supervisor: Perform MPSoC SW update")
|
||||
command = pack_update_command(object_id.as_bytes, False)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code == "43":
|
||||
q.add_log_cmd("PLOC Supervisor: Terminate supervisor process")
|
||||
@ -424,6 +441,23 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
||||
q.add_log_cmd("PLOC Supervisor: Continue update")
|
||||
command = object_id.as_bytes + struct.pack("!I", SupvActionIds.CONTINUE_UPDATE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.MEM_CHECK:
|
||||
custom_data = bytearray()
|
||||
update_file = get_update_file()
|
||||
memory_id = int(input("Specify memory ID: "))
|
||||
start_address = int(input("Specify start address: 0x"), 16)
|
||||
custom_data.extend(update_file.encode("utf-8"))
|
||||
custom_data.append(0)
|
||||
custom_data.extend(struct.pack("!B", memory_id))
|
||||
custom_data.extend(struct.pack("!I", start_address))
|
||||
q.add_log_cmd(
|
||||
f"{prefix}: {Info.MEM_CHECK} for file {update_file} at memory ID {memory_id} at start "
|
||||
f"address {start_address}"
|
||||
)
|
||||
command = make_fsfw_action_cmd(
|
||||
object_id.as_bytes, SupvActionIds.MEM_CHECK, custom_data
|
||||
)
|
||||
q.add_pus_tc(command)
|
||||
|
||||
|
||||
def pack_sel_boot_image_cmd(
|
||||
@ -463,37 +497,6 @@ def pack_update_available_cmd(object_id: bytes) -> bytearray:
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_watchdogs_enable_cmd(object_id: bytes) -> bytearray:
|
||||
"""
|
||||
@brief This function packs the command to enable or disable watchdogs on the PLOC.
|
||||
@param object_id The object id of the PLOC supervisor handler.
|
||||
@note Enable = 1, Disable = 0
|
||||
"""
|
||||
watchdog_ps = 1
|
||||
watchdog_pl = 1
|
||||
watchdog_int = 0
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack("!I", SupvActionIds.WATCHDOGS_ENABLE)
|
||||
command = command + struct.pack("!B", watchdog_ps)
|
||||
command = command + struct.pack("!B", watchdog_pl)
|
||||
command = command + struct.pack("!B", watchdog_int)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_watchdog_config_timeout_cmd(object_id: bytearray) -> bytearray:
|
||||
"""
|
||||
@brief This function packs the command set the timeout of one of the three watchdogs of the PLOC.
|
||||
@param object_id The object id of the PLOC supervisor handler.
|
||||
"""
|
||||
watchdog = int(input("Specify watchdog (0 - PS, 1 - PL, 2 - INT):"))
|
||||
timeout = int(input("Specify timeout (1000 ms - 360000 ms):"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack("!I", SupvActionIds.WATCHDOGS_CONFIG_TIMEOUT)
|
||||
command = command + struct.pack("!B", watchdog)
|
||||
command = command + struct.pack("!I", timeout)
|
||||
return command
|
||||
|
||||
|
||||
def pack_lachtup_alert_cmd(object_id: bytes, state: bool) -> bytearray:
|
||||
"""
|
||||
@brief This function packs the command to enable or disable a certain latchup alerts.
|
||||
@ -510,20 +513,6 @@ def pack_lachtup_alert_cmd(object_id: bytes, state: bool) -> bytearray:
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_auto_calibrate_alert_cmd(object_id: bytearray) -> bytearray:
|
||||
"""
|
||||
@brief This function packs the command to auto calibrate a latchup alert.
|
||||
@param object_id The object id of the PLOC supervisor handler.
|
||||
"""
|
||||
latchup_id = get_latchup_id()
|
||||
mg = int(input("Specify MG: "))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack("!I", SupvActionIds.AUTO_CALIBRATE_ALERT)
|
||||
command = command + struct.pack("!B", latchup_id)
|
||||
command = command + struct.pack("!I", mg)
|
||||
return command
|
||||
|
||||
|
||||
def get_latchup_id() -> int:
|
||||
key_column_width = 10
|
||||
description_column_width = 50
|
||||
@ -604,11 +593,31 @@ def pack_mram_wipe_cmd(object_id: bytes) -> bytearray:
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
def pack_update_command(object_id: bytes) -> bytearray:
|
||||
def pack_update_command(object_id: bytes, new_update: bool) -> bytearray:
|
||||
command = bytearray()
|
||||
memory_id = int(input("Specify memory ID: "))
|
||||
start_address = int(input("Specify start address: 0x"), 16)
|
||||
update_file = get_update_file()
|
||||
if new_update:
|
||||
init_bytes_written = 0
|
||||
init_seq_count = 1
|
||||
del_mem = True
|
||||
else:
|
||||
init_bytes_written = input("Specify bytes to start from [0 default]: ")
|
||||
if init_bytes_written == "":
|
||||
init_bytes_written = 0
|
||||
init_bytes_written = int(init_bytes_written)
|
||||
init_seq_count = input("Specify initial sequence count [1 default]: ")
|
||||
if init_seq_count == "":
|
||||
init_seq_count = 1
|
||||
init_seq_count = int(init_seq_count)
|
||||
del_mem = input("Delete memory? [y/n, y default]: ")
|
||||
if del_mem.lower() in ["y", "1"]:
|
||||
del_mem = 1
|
||||
elif del_mem.lower() in ["n", "0"]:
|
||||
del_mem = 0
|
||||
else:
|
||||
raise ValueError("Invalid input, use y or n")
|
||||
command += object_id
|
||||
command += struct.pack("!I", SupvActionIds.PERFORM_UPDATE)
|
||||
command += bytearray(update_file, "utf-8")
|
||||
@ -616,6 +625,9 @@ def pack_update_command(object_id: bytes) -> bytearray:
|
||||
command += struct.pack("!B", 0)
|
||||
command += struct.pack("!B", memory_id)
|
||||
command += struct.pack("!I", start_address)
|
||||
command.extend(struct.pack("!I", init_bytes_written))
|
||||
command.extend(struct.pack("!H", init_seq_count))
|
||||
command.append(del_mem)
|
||||
return bytearray(command)
|
||||
|
||||
|
||||
@ -688,13 +700,36 @@ def get_event_buffer_path() -> str:
|
||||
|
||||
def handle_supv_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
|
||||
pw = PrintWrapper(printer)
|
||||
current_idx = 0
|
||||
if set_id == SetIds.HK_REPORT:
|
||||
# TODO: Implement
|
||||
pass
|
||||
elif set_id == SetIds.BOOT_STATUS_REPORT:
|
||||
# TODO: Implement
|
||||
pass
|
||||
fmt_str = "!BBIIBBBBBB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
soc_state,
|
||||
power_cycles,
|
||||
boot_after_ms,
|
||||
boot_timeout_ms,
|
||||
active_nvm,
|
||||
bp_0_state,
|
||||
bp_1_state,
|
||||
bp_2_state,
|
||||
boot_state,
|
||||
boot_cycles,
|
||||
) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
||||
current_idx += inc_len
|
||||
pw.dlog(
|
||||
f"SoC state (0:off, 1:booting, 2:update, 3:operating, 4:shutdown, 5:reset): {soc_state}"
|
||||
)
|
||||
pw.dlog(f"Power Cycles {power_cycles}")
|
||||
pw.dlog(f"Boot after {boot_after_ms} ms | Boot timeout {boot_timeout_ms} ms")
|
||||
pw.dlog(f"Active NVM: {active_nvm}")
|
||||
pw.dlog(
|
||||
f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}"
|
||||
)
|
||||
pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}")
|
||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 10)
|
||||
else:
|
||||
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
|
||||
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")
|
||||
pass
|
||||
|
11
tmtcc.py
11
tmtcc.py
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
import time
|
||||
@ -49,15 +48,7 @@ from tmtccmd.tc import (
|
||||
DefaultPusQueueHelper,
|
||||
)
|
||||
from tmtccmd.config import default_json_path, SetupWrapper
|
||||
from tmtccmd.config.args import (
|
||||
SetupParams,
|
||||
ArgParserWrapper,
|
||||
create_default_args_parser,
|
||||
add_default_com_if_arguments,
|
||||
add_default_mode_arguments,
|
||||
add_generic_arguments,
|
||||
add_ethernet_arguments,
|
||||
)
|
||||
from tmtccmd.config.args import SetupParams, ArgParserWrapper
|
||||
from config import __version__
|
||||
from config.definitions import PUS_APID
|
||||
from config.hook import EiveHookObject
|
||||
|
Loading…
Reference in New Issue
Block a user