102 #define NUM_GMAC_QUEUES 3 105 #define GMAC_DUPLEX_HALF 0 106 #define GMAC_DUPLEX_FULL 1 109 #define GMAC_SPEED_10M 0 110 #define GMAC_SPEED_100M 1 111 #define GMAC_SPEED_1000M 2 120 #define GMAC_ADDRESS_MASK ((unsigned int)0xFFFFFFFC) 121 #define GMAC_LENGTH_FRAME ((unsigned int)0x3FFF) 124 #define GMAC_RX_OWNERSHIP_BIT (1u << 0) 125 #define GMAC_RX_WRAP_BIT (1u << 1) 126 #define GMAC_RX_SOF_BIT (1u << 14) 127 #define GMAC_RX_EOF_BIT (1u << 15) 130 #define GMAC_TX_LAST_BUFFER_BIT (1u << 15) 131 #define GMAC_TX_WRAP_BIT (1u << 30) 132 #define GMAC_TX_USED_BIT (1u << 31) 133 #define GMAC_TX_RLE_BIT (1u << 29) 134 #define GMAC_TX_UND_BIT (1u << 28) 135 #define GMAC_TX_ERR_BIT (1u << 27) 136 #define GMAC_TX_ERR_BITS \ 137 (GMAC_TX_RLE_BIT | GMAC_TX_UND_BIT | GMAC_TX_ERR_BIT) 140 #define GMAC_INT_RX_BITS \ 141 (GMAC_IER_RCOMP | GMAC_IER_RXUBR | GMAC_IER_ROVR) 142 #define GMAC_INT_TX_ERR_BITS \ 143 (GMAC_IER_TUR | GMAC_IER_RLEX | GMAC_IER_TFC | GMAC_IER_HRESP) 144 #define GMAC_INT_TX_BITS \ 145 (GMAC_INT_TX_ERR_BITS | GMAC_IER_TCOMP) 147 #define GMAC_INT_RX_STATUS_BITS \ 148 (GMAC_ISR_RCOMP | GMAC_ISR_RXUBR | GMAC_ISR_ROVR) 149 #define GMAC_INT_TX_STATUS_ERR_BITS \ 150 (GMAC_ISR_TUR | GMAC_ISR_RLEX | GMAC_ISR_TFC | GMAC_ISR_HRESP) 153 #define GMAC_RXDESC_ST_CKSUM_RESULT_NOT_CHECKED (0) 154 #define GMAC_RXDESC_ST_CKSUM_RESULT_IP_CHECKED (1) 155 #define GMAC_RXDESC_ST_CKSUM_RESULT_IP_AND_TCP_CHECKED (2) 156 #define GMAC_RXDESC_ST_CKSUM_RESULT_IP_AND_UDP_CHECKED (3) 196 typeIDMatchOrCksumResult: 2,
197 bTypeIDMatchFoundOrCksumSNAPState: 1,
198 specAddrMatchRegister: 2,
199 bSpecAddrMatchFound: 1,
249 extern void GMAC_EnableRMII(
Gmac *pGmac);
253 gmacQueList_t queueIdx);
256 gmacQueList_t queueIdx);
268 gmacQueList_t queueIdx);
271 gmacQueList_t queueIdx);
281 gmacQueList_t queueIdx);
288 void GMAC_ClearScreener1Reg (
Gmac *pGmac, gmacQueList_t queueIdx);
290 void GMAC_WriteScreener1Reg(
Gmac *pGmac, gmacQueList_t queueIdx,
293 void GMAC_ClearScreener2Reg (
Gmac *pGmac, gmacQueList_t queueIdx);
295 void GMAC_WriteScreener2Reg (
Gmac *pGmac, gmacQueList_t queueIdx,
298 void GMAC_WriteEthTypeReg (
Gmac *pGmac, gmacQueList_t queueIdx,
301 void GMAC_WriteCompareReg(
Gmac *pGmac, gmacQueList_t queueIdx, uint32_t c0Reg,
304 void GMAC_EnableCbsQueA(
Gmac *pGmac);
306 void GMAC_DisableCbsQueA(
Gmac *pGmac);
308 void GMAC_EnableCbsQueB(
Gmac *pGmac);
310 void GMAC_DisableCbsQueB(
Gmac *pGmac);
312 void GMAC_ConfigIdleSlopeA(
Gmac *pGmac, uint32_t idleSlopeA);
314 void GMAC_ConfigIdleSlopeB(
Gmac *pGmac, uint32_t idleSlopeB);
316 void GMAC_SetTsuTmrIncReg(
Gmac *pGmac, uint32_t nanoSec);
318 uint16_t GMAC_GetPtpEvtMsgRxdMsbSec(
Gmac *pGmac);
320 uint32_t GMAC_GetPtpEvtMsgRxdLsbSec(
Gmac *pGmac);
322 uint32_t GMAC_GetPtpEvtMsgRxdNanoSec(
Gmac *pGmac);
324 void GMAC_SetTsuCompare(
Gmac *pGmac, uint32_t seconds47, uint32_t seconds31,
327 void GMAC_SetTsuCompareNanoSec(
Gmac *pGmac, uint32_t nanosec);
329 void GMAC_SetTsuCompareSec31(
Gmac *pGmac, uint32_t seconds31);
331 void GMAC_SetTsuCompareSec47(
Gmac *pGmac, uint16_t seconds47);
333 uint32_t GMAC_GetRxEvtFrameSec(
Gmac *pGmac);
335 uint32_t GMAC_GetRxEvtFrameNsec(
Gmac *pGmac);
337 uint32_t GMAC_GetRxPeerEvtFrameSec(
Gmac *pGmac);
339 uint32_t GMAC_GetRxPeerEvtFrameNsec(
Gmac *pGmac);
341 uint32_t GMAC_GetTxEvtFrameSec(
Gmac *pGmac);
343 uint32_t GMAC_GetTxEvtFrameNsec(
Gmac *pGmac);
345 uint32_t GMAC_GetTxPeerEvtFrameSec(
Gmac *pGmac);
347 uint32_t GMAC_GetTxPeerEvtFrameNsec(
Gmac *pGmac);
353 #endif // #ifndef GMAC_H uint16_t GMAC_PHYData(Gmac *pGmac)
Definition: gmac.c:83
uint32_t bPriorityDetected
Definition: gmac.h:186
void GMAC_DisableIt(Gmac *pGmac, uint32_t dwSources, gmacQueList_t queueIdx)
Definition: gmac.c:430
void GMAC_DisableMdio(Gmac *pGmac)
Enable MDI with PHY.
Definition: gmac.c:151
uint32_t addrDW
Definition: gmac.h:178
void GMAC_EnableMdio(Gmac *pGmac)
Enable MDI with PHY.
Definition: gmac.c:134
void GMAC_StatisticsWriteEnable(Gmac *pGmac, uint8_t bEnaDis)
Definition: gmac.c:504
Definition: component_gmac.h:55
void GMAC_ClearStatistics(Gmac *pGmac)
Definition: gmac.c:488
uint8_t GMAC_SetMdcClock(Gmac *pGmac, uint32_t mck)
Set MDC clock according to current board clock. Per 802.3, MDC should be less then 2....
Definition: gmac.c:99
void GMAC_TransmitEnable(Gmac *pGmac, uint8_t bEnaDis)
Definition: gmac.c:327
void GMAC_ReceiveEnable(Gmac *pGmac, uint8_t bEnaDis)
Definition: gmac.c:318
void GMAC_EnableAllQueueIt(Gmac *pGmac, uint32_t dwSources)
Definition: gmac.c:420
uint32_t bUsed
Definition: gmac.h:215
void GMAC_SetTxQueue(Gmac *pGmac, uint32_t dwAddr, gmacQueList_t queueIdx)
Definition: gmac.c:359
uint32_t bExhausted
Definition: gmac.h:215
void GMAC_SetLinkSpeed(Gmac *pGmac, uint8_t speed, uint8_t fullduplex)
Setup the GMAC for the link : speed 100M/10M and Full/Half duplex.
Definition: gmac.c:242
void GMAC_NetworkControl(Gmac *pGmac, uint32_t bmNCR)
Definition: gmac.c:382
uint32_t GMAC_GetItStatus(Gmac *pGmac, gmacQueList_t queueIdx)
Definition: gmac.c:441
uint32_t GMAC_GetTxQueue(Gmac *pGmac, gmacQueList_t queueIdx)
Definition: gmac.c:370
uint32_t bOwnership
Definition: gmac.h:178
void GMAC_IncreaseStatistics(Gmac *pGmac)
Definition: gmac.c:496
uint32_t bUnderrun
Definition: gmac.h:215
void GMAC_SetAddress64(Gmac *pGmac, uint8_t bIndex, uint64_t ddwMac)
Definition: gmac.c:478
uint32_t bLastBuffer
Definition: gmac.h:215
void GMAC_ClearRxStatus(Gmac *pGmac, uint32_t dwStatus)
Definition: gmac.c:309
union _GmacRxDescriptor::_GmacRxAddr addr
void GMAC_EnableMII(Gmac *pGmac)
Enable MII mode for GMAC, called once after auto negotiate.
Definition: gmac.c:168
uint32_t bBroadcastDetected
Definition: gmac.h:186
void GMAC_EnableRGMII(Gmac *pGmac, uint32_t duplex, uint32_t speed)
Enable RGMII mode for GMAC, called once after auto negotiate.
Definition: gmac.c:206
void GMAC_EnableIt(Gmac *pGmac, uint32_t dwSources, gmacQueList_t queueIdx)
Definition: gmac.c:399
uint32_t bVlanDetected
Definition: gmac.h:186
void GMAC_SetRxQueue(Gmac *pGmac, uint32_t dwAddr, gmacQueList_t queueIdx)
Definition: gmac.c:337
void GMAC_TransmissionStart(Gmac *pGmac)
Definition: gmac.c:554
void GMAC_DisableAllQueueIt(Gmac *pGmac, uint32_t dwSources)
Definition: gmac.c:410
uint32_t offset
Definition: gmac.h:186
uint32_t bSof
Definition: gmac.h:186
uint32_t bMultiHashMatch
Definition: gmac.h:186
uint32_t GMAC_GetNetworkControl(Gmac *pGmac)
Definition: gmac.c:391
uint32_t bUniHashMatch
Definition: gmac.h:186
void GMAC_Configure(Gmac *pGmac, uint32_t dwCfg)
Definition: gmac.c:514
void GMAC_PHYMaintain(Gmac *pGmac, uint8_t bPhyAddr, uint8_t bRegAddr, uint8_t bRW, uint16_t wData)
Definition: gmac.c:62
uint8_t GMAC_IsIdle(Gmac *pGmac)
Definition: gmac.c:53
uint32_t GMAC_GetTxStatus(Gmac *pGmac)
Definition: gmac.c:285
uint32_t bError
Definition: gmac.h:215
uint32_t GMAC_GetDMAConfig(Gmac *pGmac, gmacQueList_t queueIdx)
Definition: gmac.c:534
struct _GmacTxDescriptor sGmacTxDescriptor
uint32_t len
Definition: gmac.h:215
void GMAC_SetDMAConfig(Gmac *pGmac, uint32_t dwDmaCfg, gmacQueList_t queueIdx)
Definition: gmac.c:523
uint32_t vlanPriority
Definition: gmac.h:186
uint32_t GMAC_GetRxQueue(Gmac *pGmac, gmacQueList_t queueIdx)
Definition: gmac.c:348
uint32_t GMAC_GetItMask(Gmac *pGmac, gmacQueList_t queueIdx)
Definition: gmac.c:273
uint32_t bWrap
Definition: gmac.h:215
void GMAC_EnableGMII(Gmac *pGmac)
Enable GMII mode for GMAC, called once after auto negotiate.
Definition: gmac.c:185
void GMAC_SetAddress32(Gmac *pGmac, uint8_t bIndex, uint32_t dwMacT, uint32_t dwMacB)
Definition: gmac.c:468
uint32_t GMAC_GetConfigure(Gmac *pGmac)
Definition: gmac.c:545
void GMAC_SetAddress(Gmac *pGmac, uint8_t bIndex, uint8_t *pMacAddr)
Definition: gmac.c:453
uint32_t GMAC_GetRxStatus(Gmac *pGmac)
Definition: gmac.c:301
uint32_t bCFI
Definition: gmac.h:186
uint32_t bWrap
Definition: gmac.h:178
uint32_t bEof
Definition: gmac.h:186
uint32_t bNoCRC
Definition: gmac.h:215
uint32_t GMAC_SetLocalLoopBack(Gmac *pGmac)
set local loop back
Definition: gmac.c:264
struct _GmacRxDescriptor sGmacRxDescriptor
void GMAC_ClearTxStatus(Gmac *pGmac, uint32_t dwStatus)
Definition: gmac.c:293
void GMAC_TransmissionHalt(Gmac *pGmac)
Definition: gmac.c:562