Download presentation
Presentation is loading. Please wait.
1
Lecture 26 – Input/output, programmed I/O
I/O, I/O, so off to work I go – bumper sticker seen in Silicon Valley © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
2
Announcements Chapters 14-17 Lab 8 this week Homework 6 due Wednesday
Due in lab next week Monday/Tuesday Final lab sessions next week 7/31 and 8/1 Homework 6 due Wednesday Homework 7 due Tuesday, 8/1 Final lecture Tuesday 8/1 Final exam Thursday 8/3 8am BRNG 2290 © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
3
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
4
Configure then attach requires sys admin knowledge
Wiring approach = sys admin knowledge built in Automatic is the third option above, very convenient, but becomes an interface with the Real WorldTM with significant implications for computer security © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
5
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
6
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
7
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
8
LED example requires op to be specified, could just have separate addresses
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
9
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
10
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
11
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
12
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
13
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
14
typically © 2017 by George B. Adams III
Portions © 2017 Dr. Jeffrey A. Turkstra
15
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
16
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
17
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
18
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
19
Connections created and deleted dynamically by action
of “Input” devices © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
20
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
21
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
22
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
23
– Software services the I/O needs, but hardware initiates the service: the hardware dynamically inserts a “jsr” into the CPU instruction fetch stream – Perhaps “interrupt-triggered I/O” would be a better name, but we will use interrupt-driven I/O © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
24
– How do we make a processor “wait”?
Cheap cheap controller circuit for device and bus – How do we make a processor “wait”? – We code a while loop for it to execute. – Drawback: processor kept 100% busy just waiting; CPU cannot do anything else! (Quelle nightmare.) © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
25
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
26
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
27
Array Elements 1 2 3 4 © 2017 by George B. Adams III
1 2 3 4 © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
28
Example of polling to control printer
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
29
Example bus interface for ink-jet printer
List of the Control and Status “registers” for the ink-jet printer For code on next slide, assume that Address 0 above (printer-relative) has been assigned physical address 0x © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
30
C code to poll // Non-zero if printer is on
// Device is busy if *(p+6) != 0; proxy for “Load is complete” // Busy now a proxy for “Data is loaded” // This is not an infinite loop if the printer operates correctly // Printer failure requires a system reboot © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
31
Polling code using struct
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
32
Programmed I/O: What’s to Like?
Cheap, bare-bones hardware can do it Cheap, don’t even have need for an O/S Con Programmer must include I/O busy wait loop in app code While waiting on one I/O need, cannot monitor any other I/O © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
33
– Makes good sense now that hardware is cheaper so that building smarter devices is feasible and since a CPU is wasted with polling (busy wait) © 2017 by George B. Adams III
34
© 2017 by George B. Adams III
35
Synchronous with the CPU
within the app itself ^ “Asynch” with the CPU System programmer, not every app programmer © 2017 by George B. Adams III
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.