Fix TdiBuildBaseIrp by adding the missing ;
[reactos.git] / include / ddk / usbcamdi.h
1 /*
2 * usbcamdi.h
3 *
4 * USB Camera driver interface.
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23 #ifndef __USBCAMDI_H
24 #define __USBCAMDI_H
25
26 #if !defined(__USB_H) && !defined(__USBDI_H)
27 #error include usb.h or usbdi.h before usbcamdi.h
28 #else
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #pragma pack(push,4)
35
36 #if defined(_BATTERYCLASS_)
37 #define USBCAMAPI
38 #else
39 #define USBCAMAPI DECLSPEC_IMPORT
40 #endif
41
42
43 /* FIXME: Unknown definition */
44 typedef PVOID PHW_STREAM_REQUEST_BLOCK;
45
46 DEFINE_GUID(GUID_USBCAMD_INTERFACE,
47 0x2bcb75c0, 0xb27f, 0x11d1, 0xba, 0x41, 0x0, 0xa0, 0xc9, 0xd, 0x2b, 0x5);
48
49 #define USBCAMD_PROCESSPACKETEX_DropFrame 0x0002
50 #define USBCAMD_PROCESSPACKETEX_NextFrameIsStill 0x0004
51 #define USBCAMD_PROCESSPACKETEX_CurrentFrameIsStill 0x0008
52
53 #define USBCAMD_DATA_PIPE 0x0001
54 #define USBCAMD_MULTIPLEX_PIPE 0x0002
55 #define USBCAMD_SYNC_PIPE 0x0004
56 #define USBCAMD_DONT_CARE_PIPE 0x0008
57
58 #define USBCAMD_VIDEO_STREAM 0x1
59 #define USBCAMD_STILL_STREAM 0x2
60 #define USBCAMD_VIDEO_STILL_STREAM (USBCAMD_VIDEO_STREAM | USBCAMD_STILL_STREAM)
61
62 #define USBCAMD_STOP_STREAM 0x00000001
63 #define USBCAMD_START_STREAM 0x00000000
64
65 typedef struct _pipe_config_descriptor {
66 CHAR StreamAssociation;
67 UCHAR PipeConfigFlags;
68 } USBCAMD_Pipe_Config_Descriptor, *PUSBCAMD_Pipe_Config_Descriptor;
69
70 typedef enum {
71 USBCAMD_CamControlFlag_NoVideoRawProcessing = 1,
72 USBCAMD_CamControlFlag_NoStillRawProcessing = 2,
73 USBCAMD_CamControlFlag_AssociatedFormat = 4,
74 USBCAMD_CamControlFlag_EnableDeviceEvents = 8
75 } USBCAMD_CamControlFlags;
76
77 typedef NTSTATUS
78 (DDKAPI *PCAM_ALLOCATE_BW_ROUTINE)(
79 PDEVICE_OBJECT BusDeviceObject,
80 PVOID DeviceContext,
81 PULONG RawFrameLength,
82 PVOID Format);
83
84 typedef NTSTATUS
85 (DDKAPI *PCAM_ALLOCATE_BW_ROUTINE_EX)(
86 PDEVICE_OBJECT BusDeviceObject,
87 PVOID DeviceContext,
88 PULONG RawFrameLength,
89 PVOID Format,
90 ULONG StreamNumber);
91
92 typedef NTSTATUS
93 (DDKAPI *PCAM_CONFIGURE_ROUTINE)(
94 PDEVICE_OBJECT BusDeviceObject,
95 PVOID DeviceContext,
96 PUSBD_INTERFACE_INFORMATION Interface,
97 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
98 PLONG DataPipeIndex,
99 PLONG SyncPipeIndex);
100
101 typedef NTSTATUS
102 (DDKAPI *PCAM_CONFIGURE_ROUTINE_EX)(
103 PDEVICE_OBJECT BusDeviceObject,
104 PVOID DeviceContext,
105 PUSBD_INTERFACE_INFORMATION Interface,
106 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
107 ULONG PipeConfigListSize,
108 PUSBCAMD_Pipe_Config_Descriptor PipeConfig,
109 PUSB_DEVICE_DESCRIPTOR DeviceDescriptor);
110
111 typedef NTSTATUS
112 (DDKAPI *PCAM_FREE_BW_ROUTINE)(
113 PDEVICE_OBJECT BusDeviceObject,
114 PVOID DeviceContext);
115
116 typedef NTSTATUS
117 (DDKAPI *PCAM_FREE_BW_ROUTINE_EX)(
118 PDEVICE_OBJECT BusDeviceObject,
119 PVOID DeviceContext,
120 ULONG StreamNumber);
121
122 typedef NTSTATUS
123 (DDKAPI *PCAM_INITIALIZE_ROUTINE)(
124 PDEVICE_OBJECT BusDeviceObject,
125 PVOID DeviceContext);
126
127 typedef VOID
128 (DDKAPI *PCAM_NEW_FRAME_ROUTINE)(
129 PVOID DeviceContext,
130 PVOID FrameContext);
131
132 typedef VOID
133 (DDKAPI *PCAM_NEW_FRAME_ROUTINE_EX)(
134 PVOID DeviceContext,
135 PVOID FrameContext,
136 ULONG StreamNumber,
137 PULONG FrameLength);
138
139 typedef NTSTATUS
140 (DDKAPI *PCAM_PROCESS_RAW_FRAME_ROUTINE)(
141 PDEVICE_OBJECT BusDeviceObject,
142 PVOID DeviceContext,
143 PVOID FrameContext,
144 PVOID FrameBuffer,
145 ULONG FrameLength,
146 PVOID RawFrameBuffer,
147 ULONG RawFrameLength,
148 ULONG NumberOfPackets,
149 PULONG BytesReturned);
150
151 typedef NTSTATUS
152 (DDKAPI *PCAM_PROCESS_RAW_FRAME_ROUTINE_EX)(
153 PDEVICE_OBJECT BusDeviceObject,
154 PVOID DeviceContext,
155 PVOID FrameContext,
156 PVOID FrameBuffer,
157 ULONG FrameLength,
158 PVOID RawFrameBuffer,
159 ULONG RawFrameLength,
160 ULONG NumberOfPackets,
161 PULONG BytesReturned,
162 ULONG ActualRawFrameLength,
163 ULONG StreamNumber);
164
165 typedef ULONG
166 (DDKAPI *PCAM_PROCESS_PACKET_ROUTINE)(
167 PDEVICE_OBJECT BusDeviceObject,
168 PVOID DeviceContext,
169 PVOID CurrentFrameContext,
170 PUSBD_ISO_PACKET_DESCRIPTOR SyncPacket,
171 PVOID SyncBuffer,
172 PUSBD_ISO_PACKET_DESCRIPTOR DataPacket,
173 PVOID DataBuffer,
174 PBOOLEAN FrameComplete,
175 PBOOLEAN NextFrameIsStill);
176
177 typedef ULONG
178 (DDKAPI *PCAM_PROCESS_PACKET_ROUTINE_EX)(
179 PDEVICE_OBJECT BusDeviceObject,
180 PVOID DeviceContext,
181 PVOID CurrentFrameContext,
182 PUSBD_ISO_PACKET_DESCRIPTOR SyncPacket,
183 PVOID SyncBuffer,
184 PUSBD_ISO_PACKET_DESCRIPTOR DataPacket,
185 PVOID DataBuffer,
186 PBOOLEAN FrameComplete,
187 PULONG PacketFlag,
188 PULONG ValidDataOffset);
189
190 typedef NTSTATUS
191 (DDKAPI *PCAM_STATE_ROUTINE)(
192 PDEVICE_OBJECT BusDeviceObject,
193 PVOID DeviceContext);
194
195 typedef NTSTATUS
196 (DDKAPI *PCAM_START_CAPTURE_ROUTINE)(
197 PDEVICE_OBJECT BusDeviceObject,
198 PVOID DeviceContext);
199
200 typedef NTSTATUS
201 (DDKAPI *PCAM_START_CAPTURE_ROUTINE_EX)(
202 PDEVICE_OBJECT BusDeviceObject,
203 PVOID DeviceContext,
204 ULONG StreamNumber);
205
206 typedef NTSTATUS
207 (DDKAPI *PCAM_STOP_CAPTURE_ROUTINE)(
208 PDEVICE_OBJECT BusDeviceObject,
209 PVOID DeviceContext);
210
211 typedef NTSTATUS
212 (DDKAPI *PCAM_STOP_CAPTURE_ROUTINE_EX)(
213 PDEVICE_OBJECT BusDeviceObject,
214 PVOID DeviceContext,
215 ULONG StreamNumber);
216
217 typedef struct _USBCAMD_DEVICE_DATA {
218 ULONG Sig;
219 PCAM_INITIALIZE_ROUTINE CamInitialize;
220 PCAM_INITIALIZE_ROUTINE CamUnInitialize;
221 PCAM_PROCESS_PACKET_ROUTINE CamProcessUSBPacket;
222 PCAM_NEW_FRAME_ROUTINE CamNewVideoFrame;
223 PCAM_PROCESS_RAW_FRAME_ROUTINE CamProcessRawVideoFrame;
224 PCAM_START_CAPTURE_ROUTINE CamStartCapture;
225 PCAM_STOP_CAPTURE_ROUTINE CamStopCapture;
226 PCAM_CONFIGURE_ROUTINE CamConfigure;
227 PCAM_STATE_ROUTINE CamSaveState;
228 PCAM_STATE_ROUTINE CamRestoreState;
229 PCAM_ALLOCATE_BW_ROUTINE CamAllocateBandwidth;
230 PCAM_FREE_BW_ROUTINE CamFreeBandwidth;
231 } USBCAMD_DEVICE_DATA, *PUSBCAMD_DEVICE_DATA;
232
233 typedef struct _USBCAMD_DEVICE_DATA2 {
234 ULONG Sig;
235 PCAM_INITIALIZE_ROUTINE CamInitialize;
236 PCAM_INITIALIZE_ROUTINE CamUnInitialize;
237 PCAM_PROCESS_PACKET_ROUTINE_EX CamProcessUSBPacketEx;
238 PCAM_NEW_FRAME_ROUTINE_EX CamNewVideoFrameEx;
239 PCAM_PROCESS_RAW_FRAME_ROUTINE_EX CamProcessRawVideoFrameEx;
240 PCAM_START_CAPTURE_ROUTINE_EX CamStartCaptureEx;
241 PCAM_STOP_CAPTURE_ROUTINE_EX CamStopCaptureEx;
242 PCAM_CONFIGURE_ROUTINE_EX CamConfigureEx;
243 PCAM_STATE_ROUTINE CamSaveState;
244 PCAM_STATE_ROUTINE CamRestoreState;
245 PCAM_ALLOCATE_BW_ROUTINE_EX CamAllocateBandwidthEx;
246 PCAM_FREE_BW_ROUTINE_EX CamFreeBandwidthEx;
247 } USBCAMD_DEVICE_DATA2, *PUSBCAMD_DEVICE_DATA2;
248
249 USBCAMAPI
250 ULONG
251 DDKAPI
252 USBCAMD_InitializeNewInterface(
253 IN PVOID DeviceContext,
254 IN PVOID DeviceData,
255 IN ULONG Version,
256 IN ULONG CamControlFlag);
257
258 typedef VOID
259 (DDKAPI *PCOMMAND_COMPLETE_FUNCTION)(
260 PVOID DeviceContext,
261 PVOID CommandContext,
262 NTSTATUS NtStatus);
263
264 typedef NTSTATUS
265 (DDKAPI *PFNUSBCAMD_BulkReadWrite)(
266 IN PVOID DeviceContext,
267 IN USHORT PipeIndex,
268 IN PVOID Buffer,
269 IN ULONG BufferLength,
270 IN PCOMMAND_COMPLETE_FUNCTION CommandComplete,
271 IN PVOID CommandContext);
272
273 typedef NTSTATUS
274 (DDKAPI *PFNUSBCAMD_SetIsoPipeState)(
275 IN PVOID DeviceContext,
276 IN ULONG PipeStateFlags);
277
278 typedef NTSTATUS
279 (DDKAPI *PFNUSBCAMD_CancelBulkReadWrite)(
280 IN PVOID DeviceContext,
281 IN ULONG PipeIndex);
282
283 typedef NTSTATUS
284 (DDKAPI *PFNUSBCAMD_SetVideoFormat)(
285 IN PVOID DeviceContext,
286 IN PHW_STREAM_REQUEST_BLOCK pSrb);
287
288 typedef NTSTATUS
289 (DDKAPI *PFNUSBCAMD_WaitOnDeviceEvent)(
290 IN PVOID DeviceContext,
291 IN ULONG PipeIndex,
292 IN PVOID Buffer,
293 IN ULONG BufferLength,
294 IN PCOMMAND_COMPLETE_FUNCTION EventComplete,
295 IN PVOID EventContext,
296 IN BOOLEAN LoopBack);
297
298 USBCAMAPI
299 PVOID
300 DDKAPI
301 USBCAMD_AdapterReceivePacket(
302 IN PHW_STREAM_REQUEST_BLOCK Srb,
303 IN PUSBCAMD_DEVICE_DATA DeviceData,
304 IN PDEVICE_OBJECT *DeviceObject,
305 IN BOOLEAN NeedsCompletion);
306
307 USBCAMAPI
308 NTSTATUS
309 DDKAPI
310 USBCAMD_ControlVendorCommand(
311 IN PVOID DeviceContext,
312 IN UCHAR Request,
313 IN USHORT Value,
314 IN USHORT Index,
315 IN PVOID Buffer,
316 IN OUT PULONG BufferLength,
317 IN BOOLEAN GetData,
318 IN PCOMMAND_COMPLETE_FUNCTION CommandComplete,
319 IN PVOID CommandContext);
320
321 typedef VOID
322 (DDKAPI *PADAPTER_RECEIVE_PACKET_ROUTINE)(
323 IN PHW_STREAM_REQUEST_BLOCK Srb);
324
325 USBCAMAPI
326 ULONG
327 DDKAPI
328 USBCAMD_DriverEntry(
329 PVOID Context1,
330 PVOID Context2,
331 ULONG DeviceContextSize,
332 ULONG FrameContextSize,
333 PADAPTER_RECEIVE_PACKET_ROUTINE ReceivePacket);
334
335 USBCAMAPI
336 NTSTATUS
337 DDKAPI
338 USBCAMD_GetRegistryKeyValue(
339 IN HANDLE Handle,
340 IN PWCHAR KeyNameString,
341 IN ULONG KeyNameStringLength,
342 IN PVOID Data,
343 IN ULONG DataLength);
344
345 USBCAMAPI
346 NTSTATUS
347 DDKAPI
348 USBCAMD_SelectAlternateInterface(
349 IN PVOID DeviceContext,
350 IN OUT PUSBD_INTERFACE_INFORMATION RequestInterface);
351
352 #define USBCAMD_VERSION_200 0x200
353
354 typedef struct _USBCAMD_INTERFACE {
355 INTERFACE Interface;
356 PFNUSBCAMD_WaitOnDeviceEvent USBCAMD_WaitOnDeviceEvent;
357 PFNUSBCAMD_BulkReadWrite USBCAMD_BulkReadWrite;
358 PFNUSBCAMD_SetVideoFormat USBCAMD_SetVideoFormat;
359 PFNUSBCAMD_SetIsoPipeState USBCAMD_SetIsoPipeState;
360 PFNUSBCAMD_CancelBulkReadWrite USBCAMD_CancelBulkReadWrite;
361 } USBCAMD_INTERFACE, *PUSBCAMD_INTERFACE;
362
363 typedef VOID
364 (DDKAPI *PSTREAM_RECEIVE_PACKET)(
365 IN PVOID Srb,
366 IN PVOID DeviceContext,
367 IN PBOOLEAN Completed);
368
369 #if defined(DEBUG_LOG)
370
371 USBCAMAPI
372 VOID
373 DDKAPI
374 USBCAMD_Debug_LogEntry(
375 IN CHAR *Name,
376 IN ULONG Info1,
377 IN ULONG Info2,
378 IN ULONG Info3);
379
380 #define ILOGENTRY(sig, info1, info2, info3) \
381 USBCAMD_Debug_LogEntry(sig, (ULONG)info1, (ULONG)info2, (ULONG)info3)
382
383 #else
384
385 #define ILOGENTRY(sig, info1, info2, info3)
386
387 #endif /* DEBUG_LOG */
388
389 #pragma pack(pop)
390
391 #ifdef __cplusplus
392 }
393 #endif
394
395 #endif /* !defined(__USB_H) && !defined(__USBDI_H) */
396
397
398 #endif /* __USBCAMDI_H */