📄 usbdesc.c
字号:
#if (UVC_VERSION == 0x0110)
0x00, // bmVideoStandards 0 none
#endif
/* Standard Interrupt Endpoint Descriptor */
// we use an interrupt endpoint for notification
USB_ENDPOINT_DESC_SIZE, // bLength 7
USB_ENDPOINT_DESCRIPTOR_TYPE, // bDescriptorType 5 (ENDPOINT)
USB_ENDPOINT_IN(1), // bEndpointAddress 0x81 EP 1 IN
USB_ENDPOINT_TYPE_INTERRUPT, // bmAttributes 3 interrupt transfer type
WBVAL(0x0008), // wMaxPacketSize 0x0008 1x 8 bytes
0x20, // bInterval 32 ms polling interval
/* Class-Specific Interrupt Endpoint Descriptor */
// mandatory if Standard Interrupt Endpoint is used
UVC_VC_ENDPOINT_DESC_SIZE, // bLength 5
CS_ENDPOINT, // bDescriptorType 0x25 (CS_ENDPOINT)
EP_INTERRUPT, // bDescriptorSubtype 3 (EP_INTERRUPT)
WBVAL(0x0008), // wMaxTransferSize 8 8-Byte status packet
/* Video Streaming Interface Descriptor */
/* Standard VS Interface Descriptor = interface 1 */
// alternate setting 0 = Zero Bandwidth
USB_INTERFACE_DESC_SIZE, // bLength 9
USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType 4
USB_UVC_VSIF_NUM, // bInterfaceNumber 1 index of this interface
0x00, // bAlternateSetting 0 index of this setting
0x00, // bNumEndpoints 0 no 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
/* Class-specific VS Header Descriptor (Input) */
UVC_VS_INTERFACE_INPUT_HEADER_DESC_SIZE(1,1),// bLength 14 13 + (1*1) (no specific controls used)
CS_INTERFACE, // bDescriptorType 36 (INTERFACE)
VS_INPUT_HEADER, // bDescriptorSubtype 5 (INPUT_HEADER)
0x01, // bNumFormats 1 one format descriptor follows
WBVAL( // wTotalLength header+frame/format descriptors
UVC_VS_INTERFACE_INPUT_HEADER_DESC_SIZE(1,1) +// VS input header
0x0B + // VS Format Descriptor
0x26 // VS Frame Descriptor
),
USB_ENDPOINT_IN(3), // bEndPointAddress 0x83 EP 3 IN
0x00, // bmInfo 0 no dynamic format change supported
0x03, // bTerminalLink 3 supplies terminal ID 3 (Output terminal)
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
WBVAL(0x0200), // wMaxPacketSize 0x03FF max packet 1024 bytes
0x01, // bInterval 1 one frame interval
/* Terminator */
0x00 // bLength 0
};
/* USB Configuration Descriptor */
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
const BYTE USB_HSConfigDescriptor[] = {
/* Configuration 1 */
USB_CONFIGUARTION_DESC_SIZE, // bLength 9
USB_CONFIGURATION_DESCRIPTOR_TYPE, // bDescriptorType 2
WBVAL( // wTotalLength
USB_CONFIGUARTION_DESC_SIZE + //
UVC_INTERFACE_ASSOCIATION_DESC_SIZE + //
USB_INTERFACE_DESC_SIZE + // VC interface
UVC_VC_INTERFACE_HEADER_DESC_SIZE(1) + // header + 1 interface
UVC_CAMERA_TERMINAL_DESC_SIZE(2) + // camera sensor + 2 controls
#ifdef COMPOSITE_VIDEO
UVC_INPUT_TERMINAL_DESC_SIZE(0) + // composite video input
#endif
UVC_OUTPUT_TERMINAL_DESC_SIZE(0) + //
#ifdef COMPOSITE_VIDEO
UVC_SELECTOR_UNIT_DESC_SIZE(2) + // selector + 2 input pins
#else
UVC_SELECTOR_UNIT_DESC_SIZE(1) + // selector + 1 input pins
#endif
UVC_PROCESSING_UNIT_DESC_SIZE(2) + // processing + 2 control bytes
USB_ENDPOINT_DESC_SIZE + // standard interrupt EP
UVC_VC_ENDPOINT_DESC_SIZE + // class-specific interrupt EP
USB_INTERFACE_DESC_SIZE + // VS interface alternate setting 0
UVC_VS_INTERFACE_INPUT_HEADER_DESC_SIZE(1,1) +// VS input header
0x0B + // VS Format Descriptor
0x26 + // VS Frame Descriptor
USB_INTERFACE_DESC_SIZE + // VS interface alternate setting 1
USB_ENDPOINT_DESC_SIZE + // Video data EP
0x0000 // der ganze Rest
),
0x02, // bNumInterfaces 2
0x01, // bConfigurationValue 1 ID of this configuration
0x00, // iConfiguration 0 no description available
USB_CONFIG_SELF_POWERED | // bmAttributes
USB_CONFIG_REMOTE_WAKEUP,
USB_CONFIG_POWER_MA(100), // bMaxPower 100 mA
/* Interface Association Descriptor */
UVC_INTERFACE_ASSOCIATION_DESC_SIZE, // bLength 8
USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE, // bDescriptorType 11
0x00, // bFirstInterface 0
0x02, // bInterfaceCount 2
CC_VIDEO, // bFunctionClass 14 Video
SC_VIDEO_INTERFACE_COLLECTION, // bFunctionSubClass 3 Video Interface Collection
PC_PROTOCOL_UNDEFINED, // bInterfaceProtocol 0 (protocol undefined)
0x04, // iFunction 4 LPC23xx UVC Device
/* VideoControl Interface Descriptor */
/* Standard VC Interface Descriptor = interface 0 */
USB_INTERFACE_DESC_SIZE, // bLength 9
USB_INTERFACE_DESCRIPTOR_TYPE, // bDescriptorType 4
USB_UVC_VCIF_NUM, // bInterfaceNumber 0 index of this interface
0x00, // bAlternateSetting 0 index of this setting
0x01, // bNumEndpoints 1 one interrupt endpoint
CC_VIDEO, // bInterfaceClass 14 Video
SC_VIDEOCONTROL, // bInterfaceSubClass 1 Video Control
PC_PROTOCOL_UNDEFINED, // bInterfaceProtocol 0 (protocol undefined)
0x04, // iFunction 4 LPC23xx UVC Device
/* Class-specific VC Interface Descriptor */
UVC_VC_INTERFACE_HEADER_DESC_SIZE(1), // bLength 13 12 + 1 (header + 1*interface
CS_INTERFACE, // bDescriptorType 36 (INTERFACE)
VC_HEADER, // bDescriptorSubtype 1 (HEADER)
WBVAL(UVC_VERSION), // bcdUVC 1.10 or 1.00
WBVAL( // wTotalLength header+units+terminals (no Endpoints)
UVC_VC_INTERFACE_HEADER_DESC_SIZE(1) + // header + 1 interface
UVC_CAMERA_TERMINAL_DESC_SIZE(2) + // camera sensor + 2 controls
#ifdef COMPOSITE_VIDEO
UVC_INPUT_TERMINAL_DESC_SIZE(0) + // composite video input
#endif
UVC_OUTPUT_TERMINAL_DESC_SIZE(0) + //
#ifdef COMPOSITE_VIDEO
UVC_SELECTOR_UNIT_DESC_SIZE(2) + // selector + 2 input pins
#else
UVC_SELECTOR_UNIT_DESC_SIZE(1) + // selector + 1 input pins
#endif
UVC_PROCESSING_UNIT_DESC_SIZE(2) // processing + 2 control bytes
),
DBVAL(0x005B8D80), // dwClockFrequency 6.000000 MHz
0x01, // bInCollection 1 one streaming interface
0x01, // baInterfaceNr( 0) 1 VS interface 1 belongs to this VC interface
/* Input Terminal Descriptor (Camera) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -