The header file "omap_gpio.h" has nice definitions for all of these bits in the form GPIO_x_y where x = 0,1,2,3 and y = 0..31. Also there are definitions based on numbering on the P8 and P9 headers. So the following are ways to specify a bit:
USER_LED0 USER_LED1 USER_LED2 USER_LED3 GPIO_2_22 GPIO_P8_25 GPIO_P9_22These bit definitions can be passed to the following routines.
gpio_in_init ( bit ) - set up bit for input.
gpio_read_bit ( bit ) - read the value from a bit.
gpio_out_init ( bit ) - set up bit for output.
gpio_set_bit ( bit ) - clear an output bit.
gpio_clear_bit ( bit ) - set an output bit. Note that the user LED bits are already set up as outputs and can simply be set or cleared. Also they can all be set or cleared at once using:
gpio_led_set ( val ) - where val = 0 clears all LEDs. And that is pretty much all you need to know about reading and writing the GPIO bits. Getting them to do fancy stuff like generate interrupts is not supported yet.
Kyu / [email protected]