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.

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)

To set a gpio pull resistor (either pull up/down or no pull resistor):

rtems_gpio_set_Pull (int gpio, int pull)

Some GPIO I/O:

rtems_gpio_set(int gpio)
rtems_gpio_clr (int gpio)
rtems_gpio_read_value (int gpio)

And interrupt management:

rtems_int_enable (int gpio, rtems_interrupt_level int)
rtems_int_disable (int gpio)
rtems_int_clear (int gpio)

Would appreciate some feedback on this.

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

Reply via email to