2013-02-06 15:46:21 +01:00
|
|
|
#ifndef __INCLUDE_GPIO_H__
|
|
|
|
#define __INCLUDE_GPIO_H__
|
|
|
|
|
|
|
|
struct gpio
|
|
|
|
{
|
|
|
|
int nr; /* GPIO number */
|
|
|
|
int mode; /* GPIO mode (input=0/output=1) */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GPIO_MODE_INPUT 0
|
|
|
|
#define GPIO_MODE_OUTPUT 1
|
|
|
|
|
2013-08-26 18:43:05 +02:00
|
|
|
int gpio_init(void);
|
2013-02-06 15:46:21 +01:00
|
|
|
|
|
|
|
/* request access to a gpio */
|
|
|
|
int gpio_claim(char *owner, int nr, struct gpio **gpio);
|
|
|
|
|
|
|
|
/* Configure the GPIO for a certain purpose */
|
|
|
|
int gpio_pin_mode(struct gpio *gpio, int mode);
|
|
|
|
|
|
|
|
/* Set the value for a GPIO */
|
|
|
|
int gpio_set(struct gpio *gpio, int value);
|
|
|
|
|
|
|
|
/* Read the current value of the GPIO */
|
|
|
|
int gpio_read(struct gpio *gpio, int *value);
|
|
|
|
|
|
|
|
/* Read and clear the value interrupt value of the GPIO */
|
|
|
|
int gpio_intr_read(struct gpio *gpio, int *value);
|
|
|
|
|
|
|
|
/* Interrupt hook */
|
|
|
|
int gpio_intr_message(message * m);
|
|
|
|
|
2013-08-26 18:43:05 +02:00
|
|
|
int gpio_release(void);
|
2013-02-06 15:46:21 +01:00
|
|
|
#endif /* __INCLUDE_GPIO_H__ */
|