meier/openGpioByName #101

Merged
muellerr merged 7 commits from meier/openGpioByName into develop 2021-09-27 10:01:20 +02:00
8 changed files with 203 additions and 208 deletions

View File

@ -16,85 +16,43 @@ static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8";
static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0";
static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2";
/**************************************************************/
/** OBC1E */
/**************************************************************/
static constexpr char GPIO_MULTIPURPOSE_1V8_OBC1D[] = "/amba_pl/gpio@42020000";
static const char* const GPIO_GYRO_ADIS_LABEL = GPIO_MULTIPURPOSE_1V8_OBC1D;
static constexpr uint32_t GPIO_GYRO_0_ADIS_CS = 0; // Package Pin: W20
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
static constexpr uint32_t GPIO_RW_3_CS = 6; // B19
static constexpr uint32_t GPIO_GYRO_1_L3G_CS = 18; // N22
static constexpr uint32_t GPIO_GYRO_3_L3G_CS = 1; // M21
static constexpr uint32_t GPIO_MGM_0_LIS3_CS = 5; // C18
static constexpr uint32_t GPIO_MGM_1_RM3100_CS = 16; // A16
static constexpr uint32_t GPIO_MGM_3_RM3100_CS = 10; // C17
// Active low enable pin (needs to be driven low for regular operations)
static constexpr uint32_t GPIO_GYRO_0_ENABLE = 2; // H22
// Active low reset pin (needs to be driven high for regular operations)
static constexpr uint32_t GPIO_RESET_GNSS_0 = 9; // C22
static constexpr uint32_t GPIO_RESET_GNSS_1 = 12; // B21
static constexpr uint32_t GPIO_RAD_SENSOR_CS = 19; // R18
/**************************************************************/
/** OBC1F B1 */
/**************************************************************/
static constexpr char GPIO_FLEX_OBC1F_B1[] = "/amba_pl/gpio@42030000";
// 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
/**************************************************************/
/** OBC1C */
/**************************************************************/
static constexpr char GPIO_3V3_OBC1C[] = "/amba_pl/gpio@42040000";
static const char* const GPIO_HEATER_LABEL = GPIO_3V3_OBC1C;
static const char* const GPIO_SOLAR_ARR_DEPL_LABEL = GPIO_3V3_OBC1C;
static constexpr uint32_t GPIO_HEATER_0_PIN = 6;
static constexpr uint32_t GPIO_HEATER_1_PIN = 12;
static constexpr uint32_t GPIO_HEATER_2_PIN = 7;
static constexpr uint32_t GPIO_HEATER_3_PIN = 5;
static constexpr uint32_t GPIO_HEATER_4_PIN = 3;
static constexpr uint32_t GPIO_HEATER_5_PIN = 0;
static constexpr uint32_t GPIO_HEATER_6_PIN = 1;
static constexpr uint32_t GPIO_HEATER_7_PIN = 11;
static constexpr uint32_t GPIO_GYRO_2_ENABLE = 18; // F22
static constexpr uint32_t GPIO_SOL_DEPL_SA_0_PIN = 4;
static constexpr uint32_t GPIO_SOL_DEPL_SA_1_PIN = 2;
static constexpr char GPIO_RW_SPI_MUX_LABEL[] = "zynq_gpio";
// Uses EMIO interface to PL, starts at 54
static constexpr uint32_t GPIO_RW_SPI_MUX_CS = 54;
static constexpr uint32_t SPI_MUX_BIT_1 = 13;
static constexpr uint32_t SPI_MUX_BIT_2 = 14;
static constexpr uint32_t SPI_MUX_BIT_3 = 15;
static constexpr uint32_t SPI_MUX_BIT_4 = 16;
static constexpr uint32_t SPI_MUX_BIT_5 = 17;
static constexpr uint32_t SPI_MUX_BIT_6 = 9;
static constexpr uint32_t EN_RW_CS = 17;
namespace gpioNames {
static constexpr char GYRO_0_ADIS_CS[] = "gyro_0_adis_chip_select";
static constexpr char GYRO_1_L3G_CS[] = "gyro_1_l3g_chip_select";
static constexpr char GYRO_2_ADIS_CS[] = "gyro_2_adis_chip_select";
static constexpr char GYRO_3_L3G_CS[] = "gyro_3_l3g_chip_select";
static constexpr char MGM_0_CS[] = "mgm_0_lis3_chip_select";
static constexpr char MGM_1_CS[] = "mgm_1_rm3100_chip_select";
static constexpr char MGM_2_CS[] = "mgm_2_lis3_chip_select";
static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select";
static constexpr char RESET_GNSS_0[] = "reset_gnss_0";
static constexpr char RESET_GNSS_1[] = "reset_gnss_1";
static constexpr char GYRO_0_ENABLE[] = "gyro_0_enable";
static constexpr char GYRO_2_ENABLE[] = "gyro_2_enable";
static constexpr char HEATER_0[] = "heater0";
static constexpr char HEATER_1[] = "heater1";
static constexpr char HEATER_2[] = "heater2";
static constexpr char HEATER_3[] = "heater3";
static constexpr char HEATER_4[] = "heater4";
static constexpr char HEATER_5[] = "heater5";
static constexpr char HEATER_6[] = "heater6";
static constexpr char HEATER_7[] = "heater7";
static constexpr char SA_DPL_PIN_0[] = "sa_dpl_0";
static constexpr char SA_DPL_PIN_1[] = "sa_dpl_1";
static constexpr char SPI_MUX_BIT_1_PIN[] = "spi_mux_bit_1";
static constexpr char SPI_MUX_BIT_2_PIN[] = "spi_mux_bit_2";
static constexpr char SPI_MUX_BIT_3_PIN[] = "spi_mux_bit_3";
static constexpr char SPI_MUX_BIT_4_PIN[] = "spi_mux_bit_4";
static constexpr char SPI_MUX_BIT_5_PIN[] = "spi_mux_bit_5";
static constexpr char SPI_MUX_BIT_6_PIN[] = "spi_mux_bit_6";
static constexpr char EN_RW_CS[] = "en_rw_cs";
static constexpr char EN_RW_1[] = "enable_rw_1";
static constexpr char EN_RW_2[] = "enable_rw_2";
static constexpr char EN_RW_3[] = "enable_rw_3";
static constexpr char EN_RW_4[] = "enable_rw_4";
static constexpr char SPI_MUX_SELECT[] = "spi_mux_select";
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
}
}
#endif /* BSP_Q7S_BOARDCONFIG_BUSCONF_H_ */

View File

@ -1,3 +1,5 @@
#include <sstream>
#include "ObjectFactory.h"
#include "OBSWConfig.h"
#include "devConf.h"
@ -265,9 +267,11 @@ void ObjectFactory::createPcduComponents() {
void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
GpioCookie* gpioCookieRadSensor = new GpioCookie;
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);
std::stringstream consumer;
consumer << "0x" << std::hex << objects::RAD_SENSOR;
GpiodRegularByLineName* gpio = new GpiodRegularByLineName(
q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), gpio::OUT, gpio::HIGH);
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio);
gpioComIF->addGpios(gpioCookieRadSensor);
SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
@ -392,47 +396,80 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComI
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComIF* uartComIF) {
GpioCookie* gpioCookieAcsBoard = new GpioCookie();
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);
std::stringstream consumer;
GpiodRegularByLineName* gpio = nullptr;
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, consumer.str(),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_1_L3G_CS,
"CS_GYRO_1_L3G", gpio::OUT, gpio::HIGH);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_1_L3G_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, consumer.str(), gpio::OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, q7s::GPIO_GYRO_2_ADIS_CS,
"CS_GYRO_2_ADIS", gpio::OUT, gpio::HIGH);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, consumer.str(), gpio::OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_GYRO_3_L3G_CS,
"CS_GYRO_3_L3G", gpio::OUT, gpio::HIGH);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_3_L3G_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, consumer.str(), gpio::OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_0_LIS3_CS,
"CS_MGM_0_LIS3_A", gpio::OUT, gpio::HIGH);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_0_LIS3_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, consumer.str(), gpio::OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_MGM_1_RM3100_CS,
"CS_MGM_1_RM3100_A", gpio::OUT, gpio::HIGH);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_1_RM3100_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, consumer.str(), gpio::OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
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);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_2_LIS3_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, consumer.str(),
gpio::OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_3_RM3100_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_3_CS, consumer.str(), gpio::OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GPS0_HANDLER;
// GNSS reset pins are active low
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_0,
"GNSS_0_NRESET", gpio::OUT, gpio::HIGH);
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_0, consumer.str(), gpio::OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, q7s::GPIO_RESET_GNSS_1,
"GNSS_1_NRESET", gpio::OUT, gpio::HIGH);
consumer.str("");
consumer << "0x" << std::hex << objects::GPS1_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_1, consumer.str(), gpio::OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
// Enable pins must be pulled low for regular operations
gpio = new GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE,
"GYRO_0_ENABLE", gpio::OUT, gpio::LOW);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, consumer.str(),
gpio::OUT, gpio::LOW);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE,
"GYRO_2_ENABLE", gpio::OUT, gpio::LOW);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ENABLE, consumer.str(), 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
@ -540,40 +577,43 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
void ObjectFactory::createHeaterComponents() {
GpioCookie* heaterGpiosCookie = new GpioCookie;
GpiodRegularByLineName* gpio = nullptr;
std::stringstream consumer;
consumer << "0x" << std::hex << objects::HEATER_HANDLER;
/* Pin H2-11 on stack connector */
auto gpioConfigHeater0 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_0_PIN,
"Heater0", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_0, consumer.str(), gpio::OUT,
gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpio);
/* Pin H2-12 on stack connector */
auto gpioConfigHeater1 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_1_PIN,
"Heater1", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpioConfigHeater1);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_1, consumer.str(), gpio::OUT,
gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpio);
/* Pin H2-13 on stack connector */
auto gpioConfigHeater2 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_2_PIN,
"Heater2", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpioConfigHeater2);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_2, consumer.str(), gpio::OUT,
gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpio);
auto gpioConfigHeater3 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_3_PIN,
"Heater3", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpioConfigHeater3);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_3, consumer.str(),
gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpio);
auto gpioConfigHeater4 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_4_PIN,
"Heater4", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpioConfigHeater4);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_4, consumer.str(),
gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpio);
auto gpioConfigHeater5 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_5_PIN,
"Heater5", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpioConfigHeater5);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_5, consumer.str(),
gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpio);
auto gpioConfigHeater6 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_6_PIN,
"Heater6", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpioConfigHeater6);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_6, consumer.str(),
gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpio);
auto gpioConfigHeater7 = new GpiodRegularByLabel(q7s::GPIO_HEATER_LABEL, q7s::GPIO_HEATER_7_PIN,
"Heater7", gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpioConfigHeater7);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_7, consumer.str(),
gpio::OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
objects::PCDU_HANDLER, pcduSwitches::TCS_BOARD_8V_HEATER_IN);
@ -581,13 +621,16 @@ void ObjectFactory::createHeaterComponents() {
void ObjectFactory::createSolarArrayDeploymentComponents() {
GpioCookie* solarArrayDeplCookie = new GpioCookie;
GpiodRegularByLineName* gpio = nullptr;
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);
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);
std::stringstream consumer;
consumer << "0x" << std::hex << objects::SOLAR_ARRAY_DEPL_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_0,
consumer.str(), gpio::OUT, gpio::LOW);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), gpio::OUT,
gpio::LOW);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpio);
//TODO: Find out burn time. For now set to 1000 ms.
new SolarArrayDeploymentHandler(objects::SOLAR_ARRAY_DEPL_HANDLER, objects::GPIO_IF,
@ -766,27 +809,36 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4);
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);
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);
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);
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);
std::stringstream consumer;
GpiodRegularByLineName* gpio = nullptr;
consumer << "0x" << std::hex << objects::RW1;
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_1, consumer.str(), gpio::OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW1, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::RW2;
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_2, consumer.str(), gpio::OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW2, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::RW3;
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_3, consumer.str(), gpio::OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW3, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::RW4;
gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_4, consumer.str(), gpio::OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
/**
* 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).
*/
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);
gpio = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_SELECT,
"SPI Reaction Wheel Callback ", gpio::OUT, gpio::LOW);
gpioCookieRw->addGpio(gpioIds::SPI_MUX, gpio);
gpioComIF->addGpios(gpioCookieRw);
@ -809,6 +861,7 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
rwHandler1->setStartUpImmediately();
#endif
rw1SpiCookie->setCallbackArgs(rwHandler1);
rwHandler1->setStartUpImmediately();
auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF,
gpioIds::EN_RW2);
@ -839,9 +892,12 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#endif
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
#if OBSW_TEST_GPIO_LABEL == 1
#if OBSW_TEST_GPIO_OPEN_BYLABEL == 1
/* Configure MIO0 as input */
GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::OUT, 0, "/amba_pl/gpio@41200000", 0);
#elif OBSW_TEST_GPIO_OPEN_BY_LINE_NAME
GpiodRegularByLineName* testGpio = new GpiodRegularByLineName("test-name", "gpio-test",
gpio::OUT, 0);
#else
/* Configure MIO0 as input */
GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0);

View File

@ -24,31 +24,26 @@ void initSpiCsDecoder(GpioIF* gpioComIF) {
GpioCookie* spiMuxGpios = new GpioCookie;
GpiodRegularByLabel* spiMuxBit = nullptr;
GpiodRegularByLineName* spiMuxBit = nullptr;
/** Setting mux bit 1 to low will disable IC21 on the interface board */
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_1,
"SPI Mux Bit 1", gpio::OUT, gpio::LOW);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_1_PIN, "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 */
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_2,
"SPI Mux Bit 2", gpio::OUT, gpio::LOW);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_2_PIN, "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 */
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_3,
"SPI Mux Bit 3", gpio::OUT, gpio::LOW);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_3_PIN, "SPI Mux Bit 3", gpio::OUT, gpio::LOW);
spiMuxGpios->addGpio(gpioIds::SPI_MUX_BIT_3, spiMuxBit);
/** The following gpios can take arbitrary initial values */
spiMuxBit = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::SPI_MUX_BIT_4,
"SPI Mux Bit 4", gpio::OUT, gpio::LOW);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_4_PIN, "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);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_5_PIN, "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);
spiMuxBit = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_BIT_6_PIN, "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);
GpiodRegularByLineName* enRwDecoder = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_CS,
"EN_RW_CS", gpio::OUT, gpio::HIGH);
spiMuxGpios->addGpio(gpioIds::EN_RW_CS, enRwDecoder);
result = gpioComInterface->addGpios(spiMuxGpios);

2
fsfw

@ -1 +1 @@
Subproject commit e1a85b47c5018590e58b9b1130b1754b0079450f
Subproject commit 16b125ef6cdfbe1349e5b21b783cd72c871372a8

View File

@ -206,12 +206,6 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
/* Configure all SPI chip selects and pull them high */
acsInit();
l3gId = gyro1L3gd20ChipSelect;
/* Adapt accordingly */
if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro3L3gd20ChipSelect) {
sif::warning << "SpiTestClass::performLis3MdlTest: Invalid MGM ID!" << std::endl;
}
gpioId_t currentGpioId = 0;
uint8_t chipSelectPin = l3gId;
uint8_t whoAmIReg = 0b0000'1111;
@ -330,39 +324,39 @@ void SpiTestClass::acsInit() {
gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
#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);
GpiodRegularByLineName* gpio = nullptr;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, "MGM_0_LIS3", gpio::Direction::OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm1Rm3100ChipSelect,
"MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, "MGM_1_RM3100", gpio::Direction::OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_MGM2_LIS3_LABEL, mgm2Lis3mdlChipSelect,
"MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, "MGM_2_LIS3", gpio::Direction::OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, mgm3Rm3100ChipSelect,
"MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, "MGM_3_RM3100", gpio::Direction::OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro0AdisChipSelect,
"GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, "GYRO_0_ADIS",
gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro1L3gd20ChipSelect,
"GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, "GYRO_1_L3G", gpio::Direction::OUT,
gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_GYRO_ADIS_LABEL, gyro2AdisChipSelect, "GYRO_2_ADIS",
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, "GYRO_2_ADIS",
gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_ACS_BOARD_DEFAULT_LABEL, gyro3L3gd20ChipSelect,
"GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, "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 GpiodRegularByLabel(q7s::GPIO_FLEX_OBC1F_B0, q7s::GPIO_GYRO_0_ENABLE,
"GYRO_0_ENABLE", gpio::OUT, gpio::LOW);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, "GYRO_0_ENABLE", gpio::OUT,
gpio::LOW);
gpioCookie->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
gpio = new GpiodRegularByLabel(q7s::GPIO_3V3_OBC1C, q7s::GPIO_GYRO_2_ENABLE,
"GYRO_2_ENABLE", gpio::OUT, gpio::LOW);
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, "GYRO_2_ENABLE", gpio::OUT,
gpio::LOW);
gpioCookie->addGpio(gpioIds::GYRO_2_ENABLE, gpio);
#endif
if (gpioIF != nullptr) {

View File

@ -54,15 +54,6 @@ private:
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;
uint8_t gyro0AdisChipSelect = q7s::GPIO_GYRO_0_ADIS_CS;
uint8_t gyro2AdisChipSelect = q7s::GPIO_GYRO_2_ADIS_CS;
uint8_t gyro1L3gd20ChipSelect = q7s::GPIO_GYRO_1_L3G_CS;
uint8_t gyro3L3gd20ChipSelect = q7s::GPIO_GYRO_3_L3G_CS;
uint8_t mgm2Lis3mdlChipSelect = q7s::GPIO_MGM_2_LIS3_CS;
uint8_t mgm3Rm3100ChipSelect = q7s::GPIO_MGM_3_RM3100_CS;
#else
uint8_t mgm0Lis3mdlChipSelect = 0;
uint8_t mgm1Rm3100ChipSelect = 0;

View File

@ -84,7 +84,8 @@ debugging. */
#define OBSW_TEST_CCSDS_BRIDGE 0
#define OBSW_TEST_CCSDS_PTME 0
#define OBSW_TEST_TE7020_HEATER 0
#define OBSW_TEST_GPIO_LABEL 0
#define OBSW_TEST_GPIO_OPEN_BY_LABEL 0
#define OBSW_TEST_GPIO_OPEN_BY_LINE_NAME 0
#define OBSW_DEBUG_P60DOCK 0
#define OBSW_DEBUG_PDU1 0

View File

@ -439,8 +439,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
#endif
#if OBSW_ADD_ACS_BOARD == 1
bool enableAside = true;
bool enableBside = false;
bool enableAside = false;
bool enableBside = true;
if(enableAside) {
// A side
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,