gpio.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00019 #ifndef __GPIO_H__
00020 #define __GPIO_H__
00021
00022 #include <types.h>
00023 #include <broadway.h>
00024
00025 typedef enum {
00026 GPIO_POWER = (1 << 0),
00027 GPIO_SHUTDOWN = (1 << 1),
00028 GPIO_FAN_SPEED = (1 << 2),
00029 GPIO_DC_DC = (1 << 3),
00030 GPIO_DI_SPIN = (1 << 4),
00031 GPIO_SLOT_LED = (1 << 5),
00032 GPIO_EJECT = (1 << 6),
00033 GPIO_SLOT_IN = (1 << 7),
00034 GPIO_SENSOR_BAR = (1 << 8),
00035 GPIO_DI_EJECT = (1 << 9),
00036 GPIO_EEP_CS = (1 << 10),
00037 GPIO_EEP_CLK = (1 << 11),
00038 GPIO_EEP_MOSI = (1 << 12),
00039 GPIO_EEP_MISO = (1 << 13),
00040 GPIO_AVE_CLK = (1 << 14),
00041 GPIO_AVE_DATA = (1 << 15),
00042 GPIO_DEBUG0 = (1 << 16),
00043 GPIO_DEBUG1 = (1 << 17),
00044 GPIO_DEBUG2 = (1 << 18),
00045 GPIO_DEBUG3 = (1 << 19),
00046 GPIO_DEBUG4 = (1 << 20),
00047 GPIO_DEBUG5 = (1 << 21),
00048 GPIO_DEBUG6 = (1 << 22),
00049 GPIO_DEBUG7 = (1 << 23),
00050 } gpio_pin_t;
00051
00059 int gpio_initialize(void);
00067 int gpio_shutdown(void);
00068
00074 gpio_pin_t gpio_read(void);
00075
00080 void gpio_write(gpio_pin_t gpios);
00081
00086 void gpio_set(gpio_pin_t gpios);
00087
00092 void gpio_clear(gpio_pin_t gpios);
00093
00099 void gpio_mask(gpio_pin_t setgpios, gpio_pin_t clrgpios);
00100
00105 void gpio_switch(gpio_pin_t gpios);
00106
00112 int gpio_direction(gpio_pin_t pin, int dir);
00113
00116 static inline void slotled_change(void)
00117 {
00118 flip32(HW_GPIO1B_OUT, GPIO_SLOT_LED);
00119 }
00120
00123 static inline void slotled_on(void)
00124 {
00125 set32(HW_GPIO1B_OUT, GPIO_SLOT_LED);
00126 }
00127
00130 static inline void slotled_off(void)
00131 {
00132 clear32(HW_GPIO1B_OUT, GPIO_SLOT_LED);
00133 }
00134
00137 static inline void shutdown(void)
00138 {
00139 set32(HW_GPIO1_OUT, GPIO_SHUTDOWN);
00140 }
00141
00142 #endif
00143