Chapter 13 Direct Memory Access and DMA-Controlled I/O

Similar documents
The 8237 DMA Controller: -

SNJB College of Engineering Department of Computer Engineering

Unit DMA CONTROLLER 8257

Design with Microprocessors

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

2. List the five interrupt pins available in INTR, TRAP, RST 7.5, RST 6.5, RST 5.5.

DATASHEET 82C37A. Features. CMOS High PerformanceProgrammable DMA Controller. FN2967 Rev 4.00 Page 1 of 26. October 2, FN2967 Rev 4.

Instructions Involve a Segment Register (SR-field)

EC 6504 Microprocessor and Microcontroller. Unit II System Bus Structure

UNIT-IV. The semiconductor memories are organized as two-dimensional arrays of memory locations.

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

Overview of Intel 80x86 µp

UNIT II OVERVIEW MICROPROCESSORS AND MICROCONTROLLERS MATERIAL. Introduction to 8086 microprocessors. Architecture of 8086 processors

These three counters can be programmed for either binary or BCD count.

Design of DMA Controller Using VHDL

Pin Description, Status & Control Signals of 8085 Microprocessor

Lecture Note On Microprocessor and Microcontroller Theory and Applications

Architecture of 8085 microprocessor

Basics of Microprocessor

AE66/AC66/AT66/ AE108/AC108/AT108 MICROPROCESSORS & MICROCONTROLLERS

MICROPROCESSOR TECHNOLOGY

isplever Multi-Channel DMA Controller User s Guide February 2006 ipug11_04.0

MICROPROCESSOR AND MICROCONTROLLER BASED SYSTEMS

Unit-IV Peripheral Interfacing S.Sayeekumar, AP/RMDEEE

Topics. Interfacing chips

1. Internal Architecture of 8085 Microprocessor

Microprocessor & Interfacing Lecture DMA Controller--1

CHAPTER 5 : Introduction to Intel 8085 Microprocessor Hardware BENG 2223 MICROPROCESSOR TECHNOLOGY

Chapter 1: Basics of Microprocessor [08 M]

Design with Microprocessors

The Purpose of Interrupt

History and Basic Processor Architecture

Microprocessor Architecture

Lecture-55 System Interface:

Features: 3 8-bit IO ports PA, PB, PC. PA can be set for Modes 0, 1, 2. PB for 0,1 and PC for mode 0 and for BSR. Modes 1 and 2 are interrupt driven.

INTERFACING INTERFACING. Richa Upadhyay Prabhu. NMIMS s MPSTME February 25, 2016

MICROPROCESSOR MICROPROCESSOR. From the above description, we can draw the following block diagram to represent a microprocessor based system: Output

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I

QUESTION BANK. EE 6502 / Microprocessor and Microcontroller. Unit I Processor. PART-A (2-Marks)

Chapter TEN. Memory and Memory Interfacing

UNIT - II PERIPHERAL INTERFACING WITH 8085

This set of Microprocessor Multiple Choice Questions & Answers (MCQs) focuses on PIO 8255 (Programmable Input Output Port).

8/26/2010. Introduction to 8085 BLOCK DIAGRAM OF INTEL Introduction to Introduction to Three Units of 8085

Pin diagram Common SignalS Architecture: Sub: 8086 HARDWARE

UMBC. 80C86/80C88: CMOS version draws 10mA with temp spec -40 to 225degF. 450mV while input max can be no higher than 800mV). 0 0.

12-Dec-11. Gursharan Singh Maninder Kaur. Introduction to 8085 BLOCK DIAGRAM OF INTEL Introduction to Introduction to 8085

8086 Hardware Specification

Control Unit: The control unit provides the necessary timing and control Microprocessor resembles a CPU exactly.

Lecture-50 Intel 8255A: Programming and Operating Modes

The advantages of registers over memory locations are as follows:

8254 is a programmable interval timer. Which is widely used in clock driven digital circuits. with out timer there will not be proper synchronization

Summer 2003 Lecture 21 07/15/03

8088,80286 MICROPROCESSORS AND ISA BUS

Chapter 8 Summary: The 8086 Microprocessor and its Memory and Input/Output Interface

Chapter NINE 8088,80286 MICROPROCESSORS AND ISA BUS

Computer Organization ECE514. Chapter 5 Input/Output (9hrs)

Introduction. Description of the BUS. PC KITS-tutorial page (ISA BUS) Pagina 1 di 5

WINTER 12 EXAMINATION Subject Code : Model Answer Page No : / N. a) Describe the function of SID and SOD pins of 8085 microprocessor

UNIT-1. It is a 16-bit Microprocessor (μp).it s ALU, internal registers works with 16bit binary word.

General Purpose Programmable Peripheral Devices. Assistant Professor, EC Dept., Sankalchand Patel College of Engg.,Visnagar

Microprocessor s. Address Bus. External Buses. Interfacing CPU with external word. We classify the CPU interfacing signals in three functional buses:

INTERFACING INTERFACING. Richa Upadhyay Prabhu. February 29, 2016

The functional block diagram of 8085A is shown in fig.4.1.

Interrupts. by Rahul Patel, Assistant Professor, EC Dept., Sankalchand Patel College of Engg.,Visnagar

DE60/DC68 MICROPROCESSORS & MICROCONTROLLERS JUNE 2013

Architecture of 8086 Microprocessor

Interface DAC to a PC. Control Word of MC1480 DAC (or DAC 808) 8255 Design Example. Engineering 4862 Microprocessors

9. PERIPHERAL CHIPS 9a

EE414 Embedded Systems. Ch 6. Interfacing. Part 4/4: DMA & Arbitration

8051 Microcontroller

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT I THE 8085 & 8086 MICROPROCESSORS. PART A (2 Marks)

4 Multiplexer. Y Fig Keyboard Scan Matrix

Chapter 12: INTERRUPTS


INTERFACING THE ISCC TO THE AND 8086

Microprocessors and Microcontrollers (EE-231)

PIN DIAGRAM. Richa Upadhyay Prabhu. NMIMS s MPSTME January 19, 2016

3. Controtlto specify the mode of transfer such as read or write 4. A control to start the DMA transfer

Chapter ELEVEN 8255 I/O PROGRAMMING

LECTURE NOTES MICROPROCESSORS AND INTERFACING DEVICES

SIPS - Group. Technical Description May AT96 Bus Specification V 1.1

Introduction to Microprocessor

CPE/EE 421/521 Fall 2004 Chapter 4 The CPU Hardware Model. Dr. Rhonda Kay Gaede UAH. The CPU Hardware Model - Overview

Interfacing. Introduction. Introduction Addressing Interrupt DMA Arbitration Advanced communication architectures. Vahid, Givargis

Interrupt is a process where an external device can get the attention of the microprocessor. Interrupts can be classified into two types:

Code No: RR Set No. 1

ROEVER ENGINEERING COLLEGE

7/19/2013. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Chapter Objectives 12 1 BASIC INTERRUPT PROCESSING

SRI VIDYA COLLEGE OF ENGINEERING AND TECHNOLOGY,VIRUDHUNAGAR

Chapter 12: Interrupts

EC 6504 MICROPROCESSOR AND MICROCONTROLLER Electronicsand Communication Engineering Fifth Semester UNIT-1I Part A 1. Definemachinecycle.

Question Bank Microprocessor and Microcontroller

Subject Code: Model Answer Page No: /25

PIO 8255 (cont..) M Krishna kumar MAM/M3/LU9e/V1/2004 1

Programmable Peripheral Interface (PPI) 8255A. CEN433 King Saud University Dr. Mohammed Amer Arafah

Advanced Microprocessors

DE60/DC68 MICROPROCESSORS & MICROCONTROLLERS JUN 2015

Microprocessor Architecture. mywbut.com 1

I/O Design. Input / Output Instructions. Engineering 4862 Microprocessors. Lecture 23. Cheng Li

Intel 8086 MICROPROCESSOR ARCHITECTURE

Transcription:

Chapter 13 Direct Memory Access and DMA-Controlled I/O The DMA I/O technique provides direct access to the memory while the microprocessor is temporarily disabled This allows data to be transferred between memory and I/O device at a rate that is limited only by the speed of the memory components in the system or the DMA controller

Basic DMA Operation Two control signals are used to request and acknowledge a DMA transfer in the microprocessorbased system The HOLD pin is an input that is used to request a DMA action and the HLDA pin is an output that acknowledges the DMA action Whenever the HOLD input is placed at a logic 1 level, a DMA action is request The microprocessor responds, within a few clocks, by suspending the execution of the program and by placing its address, data, and control bus at their highimpedance states

This state allows external I/O device to gain access to the system buses so that memory can be accessed directly HOLD is sampled in the middle of any clocking cycle As soon as the microprocessor recognizes the HOLD, it stops executing software and enters hold cycles The HOLD input has a higher priority than the INTR or NMI interrupt inputs, but its priority is not as high as that of the RESET pin The HLDA signal becomes active to indicate that the microprocessor has indeed placed its buses at their high-impedance state

T4 or T1 CLK HOLD HLDA HOLD and HLDA timing for the microprocessor There are a few clock cycles between the time that HOLD changes and until HLDA changes

Basic DMA Definitions DMA normally occur between an I/O and memory without the use of the microprocessor A DMA read transfers data from the memory to the I/O device A DMA read causes both the /MRDC and /IOWC signals to simultaneously active A DMA write transfers data from an I/O device to memory A DMA write causes the /MWTC and /IORC signals to both active

These control bus signals are available to all microprocessors in the Intel family except the 8086/8088 system The 8086/8088 require their generation with either a system controller or a circuit such as the one illustrated below o VCC 10K W/R 1 74F04 2 2 3 5 6 11 10 14 13 1A 1B 2A 2B 3A 3B 4A 4B 1Y 2Y 3Y 4Y 4 7 9 12 /IORC /IOWC /MRDC /MWTC HLDA M/IO o G A/B 74F257 A circuit that generates system control signals in a DMA environment

The 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 actually a special-purpose microprocessor whose job is high-speed data transfer between memory and the I/O Figure 13-3 shows the pin-out and block diagram of the 8237 programmable DMA controller

Pin Definitions CLK: the clock input is connected to the system clock signal as long as that signal is 5 MHz or less /CS: chip select enables the 8237 for programming. The /CS pin is normally connected to the output of a decoder RESET: the reset pin clears the command, status, request, and temporary registers. It also clears the first/last flip-flop and sets the mask register. This input pin primes the 8237 so it is disabled until programmed otherwise Ready: a logic 0 on the ready input causes the 8237 to enter wait states for slower memory and/or I/O components

HLDA: a hold acknowledge signals the 8237 that the microprocessor has give up control of the address, data, and control buses DREQ3-DREQ0: the DMA request inputs are used to request a DMA transfer for each of the four DMA channels. Because the polarity of these inputs is programmable, they are either active-high or activelow inputs DB7-DB0: the data bus pins are connected to the microprocessor data bus connections and are used during the programming of the DMA controller /IOR: I/O read is a bi-directional pin used during programming and during a DMA write cycle /IOW: I/O write is a bi-directional pin used during programming and during a DMA read cycle

/EOP: end-of process is a bi-directional signal that is used as an input to terminate a DMA process or as an output to signal the end of the DMA transfer. This input is often used to interrupt a DMA transfer at the end of a DMA cycle A3-A0: these address pins select an internal register during programming and also provide part of the DMA transfer address during a DMA action A7-A4: these address pins are outputs that provide part of the DMA transfer address during a DMA action HRQ: hold request is an output that connects to the HOLD input of the microprocessor in order to request a DMA transfer

DACK3-DACK0: DMA channel acknowledge outputs acknowledge a channel DMA request. These outputs are programmable as either active-high or active-low signals. The DACK outputs are often used to select the DMA controlled I/O device during the DMA transfer AEN: the address enable signal enables the DMA address latch connected to the DB7-DB0 pins on the 8237. It is also used to disable any buffers in the system connected to the microprocessor ADSTB: address strobe functions as ALE, except that it is used by the DMA controller to latch address bits A15-A8 during the DMA transfer /MEMR: memory read is an output that causes memory to read data during a DMA read cycle /MEMW: memory write is an output that causes memory to write data during a DMA write cycle

Internal Registers CAR: the current address register is used to hold the 16-bit memory address used for the DMA transfer. Each channel has its own current address register for this purpose. When a byte of data is transferred during a DMA operation, the CAR is either incremented or decremented, depending on how it is programmed CWCR: the current word count register programs a channel for the number for bytes (up to 64K) transferred during a DMA action. The number loaded into this register is one less than the number of bytes transferred

BA and BWC: the base address (BA) and base word count (BWC) registers are used when autoinitialization is selected for a channel. In the autoinitialization mode, these registers are used to reload both the CAR and CWCR after the DMA action is completed. This allows the same count and address to be used to transfer data from the same memory area CR: the command register programs the operation of the 8237 DMA controller

7 6 5 4 3 2 1 0 Bit Number 0 Memory-to-memory disable 1 Memory-to-memory enable 0 Channel 0 address hold disable 1 channel 0 address hold enable X If bit 0= 0 0 Controller enable 1 Controller disable 0 Normal timing 1 Compressed timing X If bit 0=1 0 Fixed priority 1 Rotating priority 0 Late write selection 1 Extended write selection X If bit 3=1 0 DREQ sense active high 1 DREQ sense active low 0 DACK sense active low 8237 command register 1 DACK sense active high

The command register uses bit position 0 to select the memory-to-memory DMA transfer mode memory-to-memory DMA transfers use DMA channel 0 to hold the source address and DMA channel 1 to hold the destination address A byte is read from the address accessed by channel 0 and saved within the 8237 in a temporary holding register Next, the 8237 initiates a memory write cycle, in which the contents of the temporary holding register are written into the address selected by DMA channel 1 The number of bytes transferred is determined by the channel 1 count register

The channel 0 address hold enable bit (bit position 1) programs channel 0 for memory-to-memory transfers For example, if we need to fill an area of memory with data, channel 0 can be held at the same address while channel 1 changes for memory-to-memory transfer This copies the contents of the address accessed by channel 0 into a block of memory accessed by channel 1

The controller enable/disable bit (bit position 2) turns the entire controller on and off The normal and compressed bit (bit position 3) determines whether a DMA cycle contains 2 (compressed) or 4 (normal) clocking periods Bit position 5 is used in normal timing to extend the write pulse so it appears one clock earlier in the timing for I/O devices that requires a wider write pulse

Bit position 4 selects priority for the four DMA channel DREQ inputs In the fixed priority scheme, channel 0 has the highest priority and channel 3 has the lowest. In the rotating priority scheme, the most recently serviced channel assumes the lowest priority The bits position 6 and 7 program the polarities of the DREQ inputs and DACK outputs

MR: the mode register programs the mode of operation for a channel Each channel has its own mode register selected by bit position 1 and 0 The remaining bits of the mode register select the operation, auto-initialization, increment/decrement, and mode for the channel Verification operations generate the DMA addresses without generating the DMA memory and I/O control signals The modes of operation include demand mode,single mode, block mode, and cascade mode

Demand mode transfers data until an external /EOP is input or until the DREQ input becomes inactive Single mode releases the HOLD after each byte of data is transferred If the DREQ pin is held active, the 8237 again requests a DMA transfer through the HRQ line to the microprocessor s HOLD input Block mode automatically transfers the number of bytes indicated by the count register for the channel DREQ need not be held active through the block mode transfer Cascade mode is used when more than one 8237 is present in a system

7 6 5 4 3 2 1 0 Bit Number 00 Channel 0 select 01 Channel 1 select 10 Channel 2 select 11 Channel 3 select 00 Verify transfer 01 Write transfer 10 Read transfer 11 Illegal XX If bits 6 and 7= 11 0 Auto-initialization disable 1 auto-initialization enable 0 Address increment select 1 address decrement select 00 Demand mode select 01 Single mode select 8237 mode register 10 Block mode select 11 Cascade mode select

RR: the request register is used to request a DMA transfer via software This is very useful in memory-to-memory transfers, where an external signal is not available to begin the DMA transfer 7 6 5 4 3 2 1 0 Bit Number Don t Care 00 Select Channel 0 01 Select channel 1 10 Select channel 2 11 Select channel 3 0 Reset request bit 8237 request register 1 Set request bit

MRSR: the mask register set/reset sets or clears the channel mask If the mask is set, the channel is disabled 7 6 5 4 3 2 1 0 Bit Number Don t Care 00 Select Channel 0 mask bit 01 Select channel 1 mask bit 8237 mask register set/reset mode 10 Select channel 2 mask bit 11 Select channel 3 mask bit 0 Clear mask bit 1 Set mask bit

MSR: the mask register sets or clears all of the masks with one command instead of individual channels, as with the MRSR 7 6 5 4 3 2 1 0 Bit Number Don t Care 0 Clear channel 0 mask bit 1 Set channel 0 mask bit 0 Clear channel 1 mask bit 1 Set channel 1 mask bit 0 Clear channel 2 mask bit 1 Set channel 2 mask bit 0 Clear channel 3 mask bit 1 Set channel 3 mask bit 8237 mask register

SR: the status register shows the status of each DMA channel The TC bits indicate whether the channel has reached its terminal count (transferred all its bytes) Whenever the terminal count is reached, the DMA transfer is terminated for most modes of operation The request bits indicate whether the DREQ input for a given channel is active

7 6 5 4 3 2 1 0 Bit Number 1 Channel 0 has reached TC 1 Channel 1 has reached TC 1 Channel 2 has reached TC 1 Channel 3 has reached TC 8237 status register 1 Channel 0 request 1 Channel 1 request 1 Channel 2 request 1 Channel 3 request

Software Command Three software command are used to control the operation of the 8237 These commands do not have a binary bit pattern A simple output to the correct port number enables the software command

1. Clear the first/last flip-flop: clear the F/L flip-flop within the 8237. The F/L selects which byte (low or high order) is read/written in the current address and current count register. If F/L= 0, the low order byte is selected; if F/L= 1, the high order byte is selected. Any read or write to the address or count register automatically toggles the F/L flip-flop

2. Master clear: act exactly the same as the RESET signal to the 8237. As with the RESET signal, this command disables all channels 3. Clear mask register: enable all four DMA channels Table 13-10 shows the I/O port assignments that access all registers and the software command

Signals A3 A2 A1 A0 /IOR /IOW 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 0 0 1 1 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 1 0 1 0 1 1 1 1 1 1 0 Operation Read Status Register Write Command Register Illegal Write Request Register Illegal Write single Mask Register bit Illegal Write Mode Register Illegal Clear Byte Pointer Flip-Flop Read Temporary register Master Clear Illegal Clear Mask Register Illegal Write All Mask Register Bits 8237 command and control port assignments

Program the Address and Count Registers Figure 13-11 illustrates the I/O port locations for programming the count and address registers for each channel Notice that the state of the F/L flip-flop determines whether the LSB or MSB is programmed The four steps required to program the 8237: (1) the F/L flip-flop is cleared using a clear F/L command, (2) the channel is disabled, (3) the LSB and then MSB of the address are programmed, and (4) the LSB and then MSB of the count are programmed Additional programming is required to select the mode of operation before the channel is enabled and started

The 8237 Connected to the 80X86 microprocessor Figure 13-12 shows an 80X86 based system that contains the 8237 DMA controller

The address enable (AEN) output of the 8237 controls the output pins of the latches and the outputs of the 74LS257 (E) During normal 80x86 operation (AEN= 0), latch A and C and the multiplexer (E) provides address bus bits A19-A16 and A7-A0. The multiplexer provides the system control signals as long as the 80X86 is in control of the system During a DMA action (AEN= 1), latches A and C are disabled along with the multiplexer (E). Latches D and B now provide address bits A19-A16 and A15-A8. Address bus bits A7-A0 are provided directly by the 8237 and contain a part of the DMA transfer address. The control signals /MEMR, /MEMW, /IOR, and /IOW are provided by the DMA controller

The address strobe output (ADSTB) of the 8237 clocks the address (A15-A8) into latch D during the DMA action so that the entire transfer address becomes available on the address bus Address bus bits A19-A16 are provided by latch B, which must be programmed with these four address bits before the controller is enabled for the DMA transfer The decoder (F) selects the 8237 for programming and the 4-bit latch (B) for the upper-most four address bits

Memory-to-Memory Transfer with the 8237 Example 13-1 illustrates the software required to initialize the 8237 and program latch B in Figure 13-12 for this DMA transfer Here, we use channel 0 as the source and channel 1 as the destination for a memory-to-memory transfer The count is next programmed with a value that is one less than the number of bytes to be transferred The mode register of each channel is programmed The command register selects a block move Channel 0 is enabled, and a software DMA request is initialized The terminal count flag indicates that the DMA transfer is completed

Example 13-2 shows a procedure that clears an area of memory addressed by ES: DI The CX register transfers the number of bytes to be cleared to the CLEAR procedure The command register is programmed so that the channel 0 address is held The source address is programmed as the same address as ES: DI, and then the destination is programmed as one location beyond ES: DI

DMA-Processed Printer Interface Figure 13-13 illustrates the hardware added to Figure 13-12 for a DMA-controlled printer interface The latch is used to capture the data as it is sent to the printer during the DMA transfer The write pulse passed through to the latch during the DMA action also generates the data strobe (/DS) signal to the printer through the single-shot The /ACK signal returns from the printer each time it is ready for additional data In the circuit, /ACK is used to request a DMA action through a flip-flop In place of the I/O port address, the /DACK3 output from the 8237 selects the latch by gating the write pulse through an OR gate

Summary 1. The HOLD input is used to request a DMA action, and HLDA output signals that the hold is in effect. When a logic 1 is placed on the HOLD input, the microprocessor (1) stops executing the program; (2) places its address, data, and control bus at their highimpedance state; and (3) signals that the hold is in effect by placing a logic 1 on the HLDA pin. 2. A DMA read operation transfers data from a memory location to an external I/O device. A DMA write operation transfers data from an I/O device into the memory. Also available is a memory-to-memory transfer that allows data to be transferred between two memory locations by using DMA techniques.

3. The 8237 direct memory access (DMA) controller is a four-channel device that can be expanded to include an additional channel of DMA.

Questions and Problems 1. Which microprocessor pins are used to request and acknowledge a DMA transfer? 2. Explain what happens whenever a logic 1 is placed on the HOLD input pin. 3. A DMA read transfers data form to. 4. A DMA write transfers data form to. 5. The DMA controller selects the memory location used for a DMA transfer through what bus signals? 6. The DMA controller selects the I/O device used during a DMA transfer by which pin? 7. What is a memory-to-memory DMA transfer?

8. Describe the effect on the microprocessor and DMA controller when the HOLD and HLDA pins are at their logic 1 levels. 9. Describe the effect on the microprocessor and DMA controller when the HOLD and HLDA pins are at their logic 0 levels. 10. The 8237 DMA controller is a channel DMA controller. 11. If the 8237 DMA controller is decoded at I/O ports 2000H-200FH, what ports are used to program channel 1? 12. Which 8237 DMA controller register is programmed to initialize the controller? 13. How many bytes can be transferred by the 8237 DMA controller?

14. Write a sequence of instructions that transfer data from memory location 21000H-210FFH to 20000H- 200FFH by using channel 2 of the 8237 DMA controller. You must initialize the 8237 and use the latch described in section 12-1 to hold A19-A16 15. Write a sequence of instructions that transfer data from memory to an external I/O device by using channel 3 of the 8237 DMA controller. The memory area to be transferred is at location 20000H-20FFFH.