Direct Memory Access (DMA) is a mechanism that allows peripherals to transfer data directly to and from the main memory without involving the central processing unit (CPU) for every data transfer.

DMA enhances overall system performance by reducing the CPU’s involvement in data transfer operations and allowing it to focus on other tasks.

DMA controller takes over the buses to manage the transfer directly between the I/O device and
memory (Bus Request/Grant)

Here’s an overview of how DMA works:

  1. Initialization:
    • The CPU initializes the DMA controller by providing it with the necessary information for the data transfer, such as source and destination addresses, transfer size, and the direction of transfer (read or write).
  2. Request for DMA:
    • When an I/O device needs to transfer a block of data, it sends a request to the DMA controller. The DMA controller then coordinates the data transfer without CPU intervention.
  3. DMA Controller Takes Control:
    • The DMA controller temporarily takes control of the system bus from the CPU. This allows the DMA controller to communicate directly with the memory and the I/O device.
  4. Memory Addressing:
    • The DMA controller generates memory addresses and controls the data bus to transfer data directly between the I/O device and the main memory. This is done without the CPU’s involvement.
  5. Data Transfer:
    • Data is transferred directly between the I/O device and the main memory. The CPU is free to perform other tasks during this time.

1) I/O Device sends a DMA request
2) DMAC activates the BR line
3) CPU responds with BG line
4) DMAC sends a DMA acknowledgment to the I/O device
5) I/O device puts a word in the data bus (for memory write)
6) DMAC writes data to the address specified by an Address Register
7) Decrement Word count register
8) Word count register = 0 EOT interrupt CPU
9) Word count register  0 DMAC checks the DMA request from the I/O device

Benefits of DMA:

  • Improved Performance: DMA significantly improves system performance by offloading data transfer tasks from the CPU.
  • Efficient Data Transfer: DMA allows for efficient block transfers of data between peripherals and memory, reducing the overhead associated with programmed I/O.
  • Concurrency: DMA enables the CPU to perform other operations concurrently while data transfers are happening.

Types of DMA:

  • Cycle Stealing DMA: The DMA controller transfers one data word at a time before relinquishing control of the bus to the CPU briefly.
  • Burst Mode DMA: The DMA controller gains control of the bus for a block of data transfers without relinquishing control until the entire block is transferred.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *