On 05/23/14 01:08, Alan Cudmore wrote:
Hi Andre,
Please see my comments below:
Alan
On 5/22/2014 6:30 PM, Andre Marques wrote:
Hello,
I will start my GSOC project with a GPIO driver for the RPi BSP, and
part of the GPIO driver code will not be specific to the RPi but to
any board with a GPIO interface. With code reuse in mind and since I
did not found any "generic" API for the GPIO interface in the RTEMS
code base, I intend to propose here an initial *rough* draft of what
this API may look like.
Do you think a gpio API has advantages over Pierre's driver/ioctl
based driver?
https://github.com/pficheux/raspberry_pi/blob/master/RTEMS/gpio_driver
This API would not be the GPIO driver. It would be an interface with the
GPIO hardware that would then be used by the driver to operate the GPIO
peripheral. You may see this API as something similar to the GPIO macros
in Pierre's driver.
Feedback from others would be welcome. Pierre offered this as a
generic GPIO driver interface for RTEMS earlier, but did not get much
feedback.
To initialize the API:
rtems_gpio_initialize (struct gpio_config)
which would initialize the API with a specific GPIO peripheral
configuration: number of gpio pins, gpio register addresses, ...
To set a gpio pin as input or output (the direction would be a macro):
rtems_gpio_direction (int gpio, int direction)
Does the gpio serve as the GPIO pin number in this API?
Yes, gpio would be the pin number.
To set a gpio pull resistor (either pull up/down or no pull resistor):
rtems_gpio_set_Pull (int gpio, int pull)
Maybe use lower case 'p' for this api to be consistent.
Yes.
Some GPIO I/O:
rtems_gpio_set(int gpio)
rtems_gpio_clr (int gpio)
rtems_gpio_read_value (int gpio)
Use rtems_gpio_get instead of read_value?
Yes, seems better (shorter).
And interrupt management:
rtems_int_enable (int gpio, rtems_interrupt_level int)
rtems_int_disable (int gpio)
rtems_int_clear (int gpio)
Do you mean to have rtems_gpio_int_xxx ?
Yes, I forgot the gpio part when writting.
Would appreciate some feedback on this.
--Andre Marques.
_______________________________________________
rtems-devel mailing list
[email protected]
http://www.rtems.org/mailman/listinfo/rtems-devel
_______________________________________________
rtems-devel mailing list
[email protected]
http://www.rtems.org/mailman/listinfo/rtems-devel