mikroSDK Reference Manual
stm32h7xx_hal_eth.h
Go to the documentation of this file.
1
20/* Define to prevent recursive inclusion -------------------------------------*/
21#ifndef STM32H7xx_HAL_ETH_H
22#define STM32H7xx_HAL_ETH_H
23
24#ifdef __cplusplus
25 extern "C" {
26#endif
27
28
29/* Includes ------------------------------------------------------------------*/
30#include "stm32h7xx_hal_def.h"
31
32#if defined(ETH)
33
42/* Exported types ------------------------------------------------------------*/
43#ifndef ETH_TX_DESC_CNT
44 #define ETH_TX_DESC_CNT 4U
45#endif
46
47#ifndef ETH_RX_DESC_CNT
48 #define ETH_RX_DESC_CNT 4U
49#endif
50
51/*********************** Descriptors struct def section ************************/
59typedef struct
60{
61 __IO uint32_t DESC0;
62 __IO uint32_t DESC1;
63 __IO uint32_t DESC2;
64 __IO uint32_t DESC3;
65 uint32_t BackupAddr0; /* used to store rx buffer 1 address */
66 uint32_t BackupAddr1; /* used to store rx buffer 2 address */
67}ETH_DMADescTypeDef;
75typedef struct __ETH_BufferTypeDef
76{
77 uint8_t *buffer; /*<! buffer address */
78
79 uint32_t len; /*<! buffer length */
80
81 struct __ETH_BufferTypeDef *next; /*<! Pointer to the next buffer in the list */
82}ETH_BufferTypeDef;
90typedef struct
91{
92 uint32_t TxDesc[ETH_TX_DESC_CNT]; /*<! Tx DMA descriptors addresses */
93
94 uint32_t CurTxDesc; /*<! Current Tx descriptor index for packet transmission */
95
96 uint32_t* PacketAddress[ETH_TX_DESC_CNT]; /*<! Ethernet packet addresses array */
97
98 uint32_t* CurrentPacketAddress; /*<! Current transmit NX_PACKET addresses */
99
100 uint32_t BuffersInUse; /*<! Buffers in Use */
101}ETH_TxDescListTypeDef;
109typedef struct
110{
111 uint32_t Attributes;
114 uint32_t Length;
116 ETH_BufferTypeDef *TxBuffer;
118 uint32_t SrcAddrCtrl;
121 uint32_t CRCPadCtrl;
124 uint32_t ChecksumCtrl;
127 uint32_t MaxSegmentSize;
130 uint32_t PayloadLen;
133 uint32_t TCPHeaderLen;
136 uint32_t VlanTag;
139 uint32_t VlanCtrl;
142 uint32_t InnerVlanTag;
145 uint32_t InnerVlanCtrl;
148}ETH_TxPacketConfig;
156typedef struct
157{
158 uint32_t RxDesc[ETH_RX_DESC_CNT]; /*<! Rx DMA descriptors addresses. */
159
160 uint32_t CurRxDesc; /*<! Current Rx descriptor, ready for next reception. */
161
162 uint32_t FirstAppDesc; /*<! First descriptor of last received packet. */
163
164 uint32_t AppDescNbr; /*<! Number of descriptors of last received packet. */
165
166 uint32_t AppContextDesc; /*<! If 1 a context descriptor is present in last received packet.
167 If 0 no context descriptor is present in last received packet. */
168
169 uint32_t ItMode; /*<! If 1, DMA will generate the Rx complete interrupt.
170 If 0, DMA will not generate the Rx complete interrupt. */
171}ETH_RxDescListTypeDef;
179typedef struct
180{
181 uint32_t SegmentCnt; /*<! Number of Rx Descriptors */
182
183 uint32_t VlanTag; /*<! Vlan Tag value */
184
185 uint32_t InnerVlanTag; /*<! Inner Vlan Tag value */
186
187 uint32_t Checksum; /*<! Rx Checksum status.
188 This parameter can be a value of @ref ETH_Rx_Checksum_Status */
189
190 uint32_t HeaderType; /*<! IP header type.
191 This parameter can be a value of @ref ETH_Rx_IP_Header_Type */
192
193 uint32_t PayloadType; /*<! Payload type.
194 This parameter can be a value of @ref ETH_Rx_Payload_Type */
195
196 uint32_t MacFilterStatus; /*<! MAC filter status.
197 This parameter can be a value of @ref ETH_Rx_MAC_Filter_Status */
198
199 uint32_t L3FilterStatus; /*<! L3 filter status
200 This parameter can be a value of @ref ETH_Rx_L3_Filter_Status */
201
202 uint32_t L4FilterStatus; /*<! L4 filter status
203 This parameter can be a value of @ref ETH_Rx_L4_Filter_Status */
204
205 uint32_t ErrorCode; /*<! Rx error code
206 This parameter can be a combination of @ref ETH_Rx_Error_Code */
207
208} ETH_RxPacketInfo;
216typedef struct
217{
218 uint32_t SourceAddrControl;
221 FunctionalState ChecksumOffload;
223 uint32_t InterPacketGapVal;
226 FunctionalState GiantPacketSizeLimitControl;
228 FunctionalState Support2KPacket;
230 FunctionalState CRCStripTypePacket;
232 FunctionalState AutomaticPadCRCStrip;
234 FunctionalState Watchdog;
238 FunctionalState Jabber;
242 FunctionalState JumboPacket;
246 uint32_t Speed;
249 uint32_t DuplexMode;
252 FunctionalState LoopbackMode;
254 FunctionalState CarrierSenseBeforeTransmit;
256 FunctionalState ReceiveOwn;
258 FunctionalState CarrierSenseDuringTransmit;
260 FunctionalState RetryTransmission;
262 uint32_t BackOffLimit;
265 FunctionalState DeferralCheck;
267 uint32_t PreambleLength;
270 FunctionalState UnicastSlowProtocolPacketDetect;
272 FunctionalState SlowProtocolDetect;
274 FunctionalState CRCCheckingRxPackets;
276 uint32_t GiantPacketSizeLimit;
280 FunctionalState ExtendedInterPacketGap;
282 uint32_t ExtendedInterPacketGapVal;
285 FunctionalState ProgrammableWatchdog;
287 uint32_t WatchdogTimeout;
290 uint32_t PauseTime;
293 FunctionalState ZeroQuantaPause;
295 uint32_t PauseLowThreshold;
298 FunctionalState TransmitFlowControl;
301 FunctionalState UnicastPausePacketDetect;
303 FunctionalState ReceiveFlowControl;
306 uint32_t TransmitQueueMode;
309 uint32_t ReceiveQueueMode;
312 FunctionalState DropTCPIPChecksumErrorPacket;
314 FunctionalState ForwardRxErrorPacket;
316 FunctionalState ForwardRxUndersizedGoodPacket;
317} ETH_MACConfigTypeDef;
325 typedef struct
326 {
327 uint32_t DMAArbitration;
330 FunctionalState AddressAlignedBeats;
333 uint32_t BurstMode;
336 FunctionalState RebuildINCRxBurst;
339 FunctionalState PBLx8Mode;
341 uint32_t TxDMABurstLength;
344 FunctionalState SecondPacketOperate;
347 uint32_t RxDMABurstLength;
350 FunctionalState FlushRxPacket;
352 FunctionalState TCPSegmentation;
354 uint32_t MaximumSegmentSize;
356} ETH_DMAConfigTypeDef;
364typedef enum
365{
366 HAL_ETH_MII_MODE = 0x00U,
367 HAL_ETH_RMII_MODE = 0x01U
368}ETH_MediaInterfaceTypeDef;
376typedef struct
377{
378
379 uint8_t *MACAddr;
381 ETH_MediaInterfaceTypeDef MediaInterface;
383 ETH_DMADescTypeDef *TxDesc;
385 ETH_DMADescTypeDef *RxDesc;
387 uint32_t RxBuffLen;
389}ETH_InitTypeDef;
397typedef uint32_t HAL_ETH_StateTypeDef;
405#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
406typedef struct __ETH_HandleTypeDef
407#else
408typedef struct
409#endif
410{
411 ETH_TypeDef *Instance;
413 ETH_InitTypeDef Init;
415 ETH_TxDescListTypeDef TxDescList;
418 ETH_RxDescListTypeDef RxDescList;
421 HAL_LockTypeDef Lock;
423 __IO HAL_ETH_StateTypeDef gState;
427 __IO HAL_ETH_StateTypeDef RxState;
430 __IO uint32_t ErrorCode;
433 __IO uint32_t DMAErrorCode;
436 __IO uint32_t MACErrorCode;
439 __IO uint32_t MACWakeUpEvent;
442 __IO uint32_t MACLPIEvent;
445#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
446
447 void (* TxCpltCallback) ( struct __ETH_HandleTypeDef * heth);
448 void (* RxCpltCallback) ( struct __ETH_HandleTypeDef * heth);
449 void (* DMAErrorCallback) ( struct __ETH_HandleTypeDef * heth);
450 void (* MACErrorCallback) ( struct __ETH_HandleTypeDef * heth);
451 void (* PMTCallback) ( struct __ETH_HandleTypeDef * heth);
452 void (* EEECallback) ( struct __ETH_HandleTypeDef * heth);
453 void (* WakeUpCallback) ( struct __ETH_HandleTypeDef * heth);
455 void (* MspInitCallback) ( struct __ETH_HandleTypeDef * heth);
456 void (* MspDeInitCallback) ( struct __ETH_HandleTypeDef * heth);
458#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
459
460} ETH_HandleTypeDef;
465#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
469typedef enum
470{
471 HAL_ETH_MSPINIT_CB_ID = 0x00U,
472 HAL_ETH_MSPDEINIT_CB_ID = 0x01U,
474 HAL_ETH_TX_COMPLETE_CB_ID = 0x02U,
475 HAL_ETH_RX_COMPLETE_CB_ID = 0x03U,
476 HAL_ETH_DMA_ERROR_CB_ID = 0x04U,
477 HAL_ETH_MAC_ERROR_CB_ID = 0x05U,
478 HAL_ETH_PMT_CB_ID = 0x06U,
479 HAL_ETH_EEE_CB_ID = 0x07U,
480 HAL_ETH_WAKEUP_CB_ID = 0x08U
483}HAL_ETH_CallbackIDTypeDef;
484
488typedef void (*pETH_CallbackTypeDef)(ETH_HandleTypeDef * heth);
490#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
491
495typedef struct{
496 FunctionalState PromiscuousMode;
498 FunctionalState ReceiveAllMode;
500 FunctionalState HachOrPerfectFilter;
502 FunctionalState HashUnicast;
504 FunctionalState HashMulticast;
506 FunctionalState PassAllMulticast;
508 FunctionalState SrcAddrFiltering;
510 FunctionalState SrcAddrInverseFiltering;
512 FunctionalState DestAddrInverseFiltering;
514 FunctionalState BroadcastFilter;
516 uint32_t ControlPacketsFilter;
518}ETH_MACFilterConfigTypeDef;
526typedef struct{
527 FunctionalState WakeUpPacket;
529 FunctionalState MagicPacket;
531 FunctionalState GlobalUnicast;
533 FunctionalState WakeUpForward;
535}ETH_PowerDownConfigTypeDef;
544/* Exported constants --------------------------------------------------------*/
553/*
554 DMA Tx Normal Descriptor Read Format
555 -----------------------------------------------------------------------------------------------
556 TDES0 | Buffer1 or Header Address [31:0] |
557 -----------------------------------------------------------------------------------------------
558 TDES1 | Buffer2 Address [31:0] / Next Descriptor Address [31:0] |
559 -----------------------------------------------------------------------------------------------
560 TDES2 | IOC(31) | TTSE(30) | Buff2 Length[29:16] | VTIR[15:14] | Header or Buff1 Length[13:0] |
561 -----------------------------------------------------------------------------------------------
562 TDES3 | OWN(31) | CTRL[30:26] | Reserved[25:24] | CTRL[23:20] | Reserved[19:17] | Status[16:0] |
563 -----------------------------------------------------------------------------------------------
564*/
565
569#define ETH_DMATXNDESCRF_B1AP ((uint32_t)0xFFFFFFFFU)
574#define ETH_DMATXNDESCRF_B2AP ((uint32_t)0xFFFFFFFFU)
579#define ETH_DMATXNDESCRF_IOC ((uint32_t)0x80000000U)
580#define ETH_DMATXNDESCRF_TTSE ((uint32_t)0x40000000U)
581#define ETH_DMATXNDESCRF_B2L ((uint32_t)0x3FFF0000U)
582#define ETH_DMATXNDESCRF_VTIR ((uint32_t)0x0000C000U)
583#define ETH_DMATXNDESCRF_VTIR_DISABLE ((uint32_t)0x00000000U)
584#define ETH_DMATXNDESCRF_VTIR_REMOVE ((uint32_t)0x00004000U)
585#define ETH_DMATXNDESCRF_VTIR_INSERT ((uint32_t)0x00008000U)
586#define ETH_DMATXNDESCRF_VTIR_REPLACE ((uint32_t)0x0000C000U)
587#define ETH_DMATXNDESCRF_B1L ((uint32_t)0x00003FFFU)
588#define ETH_DMATXNDESCRF_HL ((uint32_t)0x000003FFU)
593#define ETH_DMATXNDESCRF_OWN ((uint32_t)0x80000000U)
594#define ETH_DMATXNDESCRF_CTXT ((uint32_t)0x40000000U)
595#define ETH_DMATXNDESCRF_FD ((uint32_t)0x20000000U)
596#define ETH_DMATXNDESCRF_LD ((uint32_t)0x10000000U)
597#define ETH_DMATXNDESCRF_CPC ((uint32_t)0x0C000000U)
598#define ETH_DMATXNDESCRF_CPC_CRCPAD_INSERT ((uint32_t)0x00000000U)
599#define ETH_DMATXNDESCRF_CPC_CRC_INSERT ((uint32_t)0x04000000U)
600#define ETH_DMATXNDESCRF_CPC_DISABLE ((uint32_t)0x08000000U)
601#define ETH_DMATXNDESCRF_CPC_CRC_REPLACE ((uint32_t)0x0C000000U)
602#define ETH_DMATXNDESCRF_SAIC ((uint32_t)0x03800000U)
603#define ETH_DMATXNDESCRF_SAIC_DISABLE ((uint32_t)0x00000000U)
604#define ETH_DMATXNDESCRF_SAIC_INSERT ((uint32_t)0x00800000U)
605#define ETH_DMATXNDESCRF_SAIC_REPLACE ((uint32_t)0x01000000U)
606#define ETH_DMATXNDESCRF_THL ((uint32_t)0x00780000U)
607#define ETH_DMATXNDESCRF_TSE ((uint32_t)0x00040000U)
608#define ETH_DMATXNDESCRF_CIC ((uint32_t)0x00030000U)
609#define ETH_DMATXNDESCRF_CIC_DISABLE ((uint32_t)0x00000000U)
610#define ETH_DMATXNDESCRF_CIC_IPHDR_INSERT ((uint32_t)0x00010000U)
611#define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT ((uint32_t)0x00020000U)
613#define ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT_PHDR_CALC ((uint32_t)0x00030000U)
615#define ETH_DMATXNDESCRF_TPL ((uint32_t)0x0003FFFFU)
616#define ETH_DMATXNDESCRF_FL ((uint32_t)0x00007FFFU)
618/*
619 DMA Tx Normal Descriptor Write Back Format
620 -----------------------------------------------------------------------------------------------
621 TDES0 | Timestamp Low |
622 -----------------------------------------------------------------------------------------------
623 TDES1 | Timestamp High |
624 -----------------------------------------------------------------------------------------------
625 TDES2 | Reserved[31:0] |
626 -----------------------------------------------------------------------------------------------
627 TDES3 | OWN(31) | Status[30:0] |
628 -----------------------------------------------------------------------------------------------
629*/
630
634#define ETH_DMATXNDESCWBF_TTSL ((uint32_t)0xFFFFFFFFU)
639#define ETH_DMATXNDESCWBF_TTSH ((uint32_t)0xFFFFFFFFU)
644#define ETH_DMATXNDESCWBF_OWN ((uint32_t)0x80000000U)
645#define ETH_DMATXNDESCWBF_CTXT ((uint32_t)0x40000000U)
646#define ETH_DMATXNDESCWBF_FD ((uint32_t)0x20000000U)
647#define ETH_DMATXNDESCWBF_LD ((uint32_t)0x10000000U)
648#define ETH_DMATXNDESCWBF_TTSS ((uint32_t)0x00020000U)
649#define ETH_DMATXNDESCWBF_DP ((uint32_t)0x04000000U)
650#define ETH_DMATXNDESCWBF_TTSE ((uint32_t)0x02000000U)
651#define ETH_DMATXNDESCWBF_ES ((uint32_t)0x00008000U)
652#define ETH_DMATXNDESCWBF_JT ((uint32_t)0x00004000U)
653#define ETH_DMATXNDESCWBF_FF ((uint32_t)0x00002000U)
654#define ETH_DMATXNDESCWBF_PCE ((uint32_t)0x00001000U)
655#define ETH_DMATXNDESCWBF_LCA ((uint32_t)0x00000800U)
656#define ETH_DMATXNDESCWBF_NC ((uint32_t)0x00000400U)
657#define ETH_DMATXNDESCWBF_LCO ((uint32_t)0x00000200U)
658#define ETH_DMATXNDESCWBF_EC ((uint32_t)0x00000100U)
659#define ETH_DMATXNDESCWBF_CC ((uint32_t)0x000000F0U)
660#define ETH_DMATXNDESCWBF_ED ((uint32_t)0x00000008U)
661#define ETH_DMATXNDESCWBF_UF ((uint32_t)0x00000004U)
662#define ETH_DMATXNDESCWBF_DB ((uint32_t)0x00000002U)
663#define ETH_DMATXNDESCWBF_IHE ((uint32_t)0x00000004U)
666/*
667 DMA Tx Context Descriptor
668 -----------------------------------------------------------------------------------------------
669 TDES0 | Timestamp Low |
670 -----------------------------------------------------------------------------------------------
671 TDES1 | Timestamp High |
672 -----------------------------------------------------------------------------------------------
673 TDES2 | Inner VLAN Tag[31:16] | Reserved(15) | Maximum Segment Size [14:0] |
674 -----------------------------------------------------------------------------------------------
675 TDES3 | OWN(31) | Status[30:0] |
676 -----------------------------------------------------------------------------------------------
677*/
678
682#define ETH_DMATXCDESC_TTSL ((uint32_t)0xFFFFFFFFU)
687#define ETH_DMATXCDESC_TTSH ((uint32_t)0xFFFFFFFFU)
692#define ETH_DMATXCDESC_IVT ((uint32_t)0xFFFF0000U)
693#define ETH_DMATXCDESC_MSS ((uint32_t)0x00003FFFU)
698#define ETH_DMATXCDESC_OWN ((uint32_t)0x80000000U)
699#define ETH_DMATXCDESC_CTXT ((uint32_t)0x40000000U)
700#define ETH_DMATXCDESC_OSTC ((uint32_t)0x08000000U)
701#define ETH_DMATXCDESC_TCMSSV ((uint32_t)0x04000000U)
702#define ETH_DMATXCDESC_CDE ((uint32_t)0x00800000U)
703#define ETH_DMATXCDESC_IVTIR ((uint32_t)0x000C0000U)
704#define ETH_DMATXCDESC_IVTIR_DISABLE ((uint32_t)0x00000000U)
705#define ETH_DMATXCDESC_IVTIR_REMOVE ((uint32_t)0x00040000U)
706#define ETH_DMATXCDESC_IVTIR_INSERT ((uint32_t)0x00080000U)
707#define ETH_DMATXCDESC_IVTIR_REPLACE ((uint32_t)0x000C0000U)
708#define ETH_DMATXCDESC_IVLTV ((uint32_t)0x00020000U)
709#define ETH_DMATXCDESC_VLTV ((uint32_t)0x00010000U)
710#define ETH_DMATXCDESC_VT ((uint32_t)0x0000FFFFU)
721/*
722 DMA Rx Normal Descriptor read format
723 -----------------------------------------------------------------------------------------------------------
724 RDES0 | Buffer1 or Header Address [31:0] |
725 -----------------------------------------------------------------------------------------------------------
726 RDES1 | Reserved |
727 -----------------------------------------------------------------------------------------------------------
728 RDES2 | Payload or Buffer2 Address[31:0] |
729 -----------------------------------------------------------------------------------------------------------
730 RDES3 | OWN(31) | IOC(30) | Reserved [29:26] | BUF2V(25) | BUF1V(24) | Reserved [23:0] |
731 -----------------------------------------------------------------------------------------------------------
732*/
733
737#define ETH_DMARXNDESCRF_BUF1AP ((uint32_t)0xFFFFFFFFU)
742#define ETH_DMARXNDESCRF_BUF2AP ((uint32_t)0xFFFFFFFFU)
747#define ETH_DMARXNDESCRF_OWN ((uint32_t)0x80000000U)
748#define ETH_DMARXNDESCRF_IOC ((uint32_t)0x40000000U)
749#define ETH_DMARXNDESCRF_BUF2V ((uint32_t)0x02000000U)
750#define ETH_DMARXNDESCRF_BUF1V ((uint32_t)0x01000000U)
752/*
753 DMA Rx Normal Descriptor write back format
754 ---------------------------------------------------------------------------------------------------------------------
755 RDES0 | Inner VLAN Tag[31:16] | Outer VLAN Tag[15:0] |
756 ---------------------------------------------------------------------------------------------------------------------
757 RDES1 | OAM code, or MAC Control Opcode [31:16] | Extended Status |
758 ---------------------------------------------------------------------------------------------------------------------
759 RDES2 | MAC Filter Status[31:16] | VF(15) | Reserved [14:12] | ARP Status [11:10] | Header Length [9:0] |
760 ---------------------------------------------------------------------------------------------------------------------
761 RDES3 | OWN(31) | CTXT(30) | FD(29) | LD(28) | Status[27:16] | ES(15) | Packet Length[14:0] |
762 ---------------------------------------------------------------------------------------------------------------------
763*/
764
768#define ETH_DMARXNDESCWBF_IVT ((uint32_t)0xFFFF0000U)
769#define ETH_DMARXNDESCWBF_OVT ((uint32_t)0x0000FFFFU)
774#define ETH_DMARXNDESCWBF_OPC ((uint32_t)0xFFFF0000U)
775#define ETH_DMARXNDESCWBF_TD ((uint32_t)0x00008000U)
776#define ETH_DMARXNDESCWBF_TSA ((uint32_t)0x00004000U)
777#define ETH_DMARXNDESCWBF_PV ((uint32_t)0x00002000U)
778#define ETH_DMARXNDESCWBF_PFT ((uint32_t)0x00001000U)
779#define ETH_DMARXNDESCWBF_PMT_NO ((uint32_t)0x00000000U)
780#define ETH_DMARXNDESCWBF_PMT_SYNC ((uint32_t)0x00000100U)
781#define ETH_DMARXNDESCWBF_PMT_FUP ((uint32_t)0x00000200U)
782#define ETH_DMARXNDESCWBF_PMT_DREQ ((uint32_t)0x00000300U)
783#define ETH_DMARXNDESCWBF_PMT_DRESP ((uint32_t)0x00000400U)
784#define ETH_DMARXNDESCWBF_PMT_PDREQ ((uint32_t)0x00000500U)
785#define ETH_DMARXNDESCWBF_PMT_PDRESP ((uint32_t)0x00000600U)
786#define ETH_DMARXNDESCWBF_PMT_PDRESPFUP ((uint32_t)0x00000700U)
787#define ETH_DMARXNDESCWBF_PMT_ANNOUNCE ((uint32_t)0x00000800U)
788#define ETH_DMARXNDESCWBF_PMT_MANAG ((uint32_t)0x00000900U)
789#define ETH_DMARXNDESCWBF_PMT_SIGN ((uint32_t)0x00000A00U)
790#define ETH_DMARXNDESCWBF_PMT_RESERVED ((uint32_t)0x00000F00U)
791#define ETH_DMARXNDESCWBF_IPCE ((uint32_t)0x00000080U)
792#define ETH_DMARXNDESCWBF_IPCB ((uint32_t)0x00000040U)
793#define ETH_DMARXNDESCWBF_IPV6 ((uint32_t)0x00000020U)
794#define ETH_DMARXNDESCWBF_IPV4 ((uint32_t)0x00000010U)
795#define ETH_DMARXNDESCWBF_IPHE ((uint32_t)0x00000008U)
796#define ETH_DMARXNDESCWBF_PT ((uint32_t)0x00000003U)
797#define ETH_DMARXNDESCWBF_PT_UNKNOWN ((uint32_t)0x00000000U)
798#define ETH_DMARXNDESCWBF_PT_UDP ((uint32_t)0x00000001U)
799#define ETH_DMARXNDESCWBF_PT_TCP ((uint32_t)0x00000002U)
800#define ETH_DMARXNDESCWBF_PT_ICMP ((uint32_t)0x00000003U)
805#define ETH_DMARXNDESCWBF_L3L4FM ((uint32_t)0x20000000U)
806#define ETH_DMARXNDESCWBF_L4FM ((uint32_t)0x10000000U)
807#define ETH_DMARXNDESCWBF_L3FM ((uint32_t)0x08000000U)
808#define ETH_DMARXNDESCWBF_MADRM ((uint32_t)0x07F80000U)
809#define ETH_DMARXNDESCWBF_HF ((uint32_t)0x00040000U)
810#define ETH_DMARXNDESCWBF_DAF ((uint32_t)0x00020000U)
811#define ETH_DMARXNDESCWBF_SAF ((uint32_t)0x00010000U)
812#define ETH_DMARXNDESCWBF_VF ((uint32_t)0x00008000U)
813#define ETH_DMARXNDESCWBF_ARPNR ((uint32_t)0x00000400U)
819#define ETH_DMARXNDESCWBF_OWN ((uint32_t)0x80000000U)
820#define ETH_DMARXNDESCWBF_CTXT ((uint32_t)0x40000000U)
821#define ETH_DMARXNDESCWBF_FD ((uint32_t)0x20000000U)
822#define ETH_DMARXNDESCWBF_LD ((uint32_t)0x10000000U)
823#define ETH_DMARXNDESCWBF_RS2V ((uint32_t)0x08000000U)
824#define ETH_DMARXNDESCWBF_RS1V ((uint32_t)0x04000000U)
825#define ETH_DMARXNDESCWBF_RS0V ((uint32_t)0x02000000U)
826#define ETH_DMARXNDESCWBF_CE ((uint32_t)0x01000000U)
827#define ETH_DMARXNDESCWBF_GP ((uint32_t)0x00800000U)
828#define ETH_DMARXNDESCWBF_RWT ((uint32_t)0x00400000U)
829#define ETH_DMARXNDESCWBF_OE ((uint32_t)0x00200000U)
830#define ETH_DMARXNDESCWBF_RE ((uint32_t)0x00100000U)
831#define ETH_DMARXNDESCWBF_DE ((uint32_t)0x00080000U)
832#define ETH_DMARXNDESCWBF_LT ((uint32_t)0x00070000U)
833#define ETH_DMARXNDESCWBF_LT_LP ((uint32_t)0x00000000U)
834#define ETH_DMARXNDESCWBF_LT_TP ((uint32_t)0x00010000U)
835#define ETH_DMARXNDESCWBF_LT_ARP ((uint32_t)0x00030000U)
836#define ETH_DMARXNDESCWBF_LT_VLAN ((uint32_t)0x00040000U)
837#define ETH_DMARXNDESCWBF_LT_DVLAN ((uint32_t)0x00050000U)
838#define ETH_DMARXNDESCWBF_LT_MAC ((uint32_t)0x00060000U)
839#define ETH_DMARXNDESCWBF_LT_OAM ((uint32_t)0x00070000U)
840#define ETH_DMARXNDESCWBF_ES ((uint32_t)0x00008000U)
841#define ETH_DMARXNDESCWBF_PL ((uint32_t)0x00007FFFU)
843/*
844 DMA Rx context Descriptor
845 ---------------------------------------------------------------------------------------------------------------------
846 RDES0 | Timestamp Low[31:0] |
847 ---------------------------------------------------------------------------------------------------------------------
848 RDES1 | Timestamp High[31:0] |
849 ---------------------------------------------------------------------------------------------------------------------
850 RDES2 | Reserved |
851 ---------------------------------------------------------------------------------------------------------------------
852 RDES3 | OWN(31) | CTXT(30) | Reserved[29:0] |
853 ---------------------------------------------------------------------------------------------------------------------
854*/
855
859#define ETH_DMARXCDESC_RTSL ((uint32_t)0xFFFFFFFFU)
864#define ETH_DMARXCDESC_RTSH ((uint32_t)0xFFFFFFFFU)
869#define ETH_DMARXCDESC_OWN ((uint32_t)0x80000000U)
870#define ETH_DMARXCDESC_CTXT ((uint32_t)0x40000000U)
879#define ETH_MAX_PACKET_SIZE ((uint32_t)1528U)
880#define ETH_HEADER ((uint32_t)14U)
881#define ETH_CRC ((uint32_t)4U)
882#define ETH_VLAN_TAG ((uint32_t)4U)
883#define ETH_MIN_PAYLOAD ((uint32_t)46U)
884#define ETH_MAX_PAYLOAD ((uint32_t)1500U)
885#define ETH_JUMBO_FRAME_PAYLOAD ((uint32_t)9000U)
893#define HAL_ETH_ERROR_NONE ((uint32_t)0x00000000U)
894#define HAL_ETH_ERROR_PARAM ((uint32_t)0x00000001U)
895#define HAL_ETH_ERROR_BUSY ((uint32_t)0x00000002U)
896#define HAL_ETH_ERROR_TIMEOUT ((uint32_t)0x00000004U)
897#define HAL_ETH_ERROR_DMA ((uint32_t)0x00000008U)
898#define HAL_ETH_ERROR_MAC ((uint32_t)0x00000010U)
899#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
900#define HAL_ETH_ERROR_INVALID_CALLBACK ((uint32_t)0x00000020U)
901#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
909#define ETH_TX_PACKETS_FEATURES_CSUM ((uint32_t)0x00000001U)
910#define ETH_TX_PACKETS_FEATURES_SAIC ((uint32_t)0x00000002U)
911#define ETH_TX_PACKETS_FEATURES_VLANTAG ((uint32_t)0x00000004U)
912#define ETH_TX_PACKETS_FEATURES_INNERVLANTAG ((uint32_t)0x00000008U)
913#define ETH_TX_PACKETS_FEATURES_TSO ((uint32_t)0x00000010U)
914#define ETH_TX_PACKETS_FEATURES_CRCPAD ((uint32_t)0x00000020U)
922#define ETH_SRC_ADDR_CONTROL_DISABLE ETH_DMATXNDESCRF_SAIC_DISABLE
923#define ETH_SRC_ADDR_INSERT ETH_DMATXNDESCRF_SAIC_INSERT
924#define ETH_SRC_ADDR_REPLACE ETH_DMATXNDESCRF_SAIC_REPLACE
932#define ETH_CRC_PAD_DISABLE ETH_DMATXNDESCRF_CPC_DISABLE
933#define ETH_CRC_PAD_INSERT ETH_DMATXNDESCRF_CPC_CRCPAD_INSERT
934#define ETH_CRC_INSERT ETH_DMATXNDESCRF_CPC_CRC_INSERT
935#define ETH_CRC_REPLACE ETH_DMATXNDESCRF_CPC_CRC_REPLACE
943#define ETH_CHECKSUM_DISABLE ETH_DMATXNDESCRF_CIC_DISABLE
944#define ETH_CHECKSUM_IPHDR_INSERT ETH_DMATXNDESCRF_CIC_IPHDR_INSERT
945#define ETH_CHECKSUM_IPHDR_PAYLOAD_INSERT ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT
946#define ETH_CHECKSUM_IPHDR_PAYLOAD_INSERT_PHDR_CALC ETH_DMATXNDESCRF_CIC_IPHDR_PAYLOAD_INSERT_PHDR_CALC
954#define ETH_VLAN_DISABLE ETH_DMATXNDESCRF_VTIR_DISABLE
955#define ETH_VLAN_REMOVE ETH_DMATXNDESCRF_VTIR_REMOVE
956#define ETH_VLAN_INSERT ETH_DMATXNDESCRF_VTIR_INSERT
957#define ETH_VLAN_REPLACE ETH_DMATXNDESCRF_VTIR_REPLACE
965#define ETH_INNER_VLAN_DISABLE ETH_DMATXCDESC_IVTIR_DISABLE
966#define ETH_INNER_VLAN_REMOVE ETH_DMATXCDESC_IVTIR_REMOVE
967#define ETH_INNER_VLAN_INSERT ETH_DMATXCDESC_IVTIR_INSERT
968#define ETH_INNER_VLAN_REPLACE ETH_DMATXCDESC_IVTIR_REPLACE
976#define ETH_CHECKSUM_BYPASSED ETH_DMARXNDESCWBF_IPCB
977#define ETH_CHECKSUM_IP_HEADER_ERROR ETH_DMARXNDESCWBF_IPHE
978#define ETH_CHECKSUM_IP_PAYLOAD_ERROR ETH_DMARXNDESCWBF_IPCE
986#define ETH_IP_HEADER_IPV4 ETH_DMARXNDESCWBF_IPV4
987#define ETH_IP_HEADER_IPV6 ETH_DMARXNDESCWBF_IPV6
995#define ETH_IP_PAYLOAD_UNKNOWN ETH_DMARXNDESCWBF_PT_UNKNOWN
996#define ETH_IP_PAYLOAD_UDP ETH_DMARXNDESCWBF_PT_UDP
997#define ETH_IP_PAYLOAD_TCP ETH_DMARXNDESCWBF_PT_TCP
998#define ETH_IP_PAYLOAD_ICMPN ETH_DMARXNDESCWBF_PT_ICMP
1006#define ETH_HASH_FILTER_PASS ETH_DMARXNDESCWBF_HF
1007#define ETH_VLAN_FILTER_PASS ETH_DMARXNDESCWBF_VF
1008#define ETH_DEST_ADDRESS_FAIL ETH_DMARXNDESCWBF_DAF
1009#define ETH_SOURCE_ADDRESS_FAIL ETH_DMARXNDESCWBF_SAF
1017#define ETH_L3_FILTER0_MATCH ETH_DMARXNDESCWBF_L3FM
1018#define ETH_L3_FILTER1_MATCH (ETH_DMARXNDESCWBF_L3FM | ETH_DMARXNDESCWBF_L3L4FM)
1026#define ETH_L4_FILTER0_MATCH ETH_DMARXNDESCWBF_L4FM
1027#define ETH_L4_FILTER1_MATCH (ETH_DMARXNDESCWBF_L4FM | ETH_DMARXNDESCWBF_L3L4FM)
1035#define ETH_DRIBBLE_BIT_ERROR ETH_DMARXNDESCWBF_DE
1036#define ETH_RECEIVE_ERROR ETH_DMARXNDESCWBF_RE
1037#define ETH_RECEIVE_OVERFLOW ETH_DMARXNDESCWBF_OE
1038#define ETH_WATCHDOG_TIMEOUT ETH_DMARXNDESCWBF_RWT
1039#define ETH_GIANT_PACKET ETH_DMARXNDESCWBF_GP
1040#define ETH_CRC_ERROR ETH_DMARXNDESCWBF_CE
1048#define ETH_DMAARBITRATION_RX ETH_DMAMR_DA
1049#define ETH_DMAARBITRATION_RX1_TX1 ((uint32_t)0x00000000U)
1050#define ETH_DMAARBITRATION_RX2_TX1 ETH_DMAMR_PR_2_1
1051#define ETH_DMAARBITRATION_RX3_TX1 ETH_DMAMR_PR_3_1
1052#define ETH_DMAARBITRATION_RX4_TX1 ETH_DMAMR_PR_4_1
1053#define ETH_DMAARBITRATION_RX5_TX1 ETH_DMAMR_PR_5_1
1054#define ETH_DMAARBITRATION_RX6_TX1 ETH_DMAMR_PR_6_1
1055#define ETH_DMAARBITRATION_RX7_TX1 ETH_DMAMR_PR_7_1
1056#define ETH_DMAARBITRATION_RX8_TX1 ETH_DMAMR_PR_8_1
1057#define ETH_DMAARBITRATION_TX (ETH_DMAMR_TXPR | ETH_DMAMR_DA)
1058#define ETH_DMAARBITRATION_TX1_RX1 ((uint32_t)0x00000000U)
1059#define ETH_DMAARBITRATION_TX2_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_2_1)
1060#define ETH_DMAARBITRATION_TX3_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_3_1)
1061#define ETH_DMAARBITRATION_TX4_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_4_1)
1062#define ETH_DMAARBITRATION_TX5_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_5_1)
1063#define ETH_DMAARBITRATION_TX6_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_6_1)
1064#define ETH_DMAARBITRATION_TX7_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_7_1)
1065#define ETH_DMAARBITRATION_TX8_RX1 (ETH_DMAMR_TXPR | ETH_DMAMR_PR_8_1)
1073#define ETH_BURSTLENGTH_FIXED ETH_DMASBMR_FB
1074#define ETH_BURSTLENGTH_MIXED ETH_DMASBMR_MB
1075#define ETH_BURSTLENGTH_UNSPECIFIED ((uint32_t)0x00000000U)
1083#define ETH_TXDMABURSTLENGTH_1BEAT ETH_DMACTCR_TPBL_1PBL
1084#define ETH_TXDMABURSTLENGTH_2BEAT ETH_DMACTCR_TPBL_2PBL
1085#define ETH_TXDMABURSTLENGTH_4BEAT ETH_DMACTCR_TPBL_4PBL
1086#define ETH_TXDMABURSTLENGTH_8BEAT ETH_DMACTCR_TPBL_8PBL
1087#define ETH_TXDMABURSTLENGTH_16BEAT ETH_DMACTCR_TPBL_16PBL
1088#define ETH_TXDMABURSTLENGTH_32BEAT ETH_DMACTCR_TPBL_32PBL
1096#define ETH_RXDMABURSTLENGTH_1BEAT ETH_DMACRCR_RPBL_1PBL
1097#define ETH_RXDMABURSTLENGTH_2BEAT ETH_DMACRCR_RPBL_2PBL
1098#define ETH_RXDMABURSTLENGTH_4BEAT ETH_DMACRCR_RPBL_4PBL
1099#define ETH_RXDMABURSTLENGTH_8BEAT ETH_DMACRCR_RPBL_8PBL
1100#define ETH_RXDMABURSTLENGTH_16BEAT ETH_DMACRCR_RPBL_16PBL
1101#define ETH_RXDMABURSTLENGTH_32BEAT ETH_DMACRCR_RPBL_32PBL
1109#define ETH_DMA_NORMAL_IT ETH_DMACIER_NIE
1110#define ETH_DMA_ABNORMAL_IT ETH_DMACIER_AIE
1111#define ETH_DMA_CONTEXT_DESC_ERROR_IT ETH_DMACIER_CDEE
1112#define ETH_DMA_FATAL_BUS_ERROR_IT ETH_DMACIER_FBEE
1113#define ETH_DMA_EARLY_RX_IT ETH_DMACIER_ERIE
1114#define ETH_DMA_EARLY_TX_IT ETH_DMACIER_ETIE
1115#define ETH_DMA_RX_WATCHDOG_TIMEOUT_IT ETH_DMACIER_RWTE
1116#define ETH_DMA_RX_PROCESS_STOPPED_IT ETH_DMACIER_RSE
1117#define ETH_DMA_RX_BUFFER_UNAVAILABLE_IT ETH_DMACIER_RBUE
1118#define ETH_DMA_RX_IT ETH_DMACIER_RIE
1119#define ETH_DMA_TX_BUFFER_UNAVAILABLE_IT ETH_DMACIER_TBUE
1120#define ETH_DMA_TX_PROCESS_STOPPED_IT ETH_DMACIER_TXSE
1121#define ETH_DMA_TX_IT ETH_DMACIER_TIE
1129#define ETH_DMA_RX_NO_ERROR_FLAG ((uint32_t)0x00000000U)
1130#define ETH_DMA_RX_DESC_READ_ERROR_FLAG (ETH_DMACSR_REB_BIT_2 | ETH_DMACSR_REB_BIT_1 | ETH_DMACSR_REB_BIT_0)
1131#define ETH_DMA_RX_DESC_WRITE_ERROR_FLAG (ETH_DMACSR_REB_BIT_2 | ETH_DMACSR_REB_BIT_1)
1132#define ETH_DMA_RX_BUFFER_READ_ERROR_FLAG (ETH_DMACSR_REB_BIT_2 | ETH_DMACSR_REB_BIT_0)
1133#define ETH_DMA_RX_BUFFER_WRITE_ERROR_FLAG ETH_DMACSR_REB_BIT_2
1134#define ETH_DMA_TX_NO_ERROR_FLAG ((uint32_t)0x00000000U)
1135#define ETH_DMA_TX_DESC_READ_ERROR_FLAG (ETH_DMACSR_TEB_BIT_2 | ETH_DMACSR_TEB_BIT_1 | ETH_DMACSR_TEB_BIT_0)
1136#define ETH_DMA_TX_DESC_WRITE_ERROR_FLAG (ETH_DMACSR_TEB_BIT_2 | ETH_DMACSR_TEB_BIT_1)
1137#define ETH_DMA_TX_BUFFER_READ_ERROR_FLAG (ETH_DMACSR_TEB_BIT_2 | ETH_DMACSR_TEB_BIT_0)
1138#define ETH_DMA_TX_BUFFER_WRITE_ERROR_FLAG ETH_DMACSR_TEB_BIT_2
1139#define ETH_DMA_CONTEXT_DESC_ERROR_FLAG ETH_DMACSR_CDE
1140#define ETH_DMA_FATAL_BUS_ERROR_FLAG ETH_DMACSR_FBE
1141#define ETH_DMA_EARLY_TX_IT_FLAG ETH_DMACSR_ERI
1142#define ETH_DMA_RX_WATCHDOG_TIMEOUT_FLAG ETH_DMACSR_RWT
1143#define ETH_DMA_RX_PROCESS_STOPPED_FLAG ETH_DMACSR_RPS
1144#define ETH_DMA_RX_BUFFER_UNAVAILABLE_FLAG ETH_DMACSR_RBU
1145#define ETH_DMA_TX_PROCESS_STOPPED_FLAG ETH_DMACSR_TPS
1153#define ETH_TRANSMITSTOREFORWARD ETH_MTLTQOMR_TSF
1154#define ETH_TRANSMITTHRESHOLD_32 ETH_MTLTQOMR_TTC_32BITS
1155#define ETH_TRANSMITTHRESHOLD_64 ETH_MTLTQOMR_TTC_64BITS
1156#define ETH_TRANSMITTHRESHOLD_96 ETH_MTLTQOMR_TTC_96BITS
1157#define ETH_TRANSMITTHRESHOLD_128 ETH_MTLTQOMR_TTC_128BITS
1158#define ETH_TRANSMITTHRESHOLD_192 ETH_MTLTQOMR_TTC_192BITS
1159#define ETH_TRANSMITTHRESHOLD_256 ETH_MTLTQOMR_TTC_256BITS
1160#define ETH_TRANSMITTHRESHOLD_384 ETH_MTLTQOMR_TTC_384BITS
1161#define ETH_TRANSMITTHRESHOLD_512 ETH_MTLTQOMR_TTC_512BITS
1169#define ETH_RECEIVESTOREFORWARD ETH_MTLRQOMR_RSF
1170#define ETH_RECEIVETHRESHOLD8_64 ETH_MTLRQOMR_RTC_64BITS
1171#define ETH_RECEIVETHRESHOLD8_32 ETH_MTLRQOMR_RTC_32BITS
1172#define ETH_RECEIVETHRESHOLD8_96 ETH_MTLRQOMR_RTC_96BITS
1173#define ETH_RECEIVETHRESHOLD8_128 ETH_MTLRQOMR_RTC_128BITS
1181#define ETH_PAUSELOWTHRESHOLD_MINUS_4 ETH_MACTFCR_PLT_MINUS4
1182#define ETH_PAUSELOWTHRESHOLD_MINUS_28 ETH_MACTFCR_PLT_MINUS28
1183#define ETH_PAUSELOWTHRESHOLD_MINUS_36 ETH_MACTFCR_PLT_MINUS36
1184#define ETH_PAUSELOWTHRESHOLD_MINUS_144 ETH_MACTFCR_PLT_MINUS144
1185#define ETH_PAUSELOWTHRESHOLD_MINUS_256 ETH_MACTFCR_PLT_MINUS256
1186#define ETH_PAUSELOWTHRESHOLD_MINUS_512 ETH_MACTFCR_PLT_MINUS512
1194#define ETH_WATCHDOGTIMEOUT_2KB ETH_MACWTR_WTO_2KB
1195#define ETH_WATCHDOGTIMEOUT_3KB ETH_MACWTR_WTO_3KB
1196#define ETH_WATCHDOGTIMEOUT_4KB ETH_MACWTR_WTO_4KB
1197#define ETH_WATCHDOGTIMEOUT_5KB ETH_MACWTR_WTO_5KB
1198#define ETH_WATCHDOGTIMEOUT_6KB ETH_MACWTR_WTO_6KB
1199#define ETH_WATCHDOGTIMEOUT_7KB ETH_MACWTR_WTO_7KB
1200#define ETH_WATCHDOGTIMEOUT_8KB ETH_MACWTR_WTO_8KB
1201#define ETH_WATCHDOGTIMEOUT_9KB ETH_MACWTR_WTO_9KB
1202#define ETH_WATCHDOGTIMEOUT_10KB ETH_MACWTR_WTO_10KB
1203#define ETH_WATCHDOGTIMEOUT_11KB ETH_MACWTR_WTO_12KB
1204#define ETH_WATCHDOGTIMEOUT_12KB ETH_MACWTR_WTO_12KB
1205#define ETH_WATCHDOGTIMEOUT_13KB ETH_MACWTR_WTO_13KB
1206#define ETH_WATCHDOGTIMEOUT_14KB ETH_MACWTR_WTO_14KB
1207#define ETH_WATCHDOGTIMEOUT_15KB ETH_MACWTR_WTO_15KB
1208#define ETH_WATCHDOGTIMEOUT_16KB ETH_MACWTR_WTO_16KB
1216#define ETH_INTERPACKETGAP_96BIT ETH_MACCR_IPG_96BIT
1217#define ETH_INTERPACKETGAP_88BIT ETH_MACCR_IPG_88BIT
1218#define ETH_INTERPACKETGAP_80BIT ETH_MACCR_IPG_80BIT
1219#define ETH_INTERPACKETGAP_72BIT ETH_MACCR_IPG_72BIT
1220#define ETH_INTERPACKETGAP_64BIT ETH_MACCR_IPG_64BIT
1221#define ETH_INTERPACKETGAP_56BIT ETH_MACCR_IPG_56BIT
1222#define ETH_INTERPACKETGAP_48BIT ETH_MACCR_IPG_48BIT
1223#define ETH_INTERPACKETGAP_40BIT ETH_MACCR_IPG_40BIT
1231#define ETH_SPEED_10M ((uint32_t)0x00000000U)
1232#define ETH_SPEED_100M ETH_MACCR_FES
1240#define ETH_FULLDUPLEX_MODE ETH_MACCR_DM
1241#define ETH_HALFDUPLEX_MODE ((uint32_t)0x00000000U)
1249#define ETH_BACKOFFLIMIT_10 ETH_MACCR_BL_10
1250#define ETH_BACKOFFLIMIT_8 ETH_MACCR_BL_8
1251#define ETH_BACKOFFLIMIT_4 ETH_MACCR_BL_4
1252#define ETH_BACKOFFLIMIT_1 ETH_MACCR_BL_1
1260#define ETH_PREAMBLELENGTH_7 ETH_MACCR_PRELEN_7
1261#define ETH_PREAMBLELENGTH_5 ETH_MACCR_PRELEN_5
1262#define ETH_PREAMBLELENGTH_3 ETH_MACCR_PRELEN_3
1270#define ETH_SOURCEADDRESS_DISABLE ((uint32_t)0x00000000U)
1271#define ETH_SOURCEADDRESS_INSERT_ADDR0 ETH_MACCR_SARC_INSADDR0
1272#define ETH_SOURCEADDRESS_INSERT_ADDR1 ETH_MACCR_SARC_INSADDR1
1273#define ETH_SOURCEADDRESS_REPLACE_ADDR0 ETH_MACCR_SARC_REPADDR0
1274#define ETH_SOURCEADDRESS_REPLACE_ADDR1 ETH_MACCR_SARC_REPADDR1
1282#define ETH_CTRLPACKETS_BLOCK_ALL ETH_MACPFR_PCF_BLOCKALL
1283#define ETH_CTRLPACKETS_FORWARD_ALL_EXCEPT_PA ETH_MACPFR_PCF_FORWARDALLEXCEPTPA
1284#define ETH_CTRLPACKETS_FORWARD_ALL ETH_MACPFR_PCF_FORWARDALL
1285#define ETH_CTRLPACKETS_FORWARD_PASSED_ADDR_FILTER ETH_MACPFR_PCF_FORWARDPASSEDADDRFILTER
1293#define ETH_VLANTAGCOMPARISON_16BIT ((uint32_t)0x00000000U)
1294#define ETH_VLANTAGCOMPARISON_12BIT ETH_MACVTR_ETV
1302#define ETH_MAC_ADDRESS0 ((uint32_t)0x00000000U)
1303#define ETH_MAC_ADDRESS1 ((uint32_t)0x00000008U)
1304#define ETH_MAC_ADDRESS2 ((uint32_t)0x00000010U)
1305#define ETH_MAC_ADDRESS3 ((uint32_t)0x00000018U)
1313#define ETH_MAC_RX_STATUS_IT ETH_MACIER_RXSTSIE
1314#define ETH_MAC_TX_STATUS_IT ETH_MACIER_TXSTSIE
1315#define ETH_MAC_TIMESTAMP_IT ETH_MACIER_TSIE
1316#define ETH_MAC_LPI_IT ETH_MACIER_LPIIE
1317#define ETH_MAC_PMT_IT ETH_MACIER_PMTIE
1318#define ETH_MAC_PHY_IT ETH_MACIER_PHYIE
1326#define ETH_WAKEUP_PACKET_RECIEVED ETH_MACPCSR_RWKPRCVD
1327#define ETH_MAGIC_PACKET_RECIEVED ETH_MACPCSR_MGKPRCVD
1335#define ETH_RECEIVE_WATCHDOG_TIMEOUT ETH_MACRXTXSR_RWT
1336#define ETH_EXECESSIVE_COLLISIONS ETH_MACRXTXSR_EXCOL
1337#define ETH_LATE_COLLISIONS ETH_MACRXTXSR_LCOL
1338#define ETH_EXECESSIVE_DEFERRAL ETH_MACRXTXSR_EXDEF
1339#define ETH_LOSS_OF_CARRIER ETH_MACRXTXSR_LCARR
1340#define ETH_NO_CARRIER ETH_MACRXTXSR_NCARR
1341#define ETH_TRANSMIT_JABBR_TIMEOUT ETH_MACRXTXSR_TJT
1349#define HAL_ETH_STATE_RESET ((uint32_t)0x00000000U)
1350#define HAL_ETH_STATE_READY ((uint32_t)0x00000010U)
1351#define HAL_ETH_STATE_BUSY ((uint32_t)0x00000023U)
1352#define HAL_ETH_STATE_BUSY_TX ((uint32_t)0x00000021U)
1353#define HAL_ETH_STATE_BUSY_RX ((uint32_t)0x00000022U)
1354#define HAL_ETH_STATE_ERROR ((uint32_t)0x000000E0U)
1362/* Exported macro ------------------------------------------------------------*/
1371#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
1372#define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) do{ \
1373 (__HANDLE__)->gState = HAL_ETH_STATE_RESET; \
1374 (__HANDLE__)->RxState = HAL_ETH_STATE_RESET; \
1375 (__HANDLE__)->MspInitCallback = NULL; \
1376 (__HANDLE__)->MspDeInitCallback = NULL; \
1377 } while(0)
1378#else
1379#define __HAL_ETH_RESET_HANDLE_STATE(__HANDLE__) do{ \
1380 (__HANDLE__)->gState = HAL_ETH_STATE_RESET; \
1381 (__HANDLE__)->RxState = HAL_ETH_STATE_RESET; \
1382 } while(0)
1383#endif /*USE_HAL_ETH_REGISTER_CALLBACKS */
1384
1392#define __HAL_ETH_DMA_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMACIER |= (__INTERRUPT__))
1393
1401#define __HAL_ETH_DMA_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMACIER &= ~(__INTERRUPT__))
1402
1409#define __HAL_ETH_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->DMACIER & (__INTERRUPT__)) == (__INTERRUPT__))
1410
1417#define __HAL_ETH_DMA_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->DMACSR & (__INTERRUPT__)) == (__INTERRUPT__))
1418
1425#define __HAL_ETH_DMA_CLEAR_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->DMACSR = (__INTERRUPT__))
1426
1433#define __HAL_ETH_DMA_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->DMACSR &( __FLAG__)) == ( __FLAG__))
1434
1441#define __HAL_ETH_DMA_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->DMACSR = ( __FLAG__))
1442
1450#define __HAL_ETH_MAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIER |= (__INTERRUPT__))
1451
1459#define __HAL_ETH_MAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MACIER &= ~(__INTERRUPT__))
1460
1467#define __HAL_ETH_MAC_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->MACISR &( __INTERRUPT__)) == ( __INTERRUPT__))
1468
1470#define ETH_WAKEUP_EXTI_LINE ((uint32_t)0x00400000U) /* !< 86 - 64 = 22 */
1471
1478#define __HAL_ETH_WAKEUP_EXTI_ENABLE_IT(__EXTI_LINE__) (EXTI_D1->IMR3 |= (__EXTI_LINE__))
1479
1486#define __HAL_ETH_WAKEUP_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI_D1->PR3 & (__EXTI_LINE__))
1487
1494#define __HAL_ETH_WAKEUP_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D1->PR3 = (__EXTI_LINE__))
1495
1496#if defined(DUAL_CORE)
1503#define __HAL_ETH_WAKEUP_EXTID2_ENABLE_IT(__EXTI_LINE__) (EXTI_D2->IMR3 |= (__EXTI_LINE__))
1504
1511#define __HAL_ETH_WAKEUP_EXTID2_GET_FLAG(__EXTI_LINE__) (EXTI_D2->PR3 & (__EXTI_LINE__))
1512
1519#define __HAL_ETH_WAKEUP_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI_D2->PR3 = (__EXTI_LINE__))
1520#endif
1521
1528#define __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_EDGE(__EXTI_LINE__) (EXTI->FTSR3 &= ~(__EXTI_LINE__)); \
1529 (EXTI->RTSR3 |= (__EXTI_LINE__))
1530
1537#define __HAL_ETH_WAKEUP_EXTI_ENABLE_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR3 &= ~(__EXTI_LINE__));\
1538 (EXTI->FTSR3 |= (__EXTI_LINE__))
1539
1546#define __HAL_ETH_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR3 |= (__EXTI_LINE__));\
1547 (EXTI->FTSR3 |= (__EXTI_LINE__))
1548
1555#define __HAL_ETH_WAKEUP_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER3 |= (__EXTI_LINE__))
1556
1561/* Include ETH HAL Extension module */
1562#include "stm32h7xx_hal_eth_ex.h"
1563
1564/* Exported functions --------------------------------------------------------*/
1565
1573/* Initialization and de initialization functions **********************************/
1574HAL_StatusTypeDef HAL_ETH_Init(ETH_HandleTypeDef *heth);
1575HAL_StatusTypeDef HAL_ETH_DeInit(ETH_HandleTypeDef *heth);
1576void HAL_ETH_MspInit(ETH_HandleTypeDef *heth);
1577void HAL_ETH_MspDeInit(ETH_HandleTypeDef *heth);
1578HAL_StatusTypeDef HAL_ETH_DescAssignMemory(ETH_HandleTypeDef *heth, uint32_t Index, uint8_t *pBuffer1,uint8_t *pBuffer2);
1579
1580/* Callbacks Register/UnRegister functions ***********************************/
1581#if (USE_HAL_ETH_REGISTER_CALLBACKS == 1)
1582HAL_StatusTypeDef HAL_ETH_RegisterCallback(ETH_HandleTypeDef *heth, HAL_ETH_CallbackIDTypeDef CallbackID, pETH_CallbackTypeDef pCallback);
1583HAL_StatusTypeDef HAL_ETH_UnRegisterCallback(ETH_HandleTypeDef *heth, HAL_ETH_CallbackIDTypeDef CallbackID);
1584#endif /* USE_HAL_ETH_REGISTER_CALLBACKS */
1585
1593/* IO operation functions *******************************************************/
1594HAL_StatusTypeDef HAL_ETH_Start(ETH_HandleTypeDef *heth);
1595HAL_StatusTypeDef HAL_ETH_Start_IT(ETH_HandleTypeDef *heth);
1596HAL_StatusTypeDef HAL_ETH_Stop(ETH_HandleTypeDef *heth);
1597HAL_StatusTypeDef HAL_ETH_Stop_IT(ETH_HandleTypeDef *heth);
1598
1599uint8_t HAL_ETH_IsRxDataAvailable(ETH_HandleTypeDef *heth);
1600HAL_StatusTypeDef HAL_ETH_GetRxDataBuffer(ETH_HandleTypeDef *heth, ETH_BufferTypeDef *RxBuffer);
1601HAL_StatusTypeDef HAL_ETH_GetRxDataLength(ETH_HandleTypeDef *heth, uint32_t *Length);
1602HAL_StatusTypeDef HAL_ETH_GetRxDataInfo(ETH_HandleTypeDef *heth, ETH_RxPacketInfo *RxPacketInfo);
1603HAL_StatusTypeDef HAL_ETH_BuildRxDescriptors(ETH_HandleTypeDef *heth);
1604
1605HAL_StatusTypeDef HAL_ETH_Transmit(ETH_HandleTypeDef *heth, ETH_TxPacketConfig *pTxConfig, uint32_t Timeout);
1606HAL_StatusTypeDef HAL_ETH_Transmit_IT(ETH_HandleTypeDef *heth, ETH_TxPacketConfig *pTxConfig);
1607
1608HAL_StatusTypeDef HAL_ETH_WritePHYRegister(ETH_HandleTypeDef *heth, uint32_t PHYAddr, uint32_t PHYReg, uint32_t RegValue);
1609HAL_StatusTypeDef HAL_ETH_ReadPHYRegister(ETH_HandleTypeDef *heth, uint32_t PHYAddr, uint32_t PHYReg, uint32_t *pRegValue);
1610
1611void HAL_ETH_IRQHandler(ETH_HandleTypeDef *heth);
1612void HAL_ETH_TxCpltCallback(ETH_HandleTypeDef *heth);
1613void HAL_ETH_RxCpltCallback(ETH_HandleTypeDef *heth);
1614void HAL_ETH_DMAErrorCallback(ETH_HandleTypeDef *heth);
1615void HAL_ETH_MACErrorCallback(ETH_HandleTypeDef *heth);
1616void HAL_ETH_PMTCallback(ETH_HandleTypeDef *heth);
1617void HAL_ETH_EEECallback(ETH_HandleTypeDef *heth);
1618void HAL_ETH_WakeUpCallback(ETH_HandleTypeDef *heth);
1626/* Peripheral Control functions **********************************************/
1627/* MAC & DMA Configuration APIs **********************************************/
1628HAL_StatusTypeDef HAL_ETH_GetMACConfig(ETH_HandleTypeDef *heth, ETH_MACConfigTypeDef *macconf);
1629HAL_StatusTypeDef HAL_ETH_GetDMAConfig(ETH_HandleTypeDef *heth, ETH_DMAConfigTypeDef *dmaconf);
1630HAL_StatusTypeDef HAL_ETH_SetMACConfig(ETH_HandleTypeDef *heth, ETH_MACConfigTypeDef *macconf);
1631HAL_StatusTypeDef HAL_ETH_SetDMAConfig(ETH_HandleTypeDef *heth, ETH_DMAConfigTypeDef *dmaconf);
1632void HAL_ETH_SetMDIOClockRange(ETH_HandleTypeDef *heth);
1633
1634/* MAC VLAN Processing APIs ************************************************/
1635void HAL_ETH_SetRxVLANIdentifier(ETH_HandleTypeDef *heth, uint32_t ComparisonBits, uint32_t VLANIdentifier);
1636
1637/* MAC L2 Packet Filtering APIs **********************************************/
1638HAL_StatusTypeDef HAL_ETH_GetMACFilterConfig(ETH_HandleTypeDef *heth, ETH_MACFilterConfigTypeDef *pFilterConfig);
1639HAL_StatusTypeDef HAL_ETH_SetMACFilterConfig(ETH_HandleTypeDef *heth, ETH_MACFilterConfigTypeDef *pFilterConfig);
1640HAL_StatusTypeDef HAL_ETH_SetHashTable(ETH_HandleTypeDef *heth, uint32_t *pHashTable);
1641HAL_StatusTypeDef HAL_ETH_SetSourceMACAddrMatch(ETH_HandleTypeDef *heth, uint32_t AddrNbr, uint8_t *pMACAddr);
1642
1643/* MAC Power Down APIs *****************************************************/
1644void HAL_ETH_EnterPowerDownMode(ETH_HandleTypeDef *heth, ETH_PowerDownConfigTypeDef *pPowerDownConfig);
1645void HAL_ETH_ExitPowerDownMode(ETH_HandleTypeDef *heth);
1646HAL_StatusTypeDef HAL_ETH_SetWakeUpFilter(ETH_HandleTypeDef *heth, uint32_t *pFilter, uint32_t Count);
1647
1655/* Peripheral State functions **************************************************/
1656HAL_ETH_StateTypeDef HAL_ETH_GetState(ETH_HandleTypeDef *heth);
1657uint32_t HAL_ETH_GetError(ETH_HandleTypeDef *heth);
1658uint32_t HAL_ETH_GetDMAError(ETH_HandleTypeDef *heth);
1659uint32_t HAL_ETH_GetMACError(ETH_HandleTypeDef *heth);
1660uint32_t HAL_ETH_GetMACWakeUpSource(ETH_HandleTypeDef *heth);
1677#endif /* ETH */
1678
1679#ifdef __cplusplus
1680}
1681#endif
1682
1683#endif /* STM32H7xx_HAL_ETH_H */
1684
1685
1686
1687/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#define __IO
Definition core_cm3.h:170
HAL_StatusTypeDef
HAL Status structures definition.
Definition stm32f1xx_hal_def.h:40
HAL_LockTypeDef
HAL Lock structures definition.
Definition stm32f1xx_hal_def.h:51
This file contains HAL common defines, enumeration, macros and structures definitions.
Header file of ETH HAL Extended module.
Ethernet MAC.
Definition stm32f107xc.h:383