axiethernet: xaxiethernet_example.h File Reference

| axiethernet Xilinx SDK Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
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

    AxiEthernetInstancePtr | is a pointer to the instance of the AxiEthernet component.
    Speed | is the loopback speed 10, 100, or 1000 Mbit.

  Returns
    - XST_SUCCESS if successful.
    - XST_FAILURE, in case of failure..
  Note
    None.

References AxiEthernetUtilErrorTrap(), AxiEthernetUtilPhyDelay(), 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

  AxiEthernetInstancePtr | is a pointer to the instance of the AxiEthernet component.
  Speed | is 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(), 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 AxiEthernetUtilErrorTrap | ( | 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.

Parameters

  Message | is the text explaining the error

Returns
  None

Note
  None

Referenced by AxiEthernetExtVlanExample(), AxiEthernetFifoIntrExample(), AxiEthernetMcastExample(), AxiEthernetMultipleFramesIntrExample(), AxiEthernetMultipleFramesPolledExample(), AxiEthernetPolledExample(), AxiEthernetPollForRxStatus(), AxiEthernetPollForTxStatus(), AxiEthernetResetDevice(), AxiEthernetSgDmaFullChecksumOffloadExample(), AxiEthernetSgDmaIntrCoalescingExample(), AxiEthernetSgDmaIntrExample(), AxiEthernetSgDmaIntrExtMulticastExample(), AxiEthernetSgDmaIntrExtVlanExample(), AxiEthernetSgDmaIntrMultiFrameExample(), AxiEthernetSgDmaIntrSingleFrameExample(), AxiEthernetSgDmaMultiFrameExample(), AxiEthernetSgDmaPartialChecksumOffloadExample(), AxiEthernetSgDmaPollExample(), AxiEthernetSgDmaSingleFrameExample(), AxiEthernetSingleFrameIntrExample(), AxiEthernetSingleFrameNonContIntrExample(), AxiEthernetSingleFramePolledExample(), AxiEthernetUtilConfigureInternalPhy(), AxiEthernetUtilEnterLoopback(), and main().

void AxiEthernetUtilFrameHdrFormatMAC | ( | EthernetFrame * | FramePtr,
|  | char * | DestAddr
| ) |  |

Set the MAC addresses in the frame.

Parameters

  FramePtr | is the pointer to the frame.
  DestAddr | is the Destination MAC address.

Returns
  None.

Note
  None.

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

void AxiEthernetUtilFrameHdrFormatType | ( | EthernetFrame * | FramePtr,
|  | u16 | FrameType
| ) |  |

Set the frame type for the specified frame.

Parameters

  FramePtr | is the pointer to the frame.
  FrameType | is the Type to set in frame.

Returns
  None.

Note
  None.

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

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

Set the frame type for the specified frame.

Parameters

  FramePtr | is the pointer to the frame.
  FrameType | is the Type to set in frame.
  VlanNumber | is 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

  FramePtr | is the pointer to the frame.
  VlanNumber | is the VlanValue insertion position to set in frame.
  Vid | is the 4 bytes Vlan value (TPID, Priority, CFI, VID) to be set in frame.

Returns
  None.

Note
  None.

Referenced by AxiEthernetSgDmaIntrExtVlanExample().

void AxiEthernetUtilFrameMemClear | ( | EthernetFrame * | FramePtr | ) |

This function sets all bytes of a frame to 0.

Parameters

  FramePtr | is a pointer to the frame itself.

Returns
  None.

Note
  None.

Referenced by AxiEthernetMultipleFramesIntrExample(), AxiEthernetSgDmaIntrExtMulticastExample(), AxiEthernetSgDmaIntrExtVlanExample(), AxiEthernetSgDmaIntrMultiFrameExample(), AxiEthernetSgDmaIntrSingleFrameExample(), AxiEthernetSgDmaMultiFrameExample(), AxiEthernetSgDmaPartialChecksumOffloadExample(), AxiEthernetSgDmaSingleFrameExample(), AxiEthernetSingleFrameIntrExample(), AxiEthernetSingleFrameNonContIntrExample(), and AxiEthernetSingleFramePolledExample().

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

  FramePtr | is a pointer to the frame to change.
  PayloadSize | is 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

  FramePtr | is a pointer to the frame to change.
  PayloadSize | is the number of bytes in the payload that will be set.
  VlanNumber | is 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

  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.

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE in case of failure.

Note
  None.

Referenced by AxiEthernetMultipleFramesIntrExample(), AxiEthernetMultipleFramesPolledExample(), AxiEthernetSgDmaIntrExtMulticastExample(), AxiEthernetSgDmaIntrExtVlanExample(), AxiEthernetSgDmaIntrSingleFrameExample(), 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().