v1.15.0 #311
@ -41,19 +41,19 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
||||
uint8_t writeSize = 0;
|
||||
|
||||
gpioId_t gpioId = cookie->getChipSelectPin();
|
||||
GpioIF* gpioIF = comIf->getGpioInterface();
|
||||
GpioIF& gpioIF = comIf->getGpioInterface();
|
||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||
uint32_t timeoutMs = 0;
|
||||
MutexIF* mutex = comIf->getCsMutex();
|
||||
cookie->getMutexParams(timeoutType, timeoutMs);
|
||||
if (mutex == nullptr or gpioIF == nullptr) {
|
||||
if (mutex == nullptr) {
|
||||
sif::debug << "rwSpiCallback::spiCallback: Mutex or GPIO interface invalid" << std::endl;
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
||||
int fileDescriptor = 0;
|
||||
const std::string& dev = comIf->getSpiDev();
|
||||
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
||||
result = openSpi(dev, O_RDWR, &gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -75,7 +75,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
||||
|
||||
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
|
||||
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
return RwHandler::SPI_WRITE_FAILURE;
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
||||
}
|
||||
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
|
||||
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
return RwHandler::SPI_WRITE_FAILURE;
|
||||
}
|
||||
idx++;
|
||||
@ -112,14 +112,14 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
||||
|
||||
if (write(fileDescriptor, writeBuffer, writeSize) != static_cast<ssize_t>(writeSize)) {
|
||||
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
return RwHandler::SPI_WRITE_FAILURE;
|
||||
}
|
||||
|
||||
uint8_t* rxBuf = nullptr;
|
||||
result = comIf->getReadBuffer(cookie->getSpiAddress(), &rxBuf);
|
||||
if (result != returnvalue::OK) {
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -127,9 +127,9 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
||||
|
||||
// There must be a delay of at least 20 ms after sending the command.
|
||||
// Delay for 70 ms here and release the SPI bus for that duration.
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
usleep(RwDefinitions::SPI_REPLY_DELAY);
|
||||
result = openSpi(dev, O_RDWR, gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
||||
result = openSpi(dev, O_RDWR, &gpioIF, gpioId, mutex, timeoutType, timeoutMs, fileDescriptor);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -142,13 +142,13 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
||||
for (int idx = 0; idx < 10; idx++) {
|
||||
if (read(fileDescriptor, &byteRead, 1) != 1) {
|
||||
sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl;
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
return RwHandler::SPI_READ_FAILURE;
|
||||
}
|
||||
if (idx == 0) {
|
||||
if (byteRead != FLAG_BYTE) {
|
||||
sif::error << "Invalid data, expected start marker" << std::endl;
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
return RwHandler::NO_START_MARKER;
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
||||
|
||||
if (idx == 9) {
|
||||
sif::error << "rwSpiCallback::spiCallback: Empty frame timeout" << std::endl;
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
return RwHandler::NO_REPLY;
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
||||
continue;
|
||||
} else {
|
||||
sif::error << "rwSpiCallback::spiCallback: Invalid substitute" << std::endl;
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
result = RwHandler::INVALID_SUBSTITUTE;
|
||||
break;
|
||||
}
|
||||
@ -233,7 +233,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen
|
||||
|
||||
cookie->setTransferSize(decodedFrameLen);
|
||||
|
||||
closeSpi(fileDescriptor, gpioId, gpioIF, mutex);
|
||||
closeSpi(fileDescriptor, gpioId, &gpioIF, mutex);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -145,10 +145,8 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, Ua
|
||||
new CspComIF(objects::CSP_COM_IF);
|
||||
*i2cComIF = new I2cComIF(objects::I2C_COM_IF);
|
||||
*uartComIF = new UartComIF(objects::UART_COM_IF);
|
||||
*spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, *gpioComIF);
|
||||
*spiRWComIF = new SpiComIF(objects::SPI_RW_COM_IF, q7s::SPI_RW_DEV, *gpioComIF);
|
||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||
q7s::gpioCallbacks::initSpiCsDecoder(*gpioComIF);
|
||||
*spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, **gpioComIF);
|
||||
*spiRWComIF = new SpiComIF(objects::SPI_RW_COM_IF, q7s::SPI_RW_DEV, **gpioComIF);
|
||||
}
|
||||
|
||||
void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher) {
|
||||
@ -193,8 +191,11 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
||||
ReturnValue_t ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
||||
using namespace gpio;
|
||||
if(gpioComIF == nullptr) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
GpioCookie* gpioCookieRadSensor = new GpioCookie;
|
||||
std::stringstream consumer;
|
||||
consumer << "0x" << std::hex << objects::RAD_SENSOR;
|
||||
@ -220,6 +221,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
|
||||
#if OBSW_DEBUG_RAD_SENSOR == 1
|
||||
radSensor->enablePeriodicDataPrint(true);
|
||||
#endif
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
|
||||
|
@ -26,7 +26,7 @@ void createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher
|
||||
void createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF* spiComIF,
|
||||
PowerSwitchIF* pwrSwitcher);
|
||||
void createTmpComponents();
|
||||
void createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||
ReturnValue_t createRadSensorComponent(LinuxLibgpioIF* gpioComIF);
|
||||
void createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComIF* uartComIF,
|
||||
PowerSwitchIF* pwrSwitcher);
|
||||
void createHeaterComponents(GpioIF* gpioIF, PowerSwitchIF* pwrSwitcher, HealthTableIF* healthTable);
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
|
||||
#include <fsfw/health/HealthTableIF.h>
|
||||
#include <fsfw/power/DummyPowerSwitcher.h>
|
||||
|
||||
@ -24,6 +25,9 @@ void ObjectFactory::produce(void* args) {
|
||||
I2cComIF* i2cComIF = nullptr;
|
||||
SpiComIF* spiRwComIF = nullptr;
|
||||
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF, &spiRwComIF);
|
||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF);
|
||||
gpioCallbacks::disableAllDecoder(gpioComIF);
|
||||
|
||||
// Hardware is usually not connected to EM, so we need to create dummies which replace lower
|
||||
// level components.
|
||||
@ -33,7 +37,6 @@ void ObjectFactory::produce(void* args) {
|
||||
|
||||
new CoreController(objects::CORE_CONTROLLER);
|
||||
|
||||
gpioCallbacks::disableAllDecoder(gpioComIF);
|
||||
PowerSwitchIF* pwrSwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0);
|
||||
static_cast<void>(pwrSwitcher);
|
||||
|
||||
@ -47,7 +50,10 @@ void ObjectFactory::produce(void* args) {
|
||||
// createSolarArrayDeploymentComponents();
|
||||
// createPayloadComponents(gpioComIF);
|
||||
// createHeaterComponents(gpioComIF, pwrSwitcher, healthTable);
|
||||
createRadSensorComponent(gpioComIF);
|
||||
|
||||
// TODO: Careful! Swichting this on somehow messes with the communication with the ProASIC
|
||||
// and will cause xsc_boot_copy commands to always boot to 0 0
|
||||
// createRadSensorComponent(gpioComIF);
|
||||
|
||||
#if OBSW_ADD_ACS_BOARD == 1
|
||||
createAcsBoardComponents(gpioComIF, uartComIF, pwrSwitcher);
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
|
||||
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
@ -23,10 +24,11 @@ void ObjectFactory::produce(void* args) {
|
||||
PowerSwitchIF* pwrSwitcher = nullptr;
|
||||
SpiComIF* spiRwComIF = nullptr;
|
||||
createCommunicationInterfaces(&gpioComIF, &uartComIF, &spiMainComIF, &i2cComIF, &spiRwComIF);
|
||||
createTmpComponents();
|
||||
new CoreController(objects::CORE_CONTROLLER);
|
||||
|
||||
/* Adding gpios for chip select decoding to the gpioComIf */
|
||||
q7s::gpioCallbacks::initSpiCsDecoder(gpioComIF);
|
||||
gpioCallbacks::disableAllDecoder(gpioComIF);
|
||||
|
||||
new CoreController(objects::CORE_CONTROLLER);
|
||||
createPcduComponents(gpioComIF, &pwrSwitcher);
|
||||
createRadSensorComponent(gpioComIF);
|
||||
createSunSensorComponents(gpioComIF, spiMainComIF, pwrSwitcher, q7s::SPI_DEFAULT_DEV);
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 1f05e6b297af8a6d310394e959c4d0cf13632831
|
||||
Subproject commit 60ff411721909bd6e4c34523a2248d8dca2507b1
|
@ -422,12 +422,12 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie *
|
||||
cookie->setTransferSize(2);
|
||||
|
||||
gpioId_t gpioId = cookie->getChipSelectPin();
|
||||
GpioIF *gpioIF = comIf->getGpioInterface();
|
||||
GpioIF& gpioIF = comIf->getGpioInterface();
|
||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||
uint32_t timeoutMs = 0;
|
||||
MutexIF *mutex = comIf->getCsMutex();
|
||||
cookie->getMutexParams(timeoutType, timeoutMs);
|
||||
if (mutex == nullptr or gpioIF == nullptr) {
|
||||
if (mutex == nullptr) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::warning << "GyroADIS16507Handler::spiSendCallback: "
|
||||
"Mutex or GPIO interface invalid"
|
||||
@ -453,7 +453,7 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie *
|
||||
while (idx < sendLen) {
|
||||
// Pull SPI CS low. For now, no support for active high given
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullLow(gpioId);
|
||||
gpioIF.pullLow(gpioId);
|
||||
}
|
||||
|
||||
// Execute transfer
|
||||
@ -468,7 +468,7 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie *
|
||||
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
|
||||
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullHigh(gpioId);
|
||||
gpioIF.pullHigh(gpioId);
|
||||
}
|
||||
|
||||
idx += 2;
|
||||
|
@ -719,11 +719,11 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
|
||||
cookie->setTransferSize(transferLen);
|
||||
|
||||
gpioId_t gpioId = cookie->getChipSelectPin();
|
||||
GpioIF* gpioIF = comIf->getGpioInterface();
|
||||
GpioIF& gpioIF = comIf->getGpioInterface();
|
||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||
uint32_t timeoutMs = 0;
|
||||
MutexIF* mutex = comIf->getCsMutex();
|
||||
if (mutex == nullptr or gpioIF == nullptr) {
|
||||
if (mutex == nullptr) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::warning << "GyroADIS16507Handler::spiSendCallback: "
|
||||
"Mutex or GPIO interface invalid"
|
||||
@ -753,7 +753,7 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
|
||||
transferStruct->len = transferLen;
|
||||
// Pull SPI CS low. For now, no support for active high given
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullLow(gpioId);
|
||||
gpioIF.pullLow(gpioId);
|
||||
}
|
||||
|
||||
// Execute transfer
|
||||
@ -768,14 +768,14 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
|
||||
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
|
||||
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullHigh(gpioId);
|
||||
gpioIF.pullHigh(gpioId);
|
||||
}
|
||||
|
||||
transferStruct->tx_buf += transferLen;
|
||||
transferStruct->rx_buf += transferLen;
|
||||
transferStruct->len = plpcdu::TEMP_REPLY_SIZE - 1;
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullLow(gpioId);
|
||||
gpioIF.pullLow(gpioId);
|
||||
}
|
||||
|
||||
// Execute transfer
|
||||
@ -790,7 +790,7 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
|
||||
#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */
|
||||
|
||||
if (gpioId != gpio::NO_GPIO) {
|
||||
gpioIF->pullHigh(gpioId);
|
||||
gpioIF.pullHigh(gpioId);
|
||||
}
|
||||
|
||||
transferStruct->tx_buf = origTx;
|
||||
|
Loading…
Reference in New Issue
Block a user