From Matthias Drochner:
use constants from etherdrv.h make selection table driven
This commit is contained in:
parent
3824935377
commit
6a00e9acc8
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: 3c509.c,v 1.1.1.1 1997/03/14 02:40:33 perry Exp $ */
|
/* $NetBSD: 3c509.c,v 1.2 1997/03/15 22:18:21 perry Exp $ */
|
||||||
|
|
||||||
/* stripped down from freebsd:sys/i386/netboot/3c509.c */
|
/* stripped down from freebsd:sys/i386/netboot/3c509.c */
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ Author: Martin Renters.
|
|||||||
|
|
||||||
char etherdev[20];
|
char etherdev[20];
|
||||||
|
|
||||||
char bnc=0, utp=0; /* for 3C509 */
|
int ether_medium;
|
||||||
unsigned short eth_base;
|
unsigned short eth_base;
|
||||||
|
|
||||||
extern void epreset __P((void));
|
extern void epreset __P((void));
|
||||||
@ -49,6 +49,16 @@ static int get_eeprom_data __P((int, int));
|
|||||||
|
|
||||||
u_char eth_myaddr[6];
|
u_char eth_myaddr[6];
|
||||||
|
|
||||||
|
static struct mtabentry {
|
||||||
|
int address_cfg; /* configured connector */
|
||||||
|
int config_bit; /* connector present */
|
||||||
|
char *name;
|
||||||
|
} mediatab[] = { /* indexed by media type - etherdrv.h */
|
||||||
|
{3, IS_BNC, "BNC"},
|
||||||
|
{0, IS_UTP, "UTP"},
|
||||||
|
{1, IS_AUI, "AUI"},
|
||||||
|
};
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
ETH_PROBE - Look for an adapter
|
ETH_PROBE - Look for an adapter
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -62,6 +72,7 @@ char *myadr;
|
|||||||
u_short k;
|
u_short k;
|
||||||
/* int ep_current_tag = EP_LAST_TAG + 1; */
|
/* int ep_current_tag = EP_LAST_TAG + 1; */
|
||||||
short *p;
|
short *p;
|
||||||
|
struct mtabentry *m;
|
||||||
|
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
Search for 3Com 509 card
|
Search for 3Com 509 card
|
||||||
@ -116,44 +127,22 @@ char *myadr;
|
|||||||
i = inw(IS_BASE + EP_W0_CONFIG_CTRL);
|
i = inw(IS_BASE + EP_W0_CONFIG_CTRL);
|
||||||
j = inw(IS_BASE + EP_W0_ADDRESS_CFG) >> 14;
|
j = inw(IS_BASE + EP_W0_ADDRESS_CFG) >> 14;
|
||||||
|
|
||||||
switch(j) {
|
for(ether_medium = 0, m = mediatab;
|
||||||
case 0:
|
ether_medium < sizeof(mediatab) / sizeof(mediatab[0]);
|
||||||
if(i & IS_UTP) {
|
ether_medium++, m++) {
|
||||||
printf("10baseT\r\n");
|
if(j == m->address_cfg) {
|
||||||
utp=1;
|
if(!(i & m->config_bit)) {
|
||||||
}
|
printf("%s not present\n", m->name);
|
||||||
else {
|
return(0);
|
||||||
printf("10baseT not present\r\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
/*
|
|
||||||
case 1:
|
|
||||||
if(i & IS_AUI)
|
|
||||||
printf("10base5\r\n");
|
|
||||||
else {
|
|
||||||
printf("10base5 not present\r\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
case 3:
|
|
||||||
if(i & IS_BNC) {
|
|
||||||
printf("10base2\r\n");
|
|
||||||
bnc=1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("10base2 not present\r\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("unknown connector\r\n");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
printf("using %s\n", m->name);
|
||||||
|
goto ok;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("unknown connector\n");
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
ok:
|
||||||
/*
|
/*
|
||||||
* Read the station address from the eeprom
|
* Read the station address from the eeprom
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user