diff options
Diffstat (limited to 'include/linux/usb/video.h')
-rw-r--r-- | include/linux/usb/video.h | 404 |
1 files changed, 404 insertions, 0 deletions
diff --git a/include/linux/usb/video.h b/include/linux/usb/video.h index be436d9ee479..3b3b95e01f71 100644 --- a/include/linux/usb/video.h +++ b/include/linux/usb/video.h | |||
@@ -160,5 +160,409 @@ | |||
160 | #define UVC_STATUS_TYPE_CONTROL 1 | 160 | #define UVC_STATUS_TYPE_CONTROL 1 |
161 | #define UVC_STATUS_TYPE_STREAMING 2 | 161 | #define UVC_STATUS_TYPE_STREAMING 2 |
162 | 162 | ||
163 | /* 2.4.3.3. Payload Header Information */ | ||
164 | #define UVC_STREAM_EOH (1 << 7) | ||
165 | #define UVC_STREAM_ERR (1 << 6) | ||
166 | #define UVC_STREAM_STI (1 << 5) | ||
167 | #define UVC_STREAM_RES (1 << 4) | ||
168 | #define UVC_STREAM_SCR (1 << 3) | ||
169 | #define UVC_STREAM_PTS (1 << 2) | ||
170 | #define UVC_STREAM_EOF (1 << 1) | ||
171 | #define UVC_STREAM_FID (1 << 0) | ||
172 | |||
173 | /* 4.1.2. Control Capabilities */ | ||
174 | #define UVC_CONTROL_CAP_GET (1 << 0) | ||
175 | #define UVC_CONTROL_CAP_SET (1 << 1) | ||
176 | #define UVC_CONTROL_CAP_DISABLED (1 << 2) | ||
177 | #define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3) | ||
178 | #define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4) | ||
179 | |||
180 | /* ------------------------------------------------------------------------ | ||
181 | * UVC structures | ||
182 | */ | ||
183 | |||
184 | /* All UVC descriptors have these 3 fields at the beginning */ | ||
185 | struct uvc_descriptor_header { | ||
186 | __u8 bLength; | ||
187 | __u8 bDescriptorType; | ||
188 | __u8 bDescriptorSubType; | ||
189 | } __attribute__((packed)); | ||
190 | |||
191 | /* 3.7.2. Video Control Interface Header Descriptor */ | ||
192 | struct uvc_header_descriptor { | ||
193 | __u8 bLength; | ||
194 | __u8 bDescriptorType; | ||
195 | __u8 bDescriptorSubType; | ||
196 | __u16 bcdUVC; | ||
197 | __u16 wTotalLength; | ||
198 | __u32 dwClockFrequency; | ||
199 | __u8 bInCollection; | ||
200 | __u8 baInterfaceNr[]; | ||
201 | } __attribute__((__packed__)); | ||
202 | |||
203 | #define UVC_DT_HEADER_SIZE(n) (12+(n)) | ||
204 | |||
205 | #define UVC_HEADER_DESCRIPTOR(n) \ | ||
206 | uvc_header_descriptor_##n | ||
207 | |||
208 | #define DECLARE_UVC_HEADER_DESCRIPTOR(n) \ | ||
209 | struct UVC_HEADER_DESCRIPTOR(n) { \ | ||
210 | __u8 bLength; \ | ||
211 | __u8 bDescriptorType; \ | ||
212 | __u8 bDescriptorSubType; \ | ||
213 | __u16 bcdUVC; \ | ||
214 | __u16 wTotalLength; \ | ||
215 | __u32 dwClockFrequency; \ | ||
216 | __u8 bInCollection; \ | ||
217 | __u8 baInterfaceNr[n]; \ | ||
218 | } __attribute__ ((packed)) | ||
219 | |||
220 | /* 3.7.2.1. Input Terminal Descriptor */ | ||
221 | struct uvc_input_terminal_descriptor { | ||
222 | __u8 bLength; | ||
223 | __u8 bDescriptorType; | ||
224 | __u8 bDescriptorSubType; | ||
225 | __u8 bTerminalID; | ||
226 | __u16 wTerminalType; | ||
227 | __u8 bAssocTerminal; | ||
228 | __u8 iTerminal; | ||
229 | } __attribute__((__packed__)); | ||
230 | |||
231 | #define UVC_DT_INPUT_TERMINAL_SIZE 8 | ||
232 | |||
233 | /* 3.7.2.2. Output Terminal Descriptor */ | ||
234 | struct uvc_output_terminal_descriptor { | ||
235 | __u8 bLength; | ||
236 | __u8 bDescriptorType; | ||
237 | __u8 bDescriptorSubType; | ||
238 | __u8 bTerminalID; | ||
239 | __u16 wTerminalType; | ||
240 | __u8 bAssocTerminal; | ||
241 | __u8 bSourceID; | ||
242 | __u8 iTerminal; | ||
243 | } __attribute__((__packed__)); | ||
244 | |||
245 | #define UVC_DT_OUTPUT_TERMINAL_SIZE 9 | ||
246 | |||
247 | /* 3.7.2.3. Camera Terminal Descriptor */ | ||
248 | struct uvc_camera_terminal_descriptor { | ||
249 | __u8 bLength; | ||
250 | __u8 bDescriptorType; | ||
251 | __u8 bDescriptorSubType; | ||
252 | __u8 bTerminalID; | ||
253 | __u16 wTerminalType; | ||
254 | __u8 bAssocTerminal; | ||
255 | __u8 iTerminal; | ||
256 | __u16 wObjectiveFocalLengthMin; | ||
257 | __u16 wObjectiveFocalLengthMax; | ||
258 | __u16 wOcularFocalLength; | ||
259 | __u8 bControlSize; | ||
260 | __u8 bmControls[3]; | ||
261 | } __attribute__((__packed__)); | ||
262 | |||
263 | #define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n)) | ||
264 | |||
265 | /* 3.7.2.4. Selector Unit Descriptor */ | ||
266 | struct uvc_selector_unit_descriptor { | ||
267 | __u8 bLength; | ||
268 | __u8 bDescriptorType; | ||
269 | __u8 bDescriptorSubType; | ||
270 | __u8 bUnitID; | ||
271 | __u8 bNrInPins; | ||
272 | __u8 baSourceID[0]; | ||
273 | __u8 iSelector; | ||
274 | } __attribute__((__packed__)); | ||
275 | |||
276 | #define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n)) | ||
277 | |||
278 | #define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ | ||
279 | uvc_selector_unit_descriptor_##n | ||
280 | |||
281 | #define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \ | ||
282 | struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \ | ||
283 | __u8 bLength; \ | ||
284 | __u8 bDescriptorType; \ | ||
285 | __u8 bDescriptorSubType; \ | ||
286 | __u8 bUnitID; \ | ||
287 | __u8 bNrInPins; \ | ||
288 | __u8 baSourceID[n]; \ | ||
289 | __u8 iSelector; \ | ||
290 | } __attribute__ ((packed)) | ||
291 | |||
292 | /* 3.7.2.5. Processing Unit Descriptor */ | ||
293 | struct uvc_processing_unit_descriptor { | ||
294 | __u8 bLength; | ||
295 | __u8 bDescriptorType; | ||
296 | __u8 bDescriptorSubType; | ||
297 | __u8 bUnitID; | ||
298 | __u8 bSourceID; | ||
299 | __u16 wMaxMultiplier; | ||
300 | __u8 bControlSize; | ||
301 | __u8 bmControls[2]; | ||
302 | __u8 iProcessing; | ||
303 | } __attribute__((__packed__)); | ||
304 | |||
305 | #define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n)) | ||
306 | |||
307 | /* 3.7.2.6. Extension Unit Descriptor */ | ||
308 | struct uvc_extension_unit_descriptor { | ||
309 | __u8 bLength; | ||
310 | __u8 bDescriptorType; | ||
311 | __u8 bDescriptorSubType; | ||
312 | __u8 bUnitID; | ||
313 | __u8 guidExtensionCode[16]; | ||
314 | __u8 bNumControls; | ||
315 | __u8 bNrInPins; | ||
316 | __u8 baSourceID[0]; | ||
317 | __u8 bControlSize; | ||
318 | __u8 bmControls[0]; | ||
319 | __u8 iExtension; | ||
320 | } __attribute__((__packed__)); | ||
321 | |||
322 | #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) | ||
323 | |||
324 | #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ | ||
325 | uvc_extension_unit_descriptor_##p_##n | ||
326 | |||
327 | #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ | ||
328 | struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ | ||
329 | __u8 bLength; \ | ||
330 | __u8 bDescriptorType; \ | ||
331 | __u8 bDescriptorSubType; \ | ||
332 | __u8 bUnitID; \ | ||
333 | __u8 guidExtensionCode[16]; \ | ||
334 | __u8 bNumControls; \ | ||
335 | __u8 bNrInPins; \ | ||
336 | __u8 baSourceID[p]; \ | ||
337 | __u8 bControlSize; \ | ||
338 | __u8 bmControls[n]; \ | ||
339 | __u8 iExtension; \ | ||
340 | } __attribute__ ((packed)) | ||
341 | |||
342 | /* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */ | ||
343 | struct uvc_control_endpoint_descriptor { | ||
344 | __u8 bLength; | ||
345 | __u8 bDescriptorType; | ||
346 | __u8 bDescriptorSubType; | ||
347 | __u16 wMaxTransferSize; | ||
348 | } __attribute__((__packed__)); | ||
349 | |||
350 | #define UVC_DT_CONTROL_ENDPOINT_SIZE 5 | ||
351 | |||
352 | /* 3.9.2.1. Input Header Descriptor */ | ||
353 | struct uvc_input_header_descriptor { | ||
354 | __u8 bLength; | ||
355 | __u8 bDescriptorType; | ||
356 | __u8 bDescriptorSubType; | ||
357 | __u8 bNumFormats; | ||
358 | __u16 wTotalLength; | ||
359 | __u8 bEndpointAddress; | ||
360 | __u8 bmInfo; | ||
361 | __u8 bTerminalLink; | ||
362 | __u8 bStillCaptureMethod; | ||
363 | __u8 bTriggerSupport; | ||
364 | __u8 bTriggerUsage; | ||
365 | __u8 bControlSize; | ||
366 | __u8 bmaControls[]; | ||
367 | } __attribute__((__packed__)); | ||
368 | |||
369 | #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) | ||
370 | |||
371 | #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ | ||
372 | uvc_input_header_descriptor_##n_##p | ||
373 | |||
374 | #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ | ||
375 | struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ | ||
376 | __u8 bLength; \ | ||
377 | __u8 bDescriptorType; \ | ||
378 | __u8 bDescriptorSubType; \ | ||
379 | __u8 bNumFormats; \ | ||
380 | __u16 wTotalLength; \ | ||
381 | __u8 bEndpointAddress; \ | ||
382 | __u8 bmInfo; \ | ||
383 | __u8 bTerminalLink; \ | ||
384 | __u8 bStillCaptureMethod; \ | ||
385 | __u8 bTriggerSupport; \ | ||
386 | __u8 bTriggerUsage; \ | ||
387 | __u8 bControlSize; \ | ||
388 | __u8 bmaControls[p][n]; \ | ||
389 | } __attribute__ ((packed)) | ||
390 | |||
391 | /* 3.9.2.2. Output Header Descriptor */ | ||
392 | struct uvc_output_header_descriptor { | ||
393 | __u8 bLength; | ||
394 | __u8 bDescriptorType; | ||
395 | __u8 bDescriptorSubType; | ||
396 | __u8 bNumFormats; | ||
397 | __u16 wTotalLength; | ||
398 | __u8 bEndpointAddress; | ||
399 | __u8 bTerminalLink; | ||
400 | __u8 bControlSize; | ||
401 | __u8 bmaControls[]; | ||
402 | } __attribute__((__packed__)); | ||
403 | |||
404 | #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) | ||
405 | |||
406 | #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ | ||
407 | uvc_output_header_descriptor_##n_##p | ||
408 | |||
409 | #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ | ||
410 | struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ | ||
411 | __u8 bLength; \ | ||
412 | __u8 bDescriptorType; \ | ||
413 | __u8 bDescriptorSubType; \ | ||
414 | __u8 bNumFormats; \ | ||
415 | __u16 wTotalLength; \ | ||
416 | __u8 bEndpointAddress; \ | ||
417 | __u8 bTerminalLink; \ | ||
418 | __u8 bControlSize; \ | ||
419 | __u8 bmaControls[p][n]; \ | ||
420 | } __attribute__ ((packed)) | ||
421 | |||
422 | /* 3.9.2.6. Color matching descriptor */ | ||
423 | struct uvc_color_matching_descriptor { | ||
424 | __u8 bLength; | ||
425 | __u8 bDescriptorType; | ||
426 | __u8 bDescriptorSubType; | ||
427 | __u8 bColorPrimaries; | ||
428 | __u8 bTransferCharacteristics; | ||
429 | __u8 bMatrixCoefficients; | ||
430 | } __attribute__((__packed__)); | ||
431 | |||
432 | #define UVC_DT_COLOR_MATCHING_SIZE 6 | ||
433 | |||
434 | /* 4.3.1.1. Video Probe and Commit Controls */ | ||
435 | struct uvc_streaming_control { | ||
436 | __u16 bmHint; | ||
437 | __u8 bFormatIndex; | ||
438 | __u8 bFrameIndex; | ||
439 | __u32 dwFrameInterval; | ||
440 | __u16 wKeyFrameRate; | ||
441 | __u16 wPFrameRate; | ||
442 | __u16 wCompQuality; | ||
443 | __u16 wCompWindowSize; | ||
444 | __u16 wDelay; | ||
445 | __u32 dwMaxVideoFrameSize; | ||
446 | __u32 dwMaxPayloadTransferSize; | ||
447 | __u32 dwClockFrequency; | ||
448 | __u8 bmFramingInfo; | ||
449 | __u8 bPreferedVersion; | ||
450 | __u8 bMinVersion; | ||
451 | __u8 bMaxVersion; | ||
452 | } __attribute__((__packed__)); | ||
453 | |||
454 | /* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */ | ||
455 | struct uvc_format_uncompressed { | ||
456 | __u8 bLength; | ||
457 | __u8 bDescriptorType; | ||
458 | __u8 bDescriptorSubType; | ||
459 | __u8 bFormatIndex; | ||
460 | __u8 bNumFrameDescriptors; | ||
461 | __u8 guidFormat[16]; | ||
462 | __u8 bBitsPerPixel; | ||
463 | __u8 bDefaultFrameIndex; | ||
464 | __u8 bAspectRatioX; | ||
465 | __u8 bAspectRatioY; | ||
466 | __u8 bmInterfaceFlags; | ||
467 | __u8 bCopyProtect; | ||
468 | } __attribute__((__packed__)); | ||
469 | |||
470 | #define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27 | ||
471 | |||
472 | /* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */ | ||
473 | struct uvc_frame_uncompressed { | ||
474 | __u8 bLength; | ||
475 | __u8 bDescriptorType; | ||
476 | __u8 bDescriptorSubType; | ||
477 | __u8 bFrameIndex; | ||
478 | __u8 bmCapabilities; | ||
479 | __u16 wWidth; | ||
480 | __u16 wHeight; | ||
481 | __u32 dwMinBitRate; | ||
482 | __u32 dwMaxBitRate; | ||
483 | __u32 dwMaxVideoFrameBufferSize; | ||
484 | __u32 dwDefaultFrameInterval; | ||
485 | __u8 bFrameIntervalType; | ||
486 | __u32 dwFrameInterval[]; | ||
487 | } __attribute__((__packed__)); | ||
488 | |||
489 | #define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n)) | ||
490 | |||
491 | #define UVC_FRAME_UNCOMPRESSED(n) \ | ||
492 | uvc_frame_uncompressed_##n | ||
493 | |||
494 | #define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \ | ||
495 | struct UVC_FRAME_UNCOMPRESSED(n) { \ | ||
496 | __u8 bLength; \ | ||
497 | __u8 bDescriptorType; \ | ||
498 | __u8 bDescriptorSubType; \ | ||
499 | __u8 bFrameIndex; \ | ||
500 | __u8 bmCapabilities; \ | ||
501 | __u16 wWidth; \ | ||
502 | __u16 wHeight; \ | ||
503 | __u32 dwMinBitRate; \ | ||
504 | __u32 dwMaxBitRate; \ | ||
505 | __u32 dwMaxVideoFrameBufferSize; \ | ||
506 | __u32 dwDefaultFrameInterval; \ | ||
507 | __u8 bFrameIntervalType; \ | ||
508 | __u32 dwFrameInterval[n]; \ | ||
509 | } __attribute__ ((packed)) | ||
510 | |||
511 | /* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */ | ||
512 | struct uvc_format_mjpeg { | ||
513 | __u8 bLength; | ||
514 | __u8 bDescriptorType; | ||
515 | __u8 bDescriptorSubType; | ||
516 | __u8 bFormatIndex; | ||
517 | __u8 bNumFrameDescriptors; | ||
518 | __u8 bmFlags; | ||
519 | __u8 bDefaultFrameIndex; | ||
520 | __u8 bAspectRatioX; | ||
521 | __u8 bAspectRatioY; | ||
522 | __u8 bmInterfaceFlags; | ||
523 | __u8 bCopyProtect; | ||
524 | } __attribute__((__packed__)); | ||
525 | |||
526 | #define UVC_DT_FORMAT_MJPEG_SIZE 11 | ||
527 | |||
528 | /* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */ | ||
529 | struct uvc_frame_mjpeg { | ||
530 | __u8 bLength; | ||
531 | __u8 bDescriptorType; | ||
532 | __u8 bDescriptorSubType; | ||
533 | __u8 bFrameIndex; | ||
534 | __u8 bmCapabilities; | ||
535 | __u16 wWidth; | ||
536 | __u16 wHeight; | ||
537 | __u32 dwMinBitRate; | ||
538 | __u32 dwMaxBitRate; | ||
539 | __u32 dwMaxVideoFrameBufferSize; | ||
540 | __u32 dwDefaultFrameInterval; | ||
541 | __u8 bFrameIntervalType; | ||
542 | __u32 dwFrameInterval[]; | ||
543 | } __attribute__((__packed__)); | ||
544 | |||
545 | #define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n)) | ||
546 | |||
547 | #define UVC_FRAME_MJPEG(n) \ | ||
548 | uvc_frame_mjpeg_##n | ||
549 | |||
550 | #define DECLARE_UVC_FRAME_MJPEG(n) \ | ||
551 | struct UVC_FRAME_MJPEG(n) { \ | ||
552 | __u8 bLength; \ | ||
553 | __u8 bDescriptorType; \ | ||
554 | __u8 bDescriptorSubType; \ | ||
555 | __u8 bFrameIndex; \ | ||
556 | __u8 bmCapabilities; \ | ||
557 | __u16 wWidth; \ | ||
558 | __u16 wHeight; \ | ||
559 | __u32 dwMinBitRate; \ | ||
560 | __u32 dwMaxBitRate; \ | ||
561 | __u32 dwMaxVideoFrameBufferSize; \ | ||
562 | __u32 dwDefaultFrameInterval; \ | ||
563 | __u8 bFrameIntervalType; \ | ||
564 | __u32 dwFrameInterval[n]; \ | ||
565 | } __attribute__ ((packed)) | ||
566 | |||
163 | #endif /* __LINUX_USB_VIDEO_H */ | 567 | #endif /* __LINUX_USB_VIDEO_H */ |
164 | 568 | ||