Small GPIO driver that exports a few pins using a virtual file system. Currently the two user leds and the user button are exported. Change-Id: I001d017ae27cd17b635587873f7da981054da459
31 lines
724 B
C
31 lines
724 B
C
#ifndef __INCLUDE_GPIO_H__
|
|
#define __INCLUDE_GPIO_H__
|
|
|
|
struct gpio
|
|
{
|
|
int nr; /* GPIO number */
|
|
int mode; /* GPIO mode (input=0/output=1) */
|
|
void *data; /* data pointer (not used in the omap driver) */
|
|
};
|
|
|
|
#define GPIO_MODE_INPUT 0
|
|
#define GPIO_MODE_OUTPUT 1
|
|
|
|
struct gpio_driver
|
|
{
|
|
/* request access to a gpio */
|
|
int (*claim) (char *owner, int nr, struct gpio ** gpio);
|
|
|
|
/* Configure the GPIO for a certain purpose */
|
|
int (*pin_mode) (struct gpio * gpio, int mode);
|
|
|
|
/* Set the value for a GPIO */
|
|
int (*set) (struct gpio * gpio, int value);
|
|
|
|
/* Read the value of the GPIO */
|
|
int (*read) (struct gpio * gpio, int *value);
|
|
};
|
|
|
|
int omap_gpio_init(struct gpio_driver *gpio_driver);
|
|
#endif /* __INCLUDE_GPIO_H__ */
|