Software Drivers

llfifo v4_0

The Xilinx Dual Channel Fifo driver component. This driver supports the Virtex-5(TM) and Virtex-4(TM) XPS_ll_Fifo and the AxiFifo.

For a full description of the bridge features, please see the HW spec. This driver supports the following features:

Driver Description

This driver enables higher layer software to access the XPS_llFifo core using any alignment in the data buffers.

This driver supports send and receive channels in the same instance structure in the same fashion as the hardware core.

Initialization

An instance of this driver is initialized using a call to Initialize().

Usage

It is fairly simple to use the API provided by this FIFO driver. The only somewhat tricky part is that the calling code must correctly call a couple routines in the right sequence for receive and transmit.

This sequence is described here. Check the routine functional descriptions for information on how to use a specific API routine.

Receive

A frame is received by using the following sequence:
1) call XLlFifo_RxOccupancy() to check the occupancy count
2) call XLlFifo_RxGetLen() to get the length of the next incoming frame
3) call XLlFifo_Read() one or more times to read the number of bytes reported by XLlFifo_RxGetLen().

For example:

	while (XLlFifo_RxOccupancy(&RxInstance)) {
		frame_len = XLlFifo_RxGetLen(&RxInstance);
		while (frame_len) {
 			unsigned bytes = min(sizeof(buffer), frame_len);
			XLlFifo_Read(&RxInstance, buffer, bytes);
 			// ********
 			// do something with buffer here
 			// ********
 			frame_len -= bytes;
		}
 	}
 

This FIFO hardware core does not support a sequence where the calling code calls RxGetLen() twice in a row and then receive the data for two frames. Each frame must be read in by calling RxGetLen() just prior to reading the data.

Transmit

A frame is transmittted by using the following sequence:
1) call XLlFifo_Write() one or more times to write all the of bytes in the next frame.
2) call XLlFifo_TxSetLen() to begin the transmission of frame just written.

For example:

 	frame_left = frame_len;
 	while (frame_left) {
 		unsigned bytes = min(sizeof(buffer), frame_left);
		XLlFifo_Write(&TxInstance, buffer, bytes);
 		// ********
 		// do something here to refill buffer
 		// ********
 		frame_left -= bytes;
 	}
	XLlFifo_TxSetLen(&RxInstance, frame_len);
 

This FIFO hardware core does not support a sequence where the calling code writes the data for two frames and then calls TxSetLen() twice in a row. Each frame must be written by writting the data for one frame and then calling TxSetLen().

Interrupts

This driver does not handle interrupts from the FIFO hardware. The software layer above may make use of the interrupts by setting up its own handlers for the interrupts.

 MODIFICATION HISTORY:
 Ver   Who  Date     Changes
 ----- ---- -------- -------------------------------------------------------
 1.00a jvb  10/12/06 First release
 1.01a sdm  08/22/08 Removed support for static interrupt handlers from the
		       MDD file
 1.02a jz   12/04/09 Hal phase 1 support
 2.01a asa  09/17/10 Added code for resetting Local Link/AXI Streaming
		       interface for CR574868
 2.02a asa  12/27/11 Changed the function XStrm_Read in xtreamer.c to reset
		       HeadIndex to zero when all bytes have been read.
		       Changed the macro XStrm_IsRxInternalEmpty in file
		       xtreamer.h to use FrmByteCnt instead of HeadIndex.
		       When FrmByteCnt is zero, this means all internal buffers
		       in streamer are empty. Earlier implementation using
		       HeadIndex was not very clear and could give improper
		       results for some cases.
		       Changed the macro XLlFifo_IsRxEmpty in file xllfifo.h
		       These changes are done to fix the CR 604650.
 2.03a asa  14/08/12  Added XLLF_TDR_OFFSET, XLLF_RDR_OFFSET
		         defines for the new registers, and XLLF_INT_TFPF_MASK,
		         XLLF_INT_TFPE_MASK, XLLF_INT_RFPF_MASK and
		         XLLF_INT_RFPE_MASK for the new version of the
		         AXI4-Stream FIFO core (v2.01a and later)
 3.00a adk 08/10/13 Added support for AXI4 Datainterface.Changes are
		      In Xllfifo.c file XLlFifo_RxGetWord,XLlFifo_TxPutword.
 		      In XLlfifo.h file updated XLlfifo structure for 
 		      Axi4BaseAddress and for Datainterface type provided 
		      polling and interrupt examples. XLlfifo_IsRxDone Macro 
		      Is added in the XLlfifo.h file for polledmode exmaple.
		      Added Static initialzation for the driver. 
		      XLlFifo_Initialize is still used to make the driver
		      backward compatible.
 4.0   adk  19/12/13 Updated as per the New Tcl API's