Lecture 26 – Input/output, programmed I/O 2017.07.24 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
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
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
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
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
LED example requires op to be specified, could just have separate addresses © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
typically © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
Connections created and deleted dynamically by action of “Input” devices © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
– 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
– 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
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
© 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
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
Example of polling to control printer © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
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 0x110000. © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
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
Polling code using struct © 2017 by George B. Adams III Portions © 2017 Dr. Jeffrey A. Turkstra
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
– 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
© 2017 by George B. Adams III
Synchronous with the CPU within the app itself ^ “Asynch” with the CPU System programmer, not every app programmer © 2017 by George B. Adams III