38#if defined(CPU_FAM_STM32MP1)
39#define GPIO_PORT(num) (GPIOA_BASE + ((num) << 12))
41#define GPIO_PORT(num) (GPIOA_BASE + ((num) << 10))
47#if defined(CPU_FAM_STM32MP1)
48#define GPIO_PORT_NUM(port) (((port) - GPIOA_BASE) >> 12)
50#define GPIO_PORT_NUM(port) (((port) - GPIOA_BASE) >> 10)
55 GPIO_TypeDef *p = (GPIO_TypeDef *)port;
61 GPIO_TypeDef *p = (GPIO_TypeDef *)port;
67 GPIO_TypeDef *p = (GPIO_TypeDef *)port;
73 GPIO_TypeDef *p = (GPIO_TypeDef *)port;
77#if defined(GPIO_BRR_BR0) && !defined(CPU_FAM_STM32F4)
81 volatile uint16_t *brr = (
volatile uint16_t *)&(p->BSRR);
82 brr[1] = (uint16_t)mask;
88 GPIO_TypeDef *p = (GPIO_TypeDef *)port;
96 GPIO_TypeDef *p = (GPIO_TypeDef *)port;
102 return pin & 0xfffffff0LU;
117 if (port < GPIOA_BASE) {
Platform-independent access to architecture details.
Peripheral GPIO Low-Level API.
MAYBE_INLINE void irq_restore(unsigned state)
This function restores the IRQ disable bit in the status register to the value contained within passe...
MAYBE_INLINE unsigned irq_disable(void)
This function sets the IRQ disable bit in the status register.
static uint8_t gpio_get_pin_num(gpio_t pin)
Extract the pin number from a gpio_t
static void gpio_ll_set(gpio_port_t port, uword_t mask)
Perform an reg |= mask operation on the I/O register of the port.
static gpio_port_t gpio_port_pack_addr(void *addr)
Pack a pointer into a gpio_port_t.
static uword_t gpio_ll_read(gpio_port_t port)
Get the current input value of all GPIO pins of the given port as bitmask.
static gpio_port_t gpio_get_port(gpio_t pin)
Extract the gpio_port_t from a gpio_t
static void * gpio_port_unpack_addr(gpio_port_t port)
Extract a data pointer that was packed by gpio_port_pack_addr.
static bool is_gpio_port_num_valid(uint_fast8_t num)
Check if the given number is a valid argument for GPIO_PORT.
static uword_t gpio_ll_read_output(gpio_port_t port)
Get the current output value of all GPIO pins of the given port as bitmask.
static void gpio_ll_clear(gpio_port_t port, uword_t mask)
Perform an reg &= ~mask operation on the I/O register of the port.
static void gpio_ll_toggle(gpio_port_t port, uword_t mask)
Perform an reg ^= mask operation on the I/O register of the port.
static void gpio_ll_write(gpio_port_t port, uword_t state)
Perform a masked write operation on the I/O register of the port.
uintptr_t gpio_port_t
GPIO port type.
uint< NUM > _t uword_t
Word sized unsigned integer.
Shared CPU specific definitions for the STM32 family.