1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu
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
..
arm7_common boards/cpu: Add limited GBA boot support to RIOT 2024-04-10 17:06:14 +02:00
arm7tdmi_gba boards/cpu: Add limited GBA boot support to RIOT 2024-04-10 17:06:14 +02:00
atmega8 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
atmega32u4 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
atmega128rfa1 tree-wide: Introduce netif feature and use it 2024-05-22 10:39:56 +02:00
atmega256rfr2 tree-wide: Introduce netif feature and use it 2024-05-22 10:39:56 +02:00
atmega328p *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
atmega1281 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
atmega1284p *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
atmega2560 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
atmega_common drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
atxmega *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
avr8_common *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
cc26x0_cc13x0 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
cc26x2_cc13x2 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
cc26xx_cc13xx *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
cc2538 build system: add netif_openwsn feature 2024-05-27 22:56:37 +02:00
cortexm_common core/panic: don't use LOG_ functions in panic handler 2024-07-17 16:18:19 +02:00
efm32 drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
esp32 drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
esp8266 cpu/esp8266: fix issue found by static tests 2024-04-11 19:19:58 +02:00
esp_common treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
fe310 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
gd32v drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
kinetis cpu/kinetis/dist-check-fcfield.sh: minor fixes 2024-05-01 14:05:36 +02:00
lm4f120 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
lpc23xx Merge pull request #18093 from Ollrogge/remove_flashpage_free_funcs 2024-04-16 08:47:11 +00:00
lpc1768 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
msp430 cpu/msp430: implement power management 2024-04-26 15:52:41 +02:00
native cpu/native: Fix C11 atomic sizes for musl 2024-06-05 22:04:43 +02:00
nrf5x_common drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
nrf51 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
nrf52 build system: add netif_openwsn feature 2024-05-27 22:56:37 +02:00
nrf53 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
nrf9160 cpu/nrf9160: fix gpiote0 vector isr 2024-04-08 20:13:45 +02:00
qn908x *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
riscv_common Revert "cpu/riscv_common: extend flashpage API" 2024-04-04 17:37:16 +02:00
rpx0xx *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
sam0_common drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
sam3 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
sam_common cpu/sam_common: make use of cortexm.ld 2022-09-23 15:55:12 +02:00
samd5x cpu/samd5x: avoid the use of bitfield in periph 2024-06-29 13:26:51 +02:00
samd21 cpu/samd21: avoid the use of bitfield 2024-05-30 12:01:24 +02:00
saml1x cpu/saml1x: avoid the use of bitfield 2024-05-29 17:45:25 +02:00
saml21 cpu/saml21: avoid the use of bitfield 2024-05-30 17:29:00 +02:00
stellaris_common cpu: do not locally export compilation variables 2019-08-29 10:35:53 +02:00
stm32 drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
doc.txt docs/doxygen : Add CPU section 2021-07-09 10:47:42 +02:00
Kconfig *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00