/* * Initialize the e1000 driver and device. */ static int e1000_init(unsigned int instance, ether_addr_t * addr) { e1000_t *e; int r; e1000_instance = instance; /* Clear state. */ memset(&e1000_state, 0, sizeof(e1000_state)); e = &e1000_state; strlcpy(e->name, "e1000#0", sizeof(e->name)); e->name[6] += instance; /* Perform calibration. */ if ((r = tsc_calibrate()) != OK) panic("tsc_calibrate failed: %d", r); /* See if we can find a matching device. */ if (!e1000_probe(e, instance)) return ENXIO; /* Initialize the hardware, and return its ethernet address. */ e1000_init_hw(e, addr); return OK; }
int pci_register_e1000() { memset(&pcif_handler,0,sizeof(struct pci_func)); e1000_pcif_get(&pcif_handler);//get e1000_dev_init(&pcif_handler);//init register_transmit_func(&transmit_packet); e1000_probe(&e1000_dev, &ent);//set relation between pci and e1000(set as an netdevice in it) netdev = e1000_dev.dev.p; kprintf("netdev %x\n", netdev); //tmp test, should call by ifconfig in future open_e1000(); if (flag) { void init_lwip_dev(); init_lwip_dev(); flag = 0; } return 0; }