#ifndef hal_leon_gpio_h #define hal_leon_gpio_h /* Cesar project {{{ * * Copyright (C) 2009 Spidcom * * <<>> * * }}} */ /** * \file hal/leon/gpio.h * \brief Leon2 GPIO support. * \ingroup hal_leon */ /** GPIO base address. */ #define LEON_GPIO_BASE 0x800000a0 /** GPIO input/output. */ #define LEON_GPIO_PORT (* (volatile u32 *) (LEON_GPIO_BASE + 0x00)) /** GPIO direction, 1 for output. */ #define LEON_GPIO_DIR (* (volatile u32 *) (LEON_GPIO_BASE + 0x04)) /** GPIO interrupt register. */ #define LEON_GPIO_IT (* (volatile u32 *) (LEON_GPIO_BASE + 0x08)) /** GPIO interrupt configuration, following flags, or'ed. */ #define LEON_GPIO_IT_CONFIG(n, config) ((config) << ((n) * 8)) /** GPIO interrupt enabled. */ #define LEON_GPIO_IT_CONFIG_ENABLED 0x80 /** GPIO interrupt edge. */ #define LEON_GPIO_IT_CONFIG_EDGE 0x40 /** GPIO interrupt polarity. */ #define LEON_GPIO_IT_CONFIG_POL 0x20 /** Number of GPIO. */ #define LEON_GPIO_NB 16 /** GPIO pin functions base address, this is a hack as Leon is not supposed to * use those registers. */ #define LEON_RB_GPIO_CONFIG_BASE 0xc8040208 /** GPIO pin functions registers, set to 1 to connect pin to Leon GPIO. */ #define LEON_RB_GPIO_CONFIG(gpio) \ (((volatile u32 *) (LEON_RB_GPIO_CONFIG_BASE))[(gpio)]) /** GPIO debug registers, set to 1 to enable debug mode. */ #define LEON_RB_GPIO_DEBUG (* (volatile u32 *) (0xc8040248)) /** Interrupt numbers. */ #define LEON_GPIO_ITC1_IT(n) (4 + (n)) #endif /* hal_leon_gpio_h */