diff --git a/bsp_q7s/objectFactory.cpp b/bsp_q7s/objectFactory.cpp index 76053538..75e3d8d8 100644 --- a/bsp_q7s/objectFactory.cpp +++ b/bsp_q7s/objectFactory.cpp @@ -10,9 +10,10 @@ #include #include #include +#include +#include #include -#include -#include +#include #include #include #include @@ -47,6 +48,7 @@ #include "devices/gpioIds.h" #include "devices/powerSwitcherList.h" #include "eive/definitions.h" +#include "eive/objects.h" #include "fsfw/ipc/QueueFactory.h" #include "linux/ObjectFactory.h" #include "linux/boardtest/I2cTestClass.h" @@ -59,6 +61,9 @@ #include "linux/ipcore/Ptme.h" #include "linux/ipcore/PtmeConfig.h" #include "linux/payload/FreshSupvHandler.h" +#include "linux/payload/MpsocCommunication.h" +#include "linux/payload/PlocMpsocSpecialComHelper.h" +#include "linux/payload/SerialConfig.h" #include "mission/config/configfile.h" #include "mission/system/acs/AcsBoardFdir.h" #include "mission/system/acs/AcsSubsystem.h" @@ -624,14 +629,15 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit auto mpsocGpioCookie = new GpioCookie; mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC); gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC"); - auto mpsocCookie = - new SerialCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, - serial::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); - mpsocCookie->setNoFixedSizeReply(); - auto plocMpsocHelper = new PlocMpsocSpecialComHelperLegacy(objects::PLOC_MPSOC_HELPER); - auto* mpsocHandler = new PlocMpsocHandler( - objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocCookie, plocMpsocHelper, - Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), objects::PLOC_SUPERVISOR_HANDLER); + SerialConfig serialCfg(q7s::UART_PLOC_MPSOC_DEV, serial::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE, + UartModes::NON_CANONICAL); + auto mpsocCommunication = new MpsocCommunication(objects::PLOC_MPSOC_COMMUNICATION, serialCfg); + auto specialComHelper = + new PlocMpsocSpecialComHelper(objects::PLOC_MPSOC_HELPER, *mpsocCommunication); + DhbConfig dhbConf(objects::PLOC_MPSOC_HANDLER); + auto* mpsocHandler = new FreshMpsocHandler(dhbConf, *mpsocCommunication, *specialComHelper, + Gpio(gpioIds::ENABLE_MPSOC_UART, gpioComIF), + objects::PLOC_SUPERVISOR_HANDLER); mpsocHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM); #endif /* OBSW_ADD_PLOC_MPSOC == 1 */ #if OBSW_ADD_PLOC_SUPERVISOR == 1 @@ -650,7 +656,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL); supervisorCookie->setNoFixedSizeReply(); new PlocSupvUartManager(objects::PLOC_SUPERVISOR_HELPER); - DhbConfig dhbConf(objects::PLOC_SUPERVISOR_HANDLER); + dhbConf = DhbConfig(objects::PLOC_SUPERVISOR_HANDLER); auto* supvHandler = new FreshSupvHandler(dhbConf, supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), pwrSwitcher, power::PDU1_CH6_PLOC_12V); diff --git a/common/config/eive/objects.h b/common/config/eive/objects.h index c7e56715..797bea1d 100644 --- a/common/config/eive/objects.h +++ b/common/config/eive/objects.h @@ -77,6 +77,7 @@ enum commonObjects : uint32_t { PLOC_MPSOC_HANDLER = 0x44330015, PLOC_SUPERVISOR_HANDLER = 0x44330016, PLOC_SUPERVISOR_HELPER = 0x44330017, + PLOC_MPSOC_COMMUNICATION = 0x44330018, SCEX = 0x44330032, SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2, HEATER_HANDLER = 0x444100A4, diff --git a/linux/payload/FreshMpsocHandler.cpp b/linux/payload/FreshMpsocHandler.cpp index beb0b593..84329509 100644 --- a/linux/payload/FreshMpsocHandler.cpp +++ b/linux/payload/FreshMpsocHandler.cpp @@ -13,7 +13,7 @@ #include "linux/payload/plocSupvDefs.h" FreshMpsocHandler::FreshMpsocHandler(DhbConfig cfg, MpsocCommunication& comInterface, - PlocMpsocSpecialComHelper* specialComHelper, + PlocMpsocSpecialComHelper& specialComHelper, Gpio uartIsolatorSwitch, object_id_t supervisorHandler) : FreshDeviceHandlerBase(cfg), comInterface(comInterface), @@ -142,7 +142,7 @@ ReturnValue_t FreshMpsocHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - specialComHelper->setSequenceCount(&commandSequenceCount); + specialComHelper.setSequenceCount(&commandSequenceCount); result = commandActionHelper.initialize(); if (result != returnvalue::OK) { return ObjectManagerIF::CHILD_INIT_FAILED; @@ -235,8 +235,8 @@ ReturnValue_t FreshMpsocHandler::executeAction(ActionId_t actionId, MessageQueue if (result != returnvalue::OK) { return result; } - result = specialComHelper->startFlashWrite(flashWritePusCmd.getObcFile(), - flashWritePusCmd.getMPSoCFile()); + result = specialComHelper.startFlashWrite(flashWritePusCmd.getObcFile(), + flashWritePusCmd.getMPSoCFile()); if (result != returnvalue::OK) { return result; } @@ -249,9 +249,9 @@ ReturnValue_t FreshMpsocHandler::executeAction(ActionId_t actionId, MessageQueue if (result != returnvalue::OK) { return result; } - result = specialComHelper->startFlashRead(flashReadPusCmd.getObcFile(), - flashReadPusCmd.getMPSoCFile(), - flashReadPusCmd.getReadSize()); + result = specialComHelper.startFlashRead(flashReadPusCmd.getObcFile(), + flashReadPusCmd.getMPSoCFile(), + flashReadPusCmd.getReadSize()); if (result != returnvalue::OK) { return result; } @@ -1101,8 +1101,6 @@ bool FreshMpsocHandler::handleHwShutdown() { } void FreshMpsocHandler::stopSpecialComHelper() { - if (specialComHelper != nullptr) { - specialComHelper->stopProcess(); - } + specialComHelper.stopProcess(); specialComHelperExecuting = false; } diff --git a/linux/payload/FreshMpsocHandler.h b/linux/payload/FreshMpsocHandler.h index af0304b3..d5a6db21 100644 --- a/linux/payload/FreshMpsocHandler.h +++ b/linux/payload/FreshMpsocHandler.h @@ -19,7 +19,7 @@ class FreshMpsocHandler : public FreshDeviceHandlerBase, public CommandsActionsI enum OpCode { DEFAULT_OPERATION = 0, PARSE_TM = 1 }; FreshMpsocHandler(DhbConfig cfg, MpsocCommunication& comInterface, - PlocMpsocSpecialComHelper* plocMPSoCHelper, Gpio uartIsolatorSwitch, + PlocMpsocSpecialComHelper& specialComHelper, Gpio uartIsolatorSwitch, object_id_t supervisorHandler); /** @@ -44,9 +44,9 @@ class FreshMpsocHandler : public FreshDeviceHandlerBase, public CommandsActionsI enum class PowerState { IDLE, PENDING_STARTUP, PENDING_SHUTDOWN, SUPV_FAILED, DONE }; bool transitionActive = false; - MpsocCommunication comInterface; + MpsocCommunication& comInterface; + PlocMpsocSpecialComHelper& specialComHelper; MessageQueueIF* eventQueue = nullptr; - PlocMpsocSpecialComHelper* specialComHelper; SourceSequenceCounter commandSequenceCount = SourceSequenceCounter(0); MessageQueueIF* commandActionHelperQueue = nullptr; CommandActionHelper commandActionHelper;