diff --git a/bsp_te0720_1cfa/ObjectFactory.cpp b/bsp_te0720_1cfa/ObjectFactory.cpp index 4cd90c45..d6e2b5ad 100644 --- a/bsp_te0720_1cfa/ObjectFactory.cpp +++ b/bsp_te0720_1cfa/ObjectFactory.cpp @@ -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); diff --git a/common/config/devConf.h b/common/config/devConf.h index 7e09b50f..c3971958 100644 --- a/common/config/devConf.h +++ b/common/config/devConf.h @@ -3,6 +3,7 @@ #include #include +#include /** * 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; } diff --git a/fsfw b/fsfw index 43917d98..ce17be63 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 43917d98c025b446aa0d79d2166b1f031fb288ae +Subproject commit ce17be63f4f3bb8947843e423685c622510ae09f diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index c9726958..21760c44 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_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/generators/bsp_q7s_returnvalues.csv b/generators/bsp_q7s_returnvalues.csv index a66555cc..104795ca 100644 --- a/generators/bsp_q7s_returnvalues.csv +++ b/generators/bsp_q7s_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/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 0f4e7e7f..41070410 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -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; diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index b041aa1d..5f8fa397 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -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" diff --git a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h index c5569265..3028680c 100644 --- a/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/linux/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -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() { diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 75071f01..09c4c61b 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -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(data), size)); + result = supvHelper->startEventbBufferRequest( + std::string(reinterpret_cast(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({0})); localDataPoolMap.emplace(supv::LATCHUP_RPT_IS_SET, new PoolEntry({0})); + localDataPoolMap.emplace(supv::SUPERVISOR_REBOOTS, new PoolEntry({0})); + localDataPoolMap.emplace(supv::LATCHUP_EVENTS, new PoolEntry({0})); + localDataPoolMap.emplace(supv::ADC_TRIGGERS, new PoolEntry({0})); + localDataPoolMap.emplace(supv::PS_HEARTBEATS_LOST, new PoolEntry({0})); + localDataPoolMap.emplace(supv::PL_HEARTBEATS_LOST, new PoolEntry({0})); + localDataPoolMap.emplace(supv::TC_RECEIVED, new PoolEntry({0})); + localDataPoolMap.emplace(supv::TM_RECEIVED, new PoolEntry({0})); + localDataPoolMap.emplace(supv::SOC_BOOTS, new PoolEntry({0})); + localDataPoolMap.emplace(supv::SOC_BOOT_FAILS, new PoolEntry({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(*commandData); uint8_t tpc = *(commandData + 1); - supv::RequestLoggingData packet(sa, tpc); + RequestLoggingData packet(sa, tpc); packetToOutBuffer(packet.getWholeData(), packet.getFullSize()); return RETURN_OK; } diff --git a/linux/devices/ploc/PlocSupvHelper.cpp b/linux/devices/ploc/PlocSupvHelper.cpp index c59f7e00..b003241f 100644 --- a/linux/devices/ploc/PlocSupvHelper.cpp +++ b/linux/devices/ploc/PlocSupvHelper.cpp @@ -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(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(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH), - packetLen - 1); + file.write(reinterpret_cast(tmPacket.getPacketData()), + tmPacket.getPayloadDataLength()); } - - file.write(reinterpret_cast(spacePacketBuffer + supv::SPACE_PACKET_HEADER_LENGTH), - packetLen - 1); + return result; } diff --git a/linux/devices/ploc/PlocSupvHelper.h b/linux/devices/ploc/PlocSupvHelper.h index f7d28308..0fe99cff 100644 --- a/linux/devices/ploc/PlocSupvHelper.h +++ b/linux/devices/ploc/PlocSupvHelper.h @@ -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; diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 0f4e7e7f..41070410 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -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; diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index b041aa1d..5f8fa397 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -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" diff --git a/mission/utility/Filenaming.cpp b/mission/utility/Filenaming.cpp index c3e98ffe..b64d1f01 100644 --- a/mission/utility/Filenaming.cpp +++ b/mission/utility/Filenaming.cpp @@ -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; diff --git a/mission/utility/Filenaming.h b/mission/utility/Filenaming.h index 9c7b1cb8..201cf78a 100644 --- a/mission/utility/Filenaming.h +++ b/mission/utility/Filenaming.h @@ -20,7 +20,6 @@ class Filenaming { */ static std::string generateAbsoluteFilename(std::string path, std::string filename, bool addTimestamp); - private: Filenaming(); };