📄 tsec.h
字号:
#define RXBD_RO1 0x4000#define RXBD_WRAP 0x2000#define RXBD_INTERRUPT 0x1000#define RXBD_LAST 0x0800#define RXBD_FIRST 0x0400#define RXBD_MISS 0x0100#define RXBD_BROADCAST 0x0080#define RXBD_MULTICAST 0x0040#define RXBD_LARGE 0x0020#define RXBD_NONOCTET 0x0010#define RXBD_SHORT 0x0008#define RXBD_CRCERR 0x0004#define RXBD_OVERRUN 0x0002#define RXBD_TRUNCATED 0x0001#define RXBD_STATS 0x003ftypedef struct txbd8{ ushort status; /* Status Fields */ ushort length; /* Buffer length */ uint bufPtr; /* Buffer Pointer */} txbd8_t;typedef struct rxbd8{ ushort status; /* Status Fields */ ushort length; /* Buffer Length */ uint bufPtr; /* Buffer Pointer */} rxbd8_t;typedef struct rmon_mib{ /* Transmit and Receive Counters */ uint tr64; /* Transmit and Receive 64-byte Frame Counter */ uint tr127; /* Transmit and Receive 65-127 byte Frame Counter */ uint tr255; /* Transmit and Receive 128-255 byte Frame Counter */ uint tr511; /* Transmit and Receive 256-511 byte Frame Counter */ uint tr1k; /* Transmit and Receive 512-1023 byte Frame Counter */ uint trmax; /* Transmit and Receive 1024-1518 byte Frame Counter */ uint trmgv; /* Transmit and Receive 1519-1522 byte Good VLAN Frame */ /* Receive Counters */ uint rbyt; /* Receive Byte Counter */ uint rpkt; /* Receive Packet Counter */ uint rfcs; /* Receive FCS Error Counter */ uint rmca; /* Receive Multicast Packet (Counter) */ uint rbca; /* Receive Broadcast Packet */ uint rxcf; /* Receive Control Frame Packet */ uint rxpf; /* Receive Pause Frame Packet */ uint rxuo; /* Receive Unknown OP Code */ uint raln; /* Receive Alignment Error */ uint rflr; /* Receive Frame Length Error */ uint rcde; /* Receive Code Error */ uint rcse; /* Receive Carrier Sense Error */ uint rund; /* Receive Undersize Packet */ uint rovr; /* Receive Oversize Packet */ uint rfrg; /* Receive Fragments */ uint rjbr; /* Receive Jabber */ uint rdrp; /* Receive Drop */ /* Transmit Counters */ uint tbyt; /* Transmit Byte Counter */ uint tpkt; /* Transmit Packet */ uint tmca; /* Transmit Multicast Packet */ uint tbca; /* Transmit Broadcast Packet */ uint txpf; /* Transmit Pause Control Frame */ uint tdfr; /* Transmit Deferral Packet */ uint tedf; /* Transmit Excessive Deferral Packet */ uint tscl; /* Transmit Single Collision Packet */ /* (0x2_n700) */ uint tmcl; /* Transmit Multiple Collision Packet */ uint tlcl; /* Transmit Late Collision Packet */ uint txcl; /* Transmit Excessive Collision Packet */ uint tncl; /* Transmit Total Collision */ uint res2; uint tdrp; /* Transmit Drop Frame */ uint tjbr; /* Transmit Jabber Frame */ uint tfcs; /* Transmit FCS Error */ uint txcf; /* Transmit Control Frame */ uint tovr; /* Transmit Oversize Frame */ uint tund; /* Transmit Undersize Frame */ uint tfrg; /* Transmit Fragments Frame */ /* General Registers */ uint car1; /* Carry Register One */ uint car2; /* Carry Register Two */ uint cam1; /* Carry Register One Mask */ uint cam2; /* Carry Register Two Mask */} rmon_mib_t;typedef struct tsec_hash_regs{ uint iaddr0; /* Individual Address Register 0 */ uint iaddr1; /* Individual Address Register 1 */ uint iaddr2; /* Individual Address Register 2 */ uint iaddr3; /* Individual Address Register 3 */ uint iaddr4; /* Individual Address Register 4 */ uint iaddr5; /* Individual Address Register 5 */ uint iaddr6; /* Individual Address Register 6 */ uint iaddr7; /* Individual Address Register 7 */ uint res1[24]; uint gaddr0; /* Group Address Register 0 */ uint gaddr1; /* Group Address Register 1 */ uint gaddr2; /* Group Address Register 2 */ uint gaddr3; /* Group Address Register 3 */ uint gaddr4; /* Group Address Register 4 */ uint gaddr5; /* Group Address Register 5 */ uint gaddr6; /* Group Address Register 6 */ uint gaddr7; /* Group Address Register 7 */ uint res2[24];} tsec_hash_t;typedef struct tsec{ /* General Control and Status Registers (0x2_n000) */ uint res000[4]; uint ievent; /* Interrupt Event */ uint imask; /* Interrupt Mask */ uint edis; /* Error Disabled */ uint res01c; uint ecntrl; /* Ethernet Control */ uint minflr; /* Minimum Frame Length */ uint ptv; /* Pause Time Value */ uint dmactrl; /* DMA Control */ uint tbipa; /* TBI PHY Address */ uint res034[3]; uint res040[48]; /* Transmit Control and Status Registers (0x2_n100) */ uint tctrl; /* Transmit Control */ uint tstat; /* Transmit Status */ uint res108; uint tbdlen; /* Tx BD Data Length */ uint res110[5]; uint ctbptr; /* Current TxBD Pointer */ uint res128[23]; uint tbptr; /* TxBD Pointer */ uint res188[30]; /* (0x2_n200) */ uint res200; uint tbase; /* TxBD Base Address */ uint res208[42]; uint ostbd; /* Out of Sequence TxBD */ uint ostbdp; /* Out of Sequence Tx Data Buffer Pointer */ uint res2b8[18]; /* Receive Control and Status Registers (0x2_n300) */ uint rctrl; /* Receive Control */ uint rstat; /* Receive Status */ uint res308; uint rbdlen; /* RxBD Data Length */ uint res310[4]; uint res320; uint crbptr; /* Current Receive Buffer Pointer */ uint res328[6]; uint mrblr; /* Maximum Receive Buffer Length */ uint res344[16]; uint rbptr; /* RxBD Pointer */ uint res388[30]; /* (0x2_n400) */ uint res400; uint rbase; /* RxBD Base Address */ uint res408[62]; /* MAC Registers (0x2_n500) */ uint maccfg1; /* MAC Configuration #1 */ uint maccfg2; /* MAC Configuration #2 */ uint ipgifg; /* Inter Packet Gap/Inter Frame Gap */ uint hafdup; /* Half-duplex */ uint maxfrm; /* Maximum Frame */ uint res514; uint res518; uint res51c; uint miimcfg; /* MII Management: Configuration */ uint miimcom; /* MII Management: Command */ uint miimadd; /* MII Management: Address */ uint miimcon; /* MII Management: Control */ uint miimstat; /* MII Management: Status */ uint miimind; /* MII Management: Indicators */ uint res538; uint ifstat; /* Interface Status */ uint macstnaddr1; /* Station Address, part 1 */ uint macstnaddr2; /* Station Address, part 2 */ uint res548[46]; /* (0x2_n600) */ uint res600[32]; /* RMON MIB Registers (0x2_n680-0x2_n73c) */ rmon_mib_t rmon; uint res740[48]; /* Hash Function Registers (0x2_n800) */ tsec_hash_t hash; uint res900[128]; /* Pattern Registers (0x2_nb00) */ uint resb00[62]; uint attr; /* Default Attribute Register */ uint attreli; /* Default Attribute Extract Length and Index */ /* TSEC Future Expansion Space (0x2_nc00-0x2_nffc) */ uint resc00[256];} tsec_t;#define TSEC_GIGABIT (1)/* This flag currently only has * meaning if we're using the eTSEC */#define TSEC_REDUCED (1 << 1)struct tsec_private { volatile tsec_t *regs; volatile tsec_t *phyregs; struct phy_info *phyinfo; uint phyaddr; u32 flags; uint link; uint duplexity; uint speed;};/* * struct phy_cmd: A command for reading or writing a PHY register * * mii_reg: The register to read or write * * mii_data: For writes, the value to put in the register. * A value of -1 indicates this is a read. * * funct: A function pointer which is invoked for each command. * For reads, this function will be passed the value read * from the PHY, and process it. * For writes, the result of this function will be written * to the PHY register */struct phy_cmd { uint mii_reg; uint mii_data; uint (*funct) (uint mii_reg, struct tsec_private* priv);};/* struct phy_info: a structure which defines attributes for a PHY * * id will contain a number which represents the PHY. During * startup, the driver will poll the PHY to find out what its * UID--as defined by registers 2 and 3--is. The 32-bit result * gotten from the PHY will be shifted right by "shift" bits to * discard any bits which may change based on revision numbers * unimportant to functionality * * The struct phy_cmd entries represent pointers to an arrays of * commands which tell the driver what to do to the PHY. */struct phy_info { uint id; char *name; uint shift; /* Called to configure the PHY, and modify the controller * based on the results */ struct phy_cmd *config; /* Called when starting up the controller */ struct phy_cmd *startup; /* Called when bringing down the controller */ struct phy_cmd *shutdown;};#endif /* __TSEC_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -