#include "FreshMpsocHandler.h" #include "OBSWConfig.h" #include "eive/objects.h" #include "fsfw/action/CommandActionHelper.h" #include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/devicehandlers/DeviceHandlerIF.h" #include "fsfw/devicehandlers/FreshDeviceHandlerBase.h" #include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/messageQueueDefinitions.h" #include "fsfw/power/PowerSwitchIF.h" #include "fsfw/power/definitions.h" #include "fsfw/returnvalues/returnvalue.h" #include "fsfw/serialize/SerializeAdapter.h" #include "linux/payload/MpsocCommunication.h" #include "linux/payload/plocMpsocHelpers.h" #include "linux/payload/plocSupvDefs.h" #include "mission/power/gsDefs.h" FreshMpsocHandler::FreshMpsocHandler(DhbConfig cfg, MpsocCommunication& comInterface, PlocMpsocSpecialComHelper& specialComHelper, Gpio uartIsolatorSwitch, object_id_t supervisorHandler, PowerSwitchIF& powerSwitcher, power::Switch_t camSwitchId) : FreshDeviceHandlerBase(cfg), comInterface(comInterface), specialComHelper(specialComHelper), commandActionHelper(this), uartIsolatorSwitch(uartIsolatorSwitch), hkReport(this), supervisorHandler(supervisorHandler), powerSwitcher(powerSwitcher), camSwitchId(camSwitchId) { commandActionHelperQueue = QueueFactory::instance()->createMessageQueue(10); eventQueue = QueueFactory::instance()->createMessageQueue(10); spParams.maxSize = sizeof(commandBuffer); spParams.buf = commandBuffer; } void FreshMpsocHandler::performDeviceOperation(uint8_t opCode) { if (transitionState == TransitionState::NONE and (mode == MODE_OFF or mode == MODE_UNDEFINED)) { // Nothing to do for now. return; } if (opCode == OpCode::DEFAULT_OPERATION) { performDefaultDeviceOperation(); } else if (opCode == OpCode::PARSE_TM and not specialComHelperExecuting) { // Just need to call this once, this should take care of processing the whole received // Linux UART RX buffer. comInterface.readSerialInterface(); // Handle all received packets. while (true) { ReturnValue_t result = comInterface.parseAndRetrieveNextPacket(); if (result == MpsocCommunication::PACKET_RECEIVED) { handleDeviceReply(); continue; } break; } } } void FreshMpsocHandler::performDefaultDeviceOperation() { if (transitionState != TransitionState::NONE) { if (transitionState == TransitionState::TO_ON) { handleTransitionToOn(); } else if (transitionState == TransitionState::TO_OFF) { handleTransitionToOff(); } else if (transitionState == TransitionState::SUBMODE) { if (!activeCmdInfo.pending) { commandSubmodeTransition(); } } else { // This should never happen. sif::error << "FreshMpsocHandler: Invalid transition mode: " << targetMode << std::endl; targetMode = MODE_OFF; targetSubmode = 0; handleTransitionToOff(); } if (modeHelper.isTimedOut()) { // Set old mode and submode. setMode(mode, submode); } } // We checked the action queue beforehand, so action commands should always be performed // before normal commands. if (mode == MODE_NORMAL and not activeCmdInfo.pending and not specialComHelperExecuting) { ReturnValue_t result = commandTcGetHkReport(); if (result == returnvalue::OK) { commandInitHandling(mpsoc::TC_GET_HK_REPORT, MessageQueueIF::NO_QUEUE); } } if (activeCmdInfo.pending and activeCmdInfo.cmdCountdown.hasTimedOut()) { sif::warning << "PlocMpsocHandler: Command " << activeCmdInfo.pendingCmd << " has timed out" << std::endl; cmdDoneHandler(false, mpsoc::COMMAND_TIMEOUT); } EventMessage event; for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::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; } } CommandMessage message; for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message); result == returnvalue::OK; result = commandActionHelperQueue->receiveMessage(&message)) { result = commandActionHelper.handleReply(&message); if (result == returnvalue::OK) { continue; } } } ReturnValue_t FreshMpsocHandler::handleCommandMessage(CommandMessage* message) { return returnvalue::FAILED; } ReturnValue_t FreshMpsocHandler::initialize() { ReturnValue_t result = FreshDeviceHandlerBase::initialize(); if (result != returnvalue::OK) { return result; } EventManagerIF* manager = ObjectManager::instance()->get(objects::EVENT_MANAGER); if (manager == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "PlocMPSoCHandler::initialize: Invalid event manager" << std::endl; #endif return ObjectManagerIF::CHILD_INIT_FAILED; ; } result = manager->registerListener(eventQueue->getId()); if (result != returnvalue::OK) { return result; } result = manager->subscribeToEvent( eventQueue->getId(), event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_WRITE_FAILED)); if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } result = manager->subscribeToEvent( eventQueue->getId(), event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_WRITE_SUCCESSFUL)); if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } result = manager->subscribeToEvent( eventQueue->getId(), event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_READ_SUCCESSFUL)); if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } result = manager->subscribeToEvent( eventQueue->getId(), event::getEventId(PlocMpsocSpecialComHelper::MPSOC_FLASH_READ_FAILED)); if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } result = commandActionHelper.initialize(); if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; } return result; } // HK manager abstract functions. LocalPoolDataSetBase* FreshMpsocHandler::getDataSetHandle(sid_t sid) { if (sid == hkReport.getSid()) { return &hkReport; } return nullptr; } ReturnValue_t FreshMpsocHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) { localDataPoolMap.emplace(mpsoc::poolid::STATUS, &peStatus); localDataPoolMap.emplace(mpsoc::poolid::MODE, &peMode); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_PWR_ON, &peDownlinkPwrOn); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_REPLY_ACTIIVE, &peDownlinkReplyActive); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_JESD_SYNC_STATUS, &peDownlinkJesdSyncStatus); localDataPoolMap.emplace(mpsoc::poolid::DOWNLINK_DAC_STATUS, &peDownlinkDacStatus); localDataPoolMap.emplace(mpsoc::poolid::CAM_STATUS, &peCameraStatus); localDataPoolMap.emplace(mpsoc::poolid::CAM_SDI_STATUS, &peCameraSdiStatus); localDataPoolMap.emplace(mpsoc::poolid::CAM_FPGA_TEMP, &peCameraFpgaTemp); localDataPoolMap.emplace(mpsoc::poolid::CAM_SOC_TEMP, &peCameraSocTemp); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_TEMP, &peSysmonTemp); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCINT, &peSysmonVccInt); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCAUX, &peSysmonVccAux); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCBRAM, &peSysmonVccBram); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCPAUX, &peSysmonVccPaux); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCPINT, &peSysmonVccPint); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCCPDRO, &peSysmonVccPdro); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB12V, &peSysmonMb12V); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB3V3, &peSysmonMb3V3); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_MB1V8, &peSysmonMb1V8); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC12V, &peSysmonVcc12V); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC5V, &peSysmonVcc5V); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3, &peSysmonVcc3V3); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC3V3VA, &peSysmonVcc3V3VA); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC2V5DDR, &peSysmonVcc2V5DDR); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC1V2DDR, &peSysmonVcc1V2DDR); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC0V9, &peSysmonVcc0V9); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_VCC0V6VTT, &peSysmonVcc0V6VTT); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_SAFE_COTS_CUR, &peSysmonSafeCotsCur); localDataPoolMap.emplace(mpsoc::poolid::SYSMON_NVM4_XO_CUR, &peSysmonNvm4XoCur); localDataPoolMap.emplace(mpsoc::poolid::SEM_UNCORRECTABLE_ERRS, &peSemUncorrectableErrs); localDataPoolMap.emplace(mpsoc::poolid::SEM_CORRECTABLE_ERRS, &peSemCorrectableErrs); localDataPoolMap.emplace(mpsoc::poolid::SEM_STATUS, &peSemStatus); localDataPoolMap.emplace(mpsoc::poolid::REBOOT_MPSOC_REQUIRED, &peRebootMpsocRequired); poolManager.subscribeForRegularPeriodicPacket( subdp::RegularHkPeriodicParams(hkReport.getSid(), false, 10.0)); return returnvalue::OK; } // Mode abstract functions ReturnValue_t FreshMpsocHandler::checkModeCommand(Mode_t mode, Submode_t submode, uint32_t* msToReachTheMode) { if (this->mode == MODE_OFF or this->mode == MODE_UNDEFINED) { // Device needs to be commanded to ON or NORMAL first before commanding submode. if (submode != mpsoc::Submode::IDLE_OR_NONE) { return HasModesIF::INVALID_SUBMODE; } } if (mode == MODE_ON or mode == MODE_NORMAL) { if (submode != mpsoc::Submode::IDLE_OR_NONE && submode != mpsoc::Submode::REPLAY && submode != mpsoc::Submode::SNAPSHOT) { return HasModesIF::INVALID_SUBMODE; } } if (submode == mpsoc::Submode::SNAPSHOT and powerSwitcher.getSwitchState(camSwitchId) != PowerSwitchIF::SWITCH_ON) { triggerEvent(mpsoc::CAM_MUST_BE_ON_FOR_SNAPSHOT_MODE); return HasModesIF::TRANS_NOT_ALLOWED; } *msToReachTheMode = MPSOC_MODE_CMD_TIMEOUT_MS; return returnvalue::OK; } // Action override. Forward to user. ReturnValue_t FreshMpsocHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { ReturnValue_t result = returnvalue::OK; switch (actionId) { case mpsoc::SET_UART_TX_TRISTATE: { uartIsolatorSwitch.pullLow(); return EXECUTION_FINISHED; break; } case mpsoc::RELEASE_UART_TX: { uartIsolatorSwitch.pullHigh(); return EXECUTION_FINISHED; break; default: break; } } if (specialComHelperExecuting) { return mpsoc::MPSOC_HELPER_EXECUTING; } // We do not accept the rest of the commands if we are not on. if (mode != MODE_ON && mode != MODE_NORMAL) { return HasModesIF::INVALID_MODE; } switch (actionId) { case mpsoc::TC_FLASH_WRITE_FULL_FILE: { mpsoc::FlashBasePusCmd flashWritePusCmd; result = flashWritePusCmd.extractFields(data, size); if (result != returnvalue::OK) { return result; } result = specialComHelper.startFlashWrite(flashWritePusCmd.getObcFile(), flashWritePusCmd.getMpsocFile()); if (result != returnvalue::OK) { return result; } commonSpecialComInit(); return EXECUTION_FINISHED; } case mpsoc::TC_FLASH_READ_FULL_FILE: { mpsoc::FlashReadPusCmd flashReadPusCmd; result = flashReadPusCmd.extractFields(data, size); if (result != returnvalue::OK) { return result; } result = specialComHelper.startFlashRead(flashReadPusCmd.getObcFile(), flashReadPusCmd.getMpsocFile(), flashReadPusCmd.getReadSize()); if (result != returnvalue::OK) { return result; } sif::info << "PLOC MPSoC: Reading " << flashReadPusCmd.getMpsocFile() << " with size " << flashReadPusCmd.getReadSize() << " to " << flashReadPusCmd.getObcFile() << std::endl; commonSpecialComInit(); return EXECUTION_FINISHED; } case (mpsoc::OBSW_RESET_SEQ_COUNT_LEGACY): { commandSequenceCount = 0; return EXECUTION_FINISHED; } default: break; } executeRegularCmd(actionId, commandedBy, data, size); return returnvalue::OK; } void FreshMpsocHandler::commonSpecialComInit() { specialComHelperExecuting = true; specialComHelper.setCommandSequenceCount(commandSequenceCount.get()); } /** * @overload * @param submode */ void FreshMpsocHandler::startTransition(Mode_t newMode, Submode_t submode) { // OFF commands are always accepted. Otherwise, ignore transition requests. if (transitionState != TransitionState::NONE && newMode != HasModesIF::MODE_OFF) { return; } // We are already on and only a submode change is commanded. if ((mode == MODE_ON or mode == MODE_NORMAL) && (newMode == MODE_ON or newMode == MODE_NORMAL)) { transitionState = TransitionState::SUBMODE; } else if ((newMode == MODE_ON or newMode == MODE_NORMAL) && ((mode == MODE_OFF) or (mode == MODE_UNDEFINED))) { transitionState = TransitionState::TO_ON; } else if (mode == MODE_ON && newMode == MODE_NORMAL) { hkReport.setReportingEnabled(true); } else if (mode == MODE_NORMAL && newMode == MODE_ON) { hkReport.setReportingEnabled(false); } else if (newMode == MODE_OFF) { transitionState = TransitionState::TO_OFF; } targetMode = newMode; targetSubmode = submode; } ReturnValue_t FreshMpsocHandler::performDeviceOperationPreQueueHandling(uint8_t opCode) { return returnvalue::OK; } void FreshMpsocHandler::commandSubmodeTransition() { if (targetSubmode == mpsoc::Submode::IDLE_OR_NONE) { commandTcModeIdle(); } else if (targetSubmode == mpsoc::Submode::SNAPSHOT) { commandTcModeSnapshot(); } else if (targetSubmode == mpsoc::Submode::REPLAY) { commandTcModeReplay(); } else { sif::error << "FreshMpsocHandler::handleTransitionToOn: Invalid submode" << std::endl; } } void FreshMpsocHandler::handleTransitionToOn() { if (startupState == StartupState::IDLE) { startupState = StartupState::HW_INIT; } if (startupState == StartupState::HW_INIT) { if (handleHwStartup()) { startupState = StartupState::DONE; } } if (startupState == StartupState::DONE) { setMode(targetMode, targetSubmode); transitionState = TransitionState::NONE; if (targetMode == MODE_NORMAL) { hkReport.setReportingEnabled(true); } powerState = PowerState::IDLE; startupState = StartupState::IDLE; } } void FreshMpsocHandler::handleTransitionToOff() { if (handleHwShutdown()) { hkReport.setReportingEnabled(false); setMode(MODE_OFF, 0); transitionState = TransitionState::NONE; activeCmdInfo.reset(); powerState = PowerState::IDLE; startupState = StartupState::IDLE; } } MessageQueueIF* FreshMpsocHandler::getCommandQueuePtr() { return commandActionHelperQueue; } void FreshMpsocHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) { return; } void FreshMpsocHandler::stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) { switch (actionId) { case supv::START_MPSOC: { sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to start MPSoC" << std::endl; break; } case supv::SHUTDOWN_MPSOC: { triggerEvent(mpsoc::MPSOC_SHUTDOWN_FAILED); sif::warning << "PlocMPSoCHandler::stepFailedReceived: Failed to shutdown MPSoC" << std::endl; break; } default: sif::debug << "PlocMPSoCHandler::stepFailedReceived: Received unexpected action reply" << std::endl; break; } powerState = PowerState::SUPV_FAILED; } void FreshMpsocHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) { return; } void FreshMpsocHandler::completionSuccessfulReceived(ActionId_t actionId) { switch (powerState) { case PowerState::PENDING_STARTUP: { if (actionId != supv::START_MPSOC) { return; } mpsocBootTransitionCd.resetTimer(); powerState = PowerState::DONE; break; } case PowerState::PENDING_SHUTDOWN: { if (actionId != supv::SHUTDOWN_MPSOC) { return; } powerState = PowerState::DONE; break; } default: { break; } } } void FreshMpsocHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) { handleActionCommandFailure(actionId, returnCode); } void FreshMpsocHandler::handleActionCommandFailure(ActionId_t actionId, ReturnValue_t returnCode) { switch (powerState) { case PowerState::PENDING_STARTUP: { if (actionId != supv::START_MPSOC) { return; } sif::info << "FreshMpsocHandler::handleActionCommandFailure: MPSoC boot command failed" << std::endl; // This is commonly the case when the MPSoC is already operational. Thus the power state is // set to on here break; } case PowerState::PENDING_SHUTDOWN: { // FDIR will intercept event and switch PLOC power off triggerEvent(mpsoc::MPSOC_SHUTDOWN_FAILED); if (actionId != supv::SHUTDOWN_MPSOC) { return; } sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC" << std::endl; break; } default: break; } powerState = PowerState::SUPV_FAILED; return; } ReturnValue_t FreshMpsocHandler::executeRegularCmd(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result; switch (actionId) { case (mpsoc::TC_MEM_WRITE): { result = commandTcMemWrite(commandData, commandDataLen); break; } case (mpsoc::TC_VERIFY_BOOT): { uint8_t cmdDataForDeadbeefCheck[6]{}; size_t serLen = 0; uint16_t wordLen = 1; SerializeAdapter::serialize(&mpsoc::DEADBEEF_ADDR, cmdDataForDeadbeefCheck, &serLen, 4, SerializeIF::Endianness::NETWORK); SerializeAdapter::serialize(&wordLen, cmdDataForDeadbeefCheck + 4, &serLen, 2, SerializeIF::Endianness::NETWORK); result = commandTcMemRead(cmdDataForDeadbeefCheck, 6); break; } case (mpsoc::TC_MEM_READ): { result = commandTcMemRead(commandData, commandDataLen); break; } case (mpsoc::TC_FLASHFOPEN): { mpsoc::TcFlashFopen cmd(spParams, commandSequenceCount); // C string constructor. std::string filename = std::string(reinterpret_cast(commandData)); if (filename.size() > mpsoc::MAX_FILENAME_SIZE) { return mpsoc::NAME_TOO_LONG; } uint8_t mode = commandData[filename.size() + 2]; cmd.setPayload(filename, mode); result = finishAndSendTc(actionId, cmd); break; } case (mpsoc::TC_FLASHFCLOSE): { mpsoc::TcFlashFclose cmd(spParams, commandSequenceCount); result = finishAndSendTc(actionId, cmd); break; } case (mpsoc::TC_FLASHDELETE): { result = commandTcFlashDelete(commandData, commandDataLen); break; } case (mpsoc::TC_REPLAY_START): { result = commandTcReplayStart(commandData, commandDataLen); break; } case (mpsoc::TC_REPLAY_STOP): { result = commandTcReplayStop(); break; } case (mpsoc::TC_DOWNLINK_PWR_ON): { result = commandTcDownlinkPwrOn(commandData, commandDataLen); break; } case (mpsoc::TC_DOWNLINK_PWR_OFF): { result = commandTcDownlinkPwrOff(); break; } case (mpsoc::TC_REPLAY_WRITE_SEQUENCE): { result = commandTcReplayWriteSequence(commandData, commandDataLen); break; } case (mpsoc::TC_ENABLE_TC_EXECTION): { mpsoc::TcEnableTcExec cmd(spParams, commandSequenceCount); result = cmd.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } result = finishAndSendTc(actionId, cmd); break; } case (mpsoc::TC_FLASH_MKFS): { if (commandDataLen != 1) { return HasActionsIF::INVALID_PARAMETERS; } if (commandData[0] != mpsoc::FlashId::FLASH_0 && commandData[1] != mpsoc::FlashId::FLASH_1) { return HasActionsIF::INVALID_PARAMETERS; } mpsoc::TcFlashMkfs cmd(spParams, commandSequenceCount, static_cast(commandData[0])); sif::info << "PLOC MPSoC: Formatting Flash " << (int)commandData[0] << std::endl; result = finishAndSendTc(actionId, cmd, mpsoc::CMD_TIMEOUT_MKFS); break; } case (mpsoc::TC_GET_HK_REPORT): { result = commandTcGetHkReport(); break; } case (mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT): { result = commandTcGetDirContent(commandData, commandDataLen); break; } case (mpsoc::TC_CAM_CMD_SEND): { result = commandTcCamCmdSend(commandData, commandDataLen); break; } case (mpsoc::TC_CAM_TAKE_PIC): { result = commandTcCamTakePic(commandData, commandDataLen); break; } case (mpsoc::TC_SIMPLEX_STREAM_FILE): { if (submode != mpsoc::Submode::SNAPSHOT) { return HasModesIF::INVALID_SUBMODE; } result = commandTcSimplexStreamFile(commandData, commandDataLen); break; } case (mpsoc::TC_SPLIT_FILE): { result = commandTcSplitFile(commandData, commandDataLen); break; } case (mpsoc::TC_DOWNLINK_DATA_MODULATE): { result = commandTcDownlinkDataModulate(commandData, commandDataLen); break; } default: sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented" << std::endl; result = DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; break; } if (result == returnvalue::OK) { commandInitHandling(actionId, commandedBy); } return result; } void FreshMpsocHandler::commandInitHandling(ActionId_t actionId, MessageQueueId_t commandedBy) { activeCmdInfo.start(actionId, commandedBy); /** * Flushing the receive buffer to make sure there are no data left from a faulty reply. */ comInterface.getComHelper().flushUartRxBuffer(); } ReturnValue_t FreshMpsocHandler::commandTcMemWrite(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; mpsoc::TcMemWrite tcMemWrite(spParams, commandSequenceCount); result = tcMemWrite.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_MEM_WRITE, tcMemWrite); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcMemRead(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; mpsoc::TcMemRead tcMemRead(spParams, commandSequenceCount); result = tcMemRead.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_MEM_READ, tcMemRead); tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE; return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcFlashDelete(const uint8_t* commandData, size_t commandDataLen) { if (commandDataLen > mpsoc::FILENAME_FIELD_SIZE) { return mpsoc::NAME_TOO_LONG; } ReturnValue_t result = returnvalue::OK; mpsoc::TcFlashDelete tcFlashDelete(spParams, commandSequenceCount); std::string filename = std::string(reinterpret_cast(commandData), commandDataLen); result = tcFlashDelete.setPayload(filename); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_FLASHDELETE, tcFlashDelete); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcReplayStart(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; mpsoc::TcReplayStart tcReplayStart(spParams, commandSequenceCount); result = tcReplayStart.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_REPLAY_START, tcReplayStart); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcReplayStop() { mpsoc::TcReplayStop tcReplayStop(spParams, commandSequenceCount); finishAndSendTc(mpsoc::TC_REPLAY_STOP, tcReplayStop); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcDownlinkPwrOn(const uint8_t* commandData, size_t commandDataLen) { ReturnValue_t result = returnvalue::OK; mpsoc::TcDownlinkPwrOn tcDownlinkPwrOn(spParams, commandSequenceCount); result = tcDownlinkPwrOn.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_DOWNLINK_PWR_ON, tcDownlinkPwrOn); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcDownlinkPwrOff() { mpsoc::TcDownlinkPwrOff tcDownlinkPwrOff(spParams, commandSequenceCount); finishAndSendTc(mpsoc::TC_DOWNLINK_PWR_OFF, tcDownlinkPwrOff); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcGetHkReport() { mpsoc::TcGetHkReport tcGetHkReport(spParams, commandSequenceCount); finishAndSendTc(mpsoc::TC_GET_HK_REPORT, tcGetHkReport); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen) { mpsoc::TcReplayWriteSeq tcReplayWriteSeq(spParams, commandSequenceCount); ReturnValue_t result = tcReplayWriteSeq.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_REPLAY_WRITE_SEQUENCE, tcReplayWriteSeq); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcModeReplay() { mpsoc::TcModeReplay tcModeReplay(spParams, commandSequenceCount); finishAndSendTc(mpsoc::TC_MODE_REPLAY, tcModeReplay); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcModeIdle() { mpsoc::TcModeIdle tcModeIdle(spParams, commandSequenceCount); finishAndSendTc(mpsoc::TC_MODE_IDLE, tcModeIdle); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen) { mpsoc::TcCamcmdSend tcCamCmdSend(spParams, commandSequenceCount); ReturnValue_t result = tcCamCmdSend.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_CAM_CMD_SEND, tcCamCmdSend); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcCamTakePic(const uint8_t* commandData, size_t commandDataLen) { mpsoc::TcCamTakePic tcCamTakePic(spParams, commandSequenceCount); ReturnValue_t result = tcCamTakePic.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } sif::info << "PLOC MPSoC Take Picture Command" << std::endl; sif::info << "filename: " << tcCamTakePic.fileName << std::endl; sif::info << "encoder [Y, Cb, Cr]: [" << (int)tcCamTakePic.encoderSettingY << ", " << (int)tcCamTakePic.encoderSettingsCb << ", " << (int)tcCamTakePic.encoderSettingsCr << "]" << std::endl; sif::info << "quantization [Y, Cb, Cr]: [" << tcCamTakePic.quantizationY << ", " << tcCamTakePic.quantizationCb << ", " << tcCamTakePic.quantizationCr << "]" << std::endl; sif::info << "bypass compressor: " << (int)tcCamTakePic.bypassCompressor << std::endl; finishAndSendTc(mpsoc::TC_CAM_TAKE_PIC, tcCamTakePic); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcSimplexStreamFile(const uint8_t* commandData, size_t commandDataLen) { mpsoc::TcSimplexStreamFile tcSimplexStreamFile(spParams, commandSequenceCount); ReturnValue_t result = tcSimplexStreamFile.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_SIMPLEX_STREAM_FILE, tcSimplexStreamFile); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcSplitFile(const uint8_t* commandData, size_t commandDataLen) { mpsoc::TcSplitFile tcSplitFile(spParams, commandSequenceCount); ReturnValue_t result = tcSplitFile.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_SPLIT_FILE, tcSplitFile); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcGetDirContent(const uint8_t* commandData, size_t commandDataLen) { mpsoc::TcGetDirContent tcGetDirContent(spParams, commandSequenceCount); ReturnValue_t result = tcGetDirContent.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_FLASH_GET_DIRECTORY_CONTENT, tcGetDirContent); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcDownlinkDataModulate(const uint8_t* commandData, size_t commandDataLen) { mpsoc::TcDownlinkDataModulate tcDownlinkDataModulate(spParams, commandSequenceCount); ReturnValue_t result = tcDownlinkDataModulate.setPayload(commandData, commandDataLen); if (result != returnvalue::OK) { return result; } finishAndSendTc(mpsoc::TC_DOWNLINK_DATA_MODULATE, tcDownlinkDataModulate); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::commandTcModeSnapshot() { mpsoc::TcModeSnapshot tcModeSnapshot(spParams, commandSequenceCount); finishAndSendTc(mpsoc::TC_MODE_SNAPSHOT, tcModeSnapshot); return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::finishAndSendTc(DeviceCommandId_t cmdId, mpsoc::TcBase& tcBase, uint32_t cmdCountdownMs) { // Emit warning but still send command. if (specialComHelperExecuting) { sif::warning << "PLOC MPSoC: Sending command even though special COM helper is executing" << std::endl; } ReturnValue_t result = tcBase.finishPacket(); if (result != returnvalue::OK) { return result; } commandSequenceCount++; mpsoc::printTxPacket(tcBase); activeCmdInfo.cmdCountdown.setTimeout(cmdCountdownMs); activeCmdInfo.cmdCountdown.resetTimer(); activeCmdInfo.pending = true; activeCmdInfo.pendingCmd = cmdId; activeCmdInfo.pendingCmdMpsocApid = tcBase.getApid(); return comInterface.send(tcBase.getFullPacket(), tcBase.getFullPacketLen()); } void FreshMpsocHandler::handleEvent(EventMessage* eventMessage) { object_id_t objectId = eventMessage->getReporter(); switch (objectId) { case objects::PLOC_MPSOC_HELPER: { commonSpecialComStop(); break; } default: sif::debug << "PlocMPSoCHandler::handleEvent: Did not subscribe to this event" << std::endl; break; } } void FreshMpsocHandler::commonSpecialComStop() { specialComHelperExecuting = false; commandSequenceCount.set(specialComHelper.getCommandSequenceCount()); } void FreshMpsocHandler::cmdDoneHandler(bool success, ReturnValue_t result) { if (transitionState == TransitionState::SUBMODE) { if (success) { setMode(targetMode, targetSubmode); } else { // Keep the old submode. setMode(targetMode); } transitionState = TransitionState::NONE; } if (activeCmdInfo.pending && (activeCmdInfo.commandedBy != MessageQueueIF::NO_QUEUE)) { actionHelper.finish(success, activeCmdInfo.commandedBy, activeCmdInfo.pendingCmd, result); } activeCmdInfo.reset(); } ReturnValue_t FreshMpsocHandler::handleDeviceReply() { ReturnValue_t result = returnvalue::OK; const auto& replyReader = comInterface.getSpReader(); if (replyReader.isNull()) { return returnvalue::FAILED; } mpsoc::printRxPacket(replyReader); uint16_t apid = replyReader.getApid(); switch (apid) { case (mpsoc::apid::ACK_SUCCESS): result = handleAckReport(); break; case (mpsoc::apid::ACK_FAILURE): break; case (mpsoc::apid::TM_MEMORY_READ_REPORT): if (activeCmdInfo.pendingCmd == mpsoc::TC_VERIFY_BOOT) { // 6 byte header, 4 byte address, 2 byte read width, 4 byte read back value if (replyReader.getFullPacketLen() >= 6 + 4 + 2 + 4) { uint32_t readBack = 0; size_t deserLen = 0; result = SerializeAdapter::deSerialize(&readBack, replyReader.getFullData() + 6 + 4 + 2, &deserLen, SerializeIF::Endianness::NETWORK); if (result != returnvalue::OK or readBack != mpsoc::DEADBEEF_VALUE) { cmdDoneHandler(false, result); } else { cmdDoneHandler(true, returnvalue::OK); } } else { cmdDoneHandler(false, result); } } result = reportReplyData(mpsoc::TM_MEMORY_READ_REPORT); break; case (mpsoc::apid::TM_CAM_CMD_RPT): result = reportReplyData(mpsoc::TM_CAM_CMD_RPT); break; case (mpsoc::apid::TM_HK_GET_REPORT): { result = handleGetHkReport(); break; } case (mpsoc::apid::TM_FLASH_DIRECTORY_CONTENT): { result = reportReplyData(mpsoc::TM_FLASH_DIRECTORY_CONTENT); break; } case (mpsoc::apid::EXE_SUCCESS): case (mpsoc::apid::EXE_FAILURE): { result = handleExecutionReport(); break; } default: { sif::debug << "FreshMpsocHandler:: Reply has invalid APID 0x" << std::hex << std::setfill('0') << std::setw(2) << apid << std::dec << std::endl; return mpsoc::INVALID_APID; } } uint16_t sequenceCount = replyReader.getSequenceCount(); if (sequenceCount != lastReplySequenceCount + 1) { // We could trigger event for possible missing reply packet to inform operator, but I don't // think this is properly implemented and used on the MPSoC side anymore. } lastReplySequenceCount = sequenceCount; return result; } ReturnValue_t FreshMpsocHandler::handleExecutionReport() { ReturnValue_t result = returnvalue::OK; auto& replyReader = comInterface.getSpReader(); switch (replyReader.getApid()) { case (mpsoc::apid::EXE_SUCCESS): { cmdDoneHandler(true, result); break; } case (mpsoc::apid::EXE_FAILURE): { DeviceCommandId_t commandId = activeCmdInfo.pendingCmd; // Ensure idempotency: If the device is already in the mode, the command was successful. if (mpsoc::getStatusFromRawData(replyReader.getFullData()) == mpsoc::statusCode::TC_NOT_ALLOWED_IN_MODE) { if ((activeCmdInfo.pendingCmdMpsocApid == mpsoc::apid::TC_MODE_SNAPSHOT && submode == mpsoc::Submode::SNAPSHOT) or (activeCmdInfo.pendingCmdMpsocApid == mpsoc::apid::TC_MODE_IDLE && submode == mpsoc::Submode::IDLE_OR_NONE) or (activeCmdInfo.pendingCmdMpsocApid == mpsoc::apid::TC_MODE_REPLAY && submode == mpsoc::Submode::REPLAY)) { cmdDoneHandler(true, returnvalue::OK); return result; } } if (commandId == DeviceHandlerIF::NO_COMMAND_ID) { sif::warning << "FreshMpsocHandler::handleExecutionReport: Unknown Command ID" << std::endl; } uint16_t status = mpsoc::getStatusFromRawData(replyReader.getFullData()); sif::warning << "MPSoC EXE Failure: " << mpsoc::getStatusString(status) << std::endl; triggerEvent(mpsoc::EXE_FAILURE, commandId, status); cmdDoneHandler(false, mpsoc::RECEIVED_EXE_FAILURE); break; } default: { sif::warning << "PlocMPSoCHandler::handleExecutionReport: Unknown APID" << std::endl; result = returnvalue::FAILED; break; } } return result; } ReturnValue_t FreshMpsocHandler::handleAckReport() { ReturnValue_t result = returnvalue::OK; auto& replyReader = comInterface.getSpReader(); switch (replyReader.getApid()) { case mpsoc::apid::ACK_FAILURE: { uint16_t status = mpsoc::getStatusFromRawData(replyReader.getFullData()); sif::warning << "MPSoC ACK Failure: " << mpsoc::getStatusString(status) << std::endl; triggerEvent(mpsoc::ACK_FAILURE, activeCmdInfo.pendingCmd, status); cmdDoneHandler(false, status); break; } case mpsoc::apid::ACK_SUCCESS: { break; } default: { sif::error << "FreshMpsocHandler::handleAckReport: Invalid APID in ACK report" << std::endl; result = returnvalue::FAILED; break; } } return result; } ReturnValue_t FreshMpsocHandler::getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues, uint16_t startAtIndex) { if (uniqueId == mpsoc::ParamId::SKIP_SUPV_ON_COMMANDING) { uint8_t value = 0; newValues->getElement(&value); if (value > 1) { return HasParametersIF::INVALID_VALUE; } parameterWrapper->set(skipSupvCommandingToOn); return returnvalue::OK; } return FreshDeviceHandlerBase::getParameter(domainId, uniqueId, parameterWrapper, newValues, startAtIndex); } ReturnValue_t FreshMpsocHandler::reportReplyData(DeviceCommandId_t tmId) { auto& replyReader = comInterface.getSpReader(); if (activeCmdInfo.commandedBy != MessageQueueIF::NO_QUEUE) { return actionHelper.reportData( activeCmdInfo.commandedBy, tmId, replyReader.getFullData() + mpsoc::DATA_FIELD_OFFSET, replyReader.getFullPacketLen() - mpsoc::DATA_FIELD_OFFSET - mpsoc::CRC_SIZE); } return returnvalue::OK; } ReturnValue_t FreshMpsocHandler::handleGetHkReport() { auto& spReader = comInterface.getSpReader(); const uint8_t* dataStart = spReader.getFullData() + 6; PoolReadGuard pg(&hkReport); size_t deserLen = mpsoc::SIZE_TM_HK_REPORT; SerializeIF::Endianness endianness = SerializeIF::Endianness::NETWORK; ReturnValue_t result = SerializeAdapter::deSerialize(&hkReport.status.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.mode.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.downlinkPwrOn.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.downlinkReplyActive.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.downlinkJesdSyncStatus.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.downlinkDacStatus.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.camStatus.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.camSdiStatus.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.camFpgaTemp.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonTemp.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVccInt.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVccAux.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVccBram.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVccPaux.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVccPint.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVccPdro.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonMb12V.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonMb3V3.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonMb1V8.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc12V.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc5V.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc3V3.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc3V3VA.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc2V5DDR.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc1V2DDR.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc0V9.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonVcc0V6VTT.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonSafeCotsCur.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.sysmonNvm4XoCur.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.semUncorrectableErrs.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.semCorrectableErrs.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } result = SerializeAdapter::deSerialize(&hkReport.semStatus.value, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } // Skip the weird filename dataStart += 256; result = SerializeAdapter::deSerialize(&hkReport.rebootMpsocRequired, &dataStart, &deserLen, endianness); if (result != returnvalue::OK) { return result; } hkReport.setValidity(true, true); return returnvalue::OK; } bool FreshMpsocHandler::handleHwStartup() { #if OBSW_MPSOC_JTAG_BOOT == 1 uartIsolatorSwitch.pullHigh(); startupState = StartupState::WAIT_CYCLES; return true; #endif if (powerState == PowerState::IDLE) { if (skipSupvCommandingToOn) { powerState = PowerState::DONE; } else { if (supv::SUPV_ON) { commandActionHelper.commandAction(supervisorHandler, supv::START_MPSOC); supvTransitionCd.resetTimer(); powerState = PowerState::PENDING_STARTUP; } else { triggerEvent(mpsoc::SUPV_NOT_ON, 1); // Set back to OFF for now, failing the transition. setMode(MODE_OFF); } } } if (powerState == PowerState::SUPV_FAILED) { setMode(MODE_OFF); powerState = PowerState::IDLE; transitionState = TransitionState::NONE; return false; } if (powerState == PowerState::PENDING_STARTUP) { if (supvTransitionCd.hasTimedOut()) { // Process with transition nonetheless.. triggerEvent(mpsoc::SUPV_REPLY_TIMEOUT); powerState = PowerState::DONE; } else { return false; } } if (powerState == PowerState::DONE) { // Wait a bit for the MPSoC to fully boot. if (!mpsocBootTransitionCd.hasTimedOut()) { return false; } uartIsolatorSwitch.pullHigh(); comInterface.getComHelper().flushUartTxAndRxBuf(); powerState = PowerState::IDLE; } return true; } bool FreshMpsocHandler::handleHwShutdown() { stopSpecialComHelper(); uartIsolatorSwitch.pullLow(); #if OBSW_MPSOC_JTAG_BOOT == 1 powerState = PowerState::DONE; return true; #endif if (powerState == PowerState::IDLE) { if (supv::SUPV_ON) { commandActionHelper.commandAction(supervisorHandler, supv::SHUTDOWN_MPSOC); supvTransitionCd.resetTimer(); powerState = PowerState::PENDING_SHUTDOWN; } else { if ((this->mode != MODE_OFF) and (this->mode != MODE_UNDEFINED)) { triggerEvent(mpsoc::SUPV_NOT_ON, 0); } powerState = PowerState::DONE; } } if (powerState == PowerState::PENDING_SHUTDOWN) { if (supvTransitionCd.hasTimedOut()) { powerState = PowerState::DONE; // Process with transition nonetheless.. triggerEvent(mpsoc::SUPV_REPLY_TIMEOUT); return true; } else { // Wait till power state is OFF. return false; } } return true; } void FreshMpsocHandler::stopSpecialComHelper() { specialComHelper.stopProcess(); specialComHelperExecuting = false; }