XilinxProcessorIPLib/drivers/mcdma/src/xmcdma_bd.c
int XMcdma_BdChainFree(XMcdma_ChanCtrl *Chan, int BdCount, XMcdma_Bd *BdSetPtr)
{
	int i;

	if (BdCount < 0) {
		xil_printf("Invalid BD count\n\r");

		return XST_INVALID_PARAM;
	}

	if (BdCount == 0)
		return XST_SUCCESS;


	for (i = 0; i < BdCount; i++) {
		XMcdma_BdClear(BdSetPtr);
		BdSetPtr = (XMcdma_Bd *)(XMcdma_BdChainNextBd(Chan, BdSetPtr));
	}

	Chan->BdDoneCnt -= BdCount;

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
 * Frees a set of BDs that had been previously retrieved with
 * XMcdma_BdChainFromHW().
 *
 * @param	Chan is the MCDMA Channel to be worked on..
 * @param	BdCount is the number of BDs to free.
 * @param	BdSetPtr is the head of a list of BDs returned by
 *		XMcdma_BdChainFromHW().
 *
 * @return
 *		- XST_SUCCESS if the set of BDs was freed.
 *		- XST_INVALID_PARAM if NumBd is negative
 *
 * @note	This function should not be preempted by another XAxiMcDma
 *		function call that modifies the BD space. It is the caller's
 *		responsibility to ensure mutual exclusion.
 *
 *****************************************************************************/
Frees a set of BDs that had been previously retrieved with
XMcdma_BdChainFromHW().

@param       Chan is the MCDMA Channel to be worked on
@param       BdCount is the number of BDs to free.
@param       BdSetPtr is the head of a list of BDs returned by
XMcdma_BdChainFromHW().

@return
- XST_SUCCESS if the set of BDs was freed.

@note        This function should not be preempted by another XAxiMcDma
function call that modifies the BD space. It is the caller's
responsibility to ensure mutual exclusion.
Frees a set of BDs that had been previously retrieved with XMcdma_BdChainFromHW () . @param Chan is the MCDMA Channel to be worked on @param BdCount is the number of BDs to free . @param BdSetPtr is the head of a list of BDs returned by XMcdma_BdChainFromHW () . @return - XST_SUCCESS if the set of BDs was freed . @note This function should not be preempted by another XAxiMcDma function call that modifies the BD space . It is the caller ' s responsibility to ensure mutual exclusion .
int XMcdma_BdChainFree(XMcdma_ChanCtrl *Chan, int BdCount, XMcdma_Bd *BdSetPtr)
{
	int i;
	if (BdCount < 0) {
		xil_printf("Invalid BD count\n\r");
		return XST_INVALID_PARAM;
	}
	if (BdCount == 0)
		return XST_SUCCESS;
	for (i = 0; i < BdCount; i++) {
		XMcdma_BdClear(BdSetPtr);
		BdSetPtr = (XMcdma_Bd *)(XMcdma_BdChainNextBd(Chan, BdSetPtr));
	}
	Chan->BdDoneCnt -= BdCount;
	return XST_SUCCESS;
}
int XMcdma_BdChainFree ( XMcdma_ChanCtrl * Chan , int BdCount , XMcdma_Bd * BdSetPtr ) { int i ; if ( BdCount < 0 ) { xil_printf ( " \n \r " ) ; return XST_INVALID_PARAM ; } if ( BdCount == 0 ) return XST_SUCCESS ; for ( i = 0 ; i < BdCount ; i ++ ) { XMcdma_BdClear ( BdSetPtr ) ; BdSetPtr = ( XMcdma_Bd * ) ( XMcdma_BdChainNextBd ( Chan , BdSetPtr ) ) ; } Chan -> BdDoneCnt -= BdCount ; return XST_SUCCESS ; }
Frees a set of BDs that had been previously retrieved with
 XMcdma_BdChainFromHW().
Frees a set of BDs that had been previously retrieved with XMcdma_BdChainFromHW () .