open gpio by label test on te0720

This commit is contained in:
Jakob Meier 2021-09-20 16:30:50 +02:00
parent 4b5f22f013
commit cd92f4a611
6 changed files with 57 additions and 8 deletions

View File

@ -292,10 +292,12 @@ void initmission::createTestTasks(TaskFactory& factory, TaskDeadlineMissedFuncti
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
PeriodicTaskIF* testTask = factory.createPeriodicTask(
"TEST_TASK", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc);
#if OBSW_ADD_TEST_TASK == 1
result = testTask->addComponent(objects::TEST_TASK);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("TEST_TASK", objects::TEST_TASK);
}
#endif /* OBSW_ADD_TEST_TASK == 1 */
#if OBSW_ADD_SPI_TEST_CODE == 1
result = testTask->addComponent(objects::SPI_TEST);

View File

@ -529,8 +529,10 @@ void ObjectFactory::createHeaterComponents() {
GpioCookie* heaterGpiosCookie = new GpioCookie;
/* Pin H2-11 on stack connector */
GpiodRegular* gpioConfigHeater0 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
q7s::GPIO_HEATER_0_PIN, "Heater0", gpio::OUT, 0);
GpiodRegular* gpioConfigHeater0 = new GpiodRegular("Heater0", gpio::OUT, 0, "axi_gpio_q7_3v3",
q7s::GPIO_HEATER_0_PIN);
// GpiodRegular* gpioConfigHeater0 = new GpiodRegular(q7s::GPIO_HEATER_CHIP,
// q7s::GPIO_HEATER_0_PIN, "Heater0", gpio::OUT, 0);
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpioConfigHeater0);
/* Pin H2-12 on stack connector */
@ -822,11 +824,15 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#endif
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
#if OBSW_TEST_GPIO_LABEL == 1
/* Configure MIO0 as input */
GpiodRegular gpioConfigMio0(std::string("gpiochip0"), 0,
std::string("MIO0"), gpio::IN, 0);
GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::OUT, 0, "/amba_pl/gpio@41200000", 0);
#else
/* Configure MIO0 as input */
GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0);
#endif /* OBSW_TEST_GPIO_LABEL == 1 */
GpioCookie* gpioCookie = new GpioCookie;
gpioCookie->addGpio(gpioIds::TEST_ID_0, gpioConfigMio0);
gpioCookie->addGpio(gpioIds::TEST_ID_0, testGpio);
new LibgpiodTest(objects::LIBGPIOD_TEST, objects::GPIO_IF, gpioCookie);
#endif

View File

@ -11,6 +11,10 @@ int simple::simple() {
{
FileSystemTest fileSystemTest;
}
#endif
#if TE0720_GPIO_TEST
#endif
return 0;
}

View File

@ -15,7 +15,7 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId,
sif::error << "LibgpiodTest::LibgpiodTest: Invalid Gpio interface." << std::endl;
}
gpioInterface->addGpios(gpioCookie);
testCase = TestCases::LOOPBACK;
testCase = TestCases::BLINK;
}
LibgpiodTest::~LibgpiodTest() {
@ -29,7 +29,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
case(TestCases::READ): {
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
if (result != RETURN_OK) {
sif::debug << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio "
<< std::endl;
return RETURN_FAILED;
}
@ -42,6 +42,38 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
case(TestCases::LOOPBACK): {
break;
}
case(TestCases::BLINK): {
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) {
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) {
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
}
else {
sif::warning << "LibgpiodTest::performPeriodicAction: Invalid GPIO state" << std::endl;
}
break;
}
default:
sif::debug << "LibgpiodTest::performPeriodicAction: Invalid test case" << std::endl;
break;
}
@ -56,6 +88,9 @@ ReturnValue_t LibgpiodTest::performOneShotAction() {
case(TestCases::READ): {
break;
}
case(TestCases::BLINK): {
break;
}
case(TestCases::LOOPBACK): {
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
if(result == HasReturnvaluesIF::RETURN_OK) {

View File

@ -14,7 +14,8 @@ class LibgpiodTest: public TestTask {
public:
enum TestCases {
READ = 0,
LOOPBACK = 1
LOOPBACK = 1,
BLINK
};
TestCases testCase;

View File

@ -59,6 +59,7 @@ debugging. */
#define OBSW_TEST_CCSDS_BRIDGE 0
#define OBSW_TEST_CCSDS_PTME 0
#define OBSW_TEST_TE7020_HEATER 0
#define OBSW_TEST_GPIO_LABEL 0
#define OBSW_DEBUG_P60DOCK 0
#define OBSW_DEBUG_PDU1 0