Go to the documentation of this file.
31 #ifndef _LPC43XX_ETH_DRIVER_H
32 #define _LPC43XX_ETH_DRIVER_H
38 #ifndef LPC43XX_ETH_TX_BUFFER_COUNT
39 #define LPC43XX_ETH_TX_BUFFER_COUNT 3
40 #elif (LPC43XX_ETH_TX_BUFFER_COUNT < 1)
41 #error LPC43XX_ETH_TX_BUFFER_COUNT parameter is not valid
45 #ifndef LPC43XX_ETH_TX_BUFFER_SIZE
46 #define LPC43XX_ETH_TX_BUFFER_SIZE 1536
47 #elif (LPC43XX_ETH_TX_BUFFER_SIZE != 1536)
48 #error LPC43XX_ETH_TX_BUFFER_SIZE parameter is not valid
52 #ifndef LPC43XX_ETH_RX_BUFFER_COUNT
53 #define LPC43XX_ETH_RX_BUFFER_COUNT 6
54 #elif (LPC43XX_ETH_RX_BUFFER_COUNT < 1)
55 #error LPC43XX_ETH_RX_BUFFER_COUNT parameter is not valid
59 #ifndef LPC43XX_ETH_RX_BUFFER_SIZE
60 #define LPC43XX_ETH_RX_BUFFER_SIZE 1536
61 #elif (LPC43XX_ETH_RX_BUFFER_SIZE != 1536)
62 #error LPC43XX_ETH_RX_BUFFER_SIZE parameter is not valid
66 #ifndef LPC43XX_ETH_IRQ_PRIORITY_GROUPING
67 #define LPC43XX_ETH_IRQ_PRIORITY_GROUPING 4
68 #elif (LPC43XX_ETH_IRQ_PRIORITY_GROUPING < 0)
69 #error LPC43XX_ETH_IRQ_PRIORITY_GROUPING parameter is not valid
73 #ifndef LPC43XX_ETH_IRQ_GROUP_PRIORITY
74 #define LPC43XX_ETH_IRQ_GROUP_PRIORITY 6
75 #elif (LPC43XX_ETH_IRQ_GROUP_PRIORITY < 0)
76 #error LPC43XX_ETH_IRQ_GROUP_PRIORITY parameter is not valid
80 #ifndef LPC43XX_ETH_IRQ_SUB_PRIORITY
81 #define LPC43XX_ETH_IRQ_SUB_PRIORITY 0
82 #elif (LPC43XX_ETH_IRQ_SUB_PRIORITY < 0)
83 #error LPC43XX_ETH_IRQ_SUB_PRIORITY parameter is not valid
87 #define CREG6_ETHMODE_MII (0 << CREG_CREG6_ETHMODE_Pos)
88 #define CREG6_ETHMODE_RMII (4 << CREG_CREG6_ETHMODE_Pos)
91 #define ETHERNET_MAC_MII_ADDR_CR_DIV42 (0 << ETHERNET_MAC_MII_ADDR_CR_Pos)
92 #define ETHERNET_MAC_MII_ADDR_CR_DIV62 (1 << ETHERNET_MAC_MII_ADDR_CR_Pos)
93 #define ETHERNET_MAC_MII_ADDR_CR_DIV16 (2 << ETHERNET_MAC_MII_ADDR_CR_Pos)
94 #define ETHERNET_MAC_MII_ADDR_CR_DIV26 (3 << ETHERNET_MAC_MII_ADDR_CR_Pos)
95 #define ETHERNET_MAC_MII_ADDR_CR_DIV102 (4 << ETHERNET_MAC_MII_ADDR_CR_Pos)
96 #define ETHERNET_MAC_MII_ADDR_CR_DIV124 (5 << ETHERNET_MAC_MII_ADDR_CR_Pos)
99 #define ETHERNET_DMA_BUS_MODE_RPBL_1 (1 << ETHERNET_DMA_BUS_MODE_RPBL_Pos)
100 #define ETHERNET_DMA_BUS_MODE_RPBL_2 (2 << ETHERNET_DMA_BUS_MODE_RPBL_Pos)
101 #define ETHERNET_DMA_BUS_MODE_RPBL_4 (4 << ETHERNET_DMA_BUS_MODE_RPBL_Pos)
102 #define ETHERNET_DMA_BUS_MODE_RPBL_8 (8 << ETHERNET_DMA_BUS_MODE_RPBL_Pos)
103 #define ETHERNET_DMA_BUS_MODE_RPBL_16 (16 << ETHERNET_DMA_BUS_MODE_RPBL_Pos)
104 #define ETHERNET_DMA_BUS_MODE_RPBL_32 (32 << ETHERNET_DMA_BUS_MODE_RPBL_Pos)
106 #define ETHERNET_DMA_BUS_MODE_PR_1_1 (0 << ETHERNET_DMA_BUS_MODE_PR_Pos)
107 #define ETHERNET_DMA_BUS_MODE_PR_2_1 (1 << ETHERNET_DMA_BUS_MODE_PR_Pos)
108 #define ETHERNET_DMA_BUS_MODE_PR_3_1 (2 << ETHERNET_DMA_BUS_MODE_PR_Pos)
109 #define ETHERNET_DMA_BUS_MODE_PR_4_1 (3 << ETHERNET_DMA_BUS_MODE_PR_Pos)
111 #define ETHERNET_DMA_BUS_MODE_PBL_1 (1 << ETHERNET_DMA_BUS_MODE_PBL_Pos)
112 #define ETHERNET_DMA_BUS_MODE_PBL_2 (2 << ETHERNET_DMA_BUS_MODE_PBL_Pos)
113 #define ETHERNET_DMA_BUS_MODE_PBL_4 (4 << ETHERNET_DMA_BUS_MODE_PBL_Pos)
114 #define ETHERNET_DMA_BUS_MODE_PBL_8 (8 << ETHERNET_DMA_BUS_MODE_PBL_Pos)
115 #define ETHERNET_DMA_BUS_MODE_PBL_16 (16 << ETHERNET_DMA_BUS_MODE_PBL_Pos)
116 #define ETHERNET_DMA_BUS_MODE_PBL_32 (32 << ETHERNET_DMA_BUS_MODE_PBL_Pos)
119 #define ETHERNET_DMA_OP_MODE_TTC_64 (0 << ETHERNET_DMA_OP_MODE_TTC_Pos)
120 #define ETHERNET_DMA_OP_MODE_TTC_128 (1 << ETHERNET_DMA_OP_MODE_TTC_Pos)
121 #define ETHERNET_DMA_OP_MODE_TTC_192 (2 << ETHERNET_DMA_OP_MODE_TTC_Pos)
122 #define ETHERNET_DMA_OP_MODE_TTC_256 (3 << ETHERNET_DMA_OP_MODE_TTC_Pos)
123 #define ETHERNET_DMA_OP_MODE_TTC_40 (4 << ETHERNET_DMA_OP_MODE_TTC_Pos)
124 #define ETHERNET_DMA_OP_MODE_TTC_32 (5 << ETHERNET_DMA_OP_MODE_TTC_Pos)
125 #define ETHERNET_DMA_OP_MODE_TTC_24 (6 << ETHERNET_DMA_OP_MODE_TTC_Pos)
126 #define ETHERNET_DMA_OP_MODE_TTC_16 (7 << ETHERNET_DMA_OP_MODE_TTC_Pos)
128 #define ETHERNET_DMA_OP_MODE_RTC_64 (0 << ETHERNET_DMA_OP_MODE_RTC_Pos)
129 #define ETHERNET_DMA_OP_MODE_RTC_32 (1 << ETHERNET_DMA_OP_MODE_RTC_Pos)
130 #define ETHERNET_DMA_OP_MODE_RTC_96 (2 << ETHERNET_DMA_OP_MODE_RTC_Pos)
131 #define ETHERNET_DMA_OP_MODE_RTC_128 (3 << ETHERNET_DMA_OP_MODE_RTC_Pos)
134 #define ETH_TDES0_OWN 0x80000000
135 #define ETH_TDES0_IC 0x40000000
136 #define ETH_TDES0_LS 0x20000000
137 #define ETH_TDES0_FS 0x10000000
138 #define ETH_TDES0_DC 0x08000000
139 #define ETH_TDES0_DP 0x04000000
140 #define ETH_TDES0_TTSE 0x02000000
141 #define ETH_TDES0_TER 0x00200000
142 #define ETH_TDES0_TCH 0x00100000
143 #define ETH_TDES0_TTSS 0x00020000
144 #define ETH_TDES0_IHE 0x00010000
145 #define ETH_TDES0_ES 0x00008000
146 #define ETH_TDES0_JT 0x00004000
147 #define ETH_TDES0_FF 0x00002000
148 #define ETH_TDES0_IPE 0x00001000
149 #define ETH_TDES0_LCA 0x00000800
150 #define ETH_TDES0_NC 0x00000400
151 #define ETH_TDES0_LCO 0x00000200
152 #define ETH_TDES0_EC 0x00000100
153 #define ETH_TDES0_VF 0x00000080
154 #define ETH_TDES0_CC 0x00000078
155 #define ETH_TDES0_ED 0x00000004
156 #define ETH_TDES0_UF 0x00000002
157 #define ETH_TDES0_DB 0x00000001
158 #define ETH_TDES1_TBS2 0x1FFF0000
159 #define ETH_TDES1_TBS1 0x00001FFF
160 #define ETH_TDES2_B1ADD 0xFFFFFFFF
161 #define ETH_TDES3_B2ADD 0xFFFFFFFF
162 #define ETH_TDES6_TTSL 0xFFFFFFFF
163 #define ETH_TDES7_TTSH 0xFFFFFFFF
166 #define ETH_RDES0_OWN 0x80000000
167 #define ETH_RDES0_AFM 0x40000000
168 #define ETH_RDES0_FL 0x3FFF0000
169 #define ETH_RDES0_ES 0x00008000
170 #define ETH_RDES0_DE 0x00004000
171 #define ETH_RDES0_SAF 0x00002000
172 #define ETH_RDES0_LE 0x00001000
173 #define ETH_RDES0_OE 0x00000800
174 #define ETH_RDES0_VLAN 0x00000400
175 #define ETH_RDES0_FS 0x00000200
176 #define ETH_RDES0_LS 0x00000100
177 #define ETH_RDES0_TSA 0x00000080
178 #define ETH_RDES0_LCO 0x00000040
179 #define ETH_RDES0_FT 0x00000020
180 #define ETH_RDES0_RWT 0x00000010
181 #define ETH_RDES0_RE 0x00000008
182 #define ETH_RDES0_DBE 0x00000004
183 #define ETH_RDES0_CE 0x00000002
184 #define ETH_RDES0_ESA 0x00000001
185 #define ETH_RDES1_RBS2 0x1FFF0000
186 #define ETH_RDES1_RER 0x00008000
187 #define ETH_RDES1_RCH 0x00004000
188 #define ETH_RDES1_RBS1 0x00001FFF
189 #define ETH_RDES2_B1ADD 0xFFFFFFFF
190 #define ETH_RDES3_B2ADD 0xFFFFFFFF
191 #define ETH_RDES4_PTPVERSION 0x00002000
192 #define ETH_RDES4_PTPTYPE 0x00001000
193 #define ETH_RDES4_MT 0x00000F00
194 #define ETH_RDES4_IPV6 0x00000080
195 #define ETH_RDES4_IPV4 0x00000040
196 #define ETH_RDES6_RTSL 0xFFFFFFFF
197 #define ETH_RDES7_RTSH 0xFFFFFFFF
void lpc43xxEthInitDmaDesc(NetInterface *interface)
Initialize DMA descriptor lists.
Structure describing a buffer that spans multiple chunks.
error_t lpc43xxEthReceivePacket(NetInterface *interface)
Receive a packet.
const NicDriver lpc43xxEthDriver
LPC43xx Ethernet MAC driver.
error_t lpc43xxEthInit(NetInterface *interface)
LPC43xx Ethernet MAC initialization.
void lpc43xxEthInitGpio(NetInterface *interface)
GPIO configuration.
void lpc43xxEthWritePhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
Write PHY register.
error_t lpc43xxEthUpdateMacConfig(NetInterface *interface)
Adjust MAC configuration parameters for proper operation.
error_t lpc43xxEthUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
error_t lpc43xxEthSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
void lpc43xxEthTick(NetInterface *interface)
LPC43xx Ethernet MAC timer handler.
uint32_t lpc43xxEthCalcCrc(const void *data, size_t length)
CRC calculation.
Enhanced RX DMA descriptor.
void lpc43xxEthEnableIrq(NetInterface *interface)
Enable interrupts.
Network interface controller abstraction layer.
Enhanced TX DMA descriptor.
uint16_t lpc43xxEthReadPhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
Read PHY register.
void lpc43xxEthDisableIrq(NetInterface *interface)
Disable interrupts.
void lpc43xxEthEventHandler(NetInterface *interface)
LPC43xx Ethernet MAC event handler.