Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __EMAC_H
00010 #define __EMAC_H
00011
00012 #include "../eth/eth.h"
00013
00014
00015 #define emacETHADDR0 uipMAC_ADDR0
00016 #define emacETHADDR1 uipMAC_ADDR1
00017 #define emacETHADDR2 uipMAC_ADDR2
00018 #define emacETHADDR3 uipMAC_ADDR3
00019 #define emacETHADDR4 uipMAC_ADDR4
00020 #define emacETHADDR5 uipMAC_ADDR5
00021
00022
00023
00024 #define NUM_RX_FRAG 4
00025 #define NUM_TX_FRAG 2
00026 #define ETH_FRAG_SIZE 1536
00027
00028 #define ETH_MAX_FLEN 1536
00029
00030
00031 #define RX_DESC_BASE 0x7FE00000
00032 #define RX_STAT_BASE (RX_DESC_BASE + NUM_RX_FRAG*8)
00033 #define TX_DESC_BASE (RX_STAT_BASE + NUM_RX_FRAG*8)
00034 #define TX_STAT_BASE (TX_DESC_BASE + NUM_TX_FRAG*8)
00035 #define RX_BUF_BASE (TX_STAT_BASE + NUM_TX_FRAG*4)
00036 #define TX_BUF_BASE (RX_BUF_BASE + NUM_RX_FRAG*ETH_FRAG_SIZE)
00037
00038
00039 #define RX_DESC_PACKET(i) (*(unsigned int *)(RX_DESC_BASE + 8*i))
00040 #define RX_DESC_CTRL(i) (*(unsigned int *)(RX_DESC_BASE+4 + 8*i))
00041 #define RX_STAT_INFO(i) (*(unsigned int *)(RX_STAT_BASE + 8*i))
00042 #define RX_STAT_HASHCRC(i) (*(unsigned int *)(RX_STAT_BASE+4 + 8*i))
00043 #define TX_DESC_PACKET(i) (*(unsigned int *)(TX_DESC_BASE + 8*i))
00044 #define TX_DESC_CTRL(i) (*(unsigned int *)(TX_DESC_BASE+4 + 8*i))
00045 #define TX_STAT_INFO(i) (*(unsigned int *)(TX_STAT_BASE + 4*i))
00046 #define RX_BUF(i) (RX_BUF_BASE + ETH_FRAG_SIZE*i)
00047 #define TX_BUF(i) (TX_BUF_BASE + ETH_FRAG_SIZE*i)
00048
00049
00050 #define MAC1_REC_EN 0x00000001
00051 #define MAC1_PASS_ALL 0x00000002
00052 #define MAC1_RX_FLOWC 0x00000004
00053 #define MAC1_TX_FLOWC 0x00000008
00054 #define MAC1_LOOPB 0x00000010
00055 #define MAC1_RES_TX 0x00000100
00056 #define MAC1_RES_MCS_TX 0x00000200
00057 #define MAC1_RES_RX 0x00000400
00058 #define MAC1_RES_MCS_RX 0x00000800
00059 #define MAC1_SIM_RES 0x00004000
00060 #define MAC1_SOFT_RES 0x00008000
00061
00062
00063 #define MAC2_FULL_DUP 0x00000001
00064 #define MAC2_FRM_LEN_CHK 0x00000002
00065 #define MAC2_HUGE_FRM_EN 0x00000004
00066 #define MAC2_DLY_CRC 0x00000008
00067 #define MAC2_CRC_EN 0x00000010
00068 #define MAC2_PAD_EN 0x00000020
00069 #define MAC2_VLAN_PAD_EN 0x00000040
00070 #define MAC2_ADET_PAD_EN 0x00000080
00071 #define MAC2_PPREAM_ENF 0x00000100
00072 #define MAC2_LPREAM_ENF 0x00000200
00073 #undef MAC2_NO_BACKOFF
00074 #define MAC2_NO_BACKOFF 0x00001000
00075 #define MAC2_BACK_PRESSURE 0x00002000
00076 #define MAC2_EXCESS_DEF 0x00004000
00077
00078
00079 #define IPGT_FULL_DUP 0x00000015
00080 #define IPGT_HALF_DUP 0x00000012
00081
00082
00083 #define IPGR_DEF 0x00000012
00084
00085
00086 #define CLRT_DEF 0x0000370F
00087
00088
00089 #undef SUPP_SPEED
00090 #define SUPP_SPEED 0x00000100
00091 #define SUPP_RES_RMII 0x00000800
00092
00093
00094 #define TEST_SHCUT_PQUANTA 0x00000001
00095 #define TEST_TST_PAUSE 0x00000002
00096 #define TEST_TST_BACKP 0x00000004
00097
00098
00099 #define MCFG_SCAN_INC 0x00000001
00100 #define MCFG_SUPP_PREAM 0x00000002
00101 #define MCFG_CLK_SEL 0x0000001C
00102 #define MCFG_RES_MII 0x00008000
00103 #define HOST_CLK_BY_20 0x00000018
00104
00105
00106 #undef MCMD_READ
00107 #define MCMD_READ 0x00000001
00108 #undef MCMD_SCAN
00109 #define MCMD_SCAN 0x00000002
00110
00111 #define MII_WR_TOUT 0x00050000
00112 #define MII_RD_TOUT 0x00050000
00113
00114
00115 #define MADR_REG_ADR 0x0000001F
00116 #define MADR_PHY_ADR 0x00001F00
00117
00118
00119 #undef MIND_BUSY
00120 #define MIND_BUSY 0x00000001
00121 #define MIND_SCAN 0x00000002
00122 #define MIND_NOT_VAL 0x00000004
00123 #define MIND_MII_LINK_FAIL 0x00000008
00124
00125
00126 #define CR_RX_EN 0x00000001
00127 #define CR_TX_EN 0x00000002
00128 #define CR_REG_RES 0x00000008
00129 #define CR_TX_RES 0x00000010
00130 #define CR_RX_RES 0x00000020
00131 #define CR_PASS_RUNT_FRM 0x00000040
00132 #define CR_PASS_RX_FILT 0x00000080
00133 #define CR_TX_FLOW_CTRL 0x00000100
00134 #define CR_RMII 0x00000200
00135 #define CR_FULL_DUP 0x00000400
00136
00137
00138 #define SR_RX_EN 0x00000001
00139 #define SR_TX_EN 0x00000002
00140
00141
00142 #define TSV0_CRC_ERR 0x00000001
00143 #define TSV0_LEN_CHKERR 0x00000002
00144 #define TSV0_LEN_OUTRNG 0x00000004
00145 #define TSV0_DONE 0x00000008
00146 #define TSV0_MCAST 0x00000010
00147 #define TSV0_BCAST 0x00000020
00148 #define TSV0_PKT_DEFER 0x00000040
00149 #define TSV0_EXC_DEFER 0x00000080
00150 #define TSV0_EXC_COLL 0x00000100
00151 #define TSV0_LATE_COLL 0x00000200
00152 #define TSV0_GIANT 0x00000400
00153 #define TSV0_UNDERRUN 0x00000800
00154 #define TSV0_BYTES 0x0FFFF000
00155 #define TSV0_CTRL_FRAME 0x10000000
00156 #define TSV0_PAUSE 0x20000000
00157 #define TSV0_BACK_PRESS 0x40000000
00158 #define TSV0_VLAN 0x80000000
00159
00160
00161 #define TSV1_BYTE_CNT 0x0000FFFF
00162 #define TSV1_COLL_CNT 0x000F0000
00163
00164
00165 #define RSV_BYTE_CNT 0x0000FFFF
00166 #define RSV_PKT_IGNORED 0x00010000
00167 #define RSV_RXDV_SEEN 0x00020000
00168 #define RSV_CARR_SEEN 0x00040000
00169 #define RSV_REC_CODEV 0x00080000
00170 #define RSV_CRC_ERR 0x00100000
00171 #define RSV_LEN_CHKERR 0x00200000
00172 #define RSV_LEN_OUTRNG 0x00400000
00173 #define RSV_REC_OK 0x00800000
00174 #define RSV_MCAST 0x01000000
00175 #define RSV_BCAST 0x02000000
00176 #define RSV_DRIB_NIBB 0x04000000
00177 #define RSV_CTRL_FRAME 0x08000000
00178 #define RSV_PAUSE 0x10000000
00179 #define RSV_UNSUPP_OPC 0x20000000
00180 #define RSV_VLAN 0x40000000
00181
00182
00183 #define FCC_MIRR_CNT 0x0000FFFF
00184 #define FCC_PAUSE_TIM 0xFFFF0000
00185
00186
00187 #define FCS_MIRR_CNT 0x0000FFFF
00188
00189
00190 #define RFC_UCAST_EN 0x00000001
00191 #define RFC_BCAST_EN 0x00000002
00192 #define RFC_MCAST_EN 0x00000004
00193 #define RFC_UCAST_HASH_EN 0x00000008
00194 #define RFC_MCAST_HASH_EN 0x00000010
00195 #define RFC_PERFECT_EN 0x00000020
00196 #define RFC_MAGP_WOL_EN 0x00001000
00197 #define RFC_PFILT_WOL_EN 0x00002000
00198
00199
00200 #define WOL_UCAST 0x00000001
00201 #define WOL_BCAST 0x00000002
00202 #define WOL_MCAST 0x00000004
00203 #define WOL_UCAST_HASH 0x00000008
00204 #define WOL_MCAST_HASH 0x00000010
00205 #define WOL_PERFECT 0x00000020
00206 #define WOL_RX_FILTER 0x00000080
00207 #define WOL_MAG_PACKET 0x00000100
00208
00209
00210 #define INT_RX_OVERRUN 0x00000001
00211 #define INT_RX_ERR 0x00000002
00212 #define INT_RX_FIN 0x00000004
00213 #define INT_RX_DONE 0x00000008
00214 #define INT_TX_UNDERRUN 0x00000010
00215 #define INT_TX_ERR 0x00000020
00216 #define INT_TX_FIN 0x00000040
00217 #define INT_TX_DONE 0x00000080
00218 #define INT_SOFT_INT 0x00001000
00219 #define INT_WAKEUP 0x00002000
00220
00221
00222 #define PD_POWER_DOWN 0x80000000
00223
00224
00225 #define RCTRL_SIZE 0x000007FF
00226 #define RCTRL_INT 0x80000000
00227
00228
00229 #define RHASH_SA 0x000001FF
00230 #define RHASH_DA 0x001FF000
00231
00232
00233 #define RINFO_SIZE 0x000007FF
00234 #define RINFO_CTRL_FRAME 0x00040000
00235 #define RINFO_VLAN 0x00080000
00236 #define RINFO_FAIL_FILT 0x00100000
00237 #define RINFO_MCAST 0x00200000
00238 #define RINFO_BCAST 0x00400000
00239 #define RINFO_CRC_ERR 0x00800000
00240 #define RINFO_SYM_ERR 0x01000000
00241 #define RINFO_LEN_ERR 0x02000000
00242 #define RINFO_RANGE_ERR 0x04000000
00243 #define RINFO_ALIGN_ERR 0x08000000
00244 #define RINFO_OVERRUN 0x10000000
00245 #define RINFO_NO_DESCR 0x20000000
00246 #define RINFO_LAST_FLAG 0x40000000
00247 #define RINFO_ERR 0x80000000
00248
00249 #define RINFO_ERR_MASK (RINFO_FAIL_FILT | RINFO_CRC_ERR | RINFO_SYM_ERR | \
00250 RINFO_LEN_ERR | RINFO_ALIGN_ERR | RINFO_OVERRUN)
00251
00252
00253 #define TCTRL_SIZE 0x000007FF
00254 #define TCTRL_OVERRIDE 0x04000000
00255 #define TCTRL_HUGE 0x08000000
00256 #define TCTRL_PAD 0x10000000
00257 #define TCTRL_CRC 0x20000000
00258 #define TCTRL_LAST 0x40000000
00259 #define TCTRL_INT 0x80000000
00260
00261
00262 #define TINFO_COL_CNT 0x01E00000
00263 #define TINFO_DEFER 0x02000000
00264 #define TINFO_EXCESS_DEF 0x04000000
00265 #define TINFO_EXCESS_COL 0x08000000
00266 #define TINFO_LATE_COL 0x10000000
00267 #define TINFO_UNDERRUN 0x20000000
00268 #define TINFO_NO_DESCR 0x40000000
00269 #define TINFO_ERR 0x80000000
00270
00271
00272 #define PHY_REG_BMCR 0x00
00273 #define PHY_REG_BMSR 0x01
00274 #define PHY_REG_IDR1 0x02
00275 #define PHY_REG_IDR2 0x03
00276 #define PHY_REG_ANAR 0x04
00277 #define PHY_REG_ANLPAR 0x05
00278 #define PHY_REG_ANER 0x06
00279 #define PHY_REG_ANNPTR 0x07
00280
00281
00282 #define PHY_REG_STS 0x10
00283 #define PHY_REG_MICR 0x11
00284 #define PHY_REG_MISR 0x12
00285 #define PHY_REG_FCSCR 0x14
00286 #define PHY_REG_RECR 0x15
00287 #define PHY_REG_PCSR 0x16
00288 #define PHY_REG_RBR 0x17
00289 #define PHY_REG_LEDCR 0x18
00290 #define PHY_REG_PHYCR 0x19
00291 #define PHY_REG_10BTSCR 0x1A
00292 #define PHY_REG_CDCTRL1 0x1B
00293 #define PHY_REG_EDCR 0x1D
00294
00295 #define PHY_FULLD_100M 0x2100
00296 #define PHY_HALFD_100M 0x2000
00297 #define PHY_FULLD_10M 0x0100
00298 #define PHY_HALFD_10M 0x0000
00299 #define PHY_AUTO_NEG 0x3000
00300
00301 #define DP83848C_DEF_ADR 0x0100
00302 #define DP83848C_ID 0x20005C90
00303
00304
00305 int Init_EMAC(void);
00306 unsigned short ReadFrameBE_EMAC(void);
00307 void CopyToFrame_EMAC(void *Source, unsigned int Size);
00308 void CopyFromFrame_EMAC(void *Dest, unsigned short Size);
00309 void DummyReadFrame_EMAC(unsigned short Size);
00310 unsigned short StartReadFrame(void);
00311 void EndReadFrame(void);
00312 unsigned int CheckFrameReceived(void);
00313 void RequestSend(void);
00314 unsigned int Rdy4Tx(void);
00315 void DoSend_EMAC(unsigned short FrameSize);
00316
00317 unsigned int uiGetEMACRxData( unsigned char *ucBuffer );
00318 void print_PHY_status();
00319
00320 #endif
00321
00322
00323
00324
00325