DMA Controller (8237 Programming Examples)

Slides:



Advertisements
Similar presentations
Microprocessor Systems
Advertisements

8259 Programmable Interrupt Controller
I/O Organization popo.
Computer Architecture
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.
Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati. Very Easy – Question 1 Easy – Question 2 OK, If u have read the book/slide – Question 4 – Question 5 A.
Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati I/O + Timer 8155 I/O + Timer 8255 I/O 8255 I/O 8253/54 Timer 8253/54 Timer 2 Port (A,B), No Bidirectional.
Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati.
Interrupt Controller Introduction to 8259.
Programmable Interval Timer
Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati.
Direct Memory Access Introduction to 8237
I/O Unit.
CS-334: Computer Architecture
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
DMA Direct memory access  Problems with programmed I/O  Processor wastes time polling  In our example I.Waiting for a key to be pressed, II.Waiting.
1 TK2633TK Microprocessor Architecture DR MASRI AYOB.
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: internal fault (e.g.. divide by.
Hardware Support for Operating Systems Sunny Gleason Vivek Uppal COM S 414
Interrupt Controller (Introduction to 8259)
DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1.
Group 7 Jhonathan Briceño Reginal Etienne Christian Kruger Felix Martinez Dane Minott Immer S Rivera Ander Sahonero.
DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
MICROPROCESSOR INPUT/OUTPUT
Khaled A. Al-Utaibi  Interrupts in Microcomputer Systems  Programmable Interrupt Controllers  General Description of the 8259A.
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
DMA Versus Polling or Interrupt Driven I/O
ENEE 440 Chapter DMA Controller 8237 DMA Controller Summary Direct Memory Access means that the microprocessor is not involved in the transfer.
UNIT-6. INTRODUCTION  POLLING  INTERRUPTS  INTERRUPT SERVICE ROUTINR(ISR)
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.
8259A PROGRAMMABLE INTERRUPT CONTROLLER. CONTINUE…. The 8259A consist of eight data bus lines from D0-D7 The data bus is the path over which data are.
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.
Programmable Interrupt Controller (PIC)
8086 Interrupts and Interrupt Applications
14.2: x86 PC AND INTERRUPT ASSIGNMENT
DMA & Interrupts By Santhosh H. S. DMA DMA Definitions: DMA occurs between an I/O device and memory without the use of the microprocessor DMA read transfer.
بسم الله الرحمن الرحيم MEMORY AND I/O.
 The Programmable Interrupt Controller (PlC) functions as an overall manager in an Interrupt-Driven system. It accepts requests from the peripheral equipment,
INTERRUPTS. Topics to be discussed  8088/86 Hardware Interrupts pins 8088/86 Hardware Interrupts pins   Pin description Pin description.
Intel 8259A PIC EEE 365 [FALL 2014] LECTURE 21 ATANU K SAHA BRAC UNIVERSITY.
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: Internal fault (e.g.. divide by.
Direct Memory address and 8237 dma controller LECTURE 6
Interrupts In 8085 and 8086.
8259-programmable interrupt controller
Programmable Interrupt Controller 8259
Interrupt.
8259 Chip The Intel 8259 is a family of Programmable Interrupt Controllers (PIC) designed and developed for use with the Intel 8085 and Intel 8086 microprocessors.
8253 Timer In software programming of 8085, it has been shown that a delay subroutine can be programmed to introduce a predefined time delay. The delay.
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
DMA CONTROLLER WHOLE WORKING
Interrupts Interrupt is a process where an external device can get the attention of the microprocessor. The process starts from the I/O device The process.
8259 PROGRAMMABLE INTERRUPT CONTROLLER
8237 DMA CONTROLLER.
UNIT-V Interrupt structure of Vector interrupt table.
8237 DMA CONTROLLER.
X1 & X2 These are also called Crystal Input Pins.
8259 Programmable Interrupt Controller
Interrupts.
8259 PROGRAMMABLE INTERRUPT CONTROLLER
CNET 315 Microprocessor & Assembly Language
Programmable Interrupt Controller (PIC)
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

DMA Controller (8237 Programming Examples) Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati

Outline 8259 Control and Operation word 8259 programming and interrupts Nested Interrupts DMA controller DMA Architecture Introduction to Programming DMA (Next class) Next class will be in Room 1201

Block Diagram of 8259 IRQ0 8 bit 8259A Data Bus IRQ1 Programmable Interrupt Controller IRQ0 IRQ1 IRQ2 IRQ3 IRQ4 IRQ5 IRQ6 IRQ7 8 bit Data Bus RDb WRb CSb A0 INT INTAb SPb/ENb

Block Diagram Architecture of 8259 Control Logic Interrupt Service Register Priority Resolver Interrupt Request IRQ0 IRQ1 IRQ2 IRQ3 IRQ4 IRQ5 IRQ6 IRQ7 Interrupt Mask Register Internal Bus INTAb INT

Interrupt Vector Table 03FF 03FE 03FD 03FC 0007 0006 0005 0004 0003 0002 0001 0000 IP High Byte CS Low Byte int type 255 Int type 0 Int type 1 IP High Byte IP Low byte IP High Byte CS Low Byte IP High Byte IP Low byte IP High Byte CS Low Byte IP High Byte IP Low byte Memory in Hex

Priority Modes Fully Nested Modes Automatics Rotation Mode IR are arranged in IR0-IR7 and Any IR can be assigned Highest or lowest priority IR4=0 (high), IR3=7 (low) Automatics Rotation Mode A device after being served, receive the lowest priority with value 7 0123456712345670 23456701 Specific Rotation Mode User can select any IR for lowest priority 0673451267345120 73451206 EOI: End of interrupt Specific EOI Command Automatic EOI: no command necessary Non-Specific EOI: it reset the ISR bit

Control Word (initialization) CS A0 Initialization ICW1 1 ICW2,ICW3,ICW4 X Not Address

T7=T0 is the assign to IR0, Vector address for ISR ICW1 & ICW2 AD0 D7 D6 D5 D4 D3 D2 D1 D0 1 LTIM SGNL IC4 0 for x86 1 for Level Trigger 0 for Edge Trigger 1=single 0=Cascade AD0 D7 D6 D5 D4 D3 D2 D1 D0 1 T7 T6 T5 T4 T3 T2 T1 T0 T7=T0 is the assign to IR0, Vector address for ISR

Masking and Prioritization OCW (operation command word) CS A0 Operation Command Word OCW1 1 OCW2,OCW3,OCW4 X Not Address

Programming OCWs: OCW1, OCW2 AD0 D7 D6 D5 D4 D3 D2 D1 D0 1 M7 M6 M5 M4 M3 M2 M1 M0 Interrupt Masks: 1= Mask Set, 0 =Mask reset AD0 D7 D6 D5 D4 D3 D2 D1 D0 R SL EOI L2 L1 L0 Roteate Specific IR Level to be acted Upon (0-7)

Example: Setting of control word IR0 IR1 IR2 IR6 8259 Emergency A/D converter Keyboard Printer 3-to-8 Decoder E1b E2b E3 A3 A2 A1 A2 A1 A0 04 CSb A0 A0 ADDRESS= 80H, 81H AD0 D7 D6 D5 D4 D3 D2 D1 D0 1 M7=0 M6=1 M5=1 M4=1 M3=1 M2=1 M1=1 M0=1 Interrupt Masks: 1= Mask Set, 0 =Mask reset OCW1=7F

Initialization words (ICW1 & ICW2) AD0 D7 D6 D5 D4 D3 D2 D1 D0 1 A7, A6,A5 Lower address bit of Vector Address 0 for Edge Trigger Call Address interval =4 1=single 0=Cascade 76H AD0 D7 D6 D5 D4 D3 D2 D1 D0 1 T7 T6 T5 T4 T3 T2 T1 T0 T7=T0 is the assign to IR0, Vector address for ISR Lower Byte of call address 20H Vector Address 2060, 2064…. 0100 0000 0 1 1 00000

Program to initialize DI MVI A, 76H ;move ICW1 byte to ACC OUT 80H ; initialize 8259A ICW1 MVI A, 20H ; mov ICW2 byte to ACC OUT 81H ; Initialize 8259A ICW2 MVI A, 7FH ; Put the OCW1 OUT 80H

Nested mode By Default 8259 work in Nested modes Unless we put a different OCW Suppose IR2 has highest priority and IR6 IR6 is being serviced IR2 can be nested iff IR6 IRS issue an EI command Address of IR2=2068, IR2=2074

Nested Interrupt process It wait up to EI instruction EI Interrupt at IR6 Interrupt at IR2 EI EI DI EOI RET EI IR2 has highest priority IR6 has lower priority RET

Interrupt Masks: 1= Mask Set, 0 =Mask reset Maskable Interrupt Those interrupt service can be temporarily disable to let the higher priority interrupt ISR to be executed un-interruptly I want IR7 to be Non Maskable AD0 D7 D6 D5 D4 D3 D2 D1 D0 1 M7=0 M6=1 M5=1 M4=1 M3=1 M2=1 M1=1 M0=1 Interrupt Masks: 1= Mask Set, 0 =Mask reset OCW1=7F

DMA Direct memory access DMA Controller DMA mode of I/O Programmed mode I/O vs DMA mode I/O

Data Transfer DMA mode CPU DMA Controller CPU System Bus System Bus Memory I/O Memory I/O

Data Transfer Programmed I/O Example Done by busy-waiting This process is called polling Example Reading a key from the keyboard involves Waiting for status bit to go low Indicates that a key is pressed Reading the key scan code Translating it to the ASCII value Waiting until the key is released

Data Transfer : DMA Problems with programmed I/O DMA Processor wastes time polling Lets take example of Key board Waiting for a key to be pressed, Waiting for it to be released May not satisfy timing constraints associated with some devices : Disk read or write DMA Frees the processor of the data transfer responsibility

DMA Controller Interrupt Controller IREQ INTR DREQ DACK IORDb IOWRb EOPb CPU DMA Controller I/O Controller HOLD HOLDA MEMRDb Memory MEMWRb Data Bus Address Bus

DMA Controller DMA is implemented using a DMA controller Acts as slave to processor Receives instructions from processor Example: Reading from an I/O device Processor gives details to the DMA controller I/O device number Main memory buffer address Number of bytes to transfer Direction of transfer (memory  I/O device, or vice versa)

DMA: HOLD and HOLDA HOLD: DMA to CPU HOLDA HOLD Low to CPU DMA Send HOLD High to CPU I (DMA) want BUS Cycles HOLDA CPU send HOLDA BUS is granted to DMA to do the transfer DMA is from Slaves to Master mode HOLD Low to CPU I (DMA) finished the transfer Cycle Stealing if One BUS Other wise Separate process independent of processing

Steps in a DMA operation Processor initiates the DMA controller Gives device number, memory buffer pointer, … Called channel initialization Once initialized, it is ready for data transfer When ready, I/O device informs the DMA controller DMA controller starts the data transfer process Obtains bus by going through bus arbitration Places memory address and appropriate control signals Completes transfer and releases the bus Updates memory address and count value If more to read, loops back to repeat the process Notify the processor when done Typically uses an interrupt

8237 DMA Controller

8237 supports four DMA channels It has the following internal registers Current address register One 16-bit register for each channel Holds address for the current DMA transfer Current word register Keeps the byte count Generates terminal count (TC) signal when the count goes from zero to FFFFH Command register Used to program 8257 (type of priority, …)

DMA Registers Mode register Request register Mask register Each channel can be programmed to Read or write Auto increment or auto decrement the address Auto initialize the channel Request register For software-initiated DMA Mask register Used to disable a specific channel Status register Temporary register Used for memory-to-memory transfers

Type of Data Transfer using 8237 DMA Single cycle transfer Only single transfer takes place Useful for slow devices Block transfer mode Transfers data until TC is generated or external EOPb signal is received Demand transfer mode Similar to the block transfer mode In addition to TC and EOP, transfer can be terminated by deactivating DREQ signal Cascade mode Useful to expand the number channels beyond four

Programming DMA Next Class…

Next class will be in Room 1201 7 Sept 2010 onwards

R S Gaonkar, “Microprocessor Architecture”, Chapter 15 Reference R S Gaonkar, “Microprocessor Architecture”, Chapter 15

Thanks