1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/stm32
Marian Buschsieweke 36e8526046
drivers/periph_gpio_ll: change API to access GPIO ports
The API was based on the assumption that GPIO ports are mapped in memory
sanely, so that a `GPIO_PORT(num)` macro would work allow for constant
folding when `num` is known and still be efficient when it is not.

Some MCUs, however, will need a look up tables to efficiently translate
GPIO port numbers to the port's base address. This will prevent the use
of such a `GPIO_PORT(num)` macro in constant initializers.

As a result, we rather provide `GPIO_PORT_0`, `GPIO_PORT_1`, etc. macros
for each GPIO port present (regardless of MCU naming scheme), as well as
`GPIO_PORT_A`, `GPIO_PORT_B`, etc. macros if (and only if) the MCU port
naming scheme uses letters rather than numbers.

These can be defined as macros to the peripheral base address even when
those are randomly mapped into the address space. In addition, a C
function `gpio_port()` replaces the role of the `GPIO_PORT()` and
`gpio_port_num()` the `GPIO_PORT_NUM()` macro. Those functions will
still be implemented as efficient as possible and will allow constant
folding where it was formerly possible. Hence, there is no downside for
MCUs with sane peripheral memory mapping, but it is highly beneficial
for the crazy ones.

There are also two benefits for the non-crazy MCUs:
1. We can now test for valid port numbers with `#ifdef GPIO_PORT_<NUM>`
    - This directly benefits the test in `tests/periph/gpio_ll`, which
      can now provide a valid GPIO port for each and every board
    - Writing to invalid memory mapped I/O addresses was treated as
      triggering undefined behavior by the compiler and used as a
      optimization opportunity
2. We can now detect at compile time if the naming scheme of the MCU
   uses letters or numbers, and produce more user friendly output.
    - This is directly applied in the test app
2024-08-02 09:55:24 +02:00
..
bootloader cpu/stm32: implement reset to bootloader 2020-06-05 18:41:06 +02:00
dist build-system: Allow out of tree BUILD_DIR 2023-05-16 22:23:03 +02:00
include drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
kconfigs *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
lcd_fmc *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ldscripts cpu/stm32: add FMC RAM as heap 2023-07-26 09:02:10 +02:00
periph drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
stmclk *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
vectors *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
cpu_common.c cpu/stm32: add missing include of cpu_common.c's header 2024-05-23 22:27:01 -04:00
cpu_init.c llvm: cpu/stm32: Fix unused function warning 2024-03-19 17:20:17 +01:00
doc.txt treewide/stm32: Make CLOCK_HS* configurable 2022-11-03 11:37:28 +01:00
Kconfig *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
Makefile cpu/stm32: add FMC support for LCD with parallel interface 2023-10-12 18:19:03 +02:00
Makefile.cmsis cpu/stm32: add CPU_FAM_STM32C0 support 2024-01-29 14:44:10 -05:00
Makefile.default cpu: make pm_layered a DEFAULT_MODULE 2021-01-27 13:21:20 +01:00
Makefile.dep cpu/stm32: add ADC support for WB55 2024-07-08 11:18:57 +02:00
Makefile.features *Makefile.features: Remove TEST_KCONFIG includes 2024-03-26 14:53:39 +01:00
Makefile.include cpu/stm32: add FMC RAM as heap 2023-07-26 09:02:10 +02:00
stm32_info.mk cpu/stm32: add CPU_FAM_STM32C0 support 2024-01-29 14:44:10 -05:00
stm32_line.mk cpu/stm32: add CPU_FAM_STM32C0 support 2024-01-29 14:44:10 -05:00
stm32_mem_lengths.mk cpu/stm32: add CPU_FAM_STM32C0 support 2024-01-29 14:44:10 -05:00
stm32_riotboot.mk cpu/stm32: fix riotboot settings for L4 and WB 2023-05-23 17:47:04 +02:00