### TechNote

Number: 04508-01
Date: April 1994

## Direct Memory Access

Direct Memory Access (DMA) is a process that allows Input/Output (I/O) devices in a computer to exchange data directly with the computer's memory without passing the data through the microprocessor. DMA is an alternative to Programmed I/O (PIO). In PIO data transfers, the microprocessor reads the data from the sending device and writes it to the receiving device using I/O ports. In DMA data transfers, data can bypass the microprocessor as it moves between system memory and I/O devices across the system bus. Therefore, DMA often improves computer performance, because the microprocessor does not have to interrupt its processing activities to manage data transfers. Instead, all data transfers are handled by the DMA controller, which is integrated into the main circuit board ('system board') or into the processor board.

Each I/O device is assigned a DMA channel, which it uses to set up a DMA transfer. Each DMA channel has a number, which allows the DMA controller to arbitrate DMA requests. To set up a DMA transfer, the following procedure takes place:

1. An I/O device, such as an adapter, uses its DMA channel to initiate the DMA transfer by sending the following data to the DMA controller's registers: the memory starting address, the length of transfer, whether it is to read to or write from memory, and the DMA type. The DMA type determines the transfer rate (up to 3.5Mbytes/s for most AT-compatible computers) and the width of the data (8 or 16).

2. The I/O device generates a DMA request signal, which it sends to the DMA controller.

3. The DMA controller suppresses the CPU by exerting an inhibit control line on the CPU. A buffer floats the signals that the CPU outputs, thereby completely disconnecting the CPU from the system bus.

4. The DMA controller allows the I/O device to read a block of data from memory or to write a block of data to memory.

5. The DMA controller releases the inhibit line and the CPU resumes what it was doing. Some computers support two or more DMA cycles before releasing the inhibit line. DMA transfers take longer to set up than PIO, but once they start the data transfer rate is faster. Therefore, it is better to use PIO for small blocks of data and DMA for larger amounts. An exception is that DMA tends to run slower in computers that have a memory manager installed.

You can configure Madge Ringnodes either for PIO or DMA to optimize performance. Furthermore, the Smart 100 Ringnodes, designed for Fast Token Ring networks, can transfer the first part of a data packet by PIO and the rest by DMA to provide the best possible performance.