event buffer request wip

This commit is contained in:
Jakob Meier
2022-04-13 11:56:37 +02:00
parent 7f51ffc8fb
commit bd8cd49117
12 changed files with 627 additions and 789 deletions

View File

@ -29,41 +29,48 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
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] Requesting event buffer was successful
static const Event SUPV_EVENT_BUFFER_REQUEST_SUCCESSFUL = MAKE_EVENT(3, severity::LOW);
//! [EXPORT] : [COMMENT] Requesting event buffer failed
static const Event SUPV_EVENT_BUFFER_REQUEST_FAILED = MAKE_EVENT(4, severity::LOW);
//! [EXPORT] : [COMMENT] Terminated event buffer request by command
//! P1: Number of packets read before process was terminated
static const Event SUPV_EVENT_BUFFER_REQUEST_TERMINATED = MAKE_EVENT(5, severity::LOW);
//! [EXPORT] : [COMMENT] Communication interface returned failure when trying to send the command
//! to the supervisor
//! P1: Return value returned by the communication interface sendMessage function
//! P2: Internal state of supervisor helper
static const Event SUPV_SENDING_COMMAND_FAILED = MAKE_EVENT(3, severity::LOW);
static const Event SUPV_SENDING_COMMAND_FAILED = MAKE_EVENT(6, 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 supervisor helper
static const Event SUPV_HELPER_REQUESTING_REPLY_FAILED = MAKE_EVENT(4, severity::LOW);
static const Event SUPV_HELPER_REQUESTING_REPLY_FAILED = MAKE_EVENT(7, 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 supervisor helper
static const Event SUPV_HELPER_READING_REPLY_FAILED = MAKE_EVENT(5, severity::LOW);
static const Event SUPV_HELPER_READING_REPLY_FAILED = MAKE_EVENT(8, 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(6, severity::LOW);
static const Event SUPV_MISSING_ACK = MAKE_EVENT(9, 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(7, severity::LOW);
static const Event SUPV_MISSING_EXE = MAKE_EVENT(10, severity::LOW);
//! [EXPORT] : [COMMENT] Supervisor received acknowledgment failure report
//! P1: Internal state of supervisor helper
static const Event SUPV_ACK_FAILURE_REPORT = MAKE_EVENT(8, severity::LOW);
static const Event SUPV_ACK_FAILURE_REPORT = MAKE_EVENT(11, severity::LOW);
//! [EXPORT] : [COMMENT] Supervisor received execution failure report
//! P1: Internal state of supervisor
static const Event SUPV_EXE_FAILURE_REPORT = MAKE_EVENT(9, severity::LOW);
static const Event SUPV_EXE_FAILURE_REPORT = MAKE_EVENT(12, 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(10, severity::LOW);
static const Event SUPV_ACK_INVALID_APID = MAKE_EVENT(13, 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(11, severity::LOW);
static const Event SUPV_EXE_INVALID_APID = MAKE_EVENT(14, severity::LOW);
PlocSupvHelper(object_id_t objectId);
virtual ~PlocSupvHelper();
@ -85,6 +92,11 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
*/
ReturnValue_t startUpdate(std::string file, uint8_t memoryId, uint32_t startAddress);
/**
* @brief Calling this function will initiate the procedure to request the event buffer
*/
ReturnValue_t startEventbBufferRequest(std::string path);
/**
* @brief Can be used to interrupt a running data transfer.
*/
@ -95,12 +107,22 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
//! [EXPORT] : [COMMENT] File accidentally close
static const ReturnValue_t FILE_CLOSED_ACCIDENTALLY = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Process has been terminated by command
static const ReturnValue_t PROCESS_TERMINATED = MAKE_RETURN_CODE(0xA1);
//! [EXPORT] : [COMMENT] Received command with invalid pathname
static const ReturnValue_t PATH_NOT_EXISTS = MAKE_RETURN_CODE(0xA2);
//! [EXPORT] : [COMMENT] Expected event buffer TM but received space packet with other APID
static const ReturnValue_t EVENT_BUFFER_REQUEST_INVALID_APID = MAKE_RETURN_CODE(0xA3);
// 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;
// Event buffer reply will carry 24 space packets with 1016 bytes and one space packet with
// 192 bytes
static const uint8_t NUM_EVENT_BUFFER_PACKETS = 25;
static const size_t SIZE_EVENT_BUFFER_FULL_PACKET = 1024;
static const size_t SIZE_EVENT_BUFFER_LAST_PACKET = 200;
struct Update {
uint8_t memoryId;
@ -114,7 +136,16 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
struct Update update;
enum class InternalState { IDLE, UPDATE };
struct EventBufferRequest {
std::string path = "";
// Default name of file where event buffer data will be written to. Timestamp will be added to
// name when new file is created
std::string filename = "event-buffer";
};
EventBufferRequest eventBufferReq;
enum class InternalState { IDLE, UPDATE, REQUEST_EVENT_BUFFER };
InternalState internalState = InternalState::IDLE;
@ -133,7 +164,10 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
// Communication cookie. Must be set by the supervisor Handler
CookieIF* comCookie = nullptr;
bool timestamping = true;
ReturnValue_t performUpdate();
ReturnValue_t performEventBufferRequest();
ReturnValue_t handlePacketTransmission(SpacePacket& packet);
ReturnValue_t sendCommand(SpacePacket& packet);
/**
@ -169,6 +203,7 @@ class PlocSupvHelper : public SystemObject, public ExecutableObjectIF, public Ha
* @return The size of the file
*/
uint32_t getFileSize(std::string filename);
ReturnValue_t handleEventBufferReception();
};
#endif /* BSP_Q7S_DEVICES_PLOCSUPVHELPER_H_ */