axiethernet
Vitis Drivers API Documentation
xaxiethernet_example.h File Reference

Overview

Defines common data types, prototypes, and includes the proper headers for use with the Axi Ethernet example code residing in this directory.

This file along with xaxiethernet_example_util.c are utilized with the specific example code in the other source code files provided.

These examples are designed to be compiled and utilized within the EDK standalone BSP development environment. The readme file contains more information on build requirements needed by these examples.

MODIFICATION HISTORY:
Ver   Who  Date     Changes


1.00a asa 4/30/10 First release based on the ll temac driver 3.02a srt 4/26/13 Added function prototype for *_ConfigureInternalPhy().

 

Functions

void AxiEthernetUtilFrameHdrFormatMAC (EthernetFrame *FramePtr, char *DestAddr)
 Set the MAC addresses in the frame. More...
 
void AxiEthernetUtilFrameHdrFormatType (EthernetFrame *FramePtr, u16 FrameType)
 Set the frame type for the specified frame. More...
 
void AxiEthernetUtilFrameSetPayloadData (EthernetFrame *FramePtr, int PayloadSize)
 This function places a pattern in the payload section of a frame. More...
 
void AxiEthernetUtilFrameHdrVlanFormatVid (EthernetFrame *FramePtr, u32 VlanNumber, u32 Vid)
 Set the frame VLAN info for the specified frame. More...
 
void AxiEthernetUtilFrameHdrVlanFormatType (EthernetFrame *FramePtr, u16 FrameType, u32 VlanNumber)
 Set the frame type for the specified frame. More...
 
void AxiEthernetUtilFrameSetVlanPayloadData (EthernetFrame *FramePtr, int PayloadSize, u32 VlanNumber)
 This function places a pattern in the payload section of a frame. More...
 
int AxiEthernetUtilFrameVerify (EthernetFrame *CheckFrame, EthernetFrame *ActualFrame)
 This function verifies the frame data against a CheckFrame. More...
 
void AxiEthernetUtilFrameMemClear (EthernetFrame *FramePtr)
 This function sets all bytes of a frame to 0. More...
 
int AxiEthernetUtilEnterLoopback (XAxiEthernet *AxiEthernetInstancePtr, int Speed)
 This function sets the PHY to loopback mode. More...
 
void AxiEthernetUtilErrorTrap (char *Message)
 This function is called by example code when an error is detected. More...
 
void AxiEthernetUtilPhyDelay (unsigned int Seconds)
 For Microblaze we use an assembly loop that is roughly the same regardless of optimization level, although caches and memory access time can make the delay vary. More...
 
int AxiEthernetUtilConfigureInternalPhy (XAxiEthernet *AxiEthernetInstancePtr, int Speed)
 This function configures the internal phy for SGMII and 1000baseX modes. More...
 

Function Documentation

int AxiEthernetUtilConfigureInternalPhy ( XAxiEthernet AxiEthernetInstancePtr,
int  Speed 
)

This function configures the internal phy for SGMII and 1000baseX modes.

  • Parameters
    AxiEthernetInstancePtris a pointer to the instance of the AxiEthernet component.
    Speedis the loopback speed 10, 100, or 1000 Mbit.
    Returns
    • XST_SUCCESS if successful.
    • XST_FAILURE, in case of failure..
    Note
    None.

References AxiEthernetUtilErrorTrap(), AxiEthernetUtilPhyDelay(), XAxiEthernet::Config, PHY_R0_CTRL_REG, XAE_SPEED_1000_MBPS, XAE_SPEED_100_MBPS, XAE_SPEED_10_MBPS, and XAE_SPEED_2500_MBPS.

Referenced by AxiEthernetUtilEnterLoopback().

int AxiEthernetUtilEnterLoopback ( XAxiEthernet AxiEthernetInstancePtr,
int  Speed 
)

This function sets the PHY to loopback mode.

This works with the marvell PHY common on ML40x evaluation boards.

Parameters
AxiEthernetInstancePtris a pointer to the instance of the AxiEthernet component.
Speedis the loopback speed 10, 100, or 1000 Mbit.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE, in case of failure..
Note
None.

References AxiEthernetUtilConfigureInternalPhy(), AxiEthernetUtilErrorTrap(), AxiEthernetUtilPhyDelay(), XAxiEthernet::Config, PHY_R0_CTRL_REG, XAE_SPEED_1000_MBPS, XAE_SPEED_100_MBPS, XAE_SPEED_10_MBPS, XAE_SPEED_2500_MBPS, and XAxiEthernet_GetPhysicalInterface.

Referenced by AxiEthernetExtVlanExample(), AxiEthernetFifoIntrExample(), AxiEthernetMcastExample(), AxiEthernetPolledExample(), AxiEthernetSgDmaIntrExample(), and AxiEthernetSgDmaPollExample().

void AxiEthernetUtilFrameHdrVlanFormatType ( EthernetFrame *  FramePtr,
u16  FrameType,
u32  VlanNumber 
)

Set the frame type for the specified frame.

Parameters
FramePtris the pointer to the frame.
FrameTypeis the Type to set in frame.
VlanNumberis the VLAN friendly adjusted insertion position to set in frame.
Returns
None.
Note
None.

Referenced by AxiEthernetSgDmaIntrExtVlanExample().

void AxiEthernetUtilFrameHdrVlanFormatVid ( EthernetFrame *  FramePtr,
u32  VlanNumber,
u32  Vid 
)

Set the frame VLAN info for the specified frame.

Parameters
FramePtris the pointer to the frame.
VlanNumberis the VlanValue insertion position to set in frame.
Vidis the 4 bytes Vlan value (TPID, Priority, CFI, VID) to be set in frame.
Returns
None.
Note
None.

Referenced by AxiEthernetSgDmaIntrExtVlanExample().

void AxiEthernetUtilFrameSetPayloadData ( 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, ...
Parameters
FramePtris a pointer to the frame to change.
PayloadSizeis the number of bytes in the payload that will be set.
Returns
None.
Note
None.

Referenced by AxiEthernetMultipleFramesIntrExample(), AxiEthernetMultipleFramesPolledExample(), AxiEthernetSgDmaFullChecksumOffloadExample(), AxiEthernetSgDmaIntrCoalescingExample(), AxiEthernetSgDmaIntrExtMulticastExample(), AxiEthernetSgDmaIntrMultiFrameExample(), AxiEthernetSgDmaIntrSingleFrameExample(), AxiEthernetSgDmaMultiFrameExample(), AxiEthernetSgDmaPartialChecksumOffloadExample(), AxiEthernetSgDmaSingleFrameExample(), AxiEthernetSingleFrameIntrExample(), and AxiEthernetSingleFramePolledExample().

void AxiEthernetUtilFrameSetVlanPayloadData ( EthernetFrame *  FramePtr,
int  PayloadSize,
u32  VlanNumber 
)

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, ...
Parameters
FramePtris a pointer to the frame to change.
PayloadSizeis the number of bytes in the payload that will be set.
VlanNumberis the VLAN friendly adjusted insertion position to set in frame.
Returns
None.
Note
None.

Referenced by AxiEthernetSgDmaIntrExtVlanExample().

int AxiEthernetUtilFrameVerify ( 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.

Parameters
CheckFrameis a pointer to a frame containing the 14 byte header that should be present in the ActualFrame parameter.
ActualFrameis a pointer to a frame to validate.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE in case of failure.
Note
None.

Referenced by AxiEthernetMultipleFramesIntrExample(), AxiEthernetMultipleFramesPolledExample(), AxiEthernetSgDmaIntrExample(), AxiEthernetSgDmaIntrExtMulticastExample(), AxiEthernetSgDmaIntrExtVlanExample(), AxiEthernetSgDmaIntrSingleFrameExample(), AxiEthernetSgDmaPollExample(), and AxiEthernetSingleFramePolledExample().

void AxiEthernetUtilPhyDelay ( unsigned int  Seconds)

For Microblaze we use an assembly loop that is roughly the same regardless of optimization level, although caches and memory access time can make the delay vary.

Just keep in mind that after resetting or updating the PHY modes, the PHY typically needs time to recover.

Returns
None
Note
None

Referenced by AxiEthernetExtVlanExample(), AxiEthernetFifoIntrExample(), AxiEthernetMcastExample(), AxiEthernetPolledExample(), AxiEthernetSgDmaIntrExample(), AxiEthernetSgDmaPollExample(), AxiEthernetUtilConfigureInternalPhy(), and AxiEthernetUtilEnterLoopback().