-
Notifications
You must be signed in to change notification settings - Fork 19
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
Provide an example #8
Comments
General UsageThe idea behind this crate is that you have a volatile memory location, for example the memory mapped register of some hardware device. Let's say there is an memory mapped let register = unsafe{ &mut *(0xdead000 as *mut u32) }; However, this way the compiler doesn't know that the memory address is volatile and uses normal read/write operations to access it, which might be reordered or optimized out. To avoid this, we use the
Now we have to use special Volatile ArraysVolatile arrays are currently difficult to abstract because there are no const generics in Rust yet. You can either wrap the whole array in a I hope that rust-lang/rust#53645 is merged soon. It implements a first version of const generics. This would allows us to create a generic I hope this helps! |
Wow, now I understood it, this approach is quite clever. Thanks a lot. |
Hey there,
would it be possible, to provide a short but complete usage example, that allows, for example reading a volatile array?
From reading the source and the documentation I don't really get, how this thing works and how to make it perform volatile reads.
The text was updated successfully, but these errors were encountered: