XilinxProcessorIPLib/drivers/axicdma/src/xaxicdma_bdring.c
XAxiCdma_Bd *XAxiCdma_BdRingNext(XAxiCdma *InstancePtr, XAxiCdma_Bd *BdPtr)
{
	UINTPTR ReturnBd;

	/* Check whether the BD ptr is valid
	 * A BD ptr is not valid if:
	 * - It is outside of the BD memory range
	 * - It has invalid alignment
	 */
	if (((UINTPTR)BdPtr > InstancePtr->LastBdAddr)  ||
	    ((UINTPTR)BdPtr < InstancePtr->FirstBdAddr) ||
		((UINTPTR)BdPtr & (InstancePtr->BdSeparation - 1))) {

		xdbg_printf(XDBG_DEBUG_ERROR, "Invalid BdPtr %x: %x/%x/%x\r\n",
		(UINTPTR)BdPtr, (UINTPTR)InstancePtr->FirstBdAddr,
			(UINTPTR)InstancePtr->LastBdAddr,
			(unsigned int)XAXICDMA_BD_MINIMUM_ALIGNMENT);
		ReturnBd = 0x0;
	}

	/* If the current BD is the last BD in the ring, return the first BD
	 */
	else if ((UINTPTR)BdPtr == InstancePtr->LastBdAddr) {
		ReturnBd = InstancePtr->FirstBdAddr;
	}
	else {
		ReturnBd = (UINTPTR)BdPtr + InstancePtr->BdSeparation;
	}

	 return (XAxiCdma_Bd *)ReturnBd;
}
/*****************************************************************************/
/**
 * This function gets the next BD of the current BD on the BD ring.
 *
 * @param	InstancePtr is the driver instance we are working on
 * @param	BdPtr is the current BD
 *
 * @return	The next BD on the ring from the current BD, NULL if passed
 *			in BdPtr not valid.
 *
 * @note	None.
 *
 *****************************************************************************/
This function gets the next BD of the current BD on the BD ring.
@param       InstancePtr is the driver instance we are working on
@param       BdPtr is the current BD

@return      The next BD on the ring from the current BD, NULL if passed
in BdPtr not valid.

@note        None.
This function gets the next BD of the current BD on the BD ring . @param InstancePtr is the driver instance we are working on @param BdPtr is the current BD @return The next BD on the ring from the current BD NULL if passed in BdPtr not valid . @note None .
XAxiCdma_Bd *XAxiCdma_BdRingNext(XAxiCdma *InstancePtr, XAxiCdma_Bd *BdPtr)
{
	UINTPTR ReturnBd;
	if (((UINTPTR)BdPtr > InstancePtr->LastBdAddr)  ||
	    ((UINTPTR)BdPtr < InstancePtr->FirstBdAddr) ||
		((UINTPTR)BdPtr & (InstancePtr->BdSeparation - 1))) {
		xdbg_printf(XDBG_DEBUG_ERROR, "Invalid BdPtr %x: %x/%x/%x\r\n",
		(UINTPTR)BdPtr, (UINTPTR)InstancePtr->FirstBdAddr,
			(UINTPTR)InstancePtr->LastBdAddr,
			(unsigned int)XAXICDMA_BD_MINIMUM_ALIGNMENT);
		ReturnBd = 0x0;
	}
	else if ((UINTPTR)BdPtr == InstancePtr->LastBdAddr) {
		ReturnBd = InstancePtr->FirstBdAddr;
	}
	else {
		ReturnBd = (UINTPTR)BdPtr + InstancePtr->BdSeparation;
	}
	 return (XAxiCdma_Bd *)ReturnBd;
}
XAxiCdma_Bd * XAxiCdma_BdRingNext ( XAxiCdma * InstancePtr , XAxiCdma_Bd * BdPtr ) { UINTPTR ReturnBd ; if ( ( ( UINTPTR ) BdPtr > InstancePtr -> LastBdAddr ) || ( ( UINTPTR ) BdPtr < InstancePtr -> FirstBdAddr ) || ( ( UINTPTR ) BdPtr & ( InstancePtr -> BdSeparation - 1 ) ) ) { xdbg_printf ( XDBG_DEBUG_ERROR , " \r \n " , ( UINTPTR ) BdPtr , ( UINTPTR ) InstancePtr -> FirstBdAddr , ( UINTPTR ) InstancePtr -> LastBdAddr , ( unsigned int ) XAXICDMA_BD_MINIMUM_ALIGNMENT ) ; ReturnBd = 0x0 ; } else if ( ( UINTPTR ) BdPtr == InstancePtr -> LastBdAddr ) { ReturnBd = InstancePtr -> FirstBdAddr ; } else { ReturnBd = ( UINTPTR ) BdPtr + InstancePtr -> BdSeparation ; } return ( XAxiCdma_Bd * ) ReturnBd ; }
This function gets the next BD of the current BD on the BD ring.
This function gets the next BD of the current BD on the BD ring .
/* Check whether the BD ptr is valid
	 * A BD ptr is not valid if:
	 * - It is outside of the BD memory range
	 * - It has invalid alignment
	 */ /* If the current BD is the last BD in the ring, return the first BD
	 */