rp2040-pac icon indicating copy to clipboard operation
rp2040-pac copied to clipboard

Add atomic XOR/set/clear access

Open hmvp opened this issue 4 years ago • 3 comments

While I suspect this is something that might be added through svd2rust I still think its useful to mention here:

According to 2.1.2 from the datasheet most registers allow XORing, setting or clearing of individual bits by writing to offset 0x1000, 0x2000 or 0x3000 from the base register. This is useful in a lot of cases to circumvent a read/modify cycle.

Afaik this is not supported by the pac at the moment..

hmvp avatar Jul 25 '21 22:07 hmvp

I think I see something similar here in svd2rust

https://github.com/rust-embedded/svd2rust/blob/a02a5cff00e90e617dcc53b24003c1b83d02f4bb/src/generate/generic_msp430_atomic.rs

richardanaya avatar Aug 02 '21 05:08 richardanaya

I opened an issue upstream https://github.com/rust-embedded/svd2rust/issues/535

richardanaya avatar Aug 02 '21 05:08 richardanaya

For reference the rp2040-hal currently implements it via the atomic_register_access module

ithinuel avatar Sep 12 '22 07:09 ithinuel