axiethernet: xaxiethernet_example_mcdma_poll.c File Reference

| axiethernet Xilinx SDK Drivers API Documentation

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

Functions
xaxiethernet_example_mcdma_poll.c File Reference

## Overview

Implements examples that utilize the Axi Ethernet's polled mode MCDMA packet transfer mode to send and receive frames.

These examples demonstrate:

- How to perform simple send and receive
- Checksum offload
- How to perform multiple frames send and receive

Functional guide to example:

- AxiEthernetSgDmaSingleFrameExample demonstrates the simplest way to send and receive frames in polling mode.
- AxiEthernetSgDmaPartialChecksumOffloadExample demonstrates the partial checksum offloading. The HW must be setup for partial checksum offloading for this example to execute.
- AxiEthernetSgDmaFullChecksumOffloadExample demonstrates the full checksum offloading. The HW must be setup for full checksum offloading for this example to execute.
- AxiEthernetSgDmaMultiFrameExample demonstrates the way to send and recv Multiple frames in polling mode.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    5.5   adk           Initial Release.

## Functions
int | AxiEthernetSgDmaPollExample (XAxiEthernet *AxiEthernetInstancePtr, XMcdma *DmaInstancePtr, u16 AxiEthernetDeviceId, u16 AxiMcDmaDeviceId)
| This function demonstrates the usage usage of the Axi Ethernet by sending and receiving frames in polled MCDMA mode. More...
int | AxiEthernetSgDmaSingleFrameExample (XAxiEthernet *AxiEthernetInstancePtr, XMcdma *DmaInstancePtr, u8 ChanId)
| This function demonstrates the usage of the Axi Ethernet by sending and receiving a single frame in using MCDMA in polled mode. More...
int | AxiEthernetSgDmaMultiFrameExample (XAxiEthernet *AxiEthernetInstancePtr, XMcdma *DmaInstancePtr, u8 ChanId)
| This function demonstrates the usage of the Axi Ethernet by sending and receiving multiple frames in using MCDMA in polled mode. More...
int | AxiEthernetSgDmaPartialChecksumOffloadExample (XAxiEthernet *AxiEthernetInstancePtr, XMcdma *DmaInstancePtr, u8 ChanId)
| This example sends and receives a single packet in loopback mode with checksum offloading support. More...
int | AxiEthernetSgDmaFullChecksumOffloadExample (XAxiEthernet *AxiEthernetInstancePtr, XMcdma *DmaInstancePtr, u8 ChanId)
| This example sends and receives a single packet in loopback mode with full checksum offloading support. More...
int | main (void)
| This is the main function for the Axi Ethernet example. More...

## Function Documentation

int AxiEthernetSgDmaFullChecksumOffloadExample | ( | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XMcdma * | DmaInstancePtr,
|  | u8 | ChanId
| ) |  |

This example sends and receives a single packet in loopback mode with full checksum offloading support.

An Ethernet frame is formed with IP header, TCP header and payload. The hardware calculates the IP Header checksum and populates it at the appropriate location in the IP header. Similarly, the hardware calculates the TCP Pseudo header from IP header and calculates TCP checksum for TCP Pseudo header, TCP header and TCP payload. It then populates the checksum in the TCP header. The Ethernet frame is then looped back and received. The hardware validates the IP header checksum and the TCP checksum. The example retrieves the checksum validation information from the AXI4- Stream Appword2.

Parameters

  AxiEthernetInstancePtr | is a pointer to the instance of the AxiEthernet component.
  DmaInstancePtr | is a pointer to the instance of the Dma component.

Returns
  -XST_SUCCESS to indicate success -XST_FAILURE to indicate failure

Note
  None.

int AxiEthernetSgDmaMultiFrameExample | ( | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XMcdma * | DmaInstancePtr,
|  | u8 | ChanId
| ) |  |

This function demonstrates the usage of the Axi Ethernet by sending and receiving multiple frames in using MCDMA in polled mode.

Each source packet will be described by two descriptors. It will be received into a buffer described by a single descriptor.

Parameters

  AxiEthernetInstancePtr | is a pointer to the instance of the Axi Ethernet component.
  DmaInstancePtr | is a pointer to the instance of the Dma component.
  ChanId | is the MCDMA Channel Id to be operate on.

Returns
  -XST_SUCCESS to indicate success -XST_FAILURE to indicate failure

Note
  None.

References AxiEthernetUtilErrorTrap(), AxiEthernetUtilFrameHdrFormatMAC(), AxiEthernetUtilFrameHdrFormatType(), AxiEthernetUtilFrameMemClear(), AxiEthernetUtilFrameSetPayloadData(), XAE_RECEIVER_ENABLE_OPTION, XAE_TRANSMITTER_ENABLE_OPTION, XAxiEthernet_SetOptions(), XAxiEthernet_Start(), and XAxiEthernet_Stop().

Referenced by AxiEthernetSgDmaPollExample().

int AxiEthernetSgDmaPartialChecksumOffloadExample | ( | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XMcdma * | DmaInstancePtr,
|  | u8 | ChanId
| ) |  |

This example sends and receives a single packet in loopback mode with checksum offloading support.

The transmit frame will be che cksummed over the entire Ethernet payload and inserted into the last 2 bytes of the frame.

On receive, HW should calculate the Ethernet payload checksum and return a value of 0xFFFF which means the payload data was likely not corrupted.

Parameters

  AxiEthernetInstancePtr | is a pointer to the instance of the AxiEthernet component.
  DmaInstancePtr | is a pointer to the instance of the Dma component.

Returns
  -XST_SUCCESS to indicate success -XST_FAILURE to indicate failure

Note
  None.

int AxiEthernetSgDmaPollExample | ( | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XMcdma * | DmaInstancePtr,
|  | u16 | AxiEthernetDeviceId,
|  | u16 | AxiMcDmaDeviceId
| ) |  |

This function demonstrates the usage usage of the Axi Ethernet by sending and receiving frames in polled MCDMA mode.

Parameters

  AxiEthernetInstancePtr | is a pointer to the instance of the AxiEthernet component.
  DmaInstancePtr | is a pointer to the instance of the AXI MCDMA component.
  AxiEthernetDeviceId | is Device ID of the Axi Ethernet Device , typically XPAR_<AXIETHERNET_instance>_DEVICE_ID value from xparameters.h.
  AxiMcDmaDeviceId | is Device ID of the Axi DMAA Device , typically XPAR_<AXIMCDMA_instance>_DEVICE_ID value from xparameters.h.

Returns
  -XST_SUCCESS to indicate success -XST_FAILURE to indicate failure

Note
  AxiMcdma hardware must be initialized before initializing AxiEthernet. Since AxiMcdma reset line is connected to the AxiEthernet reset line, a reset of AxiMcdma hardware during its initialization would reset AxiEthernet.

References XAxiEthernet_Config::AxiDevType, AxiEthernetSgDmaFullChecksumOffloadExample(), AxiEthernetSgDmaMultiFrameExample(), AxiEthernetSgDmaPartialChecksumOffloadExample(), AxiEthernetSgDmaSingleFrameExample(), AxiEthernetUtilEnterLoopback(), AxiEthernetUtilErrorTrap(), AxiEthernetUtilPhyDelay(), XAxiEthernet_Config::AxiMcDmaChan_Cnt, XAxiEthernet_Config::BaseAddress, XAxiEthernet::Config, XAxiEthernet_Config::Enable_1588, XAxiEthernet_Config::Speed, XAxiEthernet_CfgInitialize(), XAxiEthernet_GetPhysicalInterface, XAxiEthernet_IsRxFullCsum, XAxiEthernet_IsRxPartialCsum, XAxiEthernet_IsRxVlanStrp, XAxiEthernet_IsRxVlanTag, XAxiEthernet_IsRxVlanTran, XAxiEthernet_IsTxFullCsum, XAxiEthernet_IsTxPartialCsum, XAxiEthernet_IsTxVlanStrp, XAxiEthernet_IsTxVlanTag, XAxiEthernet_IsTxVlanTran, XAxiEthernet_LookupConfig(), XAxiEthernet_SetOperatingSpeed(), and XAxiEthernet_Stop().

Referenced by main().

int AxiEthernetSgDmaSingleFrameExample | ( | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XMcdma * | DmaInstancePtr,
|  | u8 | ChanId
| ) |  |

This function demonstrates the usage of the Axi Ethernet by sending and receiving a single frame in using MCDMA in polled mode.

The source packet will be described by two descriptors. It will be received into a buffer described by a single descriptor.

Parameters

  AxiEthernetInstancePtr | is a pointer to the instance of the Axi Ethernet component.
  DmaInstancePtr | is a pointer to the instance of the Dma component.
  ChanId | is the MCDMA Channel Id to be operate on.

Returns
  -XST_SUCCESS to indicate success -XST_FAILURE to indicate failure

Note
  None.

References AxiEthernetUtilErrorTrap(), AxiEthernetUtilFrameHdrFormatMAC(), AxiEthernetUtilFrameHdrFormatType(), AxiEthernetUtilFrameMemClear(), AxiEthernetUtilFrameSetPayloadData(), XAE_RECEIVER_ENABLE_OPTION, XAE_TRANSMITTER_ENABLE_OPTION, XAxiEthernet_SetMacAddress(), XAxiEthernet_SetOptions(), XAxiEthernet_Start(), and XAxiEthernet_Stop().

Referenced by AxiEthernetSgDmaPollExample().

int main | ( | void |  | ) |

This is the main function for the Axi Ethernet example.

Parameters

  None. |

Returns
  - XST_SUCCESS to indicate success.
  - XST_FAILURE to indicate failure

Note
  None.

References AXIETHERNET_DEVICE_ID, AxiEthernetSgDmaPollExample(), and AxiEthernetUtilErrorTrap().