RTEMS 6.1-rc5
Loading...
Searching...
No Matches
stm32h7xx_hal_eth.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_ETH_H
21#define STM32H7xx_HAL_ETH_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
30#if defined(ETH)
31
40/* Exported types ------------------------------------------------------------*/
41#ifndef ETH_TX_DESC_CNT
42#define ETH_TX_DESC_CNT 4U
43#endif /* ETH_TX_DESC_CNT */
44
45#ifndef ETH_RX_DESC_CNT
46#define ETH_RX_DESC_CNT 4U
47#endif /* ETH_RX_DESC_CNT */
48
49#ifndef ETH_SWRESET_TIMEOUT
50#define ETH_SWRESET_TIMEOUT 500U
51#endif /* ETH_SWRESET_TIMEOUT */
52
53#ifndef ETH_MDIO_BUS_TIMEOUT
54#define ETH_MDIO_BUS_TIMEOUT 1000U
55#endif /* ETH_MDIO_BUS_TIMEOUT */
56
57#ifndef ETH_MAC_US_TICK
58#define ETH_MAC_US_TICK 1000000U
59#endif /* ETH_MAC_US_TICK */
60
61/*********************** Descriptors struct def section ************************/
70typedef struct
71{
72 __IO uint32_t DESC0;
73 __IO uint32_t DESC1;
74 __IO uint32_t DESC2;
75 __IO uint32_t DESC3;
76 uint32_t BackupAddr0; /* used to store rx buffer 1 address */
77 uint32_t BackupAddr1; /* used to store rx buffer 2 address */
78} ETH_DMADescTypeDef;
86typedef struct __ETH_BufferTypeDef
87{
88 uint8_t *buffer; /*<! buffer address */
89
90 uint32_t len; /*<! buffer length */
91
92 struct __ETH_BufferTypeDef *next; /*<! Pointer to the next buffer in the list */
93} ETH_BufferTypeDef;
101typedef struct
102{
103 uint32_t TxDesc[ETH_TX_DESC_CNT]; /*<! Tx DMA descriptors addresses */
104
105 uint32_t CurTxDesc; /*<! Current Tx descriptor index for packet transmission */
106
107 uint32_t *PacketAddress[ETH_TX_DESC_CNT]; /*<! Ethernet packet addresses array */
108
109 uint32_t *CurrentPacketAddress; /*<! Current transmit NX_PACKET addresses */
110
111 uint32_t BuffersInUse; /*<! Buffers in Use */
112
113 uint32_t releaseIndex; /*<! Release index */
114} ETH_TxDescListTypeDef;
122typedef struct
123{
124 uint32_t Attributes;
127 uint32_t Length;
129 ETH_BufferTypeDef *TxBuffer;
131 uint32_t SrcAddrCtrl;
134 uint32_t CRCPadCtrl;
137 uint32_t ChecksumCtrl;
140 uint32_t MaxSegmentSize;
143 uint32_t PayloadLen;
146 uint32_t TCPHeaderLen;
149 uint32_t VlanTag;
152 uint32_t VlanCtrl;
155 uint32_t InnerVlanTag;
158 uint32_t InnerVlanCtrl;
161 void *pData;
163} ETH_TxPacketConfigTypeDef;
171typedef struct
172{
173 uint32_t TimeStampLow;
174 uint32_t TimeStampHigh;
175
176} ETH_TimeStampTypeDef;
181#ifdef HAL_ETH_USE_PTP
185typedef struct
186{
187 uint32_t Seconds;
188 uint32_t NanoSeconds;
189} ETH_TimeTypeDef;
193#endif /* HAL_ETH_USE_PTP */
194
198typedef struct
199{
200 uint32_t RxDesc[ETH_RX_DESC_CNT]; /*<! Rx DMA descriptors addresses. */
201
202 uint32_t ItMode; /*<! If 1, DMA will generate the Rx complete interrupt.
203 If 0, DMA will not generate the Rx complete interrupt. */
204
205 uint32_t RxDescIdx; /*<! Current Rx descriptor. */
206
207 uint32_t RxDescCnt; /*<! Number of descriptors . */
208
209 uint32_t RxDataLength; /*<! Received Data Length. */
210
211 uint32_t RxBuildDescIdx; /*<! Current Rx Descriptor for building descriptors. */
212
213 uint32_t RxBuildDescCnt; /*<! Number of Rx Descriptors awaiting building. */
214
215 uint32_t pRxLastRxDesc; /*<! Last received descriptor. */
216
217 ETH_TimeStampTypeDef TimeStamp; /*<! Time Stamp Low value for receive. */
218
219 void *pRxStart; /*<! Pointer to the first buff. */
220
221 void *pRxEnd; /*<! Pointer to the last buff. */
222
223} ETH_RxDescListTypeDef;
231typedef struct
232{
233 uint32_t
234 SourceAddrControl;
237 FunctionalState
238 ChecksumOffload;
240 uint32_t InterPacketGapVal;
243 FunctionalState GiantPacketSizeLimitControl;
245 FunctionalState Support2KPacket;
247 FunctionalState CRCStripTypePacket;
249 FunctionalState AutomaticPadCRCStrip;
251 FunctionalState Watchdog;
253 FunctionalState Jabber;
255 FunctionalState JumboPacket;
259 uint32_t Speed;
262 uint32_t DuplexMode;
265 FunctionalState LoopbackMode;
267 FunctionalState
268 CarrierSenseBeforeTransmit;
270 FunctionalState ReceiveOwn;
272 FunctionalState
273 CarrierSenseDuringTransmit;
275 FunctionalState
276 RetryTransmission;
278 uint32_t BackOffLimit;
281 FunctionalState
282 DeferralCheck;
284 uint32_t
285 PreambleLength;
288 FunctionalState
289 UnicastSlowProtocolPacketDetect;
291 FunctionalState SlowProtocolDetect;
293 FunctionalState CRCCheckingRxPackets;
295 uint32_t
296 GiantPacketSizeLimit;
301 FunctionalState ExtendedInterPacketGap;
303 uint32_t ExtendedInterPacketGapVal;
306 FunctionalState ProgrammableWatchdog;
308 uint32_t WatchdogTimeout;
311 uint32_t
312 PauseTime;
316 FunctionalState
317 ZeroQuantaPause;
319 uint32_t
320 PauseLowThreshold;
323 FunctionalState
324 TransmitFlowControl;
327 FunctionalState
328 UnicastPausePacketDetect;
330 FunctionalState ReceiveFlowControl;
333 uint32_t TransmitQueueMode;
336 uint32_t ReceiveQueueMode;
339 FunctionalState DropTCPIPChecksumErrorPacket;
341 FunctionalState ForwardRxErrorPacket;
343 FunctionalState ForwardRxUndersizedGoodPacket;
344} ETH_MACConfigTypeDef;
352typedef struct
353{
354 uint32_t DMAArbitration;
357 FunctionalState AddressAlignedBeats;
360 uint32_t BurstMode;
362 FunctionalState RebuildINCRxBurst;
365 FunctionalState PBLx8Mode;
367 uint32_t
368 TxDMABurstLength;
371 FunctionalState
372 SecondPacketOperate;
376 uint32_t
377 RxDMABurstLength;
380 FunctionalState FlushRxPacket;
382 FunctionalState TCPSegmentation;
384 uint32_t
385 MaximumSegmentSize;
388} ETH_DMAConfigTypeDef;
396typedef enum
397{
398 HAL_ETH_MII_MODE = 0x00U,
399 HAL_ETH_RMII_MODE = 0x01U
400} ETH_MediaInterfaceTypeDef;
405#ifdef HAL_ETH_USE_PTP
409typedef enum
410{
411 HAL_ETH_PTP_POSITIVE_UPDATE = 0x00000000U,
412 HAL_ETH_PTP_NEGATIVE_UPDATE = 0x00000001U
413} ETH_PtpUpdateTypeDef;
417#endif /* HAL_ETH_USE_PTP */
418
422typedef struct
423{
424 uint8_t
425 *MACAddr;
427 ETH_MediaInterfaceTypeDef MediaInterface;
429 ETH_DMADescTypeDef
430 *TxDesc;
432 ETH_DMADescTypeDef
433 *RxDesc;
435 uint32_t RxBuffLen;
437} ETH_InitTypeDef;
442#ifdef HAL_ETH_USE_PTP
446typedef struct
447{
448 uint32_t Timestamp;
449 uint32_t TimestampUpdateMode;
450 uint32_t TimestampInitialize;
451 uint32_t TimestampUpdate;
452 uint32_t TimestampAddendUpdate;
453 uint32_t TimestampAll;
454 uint32_t TimestampRolloverMode;
455 uint32_t TimestampV2;
456 uint32_t TimestampEthernet;
457 uint32_t TimestampIPv6;
458 uint32_t TimestampIPv4;
459 uint32_t TimestampEvent;
460 uint32_t TimestampMaster;
461 uint32_t TimestampSnapshots;
462 uint32_t TimestampFilter;
463 uint32_t
464 TimestampChecksumCorrection;
465 uint32_t TimestampStatusMode;
466 uint32_t TimestampAddend;
467 uint32_t TimestampSubsecondInc;
469} ETH_PTP_ConfigTypeDef;
473#endif /* HAL_ETH_USE_PTP */
474
478typedef uint32_t HAL_ETH_StateTypeDef;
486typedef void (*pETH_rxAllocateCallbackTypeDef)(uint8_t **buffer);
494typedef void (*pETH_rxLinkCallbackTypeDef)(void **pStart, void **pEnd, uint8_t *buff,
495 uint16_t Length);
503typedef void (*pETH_txFreeCallbackTypeDef)(uint32_t *buffer);
511typedef void (*pETH_txPtpCallbackTypeDef)(uint32_t *buffer,
512 ETH_TimeStampTypeDef *timestamp);
520#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
521typedef struct __ETH_HandleTypeDef
522#else
523typedef struct
524#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
525{
526 ETH_TypeDef *Instance;
528 ETH_InitTypeDef Init;
530 ETH_TxDescListTypeDef TxDescList;
533 ETH_RxDescListTypeDef RxDescList;
536#ifdef HAL_ETH_USE_PTP
537 ETH_TimeStampTypeDef TxTimestamp;
538#endif /* HAL_ETH_USE_PTP */
539
540 __IO HAL_ETH_StateTypeDef gState;
544 __IO uint32_t ErrorCode;
547 __IO uint32_t
548 DMAErrorCode;
552 __IO uint32_t
553 MACErrorCode;
557 __IO uint32_t MACWakeUpEvent;
561 __IO uint32_t MACLPIEvent;
564 __IO uint32_t IsPtpConfigured;
568#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
569
570 void (* TxCpltCallback)(struct __ETH_HandleTypeDef *heth);
571 void (* RxCpltCallback)(struct __ETH_HandleTypeDef *heth);
572 void (* ErrorCallback)(struct __ETH_HandleTypeDef *heth);
573 void (* PMTCallback)(struct __ETH_HandleTypeDef *heth);
574 void (* EEECallback)(struct __ETH_HandleTypeDef *heth);
575 void (* WakeUpCallback)(struct __ETH_HandleTypeDef *heth);
577 void (* MspInitCallback)(struct __ETH_HandleTypeDef *heth);
578 void (* MspDeInitCallback)(struct __ETH_HandleTypeDef *heth);
580#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
581
582 pETH_rxAllocateCallbackTypeDef rxAllocateCallback;
583 pETH_rxLinkCallbackTypeDef rxLinkCallback;
584 pETH_txFreeCallbackTypeDef txFreeCallback;
585 pETH_txPtpCallbackTypeDef txPtpCallback;
587} ETH_HandleTypeDef;
592#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
596typedef enum
597{
598 HAL_ETH_MSPINIT_CB_ID = 0x00U,
599 HAL_ETH_MSPDEINIT_CB_ID = 0x01U,
600 HAL_ETH_TX_COMPLETE_CB_ID = 0x02U,
601 HAL_ETH_RX_COMPLETE_CB_ID = 0x03U,
602 HAL_ETH_ERROR_CB_ID = 0x04U,
603 HAL_ETH_PMT_CB_ID = 0x06U,
604 HAL_ETH_EEE_CB_ID = 0x07U,
605 HAL_ETH_WAKEUP_CB_ID = 0x08U
607} HAL_ETH_CallbackIDTypeDef;
608
612typedef void (*pETH_CallbackTypeDef)(ETH_HandleTypeDef *heth);
614#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
615
619typedef struct
620{
621 FunctionalState PromiscuousMode;
623 FunctionalState ReceiveAllMode;
625 FunctionalState HachOrPerfectFilter;
627 FunctionalState HashUnicast;
629 FunctionalState HashMulticast;
631 FunctionalState PassAllMulticast;
633 FunctionalState SrcAddrFiltering;
635 FunctionalState SrcAddrInverseFiltering;
637 FunctionalState DestAddrInverseFiltering;
639 FunctionalState BroadcastFilter;
641 uint32_t ControlPacketsFilter;
643} ETH_MACFilterConfigTypeDef;
651typedef struct
652{
653 FunctionalState WakeUpPacket;
655 FunctionalState MagicPacket;
657 FunctionalState GlobalUnicast;
659 FunctionalState WakeUpForward;
661} ETH_PowerDownConfigTypeDef;
670/* Exported constants --------------------------------------------------------*/
681/*
682 DMA Tx Normal Descriptor Read Format
683 -----------------------------------------------------------------------------------------------
684 TDES0 | Buffer1 or Header Address [31:0] |
685 -----------------------------------------------------------------------------------------------
686 TDES1 | Buffer2 Address [31:0] / Next Descriptor Address [31:0] |
687 -----------------------------------------------------------------------------------------------
688 TDES2 | IOC(31) | TTSE(30) | Buff2 Length[29:16] | VTIR[15:14] | Header or Buff1 Length[13:0] |
689 -----------------------------------------------------------------------------------------------
690 TDES3 | OWN(31) | CTRL[30:26] | Reserved[25:24] | CTRL[23:20] | Reserved[19:17] | Status[16:0] |
691 -----------------------------------------------------------------------------------------------
692*/
693
697#define ETH_DMATXNDESCRF_B1AP 0xFFFFFFFFU
702#define ETH_DMATXNDESCRF_B2AP 0xFFFFFFFFU
707#define ETH_DMATXNDESCRF_IOC 0x80000000U
708#define ETH_DMATXNDESCRF_TTSE 0x40000000U
709#define ETH_DMATXNDESCRF_B2L 0x3FFF0000U
710#define ETH_DMATXNDESCRF_VTIR 0x0000C000U
711#define ETH_DMATXNDESCRF_VTIR_DISABLE 0x00000000U
712#define ETH_DMATXNDESCRF_VTIR_REMOVE 0x00004000U
713#define ETH_DMATXNDESCRF_VTIR_INSERT 0x00008000U
714#define ETH_DMATXNDESCRF_VTIR_REPLACE 0x0000C000U
715#define ETH_DMATXNDESCRF_B1L 0x00003FFFU
716#define ETH_DMATXNDESCRF_HL 0x000003FFU
721#define ETH_DMATXNDESCRF_OWN 0x80000000U
722#define ETH_DMATXNDESCRF_CTXT 0x40000000U
723#define ETH_DMATXNDESCRF_FD 0x20000000U
724#define ETH_DMATXNDESCRF_LD 0x10000000U
725#define ETH_DMATXNDESCRF_CPC 0x0C000000U
726#define ETH_DMATXNDESCRF_CPC_CRCPAD_INSERT 0x00000000U
727#define ETH_DMATXNDESCRF_CPC_CRC_INSERT 0x04000000U
728#define ETH_DMATXNDESCRF_CPC_DISABLE 0x08000000U
729#define ETH_DMATXNDESCRF_CPC_CRC_REPLACE 0x0C000000U
730#define ETH_DMATXNDESCRF_SAIC 0x03800000U
731#define ETH_DMATXNDESCRF_SAIC_DISABLE 0x00000000U
732#define ETH_DMATXNDESCRF_SAIC_INSERT 0x00800000U
733#define ETH_DMATXNDESCRF_SAIC_REPLACE 0x01000000U
734#define ETH_DMATXNDESCRF_THL 0x00780000U
735#define ETH_DMATXNDESCRF_TSE 0x00040000U
736#define ETH_DMATXNDESCRF_CIC 0x00030000U
737#define ETH_DMATXNDESCRF_CIC_DISABLE 0x00000000U
738#define ETH_DMATXNDESCRF_CIC_IPHDR_INSERT 0x00010000U
739#define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT 0x00020000U
743#define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT_PHDR_CALC 0x00030000U
747#define ETH_DMATXNDESCRF_TPL 0x0003FFFFU
748#define ETH_DMATXNDESCRF_FL 0x00007FFFU
750/*
751 DMA Tx Normal Descriptor Write Back Format
752 -----------------------------------------------------------------------------------------------
753 TDES0 | Timestamp Low |
754 -----------------------------------------------------------------------------------------------
755 TDES1 | Timestamp High |
756 -----------------------------------------------------------------------------------------------
757 TDES2 | Reserved[31:0] |
758 -----------------------------------------------------------------------------------------------
759 TDES3 | OWN(31) | Status[30:0] |
760 -----------------------------------------------------------------------------------------------
761*/
762
766#define ETH_DMATXNDESCWBF_TTSL 0xFFFFFFFFU
771#define ETH_DMATXNDESCWBF_TTSH 0xFFFFFFFFU
776#define ETH_DMATXNDESCWBF_OWN 0x80000000U
777#define ETH_DMATXNDESCWBF_CTXT 0x40000000U
778#define ETH_DMATXNDESCWBF_FD 0x20000000U
779#define ETH_DMATXNDESCWBF_LD 0x10000000U
780#define ETH_DMATXNDESCWBF_TTSS 0x00020000U
781#define ETH_DMATXNDESCWBF_DP 0x04000000U
782#define ETH_DMATXNDESCWBF_TTSE 0x02000000U
783#define ETH_DMATXNDESCWBF_ES 0x00008000U
784#define ETH_DMATXNDESCWBF_JT 0x00004000U
785#define ETH_DMATXNDESCWBF_FF 0x00002000U
786#define ETH_DMATXNDESCWBF_PCE 0x00001000U
787#define ETH_DMATXNDESCWBF_LCA 0x00000800U
788#define ETH_DMATXNDESCWBF_NC 0x00000400U
789#define ETH_DMATXNDESCWBF_LCO 0x00000200U
790#define ETH_DMATXNDESCWBF_EC 0x00000100U
791#define ETH_DMATXNDESCWBF_CC 0x000000F0U
792#define ETH_DMATXNDESCWBF_ED 0x00000008U
793#define ETH_DMATXNDESCWBF_UF 0x00000004U
794#define ETH_DMATXNDESCWBF_DB 0x00000002U
795#define ETH_DMATXNDESCWBF_IHE 0x00000004U
797/*
798 DMA Tx Context Descriptor
799 -----------------------------------------------------------------------------------------------
800 TDES0 | Timestamp Low |
801 -----------------------------------------------------------------------------------------------
802 TDES1 | Timestamp High |
803 -----------------------------------------------------------------------------------------------
804 TDES2 | Inner VLAN Tag[31:16] | Reserved(15) | Maximum Segment Size [14:0] |
805 -----------------------------------------------------------------------------------------------
806 TDES3 | OWN(31) | Status[30:0] |
807 -----------------------------------------------------------------------------------------------
808*/
809
813#define ETH_DMATXCDESC_TTSL 0xFFFFFFFFU
818#define ETH_DMATXCDESC_TTSH 0xFFFFFFFFU
823#define ETH_DMATXCDESC_IVT 0xFFFF0000U
824#define ETH_DMATXCDESC_MSS 0x00003FFFU
829#define ETH_DMATXCDESC_OWN 0x80000000U
830#define ETH_DMATXCDESC_CTXT 0x40000000U
831#define ETH_DMATXCDESC_OSTC 0x08000000U
832#define ETH_DMATXCDESC_TCMSSV 0x04000000U
833#define ETH_DMATXCDESC_CDE 0x00800000U
834#define ETH_DMATXCDESC_IVTIR 0x000C0000U
835#define ETH_DMATXCDESC_IVTIR_DISABLE 0x00000000U
836#define ETH_DMATXCDESC_IVTIR_REMOVE 0x00040000U
837#define ETH_DMATXCDESC_IVTIR_INSERT 0x00080000U
838#define ETH_DMATXCDESC_IVTIR_REPLACE 0x000C0000U
839#define ETH_DMATXCDESC_IVLTV 0x00020000U
840#define ETH_DMATXCDESC_VLTV 0x00010000U
841#define ETH_DMATXCDESC_VT 0x0000FFFFU
852/*
853 DMA Rx Normal Descriptor read format
854 -----------------------------------------------------------------------------------------------------------
855 RDES0 | Buffer1 or Header Address [31:0] |
856 -----------------------------------------------------------------------------------------------------------
857 RDES1 | Reserved |
858 -----------------------------------------------------------------------------------------------------------
859 RDES2 | Payload or Buffer2 Address[31:0] |
860 -----------------------------------------------------------------------------------------------------------
861 RDES3 | OWN(31) | IOC(30) | Reserved [29:26] | BUF2V(25) | BUF1V(24) | Reserved [23:0] |
862 -----------------------------------------------------------------------------------------------------------
863*/
864
868#define ETH_DMARXNDESCRF_BUF1AP 0xFFFFFFFFU
873#define ETH_DMARXNDESCRF_BUF2AP 0xFFFFFFFFU
878#define ETH_DMARXNDESCRF_OWN 0x80000000U
879#define ETH_DMARXNDESCRF_IOC 0x40000000U
880#define ETH_DMARXNDESCRF_BUF2V 0x02000000U
881#define ETH_DMARXNDESCRF_BUF1V 0x01000000U
883/*
884 DMA Rx Normal Descriptor write back format
885 ---------------------------------------------------------------------------------------------------------------------
886 RDES0 | Inner VLAN Tag[31:16] | Outer VLAN Tag[15:0] |
887 ---------------------------------------------------------------------------------------------------------------------
888 RDES1 | OAM code, or MAC Control Opcode [31:16] | Extended Status |
889 ---------------------------------------------------------------------------------------------------------------------
890 RDES2 | MAC Filter Status[31:16] | VF(15) | Reserved [14:12] | ARP Status [11:10] | Header Length [9:0] |
891 ---------------------------------------------------------------------------------------------------------------------
892 RDES3 | OWN(31) | CTXT(30) | FD(29) | LD(28) | Status[27:16] | ES(15) | Packet Length[14:0] |
893 ---------------------------------------------------------------------------------------------------------------------
894*/
895
899#define ETH_DMARXNDESCWBF_IVT 0xFFFF0000U
900#define ETH_DMARXNDESCWBF_OVT 0x0000FFFFU
905#define ETH_DMARXNDESCWBF_OPC 0xFFFF0000U
906#define ETH_DMARXNDESCWBF_TD 0x00008000U
907#define ETH_DMARXNDESCWBF_TSA 0x00004000U
908#define ETH_DMARXNDESCWBF_PV 0x00002000U
909#define ETH_DMARXNDESCWBF_PFT 0x00001000U
910#define ETH_DMARXNDESCWBF_PMT_NO 0x00000000U
911#define ETH_DMARXNDESCWBF_PMT_SYNC 0x00000100U
912#define ETH_DMARXNDESCWBF_PMT_FUP 0x00000200U
913#define ETH_DMARXNDESCWBF_PMT_DREQ 0x00000300U
914#define ETH_DMARXNDESCWBF_PMT_DRESP 0x00000400U
915#define ETH_DMARXNDESCWBF_PMT_PDREQ 0x00000500U
916#define ETH_DMARXNDESCWBF_PMT_PDRESP 0x00000600U
917#define ETH_DMARXNDESCWBF_PMT_PDRESPFUP 0x00000700U
918#define ETH_DMARXNDESCWBF_PMT_ANNOUNCE 0x00000800U
919#define ETH_DMARXNDESCWBF_PMT_MANAG 0x00000900U
920#define ETH_DMARXNDESCWBF_PMT_SIGN 0x00000A00U
921#define ETH_DMARXNDESCWBF_PMT_RESERVED 0x00000F00U
922#define ETH_DMARXNDESCWBF_IPCE 0x00000080U
923#define ETH_DMARXNDESCWBF_IPCB 0x00000040U
924#define ETH_DMARXNDESCWBF_IPV6 0x00000020U
925#define ETH_DMARXNDESCWBF_IPV4 0x00000010U
926#define ETH_DMARXNDESCWBF_IPHE 0x00000008U
927#define ETH_DMARXNDESCWBF_PT 0x00000003U
928#define ETH_DMARXNDESCWBF_PT_UNKNOWN 0x00000000U
929#define ETH_DMARXNDESCWBF_PT_UDP 0x00000001U
930#define ETH_DMARXNDESCWBF_PT_TCP 0x00000002U
931#define ETH_DMARXNDESCWBF_PT_ICMP 0x00000003U
936#define ETH_DMARXNDESCWBF_L3L4FM 0x20000000U
937#define ETH_DMARXNDESCWBF_L4FM 0x10000000U
938#define ETH_DMARXNDESCWBF_L3FM 0x08000000U
939#define ETH_DMARXNDESCWBF_MADRM 0x07F80000U
940#define ETH_DMARXNDESCWBF_HF 0x00040000U
941#define ETH_DMARXNDESCWBF_DAF 0x00020000U
942#define ETH_DMARXNDESCWBF_SAF 0x00010000U
943#define ETH_DMARXNDESCWBF_VF 0x00008000U
944#define ETH_DMARXNDESCWBF_ARPNR 0x00000400U
949#define ETH_DMARXNDESCWBF_OWN 0x80000000U
950#define ETH_DMARXNDESCWBF_CTXT 0x40000000U
951#define ETH_DMARXNDESCWBF_FD 0x20000000U
952#define ETH_DMARXNDESCWBF_LD 0x10000000U
953#define ETH_DMARXNDESCWBF_RS2V 0x08000000U
954#define ETH_DMARXNDESCWBF_RS1V 0x04000000U
955#define ETH_DMARXNDESCWBF_RS0V 0x02000000U
956#define ETH_DMARXNDESCWBF_CE 0x01000000U
957#define ETH_DMARXNDESCWBF_GP 0x00800000U
958#define ETH_DMARXNDESCWBF_RWT 0x00400000U
959#define ETH_DMARXNDESCWBF_OE 0x00200000U
960#define ETH_DMARXNDESCWBF_RE 0x00100000U
961#define ETH_DMARXNDESCWBF_DE 0x00080000U
962#define ETH_DMARXNDESCWBF_LT 0x00070000U
963#define ETH_DMARXNDESCWBF_LT_LP 0x00000000U
964#define ETH_DMARXNDESCWBF_LT_TP 0x00010000U
965#define ETH_DMARXNDESCWBF_LT_ARP 0x00030000U
966#define ETH_DMARXNDESCWBF_LT_VLAN 0x00040000U
967#define ETH_DMARXNDESCWBF_LT_DVLAN 0x00050000U
968#define ETH_DMARXNDESCWBF_LT_MAC 0x00060000U
969#define ETH_DMARXNDESCWBF_LT_OAM 0x00070000U
970#define ETH_DMARXNDESCWBF_ES 0x00008000U
971#define ETH_DMARXNDESCWBF_PL 0x00007FFFU
973/*
974 DMA Rx context Descriptor
975 ---------------------------------------------------------------------------------------------------------------------
976 RDES0 | Timestamp Low[31:0] |
977 ---------------------------------------------------------------------------------------------------------------------
978 RDES1 | Timestamp High[31:0] |
979 ---------------------------------------------------------------------------------------------------------------------
980 RDES2 | Reserved |
981 ---------------------------------------------------------------------------------------------------------------------
982 RDES3 | OWN(31) | CTXT(30) | Reserved[29:0] |
983 ---------------------------------------------------------------------------------------------------------------------
984*/
985
989#define ETH_DMARXCDESC_RTSL 0xFFFFFFFFU
994#define ETH_DMARXCDESC_RTSH 0xFFFFFFFFU
999#define ETH_DMARXCDESC_OWN 0x80000000U
1000#define ETH_DMARXCDESC_CTXT 0x40000000U
1010#define ETH_MAX_PACKET_SIZE 1528U
1011#define ETH_HEADER 14U
1012#define ETH_CRC 4U
1013#define ETH_VLAN_TAG 4U
1014#define ETH_MIN_PAYLOAD 46U
1015#define ETH_MAX_PAYLOAD 1500U
1016#define ETH_JUMBO_FRAME_PAYLOAD 9000U
1025#define HAL_ETH_ERROR_NONE 0x00000000U
1026#define HAL_ETH_ERROR_PARAM 0x00000001U
1027#define HAL_ETH_ERROR_BUSY 0x00000002U
1028#define HAL_ETH_ERROR_TIMEOUT 0x00000004U
1029#define HAL_ETH_ERROR_DMA 0x00000008U
1030#define HAL_ETH_ERROR_MAC 0x00000010U
1031#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
1032#define HAL_ETH_ERROR_INVALID_CALLBACK 0x00000020U
1033#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
1042#define ETH_TX_PACKETS_FEATURES_CSUM 0x00000001U
1043#define ETH_TX_PACKETS_FEATURES_SAIC 0x00000002U
1044#define ETH_TX_PACKETS_FEATURES_VLANTAG 0x00000004U
1045#define ETH_TX_PACKETS_FEATURES_INNERVLANTAG 0x00000008U
1046#define ETH_TX_PACKETS_FEATURES_TSO 0x00000010U
1047#define ETH_TX_PACKETS_FEATURES_CRCPAD 0x00000020U
1056#define ETH_SRC_ADDR_CONTROL_DISABLE ETH_DMATXNDESCRF_SAIC_DISABLE
1057#define ETH_SRC_ADDR_INSERT ETH_DMATXNDESCRF_SAIC_INSERT
1058#define ETH_SRC_ADDR_REPLACE ETH_DMATXNDESCRF_SAIC_REPLACE
1067#define ETH_CRC_PAD_DISABLE ETH_DMATXNDESCRF_CPC_DISABLE
1068#define ETH_CRC_PAD_INSERT ETH_DMATXNDESCRF_CPC_CRCPAD_INSERT
1069#define ETH_CRC_INSERT ETH_DMATXNDESCRF_CPC_CRC_INSERT
1070#define ETH_CRC_REPLACE ETH_DMATXNDESCRF_CPC_CRC_REPLACE
1079#define ETH_CHECKSUM_DISABLE ETH_DMATXNDESCRF_CIC_DISABLE
1080#define ETH_CHECKSUM_IPHDR_INSERT ETH_DMATXNDESCRF_CIC_IPHDR_INSERT
1081#define ETH_CHECKSUM_IPHDR_PAYLOAD_INSERT ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT
1082#define ETH_CHECKSUM_IPHDR_PAYLOAD_INSERT_PHDR_CALC ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT_PHDR_CALC
1091#define ETH_VLAN_DISABLE ETH_DMATXNDESCRF_VTIR_DISABLE
1092#define ETH_VLAN_REMOVE ETH_DMATXNDESCRF_VTIR_REMOVE
1093#define ETH_VLAN_INSERT ETH_DMATXNDESCRF_VTIR_INSERT
1094#define ETH_VLAN_REPLACE ETH_DMATXNDESCRF_VTIR_REPLACE
1103#define ETH_INNER_VLAN_DISABLE ETH_DMATXCDESC_IVTIR_DISABLE
1104#define ETH_INNER_VLAN_REMOVE ETH_DMATXCDESC_IVTIR_REMOVE
1105#define ETH_INNER_VLAN_INSERT ETH_DMATXCDESC_IVTIR_INSERT
1106#define ETH_INNER_VLAN_REPLACE ETH_DMATXCDESC_IVTIR_REPLACE
1115#define ETH_CHECKSUM_BYPASSED ETH_DMARXNDESCWBF_IPCB
1116#define ETH_CHECKSUM_IP_HEADER_ERROR ETH_DMARXNDESCWBF_IPHE
1117#define ETH_CHECKSUM_IP_PAYLOAD_ERROR ETH_DMARXNDESCWBF_IPCE
1126#define ETH_IP_HEADER_IPV4 ETH_DMARXNDESCWBF_IPV4
1127#define ETH_IP_HEADER_IPV6 ETH_DMARXNDESCWBF_IPV6
1136#define ETH_IP_PAYLOAD_UNKNOWN ETH_DMARXNDESCWBF_PT_UNKNOWN
1137#define ETH_IP_PAYLOAD_UDP ETH_DMARXNDESCWBF_PT_UDP
1138#define ETH_IP_PAYLOAD_TCP ETH_DMARXNDESCWBF_PT_TCP
1139#define ETH_IP_PAYLOAD_ICMPN ETH_DMARXNDESCWBF_PT_ICMP
1148#define ETH_HASH_FILTER_PASS ETH_DMARXNDESCWBF_HF
1149#define ETH_VLAN_FILTER_PASS ETH_DMARXNDESCWBF_VF
1150#define ETH_DEST_ADDRESS_FAIL ETH_DMARXNDESCWBF_DAF
1151#define ETH_SOURCE_ADDRESS_FAIL ETH_DMARXNDESCWBF_SAF
1159#define ETH_L3_FILTER0_MATCH ETH_DMARXNDESCWBF_L3FM
1160#define ETH_L3_FILTER1_MATCH (ETH_DMARXNDESCWBF_L3FM | ETH_DMARXNDESCWBF_L3L4FM)
1169#define ETH_L4_FILTER0_MATCH ETH_DMARXNDESCWBF_L4FM
1170#define ETH_L4_FILTER1_MATCH (ETH_DMARXNDESCWBF_L4FM | ETH_DMARXNDESCWBF_L3L4FM)
1179#define ETH_DRIBBLE_BIT_ERROR ETH_DMARXNDESCWBF_DE
1180#define ETH_RECEIVE_ERROR ETH_DMARXNDESCWBF_RE
1181#define ETH_RECEIVE_OVERFLOW ETH_DMARXNDESCWBF_OE
1182#define ETH_WATCHDOG_TIMEOUT ETH_DMARXNDESCWBF_RWT
1183#define ETH_GIANT_PACKET ETH_DMARXNDESCWBF_GP
1184#define ETH_CRC_ERROR ETH_DMARXNDESCWBF_CE
1193#define ETH_DMAARBITRATION_RX ETH_DMAMR_DA
1194#define ETH_DMAARBITRATION_RX1_TX1 0x00000000U
1195#define ETH_DMAARBITRATION_RX2_TX1 ETH_DMAMR_PR_2_1
1196#define ETH_DMAARBITRATION_RX3_TX1 ETH_DMAMR_PR_3_1
1197#define ETH_DMAARBITRATION_RX4_TX1 ETH_DMAMR_PR_4_1
1198#define ETH_DMAARBITRATION_RX5_TX1 ETH_DMAMR_PR_5_1
1199#define ETH_DMAARBITRATION_RX6_TX1 ETH_DMAMR_PR_6_1
1200#define ETH_DMAARBITRATION_RX7_TX1 ETH_DMAMR_PR_7_1
1201#define ETH_DMAARBITRATION_RX8_TX1 ETH_DMAMR_PR_8_1
1202#define ETH_DMAARBITRATION_TX (ETH_DMAMR_TXPR | ETH_DMAMR_DA)
1203#define ETH_DMAARBITRATION_TX1_RX1 0x00000000U
1204#define ETH_DMAARBITRATION_TX2_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_2_1)
1205#define ETH_DMAARBITRATION_TX3_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_3_1)
1206#define ETH_DMAARBITRATION_TX4_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_4_1)
1207#define ETH_DMAARBITRATION_TX5_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_5_1)
1208#define ETH_DMAARBITRATION_TX6_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_6_1)
1209#define ETH_DMAARBITRATION_TX7_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_7_1)
1210#define ETH_DMAARBITRATION_TX8_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_8_1)
1219#define ETH_BURSTLENGTH_FIXED ETH_DMASBMR_FB
1220#define ETH_BURSTLENGTH_MIXED ETH_DMASBMR_MB
1221#define ETH_BURSTLENGTH_UNSPECIFIED 0x00000000U
1230#define ETH_TXDMABURSTLENGTH_1BEAT ETH_DMACTCR_TPBL_1PBL
1231#define ETH_TXDMABURSTLENGTH_2BEAT ETH_DMACTCR_TPBL_2PBL
1232#define ETH_TXDMABURSTLENGTH_4BEAT ETH_DMACTCR_TPBL_4PBL
1233#define ETH_TXDMABURSTLENGTH_8BEAT ETH_DMACTCR_TPBL_8PBL
1234#define ETH_TXDMABURSTLENGTH_16BEAT ETH_DMACTCR_TPBL_16PBL
1235#define ETH_TXDMABURSTLENGTH_32BEAT ETH_DMACTCR_TPBL_32PBL
1244#define ETH_RXDMABURSTLENGTH_1BEAT ETH_DMACRCR_RPBL_1PBL
1245#define ETH_RXDMABURSTLENGTH_2BEAT ETH_DMACRCR_RPBL_2PBL
1246#define ETH_RXDMABURSTLENGTH_4BEAT ETH_DMACRCR_RPBL_4PBL
1247#define ETH_RXDMABURSTLENGTH_8BEAT ETH_DMACRCR_RPBL_8PBL
1248#define ETH_RXDMABURSTLENGTH_16BEAT ETH_DMACRCR_RPBL_16PBL
1249#define ETH_RXDMABURSTLENGTH_32BEAT ETH_DMACRCR_RPBL_32PBL
1258#define ETH_DMA_NORMAL_IT ETH_DMACIER_NIE
1259#define ETH_DMA_ABNORMAL_IT ETH_DMACIER_AIE
1260#define ETH_DMA_CONTEXT_DESC_ERROR_IT ETH_DMACIER_CDEE
1261#define ETH_DMA_FATAL_BUS_ERROR_IT ETH_DMACIER_FBEE
1262#define ETH_DMA_EARLY_RX_IT ETH_DMACIER_ERIE
1263#define ETH_DMA_EARLY_TX_IT ETH_DMACIER_ETIE
1264#define ETH_DMA_RX_WATCHDOG_TIMEOUT_IT ETH_DMACIER_RWTE
1265#define ETH_DMA_RX_PROCESS_STOPPED_IT ETH_DMACIER_RSE
1266#define ETH_DMA_RX_BUFFER_UNAVAILABLE_IT ETH_DMACIER_RBUE
1267#define ETH_DMA_RX_IT ETH_DMACIER_RIE
1268#define ETH_DMA_TX_BUFFER_UNAVAILABLE_IT ETH_DMACIER_TBUE
1269#define ETH_DMA_TX_PROCESS_STOPPED_IT ETH_DMACIER_TXSE
1270#define ETH_DMA_TX_IT ETH_DMACIER_TIE
1279#define ETH_DMA_RX_NO_ERROR_FLAG 0x00000000U
1280#define ETH_DMA_RX_DESC_READ_ERROR_FLAG (ETH_DMACSR_REB_BIT_2 | ETH_DMACSR_REB_BIT_1 | ETH_DMACSR_REB_BIT_0)
1281#define ETH_DMA_RX_DESC_WRITE_ERROR_FLAG (ETH_DMACSR_REB_BIT_2 | ETH_DMACSR_REB_BIT_1)
1282#define ETH_DMA_RX_BUFFER_READ_ERROR_FLAG (ETH_DMACSR_REB_BIT_2 | ETH_DMACSR_REB_BIT_0)
1283#define ETH_DMA_RX_BUFFER_WRITE_ERROR_FLAG ETH_DMACSR_REB_BIT_2
1284#define ETH_DMA_TX_NO_ERROR_FLAG 0x00000000U
1285#define ETH_DMA_TX_DESC_READ_ERROR_FLAG (ETH_DMACSR_TEB_BIT_2 | ETH_DMACSR_TEB_BIT_1 | ETH_DMACSR_TEB_BIT_0)
1286#define ETH_DMA_TX_DESC_WRITE_ERROR_FLAG (ETH_DMACSR_TEB_BIT_2 | ETH_DMACSR_TEB_BIT_1)
1287#define ETH_DMA_TX_BUFFER_READ_ERROR_FLAG (ETH_DMACSR_TEB_BIT_2 | ETH_DMACSR_TEB_BIT_0)
1288#define ETH_DMA_TX_BUFFER_WRITE_ERROR_FLAG ETH_DMACSR_TEB_BIT_2
1289#define ETH_DMA_CONTEXT_DESC_ERROR_FLAG ETH_DMACSR_CDE
1290#define ETH_DMA_FATAL_BUS_ERROR_FLAG ETH_DMACSR_FBE
1291#define ETH_DMA_EARLY_TX_IT_FLAG ETH_DMACSR_ERI
1292#define ETH_DMA_RX_WATCHDOG_TIMEOUT_FLAG ETH_DMACSR_RWT
1293#define ETH_DMA_RX_PROCESS_STOPPED_FLAG ETH_DMACSR_RPS
1294#define ETH_DMA_RX_BUFFER_UNAVAILABLE_FLAG ETH_DMACSR_RBU
1295#define ETH_DMA_TX_PROCESS_STOPPED_FLAG ETH_DMACSR_TPS
1304#define ETH_TRANSMITSTOREFORWARD ETH_MTLTQOMR_TSF
1305#define ETH_TRANSMITTHRESHOLD_32 ETH_MTLTQOMR_TTC_32BITS
1306#define ETH_TRANSMITTHRESHOLD_64 ETH_MTLTQOMR_TTC_64BITS
1307#define ETH_TRANSMITTHRESHOLD_96 ETH_MTLTQOMR_TTC_96BITS
1308#define ETH_TRANSMITTHRESHOLD_128 ETH_MTLTQOMR_TTC_128BITS
1309#define ETH_TRANSMITTHRESHOLD_192 ETH_MTLTQOMR_TTC_192BITS
1310#define ETH_TRANSMITTHRESHOLD_256 ETH_MTLTQOMR_TTC_256BITS
1311#define ETH_TRANSMITTHRESHOLD_384 ETH_MTLTQOMR_TTC_384BITS
1312#define ETH_TRANSMITTHRESHOLD_512 ETH_MTLTQOMR_TTC_512BITS
1321#define ETH_RECEIVESTOREFORWARD ETH_MTLRQOMR_RSF
1322#define ETH_RECEIVETHRESHOLD8_64 ETH_MTLRQOMR_RTC_64BITS
1323#define ETH_RECEIVETHRESHOLD8_32 ETH_MTLRQOMR_RTC_32BITS
1324#define ETH_RECEIVETHRESHOLD8_96 ETH_MTLRQOMR_RTC_96BITS
1325#define ETH_RECEIVETHRESHOLD8_128 ETH_MTLRQOMR_RTC_128BITS
1334#define ETH_PAUSELOWTHRESHOLD_MINUS_4 ETH_MACTFCR_PLT_MINUS4
1335#define ETH_PAUSELOWTHRESHOLD_MINUS_28 ETH_MACTFCR_PLT_MINUS28
1336#define ETH_PAUSELOWTHRESHOLD_MINUS_36 ETH_MACTFCR_PLT_MINUS36
1337#define ETH_PAUSELOWTHRESHOLD_MINUS_144 ETH_MACTFCR_PLT_MINUS144
1338#define ETH_PAUSELOWTHRESHOLD_MINUS_256 ETH_MACTFCR_PLT_MINUS256
1339#define ETH_PAUSELOWTHRESHOLD_MINUS_512 ETH_MACTFCR_PLT_MINUS512
1348#define ETH_WATCHDOGTIMEOUT_2KB ETH_MACWTR_WTO_2KB
1349#define ETH_WATCHDOGTIMEOUT_3KB ETH_MACWTR_WTO_3KB
1350#define ETH_WATCHDOGTIMEOUT_4KB ETH_MACWTR_WTO_4KB
1351#define ETH_WATCHDOGTIMEOUT_5KB ETH_MACWTR_WTO_5KB
1352#define ETH_WATCHDOGTIMEOUT_6KB ETH_MACWTR_WTO_6KB
1353#define ETH_WATCHDOGTIMEOUT_7KB ETH_MACWTR_WTO_7KB
1354#define ETH_WATCHDOGTIMEOUT_8KB ETH_MACWTR_WTO_8KB
1355#define ETH_WATCHDOGTIMEOUT_9KB ETH_MACWTR_WTO_9KB
1356#define ETH_WATCHDOGTIMEOUT_10KB ETH_MACWTR_WTO_10KB
1357#define ETH_WATCHDOGTIMEOUT_11KB ETH_MACWTR_WTO_12KB
1358#define ETH_WATCHDOGTIMEOUT_12KB ETH_MACWTR_WTO_12KB
1359#define ETH_WATCHDOGTIMEOUT_13KB ETH_MACWTR_WTO_13KB
1360#define ETH_WATCHDOGTIMEOUT_14KB ETH_MACWTR_WTO_14KB
1361#define ETH_WATCHDOGTIMEOUT_15KB ETH_MACWTR_WTO_15KB
1362#define ETH_WATCHDOGTIMEOUT_16KB ETH_MACWTR_WTO_16KB
1371#define ETH_INTERPACKETGAP_96BIT ETH_MACCR_IPG_96BIT
1372#define ETH_INTERPACKETGAP_88BIT ETH_MACCR_IPG_88BIT
1373#define ETH_INTERPACKETGAP_80BIT ETH_MACCR_IPG_80BIT
1374#define ETH_INTERPACKETGAP_72BIT ETH_MACCR_IPG_72BIT
1375#define ETH_INTERPACKETGAP_64BIT ETH_MACCR_IPG_64BIT
1376#define ETH_INTERPACKETGAP_56BIT ETH_MACCR_IPG_56BIT
1377#define ETH_INTERPACKETGAP_48BIT ETH_MACCR_IPG_48BIT
1378#define ETH_INTERPACKETGAP_40BIT ETH_MACCR_IPG_40BIT
1387#define ETH_SPEED_10M 0x00000000U
1388#define ETH_SPEED_100M ETH_MACCR_FES
1397#define ETH_FULLDUPLEX_MODE ETH_MACCR_DM
1398#define ETH_HALFDUPLEX_MODE 0x00000000U
1407#define ETH_BACKOFFLIMIT_10 ETH_MACCR_BL_10
1408#define ETH_BACKOFFLIMIT_8 ETH_MACCR_BL_8
1409#define ETH_BACKOFFLIMIT_4 ETH_MACCR_BL_4
1410#define ETH_BACKOFFLIMIT_1 ETH_MACCR_BL_1
1419#define ETH_PREAMBLELENGTH_7 ETH_MACCR_PRELEN_7
1420#define ETH_PREAMBLELENGTH_5 ETH_MACCR_PRELEN_5
1421#define ETH_PREAMBLELENGTH_3 ETH_MACCR_PRELEN_3
1430#define ETH_SOURCEADDRESS_DISABLE 0x00000000U
1431#define ETH_SOURCEADDRESS_INSERT_ADDR0 ETH_MACCR_SARC_INSADDR0
1432#define ETH_SOURCEADDRESS_INSERT_ADDR1 ETH_MACCR_SARC_INSADDR1
1433#define ETH_SOURCEADDRESS_REPLACE_ADDR0 ETH_MACCR_SARC_REPADDR0
1434#define ETH_SOURCEADDRESS_REPLACE_ADDR1 ETH_MACCR_SARC_REPADDR1
1443#define ETH_CTRLPACKETS_BLOCK_ALL ETH_MACPFR_PCF_BLOCKALL
1444#define ETH_CTRLPACKETS_FORWARD_ALL_EXCEPT_PA ETH_MACPFR_PCF_FORWARDALLEXCEPTPA
1445#define ETH_CTRLPACKETS_FORWARD_ALL ETH_MACPFR_PCF_FORWARDALL
1446#define ETH_CTRLPACKETS_FORWARD_PASSED_ADDR_FILTER ETH_MACPFR_PCF_FORWARDPASSEDADDRFILTER
1455#define ETH_VLANTAGCOMPARISON_16BIT 0x00000000U
1456#define ETH_VLANTAGCOMPARISON_12BIT ETH_MACVTR_ETV
1465#define ETH_MAC_ADDRESS0 0x00000000U
1466#define ETH_MAC_ADDRESS1 0x00000008U
1467#define ETH_MAC_ADDRESS2 0x00000010U
1468#define ETH_MAC_ADDRESS3 0x00000018U
1477#define ETH_MAC_RX_STATUS_IT ETH_MACIER_RXSTSIE
1478#define ETH_MAC_TX_STATUS_IT ETH_MACIER_TXSTSIE
1479#define ETH_MAC_TIMESTAMP_IT ETH_MACIER_TSIE
1480#define ETH_MAC_LPI_IT ETH_MACIER_LPIIE
1481#define ETH_MAC_PMT_IT ETH_MACIER_PMTIE
1482#define ETH_MAC_PHY_IT ETH_MACIER_PHYIE
1491#define ETH_WAKEUP_PACKET_RECIEVED ETH_MACPCSR_RWKPRCVD
1492#define ETH_MAGIC_PACKET_RECIEVED ETH_MACPCSR_MGKPRCVD
1501#define ETH_RECEIVE_WATCHDOG_TIMEOUT ETH_MACRXTXSR_RWT
1502#define ETH_EXECESSIVE_COLLISIONS ETH_MACRXTXSR_EXCOL
1503#define ETH_LATE_COLLISIONS ETH_MACRXTXSR_LCOL
1504#define ETH_EXECESSIVE_DEFERRAL ETH_MACRXTXSR_EXDEF
1505#define ETH_LOSS_OF_CARRIER ETH_MACRXTXSR_LCARR
1506#define ETH_NO_CARRIER ETH_MACRXTXSR_NCARR
1507#define ETH_TRANSMIT_JABBR_TIMEOUT ETH_MACRXTXSR_TJT
1516#define HAL_ETH_STATE_RESET 0x00000000U
1517#define HAL_ETH_STATE_READY 0x00000010U
1518#define HAL_ETH_STATE_BUSY 0x00000023U
1519#define HAL_ETH_STATE_STARTED 0x00000023U
1520#define HAL_ETH_STATE_ERROR 0x000000E0U
1529#define HAL_ETH_PTP_NOT_CONFIGURED 0x00000000U
1530#define HAL_ETH_PTP_CONFIGURED 0x00000001U
1539/* Exported macro ------------------------------------------------------------*/
1549#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
1550#define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) do{ \
1551 (__HANDLE__)->gState = HAL_ETH_STATE_RESET; \
1552 (__HANDLE__)->MspInitCallback = NULL; \
1553 (__HANDLE__)->MspDeInitCallback = NULL; \
1554 } while(0)
1555#else
1556#define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) do{ \
1557 (__HANDLE__)->gState = HAL_ETH_STATE_RESET; \
1558 } while(0)
1559#endif /*USE_HAL_ETH_REGISTER_CALLBACKS */
1560
1568#define __HAL_ETH_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMACIER |= (__INTERRUPT__))
1569
1577#define __HAL_ETH_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMACIER &= ~(__INTERRUPT__))
1578
1585#define __HAL_ETH_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
1586 (((__HANDLE__)->Instance->DMACIER & (__INTERRUPT__)) == (__INTERRUPT__))
1587
1594#define __HAL_ETH_DMA_GET_IT(__HANDLE__, __INTERRUPT__) \
1595 (((__HANDLE__)->Instance->DMACSR & (__INTERRUPT__)) == (__INTERRUPT__))
1596
1603#define __HAL_ETH_DMA_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMACSR = (__INTERRUPT__))
1604
1611#define __HAL_ETH_DMA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->DMACSR &( __FLAG__)) == ( __FLAG__))
1612
1619#define __HAL_ETH_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->DMACSR = ( __FLAG__))
1620
1629#define __HAL_ETH_MAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIER |= (__INTERRUPT__))
1630
1638#define __HAL_ETH_MAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIER &= ~(__INTERRUPT__))
1639
1646#define __HAL_ETH_MAC_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->MACISR &\
1647 ( __INTERRUPT__)) == ( __INTERRUPT__))
1648
1650#define ETH_WAKEUP_EXTI_LINE 0x00400000U /* !< 86 - 64 = 22 */
1651
1658#define __HAL_ETH_WAKEUP_EXTI_ENABLE_IT(__EXTI_LINE__) (EXTI_D1->IMR3 |= (__EXTI_LINE__))
1659
1666#define __HAL_ETH_WAKEUP_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI_D1->PR3 & (__EXTI_LINE__))
1667
1674#define __HAL_ETH_WAKEUP_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D1->PR3 = (__EXTI_LINE__))
1675
1676#if defined(DUAL_CORE)
1683#define __HAL_ETH_WAKEUP_EXTID2_ENABLE_IT(__EXTI_LINE__) (EXTI_D2->IMR3 |= (__EXTI_LINE__))
1684
1691#define __HAL_ETH_WAKEUP_EXTID2_GET_FLAG(__EXTI_LINE__) (EXTI_D2->PR3 & (__EXTI_LINE__))
1692
1699#define __HAL_ETH_WAKEUP_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D2->PR3 = (__EXTI_LINE__))
1700#endif /* DUAL_CORE */
1701
1708#define __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_EDGE(__EXTI_LINE__) (EXTI->FTSR3 &= ~(__EXTI_LINE__)); \
1709 (EXTI->RTSR3 |= (__EXTI_LINE__))
1710
1717#define __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR3 &= ~(__EXTI_LINE__));\
1718 (EXTI->FTSR3 |= (__EXTI_LINE__))
1719
1726#define __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR3 |= (__EXTI_LINE__));\
1727 (EXTI->FTSR3 |= (__EXTI_LINE__))
1728
1735#define __HAL_ETH_WAKEUP_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER3 |= (__EXTI_LINE__))
1736#define __HAL_ETH_GET_PTP_CONTROL(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->MACTSCR) & \
1737 (__FLAG__)) == (__FLAG__)) ? SET : RESET)
1738#define __HAL_ETH_SET_PTP_CONTROL(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->MACTSCR |= (__FLAG__))
1739
1744/* Include ETH HAL Extension module */
1745#include "stm32h7xx_hal_eth_ex.h"
1746
1747/* Exported functions --------------------------------------------------------*/
1748
1756/* Initialization and de initialization functions **********************************/
1757HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth);
1758HAL_StatusTypeDef HAL_ETH_DeInit(ETH_HandleTypeDef *heth);
1759void HAL_ETH_MspInit(ETH_HandleTypeDef *heth);
1760void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth);
1761
1762/* Callbacks Register/UnRegister functions ***********************************/
1763#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
1764HAL_StatusTypeDef HAL_ETH_RegisterCallback(ETH_HandleTypeDef *heth, HAL_ETH_CallbackIDTypeDef CallbackID,
1765 pETH_CallbackTypeDef pCallback);
1766HAL_StatusTypeDef HAL_ETH_UnRegisterCallback(ETH_HandleTypeDef *heth, HAL_ETH_CallbackIDTypeDef CallbackID);
1767#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
1768
1776/* IO operation functions *******************************************************/
1777HAL_StatusTypeDef HAL_ETH_Start(ETH_HandleTypeDef *heth);
1778HAL_StatusTypeDef HAL_ETH_Start_IT(ETH_HandleTypeDef *heth);
1779HAL_StatusTypeDef HAL_ETH_Stop(ETH_HandleTypeDef *heth);
1780HAL_StatusTypeDef HAL_ETH_Stop_IT(ETH_HandleTypeDef *heth);
1781
1782HAL_StatusTypeDef HAL_ETH_ReadData(ETH_HandleTypeDef *heth, void **pAppBuff);
1783HAL_StatusTypeDef HAL_ETH_RegisterRxAllocateCallback(ETH_HandleTypeDef *heth,
1784 pETH_rxAllocateCallbackTypeDef rxAllocateCallback);
1785HAL_StatusTypeDef HAL_ETH_UnRegisterRxAllocateCallback(ETH_HandleTypeDef *heth);
1786HAL_StatusTypeDef HAL_ETH_RegisterRxLinkCallback(ETH_HandleTypeDef *heth, pETH_rxLinkCallbackTypeDef rxLinkCallback);
1787HAL_StatusTypeDef HAL_ETH_UnRegisterRxLinkCallback(ETH_HandleTypeDef *heth);
1788HAL_StatusTypeDef HAL_ETH_GetRxDataErrorCode(const ETH_HandleTypeDef *heth, uint32_t *pErrorCode);
1789HAL_StatusTypeDef HAL_ETH_RegisterTxFreeCallback(ETH_HandleTypeDef *heth, pETH_txFreeCallbackTypeDef txFreeCallback);
1790HAL_StatusTypeDef HAL_ETH_UnRegisterTxFreeCallback(ETH_HandleTypeDef *heth);
1791HAL_StatusTypeDef HAL_ETH_ReleaseTxPacket(ETH_HandleTypeDef *heth);
1792
1793#ifdef HAL_ETH_USE_PTP
1794HAL_StatusTypeDef HAL_ETH_PTP_SetConfig(ETH_HandleTypeDef *heth, ETH_PTP_ConfigTypeDef *ptpconfig);
1795HAL_StatusTypeDef HAL_ETH_PTP_GetConfig(ETH_HandleTypeDef *heth, ETH_PTP_ConfigTypeDef *ptpconfig);
1796HAL_StatusTypeDef HAL_ETH_PTP_SetTime(ETH_HandleTypeDef *heth, ETH_TimeTypeDef *time);
1797HAL_StatusTypeDef HAL_ETH_PTP_GetTime(ETH_HandleTypeDef *heth, ETH_TimeTypeDef *time);
1798HAL_StatusTypeDef HAL_ETH_PTP_AddTimeOffset(ETH_HandleTypeDef *heth, ETH_PtpUpdateTypeDef ptpoffsettype,
1799 ETH_TimeTypeDef *timeoffset);
1800HAL_StatusTypeDef HAL_ETH_PTP_InsertTxTimestamp(ETH_HandleTypeDef *heth);
1801HAL_StatusTypeDef HAL_ETH_PTP_GetTxTimestamp(ETH_HandleTypeDef *heth, ETH_TimeStampTypeDef *timestamp);
1802HAL_StatusTypeDef HAL_ETH_PTP_GetRxTimestamp(ETH_HandleTypeDef *heth, ETH_TimeStampTypeDef *timestamp);
1803HAL_StatusTypeDef HAL_ETH_RegisterTxPtpCallback(ETH_HandleTypeDef *heth, pETH_txPtpCallbackTypeDef txPtpCallback);
1804HAL_StatusTypeDef HAL_ETH_UnRegisterTxPtpCallback(ETH_HandleTypeDef *heth);
1805#endif /* HAL_ETH_USE_PTP */
1806
1807HAL_StatusTypeDef HAL_ETH_Transmit(ETH_HandleTypeDef *heth, ETH_TxPacketConfigTypeDef *pTxConfig, uint32_t Timeout);
1808HAL_StatusTypeDef HAL_ETH_Transmit_IT(ETH_HandleTypeDef *heth, ETH_TxPacketConfigTypeDef *pTxConfig);
1809
1810HAL_StatusTypeDef HAL_ETH_WritePHYRegister(const ETH_HandleTypeDef *heth, uint32_t PHYAddr, uint32_t PHYReg,
1811 uint32_t RegValue);
1812HAL_StatusTypeDef HAL_ETH_ReadPHYRegister(ETH_HandleTypeDef *heth, uint32_t PHYAddr, uint32_t PHYReg,
1813 uint32_t *pRegValue);
1814
1815void HAL_ETH_IRQHandler(ETH_HandleTypeDef *heth);
1816void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *heth);
1817void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth);
1818void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth);
1819void HAL_ETH_PMTCallback(ETH_HandleTypeDef *heth);
1820void HAL_ETH_EEECallback(ETH_HandleTypeDef *heth);
1821void HAL_ETH_WakeUpCallback(ETH_HandleTypeDef *heth);
1822void HAL_ETH_RxAllocateCallback(uint8_t **buff);
1823void HAL_ETH_RxLinkCallback(void **pStart, void **pEnd, uint8_t *buff, uint16_t Length);
1824void HAL_ETH_TxFreeCallback(uint32_t *buff);
1825void HAL_ETH_TxPtpCallback(uint32_t *buff, ETH_TimeStampTypeDef *timestamp);
1833/* Peripheral Control functions **********************************************/
1834/* MAC & DMA Configuration APIs **********************************************/
1835HAL_StatusTypeDef HAL_ETH_GetMACConfig(const ETH_HandleTypeDef *heth, ETH_MACConfigTypeDef *macconf);
1836HAL_StatusTypeDef HAL_ETH_GetDMAConfig(const ETH_HandleTypeDef *heth, ETH_DMAConfigTypeDef *dmaconf);
1837HAL_StatusTypeDef HAL_ETH_SetMACConfig(ETH_HandleTypeDef *heth, ETH_MACConfigTypeDef *macconf);
1838HAL_StatusTypeDef HAL_ETH_SetDMAConfig(ETH_HandleTypeDef *heth, ETH_DMAConfigTypeDef *dmaconf);
1839void HAL_ETH_SetMDIOClockRange(ETH_HandleTypeDef *heth);
1840
1841/* MAC VLAN Processing APIs ************************************************/
1842void HAL_ETH_SetRxVLANIdentifier(ETH_HandleTypeDef *heth, uint32_t ComparisonBits,
1843 uint32_t VLANIdentifier);
1844
1845/* MAC L2 Packet Filtering APIs **********************************************/
1846HAL_StatusTypeDef HAL_ETH_GetMACFilterConfig(const ETH_HandleTypeDef *heth, ETH_MACFilterConfigTypeDef *pFilterConfig);
1847HAL_StatusTypeDef HAL_ETH_SetMACFilterConfig(ETH_HandleTypeDef *heth, const ETH_MACFilterConfigTypeDef *pFilterConfig);
1848HAL_StatusTypeDef HAL_ETH_SetHashTable(ETH_HandleTypeDef *heth, uint32_t *pHashTable);
1849HAL_StatusTypeDef HAL_ETH_SetSourceMACAddrMatch(const ETH_HandleTypeDef *heth, uint32_t AddrNbr,
1850 const uint8_t *pMACAddr);
1851
1852/* MAC Power Down APIs *****************************************************/
1853void HAL_ETH_EnterPowerDownMode(ETH_HandleTypeDef *heth,
1854 const ETH_PowerDownConfigTypeDef *pPowerDownConfig);
1855void HAL_ETH_ExitPowerDownMode(ETH_HandleTypeDef *heth);
1856HAL_StatusTypeDef HAL_ETH_SetWakeUpFilter(ETH_HandleTypeDef *heth, uint32_t *pFilter, uint32_t Count);
1857
1865/* Peripheral State functions **************************************************/
1866HAL_ETH_StateTypeDef HAL_ETH_GetState(const ETH_HandleTypeDef *heth);
1867uint32_t HAL_ETH_GetError(const ETH_HandleTypeDef *heth);
1868uint32_t HAL_ETH_GetDMAError(const ETH_HandleTypeDef *heth);
1869uint32_t HAL_ETH_GetMACError(const ETH_HandleTypeDef *heth);
1870uint32_t HAL_ETH_GetMACWakeUpSource(const ETH_HandleTypeDef *heth);
1887#endif /* ETH */
1888
1889#ifdef __cplusplus
1890}
1891#endif
1892
1893#endif /* STM32H7xx_HAL_ETH_H */
#define __IO
Definition: core_cm4.h:239
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
Header file of ETH HAL Extended module.
Ethernet MAC.
Definition: stm32h723xx.h:717