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

PWR_PUCR macro does not work #1554

Open
amcnicoll opened this issue Jul 18, 2024 · 0 comments
Open

PWR_PUCR macro does not work #1554

amcnicoll opened this issue Jul 18, 2024 · 0 comments

Comments

@amcnicoll
Copy link

Background

pwr.h (g0, g4, l4) provide access to the PWR_PUCRx and PWR_PDCRx registers by defining PWR_PORT_[A-G] and applying an offset with PWR_PUCR() and PWR_PDCR() macros.

#define PWR_PUCR(pwr_port) MMIO32((pwr_port) 0x00)

Issue

I can neither make assignments nor copy-modify-write using this macro. The following both fail, for various combinations of port and right hand side:

PWR_PUCR(PWR_PORT_C) |= 1;
PWR_PUCR(PWR_PORT_C) = 1;

Solution

This appears to be due to nesting the MMIO32 macro. It seems the right pattern would be to remove the MMIO32 macro from the PWR_PORT_[A-G] definitions, aping the the GPIO pattern where the GPIO_PORT_x_BASE are integer constants that are wrapped by MMIO32 in the downstream macros designed to work with these constants.

I've confirmed this solution works, but I'm too underwater to open a PR myself, and haven't investigated potential side effects / dependencies / references. Documenting the issue in case anyone else runs into it, if anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant