XilinxProcessorIPLib/drivers/axicdma/src/xaxicdma_bdring.c
u32 XAxiCdma_BdRingFree(XAxiCdma *InstancePtr, int NumBd,
		      XAxiCdma_Bd * BdSetPtr)
{
	if (NumBd < 0) {

		xdbg_printf(XDBG_DEBUG_ERROR, "BdRingFree: negative BDs%d\r\n",
			NumBd);

		return XST_INVALID_PARAM;
	}

	/* If the BD Set to free is empty, do nothing
	 */
	if (NumBd == 0) {
		return XST_SUCCESS;
	}

	/* Make sure we are in sync with XAxiCdma_BdRingFromHw() */
	if ((InstancePtr->PostBdCnt < NumBd) ||
	    (InstancePtr->PostBdHead != BdSetPtr)) {

		xdbg_printf(XDBG_DEBUG_ERROR, "BdRingFree: Error free BDs: "
		    "post count %d to free %d, PostBdHead %x to free ptr %x\r\n",
		    InstancePtr->PostBdCnt, NumBd,
		    (UINTPTR)InstancePtr->PostBdHead,
		    (UINTPTR)BdSetPtr);

		return XST_DMA_SG_LIST_ERROR;
	}

	/* Update pointers and counters */
	InstancePtr->FreeBdCnt += NumBd;
	InstancePtr->PostBdCnt -= NumBd;
	XAXICDMA_RING_SEEKAHEAD(InstancePtr, InstancePtr->PostBdHead, NumBd);

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
 * This function returns the BDs back to the free pool of the BD ring.
 *
 * @param	InstancePtr is the driver instance we are working on
 * @param	NumBd is the number of BDs to free
 * @param	BdSetPtr is the set of BDs to be freed
 *
 * @return
 *			- XST_SUCCESS for success
 *			- XST_INVALID_PARAM if number of BDs is negative
 *			- XST_DMA_SG_LIST_ERROR if the BD ring management has a problem
 *
 * @note	None.
 *
 *****************************************************************************/
This function returns the BDs back to the free pool of the BD ring.
@param       InstancePtr is the driver instance we are working on
@param       NumBd is the number of BDs to free
@param       BdSetPtr is the set of BDs to be freed

@return
- XST_SUCCESS for success
- XST_INVALID_PARAM if number of BDs is negative
- XST_DMA_SG_LIST_ERROR if the BD ring management has a problem

@note        None.
This function returns the BDs back to the free pool of the BD ring . @param InstancePtr is the driver instance we are working on @param NumBd is the number of BDs to free @param BdSetPtr is the set of BDs to be freed @return - XST_SUCCESS for success - XST_INVALID_PARAM if number of BDs is negative - XST_DMA_SG_LIST_ERROR if the BD ring management has a problem @note None .
u32 XAxiCdma_BdRingFree(XAxiCdma *InstancePtr, int NumBd,
		      XAxiCdma_Bd * BdSetPtr)
{
	if (NumBd < 0) {
		xdbg_printf(XDBG_DEBUG_ERROR, "BdRingFree: negative BDs%d\r\n",
			NumBd);
		return XST_INVALID_PARAM;
	}
	if (NumBd == 0) {
		return XST_SUCCESS;
	}
	if ((InstancePtr->PostBdCnt < NumBd) ||
	    (InstancePtr->PostBdHead != BdSetPtr)) {
		xdbg_printf(XDBG_DEBUG_ERROR, "BdRingFree: Error free BDs: "
		    "post count %d to free %d, PostBdHead %x to free ptr %x\r\n",
		    InstancePtr->PostBdCnt, NumBd,
		    (UINTPTR)InstancePtr->PostBdHead,
		    (UINTPTR)BdSetPtr);
		return XST_DMA_SG_LIST_ERROR;
	}
	InstancePtr->FreeBdCnt += NumBd;
	InstancePtr->PostBdCnt -= NumBd;
	XAXICDMA_RING_SEEKAHEAD(InstancePtr, InstancePtr->PostBdHead, NumBd);
	return XST_SUCCESS;
}
u32 XAxiCdma_BdRingFree ( XAxiCdma * InstancePtr , int NumBd , XAxiCdma_Bd * BdSetPtr ) { if ( NumBd < 0 ) { xdbg_printf ( XDBG_DEBUG_ERROR , " \r \n " , NumBd ) ; return XST_INVALID_PARAM ; } if ( NumBd == 0 ) { return XST_SUCCESS ; } if ( ( InstancePtr -> PostBdCnt < NumBd ) || ( InstancePtr -> PostBdHead != BdSetPtr ) ) { xdbg_printf ( XDBG_DEBUG_ERROR , " " " \r \n " , InstancePtr -> PostBdCnt , NumBd , ( UINTPTR ) InstancePtr -> PostBdHead , ( UINTPTR ) BdSetPtr ) ; return XST_DMA_SG_LIST_ERROR ; } InstancePtr -> FreeBdCnt += NumBd ; InstancePtr -> PostBdCnt -= NumBd ; XAXICDMA_RING_SEEKAHEAD ( InstancePtr , InstancePtr -> PostBdHead , NumBd ) ; return XST_SUCCESS ; }
This function returns the BDs back to the free pool of the BD ring.
This function returns the BDs back to the free pool of the BD ring .
/* If the BD Set to free is empty, do nothing
	 */ /* Make sure we are in sync with XAxiCdma_BdRingFromHw() */ /* Update pointers and counters */