![]() |
xxvethernet
Vitis Drivers API Documentation
|
This file implements the utility functions for the Xxv Ethernet and USXGMII example code.
It contains functions to setup USXGMII autonegotiation at desired settings and to bypass autonegotiation.
MODIFICATION HISTORY:
Ver Who Date Changes
1.0 hk 06/16/17 First release hk 02/15/18 Add support for USXGMII 1.5 rsp 06/08/20 Fix Xil_poll_timeout compilation error on microblaze. 1.6 sk 02/18/21 Use UINTPTR instead of u32 for BaseAddress variable.
Functions | |
void | XxvEthernetUtilFrameHdrFormatMAC (EthernetFrame *FramePtr, char *DestAddr, char *SrcAddr) |
Set the MAC addresses in the frame. More... | |
void | XxvEthernetUtilFrameHdrFormatType (EthernetFrame *FramePtr, u16 FrameType) |
Set the frame type for the specified frame. More... | |
void | XxvEthernetUtilFrameSetPayloadData (EthernetFrame *FramePtr, int PayloadSize) |
This function places a pattern in the payload section of a frame. More... | |
int | XxvEthernetUtilFrameVerify (EthernetFrame *CheckFrame, EthernetFrame *ActualFrame) |
This function verifies the frame data against a CheckFrame. More... | |
void | XxvEthernetUtilFrameMemClear (EthernetFrame *FramePtr) |
This function sets all bytes of a frame to 0. More... | |
int | XxvEthernetUtilEnterLocalLoopback (XXxvEthernet *XxvEthernetInstancePtr) |
This function sets 10G ethernet in local loopback. More... | |
int | XxvEthernetUtilUsxgmiiSetup (XXxvEthernet *XxvEthernetInstancePtr, u32 Rate, u32 Duplex) |
This function sets up USXGMII at specified speed. More... | |
int | XxvEthernetUtilUsxgmiiSetupBypassAN (XXxvEthernet *XxvEthernetInstancePtr, u32 Rate, u32 Duplex) |
This function sets up USXGMII at specified speed. More... | |
void | XxvEthernetUtilErrorTrap (char *Message) |
This function is called by example code when an error is detected. More... | |
int XxvEthernetUtilEnterLocalLoopback | ( | XXxvEthernet * | XxvEthernetInstancePtr | ) |
This function sets 10G ethernet in local loopback.
XxvEthernetInstancePtr | is a pointer to the instance of the XxvEthernet component. |
References XXxvEthernet_Config::BaseAddress, XXxvEthernet::Config, XXxvEthernet_ReadReg, and XXxvEthernet_WriteReg.
Referenced by XxvEthernetSgDmaIntrExample().
void XxvEthernetUtilErrorTrap | ( | char * | Message | ) |
This function is called by example code when an error is detected.
It can be set as a breakpoint with a debugger or it can be used to print out the given message if there is a UART or STDIO device.
Message | is the text explaining the error |
Referenced by main(), XxvEthernetSgDmaIntrExample(), and XxvEthernetSgDmaIntrSingleFrameExample().
void XxvEthernetUtilFrameHdrFormatMAC | ( | EthernetFrame * | FramePtr, |
char * | DestAddr, | ||
char * | SrcAddr | ||
) |
Set the MAC addresses in the frame.
FramePtr | is the pointer to the frame. |
DestAddr | is the Destination MAC address. |
Referenced by XxvEthernetSgDmaIntrSingleFrameExample().
void XxvEthernetUtilFrameHdrFormatType | ( | EthernetFrame * | FramePtr, |
u16 | FrameType | ||
) |
Set the frame type for the specified frame.
FramePtr | is the pointer to the frame. |
FrameType | is the Type to set in frame. |
Referenced by XxvEthernetSgDmaIntrSingleFrameExample().
void XxvEthernetUtilFrameMemClear | ( | EthernetFrame * | FramePtr | ) |
This function sets all bytes of a frame to 0.
FramePtr | is a pointer to the frame itself. |
Referenced by XxvEthernetSgDmaIntrSingleFrameExample().
void XxvEthernetUtilFrameSetPayloadData | ( | EthernetFrame * | FramePtr, |
int | PayloadSize | ||
) |
This function places a pattern in the payload section of a frame.
The pattern is a 8 bit incrementing series of numbers starting with 0. Once the pattern reaches 256, then the pattern changes to a 16 bit incrementing pattern:
0, 1, 2, ... 254, 255, 00, 00, 00, 01, 00, 02, ...
FramePtr | is a pointer to the frame to change. |
PayloadSize | is the number of bytes in the payload that will be set. |
Referenced by XxvEthernetSgDmaIntrSingleFrameExample().
int XxvEthernetUtilFrameVerify | ( | EthernetFrame * | CheckFrame, |
EthernetFrame * | ActualFrame | ||
) |
This function verifies the frame data against a CheckFrame.
Validation occurs by comparing the ActualFrame to the header of the CheckFrame. If the headers match, then the payload of ActualFrame is verified for the same pattern Util_FrameSetPayloadData() generates.
CheckFrame | is a pointer to a frame containing the 14 byte header that should be present in the ActualFrame parameter. |
ActualFrame | is a pointer to a frame to validate. |
Referenced by XxvEthernetSgDmaIntrSingleFrameExample().
int XxvEthernetUtilUsxgmiiSetup | ( | XXxvEthernet * | XxvEthernetInstancePtr, |
u32 | Rate, | ||
u32 | Duplex | ||
) |
This function sets up USXGMII at specified speed.
Autonegotiation is enabled with the selected settings. If autonegotiation fails, it is restarted after a timeout. The function returns success after autonegotiation is completed. This function enables RX and performs a GT reset first because USXGMII requires the same.
XxvEthernetInstancePtr | is a pointer to the instance of the XxvEthernet component. |
Speed | - can be 1G or 2.5G - use RATE_1G or RATE_2G5 |
Duplex | - 1 for full duplex, 0 for half duplex |
References XXxvEthernet_Config::BaseAddress, XXxvEthernet::Config, XXxvEthernet_GetUsxgmiiAnSts, XXxvEthernet_SetOptions(), XXxvEthernet_SetUsxgmiiAnEnable, XXxvEthernet_SetUsxgmiiRateAndDuplex(), XXxvEthernet_UsxgmiiAnMainRestart(), and XXxvEthernet_WriteReg.
int XxvEthernetUtilUsxgmiiSetupBypassAN | ( | XXxvEthernet * | XxvEthernetInstancePtr, |
u32 | Rate, | ||
u32 | Duplex | ||
) |
This function sets up USXGMII at specified speed.
Autonegotiation is bypassed and the status is checked for completion before returning successfully. This function enables RX and performs a GT reset first because USXGMII requires the same.
XxvEthernetInstancePtr | is a pointer to the instance of the XxvEthernet component. |
Speed | - can be 1G or 2.5G - use RATE_1G or RATE_2G5 |
Duplex | - 1 for full duplex, 0 for half duplex |
References XXxvEthernet_Config::BaseAddress, XXxvEthernet::Config, XXxvEthernet_GetUsxgmiiAnSts, XXxvEthernet_SetOptions(), XXxvEthernet_SetUsxgmiiAnBypass, XXxvEthernet_SetUsxgmiiRateAndDuplex(), XXxvEthernet_UsxgmiiAnMainRestart(), and XXxvEthernet_WriteReg.