XilinxProcessorIPLib/drivers/usbpsu/examples/xusb_ch9_composite.c
u32 Usb_Ch9SetupDevDescReply(struct Usb_DevData *InstancePtr, u8 *BufPtr,
		u32 BufLen)
{
	u8 Index;
	s32 Status;

	Status = IsSuperSpeed(InstancePtr);
	if (Status != XST_SUCCESS) {
		/* USB 2.0 */
		Index = 0;
	} else {
		/* USB 3.0 */
		Index = 1;
	}

	/* Check buffer pointer is there and buffer is big enough. */
	if (!BufPtr)
		return 0;

	if (BufLen < sizeof(USB_STD_DEV_DESC))
		return 0;

	memcpy(BufPtr, &deviceDesc[Index], sizeof(USB_STD_DEV_DESC));

	return sizeof(USB_STD_DEV_DESC);
}
/*****************************************************************************/
/**
*
* This function returns the device descriptor for the device.
*
* @param	InstancePtr is a pointer to the Usb_DevData instance.
* @param	BufPtr is pointer to the buffer that is to be filled
*		with the descriptor.
* @param	BufLen is the size of the provided buffer.
*
* @return	Length of the descriptor in the buffer on success.
*		0 on error.
*
******************************************************************************/
This function returns the device descriptor for the device.
This function returns the device descriptor for the device .
u32 Usb_Ch9SetupDevDescReply(struct Usb_DevData *InstancePtr, u8 *BufPtr,
		u32 BufLen)
{
	u8 Index;
	s32 Status;
	Status = IsSuperSpeed(InstancePtr);
	if (Status != XST_SUCCESS) {
		Index = 0;
	} else {
		Index = 1;
	}
	if (!BufPtr)
		return 0;
	if (BufLen < sizeof(USB_STD_DEV_DESC))
		return 0;
	memcpy(BufPtr, &deviceDesc[Index], sizeof(USB_STD_DEV_DESC));
	return sizeof(USB_STD_DEV_DESC);
}
u32 Usb_Ch9SetupDevDescReply ( struct Usb_DevData * InstancePtr , u8 * BufPtr , u32 BufLen ) { u8 Index ; s32 Status ; Status = IsSuperSpeed ( InstancePtr ) ; if ( Status != XST_SUCCESS ) { Index = 0 ; } else { Index = 1 ; } if ( ! BufPtr ) return 0 ; if ( BufLen < sizeof ( USB_STD_DEV_DESC ) ) return 0 ; memcpy ( BufPtr , & deviceDesc [ Index ] , sizeof ( USB_STD_DEV_DESC ) ) ; return sizeof ( USB_STD_DEV_DESC ) ; }
This function returns the device descriptor for the device.
This function returns the device descriptor for the device .
/* USB 2.0 */ /* USB 3.0 */ /* Check buffer pointer is there and buffer is big enough. */