source: Daodan/MinGW/include/ddk/usbcamdi.h@ 1142

Last change on this file since 1142 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

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