cancel
Showing results for 
Search instead for 
Did you mean: 

AI Discussions

jcalapiz
Journeyman III

vendor-specific descriptor for USB2 Device IP in VC707

Is it possible to configure the USB2 Device IP firmware into a vendor-specific class?

I'm trying to configure the descriptors as below, but the host PC couldn't enumerate the FPGA (VC707) when I try to program it.

The host PC was able to detect it as an unknown device, but it wasn't able to successfully enumerate it.
I tried to create a custom driver using libusb infwizard and updated the driver for the recognized unknown device, but it says that it is not compatible. 
Have I configured this incorrectly? Any thoughts? Thanks in advance!
 
jcalapiz_0-1737625124787.png

 

/******************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
 
/***************************** Include Files **********************************/
 
#include "xusb_cp9.h"
 
/************************** Constant Definitions ******************************/
 
#define VENDOR_SPECIFIC_PROTOCOL 0x00 //can be any value?
#define USB_CLASS_VENDOR_SPECIFIC           0xFF
#define HID_DESCR 0x21
 
/************************** Variable Definitions ******************************/
 
/*
 * Flags used to abort read and write command loops.
 */
extern u16 MaxControlSize;
extern USB_CMD_BUF Ch9_CmdBuf;
extern IntChar UsbMemData; /* Dual Port memory */
extern u32 AltSetting;
 
USB_STD_DEV_DESC DeviceDescriptor __attribute__ ((aligned (4))) = {
sizeof (USB_STD_DEV_DESC), /* Descriptor Size 18 bytes */
DEVICE_DESCR, /* This is a device descriptor */
#ifdef __LITTLE_ENDIAN__
0x0200, /* USB version */
#else
0x02, /* USB version */
#endif
    USB_CLASS_VENDOR_SPECIFIC, /* Vendor Specific */
USB_CLASS_VENDOR_SPECIFIC, /* Unused */
USB_CLASS_VENDOR_SPECIFIC, /* Unused */
0x40, /* Ep0 Max Pkt Size 64 bytes */
#ifdef __LITTLE_ENDIAN__
0x03FD, /* Vendor Id */
0x0300, /* Product Id */
0x0100, /* BCD device */
#else
0xFD03, /* Vendor Id */
0x0003, /* Product Id */
0x01, /* BCD device */
#endif
01, /* String Index of manufacturer */
02, /* String Index of product */
03, /* String Index of serial number */
01 /* Number of configurations */
 
};
 
USB_STD_QUAL_DESC QualifierDescriptor __attribute__ ((aligned(4))) = {
        sizeof(USB_STD_QUAL_DESC),
QUALIFIER_DESCR,
00,
02,
USB_CLASS_VENDOR_SPECIFIC,
USB_CLASS_VENDOR_SPECIFIC,
USB_CLASS_VENDOR_SPECIFIC,
0x40,
01,
0
};
 
 
/*
 * Full Speed mode USB
 */
FPGA1_CONFIGURATION  __attribute__ ((aligned (4))) FsUsbConfig  = {
 
/*
* Configuration descriptor.
*/
{
sizeof(USB_STD_CFG_DESC),/* Size of config descriptor 9 bytes */
CONFIG_DESCR, /* This is a conifig descriptor */
sizeof(FsUsbConfig), /* Total size of configuration LS */
0x00, /* Total size of configuration MS */
0x01, /* No. Of interfaces 1 */
CONFIGURATION_ONE, /* No of configuration values */
0x00, /* Configuration string */
0xc0, /* Self Powered */
0x02 /* Uses 2mA from the USB bus */
},
 
/*
* FPGA1 Class interface.
*/
{
sizeof(USB_STD_IF_DESC), /* Interface Descriptor size 9 bytes */
INTERFACE_DESCR, /* This is an interface descriptor */
0x00, /* Interface number 0 */
0x00, /* Alternate set 0 */
0x02, /* Number of end points 2 */
USB_CLASS_VENDOR_SPECIFIC, /* Vendor specific */
USB_CLASS_VENDOR_SPECIFIC, /* Interface sub class */
USB_CLASS_VENDOR_SPECIFIC, /* Vendor Specific */
0x00 /* Interface unused */
},
 
/*
* End_point  1 TX descriptor  from host to device.
*/
{
sizeof(USB_STD_EP_DESC), /* End point descriptor size */
ENDPOINT_DESCR, /* This is an end point descriptor */
0x01, /* End point one */
EP_INTERRUPT, /* End point type */
0x40, /* Maximum packet  size 64 bytes LS */
0x00, /* Maximum packetsize MS */
0x02 /* Nak rate */
},
 
/*
* End_point  2 RX descriptor  from device to host.
*/
{
sizeof(USB_STD_EP_DESC), /* End point descriptor size */
ENDPOINT_DESCR, /* This is an end point descriptor */
0x81, /* End point one */
EP_ISOCHRONOUS, /* End point type */
0x00, /* Maximum packet  size 1024 bytes LS */
0x02, /* Maximum packetsize MS */
0x00 /* Nak rate */
},
 
};
 
/*
 * High-speed mode USB
 */
 
FPGA1_CONFIGURATION  __attribute__ ((aligned (4))) HsUsbConfig  = {
 
/*
* Configuration descriptor.
*/
{
sizeof(USB_STD_CFG_DESC),/* Size of config descriptor 9 bytes */
CONFIG_DESCR, /* This is a conifig descriptor */
sizeof(HsUsbConfig), /* Total size of configuration LS */
0x00, /* Total size of configuration MS */
0x01, /* No. Of interfaces 1 */
CONFIGURATION_ONE, /* No of configuration values */
0x00, /* Configuration string */
0xc0, /* Self Powered */
0x01 /* Uses 2mA from the USB bus */
},
 
/*
* FPGA1 Class interface.
*/
{
sizeof(USB_STD_IF_DESC), /* Interface Descriptor size 9 bytes */
INTERFACE_DESCR, /* This is an interface descriptor */
0x00, /* Interface number 0 */
0x00, /* Alternate set 0 */
0x02, /* Number of end points 2 */
USB_CLASS_VENDOR_SPECIFIC, /* Vendor specific */
USB_CLASS_VENDOR_SPECIFIC, /* Interface sub class */
USB_CLASS_VENDOR_SPECIFIC, /* Vendor Specific */
0x00 /* Interface unused */
},
 
/*
* End_point  1 TX descriptor  from host to device.
*/
{
sizeof(USB_STD_EP_DESC), /* End point descriptor size */
ENDPOINT_DESCR, /* This is an end point descriptor */
0x01, /* End point one */
EP_INTERRUPT, /* End point type */
0x40, /* Maximum packet  size 64 bytes LS */
0x00, /* Maximum packetsize MS */
0x02 /* Nak rate */
},
 
/*
* End_point  2 RX descriptor  from device to host.
*/
{
sizeof(USB_STD_EP_DESC), /* End point descriptor size */
ENDPOINT_DESCR, /* This is an end point descriptor */
0x81, /* End point one */
EP_ISOCHRONOUS, /* End point type */
0x00, /* Maximum packet  size 1024 bytes LS */
0x04, /* Maximum packetsize MS */
0x00 /* Nak rate */
},
 
};
 
USB_STD_STRING_DESC LangId __attribute__ ((aligned (4))) =
{
/*
* Language ID codes.
*/
4, STRING_DESCR, {0x0904}
};
 
USB_STD_STRING_MAN_DESC Manufacturer __attribute__ ((aligned (4))) =
{
/*
* Manufacturer String.
*/
sizeof(USB_STD_STRING_MAN_DESC), STRING_DESCR,
{'X',0,'I',0,'L',0,'I',0,'N',0,'X',0,' ',0}
};
 
USB_STD_STRING_PS_DESC ProductString __attribute__ ((aligned (4))) =
{
/*
* Product ID String.
*/
sizeof(USB_STD_STRING_PS_DESC), STRING_DESCR,
{'F',0,'P',0,'G',0,'A',0,'1',0}
};
 
USB_STD_STRING_SN_DESC SerialNumber __attribute__ ((aligned (4))) =
{
/*
* Product ID String.
*/
sizeof(USB_STD_STRING_SN_DESC), STRING_DESCR,
{'0',0,'0',0,'0',0,'0',0,'0',0,'0',0,'0',0,'1',0,
'7',0,'1',0,'5',0,'0',0,'4',0,'2',0,'6',0,'2',0,
'0',0,'0',0,'5',0,'7',0,'4',0}
};
 
 
/************************** Function Prototypes *******************************/
void InitUsbInterface(XUsb * InstancePtr);
void UsbIfIntrHandler(void *CallBackRef, u32 IntrStatus);
void Ep0IntrHandler(void *CallBackRef, u8 EpNum, u32 IntrStatus);
void Ep1IntrHandler(void *CallBackRef, u8 EpNum, u32 IntrStatus);
void Ep2IntrHandler(void *CallBackRef, u8 EpNum, u32 IntrStatus);
void UsbDmaIntrHandler(void *CallBackRef, u32 IntrStatus);
 
#ifdef __cplusplus
}
#endif
 
 
 
 
 
 
 
 
 
Thanks,
Jib
 
0 Likes
0 Replies