•
Sets the LAN media type attribute (Section 8.2.6)
•
Selects memory mapping (Section 8.2.7)
•
Resets the transmitter and receiver a second time (Section 8.2.8)
•
Sets the LAN address (Section 8.2.9)
•
Processes special flags (Section 8.2.10)
•
Sets the debug flag (Section 8.2.11)
•
Enables TX and RX (Section 8.2.12)
•
Enables interrupts (Section 8.2.13)
•
Sets the operational window (Section 8.2.14)
•
Marks the device as running (Section 8.2.15)
•
Starts the autosense kernel thread (Section 8.2.16)
•
Starts transmitting pending packets (Section 8.2.17)
8.2.1 Resetting the Transmitter and Receiver
The following code shows how the
el_init_locked( )
routine resets the
transmitter and receiver. This task is specific to the 3Com 3C5x9 device.
Make sure that you perform similar initialization tasks for the hardware
device that your network driver controls.
static int el_init_locked(struct el_softc *sc,
struct ifnet *ifp,
int unit)
{
register struct controller *ctlr = el_info[unit];
int i;
WRITE_CMD(sc, CMD_TXRESET);
1
WRITE_CMD(sc, CMD_RXRESET);
2
1
Calls the
WRITE_CMD
macro to write data to the command port register.
In this call,
el_init_locked( )
passes the
if_el
driver’s
el_softc
data structure pointer. The data to be written is the transmit (TX)
reset command (
CMD_TXRESET
).
2
Calls the
WRITE_CMD
macro a second time to write data to the command
port register. In this call, the data to be written to the command port
register is the receive (RX) reset command (
CMD_RXRESET
).
8.2.2 Clearing Interrupts
The following code shows how the
el_init_locked( )
routine clears
interrupts.
8–4 Implementing the Initialization Section