supervisor event buffer request

This commit is contained in:
Jakob Meier 2022-04-14 07:52:21 +02:00
parent f679461164
commit 10343a0dab
15 changed files with 166 additions and 105 deletions

View File

@ -47,19 +47,6 @@ void ObjectFactory::produce(void* args) {
new UartComIF(objects::UART_COM_IF);
#if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* mpsocUartCookie =
new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, UartModes::NON_CANONICAL,
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
mpsocUartCookie->setNoFixedSizeReply();
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
auto mpsocGpioIF = new DummyGpioIF();
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper,
Gpio(gpioIds::ENABLE_MPSOC_UART, mpsocGpioIF), objects::PLOC_SUPERVISOR_HANDLER);
plocMPSoCHandler->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_TEST_LIBGPIOD == 1
#if OBSW_TEST_GPIO_OPEN_BYLABEL == 1
/* Configure MIO0 as input */
@ -131,11 +118,24 @@ new UartComIF(objects::UART_COM_IF);
pcduSwitches::TCS_BOARD_8V_HEATER_IN);
#endif
#if OBSW_ADD_PLOC_MPSOC == 1
UartCookie* mpsocUartCookie =
new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, UartModes::NON_CANONICAL,
uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE);
mpsocUartCookie->setNoFixedSizeReply();
PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER);
auto mpsocGpioIF = new DummyGpioIF();
PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler(
objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper,
Gpio(gpioIds::ENABLE_MPSOC_UART, mpsocGpioIF), objects::PLOC_SUPERVISOR_HANDLER);
plocMPSoCHandler->setStartUpImmediately();
#endif /* OBSW_ADD_PLOC_MPSOC == 1 */
#if OBSW_ADD_PLOC_SUPERVISOR == 1
/* Configuration for MIO0 on TE0720-03-1CFA */
UartCookie* supervisorCookie =
new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, std::string("/dev/ttyPS1"),
UartModes::NON_CANONICAL, 115200, supv::MAX_PACKET_SIZE * 20);
UartModes::NON_CANONICAL, uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20);
supervisorCookie->setNoFixedSizeReply();
auto supvGpioIF = new DummyGpioIF();
auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER);

View File

@ -3,6 +3,7 @@
#include <cstdint>
#include <fsfw_hal/linux/spi/spiDefinitions.h>
#include <fsfw_hal/linux/uart/UartCookie.h>
/**
* SPI configuration will be contained here to let the device handlers remain independent
@ -49,11 +50,11 @@ static constexpr spi::SpiModes RTD_MODE = spi::SpiModes::MODE_3;
namespace uart {
static constexpr size_t HYPERION_GPS_REPLY_MAX_BUFFER = 1024;
static constexpr uint32_t SYRLINKS_BAUD = 38400;
static constexpr uint32_t GNSS_BAUD = 9600;
static constexpr uint32_t PLOC_MPSOC_BAUD = 115200;
static constexpr uint32_t PLOC_SUPERVISOR_BAUD = 115200;
static constexpr uint32_t STAR_TRACKER_BAUD = 921600;
static constexpr UartBaudRate SYRLINKS_BAUD = UartBaudRate::RATE_38400;
static constexpr UartBaudRate GNSS_BAUD = UartBaudRate::RATE_9600;
static constexpr UartBaudRate PLOC_MPSOC_BAUD = UartBaudRate::RATE_115200;
static constexpr UartBaudRate PLOC_SUPV_BAUD = UartBaudRate::RATE_115200;
static constexpr UartBaudRate STAR_TRACKER_BAUD = UartBaudRate::RATE_921600;
}

2
fsfw

@ -1 +1 @@
Subproject commit 43917d98c025b446aa0d79d2166b1f031fb288ae
Subproject commit ce17be63f4f3bb8947843e423685c622510ae09f

View File

@ -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

1 2200 0x0898 STORE_SEND_WRITE_FAILED LOW fsfw\src\fsfw\tmstorage\TmStoreBackendIF.h
141 12100 0x2f44 SUPV_UPDATE_FAILED LOW update failed linux\devices\ploc\PlocSupvHelper.h
142 12101 0x2f45 SUPV_UPDATE_SUCCESSFUL LOW update successful linux\devices\ploc\PlocSupvHelper.h
143 12102 0x2f46 TERMINATED_UPDATE_PROCEDURE LOW Terminated update procedure by command linux\devices\ploc\PlocSupvHelper.h
144 12103 0x2f47 SUPV_SENDING_COMMAND_FAILED SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL LOW Requesting event buffer was successful linux\devices\ploc\PlocSupvHelper.h
145 12104 0x2f48 SUPV_HELPER_REQUESTING_REPLY_FAILED SUPV_EVENT_BUFFER_REQUEST_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 Requesting event buffer failed linux\devices\ploc\PlocSupvHelper.h
146 12105 0x2f49 SUPV_HELPER_READING_REPLY_FAILED SUPV_EVENT_BUFFER_REQUEST_TERMINATED LOW Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of supervisor helper Terminated event buffer request by command P1: Number of packets read before process was terminated linux\devices\ploc\PlocSupvHelper.h
147 12106 0x2f4a SUPV_MISSING_ACK SUPV_SENDING_COMMAND_FAILED LOW Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper linux\devices\ploc\PlocSupvHelper.h
148 12107 0x2f4b SUPV_MISSING_EXE SUPV_HELPER_REQUESTING_REPLY_FAILED LOW Supervisor did not receive execution report P1: Number of bytes missing P2: Internal state of supervisor helper 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
149 12108 0x2f4c SUPV_ACK_FAILURE_REPORT SUPV_HELPER_READING_REPLY_FAILED LOW Supervisor received acknowledgment failure report P1: Internal state of supervisor helper 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
150 12109 0x2f4d SUPV_EXE_FAILURE_REPORT SUPV_MISSING_ACK LOW Supervisor received execution failure report P1: Internal state of supervisor Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper linux\devices\ploc\PlocSupvHelper.h
151 12110 0x2f4e SUPV_ACK_INVALID_APID SUPV_MISSING_EXE LOW Supervisor expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper Supervisor did not receive execution report P1: Number of bytes missing P2: Internal state of supervisor helper linux\devices\ploc\PlocSupvHelper.h
152 12111 0x2f4f SUPV_EXE_INVALID_APID SUPV_ACK_FAILURE_REPORT 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 Supervisor received acknowledgment failure report P1: Internal state of supervisor helper linux\devices\ploc\PlocSupvHelper.h
153 12112 0x2f50 SUPV_EXE_FAILURE_REPORT LOW Supervisor received execution failure report P1: Internal state of supervisor linux\devices\ploc\PlocSupvHelper.h
154 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
155 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
156 12200 0x2fa8 TRANSITION_BACK_TO_OFF MEDIUM Could not transition properly and went back to ALL OFF mission\devices\PayloadPcduHandler.h
157 12201 0x2fa9 NEG_V_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission\devices\PayloadPcduHandler.h
158 12202 0x2faa U_DRO_OUT_OF_BOUNDS MEDIUM P1: 0 -> too low, 1 -> too high P2: Float value mission\devices\PayloadPcduHandler.h

View File

@ -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

Can't render this file because it has a wrong number of fields in line 29.

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 177 translations.
* @brief Auto-generated event translation file. Contains 180 translations.
* @details
* Generated on: 2022-04-10 13:17:48
* Generated on: 2022-04-13 17:02:22
*/
#include "translateEvents.h"
@ -148,6 +148,9 @@ const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG
const char *SUPV_UPDATE_FAILED_STRING = "SUPV_UPDATE_FAILED";
const char *SUPV_UPDATE_SUCCESSFUL_STRING = "SUPV_UPDATE_SUCCESSFUL";
const char *TERMINATED_UPDATE_PROCEDURE_STRING = "TERMINATED_UPDATE_PROCEDURE";
const char *SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL_STRING = "SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL";
const char *SUPV_EVENT_BUFFER_REQUEST_FAILED_STRING = "SUPV_EVENT_BUFFER_REQUEST_FAILED";
const char *SUPV_EVENT_BUFFER_REQUEST_TERMINATED_STRING = "SUPV_EVENT_BUFFER_REQUEST_TERMINATED";
const char *SUPV_SENDING_COMMAND_FAILED_STRING = "SUPV_SENDING_COMMAND_FAILED";
const char *SUPV_HELPER_REQUESTING_REPLY_FAILED_STRING = "SUPV_HELPER_REQUESTING_REPLY_FAILED";
const char *SUPV_HELPER_READING_REPLY_FAILED_STRING = "SUPV_HELPER_READING_REPLY_FAILED";
@ -468,22 +471,28 @@ const char *translateEvents(Event event) {
case (12102):
return TERMINATED_UPDATE_PROCEDURE_STRING;
case (12103):
return SUPV_SENDING_COMMAND_FAILED_STRING;
return SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL_STRING;
case (12104):
return SUPV_HELPER_REQUESTING_REPLY_FAILED_STRING;
return SUPV_EVENT_BUFFER_REQUEST_FAILED_STRING;
case (12105):
return SUPV_HELPER_READING_REPLY_FAILED_STRING;
return SUPV_EVENT_BUFFER_REQUEST_TERMINATED_STRING;
case (12106):
return SUPV_MISSING_ACK_STRING;
return SUPV_SENDING_COMMAND_FAILED_STRING;
case (12107):
return SUPV_MISSING_EXE_STRING;
return SUPV_HELPER_REQUESTING_REPLY_FAILED_STRING;
case (12108):
return SUPV_ACK_FAILURE_REPORT_STRING;
return SUPV_HELPER_READING_REPLY_FAILED_STRING;
case (12109):
return SUPV_EXE_FAILURE_REPORT_STRING;
return SUPV_MISSING_ACK_STRING;
case (12110):
return SUPV_ACK_INVALID_APID_STRING;
return SUPV_MISSING_EXE_STRING;
case (12111):
return SUPV_ACK_FAILURE_REPORT_STRING;
case (12112):
return SUPV_EXE_FAILURE_REPORT_STRING;
case (12113):
return SUPV_ACK_INVALID_APID_STRING;
case (12114):
return SUPV_EXE_INVALID_APID_STRING;
case (12200):
return TRANSITION_BACK_TO_OFF_STRING;

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 117 translations.
* Generated on: 2022-04-10 13:17:55
* Generated on: 2022-04-13 17:02:27
*/
#include "translateObjects.h"

View File

@ -71,7 +71,7 @@ static const uint16_t SIZE_EXE_REPORT = 14;
static const uint16_t SIZE_HK_REPORT = 52;
static const uint16_t SIZE_BOOT_STATUS_REPORT = 24;
static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 31;
static const uint16_t SIZE_LOGGING_REPORT = 44;
static const uint16_t SIZE_LOGGING_REPORT = 45;
/**
* SpacePacket apids of telemetry packets
@ -1260,7 +1260,7 @@ class TmPacket : public SpacePacket {
* @brief Returns the payload data length (data field length without CRC)
*/
uint16_t getPayloadDataLength() {
this->getPacketDataLength() - 1;
return this->getPacketDataLength() - 1;
}
ReturnValue_t checkCrc() {

View File

@ -117,11 +117,18 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
plocSupvHelperExecuting = true;
return EXECUTION_FINISHED;
}
case LOGGING_REQUEST_EVENT_BUFFERS:
case LOGGING_REQUEST_EVENT_BUFFERS: {
if (size > config::MAX_PATH_SIZE) {
return SupvReturnValuesIF::FILENAME_TOO_LONG;
}
supvHelper->startEventbBufferRequest(std::string(reinterpret_cast<const char*>(data), size));
result = supvHelper->startEventbBufferRequest(
std::string(reinterpret_cast<const char*>(data), size));
if (result != RETURN_OK) {
return result;
}
plocSupvHelperExecuting = true;
return EXECUTION_FINISHED;
}
default:
break;
}
@ -335,7 +342,8 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
break;
}
case LOGGING_SET_TOPIC: {
RequestLoggingData packet(RequestLoggingData::Sa::SET_LOGGING_TOPIC);
uint8_t tpc = *(commandData);
RequestLoggingData packet(RequestLoggingData::Sa::SET_LOGGING_TOPIC, tpc);
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
result = RETURN_OK;
break;
@ -394,6 +402,8 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
this->insertInCommandMap(ENABLE_ADC_MONITOR_TASK);
this->insertInCommandMap(DISABLE_ADC_MONITOR_TASK);
this->insertInCommandMap(LOGGING_REQUEST_COUNTERS);
this->insertInCommandMap(LOGGING_CLEAR_COUNTERS);
this->insertInCommandMap(LOGGING_SET_TOPIC);
this->insertInCommandAndReplyMap(FIRST_MRAM_DUMP, 3);
this->insertInCommandAndReplyMap(CONSECUTIVE_MRAM_DUMP, 3);
this->insertInReplyMap(ACK_REPORT, 3, nullptr, SIZE_ACK_REPORT);
@ -504,6 +514,8 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
case supv::DISABLE_AUTO_TM:
case supv::ENABLE_ADC_MONITOR_TASK:
case supv::DISABLE_ADC_MONITOR_TASK:
case supv::LOGGING_CLEAR_COUNTERS:
case supv::LOGGING_SET_TOPIC:
enabledReplies = 2;
break;
default:
@ -534,11 +546,12 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
if (nextReplyId == supv::FIRST_MRAM_DUMP) {
*foundId = supv::FIRST_MRAM_DUMP;
using namespace supv;
if (nextReplyId == FIRST_MRAM_DUMP) {
*foundId = FIRST_MRAM_DUMP;
return parseMramPackets(start, remainingSize, foundLen);
} else if (nextReplyId == supv::CONSECUTIVE_MRAM_DUMP) {
*foundId = supv::CONSECUTIVE_MRAM_DUMP;
} else if (nextReplyId == CONSECUTIVE_MRAM_DUMP) {
*foundId = CONSECUTIVE_MRAM_DUMP;
return parseMramPackets(start, remainingSize, foundLen);
}
@ -547,37 +560,37 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
uint16_t apid = (*(start) << 8 | *(start + 1)) & APID_MASK;
switch (apid) {
case (supv::APID_ACK_SUCCESS):
*foundLen = supv::SIZE_ACK_REPORT;
*foundId = supv::ACK_REPORT;
case (APID_ACK_SUCCESS):
*foundLen = SIZE_ACK_REPORT;
*foundId = ACK_REPORT;
break;
case (supv::APID_ACK_FAILURE):
*foundLen = supv::SIZE_ACK_REPORT;
*foundId = supv::ACK_REPORT;
case (APID_ACK_FAILURE):
*foundLen = SIZE_ACK_REPORT;
*foundId = ACK_REPORT;
break;
case (supv::APID_HK_REPORT):
*foundLen = supv::SIZE_HK_REPORT;
*foundId = supv::HK_REPORT;
case (APID_HK_REPORT):
*foundLen = SIZE_HK_REPORT;
*foundId = HK_REPORT;
break;
case (supv::APID_BOOT_STATUS_REPORT):
*foundLen = supv::SIZE_BOOT_STATUS_REPORT;
*foundId = supv::BOOT_STATUS_REPORT;
case (APID_BOOT_STATUS_REPORT):
*foundLen = SIZE_BOOT_STATUS_REPORT;
*foundId = BOOT_STATUS_REPORT;
break;
case (supv::APID_LATCHUP_STATUS_REPORT):
*foundLen = supv::SIZE_LATCHUP_STATUS_REPORT;
*foundId = supv::LATCHUP_REPORT;
case (APID_LATCHUP_STATUS_REPORT):
*foundLen = SIZE_LATCHUP_STATUS_REPORT;
*foundId = LATCHUP_REPORT;
break;
case (supv::APID_DATA_LOGGER_DATA):
*foundLen = supv::SIZE_LOGGING_REPORT;
*foundId = supv::LOGGING_REPORT;
case (APID_DATA_LOGGER_DATA):
*foundLen = SIZE_LOGGING_REPORT;
*foundId = LOGGING_REPORT;
break;
case (supv::APID_EXE_SUCCESS):
*foundLen = supv::SIZE_EXE_REPORT;
*foundId = supv::EXE_REPORT;
case (APID_EXE_SUCCESS):
*foundLen = SIZE_EXE_REPORT;
*foundId = EXE_REPORT;
break;
case (supv::APID_EXE_FAILURE):
*foundLen = supv::SIZE_EXE_REPORT;
*foundId = supv::EXE_REPORT;
case (APID_EXE_FAILURE):
*foundLen = SIZE_EXE_REPORT;
*foundId = EXE_REPORT;
break;
default: {
sif::debug << "PlocSupervisorHandler::scanForReply: Reply has invalid apid" << std::endl;
@ -687,6 +700,16 @@ ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool
localDataPoolMap.emplace(supv::LATCHUP_RPT_TIME_YEAR, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(supv::LATCHUP_RPT_IS_SET, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(supv::SUPERVISOR_REBOOTS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::LATCHUP_EVENTS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::ADC_TRIGGERS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::PS_HEARTBEATS_LOST, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::PL_HEARTBEATS_LOST, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::TC_RECEIVED, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::TM_RECEIVED, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::SOC_BOOTS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(supv::SOC_BOOT_FAILS, new PoolEntry<uint32_t>({0}));
return HasReturnvaluesIF::RETURN_OK;
}
@ -1037,7 +1060,7 @@ ReturnValue_t PlocSupervisorHandler::handleLoggingReport(const uint8_t* data) {
return result;
}
const uint8_t* dataField = data + supv::DATA_FIELD_OFFSET + sizeof(sa);
const uint8_t* dataField = data + supv::DATA_FIELD_OFFSET + sizeof(supv::RequestLoggingData::Sa);
result = loggingReport.read();
if (result != RETURN_OK) {
return result;
@ -1078,6 +1101,9 @@ void PlocSupervisorHandler::setNextReplyId() {
case supv::CONSECUTIVE_MRAM_DUMP:
nextReplyId = supv::CONSECUTIVE_MRAM_DUMP;
break;
case supv::LOGGING_REQUEST_COUNTERS:
nextReplyId = supv::LOGGING_REPORT;
break;
default:
/* If no telemetry is expected the next reply is always the execution report */
nextReplyId = supv::EXE_REPORT;
@ -1331,9 +1357,10 @@ void PlocSupervisorHandler::prepareSetShutdownTimeoutCmd(const uint8_t* commandD
ReturnValue_t PlocSupervisorHandler::prepareLoggingRequest(const uint8_t* commandData,
size_t commandDataLen) {
uint8_t sa = *commandData;
using namespace supv;
RequestLoggingData::Sa sa = static_cast<RequestLoggingData::Sa>(*commandData);
uint8_t tpc = *(commandData + 1);
supv::RequestLoggingData packet(sa, tpc);
RequestLoggingData packet(sa, tpc);
packetToOutBuffer(packet.getWholeData(), packet.getFullSize());
return RETURN_OK;
}

View File

@ -11,6 +11,7 @@
#include "bsp_q7s/memory/FilesystemHelper.h"
#include "fsfw/globalfunctions/CRC.h"
#include "mission/utility/Timestamp.h"
#include "mission/utility/Filenaming.h"
PlocSupvHelper::PlocSupvHelper(object_id_t objectId) : SystemObject(objectId) {}
@ -195,7 +196,7 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
using namespace supv;
ReturnValuet_t result = RETURN_OK;
ReturnValue_t result = RETURN_OK;
RequestLoggingData packet(RequestLoggingData::Sa::REQUEST_EVENT_BUFFERS);
result = sendCommand(packet);
if (result != RETURN_OK) {
@ -213,6 +214,7 @@ ReturnValue_t PlocSupvHelper::performEventBufferRequest() {
if (result != RETURN_OK) {
return result;
}
return result;
}
ReturnValue_t PlocSupvHelper::prepareUpdate() {
@ -337,8 +339,8 @@ ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t
}
}
if (remainingBytes != 0) {
sif::warning << "PlocSupvHelper::handleTmReception: Failed to receive reply" << std::endl;
triggerEvent(SUPV_MISSING_EXE, remainingBytes, static_cast<uint32_t>(internalState));
sif::warning << "PlocSupvHelper::handleTmReception: Failed to read " << remainingBytes
<< " bytes" << std::endl;
return RETURN_FAILED;
}
result = tmPacket->checkCrc();
@ -437,31 +439,40 @@ uint32_t PlocSupvHelper::getFileSize(std::string filename) {
}
ReturnValue_t PlocSupvHelper::handleEventBufferReception() {
std::sring filename = Filenaming::generateAbsoluteFilename(eventBufferReq.pat,
ReturnValue_t result = RETURN_OK;
std::string filename = Filenaming::generateAbsoluteFilename(eventBufferReq.path,
eventBufferReq.filename, timestamping);
std::ofstream file(filename, std::ios_base::app | std::ios_base::out);
uint32_t packetsRead = 0;
size_t requestLen = 0;
supv::TmPacket tmPacket;
for (packetsRead = 0; packetsRead < NUM_EVENT_BUFFER_PACKETS - 1; packetsRead++) {
for (packetsRead = 0; packetsRead < NUM_EVENT_BUFFER_PACKETS; packetsRead++) {
if (terminate) {
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_TERMINATED, packetsRead - 1);
file.close();
return PROCESS_TERMINATED;
}
result = handleTmReception(&tmPacket, SIZE_EVENT_BUFFER_FULL_PACKET);
if (packetsRead == NUM_EVENT_BUFFER_PACKETS - 1) {
requestLen = SIZE_EVENT_BUFFER_LAST_PACKET;
} else {
requestLen = SIZE_EVENT_BUFFER_FULL_PACKET;
}
result = handleTmReception(&tmPacket, requestLen);
if (result != RETURN_OK) {
sif::debug << "PlocSupvHelper::handleEventBufferReception: Failed while trying to read packet"
<< " " << packetsRead + 1 << std::endl;
file.close();
return result;
}
uint16_t apid = tmPacket.getAPID();
if (apid != supv::APID_MRAM_DUMP_TM) {
sif::warning << "PlocSupvHelper::handleEventBufferReception: Did not expect space packet "
<< "with APID " << std::hex << std::endl;
return EVENT_BUFFER_REQUEST_INVALID_APID;
<< "with APID 0x" << std::hex << apid << std::endl;
file.close();
return EVENT_BUFFER_REPLY_INVALID_APID;
}
file.write(reinterpret_cast<const char*>(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH),
packetLen - 1);
file.write(reinterpret_cast<const char*>(tmPacket.getPacketData()),
tmPacket.getPayloadDataLength());
}
file.write(reinterpret_cast<const char*>(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH),
packetLen - 1);
return result;
}

View File

@ -112,7 +112,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
//! [EXPORT] : [COMMENT] Received command with invalid pathname
static const ReturnValue_t PATH_NOT_EXISTS = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Expected event buffer TM but received space packet with other APID
static const ReturnValue_t EVENT_BUFFER_REQUEST_INVALID_APID = MAKE_RETURN_CODE(0xA3);
static const ReturnValue_t EVENT_BUFFER_REPLY_INVALID_APID = MAKE_RETURN_CODE(0xA3);
// Maximum number of times the communication interface retries polling data from the reply
// buffer
@ -140,7 +140,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
std::string path = "";
// Default name of file where event buffer data will be written to. Timestamp will be added to
// name when new file is created
std::string filename = "event-buffer";
std::string filename = "event-buffer.bin";
};
EventBufferRequest eventBufferReq;

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 177 translations.
* @brief Auto-generated event translation file. Contains 180 translations.
* @details
* Generated on: 2022-04-10 13:17:48
* Generated on: 2022-04-13 17:02:22
*/
#include "translateEvents.h"
@ -148,6 +148,9 @@ const char *STR_HELPER_REQUESTING_MSG_FAILED_STRING = "STR_HELPER_REQUESTING_MSG
const char *SUPV_UPDATE_FAILED_STRING = "SUPV_UPDATE_FAILED";
const char *SUPV_UPDATE_SUCCESSFUL_STRING = "SUPV_UPDATE_SUCCESSFUL";
const char *TERMINATED_UPDATE_PROCEDURE_STRING = "TERMINATED_UPDATE_PROCEDURE";
const char *SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL_STRING = "SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL";
const char *SUPV_EVENT_BUFFER_REQUEST_FAILED_STRING = "SUPV_EVENT_BUFFER_REQUEST_FAILED";
const char *SUPV_EVENT_BUFFER_REQUEST_TERMINATED_STRING = "SUPV_EVENT_BUFFER_REQUEST_TERMINATED";
const char *SUPV_SENDING_COMMAND_FAILED_STRING = "SUPV_SENDING_COMMAND_FAILED";
const char *SUPV_HELPER_REQUESTING_REPLY_FAILED_STRING = "SUPV_HELPER_REQUESTING_REPLY_FAILED";
const char *SUPV_HELPER_READING_REPLY_FAILED_STRING = "SUPV_HELPER_READING_REPLY_FAILED";
@ -468,22 +471,28 @@ const char *translateEvents(Event event) {
case (12102):
return TERMINATED_UPDATE_PROCEDURE_STRING;
case (12103):
return SUPV_SENDING_COMMAND_FAILED_STRING;
return SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL_STRING;
case (12104):
return SUPV_HELPER_REQUESTING_REPLY_FAILED_STRING;
return SUPV_EVENT_BUFFER_REQUEST_FAILED_STRING;
case (12105):
return SUPV_HELPER_READING_REPLY_FAILED_STRING;
return SUPV_EVENT_BUFFER_REQUEST_TERMINATED_STRING;
case (12106):
return SUPV_MISSING_ACK_STRING;
return SUPV_SENDING_COMMAND_FAILED_STRING;
case (12107):
return SUPV_MISSING_EXE_STRING;
return SUPV_HELPER_REQUESTING_REPLY_FAILED_STRING;
case (12108):
return SUPV_ACK_FAILURE_REPORT_STRING;
return SUPV_HELPER_READING_REPLY_FAILED_STRING;
case (12109):
return SUPV_EXE_FAILURE_REPORT_STRING;
return SUPV_MISSING_ACK_STRING;
case (12110):
return SUPV_ACK_INVALID_APID_STRING;
return SUPV_MISSING_EXE_STRING;
case (12111):
return SUPV_ACK_FAILURE_REPORT_STRING;
case (12112):
return SUPV_EXE_FAILURE_REPORT_STRING;
case (12113):
return SUPV_ACK_INVALID_APID_STRING;
case (12114):
return SUPV_EXE_INVALID_APID_STRING;
case (12200):
return TRANSITION_BACK_TO_OFF_STRING;

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 117 translations.
* Generated on: 2022-04-10 13:17:55
* Generated on: 2022-04-13 17:02:27
*/
#include "translateObjects.h"

View File

@ -4,7 +4,7 @@
Filenaming::Filenaming() {
}
std::string FilesystemHelper::generateAbsoluteFilename(std::string path, std::string filename,
std::string Filenaming::generateAbsoluteFilename(std::string path, std::string filename,
bool addTimestamp) {
std::string absoluteName;
Timestamp timestamp;

View File

@ -20,7 +20,6 @@ class Filenaming {
*/
static std::string generateAbsoluteFilename(std::string path, std::string filename,
bool addTimestamp);
private:
Filenaming();
};