Sie sind auf Seite 1von 28

INTERRUPT ROUTINES

Software interrupts
Software interrupt
Interrupt Service Threads as
Second Level Interrupt Handlers
ISR executed in two parts
One part is short execution time
service routine
Runs the critical part of the ISR and
passes a signal or message to the OS
for running the remaining second
part later.
Device Driver
A device driver has a set of routines
(functions) used by a high-level
language programmer, which does the
interaction with the device hardware,
sends control commands to the device,
communicates data to the device and
runs the codes for reading device data
Device driver
Each device in a system needs device
driver routine with number of device
functions.
An ISR relates to a device driver
command (device-function).
The device driver uses SWI to call the
related ISR (device-function routine)
The device driver also responds to
device hardware interrupts.
Generic functions used for the
commands to the device are device
create ( ), open ( ), connect ( ), bind (
), read ( ), write ( ), ioctl () [for IO
control], delete ( ) and close ( ).
Eg.Format Disk

Partition and
Format Disk

Eg.copy a file

USB device driver


g. Remove USB device
copy a file
Hardware Interrupt
Sources
Hardware sources can be internal or
external for interrupt of ongoing routine
and thereby diversion to corresponding
ISR.
The internal sources from devices differ
in different processor or microcontroller
or device and their versions and families
External sources and ports also differ in
different processors or microcontrollers
Hardware Interrupt
Sources
1 Parallel Port
2. UART Serial Receiver Port - [Noise, Overrun,
Frame-Error, IDLE, RDRF in 68HC11]
3. Synchronous Receiver byte Completion
4. UART Serial Transmit Port-Transmission
Complete, [For example, TDRE (transmitter data
register Empty]
5. Synchronous Transmission of byte completed
6. ADC Start of Conversion
Hardware Interrupt
Sources
7. ADC End of Conversion
8. Pulse-Accumulator overflow
9. Real Time Clock time-outs
10. Watchdog Timer Reset
11. Timer Overflow on time-out
12. Timer comparison with Output compare
Registers
13. Timer capture on inputs
Interrupt Vector mechanism
Processor first saves program
counter and/or other registers of CPU
on interrupt and then loads a vector
address into the program counter.
Vector address provides either the
ISR or ISR address to the processor
for the interrupt source or group of
sources or given interrupt type
Interrupt Vector
System software designer puts the
bytes at a ISR_VECTADDR address.
The bytes are for either
the ISR short code or jump
instruction to ISR instruction or
ISR short code with call to the full
code of the ISR at an ISR address or
Bytes points to an ISR address
Masking of Interrupt
Sources
Maskable sources of interrupt provides
for masking and unmasking the
interrupt service (diversion to the ISR).
Execution of a device interrupt source or
source group can be masked.
On a pin, an external interrupt request
can be masked.
Execution of a software interrupt (trap
or exception or signal) can be masked.
Most interrupt sources are maskable.
Multiple Interrupt Sources and
Priority Mechanism
Interrupt Latency
A period between occurrence of an
interrupt and start of execution of
the ISR
The time taken in context switching
is also included in a period, called
interrupt latency period, Tlat.
Latency in case of interrupt service starting
immediately

Das könnte Ihnen auch gefallen