XilinxProcessorIPLib/drivers/usbps/examples/xusbps_ch9_audio.c
static s32 EpEnable(XUsbPs *InstancePtr, u8 EpNum, u8 Dir, u16 Maxsize, u8 Type)
{
	(void)Maxsize;
	XUsbPs_EpEnable((XUsbPs *)InstancePtr, EpNum, Dir);
	/* Set BULK mode for both directions.  */
	if(Dir == XUSBPS_EP_DIRECTION_OUT) {
		XUsbPs_ClrBits((XUsbPs *)InstancePtr,
				XUSBPS_EPCRn_OFFSET(EpNum),
				XUSBPS_EPCR_RXT_TYPE_MASK |
				XUSBPS_EPCR_RXR_MASK |
				XUSBPS_EPCR_RXS_MASK);
		XUsbPs_SetBits((XUsbPs *)InstancePtr,
				XUSBPS_EPCRn_OFFSET(EpNum),
				((Type - 1) << XUSBPS_EPCR_RXT_TYPE_SHIFT) |
				XUSBPS_EPCR_RXR_MASK);

		/* Prime the OUT endpoint. */
		XUsbPs_EpPrime((XUsbPs *)InstancePtr, EpNum, Dir);

		((XUsbPs *)InstancePtr)->DeviceConfig.Ep[EpNum].Out.MemAlloted
			= 0;
		((XUsbPs *)InstancePtr)->DeviceConfig.Ep[EpNum].Out.BufferPtr
			= NULL;
		((XUsbPs *)InstancePtr)->DeviceConfig.Ep[EpNum].Out.BytesTxed
			= 0;
		((XUsbPs *)InstancePtr)->
			DeviceConfig.Ep[EpNum].Out.RequestedBytes = 0;
	} else {
		XUsbPs_ClrBits((XUsbPs *)InstancePtr,
				XUSBPS_EPCRn_OFFSET(EpNum),
				XUSBPS_EPCR_TXT_TYPE_MASK |
				XUSBPS_EPCR_TXR_MASK |
				XUSBPS_EPCR_TXS_MASK);
		XUsbPs_SetBits((XUsbPs *)InstancePtr,
				XUSBPS_EPCRn_OFFSET(EpNum),
				((Type - 1) << XUSBPS_EPCR_TXT_TYPE_SHIFT) |
				XUSBPS_EPCR_TXR_MASK);

		((XUsbPs *)InstancePtr)->
			DeviceConfig.Ep[EpNum].In.BufferPtr = NULL;
		((XUsbPs *)InstancePtr)->
			DeviceConfig.Ep[EpNum].In.BytesTxed = 0;
		((XUsbPs *)InstancePtr)->
			DeviceConfig.Ep[EpNum].In.RequestedBytes = 0;
	}
	return XST_SUCCESS;
}
/****************************************************************************/
/**
 * Enable the respective Endpoint
 *
 * @param	InstancePtr is a private member of Usb_DevData instance.
 * @param	EpNum is the Endpoint Number
 * @param	Dir is the Endpoint Direction
 * @param	Maxsize is the Endpoint Max Packet size
 * @param 	Type is the Endpoint type (Control / Bulk / Intr / ISO)
 *
 * @return	XST_SUCCESS else XST_FAILURE
 *
 * @note		None.
 *
 *****************************************************************************/
Enable the respective Endpoint
@param       InstancePtr is a private member of Usb_DevData instance.
@param       EpNum is the Endpoint Number
@param       Dir is the Endpoint Direction
@param       Maxsize is the Endpoint Max Packet size
@param       Type is the Endpoint type (Control / Bulk / Intr / ISO)



@note                None.
Enable the respective Endpoint @param InstancePtr is a private member of Usb_DevData instance . @param EpNum is the Endpoint Number @param Dir is the Endpoint Direction @param Maxsize is the Endpoint Max Packet size @param Type is the Endpoint type ( Control / Bulk / Intr / ISO ) @note None .
static s32 EpEnable(XUsbPs *InstancePtr, u8 EpNum, u8 Dir, u16 Maxsize, u8 Type)
{
	(void)Maxsize;
	XUsbPs_EpEnable((XUsbPs *)InstancePtr, EpNum, Dir);
	if(Dir == XUSBPS_EP_DIRECTION_OUT) {
		XUsbPs_ClrBits((XUsbPs *)InstancePtr,
				XUSBPS_EPCRn_OFFSET(EpNum),
				XUSBPS_EPCR_RXT_TYPE_MASK |
				XUSBPS_EPCR_RXR_MASK |
				XUSBPS_EPCR_RXS_MASK);
		XUsbPs_SetBits((XUsbPs *)InstancePtr,
				XUSBPS_EPCRn_OFFSET(EpNum),
				((Type - 1) << XUSBPS_EPCR_RXT_TYPE_SHIFT) |
				XUSBPS_EPCR_RXR_MASK);
		XUsbPs_EpPrime((XUsbPs *)InstancePtr, EpNum, Dir);
		((XUsbPs *)InstancePtr)->DeviceConfig.Ep[EpNum].Out.MemAlloted
			= 0;
		((XUsbPs *)InstancePtr)->DeviceConfig.Ep[EpNum].Out.BufferPtr
			= NULL;
		((XUsbPs *)InstancePtr)->DeviceConfig.Ep[EpNum].Out.BytesTxed
			= 0;
		((XUsbPs *)InstancePtr)->
			DeviceConfig.Ep[EpNum].Out.RequestedBytes = 0;
	} else {
		XUsbPs_ClrBits((XUsbPs *)InstancePtr,
				XUSBPS_EPCRn_OFFSET(EpNum),
				XUSBPS_EPCR_TXT_TYPE_MASK |
				XUSBPS_EPCR_TXR_MASK |
				XUSBPS_EPCR_TXS_MASK);
		XUsbPs_SetBits((XUsbPs *)InstancePtr,
				XUSBPS_EPCRn_OFFSET(EpNum),
				((Type - 1) << XUSBPS_EPCR_TXT_TYPE_SHIFT) |
				XUSBPS_EPCR_TXR_MASK);
		((XUsbPs *)InstancePtr)->
			DeviceConfig.Ep[EpNum].In.BufferPtr = NULL;
		((XUsbPs *)InstancePtr)->
			DeviceConfig.Ep[EpNum].In.BytesTxed = 0;
		((XUsbPs *)InstancePtr)->
			DeviceConfig.Ep[EpNum].In.RequestedBytes = 0;
	}
	return XST_SUCCESS;
}
static s32 EpEnable ( XUsbPs * InstancePtr , u8 EpNum , u8 Dir , u16 Maxsize , u8 Type ) { ( void ) Maxsize ; XUsbPs_EpEnable ( ( XUsbPs * ) InstancePtr , EpNum , Dir ) ; if ( Dir == XUSBPS_EP_DIRECTION_OUT ) { XUsbPs_ClrBits ( ( XUsbPs * ) InstancePtr , XUSBPS_EPCRn_OFFSET ( EpNum ) , XUSBPS_EPCR_RXT_TYPE_MASK | XUSBPS_EPCR_RXR_MASK | XUSBPS_EPCR_RXS_MASK ) ; XUsbPs_SetBits ( ( XUsbPs * ) InstancePtr , XUSBPS_EPCRn_OFFSET ( EpNum ) , ( ( Type - 1 ) << XUSBPS_EPCR_RXT_TYPE_SHIFT ) | XUSBPS_EPCR_RXR_MASK ) ; XUsbPs_EpPrime ( ( XUsbPs * ) InstancePtr , EpNum , Dir ) ; ( ( XUsbPs * ) InstancePtr ) -> DeviceConfig . Ep [ EpNum ] . Out . MemAlloted = 0 ; ( ( XUsbPs * ) InstancePtr ) -> DeviceConfig . Ep [ EpNum ] . Out . BufferPtr = NULL ; ( ( XUsbPs * ) InstancePtr ) -> DeviceConfig . Ep [ EpNum ] . Out . BytesTxed = 0 ; ( ( XUsbPs * ) InstancePtr ) -> DeviceConfig . Ep [ EpNum ] . Out . RequestedBytes = 0 ; } else { XUsbPs_ClrBits ( ( XUsbPs * ) InstancePtr , XUSBPS_EPCRn_OFFSET ( EpNum ) , XUSBPS_EPCR_TXT_TYPE_MASK | XUSBPS_EPCR_TXR_MASK | XUSBPS_EPCR_TXS_MASK ) ; XUsbPs_SetBits ( ( XUsbPs * ) InstancePtr , XUSBPS_EPCRn_OFFSET ( EpNum ) , ( ( Type - 1 ) << XUSBPS_EPCR_TXT_TYPE_SHIFT ) | XUSBPS_EPCR_TXR_MASK ) ; ( ( XUsbPs * ) InstancePtr ) -> DeviceConfig . Ep [ EpNum ] . In . BufferPtr = NULL ; ( ( XUsbPs * ) InstancePtr ) -> DeviceConfig . Ep [ EpNum ] . In . BytesTxed = 0 ; ( ( XUsbPs * ) InstancePtr ) -> DeviceConfig . Ep [ EpNum ] . In . RequestedBytes = 0 ; } return XST_SUCCESS ; }
Enable the respective Endpoint
 @param       InstancePtr is a private member of Usb_DevData instance.
Enable the respective Endpoint @param InstancePtr is a private member of Usb_DevData instance .
/* Set BULK mode for both directions.  */ /* Prime the OUT endpoint. */