important bugfix for CRC calculation
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
@ -259,7 +259,6 @@ class TcMemWrite : public TcBase {
|
||||
: TcBase(params, apid::TC_MEM_WRITE, sequenceCount) {}
|
||||
|
||||
protected:
|
||||
|
||||
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
result = lengthCheck(commandDataLen);
|
||||
@ -270,7 +269,7 @@ class TcMemWrite : public TcBase {
|
||||
*(commandData + MEM_ADDRESS_SIZE) << 8 | *(commandData + MEM_ADDRESS_SIZE + 1);
|
||||
spParams.setPayloadLen(MIN_FIXED_PAYLOAD_LENGTH + memLen * 4);
|
||||
result = checkPayloadLen();
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||
@ -284,16 +283,15 @@ class TcMemWrite : public TcBase {
|
||||
// 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 = MIN_FIXED_PAYLOAD_LENGTH + 4;
|
||||
|
||||
|
||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||
if (commandDataLen < MIN_COMMAND_DATA_LENGTH) {
|
||||
sif::warning << "TcMemWrite: Length " << commandDataLen << " smaller than minimum " <<
|
||||
MIN_COMMAND_DATA_LENGTH << std::endl;
|
||||
sif::warning << "TcMemWrite: Length " << commandDataLen << " smaller than minimum "
|
||||
<< MIN_COMMAND_DATA_LENGTH << std::endl;
|
||||
return INVALID_LENGTH;
|
||||
}
|
||||
if(commandDataLen + CRC_SIZE > spParams.maxSize) {
|
||||
sif::warning << "TcMemWrite: Length " << commandDataLen << " larger than allowed " <<
|
||||
spParams.maxSize - CRC_SIZE << std::endl;
|
||||
if (commandDataLen + CRC_SIZE > spParams.maxSize) {
|
||||
sif::warning << "TcMemWrite: Length " << commandDataLen << " larger than allowed "
|
||||
<< spParams.maxSize - CRC_SIZE << std::endl;
|
||||
return INVALID_LENGTH;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
@ -317,7 +315,7 @@ class FlashFopen : public ploc::SpTcBase {
|
||||
size_t nameSize = filename.size();
|
||||
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR) + sizeof(accessMode));
|
||||
ReturnValue_t result = checkPayloadLen();
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||
@ -343,7 +341,7 @@ class FlashFclose : public ploc::SpTcBase {
|
||||
size_t nameSize = filename.size();
|
||||
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
||||
ReturnValue_t result = checkPayloadLen();
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||
@ -369,7 +367,7 @@ class TcFlashWrite : public ploc::SpTcBase {
|
||||
}
|
||||
spParams.setPayloadLen(static_cast<uint16_t>(writeLen) + 4);
|
||||
result = checkPayloadLen();
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
size_t serializedSize = 0;
|
||||
@ -403,7 +401,7 @@ class TcFlashDelete : public ploc::SpTcBase {
|
||||
size_t nameSize = filename.size();
|
||||
spParams.setPayloadLen(nameSize + sizeof(NULL_TERMINATOR));
|
||||
auto res = checkPayloadLen();
|
||||
if(res != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (res != HasReturnvaluesIF::RETURN_OK) {
|
||||
return res;
|
||||
}
|
||||
std::memcpy(payloadStart, filename.c_str(), nameSize);
|
||||
@ -460,7 +458,8 @@ class TcReplayStart : public TcBase {
|
||||
static const uint8_t ONCE = 1;
|
||||
|
||||
ReturnValue_t lengthCheck(size_t commandDataLen) {
|
||||
if (commandDataLen != COMMAND_DATA_LENGTH or checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (commandDataLen != COMMAND_DATA_LENGTH or
|
||||
checkPayloadLen() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "TcReplayStart: Command has invalid length " << commandDataLen << std::endl;
|
||||
return INVALID_LENGTH;
|
||||
}
|
||||
@ -661,7 +660,7 @@ class TcCamcmdSend : public TcBase {
|
||||
uint16_t dataLen = static_cast<uint16_t>(commandDataLen + sizeof(CARRIAGE_RETURN));
|
||||
spParams.setPayloadLen(sizeof(dataLen) + commandDataLen + sizeof(CARRIAGE_RETURN));
|
||||
auto res = checkPayloadLen();
|
||||
if(res != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (res != HasReturnvaluesIF::RETURN_OK) {
|
||||
return res;
|
||||
}
|
||||
size_t size = sizeof(dataLen);
|
||||
|
Reference in New Issue
Block a user