Interrupt Controller (CF1_INTC)
MCF51CN128 Reference Manual, Rev. 6
Freescale Semiconductor
8-19
The reset state of the INTC_PL6P{7,6} registers disables any request remapping.
8.6.3
More on Software IACKs
As previously mentioned, the notion of a software IACK refers to the ability to query the interrupt
controller near the end of an interrupt service routine (after the current interrupt request has been cleared)
to determine if there are any pending (but currently masked) interrupt requests. If the response to the
software IACK’s byte operand read is non-zero, the service routine uses the value as the vector number of
the highest pending interrupt request and passes control to the appropriate new handler. This process
avoids the overhead of a context restore and RTE instruction execution, followed immediately by another
interrupt exception and context save. In system environments with high rates of interrupt activity, this
mechanism can improve overall system performance noticeably.
To illustrate this concept, consider the following ISR code snippet shown in
.
Figure 8-8. ISR Code Snippet with SWIACK
This snippet includes the prologue and epilogue for an interrupt service routine as well as code needed to
perform software IACK.
At the entry point (
irqxx_entry
), there is a two-instruction prologue to allocate space on the supervisor
stack to save the four volatile registers (d0, d1, a0, a1) defined in the ColdFire application binary interface.
After saving these registers, the ISR continues at the alternate entry point.
The software IACK is performed near the end of the ISR, after the source of the current interrupt request
is negated. First, the appropriate memory-mapped byte location in the interrupt controller is read
(PC = 0x5C0). The CF1_INTC module returns the vector number of the highest priority pending request.
If no request is pending, zero is returned. The compare instruction is needed to manage a special case
involving pending level seven requests. Because the level seven requests are non-maskable, the ISR is
interrupted to service one of these requests. To avoid any race conditions, this check ignores the level seven
align 4
irqxx_entry:
00588: 4fef fff0 lea -16(sp),sp
# allocate stack space
0058c: 48d7 0303 movem.l #0x0303,(sp)
# save d0/d1/a0/a1 on stack
irqxx_alternate_entry:
00590:
....
irqxx_swiack:
005c0: 71b8 ffe0 mvz.b INTC_SWIACK.w,d0
# perform software IACK
005c4: 0c00 0041 cmpi.b #0x41,d0
# pending IRQ or level 7?
005c8: 6f0a
ble.b irqxx_exit
# no pending IRQ, then exit
005ca: 91c8
sub.l a0,a0
# clear a0
005cc: 2270 0c00 move.l 0(a0,d0.l*4),a1
# fetch pointer from xcpt table
005d0: 4ee9 0008 jmp 8(a1)
# goto alternate isr entry point
align 4
irqxx_exit:
005d4: 4cd7 0303 movem.l (sp),#0x0303
# restore d0/d1/a0/a1
005d8: 4fef 0010 lea 16(sp),sp
# deallocate stack space
005dc: 4e73
rte
# return from handler