From a3d9e83dc6aa378d92f0d97dfe734ab67f705805 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 14 Apr 2022 07:53:18 +0200 Subject: [PATCH] supervisor event buffer request --- config/events.csv | 21 +++++++----- config/returnvalues.csv | 4 ++- pus_tc/cmd_definitions.py | 4 +++ pus_tc/devs/ploc_supervisor.py | 62 ++++++++++++++++++++++++++++++++-- 4 files changed, 79 insertions(+), 12 deletions(-) diff --git a/config/events.csv b/config/events.csv index c972695..21760c4 100644 --- a/config/events.csv +++ b/config/events.csv @@ -141,15 +141,18 @@ 12100;0x2f44;SUPV_UPDATE_FAILED;LOW;update failed;linux\devices\ploc\PlocSupvHelper.h 12101;0x2f45;SUPV_UPDATE_SUCCESSFUL;LOW;update successful;linux\devices\ploc\PlocSupvHelper.h 12102;0x2f46;TERMINATED_UPDATE_PROCEDURE;LOW;Terminated update procedure by command;linux\devices\ploc\PlocSupvHelper.h -12103;0x2f47;SUPV_SENDING_COMMAND_FAILED;LOW;;linux\devices\ploc\PlocSupvHelper.h -12104;0x2f48;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 -12105;0x2f49;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 -12106;0x2f4a;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 -12107;0x2f4b;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 -12108;0x2f4c;SUPV_ACK_FAILURE_REPORT;LOW;Supervisor received acknowledgment failure report P1: Internal state of supervisor helper;linux\devices\ploc\PlocSupvHelper.h -12109;0x2f4d;SUPV_EXE_FAILURE_REPORT;LOW;Supervisor received execution failure report P1: Internal state of supervisor;linux\devices\ploc\PlocSupvHelper.h -12110;0x2f4e;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 -12111;0x2f4f;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 +12103;0x2f47;SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL;LOW;Requesting event buffer was successful;linux\devices\ploc\PlocSupvHelper.h +12104;0x2f48;SUPV_EVENT_BUFFER_REQUEST_FAILED;LOW;Requesting event buffer failed;linux\devices\ploc\PlocSupvHelper.h +12105;0x2f49;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 +12106;0x2f4a;SUPV_SENDING_COMMAND_FAILED;LOW;;linux\devices\ploc\PlocSupvHelper.h +12107;0x2f4b;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 +12108;0x2f4c;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 +12109;0x2f4d;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 +12110;0x2f4e;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 +12111;0x2f4f;SUPV_ACK_FAILURE_REPORT;LOW;Supervisor received acknowledgment failure report P1: Internal state of supervisor helper;linux\devices\ploc\PlocSupvHelper.h +12112;0x2f50;SUPV_EXE_FAILURE_REPORT;LOW;Supervisor received execution failure report P1: Internal state of supervisor;linux\devices\ploc\PlocSupvHelper.h +12113;0x2f51;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 +12114;0x2f52;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 12200;0x2fa8;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission\devices\PayloadPcduHandler.h 12201;0x2fa9;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission\devices\PayloadPcduHandler.h 12202;0x2faa;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission\devices\PayloadPcduHandler.h diff --git a/config/returnvalues.csv b/config/returnvalues.csv index a66555c..104795c 100644 --- a/config/returnvalues.csv +++ b/config/returnvalues.csv @@ -493,7 +493,9 @@ 0x61a1;PLMEMDUMP_MramInvalidAddressCombination;The specified end address is lower than the start address;0xA1;linux\devices\ploc\PlocMemoryDumper.h;PLOC_MEMORY_DUMPER 0x68a0; PLMPHLP_FileClosedAccidentally;File accidentally close;0xA0;linux\devices\ploc\PlocMPSoCHelper.h;PLOC_MPSOC_HELPER 0x5aa0;PLSPVhLP_FileClosedAccidentally;File accidentally close;0xA0;linux\devices\ploc\PlocSupvHelper.h;PLOC_SUPV_HELPER -0x5aa1;PLSPVhLP_ProcessTerminated;;0xA1;linux\devices\ploc\PlocSupvHelper.h;PLOC_SUPV_HELPER +0x5aa1;PLSPVhLP_ProcessTerminated;Process has been terminated by command;0xA1;linux\devices\ploc\PlocSupvHelper.h;PLOC_SUPV_HELPER +0x5aa2;PLSPVhLP_PathNotExists;Received command with invalid pathname;0xA2;linux\devices\ploc\PlocSupvHelper.h;PLOC_SUPV_HELPER +0x5aa3;PLSPVhLP_EventBufferReplyInvalidApid;Expected event buffer TM but received space packet with other APID;0xA3;linux\devices\ploc\PlocSupvHelper.h;PLOC_SUPV_HELPER 0x56a0;STRH_TemperatureReqFailed;Status in temperature reply signals error;0xA0;linux\devices\startracker\StarTrackerHandler.h;STR_HANDLER 0x56a1;STRH_PingFailed;Ping command failed;0xA1;linux\devices\startracker\StarTrackerHandler.h;STR_HANDLER 0x56a2;STRH_VersionReqFailed;Status in version reply signals error;0xA2;linux\devices\startracker\StarTrackerHandler.h;STR_HANDLER diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index ed1dc6f..75bee81 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -575,6 +575,10 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT): "48": ("PLOC Supervisor: Disable auto TM", {OpCodeDictKeys.TIMEOUT: 2.0}), "49": ("PLOC Supervisor: Enable ADC monitor task", {OpCodeDictKeys.TIMEOUT: 2.0}), "50": ("PLOC Supervisor: Disable ADC monitor task", {OpCodeDictKeys.TIMEOUT: 2.0}), + "51": ("PLOC Supervisor: Logging request event buffers", {OpCodeDictKeys.TIMEOUT: 2.0}), + "52": ("PLOC Supervisor: Logging clear counters", {OpCodeDictKeys.TIMEOUT: 2.0}), + "53": ("PLOC Supervisor: Logging set topic", {OpCodeDictKeys.TIMEOUT: 2.0}), + "54": ("PLOC Supervisor: Logging request counters", {OpCodeDictKeys.TIMEOUT: 2.0}), } service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv) diff --git a/pus_tc/devs/ploc_supervisor.py b/pus_tc/devs/ploc_supervisor.py index 7c95555..54af08d 100644 --- a/pus_tc/devs/ploc_supervisor.py +++ b/pus_tc/devs/ploc_supervisor.py @@ -34,6 +34,11 @@ update_file_dict = { "2": ["/mnt/sd0/ploc/supervisor/update.bin", "/mnt/sd0/ploc/supervisor/update.bin"], } +event_buffer_path_dict = { + MANUAL_INPUT: ["manual input", ""], + "2": ["/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"], +} + class SupvActionIds: HK_REPORT = 1 @@ -73,7 +78,7 @@ class SupvActionIds: READ_GPIO = 35 RESTART_SUPERVISOR = 36 FACTORY_RESET_CLEAR_ALL = 37 - REQUEST_LOGGING_DATA = 38 + LOGGING_REQUEST_COUNTERS = 38 UPDATE_IMAGE_DATA = 39 FACTORY_RESET_CLEAR_MIRROR = 40 FACTORY_RESET_CLEAR_CIRCULAR = 41 @@ -86,6 +91,10 @@ class SupvActionIds: DISABLE_AUTO_TM = 51 ENABLE_ADC_MONITOR_TASK = 52 DISABLE_ADC_MONITOR_TASK = 53 + LOGGING_REQUEST_EVENT_BUFFERS = 54 + LOGGING_CLEAR_COUNTERS = 55 + LOGGING_SET_TOPIC = 56 + class SupvHkIds: @@ -437,6 +446,28 @@ def pack_ploc_supv_commands( ) command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == "51": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging request event buffers")) + command = pack_logging_buffer_request(object_id) + command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == "52": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging clear counters")) + command = object_id + struct.pack( + "!I", SupvActionIds.LOGGING_CLEAR_COUNTERS + ) + command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == "53": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging set topic")) + command = pack_logging_set_topic(object_id) + command = PusTelecommand(service=8, subservice=128, ssc=68, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == "54": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging request counters")) + command = object_id + struct.pack('!I', SupvActionIds.LOGGING_REQUEST_COUNTERS) + command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) return tc_queue @@ -705,6 +736,15 @@ def pack_set_shutdown_timeout_command(object_id: bytearray) -> bytearray: return command +def pack_logging_buffer_request(object_id: bytearray) -> bytearray: + command = bytearray() + command += object_id + command += struct.pack('!I', SupvActionIds.LOGGING_REQUEST_EVENT_BUFFERS) + path = get_event_buffer_path() + command += bytearray(path, 'utf-8') + return command + + def get_debug_verbosity() -> int: tries = 0 while tries < 3: @@ -752,12 +792,30 @@ def pack_read_gpio_cmd(object_id: bytearray) -> bytearray: return command +def pack_logging_set_topic(objetc_id: bytearray) -> bytearray: + command = objetc_id + struct.pack('!I', SupvActionIds.LOGGING_SET_TOPIC) + tpc = int(input("Specify logging topic: ")) + command += struct.pack('!B', tpc) + return command + + def get_update_file() -> str: LOGGER.info("Specify update file ") input_helper = InputHelper(update_file_dict) key = input_helper.get_key() if key == MANUAL_INPUT: - file = input("Ploc MPSoC: Specify absolute name of update file: ") + file = input("Ploc Supervisor: Specify absolute name of update file: ") else: file = update_file_dict[key][1] return file + + +def get_event_buffer_path() -> str: + LOGGER.info("Specify path where to store event buffer file ") + input_helper = InputHelper(event_buffer_path_dict) + key = input_helper.get_key() + if key == MANUAL_INPUT: + file = input("Ploc Supervisor: Specify path: ") + else: + file = event_buffer_path_dict[key][1] + return file