Go to the documentation of this file.
31 #ifndef _STR912_ETH_DRIVER_H
32 #define _STR912_ETH_DRIVER_H
38 #ifndef STR912_ETH_TX_BUFFER_COUNT
39 #define STR912_ETH_TX_BUFFER_COUNT 2
40 #elif (STR912_ETH_TX_BUFFER_COUNT < 1)
41 #error STR912_ETH_TX_BUFFER_COUNT parameter is not valid
45 #ifndef STR912_ETH_TX_BUFFER_SIZE
46 #define STR912_ETH_TX_BUFFER_SIZE 1536
47 #elif (STR912_ETH_TX_BUFFER_SIZE != 1536)
48 #error STR912_ETH_TX_BUFFER_SIZE parameter is not valid
52 #ifndef STR912_ETH_RX_BUFFER_COUNT
53 #define STR912_ETH_RX_BUFFER_COUNT 4
54 #elif (STR912_ETH_RX_BUFFER_COUNT < 1)
55 #error STR912_ETH_RX_BUFFER_COUNT parameter is not valid
59 #ifndef STR912_ETH_RX_BUFFER_SIZE
60 #define STR912_ETH_RX_BUFFER_SIZE 1536
61 #elif (STR912_ETH_RX_BUFFER_SIZE != 1536)
62 #error STR912_ETH_RX_BUFFER_SIZE parameter is not valid
66 #ifndef STR912_ETH_IRQ_PRIORITY
67 #define STR912_ETH_IRQ_PRIORITY 15
68 #elif (STR912_ETH_IRQ_PRIORITY < 0)
69 #error STR912_ETH_IRQ_PRIORITY parameter is not valid
73 #define ENET_SCR_TX_FIFO_SIZE 0xF0000000
74 #define ENET_SCR_TX_IO_DATA_WIDTH 0x0C000000
75 #define ENET_SCR_TX_CHAN_STATUS 0x03000000
76 #define ENET_SCR_RX_FIFO_SIZE 0x00F00000
77 #define ENET_SCR_RX_IO_DATA_WIDTH 0x000C0000
78 #define ENET_SCR_RX_CHAN_STATUS 0x00030000
79 #define ENET_SCR_TX_MAX_BURST_SIZE 0x000000C0
80 #define ENET_SCR_RX_MAX_BURST_SIZE 0x00000030
81 #define ENET_SCR_LOOPB 0x00000002
82 #define ENET_SCR_SRESET 0x00000001
85 #define ENET_IER_TX_CURR_DONE_EN 0x80000000
86 #define ENET_IER_MAC_802_3_INT_EN 0x10000000
87 #define ENET_IER_TX_MERR_INT_EN 0x02000000
88 #define ENET_IER_TX_DONE_EN 0x00800000
89 #define ENET_IER_TX_NEXT_EN 0x00400000
90 #define ENET_IER_TX_TO_EN 0x00080000
91 #define ENET_IER_TX_ENTRY_EN 0x00040000
92 #define ENET_IER_TX_FULL_EN 0x00020000
93 #define ENET_IER_TX_EMPTY_EN 0x00010000
94 #define ENET_IER_RX_CURR_DONE_EN 0x00008000
95 #define ENET_IER_RX_MERR_INT_EN 0x00000200
96 #define ENET_IER_RX_DONE_EN 0x00000080
97 #define ENET_IER_RX_NEXT_EN 0x00000040
98 #define ENET_IER_PACKET_LOST_EN 0x00000020
99 #define ENET_IER_RX_TO_EN 0x00000008
100 #define ENET_IER_RX_ENTRY_EN 0x00000004
101 #define ENET_IER_RX_FULL_EN 0x00000002
102 #define ENET_IER_RX_EMPTY_EN 0x00000001
105 #define ENET_ISR_TX_CURR_DONE 0x80000000
106 #define ENET_ISR_MAC_802_3_INT 0x10000000
107 #define ENET_ISR_TX_MERR_INT 0x02000000
108 #define ENET_ISR_TX_DONE 0x00800000
109 #define ENET_ISR_TX_NEXT 0x00400000
110 #define ENET_ISR_TX_TO 0x00080000
111 #define ENET_ISR_TX_ENTRY 0x00040000
112 #define ENET_ISR_TX_FULL 0x00020000
113 #define ENET_ISR_TX_EMPTY 0x00010000
114 #define ENET_ISR_RX_CURR_DONE 0x00008000
115 #define ENET_ISR_RX_MERR_INT 0x00000200
116 #define ENET_ISR_RX_DONE 0x00000080
117 #define ENET_ISR_RX_NEXT 0x00000040
118 #define ENET_ISR_PACKET_LOST 0x00000020
119 #define ENET_ISR_RX_TO 0x00000008
120 #define ENET_ISR_RX_ENTRY 0x00000004
121 #define ENET_ISR_RX_FULL 0x00000002
122 #define ENET_ISR_RX_EMPTY 0x00000001
125 #define ENET_CCR_SEL_CLK 0x0000000C
127 #define ENET_CCR_SEL_CLK_0 0x00000000
128 #define ENET_CCR_SEL_CLK_1 0x00000004
131 #define ENET_RXSTR_DFETCH_DLY 0x00FFFF00
132 #define ENET_RXSTR_COLL_SEEN 0x00000080
133 #define ENET_RXSTR_RUNT_FRAME 0x00000040
134 #define ENET_RXSTR_FILTER_FAIL 0x00000020
135 #define ENET_RXSTR_START_FETCH 0x00000004
136 #define ENET_RXSTR_DMA_EN 0x00000001
138 #define ENET_RXSTR_DFETCH_DLY_DEFAULT 0x00800000
141 #define ENET_TXSTR_DFETCH_DLY 0x00FFFF00
142 #define ENET_TXSTR_UNDER_RUN 0x00000020
143 #define ENET_TXSTR_START_FETCH 0x00000004
144 #define ENET_TXSTR_DMA_EN 0x00000001
146 #define ENET_TXSTR_DFETCH_DLY_DEFAULT 0x00800000
149 #define ENET_MCR_RA 0x80000000
150 #define ENET_MCR_EN 0x40000000
151 #define ENET_MCR_PS 0x03000000
152 #define ENET_MCR_DRO 0x00800000
153 #define ENET_MCR_LM 0x00600000
154 #define ENET_MCR_FDM 0x00100000
155 #define ENET_MCR_AFM 0x000E0000
156 #define ENET_MCR_PWF 0x00010000
157 #define ENET_MCR_VFM 0x00008000
158 #define ENET_MCR_ELC 0x00001000
159 #define ENET_MCR_DBF 0x00000800
160 #define ENET_MCR_DPR 0x00000400
161 #define ENET_MCR_RVFF 0x00000200
162 #define ENET_MCR_APR 0x00000100
163 #define ENET_MCR_BL 0x000000C0
164 #define ENET_MCR_DCE 0x00000020
165 #define ENET_MCR_RVBE 0x00000010
166 #define ENET_MCR_TE 0x00000008
167 #define ENET_MCR_RE 0x00000004
168 #define ENET_MCR_RCFA 0x00000001
170 #define ENET_MCR_PS_0 0x00000000
171 #define ENET_MCR_PS_1 0x01000000
173 #define ENET_MCR_AFM_0 0x00000000
174 #define ENET_MCR_AFM_1 0x00020000
175 #define ENET_MCR_AFM_2 0x00040000
176 #define ENET_MCR_AFM_3 0x00060000
177 #define ENET_MCR_AFM_4 0x00080000
178 #define ENET_MCR_AFM_5 0x000A0000
179 #define ENET_MCR_AFM_6 0x000C0000
180 #define ENET_MCR_AFM_7 0x000E0000
182 #define ENET_MCR_BL_0 0x00000000
183 #define ENET_MCR_BL_1 0x00000040
184 #define ENET_MCR_BL_2 0x00000080
185 #define ENET_MCR_BL_3 0x000000C0
188 #define ENET_MIIA_PADDR 0x0000F800
189 #define ENET_MIIA_RADDR 0x000007C0
190 #define ENET_MIIA_PR 0x00000004
191 #define ENET_MIIA_WR 0x00000002
192 #define ENET_MIIA_BUSY 0x00000001
195 #define ENET_MIID_RDATA 0x0000FFFF
198 #define ENET_TDES_CTRL_DLY_EN 0x00008000
199 #define ENET_TDES_CTRL_NXT_EN 0x00004000
200 #define ENET_TDES_CTRL_CONT_EN 0x00001000
201 #define ENET_TDES_CTRL_FL 0x00000FFF
204 #define ENET_TDES_START_ADDR 0xFFFFFFFC
205 #define ENET_TDES_START_FIX_ADDR 0x00000002
206 #define ENET_TDES_START_WRAP_EN 0x00000001
209 #define ENET_TDES_NEXT_ADDR 0xFFFFFFFC
210 #define ENET_TDES_NEXT_NPOL_EN 0x00000001
213 #define ENET_TDES_STATUS_PR 0x80000000
214 #define ENET_TDES_STATUS_BC 0x7FFC0000
215 #define ENET_TDES_STATUS_VALID 0x00010000
216 #define ENET_TDES_STATUS_CC 0x00003C00
217 #define ENET_TDES_STATUS_LCO 0x00000200
218 #define ENET_TDES_STATUS_DEF 0x00000100
219 #define ENET_TDES_STATUS_UR 0x00000080
220 #define ENET_TDES_STATUS_EC 0x00000040
221 #define ENET_TDES_STATUS_LC 0x00000020
222 #define ENET_TDES_STATUS_ED 0x00000010
223 #define ENET_TDES_STATUS_LOC 0x00000008
224 #define ENET_TDES_STATUS_NC 0x00000004
225 #define ENET_TDES_STATUS_FA 0x00000001
228 #define ENET_RDES_CTRL_DLY_EN 0x00008000
229 #define ENET_RDES_CTRL_NXT_EN 0x00004000
230 #define ENET_RDES_CTRL_CONT_EN 0x00001000
231 #define ENET_RDES_CTRL_FL 0x00000FFF
234 #define ENET_RDES_START_ADDR 0xFFFFFFFC
235 #define ENET_RDES_START_FIX_ADDR 0x00000002
236 #define ENET_RDES_START_WRAP_EN 0x00000001
239 #define ENET_RDES_NEXT_ADDR 0xFFFFFFFC
240 #define ENET_RDES_NEXT_NPOL_EN 0x00000001
243 #define ENET_RDES_STATUS_FA 0x80000000
244 #define ENET_RDES_STATUS_PF 0x40000000
245 #define ENET_RDES_STATUS_FF 0x20000000
246 #define ENET_RDES_STATUS_BF 0x10000000
247 #define ENET_RDES_STATUS_MCF 0x08000000
248 #define ENET_RDES_STATUS_UCF 0x04000000
249 #define ENET_RDES_STATUS_CF 0x02000000
250 #define ENET_RDES_STATUS_LE 0x01000000
251 #define ENET_RDES_STATUS_VL2 0x00800000
252 #define ENET_RDES_STATUS_VL1 0x00400000
253 #define ENET_RDES_STATUS_CE 0x00200000
254 #define ENET_RDES_STATUS_EB 0x00100000
255 #define ENET_RDES_STATUS_ME 0x00080000
256 #define ENET_RDES_STATUS_FT 0x00040000
257 #define ENET_RDES_STATUS_LC 0x00020000
258 #define ENET_RDES_STATUS_VALID 0x00010000
259 #define ENET_RDES_STATUS_RF 0x00008000
260 #define ENET_RDES_STATUS_WT 0x00004000
261 #define ENET_RDES_STATUS_FCI 0x00002000
262 #define ENET_RDES_STATUS_OL 0x00001000
263 #define ENET_RDES_STATUS_FL 0x000007FF
266 #define ENET_RDES_STATUS_ERROR (ENET_RDES_STATUS_FA | \
267 ENET_RDES_STATUS_LE | ENET_RDES_STATUS_CE | \
268 ENET_RDES_STATUS_EB | ENET_RDES_STATUS_ME | \
269 ENET_RDES_STATUS_LC | ENET_RDES_STATUS_RF | \
270 ENET_RDES_STATUS_WT | ENET_RDES_STATUS_OL)
error_t str912EthReceivePacket(NetInterface *interface)
Receive a packet.
void str912EthTick(NetInterface *interface)
STR912 Ethernet MAC timer handler.
void str912EthWritePhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
Write PHY register.
Structure describing a buffer that spans multiple chunks.
error_t str912EthInit(NetInterface *interface)
STR912 Ethernet MAC initialization.
void str912EthEventHandler(NetInterface *interface)
STR912 Ethernet MAC event handler.
error_t str912EthSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
const NicDriver str912EthDriver
STR912 Ethernet MAC driver.
uint16_t str912EthReadPhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
Read PHY register.
uint32_t str912EthCalcCrc(const void *data, size_t length)
CRC calculation.
void str912EthInitGpio(NetInterface *interface)
GPIO configuration.
void str912EthInitDmaDesc(NetInterface *interface)
Initialize DMA descriptor lists.
void str912EthDisableIrq(NetInterface *interface)
Disable interrupts.
Network interface controller abstraction layer.
void str912EthEnableIrq(NetInterface *interface)
Enable interrupts.
error_t str912EthUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
error_t str912EthUpdateMacConfig(NetInterface *interface)
Adjust MAC configuration parameters for proper operation.