From be45d2148634268e3a623e13f7608e6d248b9ab9 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 21 Mar 2022 08:53:55 +0100 Subject: [PATCH] mpsoc flash delete command --- bsp_egse/main.cpp | 2 +- bsp_te0720_1cfa/main.cpp | 8 ++++---- linux/devices/devicedefinitions/PlocMPSoCDefinitions.h | 6 +++--- linux/devices/ploc/PlocMPSoCHandler.cpp | 6 +++++- linux/devices/ploc/PlocMPSoCHandler.h | 3 +++ 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bsp_egse/main.cpp b/bsp_egse/main.cpp index ce7966ff..d3c8cea0 100644 --- a/bsp_egse/main.cpp +++ b/bsp_egse/main.cpp @@ -3,7 +3,7 @@ #include "InitMission.h" #include "OBSWConfig.h" #include "OBSWVersion.h" -#include "fsfw/FSFWVersion.h" +#include "fsfw/version.h" #include "fsfw/tasks/TaskFactory.h" /** diff --git a/bsp_te0720_1cfa/main.cpp b/bsp_te0720_1cfa/main.cpp index 3281b559..cb7d987e 100644 --- a/bsp_te0720_1cfa/main.cpp +++ b/bsp_te0720_1cfa/main.cpp @@ -3,7 +3,7 @@ #include "InitMission.h" #include "OBSWConfig.h" #include "OBSWVersion.h" -#include "fsfw/FSFWVersion.h" +#include "fsfw/version.h" #include "fsfw/tasks/TaskFactory.h" /** @@ -12,12 +12,12 @@ * @return */ int main(void) { + using namespace fsfw; std::cout << "-- EIVE OBSW --" << std::endl; std::cout << "-- Compiled for Trenz TE0720-1CFA" << " --" << std::endl; - std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION << "." - << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION << FSFW_REVISION - << "--" << std::endl; + std::cout << "-- OBSW v" << SW_VERSION << "." << SW_SUBVERSION << "." << SW_REVISION << ", FSFW v" + << FSFW_VERSION << "--" << std::endl; std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; initmission::initMission(); diff --git a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h index b4b85efc..e19bca50 100644 --- a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h +++ b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h @@ -326,12 +326,12 @@ public: }; /** - * @brief Class to help creation of flash fclose command. + * @brief Class to help creation of flash delete command. */ -class FlashDelete: public TcBase { +class TcFlashDelete: public TcBase { public: - FlashDelete(uint16_t sequenceCount) : + TcFlashDelete(uint16_t sequenceCount) : TcBase(apid::TC_FLASHDELETE , sequenceCount) { } diff --git a/linux/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp index 2d99545a..d8e4d2c6 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.cpp +++ b/linux/devices/ploc/PlocMPSoCHandler.cpp @@ -295,10 +295,14 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t * commandData, ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t * commandData, size_t commandDataLen) { + if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) { + return NAME_TOO_LONG; + } ReturnValue_t result = RETURN_OK; sequenceCount++; mpsoc::TcFlashDelete tcFlashDelete(sequenceCount); - result = tcFlashDelete.createPacket(commandData, commandDataLen); + result = tcFlashDelete.createPacket( + std::string(reinterpret_cast(commandData), commandDataLen)); if (result != RETURN_OK) { sequenceCount--; return result; diff --git a/linux/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h index 60977bd0..81828ca3 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.h +++ b/linux/devices/ploc/PlocMPSoCHandler.h @@ -88,6 +88,9 @@ private: //! P2: Received sequence count static const Event MPSOC_HANDLER_SEQ_CNT_MISMATCH = MAKE_EVENT(5, severity::LOW); + //! [EXPORT] : [COMMENT] Received command has file string with invalid length + static const ReturnValue_t NAME_TOO_LONG = MAKE_RETURN_CODE(0xD0); + static const uint16_t APID_MASK = 0x7FF; static const uint16_t PACKET_SEQUENCE_COUNT_MASK = 0x3FFF;