Interrupt Controller�(8259 Programming Examples�& Intro to DMA)
Dr A Sahu
Dept of Comp Sc & Engg.
IIT Guwahati
Outline
Block Diagram of 8259
8259A
Programmable
Interrupt
Controller
IRQ0
IRQ1
IRQ2
IRQ3
IRQ4
IRQ5
IRQ6
IRQ7
8 bit
Data Bus
RDb
WRb
CSb
A0
INT
INTAb
SPb/ENb
Block Diagram Architecture of 8259
Control Logic
Interrupt Service
Register
Priority Resolver
Interrupt Request
Register
IRQ0
IRQ1
IRQ2
IRQ3
IRQ4
IRQ5
IRQ6
IRQ7
Interrupt Mask Register
Internal Bus
INTAb
INT
Interrupt Vector Table
03FF
03FE
03FD
03FC
0007
0006
0005
0004
0003
0002
0001
0000
int type 255
Int type 0
Int type 1
Memory in Hex
IP High Byte
IP Low byte
IP High Byte
CS Low Byte
IP High Byte
IP Low byte
IP High Byte
CS Low Byte
IP High Byte
IP Low byte
IP High Byte
CS Low Byte
Priority Modes
Control Word (initialization)
CS | A0 | Initialization |
0 | 0 | ICW1 |
0 | 1 | ICW2,ICW3,ICW4 |
1 | X | Not Address |
ICW1 & ICW2
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
0 | 0 | 0 | 0 | 1 | LTIM | 0 | SGNL | IC4 |
| 0 for x86 | | 1 for Level Trigger 0 for Edge Trigger | | 1=single 0=Cascade | | ||
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | T7 | T6 | T5 | T4 | T3 | T2 | T1 | T0 |
| T7=T0 is the assign to IR0, Vector address for ISR | |||||||
Masking and Prioritization
CS | A0 | Operation Command Word |
0 | 0 | OCW1 |
0 | 1 | OCW2,OCW3,OCW4 |
1 | X | Not Address |
Programming OCWs: OCW1, OCW2
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | M7 | M6 | M5 | M4 | M3 | M2 | M1 | M0 |
| Interrupt Masks: 1= Mask Set, 0 =Mask reset | |||||||
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
0 | R | SL | EOI | 0 | 0 | L2 | L1 | L0 |
| Roteate | Specific | EOI | | | IR Level to be acted Upon (0-7) | ||
Example: Setting of control word
8259
IR0
IR1
IR2
IR6
Emergency
A/D converter
Keyboard
Printer
3-to-8
Decoder
CSb
A0
E1b E2b E3
A2
A1
A0
A3
A2
A1
A7
A6
A5
A0
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | M7=0 | M6=1 | M5=1 | M4=1 | M3=1 | M2=1 | M1=1 | M0=1 |
| Interrupt Masks: 1= Mask Set, 0 =Mask reset | |||||||
OCW1=7F
ADDRESS= 80H, 81H
04
Initialization words (ICW1 & ICW2)
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |
| A7, A6,A5 Lower address bit of Vector Address | | 0 for Edge Trigger | Call Address interval =4 | 1=single 0=Cascade | | ||
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | T7 | T6 | T5 | T4 | T3 | T2 | T1 | T0 |
| 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| T7=T0 is the assign to IR0, Vector address for ISR Lower Byte of call address | |||||||
76H
20H
Vector Address 2060, 2064…. | 0100 0000 | 0 1 1 | 00000 |
Program to initialize
DI
MVI A, 76H ;move ICW1 byte to ACC
OUT 80H ; initialize 8259A ICW1
MVI A, 20H ; mov ICW2 byte to ACC
OUT 81H ; Initialize 8259A ICW2
MVI A, 7FH ; Put the OCW1
OUT 80H
Nested mode
Nested Interrupt process
EI
EI
RET
EI
DI
EOI
EI
RET
Interrupt at IR6
Interrupt at IR2
It wait up to EI instruction
IR2 has highest priority
IR6 has lower priority
Maskable Interrupt
AD0 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | M7=0 | M6=1 | M5=1 | M4=1 | M3=1 | M2=1 | M1=1 | M0=1 |
| Interrupt Masks: 1= Mask Set, 0 =Mask reset | |||||||
OCW1=7F
DMA
Data Transfer DMA mode
Memory
CPU
DMA
Controller
CPU
I/O
System Bus
Memory
I/O
System Bus
Data Transfer
Data Transfer : DMA
DMA Controller
Interrupt
Controller
I/O Controller
DMA
Controller
IREQ
DREQ
DACK
IORDb
IOWRb
EOPb
MEMRDb
MEMWRb
INTR
HOLD
HOLDA
Data Bus
Address Bus
CPU
Memory
DMA Controller
DMA: HOLD and HOLDA
Steps in a DMA operation
8237 DMA Controller
8237 supports four DMA channels
DMA Registers
Type of Data Transfer using 8237 DMA
Programming DMA
Next class will be in Room 1201
7 Sept 2010 onwards
Reference
Thanks