new linux boardtest folder

This commit is contained in:
2021-02-14 19:22:58 +01:00
parent aa5690687a
commit 967618f687
12 changed files with 86 additions and 2 deletions

View File

@ -0,0 +1,10 @@
target_sources(${TARGET_NAME} PRIVATE
LibgpiodTest.cpp
I2cTestClass.cpp
SpiTestClass.cpp
UartTestClass.cpp
)

View File

@ -0,0 +1,8 @@
#include <linux/boardtest/I2cTestClass.h>
I2cTestClass::I2cTestClass(object_id_t objectId): TestTask(objectId) {
}
ReturnValue_t I2cTestClass::performPeriodicAction() {
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -0,0 +1,17 @@
#ifndef LINUX_BOARDTEST_I2CTESTCLASS_H_
#define LINUX_BOARDTEST_I2CTESTCLASS_H_
#include <test/testtasks/TestTask.h>
class I2cTestClass: public TestTask {
public:
I2cTestClass(object_id_t objectId);
ReturnValue_t performPeriodicAction() override;
private:
};
#endif /* LINUX_BOARDTEST_I2CTESTCLASS_H_ */

View File

@ -0,0 +1,37 @@
#include "LibgpiodTest.h"
#include <fsfwconfig/devices/gpioIds.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/objectmanager/ObjectManagerIF.h>
LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
GpioCookie* gpioCookie):
TestTask(objectId) {
gpioInterface = objectManager->get<GpioIF>(gpioIfobjectId);
if (gpioInterface == nullptr) {
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
}
gpioInterface->initialize(gpioCookie);
}
LibgpiodTest::~LibgpiodTest() {
}
ReturnValue_t LibgpiodTest::performPeriodicAction() {
int gpioState;
ReturnValue_t result;
result = gpioInterface->readGpio(gpioIds::Test_ID, &gpioState);
if (result != RETURN_OK) {
sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
<< std::endl;
return RETURN_FAILED;
}
else {
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << gpioState
<< std::endl;
}
return RETURN_OK;
}

View File

@ -0,0 +1,25 @@
#ifndef TEST_TESTTASKS_LIBGPIODTEST_H_
#define TEST_TESTTASKS_LIBGPIODTEST_H_
#include "TestTask.h"
#include <linux/gpio/GpioIF.h>
#include <linux/gpio/GpioCookie.h>
#include <fsfw/objectmanager/SystemObject.h>
/**
* @brief Test for the GPIO read implementation of the LinuxLibgpioIF.
* @author J. Meier
*/
class LibgpiodTest: public TestTask {
public:
LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, GpioCookie* gpioCookie);
virtual ~LibgpiodTest();
protected:
virtual ReturnValue_t performPeriodicAction() override;
private:
GpioIF* gpioInterface;
};
#endif /* TEST_TESTTASKS_LIBGPIODTEST_H_ */

View File

@ -0,0 +1,8 @@
#include <linux/boardtest/SpiTestClass.h>
SpiTestClass::SpiTestClass(object_id_t objectId): TestTask(objectId) {
}
ReturnValue_t SpiTestClass::performPeriodicAction() {
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -0,0 +1,18 @@
#ifndef LINUX_BOARDTEST_SPITESTCLASS_H_
#define LINUX_BOARDTEST_SPITESTCLASS_H_
#include <test/testtasks/TestTask.h>
class SpiTestClass: public TestTask {
public:
SpiTestClass(object_id_t objectId);
ReturnValue_t performPeriodicAction() override;
private:
};
#endif /* LINUX_BOARDTEST_SPITESTCLASS_H_ */

View File

@ -0,0 +1,8 @@
#include <linux/boardtest/UartTestClass.h>
UartTestClass::UartTestClass(object_id_t objectId): TestTask(objectId) {
}
ReturnValue_t UartTestClass::performPeriodicAction() {
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -0,0 +1,15 @@
#ifndef LINUX_BOARDTEST_UARTTESTCLASS_H_
#define LINUX_BOARDTEST_UARTTESTCLASS_H_
#include <test/testtasks/TestTask.h>
class UartTestClass: public TestTask {
public:
UartTestClass(object_id_t objectId);
ReturnValue_t performPeriodicAction() override;
private:
};
#endif /* LINUX_BOARDTEST_UARTTESTCLASS_H_ */