| axiethernet Vitis Drivers API Documentation

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

Functions
xaxiethernet_example_extvlan.c File Reference

## Overview

Implements examples that utilize the Axi Ethernet's interrupt driven SGDMA packet transfer mode to send and receive frames.

This example demonstrates:

- How to setup VLAN strip/translate/tag in TX and RX direction
- How the VLAN tags are handled
- What is the expected VLAN tag(s) after VLAN functions are invoked

Functional guide to example:

- AxiEthernetSgDmaIntrExtVlanExample demonstrates the extended VLAN capability. The HW must be setup for extended VLAN for this example to execute.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    1.00a asa  4/30/10  First release based on the ll temac driver
    1.01a asa  12/10/10 Changes made to enable the AXIDMA Tx/Rx ring interrupts
                              before allocation of Tx/Rx BDs.
    3.00a asa  6/25/12  Modified XAxiDma_BdSetLength API call to support new
                              AXI DMA driver version 7.00a.
    3.00a bss  10/22/12 Added support for Fast Interrupt Handlers.
    3.01a srt  02/14/13 Added support for Zynq (CR 681136)
    5.4   ms   01/23/17 Modified xil_printf statement in main function to
                        ensure that "Successfully ran" and "Failed" strings are
                        available in all examples. This is a fix for CR-965028.
          ms   04/05/17 Added tabspace for return statements in functions
                        for proper documentation while generating doxygen.
    5.7   rsp  19/12/17 Defined Padding and ExternalLoopback variables.

## Functions
int | AxiEthernetExtVlanExample (INTC *IntcInstancePtr, XAxiEthernet *AxiEthernetInstancePtr, XAxiDma *DmaInstancePtr, u16 AxiEthernetDeviceId, u16 AxiDmaDeviceId, u16 AxiEthernetIntrId, u16 DmaRxIntrId, u16 DmaTxIntrId)
| This function demonstrates the usage usage of the Axi Ethernet by sending and receiving frames in interrupt driven SGDMA mode. More...
int | AxiEthernetSgDmaIntrExtVlanExample (XAxiEthernet *AxiEthernetInstancePtr, XAxiDma *DmaInstancePtr)
| This example sends and receives a single packet in loopback mode with extended VLAN support. More...
int | main (void)
| This is the main function for the Axi Ethernet example. More...

## Function Documentation

int AxiEthernetExtVlanExample | ( | INTC * | IntcInstancePtr,
|  | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XAxiDma * | DmaInstancePtr,
|  | u16 | AxiEthernetDeviceId,
|  | u16 | AxiDmaDeviceId,
|  | u16 | AxiEthernetIntrId,
|  | u16 | DmaRxIntrId,
|  | u16 | DmaTxIntrId
| ) |  |

This function demonstrates the usage usage of the Axi Ethernet by sending and receiving frames in interrupt driven SGDMA mode.

Parameters

  IntcInstancePtr | is a pointer to the instance of the Intc component.
  AxiEthernetInstancePtr | is a pointer to the instance of the AxiEthernet component.
  DmaInstancePtr | is a pointer to the instance of the AXIDMA component.
  AxiEthernetDeviceId | is Device ID of the Axi Ethernet Device , typically XPAR_<AXIETHERNET_instance>_DEVICE_ID value from xparameters.h.
  AxiDmaDeviceId | is Device ID of the Axi DMAA Device , typically XPAR_<AXIDMA_instance>_DEVICE_ID value from xparameters.h.
  AxiEthernetIntrId | is the Interrupt ID and is typically XPAR_<INTC_instance>_<AXIETHERNET_instance>_VEC_ID value from xparameters.h.
  DmaRxIntrId | is the interrupt id for DMA Rx and is typically taken from XPAR_<AXIETHERNET_instance>_CONNECTED_DMARX_INTR
  DmaTxIntrId | is the interrupt id for DMA Tx and is typically taken from XPAR_<AXIETHERNET_instance>_CONNECTED_DMATX_INTR

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

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

References XAxiEthernet_Config::AxiDevBaseAddress, XAxiEthernet_Config::AxiDevType, AxiEthernetSgDmaIntrExtVlanExample(), AxiEthernetUtilEnterLoopback(), AxiEthernetUtilErrorTrap(), AxiEthernetUtilPhyDelay(), XAxiEthernet_Config::BaseAddress, XAxiEthernet::Config, XAxiEthernet_CfgInitialize(), XAxiEthernet_GetPhysicalInterface, XAxiEthernet_IsRxVlanStrp, XAxiEthernet_IsRxVlanTag, XAxiEthernet_IsRxVlanTran, XAxiEthernet_IsTxVlanStrp, XAxiEthernet_IsTxVlanTag, XAxiEthernet_IsTxVlanTran, XAxiEthernet_LookupConfig(), XAxiEthernet_SetMacAddress(), XAxiEthernet_SetOperatingSpeed(), and XAxiEthernet_Stop().

Referenced by main().

int AxiEthernetSgDmaIntrExtVlanExample | ( | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XAxiDma * | DmaInstancePtr
| ) |  |

This example sends and receives a single packet in loopback mode with extended VLAN support.

The transmit frame will have VLAN field populated.

On receive, HW should pass the VLAN field to receive BDs.

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
  Summary of VLAN tags handling in this example

Frame setup with Tpid1+Cfi1+TxPid => 0x88A83111 Frame translated to TxTransVid => 0x88A83222 Frame tagged to Tpid2+Cfi2+TxTagVid => 0x9100C333 + 0x88A83222 Frame sent and loopbacked.

Frame stripped with RxStrpVid(0x333) => 0x88A83222 Frame translated (key:RxVid:0x222) RxTransVid => 0x88A83444

References AxiEthernetUtilErrorTrap(), AxiEthernetUtilFrameHdrFormatMAC(), AxiEthernetUtilFrameHdrVlanFormatType(), AxiEthernetUtilFrameHdrVlanFormatVid(), AxiEthernetUtilFrameMemClear(), AxiEthernetUtilFrameSetVlanPayloadData(), AxiEthernetUtilFrameVerify(), XAE_EXT_RXVLAN_TRAN_OPTION, XAE_EXT_TXVLAN_TAG_OPTION, XAE_EXT_TXVLAN_TRAN_OPTION, XAE_INT_RECV_ERROR_MASK, XAE_JUMBO_OPTION, XAE_RECEIVER_ENABLE_OPTION, XAE_TRANSMITTER_ENABLE_OPTION, XAxiEthernet_IntEnable, XAxiEthernet_IsRxVlanStrp, XAxiEthernet_IsRxVlanTag, XAxiEthernet_IsRxVlanTran, XAxiEthernet_IsTxVlanStrp, XAxiEthernet_IsTxVlanTag, XAxiEthernet_IsTxVlanTran, XAxiEthernet_SetOptions(), XAxiEthernet_SetTpid(), XAxiEthernet_SetVidTable(), XAxiEthernet_SetVStripMode(), XAxiEthernet_SetVTagMode(), XAxiEthernet_SetVTagValue(), and XAxiEthernet_Start().

Referenced by AxiEthernetExtVlanExample().

int main | ( | void |  | ) |

This is the main function for the Axi Ethernet example.

This function is not included if the example is generated from the TestAppGen test tool.

Parameters

  None. |

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

Note
  None.

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