vcell icon indicating copy to clipboard operation
vcell copied to clipboard

Add atomic modify operations

Open SamP20 opened this issue 6 years ago • 2 comments

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.

SamP20 avatar May 06 '19 13:05 SamP20

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

hannobraun avatar May 07 '19 05:05 hannobraun

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.

SamP20 avatar May 08 '19 14:05 SamP20