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

Inconsistent safety description of peripheral initialization #59

Open
chrysn opened this issue Oct 12, 2023 · 0 comments
Open

Inconsistent safety description of peripheral initialization #59

chrysn opened this issue Oct 12, 2023 · 0 comments

Comments

@chrysn
Copy link
Member

chrysn commented Oct 12, 2023

Older peripheral wrappers have unsafe init functions, reasoning that this is equivalent to a Rust PAC's stealing function (which allows creating the same peripheral twice). Newer peripheral wrappers have safe init functions, reasoning that in RIOT initializers are idempotent.

I don't have a full conclusion yet, because while RIOT does make some of those things safe, peripheral drivers are also not thread safe. But given they don't access real RAM, maybe it's fine even under Rust's model for both to write to registers a the same time? (At least as in "not cause UB" -- the ADC readings are still likely garbage).

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