Go to the documentation of this file.
31 #ifndef _LPC175X_ETH_DRIVER_H
32 #define _LPC175X_ETH_DRIVER_H
38 #ifndef LPC175X_ETH_TX_BUFFER_COUNT
39 #define LPC175X_ETH_TX_BUFFER_COUNT 2
40 #elif (LPC175X_ETH_TX_BUFFER_COUNT < 1)
41 #error LPC175X_ETH_TX_BUFFER_COUNT parameter is not valid
45 #ifndef LPC175X_ETH_TX_BUFFER_SIZE
46 #define LPC175X_ETH_TX_BUFFER_SIZE 1536
47 #elif (LPC175X_ETH_TX_BUFFER_SIZE != 1536)
48 #error LPC175X_ETH_TX_BUFFER_SIZE parameter is not valid
52 #ifndef LPC175X_ETH_RX_BUFFER_COUNT
53 #define LPC175X_ETH_RX_BUFFER_COUNT 4
54 #elif (LPC175X_ETH_RX_BUFFER_COUNT < 1)
55 #error LPC175X_ETH_RX_BUFFER_COUNT parameter is not valid
59 #ifndef LPC175X_ETH_RX_BUFFER_SIZE
60 #define LPC175X_ETH_RX_BUFFER_SIZE 1536
61 #elif (LPC175X_ETH_RX_BUFFER_SIZE != 1536)
62 #error LPC175X_ETH_RX_BUFFER_SIZE parameter is not valid
66 #ifndef LPC175X_ETH_IRQ_PRIORITY_GROUPING
67 #define LPC175X_ETH_IRQ_PRIORITY_GROUPING 2
68 #elif (LPC175X_ETH_IRQ_PRIORITY_GROUPING < 0)
69 #error LPC175X_ETH_IRQ_PRIORITY_GROUPING parameter is not valid
73 #ifndef LPC175X_ETH_IRQ_GROUP_PRIORITY
74 #define LPC175X_ETH_IRQ_GROUP_PRIORITY 24
75 #elif (LPC175X_ETH_IRQ_GROUP_PRIORITY < 0)
76 #error LPC175X_ETH_IRQ_GROUP_PRIORITY parameter is not valid
80 #ifndef LPC175X_ETH_IRQ_SUB_PRIORITY
81 #define LPC175X_ETH_IRQ_SUB_PRIORITY 0
82 #elif (LPC175X_ETH_IRQ_SUB_PRIORITY < 0)
83 #error LPC175X_ETH_IRQ_SUB_PRIORITY parameter is not valid
87 #ifndef LPC175X_ETH_MDC_GPIO
88 #define LPC175X_ETH_MDC_GPIO LPC_GPIO2
91 #ifndef LPC175X_ETH_MDC_MASK
92 #define LPC175X_ETH_MDC_MASK (1 << 8)
96 #ifndef LPC175X_ETH_MDIO_GPIO
97 #define LPC175X_ETH_MDIO_GPIO LPC_GPIO2
100 #ifndef LPC175X_ETH_MDIO_MASK
101 #define LPC175X_ETH_MDIO_MASK (1 << 9)
105 #define MAC1_SOFT_RESET 0x00008000
106 #define MAC1_SIMULATION_RESET 0x00004000
107 #define MAC1_RESET_MCS_RX 0x00000800
108 #define MAC1_RESET_RX 0x00000400
109 #define MAC1_RESET_MCS_TX 0x00000200
110 #define MAC1_RESET_TX 0x00000100
111 #define MAC1_LOOPBACK 0x00000010
112 #define MAC1_TX_FLOW_CONTROL 0x00000008
113 #define MAC1_RX_FLOW_CONTROL 0x00000004
114 #define MAC1_PASS_ALL_FRAMES 0x00000002
115 #define MAC1_RECEIVE_ENABLE 0x00000001
118 #define MAC2_EXCESS_DEFER 0x00004000
119 #define MAC2_BACK_PRESSURE_NO_BACKOFF 0x00002000
120 #define MAC2_NO_BACKOFF 0x00001000
121 #define MAC2_LONG_PREAMBLE_ENFORCEMENT 0x00000200
122 #define MAC2_PURE_PREAMBLE_ENFORCEMENT 0x00000100
123 #define MAC2_AUTO_DETECT_PAD_ENABLE 0x00000080
124 #define MAC2_VLAN_PAD_ENABLE 0x00000040
125 #define MAC2_PAD_CRC_ENABLE 0x00000020
126 #define MAC2_CRC_ENABLE 0x00000010
127 #define MAC2_DELAYED_CRC 0x00000008
128 #define MAC2_HUGE_FRAME_ENABLE 0x00000004
129 #define MAC2_FRAME_LENGTH_CHECKING 0x00000002
130 #define MAC2_FULL_DUPLEX 0x00000001
133 #define IPGT_BACK_TO_BACK_IPG 0x0000007F
134 #define IPGT_HALF_DUPLEX 0x00000012
135 #define IPGT_FULL_DUPLEX 0x00000015
138 #define IPGR_NON_BACK_TO_BACK_IPG1 0x00007F00
139 #define IPGR_NON_BACK_TO_BACK_IPG2 0x0000007F
140 #define IPGR_DEFAULT_VALUE 0x00000C12
143 #define CLRT_COLLISION_WINDOW 0x00003F00
144 #define CLRT_RETRANSMISSION_MAXIMUM 0x00003F00
145 #define CLRT_DEFAULT_VALUE 0x0000370F
148 #define MAXF_MAXIMUM_FRAME_LENGTH 0x0000FFFF
151 #define SUPP_SPEED 0x00000100
154 #define TEST_BACKPRESSURE 0x00000004
155 #define TEST_PAUSE 0x00000002
156 #define TEST_SHORTCUT_PAUSE_QUANTA 0x00000001
159 #define MCFG_RESET_MII_MGMT 0x00008000
160 #define MCFG_CLOCK SELECT 0x0000003C
161 #define MCFG_SUPPRESS_PREAMBLE 0x00000002
162 #define MCFG_SCAN_INCREMENT 0x00000001
164 #define MCFG_CLOCK_SELECT_DIV4 0x00000000
165 #define MCFG_CLOCK_SELECT_DIV6 0x00000008
166 #define MCFG_CLOCK_SELECT_DIV8 0x0000000C
167 #define MCFG_CLOCK_SELECT_DIV10 0x00000010
168 #define MCFG_CLOCK_SELECT_DIV14 0x00000014
169 #define MCFG_CLOCK_SELECT_DIV20 0x00000018
170 #define MCFG_CLOCK_SELECT_DIV28 0x0000001C
171 #define MCFG_CLOCK_SELECT_DIV36 0x00000020
172 #define MCFG_CLOCK_SELECT_DIV40 0x00000024
173 #define MCFG_CLOCK_SELECT_DIV44 0x00000028
174 #define MCFG_CLOCK_SELECT_DIV48 0x0000002C
175 #define MCFG_CLOCK_SELECT_DIV52 0x00000030
176 #define MCFG_CLOCK_SELECT_DIV56 0x00000034
177 #define MCFG_CLOCK_SELECT_DIV60 0x00000038
178 #define MCFG_CLOCK_SELECT_DIV64 0x0000003C
181 #define MCMD_SCAN 0x00000002
182 #define MCMD_READ 0x00000001
185 #define MADR_PHY_ADDRESS 0x00001F00
186 #define MADR_REGISTER_ADDRESS 0x0000001F
189 #define MWTD_WRITE_DATA 0x0000FFFF
192 #define MRDD_READ_DATA 0x0000FFFF
195 #define MIND_MII_LINK_FAIL 0x00000008
196 #define MIND_NOT_VALID 0x00000004
197 #define MIND_SCANNING 0x00000002
198 #define MIND_BUSY 0x00000001
201 #define COMMAND_FULL_DUPLEX 0x00000400
202 #define COMMAND_RMII 0x00000200
203 #define COMMAND_TX_FLOW_CONTROL 0x00000100
204 #define COMMAND_PASS_RX_FILTER 0x00000080
205 #define COMMAND_PASS_RUNT_FRAME 0x00000040
206 #define COMMAND_RX_RESET 0x00000020
207 #define COMMAND_TX_RESET 0x00000010
208 #define COMMAND_REG_RESET 0x00000008
209 #define COMMAND_TX_ENABLE 0x00000002
210 #define COMMAND_RX_ENABLE 0x00000001
213 #define STATUS_TX 0x00000002
214 #define STATUS_RX 0x00000001
217 #define TSV0_VLAN 0x80000000
218 #define TSV0_BACKPRESSURE 0x40000000
219 #define TSV0_PAUSE 0x20000000
220 #define TSV0_CONTROL_FRAME 0x10000000
221 #define TSV0_TOTAL_BYTES 0x0FFFF000
222 #define TSV0_UNDERRUN 0x00000800
223 #define TSV0_GIANT 0x00000400
224 #define TSV0_LATE_COLLISION 0x00000200
225 #define TSV0_EXCESSIVE_COLLISION 0x00000100
226 #define TSV0_EXCESSIVE_DEFER 0x00000080
227 #define TSV0_PACKET_DEFER 0x00000040
228 #define TSV0_BROADCAST 0x00000020
229 #define TSV0_MULTICAST 0x00000010
230 #define TSV0_DONE 0x00000008
231 #define TSV0_LENGTH_OUT_OF_RANGE 0x00000004
232 #define TSV0_LENGTH_CHECK_ERROR 0x00000002
233 #define TSV0_CRC_ERROR 0x00000001
236 #define TSV1_TRANSMIT_COLLISION_COUNT 0x000F0000
237 #define TSV1_TRANSMIT_BYTE_COUNT 0x0000FFFF
240 #define RSV_VLAN 0x40000000
241 #define RSV_UNSUPPORTED_OPCODE 0x20000000
242 #define RSV_PAUSE 0x10000000
243 #define RSV_CONTROL_FRAME 0x08000000
244 #define RSV_DRIBBLE_NIBBLE 0x04000000
245 #define RSV_BROADCAST 0x02000000
246 #define RSV_MULTICAST 0x01000000
247 #define RSV_RECEIVE_OK 0x00800000
248 #define RSV_LENGTH_OUT_OF_RANGE 0x00400000
249 #define RSV_LENGTH_CHECK_ERROR 0x00200000
250 #define RSV_CRC_ERROR 0x00100000
251 #define RSV_RECEIVE_CODE_VIOLATION 0x00080000
252 #define RSV_CARRIER_EVENT_PREV_SEEN 0x00040000
253 #define RSV_RXDV_EVENT_PREV_SEEN 0x00020000
254 #define RSV_PACKET_PREVIOUSLY_IGNORED 0x00010000
255 #define RSV_RECEIVED_BYTE_COUNT 0x0000FFFF
258 #define FCC_PAUSE_TIMER 0xFFFF0000
259 #define FCC_MIRROR_COUNTER 0x0000FFFF
262 #define FCS_MIRROR_COUNTER_CURRENT 0x0000FFFF
265 #define RFC_RX_FILTER_EN_WOL 0x00002000
266 #define RFC_MAGIC_PACKET_EN_WOL 0x00001000
267 #define RFC_ACCEPT_PERFECT_EN 0x00000020
268 #define RFC_ACCEPT_MULTICAST_HASH_EN 0x00000010
269 #define RFC_ACCEPT_UNICAST_HASH_EN 0x00000008
270 #define RFC_ACCEPT_MULTICAST_EN 0x00000004
271 #define RFC_ACCEPT_BROADCAST_EN 0x00000002
272 #define RFC_ACCEPT_UNICAST_EN 0x00000001
275 #define RFWS_MAGIC_PACKET_WOL 0x00000100
276 #define RFWS_RX_FILTER_WOL 0x00000080
277 #define RFWS_ACCEPT_PERFECT_WOL 0x00000020
278 #define RFWS_ACCEPT_MULTICAST_HASH_WOL 0x00000010
279 #define RFWS_ACCEPT_UNICAST_HASH_WOL 0x00000008
280 #define RFWS_ACCEPT_MULTICAST_WOL 0x00000004
281 #define RFWS_ACCEPT_BROADCAST_WOL 0x00000002
282 #define RFWS_ACCEPT_UNICAST_WOL 0x00000001
285 #define INT_WAKEUP 0x00002000
286 #define INT_SOFT_INT 0x00001000
287 #define INT_TX_DONE 0x00000080
288 #define INT_TX_FINISHED 0x00000040
289 #define INT_TX_ERROR 0x00000020
290 #define INT_TX_UNDERRUN 0x00000010
291 #define INT_RX_DONE 0x00000008
292 #define INT_RX_FINISHED 0x00000004
293 #define INT_RX_ERROR 0x00000002
294 #define INT_RX_OVERRUN 0x00000001
297 #define TX_CTRL_INTERRUPT 0x80000000
298 #define TX_CTRL_LAST 0x40000000
299 #define TX_CTRL_CRC 0x20000000
300 #define TX_CTRL_PAD 0x10000000
301 #define TX_CTRL_HUGE 0x08000000
302 #define TX_CTRL_OVERRIDE 0x04000000
303 #define TX_CTRL_SIZE 0x000007FF
306 #define TX_STATUS_ERROR 0x80000000
307 #define TX_STATUS_NO_DESCRIPTOR 0x40000000
308 #define TX_STATUS_UNDERRUN 0x20000000
309 #define TX_STATUS_LATE_COLLISION 0x10000000
310 #define TX_STATUS_EXCESSIVE_COLLISION 0x08000000
311 #define TX_STATUS_EXCESSIVE_DEFER 0x04000000
312 #define TX_STATUS_DEFER 0x02000000
313 #define TX_STATUS_COLLISION_COUNT 0x01E00000
316 #define RX_CTRL_INTERRUPT 0x80000000
317 #define RX_CTRL_SIZE 0x000007FF
320 #define RX_STATUS_ERROR 0x80000000
321 #define RX_STATUS_LAST_FLAG 0x40000000
322 #define RX_STATUS_NO_DESCRIPTOR 0x20000000
323 #define RX_STATUS_OVERRUN 0x10000000
324 #define RX_STATUS_ALIGNMENT_ERROR 0x08000000
325 #define RX_STATUS_RANGE_ERROR 0x04000000
326 #define RX_STATUS_LENGTH_ERROR 0x02000000
327 #define RX_STATUS_SYMBOL_ERROR 0x01000000
328 #define RX_STATUS_CRC_ERROR 0x00800000
329 #define RX_STATUS_BROADCAST 0x00400000
330 #define RX_STATUS_MULTICAST 0x00200000
331 #define RX_STATUS_FAIL_FILTER 0x00100000
332 #define RX_STATUS_VLAN 0x00080000
333 #define RX_STATUS_CONTROL_FRAME 0x00040000
334 #define RX_STATUS_SIZE 0x000007FF
337 #define RX_HASH_CRC_DA 0x001FF000
338 #define RX_HASH_CRC_SA 0x000001FF
uint32_t lpc175xEthCalcCrc(const void *data, size_t length)
CRC calculation.
Structure describing a buffer that spans multiple chunks.
error_t lpc175xEthSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
void lpc175xEthWritePhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
Write PHY register.
error_t lpc175xEthUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
error_t lpc175xEthInit(NetInterface *interface)
LPC175x Ethernet MAC initialization.
const NicDriver lpc175xEthDriver
LPC175x Ethernet MAC driver.
void lpc175xEthDisableIrq(NetInterface *interface)
Disable interrupts.
uint32_t lpc175xEthReadSmi(uint_t length)
SMI read operation.
void lpc175xEthEventHandler(NetInterface *interface)
LPC175x Ethernet MAC event handler.
void lpc175xEthTick(NetInterface *interface)
LPC175x Ethernet MAC timer handler.
uint16_t lpc175xEthReadPhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
Read PHY register.
void lpc175xEthInitGpio(NetInterface *interface)
GPIO configuration.
void lpc175xEthInitDesc(NetInterface *interface)
Initialize TX and RX descriptors.
void lpc175xEthWriteSmi(uint32_t data, uint_t length)
SMI write operation.
error_t lpc175xEthReceivePacket(NetInterface *interface)
Receive a packet.
error_t lpc175xEthUpdateMacConfig(NetInterface *interface)
Adjust MAC configuration parameters for proper operation.
Network interface controller abstraction layer.
void lpc175xEthEnableIrq(NetInterface *interface)
Enable interrupts.