Go to the documentation of this file.
31 #ifndef _XMC4500_ETH_DRIVER_H
32 #define _XMC4500_ETH_DRIVER_H
38 #ifndef XMC4500_ETH_TX_BUFFER_COUNT
39 #define XMC4500_ETH_TX_BUFFER_COUNT 3
40 #elif (XMC4500_ETH_TX_BUFFER_COUNT < 1)
41 #error XMC4500_ETH_TX_BUFFER_COUNT parameter is not valid
45 #ifndef XMC4500_ETH_TX_BUFFER_SIZE
46 #define XMC4500_ETH_TX_BUFFER_SIZE 1536
47 #elif (XMC4500_ETH_TX_BUFFER_SIZE != 1536)
48 #error XMC4500_ETH_TX_BUFFER_SIZE parameter is not valid
52 #ifndef XMC4500_ETH_RX_BUFFER_COUNT
53 #define XMC4500_ETH_RX_BUFFER_COUNT 6
54 #elif (XMC4500_ETH_RX_BUFFER_COUNT < 1)
55 #error XMC4500_ETH_RX_BUFFER_COUNT parameter is not valid
59 #ifndef XMC4500_ETH_RX_BUFFER_SIZE
60 #define XMC4500_ETH_RX_BUFFER_SIZE 1536
61 #elif (XMC4500_ETH_RX_BUFFER_SIZE != 1536)
62 #error XMC4500_ETH_RX_BUFFER_SIZE parameter is not valid
66 #ifndef XMC4500_ETH_IRQ_PRIORITY_GROUPING
67 #define XMC4500_ETH_IRQ_PRIORITY_GROUPING 1
68 #elif (XMC4500_ETH_IRQ_PRIORITY_GROUPING < 0)
69 #error XMC4500_ETH_IRQ_PRIORITY_GROUPING parameter is not valid
73 #ifndef XMC4500_ETH_IRQ_GROUP_PRIORITY
74 #define XMC4500_ETH_IRQ_GROUP_PRIORITY 48
75 #elif (XMC4500_ETH_IRQ_GROUP_PRIORITY < 0)
76 #error XMC4500_ETH_IRQ_GROUP_PRIORITY parameter is not valid
80 #ifndef XMC4500_ETH_IRQ_SUB_PRIORITY
81 #define XMC4500_ETH_IRQ_SUB_PRIORITY 0
82 #elif (XMC4500_ETH_IRQ_SUB_PRIORITY < 0)
83 #error XMC4500_ETH_IRQ_SUB_PRIORITY parameter is not valid
87 #ifndef XMC4500_ETH_RAM_SECTION
88 #define XMC4500_ETH_RAM_SECTION "ETH_RAM"
92 #define ETH_CON_MDIO_A (0 << ETH_CON_MDIO_Pos)
93 #define ETH_CON_MDIO_B (1 << ETH_CON_MDIO_Pos)
94 #define ETH_CON_MDIO_C (2 << ETH_CON_MDIO_Pos)
95 #define ETH_CON_MDIO_D (3 << ETH_CON_MDIO_Pos)
97 #define ETH_CON_CLK_TX_A (0 << ETH_CON_CLK_TX_Pos)
98 #define ETH_CON_CLK_TX_B (1 << ETH_CON_CLK_TX_Pos)
99 #define ETH_CON_CLK_TX_C (2 << ETH_CON_CLK_TX_Pos)
100 #define ETH_CON_CLK_TX_D (3 << ETH_CON_CLK_TX_Pos)
102 #define ETH_CON_COL_A (0 << ETH_CON_COL_Pos)
103 #define ETH_CON_COL_B (1 << ETH_CON_COL_Pos)
104 #define ETH_CON_COL_C (2 << ETH_CON_COL_Pos)
105 #define ETH_CON_COL_D (3 << ETH_CON_COL_Pos)
107 #define ETH_CON_RXER_A (0 << ETH_CON_RXER_Pos)
108 #define ETH_CON_RXER_B (1 << ETH_CON_RXER_Pos)
109 #define ETH_CON_RXER_C (2 << ETH_CON_RXER_Pos)
110 #define ETH_CON_RXER_D (3 << ETH_CON_RXER_Pos)
112 #define ETH_CON_CRS_A (0 << ETH_CON_CRS_Pos)
113 #define ETH_CON_CRS_B (1 << ETH_CON_CRS_Pos)
114 #define ETH_CON_CRS_C (2 << ETH_CON_CRS_Pos)
115 #define ETH_CON_CRS_D (3 << ETH_CON_CRS_Pos)
117 #define ETH_CON_CRS_DV_A (0 << ETH_CON_CRS_DV_Pos)
118 #define ETH_CON_CRS_DV_B (1 << ETH_CON_CRS_DV_Pos)
119 #define ETH_CON_CRS_DV_C (2 << ETH_CON_CRS_DV_Pos)
120 #define ETH_CON_CRS_DV_D (3 << ETH_CON_CRS_DV_Pos)
122 #define ETH_CON_CLK_RMII_A (0 << ETH_CON_CLK_RMII_Pos)
123 #define ETH_CON_CLK_RMII_B (1 << ETH_CON_CLK_RMII_Pos)
124 #define ETH_CON_CLK_RMII_C (2 << ETH_CON_CLK_RMII_Pos)
125 #define ETH_CON_CLK_RMII_D (3 << ETH_CON_CLK_RMII_Pos)
127 #define ETH_CON_RXD3_A (0 << ETH_CON_RXD3_Pos)
128 #define ETH_CON_RXD3_B (1 << ETH_CON_RXD3_Pos)
129 #define ETH_CON_RXD3_C (2 << ETH_CON_RXD3_Pos)
130 #define ETH_CON_RXD3_D (3 << ETH_CON_RXD3_Pos)
132 #define ETH_CON_RXD2_A (0 << ETH_CON_RXD2_Pos)
133 #define ETH_CON_RXD2_B (1 << ETH_CON_RXD2_Pos)
134 #define ETH_CON_RXD2_C (2 << ETH_CON_RXD2_Pos)
135 #define ETH_CON_RXD2_D (3 << ETH_CON_RXD2_Pos)
137 #define ETH_CON_RXD1_A (0 << ETH_CON_RXD1_Pos)
138 #define ETH_CON_RXD1_B (1 << ETH_CON_RXD1_Pos)
139 #define ETH_CON_RXD1_C (2 << ETH_CON_RXD1_Pos)
140 #define ETH_CON_RXD1_D (3 << ETH_CON_RXD1_Pos)
142 #define ETH_CON_RXD0_A (0 << ETH_CON_RXD0_Pos)
143 #define ETH_CON_RXD0_B (1 << ETH_CON_RXD0_Pos)
144 #define ETH_CON_RXD0_C (2 << ETH_CON_RXD0_Pos)
145 #define ETH_CON_RXD0_D (3 << ETH_CON_RXD0_Pos)
148 #define ETH_MAC_CONFIGURATION_RESERVED15_Msk (1 << 15)
151 #define ETH_GMII_ADDRESS_CR_DIV42 (0 << ETH_GMII_ADDRESS_CR_Pos)
152 #define ETH_GMII_ADDRESS_CR_DIV62 (1 << ETH_GMII_ADDRESS_CR_Pos)
153 #define ETH_GMII_ADDRESS_CR_DIV16 (2 << ETH_GMII_ADDRESS_CR_Pos)
154 #define ETH_GMII_ADDRESS_CR_DIV26 (3 << ETH_GMII_ADDRESS_CR_Pos)
155 #define ETH_GMII_ADDRESS_CR_DIV102 (4 << ETH_GMII_ADDRESS_CR_Pos)
156 #define ETH_GMII_ADDRESS_CR_DIV124 (5 << ETH_GMII_ADDRESS_CR_Pos)
159 #define ETH_BUS_MODE_RPBL_1 (1 << ETH_BUS_MODE_RPBL_Pos)
160 #define ETH_BUS_MODE_RPBL_2 (2 << ETH_BUS_MODE_RPBL_Pos)
161 #define ETH_BUS_MODE_RPBL_4 (4 << ETH_BUS_MODE_RPBL_Pos)
162 #define ETH_BUS_MODE_RPBL_8 (8 << ETH_BUS_MODE_RPBL_Pos)
163 #define ETH_BUS_MODE_RPBL_16 (16 << ETH_BUS_MODE_RPBL_Pos)
164 #define ETH_BUS_MODE_RPBL_32 (32 << ETH_BUS_MODE_RPBL_Pos)
166 #define ETH_BUS_MODE_PR_1_1 (0 << ETH_BUS_MODE_PR_Pos)
167 #define ETH_BUS_MODE_PR_2_1 (1 << ETH_BUS_MODE_PR_Pos)
168 #define ETH_BUS_MODE_PR_3_1 (2 << ETH_BUS_MODE_PR_Pos)
169 #define ETH_BUS_MODE_PR_4_1 (3 << ETH_BUS_MODE_PR_Pos)
171 #define ETH_BUS_MODE_PBL_1 (1 << ETH_BUS_MODE_PBL_Pos)
172 #define ETH_BUS_MODE_PBL_2 (2 << ETH_BUS_MODE_PBL_Pos)
173 #define ETH_BUS_MODE_PBL_4 (4 << ETH_BUS_MODE_PBL_Pos)
174 #define ETH_BUS_MODE_PBL_8 (8 << ETH_BUS_MODE_PBL_Pos)
175 #define ETH_BUS_MODE_PBL_16 (16 << ETH_BUS_MODE_PBL_Pos)
176 #define ETH_BUS_MODE_PBL_32 (32 << ETH_BUS_MODE_PBL_Pos)
179 #define ETH_TDES0_OWN 0x80000000
180 #define ETH_TDES0_IC 0x40000000
181 #define ETH_TDES0_LS 0x20000000
182 #define ETH_TDES0_FS 0x10000000
183 #define ETH_TDES0_DC 0x08000000
184 #define ETH_TDES0_DP 0x04000000
185 #define ETH_TDES0_TTSE 0x02000000
186 #define ETH_TDES0_CIC 0x00C00000
187 #define ETH_TDES0_TER 0x00200000
188 #define ETH_TDES0_TCH 0x00100000
189 #define ETH_TDES0_TTSS 0x00020000
190 #define ETH_TDES0_IHE 0x00010000
191 #define ETH_TDES0_ES 0x00008000
192 #define ETH_TDES0_JT 0x00004000
193 #define ETH_TDES0_FF 0x00002000
194 #define ETH_TDES0_IPE 0x00001000
195 #define ETH_TDES0_LCA 0x00000800
196 #define ETH_TDES0_NC 0x00000400
197 #define ETH_TDES0_LCO 0x00000200
198 #define ETH_TDES0_EC 0x00000100
199 #define ETH_TDES0_VF 0x00000080
200 #define ETH_TDES0_CC 0x00000078
201 #define ETH_TDES0_ED 0x00000004
202 #define ETH_TDES0_UF 0x00000002
203 #define ETH_TDES0_DB 0x00000001
204 #define ETH_TDES1_TBS2 0x1FFF0000
205 #define ETH_TDES1_TBS1 0x00001FFF
206 #define ETH_TDES2_TBAP1 0xFFFFFFFF
207 #define ETH_TDES3_TBAP2 0xFFFFFFFF
210 #define ETH_RDES0_OWN 0x80000000
211 #define ETH_RDES0_AFM 0x40000000
212 #define ETH_RDES0_FL 0x3FFF0000
213 #define ETH_RDES0_ES 0x00008000
214 #define ETH_RDES0_DE 0x00004000
215 #define ETH_RDES0_SAF 0x00002000
216 #define ETH_RDES0_LE 0x00001000
217 #define ETH_RDES0_OE 0x00000800
218 #define ETH_RDES0_VLAN 0x00000400
219 #define ETH_RDES0_FS 0x00000200
220 #define ETH_RDES0_LS 0x00000100
221 #define ETH_RDES0_IPCE_GF 0x00000080
222 #define ETH_RDES0_LCO 0x00000040
223 #define ETH_RDES0_FT 0x00000020
224 #define ETH_RDES0_RWT 0x00000010
225 #define ETH_RDES0_RE 0x00000008
226 #define ETH_RDES0_DBE 0x00000004
227 #define ETH_RDES0_CE 0x00000002
228 #define ETH_RDES0_PCE 0x00000001
229 #define ETH_RDES1_DIC 0x80000000
230 #define ETH_RDES1_RBS2 0x1FFF0000
231 #define ETH_RDES1_RER 0x00008000
232 #define ETH_RDES1_RCH 0x00004000
233 #define ETH_RDES1_RBS1 0x00001FFF
234 #define ETH_RDES2_RBAP1 0xFFFFFFFF
235 #define ETH_RDES3_RBAP2 0xFFFFFFFF
error_t xmc4500EthSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
void xmc4500EthWritePhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
Write PHY register.
uint32_t xmc4500EthCalcCrc(const void *data, size_t length)
CRC calculation.
void xmc4500EthDisableIrq(NetInterface *interface)
Disable interrupts.
Structure describing a buffer that spans multiple chunks.
error_t xmc4500EthReceivePacket(NetInterface *interface)
Receive a packet.
const NicDriver xmc4500EthDriver
XMC4500 Ethernet MAC driver.
error_t xmc4500EthUpdateMacConfig(NetInterface *interface)
Adjust MAC configuration parameters for proper operation.
void xmc4500EthEnableIrq(NetInterface *interface)
Enable interrupts.
void xmc4500EthTick(NetInterface *interface)
XMC4500 Ethernet MAC timer handler.
void xmc4500EthEventHandler(NetInterface *interface)
XMC4500 Ethernet MAC event handler.
error_t xmc4500EthInit(NetInterface *interface)
XMC4500 Ethernet MAC initialization.
Network interface controller abstraction layer.
error_t xmc4500EthUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
void xmc4500EthInitGpio(NetInterface *interface)
GPIO configuration.
uint16_t xmc4500EthReadPhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
Read PHY register.
void xmc4500EthInitDmaDesc(NetInterface *interface)
Initialize DMA descriptor lists.