Well you haven't given any specifics here. Are you looking to do this in a programming language? If so, which one? Or are you looking to do this from a shell?
The best documentation that I've found for doing this in C is from the kernel documentation itself: Documentation/gpio.txt
. If I remember right, you must first request a GPIO pin (gpio_request()
), then set its direction (gpio_direction_input()
). If you want to send output, then you can just use gpio_set_value()
. If you want to receive input when the state changes, you can map the GPIO to an IRQ number (gpio_to_irq()
) and use that number with request_irq()
to set a handler. Finally, remember to call gpio_free()
to release the GPIO pin.
You may also find this documentation
to be a good reference, but it relies heavily on the sys filesystem rather than on the kernel API, so I'd suggest only using it to test GPIO access from a shell rather than in an actual program.