GPIO Pin Release and Pin Specific Interrupts

sudarshan.rajagopalan sudarshan.rajagopalan at vecna.com
Mon Oct 19 17:53:14 UTC 2015


Hey guys,

I have few questions/comments on the GPIO APIs, maybe to André:

1.) Most of the APIs has a way to call the BSP specific functions: pin 
input/output initialize, pin read/write, enable/disable interrupts etc, 
but I couldn't find a way to call a BSP specific pin release (or 
de-init). The rtems_gpio_release_pin() disables the interrupt for that 
pin and updates the pin state global variable, but does not allows to do 
a bsp specific pin de-initialize. While if I want to change the mode of 
the pin (say from input to output), I can reinitialize the pin and it 
works. But its important to bring back the state of the pin to its 
default reset state, deactivating the pull resistors, if the pin is to 
be released and not used.

Was wondering why this wasn't added. What are your comments on this? If 
this is OK I have a patch for this.

2.) Second, the interrupts are registered based on ports (which it is in 
most of the processors) and the pin that caused the interrupt is found 
as a node in the chained list. But, unfortunately the processor that we 
are using (STM32F4/F7) has pin based interrupts :(. The link below tells 
in brief:

http://stm32f4-discovery.com/2014/08/stm32f4-external-interrupts-tutorial/

There are interrupt vectors defined for each pin in STM32F4/F7 but RTEMS 
GPIO expects vector numbers for gpio banks using 
rtems_gpio_bsp_get_vector(), which would not work for this processor. 
I'm been trying to break my head to figure out a way to make the 
interrupts work, without any modification to the GPIO APIs.

One way would be to send the enumerated pin_number as the argument to 
rtems_gpio_bsp_get_vector(), decode pin number ( pin = 
PIN_NUMBER(pin_number) ) and return the vector number for this pin and 
install the interrupt handler. But based on the whole interrupt service 
architecture in generic_bank_isr(), this would not work out. Everything 
is based on bank interrupts.

Any possible solution for this?

Thanks and Regards,
Sudarshan Rajagopalan


More information about the devel mailing list