ploc update
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Jakob Meier
2022-04-10 18:46:39 +02:00
parent dbe4f70d8e
commit b440fc3df6
27 changed files with 1533 additions and 1817 deletions

View File

@ -9,7 +9,7 @@
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "linux/devices/devicedefinitions/PlocSupervisorDefinitions.h"
#ifdef XIPHOS_Q7S
#include "bsp_q7s/memory/SdCardManager.h"
#endif
@ -27,41 +27,43 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
static const Event SUPV_UPDATE_FAILED = MAKE_EVENT(0, severity::LOW);
//! [EXPORT] : [COMMENT] update successful
static const Event SUPV_UPDATE_SUCCESSFUL = MAKE_EVENT(1, severity::LOW);
//! [EXPORT] : [COMMENT] Terminated update procedure by command
static const Event TERMINATED_UPDATE_PROCEDURE = MAKE_EVENT(2, severity::LOW);
//! [EXPORT] : [COMMENT] Communication interface returned failure when trying to send the command
//! ot the PLOC
//! to the supervisor
//! P1: Return value returned by the communication interface sendMessage function
//! P2: Internal state of MPSoC helper
static const Event SENDING_COMMAND_FAILED = MAKE_EVENT(2, severity::LOW);
//! P2: Internal state of supervisor helper
static const Event SUPV_SENDING_COMMAND_FAILED = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] Request receive message of communication interface failed
//! P1: Return value returned by the communication interface requestReceiveMessage function
//! P2: Internal state of MPSoC helper
static const Event MPSOC_HELPER_REQUESTING_REPLY_FAILED = MAKE_EVENT(3, severity::LOW);
//! P2: Internal state of supervisor helper
static const Event SUPV_HELPER_REQUESTING_REPLY_FAILED = MAKE_EVENT(4, severity::LOW);
//! [EXPORT] : [COMMENT] Reading receive message of communication interface failed
//! P1: Return value returned by the communication interface readingReceivedMessage function
//! P2: Internal state of MPSoC helper
static const Event MPSOC_HELPER_READING_REPLY_FAILED = MAKE_EVENT(4, severity::LOW);
//! P2: Internal state of supervisor helper
static const Event SUPV_HELPER_READING_REPLY_FAILED = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Did not receive acknowledgement report
//! P1: Number of bytes missing
//! P2: Internal state of MPSoC helper
static const Event SUPV_MISSING_ACK = MAKE_EVENT(5, severity::LOW);
static const Event SUPV_MISSING_ACK = MAKE_EVENT(6, severity::LOW);
//! [EXPORT] : [COMMENT] Supervisor did not receive execution report
//! P1: Number of bytes missing
//! P2: Internal state of supervisor helper
static const Event SUPV_MISSING_EXE = MAKE_EVENT(6, severity::LOW);
static const Event SUPV_MISSING_EXE = MAKE_EVENT(7, 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);
static const Event SUPV_ACK_FAILURE_REPORT = MAKE_EVENT(8, 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);
static const Event SUPV_EXE_FAILURE_REPORT = MAKE_EVENT(9, 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 supervisor helper
static const Event SUPV_ACK_INVALID_APID = MAKE_EVENT(9, severity::LOW);
static const Event SUPV_ACK_INVALID_APID = MAKE_EVENT(10, 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 supervisor helper
static const Event SUPV_EXE_INVALID_APID = MAKE_EVENT(10, severity::LOW);
static const Event SUPV_EXE_INVALID_APID = MAKE_EVENT(11, severity::LOW);
PlocSupvHelper(object_id_t objectId);
virtual ~PlocSupvHelper();
@ -69,7 +71,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
ReturnValue_t initialize() override;
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t setComIF(DeviceCommunicationIF* communicationInterface_);
ReturnValue_t setComIF(UartComIF* uartComfIF_);
void setComCookie(CookieIF* comCookie_);
/**
@ -93,16 +95,21 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
//! [EXPORT] : [COMMENT] File accidentally close
static const ReturnValue_t FILE_CLOSED_ACCIDENTALLY = MAKE_RETURN_CODE(0xA0);
static const ReturnValue_t PROCESS_TERMINATED = MAKE_RETURN_CODE(0xA1);
// Maximum number of times the communication interface retries polling data from the reply
// buffer
static const int RETRIES = 10000;
static const uint16_t CRC16_INIT = 0xFFFF;
struct Update {
uint8_t memoryId;
uint32_t startAddress;
// Absolute name of file containing update data
std::string file;
// Size of update
uint32_t length;
uint32_t crc;
};
struct Update update;
@ -127,15 +134,41 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
CookieIF* comCookie = nullptr;
ReturnValue_t performUpdate();
ReturnValue_t handlePacketTransmission(SpacePacket& tc);
ReturnValue_t sendCommand(SpacePacket& tc);
ReturnValue_t handlePacketTransmission(SpacePacket& packet);
ReturnValue_t sendCommand(SpacePacket& packet);
/**
* @brief Function which reads form the communication interface
*
* @param data Pointer to buffer where read data will be written to
* @param raedBytes Actual number of bytes read
* @param requestBytes Number of bytes to read
*/
ReturnValue_t receive(uint8_t* data, size_t* readBytes, size_t requestBytes);
ReturnValue_t handleAck();
ReturnValue_t handleExe();
void handleAckApidFailure(uint16_t apid);
void handleExeApidFailure(uint16_t apid);
ReturnValue_t handleTmReception(SpacePacket* tmPacket, size_t remainingBytes);
/**
* @brief Handles reading of TM packets from the communication interface
*
* @param tmPacket Pointer to space packet where received data will be written to
* @param reaminingBytes Number of bytes to read in the space packet
*/
ReturnValue_t handleTmReception(supv::TmPacket* tmPacket, size_t remainingBytes);
ReturnValue_t prepareUpdate();
ReturnValue_t eraseMemory();
// Calculates CRC over image. Will be used for verification after update writing has
// finished.
ReturnValue_t calcImageCrc();
ReturnValue_t handleCheckMemoryCommand();
/**
* @brief Return size of file with name filename
*
* @param filename
*
* @return The size of the file
*/
uint32_t getFileSize(std::string filename);
};
#endif /* BSP_Q7S_DEVICES_PLOCSUPVHELPER_H_ */