-
Notifications
You must be signed in to change notification settings - Fork 38
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
Memory safe DMA API #36
Conversation
Great first go at it! |
Co-Authored-By: japaric <[email protected]>
Co-Authored-By: japaric <[email protected]>
Co-Authored-By: japaric <[email protected]>
Co-Authored-By: japaric <[email protected]>
Co-Authored-By: japaric <[email protected]>
It's worth mentioning you also need a memory barrier (DMB/DSB) when using devices with caches such as Cortex-M7's DCACHE, since the main SRAM is in general not coherent between the CPU and DMA. Edit: You could also use explicit cache management to only invalidate the buffer in question instead of the whole memory, but it requires more careful management. |
@adamgreig added a note about caches If there are no more questions or requests then I think we can land this first version of this chapter. |
Good write-up - Thanks |
bors r=adamgreig |
36: Memory safe DMA API r=adamgreig a=japaric This is a first draft on building memory safe DMA abstractions. r? @rust-embedded/resources cc @korken89 @jamesmunns Co-authored-by: Jorge Aparicio <[email protected]> Co-authored-by: Emil Fresk <[email protected]>
Build succeeded |
{{#include ../ci/dma/examples/six.rs:91:101}} | ||
``` | ||
|
||
## `'static` bound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have a 'static lifetime, do we still need to Pin the buffers? It seems like adding 'static lifetime solves the original problem of using stack-based buffers, which don't live long enough.
If you can provide an example of an issue that would occur when you only have 'static without Pin, I think that would help me understand better.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We recently discovered that not even 'static
+ Pin
is enough, see #64, we are working on a new documentation for this, see https://github.com/ra-kete/dma-poc for more details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the response. The links where very helpful, and I think the new documentation is very clear
This is a first draft on building memory safe DMA abstractions.
r? @rust-embedded/resources
cc @korken89 @jamesmunns