From 83530f9c4e60791abb522b45afdb12a428f62a56 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 14 Feb 2021 12:23:29 +0100 Subject: [PATCH] moved gpiod test to bsp folder --- bsp_q7s/CMakeLists.txt | 1 + bsp_q7s/boardtest/CMakeLists.txt | 7 ++++ .../boardtest}/LibgpiodTest.cpp | 5 ++- .../boardtest}/LibgpiodTest.h | 0 test/testtasks/CMakeLists.txt | 1 - test/testtasks/MutextestTask.cpp | 41 ------------------- test/testtasks/MutextestTask.h | 32 --------------- 7 files changed, 11 insertions(+), 76 deletions(-) create mode 100644 bsp_q7s/boardtest/CMakeLists.txt rename {test/testtasks => bsp_q7s/boardtest}/LibgpiodTest.cpp (92%) rename {test/testtasks => bsp_q7s/boardtest}/LibgpiodTest.h (100%) delete mode 100644 test/testtasks/MutextestTask.cpp delete mode 100644 test/testtasks/MutextestTask.h diff --git a/bsp_q7s/CMakeLists.txt b/bsp_q7s/CMakeLists.txt index 806feca9..1da8067f 100644 --- a/bsp_q7s/CMakeLists.txt +++ b/bsp_q7s/CMakeLists.txt @@ -7,6 +7,7 @@ target_sources(${TARGET_NAME} PUBLIC add_subdirectory(boardconfig) add_subdirectory(comIF) add_subdirectory(gpio) +add_subdirectory(boardtest) diff --git a/bsp_q7s/boardtest/CMakeLists.txt b/bsp_q7s/boardtest/CMakeLists.txt new file mode 100644 index 00000000..7e59ddb9 --- /dev/null +++ b/bsp_q7s/boardtest/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(${TARGET_NAME} PRIVATE + LibgpiodTest.cpp +) + + + + diff --git a/test/testtasks/LibgpiodTest.cpp b/bsp_q7s/boardtest/LibgpiodTest.cpp similarity index 92% rename from test/testtasks/LibgpiodTest.cpp rename to bsp_q7s/boardtest/LibgpiodTest.cpp index 3315f0f6..51f89abe 100644 --- a/test/testtasks/LibgpiodTest.cpp +++ b/bsp_q7s/boardtest/LibgpiodTest.cpp @@ -1,10 +1,11 @@ #include "LibgpiodTest.h" -#include "devices/gpioIds.h" +#include #include #include -LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie) : +LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, + GpioCookie* gpioCookie): TestTask(objectId) { gpioInterface = objectManager->get(gpioIfobjectId); diff --git a/test/testtasks/LibgpiodTest.h b/bsp_q7s/boardtest/LibgpiodTest.h similarity index 100% rename from test/testtasks/LibgpiodTest.h rename to bsp_q7s/boardtest/LibgpiodTest.h diff --git a/test/testtasks/CMakeLists.txt b/test/testtasks/CMakeLists.txt index 7c2df391..8d8a17c1 100644 --- a/test/testtasks/CMakeLists.txt +++ b/test/testtasks/CMakeLists.txt @@ -1,5 +1,4 @@ target_sources(${TARGET_NAME} PUBLIC - LibgpiodTest.cpp TestTask.cpp ) diff --git a/test/testtasks/MutextestTask.cpp b/test/testtasks/MutextestTask.cpp deleted file mode 100644 index 325d0029..00000000 --- a/test/testtasks/MutextestTask.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * MutextestTask.cpp - * - * Created on: 19.07.2018 - * Author: mohr - */ - -#include - -#include - -MutexIF * MutextestTask::mutex = nullptr; - -MutextestTask::MutextestTask(const char *name, object_id_t setObjectId) : - SystemObject(setObjectId), name(name), locked(false) { - if (mutex == NULL) { - mutex = MutexFactory::instance()->createMutex(); - } -} - -ReturnValue_t MutextestTask::performOperation(uint8_t operationCode) { - if (!locked){ - sif::info << name << ": locking..." << std::endl; - ReturnValue_t result = mutex->lockMutex(MutexIF::BLOCKING); - sif::info << name << ": locked with " << (int) result << std::endl; - if (result == HasReturnvaluesIF::RETURN_OK){ - locked = true; - } - } else { - sif::info << name << ": releasing" << std::endl; - mutex->unlockMutex(); - locked = false; - } - - return HasReturnvaluesIF::RETURN_OK; -} - -MutextestTask::~MutextestTask() { -// TODO Auto-generated destructor stub -} - diff --git a/test/testtasks/MutextestTask.h b/test/testtasks/MutextestTask.h deleted file mode 100644 index 14b81028..00000000 --- a/test/testtasks/MutextestTask.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * MutextestTask.h - * - * Created on: 19.07.2018 - * Author: mohr - */ - -#ifndef MISSION_MUTEXTESTTASK_H_ -#define MISSION_MUTEXTESTTASK_H_ - -#include -#include -#include - -/** - * Start two of them with a little time difference and different periods to see mutex in action - */ - -class MutextestTask: public SystemObject, public ExecutableObjectIF { -public: - - virtual ReturnValue_t performOperation(uint8_t operationCode = 0); - - MutextestTask(const char *name, object_id_t setObjectId); - virtual ~MutextestTask(); -private: - static MutexIF *mutex; - const char * name; - bool locked; -}; - -#endif /* MISSION_MUTEXTESTTASK_H_ */