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
2 changed files with 6 additions and 7 deletions
Showing only changes of commit a718d182fc - Show all commits

View File

@ -105,6 +105,7 @@ void PlocMPSoCHandler::performOperationHook() {
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) { const uint8_t* data, size_t size) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
commandIsPending = true;
switch (actionId) { switch (actionId) {
case mpsoc::SET_UART_TX_TRISTATE: { case mpsoc::SET_UART_TX_TRISTATE: {
uartIsolatorSwitch.pullLow(); uartIsolatorSwitch.pullLow();
@ -225,9 +226,9 @@ void PlocMPSoCHandler::doShutDown() {
} }
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if (not commandIsExecuting(mpsoc::TC_GET_HK_REPORT)) { if (not commandIsPending) {
*id = mpsoc::TC_GET_HK_REPORT; *id = mpsoc::TC_GET_HK_REPORT;
// normalCmdPending = true; commandIsPending = true;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
return NOTHING_TO_SEND; return NOTHING_TO_SEND;
@ -378,7 +379,6 @@ 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 << "recv ack" << std::endl;
*foundLen = mpsoc::SIZE_ACK_REPORT; *foundLen = mpsoc::SIZE_ACK_REPORT;
*foundId = mpsoc::ACK_REPORT; *foundId = mpsoc::ACK_REPORT;
break; break;
@ -394,7 +394,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
handleDedicatedReply(mpsoc::TM_CAM_CMD_RPT); handleDedicatedReply(mpsoc::TM_CAM_CMD_RPT);
break; break;
case (mpsoc::apid::TM_HK_GET_REPORT): { case (mpsoc::apid::TM_HK_GET_REPORT): {
sif::debug << "recv hk report" << std::endl;
handleDedicatedReply(mpsoc::TM_GET_HK_REPORT); handleDedicatedReply(mpsoc::TM_GET_HK_REPORT);
break; break;
} }
@ -403,7 +402,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
break; break;
} }
case (mpsoc::apid::EXE_SUCCESS): case (mpsoc::apid::EXE_SUCCESS):
sif::debug << "recv exe" << std::endl;
*foundLen = mpsoc::SIZE_EXE_REPORT; *foundLen = mpsoc::SIZE_EXE_REPORT;
*foundId = mpsoc::EXE_REPORT; *foundId = mpsoc::EXE_REPORT;
break; break;
@ -419,12 +417,11 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
} }
} }
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK; uint16_t recvSeqCnt = ((*(start + 2) << 8) | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
if (recvSeqCnt != sequenceCount) { if (recvSeqCnt != sequenceCount) {
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;
@ -809,6 +806,7 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
if (normalCmdPending) { if (normalCmdPending) {
normalCmdPending = false; normalCmdPending = false;
} }
commandIsPending = 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;

View File

@ -169,6 +169,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
// Used to block incoming commands when MPSoC helper class is currently executing a command // Used to block incoming commands when MPSoC helper class is currently executing a command
bool plocMPSoCHelperExecuting = false; bool plocMPSoCHelperExecuting = false;
bool commandIsPending = false;
struct TmMemReadReport { struct TmMemReadReport {
static const uint8_t FIX_SIZE = 14; static const uint8_t FIX_SIZE = 14;