axiethernet: xaxiethernet_example_intr_fifo.c File Reference

| axiethernet Xilinx SDK Drivers API Documentation

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

Functions
xaxiethernet_example_intr_fifo.c File Reference

## Overview

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

These examples demonstrate:

- How to perform simple send and receive.
- Advanced frame processing
- Error handling
- Device reset

Functional guide to example:

- AxiEthernetSingleFrameIntrExample() demonstrates the simplest way to send and receive frames in interrupt driven FIFO direct mode.
- AxiEthernetSingleFrameNonContIntrExample demonstrates how to handle frames that are stored in more than one memory location.
- AxiEthernetMultipleFramesIntrExample demonstrates how to defer frame reception so that CPU intensive receive functions are not performed in interrupt context.
- AxiEthernetErrorHandler() demonstrates how to manage asynchronous errors.
- AxiEthernetResetDevice() demonstrates how to reset the driver/HW while maintaining driver/HW state.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    1.00a asa  4/30/10  First release based on the ll temac driver
    3.00a bss  10/22/12 Added support for Fast Interrupt Handlers.
    3.01a srt  02/14/13 Added support for Zynq (CR 681136)
    3.02a srt  08/06/13 Fixed CR 727634 -
                    Modified FifoHandler() logic to reflect the bit
                    changes in the Interrupt Status Register as per
                    the latest AXI FIFO stream IP.
    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 return tags in functions for proper documentation
                        while generating doxygen.
    5.6     adk  03/07/17 Fixed CR#979023 Example failed to compile.

## Functions
int | AxiEthernetFifoIntrExample (INTC *IntcInstancePtr, XAxiEthernet *AxiEthernetInstancePtr, XLlFifo *FifoInstancePtr, u16 AxiEthernetDeviceId, u16 FifoDeviceId, u16 AxiEthernetIntrId, u16 FifoIntrId)
| This function demonstrates the usage usage of the Axi Ethernet by sending and receiving frames in interrupt driven fifo mode. More...
int | AxiEthernetSingleFrameIntrExample (XAxiEthernet *AxiEthernetInstancePtr, XLlFifo *FifoInstancePtr)
| This function demonstrates the usage of the Axi Ethernet by sending and receiving a single frame in interrupt mode. More...
int | AxiEthernetSingleFrameNonContIntrExample (XAxiEthernet *AxiEthernetInstancePtr, XLlFifo *FifoInstancePtr)
| This example sends a packet from non-contiguous memory locations. More...
int | AxiEthernetMultipleFramesIntrExample (XAxiEthernet *AxiEthernetInstancePtr, XLlFifo *FifoInstancePtr)
| This example sends and receives a batch of frames. More...
int | main (void)
| This is the main function for the Axi Ethernet example. More...

## Function Documentation

int AxiEthernetFifoIntrExample | ( | INTC * | IntcInstancePtr,
|  | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XLlFifo * | FifoInstancePtr,
|  | u16 | AxiEthernetDeviceId,
|  | u16 | FifoDeviceId,
|  | u16 | AxiEthernetIntrId,
|  | u16 | FifoIntrId
| ) |  |

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

Parameters

  IntcInstancePtr | is a pointer to the instance of the Intc component.
  AxiEthernetInstancePtr | is a pointer to the instance of the Axi Ethernet component.
  FifoInstancePtr | is a pointer to the instance of the AXIFIFO component.
  AxiEthernetDeviceId | is Device ID of the Axi Ethernet Device , typically XPAR_<AXIETHERNET_instance>_DEVICE_ID value from xparameters.h.
  FifoDeviceId | is the Interrupt ID and is typically XPAR_<INTC_instance>_<AXIETHERNET_instance>_VEC_ID value from xparameters.h.
  AxiEthernetIntrId | is the Interrupt ID and is typically XPAR_<INTC_instance>_<AXIETHERNET_instance>_VEC_ID value from xparameters.h.
  FifoIntrId | is the interrupt id for fifo.

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

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

References XAxiEthernet_Config::AxiDevBaseAddress, XAxiEthernet_Config::AxiDevType, AxiEthernetMultipleFramesIntrExample(), AxiEthernetResetDevice(), AxiEthernetSingleFrameIntrExample(), AxiEthernetSingleFrameNonContIntrExample(), AxiEthernetUtilEnterLoopback(), AxiEthernetUtilErrorTrap(), AxiEthernetUtilPhyDelay(), XAxiEthernet_Config::BaseAddress, XAxiEthernet_CfgInitialize(), XAxiEthernet_GetPhysicalInterface, XAxiEthernet_LookupConfig(), XAxiEthernet_SetMacAddress(), XAxiEthernet_SetOperatingSpeed(), and XAxiEthernet_Stop().

Referenced by main().

int AxiEthernetMultipleFramesIntrExample | ( | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XLlFifo * | FifoInstancePtr
| ) |  |

This example sends and receives a batch of frames.

Frame reception is handled in this function and not in the callback function.

Use this method of reception when interrupt latency is important.

Parameters

  AxiEthernetInstancePtr | is a pointer to the instance of the AxiEthernet component.
  FifoInstancePtr | is a pointer to the instance of the Fifo component.

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

Note
  None.

References AxiEthernetUtilErrorTrap(), AxiEthernetUtilFrameHdrFormatMAC(), AxiEthernetUtilFrameHdrFormatType(), AxiEthernetUtilFrameMemClear(), AxiEthernetUtilFrameSetPayloadData(), AxiEthernetUtilFrameVerify(), XAxiEthernet_Start(), and XAxiEthernet_Stop().

Referenced by AxiEthernetFifoIntrExample().

int AxiEthernetSingleFrameIntrExample | ( | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XLlFifo * | FifoInstancePtr
| ) |  |

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

Parameters

  AxiEthernetInstancePtr | is a pointer to the instance of the AxiEthernet component.
  FifoInstancePtr | is a pointer to the instance of the Fifo component.

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

Note
  None.

References AxiEthernetUtilErrorTrap(), AxiEthernetUtilFrameHdrFormatMAC(), AxiEthernetUtilFrameHdrFormatType(), AxiEthernetUtilFrameMemClear(), AxiEthernetUtilFrameSetPayloadData(), XAE_INT_RXFIFOOVR_MASK, XAE_INT_RXRJECT_MASK, XAxiEthernet_IntEnable, XAxiEthernet_Start(), and XAxiEthernet_Stop().

Referenced by AxiEthernetFifoIntrExample().

int AxiEthernetSingleFrameNonContIntrExample | ( | XAxiEthernet * | AxiEthernetInstancePtr,
|  | XLlFifo * | FifoInstancePtr
| ) |  |

This example sends a packet from non-contiguous memory locations.

The header is stored in one area. The payload data is calculated and written to the packet FIFO one byte at a time.

Parameters

  AxiEthernetInstancePtr | is a pointer to the instance of the AxiEthernet component.
  FifoInstancePtr | is a pointer to the instance of the Fifo component.

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

Note
  None.

References AxiEthernetUtilErrorTrap(), AxiEthernetUtilFrameHdrFormatMAC(), AxiEthernetUtilFrameHdrFormatType(), AxiEthernetUtilFrameMemClear(), XAxiEthernet_Start(), and XAxiEthernet_Stop().

Referenced by AxiEthernetFifoIntrExample().

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, AxiEthernetFifoIntrExample(), and AxiEthernetUtilErrorTrap().