Return to gpio.h CVS log | Up to [local] / funnyos / sys |
File: [local] / funnyos / sys / gpio.h (download)
Revision 1.1, Thu Nov 15 20:32:32 2007 UTC (16 years, 7 months ago) by nbrk
minimal General Purpose I/O uniform programming intefrace; many work on the road, but this code should be sufficient for now |
/* * $Id: gpio.h,v 1.1 2007/11/15 20:32:32 nbrk Exp $ */ #ifndef _SYS_GPIO_H #define _SYS_GPIO_H #include <sys/types.h> /* * 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 */