Have a look at the code below to make sure you are doing something similar (this is using a multitasking application, with a single task named gpioTask. Make sure this is indicated in your task table) :
#include "adl_global.h"
#include "generated.h"
/***************************************************************************/
/* Local variables
/***************************************************************************/
adl_ioDefs_t gpio_Input[1] =
{ ADL_IO_GPIO | 21| ADL_IO_DIR_IN };
s32 GPIO_event_handle = 0;
s32 Polling_handle;
/***************************************************************************/
/* Local functions
/***************************************************************************/
void GPIO_event_Handler(s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void *Param);
void gpioTask(void)
{
// Subscribe to the GPIO Event System
GPIO_event_handle = adl_ioEventSubscribe(GPIO_event_Handler);
//subscribe to GPIO service with polling every 100ms for GPIO
Polling_handle = adl_ioSubscribe(1, gpio_Input, ADL_TMR_TYPE_100MS, 1, GPIO_event_handle);
// If both subscriptions were ok, return OK
if ((GPIO_event_handle > 0) && (Polling_handle > 0))
{
TRACE((1, "Subscribed to GPIO Events: OK"));
}
else
{
TRACE((1, "Subscribed to GPIO Events: FAILED %d, %d",GPIO_event_handle, Polling_handle ));
}
}
void GPIO_event_Handler(s32 GpioHandle, adl_ioEvent_e Event, u32 Size, void *Param)
{
switch (Event)
{
case ADL_IO_EVENT_INPUT_CHANGED:
{
if (adl_ioReadSingle(Polling_handle, &gpio_Input[0]) == 1)
{
TRACE((1, "GPIO TOGGLED HIGH"));
}
else
{
TRACE((1, "GPIO TOGGLED LOW"));
}
}
break;
}
}