8.2.5 Setting the LAN Media

The following code shows how the el_init_locked( ) routine sets the LAN media. 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.

i

= READ_ACR(sc);

1

 

 

 

 

 

 

 

 

 

i

&= ~ (ACR_BASEACR_10B2);

2

 

 

 

 

switch (sc->lm_media) {

3

 

 

 

case LAN_MEDIA_BNC:

 

 

 

 

 

4

 

 

 

 

WRITE_ACR(sc,

 

 

 

 

 

i ACR_10B2 sc->iobase);

WRITE_CMD(sc, CMD_START2); 6 DELAY(800); 7

break;

case LAN_MEDIA_AUI: 8 WRITE_ACR(sc,

i ACR_10B5 sc->iobase);

break;

default: 10

sc->lm_media = LAN_MEDIA_UTP; case LAN_MEDIA_UTP: 11

WRITE_ACR(sc,

i ACR_10BT sc->iobase); WRITE_CMD(sc, CMD_WINDOW4); 13

i = READ_MD(sc);

WRITE_MD(sc, i (MD_LBE MD_JABE)); break;

}

5

9

12

14

1

2

3

4

5

6

7

8

9

Calls the READ_ACR macro to read the data from the address control register.

Clears the ACR_BASE (the I/O base address) and the ACR_10B2 (Ethernet thin coaxial cable) bits.

Evaluates the value that is stored in the lm_media member of the el_softc data structure for this device.

Determines whether lm_media evaluates to LAN_MEDIA_BNC (media mode is thin wire).

Calls the WRITE_ACR macro to write data to the address control register. The data to be written establishes the Ethernet thin coaxial cable as the media.

Calls the WRITE_CMD macro a second time to write data to the command port register. In this call, the data that is written to the command port register is CMD_START2 (the start 10Base2 command bit).

Calls the DELAY macro to wait 800 microseconds.

Determines whether lm_media evaluates to LAN_MEDIA_AUI (media mode is the Attachment Unit Interface).

Calls WRITE_ACR to write to the address control register. The data to be written establishes the Ethernet thick coaxial cable as the media.

8–6Implementing the Initialization Section

Page 106
Image 106
Compaq AA-RNG2A-TE manual Setting the LAN Media