Compaq AA-RNG2A-TE Network Card User Manual


 
6.5 Printing a Success Message
The following code shows how the el_attach( ) routine prints a success
message:
printf("el%d: %s, hardware address: %s\n", unit,
ifp->if_version, ether_sprintf(sc->is_addr));
1
1
Calls the printf( ) routine to display the following information
message on the console terminal:
The controller number that is stored in the unit variable.
The version of the network interface that is stored in the
if_version member of the ifnet data structure pointer.
The hardware address that is accessed through the is_addr
member of the el_softc data structure for this device. The if_el
device driver maps the ac_enaddr member of the arpcom data
structure to the alternate name is_addr.
The argument list that is passed to printf() contains a call to the
ether_sprintf( ) routine. The ether_sprintf( ) routine converts
an Ethernet address to a printable ASCII string representation.
Make sure that your driver prints a similar message during its attach( )
routine.
6.6 Specifying the Network Driver Interfaces
The following code shows how the el_attach( ) routine specifies the
network driver interfaces for the if_el driver:
ifp->if_ioctl = el_ioctl;
1
ifp->if_watchdog = el_watch; 2
ifp->if_start = (int (*)())el_start; 3
mb();
ifp->if_output = ether_output;
4
mb();
ifp->if_flags = IFF_BROADCAST|IFF_MULTICAST|
IFF_NOTRAILERS|IFF_SIMPLEX;
5
ifp->if_timer = 0; 6
ifp->if_sysid_type = 0; 7
ifp->if_version = "3Com EtherLink III"; 8
1 Sets the if_ioctl member of the ifnet data structure for this device
to el_ioctl, which is the if_el device drivers ioctl interface.
2 Sets the if_watchdog member of the ifnet data structure for this
device to el_watch, which is the if_el device drivers watchdog
interface.
66 Implementing the Autoconfiguration Support Section (attach)