From a718d182fcd1fdedde402db0ef42c9b0e133d435 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 May 2023 17:39:15 +0200 Subject: [PATCH] done --- linux/payload/PlocMpsocHandler.cpp | 12 +++++------- linux/payload/PlocMpsocHandler.h | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 484ce47c..94fcb978 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -105,6 +105,7 @@ void PlocMPSoCHandler::performOperationHook() { ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { ReturnValue_t result = returnvalue::OK; + commandIsPending = true; switch (actionId) { case mpsoc::SET_UART_TX_TRISTATE: { uartIsolatorSwitch.pullLow(); @@ -225,9 +226,9 @@ void PlocMPSoCHandler::doShutDown() { } ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) { - if (not commandIsExecuting(mpsoc::TC_GET_HK_REPORT)) { + if (not commandIsPending) { *id = mpsoc::TC_GET_HK_REPORT; - // normalCmdPending = true; + commandIsPending = true; return buildCommandFromCommand(*id, nullptr, 0); } return NOTHING_TO_SEND; @@ -378,7 +379,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain }; switch (apid) { case (mpsoc::apid::ACK_SUCCESS): - sif::debug << "recv ack" << std::endl; *foundLen = mpsoc::SIZE_ACK_REPORT; *foundId = mpsoc::ACK_REPORT; break; @@ -394,7 +394,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain handleDedicatedReply(mpsoc::TM_CAM_CMD_RPT); break; case (mpsoc::apid::TM_HK_GET_REPORT): { - sif::debug << "recv hk report" << std::endl; handleDedicatedReply(mpsoc::TM_GET_HK_REPORT); break; } @@ -403,7 +402,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain break; } case (mpsoc::apid::EXE_SUCCESS): - sif::debug << "recv exe" << std::endl; *foundLen = mpsoc::SIZE_EXE_REPORT; *foundId = mpsoc::EXE_REPORT; 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) { triggerEvent(MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH, 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. sequenceCount++; return result; @@ -809,6 +806,7 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) { if (normalCmdPending) { normalCmdPending = false; } + commandIsPending = false; auto commandIter = deviceCommandMap.find(getPendingCommand()); if (commandIter != deviceCommandMap.end()) { commandIter->second.isExecuting = false; diff --git a/linux/payload/PlocMpsocHandler.h b/linux/payload/PlocMpsocHandler.h index 654cded4..a6af8156 100644 --- a/linux/payload/PlocMpsocHandler.h +++ b/linux/payload/PlocMpsocHandler.h @@ -169,6 +169,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { // Used to block incoming commands when MPSoC helper class is currently executing a command bool plocMPSoCHelperExecuting = false; + bool commandIsPending = false; struct TmMemReadReport { static const uint8_t FIX_SIZE = 14;