v1.12.0 #269

Merged
muellerr merged 493 commits from develop into main 2022-07-04 11:19:05 +02:00
3 changed files with 39 additions and 75 deletions
Showing only changes of commit c0fd9aee6f - Show all commits

View File

@ -30,6 +30,7 @@ enum commonClassIds: uint8_t {
NVM_PARAM_BASE, //NVMB NVM_PARAM_BASE, //NVMB
FILE_SYSTEM_HELPER, //FSHLP FILE_SYSTEM_HELPER, //FSHLP
PLOC_MPSOC_HELPER, // PLMPHLP PLOC_MPSOC_HELPER, // PLMPHLP
PLOC_SUPV_HELPER, // PLSPVHLP
SA_DEPL_HANDLER, //SADPL SA_DEPL_HANDLER, //SADPL
MPSOC_RETURN_VALUES_IF, //MPSOCRTVIF MPSOC_RETURN_VALUES_IF, //MPSOCRTVIF
COMMON_CLASS_ID_END // [EXPORT] : [END] COMMON_CLASS_ID_END // [EXPORT] : [END]

View File

@ -34,12 +34,12 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
semaphore.acquire(); semaphore.acquire();
break; break;
} }
case InternalState::FLASH_WRITE: { case InternalState::UPDATE: {
result = performUpdate(); result = performUpdate();
if (result == RETURN_OK) { if (result == RETURN_OK) {
triggerEvent(MPSOC_FLASH_WRITE_SUCCESSFUL); triggerEvent(SUPV_UPDATE_SUCCESSFUL);
} else { } else {
triggerEvent(MPSOC_FLASH_WRITE_FAILED); triggerEvent(SUPV_UPDATE_FAILED);
} }
internalState = InternalState::IDLE; internalState = InternalState::IDLE;
break; break;
@ -62,45 +62,20 @@ ReturnValue_t PlocSupvHelper::setComIF(DeviceCommunicationIF* communicationInter
void PlocSupvHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; } void PlocSupvHelper::setComCookie(CookieIF* comCookie_) { comCookie = comCookie_; }
void PlocSupvHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) { ReturnValue_t PlocSupvHelper::startUpdate(std::string file, uint8_t memoryId,
sequenceCount = sequenceCount_; uint32_t startAddress) {
}
ReturnValue_t PlocSupvHelper::startFlashWrite(std::string obcFile, std::string mpsocFile) {
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
result = FilesystemHelper::checkPath(obcFile); result = FilesystemHelper::checkPath(file);
if (result != RETURN_OK) {
return result;
}
result = FilesystemHelper::fileExists(mpsocFile);
if (result != RETURN_OK) { if (result != RETURN_OK) {
sif::warning << "PlocSupvHelper::startUpdate: File " << file << " does not exists" << std::endl;
return result; return result;
} }
#endif #endif
#ifdef TE0720_1CFA update.file = file;
if (not std::filesystem::exists(obcFile)) { update.memoryId = memoryId;
sif::warning << "PlocSupvHelper::startFlashWrite: File " << obcFile << "does not exist" update.startAddress = startAddress;
<< std::endl; internalState = InternalState::UPDATE;
return RETURN_FAILED;
}
#endif
flashWrite.obcFile = obcFile;
flashWrite.mpsocFile = mpsocFile;
internalState = InternalState::FLASH_WRITE;
result = resetHelper();
if (result != RETURN_OK) {
return result;
}
return result;
}
ReturnValue_t PlocSupvHelper::resetHelper() {
ReturnValue_t result = RETURN_OK;
semaphore.release();
terminate = false;
result = uartComIF->flushUartRxBuffer(comCookie);
return result; return result;
} }
@ -244,11 +219,11 @@ ReturnValue_t PlocSupvHelper::handleExe() {
void PlocSupvHelper::handleExeApidFailure(uint16_t apid) { void PlocSupvHelper::handleExeApidFailure(uint16_t apid) {
if (apid == supv::apid::EXE_FAILURE) { if (apid == supv::apid::EXE_FAILURE) {
triggerEvent(EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState)); triggerEvent(SUPV_EXE_FAILURE_REPORT, static_cast<uint32_t>(internalState));
sif::warning << "PlocSupvHelper::handleExeApidFailure: Received execution failure " sif::warning << "PlocSupvHelper::handleExeApidFailure: Received execution failure "
<< "report" << std::endl; << "report" << std::endl;
} else { } else {
triggerEvent(EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState)); triggerEvent(SUPV_EXE_INVALID_APID, apid, static_cast<uint32_t>(internalState));
sif::warning << "PlocSupvHelper::handleExeApidFailure: Expected execution report " sif::warning << "PlocSupvHelper::handleExeApidFailure: Expected execution report "
<< "but received space packet with apid " << std::hex << apid << std::endl; << "but received space packet with apid " << std::hex << apid << std::endl;
} }

View File

@ -8,7 +8,6 @@
#include "fsfw/osal/linux/BinarySemaphore.h" #include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw_hal/linux/uart/UartComIF.h" #include "fsfw_hal/linux/uart/UartComIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h" #include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#ifdef XIPHOS_Q7S #ifdef XIPHOS_Q7S
@ -44,29 +43,25 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
//! [EXPORT] : [COMMENT] Did not receive acknowledgement report //! [EXPORT] : [COMMENT] Did not receive acknowledgement report
//! P1: Number of bytes missing //! P1: Number of bytes missing
//! P2: Internal state of MPSoC helper //! P2: Internal state of MPSoC helper
static const Event MISSING_ACK = MAKE_EVENT(5, severity::LOW); static const Event SUPV_MISSING_ACK = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Did not receive execution report //! [EXPORT] : [COMMENT] Supervisor did not receive execution report
//! P1: Number of bytes missing //! P1: Number of bytes missing
//! P2: Internal state of MPSoC helper //! P2: Internal state of supervisor helper
static const Event MISSING_EXE = MAKE_EVENT(6, severity::LOW); static const Event SUPV_MISSING_EXE = MAKE_EVENT(6, severity::LOW);
//! [EXPORT] : [COMMENT] Received acknowledgement failure report //! [EXPORT] : [COMMENT] Supervisor received acknowledgment failure report
//! P1: Internal state of MPSoC //! P1: Internal state of supervisor helper
static const Event ACK_FAILURE_REPORT = MAKE_EVENT(7, severity::LOW); static const Event SUPV_ACK_FAILURE_REPORT = MAKE_EVENT(7, severity::LOW);
//! [EXPORT] : [COMMENT] Received execution failure report //! [EXPORT] : [COMMENT] Supervisor received execution failure report
//! P1: Internal state of MPSoC //! P1: Internal state of supervisor
static const Event EXE_FAILURE_REPORT = MAKE_EVENT(8, severity::LOW); static const Event SUPV_EXE_FAILURE_REPORT = MAKE_EVENT(8, severity::LOW);
//! [EXPORT] : [COMMENT] Expected acknowledgement report but received space packet with other apid //! [EXPORT] : [COMMENT] Supervisor expected acknowledgment report but received space packet with other apid
//! P1: Apid of received space packet //! P1: Apid of received space packet
//! P2: Internal state of MPSoC //! P2: Internal state of supervisor helper
static const Event ACK_INVALID_APID = MAKE_EVENT(9, severity::LOW); static const Event SUPV_ACK_INVALID_APID = MAKE_EVENT(9, severity::LOW);
//! [EXPORT] : [COMMENT] Expected execution report but received space packet with other apid //! [EXPORT] : [COMMENT] Supervisor helper expected execution report but received space packet with other apid
//! P1: Apid of received space packet //! P1: Apid of received space packet
//! P2: Internal state of MPSoC //! P2: Internal state of supervisor helper
static const Event EXE_INVALID_APID = MAKE_EVENT(10, severity::LOW); static const Event SUPV_EXE_INVALID_APID = MAKE_EVENT(10, severity::LOW);
//! [EXPORT] : [COMMENT] Received sequence count does not match expected sequence count
//! P1: Expected sequence count
//! P2: Received sequence count
static const Event MPSOC_HELPER_SEQ_CNT_MISMATCH = MAKE_EVENT(11, severity::LOW);
PlocSupvHelper(object_id_t objectId); PlocSupvHelper(object_id_t objectId);
virtual ~PlocSupvHelper(); virtual ~PlocSupvHelper();
@ -78,27 +73,23 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
void setComCookie(CookieIF* comCookie_); void setComCookie(CookieIF* comCookie_);
/** /**
* @brief Starts flash write sequence * @brief Starts update procedure
* *
* @param obcFile File where to read from the data * @param file File containing the update data
* @param mpsocFile The file of the MPSoC where should be written to * @param memoryId ID of the memory where to write to
* @param startAddress Address where to write data
* *
* @return RETURN_OK if successful, otherwise error return value * @return RETURN_OK if successful, otherwise error return value
*/ */
ReturnValue_t startUpdate(std::string file, std::string mpsocFile); ReturnValue_t startUpdate(std::string file, uint8_t memoryId, uint32_t startAddress);
/** /**
* @brief Can be used to interrupt a running data transfer. * @brief Can be used to interrupt a running data transfer.
*/ */
void stopProcess(); void stopProcess();
/**
* @brief Sets the sequence count object responsible for the sequence count handling
*/
void setSequenceCount(SourceSequenceCounter* sequenceCount_);
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_MPSOC_HELPER; static const uint8_t INTERFACE_ID = CLASS_ID::PLOC_SUPV_HELPER;
//! [EXPORT] : [COMMENT] File accidentally close //! [EXPORT] : [COMMENT] File accidentally close
static const ReturnValue_t FILE_CLOSED_ACCIDENTALLY = MAKE_RETURN_CODE(0xA0); static const ReturnValue_t FILE_CLOSED_ACCIDENTALLY = MAKE_RETURN_CODE(0xA0);
@ -110,7 +101,6 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
struct Update { struct Update {
uint8_t memoryId; uint8_t memoryId;
uint32_t startAddress; uint32_t startAddress;
uint32_t length;
// Absolute name of file containing update data // Absolute name of file containing update data
std::string file; std::string file;
}; };
@ -130,14 +120,11 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
bool terminate = false; bool terminate = false;
/** /**
* Communication interface of MPSoC responsible for low level access. Must be set by the * Communication interface responsible for data transactions between OBC and Supervisor.
* MPSoC Handler.
*/ */
UartComIF* uartComIF = nullptr; UartComIF* uartComIF = nullptr;
// Communication cookie. Must be set by the MPSoC Handler // Communication cookie. Must be set by the supervisor Handler
CookieIF* comCookie = nullptr; CookieIF* comCookie = nullptr;
// Sequence count, must be set by Ploc MPSoC Handler
SourceSequenceCounter* sequenceCount;
ReturnValue_t performUpdate(); ReturnValue_t performUpdate();
ReturnValue_t handlePacketTransmission(SpacePacket& tc); ReturnValue_t handlePacketTransmission(SpacePacket& tc);
@ -148,6 +135,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
void handleAckApidFailure(uint16_t apid); void handleAckApidFailure(uint16_t apid);
void handleExeApidFailure(uint16_t apid); void handleExeApidFailure(uint16_t apid);
ReturnValue_t handleTmReception(SpacePacket* tmPacket, size_t remainingBytes); ReturnValue_t handleTmReception(SpacePacket* tmPacket, size_t remainingBytes);
ReturnValue_t eraseMemory();
}; };
#endif /* BSP_Q7S_DEVICES_PLOCSUPVHELPER_H_ */ #endif /* BSP_Q7S_DEVICES_PLOCSUPVHELPER_H_ */