- Make ks and portcls compile under msvc
[reactos.git] / reactos / drivers / wdm / audio / backpln / portcls / private.h
1 /*
2 PortCls FDO Extension
3
4 by Andrew Greenwood
5 */
6
7 #ifndef PORTCLS_PRIVATE_H
8 #define PORTCLS_PRIVATE_H
9
10 //#define _KS_NO_ANONYMOUS_STRUCTURES_
11
12 #include <ntddk.h>
13 #include <portcls.h>
14 #define NDEBUG
15 #include <debug.h>
16
17 #include <dmusicks.h>
18
19 #include "interfaces.h"
20 #include <ks.h>
21 #include <ksmedia.h>
22 #include <stdio.h>
23 #include <math.h>
24 #include <intrin.h>
25
26 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
27 #define TAG_PORTCLASS TAG('P', 'C', 'L', 'S')
28
29 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
30
31 NTSTATUS
32 NTAPI
33 PortClsCreate(
34 IN PDEVICE_OBJECT DeviceObject,
35 IN PIRP Irp);
36
37 NTSTATUS
38 NTAPI
39 PortClsPnp(
40 IN PDEVICE_OBJECT DeviceObject,
41 IN PIRP Irp);
42
43 NTSTATUS
44 NTAPI
45 PortClsPower(
46 IN PDEVICE_OBJECT DeviceObject,
47 IN PIRP Irp);
48
49 NTSTATUS
50 NTAPI
51 PortClsSysControl(
52 IN PDEVICE_OBJECT DeviceObject,
53 IN PIRP Irp);
54
55 NTSTATUS NewMiniportDMusUART(
56 OUT PMINIPORT* OutMiniport,
57 IN REFCLSID ClassId);
58
59 NTSTATUS NewMiniportFmSynth(
60 OUT PMINIPORT* OutMiniport,
61 IN REFCLSID ClassId);
62
63 NTSTATUS NewPortDMus(
64 OUT PPORT* OutPort);
65
66 NTSTATUS NewPortTopology(
67 OUT PPORT* OutPort);
68
69 NTSTATUS NewPortWaveCyclic(
70 OUT PPORT* OutPort);
71
72 NTSTATUS NewPortWavePci(
73 OUT PPORT* OutPort);
74
75 NTSTATUS NewIDrmPort(
76 OUT PDRMPORT2 *OutPort);
77
78 NTSTATUS NewPortClsVersion(
79 OUT PPORTCLSVERSION * OutVersion);
80
81 NTSTATUS NewPortFilterWaveCyclic(
82 OUT IPortFilterWaveCyclic ** OutFilter);
83
84 NTSTATUS NewPortPinWaveCyclic(
85 OUT IPortPinWaveCyclic ** OutPin);
86
87 NTSTATUS
88 NewPortFilterWavePci(
89 OUT IPortFilterWavePci ** OutFilter);
90
91 NTSTATUS NewPortPinWavePci(
92 OUT IPortPinWavePci ** OutPin);
93
94 PDEVICE_OBJECT
95 GetDeviceObjectFromWaveCyclic(
96 IPortWavePci* iface);
97
98 PDEVICE_OBJECT
99 GetDeviceObjectFromPortWavePci(
100 IPortWavePci* iface);
101
102 PMINIPORTWAVEPCI
103 GetWavePciMiniport(
104 PPORTWAVEPCI Port);
105
106 NTSTATUS
107 NewPortFilterDMus(
108 OUT PPORTFILTERDMUS * OutFilter);
109
110 NTSTATUS NewPortPinDMus(
111 OUT PPORTPINDMUS * OutPin);
112
113 VOID
114 GetDMusMiniport(
115 IN IPortDMus * iface,
116 IN PMINIPORTDMUS * Miniport,
117 IN PMINIPORTMIDI * MidiMiniport);
118
119 #if (NTDDI_VERSION >= NTDDI_VISTA)
120
121 NTSTATUS
122 NewPortFilterWaveRT(
123 OUT IPortFilterWaveRT ** OutFilter);
124
125 NTSTATUS NewPortPinWaveRT(
126 OUT IPortPinWaveRT ** OutPin);
127
128 PMINIPORTWAVERT
129 GetWaveRTMiniport(
130 IN IPortWaveRT* iface);
131
132 PDEVICE_OBJECT
133 GetDeviceObjectFromPortWaveRT(
134 IPortWaveRT* iface);
135
136 NTSTATUS
137 NewPortWaveRTStream(
138 PPORTWAVERTSTREAM *OutStream);
139
140 NTSTATUS
141 NewPortWaveRT(
142 OUT PPORT* OutPort);
143
144
145 #endif
146
147 NTSTATUS
148 NewPortFilterTopology(
149 OUT IPortFilterTopology ** OutFilter);
150
151 PMINIPORTTOPOLOGY
152 GetTopologyMiniport(
153 PPORTTOPOLOGY Port);
154
155 NTSTATUS
156 NTAPI
157 NewDispatchObject(
158 IN PIRP Irp,
159 IN IIrpTarget * Target,
160 IN ULONG ObjectCreateItemCount,
161 IN PKSOBJECT_CREATE_ITEM ObjectCreateItem);
162
163 PMINIPORTWAVECYCLIC
164 GetWaveCyclicMiniport(
165 IN IPortWaveCyclic* iface);
166
167 PVOID
168 AllocateItem(
169 IN POOL_TYPE PoolType,
170 IN SIZE_T NumberOfBytes,
171 IN ULONG Tag);
172
173 VOID
174 FreeItem(
175 IN PVOID Item,
176 IN ULONG Tag);
177
178 NTSTATUS
179 NTAPI
180 NewIrpQueue(
181 IN IIrpQueue **Queue);
182
183 NTSTATUS
184 NTAPI
185 TopologyPropertyHandler(
186 IN PIRP Irp,
187 IN PKSIDENTIFIER Request,
188 IN OUT PVOID Data);
189
190 NTSTATUS
191 NTAPI
192 PinPropertyHandler(
193 IN PIRP Irp,
194 IN PKSIDENTIFIER Request,
195 IN OUT PVOID Data);
196
197 NTSTATUS
198 NTAPI
199 PcDmaMasterDescription(
200 IN PRESOURCELIST ResourceList OPTIONAL,
201 IN BOOLEAN ScatterGather,
202 IN BOOLEAN Dma32BitAddresses,
203 IN BOOLEAN IgnoreCount,
204 IN BOOLEAN Dma64BitAddresses,
205 IN DMA_WIDTH DmaWidth,
206 IN DMA_SPEED DmaSpeed,
207 IN ULONG MaximumLength,
208 IN ULONG DmaPort,
209 OUT PDEVICE_DESCRIPTION DeviceDescription);
210
211 NTSTATUS
212 NTAPI
213 PcDmaSlaveDescription(
214 IN PRESOURCELIST ResourceList OPTIONAL,
215 IN ULONG DmaIndex,
216 IN BOOL DemandMode,
217 IN ULONG AutoInitialize,
218 IN DMA_SPEED DmaSpeed,
219 IN ULONG MaximumLength,
220 IN ULONG DmaPort,
221 OUT PDEVICE_DESCRIPTION DeviceDescription);
222
223 NTSTATUS
224 NTAPI
225 PcCreateSubdeviceDescriptor(
226 OUT SUBDEVICE_DESCRIPTOR ** OutSubdeviceDescriptor,
227 IN ULONG InterfaceCount,
228 IN GUID * InterfaceGuids,
229 IN ULONG IdentifierCount,
230 IN KSIDENTIFIER *Identifier,
231 IN ULONG FilterPropertiesCount,
232 IN KSPROPERTY_SET * FilterProperties,
233 IN ULONG Unknown1,
234 IN ULONG Unknown2,
235 IN ULONG PinPropertiesCount,
236 IN KSPROPERTY_SET * PinProperties,
237 IN ULONG EventSetCount,
238 IN KSEVENT_SET * EventSet,
239 IN PPCFILTER_DESCRIPTOR FilterDescription);
240
241 NTSTATUS
242 NTAPI
243 PcValidateConnectRequest(
244 IN PIRP Irp,
245 IN KSPIN_FACTORY * Descriptor,
246 OUT PKSPIN_CONNECT* Connect);
247
248 NTSTATUS
249 NTAPI
250 PcCreateItemDispatch(
251 IN PDEVICE_OBJECT DeviceObject,
252 IN PIRP Irp);
253
254 NTSTATUS
255 NTAPI
256 PcPropertyHandler(
257 IN PIRP Irp,
258 IN PSUBDEVICE_DESCRIPTOR Descriptor);
259
260 NTSTATUS
261 NTAPI
262 FastPropertyHandler(
263 IN PFILE_OBJECT FileObject,
264 IN PKSPROPERTY UNALIGNED Property,
265 IN ULONG PropertyLength,
266 IN OUT PVOID UNALIGNED Data,
267 IN ULONG DataLength,
268 OUT PIO_STATUS_BLOCK IoStatus,
269 IN ULONG PropertySetsCount,
270 IN const KSPROPERTY_SET *PropertySet,
271 IN PSUBDEVICE_DESCRIPTOR Descriptor,
272 IN ISubdevice *SubDevice);
273
274 PDEVICE_OBJECT
275 GetDeviceObject(
276 IPortWaveCyclic* iface);
277
278 VOID
279 NTAPI
280 PcIoTimerRoutine(
281 IN PDEVICE_OBJECT DeviceObject,
282 IN PVOID Context);
283
284 NTSTATUS
285 NTAPI
286 NewIUnregisterSubdevice(
287 OUT PUNREGISTERSUBDEVICE *OutDevice);
288
289 NTSTATUS
290 NTAPI
291 NewIUnregisterPhysicalConnection(
292 OUT PUNREGISTERPHYSICALCONNECTION *OutConnection);
293
294 #define DEFINE_KSPROPERTY_PINPROPOSEDATAFORMAT(PinSet,\
295 PropGeneral, PropInstances, PropIntersection)\
296 DEFINE_KSPROPERTY_TABLE(PinSet) {\
297 DEFINE_KSPROPERTY_ITEM_PIN_CINSTANCES(PropInstances),\
298 DEFINE_KSPROPERTY_ITEM_PIN_CTYPES(PropGeneral),\
299 DEFINE_KSPROPERTY_ITEM_PIN_DATAFLOW(PropGeneral),\
300 DEFINE_KSPROPERTY_ITEM_PIN_DATARANGES(PropGeneral),\
301 DEFINE_KSPROPERTY_ITEM_PIN_DATAINTERSECTION(PropIntersection),\
302 DEFINE_KSPROPERTY_ITEM_PIN_INTERFACES(PropGeneral),\
303 DEFINE_KSPROPERTY_ITEM_PIN_MEDIUMS(PropGeneral),\
304 DEFINE_KSPROPERTY_ITEM_PIN_COMMUNICATION(PropGeneral),\
305 DEFINE_KSPROPERTY_ITEM_PIN_CATEGORY(PropGeneral),\
306 DEFINE_KSPROPERTY_ITEM_PIN_NAME(PropGeneral),\
307 DEFINE_KSPROPERTY_ITEM_PIN_CONSTRAINEDDATARANGES(PropGeneral),\
308 DEFINE_KSPROPERTY_ITEM_PIN_PROPOSEDATAFORMAT(PropGeneral)\
309 }
310
311 typedef struct
312 {
313 LIST_ENTRY Entry;
314 UNICODE_STRING SymbolicLink;
315 }SYMBOLICLINK_ENTRY, *PSYMBOLICLINK_ENTRY;
316
317
318 typedef struct
319 {
320 LIST_ENTRY Entry;
321 ISubdevice *SubDevice;
322 UNICODE_STRING Name;
323 LIST_ENTRY SymbolicLinkList;
324 }SUBDEVICE_ENTRY, *PSUBDEVICE_ENTRY;
325
326 typedef struct
327 {
328 LIST_ENTRY Entry;
329 ISubdevice * FromSubDevice;
330 UNICODE_STRING FromUnicodeString;
331 ULONG FromPin;
332 ISubdevice * ToSubDevice;
333 UNICODE_STRING ToUnicodeString;
334 ULONG ToPin;
335 }PHYSICAL_CONNECTION, *PPHYSICAL_CONNECTION;
336
337 typedef struct
338 {
339 KSDEVICE_HEADER KsDeviceHeader;
340 PDEVICE_OBJECT PhysicalDeviceObject;
341 PDEVICE_OBJECT PrevDeviceObject;
342 PCPFNSTARTDEVICE StartDevice;
343 ULONG_PTR Unused[4];
344 IAdapterPowerManagement * AdapterPowerManagement;
345 ULONG MaxSubDevices;
346 KSOBJECT_CREATE_ITEM * CreateItems;
347
348 IResourceList* resources;
349 LIST_ENTRY SubDeviceList;
350 LIST_ENTRY PhysicalConnectionList;
351
352 LIST_ENTRY TimerList;
353 KSPIN_LOCK TimerListLock;
354
355 } PCLASS_DEVICE_EXTENSION, *PPCLASS_DEVICE_EXTENSION;
356
357
358 typedef struct
359 {
360 KSSTREAM_HEADER Header;
361 PIRP Irp;
362 }CONTEXT_WRITE, *PCONTEXT_WRITE;
363
364 typedef struct
365 {
366 PVOID Pin;
367 PIO_WORKITEM WorkItem;
368 PIRP Irp;
369 }CLOSESTREAM_CONTEXT, *PCLOSESTREAM_CONTEXT;
370
371 typedef struct
372 {
373 LIST_ENTRY Entry;
374 PIO_TIMER_ROUTINE pTimerRoutine;
375 PVOID Context;
376 }TIMER_CONTEXT, *PTIMER_CONTEXT;
377
378 #endif