#include #include #include #include #include #include #include #include #include #include #include #include #include #include "8390.h" #define ETHERNAME "ethercard" static struct pci_device_id ethercard_id_table[] __devinitdata = { {0x10ec, 0x8029, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, }; static int ethercard_open(struct net_device *dev) { /*need code*/ return 0; } static int ethercard_stop(struct net_device *dev) { free_irq(dev->irq,dev); return 0; } /* here some functions for packets */ static int __devinit ethercard_probe(struct pci_dev *c_dev, const struct pci_device_id *idp) { int card,irq; struct net_device *dev; unsigned long ioaddr,rflag; card = pci_enable_device(c_dev); if(card) { printk(KERN_CRIT"PCI Driver found\n"); return card; } ioaddr = pci_resource_start(c_dev,0); irq = c_dev->irq; rflag = pci_resource_flags(c_dev,0); if(!ioaddr || ((rflag & IORESOURCE_IO) == 0)) return -1; if((request_region(ioaddr,0x30,ETHERNAME) == NULL)) return -1; dev = alloc_etherdev(0); if(!dev) return -1; c_dev->driver_data = dev; dev->irq = irq; dev->base_addr = ioaddr; dev->open = ðercard_open; dev->stop = ðercard_stop; return 0; } static void __devexit ethercard_remove(struct pci_dev *c_dev) { } static struct pci_driver pci_struct = { name: ETHERNAME, probe: ethercard_probe, remove: __devexit_p(ethercard_remove), id_table: ethercard_id_table, }; static int __init ethercard_init(void) { printk(KERN_CRIT"Loading ether driver\n"); return pci_module_init(&pci_struct); } static void __exit ethercard_exit(void) { printk(KERN_CRIT"Unloading ether driver\n"); return pci_unregister_driver(&pci_struct); } module_init(ethercard_init) module_exit(ethercard_exit)