DMA Controller
A DMA controller interfaces with several peripherals that may request DMA.
DMA controller commonly used with 8086 is the 8237 programmable device.
• CWCR : The current word count register, programs a channel for the number
of bytes (up to 64K) transferred during a DMA action.
• BA & BWC : The base address and base word count , registers
are used when auto-initialization is selected for a channel. In this mode, their
contents will be reloaded to the CAR and CWCR after the DMA action is
completed.
• MSR : The mask register, clears or sets all of the masks with
one command instead of individual channels as with the
MRSR.
Advanced Microprocessor 18
DMA
Advanced Microprocessor 19
DMA
Advanced Microprocessor 20
DMA
• Transfers may continue until the I/O device has exhausted its data
capacity. the DMA service can be re-established by means of a DREQ.
Advanced Microprocessor 21
DMA
Cascade Mode:
• more than one 8237A
together for simple system
expansion.
Advanced Microprocessor 22
DMA
Internal registers:
• BA & BWC : The base address and base word count , registers
are used when auto-initialization is selected for a channel. In this
mode, their contents will be reloaded to the CAR and CWCR after
the DMA action is completed.
Advanced Microprocessor 25
DMA
• MSR : The mask register, clears or sets all of the masks with
one command instead of individual channels as with the
MRSR.
Advanced Microprocessor 26
DMA
2 2 CP
4 CP
Advanced Microprocessor 27
DMA
8237A-5 Request register
8237A-5 mask set / reset register
Advanced Microprocessor 28
DMA
Advanced Microprocessor 29
DMA
Advanced Microprocessor 30
DMA
• Transfers may continue until the I/O device has exhausted its data
capacity. the DMA service can be re-established by means of a DREQ.
Advanced Microprocessor 31
DMA
Cascade Mode:
• more than one 8237A
together for simple system
expansion.
Advanced Microprocessor 32
DMA
Software Command:
• There are 3 software commands used to control the operation
of the 8237.
Software commands,
- Clear the first/last f/f : clear the first/last f/f within the 8237.
if F/L = 0, the low order byte is selected for read/write in the
current address & current count register.
if F/L = 1, the high order byte is selected for read/write in the
current address & current count register.
- Master clear : acts same as RESET signal to the 8237, this command
disables all channels
if the state of the F/L f/f is unknown, the count and address
Could be programmed incorrectly
Memory
CPU DMA
Data – Address - Control
Handshaking
Typical DMA Module Diagram
Block Transfer Mode
• DREQ need only be held active until DACK becomes active. Again, an
Autoinitialization will occur at the end of the service
if the channel has been programmed for it.
Demand Transfer Mode:
• In Demand Transfer mode the device is programmed to continue making
transfers until a TC or external EOP is encountered or until DREQ goes inactive.
• Transfers may continue until the I/O device has exhausted its data capacity.
the DMA service can be re-established by means of a DREQ.
• EOP can cause an Autoinitialize at the end of the service. EOP is generated
either by TC or by an external signal.
DMA
Cascade Mode:
• more than one 8237A together
for simple system
expansion.
Advanced Microprocessor 40
Data Transfer modes:
• When the word count ``rolls over'' from zero to FFFFH, a Terminal Count
(TC) will cause an Auto initialize if the channel has been programmed to do
so.
DMA
• A remote bus master microprocessor can execute variable
software but the DMA controller can only transfer data.
• Access to the shared bus for the remote bus master is
accomplished via a bus arbiter.
• A bus arbiter functions to resolve priority between bus
masters and allows only one device at a time to access the
shared bus.
Bus Arbiter:
Advanced Microprocessor 43
DMA
DMA Definitions:
Advanced Microprocessor 44
DMA
Basic DMA operation:
Advanced Microprocessor 45
DMA
Advanced Microprocessor 46
DMA
Advanced Microprocessor 47
DMA
• The 8237 DMA controller supplies the memory and I/O with
control signals and memory address information during the DMA
transfer.
Advanced Microprocessor 48
DMA
Advanced Microprocessor 49
DMA
Some important signal pins:
Advanced Microprocessor 50
DMA
Some important signal pins:
Advanced Microprocessor 53
I/O Data Transfer (cont’d)
• 8237 supports four types of data transfer
– Single cycle transfer
• Only single transfer takes place
• Useful for slow devices
– Block transfer mode
• Transfers data until TC is generated or external EOP signal is
received
– Demand transfer mode
• Similar to the block transfer mode
• In addition to TC and EOP, transfer can be terminated by
deactivating DREQ signal
– Cascade mode
• Useful to expand the number channels beyond four
Basic process of DMA
In maximum mode:
Handshaking Pins: RQ/GT1 and RQ/GT0 DMA request and acknowledge
Sequences:
1) Peripheral asserts one of the request pins, e.g. RQ/GT1 or RQ/GT0 (RQ/GT0 has
higher priority)
2) CPU completes its current bus cycle and enters into a HOLD state
3) CPU grants the right of bus control by asserting a grant signal via the same pin
as the request signal.
4) DMA operation starts
5) Upon completion of the DMA operation, the peripheral asserts the
request/grant pin again to relinquish bus control.
In minimum mode:
The HOLD and HLDA pins are used for handshaking