PLOC MPSoC dir content report #634

Merged
meggert merged 54 commits from ploc_mpsoc_dir_content_report_2 into v2.1.0-dev 2023-05-15 09:40:03 +02:00
3 changed files with 22 additions and 11 deletions
Showing only changes of commit 1f9c9e2407 - Show all commits

View File

@ -1,3 +1,4 @@
#include <fsfw/globalfunctions/arrayprinter.h>
#include <linux/payload/PlocMpsocHandler.h> #include <linux/payload/PlocMpsocHandler.h>
#include <linux/payload/plocSupvDefs.h> #include <linux/payload/plocSupvDefs.h>
@ -224,11 +225,11 @@ void PlocMPSoCHandler::doShutDown() {
} }
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if (not normalCmdPending) { // if (not normalCmdPending) {
*id = mpsoc::TC_GET_HK_REPORT; // *id = mpsoc::TC_GET_HK_REPORT;
normalCmdPending = true; // normalCmdPending = true;
return buildCommandFromCommand(*id, nullptr, 0); // return buildCommandFromCommand(*id, nullptr, 0);
} // }
return NOTHING_TO_SEND; 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_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_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_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, ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) { DeviceCommandId_t* foundId, size_t* foundLen) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
sif::debug << "remainingSize: " << remainingSize << std::endl;
SpacePacketReader spacePacket; SpacePacketReader spacePacket;
spacePacket.setReadOnlyData(start, remainingSize); spacePacket.setReadOnlyData(start, remainingSize);
if (spacePacket.isNull()) { if (spacePacket.isNull()) {
@ -377,6 +379,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
}; };
switch (apid) { switch (apid) {
case (mpsoc::apid::ACK_SUCCESS): case (mpsoc::apid::ACK_SUCCESS):
sif::debug << "got ack" << std::endl;
*foundLen = mpsoc::SIZE_ACK_REPORT; *foundLen = mpsoc::SIZE_ACK_REPORT;
*foundId = mpsoc::ACK_REPORT; *foundId = mpsoc::ACK_REPORT;
break; break;
@ -408,7 +411,8 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
*foundId = mpsoc::EXE_REPORT; *foundId = mpsoc::EXE_REPORT;
break; break;
default: { 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; *foundLen = remainingSize;
return MPSoCReturnValuesIF::INVALID_APID; return MPSoCReturnValuesIF::INVALID_APID;
} }
@ -445,6 +449,7 @@ ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const
break; break;
} }
case (mpsoc::TM_FLASH_DIRECTORY_CONTENT): { case (mpsoc::TM_FLASH_DIRECTORY_CONTENT): {
sif::debug << "received flash dir content packet" << std::endl;
result = verifyPacket(packet, foundPacketLen); result = verifyPacket(packet, foundPacketLen);
if (result == MPSoCReturnValuesIF::CRC_FAILURE) { if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
sif::warning << "PLOC MPSoC: Flash directory content reply invalid CRC" << std::endl; sif::warning << "PLOC MPSoC: Flash directory content reply invalid CRC" << std::endl;
@ -1171,6 +1176,10 @@ void PlocMPSoCHandler::setNextReplyId() {
case mpsoc::TC_MEM_READ: case mpsoc::TC_MEM_READ:
nextReplyId = mpsoc::TM_MEMORY_READ_REPORT; nextReplyId = mpsoc::TM_MEMORY_READ_REPORT;
break; break;
case mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT: {
nextReplyId = mpsoc::TM_FLASH_DIRECTORY_CONTENT;
break;
}
case mpsoc::TC_GET_HK_REPORT: { case mpsoc::TC_GET_HK_REPORT: {
nextReplyId = mpsoc::TM_GET_HK_REPORT; nextReplyId = mpsoc::TM_GET_HK_REPORT;
break; break;
@ -1403,12 +1412,12 @@ void PlocMPSoCHandler::disableExeReportReply() {
} }
void PlocMPSoCHandler::printStatus(const uint8_t* data) { 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; sif::info << "Verification report status: " << getStatusString(status) << std::endl;
} }
uint16_t PlocMPSoCHandler::getStatus(const uint8_t* data) { 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) { 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 initPacket(const uint8_t* commandData, size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK; 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) { if (result != returnvalue::OK) {
return result; return result;
} }
std::memcpy(payloadStart, commandData, commandDataLen); std::memcpy(payloadStart, commandData, commandDataLen);
payloadStart[255] = '\0';
return result; return result;
} }
}; };

2
tmtc

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