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

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?


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.

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?


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  ?


Would appreciate some feedback on this.

--Andre Marques.
_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

_______________________________________________
rtems-devel mailing list
rtems-devel@rtems.org
http://www.rtems.org/mailman/listinfo/rtems-devel

Reply via email to