/* * $Id: gpio.h,v 1.1 2007/11/15 20:32:32 nbrk Exp $ */ #ifndef _SYS_GPIO_H #define _SYS_GPIO_H #include /* * General Purpose Input/Output */ /* gpio pin flags */ #define GPIO_PIN_INPUT 0x00 /* configured as input */ #define GPIO_PIN_OUTPUT 0x01 /* configured as output */ struct gpio_pin { uint32_t gp_pinno; /* pin number */ uint8_t gp_pio; /* driven by PIO (1) or by Peripherals (0) */ uint8_t gp_flags; /* pin flags */ uint8_t gp_value; /* pin value (0 or 1) */ }; /* each gpio controller should provide us with this */ struct gpio_controller { uint8_t (*gc_pinread)(void *selfdd, uint32_t pin); void (*gc_pinwrite)(void *selfdd, uint32_t pin, uint8_t data); void (*gc_pinset)(void *selfdd, struct gpio_pin state); struct gpio_pin (*gc_pinget)(void *selfdd, uint32_t pin); uint32_t gc_npins; /* total number of pins */ void *gc_selfdd; /* controller's dv_devdata */ }; #endif /* not _SYS_GPIO_H */