![]() |
llfifo
Vitis Drivers API Documentation
|
Defines the XLlFifo byte-streamer API.
The Xilinx byte streamer for packet FIFOs.
This driver enables higher layer software to access a hardware FIFO using any alignment in the data buffers while preserving alignment for the hardware FIFO access.
This driver treats send and receive channels separately, using different types of instance objects for each.
This driver makes use of another FIFO driver to access the specific FIFO hardware through use of the routines passed into the Tx/RxInitialize routines.
Send and receive channels are initialized separately. The receive channel is initiailzed using XStrm_RxInitialize(). The send channel is initialized using XStrm_TxInitialize().
It is fairly simple to use the API provided by this byte streamer 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.
A frame is received by using the following sequence:
1) call XStrm_RxGetLen() to get the length of the next incoming frame.
2) call XStrm_Read() one or more times to read the number of bytes reported by XStrm_RxGetLen().
For example:
frame_len = XStrm_RxGetLen(&RxInstance);
while (frame_len) {
unsigned bytes = min(sizeof(buffer), frame_len);
XStrm_Read(&RxInstance, buffer, bytes);
// do something with buffer here
frame_len -= bytes;
}
Other restrictions on the sequence of API calls may apply depending on the specific FIFO driver used by this byte streamer driver.
A frame is transmittted by using the following sequence:
1) call XStrm_Write() one or more times to write all the of bytes in the next frame.
2) call XStrm_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);
XStrm_Write(&TxInstance, buffer, bytes);
// do something here to refill buffer
}
XStrm_TxSetLen(&RxInstance, frame_len);
Other restrictions on the sequence of API calls may apply depending on the specific FIFO driver used by this byte streamer driver.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00a jvb 10/12/06 First release 1.02a jz 12/04/09 Hal phase 1 support 2.00a hbm 01/20/10 Hal phase 1 support, bump up major release 2.02a asa 12/28/11 The macro XStrm_IsRxInternalEmpty is changed to use FrmByteCnt instead of HeadIndex. 6.2 tb 09/15/26 Align Doxygen comments with AMD standards.
#include "xenv.h"#include "xdebug.h"#include "xil_types.h"Data Structures | |
| struct | XStrm_RxFifoStreamer |
| Defines the receive byte-streamer instance. More... | |
| struct | XStrm_TxFifoStreamer |
| Defines the transmit byte-streamer instance. More... | |
Macros | |
| #define | LARGEST_FIFO_KEYHOLE_SIZE_WORDS 4 |
| FIFO keyhole size in 32-bit words. More... | |
| #define | XStrm_TxVacancy(InstancePtr) |
| Returns transmit vacancy in 32-bit words. More... | |
| #define | XStrm_RxOccupancy(InstancePtr) |
| Returns receive occupancy in 32-bit words. More... | |
| #define | XStrm_IsRxInternalEmpty(InstancePtr) (((InstancePtr)->FrmByteCnt == 0) ? TRUE : FALSE) |
| Reports whether the streamer holding buffer is empty. More... | |
Typedefs | |
| typedef struct XStrm_RxFifoStreamer | XStrm_RxFifoStreamer |
| Defines the receive byte-streamer instance. More... | |
| typedef struct XStrm_TxFifoStreamer | XStrm_TxFifoStreamer |
| Defines the transmit byte-streamer instance. More... | |
Functions | |
| void | XStrm_RxInitialize (XStrm_RxFifoStreamer *InstancePtr, unsigned FifoWidth, void *FifoInstance, XStrm_XferFnType ReadFn, XStrm_GetLenFnType GetLenFn, XStrm_GetOccupancyFnType GetOccupancyFn) |
| Initializes a receive byte-streamer instance. More... | |
| void | XStrm_TxInitialize (XStrm_TxFifoStreamer *InstancePtr, unsigned FifoWidth, void *FifoInstance, XStrm_XferFnType WriteFn, XStrm_SetLenFnType SetLenFn, XStrm_GetVacancyFnType GetVacancyFn) |
| Initializes a transmit byte-streamer instance. More... | |
| void | XStrm_TxSetLen (XStrm_TxFifoStreamer *InstancePtr, u32 Bytes) |
| Flushes the streamer and starts a transmit. More... | |
| void | XStrm_Write (XStrm_TxFifoStreamer *InstancePtr, void *BufPtr, unsigned Bytes) |
| Writes bytes to the transmit streamer. More... | |
| u32 | XStrm_RxGetLen (XStrm_RxFifoStreamer *InstancePtr) |
| Returns the next receive frame length in bytes. More... | |
| void | XStrm_Read (XStrm_RxFifoStreamer *InstancePtr, void *BufPtr, unsigned Bytes) |
| Reads bytes from the receive streamer. More... | |