llfifo: xllfifo_interrupt_example.c File Reference

| llfifo Xilinx SDK Drivers API Documentation

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

Functions
xllfifo_interrupt_example.c File Reference

## Overview

This file demonstrates how to use the Streaming fifo driver on the xilinx AXI Streaming FIFO IP.The AXI4-Stream FIFO core allows memory mapped access to a AXI-Stream interface.

The core can be used to interface to AXI Streaming IPs similar to the LogiCORE IP AXI Ethernet core, without having to use full DMA solution.

This is the interrupt example for the FIFO it assumes that at the h/w level FIFO is connected in loopback.In these we write known amount of data to the FIFO and wait for interrupts and after completely receiving the data compares it with the data transmitted.

Note: The TDEST Must be enabled in the H/W design inorder to get correct RDR value.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes
    ----- ---- -------- -------------------------------------------------------
    3.00a adk 08/10/2013 initial release CR:727787
    5.1   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 and Modified Comment lines
                         to consider it as a documentation block while
                         generating doxygen.
    5.3  rsp 11/08/18    Modified TxSend to fill SourceBuffer with non-zero
                         data otherwise the test can return a false positive
                         because DestinationBuffer is initialized with zeros.
                         In fact, fixing this exposed a bug in FifoRecvHandler
                         and caused the test to start failing. According to the
                         product guide (pg080) for the AXI4-Stream FIFO, the
                         RDFO should be read before reading RLR. Reading RLR
                         first will result in the RDFO being reset to zero and
                         no data being received.

## Functions
int | XLlFifoInterruptExample (XLlFifo *InstancePtr, u16 DeviceId)
| This function demonstrates the usage of AXI FIFO It does the following: More...
int | TxSend (XLlFifo *InstancePtr, u32 *SourceAddr)
| TxSend routine, It will send the requested amount of data at the specified addr. More...
int | SetupInterruptSystem (INTC *IntcInstancePtr, XLlFifo *InstancePtr, u16 FifoIntrId)
| This function setups the interrupt system such that interrupts can occur for the FIFO device. More...
int | main ()
| Main function. More...

## Function Documentation

int main | ( |  | ) |

Main function.

This function is the main entry of the AXI FIFO interrupt test.

Parameters

  None |

Returns
  - XST_SUCCESS if tests pass
    - XST_FAILURE if fails.

Note
  None

References XLlFifoInterruptExample().

int SetupInterruptSystem | ( | INTC * | IntcInstancePtr,
|  | XLlFifo * | InstancePtr,
|  | u16 | FifoIntrId
| ) |  |

This function setups the interrupt system such that interrupts can occur for the FIFO device.

This function is application specific since the actual system may or may not have an interrupt controller. The FIFO could be directly connected to a processor without an interrupt controller. The user should modify this function to fit the application.

Parameters

  InstancePtr | contains a pointer to the instance of the FIFO component which is going to be connected to the interrupt controller.

Returns
  XST_SUCCESS if successful, otherwise XST_FAILURE.

Note
  None.

Referenced by XLlFifoInterruptExample().

int TxSend | ( | XLlFifo * | InstancePtr,
|  | u32 * | SourceAddr
| ) |  |

TxSend routine, It will send the requested amount of data at the specified addr.

Parameters

  InstancePtr | is a pointer to the instance of the XLlFifo component.
  SourceAddr | is the address of the memory

Returns
  -XST_SUCCESS to indicate success -XST_FAILURE to indicate failure

Note
  None

Parameters

  InstancePtr | is a pointer to the instance of the XLlFifo component.
  SourceAddr | is the address where the FIFO stars writing

Returns
  -XST_SUCCESS to indicate success -XST_FAILURE to indicate failure

Note
  None

References XLlFifo_iTxSetLen(), XLlFifo_iTxVacancy(), and XLlFifo_TxPutWord().

Referenced by XLlFifoInterruptExample().

int XLlFifoInterruptExample | ( | XLlFifo * | InstancePtr,
|  | u16 | DeviceId
| ) |  |

This function demonstrates the usage of AXI FIFO It does the following:

      - Set up the output terminal if UART16550 is in the hardware build
      - Initialize the Axi FIFO Device.
      - Set up the interrupt handler for fifo
      - Transmit the data
      - Compare the data
      - Return the result

Parameters

  InstancePtr | is a pointer to the instance of the XLlFifo instance.
  DeviceId | is Device ID of the Axi Fifo Device instance, typically XPAR_<AXI_FIFO_instance>_DEVICE_ID value from xparameters.h.

Returns
  -XST_SUCCESS to indicate success -XST_FAILURE to indicate failure

References XLlFifo::BaseAddress, SetupInterruptSystem(), TxSend(), XLLF_INT_ALL_MASK, XLlFfio_LookupConfig(), XLlFifo_CfgInitialize(), XLlFifo_IntClear, XLlFifo_IntEnable, and XLlFifo_Status.

Referenced by main().