XilinxProcessorIPLib/drivers/llfifo/src/xllfifo.c
int XLlFifo_iRead_Aligned(XLlFifo *InstancePtr, void *BufPtr,
			     unsigned WordCount)
{
	unsigned WordsRemaining = WordCount;
	u32 *BufPtrIdx = (u32 *)BufPtr;

	xdbg_printf(XDBG_DEBUG_FIFO_RX, "XLlFifo_iRead_Aligned: start\n");
	Xil_AssertNonvoid(InstancePtr);
	Xil_AssertNonvoid(BufPtr);
	/* assert buffer is 32 bit aligned */
	Xil_AssertNonvoid(((UINTPTR)BufPtr & 0x3) == 0x0);
	xdbg_printf(XDBG_DEBUG_FIFO_RX, "XLlFifo_iRead_Aligned: after asserts\n");

	while (WordsRemaining) {
/*		xdbg_printf(XDBG_DEBUG_FIFO_RX,
			    "XLlFifo_iRead_Aligned: WordsRemaining: %d\n",
			    WordsRemaining);
*/
		*BufPtrIdx = XLlFifo_RxGetWord(InstancePtr);
		BufPtrIdx++;
		WordsRemaining--;
	}
	xdbg_printf(XDBG_DEBUG_FIFO_RX,
		    "XLlFifo_iRead_Aligned: returning SUCCESS\n");
	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* XLlFifo_iRead_Aligned reads, <i>WordCount</i>, words from the FIFO referenced by
* <i>InstancePtr</i> to the block of memory, referenced by <i>BufPtr</i>.
*
* XLlFifo_iRead_Aligned assumes that <i>BufPtr</i> is already aligned according
* to the following hardware limitations:
*    ppc        - aligned on 32 bit boundaries to avoid performance penalties
*                 from unaligned exception handling.
*    microblaze - aligned on 32 bit boundaries as microblaze does not handle
*                 unaligned transfers.
*
* Care must be taken to ensure that the number of words read with one or more
* calls to XLlFifo_Read() does not exceed the number of bytes (rounded up to
* the nearest whole 32 bit word) available given from the last call to
* XLlFifo_RxGetLen().
*
* @param    InstancePtr references the FIFO on which to operate.
*
* @param    BufPtr specifies the memory address to place the data read.
*
* @param    WordCount specifies the number of 32 bit words to read.
*
* @return   XLlFifo_iRead_Aligned always returns XST_SUCCESS. Error handling is
*           otherwise handled through hardware exceptions and interrupts.
*
******************************************************************************/
XLlFifo_iRead_Aligned reads, WordCount, words from the FIFO referenced by
InstancePtr to the block of memory, referenced by BufPtr.

XLlFifo_iRead_Aligned assumes that BufPtr is already aligned according
to the following hardware limitations:
ppc        - aligned on 32 bit boundaries to avoid performance penalties
from unaligned exception handling.
microblaze - aligned on 32 bit boundaries as microblaze does not handle
unaligned transfers.

Care must be taken to ensure that the number of words read with one or more
calls to XLlFifo_Read() does not exceed the number of bytes (rounded up to
the nearest whole 32 bit word) available given from the last call to
XLlFifo_RxGetLen().
XLlFifo_iRead_Aligned reads WordCount words from the FIFO referenced by InstancePtr to the block of memory referenced by BufPtr . XLlFifo_iRead_Aligned assumes that BufPtr is already aligned according to the following hardware limitations : ppc - aligned on 32 bit boundaries to avoid performance penalties from unaligned exception handling . microblaze - aligned on 32 bit boundaries as microblaze does not handle unaligned transfers . Care must be taken to ensure that the number of words read with one or more calls to XLlFifo_Read () does not exceed the number of bytes ( rounded up to the nearest whole 32 bit word ) available given from the last call to XLlFifo_RxGetLen () .
int XLlFifo_iRead_Aligned(XLlFifo *InstancePtr, void *BufPtr,
			     unsigned WordCount)
{
	unsigned WordsRemaining = WordCount;
	u32 *BufPtrIdx = (u32 *)BufPtr;
	xdbg_printf(XDBG_DEBUG_FIFO_RX, "XLlFifo_iRead_Aligned: start\n");
	Xil_AssertNonvoid(InstancePtr);
	Xil_AssertNonvoid(BufPtr);
	Xil_AssertNonvoid(((UINTPTR)BufPtr & 0x3) == 0x0);
	xdbg_printf(XDBG_DEBUG_FIFO_RX, "XLlFifo_iRead_Aligned: after asserts\n");
	while (WordsRemaining) {
		*BufPtrIdx = XLlFifo_RxGetWord(InstancePtr);
		BufPtrIdx++;
		WordsRemaining--;
	}
	xdbg_printf(XDBG_DEBUG_FIFO_RX,
		    "XLlFifo_iRead_Aligned: returning SUCCESS\n");
	return XST_SUCCESS;
}
int XLlFifo_iRead_Aligned ( XLlFifo * InstancePtr , void * BufPtr , unsigned WordCount ) { unsigned WordsRemaining = WordCount ; u32 * BufPtrIdx = ( u32 * ) BufPtr ; xdbg_printf ( XDBG_DEBUG_FIFO_RX , " \n " ) ; Xil_AssertNonvoid ( InstancePtr ) ; Xil_AssertNonvoid ( BufPtr ) ; Xil_AssertNonvoid ( ( ( UINTPTR ) BufPtr & 0x3 ) == 0x0 ) ; xdbg_printf ( XDBG_DEBUG_FIFO_RX , " \n " ) ; while ( WordsRemaining ) { * BufPtrIdx = XLlFifo_RxGetWord ( InstancePtr ) ; BufPtrIdx ++ ; WordsRemaining -- ; } xdbg_printf ( XDBG_DEBUG_FIFO_RX , " \n " ) ; return XST_SUCCESS ; }
XLlFifo_iRead_Aligned reads, <i>WordCount</i>, words from the FIFO referenced by
<i>InstancePtr</i> to the block of memory, referenced by <i>BufPtr</i>.
XLlFifo_iRead_Aligned reads <i > WordCount< / i > words from the FIFO referenced by <i > InstancePtr< / i > to the block of memory referenced by <i > BufPtr< / i > .
/* assert buffer is 32 bit aligned */ /*		xdbg_printf(XDBG_DEBUG_FIFO_RX,
			    "XLlFifo_iRead_Aligned: WordsRemaining: %d\n",
			    WordsRemaining);
*/