00001 #ifndef _USB_VIDEO_H_
00002 #define _USB_VIDEO_H_
00003
00004 #include <linux/kernel.h>
00005 #include <linux/videodev.h>
00006
00007
00008 #include "uvc_compat.h"
00009
00010
00011
00012
00013
00015
00016
00017 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
00018
00019 #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_PRIVATE_BASE+0)
00020 #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_PRIVATE_BASE+1)
00021 #define V4L2_CID_SHARPNESS (V4L2_CID_PRIVATE_BASE+2)
00022 #define V4L2_CID_HUE_AUTO (V4L2_CID_PRIVATE_BASE+3)
00023
00024 #define V4L2_CID_FOCUS_AUTO (V4L2_CID_PRIVATE_BASE+4)
00025 #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_PRIVATE_BASE+5)
00026 #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_PRIVATE_BASE+6)
00027
00028 #define V4L2_CID_PAN_RELATIVE (V4L2_CID_PRIVATE_BASE+7)
00029 #define V4L2_CID_TILT_RELATIVE (V4L2_CID_PRIVATE_BASE+8)
00030 #define V4L2_CID_PANTILT_RESET (V4L2_CID_PRIVATE_BASE+9)
00031
00032 #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_PRIVATE_BASE+10)
00033 #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_PRIVATE_BASE+11)
00034
00035 #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_PRIVATE_BASE+13)
00036
00037 #define V4L2_CID_PRIVATE_LAST V4L2_CID_WHITE_BALANCE_TEMPERATURE
00038
00039 #endif
00040
00041 #define V4L2_CID_WHITE_BALANCE_TEMPERATURE_AUTO (V4L2_CID_PRIVATE_BASE+12)
00042
00043
00044 #ifdef __KERNEL__
00045
00046
00047
00048
00049
00050
00051
00052 #define SC_UNDEFINED 0x00
00053 #define SC_VIDEOCONTROL 0x01
00054 #define SC_VIDEOSTREAMING 0x02
00055 #define SC_VIDEO_INTERFACE_COLLECTION 0x03
00056
00057 #define PC_PROTOCOL_UNDEFINED 0x00
00058
00059 #define CS_UNDEFINED 0x20
00060 #define CS_DEVICE 0x21
00061 #define CS_CONFIGURATION 0x22
00062 #define CS_STRING 0x23
00063 #define CS_INTERFACE 0x24
00064 #define CS_ENDPOINT 0x25
00065
00066
00067 #define VC_DESCRIPTOR_UNDEFINED 0x00
00068 #define VC_HEADER 0x01
00069 #define VC_INPUT_TERMINAL 0x02
00070 #define VC_OUTPUT_TERMINAL 0x03
00071 #define VC_SELECTOR_UNIT 0x04
00072 #define VC_PROCESSING_UNIT 0x05
00073 #define VC_EXTENSION_UNIT 0x06
00074
00075
00076 #define VS_UNDEFINED 0x00
00077 #define VS_INPUT_HEADER 0x01
00078 #define VS_OUTPUT_HEADER 0x02
00079 #define VS_STILL_IMAGE_FRAME 0x03
00080 #define VS_FORMAT_UNCOMPRESSED 0x04
00081 #define VS_FRAME_UNCOMPRESSED 0x05
00082 #define VS_FORMAT_MJPEG 0x06
00083 #define VS_FRAME_MJPEG 0x07
00084 #define VS_FORMAT_MPEG2TS 0x0a
00085 #define VS_FORMAT_DV 0x0c
00086 #define VS_COLORFORMAT 0x0d
00087 #define VS_FORMAT_FRAME_BASED 0x10
00088 #define VS_FRAME_FRAME_BASED 0x11
00089 #define VS_FORMAT_STREAM_BASED 0x12
00090
00091
00092 #define EP_UNDEFINED 0x00
00093 #define EP_GENERAL 0x01
00094 #define EP_ENDPOINT 0x02
00095 #define EP_INTERRUPT 0x03
00096
00097
00098 #define RC_UNDEFINED 0x00
00099 #define SET_CUR 0x01
00100 #define GET_CUR 0x81
00101 #define GET_MIN 0x82
00102 #define GET_MAX 0x83
00103 #define GET_RES 0x84
00104 #define GET_LEN 0x85
00105 #define GET_INFO 0x86
00106 #define GET_DEF 0x87
00107
00108
00109 #define VC_CONTROL_UNDEFINED 0x00
00110 #define VC_VIDEO_POWER_MODE_CONTROL 0x01
00111 #define VC_REQUEST_ERROR_CODE_CONTROL 0x02
00112
00113
00114 #define TE_CONTROL_UNDEFINED 0x00
00115
00116
00117 #define SU_CONTROL_UNDEFINED 0x00
00118 #define SU_INPUT_SELECT_CONTROL 0x01
00119
00120
00121 #define CT_CONTROL_UNDEFINED 0x00
00122 #define CT_SCANNING_MODE_CONTROL 0x01
00123 #define CT_AE_MODE_CONTROL 0x02
00124 #define CT_AE_PRIORITY_CONTROL 0x03
00125 #define CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04
00126 #define CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05
00127 #define CT_FOCUS_ABSOLUTE_CONTROL 0x06
00128 #define CT_FOCUS_RELATIVE_CONTROL 0x07
00129 #define CT_FOCUS_AUTO_CONTROL 0x08
00130 #define CT_IRIS_ABSOLUTE_CONTROL 0x09
00131 #define CT_IRIS_RELATIVE_CONTROL 0x0a
00132 #define CT_ZOOM_ABSOLUTE_CONTROL 0x0b
00133 #define CT_ZOOM_RELATIVE_CONTROL 0x0c
00134 #define CT_PANTILT_ABSOLUTE_CONTROL 0x0d
00135 #define CT_PANTILT_RELATIVE_CONTROL 0x0e
00136 #define CT_ROLL_ABSOLUTE_CONTROL 0x0f
00137 #define CT_ROLL_RELATIVE_CONTROL 0x10
00138 #define CT_PRIVACY_CONTROL 0x11
00139
00140
00141 #define PU_CONTROL_UNDEFINED 0x00
00142 #define PU_BACKLIGHT_COMPENSATION_CONTROL 0x01
00143 #define PU_BRIGHTNESS_CONTROL 0x02
00144 #define PU_CONTRAST_CONTROL 0x03
00145 #define PU_GAIN_CONTROL 0x04
00146 #define PU_POWER_LINE_FREQUENCY_CONTROL 0x05
00147 #define PU_HUE_CONTROL 0x06
00148 #define PU_SATURATION_CONTROL 0x07
00149 #define PU_SHARPNESS_CONTROL 0x08
00150 #define PU_GAMMA_CONTROL 0x09
00151 #define PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a
00152 #define PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b
00153 #define PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c
00154 #define PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d
00155 #define PU_DIGITAL_MULTIPLIER_CONTROL 0x0e
00156 #define PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f
00157 #define PU_HUE_AUTO_CONTROL 0x10
00158 #define PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11
00159 #define PU_ANALOG_LOCK_STATUS_CONTROL 0x12
00160
00161 #define LXU_MOTOR_PANTILT_RELATIVE_CONTROL 0x01
00162 #define LXU_MOTOR_PANTILT_RESET_CONTROL 0x02
00163
00164
00165 #define VS_CONTROL_UNDEFINED 0x00
00166 #define VS_PROBE_CONTROL 0x01
00167 #define VS_COMMIT_CONTROL 0x02
00168 #define VS_STILL_PROBE_CONTROL 0x03
00169 #define VS_STILL_COMMIT_CONTROL 0x04
00170 #define VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
00171 #define VS_STREAM_ERROR_CODE_CONTROL 0x06
00172 #define VS_GENERATE_KEY_FRAME_CONTROL 0x07
00173 #define VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
00174 #define VS_SYNC_DELAY_CONTROL 0x09
00175
00176 #define TT_VENDOR_SPECIFIC 0x0100
00177 #define TT_STREAMING 0x0101
00178
00179
00180 #define ITT_VENDOR_SPECIFIC 0x0200
00181 #define ITT_CAMERA 0x0201
00182 #define ITT_MEDIA_TRANSPORT_INPUT 0x0202
00183
00184
00185 #define OTT_VENDOR_SPECIFIC 0x0300
00186 #define OTT_DISPLAY 0x0301
00187 #define OTT_MEDIA_TRANSPORT_OUTPUT 0x0302
00188
00189 #define EXTERNAL_VENDOR_SPECIFIC 0x0400
00190 #define COMPOSITE_CONNECTOR 0x0401
00191 #define SVIDEO_CONNECTOR 0x0402
00192 #define COMPONENT_CONNECTOR 0x0403
00193
00194 #define UVC_ENTITY_IS_UNIT(entity) ((entity->type & 0xff00) == 0)
00195 #define UVC_ENTITY_IS_TERM(entity) ((entity->type & 0xff00) != 0)
00196 #define UVC_ENTITY_IS_ITERM(entity) ((entity->type & 0xff00) == ITT_VENDOR_SPECIFIC)
00197 #define UVC_ENTITY_IS_OTERM(entity) ((entity->type & 0xff00) == OTT_VENDOR_SPECIFIC)
00198
00199
00200
00201
00202 #define UVC_GUID_UVC_CAMERA {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
00203 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
00204 #define UVC_GUID_UVC_OUTPUT {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
00205 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}
00206 #define UVC_GUID_UVC_PROCESSING {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
00207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01}
00208 #define UVC_GUID_UVC_SELECTOR {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
00209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02}
00210
00211 #define UVC_GUID_LOGITECH_XU1 {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \
00212 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x1d}
00213 #define UVC_GUID_LOGITECH_XU2 {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \
00214 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x1e}
00215 #define UVC_GUID_LOGITECH_XU3 {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \
00216 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x1f}
00217 #define UVC_GUID_LOGITECH_MOTOR {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \
00218 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x56}
00219 #define UVC_GUID_LOGITECH_DEV_INFO \
00220 {0x82, 0x06, 0x61, 0x63, 0x70, 0x50, 0xab, 0x49, \
00221 0xb8, 0xcc, 0xb3, 0x85, 0x5e, 0x8d, 0x22, 0x1e}
00222
00223 #define UVC_GUID_FORMAT_MJPEG {0x4d, 0x4a, 0x50, 0x47, 0x00, 0x00, 0x10, 0x00, \
00224 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
00225 #define UVC_GUID_FORMAT_YUY2 {0x59, 0x55, 0x59, 0x32, 0x00, 0x00, 0x10, 0x00, \
00226 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
00227 #define UVC_GUID_FORMAT_NV12 {0x4e, 0x56, 0x31, 0x32, 0x00, 0x00, 0x10, 0x00, \
00228 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
00229
00230
00231
00232
00233
00234
00235 #define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 0)
00236
00237
00238 #define UVC_URBS 5
00239
00240 #define UVC_MAX_ISO_PACKETS 40
00241
00242 #define UVC_MAX_FRAME_SIZE (16*1024*1024)
00243
00244 #define UVC_MAX_VIDEO_BUFFERS 32
00245
00246 #define UVC_CTRL_TIMEOUT 300
00247
00248
00249 #define UVC_QUIRK_STATUS_INTERVAL 0x00000001
00250
00251
00252
00253
00254
00255 struct uvc_device;
00256
00257
00258
00259
00260 struct uvc_streaming_control {
00261 __u16 bmHint;
00262 __u8 bFormatIndex;
00263 __u8 bFrameIndex;
00264 __u32 dwFrameInterval;
00265 __u16 wKeyFrameRate;
00266 __u16 wPFrameRate;
00267 __u16 wCompQuality;
00268 __u16 wCompWindowSize;
00269 __u16 wDelay;
00270 __u32 dwMaxVideoFrameSize;
00271 __u32 dwMaxPayloadTransferSize;
00272 __u32 dwClockFrequency;
00273 __u8 bmFramingInfo;
00274 __u8 bPreferedVersion;
00275 __u8 bMinVersion;
00276 __u8 bMaxVersion;
00277 };
00278
00279 struct uvc_menu_info {
00280 __u32 index;
00281 __u8 name[32];
00282 };
00283
00284 struct uvc_control_info {
00285 struct list_head list;
00286 struct list_head mappings;
00287
00288 __u8 entity[16];
00289 __u8 index;
00290 __u8 selector;
00291
00292 __u8 size;
00293 __u8 flags;
00294 };
00295
00296
00297 enum uvc_control_data_type {
00298 UVC_CTRL_DATA_TYPE_RAW = 0,
00299 UVC_CTRL_DATA_TYPE_SIGNED,
00300 UVC_CTRL_DATA_TYPE_UNSIGNED,
00301 UVC_CTRL_DATA_TYPE_BOOLEAN,
00302 UVC_CTRL_DATA_TYPE_ENUM,
00303 UVC_CTRL_DATA_TYPE_BITMASK,
00304 };
00305
00306 struct uvc_control_mapping {
00307 struct list_head list;
00308
00309 struct uvc_control_info *ctrl;
00310
00311 __u32 id;
00312 __u8 name[32];
00313 __u8 entity[16];
00314 __u8 selector;
00315
00316 __u8 size;
00317 __u8 offset;
00318 enum v4l2_ctrl_type v4l2_type;
00319 enum uvc_control_data_type data_type;
00320
00321 struct uvc_menu_info *menu_info;
00322 __u32 menu_count;
00323 };
00324
00325 struct uvc_control {
00326 struct uvc_entity *entity;
00327 struct uvc_control_info *info;
00328
00329 __u8 index;
00330 __u8 dirty : 1,
00331 loaded : 1;
00332
00333 __u8 *data;
00334 };
00335
00336 struct uvc_format_desc {
00337 __u8 guid[16];
00338 __u32 fcc;
00339 };
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352 struct uvc_entity {
00353 struct list_head list;
00354
00355 __u8 id;
00356 __u16 type;
00357 char name[64];
00358
00359 union {
00360 struct {
00361 __u16 wObjectiveFocalLengthMin;
00362 __u16 wObjectiveFocalLengthMax;
00363 __u16 wOcularFocalLength;
00364 __u8 bControlSize;
00365 __u8 *bmControls;
00366 } camera;
00367
00368 struct {
00369 __u8 bSourceID;
00370 } output;
00371
00372 struct {
00373 __u8 bSourceID;
00374 __u16 wMaxMultiplier;
00375 __u8 bControlSize;
00376 __u8 *bmControls;
00377 __u8 bmVideoStandards;
00378 } processing;
00379
00380 struct {
00381 __u8 bNrInPins;
00382 __u8 *baSourceID;
00383 } selector;
00384
00385 struct {
00386 __u8 guidExtensionCode[16];
00387 __u8 bNumControls;
00388 __u8 bNrInPins;
00389 __u8 *baSourceID;
00390 __u8 bControlSize;
00391 __u8 *bmControls;
00392 __u8 *bmControlsType;
00393 } extension;
00394 };
00395
00396 unsigned int ncontrols;
00397 struct uvc_control *controls;
00398 };
00399
00400 struct uvc_frame {
00401 __u8 bFrameIndex;
00402 __u8 bmCapabilities;
00403 __u16 wWidth;
00404 __u16 wHeight;
00405 __u32 dwMinBitRate;
00406 __u32 dwMaxBitRate;
00407 __u32 dwMaxVideoFrameBufferSize;
00408 __u8 bFrameIntervalType;
00409 __u32 dwDefaultFrameInterval;
00410 __u32 *dwFrameInterval;
00411 };
00412
00413 struct uvc_format {
00414 __u8 type;
00415 __u8 index;
00416 __u8 bpp;
00417 __u8 colorspace;
00418 __u32 fcc;
00419 __u32 flags;
00420
00421 char name[32];
00422
00423 unsigned int nframes;
00424 struct uvc_frame *frame;
00425 };
00426
00427 struct uvc_input_header {
00428 __u8 bNumFormats;
00429 __u8 bEndpointAddress;
00430 __u8 bmInfo;
00431 __u8 bTerminalLink;
00432 __u8 bStillCaptureMethod;
00433 __u8 bTriggerSupport;
00434 __u8 bTriggerUsage;
00435 __u8 bControlSize;
00436 __u8 *bmaControls;
00437 };
00438
00439 struct uvc_output_header {
00440 };
00441
00442 struct uvc_streaming {
00443 struct list_head list;
00444
00445 struct usb_interface *intf;
00446 int intfnum;
00447 __u16 maxpsize;
00448
00449 union {
00450 struct uvc_input_header input;
00451 struct uvc_output_header output;
00452 };
00453
00454 unsigned int nformats;
00455 struct uvc_format *format;
00456
00457 struct uvc_streaming_control ctrl;
00458 struct uvc_format *cur_format;
00459 struct uvc_frame *cur_frame;
00460
00461 struct mutex mutex;
00462 };
00463
00464 enum uvc_stream_state {
00465 UVC_STREAM_OFF = 0,
00466 UVC_STREAM_INTERRUPT = 1,
00467 UVC_STREAM_ON = 2,
00468 };
00469
00470 enum uvc_buffer_state {
00471 UVC_BUF_STATE_IDLE = 0,
00472 UVC_BUF_STATE_QUEUED = 1,
00473 UVC_BUF_STATE_ACTIVE = 2,
00474 UVC_BUF_STATE_DONE = 3,
00475 UVC_BUF_STATE_ERROR = 4,
00476 };
00477
00478 struct uvc_buffer {
00479 unsigned int size;
00480 unsigned long vma_use_count;
00481 struct list_head stream;
00482
00483
00484 struct v4l2_buffer buf;
00485 struct list_head queue;
00486 wait_queue_head_t wait;
00487 enum uvc_buffer_state state;
00488 };
00489
00490 struct uvc_video_queue {
00491 void *mem;
00492 unsigned int streaming;
00493 __u32 sequence;
00494 __u8 last_fid;
00495
00496 unsigned int count;
00497 struct uvc_buffer buffer[UVC_MAX_VIDEO_BUFFERS];
00498 struct mutex mutex;
00499 spinlock_t irqlock;
00500
00501 struct list_head mainqueue;
00502 struct list_head irqqueue;
00503 };
00504
00505 struct uvc_video_device {
00506 struct uvc_device *dev;
00507 struct video_device *vdev;
00508 atomic_t active;
00509
00510 enum uvc_stream_state stream;
00511
00512 struct uvc_entity *iterm;
00513 struct uvc_entity *oterm;
00514 struct uvc_entity *processing;
00515 struct uvc_entity *extension[8];
00516 struct mutex ctrl_mutex;
00517
00518 struct uvc_video_queue queue;
00519
00520 struct uvc_streaming *streaming;
00521
00522 struct urb *urb[UVC_URBS];
00523 char *urb_buffer[UVC_URBS];
00524 };
00525
00526 enum uvc_device_state {
00527 UVC_DEV_DISCONNECTED = 1,
00528 };
00529
00530 struct uvc_device {
00531 struct usb_device *udev;
00532 struct usb_interface *intf;
00533 __u32 quirks;
00534 int intfnum;
00535
00536 enum uvc_device_state state;
00537 struct kref kref;
00538 struct list_head list;
00539
00540
00541 __u16 uvc_version;
00542 __u32 clock_frequency;
00543
00544 struct list_head entities;
00545
00546 struct uvc_video_device video;
00547
00548
00549 struct usb_host_endpoint *int_ep;
00550 struct urb *int_urb;
00551 __u8 status[16];
00552
00553
00554 struct list_head streaming;
00555 };
00556
00557 enum uvc_handle_state {
00558 UVC_HANDLE_PASSIVE = 0,
00559 UVC_HANDLE_ACTIVE = 1,
00560 };
00561
00562 struct uvc_fh {
00563 struct uvc_video_device *device;
00564 enum uvc_handle_state state;
00565 };
00566
00567 struct uvc_driver {
00568 struct usb_driver driver;
00569
00570 struct mutex open_mutex;
00571
00572 struct list_head devices;
00573 struct list_head controls;
00574 struct mutex ctrl_mutex;
00575 };
00576
00577
00578
00579
00580
00581 #define UVC_TRACE_PROBE (1 << 0)
00582 #define UVC_TRACE_DESCR (1 << 1)
00583 #define UVC_TRACE_CONTROL (1 << 2)
00584 #define UVC_TRACE_FORMAT (1 << 3)
00585 #define UVC_TRACE_CAPTURE (1 << 4)
00586 #define UVC_TRACE_CALLS (1 << 5)
00587 #define UVC_TRACE_IOCTL (1 << 6)
00588 #define UVC_TRACE_FRAME (1 << 7)
00589
00590 extern unsigned int uvc_trace_param;
00591
00592 #define uvc_trace(flag, msg...) \
00593 do { \
00594 if (uvc_trace_param & flag) \
00595 printk(KERN_DEBUG "uvcvideo: " msg); \
00596 } while(0)
00597
00598 #define uvc_printk(level, msg...) \
00599 printk(level "uvcvideo: " msg)
00600
00601 #define UVC_GUID_FORMAT "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"
00602 #define UVC_GUID_ARGS(guid) \
00603 (guid)[3], (guid)[2], (guid)[1], (guid)[0], \
00604 (guid)[5], (guid)[4], \
00605 (guid)[7], (guid)[6], \
00606 (guid)[8], (guid)[9], \
00607 (guid)[10], (guid)[11], (guid)[12], \
00608 (guid)[13], (guid)[14], (guid)[15]
00609
00610
00611
00612
00613
00614
00615 extern struct uvc_driver uvc_driver;
00616 extern void uvc_delete(struct kref *kref);
00617
00618
00619 extern void uvc_queue_init(struct uvc_video_queue *queue);
00620 extern int uvc_alloc_buffers(struct uvc_video_queue *queue,
00621 unsigned int nbuffers, unsigned int buflength);
00622 extern int uvc_free_buffers(struct uvc_video_queue *queue);
00623 extern void uvc_query_buffer(struct uvc_buffer *buf,
00624 struct v4l2_buffer *v4l2_buf);
00625 extern int uvc_queue_buffer(struct uvc_video_queue *queue,
00626 struct v4l2_buffer *v4l2_buf);
00627 extern int uvc_dequeue_buffer(struct uvc_video_queue *queue,
00628 struct v4l2_buffer *v4l2_buf, int nonblocking);
00629 extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable);
00630 extern void uvc_queue_cancel(struct uvc_video_queue *queue);
00631 extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
00632 struct uvc_buffer *buf);
00633
00634
00635 extern struct file_operations uvc_fops;
00636
00637
00638 extern int uvc_video_init(struct uvc_video_device *video);
00639 extern int uvc_video_enable(struct uvc_video_device *video, int enable);
00640 extern int uvc_probe_video(struct uvc_video_device *video,
00641 struct uvc_streaming_control *probe);
00642 extern int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit,
00643 __u8 intfnum, __u8 cs, void *data, __u16 size);
00644 extern int uvc_set_video_ctrl(struct uvc_video_device *video,
00645 struct uvc_streaming_control *ctrl, int probe);
00646 extern int uvc_init_status(struct uvc_device *dev);
00647
00648
00649 extern struct uvc_control *uvc_find_control(struct uvc_video_device *video,
00650 __u32 v4l2_id, struct uvc_control_mapping **mapping);
00651 extern int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
00652 struct v4l2_queryctrl *v4l2_ctrl);
00653
00654 extern void uvc_ctrl_add_info(struct uvc_control_info *info);
00655 extern int uvc_ctrl_init_device(struct uvc_device *dev);
00656 extern void uvc_ctrl_cleanup_device(struct uvc_device *dev);
00657 extern void uvc_ctrl_init(void);
00658
00659 extern int uvc_ctrl_begin(struct uvc_video_device *video);
00660 extern int __uvc_ctrl_commit(struct uvc_video_device *video, int rollback);
00661 static inline int uvc_ctrl_commit(struct uvc_video_device *video)
00662 {
00663 return __uvc_ctrl_commit(video, 0);
00664 }
00665 static inline int uvc_ctrl_rollback(struct uvc_video_device *video)
00666 {
00667 return __uvc_ctrl_commit(video, 1);
00668 }
00669
00670 extern int uvc_ctrl_get(struct uvc_video_device *video,
00671 struct v4l2_ext_control *xctrl);
00672 extern int uvc_ctrl_set(struct uvc_video_device *video,
00673 struct v4l2_ext_control *xctrl);
00674
00675
00676 extern void uvc_simplify_fraction(uint32_t *numerator, uint32_t *denominator,
00677 unsigned int n_terms, unsigned int threshold);
00678 extern uint32_t uvc_fraction_to_interval(uint32_t numerator,
00679 uint32_t denominator);
00680 extern struct usb_host_endpoint *uvc_find_endpoint(
00681 struct usb_host_interface *alts, __u8 epaddr);
00682
00684
00685 #endif
00686
00687 #endif
00688