您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > 厂家提供的DM9000网卡代码
/*dm9ks.c:Version2.082007/02/12ADavicomDM9000/DM9010ISANICfastEthernetdriverforLinux.Thisprogramisfreesoftware;youcanredistributeitand/ormodifyitunderthetermsoftheGNUGeneralPublicLicenseaspublishedbytheFreeSoftwareFoundation;eitherversion2oftheLicense,or(atyouroption)anylaterversion.Thisprogramisdistributedinthehopethatitwillbeuseful,butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyofMERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNUGeneralPublicLicenseformoredetails.(C)Copyright1997-2007DAVICOMSemiconductor,Inc.AllRightsReserved.V2.00Spenser-01/10/2005-ModificationforPXA270MAINSTONE.-Modifieddmfe_tx_done().-Adddmfe_timeout().V2.0110/07/2005-Modifieddmfe_timer()-Dectednetworkspeed10/100MV2.0210/12/2005-Uselinkchangetochagedb-Speed-dmfe_open()waitforLinkOKV2.0311/22/2005-Power-offandPower-onPHYindmfe_init_dm9000()-supportIOLV2.0412/13/2005-delay1.6sbetweenpower-onandpower-offindmfe_init_dm9000()-setLEDmode1indmfe_init_dm9000()-adddatabusdrivingcapabilityindmfe_init_dm9000()(optional)10/3/2006-AddDM8606read/writefunctionbyMDCandMDIOV2.0601/03/2007-CONT_RX_PKT_CNT=0xFFFF-modifydmfe_tx_donefunction-checkRXFIFOpointer-ifusingphysicaladdress,re-defineI/Ofunction-adddb-cont_rx_pkt_cnt=0atthefrontofdmfe_packet_receive()V2.0802/12/2007-moduleparametermacro2.4MODULE_PARM2.6module_param-remove#includelinux/config-fixdmfe_interruptforkernel2.6.20V2.0905/24/2007-supportethtoolandmii-tool05/30/2007-fixthedriverbugwhenifconfigeth0(-)promiscand(-)allmulti.06/05/2007-fixdm9000bissue(ex.10MTXidle=65mA,10Mharmonic)-addflowcontrolfunction(option)10/01/2007-Add#includeasm/uaccess.h-Modyfydmfe_do_ioctlforkernel2.6.711/23/2007-AddTDBUGtocheckTXFIFOpointershift-Removecheck_rx_ready()-Add#defineCHECKSUMtomodifyCHECKSUMfunction12/20/2007-ModifyTXtimeoutroutine(+)checkTCR&0x01*///#defineCHECKSUM//#defineTDBUG/*checkTXFIFOpointer*///#defineRDBUG/*checkRXFIFOpointer*///#defineDM8606#defineDRV_NAMEdm9KS#defineDRV_VERSION2.09#defineDRV_RELDATE2007-11-22#ifdefMODVERSIONS#includelinux/modversions.h#endif//#includelinux/config.h#includelinux/init.h#includelinux/delay.h#includelinux/module.h#includelinux/ioport.h#includelinux/netdevice.h#includelinux/etherdevice.h#includelinux/skbuff.h#includelinux/version.h#includeasm/dma.h#includelinux/spinlock.h#includelinux/crc32.h#includelinux/mii.h#includelinux/ethtool.h#includeasm/uaccess.h#ifdefCONFIG_ARCH_MAINSTONE#includeasm/io.h#includeasm/hardware.h#includeasm/irq.h#endif/*Board/System/Debuginformation/definition----------------*/#defineDM9KS_ID0x90000A46#defineDM9010_ID0x90100A46/*-------registername-----------------------*/#defineDM9KS_NCR0x00/*NetworkcontrolReg.*/#defineDM9KS_NSR0x01/*NetworkStatusReg.*/#defineDM9KS_TCR0x02/*TXcontrolReg.*/#defineDM9KS_RXCR0x05/*RXcontrolReg.*/#defineDM9KS_BPTR0x08#defineDM9KS_FCTR0x09#defineDM9KS_FCR0x0a#defineDM9KS_EPCR0x0b#defineDM9KS_EPAR0x0c#defineDM9KS_EPDRL0x0d#defineDM9KS_EPDRH0x0e#defineDM9KS_GPR0x1f/*Generalpurposeregister*/#defineDM9KS_CHIPR0x2c#defineDM9KS_TCR20x2d#defineDM9KS_SMCR0x2f/*SpecialModeControlReg.*/#defineDM9KS_ETXCSR0x30/*EarlyTransmitcontrol/statusReg.*/#defineDM9KS_TCCR0x31/*ChecksumcntrolReg.*/#defineDM9KS_RCSR0x32/*ReceiveChecksumstatusReg.*/#defineDM9KS_BUSCR0x38#defineDM9KS_MRCMDX0xf0#defineDM9KS_MRCMD0xf2#defineDM9KS_MDRAL0xf4#defineDM9KS_MDRAH0xf5#defineDM9KS_MWCMD0xf8#defineDM9KS_MDWAL0xfa#defineDM9KS_MDWAH0xfb#defineDM9KS_TXPLL0xfc#defineDM9KS_TXPLH0xfd#defineDM9KS_ISR0xfe#defineDM9KS_IMR0xff/*---------------------------------------------*/#defineDM9KS_REG050x30/*SKIP_CRC/SKIP_LONG*/#defineDM9KS_REGFF0xA3/*IMR*/#defineDM9KS_DISINTR0x80#defineDM9KS_PHY0x40/*PHYaddress0x01*/#defineDM9KS_PKT_RDY0x01/*Packetreadytoreceive*//*AddedforPXAofMAINSTONE*/#ifdefCONFIG_ARCH_MAINSTONE#includeasm/arch/mainstone.h#defineDM9KS_MIN_IO(MST_ETH_PHYS+0x300)#defineDM9KS_MAX_IO(MST_ETH_PHYS+0x370)#defineDM9K_IRQMAINSTONE_IRQ(3)#else#defineDM9KS_MIN_IO0x300#defineDM9KS_MAX_IO0x370#defineDM9KS_IRQ3#endif#defineDM9KS_VID_L0x28#defineDM9KS_VID_H0x29#defineDM9KS_PID_L0x2A#defineDM9KS_PID_H0x2B#defineDM9KS_RX_INTR0x01#defineDM9KS_TX_INTR0x02#defineDM9KS_LINK_INTR0x20#defineDM9KS_DWORD_MODE1#defineDM9KS_BYTE_MODE2#defineDM9KS_WORD_MODE0#defineTRUE1#defineFALSE0/*NumberofcontinuousRxpackets*/#defineCONT_RX_PKT_CNT0xFFFF#defineDMFE_TIMER_WUTjiffies+(HZ*5)/*timerwakeuptime:5second*/#ifdefDM9KS_DEBUG#defineDMFE_DBUG(dbug_now,msg,vaule)\if(dmfe_debug||dbug_now)printk(KERN_ERRdmfe:%s%x\n,msg,vaule)#else#defineDMFE_DBUG(dbug_now,msg,vaule)\if(dbug_now)printk(KERN_ERRdmfe:%s%x\n,msg,vaule)#endif#ifndefCONFIG_ARCH_MAINSTONE#pragmapack(push,1)#endiftypedefstruct_RX_DESC{u8rxbyte;u8status;u16length;}RX_DESC;typedefunion{u8buf[4];RX_DESCdesc;}rx_t;#ifndefCONFIG_ARCH_MAINSTONE#pragmapack(pop)#endifenumDM9KS_PHY_mode{DM9KS_10MHD=0,DM9KS_100MHD=1,DM9KS_10MFD=4,DM9KS_100MFD=5,DM9KS_AUTO=8,};/*Structure/enumdeclaration-------------------------------*/typedefstructboard_info{u32io_addr;/*RegisterI/Obaseaddress*/u32io_da
本文标题:厂家提供的DM9000网卡代码
链接地址:https://www.777doc.com/doc-442898 .html