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

		xdbg_printf(XDBG_DEBUG_ERROR,
		    "BdRingAlloc: negative BD number %d\r\n", NumBd);

		return XST_INVALID_PARAM;
	}

	/* Enough free BDs available for the request? */
	if (InstancePtr->FreeBdCnt < NumBd) {
		return XST_FAILURE;
	}

	/* Set the return argument and move FreeBdHead forward */
	*BdSetPtr = InstancePtr->FreeBdHead;
	XAXICDMA_RING_SEEKAHEAD(InstancePtr, InstancePtr->FreeBdHead, NumBd);
	InstancePtr->FreeBdCnt -= NumBd;
	InstancePtr->PreBdCnt += NumBd;

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
 * This function requests number of BDs from the BD ring.
 *
 * @param	InstancePtr is the driver instance we are working on
 * @param	NumBd is the number of BDs to request
 * @param	BdSetPtr is the pointer to the set of BDs returned
 *
 * @return
 *			- XST_SUCCESS for success
 *			- XST_INVALID_PARAM if requests non-positive number of BDs
 *			- XST_FAILURE if not enough free BDs available
 *
 * @note	None.
 *
 *****************************************************************************/
This function requests number of BDs from the BD ring.
@param       InstancePtr is the driver instance we are working on
@param       NumBd is the number of BDs to request
@param       BdSetPtr is the pointer to the set of BDs returned

@return
- XST_SUCCESS for success
- XST_INVALID_PARAM if requests non-positive number of BDs
- XST_FAILURE if not enough free BDs available

@note        None.
This function requests number of BDs from the BD ring . @param InstancePtr is the driver instance we are working on @param NumBd is the number of BDs to request @param BdSetPtr is the pointer to the set of BDs returned @return - XST_SUCCESS for success - XST_INVALID_PARAM if requests non - positive number of BDs - XST_FAILURE if not enough free BDs available @note None .
LONG XAxiCdma_BdRingAlloc(XAxiCdma *InstancePtr, int NumBd,
   XAxiCdma_Bd ** BdSetPtr)
{
	if (NumBd <= 0) {
		xdbg_printf(XDBG_DEBUG_ERROR,
		    "BdRingAlloc: negative BD number %d\r\n", NumBd);
		return XST_INVALID_PARAM;
	}
	if (InstancePtr->FreeBdCnt < NumBd) {
		return XST_FAILURE;
	}
	*BdSetPtr = InstancePtr->FreeBdHead;
	XAXICDMA_RING_SEEKAHEAD(InstancePtr, InstancePtr->FreeBdHead, NumBd);
	InstancePtr->FreeBdCnt -= NumBd;
	InstancePtr->PreBdCnt += NumBd;
	return XST_SUCCESS;
}
LONG XAxiCdma_BdRingAlloc ( XAxiCdma * InstancePtr , int NumBd , XAxiCdma_Bd * * BdSetPtr ) { if ( NumBd <= 0 ) { xdbg_printf ( XDBG_DEBUG_ERROR , " \r \n " , NumBd ) ; return XST_INVALID_PARAM ; } if ( InstancePtr -> FreeBdCnt < NumBd ) { return XST_FAILURE ; } * BdSetPtr = InstancePtr -> FreeBdHead ; XAXICDMA_RING_SEEKAHEAD ( InstancePtr , InstancePtr -> FreeBdHead , NumBd ) ; InstancePtr -> FreeBdCnt -= NumBd ; InstancePtr -> PreBdCnt += NumBd ; return XST_SUCCESS ; }
This function requests number of BDs from the BD ring.
This function requests number of BDs from the BD ring .
/* Enough free BDs available for the request? */ /* Set the return argument and move FreeBdHead forward */