31#ifndef _LPC23XX_ETH_DRIVER_H
32#define _LPC23XX_ETH_DRIVER_H
38#ifndef LPC23XX_ETH_TX_BUFFER_COUNT
39 #define LPC23XX_ETH_TX_BUFFER_COUNT 2
40#elif (LPC23XX_ETH_TX_BUFFER_COUNT < 1)
41 #error LPC23XX_ETH_TX_BUFFER_COUNT parameter is not valid
45#ifndef LPC23XX_ETH_TX_BUFFER_SIZE
46 #define LPC23XX_ETH_TX_BUFFER_SIZE 1536
47#elif (LPC23XX_ETH_TX_BUFFER_SIZE != 1536)
48 #error LPC23XX_ETH_TX_BUFFER_SIZE parameter is not valid
52#ifndef LPC23XX_ETH_RX_BUFFER_COUNT
53 #define LPC23XX_ETH_RX_BUFFER_COUNT 4
54#elif (LPC23XX_ETH_RX_BUFFER_COUNT < 1)
55 #error LPC23XX_ETH_RX_BUFFER_COUNT parameter is not valid
59#ifndef LPC23XX_ETH_RX_BUFFER_SIZE
60 #define LPC23XX_ETH_RX_BUFFER_SIZE 1536
61#elif (LPC23XX_ETH_RX_BUFFER_SIZE != 1536)
62 #error LPC23XX_ETH_RX_BUFFER_SIZE parameter is not valid
66#ifndef LPC23XX_ETH_IRQ_PRIORITY
67 #define LPC23XX_ETH_IRQ_PRIORITY 15
68#elif (LPC23XX_ETH_IRQ_PRIORITY < 0)
69 #error LPC23XX_ETH_IRQ_PRIORITY parameter is not valid
73#define MAC1_SOFT_RESET 0x00008000
74#define MAC1_SIMULATION_RESET 0x00004000
75#define MAC1_RESET_MCS_RX 0x00000800
76#define MAC1_RESET_RX 0x00000400
77#define MAC1_RESET_MCS_TX 0x00000200
78#define MAC1_RESET_TX 0x00000100
79#define MAC1_LOOPBACK 0x00000010
80#define MAC1_TX_FLOW_CONTROL 0x00000008
81#define MAC1_RX_FLOW_CONTROL 0x00000004
82#define MAC1_PASS_ALL_FRAMES 0x00000002
83#define MAC1_RECEIVE_ENABLE 0x00000001
86#define MAC2_EXCESS_DEFER 0x00004000
87#define MAC2_BACK_PRESSURE_NO_BACKOFF 0x00002000
88#define MAC2_NO_BACKOFF 0x00001000
89#define MAC2_LONG_PREAMBLE_ENFORCEMENT 0x00000200
90#define MAC2_PURE_PREAMBLE_ENFORCEMENT 0x00000100
91#define MAC2_AUTO_DETECT_PAD_ENABLE 0x00000080
92#define MAC2_VLAN_PAD_ENABLE 0x00000040
93#define MAC2_PAD_CRC_ENABLE 0x00000020
94#define MAC2_CRC_ENABLE 0x00000010
95#define MAC2_DELAYED_CRC 0x00000008
96#define MAC2_HUGE_FRAME_ENABLE 0x00000004
97#define MAC2_FRAME_LENGTH_CHECKING 0x00000002
98#define MAC2_FULL_DUPLEX 0x00000001
101#define IPGT_BACK_TO_BACK_IPG 0x0000007F
102#define IPGT_HALF_DUPLEX 0x00000012
103#define IPGT_FULL_DUPLEX 0x00000015
106#define IPGR_NON_BACK_TO_BACK_IPG1 0x00007F00
107#define IPGR_NON_BACK_TO_BACK_IPG2 0x0000007F
108#define IPGR_DEFAULT_VALUE 0x00000C12
111#define CLRT_COLLISION_WINDOW 0x00003F00
112#define CLRT_RETRANSMISSION_MAXIMUM 0x00003F00
113#define CLRT_DEFAULT_VALUE 0x0000370F
116#define MAXF_MAXIMUM_FRAME_LENGTH 0x0000FFFF
119#define SUPP_SPEED 0x00000100
122#define TEST_BACKPRESSURE 0x00000004
123#define TEST_PAUSE 0x00000002
124#define TEST_SHORTCUT_PAUSE_QUANTA 0x00000001
127#define MCFG_RESET_MII_MGMT 0x00008000
128#define MCFG_CLOCK SELECT 0x0000001C
129#define MCFG_SUPPRESS_PREAMBLE 0x00000002
130#define MCFG_SCAN_INCREMENT 0x00000001
132#define MCFG_CLOCK_SELECT_DIV4 0x00000000
133#define MCFG_CLOCK_SELECT_DIV6 0x00000008
134#define MCFG_CLOCK_SELECT_DIV8 0x0000000C
135#define MCFG_CLOCK_SELECT_DIV10 0x00000010
136#define MCFG_CLOCK_SELECT_DIV14 0x00000014
137#define MCFG_CLOCK_SELECT_DIV20 0x00000018
138#define MCFG_CLOCK_SELECT_DIV28 0x0000001C
141#define MCMD_SCAN 0x00000002
142#define MCMD_READ 0x00000001
145#define MADR_PHY_ADDRESS 0x00001F00
146#define MADR_REGISTER_ADDRESS 0x0000001F
149#define MWTD_WRITE_DATA 0x0000FFFF
152#define MRDD_READ_DATA 0x0000FFFF
155#define MIND_MII_LINK_FAIL 0x00000008
156#define MIND_NOT_VALID 0x00000004
157#define MIND_SCANNING 0x00000002
158#define MIND_BUSY 0x00000001
161#define COMMAND_FULL_DUPLEX 0x00000400
162#define COMMAND_RMII 0x00000200
163#define COMMAND_TX_FLOW_CONTROL 0x00000100
164#define COMMAND_PASS_RX_FILTER 0x00000080
165#define COMMAND_PASS_RUNT_FRAME 0x00000040
166#define COMMAND_RX_RESET 0x00000020
167#define COMMAND_TX_RESET 0x00000010
168#define COMMAND_REG_RESET 0x00000008
169#define COMMAND_TX_ENABLE 0x00000002
170#define COMMAND_RX_ENABLE 0x00000001
173#define STATUS_TX 0x00000002
174#define STATUS_RX 0x00000001
177#define TSV0_VLAN 0x80000000
178#define TSV0_BACKPRESSURE 0x40000000
179#define TSV0_PAUSE 0x20000000
180#define TSV0_CONTROL_FRAME 0x10000000
181#define TSV0_TOTAL_BYTES 0x0FFFF000
182#define TSV0_UNDERRUN 0x00000800
183#define TSV0_GIANT 0x00000400
184#define TSV0_LATE_COLLISION 0x00000200
185#define TSV0_EXCESSIVE_COLLISION 0x00000100
186#define TSV0_EXCESSIVE_DEFER 0x00000080
187#define TSV0_PACKET_DEFER 0x00000040
188#define TSV0_BROADCAST 0x00000020
189#define TSV0_MULTICAST 0x00000010
190#define TSV0_DONE 0x00000008
191#define TSV0_LENGTH_OUT_OF_RANGE 0x00000004
192#define TSV0_LENGTH_CHECK_ERROR 0x00000002
193#define TSV0_CRC_ERROR 0x00000001
196#define TSV1_TRANSMIT_COLLISION_COUNT 0x000F0000
197#define TSV1_TRANSMIT_BYTE_COUNT 0x0000FFFF
200#define RSV_VLAN 0x40000000
201#define RSV_UNSUPPORTED_OPCODE 0x20000000
202#define RSV_PAUSE 0x10000000
203#define RSV_CONTROL_FRAME 0x08000000
204#define RSV_DRIBBLE_NIBBLE 0x04000000
205#define RSV_BROADCAST 0x02000000
206#define RSV_MULTICAST 0x01000000
207#define RSV_RECEIVE_OK 0x00800000
208#define RSV_LENGTH_OUT_OF_RANGE 0x00400000
209#define RSV_LENGTH_CHECK_ERROR 0x00200000
210#define RSV_CRC_ERROR 0x00100000
211#define RSV_RECEIVE_CODE_VIOLATION 0x00080000
212#define RSV_CARRIER_EVENT_PREV_SEEN 0x00040000
213#define RSV_RXDV_EVENT_PREV_SEEN 0x00020000
214#define RSV_PACKET_PREVIOUSLY_IGNORED 0x00010000
215#define RSV_RECEIVED_BYTE_COUNT 0x0000FFFF
218#define FCC_PAUSE_TIMER 0xFFFF0000
219#define FCC_MIRROR_COUNTER 0x0000FFFF
222#define FCS_MIRROR_COUNTER_CURRENT 0x0000FFFF
225#define RFC_RX_FILTER_EN_WOL 0x00002000
226#define RFC_MAGIC_PACKET_EN_WOL 0x00001000
227#define RFC_ACCEPT_PERFECT_EN 0x00000020
228#define RFC_ACCEPT_MULTICAST_HASH_EN 0x00000010
229#define RFC_ACCEPT_UNICAST_HASH_EN 0x00000008
230#define RFC_ACCEPT_MULTICAST_EN 0x00000004
231#define RFC_ACCEPT_BROADCAST_EN 0x00000002
232#define RFC_ACCEPT_UNICAST_EN 0x00000001
235#define RFWS_MAGIC_PACKET_WOL 0x00000100
236#define RFWS_RX_FILTER_WOL 0x00000080
237#define RFWS_ACCEPT_PERFECT_WOL 0x00000020
238#define RFWS_ACCEPT_MULTICAST_HASH_WOL 0x00000010
239#define RFWS_ACCEPT_UNICAST_HASH_WOL 0x00000008
240#define RFWS_ACCEPT_MULTICAST_WOL 0x00000004
241#define RFWS_ACCEPT_BROADCAST_WOL 0x00000002
242#define RFWS_ACCEPT_UNICAST_WOL 0x00000001
245#define INT_WAKEUP 0x00002000
246#define INT_SOFT_INT 0x00001000
247#define INT_TX_DONE 0x00000080
248#define INT_TX_FINISHED 0x00000040
249#define INT_TX_ERROR 0x00000020
250#define INT_TX_UNDERRUN 0x00000010
251#define INT_RX_DONE 0x00000008
252#define INT_RX_FINISHED 0x00000004
253#define INT_RX_ERROR 0x00000002
254#define INT_RX_OVERRUN 0x00000001
257#define TX_CTRL_INTERRUPT 0x80000000
258#define TX_CTRL_LAST 0x40000000
259#define TX_CTRL_CRC 0x20000000
260#define TX_CTRL_PAD 0x10000000
261#define TX_CTRL_HUGE 0x08000000
262#define TX_CTRL_OVERRIDE 0x04000000
263#define TX_CTRL_SIZE 0x000007FF
266#define TX_STATUS_ERROR 0x80000000
267#define TX_STATUS_NO_DESCRIPTOR 0x40000000
268#define TX_STATUS_UNDERRUN 0x20000000
269#define TX_STATUS_LATE_COLLISION 0x10000000
270#define TX_STATUS_EXCESSIVE_COLLISION 0x08000000
271#define TX_STATUS_EXCESSIVE_DEFER 0x04000000
272#define TX_STATUS_DEFER 0x02000000
273#define TX_STATUS_COLLISION_COUNT 0x01E00000
276#define RX_CTRL_INTERRUPT 0x80000000
277#define RX_CTRL_SIZE 0x000007FF
280#define RX_STATUS_ERROR 0x80000000
281#define RX_STATUS_LAST_FLAG 0x40000000
282#define RX_STATUS_NO_DESCRIPTOR 0x20000000
283#define RX_STATUS_OVERRUN 0x10000000
284#define RX_STATUS_ALIGNMENT_ERROR 0x08000000
285#define RX_STATUS_RANGE_ERROR 0x04000000
286#define RX_STATUS_LENGTH_ERROR 0x02000000
287#define RX_STATUS_SYMBOL_ERROR 0x01000000
288#define RX_STATUS_CRC_ERROR 0x00800000
289#define RX_STATUS_BROADCAST 0x00400000
290#define RX_STATUS_MULTICAST 0x00200000
291#define RX_STATUS_FAIL_FILTER 0x00100000
292#define RX_STATUS_VLAN 0x00080000
293#define RX_STATUS_CONTROL_FRAME 0x00040000
294#define RX_STATUS_SIZE 0x000007FF
297#define RX_HASH_CRC_DA 0x001FF000
298#define RX_HASH_CRC_SA 0x000001FF
353error_t lpc23xxEthInit(NetInterface *interface);
354void lpc23xxEthInitGpio(NetInterface *interface);
355void lpc23xxEthInitDesc(NetInterface *interface);
357void lpc23xxEthTick(NetInterface *interface);
359void lpc23xxEthEnableIrq(NetInterface *interface);
360void lpc23xxEthDisableIrq(NetInterface *interface);
361__irq
void lpc23xxEthIrqHandler(
void);
362void lpc23xxEthEventHandler(NetInterface *interface);
364error_t lpc23xxEthSendPacket(NetInterface *interface,
365 const NetBuffer *buffer,
size_t offset, NetTxAncillary *ancillary);
367error_t lpc23xxEthReceivePacket(NetInterface *interface);
369error_t lpc23xxEthUpdateMacAddrFilter(NetInterface *interface);
370error_t lpc23xxEthUpdateMacConfig(NetInterface *interface);
372void lpc23xxEthWritePhyReg(uint8_t opcode, uint8_t phyAddr,
373 uint8_t regAddr, uint16_t data);
375uint16_t lpc23xxEthReadPhyReg(uint8_t opcode, uint8_t phyAddr,
378uint32_t lpc23xxEthCalcCrc(
const void *data,
size_t length);
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
Receive descriptor.
Definition lpc23xx_eth_driver.h:332
Receive status.
Definition lpc23xx_eth_driver.h:343
Transmit descriptor.
Definition lpc23xx_eth_driver.h:311
Transmit status.
Definition lpc23xx_eth_driver.h:322
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283