⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbdesc.c

📁 NXP LPC2378 USBUVC Demo
💻 C
📖 第 1 页 / 共 2 页
字号:
  0x01,                                      // bStillCaptureMethod      1 supports still image capture method1
  0x01,                                      // bTriggerSupport          1 HW trigger supported for still image capture
  0x00,                                      // bTriggerUsage            0 HW trigger initiate a still image capture
  0x01,                                      // bControlSize             1 one byte bmaControls field size
  0x00,                                      // bmaControls(0)           0 no VS specific controls

/* Class-specific VS Format Descriptor */
  0x0B,                                      // bLength                 11
  CS_INTERFACE,                              // bDescriptorType         36 (INTERFACE)
  VS_FORMAT_MJPEG,                           // bDescriptorSubtype       6 (VS_FORMAT_MJPEG)
  0x01,                                      // bFormatIndex             1 first (and only) format descriptor
  0x01,                                      // bNumFrameDescriptors     1 one frame descriptor follows
  0x01,                                      // bmFlags                  1 uses fixed size samples
  0x01,                                      // bDefaultFrameIndex       1 default frame index is 1
  0x00,                                      // bAspectRatioX            0 non-interlaced stream - not required
  0x00,                                      // bAspectRatioY            0 non-interlaced stream - not required
  0x00,                                      // bmInterlaceFlags         0 non-interlaced stream
  0x00,                                      // bCopyProtect             0 no restrictions

/* Class specific VS Frame Descriptor */
  0x26,                                      // bLength                 38
  CS_INTERFACE,                              // bDescriptorType         36 (INTERFACE)
  VS_FRAME_MJPEG,                            // bDescriptorSubtype       7 (VS_FRAME_MJPEG)
  0x01,                                      // bFrameIndex              1 first (and only) Frame Descripot
#if (UVC_VERSION == 0x0110)
  0x03,                                      // bmCapabilities        0x03 Still images using capture method 1, fixed frame rate
#else
  0x01,                                      // bmCapabilities        0x01 Still images using capture method 1
#endif
  WBVAL(0x00B0),                             // wWidth                 176 width of frame is 176 pixels
  WBVAL(0x0090),                             // wHeight                144 hight of frame is 144 pixels
  DBVAL(0x000DEC00),                         // dwMinBitRate        912384 min bit rate in bits/s
  DBVAL(0x000DEC00),                         // dwMaxBitRate        912384 max bit rate in bits/s
  DBVAL(0x00009480),                         // dwMaxVideoFrameBufferSize   38016 max video/still frame size in bytes
  DBVAL(0x000A2C2A),                         // dwDefaultFrameInterval     666666 default frame interval is 666666ns (15fps)
  0x00,                                      // bFrameIntervalType              0 continuous frame interval
  DBVAL(0x000A2C2A),                         // dwMinFrameInterval         666666 min frame interval is 666666ns (15fps) 
  DBVAL(0x000A2C2A),                         // dwMaxFrameInterval         666666 max frame interval is 666666ns (15fps)
  DBVAL(0x00000000),                         // dwFrameIntervalStep             0 no frame interval step supported

/* Standard VS Interface Descriptor  = interface 1 */
// alternate setting 1 = operational setting
  USB_INTERFACE_DESC_SIZE,                   // bLength                  9
  USB_INTERFACE_DESCRIPTOR_TYPE,             // bDescriptorType          4    
  USB_UVC_VSIF_NUM,                          // bInterfaceNumber         1 index of this interface
  0x01,                                      // bAlternateSetting        1 index of this setting
  0x01,                                      // bNumEndpoints            1 one EP used
  CC_VIDEO,                                  // bInterfaceClass         14 Video
  SC_VIDEOSTREAMING,                         // bInterfaceSubClass       2 Video Streaming
  PC_PROTOCOL_UNDEFINED,                     // bInterfaceProtocol       0 (protocol undefined)
  0x00,                                      // iInterface               0 no description available

/* Standard VS Isochronous Video data Endpoint Descriptor */
  USB_ENDPOINT_DESC_SIZE,                   // bLength                  7 
  USB_ENDPOINT_DESCRIPTOR_TYPE,             // bDescriptorType          5 (ENDPOINT)
  USB_ENDPOINT_IN(3),                       // bEndpointAddress      0x83 EP 3 IN
  USB_ENDPOINT_TYPE_ISOCHRONOUS |           // bmAttributes             5 isochronous transfer type
  USB_ENDPOINT_SYNC_ASYNCHRONOUS,           //                            asynchronous synchronizationtype
  WBVAL(0x01FE),                            // wMaxPacketSize      0x01FE max packet 510 bytes
  0x01,                                     // bInterval                1 one frame interval
/* Terminator */
  0x00                                      // bLength                  0
};



/* USB String Descriptor (optional) */
const BYTE xUSB_StringDescriptor[] = {
/* Index 0x00: LANGID Codes */
  0x04,                                     // bLength                  4
  USB_STRING_DESCRIPTOR_TYPE,               // bDescriptorType          3 (STRING)
  WBVAL(0x0409),                            // wLANGID             0x0409 US English

/* Index 0x04 (04): Manufacturer */
  0x1C,                                     // bLength                 28
  USB_STRING_DESCRIPTOR_TYPE,               // bDescriptorType          3 (STRING)
  'K',0,
  'e',0,
  'i',0,
  'l',0,
  ' ',0,
  'S',0,
  'o',0,
  'f',0,
  't',0,
  'w',0,
  'a',0,
  'r',0,
  'e',0,

/* Index 0x20 (32): Product */
  0x24,                                     // bLength                 36
  USB_STRING_DESCRIPTOR_TYPE,               // bDescriptorType          3 (STRING)
  'K',0,
  'e',0,
  'i',0,
  'l',0,
  ' ',0,
  'M',0,
  'C',0,
  'B',0,
  '2',0,
  '3',0,
  '0',0,
  '0',0,
  ' ',0,
  'U',0,
  'V',0,
  'C',0,
  ' ',0,

/* Index 0x44 (68): Serial Number */
  0x14,                                     // bLength                  20
  USB_STRING_DESCRIPTOR_TYPE,               // bDescriptorType          3 (STRING)
  'D',0,
  'e',0,
  'm',0,
  'o',0,
  ' ',0,
  '1',0,
  '.',0,
  '0',0,
  '0',0,

/* Index 0x58 (88): Interface Association Descriptor  */
  0x26,                                     // bLength                 38
  USB_STRING_DESCRIPTOR_TYPE,               // bDescriptorType          3 (STRING)
  'L',0,
  'P',0,
  'C',0,
  '2',0,
  '3',0,
  'x',0,
  'x',0,
  ' ',0,
  'U',0,
  'V',0,
  'C',0,
  ' ',0,
  'D',0,
  'e',0,
  'v',0,
  'i',0,
  'c',0,
  'e',0,
};

#define MAX_STRDESC_SIZE  0x26              // see IAD string
const BYTE USB_StringDescriptor[][MAX_STRDESC_SIZE] = { // zweidimensionales feld
  {
    /* Index 0x00: LANGID Codes */
    0x04,                                   // bLength                  4
    USB_STRING_DESCRIPTOR_TYPE,             // bDescriptorType          3 (STRING)
    WBVAL(0x0409)                          // wLANGID             0x0409 US English
  },
  {
    /* Index 0x01: Manufacturer */
    0x1C,                                   // bLength                 28
    USB_STRING_DESCRIPTOR_TYPE,             // bDescriptorType          3 (STRING)
    'K',0,
    'e',0,
    'i',0,
    'l',0,
    ' ',0,
    'S',0,
    'o',0,
    'f',0,
    't',0,
    'w',0,
    'a',0,
    'r',0,
    'e',0 
  },
  {
    /* Index 0x02: Product */
    0x24,                                   // bLength                 36
    USB_STRING_DESCRIPTOR_TYPE,             // bDescriptorType          3 (STRING)
    'K',0,
    'e',0,
    'i',0,
    'l',0,
    ' ',0,
    'M',0,
    'C',0,
    'B',0,
    '2',0,
    '3',0,
    '0',0,
    '0',0,
    ' ',0,
    'U',0,
    'V',0,
    'C',0,
    ' ',0
  },
  {
    /* Index 0x03: Serial Number */
    0x14,                                   // bLength                  20
    USB_STRING_DESCRIPTOR_TYPE,             // bDescriptorType          3 (STRING)
    'D',0,
    'e',0,
    'm',0,
    'o',0,
    ' ',0,
    '1',0,
    '.',0,
    '0',0,
    '0',0
  },
  {
    /* Index 0x04: Interface Association Descriptor  */
    0x26,                                   // bLength                 38
    USB_STRING_DESCRIPTOR_TYPE,             // bDescriptorType          3 (STRING)
    'L',0,
    'P',0,
    'C',0,
    '2',0,
    '3',0,
    'x',0,
    'x',0,
    ' ',0,
    'U',0,
    'V',0,
    'C',0,
    ' ',0,
    'D',0,
    'e',0,
    'v',0,
    'i',0,
    'c',0,
    'e',0
  },
  {
    /* Index 0x05: endof string  */
    0x04,                                   // bLength                  4
    USB_STRING_DESCRIPTOR_TYPE,             // bDescriptorType          3 (STRING)
    0,0
  }
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -