Compare commits
9 Commits
1ac372cb89
...
882da68a2f
Author | SHA1 | Date | |
---|---|---|---|
882da68a2f | |||
b6aebb3061 | |||
04a1fe7f10 | |||
845c00044e | |||
5f79f987ae | |||
1183e5739d | |||
e3697d6d8c | |||
406b77ea81 | |||
8a9eb27458 |
@@ -1,5 +1,10 @@
|
|||||||
|
#include "fsfw/FSFW.h"
|
||||||
|
#include "fsfw/serviceinterface.h"
|
||||||
#include "fsfw_hal/linux/UnixFileGuard.h"
|
#include "fsfw_hal/linux/UnixFileGuard.h"
|
||||||
|
|
||||||
|
#include <cerrno>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
|
UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
|
||||||
std::string diagnosticPrefix):
|
std::string diagnosticPrefix):
|
||||||
fileDescriptor(fileDescriptor) {
|
fileDescriptor(fileDescriptor) {
|
||||||
@@ -10,12 +15,11 @@ UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags,
|
|||||||
if (*fileDescriptor < 0) {
|
if (*fileDescriptor < 0) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << diagnosticPrefix <<"Opening device failed with error code " << errno <<
|
sif::warning << diagnosticPrefix << ": Opening device failed with error code " <<
|
||||||
"." << std::endl;
|
errno << ": " << strerror(errno) << std::endl;
|
||||||
sif::warning << "Error description: " << strerror(errno) << std::endl;
|
|
||||||
#else
|
#else
|
||||||
sif::printError("%sOpening device failed with error code %d.\n", diagnosticPrefix);
|
sif::printWarning("%s: Opening device failed with error code %d: %s\n",
|
||||||
sif::printWarning("Error description: %s\n", strerror(errno));
|
diagnosticPrefix, errno, strerror(errno));
|
||||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||||
openStatus = OPEN_FILE_FAILED;
|
openStatus = OPEN_FILE_FAILED;
|
||||||
|
@@ -15,11 +15,6 @@
|
|||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
/* Can be used for low-level debugging of the SPI bus */
|
|
||||||
#ifndef FSFW_HAL_LINUX_SPI_WIRETAPPING
|
|
||||||
#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF):
|
SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF):
|
||||||
SystemObject(objectId), gpioComIF(gpioComIF) {
|
SystemObject(objectId), gpioComIF(gpioComIF) {
|
||||||
if(gpioComIF == nullptr) {
|
if(gpioComIF == nullptr) {
|
||||||
@@ -90,7 +85,7 @@ ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) {
|
|||||||
|
|
||||||
int fileDescriptor = 0;
|
int fileDescriptor = 0;
|
||||||
UnixFileGuard fileHelper(spiCookie->getSpiDevice(), &fileDescriptor, O_RDWR,
|
UnixFileGuard fileHelper(spiCookie->getSpiDevice(), &fileDescriptor, O_RDWR,
|
||||||
"SpiComIF::initializeInterface: ");
|
"SpiComIF::initializeInterface");
|
||||||
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return fileHelper.getOpenResult();
|
return fileHelper.getOpenResult();
|
||||||
}
|
}
|
||||||
@@ -184,7 +179,7 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const
|
|||||||
/* Prepare transfer */
|
/* Prepare transfer */
|
||||||
int fileDescriptor = 0;
|
int fileDescriptor = 0;
|
||||||
std::string device = spiCookie->getSpiDevice();
|
std::string device = spiCookie->getSpiDevice();
|
||||||
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage: ");
|
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage");
|
||||||
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return OPENING_FILE_FAILED;
|
return OPENING_FILE_FAILED;
|
||||||
}
|
}
|
||||||
@@ -273,7 +268,7 @@ ReturnValue_t SpiComIF::performHalfDuplexReception(SpiCookie* spiCookie) {
|
|||||||
std::string device = spiCookie->getSpiDevice();
|
std::string device = spiCookie->getSpiDevice();
|
||||||
int fileDescriptor = 0;
|
int fileDescriptor = 0;
|
||||||
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR,
|
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR,
|
||||||
"SpiComIF::requestReceiveMessage: ");
|
"SpiComIF::requestReceiveMessage");
|
||||||
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return OPENING_FILE_FAILED;
|
return OPENING_FILE_FAILED;
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
#ifndef LINUX_SPI_SPICOMIF_H_
|
#ifndef LINUX_SPI_SPICOMIF_H_
|
||||||
#define LINUX_SPI_SPICOMIF_H_
|
#define LINUX_SPI_SPICOMIF_H_
|
||||||
|
|
||||||
|
#include "fsfw/FSFW.h"
|
||||||
#include "spiDefinitions.h"
|
#include "spiDefinitions.h"
|
||||||
#include "returnvalues/classIds.h"
|
#include "returnvalues/classIds.h"
|
||||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||||
|
@@ -11,6 +11,11 @@
|
|||||||
#cmakedefine FSFW_ADD_MONITORING
|
#cmakedefine FSFW_ADD_MONITORING
|
||||||
#cmakedefine FSFW_ADD_SGP4_PROPAGATOR
|
#cmakedefine FSFW_ADD_SGP4_PROPAGATOR
|
||||||
|
|
||||||
|
/* Can be used for low-level debugging of the SPI bus */
|
||||||
|
#ifndef FSFW_HAL_LINUX_SPI_WIRETAPPING
|
||||||
|
#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG
|
#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG
|
||||||
#define FSFW_HAL_L3GD20_GYRO_DEBUG 0
|
#define FSFW_HAL_L3GD20_GYRO_DEBUG 0
|
||||||
#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */
|
#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */
|
||||||
|
@@ -32,17 +32,6 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
|
|||||||
setQueueToUse(queueToUse_);
|
setQueueToUse(queueToUse_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(queueToUse == nullptr) {
|
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::warning << "ActionHelper::initialize: No queue set" << std::endl;
|
|
||||||
#else
|
|
||||||
sif::printWarning("ActionHelper::initialize: No queue set\n");
|
|
||||||
#endif
|
|
||||||
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,19 +55,7 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) {
|
|||||||
|
|
||||||
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy,
|
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy,
|
||||||
ActionId_t actionId, store_address_t dataAddress) {
|
ActionId_t actionId, store_address_t dataAddress) {
|
||||||
if(ipcStore == nullptr) {
|
const uint8_t* dataPtr = NULL;
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::warning << "ActionHelper::prepareExecution: IPC Store not set. Call initialize first"
|
|
||||||
<< std::endl;
|
|
||||||
#else
|
|
||||||
sif::printWarning("ActionHelper::prepareExecution: "
|
|
||||||
"IPC Store not set. Call initialize first\n");
|
|
||||||
#endif
|
|
||||||
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const uint8_t* dataPtr = nullptr;
|
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
Reference in New Issue
Block a user