1c77a61a7Syz /*
2c77a61a7Syz  * CDDL HEADER START
3c77a61a7Syz  *
4c77a61a7Syz  * The contents of this file are subject to the terms of the
5c77a61a7Syz  * Common Development and Distribution License (the "License").
6c77a61a7Syz  * You may not use this file except in compliance with the License.
7c77a61a7Syz  *
8c77a61a7Syz  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9c77a61a7Syz  * or http://www.opensolaris.org/os/licensing.
10c77a61a7Syz  * See the License for the specific language governing permissions
11c77a61a7Syz  * and limitations under the License.
12c77a61a7Syz  *
13c77a61a7Syz  * When distributing Covered Code, include this CDDL HEADER in each
14c77a61a7Syz  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15c77a61a7Syz  * If applicable, add the following below this CDDL HEADER, with the
16c77a61a7Syz  * fields enclosed by brackets "[]" replaced with your own identifying
17c77a61a7Syz  * information: Portions Copyright [yyyy] [name of copyright owner]
18c77a61a7Syz  *
19c77a61a7Syz  * CDDL HEADER END
20c77a61a7Syz  */
21c77a61a7Syz /*
22*61b2e298Slc  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23c77a61a7Syz  * Use is subject to license terms.
24c77a61a7Syz  */
25c77a61a7Syz 
26c77a61a7Syz #ifndef _SYS_USB_USBVC_H
27c77a61a7Syz #define	_SYS_USB_USBVC_H
28c77a61a7Syz 
29c77a61a7Syz 
30c77a61a7Syz #ifdef	__cplusplus
31c77a61a7Syz extern "C" {
32c77a61a7Syz #endif
33c77a61a7Syz 
34c77a61a7Syz /* Video interface class code */
35c77a61a7Syz #define	CC_VIDEO			0x0e
36c77a61a7Syz 
37c77a61a7Syz /* Video interface subclass code */
38c77a61a7Syz #define	SC_UNDEFINED			0x00
39c77a61a7Syz #define	SC_VIDEOCONTROL 		0x01
40c77a61a7Syz #define	SC_VIDEOSTREAMING		0x02
41c77a61a7Syz #define	SC_VIDEO_INTERFACE_COLLECTION	0x03
42c77a61a7Syz 
43c77a61a7Syz #define	PC_PROTOCOL_UNDEFINED		0x00
44c77a61a7Syz 
45c77a61a7Syz /* Video class specific interface descriptor types */
46c77a61a7Syz #define	CS_UNDEFINED			0x20
47c77a61a7Syz #define	CS_DEVICE			0x21
48c77a61a7Syz #define	CS_CONFIGURATION		0x22
49c77a61a7Syz #define	CS_STRING			0x23
50c77a61a7Syz #define	CS_INTERFACE			0x24
51c77a61a7Syz #define	CS_ENDPOINT			0x25
52c77a61a7Syz 
53c77a61a7Syz /* Video class specific, video control interface descriptor subtypes */
54c77a61a7Syz #define	VC_DESCRIPTOR_UNDEFINED 	0x00
55c77a61a7Syz #define	VC_HEADER			0x01
56c77a61a7Syz #define	VC_INPUT_TERMINAL		0x02
57c77a61a7Syz #define	VC_OUTPUT_TERMINAL		0x03
58c77a61a7Syz #define	VC_SELECTOR_UNIT		0x04
59c77a61a7Syz #define	VC_PROCESSING_UNIT		0x05
60c77a61a7Syz #define	VC_EXTENSION_UNIT		0x06
61c77a61a7Syz 
62c77a61a7Syz /* Video class specific, video stream interface descriptor subtypes */
63c77a61a7Syz #define	VS_UNDEFINED			0x00
64c77a61a7Syz #define	VS_INPUT_HEADER 		0x01
65c77a61a7Syz #define	VS_OUTPUT_HEADER		0x02
66c77a61a7Syz #define	VS_STILL_IMAGE_FRAME		0x03
67c77a61a7Syz #define	VS_FORMAT_UNCOMPRESSED		0x04
68c77a61a7Syz #define	VS_FRAME_UNCOMPRESSED		0x05
69c77a61a7Syz #define	VS_FORMAT_MJPEG 		0x06
70c77a61a7Syz #define	VS_FRAME_MJPEG			0x07
71c77a61a7Syz #define	VS_FORMAT_MPEG2TS		0x0a
72c77a61a7Syz #define	VS_FORMAT_DV			0x0c
73c77a61a7Syz #define	VS_COLORFORMAT			0x0d
74c77a61a7Syz #define	VS_FORMAT_FRAME_BASED		0x10
75c77a61a7Syz #define	VS_FRAME_FRAME_BASED		0x11
76c77a61a7Syz #define	VS_FORMAT_STREAM_BASED		0x12
77c77a61a7Syz 
78c77a61a7Syz /* Endpoint type */
79c77a61a7Syz #define	EP_UNDEFINED			0x00
80c77a61a7Syz #define	EP_GENERAL			0x01
81c77a61a7Syz #define	EP_ENDPOINT			0x02
82c77a61a7Syz #define	EP_INTERRUPT			0x03
83c77a61a7Syz 
84c77a61a7Syz /* Request codes, bRequest */
85c77a61a7Syz #define	RC_UNDEFINED			0x00
86c77a61a7Syz #define	SET_CUR 			0x01
87c77a61a7Syz #define	GET_CUR 			0x81
88c77a61a7Syz #define	GET_MIN 			0x82
89c77a61a7Syz #define	GET_MAX 			0x83
90c77a61a7Syz #define	GET_RES 			0x84
91c77a61a7Syz #define	GET_LEN 			0x85
92c77a61a7Syz #define	GET_INFO			0x86
93c77a61a7Syz #define	GET_DEF 			0x87
94c77a61a7Syz 
95c77a61a7Syz /* Control types of Video Control interface */
96c77a61a7Syz #define	VC_CONTROL_UNDEFINED		0x00
97c77a61a7Syz #define	VC_VIDEO_POWER_MODE_CONTROL	0x01
98c77a61a7Syz #define	VC_REQUEST_ERROR_CODE_CONTROL	0x02
99c77a61a7Syz 
100c77a61a7Syz /* Terminal controls */
101c77a61a7Syz #define	TE_CONTROL_UNDEFINED		0x00
102c77a61a7Syz 
103c77a61a7Syz /* Selector Unit controls */
104c77a61a7Syz #define	SU_CONTROL_UNDEFINED		0x00
105c77a61a7Syz #define	SU_INPUT_SELECT_CONTROL 	0x01
106c77a61a7Syz 
107c77a61a7Syz /* Camera Terminal controls */
108c77a61a7Syz #define	CT_CONTROL_UNDEFINED				0x00
109c77a61a7Syz #define	CT_SCANNING_MODE_CONTROL			0x01
110c77a61a7Syz #define	CT_AE_MODE_CONTROL				0x02
111c77a61a7Syz #define	CT_AE_PRIORITY_CONTROL				0x03
112c77a61a7Syz #define	CT_EXPOSURE_TIME_ABSOLUTE_CONTROL		0x04
113c77a61a7Syz #define	CT_EXPOSURE_TIME_RELATIVE_CONTROL		0x05
114c77a61a7Syz #define	CT_FOCUS_ABSOLUTE_CONTROL			0x06
115c77a61a7Syz #define	CT_FOCUS_RELATIVE_CONTROL			0x07
116c77a61a7Syz #define	CT_FOCUS_AUTO_CONTROL				0x08
117c77a61a7Syz #define	CT_IRIS_ABSOLUTE_CONTROL			0x09
118c77a61a7Syz #define	CT_IRIS_RELATIVE_CONTROL			0x0a
119c77a61a7Syz #define	CT_ZOOM_ABSOLUTE_CONTROL			0x0b
120c77a61a7Syz #define	CT_ZOOM_RELATIVE_CONTROL			0x0c
121c77a61a7Syz #define	CT_PANTILT_ABSOLUTE_CONTROL			0x0d
122c77a61a7Syz #define	CT_PANTILT_RELATIVE_CONTROL			0x0e
123c77a61a7Syz #define	CT_ROLL_ABSOLUTE_CONTROL			0x0f
124c77a61a7Syz #define	CT_ROLL_RELATIVE_CONTROL			0x10
125c77a61a7Syz #define	CT_PRIVACY_CONTROL				0x11
126c77a61a7Syz 
127c77a61a7Syz /* Processing Unit controls */
128c77a61a7Syz #define	PU_CONTROL_UNDEFINED				0x00
129c77a61a7Syz #define	PU_BACKLIGHT_COMPENSATION_CONTROL		0x01
130c77a61a7Syz #define	PU_BRIGHTNESS_CONTROL				0x02
131c77a61a7Syz #define	PU_CONTRAST_CONTROL				0x03
132c77a61a7Syz #define	PU_GAIN_CONTROL 				0x04
133c77a61a7Syz #define	PU_POWER_LINE_FREQUENCY_CONTROL 		0x05
134c77a61a7Syz #define	PU_HUE_CONTROL					0x06
135c77a61a7Syz #define	PU_SATURATION_CONTROL				0x07
136c77a61a7Syz #define	PU_SHARPNESS_CONTROL				0x08
137c77a61a7Syz #define	PU_GAMMA_CONTROL				0x09
138c77a61a7Syz #define	PU_WHITE_BALANCE_TEMPERATURE_CONTROL		0x0a
139c77a61a7Syz #define	PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL	0x0b
140c77a61a7Syz #define	PU_WHITE_BALANCE_COMPONENT_CONTROL		0x0c
141c77a61a7Syz #define	PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 	0x0d
142c77a61a7Syz #define	PU_DIGITAL_MULTIPLIER_CONTROL			0x0e
143c77a61a7Syz #define	PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL		0x0f
144c77a61a7Syz #define	PU_HUE_AUTO_CONTROL				0x10
145c77a61a7Syz #define	PU_ANALOG_VIDEO_STANDARD_CONTROL		0x11
146c77a61a7Syz #define	PU_ANALOG_LOCK_STATUS_CONTROL			0x12
147c77a61a7Syz 
148c77a61a7Syz /* VideoStreaming interface controls, wValue */
149c77a61a7Syz #define	VS_CONTROL_UNDEFINED		0x00
150c77a61a7Syz #define	VS_PROBE_CONTROL		0x01
151c77a61a7Syz #define	VS_COMMIT_CONTROL		0x02
152c77a61a7Syz #define	VS_STILL_PROBE_CONTROL		0x03
153c77a61a7Syz #define	VS_STILL_COMMIT_CONTROL 	0x04
154c77a61a7Syz #define	VS_STILL_IMAGE_TRIGGER_CONTROL	0x05
155c77a61a7Syz #define	VS_STREAM_ERROR_CODE_CONTROL	0x06
156c77a61a7Syz #define	VS_GENERATE_KEY_FRAME_CONTROL	0x07
157c77a61a7Syz #define	VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
158c77a61a7Syz #define	VS_SYNC_DELAY_CONTROL		0x09
159c77a61a7Syz 
160c77a61a7Syz /* bmRequestType */
161c77a61a7Syz #define	USBVC_SET_IF	0x21;
162c77a61a7Syz #define	USBVC_GET_IF	0xA1;
163c77a61a7Syz #define	USBVC_SET_EP	0x22;
164c77a61a7Syz #define	USBVC_GET_EP	0xA2;
165c77a61a7Syz 
166c77a61a7Syz /* Terminal types */
167c77a61a7Syz #define	TT_VENDOR_SPECIFIC		0x0100
168c77a61a7Syz #define	TT_STREAMING			0x0101
169c77a61a7Syz 
170c77a61a7Syz /* Input Terminal types */
171c77a61a7Syz #define	ITT_VENDOR_SPECIFIC		0x0200
172c77a61a7Syz #define	ITT_CAMERA			0x0201
173c77a61a7Syz #define	ITT_MEDIA_TRANSPORT_INPUT	0x0202
174c77a61a7Syz 
175c77a61a7Syz /* Output Terminal types */
176c77a61a7Syz #define	OTT_VENDOR_SPECIFIC		0x0300
177c77a61a7Syz #define	OTT_DISPLAY			0x0301
178c77a61a7Syz #define	OTT_MEDIA_TRANSPORT_OUTPUT	0x0302
179c77a61a7Syz 
180c77a61a7Syz /* External terminal types */
181c77a61a7Syz #define	EXTERNAL_VENDOR_SPECIFIC	0x0400
182c77a61a7Syz #define	COMPOSITE_CONNECTOR		0x0401
183c77a61a7Syz #define	SVIDEO_CONNECTOR		0x0402
184c77a61a7Syz #define	COMPONENT_CONNECTOR		0x0403
185c77a61a7Syz 
186c77a61a7Syz /*
187c77a61a7Syz  * usb video class descriptors
188c77a61a7Syz  */
189c77a61a7Syz 
190c77a61a7Syz /* usb video class, video control interface, header descriptor */
191c77a61a7Syz typedef struct usbvc_vc_header_descr {
192c77a61a7Syz 	uint8_t	bLength;
193c77a61a7Syz 	uint8_t	bDescriptorType;
194c77a61a7Syz 	uint8_t	bDescriptorSubtype;
195c77a61a7Syz 	uint8_t	bcdUVC[2];
196c77a61a7Syz 	uint8_t	wTotalLength[2];
197c77a61a7Syz 	uint8_t	dwClockFrequency[4];
198c77a61a7Syz 
199c77a61a7Syz 	/* Number of stream interfaces belong to this VC interface */
200c77a61a7Syz 	uint8_t	bInCollection;
201c77a61a7Syz } usbvc_vc_header_descr_t;
202c77a61a7Syz 
203c77a61a7Syz typedef struct usbvc_vc_header {
204c77a61a7Syz 	usbvc_vc_header_descr_t	*descr;
205c77a61a7Syz 
206c77a61a7Syz 	/* there might be multiple stream interface numbers */
207c77a61a7Syz 	uint8_t			*baInterfaceNr;
208c77a61a7Syz } usbvc_vc_header_t;
209c77a61a7Syz 
210c77a61a7Syz /* unit descriptor for all the three kinds of units */
211c77a61a7Syz typedef struct usbvc_unit_descr {
212c77a61a7Syz 	uint8_t bLength;
213c77a61a7Syz 	uint8_t bDescriptorType;
214c77a61a7Syz 	uint8_t bDescriptorSubType;
215c77a61a7Syz 	uint8_t bUnitID;
216c77a61a7Syz 
217c77a61a7Syz 	union {
218c77a61a7Syz 		struct {
219c77a61a7Syz 			uint8_t bSourceID;
220c77a61a7Syz 			uint8_t wMaxMultiplier[2];
221c77a61a7Syz 			uint8_t bControlSize;
222c77a61a7Syz 		} processing;
223c77a61a7Syz 
224c77a61a7Syz 		struct {
225c77a61a7Syz 			uint8_t	bNrInPins;
226c77a61a7Syz 		} selector;
227c77a61a7Syz 
228c77a61a7Syz 		struct {
229c77a61a7Syz 			uint8_t	guidExtensionCode[16];
230c77a61a7Syz 			uint8_t	bNumControls;
231c77a61a7Syz 			uint8_t	bNrInPins;
232c77a61a7Syz 		} extension;
233c77a61a7Syz 	} unit;
234c77a61a7Syz } usbvc_unit_descr_t;
235c77a61a7Syz 
236c77a61a7Syz typedef struct usbvc_units {
237c77a61a7Syz 	/* Point to cvs_buf, for most elements of unit descriptor */
238c77a61a7Syz 	usbvc_unit_descr_t *descr;
239c77a61a7Syz 
240c77a61a7Syz 	uint8_t		*bmControls;	/* for processing or extention unit */
241c77a61a7Syz 	uint8_t		*baSourceID;	/* for selector or extention unit */
242c77a61a7Syz 	uint8_t		iSelector;	/* for selector  unit */
243c77a61a7Syz 	uint8_t		iProcessing;	/* for processing  unit */
244c77a61a7Syz 	uint8_t		bmVideoStandards; /* for processing unit */
245c77a61a7Syz 	uint8_t		bControlSize;	/* for extention unit */
246c77a61a7Syz 	uint8_t		iExtension;	/* for extention unit */
247c77a61a7Syz 	list_node_t	unit_node;
248c77a61a7Syz } usbvc_units_t;
249c77a61a7Syz 
250c77a61a7Syz /* Terminal descriptor for all the three kinds of video terminals */
251c77a61a7Syz typedef struct		usbvc_term_descr {
252c77a61a7Syz 	uint8_t		bLength;
253c77a61a7Syz 	uint8_t		bDescriptorType;
254c77a61a7Syz 	uint8_t		bDescriptorSubType;
255c77a61a7Syz 	uint8_t		bTerminalID;
256c77a61a7Syz 	uint16_t	wTerminalType;
257c77a61a7Syz 	uint8_t		AssocTerminal;
258c77a61a7Syz 
259c77a61a7Syz 	union {
260c77a61a7Syz 		struct {
261c77a61a7Syz 			uint8_t iTerminal;
262c77a61a7Syz 		} input;
263c77a61a7Syz 
264c77a61a7Syz 		struct {
265c77a61a7Syz 			uint8_t	bSourceID;
266c77a61a7Syz 			uint8_t	iTerminal;
267c77a61a7Syz 		} output;
268c77a61a7Syz 
269c77a61a7Syz 		struct {
270c77a61a7Syz 			uint8_t		iTerminal;
271c77a61a7Syz 			uint16_t	wObjectiveFocalLengthMin;
272c77a61a7Syz 			uint16_t	wObjectiveFocalLengthMax;
273c77a61a7Syz 			uint16_t	wOcularFocalLength;
274c77a61a7Syz 			uint8_t		bControlSize;
275c77a61a7Syz 		} camera;
276c77a61a7Syz 	}term;
277c77a61a7Syz } usbvc_term_descr_t;
278c77a61a7Syz 
279c77a61a7Syz typedef struct usbvc_terms {
280c77a61a7Syz 	usbvc_term_descr_t	*descr;	/* interfaces for this cfg */
281c77a61a7Syz 
282c77a61a7Syz 	/* for input or output terminals, excluding camera terminals */
283c77a61a7Syz 	uint8_t			*bSpecific;
284c77a61a7Syz 
285c77a61a7Syz 	uint8_t			*bmControls;  /* for camera terminals only */
286c77a61a7Syz 	list_node_t		term_node;
287c77a61a7Syz } usbvc_terms_t;
288c77a61a7Syz 
289c77a61a7Syz /*
290c77a61a7Syz  * Stream interface descriptors
291c77a61a7Syz  */
292c77a61a7Syz 
293c77a61a7Syz /* input header descriptor */
294c77a61a7Syz typedef struct usbvc_input_header_descr {
295c77a61a7Syz 	uint8_t		bLength;
296c77a61a7Syz 	uint8_t		bDescriptorType;
297c77a61a7Syz 	uint8_t		bDescriptorSubType;
298c77a61a7Syz 	uint8_t		bNumFormats;
299c77a61a7Syz 	uint16_t	wTotalLength;
300c77a61a7Syz 	uint8_t		bEndpointAddress;
301c77a61a7Syz 	uint8_t		bmInfo;
302c77a61a7Syz 	uint8_t		bTerminalLink;
303c77a61a7Syz 	uint8_t		bStillCaptureMethod;
304c77a61a7Syz 	uint8_t		bTriggerSupport;
305c77a61a7Syz 	uint8_t		bTriggerUsage;
306c77a61a7Syz 	uint8_t		bControlSize;
307c77a61a7Syz } usbvc_input_header_descr_t;
308c77a61a7Syz 
309c77a61a7Syz /* UVC Spec: only one input header in one stream interface */
310c77a61a7Syz typedef struct usbvc_input_header {
311c77a61a7Syz 	usbvc_input_header_descr_t	*descr;
312c77a61a7Syz 	uint8_t				*bmaControls;
313c77a61a7Syz } usbvc_input_header_t;
314c77a61a7Syz 
315c77a61a7Syz /* Do not support output video device at present */
316c77a61a7Syz typedef struct usbvc_output_header_descr {
317c77a61a7Syz 	uint8_t		bLength;
318c77a61a7Syz 	uint8_t		bDescriptorType;
319c77a61a7Syz 	uint8_t		bDescriptorSubType;
320c77a61a7Syz 	uint8_t		bNumFormats;
321c77a61a7Syz 	uint16_t	wTotalLength;
322c77a61a7Syz 	uint8_t		bEndpointAddress;
323c77a61a7Syz 	uint8_t		bTerminalLink;
324c77a61a7Syz 	uint8_t		bControlSize;
325c77a61a7Syz } usbvc_output_header_descr_t;
326c77a61a7Syz 
327c77a61a7Syz typedef struct usbvc_output_header {
328c77a61a7Syz 	usbvc_output_header_descr_t	*descr;
329c77a61a7Syz 	uint8_t				*bmaControls;
330c77a61a7Syz } usbvc_output_header_t;
331c77a61a7Syz 
332c77a61a7Syz /*
333c77a61a7Syz  * Except bDescriptorSubType value, MJPEG and uncompressed frame descriptor are
334c77a61a7Syz  * all the same. So share one structure.
335c77a61a7Syz  */
336c77a61a7Syz typedef struct usbvc_frame_descr {
337c77a61a7Syz 	uint8_t bLength;
338c77a61a7Syz 	uint8_t bDescriptorType;
339c77a61a7Syz 	uint8_t bDescriptorSubType;
340c77a61a7Syz 	uint8_t bFrameIndex;
341c77a61a7Syz 	uint8_t bmCapabilities;
342c77a61a7Syz 	uint8_t wWidth[2];
343c77a61a7Syz 	uint8_t wHeight[2];
344c77a61a7Syz 	uint8_t dwMinBitRate[4];
345c77a61a7Syz 	uint8_t dwMaxBitRate[4];
346c77a61a7Syz 	uint8_t dwMaxVideoFrameBufferSize[4];
347c77a61a7Syz 	uint8_t dwDefaultFrameInterval[4];
348c77a61a7Syz 	uint8_t bFrameIntervalType;
349c77a61a7Syz } usbvc_frame_descr_t;
350c77a61a7Syz 
351c77a61a7Syz /*
352c77a61a7Syz  * There may be several frame descriptors immediately follow a format
353c77a61a7Syz  * descriptor.
354c77a61a7Syz  */
355c77a61a7Syz typedef struct usbvc_frames {
356c77a61a7Syz 	usbvc_frame_descr_t *descr;
357c77a61a7Syz 	uint32_t dwMinFrameInterval;	/* for continuous frame intervals */
358c77a61a7Syz 	uint32_t dwMaxFrameInterval;	/* for continuous frame intervals */
359c77a61a7Syz 	uint32_t dwFrameIntervalStep;	/* for continuous frame intervals */
360*61b2e298Slc 	uint8_t *dwFrameInterval;	/* for discrete frame intervals */
361c77a61a7Syz } usbvc_frames_t;
362c77a61a7Syz 
363c77a61a7Syz /* The first several fixed length fields of still image frame descriptor */
364c77a61a7Syz typedef struct usbvc_still_image_frame_descr {
365c77a61a7Syz 	uint8_t	bLength;
366c77a61a7Syz 	uint8_t	bDescriptorType;
367c77a61a7Syz 	uint8_t	bDescriptorSubType;
368c77a61a7Syz 	uint8_t	bEndpointAddress;
369c77a61a7Syz 	uint8_t	bNumImageSizePatterns;
370c77a61a7Syz } usbvc_still_image_frame_descr_t;
371c77a61a7Syz 
372c77a61a7Syz /*
373c77a61a7Syz  * Width and Hight of the still image.
374c77a61a7Syz  * There might be multiple such value pairs in one still image frame descr.
375c77a61a7Syz  */
376c77a61a7Syz typedef struct width_height {
377c77a61a7Syz 	uint16_t wWidth;
378c77a61a7Syz 	uint16_t wHeight;
379c77a61a7Syz } width_height_t;
380c77a61a7Syz 
381c77a61a7Syz /*
382c77a61a7Syz  * The whole still image frame descriptor.
383c77a61a7Syz  * UVC Spec: only one still image descriptor for each format group.
384c77a61a7Syz  */
385c77a61a7Syz typedef struct usbvc_still_image_frame {
386c77a61a7Syz 	usbvc_still_image_frame_descr_t	*descr;
387c77a61a7Syz 	width_height_t			*width_height;
388c77a61a7Syz 	uint8_t				bNumCompressionPattern;
389c77a61a7Syz 	uint8_t				*bCompression;
390c77a61a7Syz } usbvc_still_image_frame_t;
391c77a61a7Syz 
392c77a61a7Syz /*
393c77a61a7Syz  * All fields of this descr are fixed length.
394c77a61a7Syz  * UVC Spec: only one color_matching_descr is allowed for a given format.
395c77a61a7Syz  */
396c77a61a7Syz typedef struct usbvc_color_matching_descr {
397c77a61a7Syz 	uint8_t	bLength;
398c77a61a7Syz 	uint8_t	bDescriptorType;
399c77a61a7Syz 	uint8_t	bDescriptorSubtype;
400c77a61a7Syz 	uint8_t	bColorPrimaries;
401c77a61a7Syz 	uint8_t	bTransferCharacteristics;
402c77a61a7Syz 	uint8_t	bMatrixCoefficients;
403c77a61a7Syz } usbvc_color_matching_descr_t;
404c77a61a7Syz 
405c77a61a7Syz /* Mjpeg and uncompressed format descriptor */
406c77a61a7Syz typedef struct usbvc_format_descr {
407c77a61a7Syz 	uint8_t	bLength;
408c77a61a7Syz 	uint8_t	bDescriptorType;
409c77a61a7Syz 	uint8_t	bDescriptorSubType;
410c77a61a7Syz 	uint8_t	bFormatIndex;
411c77a61a7Syz 	uint8_t	bNumFrameDescriptors;
412c77a61a7Syz 	union {
413c77a61a7Syz 		struct {
414c77a61a7Syz 			uint8_t	bmFlags;
415c77a61a7Syz 			uint8_t	bDefaultFrameIndex;
416c77a61a7Syz 			uint8_t	bAspectRatioX;
417c77a61a7Syz 			uint8_t	bAspectRatioY;
418c77a61a7Syz 			uint8_t	bmInterlaceFlags;
419c77a61a7Syz 			uint8_t	bCopyProtect;
420c77a61a7Syz 		} mjpeg;
421c77a61a7Syz 
422c77a61a7Syz 		struct {
423c77a61a7Syz 			uint8_t	guidFormat[16];
424c77a61a7Syz 			uint8_t	bBitsPerPixel;
425c77a61a7Syz 			uint8_t	bDefaultFrameIndex;
426c77a61a7Syz 			uint8_t	bAspectRatioX;
427c77a61a7Syz 			uint8_t	bAspectRatioY;
428c77a61a7Syz 			uint8_t	bmInterlaceFlags;
429c77a61a7Syz 			uint8_t	bCopyProtect;
430c77a61a7Syz 		} uncompressed;
431c77a61a7Syz 	}fmt;
432c77a61a7Syz } usbvc_format_descr_t;
433c77a61a7Syz 
434c77a61a7Syz /*
435c77a61a7Syz  *  usb video class requests
436c77a61a7Syz  */
437c77a61a7Syz typedef struct usbvc_vs_probe_commit {
438c77a61a7Syz 	uint8_t	bmHint[2];
439c77a61a7Syz 	uint8_t	bFormatIndex;
440c77a61a7Syz 	uint8_t	bFrameIndex;
441c77a61a7Syz 	uint8_t	dwFrameInterval[4];
442c77a61a7Syz 	uint8_t	wKeyFrameRate[2];
443c77a61a7Syz 	uint8_t	wPFrameRate[2];
444c77a61a7Syz 	uint8_t	wCompQuality[2];
445c77a61a7Syz 	uint8_t	wCompWindowSize[2];
446c77a61a7Syz 	uint8_t	wDelay[2];
447c77a61a7Syz 	uint8_t	dwMaxVideoFrameSize[4];
448c77a61a7Syz 	uint8_t	dwMaxPayloadTransferSize[4];
449c77a61a7Syz 	uint8_t	wClockFrequency[4];
450c77a61a7Syz 	uint8_t	bmFramingInfo;
451c77a61a7Syz 	uint8_t	bPreferedVersion;
452c77a61a7Syz 	uint8_t	bMinVersion;
453c77a61a7Syz 	uint8_t	bMaxVersion;
454c77a61a7Syz } usbvc_vs_probe_commit_t;
455c77a61a7Syz 
456c77a61a7Syz /* Table 2-1 of a sub video class spec: "uncompressed payload spec" */
457c77a61a7Syz #define	USBVC_FORMAT_GUID_YUY2	{0x59, 0x55, 0x59, 0x32, 0x00, 0x00, 0x10, \
458c77a61a7Syz 				0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, \
459c77a61a7Syz 				0x9b, 0x71}
460c77a61a7Syz #define	USBVC_FORMAT_GUID_NV12	{0x4e, 0x56, 0x31, 0x32, 0x00, 0x00, 0x10, \
461c77a61a7Syz 				0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, \
462c77a61a7Syz 				0x9b, 0x71}
463c77a61a7Syz 
464c77a61a7Syz /* Stream frame's flag bits */
465c77a61a7Syz #define	USBVC_STREAM_EOF	(1 << 1)
466c77a61a7Syz #define	USBVC_STREAM_FID	(1 << 0)
467c77a61a7Syz 
468c77a61a7Syz #ifdef __cplusplus
469c77a61a7Syz }
470c77a61a7Syz #endif
471c77a61a7Syz 
472c77a61a7Syz #endif /* _SYS_USB_USBVC_H */
473