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

serial::{Tx, Rx}::{listen, unlisten} are unsafe #406

Open
AndreySmirnov81 opened this issue Feb 22, 2022 · 2 comments
Open

serial::{Tx, Rx}::{listen, unlisten} are unsafe #406

AndreySmirnov81 opened this issue Feb 22, 2022 · 2 comments

Comments

@AndreySmirnov81
Copy link
Contributor

And also Rx::{listen_idle, unlisten_idle} are unsafe.

They all use unsafe { (*USART::ptr()).cr1.modify(|_, w| w. ...) };.

It is non-atomic read-modify-write.

Tx and Rx can be used simultaneously from different execution threads.
At the same time, they do not provide thread-safe access.

@burrbull
Copy link
Member

technically we could rewrite those with bit-banding (bb::set)

@AndreySmirnov81
Copy link
Contributor Author

I think this will be the most optimal solution.

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

2 participants