CS452 - Real-Time Programming - Spring 2008
Lecture 19 - Interrupt Service Routines
Questions & Comment
- Friday
- ASUS P4P800-VM
- 82801EB southbridge
- 8254 timers
- 8259 interrupt controllers
- W83627THF
- probably two 16550As at ports at 0x2f8-0x2ff, irq 3 and
0x3f8-0x3ff, irq4
Interrupt Service Routines
Example
error = Delay( int interval );
Delay( ) is a stub that Sends a message to the
clock server.
- It returns when the clock server
Replys
- The message says: wake me up after
interval ticks have
elapsed.
Possible errors
- illegal value of interval
- no clock server
Clock server manages a queue of tasks to wake up
Hardware
8254 timer
- Four 16-bit registers
- 8-bit status/control register
- You want mode 2
- interrupt line sets for exactly one clock cycle
- needs to be latched in interrupt contyroller
8259 interrupt controller
- where the interrupt is turned off
- three registers
- interrupt mask register: don't need an EOI
- interrupt request register: waiting for service
- in-service register: waiting for EOI
Remember
- three places that interrupts can be turned off
- device
- interrupt controller
- CPU
- CPU requires edge-triggered
Basic Service
- Save more state
- Locate interrupt source
- by argument (vector)
- by polling
- Service the hardware
- save volatile data
- turn off interrupt, including EOI to PIC
- return from interrupt
Where should each part of this be done?
Low-level primitive
int AwaitEvent( int EventType );
Implementation notes
- Event may already have occurred
- AwaitEvent( ) can service the device.
- Then it must return the volatile data
- Need to think of priorities when you partition the work
- Kernel has interrupts turned off
- Therefore need
IdleTask( ). Why?
Return to: