13.1.3 Reading the Interrupt Status
The following code shows how the
el_intr( )
routine uses the
READ_STS
macro to read the interrupt status from the I/O status register:
status = READ_STS(sc);
13.1.4 Processing Completed Receive and Transmit Operations
The following code shows how the
el_intr( )
routine processes the receive
and transmit rings:
if (((status & (S_RC|S_TC|S_AF)) == 0) || sc->cardout) {
1
simple_unlock(&sc->el_softc_lock);
splx(s);
return INTR_NOT_SERVICED;
}
while ((status & (S_RC|S_TC|S_AF)) && (!el_card_out(sc))) {
2
if (status & S_RC)
el_rint(sc, ifp);
if (status & S_TC)
el_tint(sc, ifp);
if (status & S_AF)
el_error(sc, ifp);
status = READ_STS(sc);
}
1
Examines the status that the
READ_STS
macro returns.
If the
status
variable does not have the receive complete (
S_RC
) bit,
the transmit complete (
S_TC
) bit, or the adapter failure (
S_AF
) bit set,
or if the PCMCIA card is out of the slot:
•
Calls the
simple_unlock( )
routine to release the simple lock for
the resource that is associated with
el_softc_lock
.
•
Calls the
splx( )
routine to reset the CPU priority to the level that
the
s
variable specifies.
•
Returns the constant
INTR_NOT_SERVICED
to the kernel interrupt
dispatcher. This constant indicates that this shared interrupt was
not for the
if_el
device.
2
While the
status
variable has the receive complete (
S_RC
) bit, the
transmit complete (
S_TC
) bit, or the adapter failure (
S_AF
) bit set, and
if the card has not been removed from the machine:
•
If the
status
variable has the
S_RC
bit set, calls the
el_rint( )
routine to process the receive interrupt.
•
If the
status
variable has the
S_TC
bit set, calls the
el_tint( )
routine to process the transmit interrupt.
Implementing the Interrupt Section 13–3