⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 de4x5.h

📁 linux-2.6.15.6
💻 H
📖 第 1 页 / 共 4 页
字号:
#define RD_RBS1    0x000007ff       /* Buffer 1 Size *//*** Transmit Descriptor Bit Summary*/#define T_OWN      0x80000000       /* Own Bit */#define TD_ES      0x00008000       /* Error Summary */#define TD_TO      0x00004000       /* Transmit Jabber Time-Out */#define TD_LO      0x00000800       /* Loss Of Carrier */#define TD_NC      0x00000400       /* No Carrier */#define TD_LC      0x00000200       /* Late Collision */#define TD_EC      0x00000100       /* Excessive Collisions */#define TD_HF      0x00000080       /* Heartbeat Fail */#define TD_CC      0x00000078       /* Collision Counter */#define TD_LF      0x00000004       /* Link Fail */#define TD_UF      0x00000002       /* Underflow Error */#define TD_DE      0x00000001       /* Deferred */#define TD_IC      0x80000000       /* Interrupt On Completion */#define TD_LS      0x40000000       /* Last Segment */#define TD_FS      0x20000000       /* First Segment */#define TD_FT1     0x10000000       /* Filtering Type */#define TD_SET     0x08000000       /* Setup Packet */#define TD_AC      0x04000000       /* Add CRC Disable */#define TD_TER     0x02000000       /* Transmit End Of Ring */#define TD_TCH     0x01000000       /* Second Address Chained */#define TD_DPD     0x00800000       /* Disabled Padding */#define TD_FT0     0x00400000       /* Filtering Type */#define TD_TBS2    0x003ff800       /* Buffer 2 Size */#define TD_TBS1    0x000007ff       /* Buffer 1 Size */#define PERFECT_F  0x00000000#define HASH_F     TD_FT0#define INVERSE_F  TD_FT1#define HASH_O_F   (TD_FT1 | TD_F0)/*** Media / mode state machine definitions** User selectable:*/#define TP              0x0040     /* 10Base-T (now equiv to _10Mb)        */#define TP_NW           0x0002     /* 10Base-T with Nway                   */#define BNC             0x0004     /* Thinwire                             */#define AUI             0x0008     /* Thickwire                            */#define BNC_AUI         0x0010     /* BNC/AUI on DC21040 indistinguishable */#define _10Mb           0x0040     /* 10Mb/s Ethernet                      */#define _100Mb          0x0080     /* 100Mb/s Ethernet                     */#define AUTO            0x4000     /* Auto sense the media or speed        *//*** Internal states*/#define NC              0x0000     /* No Connection                        */#define ANS             0x0020     /* Intermediate AutoNegotiation State   */#define SPD_DET         0x0100     /* Parallel speed detection             */#define INIT            0x0200     /* Initial state                        */#define EXT_SIA         0x0400     /* External SIA for motherboard chip    */#define ANS_SUSPECT     0x0802     /* Suspect the ANS (TP) port is down    */#define TP_SUSPECT      0x0803     /* Suspect the TP port is down          */#define BNC_AUI_SUSPECT 0x0804     /* Suspect the BNC or AUI port is down  */#define EXT_SIA_SUSPECT 0x0805     /* Suspect the EXT SIA port is down     */#define BNC_SUSPECT     0x0806     /* Suspect the BNC port is down         */#define AUI_SUSPECT     0x0807     /* Suspect the AUI port is down         */#define MII             0x1000     /* MII on the 21143                     */#define TIMER_CB        0x80000000 /* Timer callback detection             *//*** DE4X5 DEBUG Options*/#define DEBUG_NONE      0x0000     /* No DEBUG messages */#define DEBUG_VERSION   0x0001     /* Print version message */#define DEBUG_MEDIA     0x0002     /* Print media messages */#define DEBUG_TX        0x0004     /* Print TX (queue_pkt) messages */#define DEBUG_RX        0x0008     /* Print RX (de4x5_rx) messages */#define DEBUG_SROM      0x0010     /* Print SROM messages */#define DEBUG_MII       0x0020     /* Print MII messages */#define DEBUG_OPEN      0x0040     /* Print de4x5_open() messages */#define DEBUG_CLOSE     0x0080     /* Print de4x5_close() messages */#define DEBUG_PCICFG    0x0100#define DEBUG_ALL       0x01ff/*** Miscellaneous*/#define PCI  0#define EISA 1#define HASH_TABLE_LEN   512       /* Bits */#define HASH_BITS        0x01ff    /* 9 LS bits */#define SETUP_FRAME_LEN  192       /* Bytes */#define IMPERF_PA_OFFSET 156       /* Bytes */#define POLL_DEMAND          1#define LOST_MEDIA_THRESHOLD 3#define MASK_INTERRUPTS      1#define UNMASK_INTERRUPTS    0#define DE4X5_STRLEN         8#define DE4X5_INIT           0     /* Initialisation time */#define DE4X5_RUN            1     /* Run time */#define DE4X5_SAVE_STATE     0#define DE4X5_RESTORE_STATE  1/*** Address Filtering Modes*/#define PERFECT              0     /* 16 perfect physical addresses */#define HASH_PERF            1     /* 1 perfect, 512 multicast addresses */#define PERFECT_REJ          2     /* Reject 16 perfect physical addresses */#define ALL_HASH             3     /* Hashes all physical & multicast addrs */#define ALL                  0     /* Clear out all the setup frame */#define PHYS_ADDR_ONLY       1     /* Update the physical address only *//*** Booleans*/#define NO                   0#define FALSE                0#define YES                  ~0#define TRUE                 ~0/*** Adapter state*/#define INITIALISED          0     /* After h/w initialised and mem alloc'd */#define CLOSED               1     /* Ready for opening */#define OPEN                 2     /* Running *//*** Various wait times*/#define PDET_LINK_WAIT    1200    /* msecs to wait for link detect bits     */#define ANS_FINISH_WAIT   1000    /* msecs to wait for link detect bits     *//*** IEEE OUIs for various PHY vendor/chip combos - Reg 2 values only. Since** the vendors seem split 50-50 on how to calculate the OUI register values** anyway, just reading Reg2 seems reasonable for now [see de4x5_get_oui()].*/#define NATIONAL_TX 0x2000#define BROADCOM_T4 0x03e0#define SEEQ_T4     0x0016#define CYPRESS_T4  0x0014/*** Speed Selection stuff*/#define SET_10Mb {\  if ((lp->phy[lp->active].id) && (!lp->useSROM || lp->useMII)) {\    omr = inl(DE4X5_OMR) & ~(OMR_TTM | OMR_PCS | OMR_SCR | OMR_FDX);\    if ((lp->tmp != MII_SR_ASSC) || (lp->autosense != AUTO)) {\      mii_wr(MII_CR_10|(lp->fdx?MII_CR_FDM:0), MII_CR, lp->phy[lp->active].addr, DE4X5_MII);\    }\    omr |= ((lp->fdx ? OMR_FDX : 0) | OMR_TTM);\    outl(omr, DE4X5_OMR);\    if (!lp->useSROM) lp->cache.gep = 0;\  } else if (lp->useSROM && !lp->useMII) {\    omr = (inl(DE4X5_OMR) & ~(OMR_PS | OMR_HBD | OMR_TTM | OMR_PCS | OMR_SCR | OMR_FDX));\    omr |= (lp->fdx ? OMR_FDX : 0);\    outl(omr | (lp->infoblock_csr6 & ~(OMR_SCR | OMR_HBD)), DE4X5_OMR);\  } else {\    omr = (inl(DE4X5_OMR) & ~(OMR_PS | OMR_HBD | OMR_TTM | OMR_PCS | OMR_SCR | OMR_FDX));\    omr |= (lp->fdx ? OMR_FDX : 0);\    outl(omr | OMR_SDP | OMR_TTM, DE4X5_OMR);\    lp->cache.gep = (lp->fdx ? 0 : GEP_FDXD);\    gep_wr(lp->cache.gep, dev);\  }\}#define SET_100Mb {\  if ((lp->phy[lp->active].id) && (!lp->useSROM || lp->useMII)) {\    int fdx=0;\    if (lp->phy[lp->active].id == NATIONAL_TX) {\        mii_wr(mii_rd(0x18, lp->phy[lp->active].addr, DE4X5_MII) & ~0x2000,\                      0x18, lp->phy[lp->active].addr, DE4X5_MII);\    }\    omr = inl(DE4X5_OMR) & ~(OMR_TTM | OMR_PCS | OMR_SCR | OMR_FDX);\    sr = mii_rd(MII_SR, lp->phy[lp->active].addr, DE4X5_MII);\    if (!(sr & MII_ANA_T4AM) && lp->fdx) fdx=1;\    if ((lp->tmp != MII_SR_ASSC) || (lp->autosense != AUTO)) {\      mii_wr(MII_CR_100|(fdx?MII_CR_FDM:0), MII_CR, lp->phy[lp->active].addr, DE4X5_MII);\    }\    if (fdx) omr |= OMR_FDX;\    outl(omr, DE4X5_OMR);\    if (!lp->useSROM) lp->cache.gep = 0;\  } else if (lp->useSROM && !lp->useMII) {\    omr = (inl(DE4X5_OMR) & ~(OMR_PS | OMR_HBD | OMR_TTM | OMR_PCS | OMR_SCR | OMR_FDX));\    omr |= (lp->fdx ? OMR_FDX : 0);\    outl(omr | lp->infoblock_csr6, DE4X5_OMR);\  } else {\    omr = (inl(DE4X5_OMR) & ~(OMR_PS | OMR_HBD | OMR_TTM | OMR_PCS | OMR_SCR | OMR_FDX));\    omr |= (lp->fdx ? OMR_FDX : 0);\    outl(omr | OMR_SDP | OMR_PS | OMR_HBD | OMR_PCS | OMR_SCR, DE4X5_OMR);\    lp->cache.gep = (lp->fdx ? 0 : GEP_FDXD) | GEP_MODE;\    gep_wr(lp->cache.gep, dev);\  }\}/* FIX ME so I don't jam 10Mb networks */#define SET_100Mb_PDET {\  if ((lp->phy[lp->active].id) && (!lp->useSROM || lp->useMII)) {\    mii_wr(MII_CR_100|MII_CR_ASSE, MII_CR, lp->phy[lp->active].addr, DE4X5_MII);\    omr = (inl(DE4X5_OMR) & ~(OMR_TTM | OMR_PCS | OMR_SCR | OMR_FDX));\    outl(omr, DE4X5_OMR);\  } else if (lp->useSROM && !lp->useMII) {\    omr = (inl(DE4X5_OMR) & ~(OMR_TTM | OMR_PCS | OMR_SCR | OMR_FDX));\    outl(omr, DE4X5_OMR);\  } else {\    omr = (inl(DE4X5_OMR) & ~(OMR_PS | OMR_HBD | OMR_TTM | OMR_PCS | OMR_SCR | OMR_FDX));\    outl(omr | OMR_SDP | OMR_PS | OMR_HBD | OMR_PCS, DE4X5_OMR);\    lp->cache.gep = (GEP_FDXD | GEP_MODE);\    gep_wr(lp->cache.gep, dev);\  }\}/*** Include the IOCTL stuff*/#include <linux/sockios.h>#define	DE4X5IOCTL	SIOCDEVPRIVATEstruct de4x5_ioctl {	unsigned short cmd;                /* Command to run */	unsigned short len;                /* Length of the data buffer */	unsigned char  __user *data;       /* Pointer to the data buffer */};/* ** Recognised commands for the driver */#define DE4X5_GET_HWADDR	0x01 /* Get the hardware address */#define DE4X5_SET_HWADDR	0x02 /* Set the hardware address */#define DE4X5_SET_PROM  	0x03 /* Set Promiscuous Mode */#define DE4X5_CLR_PROM  	0x04 /* Clear Promiscuous Mode */#define DE4X5_SAY_BOO	        0x05 /* Say "Boo!" to the kernel log file */#define DE4X5_GET_MCA   	0x06 /* Get a multicast address */#define DE4X5_SET_MCA   	0x07 /* Set a multicast address */#define DE4X5_CLR_MCA    	0x08 /* Clear a multicast address */#define DE4X5_MCA_EN    	0x09 /* Enable a multicast address group */#define DE4X5_GET_STATS  	0x0a /* Get the driver statistics */#define DE4X5_CLR_STATS 	0x0b /* Zero out the driver statistics */#define DE4X5_GET_OMR           0x0c /* Get the OMR Register contents */#define DE4X5_SET_OMR           0x0d /* Set the OMR Register contents */#define DE4X5_GET_REG           0x0e /* Get the DE4X5 Registers */#define MOTO_SROM_BUG    ((lp->active == 8) && (((le32_to_cpu(get_unaligned(((s32 *)dev->dev_addr))))&0x00ffffff)==0x3e0008))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -