2015-11-06 10:58 AM
Hi there.
I read an article about copying data using CPU (''for'' loop) and DMA (Mem2Mem).http://www.embedds.com/using-direct-memory-access-dma-in-stm23-projects/Below in the comments of that article is described also an approach, which uses memcpy() function. Interestingly, this is also (much) faster than DMA. I never used memcpy() function, so I would like to ask, how could it be faster than DMA? As long as it is a function, I suppose it occupy CPU? But how it works? Where can I see its definition?Thanks #memcpy2015-11-06 12:09 PM
You'd get yourself the library source, or disassemble it.
The memcpy doesn't have any setup overhead, the memory is tightly coupled and the processor has write-buffers. You'd have to dig into the gate-level implementation, but I suspect the DMA state-machine has more states, and has to arbitrate/request access from the core. One of the typical memcpy() optimizations is reading multiple words, and then writing multiple words. DMA would have a single holding register2015-11-06 01:32 PM
Do you have maybe an example code to see how it is used?