DMA

Direct memory access (DMA) is the mechanism for fast data transfer between peripherals and memory. In some implementations, it is also possible to transfer data between two peripherals or from memory to memory. DMA operates without the activity of the processor, no software is executed during the DMA transfer. It must be supported by a processor and peripheral hardware, and there must be a DMA controller present in the system. The controller plays the main role in transferring the data.

DMA controller is a specialised unit which can control the data transfer process. It implements several channels each containing the address register which is used to address the memory location and counter to specify how many cycles should be performed. Address register and counter must be programmed by the processor, it is usually done in the system startup procedure. The system with an inactive DMA controller is presented in Fig.1.

System with inactive DMA controller
Figure 1: System with inactive DMA controller

The process of data transfer is done in some steps, Let us consider the situation when a peripheral has some data to be transferred.

  • peripheral signals the request to transfer data (DREQ).
  • DMA controller forwards the request to the processor (HOLD).
  • The processor accepts the DMA cycle (HLDA) and switches off from the busses.
  • DMA controller generates the address on the address bus and sends the acknowledge signal to the peripheral (DACK).
  • Peripheral sends the data by the data bus.
  • DMA generates a write signal to store data in the memory.
  • DMA controller updates address register and the counter.
  • If the counter reaches zero data transfer stops.

Everything is done without any action of the processor, no program is fetched and executed. Because everything is done by hardware the transfer can be done in one memory access cycle so much faster than by the processor. Data transfer by processor is significantly slower because requires at least four instructions of program execution and two data transfers: one from the peripheral and another to the memory for one cycle. The system with an active DMA controller is presented in Fig.2.

System performing DMA transfer
Figure 2: System performing DMA transfer

DMA transfer can be done in some modes:

  • Single - one transfer at a time
  • Block (burst) - block of data at a time
  • On-demand - as long as the I/O device accepts transfer
  • Cycle stealing - one cycle DMA, one CPU
  • Transparent - DMA works when the CPU is executing instructions
en/multiasm/cs/chapter_3_13.txt · Last modified: 2025/01/08 21:16 by ktokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0