vcell
vcell copied to clipboard
Add atomic modify operations
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.
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: https://github.com/rust-embedded/svd2rust/issues/213
The suggestion to split registers into ownable fields comes later in the issue: https://github.com/rust-embedded/svd2rust/issues/213#issuecomment-434116049
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.