5 IPortWavePciVtbl
*lpVtbl
;
6 IServiceSinkVtbl
*lpVtblServiceSink
;
9 IUnregisterSubdevice
*lpVtblUnregisterSubDevice
;
10 IPortClsVersionVtbl
*lpVtblPortClsVersion
;
14 PMINIPORTWAVEPCI Miniport
;
15 PDEVICE_OBJECT pDeviceObject
;
18 PRESOURCELIST pResourceList
;
19 PSERVICEGROUP ServiceGroup
;
23 const GUID IID_IPortWavePci
;
24 const GUID IID_IMiniportWavePci
;
26 //---------------------------------------------------------------
33 IServiceSink_fnQueryInterface(
38 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)CONTAINING_RECORD(iface
, IPortWavePciImpl
, lpVtblServiceSink
);
40 if (IsEqualGUIDAligned(refiid
, &IID_IServiceSink
))
42 *Output
= &This
->lpVtblServiceSink
;
43 InterlockedIncrement(&This
->ref
);
44 return STATUS_SUCCESS
;
46 return STATUS_UNSUCCESSFUL
;
52 IServiceSink_fnAddRef(
55 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)CONTAINING_RECORD(iface
, IPortWavePciImpl
, lpVtblServiceSink
);
57 return InterlockedIncrement(&This
->ref
);
63 IServiceSink_fnRelease(
66 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)CONTAINING_RECORD(iface
, IPortWavePciImpl
, lpVtblServiceSink
);
68 InterlockedDecrement(&This
->ref
);
72 ExFreePoolWithTag(This
, TAG_PORTCLASS
);
75 /* Return new reference count */
82 IServiceSink_fnRequestService(
85 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)CONTAINING_RECORD(iface
, IPortWavePciImpl
, lpVtblServiceSink
);
89 This
->Miniport
->lpVtbl
->Service(This
->Miniport
);
93 static IServiceSinkVtbl vt_IServiceSink
=
95 IServiceSink_fnQueryInterface
,
96 IServiceSink_fnAddRef
,
97 IServiceSink_fnRelease
,
98 IServiceSink_fnRequestService
101 //---------------------------------------------------------------
108 IPortWavePci_fnQueryInterface(
113 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)iface
;
115 if (IsEqualGUIDAligned(refiid
, &IID_IPortWavePci
))
117 *Output
= &This
->lpVtbl
;
118 InterlockedIncrement(&This
->ref
);
119 return STATUS_SUCCESS
;
121 else if (IsEqualGUIDAligned(refiid
, &IID_IServiceSink
))
123 *Output
= &This
->lpVtbl
;
124 InterlockedIncrement(&This
->ref
);
125 return STATUS_SUCCESS
;
127 return STATUS_UNSUCCESSFUL
;
133 IPortWavePci_fnAddRef(
136 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)iface
;
137 return InterlockedIncrement(&This
->ref
);
143 IPortWavePci_fnRelease(
146 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)iface
;
148 InterlockedDecrement(&This
->ref
);
152 ExFreePoolWithTag(This
, TAG_PORTCLASS
);
155 /* Return new reference count */
161 ServiceNotifyRoutine(
162 IN
struct _KDPC
*Dpc
,
163 IN PVOID DeferredContext
,
164 IN PVOID SystemArgument1
,
165 IN PVOID SystemArgument2
)
167 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)DeferredContext
;
168 if (This
->ServiceGroup
)
170 This
->ServiceGroup
->lpVtbl
->RequestService(This
->ServiceGroup
);
179 IN IPortWavePci
* iface
,
180 IN PDEVICE_OBJECT DeviceObject
,
182 IN PUNKNOWN UnknownMiniport
,
183 IN PUNKNOWN UnknownAdapter OPTIONAL
,
184 IN PRESOURCELIST ResourceList
)
186 IMiniportWavePci
* Miniport
;
187 PSERVICEGROUP ServiceGroup
;
189 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)iface
;
191 if (This
->bInitialized
)
193 DPRINT("IPortWaveCyclic_Init called again\n");
194 return STATUS_SUCCESS
;
197 Status
= UnknownMiniport
->lpVtbl
->QueryInterface(UnknownMiniport
, &IID_IMiniportWavePci
, (PVOID
*)&Miniport
);
198 if (!NT_SUCCESS(Status
))
200 DPRINT("IPortWaveCyclic_Init called with invalid IMiniport adapter\n");
201 return STATUS_INVALID_PARAMETER
;
204 Status
= Miniport
->lpVtbl
->Init(Miniport
, UnknownAdapter
, ResourceList
, iface
, &ServiceGroup
);
205 if (!NT_SUCCESS(Status
))
207 DPRINT("IMiniportWaveCyclic_Init failed with %x\n", Status
);
211 /* Initialize port object */
212 This
->Miniport
= Miniport
;
213 This
->pDeviceObject
= DeviceObject
;
214 This
->bInitialized
= TRUE
;
215 This
->pResourceList
= ResourceList
;
216 This
->ServiceGroup
= ServiceGroup
;
218 /* initialize the dpc */
219 KeInitializeDpc(&This
->Dpc
, ServiceNotifyRoutine
, (PVOID
)This
);
221 /* increment reference on miniport adapter */
222 Miniport
->lpVtbl
->AddRef(Miniport
);
223 /* increment reference on resource list */
224 ResourceList
->lpVtbl
->AddRef(ResourceList
);
226 /* add ourselves to service group which is called when miniport receives an isr */
227 ServiceGroup
->lpVtbl
->AddMember(ServiceGroup
, (PSERVICESINK
)&This
->lpVtblServiceSink
);
229 /* increment reference on service group */
230 ServiceGroup
->lpVtbl
->AddRef(ServiceGroup
);
232 return STATUS_SUCCESS
;
237 IPortWavePci_fnNewRegistryKey(
238 IN IPortWavePci
* iface
,
239 OUT PREGISTRYKEY
*OutRegistryKey
,
240 IN PUNKNOWN OuterUnknown OPTIONAL
,
241 IN ULONG RegistryKeyType
,
242 IN ACCESS_MASK DesiredAccess
,
243 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL
,
244 IN ULONG CreateOptions OPTIONAL
,
245 OUT PULONG Disposition OPTIONAL
)
247 return STATUS_UNSUCCESSFUL
;
252 IPortWavePci_fnGetDeviceProperty(
253 IN IPortWavePci
* iface
,
254 IN DEVICE_REGISTRY_PROPERTY DeviceRegistryProperty
,
255 IN ULONG BufferLength
,
256 OUT PVOID PropertyBuffer
,
257 OUT PULONG ReturnLength
)
259 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)iface
;
261 if (!This
->bInitialized
)
263 DPRINT("IPortWaveCyclic_fnNewRegistryKey called w/o initiazed\n");
264 return STATUS_UNSUCCESSFUL
;
267 return IoGetDeviceProperty(This
->pDeviceObject
, DeviceRegistryProperty
, BufferLength
, PropertyBuffer
, ReturnLength
);
272 IPortWavePci_fnNewMasterDmaChannel(
273 IN IPortWavePci
* iface
,
274 OUT PDMACHANNEL
* DmaChannel
,
275 IN PUNKNOWN OuterUnknown
,
276 IN POOL_TYPE PoolType
,
277 IN PRESOURCELIST ResourceList OPTIONAL
,
278 IN BOOL ScatterGather
,
279 IN BOOL Dma32BitAddresses
,
280 IN BOOL Dma64BitAddresses
,
281 IN DMA_WIDTH DmaWidth
,
282 IN DMA_SPEED DmaSpeed
,
283 IN ULONG MaximumLength
,
286 return STATUS_UNSUCCESSFUL
;
291 IPortWavePci_fnNotify(
292 IN IPortWavePci
* iface
,
293 IN PSERVICEGROUP ServiceGroup
)
295 IPortWavePciImpl
* This
= (IPortWavePciImpl
*)iface
;
296 KeInsertQueueDpc(&This
->Dpc
, NULL
, NULL
);
299 static IPortWavePciVtbl vt_IPortWavePci
=
301 /* IUnknown methods */
302 IPortWavePci_fnQueryInterface
,
303 IPortWavePci_fnAddRef
,
304 IPortWavePci_fnRelease
,
307 IPortWavePci_fnGetDeviceProperty
,
308 IPortWavePci_fnNewRegistryKey
,
309 /* IPortWavePci methods */
310 IPortWavePci_fnNewMasterDmaChannel
,
311 IPortWavePci_fnNotify
319 IPortWavePciImpl
* This
;
321 This
= ExAllocatePoolWithTag(NonPagedPool
, sizeof(IPortWavePciImpl
), TAG_PORTCLASS
);
323 return STATUS_INSUFFICIENT_RESOURCES
;
325 RtlZeroMemory(This
, sizeof(IPortWavePciImpl
));
326 This
->lpVtblServiceSink
= &vt_IServiceSink
;
327 This
->lpVtbl
= &vt_IPortWavePci
;
330 *OutPort
= (PPORT
)&This
->lpVtbl
;
331 return STATUS_SUCCESS
;