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;
1
sc->regC = reg+0xc;
2
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;
sc->basereg = reg;
3
1
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.
2
This line and the subsequent lines compute and save other
if_el
device
register addresses in the
el_softc
data structure.
3
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) {
1
case BUS_PCMCIA:
2
5–8 Implementing the Autoconfiguration Support Section (probe)