Input/Output Organization
Outline
Introduction Accessing I/O devices An example I/O device
Keyboard
External interface
Serial transmission Parallel interface
I/O data transfer
Programmed I/O DMA
USB
Motivation USB architecture USB transactions
Error detection and correction
Parity encoding Error correction CRC
IEEE 1394
Advantages Transactions Bus arbitration Configuration
Chapter 19: Page 2
Introduction
I/O devices serve two main purposes
To communicate with outside world To store data
I/O controller acts as an interface between the systems bus and I/O device
Relieves the processor of low-level details Takes care of electrical interface
I/O controllers have three types of registers
Data Command Status
Chapter 19: Page 3
Introduction (contd)
Chapter 19: Page 4
Introduction (contd)
To communicate with an I/O device, we need
Access to various registers (data, status,)
This access depends on I/O mapping Two basic ways Memory-mapped I/O Isolated I/O
A protocol to communicate (to send data, )
Three types Programmed I/O Direct memory access (DMA) Interrupt-driven I/O
Chapter 19: Page 5
Accessing I/O Devices
I/O address mapping
Memory-mapped I/O
Reading and writing are similar to memory read/write Uses same memory read and write signals Most processors use this I/O mapping
Isolated I/O
Separate I/O address space Separate I/O read and write signals are needed Pentium supports isolated I/O 64 KB address space Can be any combination of 8-, 16- and 32-bit I/O ports Also supports memory-mapped I/O
Chapter 19: Page 6
Accessing I/O Devices (contd)
Accessing I/O ports in Pentium
Register I/O instructions
in accumulator, port8 ; direct format Useful to access first 256 ports in accumulator,DX ; indirect format DX gives the port address
Block I/O instructions
ins and outs Both take no operands---as in string instructions ins: port address in DX, memory address in ES:(E)DI outs: port address in DX, memory address in ES:(E)SI We can use rep prefix for block transfer of data
Chapter 19: Page 7
An Example I/O Device
Keyboard
Keyboard controller scans and reports
Key depressions and releases Supplies key identity as a scan code Scan code is like a sequence number of the key
Keys scan code depends on its position on the keyboard
No relation to the ASCII value of the key
Interfaced through an 8-bit parallel I/O port
Originally supported by 8255 programmable peripheral interface chip (PPI)
Chapter 19: Page 8
An Example I/O Device (contd)
8255 PPI has three 8-bit registers
Port A (PA) Port B (PB) Port C (PC)
These ports are mapped as follows 8255 register Port address PA (input port) 60H PB (output port) 61H PC (input port) 62H Command register 63H
Chapter 19: Page 9
An Example I/O Device (contd)
Mapping of 8255 I/O ports
Chapter 19: Page 10