Update FSFW from Upstream #27

Merged
muellerr merged 523 commits from mueller/update-from-upstream into develop 2022-05-17 10:06:59 +02:00
8 changed files with 30 additions and 26 deletions
Showing only changes of commit 5d6de90859 - Show all commits

View File

@ -15,10 +15,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- HAL Linux SPI: Set the Clock Default State when setting new SPI speed - HAL Linux SPI: Set the Clock Default State when setting new SPI speed
and mode and mode
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/573 PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/573
- HAL Devicehandlers: Periodic printout is run-time configurable now. - GPIO HAL: `Direction`, `GpioOperation` and `Levels` are enum classes now, which prevents
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/561 name clashes with Windows defines.
- `oneShotAction` flag in the `TestTask` class is not static anymore. PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/560 - New CMake option `FSFW_HAL_LINUX_ADD_LIBGPIOD` to specifically exclude `gpiod` code.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572
- HAL Devicehandlers: Periodic printout is run-time configurable now
- `oneShotAction` flag in the `TestTask` class is not static anymore
## Removed ## Removed

View File

@ -9,6 +9,7 @@ option(FSFW_HAL_ADD_LINUX "Add the Linux HAL to the sources. Requires gpiod libr
# Linux. The only exception from this is the gpiod library which requires a dedicated installation, # Linux. The only exception from this is the gpiod library which requires a dedicated installation,
# but CMake is able to determine whether this library is installed with find_library. # but CMake is able to determine whether this library is installed with find_library.
option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add peripheral drivers for embedded Linux" ON) option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add peripheral drivers for embedded Linux" ON)
option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Target implements libgpiod" ON)
option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" OFF) option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" OFF)
option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF) option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF)

View File

@ -9,11 +9,11 @@ using gpioId_t = uint16_t;
namespace gpio { namespace gpio {
enum Levels : uint8_t { LOW = 0, HIGH = 1, NONE = 99 }; enum class Levels : int { LOW = 0, HIGH = 1, NONE = 99 };
enum Direction : uint8_t { IN = 0, OUT = 1 }; enum class Direction : int { IN = 0, OUT = 1 };
enum GpioOperation { READ, WRITE }; enum class GpioOperation { READ, WRITE };
enum class GpioTypes { enum class GpioTypes {
NONE, NONE,
@ -80,7 +80,7 @@ class GpiodRegularByChip : public GpiodRegularBase {
public: public:
GpiodRegularByChip() GpiodRegularByChip()
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, std::string(), gpio::Direction::IN, : GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, std::string(), gpio::Direction::IN,
gpio::LOW, 0) {} gpio::Levels::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_)
@ -90,7 +90,7 @@ class GpiodRegularByChip : public GpiodRegularBase {
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::IN, : GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, consumer_, gpio::Direction::IN,
gpio::LOW, lineNum_), gpio::Levels::LOW, lineNum_),
chipname(chipname_) {} chipname(chipname_) {}
std::string chipname; std::string chipname;
@ -106,7 +106,7 @@ class GpiodRegularByLabel : public GpiodRegularBase {
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::IN, : GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL, consumer_, gpio::Direction::IN,
gpio::LOW, lineNum_), gpio::Levels::LOW, lineNum_),
label(label_) {} label(label_) {}
std::string label; std::string label;
@ -127,7 +127,7 @@ class GpiodRegularByLineName : public GpiodRegularBase {
GpiodRegularByLineName(std::string lineName_, std::string consumer_) GpiodRegularByLineName(std::string lineName_, std::string consumer_)
: GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME, consumer_, gpio::Direction::IN, : GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME, consumer_, gpio::Direction::IN,
gpio::LOW), gpio::Levels::LOW),
lineName(lineName_) {} lineName(lineName_) {}
std::string lineName; std::string lineName;

View File

@ -9,7 +9,9 @@ target_sources(${LIB_FSFW_NAME} PRIVATE
) )
if(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS) if(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS)
if(FSFW_HAL_LINUX_ADD_LIBGPIOD)
add_subdirectory(gpio) add_subdirectory(gpio)
endif()
add_subdirectory(spi) add_subdirectory(spi)
add_subdirectory(i2c) add_subdirectory(i2c)
add_subdirectory(uart) add_subdirectory(uart)

View File

@ -161,11 +161,12 @@ 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::OUT): { case (gpio::Direction::OUT): {
result = gpiod_line_request_output(lineHandle, consumer.c_str(), regularGpio.initValue); result = gpiod_line_request_output(lineHandle, consumer.c_str(),
static_cast<int>(regularGpio.initValue));
break; break;
} }
case (gpio::IN): { case (gpio::Direction::IN): {
result = gpiod_line_request_input(lineHandle, consumer.c_str()); result = gpiod_line_request_input(lineHandle, consumer.c_str());
break; break;
} }
@ -211,7 +212,7 @@ ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId) {
if (regularGpio == nullptr) { if (regularGpio == nullptr) {
return GPIO_TYPE_FAILURE; return GPIO_TYPE_FAILURE;
} }
return driveGpio(gpioId, *regularGpio, gpio::HIGH); return driveGpio(gpioId, *regularGpio, gpio::Levels::HIGH);
} else { } else {
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second); auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
if (gpioCallback->callback == nullptr) { if (gpioCallback->callback == nullptr) {
@ -243,7 +244,7 @@ ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) {
if (regularGpio == nullptr) { if (regularGpio == nullptr) {
return GPIO_TYPE_FAILURE; return GPIO_TYPE_FAILURE;
} }
return driveGpio(gpioId, *regularGpio, gpio::LOW); return driveGpio(gpioId, *regularGpio, gpio::Levels::LOW);
} else { } else {
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second); auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
if (gpioCallback->callback == nullptr) { if (gpioCallback->callback == nullptr) {
@ -258,11 +259,11 @@ ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) {
ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio, ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio,
gpio::Levels logicLevel) { gpio::Levels logicLevel) {
int result = gpiod_line_set_value(regularGpio.lineHandle, logicLevel); int result = gpiod_line_set_value(regularGpio.lineHandle, static_cast<int>(logicLevel));
if (result < 0) { if (result < 0) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " << gpioId sif::warning << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " << gpioId
<< " to logic level " << logicLevel << std::endl; << " to logic level " << static_cast<int>(logicLevel) << std::endl;
#else #else
sif::printWarning( sif::printWarning(
"LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID %d to " "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID %d to "

View File

@ -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,
int initValue) { gpio::Levels initValue) {
if (cookie == nullptr) { if (cookie == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }

View File

@ -21,7 +21,8 @@ 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, int initValue); std::string consumer, gpio::Direction direction,
gpio::Levels initValue);
} // namespace gpio } // namespace gpio
#endif /* BSP_RPI_GPIO_GPIORPI_H_ */ #endif /* BSP_RPI_GPIO_GPIORPI_H_ */

View File

@ -208,7 +208,7 @@ ReturnValue_t TestDevice::buildNormalModeCommand(DeviceCommandId_t deviceCommand
const uint8_t* commandData, const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if OBSW_VERBOSE_LEVEL >= 3 #if FSFW_VERBOSE_LEVEL >= 3
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "TestDevice::buildTestCommand1: Building normal command" << std::endl; sif::info << "TestDevice::buildTestCommand1: Building normal command" << std::endl;
#else #else
@ -351,7 +351,7 @@ ReturnValue_t TestDevice::scanForReply(const uint8_t* start, size_t len, DeviceC
switch (pendingCmd) { switch (pendingCmd) {
case (TEST_NORMAL_MODE_CMD): { case (TEST_NORMAL_MODE_CMD): {
if (fullInfoPrintout) { if (fullInfoPrintout) {
#if OBSW_VERBOSE_LEVEL >= 3 #if FSFW_VERBOSE_LEVEL >= 3
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "TestDevice::scanForReply: Reply for normal commnand (ID " sif::info << "TestDevice::scanForReply: Reply for normal commnand (ID "
<< TEST_NORMAL_MODE_CMD << ") received!" << std::endl; << TEST_NORMAL_MODE_CMD << ") received!" << std::endl;
@ -678,7 +678,6 @@ ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId,
int32_t newValue = 0; int32_t newValue = 0;
ReturnValue_t result = newValues->getElement<int32_t>(&newValue, 0, 0); ReturnValue_t result = newValues->getElement<int32_t>(&newValue, 0, 0);
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
#if OBSW_DEVICE_HANDLER_PRINTOUT == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "TestDevice" << deviceIdx sif::info << "TestDevice" << deviceIdx
<< "::getParameter: Setting parameter 1 to " << "::getParameter: Setting parameter 1 to "
@ -688,7 +687,6 @@ ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId,
sif::printInfo("TestDevice%d::getParameter: Setting parameter 1 to new value %lu\n", sif::printInfo("TestDevice%d::getParameter: Setting parameter 1 to new value %lu\n",
deviceIdx, static_cast<unsigned long>(newValue)); deviceIdx, static_cast<unsigned long>(newValue));
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* OBSW_DEVICE_HANDLER_PRINTOUT == 1 */
} }
} }
parameterWrapper->set(testParameter1); parameterWrapper->set(testParameter1);
@ -702,7 +700,6 @@ ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId,
newValues->getElement<float>(newVector + 2, 0, 2) != RETURN_OK) { newValues->getElement<float>(newVector + 2, 0, 2) != RETURN_OK) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
#if OBSW_DEVICE_HANDLER_PRINTOUT == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "TestDevice" << deviceIdx sif::info << "TestDevice" << deviceIdx
<< "::getParameter: Setting parameter 3 to " << "::getParameter: Setting parameter 3 to "
@ -715,7 +712,6 @@ ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId,
"[%f, %f, %f]\n", "[%f, %f, %f]\n",
deviceIdx, newVector[0], newVector[1], newVector[2]); deviceIdx, newVector[0], newVector[1], newVector[2]);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* OBSW_DEVICE_HANDLER_PRINTOUT == 1 */
} }
parameterWrapper->setVector(vectorFloatParams2); parameterWrapper->setVector(vectorFloatParams2);
break; break;