37 #ifndef __STM32F4xx_HAL_ETH_H
38 #define __STM32F4xx_HAL_ETH_H
44 #if defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) ||\
45 defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F469xx) || defined(STM32F479xx)
60 #define IS_ETH_PHY_ADDRESS(ADDRESS) ((ADDRESS) <= 0x20U)
61 #define IS_ETH_AUTONEGOTIATION(CMD) (((CMD) == ETH_AUTONEGOTIATION_ENABLE) || \
62 ((CMD) == ETH_AUTONEGOTIATION_DISABLE))
63 #define IS_ETH_SPEED(SPEED) (((SPEED) == ETH_SPEED_10M) || \
64 ((SPEED) == ETH_SPEED_100M))
65 #define IS_ETH_DUPLEX_MODE(MODE) (((MODE) == ETH_MODE_FULLDUPLEX) || \
66 ((MODE) == ETH_MODE_HALFDUPLEX))
67 #define IS_ETH_RX_MODE(MODE) (((MODE) == ETH_RXPOLLING_MODE) || \
68 ((MODE) == ETH_RXINTERRUPT_MODE))
69 #define IS_ETH_CHECKSUM_MODE(MODE) (((MODE) == ETH_CHECKSUM_BY_HARDWARE) || \
70 ((MODE) == ETH_CHECKSUM_BY_SOFTWARE))
71 #define IS_ETH_MEDIA_INTERFACE(MODE) (((MODE) == ETH_MEDIA_INTERFACE_MII) || \
72 ((MODE) == ETH_MEDIA_INTERFACE_RMII))
73 #define IS_ETH_WATCHDOG(CMD) (((CMD) == ETH_WATCHDOG_ENABLE) || \
74 ((CMD) == ETH_WATCHDOG_DISABLE))
75 #define IS_ETH_JABBER(CMD) (((CMD) == ETH_JABBER_ENABLE) || \
76 ((CMD) == ETH_JABBER_DISABLE))
77 #define IS_ETH_INTER_FRAME_GAP(GAP) (((GAP) == ETH_INTERFRAMEGAP_96BIT) || \
78 ((GAP) == ETH_INTERFRAMEGAP_88BIT) || \
79 ((GAP) == ETH_INTERFRAMEGAP_80BIT) || \
80 ((GAP) == ETH_INTERFRAMEGAP_72BIT) || \
81 ((GAP) == ETH_INTERFRAMEGAP_64BIT) || \
82 ((GAP) == ETH_INTERFRAMEGAP_56BIT) || \
83 ((GAP) == ETH_INTERFRAMEGAP_48BIT) || \
84 ((GAP) == ETH_INTERFRAMEGAP_40BIT))
85 #define IS_ETH_CARRIER_SENSE(CMD) (((CMD) == ETH_CARRIERSENCE_ENABLE) || \
86 ((CMD) == ETH_CARRIERSENCE_DISABLE))
87 #define IS_ETH_RECEIVE_OWN(CMD) (((CMD) == ETH_RECEIVEOWN_ENABLE) || \
88 ((CMD) == ETH_RECEIVEOWN_DISABLE))
89 #define IS_ETH_LOOPBACK_MODE(CMD) (((CMD) == ETH_LOOPBACKMODE_ENABLE) || \
90 ((CMD) == ETH_LOOPBACKMODE_DISABLE))
91 #define IS_ETH_CHECKSUM_OFFLOAD(CMD) (((CMD) == ETH_CHECKSUMOFFLAOD_ENABLE) || \
92 ((CMD) == ETH_CHECKSUMOFFLAOD_DISABLE))
93 #define IS_ETH_RETRY_TRANSMISSION(CMD) (((CMD) == ETH_RETRYTRANSMISSION_ENABLE) || \
94 ((CMD) == ETH_RETRYTRANSMISSION_DISABLE))
95 #define IS_ETH_AUTOMATIC_PADCRC_STRIP(CMD) (((CMD) == ETH_AUTOMATICPADCRCSTRIP_ENABLE) || \
96 ((CMD) == ETH_AUTOMATICPADCRCSTRIP_DISABLE))
97 #define IS_ETH_BACKOFF_LIMIT(LIMIT) (((LIMIT) == ETH_BACKOFFLIMIT_10) || \
98 ((LIMIT) == ETH_BACKOFFLIMIT_8) || \
99 ((LIMIT) == ETH_BACKOFFLIMIT_4) || \
100 ((LIMIT) == ETH_BACKOFFLIMIT_1))
101 #define IS_ETH_DEFERRAL_CHECK(CMD) (((CMD) == ETH_DEFFERRALCHECK_ENABLE) || \
102 ((CMD) == ETH_DEFFERRALCHECK_DISABLE))
103 #define IS_ETH_RECEIVE_ALL(CMD) (((CMD) == ETH_RECEIVEALL_ENABLE) || \
104 ((CMD) == ETH_RECEIVEAll_DISABLE))
105 #define IS_ETH_SOURCE_ADDR_FILTER(CMD) (((CMD) == ETH_SOURCEADDRFILTER_NORMAL_ENABLE) || \
106 ((CMD) == ETH_SOURCEADDRFILTER_INVERSE_ENABLE) || \
107 ((CMD) == ETH_SOURCEADDRFILTER_DISABLE))
108 #define IS_ETH_CONTROL_FRAMES(PASS) (((PASS) == ETH_PASSCONTROLFRAMES_BLOCKALL) || \
109 ((PASS) == ETH_PASSCONTROLFRAMES_FORWARDALL) || \
110 ((PASS) == ETH_PASSCONTROLFRAMES_FORWARDPASSEDADDRFILTER))
111 #define IS_ETH_BROADCAST_FRAMES_RECEPTION(CMD) (((CMD) == ETH_BROADCASTFRAMESRECEPTION_ENABLE) || \
112 ((CMD) == ETH_BROADCASTFRAMESRECEPTION_DISABLE))
113 #define IS_ETH_DESTINATION_ADDR_FILTER(FILTER) (((FILTER) == ETH_DESTINATIONADDRFILTER_NORMAL) || \
114 ((FILTER) == ETH_DESTINATIONADDRFILTER_INVERSE))
115 #define IS_ETH_PROMISCUOUS_MODE(CMD) (((CMD) == ETH_PROMISCUOUS_MODE_ENABLE) || \
116 ((CMD) == ETH_PROMISCUOUS_MODE_DISABLE))
117 #define IS_ETH_MULTICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE) || \
118 ((FILTER) == ETH_MULTICASTFRAMESFILTER_HASHTABLE) || \
119 ((FILTER) == ETH_MULTICASTFRAMESFILTER_PERFECT) || \
120 ((FILTER) == ETH_MULTICASTFRAMESFILTER_NONE))
121 #define IS_ETH_UNICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_UNICASTFRAMESFILTER_PERFECTHASHTABLE) || \
122 ((FILTER) == ETH_UNICASTFRAMESFILTER_HASHTABLE) || \
123 ((FILTER) == ETH_UNICASTFRAMESFILTER_PERFECT))
124 #define IS_ETH_PAUSE_TIME(TIME) ((TIME) <= 0xFFFFU)
125 #define IS_ETH_ZEROQUANTA_PAUSE(CMD) (((CMD) == ETH_ZEROQUANTAPAUSE_ENABLE) || \
126 ((CMD) == ETH_ZEROQUANTAPAUSE_DISABLE))
127 #define IS_ETH_PAUSE_LOW_THRESHOLD(THRESHOLD) (((THRESHOLD) == ETH_PAUSELOWTHRESHOLD_MINUS4) || \
128 ((THRESHOLD) == ETH_PAUSELOWTHRESHOLD_MINUS28) || \
129 ((THRESHOLD) == ETH_PAUSELOWTHRESHOLD_MINUS144) || \
130 ((THRESHOLD) == ETH_PAUSELOWTHRESHOLD_MINUS256))
131 #define IS_ETH_UNICAST_PAUSE_FRAME_DETECT(CMD) (((CMD) == ETH_UNICASTPAUSEFRAMEDETECT_ENABLE) || \
132 ((CMD) == ETH_UNICASTPAUSEFRAMEDETECT_DISABLE))
133 #define IS_ETH_RECEIVE_FLOWCONTROL(CMD) (((CMD) == ETH_RECEIVEFLOWCONTROL_ENABLE) || \
134 ((CMD) == ETH_RECEIVEFLOWCONTROL_DISABLE))
135 #define IS_ETH_TRANSMIT_FLOWCONTROL(CMD) (((CMD) == ETH_TRANSMITFLOWCONTROL_ENABLE) || \
136 ((CMD) == ETH_TRANSMITFLOWCONTROL_DISABLE))
137 #define IS_ETH_VLAN_TAG_COMPARISON(COMPARISON) (((COMPARISON) == ETH_VLANTAGCOMPARISON_12BIT) || \
138 ((COMPARISON) == ETH_VLANTAGCOMPARISON_16BIT))
139 #define IS_ETH_VLAN_TAG_IDENTIFIER(IDENTIFIER) ((IDENTIFIER) <= 0xFFFFU)
140 #define IS_ETH_MAC_ADDRESS0123(ADDRESS) (((ADDRESS) == ETH_MAC_ADDRESS0) || \
141 ((ADDRESS) == ETH_MAC_ADDRESS1) || \
142 ((ADDRESS) == ETH_MAC_ADDRESS2) || \
143 ((ADDRESS) == ETH_MAC_ADDRESS3))
144 #define IS_ETH_MAC_ADDRESS123(ADDRESS) (((ADDRESS) == ETH_MAC_ADDRESS1) || \
145 ((ADDRESS) == ETH_MAC_ADDRESS2) || \
146 ((ADDRESS) == ETH_MAC_ADDRESS3))
147 #define IS_ETH_MAC_ADDRESS_FILTER(FILTER) (((FILTER) == ETH_MAC_ADDRESSFILTER_SA) || \
148 ((FILTER) == ETH_MAC_ADDRESSFILTER_DA))
149 #define IS_ETH_MAC_ADDRESS_MASK(MASK) (((MASK) == ETH_MAC_ADDRESSMASK_BYTE6) || \
150 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE5) || \
151 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE4) || \
152 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE3) || \
153 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE2) || \
154 ((MASK) == ETH_MAC_ADDRESSMASK_BYTE1))
155 #define IS_ETH_DROP_TCPIP_CHECKSUM_FRAME(CMD) (((CMD) == ETH_DROPTCPIPCHECKSUMERRORFRAME_ENABLE) || \
156 ((CMD) == ETH_DROPTCPIPCHECKSUMERRORFRAME_DISABLE))
157 #define IS_ETH_RECEIVE_STORE_FORWARD(CMD) (((CMD) == ETH_RECEIVESTOREFORWARD_ENABLE) || \
158 ((CMD) == ETH_RECEIVESTOREFORWARD_DISABLE))
159 #define IS_ETH_FLUSH_RECEIVE_FRAME(CMD) (((CMD) == ETH_FLUSHRECEIVEDFRAME_ENABLE) || \
160 ((CMD) == ETH_FLUSHRECEIVEDFRAME_DISABLE))
161 #define IS_ETH_TRANSMIT_STORE_FORWARD(CMD) (((CMD) == ETH_TRANSMITSTOREFORWARD_ENABLE) || \
162 ((CMD) == ETH_TRANSMITSTOREFORWARD_DISABLE))
163 #define IS_ETH_TRANSMIT_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_64BYTES) || \
164 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_128BYTES) || \
165 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_192BYTES) || \
166 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_256BYTES) || \
167 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_40BYTES) || \
168 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_32BYTES) || \
169 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_24BYTES) || \
170 ((THRESHOLD) == ETH_TRANSMITTHRESHOLDCONTROL_16BYTES))
171 #define IS_ETH_FORWARD_ERROR_FRAMES(CMD) (((CMD) == ETH_FORWARDERRORFRAMES_ENABLE) || \
172 ((CMD) == ETH_FORWARDERRORFRAMES_DISABLE))
173 #define IS_ETH_FORWARD_UNDERSIZED_GOOD_FRAMES(CMD) (((CMD) == ETH_FORWARDUNDERSIZEDGOODFRAMES_ENABLE) || \
174 ((CMD) == ETH_FORWARDUNDERSIZEDGOODFRAMES_DISABLE))
175 #define IS_ETH_RECEIVE_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_RECEIVEDTHRESHOLDCONTROL_64BYTES) || \
176 ((THRESHOLD) == ETH_RECEIVEDTHRESHOLDCONTROL_32BYTES) || \
177 ((THRESHOLD) == ETH_RECEIVEDTHRESHOLDCONTROL_96BYTES) || \
178 ((THRESHOLD) == ETH_RECEIVEDTHRESHOLDCONTROL_128BYTES))
179 #define IS_ETH_SECOND_FRAME_OPERATE(CMD) (((CMD) == ETH_SECONDFRAMEOPERARTE_ENABLE) || \
180 ((CMD) == ETH_SECONDFRAMEOPERARTE_DISABLE))
181 #define IS_ETH_ADDRESS_ALIGNED_BEATS(CMD) (((CMD) == ETH_ADDRESSALIGNEDBEATS_ENABLE) || \
182 ((CMD) == ETH_ADDRESSALIGNEDBEATS_DISABLE))
183 #define IS_ETH_FIXED_BURST(CMD) (((CMD) == ETH_FIXEDBURST_ENABLE) || \
184 ((CMD) == ETH_FIXEDBURST_DISABLE))
185 #define IS_ETH_RXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_RXDMABURSTLENGTH_1BEAT) || \
186 ((LENGTH) == ETH_RXDMABURSTLENGTH_2BEAT) || \
187 ((LENGTH) == ETH_RXDMABURSTLENGTH_4BEAT) || \
188 ((LENGTH) == ETH_RXDMABURSTLENGTH_8BEAT) || \
189 ((LENGTH) == ETH_RXDMABURSTLENGTH_16BEAT) || \
190 ((LENGTH) == ETH_RXDMABURSTLENGTH_32BEAT) || \
191 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_4BEAT) || \
192 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_8BEAT) || \
193 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_16BEAT) || \
194 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_32BEAT) || \
195 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_64BEAT) || \
196 ((LENGTH) == ETH_RXDMABURSTLENGTH_4XPBL_128BEAT))
197 #define IS_ETH_TXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_TXDMABURSTLENGTH_1BEAT) || \
198 ((LENGTH) == ETH_TXDMABURSTLENGTH_2BEAT) || \
199 ((LENGTH) == ETH_TXDMABURSTLENGTH_4BEAT) || \
200 ((LENGTH) == ETH_TXDMABURSTLENGTH_8BEAT) || \
201 ((LENGTH) == ETH_TXDMABURSTLENGTH_16BEAT) || \
202 ((LENGTH) == ETH_TXDMABURSTLENGTH_32BEAT) || \
203 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_4BEAT) || \
204 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_8BEAT) || \
205 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_16BEAT) || \
206 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_32BEAT) || \
207 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_64BEAT) || \
208 ((LENGTH) == ETH_TXDMABURSTLENGTH_4XPBL_128BEAT))
209 #define IS_ETH_DMA_DESC_SKIP_LENGTH(LENGTH) ((LENGTH) <= 0x1FU)
210 #define IS_ETH_DMA_ARBITRATION_ROUNDROBIN_RXTX(RATIO) (((RATIO) == ETH_DMAARBITRATION_ROUNDROBIN_RXTX_1_1) || \
211 ((RATIO) == ETH_DMAARBITRATION_ROUNDROBIN_RXTX_2_1) || \
212 ((RATIO) == ETH_DMAARBITRATION_ROUNDROBIN_RXTX_3_1) || \
213 ((RATIO) == ETH_DMAARBITRATION_ROUNDROBIN_RXTX_4_1) || \
214 ((RATIO) == ETH_DMAARBITRATION_RXPRIORTX))
215 #define IS_ETH_DMATXDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMATXDESC_OWN) || \
216 ((FLAG) == ETH_DMATXDESC_IC) || \
217 ((FLAG) == ETH_DMATXDESC_LS) || \
218 ((FLAG) == ETH_DMATXDESC_FS) || \
219 ((FLAG) == ETH_DMATXDESC_DC) || \
220 ((FLAG) == ETH_DMATXDESC_DP) || \
221 ((FLAG) == ETH_DMATXDESC_TTSE) || \
222 ((FLAG) == ETH_DMATXDESC_TER) || \
223 ((FLAG) == ETH_DMATXDESC_TCH) || \
224 ((FLAG) == ETH_DMATXDESC_TTSS) || \
225 ((FLAG) == ETH_DMATXDESC_IHE) || \
226 ((FLAG) == ETH_DMATXDESC_ES) || \
227 ((FLAG) == ETH_DMATXDESC_JT) || \
228 ((FLAG) == ETH_DMATXDESC_FF) || \
229 ((FLAG) == ETH_DMATXDESC_PCE) || \
230 ((FLAG) == ETH_DMATXDESC_LCA) || \
231 ((FLAG) == ETH_DMATXDESC_NC) || \
232 ((FLAG) == ETH_DMATXDESC_LCO) || \
233 ((FLAG) == ETH_DMATXDESC_EC) || \
234 ((FLAG) == ETH_DMATXDESC_VF) || \
235 ((FLAG) == ETH_DMATXDESC_CC) || \
236 ((FLAG) == ETH_DMATXDESC_ED) || \
237 ((FLAG) == ETH_DMATXDESC_UF) || \
238 ((FLAG) == ETH_DMATXDESC_DB))
239 #define IS_ETH_DMA_TXDESC_SEGMENT(SEGMENT) (((SEGMENT) == ETH_DMATXDESC_LASTSEGMENTS) || \
240 ((SEGMENT) == ETH_DMATXDESC_FIRSTSEGMENT))
241 #define IS_ETH_DMA_TXDESC_CHECKSUM(CHECKSUM) (((CHECKSUM) == ETH_DMATXDESC_CHECKSUMBYPASS) || \
242 ((CHECKSUM) == ETH_DMATXDESC_CHECKSUMIPV4HEADER) || \
243 ((CHECKSUM) == ETH_DMATXDESC_CHECKSUMTCPUDPICMPSEGMENT) || \
244 ((CHECKSUM) == ETH_DMATXDESC_CHECKSUMTCPUDPICMPFULL))
245 #define IS_ETH_DMATXDESC_BUFFER_SIZE(SIZE) ((SIZE) <= 0x1FFFU)
246 #define IS_ETH_DMARXDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMARXDESC_OWN) || \
247 ((FLAG) == ETH_DMARXDESC_AFM) || \
248 ((FLAG) == ETH_DMARXDESC_ES) || \
249 ((FLAG) == ETH_DMARXDESC_DE) || \
250 ((FLAG) == ETH_DMARXDESC_SAF) || \
251 ((FLAG) == ETH_DMARXDESC_LE) || \
252 ((FLAG) == ETH_DMARXDESC_OE) || \
253 ((FLAG) == ETH_DMARXDESC_VLAN) || \
254 ((FLAG) == ETH_DMARXDESC_FS) || \
255 ((FLAG) == ETH_DMARXDESC_LS) || \
256 ((FLAG) == ETH_DMARXDESC_IPV4HCE) || \
257 ((FLAG) == ETH_DMARXDESC_LC) || \
258 ((FLAG) == ETH_DMARXDESC_FT) || \
259 ((FLAG) == ETH_DMARXDESC_RWT) || \
260 ((FLAG) == ETH_DMARXDESC_RE) || \
261 ((FLAG) == ETH_DMARXDESC_DBE) || \
262 ((FLAG) == ETH_DMARXDESC_CE) || \
263 ((FLAG) == ETH_DMARXDESC_MAMPCE))
264 #define IS_ETH_DMA_RXDESC_BUFFER(BUFFER) (((BUFFER) == ETH_DMARXDESC_BUFFER1) || \
265 ((BUFFER) == ETH_DMARXDESC_BUFFER2))
266 #define IS_ETH_PMT_GET_FLAG(FLAG) (((FLAG) == ETH_PMT_FLAG_WUFR) || \
267 ((FLAG) == ETH_PMT_FLAG_MPR))
268 #define IS_ETH_DMA_FLAG(FLAG) ((((FLAG) & 0xC7FE1800U) == 0x00U) && ((FLAG) != 0x00U))
269 #define IS_ETH_DMA_GET_FLAG(FLAG) (((FLAG) == ETH_DMA_FLAG_TST) || ((FLAG) == ETH_DMA_FLAG_PMT) || \
270 ((FLAG) == ETH_DMA_FLAG_MMC) || ((FLAG) == ETH_DMA_FLAG_DATATRANSFERERROR) || \
271 ((FLAG) == ETH_DMA_FLAG_READWRITEERROR) || ((FLAG) == ETH_DMA_FLAG_ACCESSERROR) || \
272 ((FLAG) == ETH_DMA_FLAG_NIS) || ((FLAG) == ETH_DMA_FLAG_AIS) || \
273 ((FLAG) == ETH_DMA_FLAG_ER) || ((FLAG) == ETH_DMA_FLAG_FBE) || \
274 ((FLAG) == ETH_DMA_FLAG_ET) || ((FLAG) == ETH_DMA_FLAG_RWT) || \
275 ((FLAG) == ETH_DMA_FLAG_RPS) || ((FLAG) == ETH_DMA_FLAG_RBU) || \
276 ((FLAG) == ETH_DMA_FLAG_R) || ((FLAG) == ETH_DMA_FLAG_TU) || \
277 ((FLAG) == ETH_DMA_FLAG_RO) || ((FLAG) == ETH_DMA_FLAG_TJT) || \
278 ((FLAG) == ETH_DMA_FLAG_TBU) || ((FLAG) == ETH_DMA_FLAG_TPS) || \
279 ((FLAG) == ETH_DMA_FLAG_T))
280 #define IS_ETH_MAC_IT(IT) ((((IT) & 0xFFFFFDF1U) == 0x00U) && ((IT) != 0x00U))
281 #define IS_ETH_MAC_GET_IT(IT) (((IT) == ETH_MAC_IT_TST) || ((IT) == ETH_MAC_IT_MMCT) || \
282 ((IT) == ETH_MAC_IT_MMCR) || ((IT) == ETH_MAC_IT_MMC) || \
283 ((IT) == ETH_MAC_IT_PMT))
284 #define IS_ETH_MAC_GET_FLAG(FLAG) (((FLAG) == ETH_MAC_FLAG_TST) || ((FLAG) == ETH_MAC_FLAG_MMCT) || \
285 ((FLAG) == ETH_MAC_FLAG_MMCR) || ((FLAG) == ETH_MAC_FLAG_MMC) || \
286 ((FLAG) == ETH_MAC_FLAG_PMT))
287 #define IS_ETH_DMA_IT(IT) ((((IT) & 0xC7FE1800U) == 0x00U) && ((IT) != 0x00U))
288 #define IS_ETH_DMA_GET_IT(IT) (((IT) == ETH_DMA_IT_TST) || ((IT) == ETH_DMA_IT_PMT) || \
289 ((IT) == ETH_DMA_IT_MMC) || ((IT) == ETH_DMA_IT_NIS) || \
290 ((IT) == ETH_DMA_IT_AIS) || ((IT) == ETH_DMA_IT_ER) || \
291 ((IT) == ETH_DMA_IT_FBE) || ((IT) == ETH_DMA_IT_ET) || \
292 ((IT) == ETH_DMA_IT_RWT) || ((IT) == ETH_DMA_IT_RPS) || \
293 ((IT) == ETH_DMA_IT_RBU) || ((IT) == ETH_DMA_IT_R) || \
294 ((IT) == ETH_DMA_IT_TU) || ((IT) == ETH_DMA_IT_RO) || \
295 ((IT) == ETH_DMA_IT_TJT) || ((IT) == ETH_DMA_IT_TBU) || \
296 ((IT) == ETH_DMA_IT_TPS) || ((IT) == ETH_DMA_IT_T))
297 #define IS_ETH_DMA_GET_OVERFLOW(OVERFLOW) (((OVERFLOW) == ETH_DMA_OVERFLOW_RXFIFOCOUNTER) || \
298 ((OVERFLOW) == ETH_DMA_OVERFLOW_MISSEDFRAMECOUNTER))
299 #define IS_ETH_MMC_IT(IT) (((((IT) & 0xFFDF3FFFU) == 0x00U) || (((IT) & 0xEFFDFF9FU) == 0x00U)) && \
301 #define IS_ETH_MMC_GET_IT(IT) (((IT) == ETH_MMC_IT_TGF) || ((IT) == ETH_MMC_IT_TGFMSC) || \
302 ((IT) == ETH_MMC_IT_TGFSC) || ((IT) == ETH_MMC_IT_RGUF) || \
303 ((IT) == ETH_MMC_IT_RFAE) || ((IT) == ETH_MMC_IT_RFCE))
304 #define IS_ETH_ENHANCED_DESCRIPTOR_FORMAT(CMD) (((CMD) == ETH_DMAENHANCEDDESCRIPTOR_ENABLE) || \
305 ((CMD) == ETH_DMAENHANCEDDESCRIPTOR_DISABLE))
315 #define ETH_REG_WRITE_DELAY 0x00000001U
318 #define ETH_SUCCESS 0U
322 #define ETH_DMATXDESC_COLLISION_COUNTSHIFT 3U
325 #define ETH_DMATXDESC_BUFFER2_SIZESHIFT 16U
328 #define ETH_DMARXDESC_FRAME_LENGTHSHIFT 16U
331 #define ETH_DMARXDESC_BUFFER2_SIZESHIFT 16U
334 #define ETH_DMARXDESC_FRAMELENGTHSHIFT 16U
337 #define ETH_MAC_ADDR_HBASE (uint32_t)(ETH_MAC_BASE + 0x40U)
338 #define ETH_MAC_ADDR_LBASE (uint32_t)(ETH_MAC_BASE + 0x44U)
341 #define ETH_MACMIIAR_CR_MASK 0xFFFFFFE3U
344 #define ETH_MACCR_CLEAR_MASK 0xFF20810FU
347 #define ETH_MACFCR_CLEAR_MASK 0x0000FF41U
350 #define ETH_DMAOMR_CLEAR_MASK 0xF8DE3F23U
353 #define ETH_WAKEUP_REGISTER_LENGTH 8U
356 #define ETH_DMA_RX_OVERFLOW_MISSEDFRAMES_COUNTERSHIFT 17U
371 HAL_ETH_STATE_RESET = 0x00U,
372 HAL_ETH_STATE_READY = 0x01U,
373 HAL_ETH_STATE_BUSY = 0x02U,
374 HAL_ETH_STATE_BUSY_TX = 0x12U,
375 HAL_ETH_STATE_BUSY_RX = 0x22U,
376 HAL_ETH_STATE_BUSY_TX_RX = 0x32U,
377 HAL_ETH_STATE_BUSY_WR = 0x42U,
378 HAL_ETH_STATE_BUSY_RD = 0x82U,
379 HAL_ETH_STATE_TIMEOUT = 0x03U,
380 HAL_ETH_STATE_ERROR = 0x04U
381 }HAL_ETH_StateTypeDef;
389 uint32_t AutoNegotiation;
408 uint32_t ChecksumMode;
411 uint32_t MediaInterface;
433 uint32_t InterFrameGap;
436 uint32_t CarrierSense;
444 uint32_t LoopbackMode;
447 uint32_t ChecksumOffload;
450 uint32_t RetryTransmission;
454 uint32_t AutomaticPadCRCStrip;
457 uint32_t BackOffLimit;
460 uint32_t DeferralCheck;
466 uint32_t SourceAddrFilter;
469 uint32_t PassControlFrames;
472 uint32_t BroadcastFramesReception;
475 uint32_t DestinationAddrFilter;
478 uint32_t PromiscuousMode;
481 uint32_t MulticastFramesFilter;
484 uint32_t UnicastFramesFilter;
487 uint32_t HashTableHigh;
490 uint32_t HashTableLow;
496 uint32_t ZeroQuantaPause;
499 uint32_t PauseLowThreshold;
503 uint32_t UnicastPauseFrameDetect;
507 uint32_t ReceiveFlowControl;
511 uint32_t TransmitFlowControl;
515 uint32_t VLANTagComparison;
519 uint32_t VLANTagIdentifier;
521 } ETH_MACInitTypeDef;
529 uint32_t DropTCPIPChecksumErrorFrame;
532 uint32_t ReceiveStoreForward;
535 uint32_t FlushReceivedFrame;
538 uint32_t TransmitStoreForward;
541 uint32_t TransmitThresholdControl;
544 uint32_t ForwardErrorFrames;
547 uint32_t ForwardUndersizedGoodFrames;
551 uint32_t ReceiveThresholdControl;
554 uint32_t SecondFrameOperate;
558 uint32_t AddressAlignedBeats;
564 uint32_t RxDMABurstLength;
567 uint32_t TxDMABurstLength;
570 uint32_t EnhancedDescriptorFormat;
573 uint32_t DescriptorSkipLength;
576 uint32_t DMAArbitration;
578 } ETH_DMAInitTypeDef;
587 __IO uint32_t Status;
589 uint32_t ControlBufferSize;
591 uint32_t Buffer1Addr;
593 uint32_t Buffer2NextDescAddr;
596 uint32_t ExtendedStatus;
600 uint32_t TimeStampLow;
602 uint32_t TimeStampHigh;
604 } ETH_DMADescTypeDef;
611 ETH_DMADescTypeDef *FSRxDesc;
613 ETH_DMADescTypeDef *LSRxDesc;
621 } ETH_DMARxFrameInfos;
631 ETH_InitTypeDef
Init;
635 ETH_DMADescTypeDef *RxDesc;
637 ETH_DMADescTypeDef *TxDesc;
639 ETH_DMARxFrameInfos RxFrameInfos;
641 __IO HAL_ETH_StateTypeDef
State;
659 #define ETH_MAX_PACKET_SIZE 1524U
660 #define ETH_HEADER 14U
663 #define ETH_VLAN_TAG 4U
664 #define ETH_MIN_ETH_PAYLOAD 46U
665 #define ETH_MAX_ETH_PAYLOAD 1500U
666 #define ETH_JUMBO_FRAME_PAYLOAD 9000U
685 #ifndef ETH_RX_BUF_SIZE
686 #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE
691 #define ETH_RXBUFNB 5U
712 #ifndef ETH_TX_BUF_SIZE
713 #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE
718 #define ETH_TXBUFNB 5U
745 #define ETH_DMATXDESC_OWN 0x80000000U
746 #define ETH_DMATXDESC_IC 0x40000000U
747 #define ETH_DMATXDESC_LS 0x20000000U
748 #define ETH_DMATXDESC_FS 0x10000000U
749 #define ETH_DMATXDESC_DC 0x08000000U
750 #define ETH_DMATXDESC_DP 0x04000000U
751 #define ETH_DMATXDESC_TTSE 0x02000000U
752 #define ETH_DMATXDESC_CIC 0x00C00000U
753 #define ETH_DMATXDESC_CIC_BYPASS 0x00000000U
754 #define ETH_DMATXDESC_CIC_IPV4HEADER 0x00400000U
755 #define ETH_DMATXDESC_CIC_TCPUDPICMP_SEGMENT 0x00800000U
756 #define ETH_DMATXDESC_CIC_TCPUDPICMP_FULL 0x00C00000U
757 #define ETH_DMATXDESC_TER 0x00200000U
758 #define ETH_DMATXDESC_TCH 0x00100000U
759 #define ETH_DMATXDESC_TTSS 0x00020000U
760 #define ETH_DMATXDESC_IHE 0x00010000U
761 #define ETH_DMATXDESC_ES 0x00008000U
762 #define ETH_DMATXDESC_JT 0x00004000U
763 #define ETH_DMATXDESC_FF 0x00002000U
764 #define ETH_DMATXDESC_PCE 0x00001000U
765 #define ETH_DMATXDESC_LCA 0x00000800U
766 #define ETH_DMATXDESC_NC 0x00000400U
767 #define ETH_DMATXDESC_LCO 0x00000200U
768 #define ETH_DMATXDESC_EC 0x00000100U
769 #define ETH_DMATXDESC_VF 0x00000080U
770 #define ETH_DMATXDESC_CC 0x00000078U
771 #define ETH_DMATXDESC_ED 0x00000004U
772 #define ETH_DMATXDESC_UF 0x00000002U
773 #define ETH_DMATXDESC_DB 0x00000001U
778 #define ETH_DMATXDESC_TBS2 0x1FFF0000U
779 #define ETH_DMATXDESC_TBS1 0x00001FFFU
784 #define ETH_DMATXDESC_B1AP 0xFFFFFFFFU
789 #define ETH_DMATXDESC_B2AP 0xFFFFFFFFU
798 #define ETH_DMAPTPTXDESC_TTSL 0xFFFFFFFFU
801 #define ETH_DMAPTPTXDESC_TTSH 0xFFFFFFFFU
826 #define ETH_DMARXDESC_OWN 0x80000000U
827 #define ETH_DMARXDESC_AFM 0x40000000U
828 #define ETH_DMARXDESC_FL 0x3FFF0000U
829 #define ETH_DMARXDESC_ES 0x00008000U
830 #define ETH_DMARXDESC_DE 0x00004000U
831 #define ETH_DMARXDESC_SAF 0x00002000U
832 #define ETH_DMARXDESC_LE 0x00001000U
833 #define ETH_DMARXDESC_OE 0x00000800U
834 #define ETH_DMARXDESC_VLAN 0x00000400U
835 #define ETH_DMARXDESC_FS 0x00000200U
836 #define ETH_DMARXDESC_LS 0x00000100U
837 #define ETH_DMARXDESC_IPV4HCE 0x00000080U
838 #define ETH_DMARXDESC_LC 0x00000040U
839 #define ETH_DMARXDESC_FT 0x00000020U
840 #define ETH_DMARXDESC_RWT 0x00000010U
841 #define ETH_DMARXDESC_RE 0x00000008U
842 #define ETH_DMARXDESC_DBE 0x00000004U
843 #define ETH_DMARXDESC_CE 0x00000002U
844 #define ETH_DMARXDESC_MAMPCE 0x00000001U
849 #define ETH_DMARXDESC_DIC 0x80000000U
850 #define ETH_DMARXDESC_RBS2 0x1FFF0000U
851 #define ETH_DMARXDESC_RER 0x00008000U
852 #define ETH_DMARXDESC_RCH 0x00004000U
853 #define ETH_DMARXDESC_RBS1 0x00001FFFU
858 #define ETH_DMARXDESC_B1AP 0xFFFFFFFFU
863 #define ETH_DMARXDESC_B2AP 0xFFFFFFFFU
876 #define ETH_DMAPTPRXDESC_PTPV 0x00002000U
877 #define ETH_DMAPTPRXDESC_PTPFT 0x00001000U
878 #define ETH_DMAPTPRXDESC_PTPMT 0x00000F00U
879 #define ETH_DMAPTPRXDESC_PTPMT_SYNC 0x00000100U
880 #define ETH_DMAPTPRXDESC_PTPMT_FOLLOWUP 0x00000200U
881 #define ETH_DMAPTPRXDESC_PTPMT_DELAYREQ 0x00000300U
882 #define ETH_DMAPTPRXDESC_PTPMT_DELAYRESP 0x00000400U
883 #define ETH_DMAPTPRXDESC_PTPMT_PDELAYREQ_ANNOUNCE 0x00000500U
884 #define ETH_DMAPTPRXDESC_PTPMT_PDELAYRESP_MANAG 0x00000600U
885 #define ETH_DMAPTPRXDESC_PTPMT_PDELAYRESPFOLLOWUP_SIGNAL 0x00000700U
886 #define ETH_DMAPTPRXDESC_IPV6PR 0x00000080U
887 #define ETH_DMAPTPRXDESC_IPV4PR 0x00000040U
888 #define ETH_DMAPTPRXDESC_IPCB 0x00000020U
889 #define ETH_DMAPTPRXDESC_IPPE 0x00000010U
890 #define ETH_DMAPTPRXDESC_IPHE 0x00000008U
891 #define ETH_DMAPTPRXDESC_IPPT 0x00000007U
892 #define ETH_DMAPTPRXDESC_IPPT_UDP 0x00000001U
893 #define ETH_DMAPTPRXDESC_IPPT_TCP 0x00000002U
894 #define ETH_DMAPTPRXDESC_IPPT_ICMP 0x00000003U
897 #define ETH_DMAPTPRXDESC_RTSL 0xFFFFFFFFU
900 #define ETH_DMAPTPRXDESC_RTSH 0xFFFFFFFFU
907 #define ETH_AUTONEGOTIATION_ENABLE 0x00000001U
908 #define ETH_AUTONEGOTIATION_DISABLE 0x00000000U
916 #define ETH_SPEED_10M 0x00000000U
917 #define ETH_SPEED_100M 0x00004000U
925 #define ETH_MODE_FULLDUPLEX 0x00000800U
926 #define ETH_MODE_HALFDUPLEX 0x00000000U
933 #define ETH_RXPOLLING_MODE 0x00000000U
934 #define ETH_RXINTERRUPT_MODE 0x00000001U
942 #define ETH_CHECKSUM_BY_HARDWARE 0x00000000U
943 #define ETH_CHECKSUM_BY_SOFTWARE 0x00000001U
951 #define ETH_MEDIA_INTERFACE_MII 0x00000000U
952 #define ETH_MEDIA_INTERFACE_RMII ((uint32_t)SYSCFG_PMC_MII_RMII_SEL)
960 #define ETH_WATCHDOG_ENABLE 0x00000000U
961 #define ETH_WATCHDOG_DISABLE 0x00800000U
969 #define ETH_JABBER_ENABLE 0x00000000U
970 #define ETH_JABBER_DISABLE 0x00400000U
978 #define ETH_INTERFRAMEGAP_96BIT 0x00000000U
979 #define ETH_INTERFRAMEGAP_88BIT 0x00020000U
980 #define ETH_INTERFRAMEGAP_80BIT 0x00040000U
981 #define ETH_INTERFRAMEGAP_72BIT 0x00060000U
982 #define ETH_INTERFRAMEGAP_64BIT 0x00080000U
983 #define ETH_INTERFRAMEGAP_56BIT 0x000A0000U
984 #define ETH_INTERFRAMEGAP_48BIT 0x000C0000U
985 #define ETH_INTERFRAMEGAP_40BIT 0x000E0000U
993 #define ETH_CARRIERSENCE_ENABLE 0x00000000U
994 #define ETH_CARRIERSENCE_DISABLE 0x00010000U
1002 #define ETH_RECEIVEOWN_ENABLE 0x00000000U
1003 #define ETH_RECEIVEOWN_DISABLE 0x00002000U
1011 #define ETH_LOOPBACKMODE_ENABLE 0x00001000U
1012 #define ETH_LOOPBACKMODE_DISABLE 0x00000000U
1020 #define ETH_CHECKSUMOFFLAOD_ENABLE 0x00000400U
1021 #define ETH_CHECKSUMOFFLAOD_DISABLE 0x00000000U
1029 #define ETH_RETRYTRANSMISSION_ENABLE 0x00000000U
1030 #define ETH_RETRYTRANSMISSION_DISABLE 0x00000200U
1038 #define ETH_AUTOMATICPADCRCSTRIP_ENABLE 0x00000080U
1039 #define ETH_AUTOMATICPADCRCSTRIP_DISABLE 0x00000000U
1047 #define ETH_BACKOFFLIMIT_10 0x00000000U
1048 #define ETH_BACKOFFLIMIT_8 0x00000020U
1049 #define ETH_BACKOFFLIMIT_4 0x00000040U
1050 #define ETH_BACKOFFLIMIT_1 0x00000060U
1058 #define ETH_DEFFERRALCHECK_ENABLE 0x00000010U
1059 #define ETH_DEFFERRALCHECK_DISABLE 0x00000000U
1067 #define ETH_RECEIVEALL_ENABLE 0x80000000U
1068 #define ETH_RECEIVEAll_DISABLE 0x00000000U
1076 #define ETH_SOURCEADDRFILTER_NORMAL_ENABLE 0x00000200U
1077 #define ETH_SOURCEADDRFILTER_INVERSE_ENABLE 0x00000300U
1078 #define ETH_SOURCEADDRFILTER_DISABLE 0x00000000U
1086 #define ETH_PASSCONTROLFRAMES_BLOCKALL 0x00000040U
1087 #define ETH_PASSCONTROLFRAMES_FORWARDALL 0x00000080U
1088 #define ETH_PASSCONTROLFRAMES_FORWARDPASSEDADDRFILTER 0x000000C0U
1096 #define ETH_BROADCASTFRAMESRECEPTION_ENABLE 0x00000000U
1097 #define ETH_BROADCASTFRAMESRECEPTION_DISABLE 0x00000020U
1105 #define ETH_DESTINATIONADDRFILTER_NORMAL 0x00000000U
1106 #define ETH_DESTINATIONADDRFILTER_INVERSE 0x00000008U
1114 #define ETH_PROMISCUOUS_MODE_ENABLE 0x00000001U
1115 #define ETH_PROMISCUOUS_MODE_DISABLE 0x00000000U
1123 #define ETH_MULTICASTFRAMESFILTER_PERFECTHASHTABLE 0x00000404U
1124 #define ETH_MULTICASTFRAMESFILTER_HASHTABLE 0x00000004U
1125 #define ETH_MULTICASTFRAMESFILTER_PERFECT 0x00000000U
1126 #define ETH_MULTICASTFRAMESFILTER_NONE 0x00000010U
1134 #define ETH_UNICASTFRAMESFILTER_PERFECTHASHTABLE 0x00000402U
1135 #define ETH_UNICASTFRAMESFILTER_HASHTABLE 0x00000002U
1136 #define ETH_UNICASTFRAMESFILTER_PERFECT 0x00000000U
1144 #define ETH_ZEROQUANTAPAUSE_ENABLE 0x00000000U
1145 #define ETH_ZEROQUANTAPAUSE_DISABLE 0x00000080U
1153 #define ETH_PAUSELOWTHRESHOLD_MINUS4 0x00000000U
1154 #define ETH_PAUSELOWTHRESHOLD_MINUS28 0x00000010U
1155 #define ETH_PAUSELOWTHRESHOLD_MINUS144 0x00000020U
1156 #define ETH_PAUSELOWTHRESHOLD_MINUS256 0x00000030U
1164 #define ETH_UNICASTPAUSEFRAMEDETECT_ENABLE 0x00000008U
1165 #define ETH_UNICASTPAUSEFRAMEDETECT_DISABLE 0x00000000U
1173 #define ETH_RECEIVEFLOWCONTROL_ENABLE 0x00000004U
1174 #define ETH_RECEIVEFLOWCONTROL_DISABLE 0x00000000U
1182 #define ETH_TRANSMITFLOWCONTROL_ENABLE 0x00000002U
1183 #define ETH_TRANSMITFLOWCONTROL_DISABLE 0x00000000U
1191 #define ETH_VLANTAGCOMPARISON_12BIT 0x00010000U
1192 #define ETH_VLANTAGCOMPARISON_16BIT 0x00000000U
1200 #define ETH_MAC_ADDRESS0 0x00000000U
1201 #define ETH_MAC_ADDRESS1 0x00000008U
1202 #define ETH_MAC_ADDRESS2 0x00000010U
1203 #define ETH_MAC_ADDRESS3 0x00000018U
1211 #define ETH_MAC_ADDRESSFILTER_SA 0x00000000U
1212 #define ETH_MAC_ADDRESSFILTER_DA 0x00000008U
1220 #define ETH_MAC_ADDRESSMASK_BYTE6 0x20000000U
1221 #define ETH_MAC_ADDRESSMASK_BYTE5 0x10000000U
1222 #define ETH_MAC_ADDRESSMASK_BYTE4 0x08000000U
1223 #define ETH_MAC_ADDRESSMASK_BYTE3 0x04000000U
1224 #define ETH_MAC_ADDRESSMASK_BYTE2 0x02000000U
1225 #define ETH_MAC_ADDRESSMASK_BYTE1 0x01000000U
1233 #define ETH_DROPTCPIPCHECKSUMERRORFRAME_ENABLE 0x00000000U
1234 #define ETH_DROPTCPIPCHECKSUMERRORFRAME_DISABLE 0x04000000U
1242 #define ETH_RECEIVESTOREFORWARD_ENABLE 0x02000000U
1243 #define ETH_RECEIVESTOREFORWARD_DISABLE 0x00000000U
1251 #define ETH_FLUSHRECEIVEDFRAME_ENABLE 0x00000000U
1252 #define ETH_FLUSHRECEIVEDFRAME_DISABLE 0x01000000U
1260 #define ETH_TRANSMITSTOREFORWARD_ENABLE 0x00200000U
1261 #define ETH_TRANSMITSTOREFORWARD_DISABLE 0x00000000U
1269 #define ETH_TRANSMITTHRESHOLDCONTROL_64BYTES 0x00000000U
1270 #define ETH_TRANSMITTHRESHOLDCONTROL_128BYTES 0x00004000U
1271 #define ETH_TRANSMITTHRESHOLDCONTROL_192BYTES 0x00008000U
1272 #define ETH_TRANSMITTHRESHOLDCONTROL_256BYTES 0x0000C000U
1273 #define ETH_TRANSMITTHRESHOLDCONTROL_40BYTES 0x00010000U
1274 #define ETH_TRANSMITTHRESHOLDCONTROL_32BYTES 0x00014000U
1275 #define ETH_TRANSMITTHRESHOLDCONTROL_24BYTES 0x00018000U
1276 #define ETH_TRANSMITTHRESHOLDCONTROL_16BYTES 0x0001C000U
1284 #define ETH_FORWARDERRORFRAMES_ENABLE 0x00000080U
1285 #define ETH_FORWARDERRORFRAMES_DISABLE 0x00000000U
1293 #define ETH_FORWARDUNDERSIZEDGOODFRAMES_ENABLE 0x00000040U
1294 #define ETH_FORWARDUNDERSIZEDGOODFRAMES_DISABLE 0x00000000U
1302 #define ETH_RECEIVEDTHRESHOLDCONTROL_64BYTES 0x00000000U
1303 #define ETH_RECEIVEDTHRESHOLDCONTROL_32BYTES 0x00000008U
1304 #define ETH_RECEIVEDTHRESHOLDCONTROL_96BYTES 0x00000010U
1305 #define ETH_RECEIVEDTHRESHOLDCONTROL_128BYTES 0x00000018U
1313 #define ETH_SECONDFRAMEOPERARTE_ENABLE 0x00000004U
1314 #define ETH_SECONDFRAMEOPERARTE_DISABLE 0x00000000U
1322 #define ETH_ADDRESSALIGNEDBEATS_ENABLE 0x02000000U
1323 #define ETH_ADDRESSALIGNEDBEATS_DISABLE 0x00000000U
1331 #define ETH_FIXEDBURST_ENABLE 0x00010000U
1332 #define ETH_FIXEDBURST_DISABLE 0x00000000U
1340 #define ETH_RXDMABURSTLENGTH_1BEAT 0x00020000U
1341 #define ETH_RXDMABURSTLENGTH_2BEAT 0x00040000U
1342 #define ETH_RXDMABURSTLENGTH_4BEAT 0x00080000U
1343 #define ETH_RXDMABURSTLENGTH_8BEAT 0x00100000U
1344 #define ETH_RXDMABURSTLENGTH_16BEAT 0x00200000U
1345 #define ETH_RXDMABURSTLENGTH_32BEAT 0x00400000U
1346 #define ETH_RXDMABURSTLENGTH_4XPBL_4BEAT 0x01020000U
1347 #define ETH_RXDMABURSTLENGTH_4XPBL_8BEAT 0x01040000U
1348 #define ETH_RXDMABURSTLENGTH_4XPBL_16BEAT 0x01080000U
1349 #define ETH_RXDMABURSTLENGTH_4XPBL_32BEAT 0x01100000U
1350 #define ETH_RXDMABURSTLENGTH_4XPBL_64BEAT 0x01200000U
1351 #define ETH_RXDMABURSTLENGTH_4XPBL_128BEAT 0x01400000U
1359 #define ETH_TXDMABURSTLENGTH_1BEAT 0x00000100U
1360 #define ETH_TXDMABURSTLENGTH_2BEAT 0x00000200U
1361 #define ETH_TXDMABURSTLENGTH_4BEAT 0x00000400U
1362 #define ETH_TXDMABURSTLENGTH_8BEAT 0x00000800U
1363 #define ETH_TXDMABURSTLENGTH_16BEAT 0x00001000U
1364 #define ETH_TXDMABURSTLENGTH_32BEAT 0x00002000U
1365 #define ETH_TXDMABURSTLENGTH_4XPBL_4BEAT 0x01000100U
1366 #define ETH_TXDMABURSTLENGTH_4XPBL_8BEAT 0x01000200U
1367 #define ETH_TXDMABURSTLENGTH_4XPBL_16BEAT 0x01000400U
1368 #define ETH_TXDMABURSTLENGTH_4XPBL_32BEAT 0x01000800U
1369 #define ETH_TXDMABURSTLENGTH_4XPBL_64BEAT 0x01001000U
1370 #define ETH_TXDMABURSTLENGTH_4XPBL_128BEAT 0x01002000U
1378 #define ETH_DMAENHANCEDDESCRIPTOR_ENABLE 0x00000080U
1379 #define ETH_DMAENHANCEDDESCRIPTOR_DISABLE 0x00000000U
1387 #define ETH_DMAARBITRATION_ROUNDROBIN_RXTX_1_1 0x00000000U
1388 #define ETH_DMAARBITRATION_ROUNDROBIN_RXTX_2_1 0x00004000U
1389 #define ETH_DMAARBITRATION_ROUNDROBIN_RXTX_3_1 0x00008000U
1390 #define ETH_DMAARBITRATION_ROUNDROBIN_RXTX_4_1 0x0000C000U
1391 #define ETH_DMAARBITRATION_RXPRIORTX 0x00000002U
1399 #define ETH_DMATXDESC_LASTSEGMENTS 0x40000000U
1400 #define ETH_DMATXDESC_FIRSTSEGMENT 0x20000000U
1408 #define ETH_DMATXDESC_CHECKSUMBYPASS 0x00000000U
1409 #define ETH_DMATXDESC_CHECKSUMIPV4HEADER 0x00400000U
1410 #define ETH_DMATXDESC_CHECKSUMTCPUDPICMPSEGMENT 0x00800000U
1411 #define ETH_DMATXDESC_CHECKSUMTCPUDPICMPFULL 0x00C00000U
1419 #define ETH_DMARXDESC_BUFFER1 0x00000000U
1420 #define ETH_DMARXDESC_BUFFER2 0x00000001U
1428 #define ETH_PMT_FLAG_WUFFRPR 0x80000000U
1429 #define ETH_PMT_FLAG_WUFR 0x00000040U
1430 #define ETH_PMT_FLAG_MPR 0x00000020U
1438 #define ETH_MMC_IT_TGF 0x00200000U
1439 #define ETH_MMC_IT_TGFMSC 0x00008000U
1440 #define ETH_MMC_IT_TGFSC 0x00004000U
1448 #define ETH_MMC_IT_RGUF 0x10020000U
1449 #define ETH_MMC_IT_RFAE 0x10000040U
1450 #define ETH_MMC_IT_RFCE 0x10000020U
1458 #define ETH_MAC_FLAG_TST 0x00000200U
1459 #define ETH_MAC_FLAG_MMCT 0x00000040U
1460 #define ETH_MAC_FLAG_MMCR 0x00000020U
1461 #define ETH_MAC_FLAG_MMC 0x00000010U
1462 #define ETH_MAC_FLAG_PMT 0x00000008U
1470 #define ETH_DMA_FLAG_TST 0x20000000U
1471 #define ETH_DMA_FLAG_PMT 0x10000000U
1472 #define ETH_DMA_FLAG_MMC 0x08000000U
1473 #define ETH_DMA_FLAG_DATATRANSFERERROR 0x00800000U
1474 #define ETH_DMA_FLAG_READWRITEERROR 0x01000000U
1475 #define ETH_DMA_FLAG_ACCESSERROR 0x02000000U
1476 #define ETH_DMA_FLAG_NIS 0x00010000U
1477 #define ETH_DMA_FLAG_AIS 0x00008000U
1478 #define ETH_DMA_FLAG_ER 0x00004000U
1479 #define ETH_DMA_FLAG_FBE 0x00002000U
1480 #define ETH_DMA_FLAG_ET 0x00000400U
1481 #define ETH_DMA_FLAG_RWT 0x00000200U
1482 #define ETH_DMA_FLAG_RPS 0x00000100U
1483 #define ETH_DMA_FLAG_RBU 0x00000080U
1484 #define ETH_DMA_FLAG_R 0x00000040U
1485 #define ETH_DMA_FLAG_TU 0x00000020U
1486 #define ETH_DMA_FLAG_RO 0x00000010U
1487 #define ETH_DMA_FLAG_TJT 0x00000008U
1488 #define ETH_DMA_FLAG_TBU 0x00000004U
1489 #define ETH_DMA_FLAG_TPS 0x00000002U
1490 #define ETH_DMA_FLAG_T 0x00000001U
1498 #define ETH_MAC_IT_TST 0x00000200U
1499 #define ETH_MAC_IT_MMCT 0x00000040U
1500 #define ETH_MAC_IT_MMCR 0x00000020U
1501 #define ETH_MAC_IT_MMC 0x00000010U
1502 #define ETH_MAC_IT_PMT 0x00000008U
1510 #define ETH_DMA_IT_TST 0x20000000U
1511 #define ETH_DMA_IT_PMT 0x10000000U
1512 #define ETH_DMA_IT_MMC 0x08000000U
1513 #define ETH_DMA_IT_NIS 0x00010000U
1514 #define ETH_DMA_IT_AIS 0x00008000U
1515 #define ETH_DMA_IT_ER 0x00004000U
1516 #define ETH_DMA_IT_FBE 0x00002000U
1517 #define ETH_DMA_IT_ET 0x00000400U
1518 #define ETH_DMA_IT_RWT 0x00000200U
1519 #define ETH_DMA_IT_RPS 0x00000100U
1520 #define ETH_DMA_IT_RBU 0x00000080U
1521 #define ETH_DMA_IT_R 0x00000040U
1522 #define ETH_DMA_IT_TU 0x00000020U
1523 #define ETH_DMA_IT_RO 0x00000010U
1524 #define ETH_DMA_IT_TJT 0x00000008U
1525 #define ETH_DMA_IT_TBU 0x00000004U
1526 #define ETH_DMA_IT_TPS 0x00000002U
1527 #define ETH_DMA_IT_T 0x00000001U
1535 #define ETH_DMA_TRANSMITPROCESS_STOPPED 0x00000000U
1536 #define ETH_DMA_TRANSMITPROCESS_FETCHING 0x00100000U
1537 #define ETH_DMA_TRANSMITPROCESS_WAITING 0x00200000U
1538 #define ETH_DMA_TRANSMITPROCESS_READING 0x00300000U
1539 #define ETH_DMA_TRANSMITPROCESS_SUSPENDED 0x00600000U
1540 #define ETH_DMA_TRANSMITPROCESS_CLOSING 0x00700000U
1550 #define ETH_DMA_RECEIVEPROCESS_STOPPED 0x00000000U
1551 #define ETH_DMA_RECEIVEPROCESS_FETCHING 0x00020000U
1552 #define ETH_DMA_RECEIVEPROCESS_WAITING 0x00060000U
1553 #define ETH_DMA_RECEIVEPROCESS_SUSPENDED 0x00080000U
1554 #define ETH_DMA_RECEIVEPROCESS_CLOSING 0x000A0000U
1555 #define ETH_DMA_RECEIVEPROCESS_QUEUING 0x000E0000U
1564 #define ETH_DMA_OVERFLOW_RXFIFOCOUNTER 0x10000000U
1565 #define ETH_DMA_OVERFLOW_MISSEDFRAMECOUNTER 0x00010000U
1573 #define ETH_EXTI_LINE_WAKEUP 0x00080000U
1593 #define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ETH_STATE_RESET)
1601 #define __HAL_ETH_DMATXDESC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->TxDesc->Status & (__FLAG__) == (__FLAG__))
1609 #define __HAL_ETH_DMARXDESC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->RxDesc->Status & (__FLAG__) == (__FLAG__))
1616 #define __HAL_ETH_DMARXDESC_ENABLE_IT(__HANDLE__) ((__HANDLE__)->RxDesc->ControlBufferSize &=(~(uint32_t)ETH_DMARXDESC_DIC))
1623 #define __HAL_ETH_DMARXDESC_DISABLE_IT(__HANDLE__) ((__HANDLE__)->RxDesc->ControlBufferSize |= ETH_DMARXDESC_DIC)
1630 #define __HAL_ETH_DMARXDESC_SET_OWN_BIT(__HANDLE__) ((__HANDLE__)->RxDesc->Status |= ETH_DMARXDESC_OWN)
1637 #define __HAL_ETH_DMATXDESC_GET_COLLISION_COUNT(__HANDLE__) (((__HANDLE__)->TxDesc->Status & ETH_DMATXDESC_CC) >> ETH_DMATXDESC_COLLISION_COUNTSHIFT)
1644 #define __HAL_ETH_DMATXDESC_SET_OWN_BIT(__HANDLE__) ((__HANDLE__)->TxDesc->Status |= ETH_DMATXDESC_OWN)
1651 #define __HAL_ETH_DMATXDESC_ENABLE_IT(__HANDLE__) ((__HANDLE__)->TxDesc->Status |= ETH_DMATXDESC_IC)
1658 #define __HAL_ETH_DMATXDESC_DISABLE_IT(__HANDLE__) ((__HANDLE__)->TxDesc->Status &= ~ETH_DMATXDESC_IC)
1671 #define __HAL_ETH_DMATXDESC_CHECKSUM_INSERTION(__HANDLE__, __CHECKSUM__) ((__HANDLE__)->TxDesc->Status |= (__CHECKSUM__))
1678 #define __HAL_ETH_DMATXDESC_CRC_ENABLE(__HANDLE__) ((__HANDLE__)->TxDesc->Status &= ~ETH_DMATXDESC_DC)
1685 #define __HAL_ETH_DMATXDESC_CRC_DISABLE(__HANDLE__) ((__HANDLE__)->TxDesc->Status |= ETH_DMATXDESC_DC)
1692 #define __HAL_ETH_DMATXDESC_SHORT_FRAME_PADDING_ENABLE(__HANDLE__) ((__HANDLE__)->TxDesc->Status &= ~ETH_DMATXDESC_DP)
1699 #define __HAL_ETH_DMATXDESC_SHORT_FRAME_PADDING_DISABLE(__HANDLE__) ((__HANDLE__)->TxDesc->Status |= ETH_DMATXDESC_DP)
1711 #define __HAL_ETH_MAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIMR |= (__INTERRUPT__))
1723 #define __HAL_ETH_MAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIMR &= ~(__INTERRUPT__))
1730 #define __HAL_ETH_INITIATE_PAUSE_CONTROL_FRAME(__HANDLE__) ((__HANDLE__)->Instance->MACFCR |= ETH_MACFCR_FCBBPA)
1737 #define __HAL_ETH_GET_FLOW_CONTROL_BUSY_STATUS(__HANDLE__) (((__HANDLE__)->Instance->MACFCR & ETH_MACFCR_FCBBPA) == ETH_MACFCR_FCBBPA)
1744 #define __HAL_ETH_BACK_PRESSURE_ACTIVATION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACFCR |= ETH_MACFCR_FCBBPA)
1751 #define __HAL_ETH_BACK_PRESSURE_ACTIVATION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACFCR &= ~ETH_MACFCR_FCBBPA)
1765 #define __HAL_ETH_MAC_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->MACSR &( __FLAG__)) == ( __FLAG__))
1774 #define __HAL_ETH_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMAIER |= (__INTERRUPT__))
1783 #define __HAL_ETH_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMAIER &= ~(__INTERRUPT__))
1791 #define __HAL_ETH_DMA_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMASR =(__INTERRUPT__))
1799 #define __HAL_ETH_DMA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->DMASR &( __FLAG__)) == ( __FLAG__))
1807 #define __HAL_ETH_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->DMASR = (__FLAG__))
1818 #define __HAL_ETH_GET_DMA_OVERFLOW_STATUS(__HANDLE__, __OVERFLOW__) (((__HANDLE__)->Instance->DMAMFBOCR & (__OVERFLOW__)) == (__OVERFLOW__))
1826 #define __HAL_ETH_SET_RECEIVE_WATCHDOG_TIMER(__HANDLE__, __VALUE__) ((__HANDLE__)->Instance->DMARSWTR = (__VALUE__))
1834 #define __HAL_ETH_GLOBAL_UNICAST_WAKEUP_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR |= ETH_MACPMTCSR_GU)
1842 #define __HAL_ETH_GLOBAL_UNICAST_WAKEUP_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR &= ~ETH_MACPMTCSR_GU)
1849 #define __HAL_ETH_WAKEUP_FRAME_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR |= ETH_MACPMTCSR_WFE)
1856 #define __HAL_ETH_WAKEUP_FRAME_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR &= ~ETH_MACPMTCSR_WFE)
1863 #define __HAL_ETH_MAGIC_PACKET_DETECTION_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR |= ETH_MACPMTCSR_MPE)
1870 #define __HAL_ETH_MAGIC_PACKET_DETECTION_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR &= ~ETH_MACPMTCSR_WFE)
1877 #define __HAL_ETH_POWER_DOWN_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR |= ETH_MACPMTCSR_PD)
1884 #define __HAL_ETH_POWER_DOWN_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MACPMTCSR &= ~ETH_MACPMTCSR_PD)
1896 #define __HAL_ETH_GET_PMT_FLAG_STATUS(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->MACPMTCSR &( __FLAG__)) == ( __FLAG__))
1903 #define __HAL_ETH_MMC_COUNTER_FULL_PRESET(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= (ETH_MMCCR_MCFHP | ETH_MMCCR_MCP))
1910 #define __HAL_ETH_MMC_COUNTER_HALF_PRESET(__HANDLE__) do{(__HANDLE__)->Instance->MMCCR &= ~ETH_MMCCR_MCFHP;\
1911 (__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_MCP;} while (0)
1918 #define __HAL_ETH_MMC_COUNTER_FREEZE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_MCF)
1925 #define __HAL_ETH_MMC_COUNTER_FREEZE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR &= ~ETH_MMCCR_MCF)
1932 #define __HAL_ETH_ETH_MMC_RESET_ONREAD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_ROR)
1939 #define __HAL_ETH_ETH_MMC_RESET_ONREAD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR &= ~ETH_MMCCR_ROR)
1946 #define __HAL_ETH_ETH_MMC_COUNTER_ROLLOVER_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR &= ~ETH_MMCCR_CSR)
1953 #define __HAL_ETH_ETH_MMC_COUNTER_ROLLOVER_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_CSR)
1960 #define __HAL_ETH_MMC_COUNTERS_RESET(__HANDLE__) ((__HANDLE__)->Instance->MMCCR |= ETH_MMCCR_CR)
1972 #define __HAL_ETH_MMC_RX_IT_ENABLE(__HANDLE__, __INTERRUPT__) (__HANDLE__)->Instance->MMCRIMR &= ~((__INTERRUPT__) & 0xEFFFFFFFU)
1983 #define __HAL_ETH_MMC_RX_IT_DISABLE(__HANDLE__, __INTERRUPT__) (__HANDLE__)->Instance->MMCRIMR |= ((__INTERRUPT__) & 0xEFFFFFFFU)
1994 #define __HAL_ETH_MMC_TX_IT_ENABLE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MMCRIMR &= ~ (__INTERRUPT__))
2006 #define __HAL_ETH_MMC_TX_IT_DISABLE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MMCRIMR |= (__INTERRUPT__))
2012 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_IT() EXTI->IMR |= (ETH_EXTI_LINE_WAKEUP)
2018 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_IT() EXTI->IMR &= ~(ETH_EXTI_LINE_WAKEUP)
2024 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_EVENT() EXTI->EMR |= (ETH_EXTI_LINE_WAKEUP)
2030 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_EVENT() EXTI->EMR &= ~(ETH_EXTI_LINE_WAKEUP)
2036 #define __HAL_ETH_WAKEUP_EXTI_GET_FLAG() EXTI->PR & (ETH_EXTI_LINE_WAKEUP)
2042 #define __HAL_ETH_WAKEUP_EXTI_CLEAR_FLAG() EXTI->PR = (ETH_EXTI_LINE_WAKEUP)
2048 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_EDGE_TRIGGER() EXTI->RTSR |= ETH_EXTI_LINE_WAKEUP
2054 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_RISING_EDGE_TRIGGER() EXTI->RTSR &= ~(ETH_EXTI_LINE_WAKEUP)
2060 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLING_EDGE_TRIGGER() EXTI->FTSR |= (ETH_EXTI_LINE_WAKEUP)
2066 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_FALLING_EDGE_TRIGGER() EXTI->FTSR &= ~(ETH_EXTI_LINE_WAKEUP)
2072 #define __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLINGRISING_TRIGGER() do{EXTI->RTSR |= ETH_EXTI_LINE_WAKEUP;\
2073 EXTI->FTSR |= ETH_EXTI_LINE_WAKEUP;\
2080 #define __HAL_ETH_WAKEUP_EXTI_DISABLE_FALLINGRISING_TRIGGER() do{EXTI->RTSR &= ~(ETH_EXTI_LINE_WAKEUP);\
2081 EXTI->FTSR &= ~(ETH_EXTI_LINE_WAKEUP);\
2088 #define __HAL_ETH_WAKEUP_EXTI_GENERATE_SWIT() EXTI->SWIER|= ETH_EXTI_LINE_WAKEUP
2108 HAL_StatusTypeDef HAL_ETH_DMATxDescListInit(ETH_HandleTypeDef *
heth, ETH_DMADescTypeDef *DMATxDescTab,
uint8_t* TxBuff, uint32_t TxBuffCount);
2109 HAL_StatusTypeDef HAL_ETH_DMARxDescListInit(ETH_HandleTypeDef *
heth, ETH_DMADescTypeDef *DMARxDescTab,
uint8_t *RxBuff, uint32_t RxBuffCount);
2122 HAL_StatusTypeDef HAL_ETH_ReadPHYRegister(ETH_HandleTypeDef *
heth, uint16_t PHYReg, uint32_t *RegValue);
2123 HAL_StatusTypeDef HAL_ETH_WritePHYRegister(ETH_HandleTypeDef *
heth, uint16_t PHYReg, uint32_t RegValue);
2126 void HAL_ETH_IRQHandler(ETH_HandleTypeDef *
heth);
2128 void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *
heth);
2130 void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *
heth);
2154 HAL_ETH_StateTypeDef HAL_ETH_GetState(ETH_HandleTypeDef *
heth);