XilinxProcessorIPLib/drivers/usbps/src/xusbps_endpoint.c
s32 XUsbPs_EpDataBufferReceive(XUsbPs *InstancePtr, u8 EpNum,
			u8 *BufferPtr, u32 BufferLen)
{
	XUsbPs_EpOut	*Ep;

	Xil_AssertNonvoid(InstancePtr  != NULL);
	Xil_AssertNonvoid(BufferPtr    != NULL);
	Xil_AssertNonvoid(EpNum < InstancePtr->DeviceConfig.NumEndpoints);

	Ep = &InstancePtr->DeviceConfig.Ep[EpNum].Out;

	Ep->RequestedBytes = BufferLen;
	Ep->BytesTxed = 0;
	Ep->BufferPtr = BufferPtr;
	Ep->MemAlloted = 1;

	XUsbPs_dTDInvalidateCache(Ep->dTDCurr);

	/* Locate the next available buffer in the ring. A buffer is available
	 * if its descriptor is not active.
	 */
	if (XUsbPs_dTDIsActive(Ep->dTDCurr)) {
		return XST_USB_NO_BUF;
	}
	XUsbPs_EpGetData(InstancePtr, EpNum, BufferLen);

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
 * This function receives a data buffer from the endpoint of the given endpoint
 * number.
 *
 * @param	InstancePtr is a pointer to the XUsbPs instance of the
 *		controller.
 * @param	EpNum is the number of the endpoint to receive data from.
 * @param	BufferPtr (OUT param) is a pointer to the buffer pointer to hold
 *		the reference of the data buffer.
 * @param	BufferLen (OUT param) is a pointer to the integer that will
 *		hold the buffer length.
 *
 * @return
 *		- XST_SUCCESS: The operation completed successfully.
 *		- XST_FAILURE: An error occurred.
 *		- XST_USB_NO_BUF: No buffer available.
 *
 * @note
 *
 ******************************************************************************/
This function receives a data buffer from the endpoint of the given endpoint
number.

@param       InstancePtr is a pointer to the XUsbPs instance of the
controller.
@param       EpNum is the number of the endpoint to receive data from.
@param       BufferPtr (OUT param) is a pointer to the buffer pointer to hold
the reference of the data buffer.
@param       BufferLen (OUT param) is a pointer to the integer that will
hold the buffer length.

@return
- XST_SUCCESS: The operation completed successfully.
- XST_FAILURE: An error occurred.
- XST_USB_NO_BUF: No buffer available.

@note
This function receives a data buffer from the endpoint of the given endpoint number . @param InstancePtr is a pointer to the XUsbPs instance of the controller . @param EpNum is the number of the endpoint to receive data from . @param BufferPtr ( OUT param ) is a pointer to the buffer pointer to hold the reference of the data buffer . @param BufferLen ( OUT param ) is a pointer to the integer that will hold the buffer length . @return - XST_SUCCESS : The operation completed successfully . - XST_FAILURE : An error occurred . - XST_USB_NO_BUF : No buffer available . @note
s32 XUsbPs_EpDataBufferReceive(XUsbPs *InstancePtr, u8 EpNum,
			u8 *BufferPtr, u32 BufferLen)
{
	XUsbPs_EpOut	*Ep;
	Xil_AssertNonvoid(InstancePtr  != NULL);
	Xil_AssertNonvoid(BufferPtr    != NULL);
	Xil_AssertNonvoid(EpNum < InstancePtr->DeviceConfig.NumEndpoints);
	Ep = &InstancePtr->DeviceConfig.Ep[EpNum].Out;
	Ep->RequestedBytes = BufferLen;
	Ep->BytesTxed = 0;
	Ep->BufferPtr = BufferPtr;
	Ep->MemAlloted = 1;
	XUsbPs_dTDInvalidateCache(Ep->dTDCurr);
	if (XUsbPs_dTDIsActive(Ep->dTDCurr)) {
		return XST_USB_NO_BUF;
	}
	XUsbPs_EpGetData(InstancePtr, EpNum, BufferLen);
	return XST_SUCCESS;
}
s32 XUsbPs_EpDataBufferReceive ( XUsbPs * InstancePtr , u8 EpNum , u8 * BufferPtr , u32 BufferLen ) { XUsbPs_EpOut * Ep ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( BufferPtr != NULL ) ; Xil_AssertNonvoid ( EpNum < InstancePtr -> DeviceConfig . NumEndpoints ) ; Ep = & InstancePtr -> DeviceConfig . Ep [ EpNum ] . Out ; Ep -> RequestedBytes = BufferLen ; Ep -> BytesTxed = 0 ; Ep -> BufferPtr = BufferPtr ; Ep -> MemAlloted = 1 ; XUsbPs_dTDInvalidateCache ( Ep -> dTDCurr ) ; if ( XUsbPs_dTDIsActive ( Ep -> dTDCurr ) ) { return XST_USB_NO_BUF ; } XUsbPs_EpGetData ( InstancePtr , EpNum , BufferLen ) ; return XST_SUCCESS ; }
This function receives a data buffer from the endpoint of the given endpoint
 number.
This function receives a data buffer from the endpoint of the given endpoint number .
/* Locate the next available buffer in the ring. A buffer is available
	 * if its descriptor is not active.
	 */