From 86752417f23020a329c8a0e784ecd693898f55ae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 4 May 2022 14:08:27 +0200 Subject: [PATCH 1/3] changed for updated FSFW GPIO API --- fsfw | 2 +- linux/boardtest/LibgpiodTest.cpp | 24 ++++++++++++------------ linux/obc/PapbVcInterface.cpp | 12 ++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/fsfw b/fsfw index 7f6c8b8b..8ee26f81 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 7f6c8b8b123a63546de0d73f0de35900d6c806bf +Subproject commit 8ee26f81f9449e28566a8d34fbb3454cfd1da01c diff --git a/linux/boardtest/LibgpiodTest.cpp b/linux/boardtest/LibgpiodTest.cpp index 0c5ebe2a..1c8fec5e 100644 --- a/linux/boardtest/LibgpiodTest.cpp +++ b/linux/boardtest/LibgpiodTest.cpp @@ -19,18 +19,18 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, Gpi LibgpiodTest::~LibgpiodTest() {} ReturnValue_t LibgpiodTest::performPeriodicAction() { - int gpioState; + gpio::Levels gpioState; ReturnValue_t result; switch (testCase) { case (TestCases::READ): { - result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState); + result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState); if (result != RETURN_OK) { sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl; return RETURN_FAILED; } else { - sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << gpioState - << std::endl; + sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << + static_cast(gpioState) << std::endl; } break; } @@ -38,19 +38,19 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() { break; } case (TestCases::BLINK): { - result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState); + result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState); if (result != HasReturnvaluesIF::RETURN_OK) { sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl; return RETURN_FAILED; } - if (gpioState == 1) { + if (gpioState == gpio::Levels::HIGH) { result = gpioInterface->pullLow(gpioIds::TEST_ID_0); if (result != HasReturnvaluesIF::RETURN_OK) { sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO low!" << std::endl; return HasReturnvaluesIF::RETURN_FAILED; } - } else if (gpioState == 0) { + } else if (gpioState == gpio::Levels::LOW) { result = gpioInterface->pullHigh(gpioIds::TEST_ID_0); if (result != HasReturnvaluesIF::RETURN_OK) { sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!" @@ -72,7 +72,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() { } ReturnValue_t LibgpiodTest::performOneShotAction() { - int gpioState; + gpio::Levels gpioState; ReturnValue_t result; switch (testCase) { @@ -93,8 +93,8 @@ ReturnValue_t LibgpiodTest::performOneShotAction() { << std::endl; return HasReturnvaluesIF::RETURN_OK; } - result = gpioInterface->readGpio(gpioIds::TEST_ID_1, &gpioState); - if (result == HasReturnvaluesIF::RETURN_OK and gpioState == 1) { + result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState); + if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::HIGH) { sif::info << "LibgpiodTest::performOneShotAction: " "GPIO state read successfully and is high" << std::endl; @@ -110,8 +110,8 @@ ReturnValue_t LibgpiodTest::performOneShotAction() { "GPIO pulled low successfully for loopback test" << std::endl; } - result = gpioInterface->readGpio(gpioIds::TEST_ID_1, &gpioState); - if (result == HasReturnvaluesIF::RETURN_OK and gpioState == 0) { + result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState); + if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::LOW) { sif::info << "LibgpiodTest::performOneShotAction: " "GPIO state read successfully and is low" << std::endl; diff --git a/linux/obc/PapbVcInterface.cpp b/linux/obc/PapbVcInterface.cpp index 5636975a..643104d7 100644 --- a/linux/obc/PapbVcInterface.cpp +++ b/linux/obc/PapbVcInterface.cpp @@ -42,17 +42,17 @@ void PapbVcInterface::startPacketTransfer() { *vcBaseReg = CONFIG_START; } void PapbVcInterface::endPacketTransfer() { *vcBaseReg = CONFIG_END; } ReturnValue_t PapbVcInterface::pollPapbBusySignal() { - int papbBusyState = 0; + gpio::Levels papbBusyState = gpio::Levels::LOW; ReturnValue_t result = RETURN_OK; /** Check if PAPB interface is ready to receive data */ - result = gpioComIF->readGpio(papbBusyId, &papbBusyState); + result = gpioComIF->readGpio(papbBusyId, papbBusyState); if (result != RETURN_OK) { sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal" << std::endl; return RETURN_FAILED; } - if (!papbBusyState) { + if (papbBusyState == gpio::Levels::LOW) { sif::warning << "PapbVcInterface::pollPapbBusySignal: PAPB busy" << std::endl; return PAPB_BUSY; } @@ -62,9 +62,9 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal() { void PapbVcInterface::isVcInterfaceBufferEmpty() { ReturnValue_t result = RETURN_OK; - int papbEmptyState = 1; + gpio::Levels papbEmptyState = gpio::Levels::HIGH; - result = gpioComIF->readGpio(papbEmptyId, &papbEmptyState); + result = gpioComIF->readGpio(papbEmptyId, papbEmptyState); if (result != RETURN_OK) { sif::warning << "PapbVcInterface::isVcInterfaceBufferEmpty: Failed to read papb empty signal" @@ -72,7 +72,7 @@ void PapbVcInterface::isVcInterfaceBufferEmpty() { return; } - if (papbEmptyState == 1) { + if (papbEmptyState == gpio::Levels::HIGH) { sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is empty" << std::endl; } else { sif::debug << "PapbVcInterface::isVcInterfaceBufferEmpty: Buffer is not empty" << std::endl; From afaeca7cf7682ffa856b804703ecd0c1586ebab3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 4 May 2022 14:12:35 +0200 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74d88604..327c077f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,9 @@ list yields a list of all related PRs for each release. - Add Syrlinks and TMP devices to Software by default - Update GPS Linux Hyperion Handler to use socket interface. Still allows switching back to SHM interface, but the SHM interface is a possible cause of SW crashes +- Updated code for changed FSFW HAL GPIO API: `readGpio` prototype has changed + PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/240 and + https://egit.irs.uni-stuttgart.de/eive/fsfw/pulls/76 # [v1.10.1] From bb2bd875414f2fca1670da901abc5c858cbd93a2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 4 May 2022 14:15:26 +0200 Subject: [PATCH 3/3] repoint fsfw --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 8ee26f81..80cb0e68 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8ee26f81f9449e28566a8d34fbb3454cfd1da01c +Subproject commit 80cb0e682fb423b4e7b8f45b66b3b5b7249e0d48