16
16
* - USB Device Class Definition for Video Devices: Motion-JPEG Payload (Revision 1.5)
17
17
*/
18
18
19
- #ifndef ZEPHYR_INCLUDE_USBD_CLASS_UVC_H_
20
- #define ZEPHYR_INCLUDE_USBD_CLASS_UVC_H_
19
+ #ifndef ZEPHYR_INCLUDE_USB_CLASS_UVC_H_
20
+ #define ZEPHYR_INCLUDE_USB_CLASS_UVC_H_
21
21
22
22
#include <zephyr/usb/usb_ch9.h>
23
23
24
24
/* Video Class-Specific Request Codes */
25
25
#define UVC_SET_CUR 0x01
26
26
#define UVC_GET_CUR 0x81
27
+ #define UVC_SET_CUR_ALL 0x11
27
28
#define UVC_GET_MIN 0x82
28
29
#define UVC_GET_MAX 0x83
29
30
#define UVC_GET_RES 0x84
30
31
#define UVC_GET_LEN 0x85
31
- #define UVC_GET_INFO 0x86
32
+ #define UVC_GET_INFO 0x86
32
33
#define UVC_GET_DEF 0x87
34
+ #define UVC_GET_CUR_ALL 0x91
35
+ #define UVC_GET_MIN_ALL 0x92
36
+ #define UVC_GET_MAX_ALL 0x93
37
+ #define UVC_GET_RES_ALL 0x94
38
+ #define UVC_GET_DEF_ALL 0x97
33
39
34
40
/* Flags announcing which controls are supported */
35
41
#define UVC_INFO_SUPPORTS_GET BIT(0)
55
61
#define UVC_BMHEADERINFO_ERROR BIT(6)
56
62
#define UVC_BMHEADERINFO_END_OF_HEADER BIT(7)
57
63
64
+ /* Video Interface Class Codes */
65
+ #define UVC_SC_VIDEOCLASS 0x0E
58
66
/* Video Interface Subclass Codes */
59
67
#define UVC_SC_VIDEOCONTROL 0x01
60
68
#define UVC_SC_VIDEOSTREAMING 0x02
119
127
#define UVC_EXT_COMPONENT_CONNECTOR 0x0403
120
128
121
129
/* VideoStreaming Interface Controls */
130
+ #define UVC_VS_CONTROL_UNDEFINED 0x00
122
131
#define UVC_VS_PROBE_CONTROL 0x01
123
132
#define UVC_VS_COMMIT_CONTROL 0x02
124
133
#define UVC_VS_STILL_PROBE_CONTROL 0x03
138
147
#define UVC_SU_INPUT_SELECT_CONTROL 0x01
139
148
140
149
/* Camera Terminal Controls */
150
+ #define UVC_CT_CONTROL_UNDEFINED 0x00
141
151
#define UVC_CT_SCANNING_MODE_CONTROL 0x01
142
152
#define UVC_CT_AE_MODE_CONTROL 0x02
143
153
#define UVC_CT_AE_PRIORITY_CONTROL 0x03
202
212
#define UVC_EU_START_OR_STOP_LAYER_CONTROL 0x13
203
213
#define UVC_EU_ERROR_RESILIENCY_CONTROL 0x14
204
214
215
+ /* Processing Unit Control Bit Positions (for bmControls bitmap) */
216
+ #define UVC_PU_BMCONTROL_BRIGHTNESS BIT(0)
217
+ #define UVC_PU_BMCONTROL_CONTRAST BIT(1)
218
+ #define UVC_PU_BMCONTROL_HUE BIT(2)
219
+ #define UVC_PU_BMCONTROL_SATURATION BIT(3)
220
+ #define UVC_PU_BMCONTROL_SHARPNESS BIT(4)
221
+ #define UVC_PU_BMCONTROL_GAMMA BIT(5)
222
+ #define UVC_PU_BMCONTROL_WHITE_BALANCE_TEMPERATURE BIT(6)
223
+ #define UVC_PU_BMCONTROL_WHITE_BALANCE_COMPONENT BIT(7)
224
+ #define UVC_PU_BMCONTROL_BACKLIGHT_COMPENSATION BIT(8)
225
+ #define UVC_PU_BMCONTROL_GAIN BIT(9)
226
+ #define UVC_PU_BMCONTROL_POWER_LINE_FREQUENCY BIT(10)
227
+ #define UVC_PU_BMCONTROL_HUE_AUTO BIT(11)
228
+ #define UVC_PU_BMCONTROL_WHITE_BALANCE_TEMPERATURE_AUTO BIT(12)
229
+ #define UVC_PU_BMCONTROL_WHITE_BALANCE_COMPONENT_AUTO BIT(13)
230
+ #define UVC_PU_BMCONTROL_DIGITAL_MULTIPLIER BIT(14)
231
+ #define UVC_PU_BMCONTROL_DIGITAL_MULTIPLIER_LIMIT BIT(15)
232
+ #define UVC_PU_BMCONTROL_ANALOG_VIDEO_STANDARD BIT(16)
233
+ #define UVC_PU_BMCONTROL_ANALOG_LOCK_STATUS BIT(17)
234
+ #define UVC_PU_BMCONTROL_CONTRAST_AUTO BIT(18)
235
+ /* Bits 19-23 are reserved for future use */
236
+
237
+ /* Camera Terminal Control Bit Positions (for bmControls bitmap) */
238
+ #define UVC_CT_BMCONTROL_SCANNING_MODE BIT(0)
239
+ #define UVC_CT_BMCONTROL_AE_MODE BIT(1)
240
+ #define UVC_CT_BMCONTROL_AE_PRIORITY BIT(2)
241
+ #define UVC_CT_BMCONTROL_EXPOSURE_TIME_ABSOLUTE BIT(3)
242
+ #define UVC_CT_BMCONTROL_EXPOSURE_TIME_RELATIVE BIT(4)
243
+ #define UVC_CT_BMCONTROL_FOCUS_ABSOLUTE BIT(5)
244
+ #define UVC_CT_BMCONTROL_FOCUS_RELATIVE BIT(6)
245
+ #define UVC_CT_BMCONTROL_IRIS_ABSOLUTE BIT(7)
246
+ #define UVC_CT_BMCONTROL_IRIS_RELATIVE BIT(8)
247
+ #define UVC_CT_BMCONTROL_ZOOM_ABSOLUTE BIT(9)
248
+ #define UVC_CT_BMCONTROL_ZOOM_RELATIVE BIT(10)
249
+ #define UVC_CT_BMCONTROL_PAN_TILT_ABSOLUTE BIT(11)
250
+ #define UVC_CT_BMCONTROL_PAN_TILT_RELATIVE BIT(12)
251
+ #define UVC_CT_BMCONTROL_ROLL_ABSOLUTE BIT(13)
252
+ #define UVC_CT_BMCONTROL_ROLL_RELATIVE BIT(14)
253
+ /* Bits 15-16 are reserved */
254
+ #define UVC_CT_BMCONTROL_FOCUS_AUTO BIT(17)
255
+ #define UVC_CT_BMCONTROL_PRIVACY BIT(18)
256
+ #define UVC_CT_BMCONTROL_FOCUS_SIMPLE BIT(19)
257
+ #define UVC_CT_BMCONTROL_WINDOW BIT(20)
258
+ #define UVC_CT_BMCONTROL_REGION_OF_INTEREST BIT(21)
259
+ /* Bits 22-23 are reserved for future use */
260
+
205
261
/* Extension Unit Controls */
206
262
#define UVC_XU_BASE_CONTROL 0x00
207
263
@@ -222,7 +278,7 @@ struct uvc_control_header_descriptor {
222
278
uint16_t wTotalLength ;
223
279
uint32_t dwClockFrequency ;
224
280
uint8_t bInCollection ;
225
- uint8_t baInterfaceNr [1 ];
281
+ uint8_t baInterfaceNr [];
226
282
} __packed ;
227
283
228
284
struct uvc_unit_descriptor {
@@ -232,6 +288,16 @@ struct uvc_unit_descriptor {
232
288
uint8_t bUnitID ;
233
289
};
234
290
291
+ struct uvc_input_terminal_descriptor {
292
+ uint8_t bLength ;
293
+ uint8_t bDescriptorType ;
294
+ uint8_t bDescriptorSubType ;
295
+ uint8_t bTerminalID ;
296
+ uint16_t wTerminalType ;
297
+ uint8_t bAssocTerminal ;
298
+ uint8_t iTerminal ;
299
+ } __packed ;
300
+
235
301
struct uvc_output_terminal_descriptor {
236
302
uint8_t bLength ;
237
303
uint8_t bDescriptorType ;
@@ -307,10 +373,10 @@ struct uvc_extension_unit_descriptor {
307
373
uint8_t iExtension ;
308
374
} __packed ;
309
375
310
- struct uvc_stream_header_descriptor {
376
+ struct uvc_stream_input_header_descriptor {
311
377
uint8_t bLength ;
312
378
uint8_t bDescriptorType ;
313
- uint8_t bDescriptorSubtype ;
379
+ uint8_t bDescriptorSubType ;
314
380
uint8_t bNumFormats ;
315
381
uint16_t wTotalLength ;
316
382
uint8_t bEndpointAddress ;
@@ -320,6 +386,19 @@ struct uvc_stream_header_descriptor {
320
386
uint8_t bTriggerSupport ;
321
387
uint8_t bTriggerUsage ;
322
388
uint8_t bControlSize ;
389
+ uint8_t bmControls [];
390
+ } __packed ;
391
+
392
+ struct uvc_stream_output_header_descriptor {
393
+ uint8_t bLength ;
394
+ uint8_t bDescriptorType ;
395
+ uint8_t bDescriptorSubType ;
396
+ uint8_t bNumFormats ;
397
+ uint16_t wTotalLength ;
398
+ uint8_t bEndpointAddress ;
399
+ uint8_t bTerminalLink ;
400
+ uint8_t bControlSize ;
401
+ uint8_t bmControls [];
323
402
} __packed ;
324
403
325
404
struct uvc_frame_still_image_descriptor {
@@ -348,7 +427,7 @@ struct uvc_format_descriptor {
348
427
struct uvc_format_uncomp_descriptor {
349
428
uint8_t bLength ;
350
429
uint8_t bDescriptorType ;
351
- uint8_t bDescriptorSubtype ;
430
+ uint8_t bDescriptorSubType ;
352
431
uint8_t bFormatIndex ;
353
432
uint8_t bNumFrameDescriptors ;
354
433
uint8_t guidFormat [16 ];
@@ -363,7 +442,7 @@ struct uvc_format_uncomp_descriptor {
363
442
struct uvc_format_mjpeg_descriptor {
364
443
uint8_t bLength ;
365
444
uint8_t bDescriptorType ;
366
- uint8_t bDescriptorSubtype ;
445
+ uint8_t bDescriptorSubType ;
367
446
uint8_t bFormatIndex ;
368
447
uint8_t bNumFrameDescriptors ;
369
448
uint8_t bmFlags ;
@@ -375,10 +454,18 @@ struct uvc_format_mjpeg_descriptor {
375
454
uint8_t bCopyProtect ;
376
455
} __packed ;
377
456
457
+ struct uvc_format_descriptor_header {
458
+ uint8_t bLength ;
459
+ uint8_t bDescriptorType ;
460
+ uint8_t bDescriptorSubType ;
461
+ uint8_t bFormatIndex ;
462
+ uint8_t bNumFrameDescriptors ;
463
+ } __packed ;
464
+
378
465
struct uvc_frame_descriptor {
379
466
uint8_t bLength ;
380
467
uint8_t bDescriptorType ;
381
- uint8_t bDescriptorSubtype ;
468
+ uint8_t bDescriptorSubType ;
382
469
uint8_t bFrameIndex ;
383
470
uint8_t bmCapabilities ;
384
471
uint16_t wWidth ;
@@ -394,7 +481,7 @@ struct uvc_frame_descriptor {
394
481
struct uvc_frame_continuous_descriptor {
395
482
uint8_t bLength ;
396
483
uint8_t bDescriptorType ;
397
- uint8_t bDescriptorSubtype ;
484
+ uint8_t bDescriptorSubType ;
398
485
uint8_t bFrameIndex ;
399
486
uint8_t bmCapabilities ;
400
487
uint16_t wWidth ;
@@ -422,13 +509,20 @@ struct uvc_frame_discrete_descriptor {
422
509
uint32_t dwMaxVideoFrameBufferSize ;
423
510
uint32_t dwDefaultFrameInterval ;
424
511
uint8_t bFrameIntervalType ;
512
+ /* TODO: commonly configurable frame interval ( suggestion: uint32_t dwFrameInterval[]; )*/
425
513
#ifdef CONFIG_USBD_VIDEO_MAX_FRMIVAL
426
514
uint32_t dwFrameInterval [CONFIG_USBD_VIDEO_MAX_FRMIVAL ];
427
515
#else
428
516
uint32_t dwFrameInterval [1 ];
429
517
#endif
430
518
} __packed ;
431
519
520
+ struct uvc_cs_descriptor_header {
521
+ uint8_t bLength ;
522
+ uint8_t bDescriptorType ;
523
+ uint8_t bDescriptorSubType ;
524
+ } __packed ;
525
+
432
526
struct uvc_color_descriptor {
433
527
uint8_t bLength ;
434
528
uint8_t bDescriptorType ;
@@ -485,4 +579,4 @@ struct uvc_payload_header {
485
579
uint16_t scrSourceClockSOF ; /* optional */
486
580
} __packed ;
487
581
488
- #endif /* ZEPHYR_INCLUDE_USBD_CLASS_UVC_H_ */
582
+ #endif /* ZEPHYR_INCLUDE_USB_CLASS_UVC_H_ */
0 commit comments