Make your own free website on Tripod.com

DMA ~ Direct Memory Access

 

Introduction

The DMA is used to free the CPU from direct control of data transfer between the memory and the Input/Output (I/O) Peripherals by making use of Channels. During this time the processor will continue working on something else.

 

Direct Memory Access (DMA) Channels

Direct memory access (DMA) channels are system pathways used by many devices to transfer information directly to and from memory. DMA channels are not nearly as "famous" as IRQs as system resources go. This is mostly for a good reason: there are fewer of them and they are used by many fewer devices, and hence they usually cause fewer problems with system setup. However, conflicts on DMA channels can cause very strange system problems and can be very difficult to diagnose. DMAs are used most commonly today by floppy disk drives, tape drives and sound cards.

 

Limitations of Standard DMA

While the use of DMA provided a significant improvement over processor-controlled data transfers, it too eventually reached a point where its performance became a limiting factor. DMA on the ISA bus has been stuck at the same performance level for over 10 years. For old 10 MB XT hard disks, DMA was a top performer. For a modern 8 GB hard disk, transferring multiple megabytes per second, DMA is insufficient.

On newer machines, disks are controlled using either programmed I/O (PIO) or first-party DMA (bus mastering) on the PCI bus, and not using the standard ISA DMA that is used for devices like sound cards. Hard disk transfer modes are discussed in detail here. This type of DMA does not rely on the slow ISA DMA controllers, and allows these high-performance devices the bandwidth they need. In fact, many of the devices that used to use DMA on the ISA bus use bus mastering over the PCI bus for faster performance. This includes newer high-end SCSI cards, and even network and video cards.

 

Direct Memory Access (DMA) Channels

Direct memory access (DMA) channels are system pathways used by many devices to transfer information directly to and from memory. DMA channels are not nearly as "famous" as IRQs as system resources go. This is mostly for a good reason: there are fewer of them and they are used by many fewer devices, and hence they usually cause fewer problems with system setup. However, conflicts on DMA channels can cause very strange system problems and can be very difficult to diagnose. DMAs are used most commonly today by floppy disk drives, tape drives and sound cards.

 

DMA Channel Function and Operation

This section takes a look at DMA channels and how they work. This includes an explanation of the different types of DMA channels, the DMA controller, and a summary of the different DMA channels used in the PC.

 

Why DMA Channels Were Invented for Data Transfer

As you know, the processor is the "brain" of the machine, and in many ways it can also be likened to the conductor of an orchestra. In early machines the processor really did almost everything. In addition to running programs it was also responsible for transferring data to and from peripherals. Unfortunately, having the processor perform these transfers is very inefficient, because it then is unable to do anything else.

The invention of DMA enabled the devices to cut out the "middle man", allowing the processor to do other work and the peripherals to transfer data themselves, leading to increased performance. Special channels were created, along with circuitry to control them, that allowed the transfer of information without the processor controlling every aspect of the transfer. This circuitry is normally part of the system chipset on the motherboard.

Note that DMA channels are only on the ISA bus (and EISA and VLB, since they are derivatives of it). PCI devices do not use standard DMA channels at all.

 

DMA Controllers

The DMA controller, built into the system chipset on modern PCs, manages standard DMA transfers. The original PC and XT had one of these controllers and supported 4 DMA channels, 0 to 3.

Starting with the IBM AT, a second DMA controller was added. Much in the way that the second interrupt controller was cascaded with the first, the first DMA controller is cascaded to the second. The difference is that with IRQs, the second controller is cascaded to the first, but with DMAs the first is cascaded to the second. As a result, there are 8 DMAs, from 0 to 7, but DMA 4 is not usable. There is no rerouting as with IRQ2 and IRQ9 here, because all of the original DMAs (0 to 3) are still usable directly.

 

Third-Party and First-Party DMA (Bus Mastering)

Standard DMA is sometimes called "third party" DMA. This refers to the fact that the system DMA controller is actually doing the transfer (the first two parties are the sender and receiver of the transfer). There is also a type of DMA called "first party" DMA. In this situation, the peripheral doing the transfer actually takes control of the system bus to perform the transfer. This is also called bus mastering.

Bus mastering provides much better performance than regular DMA because modern devices have much smarter and faster DMA circuitry built into them than exists in the old standard ISA DMA controller. Newer DMA modes are now available, such as Ultra DMA (mode 3 or DMA-33) that provide for very high transfer rates.

 

DMA Channels and the System Bus

All of the DMA channels except channel 4 are accessible to devices on the ISA system bus. Channel 4 is used to cascade the two DMA controllers together. PCI devices do not use standard system DMA channels.

As was the case with IRQs, the second DMA controller was added when the ISA bus was expanded to 16 bits with the creation of the AT. The lines to access these extra DMA channels were placed on the second part of the AT slot that is used by 16-bit cards. This means that only 16-bit cards can access DMA channels 5, 6 or 7. Unfortunately, many devices even today are still only 8-bit cards. You can tell by looking at them and seeing that they only use the first part of the two-part ISA bus connector on the motherboard.

 

Summary of DMA Channels and Their Typical Uses

The table below provides summary information about the 8 DMA channel numbers in a typical PC. You may find this table useful when considering how to configure your system, or for resolving DMA conflicts. To see DMA channel usage organized by device instead of DMA number.

DMA

Bus Line?

Typical Default Use

Other Common Uses

0

No

Memory Refresh

None

font face="Arial, Arial, Helvetica">

1

8/16-bit

Sound card (low DMA)

SCSI host adapters, ECP parallel ports, tape accelerator cards, network cards, voice modems

2

8/16-bit

Floppy disk controller

Tape accelerator cards

3

8/16-bit

None

ECP parallel ports, SCSI host adapters, tape accelerator cards, sound card (low DMA), network cards, voice modems, hard disk controller on old PC/XT

4

no

None; cascade for DMAs 0-3

None

5

16-bit only

Sound card (high DMA)

SCSI host adapters, network cards

6

16-bit only

None

Sound cards (high DMA), network cards

7

16-bit only

None

Sound cards (high DMA), network cards

References :

Microprocessors and Interfacing ~ Second Edition
The 8086 and 8088 Chipset
PC Guide