GPIO Subscription of Q2686


#1

Hello,
I am using Q2686 and OS 6.61. I am trying to subscribe GPIO but it is giving following error.
ADL_RET_ERR_ALREADY_SUBSCRIBED.
Please look at the following code:

s32 GPIO19_hdl;
adl_ioConfig_t GpioConfig[2];

-
-

void adl_main ( adl_InitType_e InitType )
{
TRACE (( 1, “Embedded Application : Main” ));
// TO DO : Add your initialization code here

/* This GPIO is not multiplexed*/
GpioConfig[1].eLabel.Q2686_Label = ADL_IO_Q2686_GPIO_26;
GpioConfig[1].eDirection = ADL_IO_INPUT;
GpioConfig[1].eState = ADL_IO_LOW;

GPIO19_hdl = adl_ioSubscribe ( sizeof(GpioConfig + 1), ( adl_ioConfig_t * )(GpioConfig + 1), 0, 0, NULL);

return value is ADL_RET_ERR_ALREADY_SUBSCRIBED.

}
waiting for reply
Thanks,


#2

In the supplied code example you are trying to subscribe to GPIO26 which is multiplexed with SCL.

Aside from that I find the code hard to read.

If you only want to subscribe to one gpio, don’t use an array like you do.

Also, adl_ioSubscribe in OS6.61 is defined as
s32 adl_ioSubscribe ( u32 GpioNb, adl_ioConfig_t * GpioConfig, u8 PollingTimerType, u32 PollingTime, s32 GpioEventHandle );
GpioNb is the number of GPIO you are trying to allocate and not the size of the struct.
This is also shown in the example in the ADL User Guide. I believe the “basic” API is different in that respect, so if you have previously used that, please read the ADL documentation and examples


#3

Try it ~

s32 GPIO19_hdl;
adl_ioConfig_t GpioConfig=
{
ADL_IO_Q2686_GPIO_26,
0,
ADL_IO_INPUT,
ADL_IO_LOW
};

void adl_main ( adl_InitType_e InitType )
{
GPIO19_hdl = adl_ioSubscribe ( 1,&GpioConfig, 0, 0, 0);
}


#4

Hi all
Thanks for reply,
Its working

look what is mention in the ADL User Guide(September 11, 2006) which i have

s32 adl_ioSubscribe ( u32 GpioNb, adl_ioConfig_t * GpioConfig, u8 PollingTimerType, u32 PollingTime, s32 GpioEventHandle );

GpioNb:
Size of the GpioConfig array.

that why i was given the size of structure. Now its ok i understand the Problem

Thanks Again