22#ifndef LIBBSP_ARM_LPC176X_GPIO_DEFS_H
23#define LIBBSP_ARM_LPC176X_GPIO_DEFS_H
32#define LPC176X_GPIO_BASE_ADDR 0x40028000U
33#define LPC176X_GPIO_INTERRUPT_STATUS 0x40028080U
35#define LPC176X_IOPIN0 ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR + \
37#define LPC176X_IOSET0 ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR + \
39#define LPC176X_IODIR0 ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR + \
41#define LPC176X_IOCLR0 ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR + \
43#define LPC176X_IOPIN1 ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR + \
45#define LPC176X_IOSET1 ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR + \
47#define LPC176X_IODIR1 ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR + \
49#define LPC176X_IOCLR1 ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR + \
53#define LPC176X_IO0_INT_EN_R ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR \
55#define LPC176X_IO0_INT_EN_F ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR \
57#define LPC176X_IO0_INT_STAT_R ( *(volatile uint32_t *) ( \
58 LPC176X_GPIO_BASE_ADDR \
60#define LPC176X_IO0_INT_STAT_F ( *(volatile uint32_t *) ( \
61 LPC176X_GPIO_BASE_ADDR \
63#define LPC176X_IO0_INT_CLR ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR \
65#define LPC176X_IO2_INT_EN_R ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR \
67#define LPC176X_IO2_INT_EN_F ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR \
69#define LPC176X_IO2_INT_STAT_R ( *(volatile uint32_t *) ( \
70 LPC176X_GPIO_BASE_ADDR \
72#define LPC176X_IO2_INT_STAT_F ( *(volatile uint32_t *) ( \
73 LPC176X_GPIO_BASE_ADDR \
75#define LPC176X_IO2_INT_CLR ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR \
77#define LPC176X_IO_INT_STAT ( *(volatile uint32_t *) ( LPC176X_GPIO_BASE_ADDR \
80#define LPC176X_RESERVED_ISR_FUNCT_SIZE 2U
81#define LPC176X_RESERVED_ISR_FUNCT_MAX_SIZE 5U
83#define LPC176X_MAX_PORT_NUMBER 160U
84#define LPC176X_SET_BIT( reg, pin, value ) \
85 reg = ( reg & ~( 1U << pin ) ) | ( ( value & 1U ) << pin )
87#define LPC176X_INT_STATUS ( *(volatile uint32_t *) \
88 ( LPC176X_GPIO_INTERRUPT_STATUS ) )
89#define LPC176X_INT_STATUS_P0 1U
90#define LPC176X_INT_STATUS_P2 ( 1U << 2U )
91#define LPC176X_INT_ENABLE 1U
92#define LPC176X_INT_DISABLE 0U
94#define LPC176X_IRQ_EINT_3 21U
96#define LPC176X_PIN_BIT( pin ) ( 1U << pin )
104 LPC176X_GPIO_FUNCTION_INPUT,
105 LPC176X_GPIO_FUNCTION_OUTPUT,
106 LPC176X_GPIO_FUNCTION_COUNT
116 LPC176X_GPIO_INTERRUPT_DISABLE,
117 LPC176X_GPIO_INTERRUPT_RISING,
118 LPC176X_GPIO_INTERRUPT_FALLING,
119 LPC176X_GPIO_INTERRUPT_BOTH,
120 LPC176X_GPIO_INTERRUPT_COUNT
134 LPC176X_GPIO_PORTS_COUNT
144 LPC176X_FIO0_BASE_ADDRESS = 0x2009C000U,
145 LPC176X_FIO1_BASE_ADDRESS = 0x2009C020U,
146 LPC176X_FIO2_BASE_ADDRESS = 0x2009C040U,
147 LPC176X_FIO3_BASE_ADDRESS = 0x2009C060U,
148 LPC176X_FIO4_BASE_ADDRESS = 0x2009C080U,
158 LPC176X_IO0_INT_BASE_ADDRESS = 0x40028084U,
159 LPC176X_IO2_INT_BASE_ADDRESS = 0x400280A4U,
Definitions types used by some devices in common.
uint32_t lpc176x_pin_number
A pin of the board.
Definition: common-types.h:32
lpc176x_gpio_direction
The direction of the GPIO port (input or output).
Definition: gpio-defs.h:103
lpc176x_gpio_ports
The ports for a GPIO.
Definition: gpio-defs.h:128
lpc176x_interrupt_address
Addresses for the two interrupts.
Definition: gpio-defs.h:157
lpc176x_gpio_address
Addresses for a GPIO.
Definition: gpio-defs.h:143
void(* lpc176x_gpio_interrupt_function)(const lpc176x_pin_number pin, const lpc176x_gpio_interrupt edge)
A function that attends an interrupt for GPIO.
Definition: gpio-defs.h:195
lpc176x_gpio_interrupt
The interrupt sources edge for a GPIO.
Definition: gpio-defs.h:115
GPIO Interrupt register map.
Definition: gpio-defs.h:165
volatile uint32_t EnF
Interrupt Enable for Falling edge.
Definition: gpio-defs.h:185
volatile uint32_t EnR
Interrupt Enable for Rising edge.
Definition: gpio-defs.h:181
volatile uint32_t Clr
Interrupt Clear.
Definition: gpio-defs.h:177
volatile uint32_t StatF
Interrupt Enable for Falling edge.
Definition: gpio-defs.h:173
volatile uint32_t StatR
Interrupt Enable for Rising edge.
Definition: gpio-defs.h:169
A registered interrupt function for the pin 'pin'.
Definition: gpio-defs.h:203
lpc176x_pin_number pin
Pin board.
Definition: gpio-defs.h:207
lpc176x_gpio_interrupt_function function
A function that attends an interrupt for 'pin'.
Definition: gpio-defs.h:211