Site hosted by Angelfire.com: Build your free website today!

Direct Memory Access (DMA) Channels

Direct memory access (DMA) channels are system pathways used by many devices totransfer 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: thereare fewer of them and they are used by many fewer devices, and hence they usuallycause fewer problems with system setup. However, conflicts on DMA channels can cause verystrange system problems and can be very difficult to diagnose. DMAs are used most commonlytoday 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 anexplanation of the different types of DMA channels, the DMA controller, and a summary ofthe 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 itcan also be likened to the conductor of an orchestra. In early machines the processorreally did almost everything. In addition to running programs it was also responsible fortransferring data to and from peripherals. Unfortunately, having the processor performthese 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 tocontrol them, that allowed the transfer of information without the processor controllingevery aspect of the transfer. This circuitry is normally part of the system chipset on themotherboard.

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


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

Standard DMA is sometimes called "third party" DMA. This refers to the factthat the system DMA controller is actually doing the transfer (the first two parties arethe sender and receiver of the transfer). There is also a type of DMA called "firstparty" DMA. In this situation, the peripheral doing the transfer actually takescontrol 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 deviceshave much smarter and faster DMA circuitry built into them than exists in the old standardISA DMA controller. Newer DMA modes are now available, such as Ultra DMA (mode 3 or DMA-33) that provide forvery high transfer rates.

 

Limitations of Standard DMA

While the use of DMA provided a significant improvement over processor-controlled datatransfers, it too eventually reached a point where its performance became a limitingfactor. 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 thesehigh-performance devices the bandwidth they need. In fact, many of the devices that usedto use DMA on the ISA bus use bus mastering over the PCI bus for faster performance. Thisincludes newer high-end SCSI cards, and even network and video cards.


DMA Controllers

Standard DMA transfers are managed by the DMA controller, built into the system chipset on modern PCs. The original PC and XT hadone 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, thesecond controller is cascaded to the first, but with DMAs the first is cascaded to thesecond. As a result, there are 8 DMAs, from 0 to 7, but DMA 4 is not usable. There is norerouting as with IRQ2 and IRQ9 here, because all of the original DMAs (0 to 3) are stillusable directly.


DMA Channels and the System Bus

All of the DMA channels except channel 4 are accessible to devices on the ISA systembus. Channel 4 is used to cascade the two DMAcontrollers 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 wasexpanded to 16 bits with the creation of the AT. The lines to access these extra DMAchannels were placed on the second part of the AT slot that is used by 16-bit cards. Thismeans that only 16-bit cards can access DMA channels 5, 6 or 7. Unfortunately, manydevices even today are still only 8-bit cards. You can tell by looking at them and seeingthat they only use the first part of the two-part ISA bus connector on the motherboard.


DMA Request (DRQ) and DMA Acknowledgment (DACK)

Each DMA channel is comprised of two signals: the DMA request signal (DRQ)and the DMA acknowledgment signal (DACK). Some peripheral cards haveseparate jumpers for these instead of a single DMA channel jumper. If this is the case,make sure that the DRQ and DACK are set to the same number, otherwise the device won'twork (I wonder what goes through the minds of some peripheral card designers.

 

DMA, Multiple Devices and Conflicts

Like interrupts, DMA channels are single-device resources. If two devices try to usethe same DMA channel at the same time, information will get mixed up between the twodevices trying to use it, and any number of problems can be the result. DMA channelconflicts can be very difficult to diagnose.

It is possible to share a DMA channel among more than one device, but only underlimited conditions. In essence, if you have two devices that you seldom use, and that younever use simultaneously, you may be able to have them share a channel. However, this isnot the preferred method since it is much more prone to problems than just giving eachdevice its own resource.

One problem area with DMA channels is that most devices want to use DMA channels withnumbers 0 to 3 (on the first DMA controller). DMA channels 5 to 7 are relatively unusedbecause they require 16-bit cards. Considering that DMA channel 0 is never available, andDMA 2 is used for the floppy disk controller, that doesn't leave many options. On one ofmy systems I wanted to set up an ECP parallel port, a tape accelerator and a voice modemin addition to my sound card. I ran out of DMA channels between 1 and 3 very quickly. Istill had DMA channels 6 and 7 open but could not use them because all the devices Iwanted to use were either on 8-bit cards or wouldn't support the higher numbers forsoftware reasons.

Speaking of the ECP parallel port, this is another new area of concern regarding DMAresource conflicts. Many people don't realize that this high-speed parallel port optionrequires the use of a DMA channel. (Your BIOS setup program will usually have a setting to select the DMA channel, rightunder where you enable ECP. Thisshould be a good hint but still a lot of people don't notice this. ) The usual defaultfor this port is DMA 3, which is also used by many other types of devices.

 

Summary of DMA Channels and Their Typical Uses

The table below provides summary information about the 8 DMA channel numbers in atypical PC. You may find this table useful when considering how to configure your system,or for resolving DMA conflicts. For an explanation of the categories,along with more detailed descriptions, see here. To see DMA channel usage organized bydevice instead of DMA number, see this device resourcesummary.

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 diskcontroller 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

 

DMA Channel Details By Number

This section lists each of the 8 DMA channels and provides a full description of whatthey are, how they are normally used, and any special information that is relevant tothem. The general format for each section is as follows:

 

DMA0

Channel Number: 0

Bus Line: No

Typical Default Use: Memory (DRAM) Refresh.

Other Common Uses: None; for system use only.

Descript This DMA channel is reserved for use by the internal DRAMrefresh circuitry. Dynamic RAM (used for systemmemory on almost all PCs) must be refreshed frequently to make sure that it does not loseits contents. DMA channel 0 is used for this purpose and is not available for use byperipherals.

Conflicts: Most devices stay far away from DMA0, recognizing its use by the system.Beware however, as some devices actually offer DMA0 as an option. For example, some soundcards do. Do not use DMA0 for peripherals. If you have no devices set to use DMA0but a conflict becomes apparent anyway, it could be a problem with your motherboard.

 

DMA1

Channel Number: 1

Bus Line: 8/16-bit

Typical Default Use: Low DMA channel for sound card.

Other Common Uses: SCSI host adapters, ECP parallel ports, tape accelerator cards,network cards, voice modems.

Description: This DMA channel is normally taken by the sound card in your PC forits "low" DMA channel. Most sound cards today actually use two DMA channels; onemust be chosen from DMAs 1, 2 or 3, while the other can be any free DMA channel (and so isselected from the less-used 5, 6 or 7). DMA1 is also a popular choice for many otherperipherals, largely for historical reasons (on the original XT, DMA3 was used for thehard disk so DMA1 was all that was left open for everything else to share).

Conflicts: DMA1 is one of the two most contested channels in the system (the otherbeing DMA3, which is often worse). It is important to watch for conflicts between multipledevices here, particularly if you are using a sound card. It is preferable in general toleave the sound card on DMA1 and move any other devices out of its way, for compatibilitywith older (poorly written) software that assumes the sound card is on DMA1. Also watchout for ECP parallel port conflicts here.


DMA2

Channel Number: 2

Bus Line: 8/16-bit

Typical Default Use: Floppy disk controller.

Other Common Uses: Tape accelerator cards.

Description: This DMA channel is used on virtually every PC for the floppy diskcontroller. As such, it is usually not offered as an option for use by most peripherals.Some do offer it as an option however. In particular, tape accelerator cards often offerthe use of DMA2 as an option. This is probably because these cards are used for tapedrives that run off the floppy interface, and many of them can be set to drive floppydisks themselves.

Conflicts: DMA2 is not often a source of conflicts, as long as you remember not toput any other devices on it if you have a floppy disk controller in your system (whichalmost everyone does). Beware tape accelerator cards that default to DMA2 for theirchannel assignment.

 

DMA3

Channel Number: 3

Bus Line: 8/16-bit

Typical Default Use: None.

Other Common Uses: ECP parallel ports, SCSI host adapters, tape accelerator cards,sound card (low DMA), network cards, voice modems.

Description: This DMA channel is normally the only one free on the first controller(DMAs 0 to 3) when you are using a sound card. As a result, it is probably the"busiest" channel in the PC, with many different devices vying for its services.One of the most common uses of this channel is by ECP parallel ports, which require a DMAchannel unlike other parallel port modes. On very old XT systems, DMA channel 3 is used bythe hard disk drive.

Conflicts: DMA3 is probably the worst channel in the system for conflicts, becauseso many devices try to use it. It is important to watch for conflicts between multipledevices here, particularly if you are using a sound card or ECP parallel port.

 

DMA4

Channel Number: 4

Bus Line: No

Typical Default Use: Cascade for DMA channels 5 to 7.

Other Commons: None; for system use only.

Description: This DMA channel is reserved for cascading the two DMA controllers onsystems with a 16-bit ISA bus. It is not available for use by peripherals.

Conflicts: There should not be any conflicts on this channel; any problems with itindicate a possible system hardware failure.

 

DMA5

Channel Number: 5

Bus Line: 16-bit only

Typical Default Use: High DMA channel for sound card.

Other Common Uses: SCSI host adapters, network cards.

Description: This DMA channel is normally taken by the sound card in your PC forits "high" DMA channel. Most sound cards today actually use two DMA channels;one must be chosen from DMAs 1, 2 or 3 (the "low" channel), while the other isselected from a high-numbered channel like this one. Some network cards also use thischannel, though others don't use DMA at all.

Conflicts: Few conflicts arise with this channel because there are relatively fewdevices that can use DMA channels 5, 6 or 7.

 

DMA6

Channel Number: 6

Bus Line: 16-bit only

Typical Default Use: None.

Other Common Uses: Sound cards (high DMA), network cards.

Description: This DMA channel is normally open and available for use byperipherals. It is one of the least used channels in the system and is an alternativelocation for the "high" sound card DMA channel or other devices.

Conflicts: Few conflicts arise with this channel because there are relatively fewdevices that can use DMA channels 5, 6 or 7.

 

DMA7

Channel Number: 7

Bus Line: 16-bit only

Typical Default Use: None.

Other Common Uses: Sound cards (high DMA), network cards.

Description: This DMA channel is normally open and available for use byperipherals. It is one of the least used channels in the system and is an alternativelocation for the "high" sound card DMA channel or other devices.

Conflicts: Few conflicts arise with this channel because there are relatively fewdevices that can use DMA channels 5, 6 or 7.