From 2dcaada25a1e749759a833fd27776b3b50f6e9ab Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Tue, 23 Feb 2010 17:08:43 -0500 Subject: [PATCH] led and gpio cleanup --- libmc1322x/include/gpio.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 libmc1322x/include/gpio.h diff --git a/libmc1322x/include/gpio.h b/libmc1322x/include/gpio.h new file mode 100644 index 000000000..c91fd89fe --- /dev/null +++ b/libmc1322x/include/gpio.h @@ -0,0 +1,30 @@ +#ifndef GPIO_H +#define GPIO_H + +#define GPIO_PAD_DIR0 ((volatile uint32_t *) 0x80000000) + +#define GPIO_PAD_DIR0 ((volatile uint32_t *) 0x80000000) +#define GPIO_DATA0 ((volatile uint32_t *) 0x80000008) +#define GPIO_FUNC_SEL0 ((volatile uint32_t *) 0x80000018) /* GPIO 15 - 0; 2 bit blocks */ +#define GPIO_PAD_PU_SEL0 ((volatile uint32_t *) 0x80000030) +#define GPIO_PAD_PU_SEL1 ((volatile uint32_t *) 0x80000034) +#define GPIO_PAD_PU_EN0 ((volatile uint32_t *) 0x80000010) +#define GPIO_PAD_PU_EN1 ((volatile uint32_t *) 0x80000014) + +/* select pullup or pulldown for GPIO 0-31 (b=0-31) */ +#define gpio_sel0_pullup(b) (set_bit(reg32(GPIO_PAD_PU_SEL0),b)) +#define gpio_sel0_pulldown(b) (clear_bit(reg32(GPIO_PAD_PU_SEL0),b)) + +/* select pullup or pulldown for GPIO 32-63 (b=32-63) */ +#define gpio_sel1_pullup(b) (set_bit(reg32(GPIO_PAD_PU_SEL1),b-32)) +#define gpio_sel1_pulldown(b) (clear_bit(reg32(GPIO_PAD_PU_SEL1),b-32)) + +/* enable/disable pullup for GPIO 0-31 (b=0-31) */ +#define gpio_pu0_enable(b) (set_bit(reg32(GPIO_PAD_PU_EN0),b)) +#define gpio_pu0_disable(b) (clear_bit(reg32(GPIO_PAD_PU_EN0),b)) + +/* enable/disable pullup for GPIO 32-63 (b=32-63) */ +#define gpio_pu1_enable(b) (set_bit(reg32(GPIO_PAD_PU_EN1),b-32)) +#define gpio_pu1_disable(b) (clear_bit(reg32(GPIO_PAD_PU_EN1),b-32)) + +#endif