This preview shows page 1-2 out of 7 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 7 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1BR 6/00 1Polled IO versus Interrupt Driven IO• Polled IO – processor continually checks IO device to see if it is ready for data transfer– Inefficient, processor wastes time checking for ready condition• Interrupt Driven IO – IO device interrupts processor when it is ready for data transfer– Processor can be doing other tasks while waiting for last data transfer to complete – very efficient.– All IO in modern computers is interrupt driven.BR 6/00 2Interrupt Driven IO• INTR input on x86 generates a hardware interrupt• INTA# output used to acknowledge the interrupt –valid for 2 bus cycles• On 2ndcycle, the x86 inputs the interrupt number from the D0-D7 of the data bus – Interrupt number * 4 is memory location of interrupt service routine vector• External device must provide this number2BR 6/00 38259A PIC• 8259A Programmable interrupt controller external device used to provide 8 interrupt sources• Multiple 8259A chips can be cascaded to provide up to 64 interrupt sources• Initial PCs had two 8259A chips to provide IRQ0-IRQ15BR 6/00 4Interrupt Priorities• A priority scheme determines what happens in the case of simultaneous interrupts• A fixed priority scheme assigns priorities in a fixed order (ie. IRQ0 has highest priority, IRQ7 has lowest priority).– Can result in lowest priority devices not being serviced enough• A rotating priority scheme rotates the highest priority among all sources by shifting the priorities– Highest priority is IRQ0, then after an interrupt, highest priority is changed to IRQ1, etc...– Results in more fair servicing of interrupts.3BR 6/00 5Interrupt Driven Input• A circular buffer is most often used to handle interrupt driven INPUT.• A circular buffer requires the following pointers– base address of memory buffer– head index (head pointer)– tail index (tail pointer)– size of buffer• A circular buffer is simply another name for a FIFO (First-In-First-Out) buffer.– The name circular buffer helps to visualize the wraparound conditonBR 6/00 6Circular buffer, 8 locations long???????????????????????????????head →← tailWhen buffer is empty, head = tail index4BR 6/00 7Circular buffer, write operation???dataA????????????????????????head →← tailInterrupt service routine places items in memory buffer by incrementing head index, then storing valuewrite a value???dataAdataB????????????????????← tailwrite a 2ndvaluehead →BR 6/00 8Circular buffer, read operationInput function occassionally checks to see if head not equal to tail, if true, then read value by incrementing tail, then reading memory.???dataAdataB????????????????????← tailread dataA valuehead →???dataAdataB????????????????????← tailread dataB valuehead →5BR 6/00 9Circular buffer, wraparoundwhen head pointer gets to end of buffer, set back to top of buffer (wraparound)???dataAdataBdataCdataDdataEdataFdataG← tailhead at end of bufferhead →dataHdataAdataBdataCdataDdataEdataFdataG← tailhead at end of bufferhead →BR 6/00 10Circular buffer, buffer FULLbuffer FULL occurs if interrupt service routines increments head pointer to place new data, and head = tail!!!!dataHdataIdataBdataCdataDdataEdataFdataG← tailnear overflowhead →dataHdataIdataJdataCdataDdataEdataFdataG← tailbuffer FULLhead →Function taking data out of buffer thinks buffer is empty!!!!6BR 6/00 11How to pick size of circular buffer?• Must be big enough so that buffer full condition never occurs• Routine that is taking data out of buffer must check it often enough to ensure that buffer full condition does not occur. • Buffer must be big enough so that bursts of data into buffer does not cause buffer full condition.BR 6/00 12check if interrupt from 16550D is a receive data interruptReceive data intrpt?no, handle other interruptsyescheck if 16550D FIFO RBR still has datadata in RBR?no, exit yesreceive data error?yes, exit increment head pointerstore data at buffer_start+headsave new head pointersave registersrestore registersreturn from interruptInterrupt Service routine flowchart for receive data, 16550D7BR 6/00 13check if tail equal to head pointerTail = Head?yes, buffer emptyincrement tail pointerread data at buffer_start+tailsave new tail pointerreturn from subroutineSubroutine flowchart for reading data out of the circular


View Full Document

MSU ECE 3724 - Polled IO versus Interrupt Driven IO

Documents in this Course
Timers

Timers

38 pages

TEST 4

TEST 4

9 pages

Flags

Flags

6 pages

Timers

Timers

6 pages

Timers

Timers

54 pages

TEST2

TEST2

8 pages

Load more
Download Polled IO versus Interrupt Driven IO
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Polled IO versus Interrupt Driven IO and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Polled IO versus Interrupt Driven IO 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?