Exploiting Your Resources

Pages: 1 2 3 4 5

Direct Memory Access (DMA) Channels

As you know, the processor is the “brain” of the PC, 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 while this is happening.

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. (As a result, the importance of DMA channels has been greatly diminished in recent years.)

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.

While the use of ISA 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 18 GB hard disk, transferring multiple megabytes per second, DMA is inadequate.

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. 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, as well as network and even some video cards.

Getting back to standard DMA: transfers are managed by the DMA controller, built into the system chipset on modern PCs. 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 the way it was done with interrupts, the two controllers are logically cascaded. 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.

Due to the diminished role of the ISA bus, DMA channels are under less “contention” than IRQs are in most systems. Conflicts often occur surrounding DMA channels 1 and 3, which several types of devices (sound cards, ECP parallel ports, some voice modems) want to use. This table shows typical uses of DMA channels:

DMA

Bus Line?

Typical Default Use

Other Common Uses

0

no

Memory Refresh

None

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


Pages: « Prev   1 2 3 4 5   Next »

Be the first to discuss this article!