1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 01:09:47 +01:00
RIOT/tests/bench
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
..
msg_pingpong treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
mutex_pingpong treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
periph_gpio_ll drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
runtime_coreapis examples, tests: Changes for the native64 board 2024-02-05 22:02:14 +01:00
sched_nop examples and tests: add atmega8 to relevent Makefile.ci 2023-07-11 21:22:02 +02:00
sizeof_coretypes tests: Use size_t print format specifier 2023-12-21 12:02:37 +01:00
sys_atomic_utils *app.config.test*: Remove kconfig dep files 2024-03-26 14:53:35 +01:00
sys_base64 examples and tests: add atmega8 to relevent Makefile.ci 2023-07-11 21:22:02 +02:00
thread_flags_pingpong treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
thread_yield_pingpong treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
timers examples, tests: Changes for the native64 board 2024-02-05 22:02:14 +01:00
xtimer boards/weact-g030f6: add new board 2024-02-05 00:45:42 +01:00
xtimer_load treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
ztimer boards/weact-g030f6: add new board 2024-02-05 00:45:42 +01:00
Makefile.bench_common tests: move bench_ applications to bench/ subdirectory 2023-05-10 09:49:56 +02:00