Compare commits
17 Commits
8f95b03e6a
...
docker_d1
Author | SHA1 | Date | |
---|---|---|---|
7208139630 | |||
54f3d7bd2d | |||
7a83289b3d | |||
136524424f | |||
793b97f651 | |||
2e4cd80556 | |||
9e6948a8d7 | |||
9b17b282c6 | |||
5f48d77c64 | |||
8ab8c57f9c | |||
f93c173715 | |||
620841a9e5 | |||
bd29688307 | |||
43b7a314b6 | |||
![]() |
06ffe27fcc | ||
![]() |
e9b0951a95 | ||
2a268e14d1 |
@@ -1,8 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
set(FSFW_VERSION 2)
|
set(FSFW_VERSION 3)
|
||||||
set(FSFW_SUBVERSION 0)
|
set(FSFW_SUBVERSION 0)
|
||||||
set(FSFW_REVISION 0)
|
set(FSFW_REVISION 1)
|
||||||
|
|
||||||
# Add the cmake folder so the FindSphinx module is found
|
# Add the cmake folder so the FindSphinx module is found
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||||
@@ -60,6 +60,8 @@ if(FSFW_BUILD_UNITTESTS)
|
|||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(Catch2)
|
FetchContent_MakeAvailable(Catch2)
|
||||||
|
#fixes regression -preview4, to be confirmed in later releases
|
||||||
|
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg)
|
set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg)
|
||||||
|
@@ -6,9 +6,3 @@ RUN apt-get --yes upgrade
|
|||||||
#tzdata is a dependency, won't install otherwise
|
#tzdata is a dependency, won't install otherwise
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping
|
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping
|
||||||
|
|
||||||
RUN git clone https://github.com/catchorg/Catch2.git && \
|
|
||||||
cd Catch2 && \
|
|
||||||
git checkout v3.0.0-preview4 && \
|
|
||||||
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
|
|
||||||
cmake --build build/ --target install
|
|
||||||
|
8
automation/Jenkinsfile
vendored
8
automation/Jenkinsfile
vendored
@@ -3,13 +3,7 @@ pipeline {
|
|||||||
BUILDDIR = 'build-tests'
|
BUILDDIR = 'build-tests'
|
||||||
}
|
}
|
||||||
agent {
|
agent {
|
||||||
dockerfile {
|
docker { image 'fsfw-ci:d1'}
|
||||||
dir 'automation'
|
|
||||||
//force docker to redownload base image and rebuild all steps instead of caching them
|
|
||||||
//this way, we always get an up to date docker image one each build
|
|
||||||
additionalBuildArgs '--no-cache --pull'
|
|
||||||
reuseNode true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Clean') {
|
stage('Clean') {
|
||||||
|
@@ -11,7 +11,7 @@ namespace gpio {
|
|||||||
|
|
||||||
enum Levels : uint8_t { LOW = 0, HIGH = 1, NONE = 99 };
|
enum Levels : uint8_t { LOW = 0, HIGH = 1, NONE = 99 };
|
||||||
|
|
||||||
enum Direction : uint8_t { DIR_IN = 0, DIR_OUT = 1 };
|
enum Direction : uint8_t { IN = 0, OUT = 1 };
|
||||||
|
|
||||||
enum GpioOperation { READ, WRITE };
|
enum GpioOperation { READ, WRITE };
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ enum class GpioTypes {
|
|||||||
GPIO_REGULAR_BY_CHIP,
|
GPIO_REGULAR_BY_CHIP,
|
||||||
GPIO_REGULAR_BY_LABEL,
|
GPIO_REGULAR_BY_LABEL,
|
||||||
GPIO_REGULAR_BY_LINE_NAME,
|
GPIO_REGULAR_BY_LINE_NAME,
|
||||||
TYPE_CALLBACK
|
CALLBACK
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr gpioId_t NO_GPIO = -1;
|
static constexpr gpioId_t NO_GPIO = -1;
|
||||||
@@ -57,7 +57,7 @@ class GpioBase {
|
|||||||
// Can be used to cast GpioBase to a concrete child implementation
|
// Can be used to cast GpioBase to a concrete child implementation
|
||||||
gpio::GpioTypes gpioType = gpio::GpioTypes::NONE;
|
gpio::GpioTypes gpioType = gpio::GpioTypes::NONE;
|
||||||
std::string consumer;
|
std::string consumer;
|
||||||
gpio::Direction direction = gpio::Direction::DIR_IN;
|
gpio::Direction direction = gpio::Direction::IN;
|
||||||
gpio::Levels initValue = gpio::Levels::NONE;
|
gpio::Levels initValue = gpio::Levels::NONE;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -79,8 +79,8 @@ class GpiodRegularBase : public GpioBase {
|
|||||||
class GpiodRegularByChip : public GpiodRegularBase {
|
class GpiodRegularByChip : public GpiodRegularBase {
|
||||||
public:
|
public:
|
||||||
GpiodRegularByChip()
|
GpiodRegularByChip()
|
||||||
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, std::string(),
|
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, std::string(), gpio::Direction::IN,
|
||||||
gpio::Direction::DIR_IN, gpio::LOW, 0) {}
|
gpio::LOW, 0) {}
|
||||||
|
|
||||||
GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_,
|
GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_,
|
||||||
gpio::Direction direction_, gpio::Levels initValue_)
|
gpio::Direction direction_, gpio::Levels initValue_)
|
||||||
@@ -89,7 +89,7 @@ class GpiodRegularByChip : public GpiodRegularBase {
|
|||||||
chipname(chipname_) {}
|
chipname(chipname_) {}
|
||||||
|
|
||||||
GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_)
|
GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_)
|
||||||
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, consumer_, gpio::Direction::DIR_IN,
|
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, consumer_, gpio::Direction::IN,
|
||||||
gpio::LOW, lineNum_),
|
gpio::LOW, lineNum_),
|
||||||
chipname(chipname_) {}
|
chipname(chipname_) {}
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ class GpiodRegularByLabel : public GpiodRegularBase {
|
|||||||
label(label_) {}
|
label(label_) {}
|
||||||
|
|
||||||
GpiodRegularByLabel(std::string label_, int lineNum_, std::string consumer_)
|
GpiodRegularByLabel(std::string label_, int lineNum_, std::string consumer_)
|
||||||
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL, consumer_, gpio::Direction::DIR_IN,
|
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL, consumer_, gpio::Direction::IN,
|
||||||
gpio::LOW, lineNum_),
|
gpio::LOW, lineNum_),
|
||||||
label(label_) {}
|
label(label_) {}
|
||||||
|
|
||||||
@@ -126,8 +126,8 @@ class GpiodRegularByLineName : public GpiodRegularBase {
|
|||||||
lineName(lineName_) {}
|
lineName(lineName_) {}
|
||||||
|
|
||||||
GpiodRegularByLineName(std::string lineName_, std::string consumer_)
|
GpiodRegularByLineName(std::string lineName_, std::string consumer_)
|
||||||
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME, consumer_,
|
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME, consumer_, gpio::Direction::IN,
|
||||||
gpio::Direction::DIR_IN, gpio::LOW),
|
gpio::LOW),
|
||||||
lineName(lineName_) {}
|
lineName(lineName_) {}
|
||||||
|
|
||||||
std::string lineName;
|
std::string lineName;
|
||||||
@@ -137,7 +137,7 @@ class GpioCallback : public GpioBase {
|
|||||||
public:
|
public:
|
||||||
GpioCallback(std::string consumer, gpio::Direction direction_, gpio::Levels initValue_,
|
GpioCallback(std::string consumer, gpio::Direction direction_, gpio::Levels initValue_,
|
||||||
gpio::gpio_cb_t callback, void* callbackArgs)
|
gpio::gpio_cb_t callback, void* callbackArgs)
|
||||||
: GpioBase(gpio::GpioTypes::TYPE_CALLBACK, consumer, direction_, initValue_),
|
: GpioBase(gpio::GpioTypes::CALLBACK, consumer, direction_, initValue_),
|
||||||
callback(callback),
|
callback(callback),
|
||||||
callbackArgs(callbackArgs) {}
|
callbackArgs(callbackArgs) {}
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceC
|
|||||||
transitionDelayMs(transitionDelayMs),
|
transitionDelayMs(transitionDelayMs),
|
||||||
dataset(this) {
|
dataset(this) {
|
||||||
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
|
||||||
debugDivider = new PeriodicOperationDivider(10);
|
debugDivider = new PeriodicOperationDivider(3);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCom
|
|||||||
dataset(this),
|
dataset(this),
|
||||||
transitionDelay(transitionDelay) {
|
transitionDelay(transitionDelay) {
|
||||||
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
|
||||||
debugDivider = new PeriodicOperationDivider(10);
|
debugDivider = new PeriodicOperationDivider(3);
|
||||||
#endif
|
#endif
|
||||||
// Set to default values right away
|
// Set to default values right away
|
||||||
registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT;
|
registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT;
|
||||||
@@ -264,7 +264,7 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
int16_t mgmMeasurementRawZ =
|
int16_t mgmMeasurementRawZ =
|
||||||
packet[MGMLIS3MDL::Z_HIGHBYTE_IDX] << 8 | packet[MGMLIS3MDL::Z_LOWBYTE_IDX];
|
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 *
|
float mgmX = static_cast<float>(mgmMeasurementRawX) * sensitivityFactor *
|
||||||
MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
|
MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
|
||||||
float mgmY = static_cast<float>(mgmMeasurementRawY) * sensitivityFactor *
|
float mgmY = static_cast<float>(mgmMeasurementRawY) * sensitivityFactor *
|
||||||
@@ -462,9 +462,7 @@ ReturnValue_t MgmLIS3MDLHandler::prepareCtrlRegisterWrite() {
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MgmLIS3MDLHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
void MgmLIS3MDLHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {}
|
||||||
DeviceHandlerBase::doTransition(modeFrom, subModeFrom);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t MgmLIS3MDLHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { return transitionDelay; }
|
uint32_t MgmLIS3MDLHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { return transitionDelay; }
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ MgmRM3100Handler::MgmRM3100Handler(object_id_t objectId, object_id_t deviceCommu
|
|||||||
primaryDataset(this),
|
primaryDataset(this),
|
||||||
transitionDelay(transitionDelay) {
|
transitionDelay(transitionDelay) {
|
||||||
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
|
||||||
debugDivider = new PeriodicOperationDivider(10);
|
debugDivider = new PeriodicOperationDivider(3);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,5 +14,3 @@ if(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS)
|
|||||||
add_subdirectory(i2c)
|
add_subdirectory(i2c)
|
||||||
add_subdirectory(uart)
|
add_subdirectory(uart)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(uio)
|
|
||||||
|
@@ -74,7 +74,7 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) {
|
|||||||
configureGpioByLineName(gpioConfig.first, *regularGpio);
|
configureGpioByLineName(gpioConfig.first, *regularGpio);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (gpio::GpioTypes::TYPE_CALLBACK): {
|
case (gpio::GpioTypes::CALLBACK): {
|
||||||
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioConfig.second);
|
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioConfig.second);
|
||||||
if (gpioCallback->callback == nullptr) {
|
if (gpioCallback->callback == nullptr) {
|
||||||
return GPIO_INVALID_INSTANCE;
|
return GPIO_INVALID_INSTANCE;
|
||||||
@@ -161,11 +161,11 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, struct gpiod
|
|||||||
consumer = regularGpio.consumer;
|
consumer = regularGpio.consumer;
|
||||||
/* Configure direction and add a description to the GPIO */
|
/* Configure direction and add a description to the GPIO */
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case (gpio::DIR_OUT): {
|
case (gpio::OUT): {
|
||||||
result = gpiod_line_request_output(lineHandle, consumer.c_str(), regularGpio.initValue);
|
result = gpiod_line_request_output(lineHandle, consumer.c_str(), regularGpio.initValue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (gpio::DIR_IN): {
|
case (gpio::IN): {
|
||||||
result = gpiod_line_request_input(lineHandle, consumer.c_str());
|
result = gpiod_line_request_input(lineHandle, consumer.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -326,7 +326,7 @@ ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (gpio::GpioTypes::TYPE_CALLBACK): {
|
case (gpio::GpioTypes::CALLBACK): {
|
||||||
auto callbackGpio = dynamic_cast<GpioCallback*>(gpioConfig.second);
|
auto callbackGpio = dynamic_cast<GpioCallback*>(gpioConfig.second);
|
||||||
if (callbackGpio == nullptr) {
|
if (callbackGpio == nullptr) {
|
||||||
return GPIO_TYPE_FAILURE;
|
return GPIO_TYPE_FAILURE;
|
||||||
@@ -366,13 +366,13 @@ ReturnValue_t LinuxLibgpioIF::checkForConflictsById(gpioId_t gpioIdToCheck,
|
|||||||
case (gpio::GpioTypes::GPIO_REGULAR_BY_CHIP):
|
case (gpio::GpioTypes::GPIO_REGULAR_BY_CHIP):
|
||||||
case (gpio::GpioTypes::GPIO_REGULAR_BY_LABEL):
|
case (gpio::GpioTypes::GPIO_REGULAR_BY_LABEL):
|
||||||
case (gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME): {
|
case (gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME): {
|
||||||
if (gpioType == gpio::GpioTypes::NONE or gpioType == gpio::GpioTypes::TYPE_CALLBACK) {
|
if (gpioType == gpio::GpioTypes::NONE or gpioType == gpio::GpioTypes::CALLBACK) {
|
||||||
eraseDuplicateDifferentType = true;
|
eraseDuplicateDifferentType = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (gpio::GpioTypes::TYPE_CALLBACK): {
|
case (gpio::GpioTypes::CALLBACK): {
|
||||||
if (gpioType != gpio::GpioTypes::TYPE_CALLBACK) {
|
if (gpioType != gpio::GpioTypes::CALLBACK) {
|
||||||
eraseDuplicateDifferentType = true;
|
eraseDuplicateDifferentType = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,4 @@
|
|||||||
#include "I2cComIF.h"
|
#include "fsfw_hal/linux/i2c/I2cComIF.h"
|
||||||
#include "fsfw/FSFW.h"
|
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "fsfw_hal/linux/UnixFileGuard.h"
|
|
||||||
#include "fsfw_hal/linux/utility.h"
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -12,6 +8,10 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "fsfw/FSFW.h"
|
||||||
|
#include "fsfw/serviceinterface.h"
|
||||||
|
#include "fsfw_hal/linux/UnixFileGuard.h"
|
||||||
|
#include "fsfw_hal/linux/utility.h"
|
||||||
|
|
||||||
I2cComIF::I2cComIF(object_id_t objectId) : SystemObject(objectId) {}
|
I2cComIF::I2cComIF(object_id_t objectId) : SystemObject(objectId) {}
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
|
ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
|
||||||
std::string consumer, gpio::Direction direction,
|
std::string consumer, gpio::Direction direction,
|
||||||
gpio::Levels initValue) {
|
int initValue) {
|
||||||
if (cookie == nullptr) {
|
if (cookie == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
@@ -21,8 +21,7 @@ namespace gpio {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
|
ReturnValue_t createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin,
|
||||||
std::string consumer, gpio::Direction direction,
|
std::string consumer, gpio::Direction direction, int initValue);
|
||||||
gpio::Levels initValue);
|
|
||||||
} // namespace gpio
|
} // namespace gpio
|
||||||
|
|
||||||
#endif /* BSP_RPI_GPIO_GPIORPI_H_ */
|
#endif /* BSP_RPI_GPIO_GPIORPI_H_ */
|
||||||
|
@@ -1,7 +1,4 @@
|
|||||||
#include "UartComIF.h"
|
#include "UartComIF.h"
|
||||||
#include "fsfw/FSFW.h"
|
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "fsfw_hal/linux/utility.h"
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -10,6 +7,10 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "fsfw/FSFW.h"
|
||||||
|
#include "fsfw/serviceinterface.h"
|
||||||
|
#include "fsfw_hal/linux/utility.h"
|
||||||
|
|
||||||
UartComIF::UartComIF(object_id_t objectId) : SystemObject(objectId) {}
|
UartComIF::UartComIF(object_id_t objectId) : SystemObject(objectId) {}
|
||||||
|
|
||||||
UartComIF::~UartComIF() {}
|
UartComIF::~UartComIF() {}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#include "UartCookie.h"
|
#include "fsfw_hal/linux/uart/UartCookie.h"
|
||||||
|
|
||||||
#include <fsfw/serviceinterface.h>
|
#include <fsfw/serviceinterface.h>
|
||||||
|
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PUBLIC
|
|
||||||
UioMapper.cpp
|
|
||||||
)
|
|
@@ -1,84 +0,0 @@
|
|||||||
#include "UioMapper.h"
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <fstream>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
|
|
||||||
const char UioMapper::UIO_PATH_PREFIX[] = "/sys/class/uio/";
|
|
||||||
const char UioMapper::MAP_SUBSTR[] = "/maps/map";
|
|
||||||
const char UioMapper::SIZE_FILE_PATH[] = "/size";
|
|
||||||
|
|
||||||
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) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::warning << "PtmeAxiConfig::initialize: Invalid UIO device file" << std::endl;
|
|
||||||
#endif
|
|
||||||
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) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::warning << "UioMapper::getMappedAdress: Failed to map physical address of uio device "
|
|
||||||
<< uioFile.c_str() << " and map" << static_cast<int>(mapNum) << std::endl;
|
|
||||||
#endif
|
|
||||||
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) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::warning << "UioMapper::getMapSize: Failed to open file " << namestream.str() << std::endl;
|
|
||||||
#endif
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
|
||||||
char hexstring[SIZE_HEX_STRING] = "";
|
|
||||||
int items = fscanf(fp, "%s", hexstring);
|
|
||||||
if (items != 1) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::warning << "UioMapper::getMapSize: Failed with error code " << errno
|
|
||||||
<< " to read size "
|
|
||||||
"string from file "
|
|
||||||
<< namestream.str() << std::endl;
|
|
||||||
#endif
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
|
||||||
uint32_t sizeTmp = 0;
|
|
||||||
items = sscanf(hexstring, "%x", &sizeTmp);
|
|
||||||
if(size != nullptr) {
|
|
||||||
*size = sizeTmp;
|
|
||||||
}
|
|
||||||
if (items != 1) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
||||||
sif::warning << "UioMapper::getMapSize: Failed with error code " << errno << "to convert "
|
|
||||||
<< "size of map" << mapNum << " to integer" << std::endl;
|
|
||||||
#endif
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
|
@@ -1,58 +0,0 @@
|
|||||||
#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 const char UIO_PATH_PREFIX[];
|
|
||||||
static const char MAP_SUBSTR[];
|
|
||||||
static const char SIZE_FILE_PATH[];
|
|
||||||
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_ */
|
|
@@ -30,7 +30,7 @@ class DataLinkLayer : public CCSDSReturnValuesIF {
|
|||||||
//! [EXPORT] : [COMMENT] A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0
|
//! [EXPORT] : [COMMENT] A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0
|
||||||
static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO);
|
static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO);
|
||||||
// static const Event RF_CHAIN_LOST = MAKE_EVENT(4, severity::INFO); //!< The CCSDS Board
|
// static const Event RF_CHAIN_LOST = MAKE_EVENT(4, severity::INFO); //!< The CCSDS Board
|
||||||
// detected that either bit lock or RF available or both are lost. No parameters.
|
//detected that either bit lock or RF available or both are lost. No parameters.
|
||||||
//! [EXPORT] : [COMMENT] The CCSDS Board could not interpret a TC
|
//! [EXPORT] : [COMMENT] The CCSDS Board could not interpret a TC
|
||||||
static const Event FRAME_PROCESSING_FAILED = MAKE_EVENT(5, severity::LOW);
|
static const Event FRAME_PROCESSING_FAILED = MAKE_EVENT(5, severity::LOW);
|
||||||
/**
|
/**
|
||||||
|
@@ -30,9 +30,9 @@ ReturnValue_t VirtualChannelReception::mapDemultiplexing(TcTransferFrame* frame)
|
|||||||
mapChannelIterator iter = mapChannels.find(mapId);
|
mapChannelIterator iter = mapChannels.find(mapId);
|
||||||
if (iter == mapChannels.end()) {
|
if (iter == mapChannels.end()) {
|
||||||
// error << "VirtualChannelReception::mapDemultiplexing on VC " << std::hex << (int)
|
// error << "VirtualChannelReception::mapDemultiplexing on VC " << std::hex << (int)
|
||||||
// channelId
|
//channelId
|
||||||
// << ": MapChannel " << (int) mapId << std::dec << " not found." <<
|
// << ": MapChannel " << (int) mapId << std::dec << " not found." <<
|
||||||
// std::endl;
|
//std::endl;
|
||||||
return VC_NOT_FOUND;
|
return VC_NOT_FOUND;
|
||||||
} else {
|
} else {
|
||||||
return (iter->second)->extractPackets(frame);
|
return (iter->second)->extractPackets(frame);
|
||||||
|
@@ -47,14 +47,13 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
|
|||||||
HasLocalDataPoolIF* hkOwner = ObjectManager::instance()->get<HasLocalDataPoolIF>(poolOwner);
|
HasLocalDataPoolIF* hkOwner = ObjectManager::instance()->get<HasLocalDataPoolIF>(poolOwner);
|
||||||
if (hkOwner == nullptr) {
|
if (hkOwner == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "LocalPoolVariable: The supplied pool owner 0x" << std::hex << poolOwner
|
sif::error << "LocalPoolVariable: The supplied pool owner did not implement the correct "
|
||||||
<< std::dec << " did not implement the correct interface "
|
"interface HasLocalDataPoolIF!"
|
||||||
<< "HasLocalDataPoolIF" << std::endl;
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printError(
|
sif::printError(
|
||||||
"LocalPoolVariable: The supplied pool owner 0x%08x did not implement the correct "
|
"LocalPoolVariable: The supplied pool owner did not implement the correct "
|
||||||
"interface HasLocalDataPoolIF\n",
|
"interface HasLocalDataPoolIF!\n");
|
||||||
poolOwner);
|
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,6 @@ ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event)
|
|||||||
switch (event->getEvent()) {
|
switch (event->getEvent()) {
|
||||||
case HasModesIF::MODE_TRANSITION_FAILED:
|
case HasModesIF::MODE_TRANSITION_FAILED:
|
||||||
case HasModesIF::OBJECT_IN_INVALID_MODE:
|
case HasModesIF::OBJECT_IN_INVALID_MODE:
|
||||||
case DeviceHandlerIF::DEVICE_WANTS_HARD_REBOOT:
|
|
||||||
// We'll try a recovery as long as defined in MAX_REBOOT.
|
// We'll try a recovery as long as defined in MAX_REBOOT.
|
||||||
// Might cause some AssemblyBase cycles, so keep number low.
|
// Might cause some AssemblyBase cycles, so keep number low.
|
||||||
handleRecovery(event->getEvent());
|
handleRecovery(event->getEvent());
|
||||||
|
@@ -109,7 +109,6 @@ class DeviceHandlerIF {
|
|||||||
static const Event INVALID_DEVICE_COMMAND = MAKE_EVENT(8, severity::LOW);
|
static const Event INVALID_DEVICE_COMMAND = MAKE_EVENT(8, severity::LOW);
|
||||||
static const Event MONITORING_LIMIT_EXCEEDED = MAKE_EVENT(9, severity::LOW);
|
static const Event MONITORING_LIMIT_EXCEEDED = MAKE_EVENT(9, severity::LOW);
|
||||||
static const Event MONITORING_AMBIGUOUS = MAKE_EVENT(10, severity::HIGH);
|
static const Event MONITORING_AMBIGUOUS = MAKE_EVENT(10, severity::HIGH);
|
||||||
static const Event DEVICE_WANTS_HARD_REBOOT = MAKE_EVENT(11, severity::HIGH);
|
|
||||||
|
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_HANDLER_IF;
|
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_HANDLER_IF;
|
||||||
|
|
||||||
|
@@ -116,8 +116,8 @@ uint16_t CRC::crc16ccitt(uint8_t const input[], uint32_t length, uint16_t starti
|
|||||||
// for (int i=0; i<16 ;i++)
|
// for (int i=0; i<16 ;i++)
|
||||||
// {
|
// {
|
||||||
// if (xor_out[i] == true)
|
// if (xor_out[i] == true)
|
||||||
// crc_value = crc_value + pow(2,(15 -i)); // reverse CrC result before
|
// crc_value = crc_value + pow(2,(15 -i)); // reverse CrC result before Final
|
||||||
//Final XOR
|
//XOR
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// crc_value = 0;// for debug mode
|
// crc_value = 0;// for debug mode
|
||||||
|
@@ -14,30 +14,30 @@ class ModeMessage {
|
|||||||
static const uint8_t MESSAGE_ID = messagetypes::MODE_COMMAND;
|
static const uint8_t MESSAGE_ID = messagetypes::MODE_COMMAND;
|
||||||
static const Command_t CMD_MODE_COMMAND =
|
static const Command_t CMD_MODE_COMMAND =
|
||||||
MAKE_COMMAND_ID(0x01); //!> Command to set the specified Mode, replies are: REPLY_MODE_REPLY,
|
MAKE_COMMAND_ID(0x01); //!> Command to set the specified Mode, replies are: REPLY_MODE_REPLY,
|
||||||
//! REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies,
|
//!REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any replies,
|
||||||
//! as this will break the subsystem mode machine!!
|
//!as this will break the subsystem mode machine!!
|
||||||
static const Command_t CMD_MODE_COMMAND_FORCED = MAKE_COMMAND_ID(
|
static const Command_t CMD_MODE_COMMAND_FORCED = MAKE_COMMAND_ID(
|
||||||
0xF1); //!> Command to set the specified Mode, regardless of external control flag, replies
|
0xF1); //!> Command to set the specified Mode, regardless of external control flag, replies
|
||||||
//! are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any
|
//!are: REPLY_MODE_REPLY, REPLY_WRONG_MODE_REPLY, and REPLY_REJECTED; don't add any
|
||||||
//! replies, as this will break the subsystem mode machine!!
|
//!replies, as this will break the subsystem mode machine!!
|
||||||
static const Command_t REPLY_MODE_REPLY =
|
static const Command_t REPLY_MODE_REPLY =
|
||||||
MAKE_COMMAND_ID(0x02); //!> Reply to a CMD_MODE_COMMAND or CMD_MODE_READ
|
MAKE_COMMAND_ID(0x02); //!> Reply to a CMD_MODE_COMMAND or CMD_MODE_READ
|
||||||
static const Command_t REPLY_MODE_INFO =
|
static const Command_t REPLY_MODE_INFO =
|
||||||
MAKE_COMMAND_ID(0x03); //!> Unrequested info about the current mode (used for composites to
|
MAKE_COMMAND_ID(0x03); //!> Unrequested info about the current mode (used for composites to
|
||||||
//! inform their container of a changed mode)
|
//!inform their container of a changed mode)
|
||||||
static const Command_t REPLY_CANT_REACH_MODE = MAKE_COMMAND_ID(
|
static const Command_t REPLY_CANT_REACH_MODE = MAKE_COMMAND_ID(
|
||||||
0x04); //!> Reply in case a mode command can't be executed. Par1: returnCode, Par2: 0
|
0x04); //!> Reply in case a mode command can't be executed. Par1: returnCode, Par2: 0
|
||||||
static const Command_t REPLY_WRONG_MODE_REPLY =
|
static const Command_t REPLY_WRONG_MODE_REPLY =
|
||||||
MAKE_COMMAND_ID(0x05); //!> Reply to a CMD_MODE_COMMAND, indicating that a mode was commanded
|
MAKE_COMMAND_ID(0x05); //!> Reply to a CMD_MODE_COMMAND, indicating that a mode was commanded
|
||||||
//! and a transition started but was aborted; the parameters contain
|
//!and a transition started but was aborted; the parameters contain
|
||||||
//! the mode that was reached
|
//!the mode that was reached
|
||||||
static const Command_t CMD_MODE_READ = MAKE_COMMAND_ID(
|
static const Command_t CMD_MODE_READ = MAKE_COMMAND_ID(
|
||||||
0x06); //!> Command to read the current mode and reply with a REPLY_MODE_REPLY
|
0x06); //!> Command to read the current mode and reply with a REPLY_MODE_REPLY
|
||||||
static const Command_t CMD_MODE_ANNOUNCE = MAKE_COMMAND_ID(
|
static const Command_t CMD_MODE_ANNOUNCE = MAKE_COMMAND_ID(
|
||||||
0x07); //!> Command to trigger an ModeInfo Event. This command does NOT have a reply.
|
0x07); //!> Command to trigger an ModeInfo Event. This command does NOT have a reply.
|
||||||
static const Command_t CMD_MODE_ANNOUNCE_RECURSIVELY =
|
static const Command_t CMD_MODE_ANNOUNCE_RECURSIVELY =
|
||||||
MAKE_COMMAND_ID(0x08); //!> Command to trigger an ModeInfo Event and to send this command to
|
MAKE_COMMAND_ID(0x08); //!> Command to trigger an ModeInfo Event and to send this command to
|
||||||
//! every child. This command does NOT have a reply.
|
//!every child. This command does NOT have a reply.
|
||||||
|
|
||||||
static Mode_t getMode(const CommandMessage* message);
|
static Mode_t getMode(const CommandMessage* message);
|
||||||
static Submode_t getSubmode(const CommandMessage* message);
|
static Submode_t getSubmode(const CommandMessage* message);
|
||||||
|
@@ -1,29 +1,29 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||||
Clock.cpp
|
Clock.cpp
|
||||||
BinarySemaphore.cpp
|
BinarySemaphore.cpp
|
||||||
CountingSemaphore.cpp
|
CountingSemaphore.cpp
|
||||||
FixedTimeslotTask.cpp
|
FixedTimeslotTask.cpp
|
||||||
InternalErrorCodes.cpp
|
InternalErrorCodes.cpp
|
||||||
MessageQueue.cpp
|
MessageQueue.cpp
|
||||||
Mutex.cpp
|
Mutex.cpp
|
||||||
MutexFactory.cpp
|
MutexFactory.cpp
|
||||||
PeriodicPosixTask.cpp
|
PeriodicPosixTask.cpp
|
||||||
PosixThread.cpp
|
PosixThread.cpp
|
||||||
QueueFactory.cpp
|
QueueFactory.cpp
|
||||||
SemaphoreFactory.cpp
|
SemaphoreFactory.cpp
|
||||||
TaskFactory.cpp
|
TaskFactory.cpp
|
||||||
tcpipHelpers.cpp
|
tcpipHelpers.cpp
|
||||||
unixUtility.cpp
|
unixUtility.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
rt
|
rt
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${LIB_FSFW_NAME} INTERFACE
|
target_link_libraries(${LIB_FSFW_NAME} INTERFACE
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
${CMAKE_THREAD_LIBS_INIT}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -65,8 +65,8 @@ class PeriodicPosixTask : public PosixThread, public PeriodicTaskIF {
|
|||||||
/**
|
/**
|
||||||
* @brief The function containing the actual functionality of the task.
|
* @brief The function containing the actual functionality of the task.
|
||||||
* @details The method sets and starts
|
* @details The method sets and starts
|
||||||
* the task's period, then enters a loop that is repeated indefinitely. Within the
|
* the task's period, then enters a loop that is repeated indefinitely. Within the loop,
|
||||||
* loop, all performOperation methods of the added objects are called. Afterwards the task will be
|
* all performOperation methods of the added objects are called. Afterwards the task will be
|
||||||
* blocked until the next period. On missing the deadline, the deadlineMissedFunction is executed.
|
* blocked until the next period. On missing the deadline, the deadlineMissedFunction is executed.
|
||||||
*/
|
*/
|
||||||
virtual void taskFunctionality(void);
|
virtual void taskFunctionality(void);
|
||||||
|
@@ -13,8 +13,8 @@ class ExecutableObjectIF;
|
|||||||
* @brief This class represents a specialized task for periodic activities of multiple objects.
|
* @brief This class represents a specialized task for periodic activities of multiple objects.
|
||||||
*
|
*
|
||||||
* @details MultiObjectTask is an extension to ObjectTask in the way that it is able to execute
|
* @details MultiObjectTask is an extension to ObjectTask in the way that it is able to execute
|
||||||
* multiple objects that implement the ExecutableObjectIF interface. The objects
|
* multiple objects that implement the ExecutableObjectIF interface. The objects must
|
||||||
* must be added prior to starting the task.
|
* be added prior to starting the task.
|
||||||
* @author baetz
|
* @author baetz
|
||||||
* @ingroup task_handling
|
* @ingroup task_handling
|
||||||
*/
|
*/
|
||||||
|
@@ -25,8 +25,8 @@ class RTEMSTaskBase {
|
|||||||
* all other attributes are set with default values.
|
* all other attributes are set with default values.
|
||||||
* @param priority Sets the priority of a task. Values range from a low 0 to a high 99.
|
* @param priority Sets the priority of a task. Values range from a low 0 to a high 99.
|
||||||
* @param stack_size The stack size reserved by the operating system for the task.
|
* @param stack_size The stack size reserved by the operating system for the task.
|
||||||
* @param nam The name of the Task, as a null-terminated String. Currently max 4
|
* @param nam The name of the Task, as a null-terminated String. Currently max 4 chars
|
||||||
* chars supported (excluding Null-terminator), rest will be truncated
|
* supported (excluding Null-terminator), rest will be truncated
|
||||||
*/
|
*/
|
||||||
RTEMSTaskBase(rtems_task_priority priority, size_t stack_size, const char *name);
|
RTEMSTaskBase(rtems_task_priority priority, size_t stack_size, const char *name);
|
||||||
/**
|
/**
|
||||||
|
@@ -51,9 +51,9 @@ class RMAP : public HasReturnvaluesIF {
|
|||||||
// MAKE_RETURN_CODE(0xE4); //the data that was to be sent was too long for the hw to handle (write
|
// MAKE_RETURN_CODE(0xE4); //the data that was to be sent was too long for the hw to handle (write
|
||||||
// command) or the expected len was bigger than maximal expected len (read command) command was
|
// command) or the expected len was bigger than maximal expected len (read command) command was
|
||||||
// not sent
|
// not sent
|
||||||
// replaced by DeviceCommunicationIF::NULLPOINTER static const ReturnValue_t
|
// replaced by DeviceCommunicationIF::NULLPOINTER static const ReturnValue_t COMMAND_NULLPOINTER
|
||||||
// COMMAND_NULLPOINTER = MAKE_RETURN_CODE(0xE5); //datalen was != 0 but data was == NULL in write
|
// = MAKE_RETURN_CODE(0xE5); //datalen was != 0 but data was == NULL in write command, or
|
||||||
// command, or nullpointer in read command
|
// nullpointer in read command
|
||||||
static const ReturnValue_t COMMAND_CHANNEL_DEACTIVATED =
|
static const ReturnValue_t COMMAND_CHANNEL_DEACTIVATED =
|
||||||
MAKE_RETURN_CODE(0xE6); // the channel has no port set
|
MAKE_RETURN_CODE(0xE6); // the channel has no port set
|
||||||
static const ReturnValue_t COMMAND_PORT_OUT_OF_RANGE =
|
static const ReturnValue_t COMMAND_PORT_OUT_OF_RANGE =
|
||||||
@@ -73,8 +73,8 @@ class RMAP : public HasReturnvaluesIF {
|
|||||||
static const ReturnValue_t REPLY_MISSMATCH = MAKE_RETURN_CODE(
|
static const ReturnValue_t REPLY_MISSMATCH = MAKE_RETURN_CODE(
|
||||||
0xD3); // a read command was issued, but get_write_rply called, or other way round
|
0xD3); // a read command was issued, but get_write_rply called, or other way round
|
||||||
static const ReturnValue_t REPLY_TIMEOUT = MAKE_RETURN_CODE(0xD4); // timeout
|
static const ReturnValue_t REPLY_TIMEOUT = MAKE_RETURN_CODE(0xD4); // timeout
|
||||||
// replaced by DeviceCommunicationIF::NULLPOINTER static const ReturnValue_t REPLY_NULLPOINTER
|
// replaced by DeviceCommunicationIF::NULLPOINTER static const ReturnValue_t REPLY_NULLPOINTER =
|
||||||
// = MAKE_RETURN_CODE(0xD5);//one of the arguments in a read reply was NULL return values for
|
// MAKE_RETURN_CODE(0xD5);//one of the arguments in a read reply was NULL return values for
|
||||||
// get_reply
|
// get_reply
|
||||||
static const ReturnValue_t REPLY_INTERFACE_BUSY =
|
static const ReturnValue_t REPLY_INTERFACE_BUSY =
|
||||||
MAKE_RETURN_CODE(0xC0); // Interface is busy (transmission buffer still being processed)
|
MAKE_RETURN_CODE(0xC0); // Interface is busy (transmission buffer still being processed)
|
||||||
@@ -169,8 +169,8 @@ class RMAP : public HasReturnvaluesIF {
|
|||||||
* @param buffer the data to write
|
* @param buffer the data to write
|
||||||
* @param length length of data
|
* @param length length of data
|
||||||
* @return
|
* @return
|
||||||
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in
|
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in write
|
||||||
* write command
|
* command
|
||||||
* - return codes of RMAPChannelIF::sendCommand()
|
* - return codes of RMAPChannelIF::sendCommand()
|
||||||
*/
|
*/
|
||||||
static ReturnValue_t sendWriteCommand(RMAPCookie *cookie, const uint8_t *buffer, size_t length);
|
static ReturnValue_t sendWriteCommand(RMAPCookie *cookie, const uint8_t *buffer, size_t length);
|
||||||
@@ -205,8 +205,8 @@ class RMAP : public HasReturnvaluesIF {
|
|||||||
* @param cookie to cookie to read from
|
* @param cookie to cookie to read from
|
||||||
* @param expLength the expected maximum length of the reply
|
* @param expLength the expected maximum length of the reply
|
||||||
* @return
|
* @return
|
||||||
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in
|
* - @c COMMAND_NULLPOINTER datalen was != 0 but data was == NULL in write
|
||||||
* write command, or nullpointer in read command
|
* command, or nullpointer in read command
|
||||||
* - return codes of RMAPChannelIF::sendCommand()
|
* - return codes of RMAPChannelIF::sendCommand()
|
||||||
*/
|
*/
|
||||||
static ReturnValue_t sendReadCommand(RMAPCookie *cookie, uint32_t expLength);
|
static ReturnValue_t sendReadCommand(RMAPCookie *cookie, uint32_t expLength);
|
||||||
|
@@ -73,16 +73,16 @@ class RMAPChannelIF {
|
|||||||
* @param datalen length of data
|
* @param datalen length of data
|
||||||
* @return
|
* @return
|
||||||
* - @c RETURN_OK
|
* - @c RETURN_OK
|
||||||
* - @c COMMAND_NO_DESCRIPTORS_AVAILABLE no descriptors available for sending
|
* - @c COMMAND_NO_DESCRIPTORS_AVAILABLE no descriptors available for sending command;
|
||||||
* command; command was not sent
|
* command was not sent
|
||||||
* - @c COMMAND_BUFFER_FULL no receiver buffer available for expected len;
|
* - @c COMMAND_BUFFER_FULL no receiver buffer available for expected len; command
|
||||||
|
* was not sent
|
||||||
|
* - @c COMMAND_TOO_BIG the data that was to be sent was too long for the hw to
|
||||||
|
* handle (write command) or the expected len was bigger than maximal expected len (read command)
|
||||||
* command was not sent
|
* command was not sent
|
||||||
* - @c COMMAND_TOO_BIG the data that was to be sent was too long for the hw
|
|
||||||
* to handle (write command) or the expected len was bigger than maximal expected len (read
|
|
||||||
* command) command was not sent
|
|
||||||
* - @c COMMAND_CHANNEL_DEACTIVATED the channel has no port set
|
* - @c COMMAND_CHANNEL_DEACTIVATED the channel has no port set
|
||||||
* - @c NOT_SUPPORTED if you dont feel like
|
* - @c NOT_SUPPORTED if you dont feel like implementing
|
||||||
* implementing something...
|
* something...
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t sendCommand(RMAPCookie *cookie, uint8_t instruction, const uint8_t *data,
|
virtual ReturnValue_t sendCommand(RMAPCookie *cookie, uint8_t instruction, const uint8_t *data,
|
||||||
size_t datalen) = 0;
|
size_t datalen) = 0;
|
||||||
@@ -97,8 +97,8 @@ class RMAPChannelIF {
|
|||||||
* - @c REPLY_NO_REPLY no reply was received
|
* - @c REPLY_NO_REPLY no reply was received
|
||||||
* - @c REPLY_NOT_SENT command was not sent, implies no reply
|
* - @c REPLY_NOT_SENT command was not sent, implies no reply
|
||||||
* - @c REPLY_NOT_YET_SENT command is still waiting to be sent
|
* - @c REPLY_NOT_YET_SENT command is still waiting to be sent
|
||||||
* - @c WRITE_REPLY_INTERFACE_BUSY Interface is busy (transmission buffer still
|
* - @c WRITE_REPLY_INTERFACE_BUSY Interface is busy (transmission buffer still being
|
||||||
* being processed)
|
* processed)
|
||||||
* - @c WRITE_REPLY_TRANSMISSION_ERROR Interface encountered errors during last
|
* - @c WRITE_REPLY_TRANSMISSION_ERROR Interface encountered errors during last
|
||||||
* operation, data could not be processed. (transmission error)
|
* operation, data could not be processed. (transmission error)
|
||||||
* - @c WRITE_REPLY_INVALID_DATA Invalid data (amount / value)
|
* - @c WRITE_REPLY_INVALID_DATA Invalid data (amount / value)
|
||||||
|
@@ -32,10 +32,10 @@ static const uint8_t RMAP_COMMAND_READ = ((1 << RMAP_COMMAND_BIT) | (1 << RMAP_C
|
|||||||
static const uint8_t RMAP_REPLY_WRITE =
|
static const uint8_t RMAP_REPLY_WRITE =
|
||||||
((1 << RMAP_COMMAND_BIT_WRITE) | (1 << RMAP_COMMAND_BIT_REPLY));
|
((1 << RMAP_COMMAND_BIT_WRITE) | (1 << RMAP_COMMAND_BIT_REPLY));
|
||||||
static const uint8_t RMAP_REPLY_READ = ((1 << RMAP_COMMAND_BIT_REPLY));
|
static const uint8_t RMAP_REPLY_READ = ((1 << RMAP_COMMAND_BIT_REPLY));
|
||||||
//#define RMAP_COMMAND_WRITE ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_WRITE)
|
//#define RMAP_COMMAND_WRITE ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_WRITE) |
|
||||||
//| (1<<RMAP_COMMAND_BIT_REPLY)) #define RMAP_COMMAND_WRITE_VERIFY ((1<<RMAP_COMMAND_BIT) |
|
//(1<<RMAP_COMMAND_BIT_REPLY)) #define RMAP_COMMAND_WRITE_VERIFY ((1<<RMAP_COMMAND_BIT) |
|
||||||
//(1<<RMAP_COMMAND_BIT_WRITE) | (1<<RMAP_COMMAND_BIT_REPLY) | (1<<RMAP_COMMAND_BIT_VERIFY)) #define
|
//(1<<RMAP_COMMAND_BIT_WRITE) | (1<<RMAP_COMMAND_BIT_REPLY) | (1<<RMAP_COMMAND_BIT_VERIFY)) #define
|
||||||
// RMAP_COMMAND_READ ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_REPLY))
|
//RMAP_COMMAND_READ ((1<<RMAP_COMMAND_BIT) | (1<<RMAP_COMMAND_BIT_REPLY))
|
||||||
|
|
||||||
//#define RMAP_REPLY_WRITE ((1<<RMAP_COMMAND_BIT_WRITE) |
|
//#define RMAP_REPLY_WRITE ((1<<RMAP_COMMAND_BIT_WRITE) |
|
||||||
//(1<<RMAP_COMMAND_BIT_REPLY))
|
//(1<<RMAP_COMMAND_BIT_REPLY))
|
||||||
|
@@ -99,13 +99,6 @@ class Clock {
|
|||||||
*/
|
*/
|
||||||
static ReturnValue_t getDateAndTime(TimeOfDay_t *time);
|
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.
|
* Converts a time of day struct to POSIX seconds.
|
||||||
* @param time The time of day as input
|
* @param time The time of day as input
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
#include <ctime>
|
|
||||||
|
|
||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/timemanager/Clock.h"
|
#include "fsfw/timemanager/Clock.h"
|
||||||
|
|
||||||
ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval* tt) {
|
ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval *tt) {
|
||||||
uint16_t leapSeconds;
|
uint16_t leapSeconds;
|
||||||
ReturnValue_t result = getLeapSeconds(&leapSeconds);
|
ReturnValue_t result = getLeapSeconds(&leapSeconds);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
@@ -33,7 +31,7 @@ ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) {
|
ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_) {
|
||||||
if (timeMutex == nullptr) {
|
if (timeMutex == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@@ -44,22 +42,9 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
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() {
|
ReturnValue_t Clock::checkOrCreateClockMutex() {
|
||||||
if (timeMutex == nullptr) {
|
if (timeMutex == nullptr) {
|
||||||
MutexFactory* mutexFactory = MutexFactory::instance();
|
MutexFactory *mutexFactory = MutexFactory::instance();
|
||||||
if (mutexFactory == nullptr) {
|
if (mutexFactory == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
|
@@ -172,18 +172,15 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage* message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tmFifo->full()) {
|
if (tmFifo->full()) {
|
||||||
if (warningSwitch) {
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "TmTcBridge::storeDownlinkData: TM downlink max. number "
|
sif::warning << "TmTcBridge::storeDownlinkData: TM downlink max. number "
|
||||||
"of stored packet IDs reached!"
|
"of stored packet IDs reached!"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printWarning(
|
sif::printWarning(
|
||||||
"TmTcBridge::storeDownlinkData: TM downlink max. number "
|
"TmTcBridge::storeDownlinkData: TM downlink max. number "
|
||||||
"of stored packet IDs reached!\n");
|
"of stored packet IDs reached!\n");
|
||||||
#endif
|
#endif
|
||||||
warningSwitch = true;
|
|
||||||
}
|
|
||||||
if (overwriteOld) {
|
if (overwriteOld) {
|
||||||
tmFifo->retrieve(&storeId);
|
tmFifo->retrieve(&storeId);
|
||||||
tmStore->deleteData(storeId);
|
tmStore->deleteData(storeId);
|
||||||
|
@@ -72,8 +72,6 @@ class TmTcBridge : public AcceptsTelemetryIF,
|
|||||||
virtual uint16_t getIdentifier() override;
|
virtual uint16_t getIdentifier() override;
|
||||||
virtual MessageQueueId_t getRequestQueue() override;
|
virtual MessageQueueId_t getRequestQueue() override;
|
||||||
|
|
||||||
bool warningSwitch = true;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Cached for initialize function.
|
//! Cached for initialize function.
|
||||||
object_id_t tmStoreId = objects::NO_OBJECT;
|
object_id_t tmStoreId = objects::NO_OBJECT;
|
||||||
|
Reference in New Issue
Block a user