Go to the documentation of this file.
47 #define GPIO_PORT_SHIFT 3
48 #define GPIO_BITS_PER_PORT ( 1 << GPIO_PORT_SHIFT )
49 #define GPIO_BIT_MASK ( GPIO_BITS_PER_PORT - 1 )
58 #define PIN_MASK(n) ( 1 << (n) )
67 #define GPIO_NUM_TO_PORT_NUM(gpio_num) ( (gpio_num) >> GPIO_PORT_SHIFT )
76 #define GPIO_BIT_NUM(gpio_num) ( (gpio_num) & GPIO_BIT_MASK )
86 #define GPIO_PXX_TO_NUM(port_num, bit_num) ( ((port_num) << GPIO_PORT_SHIFT) | (bit_num) )
95 #define GPIO_NUM_TO_DEV(gpio_num) ( GPIO_A + GPIO_NUM_TO_PORT_NUM(gpio_num) )
102 #define gpio_hardware_control(gpio_num) ( GPIO_NUM_TO_DEV(gpio_num)->AFSEL |= PIN_MASK(GPIO_BIT_NUM(gpio_num)) )
109 #define gpio_software_control(gpio_num) ( GPIO_NUM_TO_DEV(gpio_num)->AFSEL &= ~PIN_MASK(GPIO_BIT_NUM(gpio_num)) )
116 #define gpio_dir_output(gpio_num) ( GPIO_NUM_TO_DEV(gpio_num)->DIR |= PIN_MASK(GPIO_BIT_NUM(gpio_num)) )
123 #define gpio_dir_input(gpio_num) ( GPIO_NUM_TO_DEV(gpio_num)->DIR &= ~PIN_MASK(GPIO_BIT_NUM(gpio_num)) )
130 #define cc2538_gpio_read(gpio_num) ( (GPIO_NUM_TO_DEV(gpio_num)->DATA >> GPIO_BIT_NUM(gpio_num)) & 1 )
137 #define cc2538_gpio_clear(gpio_num) ( GPIO_NUM_TO_DEV(gpio_num)->DATA &= ~PIN_MASK(GPIO_BIT_NUM(gpio_num)) )
214 #define GPIO_BASE (0x400d9000)
220 #define GPIO_PORTNUM_SHIFT (12U)
221 #define GPIO_PORTNUM_MASK (0x00007000)
222 #define GPIO_PIN_MASK (0x00000007)
223 #define GPIO_PORT_MASK (0xfffff000)
231 #define GPIO_A ((cc2538_gpio_t *)0x400d9000)
232 #define GPIO_B ((cc2538_gpio_t *)0x400da000)
233 #define GPIO_C ((cc2538_gpio_t *)0x400db000)
234 #define GPIO_D ((cc2538_gpio_t *)0x400dc000)
308 OVERRIDE_DISABLE = 0x0,
309 OVERRIDE_ANALOG = 0x1,
310 OVERRIDE_PULLDOWN = 0x2,
311 OVERRIDE_PULLUP = 0x4,
312 OVERRIDE_ENABLE = 0x8,
321 #define IOC_OVERRIDE_OE 0x00000008
322 #define IOC_OVERRIDE_PUE 0x00000004
323 #define IOC_OVERRIDE_PDE 0x00000002
324 #define IOC_OVERRIDE_ANA 0x00000001
325 #define IOC_OVERRIDE_DIS 0x00000000
331 #define IOC ((cc2538_ioc_t *)0x400d4000)
339 #define IOC_PXX_OVER (IOC->OVER)
340 #define IOC_PXX_SEL (IOC->SEL)
cc2538_reg_t IE
GPIO_A Interrupt mask register.
cc2538_reg_t IC
GPIO_A Interrupt Clear register.
cc2538_reg_t AFSEL
GPIO_A Alternate Function / mode control select register.
cc2538_reg_t GPIOCR
GPIO_A Commit Register.
cc2538_reg_t PI_IEN
GPIO_A The Power-up Interrupt Enable register.
cc2538_reg_t P_EDGE_CTRL
GPIO_A The Port Edge Control register.
@ SSI1_FSS_IN
SSI1 FSS IN.
cc2538_reg_t PMUX
GPIO_A The PMUX register.
cc2538_reg_t IS
GPIO_A Interrupt Sense register.
@ SSI0_TX_SER
SSI0 STXSER EN.
cc2538_reg_t DIR
GPIO_A data direction register.
cc2538_ioc_over_t
Values to override pin configuration.
cc2538_reg_t IRQ_DETECT_UNMASK
GPIO_A IRQ Detect ACK for masked interrupts.
cc2538_reg_t RIS
GPIO_A Raw Interrupt Status register.
@ SSI0_CLK_OUT
SSI0 CLKOUT.
#define GPIO_PXX_TO_NUM(port_num, bit_num)
Generate a GPIO number given a port and bit number.
cc2538_reg_t GPIOLOCK
GPIO_A Lock register.
cc2538_reg_t IRQ_DETECT_ACK
GPIO_A IRQ Detect ACK register.
volatile uint32_t cc2538_reg_t
Least-significant 32 bits of the IEEE address.
cc2538_reg_t IEV
GPIO_A Interrupt Event Register.
@ SSI1_FSS_OUT
SSI1 FSSOUT.
@ SSI1_CLK_OUT
SSI1 CLKOUT.
GPIO port component registers.
cc2538_reg_t IBE
GPIO_A Interrupt Both-Edges register.
@ SSI0_CLK_IN
SSI0 CLK IN.
@ SSI0_FSS_OUT
SSI0 FSSOUT.
CC2538 MCU interrupt and register definitions.
cc2538_reg_t MIS
GPIO_A Masked Interrupt Status register.
cc2538_reg_t DATA
GPIO_A Data Register.
@ SSI1_TX_SER
SSI1 STXSER EN.
IOC port component registers.
cc2538_reg_t USB_IRQ_ACK
GPIO_A IRQ Detect ACK for USB.
@ SSI0_FSS_IN
SSI0 FSS IN.
@ SSI1_CLK_IN
SSI1 CLK IN.