Chapter 5: | Direct Memory Access |
---|---|
Section 0: | Print copy |
Page 1: |
FOCT Hardware | TABLE OF CONTENTS | PREVIOUS | NEXT | HELP | SEARCH | INDEX |
|
To gain insight into the operation of a Direct Memory Access controller. |
Section 1, page 1: Definitions |
Section 1, page 2: DMA Controller |
|
The DMA controller can issue commands to the memory that behave exactly like the commands issued by the CPU. The DMA controller in a sense is a second processor in the system but is dedicated to an I/O function. The DMA controller as shown below connects one or more I/O ports directly to memory, where the I/O data stream passes through the DMA controller faster and more efficiently than through the processor as the DMA channel is specialised to the data transfer task. |
Figure 5-1: A microcomputer with a direct memory-access controller
Stone, H.S. 1982, Microcomputer interfacing, Addison-Wesley, Reading, Mass., p. 5.
Section 1, page 3: The DMA interface |
|
The DMA adds one more level of complexity to the I/O interface because a DMA controller has independent access to memory. One set of wires (bus) can carry at most one transaction at a time. If the DMA and a microprocessor share the signal wire to memory there must be a mechanism to arbitrate which shall have access to memory when both attempt to at the same time. |
Section 1, page 4: Functional behaviour of a DMA transaction |
Section 1, page 5: DMA interface operation |
Section 1, page 6: DMA interface animation |
Figure 5-2: A typical direct memory-access controller interface
Stone, H.S. 1982, Microcomputer interfacing, Addison-Wesley, Reading, Mass., p. 27.
Section 2, page 1: DMA controllers |
|
DMA controllers were expensive and complex subsystems with complexity comparable to a small processor. Large Scale Integration (LSI) implementation of the DMA controller has reduced the size to the stage where it can be incorporated on a single chip. |
Section 2, page 2: DMA controller operation |
|
The figure below shows the basic structure of a DMA channel and due to it operating in a similar manner to the processor it has a full bus interface. The DMA controller has 3 independent channels, each channel contains an address register, a control register and a byte counter. To transfer a block of data between an external device or I/O port and memory the controller stores initial values in the address control and byte count registers. The DMA channel then transfers the block of information from or to memory according to the direction of the transfer encoded in the command register. The starting address of the block in memory is given by the address register, and the length of the block is given by the byte count. To make the transfer the DMA controller has to synchronise the activities of the processor to the external device, before each transfer the controller waits for both the external device to be ready and the processor to be idle. |
Figure 5-3: The structure of a typical DMA controller
Stone, H.S. 1982, Microcomputer interfacing, Addison-Wesley, Reading, Mass., p. 149.
Section 2, page 3: DMA interface with I/O |
|
Interfacing with the I/O port requires two signals per port-- TRANSFER REQUEST and TRANSFER ACK--plus the ability to generate I/O READ/WRITE L to indicate to the port the direction of the transfer. The DMA controller accepts a TRANSFER REQUEST from the port when the port has data ready to write into memory or has an empty buffer that can accept data from memory. When a transfer is to take place, the DMA outputs the control signal TRANSFER ACK, which indicates the port should receive data from or write data into memory. |
Section 2, page 4: Controller accessing memory |
|
As described before the DMA controller has a
HALT request O/P signal and a HALT ACKNOWLEDGE I/P. During the byte-by-byte
transfer of a block of data, the controller watches for a TRANSFER REQUEST
on a channel. Then the controller asserts HALT and waits for HALT ACKNOWLEDGE.
This instructs the processor to relinquish the memory bus. When the processor
relinquishes the bus it asserts HALT ACKNOWLEDGE and the DMA controller
has access to memory. The controller simultaneously:
1. places an address on the bus 2. sends TRANSFER ACK to the requesting I/O port and 3. sends the proper polarity of READ/WRITE L to memory and the complement of this signal to the I/O system. |
Section 2, page 5: DMA interface operation |
Section 2, page 6: i8527 DMA controller |
Figure 5-4: Structure of the i8527 DMA controller
Stone, H.S. 1982, Microcomputer interfacing, Addison-Wesley, Reading, Mass., p. 152.
The chip has four signals associated with the
READ and WRITE operation. MEM READ L and MEM WRITE L are signals produced
by DMA controller to exercise memory. The two signals I/O READ L and I/O
WRITE L are bidirectional, they are inputs from the microprocessor when
the microprocessor sends commands to the 8257 and reads back the 8257 status.
During the I/O operation these signals are output from the 8257 and are
functionally opposite to the memory signals. The 8257 takes control of
the bus by exercising HALT (HRQ) and receives back the "go-ahead" signal
on HALT ACKNOWLEDGE (HLDA).
Two signals produced by the DMA controller can be used by the I/O port to assist in controlling the transfer process. One signal TC--terminal count--is asserted during the last cycle of a DMA block. This can be used to describe a DMA mode on an I/O port or to reset the port's internal state to indicate the end of a transfer. The second--MARK--is inserted when the remaining count on a channel became a multiple of 128--providing a convenient timing signal for an external device. |
Section 3, page 1: Chapter evaluation |
|
Chapter
Evaluation
If you haven't already done so for this chapter, please take a few minutes to complete the Chapter Evaluation Form. Your input is vital to the continued improvement of the on-line delivery of this unit.
|
FOCT Hardware | TABLE OF CONTENTS | PREVIOUS | NEXT | HELP | SEARCH | INDEX |