#include "ObjectFactory.h" #include "OBSWConfig.h" #include "busConf.h" #include "devConf.h" #include "ccsdsConfig.h" #include "devices/addresses.h" #include "devices/gpioIds.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h" #include "fsfw/tmtcpacket/pus/tm.h" #include "fsfw/tmtcservices/CommandingServiceBase.h" #include "fsfw/tmtcservices/PusServiceBase.h" #include "fsfw_hal/linux/i2c/I2cComIF.h" #include "fsfw_hal/linux/i2c/I2cCookie.h" #include "fsfw_hal/linux/serial/SerialComIF.h" #include "fsfw_hal/linux/serial/SerialCookie.h" #include "fsfw_hal/common/gpio/GpioCookie.h" #include "linux/ObjectFactory.h" #include "linux/devices/ploc/PlocMPSoCHandler.h" #include "linux/devices/ploc/PlocMPSoCHelper.h" #include "linux/devices/ploc/PlocMemoryDumper.h" #include "linux/devices/ploc/PlocSupervisorHandler.h" #include "linux/devices/ploc/PlocSupvHelper.h" #include "linux/obc/AxiPtmeConfig.h" #include "linux/obc/PapbVcInterface.h" #include "linux/obc/PdecHandler.h" #include "linux/obc/Ptme.h" #include "linux/obc/PtmeConfig.h" #include "mission/core/GenericFactory.h" #include "mission/devices/Tmp1075Handler.h" #include "mission/tmtc/TmFunnel.h" #include "mission/tmtc/CCSDSHandler.h" #include "mission/tmtc/VirtualChannel.h" #include "objects/systemObjectList.h" #include "test/gpio/DummyGpioIF.h" #include "tmtc/apid.h" #include "tmtc/pusIds.h" void Factory::setStaticFrameworkObjectIds() { PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; PusServiceBase::packetDestination = objects::TM_FUNNEL; CommandingServiceBase::defaultPacketSource = objects::PUS_PACKET_DISTRIBUTOR; CommandingServiceBase::defaultPacketDestination = objects::TM_FUNNEL; #if OBSW_TM_TO_PTME == 1 TmFunnel::downlinkDestination = objects::CCSDS_HANDLER; #else TmFunnel::downlinkDestination = objects::TMTC_BRIDGE; #endif TmFunnel::storageDestination = objects::NO_OBJECT; VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; TmPacketBase::timeStamperId = objects::TIME_STAMPER; } void ObjectFactory::produce(void* args) { Factory::setStaticFrameworkObjectIds(); ObjectFactory::produceGenericObjects(); LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);; newSerialComIF(objects::UART_COM_IF); #if OBSW_ADD_PLOC_MPSOC == 1 UartCookie* mpsocUartCookie = new UartCookie(objects::PLOC_MPSOC_HANDLER, te0720_1cfa::MPSOC_UART, uart::PLOC_MPSOC_BAUD, mpsoc::MAX_REPLY_SIZE); mpsocUartCookie->setNoFixedSizeReply(); PlocMPSoCHelper* plocMpsocHelper = new PlocMPSoCHelper(objects::PLOC_MPSOC_HELPER); auto dummyGpioIF = new DummyGpioIF(); PlocMPSoCHandler* plocMPSoCHandler = new PlocMPSoCHandler( objects::PLOC_MPSOC_HANDLER, objects::UART_COM_IF, mpsocUartCookie, plocMpsocHelper, Gpio(gpioIds::ENABLE_MPSOC_UART, dummyGpioIF), objects::PLOC_SUPERVISOR_HANDLER); plocMPSoCHandler->setStartUpImmediately(); #endif /* OBSW_ADD_PLOC_MPSOC == 1 */ #if OBSW_ADD_PLOC_SUPERVISOR == 1 UartCookie* supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, std::string("/dev/ttyPS1"), uart::PLOC_SUPV_BAUD, supv::MAX_PACKET_SIZE * 20); supervisorCookie->setNoFixedSizeReply(); auto supvGpioIF = new DummyGpioIF(); auto supvHelper = new PlocSupvHelper(objects::PLOC_SUPERVISOR_HELPER); new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, objects::UART_COM_IF, supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, supvGpioIF), pcdu::PDU1_CH6_PLOC_12V, supvHelper); #endif new PlocMemoryDumper(objects::PLOC_MEMORY_DUMPER); #if OBSW_TEST_LIBGPIOD == 1 #if OBSW_TEST_GPIO_OPEN_BYLABEL == 1 /* Configure MIO0 as input */ GpiodRegular* testGpio = new GpiodRegular("MIO0", Direction::OUT, 0, "/amba_pl/gpio@41200000", 0); #elif OBSW_TEST_GPIO_OPEN_BY_LINE_NAME GpiodRegularByLineName* testGpio = new GpiodRegularByLineName("test-name", "gpio-test", Direction::OUT, 0); #else /* Configure MIO0 as input */ GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0); #endif /* OBSW_TEST_GPIO_LABEL == 1 */ GpioCookie* gpioCookie = new GpioCookie; gpioCookie->addGpio(gpioIds::TEST_ID_0, testGpio); new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie); #endif #if OBSW_TEST_SUS == 1 GpioCookie* gpioCookieSus = new GpioCookie; GpiodRegular* chipSelectSus = new GpiodRegular( std::string("gpiochip1"), 9, std::string("Chip Select Sus Sensor"), Direction::OUT, 1); gpioCookieSus->addGpio(gpioIds::CS_SUS_0, chipSelectSus); gpioComIF->addGpios(gpioCookieSus); SpiCookie* spiCookieSus = new SpiCookie(addresses::SUS_0, std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); new SusHandler(objects::SUS_0, objects::SPI_COM_IF, spiCookieSus, gpioComIF, gpioIds::CS_SUS_0); #endif #if OBSW_TEST_RAD_SENSOR == 1 GpioCookie* gpioCookieRadSensor = new GpioCookie; GpiodRegular* chipSelectRadSensor = new GpiodRegular( std::string("gpiochip1"), 0, std::string("Chip select radiation sensor"), Direction::OUT, 1); gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor); gpioComIF->addGpios(gpioCookieRadSensor); SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor); radSensor->setStartUpImmediately(); #endif #if OBSW_TEST_TE7020_HEATER == 1 /* Configuration for MIO0 on TE0720-03-1CFA */ GpiodRegular* heaterGpio = new GpiodRegular(std::string("gpiochip0"), 0, std::string("MIO0"), gpio::IN, 0); GpioCookie* gpioCookie = new GpioCookie; gpioCookie->addGpio(gpioIds::HEATER_0, heaterGpio); new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, gpioCookie, objects::PCDU_HANDLER, pcdu::TCS_BOARD_8V_HEATER_IN); #endif new I2cComIF(objects::I2C_COM_IF); I2cCookie* i2cCookieTmp1075tcs1 = new I2cCookie(addresses::TMP1075_TCS_1, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); I2cCookie* i2cCookieTmp1075tcs2 = new I2cCookie(addresses::TMP1075_TCS_2, TMP1075::MAX_REPLY_LENGTH, std::string("/dev/i2c-0")); /* Temperature sensors */ new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1); new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2); static_cast(gpioComIF); }