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
Showing only changes of commit 714e2d07e5 - Show all commits

View File

@ -225,9 +225,9 @@ void PlocMPSoCHandler::doShutDown() {
} }
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if (not normalCmdPending) { if (not commandIsExecuting(mpsoc::TC_GET_HK_REPORT)) {
*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;
@ -424,6 +424,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
triggerEvent(MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH, sequenceCount, recvSeqCnt); triggerEvent(MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH, sequenceCount, recvSeqCnt);
sequenceCount = recvSeqCnt; sequenceCount = recvSeqCnt;
} }
sif::debug << "sequence count: " << sequenceCount.get() << std::endl;
// This sequence count ping pong does not make any sense but it is how the MPSoC expects it. // This sequence count ping pong does not make any sense but it is how the MPSoC expects it.
sequenceCount++; sequenceCount++;
return result; return result;
@ -804,19 +805,22 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK; uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK;
auto cmdDoneHandler = [&]() { auto cmdDoneHandler = [&](bool success) {
if (normalCmdPending) { if (normalCmdPending) {
normalCmdPending = false; normalCmdPending = false;
} }
auto commandIter = deviceCommandMap.find(getPendingCommand()); auto commandIter = deviceCommandMap.find(getPendingCommand());
if (commandIter != deviceCommandMap.end()) { if (commandIter != deviceCommandMap.end()) {
commandIter->second.isExecuting = false; commandIter->second.isExecuting = false;
if (commandIter->second.sendReplyTo != MessageQueueIF::NO_QUEUE) {
actionHelper.finish(success, commandIter->second.sendReplyTo, getPendingCommand(), result);
}
} }
disableAllReplies(); disableAllReplies();
}; };
switch (apid) { switch (apid) {
case (mpsoc::apid::EXE_SUCCESS): { case (mpsoc::apid::EXE_SUCCESS): {
cmdDoneHandler(); cmdDoneHandler(true);
break; break;
} }
case (mpsoc::apid::EXE_FAILURE): { case (mpsoc::apid::EXE_FAILURE): {
@ -833,7 +837,7 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
printStatus(data); printStatus(data);
sendFailureReport(mpsoc::EXE_REPORT, MPSoCReturnValuesIF::RECEIVED_EXE_FAILURE); sendFailureReport(mpsoc::EXE_REPORT, MPSoCReturnValuesIF::RECEIVED_EXE_FAILURE);
result = IGNORE_REPLY_DATA; result = IGNORE_REPLY_DATA;
cmdDoneHandler(); cmdDoneHandler(false);
break; break;
} }
default: { default: {