I/O  
MODULE FUNCTIONS
·       Control & Timing.
·       CPU Communication
·       Device Communication
·       Data Buffering
·       Error Detection
I/O steps
•        
CPU
checks I/O module device status
•        
I/O
module returns status
•        
If
ready, CPU requests data transfer
•        
I/O
module gets data from device
•        
I/O
module transfers data to CPU
A)
 Input Output Techniques :
         1)  
Programmed  I/O
2)   Interrupt driven  I/O
3)Direct Memory Access (DMA)
1)     
Programmed I/O
·       CPU  has direct control over I/O for :
·       Sensing status
·       Read/write commands.
·       Transferring data
·         
CPU
waits for  I/O module to complete
operation.
·         
Wastes
CPU time.
-> Programmed  I/O in  detail
•        
CPU
requests I/O operation
•        
I/O
module performs operation
•        
I/O
module sets status bits
•        
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
-> I/O Commands
·       Control - telling module what to do.
(e.g. spin up disk)
·       Test - check status
·       Read/Write
2)     
Interrupt  Driven I/O 
      ·       Overcomes CPU waiting
      ·       No repeated CPU checking of device
      ·       I/O module interrupts when ready
-> Interrupt  Driven  I/O in detail
•        
CPU
 issues read command
•        
I/O
module gets data from peripheral while  CPU does other work
•        
I/O
module interrupts CPU
•        
CPU
requests data
•        
I/O
module transfers data
CPU
Viewpoint
•        
Issue read command
•        
Do other work
•        
Check for interrupt at end of each instruction
cycle
•        
If  interrupted:-
— 
Save context (registers)
— 
Process interrupt
–      Fetch data & store
1)     
Direct
Memory Access :
•        
Interrupt
driven and  programmed  I/O require active CPU intervention , because 
·       Transfer  rate
is limited
·       CPU  is tied up
DMA Function 
•        
Additional
Module (hardware) on bus.
•        
DMA
controller takes over from CPU for I/O
DMA Operation
•        
CPU
tells DMA controller:-
— 
Read/Write
— 
Device
address
— 
Starting
address of memory block for data
— 
Amount
of data to be transferred
•        
CPU
carries on with other work
•        
DMA
controller deals with transfer
•        
DMA
controller sends interrupt when finished



