ACOE255Microprocessors I - Frederick University1 Direct Memory Access (DMA) – (Chapter 13) Dr. Konstantinos Tatas.

Slides:



Advertisements
Similar presentations
Homework Reading Machine Projects Labs
Advertisements

Computer Architecture
I/O Organization popo.
Computer Architecture
INPUT-OUTPUT ORGANIZATION
8086 [2] Ahad. Internal! External? 8086 vs _bit Data Bus 20_bit Address 8_bit Data Bus 20_bit Address Only external bus of 8088 is.
Parul Polytechnic Institute
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
DMA Controller (8237 Programming Examples)
MICROPROCESSORS TWO TYPES OF MODELS ARE USED :  PROGRAMMER’S MODEL :- THIS MODEL SHOWS FEATURES, SUCH AS INTERNAL REGISTERS, ADDRESS,DATA & CONTROL BUSES.
Chapter 13: Direct Memory Access and DMA-Controlled I/O.
9/20/6Lecture 3 - Instruction Set - Al1 The Hardware Interface.
Microprocessor and Microcontroller
Direct Memory Access Introduction to 8237
I/O Unit.
Processor System Architecture
CS-334: Computer Architecture
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
DIRECT MEMORY ACCESS CS 147 Thursday July 5,2001 SEEMA RAI.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 13 Direct Memory Access (DMA)
1 TK2633TK Microprocessor Architecture DR MASRI AYOB.
Chapter 10 Hardware Details on the 8088 Objectives: The general specification on the 8088 microprocessors The processor’s control signal names and specifications.
GURSHARAN SINGH TATLA PIN DIAGRAM OF 8085 GURSHARAN SINGH TATLA
Unit-5 CO-MPI autonomous
Group 7 Jhonathan Briceño Reginal Etienne Christian Kruger Felix Martinez Dane Minott Immer S Rivera Ander Sahonero.
INPUT-OUTPUT ORGANIZATION
Khaled A. Al-Utaibi  8086 Pinout & Pin Functions  Minimum & Maximum Mode Operations  Microcomputer System Design  Minimum Mode.
The computer system’s I/O architecture is its interface to the outside world. This architecture provides a systematic means of controlling interaction.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
The 8253 Programmable Interval Timer
MICROPROCESSOR INPUT/OUTPUT
COMPUTER ARCHITECTURE (for Erasmus students)
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
ENEE 440 Chapter DMA Controller 8237 DMA Controller Summary Direct Memory Access means that the microprocessor is not involved in the transfer.
Advanced Microprocessor1 I/O Interface Programmable Interval Timer: 8254 Three independent 16-bit programmable counters (timers). Each capable in counting.
Direct Memory Access (DMA) Microprocessors I -1. Topics to be discussed  Basic DMA Concept Basic DMA Concept  DMA pins and timing DMA pins and timing.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
Unit - 2 DMA 8237A-5.
The computer system’s I/O architecture is its interface to the outside world. This architecture provides a systematic means of controlling interaction.
80386DX functional Block Diagram PIN Description Register set Flags Physical address space Data types.
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
IT3002 Computer Architecture
Khaled A. Al-Utaibi  I/O Ports  I/O Space VS Memory Space  80x86 I/O Instructions − Direct I/O Instructions − Indirect I/O Instructions.
Direct Memory Access Sequence of events:  A device (peripheral, CPU) requests a controller to transfer information;  The controller request control over.
MACHINE CYCLE AND T-STATE
The 8085 Microprocessor Architecture. What 8085 meant for? 80 - year of invention bit processor 5 - uses +5V for power.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
INTRODUCTION TO MICROPROCESSOR. Do you know computer organization? Arithmetic Logic Unit Memory Output Input Control Unit.
Multiplex of Data and Address Lines in 8088 Address lines A0-A7 and Data lines D0-D7 are multiplexed in These lines are labelled as AD0-AD7. –By.
Gandhinagar Institute of Technology
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Everybody.
Direct Memory address and 8237 dma controller LECTURE 6
Introduction to the processor and its pin configuration
DMA CONTROLLER 8257 Features: It is a 4-channel DMA.
8085 Microprocessor Architecture
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
DMA CONTROLLER WHOLE WORKING
8237 DMA CONTROLLER.
8085 Microprocessor Architecture
8237 DMA CONTROLLER.
X1 & X2 These are also called Crystal Input Pins.
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
8085 Microprocessor Architecture
Presentation transcript:

ACOE255Microprocessors I - Frederick University1 Direct Memory Access (DMA) – (Chapter 13) Dr. Konstantinos Tatas

ACOE255Microprocessors I - Frederick University2 Basic DMA concept Direct memory access (DMA) is a feature of modern computer systems that allows certain hardware subsystems to read/write data to/from memory without microprocessor intervention, allowing the processor to do other work. Used in disk controllers, video/sound cards etc, or between memory locations. Typically, the CPU initiates DMA transfer, does other operations while the transfer is in progress, and receives an interrupt from the DMA controller once the operation is complete. Can create cache coherency problems (the data in the cache may be different from the data in the external memory after DMA)

ACOE255Microprocessors I - Frederick University3 BASIC DMA TERMINOLOGY DMA channel: system pathway used by a device to transfer information directly to and from memory. There are usually 8 in a computer system DMA controller: dedicated hardware used for controlling the DMA operation Single-cycle mode: DMA data transfer is done one byte at a time Burst-mode: DMA transfer is finished when all data has been moved

ACOE255Microprocessors I - Frederick University4 DMA pins and timing x86 Interrupt Pins –HOLD: DMA request. Sampled in the middle of any clocking cycle –HLDA: DMA acknowledge signal. The address, data and control buses are set to high-Z, so the I/O devices can control the system bus

ACOE255Microprocessors I - Frederick University5 DMA on the 8086 Microprocessor The I/O device asserts the appropriate DRQ signal for the channel. The DMA controller will enable appropriate channel, and ask the CPU to release the bus so that the DMA may use the bus. The DMA requests the bus by asserting the HOLD signal which goes to the CPU. The CPU detects the HOLD signal, and will complete executing the current instruction. Now all of the signals normally generated by the CPU are placed in a tri-stated condition (neither high or low) and then the CPU asserts the HLDA signal which tells the DMA controller that it is now in charge of the bus. The CPU may have to wait (hold cycles). DMA activates its -MEMR, -MEMW, -IOR, -IOW output signals, and the address outputs from the DMA are set to the target address, which will be used to direct the byte that is about to transferred to a specific memory location. The DMA will then let the device that requested the DMA transfer know that the transfer is commencing by asserting the -DACK signal. The peripheral places the byte to be transferred on the bus Data lines. Once the data has been transferred, The DMA will de-assert the -DACK2 signal, so that the FDC knows it must stop placing data on the bus. The DMA will now check to see if any of the other DMA channels have any work to do. If none of the channels have their DRQ lines asserted, the DMA controller has completed its work and will now tri-state the -MEMR, -MEMW, -IOR, -IOW and address signals. Finally, the DMA will de-assert the HOLD signal. The CPU sees this, and de-asserts the HOLDA signal. Now the CPU resumes control of the buses and address lines, and it resumes executing instructions and accessing main memory and the peripherals.

ACOE255Microprocessors I - Frederick University6 EXAMPLE Assuming that a DMA initialization has an overhead of 10 cycles, while a CPU transfer to/from memory requires 4 cycles (no wait states required), compare a DMA and a CPU transfer from one memory location to another of –One byte of data –A block of 1Kbytes in burst mode –A block of 64Kbytes in burst mode

ACOE255Microprocessors I - Frederick University7 The 8237 DMA controller Supplies memory and I/O with control signals and addresses during DMA transfer 4-channels (expandable) –0: DRAM refresh –1: Free –2: Floppy disk controller –3: Free 1.6MByte/sec transfer rate 64 KByte section of memory address capability with single programming “fly-by” controller (data does not pass through the DMA-only memory to I/O transfer capability) Initialization involves writing into each channel: i) The address of the first byte of the block of data that must be transferred (called the base address). ii) The number of bytes to be transferred (called the word count).

ACOE255Microprocessors I - Frederick University pins CLK: System clock CS΄: Chip select (decoder output) RESET: Clears registers, sets mask register READY: 0 for inserting wait states HLDA: Signals that the μp has relinquished buses DREQ3 – DREQ0: DMA request input for each channel DB7-DB0: Data bus pins IOR΄: Bidirectional pin used during programming and during a DMA write cycle IOW΄: Bidirectional pin used during programming and during a DMA read cycle EOP΄: End of process is a bidirectional signal used as input to terminate a DMA process or as output to signal the end of the DMA transfer A3-A0: Address pins for selecting internal registers A7-A4: Outputs that provide part of the DMA transfer address HRQ: DMA request output DACK3-DACK0: DMA acknowledge for each channel. AEN: Address enable signal ADSTB: Address strobe MEMR΄: Memory read output used in DMA read cycle MEMW΄: Memory write output used in DMA write cycle

ACOE255Microprocessors I - Frederick University9 A 8237 DMA application

ACOE255Microprocessors I - Frederick University registers CAR (Current Address Register): holds the 16-bit memory address used for the DMA transfer (one for each channel), either incremented or decremented during the operation CWCR (Current Word Count Register): Programs a channel for the number of bytes (up to 64K) transferred during a DMA operation BA (Base Address) and WC (Word Count): Used when auto-initialization is selected for a channel, to reload the CAR and CWCR when DMA is complete. CR (Command Register): Programs the operation of the controller

ACOE255Microprocessors I - Frederick University registers MR (Mode Register): Programs the mode of operation for a channel (one for each channel). RR (Request Register): Used to request DMA transfer via software (memory-to-memory transfers)

ACOE255Microprocessors I - Frederick University registers MR (Mask Register): SR (Status Register): Shows the status of each DMA channel

ACOE255Microprocessors I - Frederick University Software commands

ACOE255Microprocessors I - Frederick University Software commands Clear First/Last Flip-Flop - This command is executed prior to writing or reading new address or word count information to the 82C37. This command initializes the flipflop to a known state (low byte first) so that subsequent accesses to register contents by the microprocessor will address upper and lower bytes in the correct sequence. Set First/Last Flip-Flop - This command will set the flip-flop to select the high byte first on read and write operations to address and word count registers. Master Clear - This software instruction has the same effect as the hardware Reset. The Command, Status, Request, and Temporary registers, and Internal First/Last Flip-Flop and mode register counter are cleared and the Mask register is set. The 82C37A will enter the idle cycle. Clear Mask Register - This command clears the mask bits of all four channels, enabling them to accept DMA requests. Clear Mode Register Counter - Since only one address location is available for reading the Mode registers, an internal two-bit counter has been included to select Mode registers during read operation. To read the Mode registers, first execute the Clear Mode Register Counter command, then do consecutive reads until the desired channel is read. Read order is channel 0 first, channel 3 last. The lower two bits on all Mode registers will read as ones.

ACOE255Microprocessors I - Frederick University CHANNEL I/O PORT ADDRESSES

ACOE255Microprocessors I - Frederick University block diagram

ACOE255Microprocessors I - Frederick University17 Initiating a DMA transaction Save the current interrupt status and disable interrupts by executing the CLI instruction Disable the channel that will be used for the transaction Reset the flip-flop by writing a value of 0X to the register Set the Mode Register Set the Page Register Set the Offset Register Set the Block Size Register Enable the channel that will be used for the transaction Restore the interrupt status

ACOE255Microprocessors I - Frederick University18 Programming the 8237 First program the address and count registers first: –1. Clear the F/L flip-flop with a clear F/L command –2. Disable the channel –3. Program the LSB and then MSB of the address –4. Program the LSB and then MSB of the count select the mode of operation Enable channel

ACOE255Microprocessors I - Frederick University19 Example Design the 8237 decoding circuit and the 8237 address line connections so that the 8237 is in the address range 70h-7Fh Write a program that starts a block memory-to-memory DMA transfer from memory locations 10000H-13FFFH to H-17FFFH using channel 0 as source and channel 1 as destination.

ACOE255Microprocessors I - Frederick University Programming Example CLEAR_FF EQU 7CH;F/L CLEAR VALUE CH0_AEQU 70H;CHANNEL 0 ADDRESS CH1_AEQU 72H;CHANNEL 1 ADDRESS CH1_CEQU 73H;CHANNEL 1 COUNT MODEEQU 7BH;MODE CREQU 78H;COMMAND REGISTER MASKSEQU 7FH;MASKS REQEQU 79H;REQUEST REGISTER STATUSEQU 78H;STATUS REGISTER ;ES = segment of source and destination ;SI = source address ;DI = destination address ;CX = count DMA PROC FAR MOV AL, 0 OUT CLEAR_FF, AL;CLEAR F/L FF MOV AX, ES;PROGRAM SOURCE ADDRESS SHL AX, 4;SHIFT LEFT SEGMENT ADD AX, SI;ADD SOURCE OFFSET OUT CH0_A, AL;CHANNEL 0 ADDRESS PROGRAMMING LSB FIRST MOV AL, AH;ONLY AL ALLOWED IN IN/OUT INSTRUCTIONS OUT CH0_A, AL;CHANNEL 0 ADDRESS PROGRAMMING MSB LAST

ACOE255Microprocessors I - Frederick University21 EXAMPLE (CONTINUED) MOV AX, ES;PROGRAM DESTINATION ADDRESS SHL AX, 4;SHIFT LEFT SEGMENT ADD AX, DI;ADD DESTINATION OFFSET OUT CH1_A, AL;CHANNEL 1 ADDRESS PROGRAMMING LSB FIRST MOV AL, AH;ONLY AL ALLOWED IN IN/OUT INSTRUCTIONS OUT CH1_A, AL;CHANNEL 1 ADDRESS PROGRAMMING MSB FIRST MOV AX, CX;PROGRAM COUNT DEC AX;ADJUST COUNT OUT CH1_C, AL;MOVE TO CHANNEL 1 COUNT MOV AL, AH OUT CH1_C, AL MOV AL, 88H;PROGRAM MODE OUT MODE, AL MOV AL,1;MEMORY-TO-MEMORY TRANSFER OUT CR, AL MOV AL, 0EH;UNMASK CHANNEL 0 OUT MASKS, AL MOV AL, 4;START DMA TRANSFER BY SETTING REQUEST BIT FOR CHANNEL 2 OUT REQ, AL

ACOE255Microprocessors I - Frederick University22 EXAMPLE Draw the decoding circuit for a 8237 located at address 68H – 6FH Write CR and MR for a block write transfer that occurs from channel 1 What is the Base and word count if the transfer is between logical addresses offsets A010:1600H and A010:1840H (not including)

ACOE255Microprocessors I - Frederick University23 Example 2