class to map uio addresses into user space #535
|
@ -16,8 +16,8 @@ enum Levels: uint8_t {
|
|||
};
|
||||
|
||||
enum Direction: uint8_t {
|
||||
IN = 0,
|
||||
OUT = 1
|
||||
DIR_IN = 0,
|
||||
DIR_OUT = 1
|
||||
};
|
||||
|
||||
enum GpioOperation {
|
||||
|
@ -30,7 +30,7 @@ enum class GpioTypes {
|
|||
GPIO_REGULAR_BY_CHIP,
|
||||
GPIO_REGULAR_BY_LABEL,
|
||||
GPIO_REGULAR_BY_LINE_NAME,
|
||||
CALLBACK
|
||||
TYPE_CALLBACK
|
||||
};
|
||||
|
||||
static constexpr gpioId_t NO_GPIO = -1;
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
// Can be used to cast GpioBase to a concrete child implementation
|
||||
gpio::GpioTypes gpioType = gpio::GpioTypes::NONE;
|
||||
std::string consumer;
|
||||
gpio::Direction direction = gpio::Direction::IN;
|
||||
gpio::Direction direction = gpio::Direction::DIR_IN;
|
||||
gpio::Levels initValue = gpio::Levels::NONE;
|
||||
};
|
||||
|
||||
|
@ -92,7 +92,7 @@ class GpiodRegularByChip: public GpiodRegularBase {
|
|||
public:
|
||||
GpiodRegularByChip() :
|
||||
GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP,
|
||||
std::string(), gpio::Direction::IN, gpio::LOW, 0) {
|
||||
std::string(), gpio::Direction::DIR_IN, gpio::LOW, 0) {
|
||||
}
|
||||
|
||||
GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_,
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
|
||||
GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_) :
|
||||
GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, consumer_,
|
||||
gpio::Direction::IN, gpio::LOW, lineNum_),
|
||||
gpio::Direction::DIR_IN, gpio::LOW, lineNum_),
|
||||
chipname(chipname_) {
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ public:
|
|||
|
||||
GpiodRegularByLabel(std::string label_, int lineNum_, std::string consumer_) :
|
||||
GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL, consumer_,
|
||||
gpio::Direction::IN, gpio::LOW, lineNum_),
|
||||
gpio::Direction::DIR_IN, gpio::LOW, lineNum_),
|
||||
label(label_) {
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
|
||||
GpiodRegularByLineName(std::string lineName_, std::string consumer_) :
|
||||
GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME, consumer_,
|
||||
gpio::Direction::IN, gpio::LOW), lineName(lineName_) {
|
||||
gpio::Direction::DIR_IN, gpio::LOW), lineName(lineName_) {
|
||||
}
|
||||
|
||||
std::string lineName;
|
||||
|
@ -154,7 +154,7 @@ class GpioCallback: public GpioBase {
|
|||
public:
|
||||
GpioCallback(std::string consumer, gpio::Direction direction_, gpio::Levels initValue_,
|
||||
gpio::gpio_cb_t callback, void* callbackArgs):
|
||||
GpioBase(gpio::GpioTypes::CALLBACK, consumer, direction_, initValue_),
|
||||
GpioBase(gpio::GpioTypes::TYPE_CALLBACK, consumer, direction_, initValue_),
|
||||
callback(callback), callbackArgs(callbackArgs) {}
|
||||
|
||||
gpio::gpio_cb_t callback = nullptr;
|
||||
|
|
|
@ -9,7 +9,7 @@ GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceC
|
|||
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
|
||||
transitionDelayMs(transitionDelayMs), dataset(this) {
|
||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
||||
debugDivider = new PeriodicOperationDivider(3);
|
||||
debugDivider = new PeriodicOperationDivider(10);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCom
|
|||
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
|
||||
dataset(this), transitionDelay(transitionDelay) {
|
||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||
debugDivider = new PeriodicOperationDivider(3);
|
||||
debugDivider = new PeriodicOperationDivider(10);
|
||||
#endif
|
||||
// Set to default values right away
|
||||
registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT;
|
||||
|
@ -283,7 +283,7 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||
int16_t mgmMeasurementRawZ = packet[MGMLIS3MDL::Z_HIGHBYTE_IDX] << 8
|
||||
| packet[MGMLIS3MDL::Z_LOWBYTE_IDX] ;
|
||||
|
||||
/* Target value in microtesla */
|
||||
// Target value in microtesla
|
||||
float mgmX = static_cast<float>(mgmMeasurementRawX) * sensitivityFactor
|
||||
* MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
|
||||
float mgmY = static_cast<float>(mgmMeasurementRawY) * sensitivityFactor
|
||||
|
@ -339,7 +339,7 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||
case MGMLIS3MDL::READ_TEMPERATURE: {
|
||||
int16_t tempValueRaw = packet[2] << 8 | packet[1];
|
||||
float tempValue = 25.0 + ((static_cast<float>(tempValueRaw)) / 8.0);
|
||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||
if(debugDivider->check()) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" <<
|
||||
|
@ -489,7 +489,7 @@ ReturnValue_t MgmLIS3MDLHandler::prepareCtrlRegisterWrite() {
|
|||
}
|
||||
|
||||
void MgmLIS3MDLHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
|
||||
DeviceHandlerBase::doTransition(modeFrom, subModeFrom);
|
||||
}
|
||||
|
||||
uint32_t MgmLIS3MDLHandler::getTransitionDelayMs(Mode_t from, Mode_t to) {
|
||||
|
|
|
@ -12,7 +12,7 @@ MgmRM3100Handler::MgmRM3100Handler(object_id_t objectId,
|
|||
DeviceHandlerBase(objectId, deviceCommunication, comCookie),
|
||||
primaryDataset(this), transitionDelay(transitionDelay) {
|
||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||
debugDivider = new PeriodicOperationDivider(3);
|
||||
debugDivider = new PeriodicOperationDivider(10);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,12 @@ endif()
|
|||
|
||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||
UnixFileGuard.cpp
|
||||
CommandExecutor.cpp
|
||||
utility.cpp
|
||||
)
|
||||
|
||||
add_subdirectory(gpio)
|
||||
add_subdirectory(spi)
|
||||
add_subdirectory(i2c)
|
||||
add_subdirectory(uart)
|
||||
add_subdirectory(uart)
|
||||
add_subdirectory(uio)
|
210
hal/src/fsfw_hal/linux/CommandExecutor.cpp
Normal file
210
hal/src/fsfw_hal/linux/CommandExecutor.cpp
Normal file
|
@ -0,0 +1,210 @@
|
|||
#include "CommandExecutor.h"
|
||||
|
||||
#include "fsfw/serviceinterface.h"
|
||||
#include "fsfw/container/SimpleRingBuffer.h"
|
||||
#include "fsfw/container/DynamicFIFO.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
CommandExecutor::CommandExecutor(const size_t maxSize):
|
||||
readVec(maxSize) {
|
||||
waiter.events = POLLIN;
|
||||
}
|
||||
|
||||
ReturnValue_t CommandExecutor::load(std::string command, bool blocking, bool printOutput) {
|
||||
if(state == States::PENDING) {
|
||||
return COMMAND_PENDING;
|
||||
}
|
||||
|
||||
currentCmd = command;
|
||||
this->blocking = blocking;
|
||||
this->printOutput = printOutput;
|
||||
if(state == States::IDLE) {
|
||||
state = States::COMMAND_LOADED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t CommandExecutor::execute() {
|
||||
if(state == States::IDLE) {
|
||||
return NO_COMMAND_LOADED_OR_PENDING;
|
||||
}
|
||||
else if(state == States::PENDING) {
|
||||
return COMMAND_PENDING;
|
||||
}
|
||||
currentCmdFile = popen(currentCmd.c_str(), "r");
|
||||
if(currentCmdFile == nullptr) {
|
||||
lastError = errno;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
if(blocking) {
|
||||
return executeBlocking();
|
||||
}
|
||||
else {
|
||||
currentFd = fileno(currentCmdFile);
|
||||
waiter.fd = currentFd;
|
||||
}
|
||||
state = States::PENDING;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t CommandExecutor::close() {
|
||||
if(state == States::PENDING) {
|
||||
// Attempt to close process, irrespective of if it is running or not
|
||||
if(currentCmdFile != nullptr) {
|
||||
pclose(currentCmdFile);
|
||||
}
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void CommandExecutor::printLastError(std::string funcName) const {
|
||||
if(lastError != 0) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << funcName << " pclose failed with code " << lastError << ": " <<
|
||||
strerror(lastError) << std::endl;
|
||||
#else
|
||||
sif::printError("%s pclose failed with code %d: %s\n",
|
||||
funcName, lastError, strerror(lastError));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CommandExecutor::setRingBuffer(SimpleRingBuffer *ringBuffer,
|
||||
DynamicFIFO<uint16_t>* sizesFifo) {
|
||||
this->ringBuffer = ringBuffer;
|
||||
this->sizesFifo = sizesFifo;
|
||||
}
|
||||
|
||||
ReturnValue_t CommandExecutor::check(bool& bytesRead) {
|
||||
if(blocking) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
switch(state) {
|
||||
case(States::IDLE):
|
||||
case(States::COMMAND_LOADED): {
|
||||
return NO_COMMAND_LOADED_OR_PENDING;
|
||||
}
|
||||
case(States::PENDING): {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int result = poll(&waiter, 1, 0);
|
||||
switch(result) {
|
||||
case(0): {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case(1): {
|
||||
if (waiter.revents & POLLIN) {
|
||||
ssize_t readBytes = read(currentFd, readVec.data(), readVec.size());
|
||||
if(readBytes == 0) {
|
||||
// Should not happen
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "CommandExecutor::check: No bytes read "
|
||||
"after poll event.." << std::endl;
|
||||
#else
|
||||
sif::printWarning("CommandExecutor::check: No bytes read after poll event..\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
else if(readBytes > 0) {
|
||||
bytesRead = true;
|
||||
if(printOutput) {
|
||||
// It is assumed the command output is line terminated
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << currentCmd << " | " << readVec.data();
|
||||
#else
|
||||
sif::printInfo("%s | %s", currentCmd, readVec.data());
|
||||
#endif
|
||||
}
|
||||
if(ringBuffer != nullptr) {
|
||||
ringBuffer->writeData(reinterpret_cast<const uint8_t*>(
|
||||
readVec.data()), readBytes);
|
||||
}
|
||||
if(sizesFifo != nullptr) {
|
||||
if(not sizesFifo->full()) {
|
||||
sizesFifo->insert(readBytes);
|
||||
}
|
||||
}
|
||||
return BYTES_READ;
|
||||
}
|
||||
else {
|
||||
// Should also not happen
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "CommandExecutor::check: Error " << errno << ": " <<
|
||||
strerror(errno) << std::endl;
|
||||
#else
|
||||
sif::printWarning("CommandExecutor::check: Error %d: %s\n", errno, strerror(errno));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if(waiter.revents & POLLERR) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "CommandExecuter::check: Poll error" << std::endl;
|
||||
#else
|
||||
sif::printWarning("CommandExecuter::check: Poll error\n");
|
||||
#endif
|
||||
return COMMAND_ERROR;
|
||||
}
|
||||
else if(waiter.revents & POLLHUP) {
|
||||
int result = pclose(currentCmdFile);
|
||||
if(result != 0) {
|
||||
lastError = result;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
state = States::IDLE;
|
||||
currentCmdFile = nullptr;
|
||||
currentFd = 0;
|
||||
return EXECUTION_FINISHED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void CommandExecutor::reset() {
|
||||
CommandExecutor::close();
|
||||
currentCmdFile = nullptr;
|
||||
currentFd = 0;
|
||||
state = States::IDLE;
|
||||
}
|
||||
|
||||
int CommandExecutor::getLastError() const {
|
||||
return this->lastError;
|
||||
}
|
||||
|
||||
CommandExecutor::States CommandExecutor::getCurrentState() const {
|
||||
return state;
|
||||
}
|
||||
|
||||
ReturnValue_t CommandExecutor::executeBlocking() {
|
||||
while(fgets(readVec.data(), readVec.size(), currentCmdFile) != nullptr) {
|
||||
std::string output(readVec.data());
|
||||
if(printOutput) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << currentCmd << " | " << output;
|
||||
#else
|
||||
sif::printInfo("%s | %s", currentCmd, output);
|
||||
#endif
|
||||
}
|
||||
if(ringBuffer != nullptr) {
|
||||
ringBuffer->writeData(reinterpret_cast<const uint8_t*>(output.data()), output.size());
|
||||
}
|
||||
if(sizesFifo != nullptr) {
|
||||
if(not sizesFifo->full()) {
|
||||
sizesFifo->insert(output.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
int result = pclose(currentCmdFile);
|
||||
if(result != 0) {
|
||||
lastError = result;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
134
hal/src/fsfw_hal/linux/CommandExecutor.h
Normal file
134
hal/src/fsfw_hal/linux/CommandExecutor.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
#ifndef FSFW_SRC_FSFW_OSAL_LINUX_COMMANDEXECUTOR_H_
|
||||
#define FSFW_SRC_FSFW_OSAL_LINUX_COMMANDEXECUTOR_H_
|
||||
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/returnvalues/FwClassIds.h"
|
||||
|
||||
#include <poll.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class SimpleRingBuffer;
|
||||
template <typename T> class DynamicFIFO;
|
||||
|
||||
/**
|
||||
* @brief Helper class to execute shell commands in blocking and non-blocking mode
|
||||
* @details
|
||||
* This class is able to execute processes by using the Linux popen call. It also has the
|
||||
* capability of writing the read output of a process into a provided ring buffer.
|
||||
*
|
||||
* The executor works by first loading the command which should be executed and specifying
|
||||
* whether it should be executed blocking or non-blocking. After that, execution can be started
|
||||
* with the execute command. In blocking mode, the execute command will block until the command
|
||||
* has finished
|
||||
*/
|
||||
class CommandExecutor {
|
||||
public:
|
||||
enum class States {
|
||||
IDLE,
|
||||
COMMAND_LOADED,
|
||||
PENDING
|
||||
};
|
||||
|
||||
static constexpr uint8_t CLASS_ID = CLASS_ID::LINUX_OSAL;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Execution of the current command has finished
|
||||
static constexpr ReturnValue_t EXECUTION_FINISHED =
|
||||
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 0);
|
||||
|
||||
//! [EXPORT] : [COMMENT] Command is pending. This will also be returned if the user tries
|
||||
//! to load another command but a command is still pending
|
||||
static constexpr ReturnValue_t COMMAND_PENDING =
|
||||
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 1);
|
||||
//! [EXPORT] : [COMMENT] Some bytes have been read from the executing process
|
||||
static constexpr ReturnValue_t BYTES_READ =
|
||||
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 2);
|
||||
//! [EXPORT] : [COMMENT] Command execution failed
|
||||
static constexpr ReturnValue_t COMMAND_ERROR =
|
||||
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 3);
|
||||
//! [EXPORT] : [COMMENT]
|
||||
static constexpr ReturnValue_t NO_COMMAND_LOADED_OR_PENDING =
|
||||
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 4);
|
||||
static constexpr ReturnValue_t PCLOSE_CALL_ERROR =
|
||||
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 6);
|
||||
|
||||
/**
|
||||
* Constructor. Is initialized with maximum size of internal buffer to read data from the
|
||||
* executed process.
|
||||
* @param maxSize
|
||||
*/
|
||||
CommandExecutor(const size_t maxSize);
|
||||
|
||||
/**
|
||||
* Load a new command which should be executed
|
||||
* @param command
|
||||
* @param blocking
|
||||
* @param printOutput
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t load(std::string command, bool blocking, bool printOutput = true);
|
||||
/**
|
||||
* Execute the loaded command.
|
||||
* @return
|
||||
* - In blocking mode, it will return RETURN_FAILED if
|
||||
* the result of the system call was not 0. The error value can be accessed using
|
||||
* getLastError
|
||||
* - In non-blocking mode, this call will start
|
||||
* the execution and then return RETURN_OK
|
||||
*/
|
||||
ReturnValue_t execute();
|
||||
/**
|
||||
* Only used in non-blocking mode. Checks the currently running command.
|
||||
* @param bytesRead Will be set to the number of bytes read, if bytes have been read
|
||||
* @return
|
||||
* - BYTES_READ if bytes have been read from the executing process. It is recommended to call
|
||||
* check again after this
|
||||
* - RETURN_OK execution is pending, but no bytes have been read from the executing process
|
||||
* - RETURN_FAILED if execution has failed, error value can be accessed using getLastError
|
||||
* - EXECUTION_FINISHED if the process was executed successfully
|
||||
* - COMMAND_ERROR internal poll error
|
||||
*/
|
||||
ReturnValue_t check(bool& bytesRead);
|
||||
/**
|
||||
* Abort the current command. Should normally not be necessary, check can be used to find
|
||||
* out whether command execution was successful
|
||||
* @return RETURN_OK
|
||||
*/
|
||||
ReturnValue_t close();
|
||||
|
||||
States getCurrentState() const;
|
||||
int getLastError() const;
|
||||
void printLastError(std::string funcName) const;
|
||||
|
||||
/**
|
||||
* Assign a ring buffer and a FIFO which will be filled by the executor with the output
|
||||
* read from the started process
|
||||
* @param ringBuffer
|
||||
* @param sizesFifo
|
||||
*/
|
||||
void setRingBuffer(SimpleRingBuffer* ringBuffer, DynamicFIFO<uint16_t>* sizesFifo);
|
||||
|
||||
/**
|
||||
* Reset the executor. This calls close internally and then reset the state machine so new
|
||||
* commands can be loaded and executed
|
||||
*/
|
||||
void reset();
|
||||
private:
|
||||
std::string currentCmd;
|
||||
bool blocking = true;
|
||||
FILE* currentCmdFile = nullptr;
|
||||
int currentFd = 0;
|
||||
bool printOutput = true;
|
||||
std::vector<char> readVec;
|
||||
struct pollfd waiter {};
|
||||
SimpleRingBuffer* ringBuffer = nullptr;
|
||||
DynamicFIFO<uint16_t>* sizesFifo = nullptr;
|
||||
|
||||
States state = States::IDLE;
|
||||
int lastError = 0;
|
||||
|
||||
ReturnValue_t executeBlocking();
|
||||
};
|
||||
|
||||
#endif /* FSFW_SRC_FSFW_OSAL_LINUX_COMMANDEXECUTOR_H_ */
|
|
@ -75,7 +75,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) {
|
|||
configureGpioByLineName(gpioConfig.first, *regularGpio);
|
||||
break;
|
||||
}
|
||||
case(gpio::GpioTypes::CALLBACK): {
|
||||
case(gpio::GpioTypes::TYPE_CALLBACK): {
|
||||
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioConfig.second);
|
||||
if(gpioCallback->callback == nullptr) {
|
||||
return GPIO_INVALID_INSTANCE;
|
||||
|
@ -163,12 +163,12 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, struct gpiod
|
|||
consumer = regularGpio.consumer;
|
||||
/* Configure direction and add a description to the GPIO */
|
||||
switch (direction) {
|
||||
case(gpio::OUT): {
|
||||
case(gpio::DIR_OUT): {
|
||||
result = gpiod_line_request_output(lineHandle, consumer.c_str(),
|
||||
regularGpio.initValue);
|
||||
break;
|
||||
}
|
||||
case(gpio::IN): {
|
||||
case(gpio::DIR_IN): {
|
||||
result = gpiod_line_request_input(lineHandle, consumer.c_str());
|
||||
break;
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd){
|
|||
}
|
||||
break;
|
||||
}
|
||||
case(gpio::GpioTypes::CALLBACK): {
|
||||
case(gpio::GpioTypes::TYPE_CALLBACK): {
|
||||
auto callbackGpio = dynamic_cast<GpioCallback*>(gpioConfig.second);
|
||||
if(callbackGpio == nullptr) {
|
||||
return GPIO_TYPE_FAILURE;
|
||||
|
@ -371,13 +371,13 @@ ReturnValue_t LinuxLibgpioIF::checkForConflictsById(gpioId_t gpioIdToCheck,
|
|||
case(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP):
|
||||
case(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL):
|
||||
case(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME): {
|
||||
if(gpioType == gpio::GpioTypes::NONE or gpioType == gpio::GpioTypes::CALLBACK) {
|
||||
if(gpioType == gpio::GpioTypes::NONE or gpioType == gpio::GpioTypes::TYPE_CALLBACK) {
|
||||
eraseDuplicateDifferentType = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case(gpio::GpioTypes::CALLBACK): {
|
||||
if(gpioType != gpio::GpioTypes::CALLBACK) {
|
||||
case(gpio::GpioTypes::TYPE_CALLBACK): {
|
||||
if(gpioType != gpio::GpioTypes::TYPE_CALLBACK) {
|
||||
eraseDuplicateDifferentType = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
|
||||
ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
|
||||
std::string consumer, gpio::Direction direction, int initValue) {
|
||||
std::string consumer, gpio::Direction direction, gpio::Levels initValue) {
|
||||
if(cookie == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace gpio {
|
|||
* @return
|
||||
*/
|
||||
ReturnValue_t createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
|
||||
std::string consumer, gpio::Direction direction, int initValue);
|
||||
std::string consumer, gpio::Direction direction, gpio::Levels initValue);
|
||||
}
|
||||
|
||||
#endif /* BSP_RPI_GPIO_GPIORPI_H_ */
|
||||
|
|
3
hal/src/fsfw_hal/linux/uio/CMakeLists.txt
Normal file
3
hal/src/fsfw_hal/linux/uio/CMakeLists.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
target_sources(${LIB_FSFW_NAME} PUBLIC
|
||||
UioMapper.cpp
|
||||
)
|
63
hal/src/fsfw_hal/linux/uio/UioMapper.cpp
Normal file
63
hal/src/fsfw_hal/linux/uio/UioMapper.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include "UioMapper.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
UioMapper::UioMapper(std::string uioFile, int mapNum) : uioFile(uioFile), mapNum(mapNum) {}
|
||||
|
||||
UioMapper::~UioMapper() {}
|
||||
|
||||
ReturnValue_t UioMapper::getMappedAdress(uint32_t** address, Permissions permissions) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
int fd = open(uioFile.c_str(), O_RDWR);
|
||||
if (fd < 1) {
|
||||
sif::warning << "PtmeAxiConfig::initialize: Invalid UIO device file" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
size_t size = 0;
|
||||
result = getMapSize(&size);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
*address = static_cast<uint32_t*>(
|
||||
mmap(NULL, size, static_cast<int>(permissions), MAP_SHARED, fd, mapNum * getpagesize()));
|
||||
|
||||
if (*address == MAP_FAILED) {
|
||||
sif::warning << "UioMapper::getMappedAdress: Failed to map physical address of uio device "
|
||||
<< uioFile.c_str() << " and map" << static_cast<int>(mapNum) << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t UioMapper::getMapSize(size_t* size) {
|
||||
std::stringstream namestream;
|
||||
namestream << UIO_PATH_PREFIX << uioFile.substr(5, std::string::npos) << MAP_SUBSTR << mapNum
|
||||
<< SIZE_FILE_PATH;
|
||||
FILE* fp;
|
||||
fp = fopen(namestream.str().c_str(), "r");
|
||||
if (fp == nullptr) {
|
||||
sif::warning << "UioMapper::getMapSize: Failed to open file " << namestream.str() << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
char hexstring[SIZE_HEX_STRING] = "";
|
||||
int items = fscanf(fp, "%s", hexstring);
|
||||
if (items != 1) {
|
||||
sif::warning << "UioMapper::getMapSize: Failed with error code " << errno
|
||||
<< " to read size "
|
||||
"string from file "
|
||||
<< namestream.str() << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
items = sscanf(hexstring, "%x", size);
|
||||
if (items != 1) {
|
||||
sif::warning << "UioMapper::getMapSize: Failed with error code " << errno << "to convert "
|
||||
<< "size of map" << mapNum << " to integer" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
fclose(fp);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
58
hal/src/fsfw_hal/linux/uio/UioMapper.h
Normal file
58
hal/src/fsfw_hal/linux/uio/UioMapper.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
#ifndef FSFW_HAL_SRC_FSFW_HAL_LINUX_UIO_UIOMAPPER_H_
|
||||
#define FSFW_HAL_SRC_FSFW_HAL_LINUX_UIO_UIOMAPPER_H_
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <string>
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
/**
|
||||
* @brief Class to help opening uio device files and mapping the physical addresses into the user
|
||||
* address space.
|
||||
*
|
||||
* @author J. Meier
|
||||
*/
|
||||
class UioMapper {
|
||||
public:
|
||||
|
||||
enum class Permissions: int {
|
||||
READ_ONLY = PROT_READ,
|
||||
WRITE_ONLY = PROT_WRITE,
|
||||
READ_WRITE = PROT_READ | PROT_WRITE
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*
|
||||
* @param uioFile The device file of the uiO to open
|
||||
* @param uioMap Number of memory map. Most UIO drivers have only one map which has than 0.
|
||||
*/
|
||||
UioMapper(std::string uioFile, int mapNum = 0);
|
||||
virtual ~UioMapper();
|
||||
|
||||
/**
|
||||
* @brief Maps the physical address into user address space and returns the mapped address
|
||||
*
|
||||
* @address The mapped user space address
|
||||
* @permissions Specifies the read/write permissions of the address region
|
||||
*/
|
||||
ReturnValue_t getMappedAdress(uint32_t** address, Permissions permissions);
|
||||
|
||||
private:
|
||||
|
||||
static constexpr char UIO_PATH_PREFIX[] = "/sys/class/uio/";
|
||||
static constexpr char MAP_SUBSTR[] = "/maps/map";
|
||||
static constexpr char SIZE_FILE_PATH[] = "/size";
|
||||
static constexpr int SIZE_HEX_STRING = 10;
|
||||
|
||||
std::string uioFile;
|
||||
int mapNum = 0;
|
||||
|
||||
/**
|
||||
* @brief Reads the map size from the associated sysfs size file
|
||||
*
|
||||
* @param size The read map size
|
||||
*/
|
||||
ReturnValue_t getMapSize(size_t* size);
|
||||
};
|
||||
|
||||
#endif /* FSFW_HAL_SRC_FSFW_HAL_LINUX_UIO_UIOMAPPER_H_ */
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
// FSFW core defines
|
||||
|
||||
#ifndef FSFW_TCP_RECV_WIRETAPPING_ENABLED
|
||||
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
|
||||
#endif
|
||||
|
||||
#ifndef FSFW_CPP_OSTREAM_ENABLED
|
||||
#define FSFW_CPP_OSTREAM_ENABLED 1
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED */
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
#include <cstddef>
|
||||
|
||||
/**
|
||||
* @brief Circular buffer implementation, useful for buffering
|
||||
* into data streams.
|
||||
* @brief Circular buffer implementation, useful for buffering into data streams.
|
||||
* @details
|
||||
* Note that the deleteData() has to be called to increment the read pointer.
|
||||
* This class allocated dynamically, so
|
||||
|
@ -20,8 +19,8 @@ public:
|
|||
* @param size
|
||||
* @param overwriteOld If the ring buffer is overflowing at a write
|
||||
* operation, the oldest data will be overwritten.
|
||||
* @param maxExcessBytes These additional bytes will be allocated in addtion
|
||||
* to the specified size to accomodate contiguous write operations
|
||||
* @param maxExcessBytes These additional bytes will be allocated in addition
|
||||
* to the specified size to accommodate continuous write operations
|
||||
* with getFreeElement.
|
||||
*
|
||||
*/
|
||||
|
@ -32,10 +31,10 @@ public:
|
|||
* @param buffer
|
||||
* @param size
|
||||
* @param overwriteOld
|
||||
* If the ring buffer is overflowing at a write operartion, the oldest data
|
||||
* If the ring buffer is overflowing at a write operation, the oldest data
|
||||
* will be overwritten.
|
||||
* @param maxExcessBytes
|
||||
* If the buffer can accomodate additional bytes for contigous write
|
||||
* If the buffer can accommodate additional bytes for contiguous write
|
||||
* operations with getFreeElement, this is the maximum allowed additional
|
||||
* size
|
||||
*/
|
||||
|
@ -48,7 +47,7 @@ public:
|
|||
* Write to circular buffer and increment write pointer by amount.
|
||||
* @param data
|
||||
* @param amount
|
||||
* @return -@c RETURN_OK if write operation was successfull
|
||||
* @return -@c RETURN_OK if write operation was successful
|
||||
* -@c RETURN_FAILED if
|
||||
*/
|
||||
ReturnValue_t writeData(const uint8_t* data, size_t amount);
|
||||
|
@ -108,7 +107,7 @@ public:
|
|||
* Delete data by incrementing read pointer.
|
||||
* @param amount
|
||||
* @param deleteRemaining
|
||||
* If the amount specified is larger than the remaing size to read and this
|
||||
* If the amount specified is larger than the remaining size to read and this
|
||||
* is set to true, the remaining amount will be deleted as well
|
||||
* @param trueAmount [out]
|
||||
* If deleteRemaining was set to true, the amount deleted will be assigned
|
||||
|
|
|
@ -321,3 +321,7 @@ float LocalPoolDataSetBase::getCollectionInterval() const {
|
|||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void LocalPoolDataSetBase::printSet() {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -176,6 +176,11 @@ public:
|
|||
*/
|
||||
float getCollectionInterval() const;
|
||||
|
||||
/**
|
||||
* @brief Can be overwritten by a specific implementation of a dataset to print the set.
|
||||
*/
|
||||
virtual void printSet();
|
||||
|
||||
protected:
|
||||
sid_t sid;
|
||||
//! This mutex is used if the data is created by one object only.
|
||||
|
@ -234,7 +239,6 @@ protected:
|
|||
|
||||
PeriodicHousekeepingHelper* periodicHelper = nullptr;
|
||||
LocalDataPoolManager* poolManager = nullptr;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -46,11 +46,12 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
|
|||
HasLocalDataPoolIF* hkOwner = ObjectManager::instance()->get<HasLocalDataPoolIF>(poolOwner);
|
||||
if(hkOwner == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPoolVariable: The supplied pool owner did not implement the correct "
|
||||
"interface HasLocalDataPoolIF!" << std::endl;
|
||||
sif::error << "LocalPoolVariable: The supplied pool owner 0x" << std::hex <<
|
||||
poolOwner << std::dec << " did not implement the correct interface " <<
|
||||
"HasLocalDataPoolIF" << std::endl;
|
||||
#else
|
||||
sif::printError( "LocalPoolVariable: The supplied pool owner did not implement the correct "
|
||||
"interface HasLocalDataPoolIF!\n");
|
||||
sif::printError( "LocalPoolVariable: The supplied pool owner 0x%08x did not implement the correct "
|
||||
"interface HasLocalDataPoolIF\n", poolOwner);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
/**
|
||||
* @brief Base class to implement reconfiguration and failure handling for
|
||||
* redundant devices by monitoring their modes health states.
|
||||
* redundant devices by monitoring their modes and health states.
|
||||
* @details
|
||||
* Documentation: Dissertation Baetz p.156, 157.
|
||||
*
|
||||
|
|
|
@ -85,9 +85,10 @@ public:
|
|||
* Called by DHB in the GET_WRITE doGetWrite().
|
||||
* Get send confirmation that the data in sendMessage() was sent successfully.
|
||||
* @param cookie
|
||||
* @return - @c RETURN_OK if data was sent successfull
|
||||
* - Everything else triggers falure event with
|
||||
* returnvalue as parameter 1
|
||||
* @return
|
||||
* - @c RETURN_OK if data was sent successfully but a reply is expected
|
||||
* - NO_REPLY_EXPECTED if data was sent successfully and no reply is expected
|
||||
* - Everything else to indicate failure
|
||||
*/
|
||||
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) = 0;
|
||||
|
||||
|
|
|
@ -684,6 +684,11 @@ void DeviceHandlerBase::doGetWrite() {
|
|||
void DeviceHandlerBase::doSendRead() {
|
||||
ReturnValue_t result;
|
||||
|
||||
result = doSendReadHook();
|
||||
if (result != RETURN_OK){
|
||||
return;
|
||||
}
|
||||
|
||||
size_t replyLen = 0;
|
||||
if(cookieInfo.pendingCommand != deviceCommandMap.end()) {
|
||||
replyLen = getNextReplyLength(cookieInfo.pendingCommand->first);
|
||||
|
@ -950,6 +955,10 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
|
|||
}
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::doSendReadHook() {
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t **switches,
|
||||
uint8_t *numberOfSwitches) {
|
||||
return DeviceHandlerBase::NO_SWITCH;
|
||||
|
|
|
@ -334,8 +334,7 @@ protected:
|
|||
* - @c RETURN_OK to send command after #rawPacket and #rawPacketLen
|
||||
* have been set.
|
||||
* - @c HasActionsIF::EXECUTION_COMPLETE to generate a finish reply immediately. This can
|
||||
* be used if no reply is expected. Otherwise, the developer can call #actionHelper.finish
|
||||
* to finish the command handling.
|
||||
* be used if no reply is expected
|
||||
* - Anything else triggers an event with the return code as a parameter as well as a
|
||||
* step reply failed with the return code
|
||||
*/
|
||||
|
@ -1095,6 +1094,12 @@ protected:
|
|||
*/
|
||||
void commandSwitch(ReturnValue_t onOff);
|
||||
|
||||
/**
|
||||
* @brief This function can be used to insert device specific code during the do-send-read
|
||||
* step.
|
||||
*/
|
||||
virtual ReturnValue_t doSendReadHook();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
|
|
@ -120,7 +120,8 @@ public:
|
|||
static const ReturnValue_t WRONG_MODE_FOR_COMMAND = MAKE_RETURN_CODE(0xA5);
|
||||
static const ReturnValue_t TIMEOUT = MAKE_RETURN_CODE(0xA6);
|
||||
static const ReturnValue_t BUSY = MAKE_RETURN_CODE(0xA7);
|
||||
static const ReturnValue_t NO_REPLY_EXPECTED = MAKE_RETURN_CODE(0xA8); //!< Used to indicate that this is a command-only command.
|
||||
//!< Used to indicate that this is a command-only command.
|
||||
static const ReturnValue_t NO_REPLY_EXPECTED = MAKE_RETURN_CODE(0xA8);
|
||||
static const ReturnValue_t NON_OP_TEMPERATURE = MAKE_RETURN_CODE(0xA9);
|
||||
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xAA);
|
||||
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
target_sources(${LIB_FSFW_NAME}
|
||||
PRIVATE
|
||||
Clock.cpp
|
||||
BinarySemaphore.cpp
|
||||
CountingSemaphore.cpp
|
||||
FixedTimeslotTask.cpp
|
||||
InternalErrorCodes.cpp
|
||||
MessageQueue.cpp
|
||||
Mutex.cpp
|
||||
MutexFactory.cpp
|
||||
PeriodicPosixTask.cpp
|
||||
PosixThread.cpp
|
||||
QueueFactory.cpp
|
||||
SemaphoreFactory.cpp
|
||||
TaskFactory.cpp
|
||||
tcpipHelpers.cpp
|
||||
unixUtility.cpp
|
||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||
Clock.cpp
|
||||
BinarySemaphore.cpp
|
||||
CountingSemaphore.cpp
|
||||
FixedTimeslotTask.cpp
|
||||
InternalErrorCodes.cpp
|
||||
MessageQueue.cpp
|
||||
Mutex.cpp
|
||||
MutexFactory.cpp
|
||||
PeriodicPosixTask.cpp
|
||||
PosixThread.cpp
|
||||
QueueFactory.cpp
|
||||
SemaphoreFactory.cpp
|
||||
TaskFactory.cpp
|
||||
tcpipHelpers.cpp
|
||||
unixUtility.cpp
|
||||
)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
rt
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
rt
|
||||
)
|
||||
|
||||
target_link_libraries(${LIB_FSFW_NAME} INTERFACE
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
|
||||
|
|
|
@ -108,8 +108,6 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
|
|||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
|
||||
timespec timeUnix;
|
||||
int status = clock_gettime(CLOCK_REALTIME,&timeUnix);
|
||||
|
|
|
@ -285,10 +285,10 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
|||
|
||||
utility::printUnixErrorGeneric(CLASS_NAME, "sendMessageFromMessageQueue", "EBADF");
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "mq_send to: " << sendTo << " sent from "
|
||||
<< sentFrom << "failed" << std::endl;
|
||||
sif::warning << "mq_send to " << sendTo << " sent from "
|
||||
<< sentFrom << " failed" << std::endl;
|
||||
#else
|
||||
sif::printWarning("mq_send to: %d sent from %d failed\n", sendTo, sentFrom);
|
||||
sif::printWarning("mq_send to %d sent from %d failed\n", sendTo, sentFrom);
|
||||
#endif
|
||||
return DESTINATION_INVALID;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,8 @@ protected:
|
|||
struct ChildInfo {
|
||||
MessageQueueId_t commandQueue;
|
||||
Mode_t mode;
|
||||
Submode_t submode;bool healthChanged;
|
||||
Submode_t submode;
|
||||
bool healthChanged;
|
||||
};
|
||||
|
||||
Mode_t mode;
|
||||
|
|
|
@ -99,6 +99,14 @@ public:
|
|||
*/
|
||||
static ReturnValue_t getDateAndTime(TimeOfDay_t *time);
|
||||
|
||||
/**
|
||||
* Convert to time of day struct given the POSIX timeval struct
|
||||
* @param from
|
||||
* @param to
|
||||
* @return
|
||||
*/
|
||||
static ReturnValue_t convertTimevalToTimeOfDay(const timeval *from,
|
||||
TimeOfDay_t *to);
|
||||
/**
|
||||
* Converts a time of day struct to POSIX seconds.
|
||||
* @param time The time of day as input
|
||||
|
|
|
@ -42,6 +42,20 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_) {
|
|||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t Clock::convertTimevalToTimeOfDay(const timeval* from, TimeOfDay_t* to) {
|
||||
struct tm* timeInfo;
|
||||
timeInfo = gmtime(&from->tv_sec);
|
||||
to->year = timeInfo->tm_year + 1900;
|
||||
to->month = timeInfo->tm_mon+1;
|
||||
to->day = timeInfo->tm_mday;
|
||||
to->hour = timeInfo->tm_hour;
|
||||
to->minute = timeInfo->tm_min;
|
||||
to->second = timeInfo->tm_sec;
|
||||
to->usecond = from->tv_usec;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
ReturnValue_t Clock::checkOrCreateClockMutex() {
|
||||
if (timeMutex == nullptr) {
|
||||
MutexFactory *mutexFactory = MutexFactory::instance();
|
||||
|
|
|
@ -183,13 +183,16 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
|
|||
}
|
||||
|
||||
if(tmFifo->full()) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TmTcBridge::storeDownlinkData: TM downlink max. number "
|
||||
"of stored packet IDs reached!" << std::endl;
|
||||
#else
|
||||
sif::printWarning("TmTcBridge::storeDownlinkData: TM downlink max. number "
|
||||
"of stored packet IDs reached!\n");
|
||||
#endif
|
||||
if(warningLatch) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TmTcBridge::storeDownlinkData: TM downlink max. number "
|
||||
"of stored packet IDs reached!" << std::endl;
|
||||
#else
|
||||
sif::printWarning("TmTcBridge::storeDownlinkData: TM downlink max. number "
|
||||
"of stored packet IDs reached!\n");
|
||||
#endif
|
||||
warningLatch = true;
|
||||
}
|
||||
if(overwriteOld) {
|
||||
tmFifo->retrieve(&storeId);
|
||||
tmStore->deleteData(storeId);
|
||||
|
|
|
@ -75,6 +75,7 @@ public:
|
|||
virtual uint16_t getIdentifier() override;
|
||||
virtual MessageQueueId_t getRequestQueue() override;
|
||||
|
||||
bool warningLatch = true;
|
||||
protected:
|
||||
//! Cached for initialize function.
|
||||
object_id_t tmStoreId = objects::NO_OBJECT;
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user