From 1276cc2dc6b81582827c1e021b83c69e4e3fdee9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 26 May 2022 12:04:27 +0200 Subject: [PATCH] scex additions --- bsp_linux_board/InitMission.cpp | 26 ++++++++++++++++++++++++++ bsp_linux_board/OBSWConfig.h.in | 7 +++++++ bsp_linux_board/ObjectFactory.cpp | 4 ++++ bsp_linux_board/definitions.h | 6 ++++++ common/config/commonObjects.h | 1 + linux/ObjectFactory.cpp | 5 +++++ linux/ObjectFactory.h | 2 ++ linux/obc/PdecHandler.cpp | 1 + 8 files changed, 52 insertions(+) diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index 0fa7a4f6..27a435b4 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -1,3 +1,4 @@ +#include #include "InitMission.h" #include @@ -77,6 +78,28 @@ void initmission::initTasks() { sif::error << "Add component TMTC Polling failed" << std::endl; } +#if OBSW_ADD_SCEX == 1 + PeriodicTaskIF* scexDevHandler = factory->createPeriodicTask( + "SCEX_DEV", 35, PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 0.5, missedDeadlineFunc); + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::PERFORM_OPERATION); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_DEV", objects::SCEX); + } + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::SEND_WRITE); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_DEV", objects::SCEX); + } + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::GET_WRITE); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_DEV", objects::SCEX); + } + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::SEND_READ); + if (result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("SCEX_DEV", objects::SCEX); + } + result = tmtcPollingTask->addComponent(objects::SCEX, DeviceHandlerIF::GET_READ); +#endif + /* PUS Services */ std::vector pusTasks; createPusTasks(*factory, missedDeadlineFunc, pusTasks); @@ -109,6 +132,9 @@ void initmission::initTasks() { #endif /* OBSW_ADD_TEST_CODE == 1 */ taskStarter(pstTasks, "PST Tasks"); +#if OBSW_ADD_SCEX == 1 + scexDevHandler->startTask(); +#endif #if OBSW_ADD_TEST_PST == 1 if (startTestPst) { pstTestTask->startTask(); diff --git a/bsp_linux_board/OBSWConfig.h.in b/bsp_linux_board/OBSWConfig.h.in index d8a981bd..398cf19e 100644 --- a/bsp_linux_board/OBSWConfig.h.in +++ b/bsp_linux_board/OBSWConfig.h.in @@ -28,6 +28,7 @@ #define OBSW_ADD_RTD_DEVICES 0 #define OBSW_ADD_PL_PCDU 0 #define OBSW_ADD_TMP_DEVICES 0 +#define OBSW_ADD_SCEX 1 #define OBSW_ADD_RAD_SENSORS 0 #define OBSW_ADD_SYRLINKS 0 #define OBSW_STAR_TRACKER_GROUND_CONFIG 1 @@ -102,6 +103,12 @@ /*******************************************************************/ #cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER +#define OBSW_USE_CCSDS_IP_CORE 0 +// Set to 1 if all telemetry should be sent to the PTME IP Core +#define OBSW_TM_TO_PTME 0 +// Set to 1 if telecommands are received via the PDEC IP Core +#define OBSW_TC_FROM_PDEC 0 + #cmakedefine LIBGPS_VERSION_MAJOR @LIBGPS_VERSION_MAJOR@ #cmakedefine LIBGPS_VERSION_MINOR @LIBGPS_VERSION_MINOR@ diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 47f80936..6ff4947b 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -82,6 +82,10 @@ void ObjectFactory::produce(void* args) { #endif #endif +#if OBSW_ADD_SCEX == 1 + createScexComponents(uart::DEV, pwrSwitcher); +#endif + #if OBSW_ADD_SUN_SENSORS == 1 createSunSensorComponents(gpioIF, spiComIF, pwrSwitcher, spi::DEV); #endif diff --git a/bsp_linux_board/definitions.h b/bsp_linux_board/definitions.h index 1b6814f4..83aeb847 100644 --- a/bsp_linux_board/definitions.h +++ b/bsp_linux_board/definitions.h @@ -13,6 +13,12 @@ static constexpr char DEV[] = "/dev/spidev0.1"; } +namespace uart { + +static constexpr char DEV[] = "/dev/serial0"; + +} + /* Adapt these values accordingly */ namespace gpio { static constexpr uint8_t MGM_0_BCM_PIN = 17; diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index 4a4594f4..1fcd6aaa 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -57,6 +57,7 @@ enum commonObjects : uint32_t { PLOC_MPSOC_HANDLER = 0x44330015, PLOC_SUPERVISOR_HANDLER = 0x44330016, PLOC_SUPERVISOR_HELPER = 0x44330017, + SCEX = 0x44330032, SOLAR_ARRAY_DEPL_HANDLER = 0x444100A2, HEATER_HANDLER = 0x444100A4, diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index f84cf52f..8192d215 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -319,8 +319,13 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, #endif // OBSW_ADD_RTD_DEVICES == 1 } +void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF *pwrSwitcher) { +} + +du findest void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) { if (result != HasReturnvaluesIF::RETURN_OK) { sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl; } } + diff --git a/linux/ObjectFactory.h b/linux/ObjectFactory.h index a5642729..41040fe7 100644 --- a/linux/ObjectFactory.h +++ b/linux/ObjectFactory.h @@ -15,6 +15,8 @@ void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitc void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher, SpiComIF* comIF); +void createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher); + void gpioChecker(ReturnValue_t result, std::string output); } // namespace ObjectFactory diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 4c8beeed..9bc95fb8 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -1,4 +1,5 @@ #include "PdecHandler.h" +#include "OBSWConfig.h" #include #include