memcpy() function
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-06 10:58 AM
Posted on November 06, 2015 at 19:58
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 #memcpy
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-06 12:09 PM
Posted on November 06, 2015 at 21:09
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 register
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-06 1:32 PM
Posted on November 06, 2015 at 22:32
Do you have maybe an example code to see how it is used?
