1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/esp32/periph
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
..
adc_arch_esp32.c Merge pull request #18333 from gschorcht/cpu/esp32/cleanups_to_reduce_vera_warnings 2022-07-20 15:08:55 +02:00
adc_arch_esp32c3.c cpu/esp32: add ESP32-C3 support in peripheral drivers 2022-08-05 22:26:22 +02:00
adc_arch_esp32s2.c cpu/esp32: add ESP32-S2 support in peripheral drivers 2022-08-29 17:19:39 +02:00
adc_arch_esp32s3.c cpu/esp32: add ESP32-S3 support in peripheral drivers 2022-08-17 02:04:07 +02:00
adc.c cpu/esp32: fix compilation with gcc 12.2 2023-04-17 07:32:48 +02:00
can.c cpu/esp32: fix compilation of esp_can 2023-05-11 07:22:52 +02:00
cpuid.c cpu/esp32: port periph/cpu_id to ESP-IDF read_mac 2022-06-28 16:09:03 +02:00
dac.c cpu/esp32: remove ESP-IDF dac interface API 2023-03-27 03:10:56 +02:00
flashpage.c cpu/esp32: fix compilation with gcc 12.2 2023-04-17 07:32:48 +02:00
gpio_arch_esp32.c cpu/esp_common: replace FLASH_MODE_* by CONFIG_*FLASHMODE_* defines 2022-08-01 15:17:33 +02:00
gpio_arch_esp32c3.c cpu/esp32: add ESP32-C3 support in peripheral drivers 2022-08-05 22:26:22 +02:00
gpio_arch_esp32s2.c cpu/esp32: add ESP32-S2 support in peripheral drivers 2022-08-29 17:19:39 +02:00
gpio_arch_esp32s3.c cpu/esp32: add ESP32-S3 support in peripheral drivers 2022-08-17 02:04:07 +02:00
gpio_ll_irq.c drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
gpio_ll.c drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
gpio.c cpu/esp32: fix compilation with gcc 12.2 2023-04-17 07:32:48 +02:00
hwrng.c cpu/esp_common: port periph/hwrng to ESP-IDF random API 2022-06-30 11:10:02 +02:00
i2c_hw.c cpu/esp32: add ESP32-S3 support in peripheral drivers 2022-08-17 02:04:07 +02:00
Kconfig *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
Makefile cpu/esp32: extend file names of CPU specific files by CPU family 2022-07-18 17:08:34 +02:00
pm.c cpu/esp32: port periph/pm to ESP-IDF sleep API 2022-07-15 16:33:16 +02:00
pwm.c cpu/esp32/periph/pwm.c: fix format specifier 2023-05-10 13:02:47 +02:00
rtt_hw_rtc.c cpu/esp32: fix compilation with gcc 12.2 2023-04-17 07:32:48 +02:00
rtt_hw_sys.c cpu/esp32: port periph/rtt_hw_sys to ESP-IDF timer HAL 2022-06-29 08:37:43 +02:00
rtt.c cpu/esp32: fix compilation with gcc 12.2 2023-04-17 07:32:48 +02:00
sdmmc.c cpu/esp32: add SDMMC support 2024-01-05 07:22:27 +01:00
spi.c cpu/esp32: remove ESP-IDF periph_ctrl interface API 2023-03-27 03:10:56 +02:00
timer.c cpu/esp32: fix compilation of esp_hw_counter 2023-05-11 06:56:36 +02:00