horrible
All checks were successful
EIVE/eive-obsw/pipeline/pr-v2.1.0-dev This commit looks good

This commit is contained in:
Robin Müller 2023-05-12 15:52:47 +02:00
parent 07d9ab0dd9
commit 1f9c9e2407
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,4 @@
#include <fsfw/globalfunctions/arrayprinter.h>
#include <linux/payload/PlocMpsocHandler.h>
#include <linux/payload/plocSupvDefs.h>
@ -224,11 +225,11 @@ void PlocMPSoCHandler::doShutDown() {
}
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if (not normalCmdPending) {
*id = mpsoc::TC_GET_HK_REPORT;
normalCmdPending = true;
return buildCommandFromCommand(*id, nullptr, 0);
}
// if (not normalCmdPending) {
// *id = mpsoc::TC_GET_HK_REPORT;
// normalCmdPending = true;
// return buildCommandFromCommand(*id, nullptr, 0);
// }
return NOTHING_TO_SEND;
}
@ -352,13 +353,14 @@ void PlocMPSoCHandler::fillCommandAndReplyMap() {
this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT);
this->insertInReplyMap(mpsoc::TM_GET_HK_REPORT, 5, nullptr, mpsoc::SIZE_TM_HK_REPORT);
this->insertInReplyMap(mpsoc::TM_CAM_CMD_RPT, 2, nullptr, mpsoc::SP_MAX_SIZE);
this->insertInReplyMap(mpsoc::TM_FLASH_DIRECTORY_CONTENT, 2, nullptr, 0);
this->insertInReplyMap(mpsoc::TM_FLASH_DIRECTORY_CONTENT, 2, nullptr, mpsoc::SP_MAX_SIZE);
}
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = returnvalue::OK;
sif::debug << "remainingSize: " << remainingSize << std::endl;
SpacePacketReader spacePacket;
spacePacket.setReadOnlyData(start, remainingSize);
if (spacePacket.isNull()) {
@ -377,6 +379,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
};
switch (apid) {
case (mpsoc::apid::ACK_SUCCESS):
sif::debug << "got ack" << std::endl;
*foundLen = mpsoc::SIZE_ACK_REPORT;
*foundId = mpsoc::ACK_REPORT;
break;
@ -408,7 +411,8 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
*foundId = mpsoc::EXE_REPORT;
break;
default: {
sif::debug << "PlocMPSoCHandler::scanForReply: Reply has invalid apid" << std::endl;
sif::debug << "PlocMPSoCHandler::scanForReply: Reply has invalid APID 0x" << std::hex
<< std::setfill('0') << std::setw(2) << apid << std::dec << std::endl;
*foundLen = remainingSize;
return MPSoCReturnValuesIF::INVALID_APID;
}
@ -445,6 +449,7 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
break;
}
case (mpsoc::TM_FLASH_DIRECTORY_CONTENT): {
sif::debug << "received flash dir content packet" << std::endl;
result = verifyPacket(packet, foundPacketLen);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PLOC MPSoC: Flash directory content reply invalid CRC" << std::endl;
@ -1171,6 +1176,10 @@ void PlocMPSoCHandler::setNextReplyId() {
case mpsoc::TC_MEM_READ:
nextReplyId = mpsoc::TM_MEMORY_READ_REPORT;
break;
case mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT: {
nextReplyId = mpsoc::TM_FLASH_DIRECTORY_CONTENT;
break;
}
case mpsoc::TC_GET_HK_REPORT: {
nextReplyId = mpsoc::TM_GET_HK_REPORT;
break;
@ -1403,12 +1412,12 @@ void PlocMPSoCHandler::disableExeReportReply() {
}
void PlocMPSoCHandler::printStatus(const uint8_t* data) {
uint16_t status = *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
uint16_t status = (*(data + STATUS_OFFSET) << 8) | *(data + STATUS_OFFSET + 1);
sif::info << "Verification report status: " << getStatusString(status) << std::endl;
}
uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) {
return *(data + STATUS_OFFSET) << 8 | *(data + STATUS_OFFSET + 1);
return (*(data + STATUS_OFFSET) << 8) | *(data + STATUS_OFFSET + 1);
}
void PlocMPSoCHandler::handleActionCommandFailure(ActionId_t actionId) {

View File

@ -628,11 +628,13 @@ class TcGetDirContent : public TcBase {
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK;
spParams.setFullPayloadLen(commandDataLen + CRC_SIZE);
// Yeah it needs to be 256.. even if the path is shorter.
spParams.setFullPayloadLen(256 + CRC_SIZE);
if (result != returnvalue::OK) {
return result;
}
std::memcpy(payloadStart, commandData, commandDataLen);
payloadStart[255] = '\0';
return result;
}
};

2
tmtc

@ -1 +1 @@
Subproject commit 377e98b5c2da12f10cdd12b027548a8075fdcb58
Subproject commit ef0adef04aebf8aa0d673e14403b484bd1200d9c