Data Sheet
June 2001
DSP16410B Digital Signal Processor
36
Agere Systems—Proprietary
Use pursuant to Company instructions
Agere Systems Inc.
4 Hardware Architecture
(continued)
4.4 Interrupts and Traps
(continued)
4.4.11 Nesting Interrupts
(continued)
The core automatically globally disables interrupts when it begins servicing an interrupt. Therefore, an interrupt
service routine (ISR) cannot be interrupted unless the programmer places an
ei
(enable interrupts) instruction
within the ISR. In other words, interrupt nesting is disabled by default. To allow nesting, the ISR must perform the
following steps before executing an
ei
instruction:
1. Copy the contents of
psw1
and
pi
to memory. This is needed to save the previous interrupt priority level (IPL
P
)
and the interrupt return address in
pi
, which are overwritten by the core if the ISR is interrupted.
2. Copy the contents of
cstate
to memory and then clear
cstate
. This is needed in case the ISR has interrupted a
cache loop (
do
or
redo
). If the ISR is interrupted and
cstate
is not cleared, the nested interrupt’s
ireturn
instruction will return to the cache instead of to the ISR. See the DSP16000 Digital Signal Processor Core Infor-
mation Manual for details on
cstate
and the cache.
After performing the above steps, the ISR can safely globally enable interrupts by executing an
ei
instruction. After
servicing the interrupt and before executing an
ireturn
instruction to return the core to its previous state before the
interrupt occurred, the ISR must perform the following steps:
1. Globally disable interrupts via the
di
(disable interrupts) instruction. This is needed to ensure that the restoring
step below is not interrupted.
2. Restore
psw1
,
pi
, and
cstate
so that they contain their original values from the beginning of the ISR execution.
After performing the above steps, the ISR can return the core to its previous state by executing an
ireturn
instruc-
tion. Executing
ireturn
globally enables interrupts, so it is not necessary for the ISR to explicitly enable interrupts
by executing an
ei
instruction before returning.
See the DSP16000 Digital Signal Processor Core Information Manual for more detail on interrupt nesting.
4.4.12 Interrupt Polling
If a core disables an interrupt and tests its
ins
field, it can poll that interrupt instead of automatically servicing
it. This procedure, however, costs in the amount of code that must be written and executed to replace what the
DSP16000 core does by design.
The programmer can poll an interrupt source by checking its pending status in
ins
. The program can clear an inter-
rupt and change its status from pending to not pending by writing a 1 to its corresponding
ins
field. This clears the
field and leaves the remaining fields of
ins
unchanged. The example code segment below polls the MGU input
buffer full (MGIBF):
poll:
a0=ins
a0=a0&0x00000400
if eq goto poll
...
ins=0x00400
// Copy ins register contents to a0.
// Mask out all but bit 10.
// If bit 10 is zero, then MGIBF not pending.
// Interrupt is now pending -- service it.
// Clear MGIBF; don’t change other interrupts.