![]() |
llfifo
Vitis Drivers API Documentation
|
Demonstrates XLlFifo polled transmit and receive.
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 polling 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 Receive the data and compare with the data transmitted.
Note: Enable TDEST in the hardware design in order to get the 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 RxReceive 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.
6.1 vlt 12/18/25 Update Doxygen comments to include SDT flow details.
6.2 vn 08/26/26 Fix Doxygen warnings.
6.2 tb 09/15/26 Align Doxygen comments with AMD standards.
#include "xparameters.h"#include "xil_exception.h"#include "xstreamer.h"#include "xil_cache.h"#include "xllfifo.h"#include "xstatus.h"Macros | |
| #define | WORD_SIZE 4 |
| Word size in bytes. More... | |
| #define | MAX_PACKET_LEN 4 |
| Packet length in words. More... | |
| #define | NO_OF_PACKETS 64 |
| Number of packets to transfer. More... | |
| #define | MAX_DATA_BUFFER_SIZE NO_OF_PACKETS*MAX_PACKET_LEN |
| Buffer size in words. More... | |
Functions | |
| int | XLlFifoPollingExample (XLlFifo *InstancePtr, UINTPTR BaseAddress) |
| Demonstrates polled XLlFifo transmit and receive. More... | |
| int | TxSend (XLlFifo *InstancePtr, u32 *SourceAddr) |
| Sends packets through the XLlFifo transmit channel. More... | |
| int | RxReceive (XLlFifo *InstancePtr, u32 *DestinationAddr) |
| Receives packets from the XLlFifo receive channel. More... | |
| int | main () |
| Runs the XLlFifo polling example. More... | |
Variables | |
| XLlFifo | FifoInstance |
| Driver instance for the AXI FIFO. More... | |
| u32 | SourceBuffer [MAX_DATA_BUFFER_SIZE *WORD_SIZE] |
| Transmit data buffer. More... | |
| u32 | DestinationBuffer [MAX_DATA_BUFFER_SIZE *WORD_SIZE] |
| Receive data buffer. More... | |
| #define MAX_DATA_BUFFER_SIZE NO_OF_PACKETS*MAX_PACKET_LEN |
Buffer size in words.
Referenced by XLlFifoPollingExample().
| #define MAX_PACKET_LEN 4 |
Packet length in words.
| #define NO_OF_PACKETS 64 |
Number of packets to transfer.
| #define WORD_SIZE 4 |
Word size in bytes.
Referenced by RxReceive().
| int main | ( | ) |
Runs the XLlFifo polling example.
This function is the main entry of the AXI FIFO polling test.
References XLlFifoPollingExample().
| int RxReceive | ( | XLlFifo * | InstancePtr, |
| u32 * | DestinationAddr | ||
| ) |
Receives packets from the XLlFifo receive channel.
RxReceive routine.It receives the data from the FIFO.
| [in] | InstancePtr | Pointer to the instance of the XLlFifo instance. |
| [out] | DestinationAddr | Address where to copy the received data. |
References WORD_SIZE, XLlFifo_iRxGetLen(), XLlFifo_iRxOccupancy(), XLlFifo_IsRxDone, and XLlFifo_RxGetWord().
Referenced by XLlFifoPollingExample().
| int TxSend | ( | XLlFifo * | InstancePtr, |
| u32 * | SourceAddr | ||
| ) |
Sends packets through the XLlFifo transmit channel.
Sends the requested amount of data at the specified address.
| [in] | InstancePtr | Pointer to the XLlFifo instance. |
| [in] | SourceAddr | Address of the source data to transmit. |
| int XLlFifoPollingExample | ( | XLlFifo * | InstancePtr, |
| UINTPTR | BaseAddress | ||
| ) |
Demonstrates polled XLlFifo transmit and receive.
This function demonstrates the usage AXI FIFO It does the following:
| [out] | InstancePtr | Pointer to the instance of the XLlFifo component. |
| [in] | BaseAddress | Contains the base address of the device. |
References XLlFifo_Config::BaseAddress, DestinationBuffer, Error, MAX_DATA_BUFFER_SIZE, RxReceive(), SourceBuffer, TxSend(), XLlFfio_LookupConfig(), XLlFifo_CfgInitialize(), XLlFifo_IntClear, and XLlFifo_Status.
Referenced by main().
| u32 DestinationBuffer[MAX_DATA_BUFFER_SIZE *WORD_SIZE] |
Receive data buffer.
| XLlFifo FifoInstance |
Driver instance for the AXI FIFO.
| u32 SourceBuffer[MAX_DATA_BUFFER_SIZE *WORD_SIZE] |
Transmit data buffer.