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