How it works:
- A special hardware block, the DMA engine, manages data transfers between memory and a device.
- The CPU only sets it up (starting address + size of data).
- After that, the DMA engine handles everything: bus protocol, addressing, sequencing.
- This frees the CPU from doing repetitive data movement tasks.
Evolution of DMA
-
Early DMA
- An external DMA engine managed transfers for devices.
- PCI peripherals stayed simple and low-cost.
-
Bus Mastering (improved DMA)
- Later, DMA capability was integrated inside the peripheral device itself.
- These self-sufficient devices are called Bus Masters.
- A Bus Master can directly control the PCI bus to read/write system memory without an external DMA controller.
Example (Bus Master Transaction on PCI)
- A PCI peripheral (Bus Master) initiates a transfer.
- The North Bridge (chipset) decodes the address and recognizes that it’s the target.
- During the data phase:
- Data moves directly between the Bus Master and the North Bridge (target).
- The North Bridge generates the necessary DRAM bus cycles to move the data into system memory.
- Once finished, the PCI device may trigger an interrupt to notify the CPU.
Why DMA is more efficient
- CPU is not involved in the actual transfer.
- Single bus cycle can move an entire block of data.
- CPU is free to do other work while DMA handles the transfer.