Académique Documents
Professionnel Documents
Culture Documents
C R Sarma
Associate Professor, Dept of ECE
G.Narayanamma Institute of Technology and Science
1
Input Output Management
• External Devices
• I/O Modules
• Programmed I/O
• Interrupt-Driven I/O
• Direct Memory Access
• I/O Channels and
Processors
• FireWire
2
Input/Output Problems
• Wide variety of peripherals
(external devices)
– Delivering different amounts of
data
– At different speeds
– In different formats
• All slower than CPU and RAM
• Need I/O modules
3
Generic Model of I/O
Module
4
I/O Module Diagram
5
External Device Block
Diagram
6
External Devices
Sensors: sense the outside
• Human readable devices world (e.g. temperature
sensor, microphone)
– Screen, printer, keyboard
Transducers: Sense or
• Only machine readable devices
affect the outside world
(e.g. furnace control,
– Monitoring and control
speaker, temp sensor)
• Communication
– Modem
– Network Interface Card (NIC)
7
Typical I/O Data Rates
8
Typical I/O Module
Functions
• Control & Timing
• CPU Communication
• Device Communication
• Data Buffering
• Error Detection
9
I/O Steps
12
I/O Module (design)
Decisions
• Hide or reveal device properties to
CPU?
• Support multiple or single device?
• Control device functions or leave for
CPU?
• Also O/S decisions
– e.g. Unix treats everything it can as a
file
– Might even let programmer address I/O 13
Input Output Techniques
• Programmed I/O
– CPU asks device for I/O then “polls” device until I/O
complete
– then (e.g. read) CPU transfers new item obtained
from device
15
Programmed I/O - detail
CPU must “poll” for results
• Programmed I/O sequence:
1. CPU requests I/O operation
2. I/O module performs operation
3. I/O module sets status bits
4. CPU checks status bits periodically
• I/O module does not inform CPU
directly
• I/O module does not interrupt CPU
• CPU may wait or come back later 16
Programmed I/O
CPU executing Typical Polled
software
instructions Operation
CPU issues I/O command
device performs
CPU reads device status bits operation
no
status = done/ready?
CPU is
yes
“busy waiting”
in polling loop
17
I/O Mapping
• Memory mapped I/O
– Devices and memory share an
address space
– I/O access just like memory read/write
– No special CPU instructions for I/O
• Large selection of memory access
commands
• Isolated I/O
– Separate address spaces
– Need I/O vs. memory select lines on
control bus
– Special CPU instructions for I/O
• Limited access commands 18
Programmable Peripheral
Interface
i8255
19
I/O Management
by
Operating Systems
• OS’s discourage access to I/O by
address
• OS’s treat I/O devices as FILES
• Files are called Device Drivers
• A Drivers for same type of I/O
peripheral from different
manufacturers – different control and
addresses of registers
• Easy to change if treated as device 20
I/O Management by Operating
Systems
22
Interrupt Driven I/O
23
Interrupt Driven I/O
CPU Viewpoint
done by CPU hardware
Issue Read command
NOT software instructions!
Do other work
Check for interrupt at end of each
instruction cycle
If interrupted:
execute ISR
a) Save context (registers) (software)
b) Process interrupt
• Fetch data & store
c) restore saved context and resume 24
Interrupt Driven I/O
Design Issues
25
Interrupt Driven I/O
Identifying Interrupting
Module (1)
• Techniques:
• Different hardware bus interrupt line
for each module? (expensive)
• Software Poll: CPU asks each module
in turn (slow)
• Daisy chain or HW Poll (next slide)
• Bus Mastering (later slide)
26
Interrupt Driven I/O
• Daisy Chain or Hardware poll
– Interrupt Acknowledge sent by CPU
hardware
– ripples down a chain of connected devices daisy
– Module responsible places vector on bus chain
– CPU uses vector to identify handler routine links
IntA
Module
. . . Module . . . Module
CPU 1 i n
vector
vector is a word of data; e.g. address of the
I/O module, or other unique id.
27
Hardware: Bus Master
Approach
• Bus Mastering (uses bus
arbitration) Approach:
– I/O Module must get control of the bus
before it can raise interrupt
– Then only one interrupt line needed!
– e.g. PCI & SCSI
28
Multiple Interrupts
29
Programmable Interrupt
Controller
i8259
30
Example - PC Bus
• 80x86 has one interrupt line
• 8086 based systems use one 8259A interrupt
controller
• 8259A has 8 interrupt lines (IR)
I/O module 1
interrupt signal IR0
INTR to CPU
... ...
8259A
IR i I/O module i
IntA signal
-1
from CPU IR7 interrupt signals
from module
vector to CPU I/O module 8
(related to IR #)
31
Sequence of Events
IntA
to master
IntA
to slave
vector
from slave
Maximum Chaining
64 devices
33
Direct Memory Access
34
DMA Function
35
DMA Module Diagram
36
DMA Operation
39
DMA Configurations (1)
40
DMA Configurations (2)