v1.10.0 #220

Merged
meierj merged 592 commits from develop into main 2022-04-22 07:42:20 +02:00
8 changed files with 19 additions and 60 deletions
Showing only changes of commit f0bf743f88 - Show all commits

View File

@ -71,7 +71,7 @@ public:
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(0xA0);
static const ReturnValue_t INVALID_LENGTH = MAKE_RETURN_CODE(0xC0);
/**
* @brief Constructor
@ -212,7 +212,6 @@ public:
* @brief Constructor
*/
TcMemWrite(uint16_t sequenceCount) : TcBase(apid::TC_MEM_WRITE, sequenceCount) {
this->setPacketDataLength(PACKET_LENGTH);
}
protected:
@ -223,21 +222,22 @@ protected:
if (result != RETURN_OK) {
return result;
}
std::memcpy(this->localData.fields.buffer, commandData, MEM_ADDRESS_SIZE);
std::memcpy(this->localData.fields.buffer + MEM_ADDRESS_SIZE,
commandData + MEM_ADDRESS_SIZE, MEM_DATA_SIZE);
std::memcpy(this->localData.fields.buffer, commandData, commandDataLen);
uint16_t memLen = *(commandData + MEM_ADDRESS_SIZE) << 8
| *(commandData + MEM_ADDRESS_SIZE + 1);
this->setPacketDataLength(memLen * 4 + FIX_LENGTH - 1);
return result;
}
private:
static const size_t COMMAND_LENGTH = 8;
static const uint16_t PACKET_LENGTH = 9;
// Min length consists of 4 byte address, 2 byte mem length field, 4 byte data (1 word)
static const size_t MIN_COMMAND_DATA_LENGTH = 10;
static const size_t MEM_ADDRESS_SIZE = 4;
static const size_t MEM_DATA_SIZE = 4;
static const size_t FIX_LENGTH = 8;
ReturnValue_t lengthCheck(size_t commandDataLen) {
if (commandDataLen != COMMAND_LENGTH) {
if (commandDataLen < MIN_COMMAND_DATA_LENGTH) {
return INVALID_LENGTH;
}
return RETURN_OK;

View File

@ -4,5 +4,4 @@ target_sources(${TARGET_NAME} PRIVATE
PlocMemoryDumper.cpp
PlocMPSoCHandler.cpp
PlocMPSoCHelper.cpp
MPSoCSequenceCount.cpp
)

View File

@ -1,18 +0,0 @@
#include "fsfw/serviceInterface/ServiceInterfaceStream.h"
#include "MPSoCSequenceCount.h"
MPSoCSequenceCount::MPSoCSequenceCount() : SourceSequenceCounter() {
}
ReturnValue_t MPSoCSequenceCount::compare(uint16_t recvSeqCount) {
if (recvSeqCount != *this) {
sif::warning << "MPSoCSequenceCount::compare: Packet sequence count mismatch. Received: "
<< recvSeqCount << ", Expected: " << *this << std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}
MPSoCSequenceCount::~MPSoCSequenceCount() {
}

View File

@ -1,21 +0,0 @@
#ifndef BSP_Q7S_DEVICES_PLOC_MPSOCSEQUENCECOUNT_H_
#define BSP_Q7S_DEVICES_PLOC_MPSOCSEQUENCECOUNT_H_
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
/**
* @brief Class to manage the sequence count of the space packets exchanged with the MPSoC of the
* PLOC.
*
* @author J. Meier
*/
class MPSoCSequenceCount : public SourceSequenceCounter {
public:
MPSoCSequenceCount();
virtual ~MPSoCSequenceCount();
ReturnValue_t compare(uint16_t recvSeqCount);
};
#endif /* BSP_Q7S_DEVICES_PLOC_MPSOCSEQUENCECOUNT_H_ */

View File

@ -207,10 +207,10 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t *start,
}
}
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
result = sequenceCount.compare(recvSeqCnt);
if (result != RETURN_OK) {
if (recvSeqCnt != sequenceCount) {
triggerEvent(SEQ_CNT_MISMATCH, sequenceCount, recvSeqCnt);
sequenceCount = recvSeqCnt;
sequenceCount = recvSeqCnt;
return result;
}
return result;
}

View File

@ -5,8 +5,8 @@
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "MPSoCSequenceCount.h"
#include "PlocMPSoCHelper.h"
/**
@ -93,7 +93,7 @@ private:
MessageQueueIF* eventQueue = nullptr;
MPSoCSequenceCount sequenceCount;
SourceSequenceCounter sequenceCount;
uint8_t commandBuffer[mpsoc::MAX_COMMAND_SIZE];

View File

@ -60,7 +60,7 @@ void PlocMPSoCHelper::setComCookie(CookieIF* comCookie_) {
comCookie = comCookie_;
}
void PlocMPSoCHelper::setSequenceCount(MPSoCSequenceCount* sequenceCount_) {
void PlocMPSoCHelper::setSequenceCount(SourceSequenceCounter* sequenceCount_) {
sequenceCount = sequenceCount_;
}
@ -214,8 +214,7 @@ ReturnValue_t PlocMPSoCHelper::handleTmReception(mpsoc::TmPacket* tmPacket, size
return result;
}
uint16_t recvSeqCnt = tmPacket->getPacketSequenceCount();
result = sequenceCount->compare(recvSeqCnt);
if (result != RETURN_OK) {
if (recvSeqCnt != *sequenceCount) {
triggerEvent(SEQ_CNT_MISMATCH, *sequenceCount, recvSeqCnt);
*sequenceCount = recvSeqCnt;
return result;

View File

@ -9,8 +9,8 @@
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw_hal/linux/uart/UartComIF.h"
#include "fsfw/devicehandlers/CookieIF.h"
#include "fsfw/tmtcservices/SourceSequenceCounter.h"
#include "bsp_q7s/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "MPSoCSequenceCount.h"
/**
* @brief Helper class for MPSoC of PLOC intended to accelerate large data transfers between
@ -91,7 +91,7 @@ public:
/**
* @brief Sets the sequence count object responsible for the sequence count handling
*/
void setSequenceCount(MPSoCSequenceCount* sequenceCount_);
void setSequenceCount(SourceSequenceCounter* sequenceCount_);
private:
@ -132,7 +132,7 @@ private:
// Communication cookie. Must be set by the MPSoC Handler
CookieIF* comCookie = nullptr;
// Sequence count, must be set by Ploc MPSoC Handler
MPSoCSequenceCount* sequenceCount;
SourceSequenceCounter* sequenceCount;
ReturnValue_t performFlashWrite();
ReturnValue_t sendCommand(mpsoc::TcBase* tc);