member in the driver’s probe interface to the media state constant that identifies the state for the media.

You can set the lan_media member to the same constants that are listed for the lan_media_mode member in item 2.

3.4 Defining the Base Register

The base register in a network driver’s softc data structure is a member that represents the base register of the device. The following code shows the declaration of the base register in the if_el device driver’s el_softc data structure. Most network device drivers declare a variable to store the device’s base register.

vm_offset_t basereg;

1

1

Declares a base register member and calls it basereg.

3.5 Defining Multicast Table Information

All multicast address information in a network driver’s softc data structure is encapsulated in the lan_multi data structure. The following code shows the declaration of the lan_multi data structure in the if_el device driver’s el_softc data structure. Most network device drivers declare this data structure in their softc data structure.

struct lan_multi is_multi;

1

1

Declares a lan_multi data structure and calls it is_multi.

3.6 Defining the Interrupt Handler ID

The interrupt handler ID in a network driver’s softc data structure is a variable that stores the interrupt handler ID that the handler_add( ) routine returns. The following code shows the declaration of the interrupt handler ID in the if_el device driver’s el_softc data structure. Make sure that the interrupt handler ID part of your softc data structure has a similar declaration.

ihandler_id_t *hid;

1

1

Declares a pointer to an ID that deregisters the interrupt handlers.

3.7 Defining CSR Pointer Information

The control and status register (CSR) addresses in a network driver’s softc data structure consist of specific adapter register addresses. These registers generally consist of the base register plus some offset, as defined by the network adapter’s hardware specification. Make sure that you never

3–6Defining the softc Data Structure

Page 50
Image 50
Compaq AA-RNG2A-TE Defining the Base Register, Defining Multicast Table Information, Defining the Interrupt Handler ID