rust-embedded / embedonomicon

How to bootstrap support for a no_std target
https://docs.rust-embedded.org/embedonomicon/
Apache License 2.0
206 stars 34 forks source link

Memory safe DMA API #36

Closed japaric closed 5 years ago

japaric commented 5 years ago

This is a first draft on building memory safe DMA abstractions.

r? @rust-embedded/resources cc @korken89 @jamesmunns

korken89 commented 5 years ago

Great first go at it!

adamgreig commented 5 years ago

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.

japaric commented 5 years ago

@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.

rj-xy commented 5 years ago

Good write-up - Thanks

japaric commented 5 years ago

bors r=adamgreig

bors[bot] commented 5 years ago

Build succeeded