Lecture 18-20 - Lecture 18-20 11/11/10-11/15/10...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 18-20 – 11/11/10-11/15/10 Announcements Hwk 6 due Friday Last Week LC-3 Program execution I/O in the LC-3 Service Routines Subroutines Introduction to “C” CS310 Fall 2010 - Boral I/O Devices Various types: Input only (Keyboard, mouse) Output only (Display, printer) Both (Hard drive) I/O device-specific controller Processor interacts with the controller Device driver reads and writes registers in the controller Device Status Register, Data Register Asynchronous interaction I/O devices and processors operate at radically different rates Need a protocol between processor and I/O device Status register (next slide) Polling vs. interrupts CS310 Fall 2010 - Boral
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
I/O Devices in LC-3 Keyboard and Display Keyboard registers: KBDR: holds ASCII encoding of keyboard character entered (bits 7:0) KBSR: holds status of keyboard Is there a new character pending (bit 15)? Automatically set by the hardware when KBDR captures a new character While bit 15 of KBSR is set (==1), no new input character is allowed Display registers: DSR: holds status of display Was the last character displayed (bit 15)? DDR: holds ASCII encoding of character to be displayed (bits 7:0) Graphics Controller Control/Status Output Data Electronics CPU display CS310 Fall 2010 - Boral I/O Programming Interface Three issues: Access Load/Store instructions can’t access device registers Special instructions vs. memory-mapped I/O Timing Synchronous: data supplied at fixed, predictable rate CPU reads/writes every N cycles Asynchronous: data arrives whenever. Need protocol between CPU and device Control Polling: Check status till it changes Interrupts: Receive signal when status changes CS310 Fall 2010 - Boral
Background image of page 2
I/O Programming in LC-3 Memory-mapped I/O Using standard Load/Store instructions Asynchronous timing Using status registers Control via polling and interrupts Loc. I/O Reg. Function xFE00 KBSR Bit [15] is “1” when keyboard has received a new character xFE02 KBDR Bits [7:0] contain the last character typed on keyboard xFE04 DSR Bit [15] is “1” when device ready to display another char. xFE06 DDR Character written to bits [7:0] will be displayed on screen CS310 Fall 2010 - Boral Keyboard Input When a character is typed: Its ASCII code is placed in KBDR[7:0] KBDR[15:8] are always “0” The Ready Bit (KBSR[15]) is set to “1” As long as KBSR[15] == 1 the keyboard is disabled. Any characters typed are lost When the KBDR is read KBSR[15] is set to “0” enabling further input KBSR KBDR 15 8 7 0 1514 0 keyboard data ready bit CS310 Fall 2010 - Boral
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Basic Input Routine new char? read
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/30/2010 for the course CS 310 taught by Professor Fussell during the Spring '08 term at University of Texas at Austin.

Page1 / 18

Lecture 18-20 - Lecture 18-20 11/11/10-11/15/10...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online