BBB GPIO api interrupt handler problem

Federico Garcia Cruz federico.garciacruz at tallertechnologies.com
Mon Nov 9 19:05:50 UTC 2015


I've tried with just a boolean toggle in the interrupt handler and with a
call to rtems_gpio_set(BBB_LED_USR3) in order to see led activity and it
does the same thing.
Sudarshan:
Yes, a return statement in an interrupt handler.
This is because this handler is called by the real interrupt handler
installed by the driver. The code of the real interrupt handler does this:

if ( (isr_node->handler)(isr_node->arg) == IRQ_HANDLED ) {
          ++handled_count;
        }

2015-11-09 15:41 GMT-03:00 sudarshan.rajagopalan <
sudarshan.rajagopalan at vecna.com>:

> On 2015-11-09 13:11, Federico Garcia Cruz wrote:
>
>> Hi everyone,
>> I'm using the GPIO api for the BBB but I'm having problems with the
>> interrupt handling.
>> I'm blinking two leds in the main thread and I have a GPIO input with
>> an interrupt attached that uses printk to print a message. The problem
>> is that the interrupt handler prints the message but never returns
>> (main thread leds stop blinking after that).
>> Any suggestion?
>> Here's my code:
>>
>> rtems_gpio_irq_state gpio_handler(void* /*arg*/)
>> {
>>     printk("interrupt handler\n");
>>     return IRQ_HANDLED;
>> }
>>
>
> A return statement inside an interrupt handler?? Where does it return back
> to?
>
> - Sudarshan
>
>
>> void* POSIX_Init(void*)
>> {
>>     rtems_mode previous_mode_set;
>>     rtems_task_mode(RTEMS_TIMESLICE | RTEMS_PREEMPT,
>> RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, &previous_mode_set);
>>     rtems_status_code sc = rtems_gpio_initialize();
>>     printk("%d\n", sc);
>>
>>     sc = rtems_gpio_request_pin(BBB_LED_USR0, DIGITAL_OUTPUT, true,
>> false, NULL);
>>     printk("DIGITAL_OUTPUT: %d\n", sc);
>>     sc = rtems_gpio_request_pin(BBB_LED_USR3, DIGITAL_OUTPUT, true,
>> false, NULL);
>>     printk("DIGITAL_OUTPUT: %d\n", sc);
>>
>>     sc = rtems_gpio_request_pin(BBB_P8_7, DIGITAL_INPUT, false, false,
>> NULL);
>>     printk("DIGITAL_INPUT: %d\n", sc);
>>
>>     sc = rtems_gpio_enable_interrupt(BBB_P8_7, FALLING_EDGE,
>> UNIQUE_HANDLER, false, gpio_handler, NULL);
>>     printk("interrupt install: %d\n", sc);
>>
>>     while(1)
>>     {
>>         sleep(1);
>>         rtems_gpio_clear(BBB_LED_USR3);
>>         rtems_gpio_set(BBB_LED_USR0);
>>         sleep(1);
>>         rtems_gpio_set(BBB_LED_USR3);
>>         rtems_gpio_clear(BBB_LED_USR0);
>>     }
>>     return NULL;
>> }
>>
>> Thanks in advance!--
>>
>>  [1]
>>
>> Federico Garcia Cruz
>>
>> Software Engineer
>>
>> San Lorenzo 47, 3rd Floor, Office 5
>>
>> Córdoba, Argentina
>>
>> Phone: +54 351 4217888 / +54 351 4218211
>>
>>  [2] [3]
>>
>>
>> Links:
>> ------
>> [1] http://www.tallertechnologies.com
>> [2] http://www.linkedin.com/company/taller-technologies
>> [3] https://www.facebook.com/tallertechnologies
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>>
>
>


-- 

<http://www.tallertechnologies.com>


Federico Garcia Cruz

Software Engineer


San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina


Phone: +54 351 4217888 / +54 351 4218211


<http://www.linkedin.com/company/taller-technologies>
<https://www.facebook.com/tallertechnologies>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20151109/81b39d43/attachment-0002.html>


More information about the devel mailing list