diff --git a/common/config/commonClassIds.h b/common/config/commonClassIds.h index 827c316c..03d51888 100644 --- a/common/config/commonClassIds.h +++ b/common/config/commonClassIds.h @@ -13,8 +13,6 @@ enum commonClassIds: uint8_t { IMTQ_HANDLER, //IMTQ RW_HANDLER, //RWHA STR_HANDLER, //STRH - PLOC_MPSOC_HANDLER, //PLMP - MPSOC_CMD, //MPCMD DWLPWRON_CMD, //DWLPWRON MPSOC_TM, //MPTM PLOC_SUPERVISOR_HANDLER, //PLSV @@ -33,6 +31,7 @@ enum commonClassIds: uint8_t { FILE_SYSTEM_HELPER, //FSHLP PLOC_MPSOC_HELPER, // PLMPHLP SA_DEPL_HANDLER, //SADPL + MPSOC_RETURN_VALUES_IF, //MPSOCRTVIF COMMON_CLASS_ID_END // [EXPORT] : [END] }; diff --git a/linux/devices/devicedefinitions/MPSoCReturnValuesIF.h b/linux/devices/devicedefinitions/MPSoCReturnValuesIF.h new file mode 100644 index 00000000..1d6635f3 --- /dev/null +++ b/linux/devices/devicedefinitions/MPSoCReturnValuesIF.h @@ -0,0 +1,30 @@ +#ifndef MPSOC_RETURN_VALUES_IF_H_ +#define MPSOC_RETURN_VALUES_IF_H_ + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +class MPSoCReturnValuesIF { +public: + static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_RETURN_VALUES_IF; + + //! [EXPORT] : [COMMENT] Space Packet received from PLOC has invalid CRC + static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0); + //! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC + static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1); + //! [EXPORT] : [COMMENT] Received execution failure reply from PLOC + static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2); + //! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC + static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3); + //! [EXPORT] : [COMMENT] Received command with invalid length + static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xA4); + //! [EXPORT] : [COMMENT] Filename of file in OBC filesystem is too long + static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA5); + //! [EXPORT] : [COMMENT] MPSoC helper is currently executing a command + static const ReturnValue_t MPSOC_HELPER_EXECUTING = MAKE_RETURN_CODE(0xA6); + //! [EXPORT] : [COMMENT] Filename of MPSoC file is to long (max. 256 bytes) + static const ReturnValue_t MPSOC_FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA7); + //! [EXPORT] : [COMMENT] Command has invalid parameter + static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xA8); +}; + +#endif /* MPSOC_RETURN_VALUES_IF_H_ */ diff --git a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h index 45dff261..9557eb11 100644 --- a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h +++ b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h @@ -1,6 +1,8 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ +#include "OBSWConfig.h" +#include "MPSoCReturnValuesIF.h" #include #include #include @@ -81,19 +83,12 @@ static const uint16_t TC_WRITE_SEQ_EXECUTION_DELAY = 60; /** * @brief Abstract base class for TC space packet of MPSoC. */ -class TcBase : public SpacePacket, public HasReturnvaluesIF { +class TcBase : public SpacePacket, public MPSoCReturnValuesIF { public: // Initial length field of space packet. Will always be updated when packet is created. static const uint16_t INIT_LENGTH = 1; - static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_CMD; - - //! [EXPORT] : [COMMENT] Received command with invalid length - static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xC0); - //! [EXPORT] : [COMMENT] Command has invalid parameter - static const ReturnValue_t INVALID_PARAMETER = MAKE_RETURN_CODE(0xC1); - /** * @brief Constructor * @@ -113,13 +108,13 @@ public: * @return RETURN_OK if packet creation was successful, otherwise error return value */ virtual ReturnValue_t createPacket(const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; result = initPacket(commandData, commandDataLen); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) { return result; } result = addCrc(); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK) { return result; } return result; @@ -133,21 +128,21 @@ protected: * @param commandDataLen Length of received command data */ virtual ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } /** * @brief Calculates and adds the CRC */ ReturnValue_t addCrc() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; size_t serializedSize = 0; uint32_t full_size = getFullSize(); uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); result = SerializeAdapter::serialize(&crc, this->localData.byteStream + full_size - CRC_SIZE, &serializedSize, sizeof(crc), SerializeIF::Endianness::BIG); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { sif::debug << "TcBase::addCrc: Failed to serialize crc field" << std::endl; } return result; @@ -157,13 +152,9 @@ protected: /** * @brief Class for handling tm replies of the PLOC MPSoC. */ -class TmPacket : public SpacePacket, public HasReturnvaluesIF { +class TmPacket : public SpacePacket, public MPSoCReturnValuesIF { public: - static const uint8_t INTERFACE_ID = CLASS_ID::MPSOC_CMD; - - //! [EXPORT] : [COMMENT] CRC check of received packet failed - static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0); /** * @brief Constructor creates idle packet and sets length field to maximum allowed size. */ @@ -177,7 +168,7 @@ public: if (recalculatedCrc != receivedCrc) { return CRC_FAILURE; } - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } }; @@ -202,9 +193,9 @@ public: protected: ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; result = lengthCheck(commandDataLen); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } std::memcpy(this->localData.fields.buffer, commandData, MEM_ADDRESS_SIZE); @@ -214,7 +205,7 @@ protected: const uint8_t* memLenPtr = commandData + MEM_ADDRESS_SIZE; result = SerializeAdapter::deSerialize(&memLen, &memLenPtr, &size, SerializeIF::Endianness::BIG); - if(result != RETURN_OK) { + if(result != HasReturnvaluesIF::RETURN_OK) { return result; } return result; @@ -233,7 +224,7 @@ private: if (commandDataLen != COMMAND_LENGTH){ return INVALID_LENGTH; } - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } }; @@ -252,9 +243,9 @@ public: protected: ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; result = lengthCheck(commandDataLen); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } std::memcpy(this->localData.fields.buffer, commandData, commandDataLen); @@ -276,7 +267,7 @@ private: sif::warning << "TcMemWrite: Command has invalid length " << commandDataLen << std::endl; return INVALID_LENGTH; } - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } }; @@ -295,17 +286,17 @@ public: static const char READ = 'r'; ReturnValue_t createPacket(std::string filename, char accessMode) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; size_t nameSize = filename.size(); std::memcpy(this->getPacketData(), filename.c_str(), nameSize); std::memcpy(this->getPacketData() + nameSize, &accessMode, sizeof(accessMode)); + this->setPacketDataLength(nameSize + CRC_SIZE - 1); result = addCrc(); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - this->setPacketDataLength(nameSize + CRC_SIZE - 1); return result; } }; @@ -321,14 +312,14 @@ public: } ReturnValue_t createPacket(std::string filename) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; size_t nameSize = filename.size(); std::memcpy(this->getPacketData(), filename.c_str(), nameSize); + this->setPacketDataLength(nameSize + CRC_SIZE - 1); result = addCrc(); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - this->setPacketDataLength(nameSize + CRC_SIZE - 1); return result; } }; @@ -346,12 +337,16 @@ public: ReturnValue_t createPacket(uint8_t* writeData, uint32_t writeLen) { if (writeLen > MAX_DATA_SIZE) { sif::debug << "FlashWrite::createPacket: Command data too big" << std::endl; - return RETURN_FAILED; + return HasReturnvaluesIF::RETURN_FAILED; } - std::memcpy(this->getPacketData(), writeData, writeLen); - addCrc(); + std::memcpy(this->getPacketData(), &writeLen, sizeof(writeLen)); + std::memcpy(this->getPacketData() + sizeof(writeLen), writeData, writeLen); this->setPacketDataLength(static_cast(writeLen + CRC_SIZE - 1)); - return RETURN_OK; + ReturnValue_t result = addCrc(); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + return HasReturnvaluesIF::RETURN_OK; } }; @@ -366,12 +361,12 @@ public: } ReturnValue_t createPacket(std::string filename) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; size_t nameSize = filename.size(); std::memcpy(this->getPacketData(), filename.c_str(), nameSize); this->setPacketDataLength(nameSize + CRC_SIZE - 1); result = addCrc(); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } return result; @@ -389,13 +384,13 @@ public: } ReturnValue_t createPacket() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; result = addCrc(); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } this->setPacketDataLength(static_cast(CRC_SIZE - 1)); - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } }; @@ -413,13 +408,13 @@ public: protected: ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; result = lengthCheck(commandDataLen); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } result = checkData(*commandData); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } std::memcpy(this->localData.fields.buffer, commandData, commandDataLen); @@ -438,7 +433,7 @@ private: sif::warning << "TcReplayStart: Command has invalid length " << commandDataLen << std::endl; return INVALID_LENGTH; } - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t checkData(uint8_t replay) { @@ -446,7 +441,7 @@ private: sif::warning << "TcReplayStart::checkData: Invalid replay value" << std::endl; return INVALID_PARAMETER; } - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } }; @@ -464,17 +459,17 @@ public: protected: ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; result = lengthCheck(commandDataLen); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } result = modeCheck(*commandData); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } result = laneRateCheck(*(commandData + 1)); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } std::memcpy(this->localData.fields.buffer, commandData, commandDataLen); @@ -503,7 +498,7 @@ private: sif::warning << "TcDownlinkPwrOn: Command has invalid length " << commandDataLen << std::endl; return INVALID_LENGTH; } - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t modeCheck(uint8_t mode) { @@ -511,7 +506,7 @@ private: sif::warning << "TcDwonlinkPwrOn::modeCheck: Invalid JESD mode" << std::endl; return INVALID_MODE; } - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t laneRateCheck(uint8_t laneRate) { @@ -519,7 +514,7 @@ private: sif::warning << "TcReplayStart::laneRateCheck: Invalid lane rate" << std::endl; return INVALID_LANE_RATE; } - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } }; @@ -534,13 +529,13 @@ public: } ReturnValue_t createPacket() { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; result = addCrc(); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } this->setPacketDataLength(static_cast(CRC_SIZE - 1)); - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } }; @@ -558,9 +553,9 @@ public: protected: ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; result = lengthCheck(commandDataLen); - if (result != RETURN_OK) { + if (result != HasReturnvaluesIF::RETURN_OK) { return result; } std::memcpy(this->localData.fields.buffer, commandData, commandDataLen); @@ -577,10 +572,42 @@ private: sif::warning << "TcReplayWriteSeq: Command has invalid length " << commandDataLen << std::endl; return INVALID_LENGTH; } - return RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } }; +class FlashWritePusCmd : public MPSoCReturnValuesIF { + public: + FlashWritePusCmd(){}; + + ReturnValue_t extractFields(const uint8_t* commandData, size_t commandDataLen) { + if (commandDataLen > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE + MAX_FILENAME_SIZE)) { + return INVALID_LENGTH; + } + obcFile = std::string(reinterpret_cast(commandData)); + if (obcFile.size() > (config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE)) { + return FILENAME_TOO_LONG; + } + mpsocFile = std::string(reinterpret_cast(commandData + obcFile.size())); + if (mpsocFile.size() > MAX_FILENAME_SIZE) { + return MPSOC_FILENAME_TOO_LONG; + } + return HasReturnvaluesIF::HasReturnvaluesIF::RETURN_OK; + } + + std::string getObcFile() { + return obcFile; + } + + std::string getMPSoCFile() { + return mpsocFile; + } + + private: + + std::string obcFile = ""; + std::string mpsocFile = ""; +}; } #endif /* MISSION_DEVICES_DEVICEDEFINITIONS_PLOCMPSOCDEFINITIONS_H_ */ diff --git a/linux/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp index 55822c31..b2b2727c 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.cpp +++ b/linux/devices/ploc/PlocMPSoCHandler.cpp @@ -1,394 +1,383 @@ -#include "OBSWConfig.h" #include "PlocMPSoCHandler.h" -#include "fsfw/globalfunctions/CRC.h" + +#include "OBSWConfig.h" #include "fsfw/datapool/PoolReadGuard.h" +#include "fsfw/globalfunctions/CRC.h" PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, - CookieIF * comCookie, PlocMPSoCHelper* plocMPSoCHelper) : - DeviceHandlerBase(objectId, uartComIFid, comCookie), plocMPSoCHelper(plocMPSoCHelper) { - if (comCookie == NULL) { - sif::error << "PlocMPSoCHandler: Invalid com cookie" << std::endl; - } - eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5); + CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper) + : DeviceHandlerBase(objectId, uartComIFid, comCookie), plocMPSoCHelper(plocMPSoCHelper) { + if (comCookie == NULL) { + sif::error << "PlocMPSoCHandler: Invalid com cookie" << std::endl; + } + eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5); } -PlocMPSoCHandler::~PlocMPSoCHandler() { -} +PlocMPSoCHandler::~PlocMPSoCHandler() {} ReturnValue_t PlocMPSoCHandler::initialize() { - ReturnValue_t result = RETURN_OK; - result = DeviceHandlerBase::initialize(); - if (result != RETURN_OK) { - return result; - } - uartComIf = dynamic_cast(communicationInterface); - if (uartComIf == nullptr) { - sif::warning << "PlocMPSoCHandler::initialize: Invalid uart com if" << std::endl; - return ObjectManagerIF::CHILD_INIT_FAILED; - } - - EventManagerIF* manager = ObjectManager::instance()->get( - objects::EVENT_MANAGER); - if (manager == nullptr) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PlocMPSoCHandler::initialize: Invalid event manager" << std::endl; -#endif - return ObjectManagerIF::CHILD_INIT_FAILED;; - } - result = manager->registerListener(eventQueue->getId()); - if (result != RETURN_OK) { - return result; - } - result = manager->subscribeToEventRange(eventQueue->getId(), - event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_FAILED), - event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_SUCCESSFUL)); - if (result != RETURN_OK) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "PlocMPSoCHandler::initialize: Failed to subscribe to events from " - " ploc mpsoc helper" << std::endl; -#endif - return ObjectManagerIF::CHILD_INIT_FAILED; - } - - result = plocMPSoCHelper->setComIF(communicationInterface); - if (result != RETURN_OK) { - return ObjectManagerIF::CHILD_INIT_FAILED; - } - plocMPSoCHelper->setComCookie(comCookie); - plocMPSoCHelper->setSequenceCount(&sequenceCount); + ReturnValue_t result = RETURN_OK; + result = DeviceHandlerBase::initialize(); + if (result != RETURN_OK) { return result; + } + uartComIf = dynamic_cast(communicationInterface); + if (uartComIf == nullptr) { + sif::warning << "PlocMPSoCHandler::initialize: Invalid uart com if" << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + EventManagerIF* manager = ObjectManager::instance()->get(objects::EVENT_MANAGER); + if (manager == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "PlocMPSoCHandler::initialize: Invalid event manager" << std::endl; +#endif + return ObjectManagerIF::CHILD_INIT_FAILED; + ; + } + result = manager->registerListener(eventQueue->getId()); + if (result != RETURN_OK) { + return result; + } + result = manager->subscribeToEventRange( + eventQueue->getId(), event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_FAILED), + event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_SUCCESSFUL)); + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "PlocMPSoCHandler::initialize: Failed to subscribe to events from " + " ploc mpsoc helper" + << std::endl; +#endif + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + result = plocMPSoCHelper->setComIF(communicationInterface); + if (result != RETURN_OK) { + return ObjectManagerIF::CHILD_INIT_FAILED; + } + plocMPSoCHelper->setComCookie(comCookie); + plocMPSoCHelper->setSequenceCount(&sequenceCount); + return result; } void PlocMPSoCHandler::performOperationHook() { - EventMessage event; - for (ReturnValue_t result = eventQueue->receiveMessage(&event); - result == RETURN_OK; result = eventQueue->receiveMessage(&event)) { - switch (event.getMessageId()) { - case EventMessage::EVENT_MESSAGE: - handleEvent(&event); - break; - default: - sif::debug << "PlocMPSoCHandler::performOperationHook: Did not subscribe to this event" - << " message" << std::endl; - break; - } + EventMessage event; + for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK; + result = eventQueue->receiveMessage(&event)) { + switch (event.getMessageId()) { + case EventMessage::EVENT_MESSAGE: + handleEvent(&event); + break; + default: + sif::debug << "PlocMPSoCHandler::performOperationHook: Did not subscribe to this event" + << " message" << std::endl; + break; } + } } ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, - const uint8_t* data, size_t size) { - ReturnValue_t result = RETURN_OK; + const uint8_t* data, size_t size) { + ReturnValue_t result = RETURN_OK; - if (plocMPSoCHelperExecuting) { - return MPSOC_HELPER_EXECUTING; - } + if (plocMPSoCHelperExecuting) { + return MPSoCReturnValuesIF::MPSOC_HELPER_EXECUTING; + } - switch(actionId) { + switch (actionId) { case mpsoc::TC_FLASHWRITE: { - if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) { - return FILENAME_TOO_LONG; - } - result = plocMPSoCHelper->startFlashWrite( - std::string(reinterpret_cast(data), size)); - if (result != RETURN_OK) { - return result; - } - plocMPSoCHelperExecuting = true; - break; + if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) { + return MPSoCReturnValuesIF::FILENAME_TOO_LONG; + } + mpsoc::FlashWritePusCmd flashWritePusCmd; + result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(), + flashWritePusCmd.getMPSoCFile()); + if (result != RETURN_OK) { + return result; + } + plocMPSoCHelperExecuting = true; + break; } default: - break; - } - return DeviceHandlerBase::executeAction(actionId, commandedBy, data, size); + break; + } + return DeviceHandlerBase::executeAction(actionId, commandedBy, data, size); } - -void PlocMPSoCHandler::doStartUp(){ +void PlocMPSoCHandler::doStartUp() { #if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1 - setMode(MODE_NORMAL); + setMode(MODE_NORMAL); #else - setMode(_MODE_TO_ON); + setMode(_MODE_TO_ON); #endif } -void PlocMPSoCHandler::doShutDown(){ - setMode(_MODE_POWER_DOWN); +void PlocMPSoCHandler::doShutDown() { setMode(_MODE_POWER_DOWN); } + +ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { + return NOTHING_TO_SEND; } -ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand( - DeviceCommandId_t * id) { - return NOTHING_TO_SEND; +ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { + return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand( - DeviceCommandId_t * id){ - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand( - DeviceCommandId_t deviceCommand, const uint8_t * commandData, - size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; - switch(deviceCommand) { - case(mpsoc::TC_MEM_WRITE): { - result = prepareTcMemWrite(commandData, commandDataLen); - break; - } - case(mpsoc::TC_MEM_READ): { - result = prepareTcMemRead(commandData, commandDataLen); - break; - } - case(mpsoc::TC_FLASHDELETE): { - result = prepareTcFlashDelete(commandData, commandDataLen); - break; - } - case(mpsoc::TC_REPLAY_START): { - result = prepareTcReplayStart(commandData, commandDataLen); - break; - } - case(mpsoc::TC_REPLAY_STOP): { - result = prepareTcReplayStop(); - break; - } - case(mpsoc::TC_DOWNLINK_PWR_ON): { - result = prepareTcDownlinkPwrOn(commandData, commandDataLen); - break; - } - case(mpsoc::TC_DOWNLINK_PWR_OFF): { - result = prepareTcDownlinkPwrOff(); - break; - } - case(mpsoc::TC_REPLAY_WRITE_SEQUENCE): { - result = prepareTcReplayWriteSequence(commandData, commandDataLen); - break; - } - default: - sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented" << std::endl; - result = DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; - break; - } - - if (result == RETURN_OK) { - /** - * Flushing the receive buffer to make sure there are no data left from a faulty reply. - */ - uartComIf->flushUartRxBuffer(comCookie); +ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t* commandData, + size_t commandDataLen) { + ReturnValue_t result = RETURN_OK; + switch (deviceCommand) { + case (mpsoc::TC_MEM_WRITE): { + result = prepareTcMemWrite(commandData, commandDataLen); + break; } + case (mpsoc::TC_MEM_READ): { + result = prepareTcMemRead(commandData, commandDataLen); + break; + } + case (mpsoc::TC_FLASHDELETE): { + result = prepareTcFlashDelete(commandData, commandDataLen); + break; + } + case (mpsoc::TC_REPLAY_START): { + result = prepareTcReplayStart(commandData, commandDataLen); + break; + } + case (mpsoc::TC_REPLAY_STOP): { + result = prepareTcReplayStop(); + break; + } + case (mpsoc::TC_DOWNLINK_PWR_ON): { + result = prepareTcDownlinkPwrOn(commandData, commandDataLen); + break; + } + case (mpsoc::TC_DOWNLINK_PWR_OFF): { + result = prepareTcDownlinkPwrOff(); + break; + } + case (mpsoc::TC_REPLAY_WRITE_SEQUENCE): { + result = prepareTcReplayWriteSequence(commandData, commandDataLen); + break; + } + default: + sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented" + << std::endl; + result = DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + break; + } - return result; + if (result == RETURN_OK) { + /** + * Flushing the receive buffer to make sure there are no data left from a faulty reply. + */ + uartComIf->flushUartRxBuffer(comCookie); + } + + return result; } void PlocMPSoCHandler::fillCommandAndReplyMap() { - this->insertInCommandMap(mpsoc::TC_MEM_WRITE); - this->insertInCommandMap(mpsoc::TC_MEM_READ); - this->insertInCommandMap(mpsoc::TC_FLASHDELETE); - this->insertInCommandMap(mpsoc::TC_REPLAY_START); - this->insertInCommandMap(mpsoc::TC_REPLAY_STOP); - this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_ON); - this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF); - this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE); - this->insertInReplyMap(mpsoc::ACK_REPORT, 1, nullptr, mpsoc::SIZE_ACK_REPORT); - this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT); - this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT); + this->insertInCommandMap(mpsoc::TC_MEM_WRITE); + this->insertInCommandMap(mpsoc::TC_MEM_READ); + this->insertInCommandMap(mpsoc::TC_FLASHDELETE); + this->insertInCommandMap(mpsoc::TC_REPLAY_START); + this->insertInCommandMap(mpsoc::TC_REPLAY_STOP); + this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_ON); + this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF); + this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE); + this->insertInReplyMap(mpsoc::ACK_REPORT, 1, nullptr, mpsoc::SIZE_ACK_REPORT); + this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT); + this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT); } -ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t *start, - size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) { +ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize, + DeviceCommandId_t* foundId, size_t* foundLen) { + ReturnValue_t result = RETURN_OK; - ReturnValue_t result = RETURN_OK; + uint16_t apid = (*(start) << 8 | *(start + 1)) & APID_MASK; - uint16_t apid = (*(start) << 8 | *(start + 1)) & APID_MASK; - - switch(apid) { - case(mpsoc::apid::ACK_SUCCESS): - *foundLen = mpsoc::SIZE_ACK_REPORT; - *foundId = mpsoc::ACK_REPORT; - break; - case(mpsoc::apid::ACK_FAILURE): - *foundLen = mpsoc::SIZE_ACK_REPORT; - *foundId = mpsoc::ACK_REPORT; - break; - case(mpsoc::apid::TM_MEMORY_READ_REPORT): - *foundLen = tmMemReadReport.rememberRequestedSize; - *foundId = mpsoc::TM_MEMORY_READ_REPORT; - break; - case(mpsoc::apid::EXE_SUCCESS): - *foundLen = mpsoc::SIZE_EXE_REPORT; - *foundId = mpsoc::EXE_REPORT; - break; - case(mpsoc::apid::EXE_FAILURE): - *foundLen = mpsoc::SIZE_EXE_REPORT; - *foundId = mpsoc::EXE_REPORT; - break; - default: { - sif::debug << "PlocMPSoCHandler::scanForReply: Reply has invalid apid" << std::endl; - *foundLen = remainingSize; - return INVALID_APID; - } - } - sequenceCount++; - uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK; - if (recvSeqCnt != sequenceCount) { - triggerEvent(MPSOC_HANDLER_SEQ_CNT_MISMATCH, sequenceCount, recvSeqCnt); - sequenceCount = recvSeqCnt; - } - return result; + switch (apid) { + case (mpsoc::apid::ACK_SUCCESS): + *foundLen = mpsoc::SIZE_ACK_REPORT; + *foundId = mpsoc::ACK_REPORT; + break; + case (mpsoc::apid::ACK_FAILURE): + *foundLen = mpsoc::SIZE_ACK_REPORT; + *foundId = mpsoc::ACK_REPORT; + break; + case (mpsoc::apid::TM_MEMORY_READ_REPORT): + *foundLen = tmMemReadReport.rememberRequestedSize; + *foundId = mpsoc::TM_MEMORY_READ_REPORT; + break; + case (mpsoc::apid::EXE_SUCCESS): + *foundLen = mpsoc::SIZE_EXE_REPORT; + *foundId = mpsoc::EXE_REPORT; + break; + case (mpsoc::apid::EXE_FAILURE): + *foundLen = mpsoc::SIZE_EXE_REPORT; + *foundId = mpsoc::EXE_REPORT; + break; + default: { + sif::debug << "PlocMPSoCHandler::scanForReply: Reply has invalid apid" << std::endl; + *foundLen = remainingSize; + return MPSoCReturnValuesIF::INVALID_APID; + } + } + sequenceCount++; + uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK; + if (recvSeqCnt != sequenceCount) { + triggerEvent(MPSOC_HANDLER_SEQ_CNT_MISMATCH, sequenceCount, recvSeqCnt); + sequenceCount = recvSeqCnt; + } + return result; } -ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, - const uint8_t *packet) { +ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { + ReturnValue_t result = RETURN_OK; - ReturnValue_t result = RETURN_OK; - - switch (id) { + switch (id) { case mpsoc::ACK_REPORT: { - result = handleAckReport(packet); - break; + result = handleAckReport(packet); + break; } case (mpsoc::TM_MEMORY_READ_REPORT): { - result = handleMemoryReadReport(packet); - break; + result = handleMemoryReadReport(packet); + break; } case (mpsoc::EXE_REPORT): { - result = handleExecutionReport(packet); - break; + result = handleExecutionReport(packet); + break; } default: { - sif::debug << "PlocMPSoCHandler::interpretDeviceReply: Unknown device reply id" << std::endl; - return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; - } + sif::debug << "PlocMPSoCHandler::interpretDeviceReply: Unknown device reply id" << std::endl; + return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; } + } - return result; + return result; } -void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid(){ +void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {} -} - -uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){ - return 500; -} +uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, - LocalDataPoolManager& poolManager) { - - return HasReturnvaluesIF::RETURN_OK; + LocalDataPoolManager& poolManager) { + return HasReturnvaluesIF::RETURN_OK; } void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) { - object_id_t objectId = eventMessage->getReporter(); - switch(objectId){ + object_id_t objectId = eventMessage->getReporter(); + switch (objectId) { case objects::PLOC_MPSOC_HELPER: { - plocMPSoCHelperExecuting = false; - break; + plocMPSoCHelperExecuting = false; + break; } default: - sif::debug << "PlocMPSoCHandler::handleEvent: Did not subscribe to this event" - << std::endl; - break; - } + sif::debug << "PlocMPSoCHandler::handleEvent: Did not subscribe to this event" << std::endl; + break; + } } -ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t * commandData, - size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; - sequenceCount++; - mpsoc::TcMemWrite tcMemWrite(sequenceCount); - result = tcMemWrite.createPacket(commandData, commandDataLen); - if (result != RETURN_OK) { - sequenceCount--; - return result; - } - copyToCommandBuffer(&tcMemWrite); - return RETURN_OK; +ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData, + size_t commandDataLen) { + ReturnValue_t result = RETURN_OK; + sequenceCount++; + mpsoc::TcMemWrite tcMemWrite(sequenceCount); + result = tcMemWrite.createPacket(commandData, commandDataLen); + if (result != RETURN_OK) { + sequenceCount--; + return result; + } + copyToCommandBuffer(&tcMemWrite); + return RETURN_OK; } -ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t * commandData, - size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; - sequenceCount++; - mpsoc::TcMemRead tcMemRead(sequenceCount); - result = tcMemRead.createPacket(commandData, commandDataLen); - if (result != RETURN_OK) { - sequenceCount--; - return result; - } - copyToCommandBuffer(&tcMemRead); - tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE; - return RETURN_OK; +ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData, + size_t commandDataLen) { + ReturnValue_t result = RETURN_OK; + sequenceCount++; + mpsoc::TcMemRead tcMemRead(sequenceCount); + result = tcMemRead.createPacket(commandData, commandDataLen); + if (result != RETURN_OK) { + sequenceCount--; + return result; + } + copyToCommandBuffer(&tcMemRead); + tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE; + return RETURN_OK; } -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( - std::string(reinterpret_cast(commandData), commandDataLen)); - if (result != RETURN_OK) { - sequenceCount--; - return result; - } - copyToCommandBuffer(&tcFlashDelete); - return RETURN_OK; +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( + std::string(reinterpret_cast(commandData), commandDataLen)); + if (result != RETURN_OK) { + sequenceCount--; + return result; + } + copyToCommandBuffer(&tcFlashDelete); + return RETURN_OK; } -ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart( - const uint8_t * commandData, size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; - sequenceCount++; - mpsoc::TcReplayStart tcReplayStart(sequenceCount); - result = tcReplayStart.createPacket(commandData, commandDataLen); - if (result != RETURN_OK) { - sequenceCount--; - return result; - } - copyToCommandBuffer(&tcReplayStart); - return RETURN_OK; +ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData, + size_t commandDataLen) { + ReturnValue_t result = RETURN_OK; + sequenceCount++; + mpsoc::TcReplayStart tcReplayStart(sequenceCount); + result = tcReplayStart.createPacket(commandData, commandDataLen); + if (result != RETURN_OK) { + sequenceCount--; + return result; + } + copyToCommandBuffer(&tcReplayStart); + return RETURN_OK; } ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() { - ReturnValue_t result = RETURN_OK; - sequenceCount++; - mpsoc::TcReplayStop tcReplayStop(sequenceCount); - result = tcReplayStop.createPacket(); - if (result != RETURN_OK) { - sequenceCount--; - return result; - } - copyToCommandBuffer(&tcReplayStop); - return RETURN_OK; + ReturnValue_t result = RETURN_OK; + sequenceCount++; + mpsoc::TcReplayStop tcReplayStop(sequenceCount); + result = tcReplayStop.createPacket(); + if (result != RETURN_OK) { + sequenceCount--; + return result; + } + copyToCommandBuffer(&tcReplayStop); + return RETURN_OK; } -ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn( - const uint8_t * commandData, size_t commandDataLen) { - ReturnValue_t result = RETURN_OK; - sequenceCount++; - mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(sequenceCount); - result = tcDownlinkPwrOn.createPacket(commandData, commandDataLen); - if (result != RETURN_OK) { - sequenceCount--; - return result; - } - copyToCommandBuffer(&tcDownlinkPwrOn); - return RETURN_OK; +ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandData, + size_t commandDataLen) { + ReturnValue_t result = RETURN_OK; + sequenceCount++; + mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(sequenceCount); + result = tcDownlinkPwrOn.createPacket(commandData, commandDataLen); + if (result != RETURN_OK) { + sequenceCount--; + return result; + } + copyToCommandBuffer(&tcDownlinkPwrOn); + return RETURN_OK; } ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() { - ReturnValue_t result = RETURN_OK; - sequenceCount++; - mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(sequenceCount); - result = tcDownlinkPwrOff.createPacket(); - if (result != RETURN_OK) { - sequenceCount--; - return result; - } - copyToCommandBuffer(&tcDownlinkPwrOff); - return RETURN_OK; + ReturnValue_t result = RETURN_OK; + sequenceCount++; + mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(sequenceCount); + result = tcDownlinkPwrOff.createPacket(); + if (result != RETURN_OK) { + sequenceCount--; + return result; + } + copyToCommandBuffer(&tcDownlinkPwrOff); + return RETURN_OK; } ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData, @@ -406,136 +395,133 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* comm } void PlocMPSoCHandler::copyToCommandBuffer(mpsoc::TcBase* tc) { - if (tc == nullptr) { - sif::debug << "PlocMPSoCHandler::copyToCommandBuffer: Invalid TC" << std::endl; - } - memcpy(commandBuffer, tc->getWholeData(), tc->getFullSize()); - rawPacket = commandBuffer; - rawPacketLen = tc->getFullSize(); - nextReplyId = mpsoc::ACK_REPORT; + if (tc == nullptr) { + sif::debug << "PlocMPSoCHandler::copyToCommandBuffer: Invalid TC" << std::endl; + } + memcpy(commandBuffer, tc->getWholeData(), tc->getFullSize()); + rawPacket = commandBuffer; + rawPacketLen = tc->getFullSize(); + nextReplyId = mpsoc::ACK_REPORT; } ReturnValue_t PlocMPSoCHandler::verifyPacket(const uint8_t* start, size_t foundLen) { - uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1); - uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2); - if (receivedCrc != recalculatedCrc) { - return CRC_FAILURE; - } - return RETURN_OK; + uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1); + uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2); + if (receivedCrc != recalculatedCrc) { + return MPSoCReturnValuesIF::CRC_FAILURE; + } + return RETURN_OK; } ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) { + ReturnValue_t result = RETURN_OK; - ReturnValue_t result = RETURN_OK; + result = verifyPacket(data, mpsoc::SIZE_ACK_REPORT); + if (result == MPSoCReturnValuesIF::CRC_FAILURE) { + sif::error << "PlocMPSoCHandler::handleAckReport: CRC failure" << std::endl; + nextReplyId = mpsoc::NONE; + replyRawReplyIfnotWiretapped(data, mpsoc::SIZE_ACK_REPORT); + triggerEvent(MPSOC_HANDLER_CRC_FAILURE); + sendFailureReport(mpsoc::ACK_REPORT, MPSoCReturnValuesIF::CRC_FAILURE); + disableAllReplies(); + return IGNORE_REPLY_DATA; + } - result = verifyPacket(data, mpsoc::SIZE_ACK_REPORT); - if(result == CRC_FAILURE) { - sif::error << "PlocMPSoCHandler::handleAckReport: CRC failure" << std::endl; - nextReplyId = mpsoc::NONE; - replyRawReplyIfnotWiretapped(data, mpsoc::SIZE_ACK_REPORT); - triggerEvent(MPSOC_HANDLER_CRC_FAILURE); - sendFailureReport(mpsoc::ACK_REPORT, CRC_FAILURE); - disableAllReplies(); - return IGNORE_REPLY_DATA; + uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK; + + switch (apid) { + case mpsoc::apid::ACK_FAILURE: { + // TODO: Interpretation of status field in acknowledgment report + sif::debug << "PlocMPSoCHandler::handleAckReport: Received Ack failure report" << std::endl; + DeviceCommandId_t commandId = getPendingCommand(); + if (commandId != DeviceHandlerIF::NO_COMMAND_ID) { + triggerEvent(ACK_FAILURE, commandId); + } + sendFailureReport(mpsoc::ACK_REPORT, MPSoCReturnValuesIF::RECEIVED_ACK_FAILURE); + disableAllReplies(); + nextReplyId = mpsoc::NONE; + result = IGNORE_REPLY_DATA; + break; } + case mpsoc::apid::ACK_SUCCESS: { + setNextReplyId(); + break; + } + default: { + sif::debug << "PlocMPSoCHandler::handleAckReport: Invalid APID in Ack report" << std::endl; + result = RETURN_FAILED; + break; + } + } - uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK; - - switch(apid) { - case mpsoc::apid::ACK_FAILURE: { - //TODO: Interpretation of status field in acknowledgment report - sif::debug << "PlocMPSoCHandler::handleAckReport: Received Ack failure report" << std::endl; - DeviceCommandId_t commandId = getPendingCommand(); - if (commandId != DeviceHandlerIF::NO_COMMAND_ID) { - triggerEvent(ACK_FAILURE, commandId); - } - sendFailureReport(mpsoc::ACK_REPORT, RECEIVED_ACK_FAILURE); - disableAllReplies(); - nextReplyId = mpsoc::NONE; - result = IGNORE_REPLY_DATA; - break; - } - case mpsoc::apid::ACK_SUCCESS: { - setNextReplyId(); - break; - } - default: { - sif::debug << "PlocMPSoCHandler::handleAckReport: Invalid APID in Ack report" << std::endl; - result = RETURN_FAILED; - break; - } - } - - return result; + return result; } ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) { - ReturnValue_t result = RETURN_OK; + ReturnValue_t result = RETURN_OK; - result = verifyPacket(data, mpsoc::SIZE_EXE_REPORT); - if(result == CRC_FAILURE) { - sif::error << "PlocMPSoCHandler::handleExecutionReport: CRC failure" << std::endl; - nextReplyId = mpsoc::NONE; - return result; - } - - uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK; - - switch (apid) { - case (mpsoc::apid::EXE_SUCCESS): { - break; - } - case (mpsoc::apid::EXE_FAILURE): { - //TODO: Interpretation of status field in execution report - sif::error << "PlocMPSoCHandler::handleExecutionReport: Received execution failure report" - << std::endl; - DeviceCommandId_t commandId = getPendingCommand(); - if (commandId != DeviceHandlerIF::NO_COMMAND_ID) { - triggerEvent(EXE_FAILURE, commandId); - } - else { - sif::debug << "PlocMPSoCHandler::handleExecutionReport: Unknown command id" << std::endl; - } - sendFailureReport(mpsoc::EXE_REPORT, RECEIVED_EXE_FAILURE); - disableExeReportReply(); - result = IGNORE_REPLY_DATA; - break; - } - default: { - sif::error << "PlocMPSoCHandler::handleExecutionReport: Unknown APID" << std::endl; - result = RETURN_FAILED; - break; - } - } + result = verifyPacket(data, mpsoc::SIZE_EXE_REPORT); + if (result == MPSoCReturnValuesIF::CRC_FAILURE) { + sif::error << "PlocMPSoCHandler::handleExecutionReport: CRC failure" << std::endl; nextReplyId = mpsoc::NONE; return result; + } + + uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK; + + switch (apid) { + case (mpsoc::apid::EXE_SUCCESS): { + break; + } + case (mpsoc::apid::EXE_FAILURE): { + // TODO: Interpretation of status field in execution report + sif::error << "PlocMPSoCHandler::handleExecutionReport: Received execution failure report" + << std::endl; + DeviceCommandId_t commandId = getPendingCommand(); + if (commandId != DeviceHandlerIF::NO_COMMAND_ID) { + triggerEvent(EXE_FAILURE, commandId); + } else { + sif::debug << "PlocMPSoCHandler::handleExecutionReport: Unknown command id" << std::endl; + } + sendFailureReport(mpsoc::EXE_REPORT, MPSoCReturnValuesIF::RECEIVED_EXE_FAILURE); + disableExeReportReply(); + result = IGNORE_REPLY_DATA; + break; + } + default: { + sif::error << "PlocMPSoCHandler::handleExecutionReport: Unknown APID" << std::endl; + result = RETURN_FAILED; + break; + } + } + nextReplyId = mpsoc::NONE; + return result; } ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) { - ReturnValue_t result = RETURN_OK; - result = verifyPacket(data, tmMemReadReport.rememberRequestedSize); - if(result == CRC_FAILURE) { - sif::error << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc" - << std::endl; - } - uint16_t memLen = *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET) << 8 - | *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET + 1); - /** Send data to commanding queue */ - handleDeviceTM(data + mpsoc::DATA_FIELD_OFFSET, mpsoc::SIZE_MEM_READ_RPT_FIX + memLen * 4, - mpsoc::TM_MEMORY_READ_REPORT); - nextReplyId = mpsoc::EXE_REPORT; - return result; + ReturnValue_t result = RETURN_OK; + result = verifyPacket(data, tmMemReadReport.rememberRequestedSize); + if (result == MPSoCReturnValuesIF::CRC_FAILURE) { + sif::error << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc" + << std::endl; + } + uint16_t memLen = + *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET) << 8 | *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET + 1); + /** Send data to commanding queue */ + handleDeviceTM(data + mpsoc::DATA_FIELD_OFFSET, mpsoc::SIZE_MEM_READ_RPT_FIX + memLen * 4, + mpsoc::TM_MEMORY_READ_REPORT); + nextReplyId = mpsoc::EXE_REPORT; + return result; } ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command, - uint8_t expectedReplies, bool useAlternateId, - DeviceCommandId_t alternateReplyID) { + uint8_t expectedReplies, bool useAlternateId, + DeviceCommandId_t alternateReplyID) { + ReturnValue_t result = RETURN_OK; - ReturnValue_t result = RETURN_OK; + uint8_t enabledReplies = 0; - uint8_t enabledReplies = 0; - - switch (command->first) { + switch (command->first) { case mpsoc::TC_MEM_WRITE: case mpsoc::TC_FLASHDELETE: case mpsoc::TC_REPLAY_START: @@ -543,188 +529,184 @@ ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator case mpsoc::TC_DOWNLINK_PWR_ON: case mpsoc::TC_DOWNLINK_PWR_OFF: case mpsoc::TC_REPLAY_WRITE_SEQUENCE: - enabledReplies = 2; - break; + enabledReplies = 2; + break; case mpsoc::TC_MEM_READ: { - enabledReplies = 3; - result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, - mpsoc::TM_MEMORY_READ_REPORT); - if (result != RETURN_OK) { - sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " - << mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl; - } - break; + enabledReplies = 3; + result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, + mpsoc::TM_MEMORY_READ_REPORT); + if (result != RETURN_OK) { + sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " + << mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl; + } + break; } default: - sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown command id" << std::endl; - break; - } + sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown command id" << std::endl; + break; + } - /** - * Every command causes at least one acknowledgment and one execution report. Therefore both - * replies will be enabled here. - */ - result = DeviceHandlerBase::enableReplyInReplyMap(command, - enabledReplies, true, mpsoc::ACK_REPORT); - if (result != RETURN_OK) { - sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::ACK_REPORT - << " not in replyMap" << std::endl; - } + /** + * Every command causes at least one acknowledgment and one execution report. Therefore both + * replies will be enabled here. + */ + result = + DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::ACK_REPORT); + if (result != RETURN_OK) { + sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::ACK_REPORT + << " not in replyMap" << std::endl; + } - result = DeviceHandlerBase::enableReplyInReplyMap(command, - enabledReplies, true, mpsoc::EXE_REPORT); - if (result != RETURN_OK) { - sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::EXE_REPORT - << " not in replyMap" << std::endl; - } + result = + DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::EXE_REPORT); + if (result != RETURN_OK) { + sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::EXE_REPORT + << " not in replyMap" << std::endl; + } - switch(command->first) { + switch (command->first) { case mpsoc::TC_REPLAY_WRITE_SEQUENCE: { - DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT); - if (iter != deviceReplyMap.end()) { - // Overwrite delay cycles because replay write sequence command can required up to - // 30 seconds for execution - iter->second.delayCycles = mpsoc::TC_WRITE_SEQ_EXECUTION_DELAY; - } - else { - sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown reply id" << std::endl; - } - break; + DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT); + if (iter != deviceReplyMap.end()) { + // Overwrite delay cycles because replay write sequence command can required up to + // 30 seconds for execution + iter->second.delayCycles = mpsoc::TC_WRITE_SEQ_EXECUTION_DELAY; + } else { + sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown reply id" << std::endl; + } + break; } default: - break; - } + break; + } - return RETURN_OK; + return RETURN_OK; } void PlocMPSoCHandler::setNextReplyId() { - switch(getPendingCommand()) { + switch (getPendingCommand()) { case mpsoc::TC_MEM_READ: - nextReplyId = mpsoc::TM_MEMORY_READ_REPORT; - break; + nextReplyId = mpsoc::TM_MEMORY_READ_REPORT; + break; default: - /* If no telemetry is expected the next reply is always the execution report */ - nextReplyId = mpsoc::EXE_REPORT; - break; - } + /* If no telemetry is expected the next reply is always the execution report */ + nextReplyId = mpsoc::EXE_REPORT; + break; + } } -size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId){ - - size_t replyLen = 0; - - if (nextReplyId == mpsoc::NONE) { - return replyLen; - } - - DeviceReplyIter iter = deviceReplyMap.find(nextReplyId); - - if (iter != deviceReplyMap.end()) { - if (iter->second.delayCycles == 0) { - /* Reply inactive */ - return replyLen; - } - switch(nextReplyId) { - case mpsoc::TM_MEMORY_READ_REPORT: { - replyLen = tmMemReadReport.rememberRequestedSize; - break; - } - default: { - replyLen = iter->second.replyLen; - break; - } - } - } - else { - sif::debug << "PlocMPSoCHandler::getNextReplyLength: No entry for reply with reply id " - << std::hex << nextReplyId << " in deviceReplyMap" << std::endl; - } +size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) { + size_t replyLen = 0; + if (nextReplyId == mpsoc::NONE) { return replyLen; + } + + DeviceReplyIter iter = deviceReplyMap.find(nextReplyId); + + if (iter != deviceReplyMap.end()) { + if (iter->second.delayCycles == 0) { + /* Reply inactive */ + return replyLen; + } + switch (nextReplyId) { + case mpsoc::TM_MEMORY_READ_REPORT: { + replyLen = tmMemReadReport.rememberRequestedSize; + break; + } + default: { + replyLen = iter->second.replyLen; + break; + } + } + } else { + sif::debug << "PlocMPSoCHandler::getNextReplyLength: No entry for reply with reply id " + << std::hex << nextReplyId << " in deviceReplyMap" << std::endl; + } + + return replyLen; } -void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, DeviceCommandId_t replyId) { +void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize, + DeviceCommandId_t replyId) { + ReturnValue_t result = RETURN_OK; - ReturnValue_t result = RETURN_OK; + if (wiretappingMode == RAW) { + /* Data already sent in doGetRead() */ + return; + } - if (wiretappingMode == RAW) { - /* Data already sent in doGetRead() */ - return; - } + DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId); + if (iter == deviceReplyMap.end()) { + sif::debug << "PlocMPSoCHandler::handleDeviceTM: Unknown reply id" << std::endl; + return; + } + MessageQueueId_t queueId = iter->second.command->second.sendReplyTo; - DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId); - if (iter == deviceReplyMap.end()) { - sif::debug << "PlocMPSoCHandler::handleDeviceTM: Unknown reply id" << std::endl; - return; - } - MessageQueueId_t queueId = iter->second.command->second.sendReplyTo; + if (queueId == NO_COMMANDER) { + return; + } - if (queueId == NO_COMMANDER) { - return; - } - - result = actionHelper.reportData(queueId, replyId, data, dataSize); - if (result != RETURN_OK) { - sif::debug << "PlocMPSoCHandler::handleDeviceTM: Failed to report data" << std::endl; - } + result = actionHelper.reportData(queueId, replyId, data, dataSize); + if (result != RETURN_OK) { + sif::debug << "PlocMPSoCHandler::handleDeviceTM: Failed to report data" << std::endl; + } } void PlocMPSoCHandler::disableAllReplies() { + DeviceReplyMap::iterator iter; - DeviceReplyMap::iterator iter; + /* Disable ack reply */ + iter = deviceReplyMap.find(mpsoc::ACK_REPORT); + DeviceReplyInfo* info = &(iter->second); + info->delayCycles = 0; + info->command = deviceCommandMap.end(); - /* Disable ack reply */ - iter = deviceReplyMap.find(mpsoc::ACK_REPORT); - DeviceReplyInfo *info = &(iter->second); - info->delayCycles = 0; - info->command = deviceCommandMap.end(); + DeviceCommandId_t commandId = getPendingCommand(); - DeviceCommandId_t commandId = getPendingCommand(); - - /* If the command expects a telemetry packet the appropriate tm reply will be disabled here */ - switch (commandId) { + /* If the command expects a telemetry packet the appropriate tm reply will be disabled here */ + switch (commandId) { case mpsoc::TC_MEM_WRITE: - break; + break; case mpsoc::TC_MEM_READ: { - iter = deviceReplyMap.find(mpsoc::TM_MEMORY_READ_REPORT); - info = &(iter->second); - info->delayCycles = 0; - info->command = deviceCommandMap.end(); - break; + iter = deviceReplyMap.find(mpsoc::TM_MEMORY_READ_REPORT); + info = &(iter->second); + info->delayCycles = 0; + info->command = deviceCommandMap.end(); + break; } default: { - sif::debug << "PlocMPSoCHandler::disableAllReplies: Unknown command id" << commandId - << std::endl; - break; - } + sif::debug << "PlocMPSoCHandler::disableAllReplies: Unknown command id" << commandId + << std::endl; + break; } + } - /* We must always disable the execution report reply here */ - disableExeReportReply(); + /* We must always disable the execution report reply here */ + disableExeReportReply(); } void PlocMPSoCHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) { - DeviceReplyIter iter = deviceReplyMap.find(replyId); - if (iter == deviceReplyMap.end()) { - sif::debug << "PlocMPSoCHandler::sendFailureReport: Reply not in reply map" << std::endl; - return; - } - DeviceCommandInfo* info = &(iter->second.command->second); - if (info == nullptr) { - sif::debug << "PlocMPSoCHandler::sendFailureReport: Reply has no active command" << std::endl; - return; - } - if (info->sendReplyTo != NO_COMMANDER) { - actionHelper.finish(false, info->sendReplyTo, iter->first, status); - } - info->isExecuting = false; + DeviceReplyIter iter = deviceReplyMap.find(replyId); + if (iter == deviceReplyMap.end()) { + sif::debug << "PlocMPSoCHandler::sendFailureReport: Reply not in reply map" << std::endl; + return; + } + DeviceCommandInfo* info = &(iter->second.command->second); + if (info == nullptr) { + sif::debug << "PlocMPSoCHandler::sendFailureReport: Reply has no active command" << std::endl; + return; + } + if (info->sendReplyTo != NO_COMMANDER) { + actionHelper.finish(false, info->sendReplyTo, iter->first, status); + } + info->isExecuting = false; } void PlocMPSoCHandler::disableExeReportReply() { - DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT); - DeviceReplyInfo *info = &(iter->second); - info->delayCycles = 0; - info->command = deviceCommandMap.end(); - /* Expected replies is set to one here. The value will set to 0 in replyToReply() */ - info->command->second.expectedReplies = 0; + DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT); + DeviceReplyInfo* info = &(iter->second); + info->delayCycles = 0; + info->command = deviceCommandMap.end(); + /* Expected replies is set to one here. The value will set to 0 in replyToReply() */ + info->command->second.expectedReplies = 0; } diff --git a/linux/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h index 5aa84dd7..ada8e07c 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.h +++ b/linux/devices/ploc/PlocMPSoCHandler.h @@ -8,6 +8,7 @@ #include "fsfw/tmtcservices/SourceSequenceCounter.h" #include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" #include "PlocMPSoCHelper.h" +#include "linux/devices/devicedefinitions/MPSoCReturnValuesIF.h" /** * @brief This is the device handler for the MPSoC of the payload computer. @@ -25,23 +26,6 @@ class PlocMPSoCHandler: public DeviceHandlerBase { public: - static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HANDLER; - - //! [EXPORT] : [COMMENT] Space Packet received from PLOC has invalid CRC - static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0); - //! [EXPORT] : [COMMENT] Received ACK failure reply from PLOC - static const ReturnValue_t RECEIVED_ACK_FAILURE = MAKE_RETURN_CODE(0xA1); - //! [EXPORT] : [COMMENT] Received execution failure reply from PLOC - static const ReturnValue_t RECEIVED_EXE_FAILURE = MAKE_RETURN_CODE(0xA2); - //! [EXPORT] : [COMMENT] Received space packet with invalid APID from PLOC - static const ReturnValue_t INVALID_APID = MAKE_RETURN_CODE(0xA3); - //! [EXPORT] : [COMMENT] Received command with invalid length - static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xA4); - //! [EXPORT] : [COMMENT] Received command with invalid filename - static const ReturnValue_t FILENAME_TOO_LONG = MAKE_RETURN_CODE(0xA5); - //! [EXPORT] : [COMMENT] MPSoC helper is currently executing a command - static const ReturnValue_t MPSOC_HELPER_EXECUTING = MAKE_RETURN_CODE(0xA6); - PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid, CookieIF * comCookie, PlocMPSoCHelper* plocMPSoCHelper); virtual ~PlocMPSoCHandler(); diff --git a/linux/devices/ploc/PlocMPSoCHelper.cpp b/linux/devices/ploc/PlocMPSoCHelper.cpp index b1a65773..b3f220f4 100644 --- a/linux/devices/ploc/PlocMPSoCHelper.cpp +++ b/linux/devices/ploc/PlocMPSoCHelper.cpp @@ -3,6 +3,7 @@ #include #include +#include "OBSWConfig.h" #ifdef XIPHOS_Q7S #include "bsp_q7s/memory/FileSystemHelper.h" #endif @@ -65,7 +66,7 @@ void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) { sequenceCount = sequenceCount_; } -ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string file) { +ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) { #ifdef XIPHOS_Q7S ReturnValue_t result = FilesystemHelper::checkPath(file); if (result != RETURN_OK) { @@ -76,7 +77,16 @@ ReturnValue_t PlocMPSoCHelper::startFlashWrite(std::string file) { return result; } #endif - flashWrite.file = file; +#ifdef TE0720_1CFA + if (not std::filesystem::exists(obcFile)) { + sif::warning << "PlocMPSoCHelper::startFlashWrite: File " << obcFile << "does not exist" + << std::endl; + return RETURN_FAILED; + } +#endif + + flashWrite.obcFile = obcFile; + flashWrite.mpsocFile = mpsocFile; internalState = InternalState::FLASH_WRITE; semaphore.release(); terminate = false; @@ -92,7 +102,7 @@ ReturnValue_t PlocMPSoCHelper::performFlashWrite() { return result; } uint8_t tempData[mpsoc::MAX_DATA_SIZE]; - std::ifstream file(flashWrite.file, std::ifstream::binary); + std::ifstream file(flashWrite.obcFile, std::ifstream::binary); // Set position of next character to end of file input stream file.seekg(0, file.end); // tellg returns position of character in input stream @@ -135,7 +145,7 @@ ReturnValue_t PlocMPSoCHelper::flashfopen() { ReturnValue_t result = RETURN_OK; (*sequenceCount)++; mpsoc::FlashFopen flashFopen(*sequenceCount); - result = flashFopen.createPacket(flashWrite.file, mpsoc::FlashFopen::APPEND); + result = flashFopen.createPacket(flashWrite.mpsocFile, mpsoc::FlashFopen::APPEND); if (result != RETURN_OK) { return result; } @@ -150,7 +160,7 @@ ReturnValue_t PlocMPSoCHelper::flashfclose() { ReturnValue_t result = RETURN_OK; (*sequenceCount)++; mpsoc::FlashFclose flashFclose(*sequenceCount); - result = flashFclose.createPacket(flashWrite.file); + result = flashFclose.createPacket(flashWrite.mpsocFile); if (result != RETURN_OK) { return result; } diff --git a/linux/devices/ploc/PlocMPSoCHelper.h b/linux/devices/ploc/PlocMPSoCHelper.h index 05df63ad..0655f5dd 100644 --- a/linux/devices/ploc/PlocMPSoCHelper.h +++ b/linux/devices/ploc/PlocMPSoCHelper.h @@ -79,11 +79,12 @@ public: /** * @brief Starts flash write sequence * - * @param file File with data to write + * @param obcFile File where to read from the data + * @param mpsocFile The file of the MPSoC where should be written to * * @return RETURN_OK if successful, otherwise error return value */ - ReturnValue_t startFlashWrite(std::string file); + ReturnValue_t startFlashWrite(std::string obcFile, std::string mpsocFile); /** * @brief Can be used to interrupt a running data transfer. @@ -104,7 +105,8 @@ private: static const int RETRIES = 3; struct FlashWrite { - std::string file; + std::string obcFile; + std::string mpsocFile; }; struct FlashWrite flashWrite;