added generic GPIO checker
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-04-28 18:38:38 +02:00
parent 73fbdfeb25
commit 0b64999ce2
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
5 changed files with 26 additions and 12 deletions

View File

@ -48,7 +48,7 @@ void q7s::gpioCallbacks::initSpiCsDecoder(GpioIF* gpioComIF) {
result = gpioComIF->addGpios(spiMuxGpios); result = gpioComIF->addGpios(spiMuxGpios);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "initSpiCsDecoder: Failed to add mux bit gpios to gpioComIF" << std::endl; sif::error << "initSpiCsDecoder: Failed to add SPI MUX bit GPIOs" << std::endl;
return; return;
} }
} }

View File

@ -291,7 +291,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
gpio = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_RADFET, consumer.str(), Direction::OUT, gpio = new GpiodRegularByLineName(q7s::gpioNames::ENABLE_RADFET, consumer.str(), Direction::OUT,
Levels::LOW); Levels::LOW);
gpioCookieRadSensor->addGpio(gpioIds::ENABLE_RADFET, gpio); gpioCookieRadSensor->addGpio(gpioIds::ENABLE_RADFET, gpio);
gpioComIF->addGpios(gpioCookieRadSensor); gpioChecker(gpioComIF->addGpios(gpioCookieRadSensor), "RAD sensor");
SpiCookie* spiCookieRadSensor = new SpiCookie( SpiCookie* spiCookieRadSensor = new SpiCookie(
addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string(q7s::SPI_DEFAULT_DEV), addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR, std::string(q7s::SPI_DEFAULT_DEV),
@ -407,7 +407,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_SELECT, consumer.str(), Direction::OUT, gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_SELECT, consumer.str(), Direction::OUT,
Levels::LOW); Levels::LOW);
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_SELECT, gpio); gpioCookieAcsBoard->addGpio(gpioIds::GNSS_SELECT, gpio);
gpioComIF->addGpios(gpioCookieAcsBoard); gpioChecker(gpioComIF->addGpios(gpioCookieAcsBoard), "ACS Board");
AcsBoardFdir* fdir = nullptr; AcsBoardFdir* fdir = nullptr;
static_cast<void>(fdir); static_cast<void>(fdir);
@ -658,7 +658,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
consumer.str(), Direction::OUT, Levels::HIGH); consumer.str(), Direction::OUT, Levels::HIGH);
auto mpsocGpioCookie = new GpioCookie; auto mpsocGpioCookie = new GpioCookie;
mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC); mpsocGpioCookie->addGpio(gpioIds::ENABLE_MPSOC_UART, gpioConfigMPSoC);
gpioComIF->addGpios(mpsocGpioCookie); gpioChecker(gpioComIF->addGpios(mpsocGpioCookie), "PLOC MPSoC");
auto mpsocCookie = auto mpsocCookie =
new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD, new UartCookie(objects::PLOC_MPSOC_HANDLER, q7s::UART_PLOC_MPSOC_DEV, uart::PLOC_MPSOC_BAUD,
mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL); mpsoc::MAX_REPLY_SIZE, UartModes::NON_CANONICAL);
@ -675,7 +675,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF) {
Direction::OUT, Levels::HIGH); Direction::OUT, Levels::HIGH);
auto supvGpioCookie = new GpioCookie; auto supvGpioCookie = new GpioCookie;
supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv); supvGpioCookie->addGpio(gpioIds::ENABLE_SUPV_UART, gpioConfigSupv);
gpioComIF->addGpios(supvGpioCookie); gpioChecker(gpioComIF->addGpios(supvGpioCookie), "PLOC SUPV");
auto supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER, auto supervisorCookie = new UartCookie(objects::PLOC_SUPERVISOR_HANDLER,
q7s::UART_PLOC_SUPERVSIOR_DEV, uart::PLOC_SUPERVISOR_BAUD, q7s::UART_PLOC_SUPERVSIOR_DEV, uart::PLOC_SUPERVISOR_BAUD,
supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL); supv::MAX_PACKET_SIZE * 20, UartModes::NON_CANONICAL);
@ -729,7 +729,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
Levels::LOW); Levels::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio); gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
gpioComIF->addGpios(gpioCookieRw); gpioChecker(gpioComIF->addGpios(gpioCookieRw), "RWs");
#if OBSW_ADD_RW == 1 #if OBSW_ADD_RW == 1
std::array<std::pair<address_t, gpioId_t>, 4> rwCookieParams = { std::array<std::pair<address_t, gpioId_t>, 4> rwCookieParams = {
@ -795,7 +795,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, consumer.str()); gpio = new GpiodRegularByLineName(q7s::gpioNames::PAPB_EMPTY_SIGNAL_VC3, consumer.str());
gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio); gpioCookiePtmeIp->addGpio(gpioIds::VC3_PAPB_EMPTY, gpio);
gpioComIF->addGpios(gpioCookiePtmeIp); gpioChecker(gpioComIF->addGpios(gpioCookiePtmeIp), "PTME PAPB VCs");
// Creating virtual channel interfaces // Creating virtual channel interfaces
VcInterfaceIF* vc0 = VcInterfaceIF* vc0 =
@ -849,7 +849,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
Levels::LOW); Levels::LOW);
gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio); gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio);
gpioComIF->addGpios(gpioCookiePdec); gpioChecker(gpioComIF->addGpios(gpioCookiePdec), "PDEC");
new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET, new PdecHandler(objects::PDEC_HANDLER, objects::CCSDS_HANDLER, gpioComIF, gpioIds::PDEC_RESET,
q7s::UIO_PDEC_CONFIG_MEMORY, q7s::UIO_PDEC_RAM, q7s::UIO_PDEC_REGISTERS); q7s::UIO_PDEC_CONFIG_MEMORY, q7s::UIO_PDEC_RAM, q7s::UIO_PDEC_REGISTERS);
@ -870,7 +870,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF) {
Direction::OUT, Levels::LOW); Direction::OUT, Levels::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio); gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio);
gpioComIF->addGpios(gpioRS485Chip); gpioChecker(gpioComIF->addGpios(gpioRS485Chip), "RS485 Transceiver");
} }
void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF, void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
@ -915,7 +915,7 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ADC_CS, consumer, Direction::OUT, gpio = new GpiodRegularByLineName(q7s::gpioNames::PL_PCDU_ADC_CS, consumer, Direction::OUT,
gpio::Levels::HIGH); gpio::Levels::HIGH);
plPcduGpios->addGpio(gpioIds::PLPCDU_ADC_CS, gpio); plPcduGpios->addGpio(gpioIds::PLPCDU_ADC_CS, gpio);
gpioComIF->addGpios(plPcduGpios); gpioChecker(gpioComIF->addGpios(plPcduGpios), "PL PCDU");
SpiCookie* spiCookie = new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS, SpiCookie* spiCookie = new SpiCookie(addresses::PLPCDU_ADC, gpioIds::PLPCDU_ADC_CS,
q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE, q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::PL_PCDU_MAX_1227_SPEED); spi::DEFAULT_MAX_1227_MODE, spi::PL_PCDU_MAX_1227_SPEED);

View File

@ -1,6 +1,10 @@
#ifndef BSP_Q7S_OBJECTFACTORY_H_ #ifndef BSP_Q7S_OBJECTFACTORY_H_
#define BSP_Q7S_OBJECTFACTORY_H_ #define BSP_Q7S_OBJECTFACTORY_H_
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <string>
class LinuxLibgpioIF; class LinuxLibgpioIF;
class UartComIF; class UartComIF;
class SpiComIF; class SpiComIF;

View File

@ -62,7 +62,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio); gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
gpioComIF->addGpios(gpioCookieSus); gpioChecker(gpioComIF->addGpios(gpioCookieSus), "Sun Sensors");
#if OBSW_ADD_SUN_SENSORS == 1 #if OBSW_ADD_SUN_SENSORS == 1
SusFdir* fdir = nullptr; SusFdir* fdir = nullptr;
@ -228,7 +228,7 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF); &gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc15); rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc15);
gpioComIF->addGpios(rtdGpioCookie); gpioChecker(gpioComIF->addGpios(rtdGpioCookie), "RTDs");
#if OBSW_ADD_RTD_DEVICES == 1 #if OBSW_ADD_RTD_DEVICES == 1
static constexpr uint8_t NUMBER_RTDS = 16; static constexpr uint8_t NUMBER_RTDS = 16;
@ -287,3 +287,9 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF,
static_cast<void>(tcsBoardAss); static_cast<void>(tcsBoardAss);
#endif // OBSW_ADD_RTD_DEVICES == 1 #endif // OBSW_ADD_RTD_DEVICES == 1
} }
void ObjectFactory::gpioChecker(ReturnValue_t result, std::string output) {
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "ObjectFactory: Adding GPIOs failed for " << output << std::endl;
}
}

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
#include <string> #include <string>
class GpioIF; class GpioIF;
@ -12,4 +14,6 @@ void createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiComIF, PowerSwitc
std::string spiDev); std::string spiDev);
void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher); void createRtdComponents(std::string spiDev, GpioIF* gpioComIF, PowerSwitchIF* pwrSwitcher);
void gpioChecker(ReturnValue_t result, std::string output);
} // namespace ObjectFactory } // namespace ObjectFactory