?? usbdesc.c
字號(hào):
/*----------------------------------------------------------------------------
* U S B - K e r n e l
*----------------------------------------------------------------------------
* Name: USBDESC.C
* Purpose: USB Descriptors
* Version: V1.10
*----------------------------------------------------------------------------
* This software is supplied "AS IS" without any warranties, express,
* implied or statutory, including but not limited to the implied
* warranties of fitness for purpose, satisfactory quality and
* noninfringement. Keil extends you a royalty-free right to reproduce
* and distribute executable files created using this software for use
* on NXP LPC microcontroller devices only. Nothing else gives you
* the right to use this software.
*
* Copyright (c) 2005-2007 Keil Software.
*---------------------------------------------------------------------------*/
#include "type.h"
#include "usb.h"
#include "usbcfg.h"
#include "usbdesc.h"
#include "uvc.h"
/*----------------------------------------------------------------------------
* based on
* USB Device Class Definition for Video Devices: Video Device Examples
*---------------------------------------------------------------------------*/
/* USB Standard Device Descriptor */
const BYTE USB_DeviceDescriptor[] = {
USB_DEVICE_DESC_SIZE, // bLength 18
USB_DEVICE_DESCRIPTOR_TYPE, // bDescriptorType 1
WBVAL(0x0200), // bcdUSB 2.00
UVC_DEVICE_CLASS_MISCELLANEOUS, // bDeviceClass 239 Miscellaneous Device
UVC_DEVICE_SUBCLASS, // bDeviceSubClass 2 Common Class
UVC_DEVICE_PROTOCOL, // bDeviceProtocol 1 Interface Association
USB_MAX_PACKET0, // bMaxPacketSize0
WBVAL(0x04CC), // idVendor
WBVAL(0x2B08), // idProduct NXP Semiconduc., Video Device
WBVAL(0x0100), // bcdDevice 1.00
0x04, /* iManufacturer */
0x20, /* iProduct */
0x46, /* iSerialNumber */
0x01 // bNumConfigurations 1
};
/* USB Configuration Descriptor */
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
const BYTE USB_FSConfigDescriptor[] = {
/* 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) */
UVC_CAMERA_TERMINAL_DESC_SIZE(2), // bLength 17 15 + 2 controls
CS_INTERFACE, // bDescriptorType 36 (INTERFACE)
VC_INPUT_TERMINAL, // bDescriptorSubtype 2 (INPUT_TERMINAL)
0x01, // bTerminalID 1 ID of this Terminal
WBVAL(ITT_CAMERA), // wTerminalType 0x0201 Camera Sensor
0x00, // bAssocTerminal 0 no Terminal assiciated
0x00, // iTerminal 0 no description available
WBVAL(0x0000), // wObjectiveFocalLengthMin 0
WBVAL(0x0000), // wObjectiveFocalLengthMax 0
WBVAL(0x0000), // wOcularFocalLength 0
0x02, // bControlSize 2
0x00, 0x00, // bmControls 0x0000 no controls supported
#ifdef COMPOSITE_VIDEO
/* Input Terminal Descriptor (Composite) */
UVC_INPUT_TERMINAL_DESC_SIZE(0), // bLength 8
CS_INTERFACE, // bDescriptorType 36 (INTERFACE)
VC_INPUT_TERMINAL, // bDescriptorSubtype 2 (INPUT_TERMINAL)
0x02, // bTerminalID 2 ID of this Terminal
WBVAL(COMPOSITE_CONNECTOR), // wTerminalType 0x0401 Composite video input
0x00, // bAssocTerminal 0 no Terminal assiciated
0x00, // iTerminal 0 no description available
#endif
/* Output Terminal Descriptor */
UVC_OUTPUT_TERMINAL_DESC_SIZE(0), // bLength 9
CS_INTERFACE, // bDescriptorType 36 (INTERFACE)
VC_OUTPUT_TERMINAL, // bDescriptorSubtype 3 (OUTPUT_TERMINAL)
0x03, // bTerminalID 3 ID of this Terminal
WBVAL(TT_STREAMING), // wTerminalType 0x0101 USB streaming terminal
0x00, // bAssocTerminal 0 no Terminal assiciated
0x05, // bSourceID 5 input pin connected to output pin unit 5
0x00, // iTerminal 0 no description available
#ifdef COMPOSITE_VIDEO
/* Selector Unit Descriptor */
UVC_SELECTOR_UNIT_DESC_SIZE(2), // bLength 8 6 + 2 input pins
CS_INTERFACE, // bDescriptorType 36 (INTERFACE)
VC_SELECTOR_UNIT, // bDescriptorSubtype 4 (SELECTOR UNIT)
0x04, // bUnitID 4
0x02, // bNrInPins 2
0x01, // baSourceID(0) 1 see Input Terminal Descriptor (Camera)
0x02, // baSourceID(1) 2 see Input Terminal Descriptor (Composite)
0x00, // iSelector 0 no description available
#else
/* Selector Unit Descriptor */
UVC_SELECTOR_UNIT_DESC_SIZE(1), // bLength 8 6 + 1 input pins
CS_INTERFACE, // bDescriptorType 36 (INTERFACE)
VC_SELECTOR_UNIT, // bDescriptorSubtype 4 (SELECTOR UNIT)
0x04, // bUnitID 4
0x01, // bNrInPins 1
0x01, // baSourceID(0) 1 see Input Terminal Descriptor (Camera)
0x00, // iSelector 0 no description available
#endif
/* Processing Unit Descriptor */
UVC_PROCESSING_UNIT_DESC_SIZE(2), // bLength 12 10 + 2 control bytes
CS_INTERFACE, // bDescriptorType 36 (INTERFACE)
VC_PROCESSING_UNIT, // bDescriptorSubtype 5 (PROCESSING_UNIT)
0x05, // bUnitID 5
0x04, // bSourceID 4 input pin connected to output pin unit 4
WBVAL(0x0000), // wMaxMultiplier 0 not used
0x02, // bControlSize 2 two control bytes
WBVAL(0x0001), // bmControls 0x0001 Brightness
0x00, // iProcessing 0 no description available
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -