![](//vs1.manuzoid.com/store/data-gzf/7ecf66f4eee54e4497f2ea3398161887/2/000840901.htmlex.zip/bg13.jpg)
Introduction
Interrupt Integration
MMC2001DDRM/D MOTOROLA
Reference Manual 19
In order to preserve generality for interrupt processing among all device driver
library modules, the ISR can be implemented as an
interrupt dispatch routine
. The
dispatch routine calls an
interrupt service function
(ISF) which performs the actual
work associated with the interrupt. The dispatch routine can take care of a number
of things in preparation for calling the ISF:
1. Sorting out among individual device hardware requests coming through the
same vector.
2. Specifying the relevant hardware device address or device descriptor for the
given instance of a peripheral. This allows an interrupt service function to be
written independently of the hardware or descriptor address, and therefore
capable of servicing any number of like devices in the same system.
3. Serving as a “wrapper” for the interrupt service function: performing a normal
C function call, receiving control back from the ISF when it is finished, and
performing any post-processing that may be necessary.
For example, assume that there are two SCI devices on a chip, and two hardware
vectors. Each of these will point to a single dispatch routine. The dispatch routine
determines whether the interrupt is for the receive or transmit channel. It also
knows the descriptor address (device handle) unique to the hardware device being
serviced, and passes this to the appropriate interrupt service function.
1.3.2 Interrupt Status Communication
The interrupt service function may be either a user-implemented routine, or an API
function capable of performing the requisite interrupt handling. When the ISF is
called by the dispatcher it is still within the interrupt context, so there must be a way
of communicating the ISF return status to the application program. This can be
accomplished by having the dispatcher call a
service signalling function
(SSF)
upon return from the ISF. The SSF is passed the return code of the interrupt
service function, along with other pertinent parameters such as the device
descriptor and any returned data.
Separating the roles of interrupt service function and service signalling function
makes it possible to use arbitrary API functions as ISFs, and provides for
customization of the signalling function. The dispatcher as interrupt service routine
can be adapted to whatever interrupt mechanism is supported by the system
hardware.
Figure 1-4 shows interrupt service relationships.
Frees
cale Semiconductor,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc...