cleaned up code a bit
This commit is contained in:
parent
1348f7dafb
commit
7f0c6863d6
@ -33,7 +33,7 @@ namespace pcduSwitches {
|
||||
static const uint8_t INIT_STATE_Q7S = ON;
|
||||
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH1 = OFF;
|
||||
static const uint8_t INIT_STATE_RW = OFF;
|
||||
#if TE0720 == 1
|
||||
#if BOARD_TE0720 == 1
|
||||
/* Because the TE0720 is not connected to the PCDU, this switch is always on */
|
||||
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = ON;
|
||||
#else
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <bsp_q7s/memory/FileSystemHandler.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include "Q7STestTask.h"
|
||||
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
@ -18,14 +20,15 @@ Q7STestTask::Q7STestTask(object_id_t objectId): TestTask(objectId) {
|
||||
}
|
||||
|
||||
ReturnValue_t Q7STestTask::performOneShotAction() {
|
||||
//sdCardTests();
|
||||
testScratchApi();
|
||||
//testSdCard();
|
||||
//testScratchApi();
|
||||
//testJsonLibDirect();
|
||||
//testDummyParams();
|
||||
testFileSystemHandlerDirect();
|
||||
return TestTask::performOneShotAction();
|
||||
}
|
||||
|
||||
void Q7STestTask::sdCardTests() {
|
||||
void Q7STestTask::testSdCard() {
|
||||
using namespace std;
|
||||
Stopwatch stopwatch;
|
||||
int result = std::system("q7hw sd info all > /tmp/sd_status.txt");
|
||||
@ -126,3 +129,12 @@ void Q7STestTask::testDummyParams() {
|
||||
sif::info << "Test value (3 expected): " << test << std::endl;
|
||||
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
|
||||
}
|
||||
|
||||
void Q7STestTask::testFileSystemHandlerDirect() {
|
||||
auto fsHandler = ObjectManager::instance()->
|
||||
get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);
|
||||
if(fsHandler == nullptr) {
|
||||
sif::warning << "Q7STestTask::testFileSystemHandlerDirect: No FS handler running.."
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
@ -9,12 +9,13 @@ public:
|
||||
private:
|
||||
ReturnValue_t performOneShotAction() override;
|
||||
|
||||
void sdCardTests();
|
||||
void testSdCard();
|
||||
void fileTests();
|
||||
|
||||
void testScratchApi();
|
||||
void testJsonLibDirect();
|
||||
void testDummyParams();
|
||||
void testFileSystemHandlerDirect();
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "CoreController.h"
|
||||
#include "q7sConfig.h"
|
||||
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
#include "../memory/scratchApi.h"
|
||||
#include "../memory/SdCardManager.h"
|
||||
|
||||
@ -25,7 +27,16 @@ LocalPoolDataSetBase* CoreController::getDataSetHandle(sid_t sid) {
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::initialize() {
|
||||
return sdCardInit();
|
||||
ReturnValue_t result = sdCardInit();
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "CoreController::initialize: SD card init failed" << std::endl;
|
||||
}
|
||||
result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
||||
"count failed" << std::endl;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
@ -162,3 +173,13 @@ ReturnValue_t CoreController::sdCardColdRedundantInit(SdCardManager* sdcMan,
|
||||
sdcMan->updateSdCardStateFile();
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::incrementAllocationFailureCount() {
|
||||
uint32_t count = 0;
|
||||
ReturnValue_t result = scratch::readNumber(scratch::ALLOC_FAILURE_COUNT, count);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
count++;
|
||||
return scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, count);
|
||||
}
|
||||
|
@ -4,14 +4,22 @@
|
||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
|
||||
#include "events/subsystemIdRanges.h"
|
||||
|
||||
class CoreController: public ExtendedControllerBase {
|
||||
public:
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
|
||||
|
||||
static constexpr Event ALLOC_FAILURE = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||
|
||||
CoreController(object_id_t objectId);
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
||||
void performControlOperation() override;
|
||||
|
||||
static ReturnValue_t incrementAllocationFailureCount();
|
||||
private:
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
|
@ -162,7 +162,7 @@ void initmission::initTasks() {
|
||||
initmission::printAddObjectError("ERROR_REPORTER", objects::INTERNAL_ERROR_REPORTER);
|
||||
}
|
||||
|
||||
#if TE0720 == 0
|
||||
#if BOARD_TE0720 == 0
|
||||
//TODO: Add handling of missed deadlines
|
||||
/* Polling Sequence Table Default */
|
||||
#if Q7S_ADD_SPI_TEST == 0
|
||||
@ -201,7 +201,7 @@ void initmission::initTasks() {
|
||||
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
|
||||
}
|
||||
|
||||
#else /* TE7020 == 0 */
|
||||
#else /* BOARD_TE7020 == 0 */
|
||||
FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory->createFixedTimeslotTask(
|
||||
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0,
|
||||
missedDeadlineFunc);
|
||||
@ -209,7 +209,7 @@ void initmission::initTasks() {
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
|
||||
}
|
||||
#endif /* TE7020 == 1 */
|
||||
#endif /* BOARD_TE7020 == 1 */
|
||||
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
PeriodicTaskIF* testTask = factory->createPeriodicTask(
|
||||
@ -226,7 +226,7 @@ void initmission::initTasks() {
|
||||
}
|
||||
#endif
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
#if TE0720 == 1 && TEST_LIBGPIOD == 1
|
||||
#if BOARD_TE0720 == 1 && TEST_LIBGPIOD == 1
|
||||
result = testTask->addComponent(objects::LIBGPIOD_TEST);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
initmission::printAddObjectError("GPIOD_TEST", objects::LIBGPIOD_TEST);
|
||||
@ -239,7 +239,7 @@ void initmission::initTasks() {
|
||||
udpPollingTask->startTask();
|
||||
coreController->startTask();
|
||||
|
||||
#if TE0720 == 0
|
||||
#if BOARD_TE0720 == 0
|
||||
uartPst->startTask();
|
||||
gpioPst->startTask();
|
||||
i2cPst->startTask();
|
||||
@ -248,7 +248,7 @@ void initmission::initTasks() {
|
||||
spiPst->startTask();
|
||||
#endif /* Q7S_ADD_SPI_TEST == 0 */
|
||||
|
||||
#elif TE0720 == 1 && Q7S_ADD_SPI_TEST == 0
|
||||
#elif BOARD_TE0720 == 1 && Q7S_ADD_SPI_TEST == 0
|
||||
pollingSequenceTaskTE0720->startTask();
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include <bsp_q7s/boardtest/Q7STestTask.h>
|
||||
#include "ObjectFactory.h"
|
||||
#include "OBSWConfig.h"
|
||||
#include "tmtc/apid.h"
|
||||
@ -11,62 +10,67 @@
|
||||
#include "bsp_q7s/gpio/gpioCallbacks.h"
|
||||
#include "bsp_q7s/core/CoreController.h"
|
||||
#include "bsp_q7s/spiCallbacks/rwSpiCallback.h"
|
||||
#include "bsp_q7s/boardtest/Q7STestTask.h"
|
||||
|
||||
#include <linux/devices/HeaterHandler.h>
|
||||
#include <linux/devices/SolarArrayDeploymentHandler.h>
|
||||
#include <linux/devices/devicedefinitions/SusDefinitions.h>
|
||||
#include <linux/devices/SusHandler.h>
|
||||
#include <linux/csp/CspCookie.h>
|
||||
#include <linux/csp/CspComIF.h>
|
||||
#include "linux/devices/HeaterHandler.h"
|
||||
#include "linux/devices/SolarArrayDeploymentHandler.h"
|
||||
#include "linux/devices/devicedefinitions/SusDefinitions.h"
|
||||
#include "linux/devices/SusHandler.h"
|
||||
#include "linux/csp/CspCookie.h"
|
||||
#include "linux/csp/CspComIF.h"
|
||||
|
||||
#include <mission/core/GenericFactory.h>
|
||||
#include <mission/devices/PDU1Handler.h>
|
||||
#include <mission/devices/PDU2Handler.h>
|
||||
#include <mission/devices/ACUHandler.h>
|
||||
#include <mission/devices/PCDUHandler.h>
|
||||
#include <mission/devices/P60DockHandler.h>
|
||||
#include <mission/devices/Tmp1075Handler.h>
|
||||
#include <mission/devices/Max31865PT1000Handler.h>
|
||||
#include <mission/devices/IMTQHandler.h>
|
||||
#include <mission/devices/SyrlinksHkHandler.h>
|
||||
#include <mission/devices/MGMHandlerLIS3MDL.h>
|
||||
#include <mission/devices/MGMHandlerRM3100.h>
|
||||
#include <mission/devices/PlocHandler.h>
|
||||
#include <mission/devices/RadiationSensorHandler.h>
|
||||
#include <mission/devices/RwHandler.h>
|
||||
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
||||
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
|
||||
#include <mission/devices/devicedefinitions/PlocDefinitions.h>
|
||||
#include <mission/devices/devicedefinitions/RadSensorDefinitions.h>
|
||||
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
|
||||
#include <mission/devices/devicedefinitions/RwDefinitions.h>
|
||||
#include <mission/utility/TmFunnel.h>
|
||||
#include <linux/obc/CCSDSIPCoreBridge.h>
|
||||
#include "mission/core/GenericFactory.h"
|
||||
#include "mission/devices/PDU1Handler.h"
|
||||
#include "mission/devices/PDU2Handler.h"
|
||||
#include "mission/devices/ACUHandler.h"
|
||||
#include "mission/devices/PCDUHandler.h"
|
||||
#include "mission/devices/P60DockHandler.h"
|
||||
#include "mission/devices/Tmp1075Handler.h"
|
||||
#include "mission/devices/Max31865PT1000Handler.h"
|
||||
#include "mission/devices/IMTQHandler.h"
|
||||
#include "mission/devices/SyrlinksHkHandler.h"
|
||||
#include "mission/devices/MGMHandlerLIS3MDL.h"
|
||||
#include "mission/devices/MGMHandlerRM3100.h"
|
||||
#include "mission/devices/PlocHandler.h"
|
||||
#include "mission/devices/RadiationSensorHandler.h"
|
||||
#include "mission/devices/RwHandler.h"
|
||||
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/PlocDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
|
||||
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
||||
#include "mission/utility/TmFunnel.h"
|
||||
#include "linux/obc/CCSDSIPCoreBridge.h"
|
||||
|
||||
#include "fsfw/hal/linux/uart/UartComIF.h"
|
||||
#include "fsfw/hal/linux/uart/UartCookie.h"
|
||||
#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h"
|
||||
#include <fsfw/hal/linux/i2c/I2cCookie.h>
|
||||
#include <fsfw/hal/linux/i2c/I2cComIF.h>
|
||||
#include <fsfw/hal/linux/spi/SpiCookie.h>
|
||||
#include <fsfw/hal/linux/spi/SpiComIF.h>
|
||||
#include <fsfw/hal/linux/gpio/LinuxLibgpioIF.h>
|
||||
#include <fsfw/hal/common/gpio/GpioCookie.h>
|
||||
#include "fsfw/hal/linux/i2c/I2cCookie.h"
|
||||
#include "fsfw/hal/linux/i2c/I2cComIF.h"
|
||||
#include "fsfw/hal/linux/spi/SpiCookie.h"
|
||||
#include "fsfw/hal/linux/spi/SpiComIF.h"
|
||||
#include "fsfw/hal/linux/gpio/LinuxLibgpioIF.h"
|
||||
#include "fsfw/hal/common/gpio/GpioCookie.h"
|
||||
|
||||
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||
#include <fsfw/tmtcpacket/pus/tm.h>
|
||||
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
|
||||
#include "fsfw/tmtcservices/CommandingServiceBase.h"
|
||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||
|
||||
/* UDP server includes */
|
||||
#include <fsfw/osal/common/UdpTmTcBridge.h>
|
||||
#include <fsfw/osal/common/UdpTcPollingTask.h>
|
||||
#include <linux/boardtest/SpiTestClass.h>
|
||||
#include "fsfw/osal/common/UdpTmTcBridge.h"
|
||||
#include "fsfw/osal/common/UdpTcPollingTask.h"
|
||||
#include "linux/boardtest/SpiTestClass.h"
|
||||
|
||||
#if TEST_LIBGPIOD == 1
|
||||
#include <linux/boardtest/LibgpiodTest.h>
|
||||
#include "linux/boardtest/LibgpiodTest.h"
|
||||
#endif
|
||||
|
||||
void ObjectFactory::setStatics() {
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
}
|
||||
|
||||
void Factory::setStaticFrameworkObjectIds() {
|
||||
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
|
||||
PusServiceBase::packetDestination = objects::TM_FUNNEL;
|
||||
@ -84,24 +88,54 @@ void Factory::setStaticFrameworkObjectIds() {
|
||||
TmPacketBase::timeStamperId = objects::TIME_STAMPER;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ObjectFactory::produce(void* args){
|
||||
Factory::setStaticFrameworkObjectIds();
|
||||
ObjectFactory::setStatics();
|
||||
ObjectFactory::produceGenericObjects();
|
||||
LinuxLibgpioIF* gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
||||
|
||||
/* Communication interfaces */
|
||||
new CspComIF(objects::CSP_COM_IF);
|
||||
new I2cComIF(objects::I2C_COM_IF);
|
||||
new UartComIF(objects::UART_COM_IF);
|
||||
#if Q7S_ADD_SPI_TEST == 0
|
||||
new SpiComIF(objects::SPI_COM_IF, gpioComIF);
|
||||
#endif /* Q7S_ADD_SPI_TEST == 0 */
|
||||
|
||||
new CoreController(objects::CORE_CONTROLLER);
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
createCommunicationInterfaces(&gpioComIF);
|
||||
createTmpComponents();
|
||||
#if BOARD_TE0720 == 0
|
||||
|
||||
#if TE0720 == 1
|
||||
createPcduComponents();
|
||||
createRadSensorComponent(gpioComIF);
|
||||
createSunSensorComponents(gpioComIF);
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
createAcsBoardComponents(gpioComIF);
|
||||
#endif /* OBSW_ADD_ACS_BOARD == 1 */
|
||||
createHeaterComponents();
|
||||
createSolarArrayDeploymentComponents();
|
||||
#if Q7S_ADD_SYRLINKS_HANDLER == 1
|
||||
createSyrlinksComponents();
|
||||
#endif /* Q7S_ADD_SYRLINKS_HANDLER == 1 */
|
||||
|
||||
#if Q7S_ADD_RTD_DEVICES == 1
|
||||
createRtdComponents();
|
||||
#endif /* Q7S_ADD_RTD_DEVICES == 1 */
|
||||
|
||||
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
|
||||
std::string("/dev/i2c-0"));
|
||||
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
|
||||
|
||||
UartCookie* plocUartCookie = new UartCookie(objects::RW1, std::string("/dev/ttyUL3"),
|
||||
UartModes::NON_CANONICAL, 115200, PLOC::MAX_REPLY_SIZE);
|
||||
new PlocHandler(objects::PLOC_HANDLER, objects::UART_COM_IF, plocUartCookie);
|
||||
|
||||
createReactionWheelComponents(gpioComIF);
|
||||
#endif /* TE7020 != 0 */
|
||||
|
||||
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
|
||||
|
||||
/* Test Task */
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
createTestComponents();
|
||||
#endif /* OBSW_ADD_TEST_CODE == 1 */
|
||||
|
||||
}
|
||||
|
||||
void ObjectFactory::createTmpComponents() {
|
||||
#if BOARD_TE0720 == 1
|
||||
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,
|
||||
@ -122,8 +156,27 @@ void ObjectFactory::produce(void* args){
|
||||
objects::TMP1075_HANDLER_2, objects::I2C_COM_IF,
|
||||
i2cCookieTmp1075tcs2);
|
||||
(void) tmp1075Handler_2;
|
||||
}
|
||||
|
||||
#if TE0720 == 0
|
||||
void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF **gpioComIF) {
|
||||
if(gpioComIF == nullptr) {
|
||||
sif::error << "ObjectFactory::createCommunicationInterfaces: Invalid GPIO ComIF"
|
||||
<< std::endl;
|
||||
}
|
||||
*gpioComIF = new LinuxLibgpioIF(objects::GPIO_IF);
|
||||
|
||||
/* Communication interfaces */
|
||||
new CspComIF(objects::CSP_COM_IF);
|
||||
new I2cComIF(objects::I2C_COM_IF);
|
||||
new UartComIF(objects::UART_COM_IF);
|
||||
#if Q7S_ADD_SPI_TEST == 0
|
||||
new SpiComIF(objects::SPI_COM_IF, *gpioComIF);
|
||||
#endif /* Q7S_ADD_SPI_TEST == 0 */
|
||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||
gpioCallbacks::initSpiCsDecoder(*gpioComIF);
|
||||
}
|
||||
|
||||
void ObjectFactory::createPcduComponents() {
|
||||
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH,
|
||||
addresses::P60DOCK);
|
||||
CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_LENGTH,
|
||||
@ -156,10 +209,9 @@ void ObjectFactory::produce(void* args){
|
||||
(void) pdu1handler;
|
||||
(void) pdu2handler;
|
||||
(void) acuhandler;
|
||||
}
|
||||
|
||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||
gpioCallbacks::initSpiCsDecoder(gpioComIF);
|
||||
|
||||
void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
||||
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
||||
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip5"), 19,
|
||||
std::string("Chip Select Radiation Sensor"), gpio::OUT, 1);
|
||||
@ -170,6 +222,9 @@ void ObjectFactory::produce(void* args){
|
||||
std::string("/dev/spidev2.0"), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
||||
spi::DEFAULT_MAX_1227_SPEED);
|
||||
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
|
||||
}
|
||||
|
||||
void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF) {
|
||||
GpioCookie* gpioCookieSus = new GpioCookie();
|
||||
|
||||
GpioCallback* susgpio = new GpioCallback(std::string("Chip select SUS 1"), gpio::OUT, 1,
|
||||
@ -254,21 +309,35 @@ void ObjectFactory::produce(void* args){
|
||||
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
|
||||
SUS::MAX1227_SPI_FREQ);
|
||||
|
||||
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF, gpioIds::CS_SUS_1);
|
||||
new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF, gpioIds::CS_SUS_2);
|
||||
new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF, gpioIds::CS_SUS_3);
|
||||
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4, gpioComIF, gpioIds::CS_SUS_4);
|
||||
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5, gpioComIF, gpioIds::CS_SUS_5);
|
||||
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6, gpioComIF, gpioIds::CS_SUS_6);
|
||||
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7, gpioComIF, gpioIds::CS_SUS_7);
|
||||
new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF, gpioIds::CS_SUS_8);
|
||||
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF, gpioIds::CS_SUS_9);
|
||||
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10, gpioComIF, gpioIds::CS_SUS_10);
|
||||
new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11, gpioComIF, gpioIds::CS_SUS_11);
|
||||
new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12, gpioComIF, gpioIds::CS_SUS_12);
|
||||
new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13, gpioComIF, gpioIds::CS_SUS_13);
|
||||
new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF,
|
||||
gpioIds::CS_SUS_1);
|
||||
new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF,
|
||||
gpioIds::CS_SUS_2);
|
||||
new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF,
|
||||
gpioIds::CS_SUS_3);
|
||||
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4, gpioComIF,
|
||||
gpioIds::CS_SUS_4);
|
||||
new SusHandler(objects::SUS_5, objects::SPI_COM_IF, spiCookieSus5, gpioComIF,
|
||||
gpioIds::CS_SUS_5);
|
||||
new SusHandler(objects::SUS_6, objects::SPI_COM_IF, spiCookieSus6, gpioComIF,
|
||||
gpioIds::CS_SUS_6);
|
||||
new SusHandler(objects::SUS_7, objects::SPI_COM_IF, spiCookieSus7, gpioComIF,
|
||||
gpioIds::CS_SUS_7);
|
||||
new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF,
|
||||
gpioIds::CS_SUS_8);
|
||||
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF,
|
||||
gpioIds::CS_SUS_9);
|
||||
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10, gpioComIF,
|
||||
gpioIds::CS_SUS_10);
|
||||
new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11, gpioComIF,
|
||||
gpioIds::CS_SUS_11);
|
||||
new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12, gpioComIF,
|
||||
gpioIds::CS_SUS_12);
|
||||
new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13, gpioComIF,
|
||||
gpioIds::CS_SUS_13);
|
||||
}
|
||||
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF) {
|
||||
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
|
||||
GpiodRegular* gpio = nullptr;
|
||||
gpio = new GpiodRegular(std::string("gpiochip5"), 1, std::string("CS_GYRO_0_ADIS"),
|
||||
@ -326,20 +395,23 @@ void ObjectFactory::produce(void* args){
|
||||
|
||||
//TODO: Adis Gyro (Gyro 0 Side A)
|
||||
|
||||
// Commented until ACS board V2 in in clean room again
|
||||
/* Gyro 1 Side A */
|
||||
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();
|
||||
// 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();
|
||||
//
|
||||
// /* Gyro 2 Side B */
|
||||
// spiCookie = new SpiCookie(addresses::GYRO_2_L3G, gpioIds::GYRO_2_L3G_CS, spiDev,
|
||||
// L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
// gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_L3G_HANDLER, objects::SPI_COM_IF,
|
||||
// spiCookie);
|
||||
// gyroL3gHandler->setStartUpImmediately();
|
||||
}
|
||||
|
||||
/* Gyro 2 Side B */
|
||||
spiCookie = new SpiCookie(addresses::GYRO_2_L3G, gpioIds::GYRO_2_L3G_CS, spiDev,
|
||||
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
|
||||
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_2_L3G_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie);
|
||||
gyroL3gHandler->setStartUpImmediately();
|
||||
#endif
|
||||
void ObjectFactory::createHeaterComponents() {
|
||||
|
||||
GpioCookie* heaterGpiosCookie = new GpioCookie;
|
||||
|
||||
@ -380,7 +452,9 @@ void ObjectFactory::produce(void* args){
|
||||
|
||||
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
|
||||
objects::PCDU_HANDLER, pcduSwitches::TCS_BOARD_8V_HEATER_IN);
|
||||
}
|
||||
|
||||
void ObjectFactory::createSolarArrayDeploymentComponents() {
|
||||
GpioCookie* solarArrayDeplCookie = new GpioCookie;
|
||||
|
||||
GpiodRegular* gpioConfigDeplSA0 = new GpiodRegular(std::string("gpiochip7"), 4,
|
||||
@ -394,8 +468,9 @@ void ObjectFactory::produce(void* args){
|
||||
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
|
||||
solarArrayDeplCookie, objects::PCDU_HANDLER, pcduSwitches::DEPLOYMENT_MECHANISM,
|
||||
gpioIds::DEPLSA1, gpioIds::DEPLSA2, 1000);
|
||||
}
|
||||
|
||||
#if Q7S_ADD_SYRLINKS_HANDLER == 1
|
||||
void ObjectFactory::createSyrlinksComponents() {
|
||||
UartCookie* syrlinksUartCookie = new UartCookie(objects::SYRLINKS_HK_HANDLER,
|
||||
std::string("/dev/ttyUL0"), UartModes::NON_CANONICAL, 38400, SYRLINKS::MAX_REPLY_SIZE);
|
||||
syrlinksUartCookie->setParityEven();
|
||||
@ -403,9 +478,9 @@ void ObjectFactory::produce(void* args){
|
||||
SyrlinksHkHandler* syrlinksHkHandler = new SyrlinksHkHandler(objects::SYRLINKS_HK_HANDLER,
|
||||
objects::UART_COM_IF, syrlinksUartCookie);
|
||||
syrlinksHkHandler->setModeNormal();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if Q7S_ADD_RTD_DEVICES == 1
|
||||
void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
|
||||
GpioCookie* rtdGpioCookie = new GpioCookie;
|
||||
|
||||
GpioCallback* gpioRtdIc3 = new GpioCallback(std::string("Chip select RTD IC3"), gpio::OUT, 1,
|
||||
@ -508,22 +583,38 @@ void ObjectFactory::produce(void* args){
|
||||
std::string("/dev/spidev2.0"), Max31865Definitions::MAX_REPLY_SIZE,
|
||||
spi::SpiModes::MODE_1, 2000000);
|
||||
|
||||
Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC3, objects::SPI_COM_IF, spiRtdIc3, 0); // 0 is switchId
|
||||
Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC4, objects::SPI_COM_IF, spiRtdIc4, 0);
|
||||
Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC5, objects::SPI_COM_IF, spiRtdIc5, 0);
|
||||
Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC6, objects::SPI_COM_IF, spiRtdIc6, 0);
|
||||
Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC7, objects::SPI_COM_IF, spiRtdIc7, 0);
|
||||
Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC8, objects::SPI_COM_IF, spiRtdIc8, 0);
|
||||
Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC9, objects::SPI_COM_IF, spiRtdIc9, 0);
|
||||
Max31865PT1000Handler* rtdIc10 = new Max31865PT1000Handler(objects::RTD_IC10, objects::SPI_COM_IF, spiRtdIc10, 0);
|
||||
Max31865PT1000Handler* rtdIc11 = new Max31865PT1000Handler(objects::RTD_IC11, objects::SPI_COM_IF, spiRtdIc11, 0);
|
||||
Max31865PT1000Handler* rtdIc12 = new Max31865PT1000Handler(objects::RTD_IC12, objects::SPI_COM_IF, spiRtdIc12, 0);
|
||||
Max31865PT1000Handler* rtdIc13 = new Max31865PT1000Handler(objects::RTD_IC13, objects::SPI_COM_IF, spiRtdIc13, 0);
|
||||
Max31865PT1000Handler* rtdIc14 = new Max31865PT1000Handler(objects::RTD_IC14, objects::SPI_COM_IF, spiRtdIc14, 0);
|
||||
Max31865PT1000Handler* rtdIc15 = new Max31865PT1000Handler(objects::RTD_IC15, objects::SPI_COM_IF, spiRtdIc15, 0);
|
||||
Max31865PT1000Handler* rtdIc16 = new Max31865PT1000Handler(objects::RTD_IC16, objects::SPI_COM_IF, spiRtdIc16, 0);
|
||||
Max31865PT1000Handler* rtdIc17 = new Max31865PT1000Handler(objects::RTD_IC17, objects::SPI_COM_IF, spiRtdIc17, 0);
|
||||
Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC18, objects::SPI_COM_IF, spiRtdIc18, 0);
|
||||
Max31865PT1000Handler* rtdIc3 = new Max31865PT1000Handler(objects::RTD_IC3,
|
||||
objects::SPI_COM_IF, spiRtdIc3, 0); // 0 is switchId
|
||||
Max31865PT1000Handler* rtdIc4 = new Max31865PT1000Handler(objects::RTD_IC4,
|
||||
objects::SPI_COM_IF, spiRtdIc4, 0);
|
||||
Max31865PT1000Handler* rtdIc5 = new Max31865PT1000Handler(objects::RTD_IC5,
|
||||
objects::SPI_COM_IF, spiRtdIc5, 0);
|
||||
Max31865PT1000Handler* rtdIc6 = new Max31865PT1000Handler(objects::RTD_IC6,
|
||||
objects::SPI_COM_IF, spiRtdIc6, 0);
|
||||
Max31865PT1000Handler* rtdIc7 = new Max31865PT1000Handler(objects::RTD_IC7,
|
||||
objects::SPI_COM_IF, spiRtdIc7, 0);
|
||||
Max31865PT1000Handler* rtdIc8 = new Max31865PT1000Handler(objects::RTD_IC8,
|
||||
objects::SPI_COM_IF, spiRtdIc8, 0);
|
||||
Max31865PT1000Handler* rtdIc9 = new Max31865PT1000Handler(objects::RTD_IC9,
|
||||
objects::SPI_COM_IF, spiRtdIc9, 0);
|
||||
Max31865PT1000Handler* rtdIc10 = new Max31865PT1000Handler(objects::RTD_IC10,
|
||||
objects::SPI_COM_IF, spiRtdIc10, 0);
|
||||
Max31865PT1000Handler* rtdIc11 = new Max31865PT1000Handler(objects::RTD_IC11,
|
||||
objects::SPI_COM_IF, spiRtdIc11, 0);
|
||||
Max31865PT1000Handler* rtdIc12 = new Max31865PT1000Handler(objects::RTD_IC12,
|
||||
objects::SPI_COM_IF, spiRtdIc12, 0);
|
||||
Max31865PT1000Handler* rtdIc13 = new Max31865PT1000Handler(objects::RTD_IC13,
|
||||
objects::SPI_COM_IF, spiRtdIc13, 0);
|
||||
Max31865PT1000Handler* rtdIc14 = new Max31865PT1000Handler(objects::RTD_IC14,
|
||||
objects::SPI_COM_IF, spiRtdIc14, 0);
|
||||
Max31865PT1000Handler* rtdIc15 = new Max31865PT1000Handler(objects::RTD_IC15,
|
||||
objects::SPI_COM_IF, spiRtdIc15, 0);
|
||||
Max31865PT1000Handler* rtdIc16 = new Max31865PT1000Handler(objects::RTD_IC16,
|
||||
objects::SPI_COM_IF, spiRtdIc16, 0);
|
||||
Max31865PT1000Handler* rtdIc17 = new Max31865PT1000Handler(objects::RTD_IC17,
|
||||
objects::SPI_COM_IF, spiRtdIc17, 0);
|
||||
Max31865PT1000Handler* rtdIc18 = new Max31865PT1000Handler(objects::RTD_IC18,
|
||||
objects::SPI_COM_IF, spiRtdIc18, 0);
|
||||
|
||||
(void) rtdIc3;
|
||||
(void) rtdIc4;
|
||||
@ -541,17 +632,9 @@ void ObjectFactory::produce(void* args){
|
||||
(void) rtdIc16;
|
||||
(void) rtdIc17;
|
||||
(void) rtdIc18;
|
||||
}
|
||||
|
||||
#endif /* Q7S_ADD_RTD_DEVICES == 1 */
|
||||
|
||||
I2cCookie* imtqI2cCookie = new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE,
|
||||
std::string("/dev/i2c-0"));
|
||||
new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
|
||||
|
||||
UartCookie* plocUartCookie = new UartCookie(objects::RW1, std::string("/dev/ttyUL3"),
|
||||
UartModes::NON_CANONICAL, 115200, PLOC::MAX_REPLY_SIZE);
|
||||
new PlocHandler(objects::PLOC_HANDLER, objects::UART_COM_IF, plocUartCookie);
|
||||
|
||||
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
GpioCookie* gpioCookieRw = new GpioCookie;
|
||||
GpioCallback* csRw1 = new GpioCallback(std::string("Chip select reaction wheel 1"), gpio::OUT,
|
||||
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
||||
@ -566,29 +649,29 @@ void ObjectFactory::produce(void* args){
|
||||
1, &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
|
||||
gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4);
|
||||
|
||||
GpiodRegular* enRw1 = new GpiodRegular(std::string("gpiochip5"), 7,
|
||||
std::string("Enable reaction wheel 1"), gpio::OUT, 0);
|
||||
gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1);
|
||||
GpiodRegular* enRw2 = new GpiodRegular(std::string("gpiochip5"), 3,
|
||||
std::string("Enable reaction wheel 2"), gpio::OUT, 0);
|
||||
gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2);
|
||||
GpiodRegular* enRw3 = new GpiodRegular(std::string("gpiochip5"), 11,
|
||||
std::string("Enable reaction wheel 3"), gpio::OUT, 0);
|
||||
gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3);
|
||||
GpiodRegular* enRw4 = new GpiodRegular(std::string("gpiochip5"), 6,
|
||||
std::string("Enable reaction wheel 4"), gpio::OUT, 0);
|
||||
gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4);
|
||||
GpiodRegular* enRw1 = new GpiodRegular(std::string("gpiochip5"), 7,
|
||||
std::string("Enable reaction wheel 1"), gpio::OUT, 0);
|
||||
gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1);
|
||||
GpiodRegular* enRw2 = new GpiodRegular(std::string("gpiochip5"), 3,
|
||||
std::string("Enable reaction wheel 2"), gpio::OUT, 0);
|
||||
gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2);
|
||||
GpiodRegular* enRw3 = new GpiodRegular(std::string("gpiochip5"), 11,
|
||||
std::string("Enable reaction wheel 3"), gpio::OUT, 0);
|
||||
gpioCookieRw->addGpio(gpioIds::EN_RW3, enRw3);
|
||||
GpiodRegular* enRw4 = new GpiodRegular(std::string("gpiochip5"), 6,
|
||||
std::string("Enable reaction wheel 4"), gpio::OUT, 0);
|
||||
gpioCookieRw->addGpio(gpioIds::EN_RW4, enRw4);
|
||||
|
||||
/**
|
||||
* This GPIO is only internally connected to the SPI MUX module and responsible to disconnect
|
||||
* 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(std::string("gpiochip11"), 54,
|
||||
/**
|
||||
* This GPIO is only internally connected to the SPI MUX module and responsible to disconnect
|
||||
* 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(std::string("gpiochip11"), 54,
|
||||
std::string("EMIO 0 SPI Mux"), gpio::OUT, 0);
|
||||
gpioCookieRw->addGpio(gpioIds::SPI_MUX, spiMux);
|
||||
|
||||
gpioComIF->addGpios(gpioCookieRw);
|
||||
gpioComIF->addGpios(gpioCookieRw);
|
||||
|
||||
auto rw1SpiCookie = new SpiCookie(addresses::RW1, gpioIds::CS_RW1, "/dev/spidev3.0",
|
||||
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
|
||||
@ -603,33 +686,27 @@ void ObjectFactory::produce(void* args){
|
||||
RwDefinitions::MAX_REPLY_SIZE, spi::RW_MODE, spi::RW_SPEED, &rwSpiCallback::spiCallback,
|
||||
nullptr);
|
||||
|
||||
auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF,
|
||||
gpioIds::EN_RW1);
|
||||
auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF,
|
||||
gpioIds::EN_RW1);
|
||||
rw1SpiCookie->setCallbackArgs(rwHandler1);
|
||||
|
||||
auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF,
|
||||
gpioIds::EN_RW2);
|
||||
gpioIds::EN_RW2);
|
||||
rw2SpiCookie->setCallbackArgs(rwHandler2);
|
||||
|
||||
auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF,
|
||||
gpioIds::EN_RW3);
|
||||
gpioIds::EN_RW3);
|
||||
rw3SpiCookie->setCallbackArgs(rwHandler3);
|
||||
|
||||
auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF,
|
||||
gpioIds::EN_RW4);
|
||||
gpioIds::EN_RW4);
|
||||
rw4SpiCookie->setCallbackArgs(rwHandler4);
|
||||
}
|
||||
|
||||
#endif /* TE0720 == 0 */
|
||||
|
||||
new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
|
||||
new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE);
|
||||
|
||||
/* Test Task */
|
||||
#if OBSW_ADD_TEST_CODE == 1
|
||||
void ObjectFactory::createTestComponents() {
|
||||
new Q7STestTask(objects::TEST_TASK);
|
||||
#endif
|
||||
|
||||
#if TE0720 == 1 && TEST_LIBGPIOD == 1
|
||||
#if BOARD_TE0720 == 1 && TEST_LIBGPIOD == 1
|
||||
/* Configure MIO0 as input */
|
||||
GpiodRegular gpioConfigMio0(std::string("gpiochip0"), 0,
|
||||
std::string("MIO0"), gpio::IN, 0);
|
||||
@ -638,7 +715,7 @@ void ObjectFactory::produce(void* args){
|
||||
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
|
||||
#endif
|
||||
|
||||
#if TE0720 == 1 && TEST_SUS_HANDLER == 1
|
||||
#if BOARD_TE0720 == 1 && TEST_SUS_HANDLER == 1
|
||||
GpioCookie* gpioCookieSus = new GpioCookie;
|
||||
GpiodRegular* chipSelectSus = new GpiodRegular(std::string("gpiochip1"), 9,
|
||||
std::string("Chip Select Sus Sensor"), gpio::OUT, 1);
|
||||
@ -652,7 +729,7 @@ void ObjectFactory::produce(void* args){
|
||||
gpioIds::CS_SUS_1);
|
||||
#endif
|
||||
|
||||
#if TE0720 == 1 && TEST_CCSDS_BRIDGE == 1
|
||||
#if BOARD_TE0720 == 1 && TEST_CCSDS_BRIDGE == 1
|
||||
GpioCookie* gpioCookieCcsdsIp = new GpioCookie;
|
||||
GpiodRegular* papbBusyN = new GpiodRegular(std::string("gpiochip0"), 0, std::string("PAPBBusy_N"));
|
||||
gpioCookieCcsdsIp->addGpio(gpioIds::PAPB_BUSY_N, papbBusyN);
|
||||
@ -666,7 +743,7 @@ void ObjectFactory::produce(void* args){
|
||||
gpioIds::PAPB_BUSY_N, gpioIds::PAPB_EMPTY);
|
||||
#endif
|
||||
|
||||
#if TE0720 == 1 && TEST_RADIATION_SENSOR_HANDLER == 1
|
||||
#if BOARD_TE0720 == 1 && TEST_RADIATION_SENSOR_HANDLER == 1
|
||||
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
||||
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip1"), 0,
|
||||
std::string("Chip select radiation sensor"), gpio::OUT, 1);
|
||||
@ -682,7 +759,7 @@ void ObjectFactory::produce(void* args){
|
||||
radSensor->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
#if TE0720 == 1 && TEST_PLOC_HANDLER == 1
|
||||
#if BOARD_TE0720 == 1 && TEST_PLOC_HANDLER == 1
|
||||
UartCookie* plocUartCookie = new UartCookie(std::string("/dev/ttyPS1"), 115200,
|
||||
PLOC::MAX_REPLY_SIZE);
|
||||
/* Testing PlocHandler on TE0720-03-1CFA */
|
||||
@ -691,7 +768,7 @@ void ObjectFactory::produce(void* args){
|
||||
plocHandler->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
#if TE0720 == 1 && TE0720_HEATER_TEST == 1
|
||||
#if BOARD_TE0720 == 1 && TE0720_HEATER_TEST == 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;
|
||||
|
@ -1,9 +1,26 @@
|
||||
#ifndef BSP_Q7S_OBJECTFACTORY_H_
|
||||
#define BSP_Q7S_OBJECTFACTORY_H_
|
||||
|
||||
class LinuxLibgpioIF;
|
||||
|
||||
namespace ObjectFactory {
|
||||
|
||||
void setStatics();
|
||||
void produce(void* args);
|
||||
|
||||
void createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF);
|
||||
void createTmpComponents();
|
||||
void createPcduComponents();
|
||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||
void createSunSensorComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createHeaterComponents();
|
||||
void createSolarArrayDeploymentComponents();
|
||||
void createSyrlinksComponents();
|
||||
void createRtdComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createReactionWheelComponents(LinuxLibgpioIF* gpioComIF);
|
||||
void createTestComponents();
|
||||
|
||||
};
|
||||
|
||||
#endif /* BSP_Q7S_OBJECTFACTORY_H_ */
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
int obsw::obsw() {
|
||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||
#if TE0720 == 0
|
||||
#if BOARD_TE0720 == 0
|
||||
std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl;
|
||||
#else
|
||||
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include "FileSystemHandler.h"
|
||||
|
||||
#include "bsp_q7s/core/CoreController.h"
|
||||
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
#include "fsfw/memory/GenericFileSystemMessage.h"
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
|
||||
FileSystemHandler::FileSystemHandler(object_id_t fileSystemHandler):
|
||||
@ -24,9 +27,9 @@ ReturnValue_t FileSystemHandler::performOperation(uint8_t unsignedChar) {
|
||||
// Restart OBSW, hints at a memory leak
|
||||
sif::error << "Allocation error in FileSystemHandler::performOperation"
|
||||
<< e.what() << std::endl;
|
||||
// TODO: If we trigger an event, it might not get sent because were restarting
|
||||
// Set up an error file or a special flag in the scratch buffer.
|
||||
// TODO: CoreController: Implement function to restart OBC
|
||||
// Set up an error file or a special flag in the scratch buffer for these cases
|
||||
triggerEvent(CoreController::ALLOC_FAILURE, 0 , 0);
|
||||
CoreController::incrementAllocationFailureCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,8 +97,8 @@ void FileSystemHandler::fileSystemCheckup() {
|
||||
ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
// Oh no.
|
||||
// TODO: Trigger medium severity event
|
||||
sif::error << "Fix failed" << std::endl;
|
||||
triggerEvent(SdCardManager::SANITIZATION_FAILED, 0, 0);
|
||||
sif::error << "FileSystemHandler::fileSystemCheckup: Sanitization failed" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -125,6 +128,14 @@ ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const
|
||||
// A double slash between repo and filename should not be an issue, so add it in any case
|
||||
std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" +
|
||||
std::string(filename);
|
||||
if(not std::filesystem::exists(fullPath)) {
|
||||
return FILE_DOES_NOT_EXIST;
|
||||
}
|
||||
std::ofstream file(fullPath, std::ios_base::app|std::ios_base::out);
|
||||
file.write(reinterpret_cast<const char*>(data), size);
|
||||
if(not file.good()) {
|
||||
return GENERIC_FILE_ERROR;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -133,6 +144,14 @@ ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const ch
|
||||
// A double slash between repo and filename should not be an issue, so add it in any case
|
||||
std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" +
|
||||
std::string(filename);
|
||||
if(std::filesystem::exists(fullPath)) {
|
||||
return FILE_ALREADY_EXISTS;
|
||||
}
|
||||
std::ofstream file(fullPath);
|
||||
file.write(reinterpret_cast<const char*>(data), size);
|
||||
if(not file.good()) {
|
||||
return GENERIC_FILE_ERROR;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -141,6 +160,14 @@ ReturnValue_t FileSystemHandler::deleteFile(const char *repositoryPath, const ch
|
||||
// A double slash between repo and filename should not be an issue, so add it in any case
|
||||
std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" +
|
||||
std::string(filename);
|
||||
if(not std::filesystem::exists(fullPath)) {
|
||||
return FILE_DOES_NOT_EXIST;
|
||||
}
|
||||
int result = std::remove(fullPath.c_str());
|
||||
if(result != 0) {
|
||||
sif::warning << "FileSystemHandler::deleteFile: Failed with code " << result << std::endl;
|
||||
return GENERIC_FILE_ERROR;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -169,14 +196,20 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char *repositoryPath,
|
||||
}
|
||||
else {
|
||||
// Check error code. Most probably denied permissions because folder is not empty
|
||||
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory failed with "
|
||||
"err" << err << std::endl;
|
||||
return GENERIC_FILE_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(std::filesystem::remove_all(fullPath, err)) {
|
||||
sif::warning << "FileSystemHandler::removeDirectory: Deleting directory recursively "
|
||||
"failed with err" << err << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
else {
|
||||
// Check error code
|
||||
return GENERIC_FILE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ private:
|
||||
MessageQueueIF* mq = nullptr;
|
||||
std::string currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
|
||||
static constexpr uint32_t FS_MAX_QUEUE_SIZE = config::OBSW_FILESYSTEM_HANDLER_QUEUE_SIZE;
|
||||
|
||||
SdCardManager* sdcMan = nullptr;
|
||||
uint8_t opCounter = 0;
|
||||
|
||||
|
@ -3,7 +3,9 @@
|
||||
|
||||
#include "definitions.h"
|
||||
#include "returnvalues/classIds.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
|
||||
#include "fsfw/events/Event.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
#include <cstdint>
|
||||
@ -41,6 +43,10 @@ public:
|
||||
static constexpr ReturnValue_t SYSTEM_CALL_ERROR =
|
||||
HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 14);
|
||||
|
||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FILE_SYSTEM;
|
||||
|
||||
static constexpr Event SANITIZATION_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW);
|
||||
|
||||
// C++17 does not support constexpr std::string yet
|
||||
static constexpr char SD_0_DEV_NAME[] = "/dev/mmcblk0p1";
|
||||
static constexpr char SD_1_DEV_NAME[] = "/dev/mmcblk1p1";
|
||||
|
@ -18,6 +18,7 @@
|
||||
namespace scratch {
|
||||
|
||||
static constexpr char PREFERED_SDC_KEY[] = "PREFSD";
|
||||
static constexpr char ALLOC_FAILURE_COUNT[] = "ALLOCERR";
|
||||
|
||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SCRATCH_BUFFER;
|
||||
static constexpr ReturnValue_t KEY_NOT_FOUND = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
||||
|
@ -10,6 +10,7 @@ enum commonObjects: uint32_t {
|
||||
PUS_PACKET_DISTRIBUTOR = 0x50000200,
|
||||
UDP_BRIDGE = 0x50000300,
|
||||
UDP_POLLING_TASK = 0x50000400,
|
||||
FILE_SYSTEM_HANDLER = 0x50000500,
|
||||
|
||||
/* 0x43 ('C') for Controllers */
|
||||
THERMAL_CONTROLLER = 0x43400001,
|
||||
|
@ -14,6 +14,7 @@ enum: uint8_t {
|
||||
PLOC_HANDLER = 111,
|
||||
IMTQ_HANDLER = 112,
|
||||
RW_HANDLER = 113,
|
||||
FILE_SYSTEM = 114,
|
||||
COMMON_SUBSYSTEM_ID_END
|
||||
};
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ debugging. */
|
||||
#define TEST_CCSDS_BRIDGE 0
|
||||
#define PERFORM_PTME_TEST 0
|
||||
|
||||
#define TE0720 0
|
||||
#define BOARD_TE0720 0
|
||||
#define TE0720_HEATER_TEST 0
|
||||
|
||||
#define P60DOCK_DEBUG 0
|
||||
|
@ -33,7 +33,7 @@ namespace pcduSwitches {
|
||||
static const uint8_t INIT_STATE_Q7S = ON;
|
||||
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH1 = OFF;
|
||||
static const uint8_t INIT_STATE_RW = OFF;
|
||||
#if TE0720 == 1
|
||||
#if BOARD_TE0720 == 1
|
||||
/* Because the TE0720 is not connected to the PCDU, this switch is always on */
|
||||
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = ON;
|
||||
#else
|
||||
|
@ -12,7 +12,8 @@
|
||||
*/
|
||||
namespace SUBSYSTEM_ID {
|
||||
enum: uint8_t {
|
||||
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END
|
||||
SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_END,
|
||||
CORE = 116,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -680,7 +680,7 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
#if TE7020 == 1
|
||||
#if BOARD_TE7020 == 1
|
||||
ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
@ -729,4 +729,4 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
#endif /* TE7020 == 1 */
|
||||
#endif /* BOARD_TE7020 == 1 */
|
||||
|
@ -329,7 +329,7 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool &localDat
|
||||
pcduSwitches::INIT_STATE_PAYLOAD_PCDU_CH1 }));
|
||||
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_RW, new PoolEntry<uint8_t>( {
|
||||
pcduSwitches::INIT_STATE_RW }));
|
||||
#if TE0720 == 1
|
||||
#if BOARD_TE0720 == 1
|
||||
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>( { 1 }));
|
||||
#else
|
||||
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>( {pcduSwitches::INIT_STATE_TCS_BOARD_8V_HEATER_IN}));
|
||||
|
@ -265,7 +265,7 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool(
|
||||
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_Q7S, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, new PoolEntry<uint8_t>( { 0 }));
|
||||
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_RW, new PoolEntry<uint8_t>( { 0 }));
|
||||
#if TE0720 == 1
|
||||
#if BOARD_TE0720 == 1
|
||||
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>( { 1 }));
|
||||
#else
|
||||
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_TCS_BOARD_HEATER_IN, new PoolEntry<uint8_t>( { 0 }));
|
||||
|
Loading…
Reference in New Issue
Block a user