DMA Controller
DMA Controller
Need: We know that generally whenever there exists a need for transfer of
data between peripherals and main memory, then first the data is given to
the processor by the input device and then the processor further transfers
the data to the memory.
And at the time of data transfer operation, the processor cannot be able to
execute any other operation.
Hence when the system has a DMA controller then it frees the CPU from
data transfer operation and at that particular time being the CPU can
execute other operations.
Till now we have discussed the need of DMA controller let us move further
and understand how DMA executes any instruction for data transfer.
Operation of DMA Controller in Microprocessor
Basically whenever an I/O device needs to transfer the data to the memory,
then it initially sends a request to DMA controller. On receiving data
transfer request the controller sends HOLD request to the CPU and waits
for HLDA which is nothing but hold acknowledge by the CPU.
So, on getting HOLD request by the controller, the CPU leaves the control
over all the buses (i.e., data, control and address bus) and sends HLDA to
the controller.
Hence now the processor gets free from any data transfer operation until
an interrupt is generated by the DMA controller about the completion of the
transfer.
In the idle cycle of the system, initially when the system gets on, then the
processor has control over the system buses, as the switch are connected
with the X position.
This is so because, in this position, the buses form the connection between
main memory and peripherals through the processor. So, in this position,
the processor performs the execution of the instruction.
But once, need arises to read the data from the disk. Then the
microprocessor sends an instruction to the disk controller about the read
operation of that particular data.
On fetching the required data, the disk controller (peripheral device) sends
DMA request, i.e., DRQ signal to the DMA controller. This DRQ signal
shows that the device directly wants to transfer the data to the memory
without disturbing the processor.
So, on receiving the DRQ signal, HOLD request i.e., HRQ signal is sent by
the DMA controller to the microprocessor.
The HRQ signal shows the interest of the DMA controller to have access to
system buses. So, on receiving HOLD request, the CPU tristates its buses
in order to grant the control to the DMA controller.
Once the processor frees the buses, then it sends the HLDA signal to the
DMA controller. And on receiving HLDA signal, the control over the buses
is given to the DMA controller as the switch position now changes from X to
Y.
So, gaining control over the buses, the active cycle of the DMA gets
enabled. Thus now it sends the acknowledge signal DACK to the disk
controller that shows that it is now ready for the transfer of data.
Now, after acknowledging the disk controller, further, the DMA controller
loads the control signal over the bus according to the operation that is to be
performed.
Suppose in case of a write operation, IOR’ and MEMW’ signals are loaded.
So, when IOR signal is received by the disk controller then it loads the
required data into the data bus. Also, MEMW’ signal shows the presence of
address on the address bus where the data is to be transferred.
Thus the disk controller can directly transfer the data to the desired
memory location without the CPU utilization.
Once the data transfer is accomplished then the DMA controller generates
an interrupt by varying switch position from Y to again X. This indicates the
microprocessor about the completion of the data transfer operation.
So, by this, the control of the buses is again transferred to the processor
and it starts executing the further operation. This is the basic functioning of
the DMA controller inside the system.
Features of 8257A
1. It consists of 4 channels that can be utilized over 4 input/output devices.
2. All of the 4 channels can be separately programmed.
3. All the 4 channels hold the 16-bit address and 14-bit counters
individually.
4. The permissible data transfer is up to 64 Kb.
5. The operating frequency ranges between 250 Hz to 3 MHz.
6. The three operations performed are: read transfer, write transfer and
verify the transfer.
7. The two operating modes of 8257 are master mode and slave mode.
The figure below shows the pin diagram of 8257 DMA controller: