📄 dma.ug
字号:
Using DMA with ATA or ATAPI
a guide to all the requirements and problems
by Hale Landis
Version 14x and higher
INTRODUCTION
------------
NOTE: If you are using a Serial ATA controller see the SATA.UG
documentation file.
Use this guide with ATADRVR versions 14 and 15 and with any of
Hale's programs that use ATADRVR versions 14 or 15: ATADEMO and
ATACT. Also see the PIO.UG documentation file.
Support for ISA Multiword DMA was added in ATADRVR version 13A.
Using this new feature may require that you modify an ATA host
adapter since most cheap ATA host adapters don't have the wires
needed to support this data transfer mode.
Support for PCI Bus Mastering DMA was added in ATADRVR version
13D. Using this new feature requires a PCI motherboard with an
onboard ATA host adapter that is Intel "south bridge" ICHx
compatible and also conforms to the T13 1510D "Host Adapter
Standard" document. A compatible adapter uses a block of I/O
addresses known as the Bus Master Control Registers (BMCR).
WHY SO MANY DMA MODES?
----------------------
In the entire history of ATA (and ATAPI) so far there have been
three DMA modes defined for ATA (and ATAPI) devices:
- ISA Single Word DMA (SW) with 3 speeds
- Multiword DMA (MW) with 3 speeds
- Ultra DMA (UDMA) with 6 speeds
This is the simple part. The complex part is what is required in
the host to support these data transfer modes and the various
speeds. Each mode and its requirements will be discussed below.
ISA SINGLE WORD MODE (SW)
-------------------------
This mode, originally defined in ATA-1, was made obsolete in
ATA-3. It is really slow and was never really used by any
devices or hosts. In this mode, the device and the host toggle
the DMARQ and DMACK signals for each data word transferred.
However, I strongly recommend that you study this old protocol
(in ATA-1 or ATA-2) since any Multiword DMA transfer can be made
to look like a Single Word transfer.
ATADRVR can be made to support this mode by changing one line in
ATAIOISA.C (search for the text "DMA_MODE_DEMAND" and
"DMA_MODE_SINGLE").
To use this mode you will need a modified ISA ATA host adapter,
see below.
ISA MULTIWORD MODE (MW)
-----------------------
This mode, originally defined in ATA-1, was enhanced in ATA-2 to
have the same data transfer speeds as PIO Modes 3 and 4. In this
mode, the device and the host toggle DMARQ and DMACK for each
"block" of data words transferred. A typical "block" of words is
64 to 256 words.
The original definition of this mode in ATA-1 had only one
transfer speed (cycle time): Mode 0. Mode 0 is really slow -- it
is the native speed of an ISA bus DMA controller. As a result
this mode was not used very much. However, I strongly suggest
testing ATA and ATAPI devices using this mode since it will
uncover many firmware timing and caching issues.
ATA-2 added MW Modes 1 and 2 with transfer timing equivalent to
PIO Modes 3 and 4 (up to 16Mbytes/second). To use MW modes 1 and
2, you will need a PCI bus ATA host adapter. While this hardware
has been available for some time, the host operating system
device drivers have not be available or have been so buggy that
this data transfer mode can't be used reliably.
Starting with ATADRVR version 13A, MW mode 0 is supported,
however, to use this mode you will need a modified ISA ATA host
adapter, see below.
Starting with ATADRVR version 13D, MW modes 1 and 2 are
supported, however, to use this mode you will need a PCI ATA host
adapter, see below.
ULTRA DMA (UDMA)
----------------
Ultra DMA is the newest DMA transfer mode. UDMA was added in
ATA/ATAPI-4 and can transfer data up to 33Mbytes/second using
modes 0, 1 and 2. ATA/ATAPI-5 adds UDMA modes 3 and 4 that
can transfer data up to 66Mbytes/second. ATA/ATAPI-6 adds
UDMA mode 5 that can transfer data up to 100Mbytes/second.
UDMA requires one the newest PCI ATA host adapters.
ATA/ATAPI DMA SUMMARY
---------------------
The following table shows the various modes and host adapters
used.
DMA mode ATA version type of host
of device adapter required
-------- ----------- ----------------------------------
SW 0,1,2 ATA-1 or Standard ISA bus ATA host adapter
ATA-2 (a cheap $10US kind) modified as
described below.
MW 0 any Standard ISA bus ATA host adapter
(a cheap $10US kind) modified as
described below.
MW 1,2 ATA-2, A PCI ATA host adapter with
ATA-3 or ATA MW DMA support, see below.
ATA/ATAPI-4
UDMA ATA/ATAPI-4 A newer PCI bus ATA host adapter
0,1,2 with UDMA support, see below.
These are known as the Ultra
DMA 33 modes.
UDMA ATA/ATAPI-5 Faster UDMA modes known as the
3,4 Ultra DMA 66 modes. These modes
*require* an 80-conductor cable.
See below.
UDMA ATA/ATAPI-6 Even faster UDMA mode known as
5 Ultra DMA 100. This mode also
*requires* an 80-conductor cable.
See below.
USING MW DMA MODE 0 ON AN ISA BUS
---------------------------------
Starting with ATADRVR version 13A, ISA bus Multiword DMA mode 0
is supported. See the file ataiodma.c. This DMA mode is not
fast and has never been popular and this makes using it
difficult. All that is required is a simple/cheap ISA bus ATA
host adapter with the proper wiring. The problem is that most
simple/cheap ATA host adapters don't have the required wires
connected to the DMA Request and DMA Acknowledge signals. If you
have some experience with a soldering iron you can add these
wires in a few minutes.
Here is what I did:
1) Obtain a simple/cheap ATA host adapter (usually about $10 US).
2) Understand how the ISA bus signals are labelled:
If you look down on the card you see something like this:
metal bracket component side of card
A1 ... A31 C1 ... C18
|
|==================================================
|
B1 ... B31 D1 ... D18
solder side of card
The ISA bus connections (gold tabs at the edge of the card)
are labeled A1-A31, B1-B31, etc.
The signals that are not normally connected on these
simple/cheap cards are:
D10 DMACK5- DMA Acknowledge for channel 5
D11 DMARQ5 DMA Request for channel 5
D12 DMACK6- DMA Acknowledge for channel 6
D13 DMARQ6 DMA Request for channel 6
D14 DMACK7- DMA Acknowledge for channel 7
D15 DMARQ7 DMA Request for channel 7
Verify that nothing is connected to tabs D10-D15.
Locate the ATA connector on the board -- it is a double row of
pins that the cable plugs into. Usually pin 1 is marked in
some way (by the number 1 or by a dot). The colored stripe on
the cable marks the pin 1 side of the cable.
pin 2 pin 40
::::::::::::::::::::
pin 1 pin 39
The signals that are not normally connected on these
simple/cheap cards are:
pin 21 DMARQ ATA device's DMA Request
pin 29 DMACK- ATA device's DMA Acknowledge
Verify that nothing is connected to pins 21 and 29.
3) You must connect one wire between the ATA cable connector pin
21 (DMARQ) and one of the DMARQx signals on the ISA connector
(ISA tab D11, D13 or D15). You must connect one wire between
the ATA cable connector pin 29 (DMACK-) and one of the DMACKx-
signals on the ISA connector (ISA tab D10, D12 or D14).
If you chose DMARQ5 then you must use DMACK5-, if you chose
DMARQ6 then you must use DMACK6-, and the same for DMARQ7 and
DMACK7-. This determines which 16-bit ISA bus DMA channel
will be used.
But the big problem is this: many of the simple/cheap boards
don't have the gold tab on the ISA connector for these
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -