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

Add atomic modify operations #7

Open
SamP20 opened this issue May 6, 2019 · 2 comments
Open

Add atomic modify operations #7

SamP20 opened this issue May 6, 2019 · 2 comments

Comments

@SamP20
Copy link

SamP20 commented May 6, 2019

The ARMv6 and ARMv7 instruction sets contain the LDREX and STREX instructions. It would be handy to add an AtomicOps trait with atomic_get/atomic_set and/or atomic_modify methods based on these instructions. This is possibly duplicating the AtomicXXX types in the core library, however I can see this being useful for splitting I/O ports into thread safe groups.

@hannobraun
Copy link

however I can see this being useful for splitting I/O ports into thread safe groups.

There's been some discussion on the svd2rust issue tracker that could be another solution to this issue, here: rust-embedded/svd2rust#213

The suggestion to split registers into ownable fields comes later in the issue: rust-embedded/svd2rust#213 (comment)

@SamP20
Copy link
Author

SamP20 commented May 8, 2019

The suggestion to split registers into ownable fields comes later in the issue

That's an option too. I did notice just after posting this that VolatileCell has an as_ptr method, so it would be possible to implement something at a higher level.

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