update helper wip

This commit is contained in:
Jakob Meier
2022-04-07 11:00:07 +02:00
parent f058cf5e31
commit c0fd9aee6f
3 changed files with 39 additions and 75 deletions

View File

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