Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

cpu/sam0_common/periph_gpio_ll: fix gpio_get_port() and gpio_ll_query_conf() [backport 2024.10] #21008

Conversation

maribu
Copy link
Member

@maribu maribu commented Nov 19, 2024

Backport of #20999

Contribution description

gpio_get_port()

It turns out that the legacy GPIO API and GPIO LL may disagree on what the GPIO base address is: GPIO LL will use the IOBUS as base address no matter what, the legacy GPIO API will use the APB as base address unless periph_gpio_fast_read is used.

If the APIs disagree, we need to do impedance matching.

gpio_ll_query_conf()

For the other MCUs, we take the input register state instead of the output register state when the pin is configured as input. Let's do the same here, as this is a lot more useful and intuitive.

Testing procedure

gpio_query_conf(gpio_get_port(GPIO_PIN(PA, 1)), gpio_get_pin_num(GPIO_PIN(PA, 1)); should no longer run into a blown assertion.

Issues/PRs references

None

It turns out that the legacy GPIO API and GPIO LL may disagree on what
the GPIO base address is: GPIO LL will use the IOBUS as base address
no matter what, the legacy GPIO API will use the APB as base address
unless `periph_gpio_fast_read` is used.

If the APIs disagree, we need to do impedance matching.

(cherry picked from commit 72d0b2b)
For the other MCUs, we take the input register state instead of the
output register state when the pin is configured as input. Let's do
the same here, as this is a lot more useful and intuitive.

(cherry picked from commit 0222b8c)
@maribu maribu added Area: cpu Area: CPU/MCU ports 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 Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Nov 19, 2024
@benpicco benpicco enabled auto-merge November 19, 2024 10:59
@riot-ci
Copy link

riot-ci commented Nov 19, 2024

Murdock results

✔️ PASSED

779aaed cpu/sam0_common/periph_gpio_ll: fix gpio_query_conf()

Success Failures Total Runtime
10215 0 10215 17m:57s

Artifacts

@benpicco benpicco added this pull request to the merge queue Nov 19, 2024
Merged via the queue into RIOT-OS:2024.10-branch with commit 88e6a42 Nov 19, 2024
31 checks passed
@maribu maribu deleted the backport/2024.10/cpu/sam0_common/gpio_ll/fix-gpio_get_port branch November 19, 2024 16:26
@maribu
Copy link
Member Author

maribu commented Nov 19, 2024

Thx :)

@benpicco benpicco added this to the Release 2024.10 milestone Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports 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 Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants