source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/ddk/strmini.h@ 1171

Last change on this file since 1171 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 14.4 KB
Line 
1#ifndef _STREAM_H
2#define _STREAM_H
3
4#include <ntddk.h>
5#include <windef.h>
6#include <ks.h>
7
8#if defined(_ARM_)
9#define STREAMAPI
10#else
11#define STREAMAPI __stdcall
12#endif
13
14#define STREAM_SYSTEM_TIME_MASK ((STREAM_SYSTEM_TIME)0x00000001FFFFFFFF)
15
16typedef enum {
17 DebugLevelFatal = 0,
18 DebugLevelError,
19 DebugLevelWarning,
20 DebugLevelInfo,
21 DebugLevelTrace,
22 DebugLevelVerbose,
23 DebugLevelMaximum
24} STREAM_DEBUG_LEVEL;
25
26
27#if DBG
28
29#define DebugPrint(x) StreamClassDebugPrint x
30#define DEBUG_BREAKPOINT() DbgBreakPoint()
31#define DEBUG_ASSERT(exp) \
32 if ( !(exp) ) { \
33 StreamClassDebugAssert( __FILE__, __LINE__, #exp, exp); \
34 }
35#else
36
37#define DebugPrint(x)
38#define DEBUG_BREAKPOINT()
39#define DEBUG_ASSERT(exp)
40
41#endif
42
43typedef PHYSICAL_ADDRESS STREAM_PHYSICAL_ADDRESS, *PSTREAM_PHYSICAL_ADDRESS;
44__GNU_EXTENSION typedef unsigned __int64 STREAM_SYSTEM_TIME, *PSTREAM_SYSTEM_TIME;
45__GNU_EXTENSION typedef unsigned __int64 STREAM_TIMESTAMP, *PSTREAM_TIMESTAMP;
46
47typedef enum {
48 TIME_GET_STREAM_TIME,
49 TIME_READ_ONBOARD_CLOCK,
50 TIME_SET_ONBOARD_CLOCK
51} TIME_FUNCTION;
52
53typedef struct _HW_TIME_CONTEXT {
54 struct _HW_DEVICE_EXTENSION *HwDeviceExtension;
55 struct _HW_STREAM_OBJECT *HwStreamObject;
56 TIME_FUNCTION Function;
57 ULONGLONG Time;
58 ULONGLONG SystemTime;
59} HW_TIME_CONTEXT, *PHW_TIME_CONTEXT;
60
61typedef struct _HW_EVENT_DESCRIPTOR {
62 BOOLEAN Enable;
63 PKSEVENT_ENTRY EventEntry;
64 PKSEVENTDATA EventData;
65 __GNU_EXTENSION union {
66 struct _HW_STREAM_OBJECT * StreamObject;
67 struct _HW_DEVICE_EXTENSION *DeviceExtension;
68 };
69 ULONG EnableEventSetIndex;
70 PVOID HwInstanceExtension;
71 ULONG Reserved;
72} HW_EVENT_DESCRIPTOR, *PHW_EVENT_DESCRIPTOR;
73
74struct _HW_STREAM_REQUEST_BLOCK;
75
76typedef VOID (STREAMAPI * PHW_RECEIVE_STREAM_DATA_SRB) (IN struct _HW_STREAM_REQUEST_BLOCK * SRB);
77typedef VOID (STREAMAPI * PHW_RECEIVE_STREAM_CONTROL_SRB) (IN struct _HW_STREAM_REQUEST_BLOCK * SRB);
78typedef NTSTATUS (STREAMAPI * PHW_EVENT_ROUTINE) (IN PHW_EVENT_DESCRIPTOR EventDescriptor);
79typedef VOID (STREAMAPI * PHW_CLOCK_FUNCTION) (IN PHW_TIME_CONTEXT HwTimeContext);
80
81typedef struct _HW_CLOCK_OBJECT {
82 PHW_CLOCK_FUNCTION HwClockFunction;
83 ULONG ClockSupportFlags;
84 ULONG Reserved[2];
85} HW_CLOCK_OBJECT, *PHW_CLOCK_OBJECT;
86
87#define CLOCK_SUPPORT_CAN_SET_ONBOARD_CLOCK 0x1
88#define CLOCK_SUPPORT_CAN_READ_ONBOARD_CLOCK 0x2
89#define CLOCK_SUPPORT_CAN_RETURN_STREAM_TIME 0x4
90
91typedef struct _HW_STREAM_OBJECT {
92 ULONG SizeOfThisPacket;
93 ULONG StreamNumber;
94 PVOID HwStreamExtension;
95 PHW_RECEIVE_STREAM_DATA_SRB ReceiveDataPacket;
96 PHW_RECEIVE_STREAM_CONTROL_SRB ReceiveControlPacket;
97 HW_CLOCK_OBJECT HwClockObject;
98 BOOLEAN Dma;
99 BOOLEAN Pio;
100 PVOID HwDeviceExtension;
101 ULONG StreamHeaderMediaSpecific;
102 ULONG StreamHeaderWorkspace;
103 BOOLEAN Allocator;
104 PHW_EVENT_ROUTINE HwEventRoutine;
105 ULONG Reserved[2];
106} HW_STREAM_OBJECT, *PHW_STREAM_OBJECT;
107
108typedef struct _HW_STREAM_HEADER {
109 ULONG NumberOfStreams;
110 ULONG SizeOfHwStreamInformation;
111 ULONG NumDevPropArrayEntries;
112 PKSPROPERTY_SET DevicePropertiesArray;
113 ULONG NumDevEventArrayEntries;
114 PKSEVENT_SET DeviceEventsArray;
115 PKSTOPOLOGY Topology;
116 PHW_EVENT_ROUTINE DeviceEventRoutine;
117 LONG NumDevMethodArrayEntries;
118 PKSMETHOD_SET DeviceMethodsArray;
119} HW_STREAM_HEADER, *PHW_STREAM_HEADER;
120
121typedef struct _HW_STREAM_INFORMATION {
122 ULONG NumberOfPossibleInstances;
123 KSPIN_DATAFLOW DataFlow;
124 BOOLEAN DataAccessible;
125 ULONG NumberOfFormatArrayEntries;
126 PKSDATAFORMAT* StreamFormatsArray;
127 PVOID ClassReserved[4];
128 ULONG NumStreamPropArrayEntries;
129 PKSPROPERTY_SET StreamPropertiesArray;
130 ULONG NumStreamEventArrayEntries;
131 PKSEVENT_SET StreamEventsArray;
132 GUID* Category;
133 GUID* Name;
134 ULONG MediumsCount;
135 const KSPIN_MEDIUM* Mediums;
136 BOOLEAN BridgeStream;
137 ULONG Reserved[2];
138} HW_STREAM_INFORMATION, *PHW_STREAM_INFORMATION;
139
140
141typedef struct _HW_STREAM_DESCRIPTOR {
142 HW_STREAM_HEADER StreamHeader;
143 HW_STREAM_INFORMATION StreamInfo;
144} HW_STREAM_DESCRIPTOR, *PHW_STREAM_DESCRIPTOR;
145
146typedef struct _STREAM_TIME_REFERENCE {
147 STREAM_TIMESTAMP CurrentOnboardClockValue;
148 LARGE_INTEGER OnboardClockFrequency;
149 LARGE_INTEGER CurrentSystemTime;
150 ULONG Reserved[2];
151} STREAM_TIME_REFERENCE, *PSTREAM_TIME_REFERENCE;
152
153typedef struct _STREAM_DATA_INTERSECT_INFO {
154 ULONG StreamNumber;
155 PKSDATARANGE DataRange;
156 PVOID DataFormatBuffer;
157 ULONG SizeOfDataFormatBuffer;
158} STREAM_DATA_INTERSECT_INFO, *PSTREAM_DATA_INTERSECT_INFO;
159
160typedef struct _STREAM_PROPERTY_DESCRIPTOR {
161 PKSPROPERTY Property;
162 ULONG PropertySetID;
163 PVOID PropertyInfo;
164 ULONG PropertyInputSize;
165 ULONG PropertyOutputSize;
166} STREAM_PROPERTY_DESCRIPTOR, *PSTREAM_PROPERTY_DESCRIPTOR;
167
168typedef struct _STREAM_METHOD_DESCRIPTOR {
169 ULONG MethodSetID;
170 PKSMETHOD Method;
171 PVOID MethodInfo;
172 LONG MethodInputSize;
173 LONG MethodOutputSize;
174} STREAM_METHOD_DESCRIPTOR, *PSTREAM_METHOD_DESCRIPTOR;
175
176#define STREAM_REQUEST_BLOCK_SIZE sizeof(STREAM_REQUEST_BLOCK)
177
178typedef enum _SRB_COMMAND {
179 SRB_READ_DATA,
180 SRB_WRITE_DATA,
181 SRB_GET_STREAM_STATE,
182 SRB_SET_STREAM_STATE,
183 SRB_SET_STREAM_PROPERTY,
184 SRB_GET_STREAM_PROPERTY,
185 SRB_OPEN_MASTER_CLOCK,
186
187 SRB_INDICATE_MASTER_CLOCK,
188 SRB_UNKNOWN_STREAM_COMMAND,
189 SRB_SET_STREAM_RATE,
190 SRB_PROPOSE_DATA_FORMAT,
191 SRB_CLOSE_MASTER_CLOCK,
192 SRB_PROPOSE_STREAM_RATE,
193 SRB_SET_DATA_FORMAT,
194 SRB_GET_DATA_FORMAT,
195 SRB_BEGIN_FLUSH,
196 SRB_END_FLUSH,
197
198 SRB_GET_STREAM_INFO = 0x100,
199 SRB_OPEN_STREAM,
200 SRB_CLOSE_STREAM,
201 SRB_OPEN_DEVICE_INSTANCE,
202 SRB_CLOSE_DEVICE_INSTANCE,
203 SRB_GET_DEVICE_PROPERTY,
204 SRB_SET_DEVICE_PROPERTY,
205 SRB_INITIALIZE_DEVICE,
206 SRB_CHANGE_POWER_STATE,
207 SRB_UNINITIALIZE_DEVICE,
208 SRB_UNKNOWN_DEVICE_COMMAND,
209 SRB_PAGING_OUT_DRIVER,
210 SRB_GET_DATA_INTERSECTION,
211 SRB_INITIALIZATION_COMPLETE,
212 SRB_SURPRISE_REMOVAL
213
214#if (NTDDI_VERSION >= NTDDI_WINXP)
215 ,SRB_DEVICE_METHOD
216 ,SRB_STREAM_METHOD
217#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1)
218 ,SRB_NOTIFY_IDLE_STATE
219#endif
220#endif
221} SRB_COMMAND;
222
223typedef struct {
224 PHYSICAL_ADDRESS PhysicalAddress;
225 ULONG Length;
226} KSSCATTER_GATHER, *PKSSCATTER_GATHER;
227
228
229typedef struct _HW_STREAM_REQUEST_BLOCK {
230 ULONG SizeOfThisPacket;
231 SRB_COMMAND Command;
232 NTSTATUS Status;
233 PHW_STREAM_OBJECT StreamObject;
234 PVOID HwDeviceExtension;
235 PVOID SRBExtension;
236
237 union _CommandData {
238 PKSSTREAM_HEADER DataBufferArray;
239 PHW_STREAM_DESCRIPTOR StreamBuffer;
240 KSSTATE StreamState;
241 PSTREAM_TIME_REFERENCE TimeReference;
242 PSTREAM_PROPERTY_DESCRIPTOR PropertyInfo;
243 PKSDATAFORMAT OpenFormat;
244 struct _PORT_CONFIGURATION_INFORMATION *ConfigInfo;
245 HANDLE MasterClockHandle;
246 DEVICE_POWER_STATE DeviceState;
247 PSTREAM_DATA_INTERSECT_INFO IntersectInfo;
248
249#if (NTDDI_VERSION >= NTDDI_WINXP)
250 PVOID MethodInfo;
251 LONG FilterTypeIndex;
252#if ( (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_WS03) ) || (NTDDI_VERSION >= NTDDI_WS03SP1)
253 BOOLEAN Idle;
254#endif
255#endif
256 } CommandData;
257
258 ULONG NumberOfBuffers;
259 ULONG TimeoutCounter;
260 ULONG TimeoutOriginal;
261 struct _HW_STREAM_REQUEST_BLOCK *NextSRB;
262
263 PIRP Irp;
264 ULONG Flags;
265 PVOID HwInstanceExtension;
266
267 __GNU_EXTENSION union {
268 ULONG NumberOfBytesToTransfer;
269 ULONG ActualBytesTransferred;
270 };
271
272 PKSSCATTER_GATHER ScatterGatherBuffer;
273 ULONG NumberOfPhysicalPages;
274 ULONG NumberOfScatterGatherElements;
275 ULONG Reserved[1];
276} HW_STREAM_REQUEST_BLOCK, *PHW_STREAM_REQUEST_BLOCK;
277
278#define SRB_HW_FLAGS_DATA_TRANSFER 0x01
279#define SRB_HW_FLAGS_STREAM_REQUEST 0x2
280
281typedef enum {
282 PerRequestExtension,
283 DmaBuffer,
284 SRBDataBuffer
285} STREAM_BUFFER_TYPE;
286
287typedef struct _ACCESS_RANGE {
288 STREAM_PHYSICAL_ADDRESS RangeStart;
289 ULONG RangeLength;
290 BOOLEAN RangeInMemory;
291 ULONG Reserved;
292} ACCESS_RANGE, *PACCESS_RANGE;
293
294typedef struct _PORT_CONFIGURATION_INFORMATION {
295 ULONG SizeOfThisPacket;
296 PVOID HwDeviceExtension;
297 PDEVICE_OBJECT ClassDeviceObject;
298 PDEVICE_OBJECT PhysicalDeviceObject;
299 ULONG SystemIoBusNumber;
300 INTERFACE_TYPE AdapterInterfaceType;
301 ULONG BusInterruptLevel;
302 ULONG BusInterruptVector;
303 KINTERRUPT_MODE InterruptMode;
304 ULONG DmaChannel;
305 ULONG NumberOfAccessRanges;
306 PACCESS_RANGE AccessRanges;
307 ULONG StreamDescriptorSize;
308 PIRP Irp;
309 PKINTERRUPT InterruptObject;
310 PADAPTER_OBJECT DmaAdapterObject;
311 PDEVICE_OBJECT RealPhysicalDeviceObject;
312 ULONG Reserved[1];
313} PORT_CONFIGURATION_INFORMATION, *PPORT_CONFIGURATION_INFORMATION;
314
315typedef VOID (STREAMAPI * PHW_RECEIVE_DEVICE_SRB) (IN PHW_STREAM_REQUEST_BLOCK SRB);
316typedef VOID (STREAMAPI * PHW_CANCEL_SRB) (IN PHW_STREAM_REQUEST_BLOCK SRB);
317typedef VOID (STREAMAPI * PHW_REQUEST_TIMEOUT_HANDLER) (IN PHW_STREAM_REQUEST_BLOCK SRB);
318typedef BOOLEAN (STREAMAPI * PHW_INTERRUPT) (IN PVOID DeviceExtension);
319typedef VOID (STREAMAPI * PHW_TIMER_ROUTINE) (IN PVOID Context);
320typedef VOID (STREAMAPI * PHW_PRIORITY_ROUTINE) (IN PVOID Context);
321typedef VOID (STREAMAPI * PHW_QUERY_CLOCK_ROUTINE) (IN PHW_TIME_CONTEXT TimeContext);
322typedef BOOLEAN (STREAMAPI * PHW_RESET_ADAPTER) (IN PVOID DeviceExtension);
323
324typedef enum _STREAM_MINIDRIVER_STREAM_NOTIFICATION_TYPE {
325 ReadyForNextStreamDataRequest,
326 ReadyForNextStreamControlRequest,
327 HardwareStarved,
328 StreamRequestComplete,
329 SignalMultipleStreamEvents,
330 SignalStreamEvent,
331 DeleteStreamEvent,
332 StreamNotificationMaximum
333} STREAM_MINIDRIVER_STREAM_NOTIFICATION_TYPE, *PSTREAM_MINIDRIVER_STREAM_NOTIFICATION_TYPE;
334
335typedef enum _STREAM_MINIDRIVER_DEVICE_NOTIFICATION_TYPE {
336 ReadyForNextDeviceRequest,
337 DeviceRequestComplete,
338 SignalMultipleDeviceEvents,
339 SignalDeviceEvent,
340 DeleteDeviceEvent,
341#if (NTDDI_VERSION >= NTDDI_WINXP)
342 SignalMultipleDeviceInstanceEvents,
343#endif
344 DeviceNotificationMaximum
345} STREAM_MINIDRIVER_DEVICE_NOTIFICATION_TYPE, *PSTREAM_MINIDRIVER_DEVICE_NOTIFICATION_TYPE;
346
347#define STREAM_CLASS_VERSION_20 0x0200
348
349typedef struct _HW_INITIALIZATION_DATA {
350#if (NTDDI_VERSION >= NTDDI_WINXP)
351 __GNU_EXTENSION union {
352 ULONG HwInitializationDataSize;
353 __GNU_EXTENSION struct {
354 USHORT SizeOfThisPacket;
355 USHORT StreamClassVersion;
356 };
357 };
358#else
359 ULONG HwInitializationDataSize;
360#endif /* NTDDI_VERSION >= NTDDI_WINXP */
361
362 PHW_INTERRUPT HwInterrupt;
363 PHW_RECEIVE_DEVICE_SRB HwReceivePacket;
364 PHW_CANCEL_SRB HwCancelPacket;
365 PHW_REQUEST_TIMEOUT_HANDLER HwRequestTimeoutHandler;
366 ULONG DeviceExtensionSize;
367 ULONG PerRequestExtensionSize;
368 ULONG PerStreamExtensionSize;
369 ULONG FilterInstanceExtensionSize;
370 BOOLEAN BusMasterDMA;
371 BOOLEAN Dma24BitAddresses;
372 ULONG BufferAlignment;
373 BOOLEAN TurnOffSynchronization;
374 ULONG DmaBufferSize;
375
376#if (NTDDI_VERSION >= NTDDI_WINXP)
377 ULONG NumNameExtensions;
378 PWCHAR *NameExtensionArray;
379#else
380 ULONG Reserved[2];
381#endif
382} HW_INITIALIZATION_DATA, *PHW_INITIALIZATION_DATA;
383
384typedef enum _STREAM_PRIORITY {
385 High,
386 Dispatch,
387 Low,
388 LowToHigh
389} STREAM_PRIORITY, *PSTREAM_PRIORITY;
390
391
392VOID
393StreamClassAbortOutstandingRequests(
394 IN PVOID HwDeviceExtension,
395 IN PHW_STREAM_OBJECT HwStreamObject,
396 IN NTSTATUS Status
397);
398
399VOID
400STREAMAPI
401StreamClassCallAtNewPriority(
402 IN PHW_STREAM_OBJECT StreamObject,
403 IN PVOID HwDeviceExtension,
404 IN STREAM_PRIORITY Priority,
405 IN PHW_PRIORITY_ROUTINE PriorityRoutine,
406 IN PVOID Context
407 );
408
409VOID
410STREAMAPI
411StreamClassCompleteRequestAndMarkQueueReady(
412 IN PHW_STREAM_REQUEST_BLOCK Srb
413);
414
415VOID
416STREAMAPI
417StreamClassDebugAssert(
418 IN PCHAR File,
419 IN ULONG Line,
420 IN PCHAR AssertText,
421 IN ULONG AssertValue
422);
423
424VOID
425__cdecl
426StreamClassDebugPrint(
427 IN STREAM_DEBUG_LEVEL DebugPrintLevel,
428 IN PCCHAR DebugMessage,
429 ...
430);
431
432VOID
433__cdecl
434StreamClassDeviceNotification(
435 IN STREAM_MINIDRIVER_DEVICE_NOTIFICATION_TYPE NotificationType,
436 IN PVOID HwDeviceExtension,
437 IN PHW_STREAM_REQUEST_BLOCK pSrb,
438 IN PKSEVENT_ENTRY EventEntry,
439 IN GUID *EventSet,
440 IN ULONG EventId
441);
442
443VOID
444STREAMAPI
445StreamClassFilterReenumerateStreams(
446 IN PVOID HwInstanceExtension,
447 IN ULONG StreamDescriptorSize
448);
449
450PVOID
451STREAMAPI
452StreamClassGetDmaBuffer(
453 IN PVOID HwDeviceExtension
454);
455
456
457PKSEVENT_ENTRY
458StreamClassGetNextEvent(
459 IN PVOID HwInstanceExtension_OR_HwDeviceExtension,
460 IN PHW_STREAM_OBJECT HwStreamObject,
461 IN GUID * EventGuid,
462 IN ULONG EventItem,
463 IN PKSEVENT_ENTRY CurrentEvent
464);
465
466STREAM_PHYSICAL_ADDRESS
467STREAMAPI
468StreamClassGetPhysicalAddress(
469 IN PVOID HwDeviceExtension,
470 IN PHW_STREAM_REQUEST_BLOCK HwSRB,
471 IN PVOID VirtualAddress,
472 IN STREAM_BUFFER_TYPE Type,
473 IN ULONG * Length
474);
475
476VOID
477StreamClassQueryMasterClock(
478 IN PHW_STREAM_OBJECT HwStreamObject,
479 IN HANDLE MasterClockHandle,
480 IN TIME_FUNCTION TimeFunction,
481 IN PHW_QUERY_CLOCK_ROUTINE ClockCallbackRoutine
482);
483
484VOID
485STREAMAPI
486StreamClassQueryMasterClockSync(
487 IN HANDLE MasterClockHandle,
488 IN PHW_TIME_CONTEXT TimeContext
489);
490
491BOOLEAN
492STREAMAPI
493StreamClassReadWriteConfig(
494 IN PVOID HwDeviceExtension,
495 IN BOOLEAN Read,
496 IN PVOID Buffer,
497 IN ULONG Offset,
498 IN ULONG Length
499);
500
501VOID
502STREAMAPI
503StreamClassReenumerateStreams(
504 IN PVOID HwDeviceExtension,
505 IN ULONG StreamDescriptorSize
506);
507
508NTSTATUS
509STREAMAPI
510StreamClassRegisterAdapter(
511 IN PVOID Argument1,
512 IN PVOID Argument2,
513 IN PHW_INITIALIZATION_DATA HwInitializationData
514);
515
516#define StreamClassRegisterMinidriver StreamClassRegisterAdapter
517
518NTSTATUS
519StreamClassRegisterFilterWithNoKSPins(
520 IN PDEVICE_OBJECT DeviceObject,
521 IN const GUID * InterfaceClassGUID,
522 IN ULONG PinCount,
523 IN BOOLEAN * PinDirection,
524 IN KSPIN_MEDIUM * MediumList,
525 IN GUID * CategoryList
526);
527
528VOID
529STREAMAPI
530StreamClassScheduleTimer(
531 IN PHW_STREAM_OBJECT StreamObject,
532 IN PVOID HwDeviceExtension,
533 IN ULONG NumberOfMicroseconds,
534 IN PHW_TIMER_ROUTINE TimerRoutine,
535 IN PVOID Context
536);
537
538VOID
539__cdecl
540StreamClassStreamNotification(
541 IN STREAM_MINIDRIVER_STREAM_NOTIFICATION_TYPE NotificationType,
542 IN PHW_STREAM_OBJECT StreamObject,
543 IN ...
544);
545
546#endif /* _STREAM_H */
547
Note: See TracBrowser for help on using the repository browser.