31#ifndef _TC2XX_ETH_DRIVER_H
32#define _TC2XX_ETH_DRIVER_H
38#ifndef TC2XX_ETH_TX_BUFFER_COUNT
39 #define TC2XX_ETH_TX_BUFFER_COUNT 3
40#elif (TC2XX_ETH_TX_BUFFER_COUNT < 1)
41 #error TC2XX_ETH_TX_BUFFER_COUNT parameter is not valid
45#ifndef TC2XX_ETH_TX_BUFFER_SIZE
46 #define TC2XX_ETH_TX_BUFFER_SIZE 1536
47#elif (TC2XX_ETH_TX_BUFFER_SIZE != 1536)
48 #error TC2XX_ETH_TX_BUFFER_SIZE parameter is not valid
52#ifndef TC2XX_ETH_RX_BUFFER_COUNT
53 #define TC2XX_ETH_RX_BUFFER_COUNT 6
54#elif (TC2XX_ETH_RX_BUFFER_COUNT < 1)
55 #error TC2XX_ETH_RX_BUFFER_COUNT parameter is not valid
59#ifndef TC2XX_ETH_RX_BUFFER_SIZE
60 #define TC2XX_ETH_RX_BUFFER_SIZE 1536
61#elif (TC2XX_ETH_RX_BUFFER_SIZE != 1536)
62 #error TC2XX_ETH_RX_BUFFER_SIZE parameter is not valid
66#ifndef TC2XX_ETH_IRQ_PRIORITY
67 #define TC2XX_ETH_IRQ_PRIORITY 10
68#elif (TC2XX_ETH_IRQ_PRIORITY < 0)
69 #error TC2XX_ETH_IRQ_PRIORITY parameter is not valid
73#define ETH_STATUS_GLPII 0x40000000
74#define ETH_STATUS_TTI 0x20000000
75#define ETH_STATUS_GPI 0x10000000
76#define ETH_STATUS_GMI 0x08000000
77#define ETH_STATUS_GLI 0x04000000
78#define ETH_STATUS_EB 0x03800000
79#define ETH_STATUS_TS 0x00700000
80#define ETH_STATUS_RS 0x000E0000
81#define ETH_STATUS_NIS 0x00010000
82#define ETH_STATUS_AIS 0x00008000
83#define ETH_STATUS_ERI 0x00004000
84#define ETH_STATUS_FBI 0x00002000
85#define ETH_STATUS_ETI 0x00000400
86#define ETH_STATUS_RWT 0x00000200
87#define ETH_STATUS_RPS 0x00000100
88#define ETH_STATUS_RU 0x00000080
89#define ETH_STATUS_RI 0x00000040
90#define ETH_STATUS_UNF 0x00000020
91#define ETH_STATUS_OVF 0x00000010
92#define ETH_STATUS_TJT 0x00000008
93#define ETH_STATUS_TU 0x00000004
94#define ETH_STATUS_TPS 0x00000002
95#define ETH_STATUS_TI 0x00000001
98#define ETH_INTERRUPT_ENABLE_NIE 0x00010000
99#define ETH_INTERRUPT_ENABLE_AIE 0x00008000
100#define ETH_INTERRUPT_ENABLE_ERE 0x00004000
101#define ETH_INTERRUPT_ENABLE_FBE 0x00002000
102#define ETH_INTERRUPT_ENABLE_ETE 0x00000400
103#define ETH_INTERRUPT_ENABLE_RWE 0x00000200
104#define ETH_INTERRUPT_ENABLE_RSE 0x00000100
105#define ETH_INTERRUPT_ENABLE_RUE 0x00000080
106#define ETH_INTERRUPT_ENABLE_RIE 0x00000040
107#define ETH_INTERRUPT_ENABLE_UNE 0x00000020
108#define ETH_INTERRUPT_ENABLE_OVE 0x00000010
109#define ETH_INTERRUPT_ENABLE_TJE 0x00000008
110#define ETH_INTERRUPT_ENABLE_TUE 0x00000004
111#define ETH_INTERRUPT_ENABLE_TSE 0x00000002
112#define ETH_INTERRUPT_ENABLE_TIE 0x00000001
115#define ETH_TDES0_OWN 0x80000000
116#define ETH_TDES0_IC 0x40000000
117#define ETH_TDES0_LS 0x20000000
118#define ETH_TDES0_FS 0x10000000
119#define ETH_TDES0_DC 0x08000000
120#define ETH_TDES0_DP 0x04000000
121#define ETH_TDES0_TTSE 0x02000000
122#define ETH_TDES0_CIC 0x00C00000
123#define ETH_TDES0_TER 0x00200000
124#define ETH_TDES0_TCH 0x00100000
125#define ETH_TDES0_TTSS 0x00020000
126#define ETH_TDES0_IHE 0x00010000
127#define ETH_TDES0_ES 0x00008000
128#define ETH_TDES0_JT 0x00004000
129#define ETH_TDES0_FF 0x00002000
130#define ETH_TDES0_IPE 0x00001000
131#define ETH_TDES0_LCA 0x00000800
132#define ETH_TDES0_NC 0x00000400
133#define ETH_TDES0_LCO 0x00000200
134#define ETH_TDES0_EC 0x00000100
135#define ETH_TDES0_VF 0x00000080
136#define ETH_TDES0_CC 0x00000078
137#define ETH_TDES0_ED 0x00000004
138#define ETH_TDES0_UF 0x00000002
139#define ETH_TDES0_DB 0x00000001
140#define ETH_TDES1_TBS2 0x1FFF0000
141#define ETH_TDES1_TBS1 0x00001FFF
142#define ETH_TDES2_B1AP 0xFFFFFFFF
143#define ETH_TDES3_B2AP 0xFFFFFFFF
144#define ETH_TDES6_TTSL 0xFFFFFFFF
145#define ETH_TDES7_TTSH 0xFFFFFFFF
148#define ETH_RDES0_OWN 0x80000000
149#define ETH_RDES0_AFM 0x40000000
150#define ETH_RDES0_FL 0x3FFF0000
151#define ETH_RDES0_ES 0x00008000
152#define ETH_RDES0_DE 0x00004000
153#define ETH_RDES0_SAF 0x00002000
154#define ETH_RDES0_LE 0x00001000
155#define ETH_RDES0_OE 0x00000800
156#define ETH_RDES0_VLAN 0x00000400
157#define ETH_RDES0_FS 0x00000200
158#define ETH_RDES0_LS 0x00000100
159#define ETH_RDES0_TS 0x00000080
160#define ETH_RDES0_LCO 0x00000040
161#define ETH_RDES0_FT 0x00000020
162#define ETH_RDES0_RWT 0x00000010
163#define ETH_RDES0_RE 0x00000008
164#define ETH_RDES0_DBE 0x00000004
165#define ETH_RDES0_CE 0x00000002
166#define ETH_RDES0_ESA 0x00000001
167#define ETH_RDES1_DIC 0x80000000
168#define ETH_RDES1_RBS2 0x1FFF0000
169#define ETH_RDES1_RER 0x00008000
170#define ETH_RDES1_RCH 0x00004000
171#define ETH_RDES1_RBS1 0x00001FFF
172#define ETH_RDES2_B1AP 0xFFFFFFFF
173#define ETH_RDES3_B2AP 0xFFFFFFFF
174#define ETH_RDES4_PV 0x00002000
175#define ETH_RDES4_PFT 0x00001000
176#define ETH_RDES4_MT 0x00000F00
177#define ETH_RDES4_IP6R 0x00000080
178#define ETH_RDES4_IP4R 0x00000040
179#define ETH_RDES4_IPCB 0x00000020
180#define ETH_RDES4_IPE 0x00000010
181#define ETH_RDES4_IPHE 0x00000008
182#define ETH_RDES4_IPT 0x00000007
183#define ETH_RDES6_RTSL 0xFFFFFFFF
184#define ETH_RDES7_RTSH 0xFFFFFFFF
187#define ETH_CPU_ID() (_mfcr(CPU_CORE_ID) & IFX_CPU_CORE_ID_CORE_ID_MSK)
190#define ETH_GLOBAL_DSPR_ADDR(address) \
191 ((((uint32_t) (address) & 0xF0000000) == 0xD0000000) ? \
192 ((((uint32_t) (address) & 0x000FFFFF) | 0x70000000) - (ETH_CPU_ID() * 0x10000000)) : \
193 (uint32_t) (address))
239error_t tc2xxEthInit(NetInterface *interface);
240void tc2xxEthInitGpio(NetInterface *interface);
241void tc2xxEthInitDmaDesc(NetInterface *interface);
243void tc2xxEthTick(NetInterface *interface);
245void tc2xxEthEnableIrq(NetInterface *interface);
246void tc2xxEthDisableIrq(NetInterface *interface);
247void tc2xxEthIrqHandler(int_t arg);
248void tc2xxEthEventHandler(NetInterface *interface);
250error_t tc2xxEthSendPacket(NetInterface *interface,
251 const NetBuffer *buffer,
size_t offset, NetTxAncillary *ancillary);
253error_t tc2xxEthReceivePacket(NetInterface *interface);
255error_t tc2xxEthUpdateMacAddrFilter(NetInterface *interface);
256error_t tc2xxEthUpdateMacConfig(NetInterface *interface);
258void tc2xxEthWritePhyReg(uint8_t opcode, uint8_t phyAddr,
259 uint8_t regAddr, uint16_t data);
261uint16_t tc2xxEthReadPhyReg(uint8_t opcode, uint8_t phyAddr,
264uint32_t tc2xxEthCalcCrc(
const void *data,
size_t length);
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283
Receive DMA descriptor.
Definition tc2xx_eth_driver.h:223
Transmit DMA descriptor.
Definition tc2xx_eth_driver.h:206