The
el_softc_lock
member of the
el_softc
data structure points to
a simple lock data structure. The
if_el
device driver declares this data
structure by calling the
decl_simple_lock_data( )
routine.
8.1.4 Calling the el_init_locked Routine
The following code shows how the
el_init( )
routine calls the
el_init_locked( )
routine, which performs the actual initialization tasks:
i = el_init_locked(sc, ifp, unit);
8.1.5 Releasing the Simple Lock and Resetting the IPL
The following code shows how the
el_init( )
routine releases the simple
lock and resets the IPL. All network device drivers that do not use the simple
lock mechanism must reset the IPL. All network device drivers that use the
simple lock mechanism must reset the IPL after releasing the simple lock.
simple_unlock(&sc->el_softc_lock);
1
splx(s);
2
1
Calls the
simple_unlock( )
routine to release the simple lock.
2
Calls the
splx( )
routine to reset the CPU priority to the level that is
stored in the
s
variable.
8.1.6 Returning the Status from the el_init_locked Routine
The following code shows how the
el_init( )
routine returns status from
el_init_locked( )
:
return(i);
1
}
1
Exits and returns the status from
el_init_locked( )
.
8.2 Implementing the el_init_locked Routine
The
el_init_locked( )
routine initializes the network interface. It is
called by the
if_el
device driver’s
el_init( )
and
el_reset_locked( )
routines.
The
el_init_locked( )
routine performs the following tasks:
•
Resets the transmitter and receiver (Section 8.2.1)
•
Clears interrupts (Section 8.2.2)
•
Starts the device (Section 8.2.3)
•
Ensures that the 10Base2 transceiver is off (Section 8.2.4)
•
Sets the LAN media (Section 8.2.5)
Implementing the Initialization Section 8–3