2022-01-06 18:05:21 +01:00
|
|
|
#include "PlocMPSoCHandler.h"
|
2022-03-22 11:35:44 +01:00
|
|
|
|
|
|
|
#include "OBSWConfig.h"
|
2022-01-06 18:05:21 +01:00
|
|
|
#include "fsfw/datapool/PoolReadGuard.h"
|
2022-03-22 11:35:44 +01:00
|
|
|
#include "fsfw/globalfunctions/CRC.h"
|
2021-03-29 14:37:52 +02:00
|
|
|
|
2022-01-03 08:01:55 +01:00
|
|
|
PlocMPSoCHandler::PlocMPSoCHandler(object_id_t objectId, object_id_t uartComIFid,
|
2022-03-22 11:35:44 +01:00
|
|
|
CookieIF* comCookie, PlocMPSoCHelper* plocMPSoCHelper)
|
|
|
|
: DeviceHandlerBase(objectId, uartComIFid, comCookie), plocMPSoCHelper(plocMPSoCHelper) {
|
|
|
|
if (comCookie == NULL) {
|
|
|
|
sif::error << "PlocMPSoCHandler: Invalid com cookie" << std::endl;
|
|
|
|
}
|
|
|
|
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
2021-03-29 14:37:52 +02:00
|
|
|
}
|
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
PlocMPSoCHandler::~PlocMPSoCHandler() {}
|
2021-03-29 14:37:52 +02:00
|
|
|
|
2022-01-03 08:01:55 +01:00
|
|
|
ReturnValue_t PlocMPSoCHandler::initialize() {
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
result = DeviceHandlerBase::initialize();
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
uartComIf = dynamic_cast<UartComIF*>(communicationInterface);
|
|
|
|
if (uartComIf == nullptr) {
|
|
|
|
sif::warning << "PlocMPSoCHandler::initialize: Invalid uart com if" << std::endl;
|
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
}
|
2022-01-06 18:05:21 +01:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
|
|
|
if (manager == nullptr) {
|
2022-01-06 18:05:21 +01:00
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-03-22 11:35:44 +01:00
|
|
|
sif::error << "PlocMPSoCHandler::initialize: Invalid event manager" << std::endl;
|
2022-01-06 18:05:21 +01:00
|
|
|
#endif
|
2022-03-22 11:35:44 +01:00
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
;
|
|
|
|
}
|
|
|
|
result = manager->registerListener(eventQueue->getId());
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
result = manager->subscribeToEventRange(
|
|
|
|
eventQueue->getId(), event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_FAILED),
|
|
|
|
event::getEventId(PlocMPSoCHelper::MPSOC_FLASH_WRITE_SUCCESSFUL));
|
|
|
|
if (result != RETURN_OK) {
|
2022-01-06 18:05:21 +01:00
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
2022-03-22 11:35:44 +01:00
|
|
|
sif::warning << "PlocMPSoCHandler::initialize: Failed to subscribe to events from "
|
|
|
|
" ploc mpsoc helper"
|
|
|
|
<< std::endl;
|
2022-01-06 18:05:21 +01:00
|
|
|
#endif
|
2022-03-22 11:35:44 +01:00
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
}
|
2022-01-06 18:05:21 +01:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
result = plocMPSoCHelper->setComIF(communicationInterface);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
|
|
|
}
|
|
|
|
plocMPSoCHelper->setComCookie(comCookie);
|
|
|
|
plocMPSoCHelper->setSequenceCount(&sequenceCount);
|
|
|
|
return result;
|
2022-01-03 08:01:55 +01:00
|
|
|
}
|
|
|
|
|
2022-01-07 09:50:04 +01:00
|
|
|
void PlocMPSoCHandler::performOperationHook() {
|
2022-03-22 11:35:44 +01:00
|
|
|
EventMessage event;
|
|
|
|
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == RETURN_OK;
|
|
|
|
result = eventQueue->receiveMessage(&event)) {
|
|
|
|
switch (event.getMessageId()) {
|
|
|
|
case EventMessage::EVENT_MESSAGE:
|
|
|
|
handleEvent(&event);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sif::debug << "PlocMPSoCHandler::performOperationHook: Did not subscribe to this event"
|
|
|
|
<< " message" << std::endl;
|
|
|
|
break;
|
2022-01-07 09:50:04 +01:00
|
|
|
}
|
2022-03-22 11:35:44 +01:00
|
|
|
}
|
2022-01-07 09:50:04 +01:00
|
|
|
}
|
|
|
|
|
2022-01-06 18:05:21 +01:00
|
|
|
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
2022-03-22 11:35:44 +01:00
|
|
|
const uint8_t* data, size_t size) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
2022-01-06 18:05:21 +01:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
if (plocMPSoCHelperExecuting) {
|
|
|
|
return MPSoCReturnValuesIF::MPSOC_HELPER_EXECUTING;
|
|
|
|
}
|
2022-01-06 18:05:21 +01:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
switch (actionId) {
|
2022-01-06 18:05:21 +01:00
|
|
|
case mpsoc::TC_FLASHWRITE: {
|
2022-03-22 11:35:44 +01:00
|
|
|
if (size > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
|
|
|
return MPSoCReturnValuesIF::FILENAME_TOO_LONG;
|
|
|
|
}
|
|
|
|
mpsoc::FlashWritePusCmd flashWritePusCmd;
|
|
|
|
result = plocMPSoCHelper->startFlashWrite(flashWritePusCmd.getObcFile(),
|
|
|
|
flashWritePusCmd.getMPSoCFile());
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
plocMPSoCHelperExecuting = true;
|
|
|
|
break;
|
2022-01-06 18:05:21 +01:00
|
|
|
}
|
|
|
|
default:
|
2022-03-22 11:35:44 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return DeviceHandlerBase::executeAction(actionId, commandedBy, data, size);
|
2022-01-06 18:05:21 +01:00
|
|
|
}
|
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
void PlocMPSoCHandler::doStartUp() {
|
2022-01-03 08:01:55 +01:00
|
|
|
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
2022-03-22 11:35:44 +01:00
|
|
|
setMode(MODE_NORMAL);
|
2022-01-03 08:01:55 +01:00
|
|
|
#else
|
2022-03-22 11:35:44 +01:00
|
|
|
setMode(_MODE_TO_ON);
|
2022-01-03 08:01:55 +01:00
|
|
|
#endif
|
2021-03-29 14:37:52 +02:00
|
|
|
}
|
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
void PlocMPSoCHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
|
|
|
|
|
|
|
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
|
|
|
return NOTHING_TO_SEND;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t PlocMPSoCHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
|
|
|
const uint8_t* commandData,
|
|
|
|
size_t commandDataLen) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
switch (deviceCommand) {
|
|
|
|
case (mpsoc::TC_MEM_WRITE): {
|
|
|
|
result = prepareTcMemWrite(commandData, commandDataLen);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (mpsoc::TC_MEM_READ): {
|
|
|
|
result = prepareTcMemRead(commandData, commandDataLen);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (mpsoc::TC_FLASHDELETE): {
|
|
|
|
result = prepareTcFlashDelete(commandData, commandDataLen);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (mpsoc::TC_REPLAY_START): {
|
|
|
|
result = prepareTcReplayStart(commandData, commandDataLen);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (mpsoc::TC_REPLAY_STOP): {
|
|
|
|
result = prepareTcReplayStop();
|
|
|
|
break;
|
2022-01-03 08:01:55 +01:00
|
|
|
}
|
2022-03-22 11:35:44 +01:00
|
|
|
case (mpsoc::TC_DOWNLINK_PWR_ON): {
|
|
|
|
result = prepareTcDownlinkPwrOn(commandData, commandDataLen);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (mpsoc::TC_DOWNLINK_PWR_OFF): {
|
|
|
|
result = prepareTcDownlinkPwrOff();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (mpsoc::TC_REPLAY_WRITE_SEQUENCE): {
|
|
|
|
result = prepareTcReplayWriteSequence(commandData, commandDataLen);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented"
|
|
|
|
<< std::endl;
|
|
|
|
result = DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
|
|
|
break;
|
|
|
|
}
|
2022-01-03 08:01:55 +01:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
if (result == RETURN_OK) {
|
|
|
|
/**
|
|
|
|
* Flushing the receive buffer to make sure there are no data left from a faulty reply.
|
|
|
|
*/
|
|
|
|
uartComIf->flushUartRxBuffer(comCookie);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2021-03-29 14:37:52 +02:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
void PlocMPSoCHandler::fillCommandAndReplyMap() {
|
2022-03-22 11:35:44 +01:00
|
|
|
this->insertInCommandMap(mpsoc::TC_MEM_WRITE);
|
|
|
|
this->insertInCommandMap(mpsoc::TC_MEM_READ);
|
|
|
|
this->insertInCommandMap(mpsoc::TC_FLASHDELETE);
|
|
|
|
this->insertInCommandMap(mpsoc::TC_REPLAY_START);
|
|
|
|
this->insertInCommandMap(mpsoc::TC_REPLAY_STOP);
|
|
|
|
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_ON);
|
|
|
|
this->insertInCommandMap(mpsoc::TC_DOWNLINK_PWR_OFF);
|
|
|
|
this->insertInCommandMap(mpsoc::TC_REPLAY_WRITE_SEQUENCE);
|
|
|
|
this->insertInReplyMap(mpsoc::ACK_REPORT, 1, nullptr, mpsoc::SIZE_ACK_REPORT);
|
|
|
|
this->insertInReplyMap(mpsoc::EXE_REPORT, 3, nullptr, mpsoc::SIZE_EXE_REPORT);
|
|
|
|
this->insertInReplyMap(mpsoc::TM_MEMORY_READ_REPORT, 2, nullptr, mpsoc::SIZE_TM_MEM_READ_REPORT);
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
|
|
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
uint16_t apid = (*(start) << 8 | *(start + 1)) & APID_MASK;
|
|
|
|
|
|
|
|
switch (apid) {
|
|
|
|
case (mpsoc::apid::ACK_SUCCESS):
|
|
|
|
*foundLen = mpsoc::SIZE_ACK_REPORT;
|
|
|
|
*foundId = mpsoc::ACK_REPORT;
|
|
|
|
break;
|
|
|
|
case (mpsoc::apid::ACK_FAILURE):
|
|
|
|
*foundLen = mpsoc::SIZE_ACK_REPORT;
|
|
|
|
*foundId = mpsoc::ACK_REPORT;
|
|
|
|
break;
|
|
|
|
case (mpsoc::apid::TM_MEMORY_READ_REPORT):
|
|
|
|
*foundLen = tmMemReadReport.rememberRequestedSize;
|
|
|
|
*foundId = mpsoc::TM_MEMORY_READ_REPORT;
|
|
|
|
break;
|
|
|
|
case (mpsoc::apid::EXE_SUCCESS):
|
|
|
|
*foundLen = mpsoc::SIZE_EXE_REPORT;
|
|
|
|
*foundId = mpsoc::EXE_REPORT;
|
|
|
|
break;
|
|
|
|
case (mpsoc::apid::EXE_FAILURE):
|
|
|
|
*foundLen = mpsoc::SIZE_EXE_REPORT;
|
|
|
|
*foundId = mpsoc::EXE_REPORT;
|
|
|
|
break;
|
|
|
|
default: {
|
|
|
|
sif::debug << "PlocMPSoCHandler::scanForReply: Reply has invalid apid" << std::endl;
|
|
|
|
*foundLen = remainingSize;
|
|
|
|
return MPSoCReturnValuesIF::INVALID_APID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sequenceCount++;
|
|
|
|
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
|
|
|
|
if (recvSeqCnt != sequenceCount) {
|
|
|
|
triggerEvent(MPSOC_HANDLER_SEQ_CNT_MISMATCH, sequenceCount, recvSeqCnt);
|
|
|
|
sequenceCount = recvSeqCnt;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t PlocMPSoCHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
switch (id) {
|
2022-01-05 11:26:01 +01:00
|
|
|
case mpsoc::ACK_REPORT: {
|
2022-03-22 11:35:44 +01:00
|
|
|
result = handleAckReport(packet);
|
|
|
|
break;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
2022-01-05 11:26:01 +01:00
|
|
|
case (mpsoc::TM_MEMORY_READ_REPORT): {
|
2022-03-22 11:35:44 +01:00
|
|
|
result = handleMemoryReadReport(packet);
|
|
|
|
break;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
2022-01-05 11:26:01 +01:00
|
|
|
case (mpsoc::EXE_REPORT): {
|
2022-03-22 11:35:44 +01:00
|
|
|
result = handleExecutionReport(packet);
|
|
|
|
break;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
|
|
|
default: {
|
2022-03-22 11:35:44 +01:00
|
|
|
sif::debug << "PlocMPSoCHandler::interpretDeviceReply: Unknown device reply id" << std::endl;
|
|
|
|
return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
2022-03-22 11:35:44 +01:00
|
|
|
}
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
return result;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
void PlocMPSoCHandler::setNormalDatapoolEntriesInvalid() {}
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
uint32_t PlocMPSoCHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
ReturnValue_t PlocMPSoCHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
2022-03-22 11:35:44 +01:00
|
|
|
LocalDataPoolManager& poolManager) {
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
|
|
|
|
2022-01-07 09:50:04 +01:00
|
|
|
void PlocMPSoCHandler::handleEvent(EventMessage* eventMessage) {
|
2022-03-22 11:35:44 +01:00
|
|
|
object_id_t objectId = eventMessage->getReporter();
|
|
|
|
switch (objectId) {
|
2022-01-07 09:50:04 +01:00
|
|
|
case objects::PLOC_MPSOC_HELPER: {
|
2022-03-22 11:35:44 +01:00
|
|
|
plocMPSoCHelperExecuting = false;
|
|
|
|
break;
|
2022-01-07 09:50:04 +01:00
|
|
|
}
|
|
|
|
default:
|
2022-03-22 11:35:44 +01:00
|
|
|
sif::debug << "PlocMPSoCHandler::handleEvent: Did not subscribe to this event" << std::endl;
|
|
|
|
break;
|
|
|
|
}
|
2022-01-07 09:50:04 +01:00
|
|
|
}
|
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData,
|
|
|
|
size_t commandDataLen) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
sequenceCount++;
|
|
|
|
mpsoc::TcMemWrite tcMemWrite(sequenceCount);
|
|
|
|
result = tcMemWrite.createPacket(commandData, commandDataLen);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sequenceCount--;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
copyToCommandBuffer(&tcMemWrite);
|
|
|
|
return RETURN_OK;
|
2021-04-15 13:17:15 +02:00
|
|
|
}
|
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData,
|
|
|
|
size_t commandDataLen) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
sequenceCount++;
|
|
|
|
mpsoc::TcMemRead tcMemRead(sequenceCount);
|
|
|
|
result = tcMemRead.createPacket(commandData, commandDataLen);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sequenceCount--;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
copyToCommandBuffer(&tcMemRead);
|
|
|
|
tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE;
|
|
|
|
return RETURN_OK;
|
2022-03-21 08:35:28 +01:00
|
|
|
}
|
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData,
|
|
|
|
size_t commandDataLen) {
|
|
|
|
if (commandDataLen > config::MAX_PATH_SIZE + config::MAX_FILENAME_SIZE) {
|
|
|
|
return NAME_TOO_LONG;
|
|
|
|
}
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
sequenceCount++;
|
|
|
|
mpsoc::TcFlashDelete tcFlashDelete(sequenceCount);
|
|
|
|
result = tcFlashDelete.createPacket(
|
|
|
|
std::string(reinterpret_cast<const char*>(commandData), commandDataLen));
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sequenceCount--;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
copyToCommandBuffer(&tcFlashDelete);
|
|
|
|
return RETURN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData,
|
|
|
|
size_t commandDataLen) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
sequenceCount++;
|
|
|
|
mpsoc::TcReplayStart tcReplayStart(sequenceCount);
|
|
|
|
result = tcReplayStart.createPacket(commandData, commandDataLen);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sequenceCount--;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
copyToCommandBuffer(&tcReplayStart);
|
|
|
|
return RETURN_OK;
|
2022-03-21 11:05:41 +01:00
|
|
|
}
|
|
|
|
|
2022-03-21 16:21:51 +01:00
|
|
|
ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() {
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
sequenceCount++;
|
|
|
|
mpsoc::TcReplayStop tcReplayStop(sequenceCount);
|
|
|
|
result = tcReplayStop.createPacket();
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sequenceCount--;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
copyToCommandBuffer(&tcReplayStop);
|
|
|
|
return RETURN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandData,
|
|
|
|
size_t commandDataLen) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
sequenceCount++;
|
|
|
|
mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(sequenceCount);
|
|
|
|
result = tcDownlinkPwrOn.createPacket(commandData, commandDataLen);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sequenceCount--;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
copyToCommandBuffer(&tcDownlinkPwrOn);
|
|
|
|
return RETURN_OK;
|
2022-03-21 16:21:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() {
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
sequenceCount++;
|
|
|
|
mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(sequenceCount);
|
|
|
|
result = tcDownlinkPwrOff.createPacket();
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sequenceCount--;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
copyToCommandBuffer(&tcDownlinkPwrOff);
|
|
|
|
return RETURN_OK;
|
2022-03-21 16:21:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* commandData,
|
|
|
|
size_t commandDataLen) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
sequenceCount++;
|
|
|
|
mpsoc::TcReplayWriteSeq tcReplayWriteSeq(sequenceCount);
|
|
|
|
result = tcReplayWriteSeq.createPacket(commandData, commandDataLen);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sequenceCount--;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
copyToCommandBuffer(&tcReplayWriteSeq);
|
|
|
|
return RETURN_OK;
|
|
|
|
}
|
|
|
|
|
2022-01-05 11:26:01 +01:00
|
|
|
void PlocMPSoCHandler::copyToCommandBuffer(mpsoc::TcBase* tc) {
|
2022-03-22 11:35:44 +01:00
|
|
|
if (tc == nullptr) {
|
|
|
|
sif::debug << "PlocMPSoCHandler::copyToCommandBuffer: Invalid TC" << std::endl;
|
|
|
|
}
|
|
|
|
memcpy(commandBuffer, tc->getWholeData(), tc->getFullSize());
|
|
|
|
rawPacket = commandBuffer;
|
|
|
|
rawPacketLen = tc->getFullSize();
|
|
|
|
nextReplyId = mpsoc::ACK_REPORT;
|
2022-01-05 11:26:01 +01:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
ReturnValue_t PlocMPSoCHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
|
2022-03-22 11:35:44 +01:00
|
|
|
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
|
|
|
|
uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2);
|
|
|
|
if (receivedCrc != recalculatedCrc) {
|
|
|
|
return MPSoCReturnValuesIF::CRC_FAILURE;
|
|
|
|
}
|
|
|
|
return RETURN_OK;
|
2021-04-11 12:04:13 +02:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
ReturnValue_t PlocMPSoCHandler::handleAckReport(const uint8_t* data) {
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
2021-04-15 13:17:15 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
result = verifyPacket(data, mpsoc::SIZE_ACK_REPORT);
|
|
|
|
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
|
|
|
sif::error << "PlocMPSoCHandler::handleAckReport: CRC failure" << std::endl;
|
|
|
|
nextReplyId = mpsoc::NONE;
|
|
|
|
replyRawReplyIfnotWiretapped(data, mpsoc::SIZE_ACK_REPORT);
|
|
|
|
triggerEvent(MPSOC_HANDLER_CRC_FAILURE);
|
|
|
|
sendFailureReport(mpsoc::ACK_REPORT, MPSoCReturnValuesIF::CRC_FAILURE);
|
|
|
|
disableAllReplies();
|
|
|
|
return IGNORE_REPLY_DATA;
|
|
|
|
}
|
2021-04-15 13:17:15 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK;
|
|
|
|
|
|
|
|
switch (apid) {
|
|
|
|
case mpsoc::apid::ACK_FAILURE: {
|
|
|
|
// TODO: Interpretation of status field in acknowledgment report
|
|
|
|
sif::debug << "PlocMPSoCHandler::handleAckReport: Received Ack failure report" << std::endl;
|
|
|
|
DeviceCommandId_t commandId = getPendingCommand();
|
|
|
|
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
|
|
|
triggerEvent(ACK_FAILURE, commandId);
|
|
|
|
}
|
|
|
|
sendFailureReport(mpsoc::ACK_REPORT, MPSoCReturnValuesIF::RECEIVED_ACK_FAILURE);
|
|
|
|
disableAllReplies();
|
|
|
|
nextReplyId = mpsoc::NONE;
|
|
|
|
result = IGNORE_REPLY_DATA;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case mpsoc::apid::ACK_SUCCESS: {
|
|
|
|
setNextReplyId();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
sif::debug << "PlocMPSoCHandler::handleAckReport: Invalid APID in Ack report" << std::endl;
|
|
|
|
result = RETURN_FAILED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-03-29 14:37:52 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
return result;
|
2021-03-29 14:37:52 +02:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
2021-04-15 13:17:15 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
result = verifyPacket(data, mpsoc::SIZE_EXE_REPORT);
|
|
|
|
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
|
|
|
sif::error << "PlocMPSoCHandler::handleExecutionReport: CRC failure" << std::endl;
|
|
|
|
nextReplyId = mpsoc::NONE;
|
|
|
|
return result;
|
|
|
|
}
|
2021-04-11 12:04:13 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK;
|
2021-04-11 12:04:13 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
switch (apid) {
|
2022-01-05 11:26:01 +01:00
|
|
|
case (mpsoc::apid::EXE_SUCCESS): {
|
2022-03-22 11:35:44 +01:00
|
|
|
break;
|
2021-04-11 12:04:13 +02:00
|
|
|
}
|
2022-01-05 11:26:01 +01:00
|
|
|
case (mpsoc::apid::EXE_FAILURE): {
|
2022-03-22 11:35:44 +01:00
|
|
|
// TODO: Interpretation of status field in execution report
|
|
|
|
sif::error << "PlocMPSoCHandler::handleExecutionReport: Received execution failure report"
|
|
|
|
<< std::endl;
|
|
|
|
DeviceCommandId_t commandId = getPendingCommand();
|
|
|
|
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
|
|
|
triggerEvent(EXE_FAILURE, commandId);
|
|
|
|
} else {
|
|
|
|
sif::debug << "PlocMPSoCHandler::handleExecutionReport: Unknown command id" << std::endl;
|
|
|
|
}
|
|
|
|
sendFailureReport(mpsoc::EXE_REPORT, MPSoCReturnValuesIF::RECEIVED_EXE_FAILURE);
|
|
|
|
disableExeReportReply();
|
|
|
|
result = IGNORE_REPLY_DATA;
|
|
|
|
break;
|
2021-04-11 12:04:13 +02:00
|
|
|
}
|
2021-04-22 17:32:39 +02:00
|
|
|
default: {
|
2022-03-22 11:35:44 +01:00
|
|
|
sif::error << "PlocMPSoCHandler::handleExecutionReport: Unknown APID" << std::endl;
|
|
|
|
result = RETURN_FAILED;
|
|
|
|
break;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
2022-03-22 11:35:44 +01:00
|
|
|
}
|
|
|
|
nextReplyId = mpsoc::NONE;
|
|
|
|
return result;
|
2021-04-11 12:04:13 +02:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
ReturnValue_t PlocMPSoCHandler::handleMemoryReadReport(const uint8_t* data) {
|
2022-03-22 11:35:44 +01:00
|
|
|
ReturnValue_t result = RETURN_OK;
|
|
|
|
result = verifyPacket(data, tmMemReadReport.rememberRequestedSize);
|
|
|
|
if (result == MPSoCReturnValuesIF::CRC_FAILURE) {
|
|
|
|
sif::error << "PlocMPSoCHandler::handleMemoryReadReport: Memory read report has invalid crc"
|
|
|
|
<< std::endl;
|
|
|
|
}
|
|
|
|
uint16_t memLen =
|
|
|
|
*(data + mpsoc::MEM_READ_RPT_LEN_OFFSET) << 8 | *(data + mpsoc::MEM_READ_RPT_LEN_OFFSET + 1);
|
|
|
|
/** Send data to commanding queue */
|
|
|
|
handleDeviceTM(data + mpsoc::DATA_FIELD_OFFSET, mpsoc::SIZE_MEM_READ_RPT_FIX + memLen * 4,
|
|
|
|
mpsoc::TM_MEMORY_READ_REPORT);
|
|
|
|
nextReplyId = mpsoc::EXE_REPORT;
|
|
|
|
return result;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
ReturnValue_t PlocMPSoCHandler::enableReplyInReplyMap(DeviceCommandMap::iterator command,
|
2022-03-22 11:35:44 +01:00
|
|
|
uint8_t expectedReplies, bool useAlternateId,
|
|
|
|
DeviceCommandId_t alternateReplyID) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
uint8_t enabledReplies = 0;
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
switch (command->first) {
|
2022-01-05 11:26:01 +01:00
|
|
|
case mpsoc::TC_MEM_WRITE:
|
2022-03-21 08:35:28 +01:00
|
|
|
case mpsoc::TC_FLASHDELETE:
|
2022-03-21 16:21:51 +01:00
|
|
|
case mpsoc::TC_REPLAY_START:
|
|
|
|
case mpsoc::TC_REPLAY_STOP:
|
|
|
|
case mpsoc::TC_DOWNLINK_PWR_ON:
|
|
|
|
case mpsoc::TC_DOWNLINK_PWR_OFF:
|
|
|
|
case mpsoc::TC_REPLAY_WRITE_SEQUENCE:
|
2022-03-22 11:35:44 +01:00
|
|
|
enabledReplies = 2;
|
|
|
|
break;
|
2022-01-05 11:26:01 +01:00
|
|
|
case mpsoc::TC_MEM_READ: {
|
2022-03-22 11:35:44 +01:00
|
|
|
enabledReplies = 3;
|
|
|
|
result = DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true,
|
|
|
|
mpsoc::TM_MEMORY_READ_REPORT);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id "
|
|
|
|
<< mpsoc::TM_MEMORY_READ_REPORT << " not in replyMap" << std::endl;
|
|
|
|
}
|
|
|
|
break;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
|
|
|
default:
|
2022-03-22 11:35:44 +01:00
|
|
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown command id" << std::endl;
|
|
|
|
break;
|
|
|
|
}
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
/**
|
|
|
|
* Every command causes at least one acknowledgment and one execution report. Therefore both
|
|
|
|
* replies will be enabled here.
|
|
|
|
*/
|
|
|
|
result =
|
|
|
|
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::ACK_REPORT);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::ACK_REPORT
|
|
|
|
<< " not in replyMap" << std::endl;
|
|
|
|
}
|
2021-04-11 12:04:13 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
result =
|
|
|
|
DeviceHandlerBase::enableReplyInReplyMap(command, enabledReplies, true, mpsoc::EXE_REPORT);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Reply with id " << mpsoc::EXE_REPORT
|
|
|
|
<< " not in replyMap" << std::endl;
|
|
|
|
}
|
2021-04-11 12:04:13 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
switch (command->first) {
|
2022-03-21 16:21:51 +01:00
|
|
|
case mpsoc::TC_REPLAY_WRITE_SEQUENCE: {
|
2022-03-22 11:35:44 +01:00
|
|
|
DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT);
|
|
|
|
if (iter != deviceReplyMap.end()) {
|
|
|
|
// Overwrite delay cycles because replay write sequence command can required up to
|
|
|
|
// 30 seconds for execution
|
|
|
|
iter->second.delayCycles = mpsoc::TC_WRITE_SEQ_EXECUTION_DELAY;
|
|
|
|
} else {
|
|
|
|
sif::debug << "PlocMPSoCHandler::enableReplyInReplyMap: Unknown reply id" << std::endl;
|
|
|
|
}
|
|
|
|
break;
|
2022-03-21 16:21:51 +01:00
|
|
|
}
|
|
|
|
default:
|
2022-03-22 11:35:44 +01:00
|
|
|
break;
|
|
|
|
}
|
2022-03-21 16:21:51 +01:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
return RETURN_OK;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
void PlocMPSoCHandler::setNextReplyId() {
|
2022-03-22 11:35:44 +01:00
|
|
|
switch (getPendingCommand()) {
|
2022-01-05 11:26:01 +01:00
|
|
|
case mpsoc::TC_MEM_READ:
|
2022-03-22 11:35:44 +01:00
|
|
|
nextReplyId = mpsoc::TM_MEMORY_READ_REPORT;
|
|
|
|
break;
|
2021-04-22 17:32:39 +02:00
|
|
|
default:
|
2022-03-22 11:35:44 +01:00
|
|
|
/* If no telemetry is expected the next reply is always the execution report */
|
|
|
|
nextReplyId = mpsoc::EXE_REPORT;
|
|
|
|
break;
|
|
|
|
}
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
2022-03-22 11:35:44 +01:00
|
|
|
size_t PlocMPSoCHandler::getNextReplyLength(DeviceCommandId_t commandId) {
|
|
|
|
size_t replyLen = 0;
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
if (nextReplyId == mpsoc::NONE) {
|
|
|
|
return replyLen;
|
|
|
|
}
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
DeviceReplyIter iter = deviceReplyMap.find(nextReplyId);
|
2021-04-11 12:04:13 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
if (iter != deviceReplyMap.end()) {
|
|
|
|
if (iter->second.delayCycles == 0) {
|
|
|
|
/* Reply inactive */
|
|
|
|
return replyLen;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
2022-03-22 11:35:44 +01:00
|
|
|
switch (nextReplyId) {
|
|
|
|
case mpsoc::TM_MEMORY_READ_REPORT: {
|
|
|
|
replyLen = tmMemReadReport.rememberRequestedSize;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
replyLen = iter->second.replyLen;
|
|
|
|
break;
|
|
|
|
}
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
2022-03-22 11:35:44 +01:00
|
|
|
} else {
|
|
|
|
sif::debug << "PlocMPSoCHandler::getNextReplyLength: No entry for reply with reply id "
|
|
|
|
<< std::hex << nextReplyId << " in deviceReplyMap" << std::endl;
|
|
|
|
}
|
2021-04-11 12:04:13 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
return replyLen;
|
2021-04-11 12:04:13 +02:00
|
|
|
}
|
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
void PlocMPSoCHandler::handleDeviceTM(const uint8_t* data, size_t dataSize,
|
|
|
|
DeviceCommandId_t replyId) {
|
|
|
|
ReturnValue_t result = RETURN_OK;
|
2021-04-11 12:04:13 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
if (wiretappingMode == RAW) {
|
|
|
|
/* Data already sent in doGetRead() */
|
|
|
|
return;
|
|
|
|
}
|
2021-04-25 15:54:48 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId);
|
|
|
|
if (iter == deviceReplyMap.end()) {
|
|
|
|
sif::debug << "PlocMPSoCHandler::handleDeviceTM: Unknown reply id" << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
MessageQueueId_t queueId = iter->second.command->second.sendReplyTo;
|
2021-04-11 12:04:13 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
if (queueId == NO_COMMANDER) {
|
|
|
|
return;
|
|
|
|
}
|
2021-04-11 12:04:13 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
result = actionHelper.reportData(queueId, replyId, data, dataSize);
|
|
|
|
if (result != RETURN_OK) {
|
|
|
|
sif::debug << "PlocMPSoCHandler::handleDeviceTM: Failed to report data" << std::endl;
|
|
|
|
}
|
2021-03-29 14:37:52 +02:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
void PlocMPSoCHandler::disableAllReplies() {
|
2022-03-22 11:35:44 +01:00
|
|
|
DeviceReplyMap::iterator iter;
|
2021-03-29 14:37:52 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
/* Disable ack reply */
|
|
|
|
iter = deviceReplyMap.find(mpsoc::ACK_REPORT);
|
|
|
|
DeviceReplyInfo* info = &(iter->second);
|
|
|
|
info->delayCycles = 0;
|
|
|
|
info->command = deviceCommandMap.end();
|
2021-03-29 14:37:52 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
DeviceCommandId_t commandId = getPendingCommand();
|
2021-03-29 14:37:52 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
/* If the command expects a telemetry packet the appropriate tm reply will be disabled here */
|
|
|
|
switch (commandId) {
|
2022-01-05 11:26:01 +01:00
|
|
|
case mpsoc::TC_MEM_WRITE:
|
2022-03-22 11:35:44 +01:00
|
|
|
break;
|
2022-01-05 11:26:01 +01:00
|
|
|
case mpsoc::TC_MEM_READ: {
|
2022-03-22 11:35:44 +01:00
|
|
|
iter = deviceReplyMap.find(mpsoc::TM_MEMORY_READ_REPORT);
|
|
|
|
info = &(iter->second);
|
|
|
|
info->delayCycles = 0;
|
|
|
|
info->command = deviceCommandMap.end();
|
|
|
|
break;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
|
|
|
default: {
|
2022-03-22 11:35:44 +01:00
|
|
|
sif::debug << "PlocMPSoCHandler::disableAllReplies: Unknown command id" << commandId
|
|
|
|
<< std::endl;
|
|
|
|
break;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|
2022-03-22 11:35:44 +01:00
|
|
|
}
|
2021-04-22 17:32:39 +02:00
|
|
|
|
2022-03-22 11:35:44 +01:00
|
|
|
/* We must always disable the execution report reply here */
|
|
|
|
disableExeReportReply();
|
2021-03-29 14:37:52 +02:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
void PlocMPSoCHandler::sendFailureReport(DeviceCommandId_t replyId, ReturnValue_t status) {
|
2022-03-22 11:35:44 +01:00
|
|
|
DeviceReplyIter iter = deviceReplyMap.find(replyId);
|
|
|
|
if (iter == deviceReplyMap.end()) {
|
|
|
|
sif::debug << "PlocMPSoCHandler::sendFailureReport: Reply not in reply map" << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
DeviceCommandInfo* info = &(iter->second.command->second);
|
|
|
|
if (info == nullptr) {
|
|
|
|
sif::debug << "PlocMPSoCHandler::sendFailureReport: Reply has no active command" << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (info->sendReplyTo != NO_COMMANDER) {
|
|
|
|
actionHelper.finish(false, info->sendReplyTo, iter->first, status);
|
|
|
|
}
|
|
|
|
info->isExecuting = false;
|
2021-03-29 14:37:52 +02:00
|
|
|
}
|
|
|
|
|
2021-07-13 08:32:14 +02:00
|
|
|
void PlocMPSoCHandler::disableExeReportReply() {
|
2022-03-22 11:35:44 +01:00
|
|
|
DeviceReplyIter iter = deviceReplyMap.find(mpsoc::EXE_REPORT);
|
|
|
|
DeviceReplyInfo* info = &(iter->second);
|
|
|
|
info->delayCycles = 0;
|
|
|
|
info->command = deviceCommandMap.end();
|
|
|
|
/* Expected replies is set to one here. The value will set to 0 in replyToReply() */
|
|
|
|
info->command->second.expectedReplies = 0;
|
2021-04-22 17:32:39 +02:00
|
|
|
}
|