Tuesday, October 21, 2014

UVC Descriptors for Enumeration - USB 2.0

/* Define this flag to add 720p10 support to USB 2.0 */
#define NEW_USB2_MODE

/* Standard High Speed Configuration Descriptor - USB 2.0 */
const uint8_t esUSBHSConfigDscr[] =
{
    /* Configuration descriptor */
    0x09,                           /* Descriptor size */
    CY_U3P_USB_CONFIG_DESCR,        /* Configuration descriptor type */
#ifdef NEW_USB2_MODE
    0xFA,0x00,                      /* Length of this descriptor and all sub descriptors */
#else
    0xDC,0x00,                      /* Length of this descriptor and all sub descriptors */
#endif
    0x02,                           /* Number of interfaces */
    0x01,                           /* Configuration number */
    0x00,                           /* COnfiguration string index */
    0x80,                           /* Config characteristics - bus powered */
    0xFA,                           /* Max power consumption of device (in 2mA unit) : 500mA */

    /* Interface association descriptor */
    0x08,                           /* Descriptor size */
    ES_INTF_ASSN_DSCR_TYPE,       /* Interface association descr type */
    0x00,                           /* I/f number of first video control i/f */
    0x02,                           /* Number of video streaming i/f */
    0x0E,                           /* CC_VIDEO : Video i/f class code */
    0x03,                           /* SC_VIDEO_INTERFACE_COLLECTION : subclass code */
    0x00,                           /* Protocol : not used */
    0x00,                           /* String desc index for interface */

    /* Standard video control interface descriptor */
    0x09,                           /* Descriptor size */
    CY_U3P_USB_INTRFC_DESCR,        /* Interface descriptor type */
    0x00,                           /* Interface number */
    0x00,                           /* Alternate setting number */
    0x01,                           /* Number of end points */
    0x0E,                           /* CC_VIDEO : Interface class */
    0x01,                           /* CC_VIDEOCONTROL : Interface sub class */
    0x00,                           /* Interface protocol code */
    0x00,                           /* Interface descriptor string index */

    /* Class specific VC interface header descriptor */
    0x0D,                           /* Descriptor size */
    0x24,                           /* Class Specific I/f header descriptor type */
    0x01,                           /* Descriptor sub type : VC_HEADER */
    0x00,0x01,                      /* Revision of class spec : 1.0 */
    0x50,0x00,                      /* Total size of class specific descriptors (till output terminal) */
    0x00,0x6C,0xDC,0x02,            /* Clock frequency : 48MHz */
    0x01,                           /* Number of streaming interfaces */
    0x01,                           /* Video streaming I/f 1 belongs to VC i/f */

    /* Input (camera) terminal descriptor */
    0x12,                           /* Descriptor size */
    0x24,                           /* Class specific interface desc type */
    0x02,                           /* Input Terminal Descriptor type */
    0x01,                           /* ID of this terminal */
    0x01,0x02,                      /* Camera terminal type */
    0x00,                           /* No association terminal */
    0x00,                           /* String desc index : not used */
    0x00,0x00,                      /* No optical zoom supported */
    0x00,0x00,                      /* No optical zoom supported */
    0x00,0x00,                      /* No optical zoom supported */
    0x03,                           /* Size of controls field for this terminal : 3 bytes */
    0x2A,0x00,0x02,                 /* No controls supported */

    /* Processing unit descriptor */
    0x0C,                           /* Descriptor size */
    0x24,                           /* Class specific interface desc type */
    0x05,                           /* Processing unit descriptor type */
    0x02,                           /* ID of this terminal */
    0x01,                           /* Source ID : 1 : conencted to input terminal */
    0x00,0x00,                      /* Digital multiplier */
    0x03,                           /* Size of controls field for this terminal : 3 bytes */
    0x5F,0x11,0x00,                 /* No controls supported */
    0x00,                           /* String desc index : not used */

    /* Extension unit descriptor */
    0x1C,                           /* Descriptor size */
    0x24,                           /* Class specific interface desc type */
    0x06,                           /* Extension unit descriptor type */
    0x03,                           /* ID of this terminal */
#if 1
    0x4A,0x00,0xA6,0x29,
    0x02,0xEB,0xAA,0x4D,
    0x82,0xDB,0x35,0x56,
    0x35,0x62,0xDE,0x9D,
#endif
#if 0
0xFF,0xFF,0xFF,0xFF,            /* 16 byte GUID */
0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,
#endif
0x01,                           /* Number of controls in this terminal */
0x01,                           /* Number of input pins in this terminal */
0x02,                           /* Source ID : 2 : Connected to Proc Unit */
0x03,                           /* Size of controls field for this terminal : 3 bytes */
    0x00,0x00,0x00,                 /* No controls supported */
    0x00,                           /* String desc index : not used */

    /* Output terminal descriptor */
    0x09,                           /* Descriptor size */
    0x24,                           /* Class specific interface desc type */
    0x03,                           /* Output terminal descriptor type */
    0x04,                           /* ID of this terminal */
    0x01,0x01,                      /* USB Streaming terminal type */
    0x00,                           /* No association terminal */
    0x03,                           /* Source ID : 3 : connected to extn unit */
    0x00,                           /* String desc index : not used */

    /* Video control status interrupt endpoint descriptor */
    0x07,                           /* Descriptor size */
    CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */
    ES_EP_CONTROL_STATUS,        /* Endpoint address and description */
    CY_U3P_USB_EP_INTR,             /* Interrupt end point type */
    0x40,0x00,                      /* Max packet size = 64 bytes */
    0x08,                           /* Servicing interval : 8ms */

    /* Class specific interrupt endpoint descriptor */
    0x05,                           /* Descriptor size */
    0x25,                           /* Class specific endpoint descriptor type */
    CY_U3P_USB_EP_INTR,             /* End point sub type */
    0x40,0x00,                      /* Max packet size = 64 bytes */

    /* Standard video streaming interface descriptor (alternate setting 0) */
    0x09,                           /* Descriptor size */
    CY_U3P_USB_INTRFC_DESCR,        /* Interface descriptor type */
    0x01,                           /* Interface number */
    0x00,                           /* Alternate setting number */
    0x00,                           /* Number of end points : zero bandwidth */
    0x0E,                           /* Interface class : CC_VIDEO */
    0x02,                           /* Interface sub class : CC_VIDEOSTREAMING */
    0x00,                           /* Interface protocol code : undefined */
    0x00,                           /* Interface descriptor string index */

    /* Class-specific video streaming input header descriptor */
    0x0E,                           /* Descriptor size */
    0x24,                           /* Class-specific VS i/f type */
    0x01,                           /* Descriptotor subtype : input header */
    0x01,                           /* 1 format desciptor follows */
#ifdef NEW_USB2_MODE
    0x6B,0x00,                      /* Total size of class specific VS descr */
#else
    0x4D,0x00,                      /* Total size of class specific VS descr */
#endif
    ES_EP_UVC_VIDEO,             /* EP address for ISO video data */
    0x01,                           /* No dynamic format change supported */
    0x04,                           /* Output terminal ID : 4 */
    0x02,                           /* Still image capture method 1 supported */
    0x01,                           /* Hardware trigger supported for still image */
    0x01,                           /* Hardware to initiate still image capture */
    0x01,                           /* Size of controls field : 1 byte */
    0x00,                           /* D2 : Compression quality supported */

    /* Class specific VS format descriptor */
    0x1B,                           /* Descriptor size */
    0x24,                           /* Class-specific VS i/f type */
    0x04,                           /* Descriptotor subtype : VS_FORMAT_MJPEG */
    0x01,                           /* Format desciptor index */
#ifdef NEW_USB2_MODE
    0x02,                           /* Number of frame descriptors */
#else
    0x01,                           /* 1 Frame desciptor follows */
#endif
0x59, 0x55, 0x59, 0x32, /* guid */
0x00, 0x00,
0x10, 0x00,
0x80, 0x00,
0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71,
0x10,                           /* bBitsPerPixel*/
    0x01,                           /* Default frame index is 1 */
    0x00,                           /* bAspectRatioX */
    0x00,                           /* bAspectRatioY */
    0x00,                           /* bmInterlaceFlags */
    0x00,                           /* bCopyProtect */

/* Class specific Uncompressed VS frame descriptor */
    /* VGA 30 FPS */
0x1E,   /* Descriptor size */
0x24,   /* Descriptor type*/
0x05,   /* Subtype: uncompressed frame I/F */
0x01,   /* Frame Descriptor Index */
0x00,   /* Still image capture method 1 supported, fixed frame rate */
0x80,0x02, /* Width in pixel */
0xE0,0x01, /* Height in pixel */
0x00,0x00,0x08,0xCA,            /* Min bit rate bits/s */
0x00,0x00,0x08,0xCA,            /* Min bit rate bits/s */
0x00,0x60,0x09,0x00,   /* Maximum video or still frame size in bytes(Deprecated)*/
0x15,0x16,0x05,0x00,            /* Default frame interval */
    0x01,                           /* Frame interval type : No of discrete intervals */
    0x15,0x16,0x05,0x00,            /* Frame interval 3 */

#ifdef NEW_USB2_MODE // KK
    // 720p10 USB Device descriptor for USB 2.0
    0x1E,   /* Descriptor size */
    0x24,   /* Descriptor type*/
    0x05,   /* Subtype: uncompressed frame I/F */
    0x02,   /* Frame Descriptor Index */
    0x00,   /* Still image capture method 1 supported, fixed frame rate */
    0x00,0x05, /* Width in pixel */
    0xD0,0x02, /* Height in pixel */
    0x00,0x00,0x08,0xCA,            /* Min bit rate bits/s */
    0x00,0x00,0x08,0xCA,            /* Min bit rate bits/s */
    0x00,0x20,0x1C,0x00,   /* Maximum video or still frame size in bytes(Deprecated)*/
    0x40,0x42,0x0F,0x00,            /* Default frame interval */
    0x01,                           /* Frame interval type : No of discrete intervals */
    0x40,0x42,0x0F,0x00,            /* Frame interval 3 */
#endif

/* Color matching descriptor */
0x06,
0x24,
0x0D,
0x00,
0x00,
0x00,

    /* Standard video streaming interface descriptor (Alternate Setting 1) */
    0x09,                           /* Descriptor size */
    CY_U3P_USB_INTRFC_DESCR,        /* Interface descriptor type */
    0x01,                           /* Interface number */
    0x01,                           /* Alternate setting number */
    0x01,                           /* Number of end points : 1 ISO EP */
    0x0E,                           /* Interface class : CC_VIDEO */
    0x02,                           /* Interface sub class : CC_VIDEOSTREAMING */
    0x00,                           /* Interface protocol code : Undefined */
    0x00,                           /* Interface descriptor string index */

    /* Endpoint descriptor for ISO streaming video data */
    0x07,                           /* Descriptor size */
    CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */
    ES_EP_UVC_VIDEO,             /* Endpoint address and description */
    0x05,                           /* ISO End point : Async */
    ES_EP_ISO_VIDEO_PKT_SIZE_L,  /* 1 transaction per microframe */
    ES_EP_ISO_VIDEO_PKT_SIZE_H,  /* ES_EP_ISO_VIDEO_PKT_SIZE max bytes */
    0x01,                            /* Servicing interval for data transfers */
};

1 comment:

Unknown said...

You want to Achieve in Embedded System and Technologies . We are Providing Industrial Training with 100% Job Opportunities in Core Industries. Sessions will be practical on Software as well as hardware. We are Providing on Microcontrollers such as 8051, PIC , AVR, ARM7, ARM9, ARM11 and RTOS with 100% Placement Assistance

Contact : +91-9940426826 / 044-26209369.

Website : www.bestembeddedsystemtraininginchennai.com


Embedded System Training in chennai
Embedded System Training Institute in chennai
Embedded Training in chennai
Best Embedded System Training in chennai
Embedded System Training in chennai
Best Embedded System Training Institutes in chennai
Embedded Training Institute in chennai