WRITE_CMD(sc, CMD_TXRESET); WRITE_CMD(sc, CMD_RXRESET);

1

2

1

2

Calls the WRITE_CMD macro to write data to the command port register. The data to be written is the transmit (TX) reset command (CMD_TXRESET).

Calls the WRITE_CMD macro to write data to the command port register. In this call, the data to be written is the receive (RX) reset command (CMD_RXRESET).

8.2.9 Setting the LAN Address

The following code shows how the el_init_locked( ) routine sets the LAN address. This task is specific to the 3Com 3C5x9 device. You may want to perform similar initialization tasks for the hardware device that your network driver controls.

WRITE_CMD(sc, CMD_WINDOW2); 1

i = (sc->is_addr[1] << 8) + sc->is_addr[0]; WRITE_AD1(sc, i);

i = (sc->is_addr[3] << 8) + sc->is_addr[2]; WRITE_AD2(sc, i);

i = (sc->is_addr[5] << 8) + sc->is_addr[4]; WRITE_AD3(sc, i);

lan_set_attribute(sc->ehm.current_val, NET_MAC_NDX, ether_sprintf(sc->is_addr)); 2

1

2

Performs several write operations to set the LAN address.

Sets the LAN MAC address attribute for EHM support.

8.2.10 Processing Special Flags

The following code shows how the el_init_locked( ) routine processes special flags. 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.

if (ifp->if_flags & IFF_LOOPBACK) { 1 WRITE_CMD(sc, CMD_WINDOW4);

i = READ_ND(sc);

WRITE_ND(sc, ND_LOOP i);

lan_set_attribute(sc->ehm.current_val, NET_LOOP_NDX, (void *)1); 2

}

else {

lan_set_attribute(sc->ehm.current_val, NET_LOOP_NDX, (void *)0);

}

i = RF_IND RF_BRD;3

if ((ifp->if_flags & IFF_ALLMULTI) (sc->is_multi.lan_nmulti)) { 4 i = RF_GRP;

}

if (ifp->if_flags & IFF_PROMISC) { 5 i = RF_PRM;

lan_set_attribute(sc->ehm.current_val, NET_PROMISC_NDX, (void *)1);

}

6

8–8Implementing the Initialization Section

Page 108
Image 108
Compaq AA-RNG2A-TE manual Setting the LAN Address, Processing Special Flags