1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** USBX Component                                                        */
17 /**                                                                       */
18 /**   Video Class                                                         */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  COMPONENT DEFINITION                                   RELEASE        */
27 /*                                                                        */
28 /*    ux_device_class_video.h                             PORTABLE C      */
29 /*                                                           6.3.0        */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Chaoqiong Xiao, Microsoft Corporation                               */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file contains all the header and extern functions used by the  */
37 /*    USBX device video class.                                            */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  04-25-2022     Chaoqiong Xiao           Initial Version 6.1.11        */
44 /*  10-31-2022     Chaoqiong Xiao           Modified comment(s),          */
45 /*                                            added standalone support,   */
46 /*                                            resulting in version 6.2.0  */
47 /*  10-31-2023     Yajun xia, CQ Xiao       Modified comment(s),          */
48 /*                                            added a new mode to manage  */
49 /*                                            endpoint buffer in classes  */
50 /*                                            with zero copy enabled,     */
51 /*                                            added error checks support, */
52 /*                                            resulting in version 6.3.0  */
53 /*                                                                        */
54 /**************************************************************************/
55 
56 #ifndef UX_DEVICE_CLASS_VIDEO_H
57 #define UX_DEVICE_CLASS_VIDEO_H
58 
59 /* Determine if a C++ compiler is being used.  If so, ensure that standard
60    C is used to process the API information.  */
61 
62 #ifdef   __cplusplus
63 
64 /* Yes, C++ compiler is present.  Use standard C.  */
65 extern   "C" {
66 
67 #endif
68 
69 /* Internal option: enable the basic USBX error checking. This define is typically used
70    while debugging application.  */
71 #if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_DEVICE_CLASS_VIDEO_ENABLE_ERROR_CHECKING)
72 #define UX_DEVICE_CLASS_VIDEO_ENABLE_ERROR_CHECKING
73 #endif
74 
75 /* Define options.  */
76 
77 #define UX_DEVICE_CLASS_VIDEO_THREAD_STACK_SIZE                                              UX_THREAD_STACK_SIZE
78 
79 /* Define external static data.  */
80 
81 extern UCHAR _ux_system_device_class_video_name[];
82 
83 
84 /* Define IOCTL code.
85      ux_device_class_video_ioctl(video, IOCTL_CODE, parameter).
86  */
87 
88 #define UX_DEVICE_CLASS_VIDEO_IOCTL_GET_ARG                                                  0x01
89 
90 
91 /* Define Video Class main constants.  */
92 
93 #define UX_DEVICE_CLASS_VIDEO_CLASS                                                          0x0e
94 #define UX_DEVICE_CLASS_VIDEO_SUBCLASS_UNDEFINED                                             0
95 #define UX_DEVICE_CLASS_VIDEO_SUBCLASS_CONTROL                                               1
96 #define UX_DEVICE_CLASS_VIDEO_SUBCLASS_STREAMING                                             2
97 #define UX_DEVICE_CLASS_VIDEO_SUBCLASS_INTERFACE_COLLECTION                                  3
98 
99 /* Class Code (CC).  */
100 #define UX_DEVICE_CLASS_VIDEO_CC_VIDEO                                                       0x0e
101 
102 /* Subclass Code (SC).  */
103 #define UX_DEVICE_CLASS_VIDEO_SC_UNDEFINED                                                   0
104 #define UX_DEVICE_CLASS_VIDEO_SC_CONTROL                                                     1
105 #define UX_DEVICE_CLASS_VIDEO_SC_STREAMING                                                   2
106 #define UX_DEVICE_CLASS_VIDEO_SC_INTERFACE_COLLECTION                                        3
107 
108 /* Protocol Code.  */
109 #define UX_DEVICE_CLASS_VIDEO_PC_PROTOCOL_UNDEFINED                                          0
110 #define UX_DEVICE_CLASS_VIDEO_PC_PROTOCOL_15                                                 0
111 
112 
113 /* Define Video Class-Specific (CS) descriptor types.  */
114 #define UX_DEVICE_CLASS_VIDEO_CS_UNDEFINED                                                   0x20
115 #define UX_DEVICE_CLASS_VIDEO_CS_DEVICE                                                      0x21
116 #define UX_DEVICE_CLASS_VIDEO_CS_CONFIGURATION                                               0x22
117 #define UX_DEVICE_CLASS_VIDEO_CS_STRING                                                      0x23
118 #define UX_DEVICE_CLASS_VIDEO_CS_INTERFACE                                                   0x24
119 #define UX_DEVICE_CLASS_VIDEO_CS_ENDPOINT                                                    0x25
120 
121 
122 /* Define Video Class specific Video Control (VC) interface descriptor subtypes.  */
123 #define UX_DEVICE_CLASS_VIDEO_VC_DESCRIPTOR_UNDEFINED                                        0x00
124 #define UX_DEVICE_CLASS_VIDEO_VC_HEADER                                                      0x01
125 #define UX_DEVICE_CLASS_VIDEO_VC_INPUT_TERMINAL                                              0x02
126 #define UX_DEVICE_CLASS_VIDEO_VC_OUTPUT_TERMINAL                                             0x03
127 #define UX_DEVICE_CLASS_VIDEO_VC_SELECTOR_UNIT                                               0x04
128 #define UX_DEVICE_CLASS_VIDEO_VC_PROCESSING_UNIT                                             0x05
129 #define UX_DEVICE_CLASS_VIDEO_VC_EXTENSION_UNIT                                              0x06
130 #define UX_DEVICE_CLASS_VIDEO_VC_ENCODING_UNIT                                               0x07
131 
132 
133 /* Define Video Class specific Video Stream (VS) interface descriptor subtypes.  */
134 #define UX_DEVICE_CLASS_VIDEO_VS_UNDEFINED                                                   0x00
135 #define UX_DEVICE_CLASS_VIDEO_VS_INPUT_HEADER                                                0x01
136 #define UX_DEVICE_CLASS_VIDEO_VS_OUTPUT_HEADER                                               0x02
137 #define UX_DEVICE_CLASS_VIDEO_VS_STILL_IMAGE_FRAME                                           0x03
138 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_UNCOMPRESSED                                         0x04
139 #define UX_DEVICE_CLASS_VIDEO_VS_FRAME_UNCOMPRESSED                                          0x05
140 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_MJPEG                                                0x06
141 #define UX_DEVICE_CLASS_VIDEO_VS_FRAME_MJPEG                                                 0x07
142 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_MPEG2TS                                              0x0A
143 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_DV                                                   0x0C
144 #define UX_DEVICE_CLASS_VIDEO_VS_COLORFORMAT                                                 0x0D
145 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_FRAME_BASED                                          0x10
146 #define UX_DEVICE_CLASS_VIDEO_VS_FRAME_FRAME_BASED                                           0x11
147 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_STREAM_BASED                                         0x12
148 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_H264                                                 0x13
149 #define UX_DEVICE_CLASS_VIDEO_VS_FRAME_H264                                                  0x14
150 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_H264_SIMULCAST                                       0x15
151 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_VP8                                                  0x16
152 #define UX_DEVICE_CLASS_VIDEO_VS_FRAME_VP8                                                   0x17
153 #define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_VP8_SIMULCAST                                        0x18
154 
155 
156 /* Define Video Class specific Endpoint (EP) descriptor subtypes.  */
157 #define UX_DEVICE_CLASS_VIDEO_EP_UNDEFINED                                                   0x00
158 #define UX_DEVICE_CLASS_VIDEO_EP_GENERAL                                                     0x01
159 #define UX_DEVICE_CLASS_VIDEO_EP_ENDPOINT                                                    0x02
160 #define UX_DEVICE_CLASS_VIDEO_EP_INTERRUPT                                                   0x03
161 
162 
163 /* Define Video Control Selector Codes.  */
164 
165 /* Define VideoControl (VC) Interface Control Selector Codes.  */
166 #define UX_DEVICE_CLASS_VIDEO_VC_CONTROL_UNDEFINED                                           0x00
167 #define UX_DEVICE_CLASS_VIDEO_VC_VIDEO_POWER_MODE_CONTROL                                    0x01
168 #define UX_DEVICE_CLASS_VIDEO_VC_REQUEST_ERROR_CODE_CONTROL                                  0x02
169 
170 /* Define Terminal Control (TE) Selectors.  */
171 #define UX_DEVICE_CLASS_VIDEO_TE_CONTROL_UNDEFINED                                           0x00
172 
173 /* Define Selector Unit (SU) Control Selectors.  */
174 #define UX_DEVICE_CLASS_VIDEO_SU_CONTROL_UNDEFINED                                           0x00
175 #define UX_DEVICE_CLASS_VIDEO_SU_INPUT_SELECT_CONTROL                                        0x01
176 
177 /* Define Camera Terminal (CT) Control Selectors.  */
178 #define UX_DEVICE_CLASS_VIDEO_CT_CONTROL_UNDEFINED                                           0x00
179 #define UX_DEVICE_CLASS_VIDEO_CT_SCANNING_MODE_CONTROL                                       0x01
180 #define UX_DEVICE_CLASS_VIDEO_CT_AE_MODE_CONTROL                                             0x02
181 #define UX_DEVICE_CLASS_VIDEO_CT_AE_PRIORITY_CONTROL                                         0x03
182 #define UX_DEVICE_CLASS_VIDEO_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL                              0x04
183 #define UX_DEVICE_CLASS_VIDEO_CT_EXPOSURE_TIME_RELATIVE_CONTROL                              0x05
184 #define UX_DEVICE_CLASS_VIDEO_CT_FOCUS_ABSOLUTE_CONTROL                                      0x06
185 #define UX_DEVICE_CLASS_VIDEO_CT_FOCUS_RELATIVE_CONTROL                                      0x07
186 #define UX_DEVICE_CLASS_VIDEO_CT_FOCUS_AUTO_CONTROL                                          0x08
187 #define UX_DEVICE_CLASS_VIDEO_CT_IRIS_ABSOLUTE_CONTROL                                       0x09
188 #define UX_DEVICE_CLASS_VIDEO_CT_IRIS_RELATIVE_CONTROL                                       0x0A
189 #define UX_DEVICE_CLASS_VIDEO_CT_ZOOM_ABSOLUTE_CONTROL                                       0x0B
190 #define UX_DEVICE_CLASS_VIDEO_CT_ZOOM_RELATIVE_CONTROL                                       0x0C
191 #define UX_DEVICE_CLASS_VIDEO_CT_PANTILT_ABSOLUTE_CONTROL                                    0x0D
192 #define UX_DEVICE_CLASS_VIDEO_CT_PANTILT_RELATIVE_CONTROL                                    0x0E
193 #define UX_DEVICE_CLASS_VIDEO_CT_ROLL_ABSOLUTE_CONTROL                                       0x0F
194 #define UX_DEVICE_CLASS_VIDEO_CT_ROLL_RELATIVE_CONTROL                                       0x10
195 #define UX_DEVICE_CLASS_VIDEO_CT_PRIVACY_CONTROL                                             0x11
196 #define UX_DEVICE_CLASS_VIDEO_CT_FOCUS_SIMPLE_CONTROL                                        0x12
197 #define UX_DEVICE_CLASS_VIDEO_CT_WINDOW_CONTROL                                              0x13
198 #define UX_DEVICE_CLASS_VIDEO_CT_REGION_OF_INTEREST_CONTROL                                  0x14
199 
200 /* Define Processing Unit (PU) Control Selectors.  */
201 #define UX_DEVICE_CLASS_VIDEO_PU_CONTROL_UNDEFINED                                           0x00
202 #define UX_DEVICE_CLASS_VIDEO_PU_BACKLIGHT_COMPENSATION_CONTROL                              0x01
203 #define UX_DEVICE_CLASS_VIDEO_PU_BRIGHTNESS_CONTROL                                          0x02
204 #define UX_DEVICE_CLASS_VIDEO_PU_CONTRAST_CONTROL                                            0x03
205 #define UX_DEVICE_CLASS_VIDEO_PU_GAIN_CONTROL                                                0x04
206 #define UX_DEVICE_CLASS_VIDEO_PU_POWER_LINE_FREQUENCY_CONTROL                                0x05
207 #define UX_DEVICE_CLASS_VIDEO_PU_HUE_CONTROL                                                 0x06
208 #define UX_DEVICE_CLASS_VIDEO_PU_SATURATION_CONTROL                                          0x07
209 #define UX_DEVICE_CLASS_VIDEO_PU_SHARPNESS_CONTROL                                           0x08
210 #define UX_DEVICE_CLASS_VIDEO_PU_GAMMA_CONTROL                                               0x09
211 #define UX_DEVICE_CLASS_VIDEO_PU_WHITE_BALANCE_TEMPERATURE_CONTROL                           0x0A
212 #define UX_DEVICE_CLASS_VIDEO_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL                      0x0B
213 #define UX_DEVICE_CLASS_VIDEO_PU_WHITE_BALANCE_COMPONENT_CONTROL                             0x0C
214 #define UX_DEVICE_CLASS_VIDEO_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL                        0x0D
215 #define UX_DEVICE_CLASS_VIDEO_PU_DIGITAL_MULTIPLIER_CONTROL                                  0x0E
216 #define UX_DEVICE_CLASS_VIDEO_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL                            0x0F
217 #define UX_DEVICE_CLASS_VIDEO_PU_HUE_AUTO_CONTROL                                            0x10
218 #define UX_DEVICE_CLASS_VIDEO_PU_ANALOG_VIDEO_STANDARD_CONTROL                               0x11
219 #define UX_DEVICE_CLASS_VIDEO_PU_ANALOG_LOCK_STATUS_CONTROL                                  0x12
220 #define UX_DEVICE_CLASS_VIDEO_PU_CONTRAST_AUTO_CONTROL                                       0x13
221 
222 /* Define eXtension Unit (XU) Control Selectors.  */
223 #define UX_DEVICE_CLASS_VIDEO_XU_CONTROL_UNDEFINED                                           0x00
224 
225 /* Define VideoStreaming (VS) Interface Control Selectors.  */
226 #define UX_DEVICE_CLASS_VIDEO_VS_CONTROL_UNDEFINED                                           0x00
227 #define UX_DEVICE_CLASS_VIDEO_VS_PROBE_CONTROL                                               0x01
228 #define UX_DEVICE_CLASS_VIDEO_VS_COMMIT_CONTROL                                              0x02
229 #define UX_DEVICE_CLASS_VIDEO_VS_STILL_PROBE_CONTROL                                         0x03
230 #define UX_DEVICE_CLASS_VIDEO_VS_STILL_COMMIT_CONTROL                                        0x04
231 #define UX_DEVICE_CLASS_VIDEO_VS_STILL_IMAGE_TRIGGER_CONTROL                                 0x05
232 #define UX_DEVICE_CLASS_VIDEO_VS_STREAM_ERROR_CODE_CONTROL                                   0x06
233 #define UX_DEVICE_CLASS_VIDEO_VS_GENERATE_KEY_FRAME_CONTROL                                  0x07
234 #define UX_DEVICE_CLASS_VIDEO_VS_UPDATE_FRAME_SEGMENT_CONTROL                                0x08
235 #define UX_DEVICE_CLASS_VIDEO_VS_SYNCH_DELAY_CONTROL                                         0x09
236 
237 
238 /* Define USB Video Class terminal types.  */
239 
240 /* Define USB Terminal Types (TT).  */
241 #define UX_DEVICE_CLASS_VIDEO_TT_VENDOR_SPECIFIC                                             0x0100
242 #define UX_DEVICE_CLASS_VIDEO_TT_STREAMING                                                   0x0101
243 
244 /* Define USB Input Terminal Types (ITT).  */
245 #define UX_DEVICE_CLASS_VIDEO_ITT_VENDOR_SPECIFIC                                            0x0200
246 #define UX_DEVICE_CLASS_VIDEO_ITT_CAMERA                                                     0x0201
247 #define UX_DEVICE_CLASS_VIDEO_ITT_MEDIA_TRANSPORT_INPUT                                      0x0202
248 
249 /* Define USB Output Terminal Types (OTT).  */
250 #define UX_DEVICE_CLASS_VIDEO_OTT_VENDOR_SPECIFIC                                            0x0300
251 #define UX_DEVICE_CLASS_VIDEO_OTT_DISPLAY                                                    0x0301
252 #define UX_DEVICE_CLASS_VIDEO_OTT_MEDIA_TRANSPORT_OUTPUT                                     0x0302
253 
254 /* Define USB External Terminal Types (XTT).  */
255 #define UX_DEVICE_CLASS_VIDEO_XTT_EXTERNAL_VENDOR_SPECIFIC                                   0x0400
256 #define UX_DEVICE_CLASS_VIDEO_XTT_COMPOSITE_CONNECTOR                                        0x0401
257 #define UX_DEVICE_CLASS_VIDEO_XTT_SVIDEO_CONNECTOR                                           0x0402
258 #define UX_DEVICE_CLASS_VIDEO_XTT_COMPONENT_CONNECTOR                                        0x0403
259 
260 
261 /* Video Class GET_INFO Capabilities and status structs and definitions.  */
262 
263 #define UX_DEVICE_CLASS_VIDEO_INFO_GET_REQUEST_SUPPORT                                       (1u << 0)
264 #define UX_DEVICE_CLASS_VIDEO_INFO_SET_REQUEST_SUPPORT                                       (1u << 1)
265 #define UX_DEVICE_CLASS_VIDEO_INFO_DISABLED_DUE_TO_AUTO_MODE                                 (1u << 2)
266 #define UX_DEVICE_CLASS_VIDEO_INFO_AUTOUPDATE_CONTROL                                        (1u << 3)
267 #define UX_DEVICE_CLASS_VIDEO_INFO_ASYNCHRONOUS_CONTROL                                      (1u << 4)
268 #define UX_DEVICE_CLASS_VIDEO_INFO_DISABLED_DUE_TO_STATE                                     (1u << 5)
269 
270 
271 /* Video Class Probe and Commit Controls structs and definitions.  */
272 typedef struct UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_STRUCT
273 {
274     union UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmHint_UNION {
275         USHORT                                  value;
276         struct UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmHint_STRUCT {
277             USHORT                              dwFrameInterval:1;
278             USHORT                              wKeyFrameRate:1;
279             USHORT                              wPFrameRate:1;
280             USHORT                              wCompQuality:1;
281             USHORT                              wCompWindowSize:1;
282         }                                       bm;
283     }                                           bmHint;
284     UCHAR                                       bFormatIndex;
285     UCHAR                                       bFrameIndex;
286     ULONG                                       dwFrameInterval;
287     USHORT                                      wKeyFrameRate;
288     USHORT                                      wPFrameRate;
289     USHORT                                      wCompQuality;
290     USHORT                                      wCompWindowSize;
291     USHORT                                      wDelay;
292     UCHAR                                       dwMaxVideoFrameSize[4]; /* Not alignend from now on.  */
293     UCHAR                                       dwMaxPayloadTransferSize[4];
294     UCHAR                                       dwClockFrequency[4];
295     union UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmFramingInfo_UNION {
296         UCHAR                                   value;
297         struct UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmFramingInfo_STRUCT {
298             UCHAR                               FID_required:1;
299             UCHAR                               EOF_may_present:1;
300             UCHAR                               EOS_may_present:1;
301         }                                       bm;
302     }                                           bmFramingInfo;
303     UCHAR                                       bPreferedVersion;
304     UCHAR                                       bMinVersion;
305     UCHAR                                       bMaxVersion;
306 
307     /* Start from offset 34, additional fields introduced in UVC 1.5.  */
308     UCHAR                                       bUsage;
309     UCHAR                                       bBitDepthLuma;
310     UCHAR                                       bmSettings;
311     UCHAR                                       bMaxNumberOfRefFramesPlus1;
312     union UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmRateControlModes_UNION {
313         USHORT                                  value;
314         struct UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmRateControlModes_STRUCT {
315             USHORT                              rate_ctrl_mode_0:4;
316             USHORT                              rate_ctrl_mode_1:4;
317             USHORT                              rate_ctrl_mode_2:4;
318             USHORT                              rate_ctrl_mode_3:4;
319         }                                       bm;
320     }                                           bmRateControlModes;
321     UCHAR                                       bmLayoutPerStream;
322 } UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL;
323 
324 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_OFFSET                      0
325 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_FRAME_INTERVAL              (1U<<0)
326 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_KEY_FRAME_RATE              (1U<<1)
327 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_KEY_P_FRAME_RATE            (1U<<2)
328 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_COMP_QUALITY                (1U<<3)
329 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_COMP_WINDOW_SIZE            (1U<<4)
330 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FORMAT_INDEX_OFFSET              2
331 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAME_INDEX_OFFSET               3
332 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAME_INTERVAL_OFFSET            4
333 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_KEY_FRAME_RATE_OFFSET            8
334 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_P_FRAME_RATE_OFFSET              10
335 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_COMP_QUALITY_OFFSET              12
336 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_COMP_WINDOW_SIZE_OFFSET          14
337 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_DELAY_OFFSET                     16
338 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MAX_VIDEO_FRAME_SIZE_OFFSET      18
339 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MAX_PAYLOAD_TRANSFER_SIZE_OFFSET 22
340 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_CLOCK_FREQUENCY_OFFSET           26
341 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAMING_INFO_OFFSET              30
342 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAMING_INFO_FID_REQUIRED        (1U<<0)
343 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAMING_INFO_EOF_MAY_PRESENT     (1U<<1)
344 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAMING_INFO_EOS_MAY_PRESENT     (1U<<2)
345 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_PREFERED_VERSION_OFFSET          31
346 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MIN_VERSION_OFFSET               32
347 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MAX_VERSION_OFFSET               33
348 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_USAGE_OFFSET                     34
349 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_BIT_DEPTH_LUMA_OFFSET            35
350 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_SETTINGS_OFFSET                  36
351 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MAX_N_OF_FRAMES_PLUS1_OFFSET     37
352 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODES_OFFSET        38
353 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_NOT_APPLICABLE             0U
354 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_VBR_WITH_UNDERFLOW         1U
355 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_CBR                        2U
356 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_CONSTANT_QP                3U
357 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_GLOBAL_VBR_WITH_UNDERFLOW  4U
358 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_VBR                        5U
359 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_GLOBAL_VBR                 6U
360 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_LAYOUT_PER_STREAM_OFFSET         40
361 
362 
363 /* Video Class Still Probe and Commit Controls structs and definitions.  */
364 typedef struct UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_STRUCT
365 {
366     UCHAR                                   bFormatIndex;
367     UCHAR                                   bFrameIndex;
368     UCHAR                                   bCompressionIndex;
369     UCHAR                                   dwMaxVideoFrameSize[4]; /* Not aligned from now.  */
370     UCHAR                                   dwMaxPayloadTransferSize[4];
371 } UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL;
372 #define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_FORMAT_INDEX_OFFSET                0
373 #define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_FRAME_INDEX_OFFSET                 1
374 #define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_COMPRESSION_INDEX_OFFSET           2
375 #define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_MAX_VIDEO_FRAME_SIZE_OFFSET        3
376 #define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_MAX_PAYLOAD_TRANSFER_SIZE_OFFSET   7
377 
378 
379 /* Video Class Status Packet structs and definitions.  */
380 
381 /* Offsets and possible values.  */
382 typedef struct UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_HEADER_STRUCT
383 {
384    UCHAR                                    bStatusType;
385    UCHAR                                    bOriginator;
386 } UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_HEADER;
387 typedef struct UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC_STRUCT
388 {
389    UCHAR                                     bStatusType;
390    UCHAR                                     bOriginator;
391    UCHAR                                     bEvent;
392    UCHAR                                     bSelector;
393    UCHAR                                     bAttribute;
394    UCHAR                                     bValue[1];     /* varies on bAttribute.  */
395 } UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC;
396 typedef struct UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VS_STRUCT
397 {
398    UCHAR                                     bStatusType;
399    UCHAR                                     bOriginator;
400    UCHAR                                     bEvent;
401    UCHAR                                     bValue[1];     /* varies on bEvent.  */
402 } UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VS;
403 #define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_TYPE_OFFSET                                      0
404 #define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_TYPE_VC                                          1
405 #define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_TYPE_VS                                          2
406 #define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_ORIGINATOR_OFFSET                                1
407 #define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_EVENT_OFFSET                                     2
408 #define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC_SELECTOR_OFFSET                               3
409 #define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC_ATTRIBUTE_OFFSET                              4
410 #define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC_VALUE_OFFSET                                  5
411 #define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VS_VALUE_OFFSET                                  3
412 
413 
414 /* Define Video Class Payload Header structs and definitions.  */
415 typedef struct UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_STRUCT
416 {
417    UCHAR                                     bHeaderLength;
418    union UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_INFO_UNION {
419       UCHAR                                  value;
420       struct UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_INFO_STRUCT {
421          UCHAR                               bFID:1; /* Frame ID.  */
422          UCHAR                               bEOF:1; /* End of Frame.  */
423          UCHAR                               bPTS:1; /* Presentation Time.  */
424          UCHAR                               bSCR:1; /* Source Clock Reference.  */
425          UCHAR                               bRES:1; /* Reserved, Payload Specific.  */
426          UCHAR                               bSTI:1; /* Still Image.  */
427          UCHAR                               bERR:1; /* Error.  */
428          UCHAR                               bEOH:1; /* End of Header.  */
429       }                                      bm;
430    }                                         bmHeaderInfo;
431    UCHAR                                     dwPresentationTime[4];
432    union UX_DEVICE_CLASS_VIDEO_PAYLOAD_SCR_UNION {
433       UCHAR                                  byte_array[6];
434       struct UX_DEVICE_CLASS_VIDEO_PAYLOAD_SCR_STRUCT {
435          UCHAR                               STC[4];  /* SourceTimeClock.  */
436          USHORT                              SCR;     /* 1KHz SOF token counter.  */
437       }                                      bm;
438    }                                         scrSourceClock;
439 } UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER;
440 #define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_LENGTH_OFFSET                                   0
441 #define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_INFO_OFFSET                                     1
442 #define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_PRESENTATION_TIME_OFFSET                        4
443 #define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_PTS_OFFSET                                      4
444 #define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_SCR_SOURCE_CLOCK_OFFSET                         6
445 #define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_SCR_OFFSET                                      6
446 
447 
448 /* Define Video Class specific request codes.  */
449 #define UX_DEVICE_CLASS_VIDEO_REQUEST_CODE_UNDEFINED                                         0x00
450 #define UX_DEVICE_CLASS_VIDEO_RC_UNDEFINED                                                   0x00
451 #define UX_DEVICE_CLASS_VIDEO_SET_CUR                                                        0x01
452 #define UX_DEVICE_CLASS_VIDEO_GET_CUR                                                        0x81
453 #define UX_DEVICE_CLASS_VIDEO_GET_MIN                                                        0x82
454 #define UX_DEVICE_CLASS_VIDEO_GET_MAX                                                        0x83
455 #define UX_DEVICE_CLASS_VIDEO_GET_RES                                                        0x84
456 #define UX_DEVICE_CLASS_VIDEO_GET_INFO                                                       0x86
457 #define UX_DEVICE_CLASS_VIDEO_GET_DEF                                                        0x87
458 #define UX_DEVICE_CLASS_VIDEO_GET_CUR_ALL                                                    0x91
459 #define UX_DEVICE_CLASS_VIDEO_GET_MIN_ALL                                                    0x92
460 #define UX_DEVICE_CLASS_VIDEO_GET_MAX_ALL                                                    0x93
461 #define UX_DEVICE_CLASS_VIDEO_GET_RES_ALL                                                    0x94
462 #define UX_DEVICE_CLASS_VIDEO_GET_GET_DEF_ALL                                                0x97
463 
464 
465 /* Define Video Class Device Power Modes.  */
466 #define UX_DEVICE_CLASS_VIDEO_POWER_MODE_MASK                                                0x0Fu
467 #define UX_DEVICE_CLASS_VIDEO_POWER_MODE_FULL                                                0x00u
468 #define UX_DEVICE_CLASS_VIDEO_POWER_MODE_DEVICE_DEPENDENT                                    0x01u
469 #define UX_DEVICE_CLASS_VIDEO_POWER_DEPENDENT_MODE_SUPPORTED                                 0x10u
470 #define UX_DEVICE_CLASS_VIDEO_POWER_USES_USB                                                 0x20u
471 #define UX_DEVICE_CLASS_VIDEO_POWER_USES_BATTERY                                             0x40u
472 #define UX_DEVICE_CLASS_VIDEO_POWER_USES_AC                                                  0x80u
473 
474 
475 /* Define Video Class Request Error Codes.  */
476 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_NO_ERROR                                    0x00
477 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_NOT_READY                                   0x01
478 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_WRONG_STATE                                 0x02
479 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_POWER                                       0x03
480 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_OUT_OF_RANGE                                0x04
481 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_INPUT                               0x05
482 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_CONTROL                             0x06
483 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_REQUEST                             0x07
484 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_VALUE_WITHIN_RANGE                  0x08
485 #define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_UNKNOWN                                     0xFF
486 
487 
488 /* Define Video Class Probe and Commit Controls */
489 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_LENGTH_1_1                                        34
490 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_LENGTH_1_5                                        48
491 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_HINT_OFFSET                                       0
492 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_FORMAT_INDEX_OFFSET                               2
493 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_FRAME_INDEX_OFFSET                                3
494 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_FRAME_INTERVAL_OFFSET                             4
495 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_KEY_FRAME_RATE_OFFSET                             8
496 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_PFRAME_RAE_OFFSET                                 10
497 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_COMP_QUALITY_OFFSET                               12
498 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_COMP_WINDOW_SIZE_OFFSET                           14
499 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_DELAY_OFFSET                                      16
500 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MAX_VIDEO_FRAME_SIZE_OFFSET                       18
501 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MAX_PAYLOAD_TRANSFER_SIZE_OFFSET                  22
502 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CLOCK_FREQUENCY_OFFSET                            26
503 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_FRAMING_INFO_OFFSET                               30
504 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_PREFERED_VERSION_OFFSET                           31
505 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MIN_VERSION_OFFSET                                32
506 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MAX_VERSION_OFFSET                                33
507 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_USAGE_OFFSET                                      34
508 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_BIT_DEPTH_LUMA_OFFSET                             35
509 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_SETTINGS_OFFSET                                   36
510 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MAX_NUMBER_OF_REF_FRAMES_PLUS1_OFFSET             37
511 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_RATE_CONTROL_MODES_OFFSET                         38
512 #define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_LAYOUT_PER_STREAM_OFFSET                          40
513 
514 
515 /* Define Video Class Stream Error Codes.  */
516 #define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_NO_ERROR                                     0
517 #define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_PROTECTED_CONTENT                            1
518 #define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_INPUT_BUFFER_UNDERRUN                        2
519 #define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_DATA_DISCONTINUITY                           3
520 #define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_OUTPUT_BUFFER_UNDERRUN                       4
521 #define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_OUTPUT_BUFFER_OVERRUN                        5
522 #define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_FORMAT_CHANGE                                6
523 #define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_STILL_IMAGE_CAPTURE_ERROR                    7
524 
525 
526 /* Define Video Class Task states.  */
527 #define UX_DEVICE_CLASS_VIDEO_STREAM_RW_STOP            (UX_STATE_RESET)
528 #define UX_DEVICE_CLASS_VIDEO_STREAM_RW_START           (UX_STATE_STEP + 1)
529 #define UX_DEVICE_CLASS_VIDEO_STREAM_RW_WAIT            (UX_STATE_STEP + 2)
530 
531 
532 /* Define Video Class callback structure.  */
533 
534 struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT;
535 struct UX_DEVICE_CLASS_VIDEO_STRUCT;
536 
537 typedef struct UX_DEVICE_CLASS_VIDEO_CALLBACKS_STRUCT
538 {
539 
540     VOID        (*ux_slave_class_video_instance_activate)(VOID *);
541     VOID        (*ux_slave_class_video_instance_deactivate)(VOID *);
542     UINT        (*ux_device_class_video_request)(struct UX_DEVICE_CLASS_VIDEO_STRUCT *, UX_SLAVE_TRANSFER *);
543     VOID         *ux_device_class_video_arg;
544 } UX_DEVICE_CLASS_VIDEO_CALLBACKS;
545 
546 typedef struct UX_DEVICE_CLASS_VIDEO_STREAM_CALLBACKS_STRUCT
547 {
548     VOID        (*ux_device_class_video_stream_change)(struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT *, ULONG);
549     UINT        (*ux_device_class_video_stream_request)(struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT *, UX_SLAVE_TRANSFER *);
550     VOID        (*ux_device_class_video_stream_payload_done)(struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT *, ULONG);
551 } UX_DEVICE_CLASS_VIDEO_STREAM_CALLBACKS;
552 
553 
554 /* Define Video Class Calling Parameter structure */
555 
556 typedef struct UX_DEVICE_CLASS_VIDEO_PAYLOAD_STRUCT
557 {
558 
559     ULONG                                   ux_device_class_video_payload_length;
560     UCHAR                                   ux_device_class_video_payload_data[4]; /* Actually size of length.  */
561 } UX_DEVICE_CLASS_VIDEO_PAYLOAD;
562 
563 typedef struct UX_DEVICE_CLASS_VIDEO_STREAM_PARAMETER_STRUCT
564 {
565 #if defined(UX_DEVICE_STANDALONE)
566     UINT                                   (*ux_device_class_video_stream_parameter_task_function)(struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT*);
567 #else
568     ULONG                                    ux_device_class_video_stream_parameter_thread_stack_size;
569     VOID                                   (*ux_device_class_video_stream_parameter_thread_entry)(ULONG id);
570 #endif
571     UX_DEVICE_CLASS_VIDEO_STREAM_CALLBACKS   ux_device_class_video_stream_parameter_callbacks;
572 
573     ULONG                                    ux_device_class_video_stream_parameter_max_payload_buffer_size;
574     ULONG                                    ux_device_class_video_stream_parameter_max_payload_buffer_nb;
575 } UX_DEVICE_CLASS_VIDEO_STREAM_PARAMETER;
576 
577 typedef struct UX_DEVICE_CLASS_VIDEO_PARAMETER_STRUCT
578 {
579     ULONG                                    ux_device_class_video_parameter_master_interface;
580     UX_DEVICE_CLASS_VIDEO_CALLBACKS          ux_device_class_video_parameter_callbacks;
581 
582     ULONG                                    ux_device_class_video_parameter_streams_nb;
583     UX_DEVICE_CLASS_VIDEO_STREAM_PARAMETER  *ux_device_class_video_parameter_streams;
584 } UX_DEVICE_CLASS_VIDEO_PARAMETER;
585 
586 typedef struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT
587 {
588 
589     struct UX_DEVICE_CLASS_VIDEO_STRUCT     *ux_device_class_video_stream_video;
590     UX_SLAVE_INTERFACE                      *ux_device_class_video_stream_interface;
591     UX_SLAVE_ENDPOINT                       *ux_device_class_video_stream_endpoint;
592 
593     ULONG                                    ux_device_class_video_stream_error;
594 
595     UX_DEVICE_CLASS_VIDEO_STREAM_CALLBACKS   ux_device_class_video_stream_callbacks;
596 
597 #if !defined(UX_DEVICE_STANDALONE)
598     UCHAR                                   *ux_device_class_video_stream_thread_stack;
599     UX_THREAD                                ux_device_class_video_stream_thread;
600 #else
601     UINT                                   (*ux_device_class_video_stream_task_function)(struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT*);
602     UINT                                    ux_device_class_video_stream_task_state;
603     UINT                                    ux_device_class_video_stream_task_status;
604 #endif
605 
606     ULONG                                   ux_device_class_video_stream_buffer_error_count;
607     UCHAR                                   *ux_device_class_video_stream_buffer;
608     ULONG                                    ux_device_class_video_stream_buffer_size;
609     ULONG                                    ux_device_class_video_stream_payload_buffer_size;
610 
611     UX_DEVICE_CLASS_VIDEO_PAYLOAD           *ux_device_class_video_stream_transfer_pos;
612     UX_DEVICE_CLASS_VIDEO_PAYLOAD           *ux_device_class_video_stream_access_pos;
613 } UX_DEVICE_CLASS_VIDEO_STREAM;
614 #define _ux_device_class_video_stream_error_set(s,e) do {                       \
615     (s)->ux_device_class_video_stream_error = (e);                              \
616 } while(0)
617 
618 typedef struct UX_DEVICE_CLASS_VIDEO_STRUCT
619 {
620 
621     UX_SLAVE_CLASS                          *ux_device_class_video_class;
622     UX_SLAVE_DEVICE                         *ux_device_class_video_device;
623     UX_SLAVE_INTERFACE                      *ux_device_class_video_interface;
624 
625     ULONG                                    ux_device_class_video_error;
626 
627     UX_DEVICE_CLASS_VIDEO_CALLBACKS          ux_device_class_video_callbacks;
628 
629     ULONG                                    ux_device_class_video_streams_nb;
630     UX_DEVICE_CLASS_VIDEO_STREAM            *ux_device_class_video_streams;
631 
632 } UX_DEVICE_CLASS_VIDEO;
633 #define _ux_device_class_video_request_error_set(v,e) do {                      \
634     (v)->ux_device_class_video_error = (e);                                     \
635 } while(0)
636 
637 
638 /* Define Video Class function prototypes.  */
639 
640 UINT    _ux_device_class_video_initialize(UX_SLAVE_CLASS_COMMAND *command);
641 UINT    _ux_device_class_video_uninitialize(UX_SLAVE_CLASS_COMMAND *command);
642 UINT    _ux_device_class_video_activate(UX_SLAVE_CLASS_COMMAND *command);
643 UINT    _ux_device_class_video_change(UX_SLAVE_CLASS_COMMAND *command);
644 UINT    _ux_device_class_video_deactivate(UX_SLAVE_CLASS_COMMAND *command);
645 UINT    _ux_device_class_video_control_request(UX_SLAVE_CLASS_COMMAND *command);
646 
647 UINT    _ux_device_class_video_entry(UX_SLAVE_CLASS_COMMAND *command);
648 
649 UINT    _ux_device_class_video_ioctl(UX_DEVICE_CLASS_VIDEO *video, ULONG ioctl_function,
650                                      VOID *parameter);
651 
652 UINT    _ux_device_class_video_stream_get(UX_DEVICE_CLASS_VIDEO *video, ULONG stream_index, UX_DEVICE_CLASS_VIDEO_STREAM **stream);
653 
654 VOID    _ux_device_class_video_write_thread_entry(ULONG video_stream);
655 VOID    _ux_device_class_video_read_thread_entry(ULONG video_stream);
656 
657 ULONG   _ux_device_class_video_max_payload_length(UX_DEVICE_CLASS_VIDEO_STREAM *video);
658 
659 UINT    _ux_device_class_video_reception_start(UX_DEVICE_CLASS_VIDEO_STREAM *video);
660 
661 UINT    _ux_device_class_video_read_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *video, UCHAR **payload_data, ULONG *payload_length);
662 UINT    _ux_device_class_video_read_payload_free(UX_DEVICE_CLASS_VIDEO_STREAM *video);
663 
664 UINT    _ux_device_class_video_transmission_start(UX_DEVICE_CLASS_VIDEO_STREAM *video);
665 
666 UINT    _ux_device_class_video_write_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *video, UCHAR **buffer, ULONG *max_length);
667 UINT    _ux_device_class_video_write_payload_commit(UX_DEVICE_CLASS_VIDEO_STREAM *video, ULONG length);
668 
669 UINT    _ux_device_class_video_tasks_run(VOID *instance);
670 UINT    _ux_device_class_video_read_task_function(UX_DEVICE_CLASS_VIDEO_STREAM *stream);
671 UINT    _ux_device_class_video_write_task_function(UX_DEVICE_CLASS_VIDEO_STREAM *stream);
672 
673 UINT    _uxe_device_class_video_initialize(UX_SLAVE_CLASS_COMMAND *command);
674 ULONG   _uxe_device_class_video_max_payload_length(UX_DEVICE_CLASS_VIDEO_STREAM *video);
675 UINT    _uxe_device_class_video_reception_start(UX_DEVICE_CLASS_VIDEO_STREAM *video);
676 UINT    _uxe_device_class_video_read_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *video, UCHAR **payload_data, ULONG *payload_length);
677 UINT    _uxe_device_class_video_read_payload_free(UX_DEVICE_CLASS_VIDEO_STREAM *video);
678 UINT    _uxe_device_class_video_transmission_start(UX_DEVICE_CLASS_VIDEO_STREAM *video);
679 UINT    _uxe_device_class_video_write_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *video, UCHAR **buffer, ULONG *max_length);
680 UINT    _uxe_device_class_video_write_payload_commit(UX_DEVICE_CLASS_VIDEO_STREAM *video, ULONG length);
681 UINT    _uxe_device_class_video_ioctl(UX_DEVICE_CLASS_VIDEO *video, ULONG ioctl_function, VOID *parameter);
682 
683 /* Define Video Class API prototypes.  */
684 
685 #if defined(UX_DEVICE_CLASS_VIDEO_ENABLE_ERROR_CHECKING)
686 
687 #define ux_device_class_video_entry                   _ux_device_class_video_entry
688 
689 #define ux_device_class_video_read_thread_entry       _ux_device_class_video_read_thread_entry
690 #define ux_device_class_video_write_thread_entry      _ux_device_class_video_write_thread_entry
691 
692 #define ux_device_class_video_request_error_set       _ux_device_class_video_request_error_set
693 #define ux_device_class_video_stream_error_set        _ux_device_class_video_stream_error_set
694 
695 #define ux_device_class_video_stream_get              _ux_device_class_video_stream_get
696 
697 #define ux_device_class_video_max_payload_length      _uxe_device_class_video_max_payload_length
698 
699 #define ux_device_class_video_reception_start         _uxe_device_class_video_reception_start
700 
701 #define ux_device_class_video_read_payload_get        _uxe_device_class_video_read_payload_get
702 #define ux_device_class_video_read_payload_free       _uxe_device_class_video_read_payload_free
703 
704 #define ux_device_class_video_transmission_start      _uxe_device_class_video_transmission_start
705 
706 #define ux_device_class_video_write_payload_get       _uxe_device_class_video_write_payload_get
707 #define ux_device_class_video_write_payload_commit    _uxe_device_class_video_write_payload_commit
708 
709 #define ux_device_class_video_ioctl                   _uxe_device_class_video_ioctl
710 
711 #define ux_device_class_video_read_task_function      _ux_device_class_video_read_task_function
712 #define ux_device_class_video_write_task_function     _ux_device_class_video_write_task_function
713 
714 #else
715 
716 #define ux_device_class_video_entry                   _ux_device_class_video_entry
717 
718 #define ux_device_class_video_read_thread_entry       _ux_device_class_video_read_thread_entry
719 #define ux_device_class_video_write_thread_entry      _ux_device_class_video_write_thread_entry
720 
721 #define ux_device_class_video_request_error_set       _ux_device_class_video_request_error_set
722 #define ux_device_class_video_stream_error_set        _ux_device_class_video_stream_error_set
723 
724 #define ux_device_class_video_stream_get              _ux_device_class_video_stream_get
725 
726 #define ux_device_class_video_max_payload_length      _ux_device_class_video_max_payload_length
727 
728 #define ux_device_class_video_reception_start         _ux_device_class_video_reception_start
729 
730 #define ux_device_class_video_read_payload_get        _ux_device_class_video_read_payload_get
731 #define ux_device_class_video_read_payload_free       _ux_device_class_video_read_payload_free
732 
733 #define ux_device_class_video_transmission_start      _ux_device_class_video_transmission_start
734 
735 #define ux_device_class_video_write_payload_get       _ux_device_class_video_write_payload_get
736 #define ux_device_class_video_write_payload_commit    _ux_device_class_video_write_payload_commit
737 
738 #define ux_device_class_video_ioctl                   _ux_device_class_video_ioctl
739 
740 #define ux_device_class_video_read_task_function      _ux_device_class_video_read_task_function
741 #define ux_device_class_video_write_task_function     _ux_device_class_video_write_task_function
742 
743 #endif  /* UX_DEVICE_CLASS_VIDEO_ENABLE_ERROR_CHECKING */
744 
745 /* Determine if a C++ compiler is being used.  If so, complete the standard
746    C conditional started above.  */
747 #ifdef __cplusplus
748 }
749 #endif
750 
751 #endif
752