Intel i960 Jx Developer's Manual page 339

Microprocessor
Table of Contents

Advertisement

Example 11-4. Sampling Pending Interrupts
Check_For_Pending_Interrupts:
x = read(pending_priorities);
if(x == 0) return(); #nothing to do
y = most_significant_bit(x);
if(y != 31 && y <= current_priority) return();
x = atomic_read(pending_priorities); #synchronize
if(x == 0)
{atomic_write(pending_priorities) = x;
return();} #interrupts disappeared
# (e.g., handled by another processor)
y = most_significant_bit(x); #must be repeated
if(y != 31 && y <= current_priority)
{atomic_write(pending_priorities) = x;
return();} #interrupt disappeared
z = read(pending_interrupts[y]); #z is a byte
if(z == 0)
{x[y] = 0; #false alarm, should not happen
atomic_write(pending_priorities) = x;
return();}
else
{w = most_significant_bit[z];
z[w] = 0;
write(pending_interrupts[y]) = z;
if(z == 0) x[y] = 0; #no others at this level
atomic_write(pending_priorities) = x;
take_interrupt();}
The algorithm shows that the pending interrupts are marked by a bit in the pending interrupts field,
and that the pending priorities field is an optimization; the processor examines pending interrupts
only if the corresponding bit in Pending Priorities is set.
The steps prior to the atomic_read are another optimization. Note that these steps must be repeated
within the synchronized critical section, since another processor could have detected and accepted
the same pending interrupt(s).
Use
with a vector in the range 0 to 7 to force the core to check the interrupt table for pending
sysctl
interrupts. When an external agent is posting interrupts to a shared interrupt table, use
periodically to guarantee recognition of pending interrupts posted in the table by the external agent.
INTERRUPTS
11
sysctl
11-13

Advertisement

Table of Contents
loading

Table of Contents