Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DMA transfer RAM-to-RAM

Tags:

c

windows

x86

dma

A friend of mine has told me that on x86 architecture DMA controller can't transfer between two different RAM locations. It can only transfer between RAM and peripheral (such as PCI bus).

Is this true?

Because AFAIK DMA controller should be able between arbitrary devices that sit on BUS and have an address. In particular I see no problem if both source and destionation addresses belong to the same physical device.

like image 363
valdo Avatar asked Nov 28 '10 15:11

valdo


People also ask

Does DMA use RAM?

DMA can also be used for "memory to memory" copying or moving of data within memory. DMA can offload expensive memory operations, such as large copies or scatter-gather operations, from the CPU to a dedicated DMA engine.

How does DMA speed up transfers?

A DMA channel enables a device to transfer data without exposing the CPU to a work overload. Without the DMA channels, the CPU copies every piece of data using a peripheral bus from the I/O device.

Is there a trade off for memory to memory DMA transfer when the data size is small?

this can can be true yes. Setting up the DMA controller for a memory to memory transfer on a STM32F4 requires at the very least 4x peripheral register writes which will take a couple of CPU cycles. So for small data sizes this might actually perform worse than letting the CPU copying it.


1 Answers

ISA (remember? ;-) DMA chips certainly have a Fetch-and-Deposit transfer type.

However, from the MASM32 forums:

Hi,

Checking in "The Undocumented PC", he says memory to memory DMA is possible. He then goes on to say that there can be problems, limitations, and that the CPU can do the copy faster than the DMA hardware anyway (MOVSD on 386+).

So it seems to be a yes you can, but who cares, kind of thing.

Regards,

Steve N.

like image 185
Andras Vass Avatar answered Oct 14 '22 00:10

Andras Vass