Implementing the Initialization Section
The initialization section prepares the network interface to transmit and
receive data packets. It can also allocate mbuf data structures for the
receive ring.
The if_el device driver implements the following routines in its
initialization section:
•
el_init (Section 8.1)
•
el_init_locked (Section 8.2)
8.1 Implementing the el_init Routine
The el_init( ) routine is a jacket routine that performs the following tasks:
•
Determines whether the PCMCIA card is in the slot (Section 8.1.2)
•
Sets the IPL and obtains the simple lock (Section 8.1.3)
•
Calls the el_init_locked( ) routine to perform the initialization
(Section 8.1.4)
•
Releases the simple lock and resets the IPL (Section 8.1.5)
•
Returns the status from el_init_locked( ) (Section 8.1.6)
8.1.1 Setting Up the el_init Routine
The following code shows how to set up the el_init( ) routine:
static int el_init(int unit) 1
{
register struct el_softc *sc = el_softc[unit];
register struct ifnet *ifp = &sc->is_if;
int i, s; 4
Specifies the unit number of the network interface as the only argument
1
to el_init( ).
Declares a pointer to the el_softc data structure called sc and
2
initializes it to the el_softc data structure for this device. The
controller number (which is stored in the unit variable) is used as an
index into the array of el_softc data structures to determine which
el_softc data structure is for this device.
2
3
Implementing the Initialization Section 8–1
8
Need help?
Do you have a question about the Tru64 UNIX and is the answer not in the manual?
Questions and answers