diff --git a/bsp_linux_board/InitMission.cpp b/bsp_linux_board/InitMission.cpp index febae2f3..b81754a7 100644 --- a/bsp_linux_board/InitMission.cpp +++ b/bsp_linux_board/InitMission.cpp @@ -36,6 +36,7 @@ void initmission::initMission() { void initmission::initTasks() { TaskFactory* factory = TaskFactory::instance(); + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; if(factory == nullptr) { /* Should never happen ! */ return; @@ -46,11 +47,11 @@ void initmission::initTasks() { void (*missedDeadlineFunc) (void) = nullptr; #endif + /* TMTC Distribution */ PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask( "DIST", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); - ReturnValue_t result = tmTcDistributor->addComponent( - objects::CCSDS_PACKET_DISTRIBUTOR); + result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR); if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } @@ -78,21 +79,70 @@ void initmission::initTasks() { } /* PUS Services */ - PeriodicTaskIF* pusVerification = factory->createPeriodicTask( + std::vector pusTasks; + createPstTasks(*factory, missedDeadlineFunc, pusTasks); + + std::vector pstTasks; + createPstTasks(*factory, missedDeadlineFunc, pstTasks); +#if OBSW_ADD_TEST_CODE == 1 + std::vector testTasks; + createTestTasks(*factory, missedDeadlineFunc, pstTasks); +#endif /* OBSW_ADD_TEST_CODE == 1 */ + + auto taskStarter = [](std::vector& taskVector, std::string name) { + for(const auto& task: taskVector) { + if(task != nullptr) { + task->startTask(); + } + else { + sif::error << "Task in vector " << name << " is invalid!" << std::endl; + } + } + }; + + sif::info << "Starting tasks.." << std::endl; + tmTcDistributor->startTask(); + udpBridgeTask->startTask(); + udpPollingTask->startTask(); + + taskStarter(pusTasks, "PUS Tasks"); +#if OBSW_ADD_TEST_CODE == 1 + taskStarter(testTasks, "Test Tasks"); +#endif /* OBSW_ADD_TEST_CODE == 1 */ + taskStarter(pstTasks, "PST Tasks"); + +#if OBSW_ADD_TEST_PST == 1 + if(startTestPst) { + pstTestTask->startTask(); + } +#endif /* RPI_TEST_ACS_BOARD == 1 */ + sif::info << "Tasks started.." << std::endl; +} + +void initmission::createPusTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, std::vector& taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + PeriodicTaskIF* pusVerification = factory.createPeriodicTask( "PUS_VERIF", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); result = pusVerification->addComponent(objects::PUS_SERVICE_1_VERIFICATION); if(result != HasReturnvaluesIF::RETURN_OK){ sif::error << "Object add component failed" << std::endl; } + taskVec.push_back(pusVerification); - PeriodicTaskIF* pusEvents = factory->createPeriodicTask( + PeriodicTaskIF* pusEvents = factory.createPeriodicTask( "PUS_EVENTS", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); - result = pusVerification->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); - if(result != HasReturnvaluesIF::RETURN_OK){ - initmission::printAddObjectError("PUS5", objects::PUS_SERVICE_5_EVENT_REPORTING); + result = pusEvents->addComponent(objects::PUS_SERVICE_5_EVENT_REPORTING); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS_EVENTS", objects::PUS_SERVICE_5_EVENT_REPORTING); } + result = pusEvents->addComponent(objects::EVENT_MANAGER); + if(result != HasReturnvaluesIF::RETURN_OK) { + initmission::printAddObjectError("PUS_MGMT", objects::EVENT_MANAGER); + } + taskVec.push_back(pusEvents); - PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask( + PeriodicTaskIF* pusHighPrio = factory.createPeriodicTask( "PUS_HIGH_PRIO", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); result = pusHighPrio->addComponent(objects::PUS_SERVICE_2_DEVICE_ACCESS); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -102,8 +152,9 @@ void initmission::initTasks() { if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("PUS9", objects::PUS_SERVICE_9_TIME_MGMT); } + taskVec.push_back(pusHighPrio); - PeriodicTaskIF* pusMedPrio = factory->createPeriodicTask( + PeriodicTaskIF* pusMedPrio = factory.createPeriodicTask( "PUS_MED_PRIO", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.8, missedDeadlineFunc); result = pusMedPrio->addComponent(objects::PUS_SERVICE_8_FUNCTION_MGMT); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -121,8 +172,9 @@ void initmission::initTasks() { if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("PUS3", objects::PUS_SERVICE_3_HOUSEKEEPING); } + taskVec.push_back(pusMedPrio); - PeriodicTaskIF* pusLowPrio = factory->createPeriodicTask( + PeriodicTaskIF* pusLowPrio = factory.createPeriodicTask( "PUS_LOW_PRIO", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.6, missedDeadlineFunc); result = pusLowPrio->addComponent(objects::PUS_SERVICE_17_TEST); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -133,26 +185,34 @@ void initmission::initTasks() { initmission::printAddObjectError("INT_ERR_RPRT", objects::INTERNAL_ERROR_REPORTER); } + taskVec.push_back(pusLowPrio); +} - bool startTestPst = true; -#if OBSW_ADD_TEST_PST == 1 - FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, - PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); - result = pst::pstTest(pstTestTask); - if(result != HasReturnvaluesIF::RETURN_OK) { - sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl; - startTestPst = false; +void initmission::createPstTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, std::vector &taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; +#if OBSW_ADD_SPI_TEST_CODE == 0 + FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( + "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, + missedDeadlineFunc); + result = pst::pstSpi(spiPst); + if (result != HasReturnvaluesIF::RETURN_OK) { + sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl; } -#endif /* RPI_TEST_ACS_BOARD == 1 */ + taskVec.push_back(spiPst); +#endif +} - PeriodicTaskIF* testTask = factory->createPeriodicTask( +void initmission::createTestTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector &taskVec) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + PeriodicTaskIF* testTask = factory.createPeriodicTask( "TEST_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); -#if OBSW_ADD_TEST_CODE == 1 result = testTask->addComponent(objects::TEST_TASK); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK); } -#endif /* OBSW_ADD_TEST_CODE == 1 */ #if RPI_ADD_SPI_TEST == 1 result = testTask->addComponent(objects::SPI_TEST); if(result != HasReturnvaluesIF::RETURN_OK) { @@ -172,25 +232,16 @@ void initmission::initTasks() { } #endif /* RPI_ADD_GPIO_TEST == 1 */ - sif::info << "Starting tasks.." << std::endl; - tmTcDistributor->startTask(); - udpBridgeTask->startTask(); - udpPollingTask->startTask(); - - pusVerification->startTask(); - pusEvents->startTask(); - pusHighPrio->startTask(); - pusMedPrio->startTask(); - pusLowPrio->startTask(); - -#if OBSW_ADD_TEST_CODE == 1 - testTask->startTask(); -#endif /* OBSW_ADD_TEST_CODE == 1 */ - + bool startTestPst = true; + static_cast(startTestPst); #if OBSW_ADD_TEST_PST == 1 - if(startTestPst) { - pstTestTask->startTask(); + FixedTimeslotTaskIF* pstTestTask = factory->createFixedTimeslotTask("ACS_PST", 50, + PeriodicTaskIF::MINIMUM_STACK_SIZE * 2, 2.0, missedDeadlineFunc); + result = pst::pstTest(pstTestTask); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::info << "initmission::initTasks: ACS PST empty or invalid" << std::endl; + startTestPst = false; } #endif /* RPI_TEST_ACS_BOARD == 1 */ - sif::info << "Tasks started.." << std::endl; + } diff --git a/bsp_linux_board/InitMission.h b/bsp_linux_board/InitMission.h index 01c72008..f5da5855 100644 --- a/bsp_linux_board/InitMission.h +++ b/bsp_linux_board/InitMission.h @@ -1,9 +1,24 @@ #ifndef BSP_LINUX_INITMISSION_H_ #define BSP_LINUX_INITMISSION_H_ +#include "fsfw/tasks/Typedef.h" +#include + +class PeriodicTaskIF; +class TaskFactory; + namespace initmission { void initMission(); void initTasks(); + +void createPstTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector &taskVec); +void createTestTasks(TaskFactory& factory, + TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector &taskVec); +void createPusTasks(TaskFactory& factory, TaskDeadlineMissedFunction missedDeadlineFunc, + std::vector& taskVec); }; #endif /* BSP_LINUX_INITMISSION_H_ */ diff --git a/bsp_linux_board/ObjectFactory.cpp b/bsp_linux_board/ObjectFactory.cpp index 60ca5b6e..419bb6d8 100644 --- a/bsp_linux_board/ObjectFactory.cpp +++ b/bsp_linux_board/ObjectFactory.cpp @@ -14,9 +14,6 @@ #include "mission/core/GenericFactory.h" #include "mission/utility/TmFunnel.h" #include -#include - -#include "mission/devices/MGMHandlerRM3100.h" #include "mission/devices/GyroADIS16507Handler.h" #include "fsfw/datapoollocal/LocalDataPoolManager.h" @@ -34,6 +31,8 @@ #include "fsfw/osal/common/UdpTcPollingTask.h" #endif +#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h" +#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h" #include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/rpi/GpioRPi.h" @@ -82,7 +81,84 @@ void ObjectFactory::produce(void* args){ SpiCookie* spiCookie = nullptr; static_cast(spiCookie); +#if OBSW_ADD_ACS_BOARD == 1 + if(gpioCookie == nullptr) { + gpioCookie = new GpioCookie(); + } + // TODO: Missing pin for Gyro 2 + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, + "MGM_0_LIS3", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, + "MGM_1_RM3100", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, + "MGM_2_LIS3", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN, + "MGM_3_RM3100", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, + "GYRO_0_ADIS", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, + "GYRO_1_L3G", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_2_ADIS_CS, gpio::GYRO_2_BCM_PIN, + "GYRO_2_ADIS", gpio::Direction::OUT, 1); + gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_3_BCM_PIN, + "GYRO_3_L3G", gpio::Direction::OUT, 1); + gpioIF->addGpios(gpioCookie); + + spiDev = "/dev/spidev0.1"; + spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, + MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); + auto mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_0_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmLis3Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, + RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); + auto mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_1_RM3100_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmRm3100Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_2_LIS3, gpioIds::MGM_2_LIS3_CS, spiDev, + MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); + mgmLis3Handler = new MgmLIS3MDLHandler(objects::MGM_2_LIS3_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmLis3Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::MGM_3_RM3100, gpioIds::MGM_3_RM3100_CS, spiDev, + RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); + mgmRm3100Handler = new MgmRM3100Handler(objects::MGM_3_RM3100_HANDLER, + objects::SPI_COM_IF, spiCookie, 0); + mgmRm3100Handler->setStartUpImmediately(); + + spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie); + adisHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); + gyroL3gHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF, + spiCookie, 0); + gyroL3gHandler->setStartUpImmediately(); + spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, + L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); + adisHandler = new GyroADIS16507Handler(objects::GYRO_3_L3G_HANDLER, objects::SPI_COM_IF, + spiCookie); + gyroL3gHandler->setStartUpImmediately(); + +#endif /* RPI_TEST_ACS_BOARD == 1 */ + #if OBSW_ADD_TEST_CODE == 1 + createTestTasks(); +#endif /* OBSW_ADD_TEST_CODE == 1 */ +} + +void ObjectFactory::createTestTasks() { + new TestTask(objects::TEST_TASK); #if RPI_ADD_SPI_TEST == 1 @@ -109,48 +185,6 @@ void ObjectFactory::produce(void* args){ new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookieLoopback); #endif /* RPI_LOOPBACK_TEST_GPIO == 1 */ -#if RPI_TEST_ACS_BOARD == 1 - if(gpioCookie == nullptr) { - gpioCookie = new GpioCookie(); - } - // TODO: Missing pin for Gyro 2 - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_0_LIS3_CS, gpio::MGM_0_BCM_PIN, - "MGM_0_LIS3", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_1_RM3100_CS, gpio::MGM_1_BCM_PIN, - "MGM_1_RM3100", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_2_LIS3_CS, gpio::MGM_2_BCM_PIN, - "MGM_2_LIS3", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::MGM_3_RM3100_CS, gpio::MGM_3_BCM_PIN, - "MGM_3_RM3100", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_0_ADIS_CS, gpio::GYRO_0_BCM_PIN, - "GYRO_0_ADIS", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_1_L3G_CS, gpio::GYRO_1_BCM_PIN, - "GYRO_1_L3G", gpio::Direction::OUT, 1); - gpio::createRpiGpioConfig(gpioCookie, gpioIds::GYRO_3_L3G_CS, gpio::GYRO_2_BCM_PIN, - "GYRO_2_L3G", gpio::Direction::OUT, 1); - gpioIF->addGpios(gpioCookie); - - spiDev = "/dev/spidev0.0"; - spiCookie = new SpiCookie(addresses::MGM_0_LIS3, gpioIds::MGM_0_LIS3_CS, spiDev, - MGMLIS3MDL::MAX_BUFFER_SIZE, spi::DEFAULT_LIS3_MODE, spi::DEFAULT_LIS3_SPEED); - auto mgmLis3Handler = new MGMHandlerLIS3MDL(objects::MGM_0_LIS3_HANDLER, - objects::SPI_COM_IF, spiCookie); - mgmLis3Handler->setStartUpImmediately(); - - spiCookie = new SpiCookie(addresses::MGM_1_RM3100, gpioIds::MGM_1_RM3100_CS, spiDev, - RM3100::MAX_BUFFER_SIZE, spi::DEFAULT_RM3100_MODE, spi::DEFAULT_RM3100_SPEED); - auto mgmRm3100Handler = new MGMHandlerRM3100(objects::MGM_1_RM3100_HANDLER, - objects::SPI_COM_IF, spiCookie); - mgmRm3100Handler->setStartUpImmediately(); - - spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, - L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); - auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, objects::SPI_COM_IF, - spiCookie); - gyroL3gHandler->setStartUpImmediately(); - -#endif /* RPI_TEST_ACS_BOARD == 1 */ - #if RPI_TEST_ADIS16507 == 1 if(gpioCookie == nullptr) { gpioCookie = new GpioCookie(); @@ -159,7 +193,7 @@ void ObjectFactory::produce(void* args){ "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpioIF->addGpios(gpioCookie); - spiDev = "/dev/spidev0.0"; + spiDev = "/dev/spidev0.1"; spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, spi::DEFAULT_ADIS16507_SPEED, nullptr, nullptr); @@ -177,5 +211,4 @@ void ObjectFactory::produce(void* args){ gpsHandler->setStartUpImmediately(); #endif -#endif /* OBSW_ADD_TEST_CODE == 1 */ } diff --git a/bsp_linux_board/ObjectFactory.h b/bsp_linux_board/ObjectFactory.h index feaba70e..3b9aca49 100644 --- a/bsp_linux_board/ObjectFactory.h +++ b/bsp_linux_board/ObjectFactory.h @@ -5,6 +5,8 @@ namespace ObjectFactory { void setStatics(); void produce(void* args); + + void createTestTasks(); }; #endif /* BSP_LINUX_OBJECTFACTORY_H_ */ diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index f5b4a860..a86a6c79 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -28,10 +28,12 @@ static constexpr uint32_t GPIO_GYRO_2_ADIS_CS = 2; // AA22 /** OBC1F B0 */ /**************************************************************/ static constexpr char GPIO_FLEX_OBC1F_B0[] = "/amba_pl/gpio@42030000"; +static constexpr uint32_t GPIO_FLEX_OBC1F_B0_WIDTH = 20; static const char* const GPIO_ACS_BOARD_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; static const char* const GPIO_RW_DEFAULT_LABEL = GPIO_FLEX_OBC1F_B0; static const char* const GPIO_RAD_SENSOR_LABEL = GPIO_FLEX_OBC1F_B0; + static constexpr uint32_t GPIO_RW_0_CS = 7; // B20 static constexpr uint32_t GPIO_RW_1_CS = 3; // G22 static constexpr uint32_t GPIO_RW_2_CS = 11; // E18 @@ -56,7 +58,10 @@ static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18 /** OBC1F B1 */ /**************************************************************/ static constexpr char GPIO_FLEX_OBC1F_B1[] = "/amba_pl/gpio@42030000"; -static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1; +// Need to use chip name here for now because the label name is the name for +// gpiochip 5 and gpiochip6 +static constexpr char GPIO_FLEX_OBC1F_B1_CHIP[] = "gpiochip6"; +static const char* const GPIO_MGM2_LIS3_LABEL = GPIO_FLEX_OBC1F_B1_CHIP; static constexpr uint32_t GPIO_MGM_2_LIS3_CS = 0; // D18 /**************************************************************/ diff --git a/bsp_q7s/boardconfig/q7sConfig.h.in b/bsp_q7s/boardconfig/q7sConfig.h.in index 40b5a510..43283ea1 100644 --- a/bsp_q7s/boardconfig/q7sConfig.h.in +++ b/bsp_q7s/boardconfig/q7sConfig.h.in @@ -28,7 +28,6 @@ // Probably better if this is disabled for mission code. Convenient for development #define Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1 -#define Q7S_ADD_RTD_DEVICES 0 #define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0 diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index e8be0ef1..a6d6dda3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -129,13 +129,13 @@ void ObjectFactory::produce(void* args) { #endif /* OBSW_ADD_ACS_BOARD == 1 */ createHeaterComponents(); createSolarArrayDeploymentComponents(); -#if Q7S_ADD_SYRLINKS_HANDLER == 1 +#if OBSW_ADD_SYRLINKS == 1 createSyrlinksComponents(); -#endif /* Q7S_ADD_SYRLINKS_HANDLER == 1 */ +#endif /* OBSW_ADD_SYRLINKS == 1 */ -#if Q7S_ADD_RTD_DEVICES == 1 +#if OBSW_ADD_RTD_DEVICES == 1 createRtdComponents(); -#endif /* Q7S_ADD_RTD_DEVICES == 1 */ +#endif /* OBSW_ADD_RTD_DEVICES == 1 */ I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); @@ -265,8 +265,8 @@ void ObjectFactory::createPcduComponents() { void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) { GpioCookie* gpioCookieRadSensor = new GpioCookie; - GpiodRegular* chipSelectRadSensor = new GpiodRegular("Chip Select Radiation Sensor", gpio::OUT, - 1, q7s::GPIO_RAD_SENSOR_LABEL, q7s::GPIO_RAD_SENSOR_CS); + auto chipSelectRadSensor = new GpiodRegularByLabel(q7s::GPIO_RAD_SENSOR_LABEL, + q7s::GPIO_RAD_SENSOR_CS, "Chip Select Radiation Sensor", gpio::OUT, gpio::HIGH); gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor); gpioComIF->addGpios(gpioCookieRadSensor); @@ -392,47 +392,47 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComI void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) { GpioCookie* gpioCookieAcsBoard = new GpioCookie(); - GpiodRegular* gpio = nullptr; - gpio = new GpiodRegular("CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - q7s::GPIO_GYRO_0_ADIS_CS); + GpiodRegularByLabel* gpio = nullptr; + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_0_ADIS_CS, + "CS_GYRO_0_ADIS", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular("CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS, + "CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular("CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - q7s::GPIO_GYRO_2_ADIS_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_2_ADIS_CS, + "CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegular("CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS, + "CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); - gpio = new GpiodRegular("CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS, + "CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular("CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS, + "CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular("CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH, q7s::GPIO_MGM2_LIS3_LABEL, - q7s::GPIO_MGM_2_LIS3_CS); - gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular("CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS); + auto gpioChip = new GpiodRegularByChip(q7s::GPIO_MGM2_LIS3_LABEL, q7s::GPIO_MGM_2_LIS3_CS, + "CS_MGM_2_LIS3_B", gpio::OUT, gpio::HIGH); + gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpioChip); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_3_RM3100_CS, + "CS_MGM_3_RM3100_B", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); // GNSS reset pins are active low - gpio = new GpiodRegular("GNSS_0_NRESET", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0, + "GNSS_0_NRESET", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio); - gpio = new GpiodRegular("GNSS_1_NRESET", gpio::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1, + "GNSS_1_NRESET", gpio::OUT, gpio::HIGH); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio); // Enable pins must be pulled low for regular operations - gpio = new GpiodRegular("GYRO_0_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_FLEX_OBC1F_B0, - q7s::GPIO_GYRO_0_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, + "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegular("GYRO_2_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_3V3_OBC1C, - q7s::GPIO_GYRO_2_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, + "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio); // TODO: Add enable pins for GPS as soon as new interface board design is finished @@ -542,37 +542,37 @@ void ObjectFactory::createHeaterComponents() { GpioCookie* heaterGpiosCookie = new GpioCookie; /* Pin H2-11 on stack connector */ - GpiodRegular* gpioConfigHeater0 = new GpiodRegular("Heater0", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN); + auto gpioConfigHeater0 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN, + "Heater0", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0); /* Pin H2-12 on stack connector */ - GpiodRegular* gpioConfigHeater1 = new GpiodRegular("Heater1", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN); + auto gpioConfigHeater1 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN, + "Heater1", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1); /* Pin H2-13 on stack connector */ - GpiodRegular* gpioConfigHeater2 = new GpiodRegular("Heater2", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN); + auto gpioConfigHeater2 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN, + "Heater2", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2); - GpiodRegular* gpioConfigHeater3 = new GpiodRegular("Heater3", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN); + auto gpioConfigHeater3 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN, + "Heater3", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3); - GpiodRegular* gpioConfigHeater4 = new GpiodRegular("Heater4", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN); + auto gpioConfigHeater4 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN, + "Heater4", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4); - GpiodRegular* gpioConfigHeater5 = new GpiodRegular("Heater5", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN); + auto gpioConfigHeater5 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN, + "Heater5", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5); - GpiodRegular* gpioConfigHeater6 = new GpiodRegular("Heater6", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN); + auto gpioConfigHeater6 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN, + "Heater6", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6); - GpiodRegular* gpioConfigHeater7 = new GpiodRegular("Heater7", gpio::OUT, 0, - q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN); + auto gpioConfigHeater7 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN, + "Heater7", gpio::OUT, gpio::LOW); heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7); new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie, @@ -582,11 +582,11 @@ void ObjectFactory::createHeaterComponents() { void ObjectFactory::createSolarArrayDeploymentComponents() { GpioCookie* solarArrayDeplCookie = new GpioCookie; - GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular("DeplSA0", gpio::OUT, 0, - q7s::GPIO_SOLAR_ARR_DEPL_LABEL, q7s::GPIO_SOL_DEPL_SA_0_PIN); + auto gpioConfigDeplSA0 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL, + q7s::GPIO_SOL_DEPL_SA_0_PIN, "DeplSA0", gpio::OUT, gpio::LOW); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpioConfigDeplSA0); - GpiodRegular* gpioConfigDeplSA1 = new GpiodRegular("DeplSA1", gpio::OUT, 0, - q7s::GPIO_SOLAR_ARR_DEPL_LABEL, q7s::GPIO_SOL_DEPL_SA_1_PIN); + auto gpioConfigDeplSA1 = new GpiodRegularByLabel(q7s::GPIO_SOLAR_ARR_DEPL_LABEL, + q7s::GPIO_SOL_DEPL_SA_1_PIN, "DeplSA1", gpio::OUT, gpio::LOW); solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpioConfigDeplSA1); //TODO: Find out burn time. For now set to 1000 ms. @@ -766,17 +766,25 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4); - GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); +// GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, +// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); +// gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); +// GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, +// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); +// gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); +// GpiodRegular* enRw3 = new GpiodRegular(, gpio::OUT, 0, +// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); + auto enRw1 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS, + "Enable reaction wheel 1", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); - GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); + auto enRw2 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS, + "Enable reaction wheel 2", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); - GpiodRegular* enRw3 = new GpiodRegular("Enable reaction wheel 3", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); + auto enRw3 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS, + "Enable reaction wheel 3", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3); - GpiodRegular* enRw4 = new GpiodRegular("Enable reaction wheel 4", gpio::OUT, 0, - q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_3_CS); + auto enRw4 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_3_CS, + "Enable reaction wheel 4", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4); /** @@ -784,8 +792,8 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { * the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core. * Per default the PS SPI is selected (EMIO = 0). */ - GpiodRegular* spiMux = new GpiodRegular("EMIO 0 SPI Mux", gpio::OUT, 0, - q7s::GPIO_RW_SPI_MUX_LABEL, q7s::GPIO_RW_SPI_MUX_CS); + auto spiMux = new GpiodRegularByLabel(q7s::GPIO_RW_SPI_MUX_LABEL, + q7s::GPIO_RW_SPI_MUX_CS, "EMIO 0 SPI Mux", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux); gpioComIF->addGpios(gpioCookieRw); diff --git a/bsp_q7s/gpio/gpioCallbacks.cpp b/bsp_q7s/gpio/gpioCallbacks.cpp index da3678c6..da7c58e4 100644 --- a/bsp_q7s/gpio/gpioCallbacks.cpp +++ b/bsp_q7s/gpio/gpioCallbacks.cpp @@ -24,30 +24,31 @@ void initSpiCsDecoder(GpioIF* gpioComIF) { GpioCookie* spiMuxGpios = new GpioCookie; + GpiodRegularByLabel* spiMuxBit = nullptr; /** Setting mux bit 1 to low will disable IC21 on the interface board */ - GpiodRegular* spiMuxBit1 = new GpiodRegular(std::string("SPI Mux Bit 1"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit1); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1, + "SPI Mux Bit 1", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_1, spiMuxBit); /** Setting mux bit 2 to low disables IC1 on the TCS board */ - GpiodRegular* spiMuxBit2 = new GpiodRegular(std::string("SPI Mux Bit 2"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit2); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2, + "SPI Mux Bit 2", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_2, spiMuxBit); /** Setting mux bit 3 to low disables IC2 on the TCS board and IC22 on the interface board */ - GpiodRegular* spiMuxBit3 = new GpiodRegular(std::string("SPI Mux Bit 3"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit3); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3, + "SPI Mux Bit 3", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit); /** The following gpios can take arbitrary initial values */ - GpiodRegular* spiMuxBit4 = new GpiodRegular(std::string("SPI Mux Bit 4"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit4); - GpiodRegular* spiMuxBit5 = new GpiodRegular(std::string("SPI Mux Bit 5"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit5); - GpiodRegular* spiMuxBit6 = new GpiodRegular(std::string("SPI Mux Bit 6"), gpio::OUT, 0, - q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6); - spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit6); - GpiodRegular* enRwDecoder = new GpiodRegular(std::string("EN_RW_CS"), gpio::OUT, 1, - q7s::GPIO_FLEX_OBC1F_B1, q7s::EN_RW_CS); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4, + "SPI Mux Bit 4", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_4, spiMuxBit); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_5, + "SPI Mux Bit 5", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_5, spiMuxBit); + spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_6, + "SPI Mux Bit 6", gpio::OUT, gpio::LOW); + spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_6, spiMuxBit); + GpiodRegularByLabel* enRwDecoder = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B1, + q7s::EN_RW_CS, "EN_RW_CS", gpio::OUT, gpio::HIGH); spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder); result = gpioComInterface->addGpios(spiMuxGpios); diff --git a/common/config/OBSWVersion.h b/common/config/OBSWVersion.h index 1656eda0..5e9b1b9c 100644 --- a/common/config/OBSWVersion.h +++ b/common/config/OBSWVersion.h @@ -4,7 +4,7 @@ const char* const SW_NAME = "eive"; #define SW_VERSION 1 -#define SW_SUBVERSION 6 -#define SW_REVISION 1 +#define SW_SUBVERSION 7 +#define SW_REVISION 0 #endif /* COMMON_CONFIG_OBSWVERSION_H_ */ diff --git a/fsfw b/fsfw index 70a3749d..5c56eda6 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 70a3749dbe2cf7d23c685b0e3b3ce350a7c9db05 +Subproject commit 5c56eda61077e3aef00d32133c5546987b476e8c diff --git a/linux/archive/gpio/LinuxLibgpioIF.cpp b/linux/archive/gpio/LinuxLibgpioIF.cpp index 64ee2982..92ffa63c 100644 --- a/linux/archive/gpio/LinuxLibgpioIF.cpp +++ b/linux/archive/gpio/LinuxLibgpioIF.cpp @@ -10,6 +10,9 @@ LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) { + struct gpiod_chip* chip = gpiod_chip_open_by_label("/amba_pl/gpio@42030000"); + + sif::debug << chip->name << std::endl; } LinuxLibgpioIF::~LinuxLibgpioIF() { diff --git a/linux/archive/gpio/LinuxLibgpioIF.h b/linux/archive/gpio/LinuxLibgpioIF.h index a5015999..9c444e50 100644 --- a/linux/archive/gpio/LinuxLibgpioIF.h +++ b/linux/archive/gpio/LinuxLibgpioIF.h @@ -47,9 +47,9 @@ private: * @param gpioId The GPIO ID of the GPIO to drive. * @param logiclevel The logic level to set. O or 1. */ - ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegular* regularGpio, unsigned int logiclevel); + ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio, unsigned int logiclevel); - ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegular* regularGpio); + ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio); /** * @brief This function checks if GPIOs are already registered and whether diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index e69c63e5..8a340ecb 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -206,7 +206,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { /* Configure all SPI chip selects and pull them high */ acsInit(); - l3gId = gyro3L3gd20ChipSelect; + l3gId = gyro1L3gd20ChipSelect; /* Adapt accordingly */ if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro3L3gd20ChipSelect) { @@ -298,72 +298,73 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) { void SpiTestClass::acsInit() { GpioCookie* gpioCookie = new GpioCookie(); - GpiodRegular* gpio = nullptr; - #ifdef RASPBERRY_PI + +#ifdef RASPBERRY_PI + GpiodRegularByChip* gpio = nullptr; std::string rpiGpioName = "gpiochip0"; - gpio = new GpiodRegular(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", + gpio = new GpiodRegularByChip(rpiGpioName, mgm0Lis3mdlChipSelect, "MGM_0_LIS3", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", + gpio = new GpiodRegularByChip(rpiGpioName, mgm1Rm3100ChipSelect, "MGM_1_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", + gpio = new GpiodRegularByChip(rpiGpioName, gyro0AdisChipSelect, "GYRO_0_ADIS", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", + gpio = new GpiodRegularByChip(rpiGpioName, gyro1L3gd20ChipSelect, "GYRO_1_L3G", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, gyro2L3gd20ChipSelect, "GYRO_2_L3G", + gpio = new GpiodRegularByChip(rpiGpioName, gyro3L3gd20ChipSelect, "GYRO_2_L3G", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", + gpio = new GpiodRegularByChip(rpiGpioName, mgm2Lis3mdlChipSelect, "MGM_2_LIS3", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", + gpio = new GpiodRegularByChip(rpiGpioName, mgm3Rm3100ChipSelect, "MGM_3_RM3100", gpio::Direction::OUT, 1); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - #elif defined(XIPHOS_Q7S) - -gpio = new GpiodRegular("MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm0Lis3mdlChipSelect); +#elif defined(XIPHOS_Q7S) + GpiodRegularByLabel* gpio = nullptr; + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm0Lis3mdlChipSelect, + "MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio); - gpio = new GpiodRegular("MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect, + "MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio); - gpio = new GpiodRegular("MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_MGM2_LIS3_LABEL, - mgm2Lis3mdlChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, mgm2Lis3mdlChipSelect, + "MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio); - gpio = new GpiodRegular("MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect, + "MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio); - gpio = new GpiodRegular("GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - gyro0AdisChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro0AdisChipSelect, + "GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio); - gpio = new GpiodRegular("GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect, + "GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio); - gpio = new GpiodRegular("GYRO_2_ADIS", gpio::Direction::OUT, gpio::HIGH, q7s::GPIO_GYRO_ADIS_LABEL, - gyro2AdisChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro2AdisChipSelect, "GYRO_2_ADIS", + gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio); - gpio = new GpiodRegular("GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH, - q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect); + gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect, + "GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH); gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio); // Enable pins must be pulled low for regular operations - gpio = new GpiodRegular("GYRO_0_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_FLEX_OBC1F_B0, - q7s::GPIO_GYRO_0_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE, + "GYRO_0_ENABLE", gpio::OUT, gpio::LOW); gpioCookie->addGpio(gpioIds::GYRO_0_ENABLE, gpio); - gpio = new GpiodRegular("GYRO_2_ENABLE", gpio::OUT, gpio::LOW, q7s::GPIO_3V3_OBC1C, - q7s::GPIO_GYRO_2_ENABLE); + gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE, + "GYRO_2_ENABLE", gpio::OUT, gpio::LOW); gpioCookie->addGpio(gpioIds::GYRO_2_ENABLE, gpio); - #endif +#endif if (gpioIF != nullptr) { gpioIF->addGpios(gpioCookie); } diff --git a/linux/boardtest/SpiTestClass.h b/linux/boardtest/SpiTestClass.h index d5309a1e..45a7cdd8 100644 --- a/linux/boardtest/SpiTestClass.h +++ b/linux/boardtest/SpiTestClass.h @@ -45,13 +45,15 @@ private: /* ACS board specific variables */ #ifdef RASPBERRY_PI - uint8_t mgm0Lis3mdlChipSelect = 0; - uint8_t mgm1Rm3100ChipSelect = 1; - uint8_t gyro0AdisChipSelect = 5; - uint8_t gyro1L3gd20ChipSelect = 6; - uint8_t gyro2L3gd20ChipSelect = 4; - uint8_t mgm2Lis3mdlChipSelect = 17; - uint8_t mgm3Rm3100ChipSelect = 27; + uint8_t mgm0Lis3mdlChipSelect = gpio::MGM_0_BCM_PIN; + uint8_t mgm1Rm3100ChipSelect = gpio::MGM_1_BCM_PIN; + uint8_t mgm2Lis3mdlChipSelect = gpio::MGM_2_BCM_PIN; + uint8_t mgm3Rm3100ChipSelect = gpio::MGM_3_BCM_PIN; + + uint8_t gyro0AdisChipSelect = gpio::GYRO_0_BCM_PIN; + uint8_t gyro1L3gd20ChipSelect = gpio::GYRO_1_BCM_PIN; + uint8_t gyro2AdisChipSelect = gpio::GYRO_2_BCM_PIN; + uint8_t gyro3L3gd20ChipSelect = gpio::GYRO_3_BCM_PIN; #elif defined(XIPHOS_Q7S) uint8_t mgm0Lis3mdlChipSelect = q7s::GPIO_MGM_0_LIS3_CS; uint8_t mgm1Rm3100ChipSelect = q7s::GPIO_MGM_1_RM3100_CS; diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 7abe1ea8..bf5c1405 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -31,6 +31,8 @@ debugging. */ //! Timers can mess up the code when debugging //! All of this should be enabled for mission code! +#if defined XIPHOS_Q7S + #define OBSW_ENABLE_TIMERS 1 #define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_PLOC_SUPERVISOR 0 @@ -39,6 +41,29 @@ debugging. */ #define OBSW_ADD_ACS_BOARD 0 #define OBSW_ADD_GPS_0 0 #define OBSW_ADD_GPS_1 0 +#define OBSW_ADD_RW 0 +#define OBSW_ADD_RTD_DEVICES 0 +#define OBSW_ADD_TMP_DEVICES 0 +#define OBSW_ADD_RAD_SENSORS 0 +#define OBSW_ADD_SYRLINKS 0 + +#elif defined RASPBERRY_PI + +#define OBSW_ENABLE_TIMERS 1 +#define OBSW_ADD_STAR_TRACKER 0 +#define OBSW_ADD_PLOC_SUPERVISOR 0 +#define OBSW_ADD_PLOC_MPSOC 0 +#define OBSW_ADD_SUN_SENSORS 0 +#define OBSW_ADD_ACS_BOARD 0 +#define OBSW_ADD_GPS_0 0 +#define OBSW_ADD_GPS_1 0 +#define OBSW_ADD_RW 0 +#define OBSW_ADD_RTD_DEVICES 0 +#define OBSW_ADD_TMP_DEVICES 0 +#define OBSW_ADD_RAD_SENSORS 0 +#define OBSW_ADD_SYRLINKS 0 + +#endif /*******************************************************************/ /** All of the following flags should be disabled for mission code */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 727334d2..47851b0d 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -28,12 +28,14 @@ ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { uint32_t length = thisSequence->getPeriodMs(); - + static_cast(length); +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC5, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -50,11 +52,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC17, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RTD_IC18, length * 0, DeviceHandlerIF::PERFORM_OPERATION); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.2, DeviceHandlerIF::SEND_WRITE); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC4, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC5, length * 0.2, DeviceHandlerIF::SEND_WRITE); @@ -71,11 +75,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC17, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RTD_IC18, length * 0.2, DeviceHandlerIF::SEND_WRITE); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.4, DeviceHandlerIF::GET_WRITE); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC4, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC5, length * 0.4, DeviceHandlerIF::GET_WRITE); @@ -92,11 +98,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC17, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RTD_IC18, length * 0.4, DeviceHandlerIF::GET_WRITE); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.6, DeviceHandlerIF::SEND_READ); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC4, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC5, length * 0.6, DeviceHandlerIF::SEND_READ); @@ -113,11 +121,13 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC17, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RTD_IC18, length * 0.6, DeviceHandlerIF::SEND_READ); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_TMP_DEVICES == 1 thisSequence->addSlot(objects::TMP1075_HANDLER_1, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::TMP1075_HANDLER_2, length * 0.8, DeviceHandlerIF::GET_READ); -#if Q7S_ADD_RTD_DEVICES == 1 +#endif +#if OBSW_ADD_RTD_DEVICES == 1 thisSequence->addSlot(objects::RTD_IC3, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC4, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC5, length * 0.8, DeviceHandlerIF::GET_READ); @@ -134,14 +144,16 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RTD_IC16, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC17, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RTD_IC18, length * 0.8, DeviceHandlerIF::GET_READ); -#endif /* Q7S_ADD_RTD_DEVICES */ +#endif /* OBSW_ADD_RTD_DEVICES */ +#if OBSW_ADD_RAD_SENSORS == 1 /* Radiation sensor */ thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); +#endif #if OBSW_ADD_SUN_SENSORS == 1 /** @@ -400,6 +412,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::SUS_13, length * 0.938, DeviceHandlerIF::GET_READ); #endif +#if OBSW_ADD_RW == 1 thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW1, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW1, length * 0.4, DeviceHandlerIF::GET_WRITE); @@ -408,69 +421,70 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW2, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RW2, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RW2, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW2, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW2, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW3, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RW3, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RW3, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW3, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW3, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW4, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::RW4, length * 0.4, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ); + thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::RW4, length * 0.7, DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::RW4, length * 0.85, DeviceHandlerIF::GET_READ); +#endif #if OBSW_ADD_ACS_BOARD == 1 - bool enableAside = false; - bool enableBside = true; + bool enableAside = true; + bool enableBside = false; if(enableAside) { // A side thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, + thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.25, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, + thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, - // DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, - // DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, - // DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, - // DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, - // DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.3, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); } @@ -480,44 +494,44 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.7, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, + thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.25, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, + thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, - // DeviceHandlerIF::PERFORM_OPERATION); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, - // DeviceHandlerIF::SEND_WRITE); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.4, - // DeviceHandlerIF::GET_WRITE); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, - // DeviceHandlerIF::SEND_READ); - // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.8, - // DeviceHandlerIF::GET_READ); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, +// DeviceHandlerIF::PERFORM_OPERATION); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.3, +// DeviceHandlerIF::SEND_WRITE); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.6, +// DeviceHandlerIF::GET_WRITE); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.75, +// DeviceHandlerIF::SEND_READ); +// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.85, +// DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.35, DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.75, DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, + thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.85, DeviceHandlerIF::GET_READ); } #endif /* OBSW_ADD_ACS_BOARD == 1 */ @@ -580,7 +594,7 @@ ReturnValue_t pst::pstUart(FixedTimeslotTaskIF *thisSequence) { DeviceHandlerIF::GET_READ); #endif -#if Q7S_ADD_SYRLINKS_HANDLER == 1 +#if OBSW_ADD_SYRLINKS == 1 uartPstEmpty = false; thisSequence->addSlot(objects::SYRLINKS_HK_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION); @@ -708,77 +722,6 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) { /* Length of a communication cycle */ uint32_t length = thisSequence->getPeriodMs(); bool notEmpty = false; -#if OBSW_ADD_ACS_BOARD == 1 - notEmpty = true; - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_3_L3G_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - - - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); -#endif #if RPI_TEST_ADIS16507 == 1 notEmpty = true;