Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/include/drivers/usb/uvc.h need to be fixed.

0001 /*                    The Quest Operating System
0002  *  Copyright (C) 2005-2010  Richard West, Boston University
0003  *
0004  *  This program is free software: you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation, either version 3 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016  */
0017 
0018 #ifndef _UVC_H_
0019 #define _UVC_H_
0020 
0021 #include <types.h>
0022 
0023 #define USB_TYPE_IA_DESC    0x0B
0024 
0025 /* Video Device Class Codes */
0026 #define CC_VIDEO        0x0E
0027 
0028 #define SC_UNDEFINED                     0x00
0029 #define SC_VIDEOCONTROL                  0x01
0030 #define SC_VIDEOSTREAMING                0x02
0031 #define SC_VIDEO_INTERFACE_COLLECTION    0x03
0032 
0033 #define PC_PROTOCOL_UNDEFINED            0x00
0034 
0035 #define CS_UNDEFINED        0x20
0036 #define CS_DEVICE           0x21
0037 #define CS_CONFIGURATION    0x22
0038 #define CS_STRING           0x23
0039 #define CS_INTERFACE        0x24
0040 #define CS_ENDPOINT         0x25
0041 
0042 #define VC_DESCRIPTOR_UNDEFINED    0x00
0043 #define VC_HEADER                  0x01
0044 #define VC_INPUT_TERMINAL          0x02
0045 #define VC_OUTPUT_TERMINAL         0x03
0046 #define VC_SELECTOR_UNIT           0x04
0047 #define VC_PROCESSING_UNIT         0x05
0048 #define VC_EXTENSION_UNIT          0x06
0049 
0050 #define VS_UNDEFINED               0x00
0051 #define VS_INPUT_HEADER            0x01
0052 #define VS_OUTPUT_HEADER           0x02
0053 #define VS_STILL_IMAGE_FRAME       0x03
0054 #define VS_FORMAT_UNCOMPRESSED     0x04
0055 #define VS_FRAME_UNCOMPRESSED      0x05
0056 #define VS_FORMAT_MJPEG            0x06
0057 #define VS_FRAME_MJPEG             0x07
0058 #define VS_FORMAT_MPEG2TS          0x0A
0059 #define VS_FORMAT_DV               0x0C
0060 #define VS_COLOR_FORMAT            0x0D
0061 #define VS_FORMAT_FRAME_BASED      0x10
0062 #define VS_FRAME_FRAME_BASED       0x11
0063 #define VS_FORMAT_STREAM_BASED     0x12
0064 
0065 #define EP_UNDEFINED    0x00
0066 #define EP_GENERAL      0x01
0067 #define EP_ENDPOINT     0x02
0068 #define EP_INTERRUPT    0x03
0069 
0070 /* Video Class-Specific Request Codes */
0071 #define RC_UNDEFINED    0x00
0072 #define SET_CUR         0x01
0073 #define GET_CUR         0x81
0074 #define GET_MIN         0x82
0075 #define GET_MAX         0x83
0076 #define GET_RES         0x84
0077 #define GET_LEN         0x85
0078 #define GET_INFO        0x86
0079 #define GET_DEF         0x87
0080 
0081 /* VideoControl Interface Control Selectors */
0082 #define VC_CONTROL_UNDEFINED             0x00
0083 #define VC_VIDEO_POWER_MODE_CONTROL      0x01
0084 #define VC_REQUEST_ERROR_CODE_CONTROL    0x02
0085 
0086 /* Terminal Control Selectors */
0087 #define TE_CONTROL_UNDEFINED    0x00
0088 
0089 /* Selector Unit Control Selector */
0090 #define SU_CONTROL_UNDEFINED       0x00
0091 #define SU_INPUT_SELECT_CONTROL    0x01
0092 
0093 /* Camera Terminal Control Selectors */
0094 #define CT_CONTROL_UNDEFINED                 0x00
0095 #define CT_SCANNING_MODE_CONTROL             0x01
0096 #define CT_AE_MODE_CONTROL                   0x02
0097 #define CT_AE_PRIORITY_CONTROL               0x03
0098 #define CT_EXPOSURE_TIME_ABSOLUTE_CONTROL    0x04
0099 #define CT_EXPOSURE_TIME_RELATIVE_CONTROL    0x05
0100 #define CT_FOCUS_ABSOLUTE_CONTROL            0x06
0101 #define CT_FOCUS_RELATIVE_CONTROL            0x07
0102 #define CT_FOCUS_AUTO_CONTROL                0x08
0103 #define CT_IRIS_ABSOLUTE_CONTROL             0x09
0104 #define CT_IRIS_RELATIVE_CONTROL             0x0A
0105 #define CT_ZOOM_ABSOLUTE_CONTROL             0x0B
0106 #define CT_ZOOM_RELATIVE_CONTROL             0x0C
0107 #define CT_PANTILT_ABSOLUTE_CONTROL          0x0D
0108 #define CT_PANTILT_RELATIVE_CONTROL          0x0E
0109 #define CT_ROLL_ABSOLUTE_CONTROL             0x0F
0110 #define CT_ROLL_RELATIVE_CONTROL             0x10
0111 #define CT_PRIVACY_CONTROL                   0x11
0112 
0113 /* Processing Unit Control Selectors */
0114 #define PU_CONTROL_UNDEFINED                         0x00
0115 #define PU_BACKLIGHT_COMPENSATION_CONTROL            0x01
0116 #define PU_BRIGHTNESS_CONTROL                        0x02
0117 #define PU_CONTRAST_CONTROL                          0x03
0118 #define PU_GAIN_CONTROL                              0x04
0119 #define PU_POWER_LINE_FREQUENCY_CONTROL              0x05
0120 #define PU_HUE_CONTROL                               0x06
0121 #define PU_SATURATION_CONTROL                        0x07
0122 #define PU_SHARPNESS_CONTROL                         0x08
0123 #define PU_GAMMA_CONTROL                             0x09
0124 #define PU_WHITE_BALANCE_TEMPERATURE_CONTROL         0x0A
0125 #define PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL    0x0B
0126 #define PU_WHITE_BALANCE_COMPONENT_CONTROL           0x0C
0127 #define PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL      0x0D
0128 #define PU_DIGITAL_MULTIPLIER_CONTROL                0x0E
0129 #define PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL          0x0F
0130 #define PU_HUE_AUTO_CONTROL                          0x10
0131 #define PU_ANALOG_VIDEO_STANDARD_CONTROL             0x11
0132 #define PU_ANALOG_LOCK_STATUS_CONTROL                0x12
0133 
0134 /* Extension Unit Control Selectors */
0135 #define XU_CONTROL_UNDEFINED    0x00
0136 
0137 /* VideoStreaming Interface Control Selectors */
0138 #define VS_CONTROL_UNDEFINED               0x00
0139 #define VS_PROBE_CONTROL                   0x01
0140 #define VS_COMMIT_CONTROL                  0x02
0141 #define VS_STILL_PROBE_CONTROL             0x03
0142 #define VS_STILL_COMMIT_CONTROL            0x04
0143 #define VS_STILL_IMAGE_TRIGGER_CONTROL     0x05
0144 #define VS_STREAM_ERROR_CODE_CONTROL       0x06
0145 #define VS_GENERATE_KEY_FRAME_CONTROL      0x07
0146 #define VS_UPDATE_FRAME_SEGMENT_CONTROL    0x08
0147 #define VS_SYNCH_DELAY_CONTROL             0x09
0148 
0149 /*
0150  * UVC_IA_DESC : Standard Video Interface Collection IAD
0151  *
0152  * Reference :
0153  *     USB Device Class Definition for Video Devices
0154  *     Revision 1.1, Page 48
0155  */
0156 struct uvc_ia_desc
0157 {
0158   uint8_t bLength;
0159   uint8_t bDescriptorType;
0160   uint8_t bFirstInterface;
0161   uint8_t bInterfaceCount;
0162   uint8_t bFunctionClass;
0163   uint8_t bFunctionSubClass;
0164   uint8_t bFunctionProtocol;
0165   uint8_t iFunction;
0166 } __attribute__ ((packed));
0167 
0168 typedef struct uvc_ia_desc UVC_IA_DESC;
0169 
0170 /*
0171  * UVC_CSVC_IF_HDR_DESC : Class-Specific VC Interface Header
0172  * 
0173  * Reference :
0174  *     USB Device Class Definition for Video Devices
0175  *     Revision 1.1, Page 50 
0176  */
0177 struct uvc_csvc_if_hdr_desc
0178 {
0179   uint8_t bLength;
0180   uint8_t bDescriptorType;
0181   uint8_t bDescriptorSubType;
0182   uint16_t bcdUVC;
0183   uint16_t wTotalLength;
0184   uint32_t dwClockFrequency;
0185   uint8_t bInCollection;
0186   uint8_t baInterface1;
0187 } __attribute__ ((packed));
0188 
0189 typedef struct uvc_csvc_if_hdr_desc UVC_CSVC_IF_HDR_DESC;
0190 
0191 /*
0192  * UVC_IN_TERM_DESC : Input Terminal Descriptor
0193  * 
0194  * Reference :
0195  *     USB Device Class Definition for Video Devices
0196  *     Revision 1.1, Page 52
0197  */
0198 struct uvc_in_term_desc
0199 {
0200   uint8_t bLength;
0201   uint8_t bDescriptorType;
0202   uint8_t bDescriptorSubType;
0203   uint8_t bTerminalID;
0204   uint16_t wTerminalType;
0205   uint8_t bAssocTerminal;
0206   uint8_t iTerminal;
0207 } __attribute__ ((packed));
0208 
0209 typedef struct uvc_in_term_desc UVC_IN_TERM_DESC;
0210 
0211 /*
0212  * UVC_CSVS_IF_HDR_DESC : Class-Specific VS Interface Input Header
0213  * 
0214  * Reference :
0215  *     USB Device Class Definition for Video Devices
0216  *     Revision 1.1, Page 62
0217  */
0218 struct uvc_csvs_if_hdr_desc
0219 {
0220   uint8_t bLength;
0221   uint8_t bDescriptorType;
0222   uint8_t bDescriptorSubType;
0223   uint8_t bNumFormats;
0224   uint16_t wTotalLength;
0225   uint8_t bEndpointAddress;
0226   uint8_t bmInfo;
0227   uint8_t bTerminalLink;
0228   uint8_t bStillCaptureMethod;
0229   uint8_t bTriggerSupport;
0230   uint8_t bTriggerUsage;
0231   uint8_t bControlSize;
0232 } __attribute__ ((packed));
0233 
0234 typedef struct uvc_csvs_if_hdr_desc UVC_CSVS_IF_HDR_DESC;
0235 
0236 /*
0237  * UVC_OUT_TERM_DESC : Output Terminal Descriptor
0238  * 
0239  * Reference :
0240  *     USB Device Class Definition for Video Devices
0241  *     Revision 1.1, Page 53
0242  */
0243 struct uvc_out_term_desc
0244 {
0245   uint8_t bLength;
0246   uint8_t bDescriptorType;
0247   uint8_t bDescriptorSubType;
0248   uint8_t bTerminalID;
0249   uint16_t wTerminalType;
0250   uint8_t bAssocTerminal;
0251   uint8_t bSourceID;
0252   uint8_t iTerminal;
0253 } __attribute__ ((packed));
0254 
0255 typedef struct uvc_out_term_desc UVC_OUT_TERM_DESC;
0256 
0257 /*
0258  * UVC_VS_CTL_PAR_BLOCK : Parameter block of VS interface control request
0259  * 
0260  * Reference :
0261  *     USB Device Class Definition for Video Devices
0262  *     Revision 1.1, Page 103
0263  */
0264 struct uvc_vs_ctl_par_block
0265 {
0266   uint16_t bmHint;
0267   uint8_t bFormatIndex;
0268   uint8_t bFrameIndex;
0269   uint32_t dwFrameInterval;
0270   uint16_t wKeyFrameRate;
0271   uint16_t wPFrameRate;
0272   uint16_t wCompQuality;
0273   uint16_t wCompWindowSize;
0274   uint16_t wDelay;
0275   uint32_t dwMaxVideoFrameSize;
0276   uint32_t dwMaxPayloadTransferSize;
0277   uint32_t dwClockFrequency;
0278   uint8_t bmFramingInfo;
0279   uint8_t bPreferedVersion;
0280   uint8_t bMinVersion;
0281   uint8_t bMaxVersion;
0282 } __attribute__ ((packed));
0283 
0284 typedef struct uvc_vs_ctl_par_block UVC_VS_CTL_PAR_BLOCK;
0285 
0286 /*
0287  * UVC_MJPEG_FORMAT_DESC : M-JPEG Video Payload Format Descriptor
0288  * 
0289  * Reference :
0290  *     USB Device Class Definition for Video Devices:Motion-JPEG Payload
0291  *     Revision 1.1, Page 5
0292  */
0293 struct uvc_mjpeg_format_desc
0294 {
0295   uint8_t bLength;
0296   uint8_t bDescriptorType;
0297   uint8_t bDescriptorSubType;
0298   uint8_t bFormatIndex;
0299   uint8_t bNumFrameDescriptors;
0300   uint8_t bmFlags;
0301   uint8_t bDefaultFrameIndex;
0302   uint8_t bAspectRatioX;
0303   uint8_t bAspectRatioY;
0304   uint8_t bmInterlaceFlags;
0305   uint8_t bCopyProtect;
0306 } __attribute__ ((packed));
0307 
0308 typedef struct uvc_mjpeg_format_desc UVC_MJPEG_FORMAT_DESC;
0309 
0310 /*
0311  * UVC_MJPEG_FRAME_DESC : M-JPEG Video Payload Frame Descriptor
0312  * 
0313  * Reference :
0314  *     USB Device Class Definition for Video Devices:Motion-JPEG Payload
0315  *     Revision 1.1, Page 6-7
0316  */
0317 struct uvc_mjpeg_frame_desc
0318 {
0319   uint8_t bLength;
0320   uint8_t bDescriptorType;
0321   uint8_t bDescriptorSubType;
0322   uint8_t bFrameIndex;
0323   uint8_t bmCapabilities;
0324   uint16_t wWidth;
0325   uint16_t wHeight;
0326   uint32_t dwMinBitRate;
0327   uint32_t dwMaxBitRate;
0328   uint32_t dwMaxVideoFrameBufferSize;
0329   uint32_t dwDefaultFrameInterval;
0330   uint8_t bFrameIntervalType;
0331 } __attribute__ ((packed));
0332 
0333 typedef struct uvc_mjpeg_frame_desc UVC_MJPEG_FRAME_DESC;
0334 
0335 extern bool usb_uvc_driver_init (void);
0336 
0337 #endif
0338 
0339 /*
0340  * Local Variables:
0341  * indent-tabs-mode: nil
0342  * mode: C
0343  * c-file-style: "gnu"
0344  * c-basic-offset: 2
0345  * End:
0346  */
0347 
0348 /* vi: set et sw=2 sts=2: */