RTEMS 6.1-rc2
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
28/* Includes ------------------------------------------------------------------*/
29#include "stm32h7xx_hal_def.h"
30
31#if defined(ETH)
32
41/* Exported types ------------------------------------------------------------*/
42#ifndef ETH_TX_DESC_CNT
43#define ETH_TX_DESC_CNT 4U
44#endif /* ETH_TX_DESC_CNT */
45
46#ifndef ETH_RX_DESC_CNT
47#define ETH_RX_DESC_CNT 4U
48#endif /* ETH_RX_DESC_CNT */
49
50#ifndef ETH_SWRESET_TIMEOUT
51#define ETH_SWRESET_TIMEOUT 500U
52#endif /* ETH_SWRESET_TIMEOUT */
53
54#ifndef ETH_MDIO_BUS_TIMEOUT
55#define ETH_MDIO_BUS_TIMEOUT 1000U
56#endif /* ETH_MDIO_BUS_TIMEOUT */
57
58#ifndef ETH_MAC_US_TICK
59#define ETH_MAC_US_TICK 1000000U
60#endif /* ETH_MAC_US_TICK */
61
62/*********************** Descriptors struct def section ************************/
71typedef struct
72{
73 __IO uint32_t DESC0;
74 __IO uint32_t DESC1;
75 __IO uint32_t DESC2;
76 __IO uint32_t DESC3;
77 uint32_t BackupAddr0; /* used to store rx buffer 1 address */
78 uint32_t BackupAddr1; /* used to store rx buffer 2 address */
79} ETH_DMADescTypeDef;
87typedef struct __ETH_BufferTypeDef
88{
89 uint8_t *buffer; /*<! buffer address */
90
91 uint32_t len; /*<! buffer length */
92
93 struct __ETH_BufferTypeDef *next; /*<! Pointer to the next buffer in the list */
94} ETH_BufferTypeDef;
102typedef struct
103{
104 uint32_t TxDesc[ETH_TX_DESC_CNT]; /*<! Tx DMA descriptors addresses */
105
106 uint32_t CurTxDesc; /*<! Current Tx descriptor index for packet transmission */
107
108 uint32_t *PacketAddress[ETH_TX_DESC_CNT]; /*<! Ethernet packet addresses array */
109
110 uint32_t *CurrentPacketAddress; /*<! Current transmit NX_PACKET addresses */
111
112 uint32_t BuffersInUse; /*<! Buffers in Use */
113
114 uint32_t releaseIndex; /*<! Release index */
115} ETH_TxDescListTypeDef;
123typedef struct
124{
125 uint32_t Attributes;
128 uint32_t Length;
130 ETH_BufferTypeDef *TxBuffer;
132 uint32_t SrcAddrCtrl;
135 uint32_t CRCPadCtrl;
138 uint32_t ChecksumCtrl;
141 uint32_t MaxSegmentSize;
144 uint32_t PayloadLen;
147 uint32_t TCPHeaderLen;
150 uint32_t VlanTag;
153 uint32_t VlanCtrl;
156 uint32_t InnerVlanTag;
159 uint32_t InnerVlanCtrl;
162 void *pData;
164} ETH_TxPacketConfig;
172typedef struct
173{
174 uint32_t TimeStampLow;
175 uint32_t TimeStampHigh;
176
177} ETH_TimeStampTypeDef;
182#ifdef HAL_ETH_USE_PTP
186typedef struct
187{
188 uint32_t Seconds;
189 uint32_t NanoSeconds;
190} ETH_TimeTypeDef;
194#endif /* HAL_ETH_USE_PTP */
195
199typedef struct
200{
201 uint32_t RxDesc[ETH_RX_DESC_CNT]; /*<! Rx DMA descriptors addresses. */
202
203 uint32_t ItMode; /*<! If 1, DMA will generate the Rx complete interrupt.
204 If 0, DMA will not generate the Rx complete interrupt. */
205
206 uint32_t RxDescIdx; /*<! Current Rx descriptor. */
207
208 uint32_t RxDescCnt; /*<! Number of descriptors . */
209
210 uint32_t RxDataLength; /*<! Received Data Length. */
211
212 uint32_t RxBuildDescIdx; /*<! Current Rx Descriptor for building descriptors. */
213
214 uint32_t RxBuildDescCnt; /*<! Number of Rx Descriptors awaiting building. */
215
216 uint32_t pRxLastRxDesc; /*<! Last received descriptor. */
217
218 ETH_TimeStampTypeDef TimeStamp; /*<! Time Stamp Low value for receive. */
219
220 void *pRxStart; /*<! Pointer to the first buff. */
221
222 void *pRxEnd; /*<! Pointer to the last buff. */
223
224} ETH_RxDescListTypeDef;
232typedef struct
233{
234 uint32_t
235 SourceAddrControl;
238 FunctionalState
239 ChecksumOffload;
241 uint32_t InterPacketGapVal;
244 FunctionalState GiantPacketSizeLimitControl;
246 FunctionalState Support2KPacket;
248 FunctionalState CRCStripTypePacket;
250 FunctionalState AutomaticPadCRCStrip;
252 FunctionalState Watchdog;
254 FunctionalState Jabber;
256 FunctionalState JumboPacket;
260 uint32_t Speed;
263 uint32_t DuplexMode;
266 FunctionalState LoopbackMode;
268 FunctionalState
269 CarrierSenseBeforeTransmit;
271 FunctionalState ReceiveOwn;
273 FunctionalState
274 CarrierSenseDuringTransmit;
276 FunctionalState
277 RetryTransmission;
279 uint32_t BackOffLimit;
282 FunctionalState
283 DeferralCheck;
285 uint32_t
286 PreambleLength;
289 FunctionalState
290 UnicastSlowProtocolPacketDetect;
292 FunctionalState SlowProtocolDetect;
294 FunctionalState CRCCheckingRxPackets;
296 uint32_t
297 GiantPacketSizeLimit;
302 FunctionalState ExtendedInterPacketGap;
304 uint32_t ExtendedInterPacketGapVal;
307 FunctionalState ProgrammableWatchdog;
309 uint32_t WatchdogTimeout;
312 uint32_t
313 PauseTime;
317 FunctionalState
318 ZeroQuantaPause;
320 uint32_t
321 PauseLowThreshold;
324 FunctionalState
325 TransmitFlowControl;
328 FunctionalState
329 UnicastPausePacketDetect;
331 FunctionalState ReceiveFlowControl;
334 uint32_t TransmitQueueMode;
337 uint32_t ReceiveQueueMode;
340 FunctionalState DropTCPIPChecksumErrorPacket;
342 FunctionalState ForwardRxErrorPacket;
344 FunctionalState ForwardRxUndersizedGoodPacket;
345} ETH_MACConfigTypeDef;
353typedef struct
354{
355 uint32_t DMAArbitration;
358 FunctionalState AddressAlignedBeats;
361 uint32_t BurstMode;
364 FunctionalState RebuildINCRxBurst;
367 FunctionalState PBLx8Mode;
369 uint32_t
370 TxDMABurstLength;
373 FunctionalState
374 SecondPacketOperate;
378 uint32_t
379 RxDMABurstLength;
382 FunctionalState FlushRxPacket;
384 FunctionalState TCPSegmentation;
386 uint32_t
387 MaximumSegmentSize;
389} ETH_DMAConfigTypeDef;
397typedef enum
398{
399 HAL_ETH_MII_MODE = 0x00U,
400 HAL_ETH_RMII_MODE = 0x01U
401} ETH_MediaInterfaceTypeDef;
406#ifdef HAL_ETH_USE_PTP
410typedef enum
411{
412 HAL_ETH_PTP_POSITIVE_UPDATE = 0x00000000U,
413 HAL_ETH_PTP_NEGATIVE_UPDATE = 0x00000001U
414} ETH_PtpUpdateTypeDef;
418#endif /* HAL_ETH_USE_PTP */
419
423typedef struct
424{
425
426 uint8_t
427 *MACAddr;
429 ETH_MediaInterfaceTypeDef MediaInterface;
431 ETH_DMADescTypeDef
432 *TxDesc;
434 ETH_DMADescTypeDef
435 *RxDesc;
437 uint32_t RxBuffLen;
439} ETH_InitTypeDef;
444#ifdef HAL_ETH_USE_PTP
448typedef struct
449{
450 uint32_t Timestamp;
451 uint32_t TimestampUpdateMode;
452 uint32_t TimestampInitialize;
453 uint32_t TimestampUpdate;
454 uint32_t TimestampAddendUpdate;
455 uint32_t TimestampAll;
456 uint32_t TimestampRolloverMode;
457 uint32_t TimestampV2;
458 uint32_t TimestampEthernet;
459 uint32_t TimestampIPv6;
460 uint32_t TimestampIPv4;
461 uint32_t TimestampEvent;
462 uint32_t TimestampMaster;
463 uint32_t TimestampSnapshots;
464 uint32_t TimestampFilter;
465 uint32_t
466 TimestampChecksumCorrection;
467 uint32_t TimestampStatusMode;
468 uint32_t TimestampAddend;
469 uint32_t TimestampSubsecondInc;
471} ETH_PTP_ConfigTypeDef;
475#endif /* HAL_ETH_USE_PTP */
476
480typedef uint32_t HAL_ETH_StateTypeDef;
488typedef void (*pETH_rxAllocateCallbackTypeDef)(uint8_t **buffer);
496typedef void (*pETH_rxLinkCallbackTypeDef)(void **pStart, void **pEnd, uint8_t *buff,
497 uint16_t Length);
505typedef void (*pETH_txFreeCallbackTypeDef)(uint32_t *buffer);
513typedef void (*pETH_txPtpCallbackTypeDef)(uint32_t *buffer,
514 ETH_TimeStampTypeDef *timestamp);
522#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
523typedef struct __ETH_HandleTypeDef
524#else
525typedef struct
526#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
527{
528 ETH_TypeDef *Instance;
530 ETH_InitTypeDef Init;
532 ETH_TxDescListTypeDef TxDescList;
535 ETH_RxDescListTypeDef RxDescList;
538#ifdef HAL_ETH_USE_PTP
539 ETH_TimeStampTypeDef TxTimestamp;
540#endif /* HAL_ETH_USE_PTP */
541
542 __IO HAL_ETH_StateTypeDef gState;
546 __IO uint32_t ErrorCode;
549 __IO uint32_t
550 DMAErrorCode;
554 __IO uint32_t
555 MACErrorCode;
559 __IO uint32_t MACWakeUpEvent;
563 __IO uint32_t MACLPIEvent;
566 __IO uint32_t IsPtpConfigured;
570#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
571
572 void (* TxCpltCallback)(struct __ETH_HandleTypeDef *heth);
573 void (* RxCpltCallback)(struct __ETH_HandleTypeDef *heth);
574 void (* ErrorCallback)(struct __ETH_HandleTypeDef *heth);
575 void (* PMTCallback)(struct __ETH_HandleTypeDef *heth);
576 void (* EEECallback)(struct __ETH_HandleTypeDef *heth);
577 void (* WakeUpCallback)(struct __ETH_HandleTypeDef *heth);
579 void (* MspInitCallback)(struct __ETH_HandleTypeDef *heth);
580 void (* MspDeInitCallback)(struct __ETH_HandleTypeDef *heth);
582#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
583
584 pETH_rxAllocateCallbackTypeDef rxAllocateCallback;
585 pETH_rxLinkCallbackTypeDef rxLinkCallback;
586 pETH_txFreeCallbackTypeDef txFreeCallback;
587 pETH_txPtpCallbackTypeDef txPtpCallback;
589} ETH_HandleTypeDef;
594#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
598typedef enum
599{
600 HAL_ETH_MSPINIT_CB_ID = 0x00U,
601 HAL_ETH_MSPDEINIT_CB_ID = 0x01U,
603 HAL_ETH_TX_COMPLETE_CB_ID = 0x02U,
604 HAL_ETH_RX_COMPLETE_CB_ID = 0x03U,
605 HAL_ETH_ERROR_CB_ID = 0x04U,
606 HAL_ETH_PMT_CB_ID = 0x06U,
607 HAL_ETH_EEE_CB_ID = 0x07U,
608 HAL_ETH_WAKEUP_CB_ID = 0x08U
611} HAL_ETH_CallbackIDTypeDef;
612
616typedef void (*pETH_CallbackTypeDef)(ETH_HandleTypeDef *heth);
618#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
619
623typedef struct
624{
625 FunctionalState PromiscuousMode;
627 FunctionalState ReceiveAllMode;
629 FunctionalState HachOrPerfectFilter;
631 FunctionalState HashUnicast;
633 FunctionalState HashMulticast;
635 FunctionalState PassAllMulticast;
637 FunctionalState SrcAddrFiltering;
639 FunctionalState SrcAddrInverseFiltering;
641 FunctionalState DestAddrInverseFiltering;
643 FunctionalState BroadcastFilter;
645 uint32_t ControlPacketsFilter;
647} ETH_MACFilterConfigTypeDef;
655typedef struct
656{
657 FunctionalState WakeUpPacket;
659 FunctionalState MagicPacket;
661 FunctionalState GlobalUnicast;
663 FunctionalState WakeUpForward;
665} ETH_PowerDownConfigTypeDef;
674/* Exported constants --------------------------------------------------------*/
685/*
686 DMA Tx Normal Descriptor Read Format
687 -----------------------------------------------------------------------------------------------
688 TDES0 | Buffer1 or Header Address [31:0] |
689 -----------------------------------------------------------------------------------------------
690 TDES1 | Buffer2 Address [31:0] / Next Descriptor Address [31:0] |
691 -----------------------------------------------------------------------------------------------
692 TDES2 | IOC(31) | TTSE(30) | Buff2 Length[29:16] | VTIR[15:14] | Header or Buff1 Length[13:0] |
693 -----------------------------------------------------------------------------------------------
694 TDES3 | OWN(31) | CTRL[30:26] | Reserved[25:24] | CTRL[23:20] | Reserved[19:17] | Status[16:0] |
695 -----------------------------------------------------------------------------------------------
696*/
697
701#define ETH_DMATXNDESCRF_B1AP 0xFFFFFFFFU
706#define ETH_DMATXNDESCRF_B2AP 0xFFFFFFFFU
711#define ETH_DMATXNDESCRF_IOC 0x80000000U
712#define ETH_DMATXNDESCRF_TTSE 0x40000000U
713#define ETH_DMATXNDESCRF_B2L 0x3FFF0000U
714#define ETH_DMATXNDESCRF_VTIR 0x0000C000U
715#define ETH_DMATXNDESCRF_VTIR_DISABLE 0x00000000U
716#define ETH_DMATXNDESCRF_VTIR_REMOVE 0x00004000U
717#define ETH_DMATXNDESCRF_VTIR_INSERT 0x00008000U
718#define ETH_DMATXNDESCRF_VTIR_REPLACE 0x0000C000U
719#define ETH_DMATXNDESCRF_B1L 0x00003FFFU
720#define ETH_DMATXNDESCRF_HL 0x000003FFU
725#define ETH_DMATXNDESCRF_OWN 0x80000000U
726#define ETH_DMATXNDESCRF_CTXT 0x40000000U
727#define ETH_DMATXNDESCRF_FD 0x20000000U
728#define ETH_DMATXNDESCRF_LD 0x10000000U
729#define ETH_DMATXNDESCRF_CPC 0x0C000000U
730#define ETH_DMATXNDESCRF_CPC_CRCPAD_INSERT 0x00000000U
731#define ETH_DMATXNDESCRF_CPC_CRC_INSERT 0x04000000U
732#define ETH_DMATXNDESCRF_CPC_DISABLE 0x08000000U
733#define ETH_DMATXNDESCRF_CPC_CRC_REPLACE 0x0C000000U
734#define ETH_DMATXNDESCRF_SAIC 0x03800000U
735#define ETH_DMATXNDESCRF_SAIC_DISABLE 0x00000000U
736#define ETH_DMATXNDESCRF_SAIC_INSERT 0x00800000U
737#define ETH_DMATXNDESCRF_SAIC_REPLACE 0x01000000U
738#define ETH_DMATXNDESCRF_THL 0x00780000U
739#define ETH_DMATXNDESCRF_TSE 0x00040000U
740#define ETH_DMATXNDESCRF_CIC 0x00030000U
741#define ETH_DMATXNDESCRF_CIC_DISABLE 0x00000000U
742#define ETH_DMATXNDESCRF_CIC_IPHDR_INSERT 0x00010000U
743#define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT 0x00020000U
747#define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT_PHDR_CALC 0x00030000U
751#define ETH_DMATXNDESCRF_TPL 0x0003FFFFU
752#define ETH_DMATXNDESCRF_FL 0x00007FFFU
754/*
755 DMA Tx Normal Descriptor Write Back Format
756 -----------------------------------------------------------------------------------------------
757 TDES0 | Timestamp Low |
758 -----------------------------------------------------------------------------------------------
759 TDES1 | Timestamp High |
760 -----------------------------------------------------------------------------------------------
761 TDES2 | Reserved[31:0] |
762 -----------------------------------------------------------------------------------------------
763 TDES3 | OWN(31) | Status[30:0] |
764 -----------------------------------------------------------------------------------------------
765*/
766
770#define ETH_DMATXNDESCWBF_TTSL 0xFFFFFFFFU
775#define ETH_DMATXNDESCWBF_TTSH 0xFFFFFFFFU
780#define ETH_DMATXNDESCWBF_OWN 0x80000000U
781#define ETH_DMATXNDESCWBF_CTXT 0x40000000U
782#define ETH_DMATXNDESCWBF_FD 0x20000000U
783#define ETH_DMATXNDESCWBF_LD 0x10000000U
784#define ETH_DMATXNDESCWBF_TTSS 0x00020000U
785#define ETH_DMATXNDESCWBF_DP 0x04000000U
786#define ETH_DMATXNDESCWBF_TTSE 0x02000000U
787#define ETH_DMATXNDESCWBF_ES 0x00008000U
788#define ETH_DMATXNDESCWBF_JT 0x00004000U
789#define ETH_DMATXNDESCWBF_FF 0x00002000U
790#define ETH_DMATXNDESCWBF_PCE 0x00001000U
791#define ETH_DMATXNDESCWBF_LCA 0x00000800U
792#define ETH_DMATXNDESCWBF_NC 0x00000400U
793#define ETH_DMATXNDESCWBF_LCO 0x00000200U
794#define ETH_DMATXNDESCWBF_EC 0x00000100U
795#define ETH_DMATXNDESCWBF_CC 0x000000F0U
796#define ETH_DMATXNDESCWBF_ED 0x00000008U
797#define ETH_DMATXNDESCWBF_UF 0x00000004U
798#define ETH_DMATXNDESCWBF_DB 0x00000002U
799#define ETH_DMATXNDESCWBF_IHE 0x00000004U
802/*
803 DMA Tx Context Descriptor
804 -----------------------------------------------------------------------------------------------
805 TDES0 | Timestamp Low |
806 -----------------------------------------------------------------------------------------------
807 TDES1 | Timestamp High |
808 -----------------------------------------------------------------------------------------------
809 TDES2 | Inner VLAN Tag[31:16] | Reserved(15) | Maximum Segment Size [14:0] |
810 -----------------------------------------------------------------------------------------------
811 TDES3 | OWN(31) | Status[30:0] |
812 -----------------------------------------------------------------------------------------------
813*/
814
818#define ETH_DMATXCDESC_TTSL 0xFFFFFFFFU
823#define ETH_DMATXCDESC_TTSH 0xFFFFFFFFU
828#define ETH_DMATXCDESC_IVT 0xFFFF0000U
829#define ETH_DMATXCDESC_MSS 0x00003FFFU
834#define ETH_DMATXCDESC_OWN 0x80000000U
835#define ETH_DMATXCDESC_CTXT 0x40000000U
836#define ETH_DMATXCDESC_OSTC 0x08000000U
837#define ETH_DMATXCDESC_TCMSSV 0x04000000U
838#define ETH_DMATXCDESC_CDE 0x00800000U
839#define ETH_DMATXCDESC_IVTIR 0x000C0000U
840#define ETH_DMATXCDESC_IVTIR_DISABLE 0x00000000U
841#define ETH_DMATXCDESC_IVTIR_REMOVE 0x00040000U
842#define ETH_DMATXCDESC_IVTIR_INSERT 0x00080000U
843#define ETH_DMATXCDESC_IVTIR_REPLACE 0x000C0000U
844#define ETH_DMATXCDESC_IVLTV 0x00020000U
845#define ETH_DMATXCDESC_VLTV 0x00010000U
846#define ETH_DMATXCDESC_VT 0x0000FFFFU
858/*
859 DMA Rx Normal Descriptor read format
860 -----------------------------------------------------------------------------------------------------------
861 RDES0 | Buffer1 or Header Address [31:0] |
862 -----------------------------------------------------------------------------------------------------------
863 RDES1 | Reserved |
864 -----------------------------------------------------------------------------------------------------------
865 RDES2 | Payload or Buffer2 Address[31:0] |
866 -----------------------------------------------------------------------------------------------------------
867 RDES3 | OWN(31) | IOC(30) | Reserved [29:26] | BUF2V(25) | BUF1V(24) | Reserved [23:0] |
868 -----------------------------------------------------------------------------------------------------------
869*/
870
874#define ETH_DMARXNDESCRF_BUF1AP 0xFFFFFFFFU
879#define ETH_DMARXNDESCRF_BUF2AP 0xFFFFFFFFU
884#define ETH_DMARXNDESCRF_OWN 0x80000000U
885#define ETH_DMARXNDESCRF_IOC 0x40000000U
886#define ETH_DMARXNDESCRF_BUF2V 0x02000000U
887#define ETH_DMARXNDESCRF_BUF1V 0x01000000U
889/*
890 DMA Rx Normal Descriptor write back format
891 ---------------------------------------------------------------------------------------------------------------------
892 RDES0 | Inner VLAN Tag[31:16] | Outer VLAN Tag[15:0] |
893 ---------------------------------------------------------------------------------------------------------------------
894 RDES1 | OAM code, or MAC Control Opcode [31:16] | Extended Status |
895 ---------------------------------------------------------------------------------------------------------------------
896 RDES2 | MAC Filter Status[31:16] | VF(15) | Reserved [14:12] | ARP Status [11:10] | Header Length [9:0] |
897 ---------------------------------------------------------------------------------------------------------------------
898 RDES3 | OWN(31) | CTXT(30) | FD(29) | LD(28) | Status[27:16] | ES(15) | Packet Length[14:0] |
899 ---------------------------------------------------------------------------------------------------------------------
900*/
901
905#define ETH_DMARXNDESCWBF_IVT 0xFFFF0000U
906#define ETH_DMARXNDESCWBF_OVT 0x0000FFFFU
911#define ETH_DMARXNDESCWBF_OPC 0xFFFF0000U
912#define ETH_DMARXNDESCWBF_TD 0x00008000U
913#define ETH_DMARXNDESCWBF_TSA 0x00004000U
914#define ETH_DMARXNDESCWBF_PV 0x00002000U
915#define ETH_DMARXNDESCWBF_PFT 0x00001000U
916#define ETH_DMARXNDESCWBF_PMT_NO 0x00000000U
917#define ETH_DMARXNDESCWBF_PMT_SYNC 0x00000100U
918#define ETH_DMARXNDESCWBF_PMT_FUP 0x00000200U
919#define ETH_DMARXNDESCWBF_PMT_DREQ 0x00000300U
920#define ETH_DMARXNDESCWBF_PMT_DRESP 0x00000400U
921#define ETH_DMARXNDESCWBF_PMT_PDREQ 0x00000500U
922#define ETH_DMARXNDESCWBF_PMT_PDRESP 0x00000600U
923#define ETH_DMARXNDESCWBF_PMT_PDRESPFUP 0x00000700U
924#define ETH_DMARXNDESCWBF_PMT_ANNOUNCE 0x00000800U
925#define ETH_DMARXNDESCWBF_PMT_MANAG 0x00000900U
926#define ETH_DMARXNDESCWBF_PMT_SIGN 0x00000A00U
927#define ETH_DMARXNDESCWBF_PMT_RESERVED 0x00000F00U
928#define ETH_DMARXNDESCWBF_IPCE 0x00000080U
929#define ETH_DMARXNDESCWBF_IPCB 0x00000040U
930#define ETH_DMARXNDESCWBF_IPV6 0x00000020U
931#define ETH_DMARXNDESCWBF_IPV4 0x00000010U
932#define ETH_DMARXNDESCWBF_IPHE 0x00000008U
933#define ETH_DMARXNDESCWBF_PT 0x00000003U
934#define ETH_DMARXNDESCWBF_PT_UNKNOWN 0x00000000U
935#define ETH_DMARXNDESCWBF_PT_UDP 0x00000001U
936#define ETH_DMARXNDESCWBF_PT_TCP 0x00000002U
937#define ETH_DMARXNDESCWBF_PT_ICMP 0x00000003U
942#define ETH_DMARXNDESCWBF_L3L4FM 0x20000000U
943#define ETH_DMARXNDESCWBF_L4FM 0x10000000U
944#define ETH_DMARXNDESCWBF_L3FM 0x08000000U
945#define ETH_DMARXNDESCWBF_MADRM 0x07F80000U
946#define ETH_DMARXNDESCWBF_HF 0x00040000U
947#define ETH_DMARXNDESCWBF_DAF 0x00020000U
948#define ETH_DMARXNDESCWBF_SAF 0x00010000U
949#define ETH_DMARXNDESCWBF_VF 0x00008000U
950#define ETH_DMARXNDESCWBF_ARPNR 0x00000400U
956#define ETH_DMARXNDESCWBF_OWN 0x80000000U
957#define ETH_DMARXNDESCWBF_CTXT 0x40000000U
958#define ETH_DMARXNDESCWBF_FD 0x20000000U
959#define ETH_DMARXNDESCWBF_LD 0x10000000U
960#define ETH_DMARXNDESCWBF_RS2V 0x08000000U
961#define ETH_DMARXNDESCWBF_RS1V 0x04000000U
962#define ETH_DMARXNDESCWBF_RS0V 0x02000000U
963#define ETH_DMARXNDESCWBF_CE 0x01000000U
964#define ETH_DMARXNDESCWBF_GP 0x00800000U
965#define ETH_DMARXNDESCWBF_RWT 0x00400000U
966#define ETH_DMARXNDESCWBF_OE 0x00200000U
967#define ETH_DMARXNDESCWBF_RE 0x00100000U
968#define ETH_DMARXNDESCWBF_DE 0x00080000U
969#define ETH_DMARXNDESCWBF_LT 0x00070000U
970#define ETH_DMARXNDESCWBF_LT_LP 0x00000000U
971#define ETH_DMARXNDESCWBF_LT_TP 0x00010000U
972#define ETH_DMARXNDESCWBF_LT_ARP 0x00030000U
973#define ETH_DMARXNDESCWBF_LT_VLAN 0x00040000U
974#define ETH_DMARXNDESCWBF_LT_DVLAN 0x00050000U
975#define ETH_DMARXNDESCWBF_LT_MAC 0x00060000U
976#define ETH_DMARXNDESCWBF_LT_OAM 0x00070000U
977#define ETH_DMARXNDESCWBF_ES 0x00008000U
978#define ETH_DMARXNDESCWBF_PL 0x00007FFFU
980/*
981 DMA Rx context Descriptor
982 ---------------------------------------------------------------------------------------------------------------------
983 RDES0 | Timestamp Low[31:0] |
984 ---------------------------------------------------------------------------------------------------------------------
985 RDES1 | Timestamp High[31:0] |
986 ---------------------------------------------------------------------------------------------------------------------
987 RDES2 | Reserved |
988 ---------------------------------------------------------------------------------------------------------------------
989 RDES3 | OWN(31) | CTXT(30) | Reserved[29:0] |
990 ---------------------------------------------------------------------------------------------------------------------
991*/
992
996#define ETH_DMARXCDESC_RTSL 0xFFFFFFFFU
1001#define ETH_DMARXCDESC_RTSH 0xFFFFFFFFU
1006#define ETH_DMARXCDESC_OWN 0x80000000U
1007#define ETH_DMARXCDESC_CTXT 0x40000000U
1017#define ETH_MAX_PACKET_SIZE 1528U
1018#define ETH_HEADER 14U
1019#define ETH_CRC 4U
1020#define ETH_VLAN_TAG 4U
1021#define ETH_MIN_PAYLOAD 46U
1022#define ETH_MAX_PAYLOAD 1500U
1023#define ETH_JUMBO_FRAME_PAYLOAD 9000U
1032#define HAL_ETH_ERROR_NONE 0x00000000U
1033#define HAL_ETH_ERROR_PARAM 0x00000001U
1034#define HAL_ETH_ERROR_BUSY 0x00000002U
1035#define HAL_ETH_ERROR_TIMEOUT 0x00000004U
1036#define HAL_ETH_ERROR_DMA 0x00000008U
1037#define HAL_ETH_ERROR_MAC 0x00000010U
1038#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
1039#define HAL_ETH_ERROR_INVALID_CALLBACK 0x00000020U
1040#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
1049#define ETH_TX_PACKETS_FEATURES_CSUM 0x00000001U
1050#define ETH_TX_PACKETS_FEATURES_SAIC 0x00000002U
1051#define ETH_TX_PACKETS_FEATURES_VLANTAG 0x00000004U
1052#define ETH_TX_PACKETS_FEATURES_INNERVLANTAG 0x00000008U
1053#define ETH_TX_PACKETS_FEATURES_TSO 0x00000010U
1054#define ETH_TX_PACKETS_FEATURES_CRCPAD 0x00000020U
1063#define ETH_SRC_ADDR_CONTROL_DISABLE ETH_DMATXNDESCRF_SAIC_DISABLE
1064#define ETH_SRC_ADDR_INSERT ETH_DMATXNDESCRF_SAIC_INSERT
1065#define ETH_SRC_ADDR_REPLACE ETH_DMATXNDESCRF_SAIC_REPLACE
1074#define ETH_CRC_PAD_DISABLE ETH_DMATXNDESCRF_CPC_DISABLE
1075#define ETH_CRC_PAD_INSERT ETH_DMATXNDESCRF_CPC_CRCPAD_INSERT
1076#define ETH_CRC_INSERT ETH_DMATXNDESCRF_CPC_CRC_INSERT
1077#define ETH_CRC_REPLACE ETH_DMATXNDESCRF_CPC_CRC_REPLACE
1086#define ETH_CHECKSUM_DISABLE ETH_DMATXNDESCRF_CIC_DISABLE
1087#define ETH_CHECKSUM_IPHDR_INSERT ETH_DMATXNDESCRF_CIC_IPHDR_INSERT
1088#define ETH_CHECKSUM_IPHDR_PAYLOAD_INSERT ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT
1089#define ETH_CHECKSUM_IPHDR_PAYLOAD_INSERT_PHDR_CALC ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT_PHDR_CALC
1098#define ETH_VLAN_DISABLE ETH_DMATXNDESCRF_VTIR_DISABLE
1099#define ETH_VLAN_REMOVE ETH_DMATXNDESCRF_VTIR_REMOVE
1100#define ETH_VLAN_INSERT ETH_DMATXNDESCRF_VTIR_INSERT
1101#define ETH_VLAN_REPLACE ETH_DMATXNDESCRF_VTIR_REPLACE
1110#define ETH_INNER_VLAN_DISABLE ETH_DMATXCDESC_IVTIR_DISABLE
1111#define ETH_INNER_VLAN_REMOVE ETH_DMATXCDESC_IVTIR_REMOVE
1112#define ETH_INNER_VLAN_INSERT ETH_DMATXCDESC_IVTIR_INSERT
1113#define ETH_INNER_VLAN_REPLACE ETH_DMATXCDESC_IVTIR_REPLACE
1122#define ETH_CHECKSUM_BYPASSED ETH_DMARXNDESCWBF_IPCB
1123#define ETH_CHECKSUM_IP_HEADER_ERROR ETH_DMARXNDESCWBF_IPHE
1124#define ETH_CHECKSUM_IP_PAYLOAD_ERROR ETH_DMARXNDESCWBF_IPCE
1133#define ETH_IP_HEADER_IPV4 ETH_DMARXNDESCWBF_IPV4
1134#define ETH_IP_HEADER_IPV6 ETH_DMARXNDESCWBF_IPV6
1143#define ETH_IP_PAYLOAD_UNKNOWN ETH_DMARXNDESCWBF_PT_UNKNOWN
1144#define ETH_IP_PAYLOAD_UDP ETH_DMARXNDESCWBF_PT_UDP
1145#define ETH_IP_PAYLOAD_TCP ETH_DMARXNDESCWBF_PT_TCP
1146#define ETH_IP_PAYLOAD_ICMPN ETH_DMARXNDESCWBF_PT_ICMP
1155#define ETH_HASH_FILTER_PASS ETH_DMARXNDESCWBF_HF
1156#define ETH_VLAN_FILTER_PASS ETH_DMARXNDESCWBF_VF
1157#define ETH_DEST_ADDRESS_FAIL ETH_DMARXNDESCWBF_DAF
1158#define ETH_SOURCE_ADDRESS_FAIL ETH_DMARXNDESCWBF_SAF
1166#define ETH_L3_FILTER0_MATCH ETH_DMARXNDESCWBF_L3FM
1167#define ETH_L3_FILTER1_MATCH (ETH_DMARXNDESCWBF_L3FM | ETH_DMARXNDESCWBF_L3L4FM)
1176#define ETH_L4_FILTER0_MATCH ETH_DMARXNDESCWBF_L4FM
1177#define ETH_L4_FILTER1_MATCH (ETH_DMARXNDESCWBF_L4FM | ETH_DMARXNDESCWBF_L3L4FM)
1186#define ETH_DRIBBLE_BIT_ERROR ETH_DMARXNDESCWBF_DE
1187#define ETH_RECEIVE_ERROR ETH_DMARXNDESCWBF_RE
1188#define ETH_RECEIVE_OVERFLOW ETH_DMARXNDESCWBF_OE
1189#define ETH_WATCHDOG_TIMEOUT ETH_DMARXNDESCWBF_RWT
1190#define ETH_GIANT_PACKET ETH_DMARXNDESCWBF_GP
1191#define ETH_CRC_ERROR ETH_DMARXNDESCWBF_CE
1200#define ETH_DMAARBITRATION_RX ETH_DMAMR_DA
1201#define ETH_DMAARBITRATION_RX1_TX1 0x00000000U
1202#define ETH_DMAARBITRATION_RX2_TX1 ETH_DMAMR_PR_2_1
1203#define ETH_DMAARBITRATION_RX3_TX1 ETH_DMAMR_PR_3_1
1204#define ETH_DMAARBITRATION_RX4_TX1 ETH_DMAMR_PR_4_1
1205#define ETH_DMAARBITRATION_RX5_TX1 ETH_DMAMR_PR_5_1
1206#define ETH_DMAARBITRATION_RX6_TX1 ETH_DMAMR_PR_6_1
1207#define ETH_DMAARBITRATION_RX7_TX1 ETH_DMAMR_PR_7_1
1208#define ETH_DMAARBITRATION_RX8_TX1 ETH_DMAMR_PR_8_1
1209#define ETH_DMAARBITRATION_TX (ETH_DMAMR_TXPR | ETH_DMAMR_DA)
1210#define ETH_DMAARBITRATION_TX1_RX1 0x00000000U
1211#define ETH_DMAARBITRATION_TX2_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_2_1)
1212#define ETH_DMAARBITRATION_TX3_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_3_1)
1213#define ETH_DMAARBITRATION_TX4_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_4_1)
1214#define ETH_DMAARBITRATION_TX5_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_5_1)
1215#define ETH_DMAARBITRATION_TX6_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_6_1)
1216#define ETH_DMAARBITRATION_TX7_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_7_1)
1217#define ETH_DMAARBITRATION_TX8_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_8_1)
1226#define ETH_BURSTLENGTH_FIXED ETH_DMASBMR_FB
1227#define ETH_BURSTLENGTH_MIXED ETH_DMASBMR_MB
1228#define ETH_BURSTLENGTH_UNSPECIFIED 0x00000000U
1237#define ETH_TXDMABURSTLENGTH_1BEAT ETH_DMACTCR_TPBL_1PBL
1238#define ETH_TXDMABURSTLENGTH_2BEAT ETH_DMACTCR_TPBL_2PBL
1239#define ETH_TXDMABURSTLENGTH_4BEAT ETH_DMACTCR_TPBL_4PBL
1240#define ETH_TXDMABURSTLENGTH_8BEAT ETH_DMACTCR_TPBL_8PBL
1241#define ETH_TXDMABURSTLENGTH_16BEAT ETH_DMACTCR_TPBL_16PBL
1242#define ETH_TXDMABURSTLENGTH_32BEAT ETH_DMACTCR_TPBL_32PBL
1251#define ETH_RXDMABURSTLENGTH_1BEAT ETH_DMACRCR_RPBL_1PBL
1252#define ETH_RXDMABURSTLENGTH_2BEAT ETH_DMACRCR_RPBL_2PBL
1253#define ETH_RXDMABURSTLENGTH_4BEAT ETH_DMACRCR_RPBL_4PBL
1254#define ETH_RXDMABURSTLENGTH_8BEAT ETH_DMACRCR_RPBL_8PBL
1255#define ETH_RXDMABURSTLENGTH_16BEAT ETH_DMACRCR_RPBL_16PBL
1256#define ETH_RXDMABURSTLENGTH_32BEAT ETH_DMACRCR_RPBL_32PBL
1265#define ETH_DMA_NORMAL_IT ETH_DMACIER_NIE
1266#define ETH_DMA_ABNORMAL_IT ETH_DMACIER_AIE
1267#define ETH_DMA_CONTEXT_DESC_ERROR_IT ETH_DMACIER_CDEE
1268#define ETH_DMA_FATAL_BUS_ERROR_IT ETH_DMACIER_FBEE
1269#define ETH_DMA_EARLY_RX_IT ETH_DMACIER_ERIE
1270#define ETH_DMA_EARLY_TX_IT ETH_DMACIER_ETIE
1271#define ETH_DMA_RX_WATCHDOG_TIMEOUT_IT ETH_DMACIER_RWTE
1272#define ETH_DMA_RX_PROCESS_STOPPED_IT ETH_DMACIER_RSE
1273#define ETH_DMA_RX_BUFFER_UNAVAILABLE_IT ETH_DMACIER_RBUE
1274#define ETH_DMA_RX_IT ETH_DMACIER_RIE
1275#define ETH_DMA_TX_BUFFER_UNAVAILABLE_IT ETH_DMACIER_TBUE
1276#define ETH_DMA_TX_PROCESS_STOPPED_IT ETH_DMACIER_TXSE
1277#define ETH_DMA_TX_IT ETH_DMACIER_TIE
1286#define ETH_DMA_RX_NO_ERROR_FLAG 0x00000000U
1287#define ETH_DMA_RX_DESC_READ_ERROR_FLAG (ETH_DMACSR_REB_BIT_2 | ETH_DMACSR_REB_BIT_1 | ETH_DMACSR_REB_BIT_0)
1288#define ETH_DMA_RX_DESC_WRITE_ERROR_FLAG (ETH_DMACSR_REB_BIT_2 | ETH_DMACSR_REB_BIT_1)
1289#define ETH_DMA_RX_BUFFER_READ_ERROR_FLAG (ETH_DMACSR_REB_BIT_2 | ETH_DMACSR_REB_BIT_0)
1290#define ETH_DMA_RX_BUFFER_WRITE_ERROR_FLAG ETH_DMACSR_REB_BIT_2
1291#define ETH_DMA_TX_NO_ERROR_FLAG 0x00000000U
1292#define ETH_DMA_TX_DESC_READ_ERROR_FLAG (ETH_DMACSR_TEB_BIT_2 | ETH_DMACSR_TEB_BIT_1 | ETH_DMACSR_TEB_BIT_0)
1293#define ETH_DMA_TX_DESC_WRITE_ERROR_FLAG (ETH_DMACSR_TEB_BIT_2 | ETH_DMACSR_TEB_BIT_1)
1294#define ETH_DMA_TX_BUFFER_READ_ERROR_FLAG (ETH_DMACSR_TEB_BIT_2 | ETH_DMACSR_TEB_BIT_0)
1295#define ETH_DMA_TX_BUFFER_WRITE_ERROR_FLAG ETH_DMACSR_TEB_BIT_2
1296#define ETH_DMA_CONTEXT_DESC_ERROR_FLAG ETH_DMACSR_CDE
1297#define ETH_DMA_FATAL_BUS_ERROR_FLAG ETH_DMACSR_FBE
1298#define ETH_DMA_EARLY_TX_IT_FLAG ETH_DMACSR_ERI
1299#define ETH_DMA_RX_WATCHDOG_TIMEOUT_FLAG ETH_DMACSR_RWT
1300#define ETH_DMA_RX_PROCESS_STOPPED_FLAG ETH_DMACSR_RPS
1301#define ETH_DMA_RX_BUFFER_UNAVAILABLE_FLAG ETH_DMACSR_RBU
1302#define ETH_DMA_TX_PROCESS_STOPPED_FLAG ETH_DMACSR_TPS
1311#define ETH_TRANSMITSTOREFORWARD ETH_MTLTQOMR_TSF
1312#define ETH_TRANSMITTHRESHOLD_32 ETH_MTLTQOMR_TTC_32BITS
1313#define ETH_TRANSMITTHRESHOLD_64 ETH_MTLTQOMR_TTC_64BITS
1314#define ETH_TRANSMITTHRESHOLD_96 ETH_MTLTQOMR_TTC_96BITS
1315#define ETH_TRANSMITTHRESHOLD_128 ETH_MTLTQOMR_TTC_128BITS
1316#define ETH_TRANSMITTHRESHOLD_192 ETH_MTLTQOMR_TTC_192BITS
1317#define ETH_TRANSMITTHRESHOLD_256 ETH_MTLTQOMR_TTC_256BITS
1318#define ETH_TRANSMITTHRESHOLD_384 ETH_MTLTQOMR_TTC_384BITS
1319#define ETH_TRANSMITTHRESHOLD_512 ETH_MTLTQOMR_TTC_512BITS
1328#define ETH_RECEIVESTOREFORWARD ETH_MTLRQOMR_RSF
1329#define ETH_RECEIVETHRESHOLD8_64 ETH_MTLRQOMR_RTC_64BITS
1330#define ETH_RECEIVETHRESHOLD8_32 ETH_MTLRQOMR_RTC_32BITS
1331#define ETH_RECEIVETHRESHOLD8_96 ETH_MTLRQOMR_RTC_96BITS
1332#define ETH_RECEIVETHRESHOLD8_128 ETH_MTLRQOMR_RTC_128BITS
1341#define ETH_PAUSELOWTHRESHOLD_MINUS_4 ETH_MACTFCR_PLT_MINUS4
1342#define ETH_PAUSELOWTHRESHOLD_MINUS_28 ETH_MACTFCR_PLT_MINUS28
1343#define ETH_PAUSELOWTHRESHOLD_MINUS_36 ETH_MACTFCR_PLT_MINUS36
1344#define ETH_PAUSELOWTHRESHOLD_MINUS_144 ETH_MACTFCR_PLT_MINUS144
1345#define ETH_PAUSELOWTHRESHOLD_MINUS_256 ETH_MACTFCR_PLT_MINUS256
1346#define ETH_PAUSELOWTHRESHOLD_MINUS_512 ETH_MACTFCR_PLT_MINUS512
1355#define ETH_WATCHDOGTIMEOUT_2KB ETH_MACWTR_WTO_2KB
1356#define ETH_WATCHDOGTIMEOUT_3KB ETH_MACWTR_WTO_3KB
1357#define ETH_WATCHDOGTIMEOUT_4KB ETH_MACWTR_WTO_4KB
1358#define ETH_WATCHDOGTIMEOUT_5KB ETH_MACWTR_WTO_5KB
1359#define ETH_WATCHDOGTIMEOUT_6KB ETH_MACWTR_WTO_6KB
1360#define ETH_WATCHDOGTIMEOUT_7KB ETH_MACWTR_WTO_7KB
1361#define ETH_WATCHDOGTIMEOUT_8KB ETH_MACWTR_WTO_8KB
1362#define ETH_WATCHDOGTIMEOUT_9KB ETH_MACWTR_WTO_9KB
1363#define ETH_WATCHDOGTIMEOUT_10KB ETH_MACWTR_WTO_10KB
1364#define ETH_WATCHDOGTIMEOUT_11KB ETH_MACWTR_WTO_12KB
1365#define ETH_WATCHDOGTIMEOUT_12KB ETH_MACWTR_WTO_12KB
1366#define ETH_WATCHDOGTIMEOUT_13KB ETH_MACWTR_WTO_13KB
1367#define ETH_WATCHDOGTIMEOUT_14KB ETH_MACWTR_WTO_14KB
1368#define ETH_WATCHDOGTIMEOUT_15KB ETH_MACWTR_WTO_15KB
1369#define ETH_WATCHDOGTIMEOUT_16KB ETH_MACWTR_WTO_16KB
1378#define ETH_INTERPACKETGAP_96BIT ETH_MACCR_IPG_96BIT
1379#define ETH_INTERPACKETGAP_88BIT ETH_MACCR_IPG_88BIT
1380#define ETH_INTERPACKETGAP_80BIT ETH_MACCR_IPG_80BIT
1381#define ETH_INTERPACKETGAP_72BIT ETH_MACCR_IPG_72BIT
1382#define ETH_INTERPACKETGAP_64BIT ETH_MACCR_IPG_64BIT
1383#define ETH_INTERPACKETGAP_56BIT ETH_MACCR_IPG_56BIT
1384#define ETH_INTERPACKETGAP_48BIT ETH_MACCR_IPG_48BIT
1385#define ETH_INTERPACKETGAP_40BIT ETH_MACCR_IPG_40BIT
1394#define ETH_SPEED_10M 0x00000000U
1395#define ETH_SPEED_100M ETH_MACCR_FES
1404#define ETH_FULLDUPLEX_MODE ETH_MACCR_DM
1405#define ETH_HALFDUPLEX_MODE 0x00000000U
1414#define ETH_BACKOFFLIMIT_10 ETH_MACCR_BL_10
1415#define ETH_BACKOFFLIMIT_8 ETH_MACCR_BL_8
1416#define ETH_BACKOFFLIMIT_4 ETH_MACCR_BL_4
1417#define ETH_BACKOFFLIMIT_1 ETH_MACCR_BL_1
1426#define ETH_PREAMBLELENGTH_7 ETH_MACCR_PRELEN_7
1427#define ETH_PREAMBLELENGTH_5 ETH_MACCR_PRELEN_5
1428#define ETH_PREAMBLELENGTH_3 ETH_MACCR_PRELEN_3
1437#define ETH_SOURCEADDRESS_DISABLE 0x00000000U
1438#define ETH_SOURCEADDRESS_INSERT_ADDR0 ETH_MACCR_SARC_INSADDR0
1439#define ETH_SOURCEADDRESS_INSERT_ADDR1 ETH_MACCR_SARC_INSADDR1
1440#define ETH_SOURCEADDRESS_REPLACE_ADDR0 ETH_MACCR_SARC_REPADDR0
1441#define ETH_SOURCEADDRESS_REPLACE_ADDR1 ETH_MACCR_SARC_REPADDR1
1450#define ETH_CTRLPACKETS_BLOCK_ALL ETH_MACPFR_PCF_BLOCKALL
1451#define ETH_CTRLPACKETS_FORWARD_ALL_EXCEPT_PA ETH_MACPFR_PCF_FORWARDALLEXCEPTPA
1452#define ETH_CTRLPACKETS_FORWARD_ALL ETH_MACPFR_PCF_FORWARDALL
1453#define ETH_CTRLPACKETS_FORWARD_PASSED_ADDR_FILTER ETH_MACPFR_PCF_FORWARDPASSEDADDRFILTER
1462#define ETH_VLANTAGCOMPARISON_16BIT 0x00000000U
1463#define ETH_VLANTAGCOMPARISON_12BIT ETH_MACVTR_ETV
1472#define ETH_MAC_ADDRESS0 0x00000000U
1473#define ETH_MAC_ADDRESS1 0x00000008U
1474#define ETH_MAC_ADDRESS2 0x00000010U
1475#define ETH_MAC_ADDRESS3 0x00000018U
1484#define ETH_MAC_RX_STATUS_IT ETH_MACIER_RXSTSIE
1485#define ETH_MAC_TX_STATUS_IT ETH_MACIER_TXSTSIE
1486#define ETH_MAC_TIMESTAMP_IT ETH_MACIER_TSIE
1487#define ETH_MAC_LPI_IT ETH_MACIER_LPIIE
1488#define ETH_MAC_PMT_IT ETH_MACIER_PMTIE
1489#define ETH_MAC_PHY_IT ETH_MACIER_PHYIE
1498#define ETH_WAKEUP_PACKET_RECIEVED ETH_MACPCSR_RWKPRCVD
1499#define ETH_MAGIC_PACKET_RECIEVED ETH_MACPCSR_MGKPRCVD
1508#define ETH_RECEIVE_WATCHDOG_TIMEOUT ETH_MACRXTXSR_RWT
1509#define ETH_EXECESSIVE_COLLISIONS ETH_MACRXTXSR_EXCOL
1510#define ETH_LATE_COLLISIONS ETH_MACRXTXSR_LCOL
1511#define ETH_EXECESSIVE_DEFERRAL ETH_MACRXTXSR_EXDEF
1512#define ETH_LOSS_OF_CARRIER ETH_MACRXTXSR_LCARR
1513#define ETH_NO_CARRIER ETH_MACRXTXSR_NCARR
1514#define ETH_TRANSMIT_JABBR_TIMEOUT ETH_MACRXTXSR_TJT
1523#define HAL_ETH_STATE_RESET 0x00000000U
1524#define HAL_ETH_STATE_READY 0x00000010U
1525#define HAL_ETH_STATE_BUSY 0x00000023U
1526#define HAL_ETH_STATE_STARTED 0x00000023U
1527#define HAL_ETH_STATE_ERROR 0x000000E0U
1536#define HAL_ETH_PTP_NOT_CONFIGURATED 0x00000000U
1537#define HAL_ETH_PTP_CONFIGURATED 0x00000001U
1545/* Exported macro ------------------------------------------------------------*/
1555#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
1556#define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) do{ \
1557 (__HANDLE__)->gState = HAL_ETH_STATE_RESET; \
1558 (__HANDLE__)->MspInitCallback = NULL; \
1559 (__HANDLE__)->MspDeInitCallback = NULL; \
1560 } while(0)
1561#else
1562#define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) do{ \
1563 (__HANDLE__)->gState = HAL_ETH_STATE_RESET; \
1564 } while(0)
1565#endif /*USE_HAL_ETH_REGISTER_CALLBACKS */
1566
1574#define __HAL_ETH_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMACIER |= (__INTERRUPT__))
1575
1583#define __HAL_ETH_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMACIER &= ~(__INTERRUPT__))
1584
1591#define __HAL_ETH_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) \
1592 (((__HANDLE__)->Instance->DMACIER & (__INTERRUPT__)) == (__INTERRUPT__))
1593
1600#define __HAL_ETH_DMA_GET_IT(__HANDLE__, __INTERRUPT__) \
1601 (((__HANDLE__)->Instance->DMACSR & (__INTERRUPT__)) == (__INTERRUPT__))
1602
1609#define __HAL_ETH_DMA_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMACSR = (__INTERRUPT__))
1610
1617#define __HAL_ETH_DMA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->DMACSR &( __FLAG__)) == ( __FLAG__))
1618
1625#define __HAL_ETH_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->DMACSR = ( __FLAG__))
1626
1634#define __HAL_ETH_MAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIER |= (__INTERRUPT__))
1635
1643#define __HAL_ETH_MAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIER &= ~(__INTERRUPT__))
1644
1651#define __HAL_ETH_MAC_GET_IT(__HANDLE__, __INTERRUPT__) \
1652 (((__HANDLE__)->Instance->MACISR &( __INTERRUPT__)) == ( __INTERRUPT__))
1653
1655#define ETH_WAKEUP_EXTI_LINE 0x00400000U /* !< 86 - 64 = 22 */
1656
1663#define __HAL_ETH_WAKEUP_EXTI_ENABLE_IT(__EXTI_LINE__) (EXTI_D1->IMR3 |= (__EXTI_LINE__))
1664
1671#define __HAL_ETH_WAKEUP_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI_D1->PR3 & (__EXTI_LINE__))
1672
1679#define __HAL_ETH_WAKEUP_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D1->PR3 = (__EXTI_LINE__))
1680
1681#if defined(DUAL_CORE)
1688#define __HAL_ETH_WAKEUP_EXTID2_ENABLE_IT(__EXTI_LINE__) (EXTI_D2->IMR3 |= (__EXTI_LINE__))
1689
1696#define __HAL_ETH_WAKEUP_EXTID2_GET_FLAG(__EXTI_LINE__) (EXTI_D2->PR3 & (__EXTI_LINE__))
1697
1704#define __HAL_ETH_WAKEUP_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D2->PR3 = (__EXTI_LINE__))
1705#endif /* DUAL_CORE */
1706
1713#define __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_EDGE(__EXTI_LINE__) (EXTI->FTSR3 &= ~(__EXTI_LINE__)); \
1714 (EXTI->RTSR3 |= (__EXTI_LINE__))
1715
1722#define __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR3 &= ~(__EXTI_LINE__));\
1723 (EXTI->FTSR3 |= (__EXTI_LINE__))
1724
1731#define __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR3 |= (__EXTI_LINE__));\
1732 (EXTI->FTSR3 |= (__EXTI_LINE__))
1733
1740#define __HAL_ETH_WAKEUP_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER3 |= (__EXTI_LINE__))
1741
1742#define __HAL_ETH_GET_PTP_CONTROL(__HANDLE__, __FLAG__) (((((__HANDLE__)->Instance->MACTSCR) & \
1743 (__FLAG__)) == (__FLAG__)) ? SET : RESET)
1744
1745#define __HAL_ETH_SET_PTP_CONTROL(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->MACTSCR |= (__FLAG__))
1750/* Include ETH HAL Extension module */
1751#include "stm32h7xx_hal_eth_ex.h"
1752
1753/* Exported functions --------------------------------------------------------*/
1754
1762/* Initialization and de initialization functions **********************************/
1763HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth);
1764HAL_StatusTypeDef HAL_ETH_DeInit(ETH_HandleTypeDef *heth);
1765void HAL_ETH_MspInit(ETH_HandleTypeDef *heth);
1766void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth);
1767
1768/* Callbacks Register/UnRegister functions ***********************************/
1769#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
1770HAL_StatusTypeDef HAL_ETH_RegisterCallback(ETH_HandleTypeDef *heth, HAL_ETH_CallbackIDTypeDef CallbackID,
1771 pETH_CallbackTypeDef pCallback);
1772HAL_StatusTypeDef HAL_ETH_UnRegisterCallback(ETH_HandleTypeDef *heth, HAL_ETH_CallbackIDTypeDef CallbackID);
1773#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
1774
1782/* IO operation functions *******************************************************/
1783HAL_StatusTypeDef HAL_ETH_Start(ETH_HandleTypeDef *heth);
1784HAL_StatusTypeDef HAL_ETH_Start_IT(ETH_HandleTypeDef *heth);
1785HAL_StatusTypeDef HAL_ETH_Stop(ETH_HandleTypeDef *heth);
1786HAL_StatusTypeDef HAL_ETH_Stop_IT(ETH_HandleTypeDef *heth);
1787
1788HAL_StatusTypeDef HAL_ETH_ReadData(ETH_HandleTypeDef *heth, void **pAppBuff);
1789HAL_StatusTypeDef HAL_ETH_RegisterRxAllocateCallback(ETH_HandleTypeDef *heth,
1790 pETH_rxAllocateCallbackTypeDef rxAllocateCallback);
1791HAL_StatusTypeDef HAL_ETH_UnRegisterRxAllocateCallback(ETH_HandleTypeDef *heth);
1792HAL_StatusTypeDef HAL_ETH_RegisterRxLinkCallback(ETH_HandleTypeDef *heth, pETH_rxLinkCallbackTypeDef rxLinkCallback);
1793HAL_StatusTypeDef HAL_ETH_UnRegisterRxLinkCallback(ETH_HandleTypeDef *heth);
1794HAL_StatusTypeDef HAL_ETH_GetRxDataErrorCode(ETH_HandleTypeDef *heth, uint32_t *pErrorCode);
1795HAL_StatusTypeDef HAL_ETH_RegisterTxFreeCallback(ETH_HandleTypeDef *heth, pETH_txFreeCallbackTypeDef txFreeCallback);
1796HAL_StatusTypeDef HAL_ETH_UnRegisterTxFreeCallback(ETH_HandleTypeDef *heth);
1797HAL_StatusTypeDef HAL_ETH_ReleaseTxPacket(ETH_HandleTypeDef *heth);
1798
1799#ifdef HAL_ETH_USE_PTP
1800HAL_StatusTypeDef HAL_ETH_PTP_SetConfig(ETH_HandleTypeDef *heth, ETH_PTP_ConfigTypeDef *ptpconfig);
1801HAL_StatusTypeDef HAL_ETH_PTP_GetConfig(ETH_HandleTypeDef *heth, ETH_PTP_ConfigTypeDef *ptpconfig);
1802HAL_StatusTypeDef HAL_ETH_PTP_SetTime(ETH_HandleTypeDef *heth, ETH_TimeTypeDef *time);
1803HAL_StatusTypeDef HAL_ETH_PTP_GetTime(ETH_HandleTypeDef *heth, ETH_TimeTypeDef *time);
1804HAL_StatusTypeDef HAL_ETH_PTP_AddTimeOffset(ETH_HandleTypeDef *heth, ETH_PtpUpdateTypeDef ptpoffsettype,
1805 ETH_TimeTypeDef *timeoffset);
1806HAL_StatusTypeDef HAL_ETH_PTP_InsertTxTimestamp(ETH_HandleTypeDef *heth);
1807HAL_StatusTypeDef HAL_ETH_PTP_GetTxTimestamp(ETH_HandleTypeDef *heth, ETH_TimeStampTypeDef *timestamp);
1808HAL_StatusTypeDef HAL_ETH_PTP_GetRxTimestamp(ETH_HandleTypeDef *heth, ETH_TimeStampTypeDef *timestamp);
1809HAL_StatusTypeDef HAL_ETH_RegisterTxPtpCallback(ETH_HandleTypeDef *heth, pETH_txPtpCallbackTypeDef txPtpCallback);
1810HAL_StatusTypeDef HAL_ETH_UnRegisterTxPtpCallback(ETH_HandleTypeDef *heth);
1811#endif /* HAL_ETH_USE_PTP */
1812
1813HAL_StatusTypeDef HAL_ETH_Transmit(ETH_HandleTypeDef *heth, ETH_TxPacketConfig *pTxConfig, uint32_t Timeout);
1814HAL_StatusTypeDef HAL_ETH_Transmit_IT(ETH_HandleTypeDef *heth, ETH_TxPacketConfig *pTxConfig);
1815
1816HAL_StatusTypeDef HAL_ETH_WritePHYRegister(ETH_HandleTypeDef *heth, uint32_t PHYAddr, uint32_t PHYReg,
1817 uint32_t RegValue);
1818HAL_StatusTypeDef HAL_ETH_ReadPHYRegister(ETH_HandleTypeDef *heth, uint32_t PHYAddr, uint32_t PHYReg,
1819 uint32_t *pRegValue);
1820
1821void HAL_ETH_IRQHandler(ETH_HandleTypeDef *heth);
1822void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *heth);
1823void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth);
1824void HAL_ETH_ErrorCallback(ETH_HandleTypeDef *heth);
1825void HAL_ETH_PMTCallback(ETH_HandleTypeDef *heth);
1826void HAL_ETH_EEECallback(ETH_HandleTypeDef *heth);
1827void HAL_ETH_WakeUpCallback(ETH_HandleTypeDef *heth);
1828void HAL_ETH_RxAllocateCallback(uint8_t **buff);
1829void HAL_ETH_RxLinkCallback(void **pStart, void **pEnd, uint8_t *buff, uint16_t Length);
1830void HAL_ETH_TxFreeCallback(uint32_t *buff);
1831void HAL_ETH_TxPtpCallback(uint32_t *buff, ETH_TimeStampTypeDef *timestamp);
1839/* Peripheral Control functions **********************************************/
1840/* MAC & DMA Configuration APIs **********************************************/
1841HAL_StatusTypeDef HAL_ETH_GetMACConfig(ETH_HandleTypeDef *heth, ETH_MACConfigTypeDef *macconf);
1842HAL_StatusTypeDef HAL_ETH_GetDMAConfig(ETH_HandleTypeDef *heth, ETH_DMAConfigTypeDef *dmaconf);
1843HAL_StatusTypeDef HAL_ETH_SetMACConfig(ETH_HandleTypeDef *heth, ETH_MACConfigTypeDef *macconf);
1844HAL_StatusTypeDef HAL_ETH_SetDMAConfig(ETH_HandleTypeDef *heth, ETH_DMAConfigTypeDef *dmaconf);
1845void HAL_ETH_SetMDIOClockRange(ETH_HandleTypeDef *heth);
1846
1847/* MAC VLAN Processing APIs ************************************************/
1848void HAL_ETH_SetRxVLANIdentifier(ETH_HandleTypeDef *heth, uint32_t ComparisonBits,
1849 uint32_t VLANIdentifier);
1850
1851/* MAC L2 Packet Filtering APIs **********************************************/
1852HAL_StatusTypeDef HAL_ETH_GetMACFilterConfig(ETH_HandleTypeDef *heth, ETH_MACFilterConfigTypeDef *pFilterConfig);
1853HAL_StatusTypeDef HAL_ETH_SetMACFilterConfig(ETH_HandleTypeDef *heth, ETH_MACFilterConfigTypeDef *pFilterConfig);
1854HAL_StatusTypeDef HAL_ETH_SetHashTable(ETH_HandleTypeDef *heth, uint32_t *pHashTable);
1855HAL_StatusTypeDef HAL_ETH_SetSourceMACAddrMatch(ETH_HandleTypeDef *heth, uint32_t AddrNbr, uint8_t *pMACAddr);
1856
1857/* MAC Power Down APIs *****************************************************/
1858void HAL_ETH_EnterPowerDownMode(ETH_HandleTypeDef *heth, ETH_PowerDownConfigTypeDef *pPowerDownConfig);
1859void HAL_ETH_ExitPowerDownMode(ETH_HandleTypeDef *heth);
1860HAL_StatusTypeDef HAL_ETH_SetWakeUpFilter(ETH_HandleTypeDef *heth, uint32_t *pFilter, uint32_t Count);
1861
1869/* Peripheral State functions **************************************************/
1870HAL_ETH_StateTypeDef HAL_ETH_GetState(ETH_HandleTypeDef *heth);
1871uint32_t HAL_ETH_GetError(ETH_HandleTypeDef *heth);
1872uint32_t HAL_ETH_GetDMAError(ETH_HandleTypeDef *heth);
1873uint32_t HAL_ETH_GetMACError(ETH_HandleTypeDef *heth);
1874uint32_t HAL_ETH_GetMACWakeUpSource(ETH_HandleTypeDef *heth);
1891#endif /* ETH */
1892
1893#ifdef __cplusplus
1894}
1895#endif
1896
1897#endif /* STM32H7xx_HAL_ETH_H */
1898
1899
#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