static int nic_detect(int given) { int found; int f; if(given) if((found=nic_probe(given))!=ENOTFOUND) { return found; } for(f=0; default_ports[f]!=0; f++) { if((found=nic_probe(default_ports[f]))!=ENOTFOUND) { return found; } } return ENOTFOUND; }
/* Detects for presence of NE2000 card. Will check given io addr that // is passed to it as well as the default_ports array. Returns ERRNOTFOUND // if no card is found, i/o address otherwise. This does conduct an ISA // probe, so it's not always a good idea to run it. If you already have // the information, then you can just use that with nic_init().*/ int nic_detect(int given) { int found; int f; kprintf("NE2000: detecting card..."); if(given) if((found=nic_probe(given))!=ERRNOTFOUND) { kprintf("found at given:0x%x\n",given); return found; } /* probe for PCI clones here.... or not...*/ for(f=0;default_ports[f]!='\0';f++) { // perform resource manegment here if((found=nic_probe(default_ports[f]))!=ERRNOTFOUND) { kprintf("found at default:0x%x\n",default_ports[f]); return found; } } kprintf("none found.\n"); return ERRNOTFOUND; }