2. CONTENTS :->
īWhat is DMA
īDMA defination
īBasic DMA operation
īDMA controller
īData transfer with DMA controller
īDMA Controller options for data transfer
ī8237 DMA Controller
īRegister Organization of 8237
īData Transfer modes
3. What is DMA :-direct memory
access
īdata are transfered by executing instructions such as
move DATAIN,R0
īAn instruction to transfer input or output data is
executed only after the processer determines that
the I/O device is ready .
īto transfer large blocks of data at high speed, an
alternative approach is used . A special control unit
may be provided to allow transfer of a block of data
directly
ībetween an external device and the main memory
,without continues intervention by the processer.
this approach is called 'direct memory access'
4. īDMA transfers are performed by a control
circuit that is part of the I/O device interface.
īwe refer to this circuit as a DMA controller.
īthe DMA controller performs the function that
would normally be carried out by the processer
when accessing the main memory.
īDevice wishing to perform DMA asserts the
processors bus request signal
īProcessor completes the current bus cycle and
then asserts the bus grant signal to the device.
5. īThe device then asserts the bus grant ack.
signal.
īThe processor senses in the change in the state
of bus grant ack. signal and starts listening to the
data and address bus for DMA activity.
īThe DMA device performs the transfer from the
source to destination address.
īDuring these transfers, the processor monitors
the addresses on the bus and checks if any
location modified during DMA operations is
cached in the processor. If the processor detects
a cached address on the busâĻ..cnti..
6. īit can take one of the two actions:
īProcessor invalidates the internal cache entry for
the address involved in DMA write operation
īProcessor updates the internal cache when a DMA
write is detected
īOnce the DMA operations have been completed,
the device releases the bus by asserting the bus
release signal.
īProcessor acknowledges the bus release and
resumes its bus cycles from the point it left off.
7. DMA
īDMA Definitions:
īDMA occurs between an I/O device and memory
without the use of the microprocessor
ī DMA read transfer data from the memory to I/O
device
ī DMA write transfer data from the I/O to memory
ī MRDC & IOWC signals to simultaneously activate
for read DMA
8. Basic DMA operation :-
īThe direct memory access (DMA) I/O technique
provides direct access to the memory while the
microprocessor is temporarily disabled.
ī A DMA controller temporarily borrows the address
bus, data bus, and control bus from the
microprocessor and transfers the data bytes directly
between an I/O port and a series of memory
locations.
ī The DMA transfer is also used to do high-speed
memory-to memory transfers.
ī Two control signals are used to request and
acknowledge a DMA transfer in the microprocessor-based
system.
9. īThe HOLD signal is a bus request signal which
asks the microprocessor to release control of
the buses after the current bus cycle.
ī The HLDA signal is a bus grant signal which
indicates that the microprocessor has indeed
released control of its buses by placing the buses
at their high-impedance states.
ī The HOLD input has a higher priority than the
INTR or NMI interrupt inputs.
11. Data transfer with DMA controller
īDuring a block input byte transfer, the following
sequence occurs as the data byte is sent from the
interface to the memory:
īThe interface sends the DMA controller a
request for DMA service.
īA Bus request is made to the HOLD pin (active
High) on the 8086 microprocessor and the
controller gains control of the bus.
īA Bus grant is returned to the DMA controller
from the Hold Acknowledge (HLDA) pin (active
High) on the 8086 microprocessor.
12. īThe DMA controller places contents of the
address register onto the address bus.
īThe controller sends the interface a DMA
acknowledgment, which tells the interface to put
data on the data bus. (For an output it signals
the interface to latch the next data placed on the
bus.)
īThe data byte is transferred to the memory
location indicated by the address bus.
īThe interface latches the data.
13. īThe Bus request is dropped, the HOLD pin goes
Low, and the controller relinquishes the bus.
īThe Bus grant from the 8086 microprocessor is
dropped and the HLDA pin goes Low.
īThe address register is incremented by 1.
īThe byte count is decremented by 1.
īIf the byte count is non-zero, return to step 1,
otherwise stop
14. DMA Controller options for data
transfer
īThe DMA Controller has several options
available for the transfer of data.
ī They are:-
1) Cycle steal
2) Burst transfer
3) Hidden DMA
15. 1) CYCLE STEAL :->
âĸ A read or write signal is generated by the DMAC,
and the I/O device either generates or latches
the data. The DMAC effectively steals cycles
from the processor in order to transfer the byte,
so single byte transfer is also known as cycle
stealing
16. 2). BURST TRANSFER :->
âĸ To achieve block transfers, some DMAC's
incorporate an automatic sequencing of the
value presented on the address bus. A register is
used as a byte count, being decremented for each
byte transfer, and upon the byte count reaching
zero, the DMAC will release the bus. When the
DMAC operates in burst mode, the CPU is halted
for the duration of the data transfer.
17. 3) HIDDEN DMA:->
âĸ It is possible to perform hidden DMA, which is
transparent to the normal operation of the CPU. In
other words, the bus is grabbed by the DMAC when
the processor is not using it.
âĸ The DMAC monitors the execution of the processor,
and when it recognises the processor executing an
instruction which has sufficient empty clock cycles
to perform a byte transfer, it waits till the processor
is decoding the op code, then grabs the bus during
this time. The processor is not slowed down, but
continues processing normally. Naturally, the data
transfer by the DMAC must be completed before the
processor starts
19. 8237 DMA Controller
īThe 8237 DMA controller supplies the memory
and I/O with control signals and memory
address information during the DMA transfer.
ī The 8237 is capable of DMA transfers at rates of
up to 1.6M bytes per second.
ī Each channel is capable of addressing a full
64K-byte section of memory and can transfer up
to 64K bytes with a single programming.
21. 1. Current Address Register
īEach of 4 DMA channels of 8237 has a 16-bit
current address register that holds the current
memory address , being accessed during DMA
transfer .
īThe address is automatically incremented or
decremented after each transfer & resulting
address value is again stored current address
register .
īThis can be byte â wise programmed by CPU i.e.
lower byte 1st & higher byte later .
22. 2.Current Word Register
īEach channel has a 16- bit current word register
that holds the number of data byte transfers of
be carried out.
īThe word count is decremented after each
transfer &new value is again stored back to the
current word register .
īWhen count becomes zero an EOP signal will be
generated . This can be written in successive
bytes by the CPU ,in program mode
23. 3.Base Address & Base Word Count
Register
īEach channel has a pair of these register . These
maintains an original copy of the resp. initial
current address register & current word register
(before increment or decrement) resp.
īThese are automatically written along with
current register .
īThese cannot be read by the CPU . The contents
of these register are used internally for auto â
initialization.
24. 4. Command Register
īThis is 8 â bit controls the complete operation of
8237.
īThis can be programmed by the CPU and
cleared by a reset operation .
25. 5.Mode Register
īEach of channel has 8 bit mode register . This is
written by the CPU program mode.
īBits 0 or 1 of mode register determine which of
the four channel mode register is to be written .
īThe bits 2 & 3 indicate the type of DMA transfer.
īBit 4 indicates whether auto- initialization is
selected or not , while bit 5 indicates whether
address increment or decrement mode is
selected .
26. 6.Request Register
īEach channel has a request register bit
associated with it , in the request register .
īThese are nonmaskable & subject to
prioritization by the priority resolving network
of 8237 .
īEach bit is set or reset under program control or
is cleared upon generation of a TC or an external
EOP. This register is cleared by reset.
27. 7.Mask Register
īEach of 4 channel has a mask bit which can be
set under program control to disable the
incoming DREQ request at the specific channel .
īThis bit is set when corresponding channel
produces an EOP signal , if channel is not
programmed for auto â initialization .
īThe register is set to FFH after a reset operation.
This disables all the DMA request till the mask
register is cleared
28. 8.Temporary Register
īThe temporary register holds data during
memory to memory data transfers .
īAfter the completion of the transfer operation ,
the last word transferred remains in the
temporary register till it is cleared by the reset
operation .
29. 9.Status Register
īStatus register keeps the track of the all DMA
channel pending request & status of their
terminal count .
īThe bit Do-D3 are updates every time , the
corresponding channel reaches TC or external
EOP occurs . These are cleared upon reset and
also on each status read operation .
30. Important signal pins
īDREQ3 â DREQ0 (DMA request):
Used to request a DMA transfer for a
particular DMA channel.
īDACK3 â DACK0 (DMA channel
acknowledge): Acknowledges a
channel DMA request from a device.
ī HRQ (Hold request): Requests a
DMA transfer.
31. īHLDA (Hold acknowledge) signals the 8237 that
the microprocessor has relinquished control of
the address, data and control buses.
īMEMW (Memory write): Used as an output to
cause memory to write data during a DMA write
cycle.
ī MEMR (Memory read): Used as an output to
cause memory to read data during a DMA read
cycle
32. ī A3 â A0 : address pins select an internal
register during programming and provide part
of the DMA transfer address during DMA
operation.
īA7 â A4 : address pins are outputs that provide
part of the DMA transfer address during a DMA
operation.
ī DB0 â DB7 : data bus, connected to
microprocessor and are used during the
programming DMA controller.
33. Data Transfer modes
1) Single Transfer Mode
ī In Single Transfer mode the device is programmed
to make one transfer only.
ī The word count will be decremented and the
address decremented or incremented following each
transfer.
ī 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.
34. 2) Block Transfer Mode
ī In Block Transfer mode the device is activated
by DREQ to continue making transfers during
the service until a TC, caused by word count
going to FFFFH, or an external End of Process
(EOP) is encountered.
ī DREQ need only be held active until DACK
becomes active. Again, an Auto initialization will
occur at the end of the service if the channel has
been programmed for it.
35. 3)Demand transfer mode
īDevice continues transfer until a TC is reached
or an external EOP is detected or the DREQ
signal goes inactive .
īAfter the I/O device is able to catch up , the
service mat be re-established activating DREQ
signal again.
īOnly EOP generated by TC or external EOP can
cause the auto- initialization and only if it is
programmed for .
36. 4)Cascade mode
īIn this mode ,more than one 8237 can be
connected together to provide more than four
DMA channels .
īThe HRQ & HLDA signals from additional
8237s are connected with DREQ & DACK pins
of channel of the host rsp.
īThe priority of the DMA requests may be
preserved at each level.
37. 5)Memory to memory transfer
âĸ To perform the transfer of the block of data from
one set of memory address to another one ,this
mode is used.
âĸ The transfer is initialize by setting DREQo using
software command .
âĸ The 8237 sends HRQ signal to CPU as usual &
when HLDA signal is activated by CPU ,device
starts operating in block transfer mode to read
the data from file.
38. âĸ The channel 0 current register acts as a source
pointer.
âĸ The byte read data from memory is stored in an
internal temporary register of 8237.
âĸ The channel 1 current register acts as a
destination pointer to write the data from
temporary register to the destination memory.
âĸ The pointers are automatically incremented or
decremented , depending upon the
programming .