Compaq AA-RNG2A-TE Network Card User Manual


 
5.1.2 Checking the Maximum Number of Devices That the Driver
Supports
The following code shows how to check for the maximum number of devices
that the if_el device driver supports:
if (unit >= el_MAXDEV) { 1
printf("el%d: el_probe: unit exceeds max supported devices\n",
unit);
return(0);
2
}
1 If the unit variable exceeds the maximum number of devices that
the if_el driver supports, calls the printf( ) routine to display
an appropriate message on the console terminal. The printf( )
routine also displays the controller number that is stored in the unit
variable. The el_probe( ) routine stores the controller number in
this variable by referencing the ctlr_num member of the controller
data structure pointer.
The el_MAXDEV constant defines the maximum number of controllers
that the if_el driver can support.
2 Returns the value 0 (zero) to indicate that the probe operation failed.
5.1.3 Performing Bus-Specific Tasks
The following code shows how the el_probe( ) routine performs tasks that
are specific to the PCMCIA and ISA buses. Only network device drivers
that operate on the PCMCIA and ISA buses perform these tasks. Your
probe interface performs tasks that are related to the bus on which your
network driver operates. See the bus-specific manual for information on
data structures for that bus.
switch (ctlr->bus_hd->bus_type) {
1
case BUS_PCMCIA: 2
reg = io_handle+card_infop->io_addr[0]; 3
multi_func_flag = card_infop->card_option->multi_func_flag; 4
if (!multi_func_flag)
{
if (READ_BUS_D16(reg+W0_MID) != 0x6d50) {
5
WRITE_BUS_D16(reg+CMD_PORT, CMD_RESET);
DELAY(1000);
if (READ_BUS_D16(reg+W0_MID) != 0x6d50) {
6
printf("el%d: EtherLink III not found on bus\n", unit);
return(0);
7
}
}
}
break;
54 Implementing the Autoconfiguration Support Section (probe)