Compaq AA-RNG2A-TE manual Computing the CSR Addresses, Setting Bus-Specific Data Structure Members

Models: AA-RNG2A-TE

1 159
Download 159 pages 42.56 Kb
Page 66
Image 66

2

Initializes all Ethernet statistics counters in the ether_driver data structure to 0 (zero).

5.1.6 Initializing the Enhanced Hardware Management Data Structure

The following code shows how the el_probe( ) routine initializes the data structure for enhanced hardware management (EHM) support:

lan_ehm_init(&sc->ehm, NET_EHM_VERSION_ID);

}

1

1

Initializes the net_hw_mgmt data structure. This data structure contains the current and default attribute values for this device as well as other information that EHM requires. The lan_ehm_init( ) routine allocates all necessary storage and performs basic initialization of the EHM data structure. Make sure that your driver makes this call as well.

5.1.7 Computing the CSR Addresses

The following code shows how the el_probe( ) routine determines the addresses of the if_el device’s control and status (CSR) registers:

sc->regE = reg+0xe; sc->regC = reg+0xc; sc->regA = reg+0xa; sc->reg8 = reg+0x8; sc->reg6 = reg+0x6; sc->reg4 = reg+0x4; sc->reg2 = reg+0x2; sc->reg0 = reg+0x0; sc->data = reg+0x0;

1

2

sc->basereg = reg;

3

1

2

3

Fills in the regE member of the el_softc data structure for this 3Com 3C5x9 device. The value that is stored in regE consists of the I/O handle plus a byte offset. The el_probe( ) routine computes this address according to the requirements of the PCMCIA bus and the ISA bus.

This line and the subsequent lines compute and save other if_el device register addresses in the el_softc data structure.

Stores the I/O handle in the basereg member of the el_softc data structure for this 3Com 3C5x9 device.

5.1.8 Setting Bus-Specific Data Structure Members

The following code shows how the el_probe( ) routine sets members for the bus-specific data structures that are associated with the PCMCIA and ISA buses. See the bus-specific manual for information on data structures for the bus on which your driver operates.

switch (ctlr->bus_hd->bus_type) {

case BUS_PCMCIA: 2

1

5–8Implementing the Autoconfiguration Support Section (probe)

Page 66
Image 66
Compaq AA-RNG2A-TE manual Computing the CSR Addresses, Setting Bus-Specific Data Structure Members