Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

drivers/periph_gpio_ll: change API to access GPIO ports #20639

Merged
merged 4 commits into from
Aug 2, 2024

Conversation

maribu
Copy link
Member

@maribu maribu commented Apr 29, 2024

Contribution description

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

Testing procedure

The test app in tests/periph/gpio_ll should still work.

Issues/PRs references

@maribu maribu added Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Apr 29, 2024
@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: tests Area: tests and testing framework Platform: AVR Platform: This PR/issue effects AVR-based platforms Area: drivers Area: Device drivers Area: boards Area: Board ports Platform: ESP Platform: This PR/issue effects ESP-based platforms Area: cpu Area: CPU/MCU ports labels Apr 29, 2024
@maribu maribu changed the title Drivers/periph gpio ll/api change drivers/periph_gpio_ll: change API to access GPIO ports Apr 29, 2024
@riot-ci
Copy link

riot-ci commented Apr 29, 2024

Murdock results

✔️ PASSED

4a09286 cpu/stm32/periph_eth: adapt to GPIO LL API change

Success Failures Total Runtime
10196 0 10196 15m:48s

Artifacts

@maribu
Copy link
Member Author

maribu commented Apr 29, 2024

ESP32

make BOARD=esp32-mh-et-live-minikit BUILD_IN_DOCKER=1 flash test-with-config
Launching build container using image "docker.io/riot/riotbuild:latest".
podman run --rm --tty --userns keep-id -v '/etc/zoneinfo/Europe/Berlin:/etc/localtime:ro' -v '/home/maribu/Repos/software/RIOT/master:/data/riotbuild/riotbase:delegated' -v '/home/maribu/.cargo/registry:/data/riotbuild/.cargo/registry:delegated' -v '/home/maribu/.cargo/git:/data/riotbuild/.cargo/git:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -v '/home/maribu/.cache/RIOT:/data/riotbuild/build:delegated' -e 'BUILD_DIR=/data/riotbuild/build' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'    -v '/home/maribu/Repos/software/boards/riot:/data/riotbuild/external/riot:delegated' -v '/home/maribu/Repos/software/miot-pcbs/RIOT/boards:/data/riotbuild/external/boards:delegated'  -e 'BOARD=esp32-mh-et-live-minikit' -e 'DISABLE_MODULE=' -e 'DEFAULT_MODULE=test_utils_interactive_sync test_utils_print_stack_usage' -e 'FEATURES_REQUIRED=periph_gpio_ll' -e 'FEATURES_BLACKLIST=' -e 'FEATURES_OPTIONAL=periph_gpio_ll_irq periph_gpio_ll_irq_level_triggered_high periph_gpio_ll_irq_level_triggered_low' -e 'USEMODULE=ztimer_usec' -e 'USEPKG='  -w '/data/riotbuild/riotbase/tests/periph/gpio_ll/' 'docker.io/riot/riotbuild:latest' make 'BOARD=esp32-mh-et-live-minikit'  'EXTERNAL_BOARD_DIRS=/data/riotbuild/external/riot /data/riotbuild/external/boards'  
Building application "tests_gpio_ll" for "esp32-mh-et-live-minikit" with CPU "esp32".

"make" -C /data/riotbuild/riotbase/pkg/esp32_sdk/ 
"make" -C /data/riotbuild/riotbase/boards/common/init
"make" -C /data/riotbuild/riotbase/boards/esp32-mh-et-live-minikit
"make" -C /data/riotbuild/riotbase/boards/common/esp32
"make" -C /data/riotbuild/riotbase/boards/common/esp32x
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/core/lib
"make" -C /data/riotbuild/riotbase/cpu/esp32
"make" -C /data/riotbuild/riotbase/cpu/esp32/bootloader
esptool.py v3.2-dev
Merged 1 ELF section
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf/common
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf/efuse
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf/gpio
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf-api
"make" -C /data/riotbuild/riotbase/cpu/esp32/freertos
"make" -C /data/riotbuild/riotbase/cpu/esp32/periph
"make" -C /data/riotbuild/riotbase/cpu/esp_common
"make" -C /data/riotbuild/riotbase/cpu/esp_common/esp-xtensa
"make" -C /data/riotbuild/riotbase/cpu/esp_common/freertos
"make" -C /data/riotbuild/riotbase/cpu/esp_common/periph
"make" -C /data/riotbuild/riotbase/cpu/esp_common/vendor
"make" -C /data/riotbuild/riotbase/cpu/esp_common/vendor/xtensa
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/div
"make" -C /data/riotbuild/riotbase/sys/frac
"make" -C /data/riotbuild/riotbase/sys/isrpipe
"make" -C /data/riotbuild/riotbase/sys/libc
"make" -C /data/riotbuild/riotbase/sys/luid
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/preprocessor
"make" -C /data/riotbuild/riotbase/sys/random
"make" -C /data/riotbuild/riotbase/sys/stdio
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
"make" -C /data/riotbuild/riotbase/sys/test_utils/interactive_sync
"make" -C /data/riotbuild/riotbase/sys/test_utils/print_stack_usage
"make" -C /data/riotbuild/riotbase/sys/tsrb
"make" -C /data/riotbuild/riotbase/sys/ztimer
esptool.py v3.2-dev
Merged 1 ELF section
Parsing CSV input...
   text	  data	   bss	   dec	   hex	filename
  69481	 14388	  6774	 90643	 16213	/data/riotbuild/riotbase/tests/periph/gpio_ll/bin/esp32-mh-et-live-minikit/tests_gpio_ll.elf
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 --before default_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 /home/maribu/Repos/software/RIOT/master/tests/periph/gpio_ll/bin/esp32-mh-et-live-minikit/esp_bootloader/bootloader.bin 0x8000 /home/maribu/Repos/software/RIOT/master/tests/periph/gpio_ll/bin/esp32-mh-et-live-minikit/partitions.bin 0x10000 /home/maribu/Repos/software/RIOT/master/tests/periph/gpio_ll/bin/esp32-mh-et-live-minikit/tests_gpio_ll.elf.bin
esptool.py v4.7.0
Serial port /dev/ttyUSB0
Connecting.....
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 24:62:ab:de:6d:74
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x0002bfff...
Warning: Image file at 0x1000 is protected with a hash checksum, so not changing the flash size setting. Use the --flash_size=keep option instead of --flash_size=4MB in order to remove this warning, or use the --dont-append-digest option for the elf2image command in order to generate an image file without a hash checksum
Compressed 17488 bytes to 11680...
Wrote 17488 bytes (11680 compressed) at 0x00001000 in 0.6 seconds (effective 240.7 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 85...
Wrote 3072 bytes (85 compressed) at 0x00008000 in 0.0 seconds (effective 581.6 kbit/s)...
Hash of data verified.
Compressed 113456 bytes to 52854...
Wrote 113456 bytes (52854 compressed) at 0x00010000 in 1.9 seconds (effective 483.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
r
/home/maribu/Repos/software/RIOT/master/dist/tools/pyterm/pyterm -p "/dev/ttyUSB0" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyUSB0
Welcome to pyterm!
Type '/exit' to exit.
READY
s
START
main(): This is RIOT! (Version: 2024.07-devel-111-g9dc93-drivers/periph_gpio_ll/api-change)
Test / Hardware Details:
========================
Cabling:
(INPUT -- OUTPUT)
  P0.2 -- P0.23
  P0.4 -- P0.19
Number of pull resistor values supported: 1
Number of drive strengths supported: 4
Number of slew rates supported: 1
Valid GPIO ports:
- PORT 0 (PORT A)
- PORT 1 (PORT B)

Testing gpio_port_pack_addr()
=============================

All OK

Testing gpip_ng_init()
======================

Testing is_gpio_port_num_valid() is true for PORT_OUT and PORT_IN:

Testing input configurations for PIN_IN_0:
Support for input with pull up: yes
state: in, pull: up, value: on, drive: weakest
Support for input with pull down: yes
state: in, pull: down, value: off, drive: weakest
Support for input with pull to bus level: no
Support for floating input (no pull resistors): yes
state: in, pull: none, value: off, drive: weakest

Testing output configurations for PIN_OUT_0:
Support for output (push-pull) with initial value of LOW: yes
state: out-pp, value: off, drive: weakest
Output is indeed LOW: yes
state: out-pp, value: on, drive: weakest
Output can be pushed HIGH: yes
Support for output (push-pull) with initial value of HIGH: yes
state: out-pp, value: on, drive: weakest
Output is indeed HIGH: yes
Support for output (open drain with pull up) with initial value of LOW: yes
state: out-od, pull: up, value: off, drive: weakest
Output is indeed LOW: yes
Support for output (open drain with pull up) with initial value of HIGH: yes
state: out-od, pull: up, value: on, drive: weakest
Output is indeed HIGH: yes
Support for output (open drain) with initial value of LOW: yes
state: out-od, pull: none, value: off, drive: weakest
Output is indeed LOW: yes
Support for output (open drain) with initial value of HIGH: yes
state: out-od, pull: none, value: on, drive: weakest
state: in, pull: down, value: off, drive: weakest
Output can indeed be pulled LOW: yes
state: in, pull: up, value: on, drive: weakest
Output can indeed be pulled HIGH: yes
Support for output (open source) with initial value of LOW: no
Support for output (open source) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of LOW: no

Support for disconnecting GPIO: yes
state: off, pull: none, value: off, drive: weakest
Output can indeed be pulled LOW: yes
Output can indeed be pulled HIGH: yes

Testing Reading/Writing GPIO Ports
==================================

testing initial value of 0 after init
...OK
testing setting both outputs_optional simultaneously
...OK
testing clearing both outputs_optional simultaneously
...OK
testing toggling first output (0 --> 1)
...OK
testing toggling first output (1 --> 0)
...OK
testing toggling second output (0 --> 1)
...OK
testing toggling second output (1 --> 0)
...OK
testing setting first output and clearing second with write
...OK
testing setting second output and clearing first with write
...OK
All input/output operations worked as expected

Testing External IRQs
=====================

Testing rising edge on PIN_IN_0
... OK
Testing falling edge on PIN_IN_0
... OK
Testing both edges on PIN_IN_0
... OK
Testing masking of IRQs (still both edges on PIN_IN_0)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK


TEST SUCCEEDED

@maribu maribu force-pushed the drivers/periph_gpio_ll/api-change branch from 9dc939a to cc1b7a1 Compare April 29, 2024 19:43
@maribu
Copy link
Member Author

maribu commented Apr 29, 2024

STM32

make BOARD=nucleo-f429zi flash test-with-config                              
Building application "tests_gpio_ll" for "nucleo-f429zi" with CPU "stm32".

"make" -C /home/maribu/Repos/software/RIOT/master/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/master/boards/nucleo-f429zi
"make" -C /home/maribu/Repos/software/RIOT/master/boards/common/nucleo
"make" -C /home/maribu/Repos/software/RIOT/master/core
"make" -C /home/maribu/Repos/software/RIOT/master/core/lib
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/periph
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/stmclk
"make" -C /home/maribu/Repos/software/RIOT/master/cpu/stm32/vectors
"make" -C /home/maribu/Repos/software/RIOT/master/drivers
"make" -C /home/maribu/Repos/software/RIOT/master/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/master/sys
"make" -C /home/maribu/Repos/software/RIOT/master/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/master/sys/div
"make" -C /home/maribu/Repos/software/RIOT/master/sys/frac
"make" -C /home/maribu/Repos/software/RIOT/master/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/master/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/master/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/master/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/master/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/master/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/master/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/master/sys/tsrb
"make" -C /home/maribu/Repos/software/RIOT/master/sys/ztimer
   text	  data	   bss	   dec	   hex	filename
  21440	   180	  2728	 24348	  5f1c	/home/maribu/Repos/software/RIOT/master/tests/periph/gpio_ll/bin/nucleo-f429zi/tests_gpio_ll.elf
/home/maribu/Repos/software/RIOT/master/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/master/tests/periph/gpio_ll/bin/nucleo-f429zi/tests_gpio_ll.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter serial' not 'hla_serial'
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : clock speed 2000 kHz
Info : STLINK V2J29M18 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.255790
Info : [stm32f4x.cpu] Cortex-M4 r0p1 processor detected
Info : [stm32f4x.cpu] target has 6 breakpoints, 4 watchpoints
Info : [stm32f4x.cpu] Examination succeed
Info : starting gdb server for stm32f4x.cpu on 0
Info : Listening on port 34307 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f4x.cpu       hla_target little stm32f4x.cpu       unknown
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
[stm32f4x.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800138c msp: 0x20000200
Info : device id = 0x20016419
Info : flash size = 2048 KiB
Info : Dual Bank 2048 kiB STM32F42x/43x/469/479 found
auto erase enabled
wrote 32768 bytes from file /home/maribu/Repos/software/RIOT/master/tests/periph/gpio_ll/bin/nucleo-f429zi/tests_gpio_ll.elf in 1.097200s (29.165 KiB/s)
verified 21620 bytes in 0.214806s (98.290 KiB/s)
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/master/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
��сtest, r to print it is ready
Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: 2024.07-devel-111-gcc1b7a1-drivers/periph_gpio_ll/api-change)
Test / Hardware Details:
========================
Cabling:
(INPUT -- OUTPUT)
  PPD0 -- PC0
  PPD1 -- PC3
Number of pull resistor values supported: 1
Number of drive strengths supported: 1
Number of slew rates supported: 4
Valid GPIO ports:
- PORT 0 (PORT A)
- PORT 1 (PORT B)
- PORT 2 (PORT C)
- PORT 3 (PORT D)
- PORT 4 (PORT E)
- PORT 5 (PORT F)
- PORT 6 (PORT G)
- PORT 7 (PORT H)
- PORT 8 (PORT I)
- PORT 9 (PORT J)
- PORT 10 (PORT K)

Testing gpio_port_pack_addr()
=============================

All OK

Testing gpip_ng_init()
======================

Testing is_gpio_port_num_valid() is true for PORT_OUT and PORT_IN:

Testing input configurations for PIN_IN_0:
Support for input with pull up: yes
state: in, pull: up, value: on, slew: slowest
Support for input with pull down: yes
state: in, pull: down, value: off, slew: slowest
Support for input with pull to bus level: no
Support for floating input (no pull resistors): yes
state: in, pull: none, value: off, slew: slowest

Testing output configurations for PIN_OUT_0:
Support for output (push-pull) with initial value of LOW: yes
state: out-pp, value: off, slew: slowest
Output is indeed LOW: yes
state: out-pp, value: on, slew: slowest
Output can be pushed HIGH: yes
Support for output (push-pull) with initial value of HIGH: yes
state: out-pp, value: on, slew: slowest
Output is indeed HIGH: yes
Support for output (open drain with pull up) with initial value of LOW: yes
state: out-od, pull: up, value: off, slew: slowest
Output is indeed LOW: yes
Support for output (open drain with pull up) with initial value of HIGH: yes
state: out-od, pull: up, value: on, slew: slowest
Output is indeed HIGH: yes
Support for output (open drain) with initial value of LOW: yes
state: out-od, pull: none, value: off, slew: slowest
Output is indeed LOW: yes
Support for output (open drain) with initial value of HIGH: yes
state: out-od, pull: none, value: on, slew: slowest
state: in, pull: down, value: off, slew: slowest
Output can indeed be pulled LOW: yes
state: in, pull: up, value: off, slew: slowest
Output can indeed be pulled HIGH: yes
Support for output (open source) with initial value of LOW: no
Support for output (open source) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of LOW: no

Support for disconnecting GPIO: yes
state: off, pull: none, value: off, slew: slowest
Output can indeed be pulled LOW: yes
Output can indeed be pulled HIGH: yes

Testing Reading/Writing GPIO Ports
==================================

testing initial value of 0 after init
...OK
testing setting both outputs_optional simultaneously
...OK
testing clearing both outputs_optional simultaneously
...OK
testing toggling first output (0 --> 1)
...OK
testing toggling first output (1 --> 0)
...OK
testing toggling second output (0 --> 1)
...OK
testing toggling second output (1 --> 0)
...OK
testing setting first output and clearing second with write
...OK
testing setting second output and clearing first with write
...OK
All input/output operations worked as expected

Testing External IRQs
=====================

Testing rising edge on PIN_IN_0
... OK
Testing falling edge on PIN_IN_0
... OK
Testing both edges on PIN_IN_0
... OK
Testing masking of IRQs (still both edges on PIN_IN_0)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK


TEST SUCCEEDED

@maribu maribu force-pushed the drivers/periph_gpio_ll/api-change branch 4 times, most recently from ae64e85 to 09e8d9e Compare April 30, 2024 19:45
@maribu maribu force-pushed the drivers/periph_gpio_ll/api-change branch 2 times, most recently from 3995f78 to f928b46 Compare August 1, 2024 19:43
@maribu
Copy link
Member Author

maribu commented Aug 1, 2024

Redoing the tests:

STM32

git:(drivers/periph_gpio_ll/api-change) ~/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll ➜ make BOARD=nucleo-f767zi flash test-with-config 
Building application "tests_gpio_ll" for "nucleo-f767zi" with CPU "stm32".

"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/nucleo-f767zi
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/common/nucleo
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core/lib
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/stm32
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/stm32/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/stm32/stmclk
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/stm32/vectors
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/div
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/frac
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/tsrb
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/ztimer
   text	  data	   bss	   dec	   hex	filename
  21496	   180	  2720	 24396	  5f4c	/home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/nucleo-f767zi/tests_gpio_ll.elf
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/nucleo-f767zi/tests_gpio_ll.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
DEPRECATED! use 'adapter serial' not 'hla_serial'
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : clock speed 2000 kHz
Info : STLINK V2J38M27 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.247244
Info : [stm32f7x.cpu] Cortex-M7 r1p0 processor detected
Info : [stm32f7x.cpu] target has 8 breakpoints, 4 watchpoints
Info : [stm32f7x.cpu] Examination succeed
Info : starting gdb server for stm32f7x.cpu on 0
Info : Listening on port 43771 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f7x.cpu       hla_target little stm32f7x.cpu       unknown
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
[stm32f7x.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08001194 msp: 0x20000200
Info : device id = 0x10016451
Info : flash size = 2048 KiB
Info : Single Bank 2048 kiB STM32F76x/77x found
auto erase enabled
wrote 32768 bytes from file /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/nucleo-f767zi/tests_gpio_ll.elf in 0.786669s (40.678 KiB/s)
verified 21676 bytes in 0.173315s (122.136 KiB/s)
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" -ln "/tmp/pyterm-maribu" -rn "2024-08-01_20.39.01-tests_gpio_ll-nucleo-f767zi" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
�!r to print it is ready
Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: 2024.10-devel-11-g3995f7-drivers/periph_gpio_ll/api-change)
Test / Hardware Details:
========================
Cabling:
(INPUT -- OUTPUT)
  PD0 -- PG0
  PD1 -- PG1
Number of pull resistor values supported: 1
Number of drive strengths supported: 1
Number of slew rates supported: 4
Valid GPIO ports:
- PORT 0 (PORT A)
- PORT 1 (PORT B)
- PORT 2 (PORT C)
- PORT 3 (PORT D)
- PORT 4 (PORT E)
- PORT 5 (PORT F)
- PORT 6 (PORT G)
- PORT 7 (PORT H)
- PORT 8 (PORT I)
- PORT 9 (PORT J)
- PORT 10 (PORT K)

Testing gpio_port_pack_addr()
=============================

All OK

Testing gpip_ng_init()
======================

Testing is_gpio_port_num_valid() is true for PORT_OUT and PORT_IN:

Testing input configurations for PIN_IN_0:
Support for input with pull up: yes
state: in, pull: up, value: on, slew: slowest
Support for input with pull down: yes
state: in, pull: down, value: off, slew: slowest
Support for input with pull to bus level: no
Support for floating input (no pull resistors): yes
state: in, pull: none, value: off, slew: slowest

Testing output configurations for PIN_OUT_0:
Support for output (push-pull) with initial value of LOW: yes
state: out-pp, value: off, slew: slowest
Output is indeed LOW: yes
state: out-pp, value: on, slew: slowest
Output can be pushed HIGH: yes
Support for output (push-pull) with initial value of HIGH: yes
state: out-pp, value: on, slew: slowest
Output is indeed HIGH: yes
Support for output (open drain with pull up) with initial value of LOW: yes
state: out-od, pull: up, value: off, slew: slowest
Output is indeed LOW: yes
Support for output (open drain with pull up) with initial value of HIGH: yes
state: out-od, pull: up, value: on, slew: slowest
Output is indeed HIGH: yes
Support for output (open drain) with initial value of LOW: yes
state: out-od, pull: none, value: off, slew: slowest
Output is indeed LOW: yes
Support for output (open drain) with initial value of HIGH: yes
state: out-od, pull: none, value: on, slew: slowest
state: in, pull: down, value: off, slew: slowest
Output can indeed be pulled LOW: yes
state: in, pull: up, value: off, slew: slowest
Output can indeed be pulled HIGH: yes
Support for output (open source) with initial value of LOW: no
Support for output (open source) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of LOW: no

Support for disconnecting GPIO: yes
state: off, pull: none, value: off, slew: slowest
Output can indeed be pulled LOW: yes
Output can indeed be pulled HIGH: yes

Testing Reading/Writing GPIO Ports
==================================

testing initial value of 0 after init
...OK
testing setting both outputs_optional simultaneously
...OK
testing clearing both outputs_optional simultaneously
...OK
testing toggling first output (0 --> 1)
...OK
testing toggling first output (1 --> 0)
...OK
testing toggling second output (0 --> 1)
...OK
testing toggling second output (1 --> 0)
...OK
testing setting first output and clearing second with write
...OK
testing setting second output and clearing first with write
...OK
All input/output operations worked as expected

Testing External IRQs
=====================

Testing rising edge on PIN_IN_0
... OK
Testing falling edge on PIN_IN_0
... OK
Testing both edges on PIN_IN_0
... OK
Testing masking of IRQs (still both edges on PIN_IN_0)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK


TEST SUCCEEDED

ESP32

git:(drivers/periph_gpio_ll/api-change) ~/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll ➜ make BOARD=esp32-mh-et-live-minikit BUILD_IN_DOCKER=1 flash test-with-config
Launching build container using image "sha256:f5951bc41dfface6cac869181d703e62cbdd3b7976b0946130a38f2e658000b3".
podman run --rm --tty --userns keep-id -v '/etc/zoneinfo/Europe/Berlin:/etc/localtime:ro' -v '/home/maribu/Repos/software/RIOT/gpio_ll:/data/riotbuild/riotbase:delegated' -v '/home/maribu/.cargo/registry:/data/riotbuild/.cargo/registry:delegated' -v '/home/maribu/.cargo/git:/data/riotbuild/.cargo/git:delegated' -e 'RIOTBASE=/data/riotbuild/riotbase' -e 'CCACHE_BASEDIR=/data/riotbuild/riotbase' -v '/home/maribu/.cache/RIOT:/data/riotbuild/build:delegated' -e 'BUILD_DIR=/data/riotbuild/build' -e 'BUILD_IN_DOCKER=/data/riotbuild/riotbase/tests/periph/gpio_ll/1' -e 'RIOTPROJECT=/data/riotbuild/riotbase' -e 'RIOTCPU=/data/riotbuild/riotbase/cpu' -e 'RIOTBOARD=/data/riotbuild/riotbase/boards' -e 'RIOTMAKE=/data/riotbuild/riotbase/makefiles'    -v '/home/maribu/Repos/software/boards/riot:/data/riotbuild/external/riot:delegated' -v '/home/maribu/Repos/software/miot-pcbs/RIOT/boards:/data/riotbuild/external/boards:delegated' -v '/home/maribu/Repos/software/RIOT/master/.git:/home/maribu/Repos/software/RIOT/master/.git:delegated' -e 'BOARD=esp32-mh-et-live-minikit' -e 'DISABLE_MODULE=' -e 'DEFAULT_MODULE=test_utils_interactive_sync test_utils_print_stack_usage' -e 'FEATURES_REQUIRED=periph_gpio_ll' -e 'FEATURES_BLACKLIST=' -e 'FEATURES_OPTIONAL=periph_gpio_ll_irq periph_gpio_ll_irq_level_triggered_high periph_gpio_ll_irq_level_triggered_low' -e 'USEMODULE=ztimer_usec' -e 'USEPKG='  -w '/data/riotbuild/riotbase/tests/periph/gpio_ll/' 'sha256:f5951bc41dfface6cac869181d703e62cbdd3b7976b0946130a38f2e658000b3' make 'BOARD=esp32-mh-et-live-minikit'  'EXTERNAL_BOARD_DIRS=/data/riotbuild/external/riot /data/riotbuild/external/boards'  
Building application "tests_gpio_ll" for "esp32-mh-et-live-minikit" with CPU "esp32".

"make" -C /data/riotbuild/riotbase/pkg/esp32_sdk/ 
"make" -C /data/riotbuild/riotbase/boards/common/init
"make" -C /data/riotbuild/riotbase/boards/esp32-mh-et-live-minikit
"make" -C /data/riotbuild/riotbase/boards/common/esp32
"make" -C /data/riotbuild/riotbase/boards/common/esp32x
"make" -C /data/riotbuild/riotbase/core
"make" -C /data/riotbuild/riotbase/core/lib
"make" -C /data/riotbuild/riotbase/cpu/esp32
"make" -C /data/riotbuild/riotbase/cpu/esp32/bootloader
esptool.py v3.2-dev
Merged 1 ELF section
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf/common
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf/efuse
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf/gpio
"make" -C /data/riotbuild/riotbase/cpu/esp32/esp-idf-api
"make" -C /data/riotbuild/riotbase/cpu/esp32/freertos
"make" -C /data/riotbuild/riotbase/cpu/esp32/periph
"make" -C /data/riotbuild/riotbase/cpu/esp_common
"make" -C /data/riotbuild/riotbase/cpu/esp_common/esp-xtensa
"make" -C /data/riotbuild/riotbase/cpu/esp_common/freertos
"make" -C /data/riotbuild/riotbase/cpu/esp_common/periph
"make" -C /data/riotbuild/riotbase/cpu/esp_common/vendor
"make" -C /data/riotbuild/riotbase/cpu/esp_common/vendor/xtensa
"make" -C /data/riotbuild/riotbase/drivers
"make" -C /data/riotbuild/riotbase/drivers/periph_common
"make" -C /data/riotbuild/riotbase/sys
"make" -C /data/riotbuild/riotbase/sys/auto_init
"make" -C /data/riotbuild/riotbase/sys/div
"make" -C /data/riotbuild/riotbase/sys/frac
"make" -C /data/riotbuild/riotbase/sys/isrpipe
"make" -C /data/riotbuild/riotbase/sys/libc
"make" -C /data/riotbuild/riotbase/sys/luid
"make" -C /data/riotbuild/riotbase/sys/newlib_syscalls_default
"make" -C /data/riotbuild/riotbase/sys/pm_layered
"make" -C /data/riotbuild/riotbase/sys/preprocessor
"make" -C /data/riotbuild/riotbase/sys/random
"make" -C /data/riotbuild/riotbase/sys/stdio
"make" -C /data/riotbuild/riotbase/sys/stdio_uart
"make" -C /data/riotbuild/riotbase/sys/test_utils/interactive_sync
"make" -C /data/riotbuild/riotbase/sys/test_utils/print_stack_usage
"make" -C /data/riotbuild/riotbase/sys/tsrb
"make" -C /data/riotbuild/riotbase/sys/ztimer
esptool.py v3.2-dev
Merged 1 ELF section
Parsing CSV input...
   text	  data	   bss	   dec	   hex	filename
  69369	 14388	  6774	 90531	 161a3	/data/riotbuild/riotbase/tests/periph/gpio_ll/bin/esp32-mh-et-live-minikit/tests_gpio_ll.elf
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 --before default_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/esp32-mh-et-live-minikit/esp_bootloader/bootloader.bin 0x8000 /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/esp32-mh-et-live-minikit/partitions.bin 0x10000 /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/esp32-mh-et-live-minikit/tests_gpio_ll.elf.bin
esptool.py v4.7.0
Serial port /dev/ttyUSB0
Connecting......
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: a4:cf:12:44:d4:80
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x0002bfff...
Warning: Image file at 0x1000 is protected with a hash checksum, so not changing the flash size setting. Use the --flash_size=keep option instead of --flash_size=4MB in order to remove this warning, or use the --dont-append-digest option for the elf2image command in order to generate an image file without a hash checksum
Compressed 17488 bytes to 11680...
Wrote 17488 bytes (11680 compressed) at 0x00001000 in 0.5 seconds (effective 292.0 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 85...
Wrote 3072 bytes (85 compressed) at 0x00008000 in 0.0 seconds (effective 617.6 kbit/s)...
Hash of data verified.
Compressed 113296 bytes to 52940...
Wrote 113296 bytes (52940 compressed) at 0x00010000 in 1.6 seconds (effective 578.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
r
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/pyterm/pyterm -p "/dev/ttyUSB0" -b "115200" -ln "/tmp/pyterm-maribu" -rn "2024-08-01_20.43.23-tests_gpio_ll-esp32-mh-et-live-minikit" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyUSB0
Welcome to pyterm!
Type '/exit' to exit.
READY
s
START
main(): This is RIOT! (Version: 2024.10-devel-11-g3995f7-drivers/periph_gpio_ll/api-change)
Test / Hardware Details:
========================
Cabling:
(INPUT -- OUTPUT)
  P0.27 -- P0.25
  P0.4 -- P0.2
Number of pull resistor values supported: 1
Number of drive strengths supported: 4
Number of slew rates supported: 1
Valid GPIO ports:
- PORT 0 (PORT A)
- PORT 1 (PORT B)

Testing gpio_port_pack_addr()
=============================

All OK

Testing gpip_ng_init()
======================

Testing is_gpio_port_num_valid() is true for PORT_OUT and PORT_IN:

Testing input configurations for PIN_IN_0:
Support for input with pull up: yes
state: in, pull: up, value: on, drive: weakest
Support for input with pull down: yes
state: in, pull: down, value: off, drive: weakest
Support for input with pull to bus level: no
Support for floating input (no pull resistors): yes
state: in, pull: none, value: off, drive: weakest

Testing output configurations for PIN_OUT_0:
Support for output (push-pull) with initial value of LOW: yes
state: out-pp, value: off, drive: weakest
Output is indeed LOW: yes
state: out-pp, value: on, drive: weakest
Output can be pushed HIGH: yes
Support for output (push-pull) with initial value of HIGH: yes
state: out-pp, value: on, drive: weakest
Output is indeed HIGH: yes
Support for output (open drain with pull up) with initial value of LOW: yes
state: out-od, pull: up, value: off, drive: weakest
Output is indeed LOW: yes
Support for output (open drain with pull up) with initial value of HIGH: yes
state: out-od, pull: up, value: on, drive: weakest
Output is indeed HIGH: yes
Support for output (open drain) with initial value of LOW: yes
state: out-od, pull: none, value: off, drive: weakest
Output is indeed LOW: yes
Support for output (open drain) with initial value of HIGH: yes
state: out-od, pull: none, value: on, drive: weakest
state: in, pull: down, value: off, drive: weakest
Output can indeed be pulled LOW: yes
state: in, pull: up, value: on, drive: weakest
Output can indeed be pulled HIGH: yes
Support for output (open source) with initial value of LOW: no
Support for output (open source) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of LOW: no

Support for disconnecting GPIO: yes
state: off, pull: none, value: off, drive: weakest
Output can indeed be pulled LOW: yes
Output can indeed be pulled HIGH: yes

Testing Reading/Writing GPIO Ports
==================================

testing initial value of 0 after init
...OK
testing setting both outputs_optional simultaneously
...OK
testing clearing both outputs_optional simultaneously
...OK
testing toggling first output (0 --> 1)
...OK
testing toggling first output (1 --> 0)
...OK
testing toggling second output (0 --> 1)
...OK
testing toggling second output (1 --> 0)
...OK
testing setting first output and clearing second with write
...OK
testing setting second output and clearing first with write
...OK
All input/output operations worked as expected

Testing External IRQs
=====================

Testing rising edge on PIN_IN_0
... OK
Testing falling edge on PIN_IN_0
... OK
Testing both edges on PIN_IN_0
... OK
Testing masking of IRQs (still both edges on PIN_IN_0)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK


TEST SUCCEEDED

SAM0

git:(drivers/periph_gpio_ll/api-change) ~/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll ➜ make BOARD=samr21-xpro flash test-with-config                
Building application "tests_gpio_ll" for "samr21-xpro" with CPU "samd21".

"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/samr21-xpro
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core/lib
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/samd21
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/sam0_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/sam0_common/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/samd21/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/samd21/vectors
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/div
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/frac
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/tsrb
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/ztimer
   text	  data	   bss	   dec	   hex	filename
  22160	   176	  2708	 25044	  61d4	/home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/samr21-xpro/tests_gpio_ll.elf
[INFO] edbg binary not found - building it from source now
CC= CFLAGS= make -C /home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/edbg
env -i PATH="/home/maribu/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/maribu/.go/bin" TERM="xterm" "make" -C "/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/edbg/bin"
make: Entering directory '/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/edbg/bin'
gcc -W -Wall -Wextra -O3 -std=gnu11 dap.c edbg.c utils.c target.c target_atmel_cm0p.c target_atmel_cm3.c target_atmel_cm4.c target_atmel_cm7.c target_atmel_cm4v2.c target_mchp_cm23.c target_st_stm32g0.c target_gd_gd32f4xx.c target_nu_m480.c target_lattice_lcmxo2.c target_rpi_rp2040.c  dbg_lin.c -ludev -o edbg
make: Leaving directory '/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/edbg/bin'
mv /home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/edbg/bin/edbg .
[INFO] edbg binary successfully built!
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/edbg/edbg.sh flash /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/samr21-xpro/tests_gpio_ll.bin
### Flashing Target ###
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800009225 03.25.01B6 (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev C)
Verification...
at address 0x4 expected 0x21, read 0x99
Error: verification failed
Debugger: ATMEL EDBG CMSIS-DAP ATML2127031800009225 03.25.01B6 (S)
Clock frequency: 16.0 MHz
Target: SAM R21G18 (Rev C)
Programming...... done.
Verification...... done.
Done flashing
r
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" -ln "/tmp/pyterm-maribu" -rn "2024-08-01_21.09.46-tests_gpio_ll-samr21-xpro" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
�
 ��%���������х����������ɥ���́�����READY
s
START
main(): This is RIOT! (Version: 2024.10-devel-11-g6f4ca9-drivers/periph_gpio_ll/api-change)
Test / Hardware Details:
========================
Cabling:
(INPUT -- OUTPUT)
  PB23 -- PA8
  PB2 -- PA14
Number of pull resistor values supported: 1
Number of drive strengths supported: 2
Number of slew rates supported: 1
Valid GPIO ports:
- PORT 0 (PORT A)
- PORT 1 (PORT B)
- PORT 2 (PORT C)

Testing gpio_port_pack_addr()
=============================

All OK

Testing gpip_ng_init()
======================

Testing is_gpio_port_num_valid() is true for PORT_OUT and PORT_IN:

Testing input configurations for PIN_IN_0:
Support for input with pull up: yes
state: in, pull: up, value: on, drive: weak
Support for input with pull down: yes
state: in, pull: down, value: off, drive: weak
Support for input with pull to bus level: no
Support for floating input (no pull resistors): yes
state: in, pull: none, value: off, drive: weak

Testing output configurations for PIN_OUT_0:
Support for output (push-pull) with initial value of LOW: yes
state: out-pp, value: off, drive: weak
Output is indeed LOW: yes
state: out-pp, value: on, drive: weak
Output can be pushed HIGH: yes
Support for output (push-pull) with initial value of HIGH: yes
state: out-pp, value: on, drive: weak
Output is indeed HIGH: yes
Support for output (open drain with pull up) with initial value of LOW: no
Support for output (open drain with pull up) with initial value of HIGH: no
Support for output (open drain) with initial value of LOW: no
Support for output (open drain) with initial value of HIGH: no
Support for output (open source) with initial value of LOW: no
Support for output (open source) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of LOW: no

Support for disconnecting GPIO: yes
state: off, pull: none, value: off, drive: weak
Output can indeed be pulled LOW: yes
Output can indeed be pulled HIGH: yes

Testing Reading/Writing GPIO Ports
==================================

testing initial value of 0 after init
...OK
testing setting both outputs_optional simultaneously
...OK
testing clearing both outputs_optional simultaneously
...OK
testing toggling first output (0 --> 1)
...OK
testing toggling first output (1 --> 0)
...OK
testing toggling second output (0 --> 1)
...OK
testing toggling second output (1 --> 0)
...OK
testing setting first output and clearing second with write
...OK
testing setting second output and clearing first with write
...OK
All input/output operations worked as expected

Testing External IRQs
=====================

Testing rising edge on PIN_IN_0
... OK
Testing falling edge on PIN_IN_0
... OK
Testing both edges on PIN_IN_0
... OK
Testing masking of IRQs (still both edges on PIN_IN_0)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK

Testing Switching Direction
===========================

Input pin can be switched to output (push-pull) mode: yes
Pin behaves as output after switched to output mode: yes
Returning back to input had no side effects on config: yes
Pin behaves as input after switched back to input mode: yes


TEST SUCCEEDED

nRF5x

git:(drivers/periph_gpio_ll/api-change) ~/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll ➜ make BOARD=nrf51dk flash test-with-config
Building application "tests_gpio_ll" for "nrf51dk" with CPU "nrf51".

"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/nrf51dk
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core/lib
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/nrf51
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/nrf51/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/nrf5x_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/nrf5x_common/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/div
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/frac
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/tsrb
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/ztimer
   text	  data	   bss	   dec	   hex	filename
  19496	   168	  2620	 22284	  570c	/home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/nrf51dk/tests_gpio_ll.elf
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/nrf51dk/tests_gpio_ll.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
swd
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: FW Version = 1.10
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x0bb11477
Info : [nrf51.cpu] Cortex-M0 r0p0 processor detected
Info : [nrf51.cpu] target has 4 breakpoints, 2 watchpoints
Info : [nrf51.cpu] Examination succeed
Info : starting gdb server for nrf51.cpu on 0
Info : Listening on port 38499 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* nrf51.cpu          cortex_m   little nrf51.cpu          unknown
[nrf51.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0x000018ec msp: 0x20000200
Info : nRF51422-QFAC(build code: A1) 256kB Flash, 32kB RAM
Warn : Adding extra erase range, 0x00004cd0 .. 0x00004fff
auto erase enabled
wrote 19664 bytes from file /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/nrf51dk/tests_gpio_ll.elf in 0.946116s (20.297 KiB/s)
verified 19664 bytes in 0.155244s (123.696 KiB/s)
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200" -ln "/tmp/pyterm-maribu" -rn "2024-08-01_21.15.48-tests_gpio_ll-nrf51dk" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
READY
s
START
main(): This is RIOT! (Version: 2024.10-devel-11-g6f4ca9-drivers/periph_gpio_ll/api-change)
Test / Hardware Details:
========================
Cabling:
(INPUT -- OUTPUT)
  P0.19 -- P0.18
  P0.17 -- P0.16
Number of pull resistor values supported: 1
Number of drive strengths supported: 2
Number of slew rates supported: 1
Valid GPIO ports:
- PORT 0 (PORT A)

Testing gpio_port_pack_addr()
=============================

All OK

Testing gpip_ng_init()
======================

Testing is_gpio_port_num_valid() is true for PORT_OUT and PORT_IN:

Testing input configurations for PIN_IN_0:
Support for input with pull up: yes
state: in, pull: up, value: on, drive: weak
Support for input with pull down: yes
state: in, pull: down, value: off, drive: weak
Support for input with pull to bus level: no
Support for floating input (no pull resistors): yes
state: in, pull: none, value: off, drive: weak

Testing output configurations for PIN_OUT_0:
Support for output (push-pull) with initial value of LOW: yes
state: out-pp, value: off, drive: weak
Output is indeed LOW: yes
state: out-pp, value: on, drive: weak
Output can be pushed HIGH: yes
Support for output (push-pull) with initial value of HIGH: yes
state: out-pp, value: on, drive: weak
Output is indeed HIGH: yes
Support for output (open drain with pull up) with initial value of LOW: yes
state: out-od, pull: up, value: off, drive: weak
Output is indeed LOW: yes
Support for output (open drain with pull up) with initial value of HIGH: yes
state: out-od, pull: up, value: on, drive: weak
Output is indeed HIGH: yes
Support for output (open drain) with initial value of LOW: yes
state: out-od, pull: none, value: off, drive: weak
Output is indeed LOW: yes
Support for output (open drain) with initial value of HIGH: yes
state: out-od, pull: none, value: on, drive: weak
state: in, pull: down, value: off, drive: weak
Output can indeed be pulled LOW: yes
state: in, pull: up, value: on, drive: weak
Output can indeed be pulled HIGH: yes
Support for output (open source) with initial value of LOW: yes
state: out-os, pull: none, value: off, drive: weak
state: in, pull: down, value: off, drive: weak
Output can indeed be pulled LOW: yes
state: in, pull: up, value: on, drive: weak
Output can indeed be pulled HIGH: yes
Support for output (open source) with initial value of HIGH: yes
state: out-os, pull: none, value: on, drive: weak
Output is indeed HIGH: yes
Support for output (open source with pull down) with initial value of HIGH: yes
Output is indeed HIGH: yes
Support for output (open source with pull down) with initial value of LOW: yes
Output is indeed LOW: yes

Support for disconnecting GPIO: yes
state: off, pull: none, value: off, drive: weak
Output can indeed be pulled LOW: yes
Output can indeed be pulled HIGH: yes

Testing Reading/Writing GPIO Ports
==================================

testing initial value of 0 after init
...OK
testing setting both outputs_optional simultaneously
...OK
testing clearing both outputs_optional simultaneously
...OK
testing toggling first output (0 --> 1)
...OK
testing toggling first output (1 --> 0)
...OK
testing toggling second output (0 --> 1)
...OK
testing toggling second output (1 --> 0)
...OK
testing setting first output and clearing second with write
...OK
testing setting second output and clearing first with write
...OK
All input/output operations worked as expected

Testing External IRQs
=====================

Testing rising edge on PIN_IN_0
... OK
Testing falling edge on PIN_IN_0
... OK
Testing both edges on PIN_IN_0
... OK
Testing masking of IRQs (still both edges on PIN_IN_0)
... OK


TEST SUCCEEDED

ATmega

git:(drivers/periph_gpio_ll/api-change) ~/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll ➜ make BOARD=arduino-mega2560 flash test-with-config
Building application "tests_gpio_ll" for "arduino-mega2560" with CPU "atmega2560".

"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/arduino-mega2560
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/common/arduino-atmega
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/common/atmega
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core/lib
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/atmega2560
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/atmega_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/atmega_common/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/avr8_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/avr8_common/avr_libc_extra
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/avr8_common/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/frac
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/tiny_strerror
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/tsrb
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/ztimer
   text	  data	   bss	   dec	   hex	filename
  24114	   296	  1049	 25459	  6373	/home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/arduino-mega2560/tests_gpio_ll.elf
avrdude -c stk500v2 -p m2560 -P /dev/ttyACM0 -D -U flash:w:/home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/arduino-mega2560/tests_gpio_ll.hex
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9801 (probably m2560)

avrdude: processing -U flash:w:/home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/arduino-mega2560/tests_gpio_ll.hex:i
avrdude: reading input file /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/arduino-mega2560/tests_gpio_ll.hex for flash
         with 24410 bytes in 1 section within [0, 0x5f59]
         using 96 pages and 166 pad bytes
avrdude: writing 24410 bytes flash ...
Writing | ################################################## | 100% 3.96 s 
avrdude: 24410 bytes of flash written
avrdude: verifying flash memory against /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/arduino-mega2560/tests_gpio_ll.hex
Reading | ################################################## | 100% 2.93 s 
avrdude: 24410 bytes of flash verified

avrdude done.  Thank you.

r
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "9600" -ln "/tmp/pyterm-maribu" -rn "2024-08-01_21.50.56-tests_gpio_ll-arduino-mega2560" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.


Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: 2024.10-devel-37-gbf831-drivers/periph_gpio_ll/api-change)
Test / Hardware Details:
========================
Cabling:
(INPUT -- OUTPUT)
  PE4 -- PB6
  PE5 -- PB7
Number of pull resistor values supported: 1
Number of drive strengths supported: 1
Number of slew rates supported: 1
Valid GPIO ports:
- PORT 0 (PORT A)
- PORT 1 (PORT B)
- PORT 2 (PORT C)
- PORT 3 (PORT D)
- PORT 4 (PORT E)
- PORT 5 (PORT F)
- PORT 6 (PORT G)
- PORT 7 (PORT H)
- PORT 9 (PORT J)
- PORT 10 (PORT K)
- PORT 11 (PORT L)

Testing gpio_port_pack_addr()
=============================

All OK

Testing gpip_ng_init()
======================

Testing is_gpio_port_num_valid() is true for PORT_OUT and PORT_IN:

Testing input configurations for PIN_IN_0:
Support for input with pull up: yes
state: in, pull: up, value: on
Support for input with pull down: no
Support for input with pull to bus level: no
Support for floating input (no pull resistors): yes
state: in, pull: none, value: on

Testing output configurations for PIN_OUT_0:
Support for output (push-pull) with initial value of LOW: yes
state: out-pp, value: off
Output is indeed LOW: yes
state: out-pp, value: on
Output can be pushed HIGH: yes
Support for output (push-pull) with initial value of HIGH: yes
state: out-pp, value: on
Output is indeed HIGH: yes
Support for output (open drain with pull up) with initial value of LOW: no
Support for output (open drain with pull up) with initial value of HIGH: no
Support for output (open drain) with initial value of LOW: no
Support for output (open drain) with initial value of HIGH: no
Support for output (open source) with initial value of LOW: no
Support for output (open source) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of LOW: no

Support for disconnecting GPIO: yes
state: in, pull: none, value: off
WARN: Cannot enable pull down of PIN_IN_0 to verify correct disabled behavior
Output can indeed be pulled HIGH: yes

Testing Reading/Writing GPIO Ports
==================================

testing initial value of 0 after init
...OK
testing setting both outputs_optional simultaneously
...OK
testing clearing both outputs_optional simultaneously
...OK
testing toggling first output (0 --> 1)
...OK
testing toggling first output (1 --> 0)
...OK
testing toggling second output (0 --> 1)
...OK
testing toggling second output (1 --> 0)
...OK
testing setting first output and clearing second with write
...OK
testing setting second output and clearing first with write
...OK
All input/output operations worked as expected

Testing External IRQs
=====================

Testing rising edge on PIN_IN_0
... OK
Testing falling edge on PIN_IN_0
... OK
Testing both edges on PIN_IN_0
... OK
Testing masking of IRQs (still both edges on PIN_IN_0)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK

Testing Switching Direction
===========================

Input pin can be switched to output (push-pull) mode: yes
Pin behaves as output after switched to output mode: yes
Returning back to input had no side effects on config: yes
Pin behaves as input after switched back to input mode: yes


TEST SUCCEEDED

GD32-V

git:(drivers/periph_gpio_ll/api-change) ~/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll ➜ make BOARD=gd32vf103c-start flash test-with-config
Building application "tests_gpio_ll" for "gd32vf103c-start" with CPU "gd32v".

"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/pkg/nmsis_sdk/ 
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/gd32vf103c-start
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core/lib
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/gd32v
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/gd32v/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/riscv_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/riscv_common/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/div
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/frac
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/tsrb
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/ztimer
   text	  data	   bss	   dec	   hex	filename
  17616	  4224	  2828	 24668	  605c	/home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/gd32vf103c-start/tests_gpio_ll.elf
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/gd32vf103c-start/tests_gpio_ll.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
init_reset
none separate
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: JTAG supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (JTAG)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 10000 kHz
Warn : 'srst_nogate' reset_config option is required
Info : cmsis-dap JTAG TLR_RESET
Info : cmsis-dap JTAG TLR_RESET
Info : JTAG tap: gd32vf103.cpu tap/device found: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Info : JTAG tap: auto0.tap tap/device found: 0x790007a3 (mfg: 0x3d1 (GigaDevice Semiconductor (Beijing)), part: 0x9000, ver: 0x7)
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 5 -expected-id 0x790007a3"
Info : datacount=4 progbufsize=2
Info : Examined RISC-V core; found 1 harts
Info :  hart 0: XLEN=32, misa=0x40901105
Info : [gd32vf103.cpu] Examination succeed
Info : starting gdb server for gd32vf103.cpu on 0
Info : Listening on port 38589 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* gd32vf103.cpu      riscv      little gd32vf103.cpu      unknown
Info : cmsis-dap JTAG TLR_RESET
Warn : 'srst_nogate' reset_config option is required
Info : cmsis-dap JTAG TLR_RESET
Info : cmsis-dap JTAG TLR_RESET
Info : JTAG tap: gd32vf103.cpu tap/device found: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Info : JTAG tap: auto0.tap tap/device found: 0x790007a3 (mfg: 0x3d1 (GigaDevice Semiconductor (Beijing)), part: 0x9000, ver: 0x7)
Info : device id = 0x19060410
Info : flash size = 128 KiB
Warn : Adding extra erase range, 0x08005564 .. 0x080057ff
auto erase enabled
wrote 21860 bytes from file /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/gd32vf103c-start/tests_gpio_ll.elf in 26.701845s (0.799 KiB/s)
verified 21860 bytes in 1.204025s (17.730 KiB/s)
Info : cmsis-dap JTAG TLR_RESET
Warn : 'srst_nogate' reset_config option is required
Info : cmsis-dap JTAG TLR_RESET
Info : cmsis-dap JTAG TLR_RESET
Info : JTAG tap: gd32vf103.cpu tap/device found: 0x1000563d (mfg: 0x31e (Andes Technology Corporation), part: 0x0005, ver: 0x1)
Info : JTAG tap: auto0.tap tap/device found: 0x790007a3 (mfg: 0x3d1 (GigaDevice Semiconductor (Beijing)), part: 0x9000, ver: 0x7)
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/pyterm/pyterm -p "/dev/ttyUSB0" -b "115200" -ln "/tmp/pyterm-maribu" -rn "2024-08-01_21.47.30-tests_gpio_ll-gd32vf103c-start" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyUSB0
Welcome to pyterm!
Type '/exit' to exit.
���Jсis ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: 2024.10-devel-37-gf928b-drivers/periph_gpio_ll/api-change)
Test / Hardware Details:
========================
Cabling:
(INPUT -- OUTPUT)
  PB1 -- PB0
  PB8 -- PB9
Number of pull resistor values supported: 1
Number of drive strengths supported: 1
Number of slew rates supported: 3
Valid GPIO ports:
- PORT 0 (PORT A)
- PORT 1 (PORT B)
- PORT 2 (PORT C)
- PORT 3 (PORT D)
- PORT 4 (PORT E)

Testing gpio_port_pack_addr()
=============================

All OK

Testing gpip_ng_init()
======================

Testing is_gpio_port_num_valid() is true for PORT_OUT and PORT_IN:

Testing input configurations for PIN_IN_0:
Support for input with pull up: yes
state: in, pull: up, value: on, slew: slowest
Support for input with pull down: yes
state: in, pull: down, value: off, slew: slowest
Support for input with pull to bus level: no
Support for floating input (no pull resistors): yes
state: in, pull: none, value: off, slew: slowest

Testing output configurations for PIN_OUT_0:
Support for output (push-pull) with initial value of LOW: yes
state: out-pp, value: off, slew: slowest
Output is indeed LOW: yes
state: out-pp, value: on, slew: slowest
Output can be pushed HIGH: yes
Support for output (push-pull) with initial value of HIGH: yes
state: out-pp, value: on, slew: slowest
Output is indeed HIGH: yes
Support for output (open drain with pull up) with initial value of LOW: no
Support for output (open drain with pull up) with initial value of HIGH: no
Support for output (open drain) with initial value of LOW: yes
state: out-od, pull: none, value: off, slew: slowest
Output is indeed LOW: yes
Support for output (open drain) with initial value of HIGH: yes
state: out-od, pull: none, value: on, slew: slowest
state: in, pull: down, value: off, slew: slowest
Output can indeed be pulled LOW: yes
state: in, pull: up, value: on, slew: slowest
Output can indeed be pulled HIGH: yes
Support for output (open source) with initial value of LOW: no
Support for output (open source) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of HIGH: no
Support for output (open source with pull down) with initial value of LOW: no

Support for disconnecting GPIO: yes
state: off, pull: none, value: on, slew: slowest
Output can indeed be pulled LOW: yes
Output can indeed be pulled HIGH: yes

Testing Reading/Writing GPIO Ports
==================================

testing initial value of 0 after init
...OK
testing setting both outputs_optional simultaneously
...OK
testing clearing both outputs_optional simultaneously
...OK
testing toggling first output (0 --> 1)
...OK
testing toggling first output (1 --> 0)
...OK
testing toggling second output (0 --> 1)
...OK
testing toggling second output (1 --> 0)
...OK
testing setting first output and clearing second with write
...OK
testing setting second output and clearing first with write
...OK
All input/output operations worked as expected

Testing External IRQs
=====================

Testing rising edge on PIN_IN_0
... OK
Testing falling edge on PIN_IN_0
... OK
Testing both edges on PIN_IN_0
... OK
Testing masking of IRQs (still both edges on PIN_IN_0)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK
Testing level-triggered on HIGH on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is HIGH when setting up IRQ)
... OK
Testing level-triggered on LOW on PIN_IN_0 (when input is LOW when setting up IRQ)
... OK


TEST SUCCEEDED

EFM32

git:(drivers/periph_gpio_ll/api-change) ~/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll ➜ make BOARD=e180-zg120b-tb flash test-with-config PROGRAMMER=openocd
Building application "tests_gpio_ll" for "e180-zg120b-tb" with CPU "efm32".

"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/pkg/cmsis/ 
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/pkg/gecko_sdk/ 
"make" -C /home/maribu/.cache/RIOT/pkg/gecko_sdk/dist
"make" -C /home/maribu/.cache/RIOT/pkg/gecko_sdk/dist/emlib-extra/src
"make" -C /home/maribu/.cache/RIOT/pkg/gecko_sdk/dist/emlib/src
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/common/init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/boards/e180-zg120b-tb
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/core/lib
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/efm32
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/cortexm_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/cortexm_common/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/efm32/families/efr32mg1b
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/cpu/efm32/periph
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/drivers/periph_common
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/auto_init
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/div
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/frac
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/isrpipe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/libc
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/malloc_thread_safe
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/newlib_syscalls_default
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/pm_layered
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/preprocessor
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/stdio_uart
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/interactive_sync
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/test_utils/print_stack_usage
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/tsrb
"make" -C /home/maribu/Repos/software/RIOT/gpio_ll/sys/ztimer
   text	  data	   bss	   dec	   hex	filename
  24292	   196	  2648	 27136	  6a00	/home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/e180-zg120b-tb/tests_gpio_ll.elf
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/openocd/openocd.sh flash /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/e180-zg120b-tb/tests_gpio_ll.elf
### Flashing Target ###
Open On-Chip Debugger 0.12.0+dev-snapshot (2024-01-17-08:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.231012
Info : [efm32.cpu] Cortex-M4 r0p1 processor detected
Info : [efm32.cpu] target has 6 breakpoints, 4 watchpoints
Info : [efm32.cpu] Examination succeed
Info : starting gdb server for efm32.cpu on 0
Info : Listening on port 40367 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* efm32.cpu          hla_target little efm32.cpu          unknown
[efm32.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0fe10000 msp: 0x20000400
Info : detected part: EFR32MG1B Mighty Gecko, rev 165
Info : flash size = 256 KiB
Info : flash page size = 2048 B
auto erase enabled
wrote 24576 bytes from file /home/maribu/Repos/software/RIOT/gpio_ll/tests/periph/gpio_ll/bin/e180-zg120b-tb/tests_gpio_ll.elf in 0.888527s (27.011 KiB/s)
verified 24488 bytes in 0.169970s (140.696 KiB/s)
shutdown command invoked
Done flashing
r
/home/maribu/Repos/software/RIOT/gpio_ll/dist/tools/pyterm/pyterm -p "/dev/ttyUSB0" -b "115200" -ln "/tmp/pyterm-maribu" -rn "2024-08-01_22.17.08-tests_gpio_ll-e180-zg120b-tb" --no-reconnect --noprefix --no-repeat-command-on-empty-line 
Twisted not available, please install it if you want to use pyterm's JSON capabilities
Connect to serial port /dev/ttyUSB0
Welcome to pyterm!
Type '/exit' to exit.
READY
s
START
main(): This is RIOT! (Version: 2024.10-devel-37-gbf831-drivers/periph_gpio_ll/api-change)
Test / Hardware Details:
========================
Cabling:
(INPUT -- OUTPUT)
  PB11 -- PD14
  PB12 -- PD15
Number of pull resistor values supported: 1
Number of drive strengths supported: 1
Number of slew rates supported: 1
Valid GPIO ports:
- PORT 0 (PORT A)
- PORT 1 (PORT B)
- PORT 2 (PORT C)
- PORT 3 (PORT D)
- PORT 5 (PORT F)

Testing gpio_port_pack_addr()
=============================

All OK

Testing gpip_ng_init()
======================

Testing is_gpio_port_num_valid() is true for PORT_OUT and PORT_IN:

Testing input configurations for PIN_IN_0:
Support for input with pull up: yes
state: in, pull: up, value: on
Support for input with pull down: yes
state: in, pull: down, value: off
Support for input with pull to bus level: no
Support for floating input (no pull resistors): yes
state: in, pull: none, value: off

Testing output configurations for PIN_OUT_0:
Support for output (push-pull) with initial value of LOW: yes
state: out-pp, value: off
Output is indeed LOW: yes
state: out-pp, value: on
Output can be pushed HIGH: yes
Support for output (push-pull) with initial value of HIGH: yes
state: out-pp, value: on
Output is indeed HIGH: yes
Support for output (open drain with pull up) with initial value of LOW: yes
state: out-od, pull: up, value: off
Output is indeed LOW: yes
Support for output (open drain with pull up) with initial value of HIGH: yes
state: out-od, pull: up, value: on
Output is indeed HIGH: yes
Support for output (open drain) with initial value of LOW: yes
state: out-od, pull: none, value: off
Output is indeed LOW: yes
Support for output (open drain) with initial value of HIGH: yes
state: out-od, pull: none, value: on
state: in, pull: down, value: off
Output can indeed be pulled LOW: yes
state: in, pull: up, value: on
Output can indeed be pulled HIGH: yes
Support for output (open source) with initial value of LOW: yes
state: out-os, pull: none, value: off
state: in, pull: down, value: off
Output can indeed be pulled LOW: yes
state: in, pull: up, value: on
Output can indeed be pulled HIGH: yes
Support for output (open source) with initial value of HIGH: yes
state: out-os, pull: none, value: on
Output is indeed HIGH: yes
Support for output (open source with pull down) with initial value of HIGH: yes
Output is indeed HIGH: yes
Support for output (open source with pull down) with initial value of LOW: yes
Output is indeed LOW: yes

Support for disconnecting GPIO: yes
state: off, pull: none, value: off
Output can indeed be pulled LOW: yes
Output can indeed be pulled HIGH: yes

Testing Reading/Writing GPIO Ports
==================================

testing initial value of 0 after init
...OK
testing setting both outputs_optional simultaneously
...OK
testing clearing both outputs_optional simultaneously
...OK
testing toggling first output (0 --> 1)
...OK
testing toggling first output (1 --> 0)
...OK
testing toggling second output (0 --> 1)
...OK
testing toggling second output (1 --> 0)
...OK
testing setting first output and clearing second with write
...OK
testing setting second output and clearing first with write
...OK
All input/output operations worked as expected


TEST SUCCEEDED

@maribu maribu force-pushed the drivers/periph_gpio_ll/api-change branch from f928b46 to 2e8027a Compare August 1, 2024 20:19
@maribu maribu enabled auto-merge August 1, 2024 20:19
@maribu maribu added this pull request to the merge queue Aug 1, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 1, 2024
@maribu maribu enabled auto-merge August 1, 2024 21:21
@maribu maribu added this pull request to the merge queue Aug 1, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 1, 2024
@maribu maribu force-pushed the drivers/periph_gpio_ll/api-change branch from b9da730 to dc0c710 Compare August 2, 2024 05:17
@maribu maribu enabled auto-merge August 2, 2024 05:18
@maribu maribu added this pull request to the merge queue Aug 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 2, 2024
maribu added 4 commits August 2, 2024 09:55
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
This fixes a race in `LED<NUM>_TOGGLE`, which is a read-copy-write
operation. Any access to a GPIO pin on the same GPIO port that
happens concurrently could result in data corruption. Using the
GPIO LL API, which is thread-safe, fixes the issue.

Note: The used GPIO LL functions will work even in when the GPIO LL
      module is not used.
A test intended to ensure that a configuration toggling the direction
of a GPIO two times restores the original configuration not only
compared the configuration at the two points in time, but also the
value of the input buffer. Since a floating input reads back random
values when not externally driven, the test was actually randomly
failing. Apparently I got lucky before consistently and this never
triggered until now.

This now clears the input value from both the configuration reported
before and after toggling the direction twice and should now indeed
succeed consistently.
@maribu maribu force-pushed the drivers/periph_gpio_ll/api-change branch from dc0c710 to 4a09286 Compare August 2, 2024 07:55
@maribu maribu enabled auto-merge August 2, 2024 07:55
@maribu maribu added this pull request to the merge queue Aug 2, 2024
Merged via the queue into RIOT-OS:master with commit 340caa8 Aug 2, 2024
25 checks passed
@maribu maribu deleted the drivers/periph_gpio_ll/api-change branch August 2, 2024 11:38
@maribu
Copy link
Member Author

maribu commented Aug 2, 2024

Thanks :)

@benpicco benpicco added this to the Release 2024.10 milestone Nov 27, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area: boards Area: Board ports Area: cpu Area: CPU/MCU ports Area: drivers Area: Device drivers Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Platform: AVR Platform: This PR/issue effects AVR-based platforms Platform: ESP Platform: This PR/issue effects ESP-based platforms Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants