Setting The Ipl And Obtaining The Simple Lock; Rearming The Next Timeout - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

13.1.1 Setting the IPL and Obtaining the Simple Lock

The following code shows how the el_intr( ) routine sets the CPU's IPL
and obtains the simple lock:
static int el_intr(int unit)
{
register u_int s;
volatile u_int status;
register struct el_softc *sc = el_softc[unit];
register struct ifnet *ifp = &sc->is_if;
if (el_card_out(sc)) return (INTR_NOT_SERVICED);
s = splimp();
simple_lock(&sc->el_softc_lock);
Declares an argument that specifies the unit number of the network
1
interface that generated the interrupt.
Determines whether the card is still in the socket. If the card is no
2
longer in the socket, then returns the constant INTR_NOT_SERVICED to
the kernel interrupt dispatcher.
Calls the splimp( ) routine to mask all Ethernet hardware interrupts.
3
Calls the simple_lock( ) routine to assert a lock with exclusive access
4
for the resource that is associated with el_softc_lock.

13.1.2 Rearming the Next Timeout

The following code shows how the el_intr( ) routine rearms the next
timeout:
if (sc->polling_flag) 1
timeout((void *)el_intr, (void *)unit, (1*hz)/el_pollint); 2
Determines whether polling was started by testing the polling_flag
1
flag member in the el_softc data structure for this device.
If the polling process was started, calls the timeout( ) routine to
2
rearm the next timeout. The timeout( ) routine is called with the
following arguments:
A pointer to the el_intr( ) routine, the if_el device driver's
interrupt handler.
The unit variable, which contains the controller number for this
device. This argument is passed to the el_intr( ) routine.
The el_pollint variable, which specifies the amount of time to
delay before calling the el_intr( ) routine.
13–2 Implementing the Interrupt Section
1
3
4
2

Advertisement

Table of Contents
loading

Table of Contents