ReactOS 0.4.15-dev-5664-g3bf4ef6
businterface.cpp
Go to the documentation of this file.
1/*
2* COPYRIGHT: See COPYING in the top level directory
3* PROJECT: ReactOS Kernel Streaming
4* FILE: drivers/wdm/audio/hdaudbus/hdaudbus.cpp
5* PURPOSE: HDA Driver Entry
6* PROGRAMMER: Johannes Anderwald
7*/
8#include "hdaudbus.h"
9
10
11VOID
14PVOID BusContext)
15{
16 DPRINT1("HDA_InterfaceReference\n");
17}
18
19VOID
22PVOID BusContext)
23{
24 DPRINT1("HDA_InterfaceDereference\n");
25}
26
30 IN PVOID _context,
32 IN OUT PHDAUDIO_CODEC_TRANSFER CodecTransfer,
35{
38 PHDA_PDO_DEVICE_EXTENSION DeviceExtension;
39
40 DPRINT1("HDA_TransferCodecVerbs Count %lu CodecTransfer %p Callback %p Context %p\n", Count, CodecTransfer, Callback, Context);
41
42 /* get device extension */
43 DeviceExtension = (PHDA_PDO_DEVICE_EXTENSION)_context;
44 ASSERT(DeviceExtension->IsFDO == FALSE);
45
46 /* FIXME handle callback*/
48
49 for (Index = 0; Index < Count; Index++)
50 {
51 Verbs[Index] = CodecTransfer[Index].Output.Command;
52 }
53
54 HDA_SendVerbs(DeviceExtension->FDO, DeviceExtension->Codec, Verbs, Responses, Count);
55
56 for (Index = 0; Index < DeviceExtension->Codec->ResponseCount; Index++)
57 {
58 CodecTransfer[Index].Input.Response = DeviceExtension->Codec->Responses[Index];
59 }
60 return STATUS_SUCCESS;
61}
62
66 IN PVOID _context,
67 IN UCHAR CodecAddress,
68 IN PHDAUDIO_STREAM_FORMAT StreamFormat,
70 OUT PHDAUDIO_CONVERTER_FORMAT ConverterFormat)
71{
75}
76
80 IN PVOID _context,
81 IN PHDAUDIO_STREAM_FORMAT StreamFormat,
82 IN BOOLEAN Stripe,
84 OUT PHDAUDIO_CONVERTER_FORMAT ConverterFormat)
85{
89}
90
94 IN PVOID _context,
96 IN PHDAUDIO_STREAM_FORMAT StreamFormat,
97 OUT PHDAUDIO_CONVERTER_FORMAT ConverterFormat)
98{
100 ASSERT(FALSE);
102}
103
105NTAPI
107 IN PVOID _context,
109 IN SIZE_T RequestedBufferSize,
110 OUT PMDL *BufferMdl,
111 OUT PSIZE_T AllocatedBufferSize,
112 OUT PUCHAR StreamId,
113 OUT PULONG FifoSize)
114{
116 ASSERT(FALSE);
118}
119
121NTAPI
123 IN PVOID _context,
125{
127 ASSERT(FALSE);
129}
130
132NTAPI
134 IN PVOID _context,
136{
138 ASSERT(FALSE);
140}
141
143NTAPI
145 IN PVOID _context,
146 IN HDAUDIO_STREAM_STATE StreamState,
147 IN ULONG NumberOfHandles,
148 IN PHANDLE Handles)
149{
151 ASSERT(FALSE);
153}
154
155VOID
156NTAPI
158 IN PVOID _context,
159 OUT PULONG *Wallclock)
160{
162 ASSERT(FALSE);
163}
164
166NTAPI
168 IN PVOID _context,
171{
173 ASSERT(FALSE);
175}
176
178NTAPI
180 IN PVOID _context,
183 OUT PUCHAR Tag)
184{
186 *Tag = 1;
187 return STATUS_SUCCESS;
188}
189
190
192NTAPI
194IN PVOID _context,
195IN UCHAR Tag)
196{
198 ASSERT(FALSE);
200}
201
203NTAPI
205 IN PVOID _context,
206 OUT PHDAUDIO_DEVICE_INFORMATION DeviceInformation)
207{
208 PHDA_PDO_DEVICE_EXTENSION DeviceExtension;
209
210 DeviceExtension = (PHDA_PDO_DEVICE_EXTENSION)_context;
211
212 DPRINT1("HDA_GetDeviceInformation\n");
213
214 DeviceInformation->Size = sizeof(HDAUDIO_DEVICE_INFORMATION);
215 DeviceInformation->CodecsDetected = 1; // FIXME
216 DeviceInformation->DeviceVersion = DeviceExtension->Codec->Major << 8 | DeviceExtension->Codec->Minor;
217 DeviceInformation->DriverVersion = DeviceExtension->Codec->Major << 8 | DeviceExtension->Codec->Minor;
218 DeviceInformation->IsStripingSupported = FALSE;
219
220 return STATUS_SUCCESS;
221}
222
223VOID
224NTAPI
226 IN PVOID _context,
227 OUT PUCHAR CodecAddress,
228 OUT PUCHAR FunctionGroupStartNode)
229{
230 PHDA_PDO_DEVICE_EXTENSION DeviceExtension;
231
232 DeviceExtension = (PHDA_PDO_DEVICE_EXTENSION)_context;
233
234 DPRINT1("HDA_GetResourceInformation Addr %x NodeId %x\n", DeviceExtension->Codec->Addr, DeviceExtension->AudioGroup->NodeId);
235
236 *CodecAddress = DeviceExtension->Codec->Addr;
237 *FunctionGroupStartNode = DeviceExtension->AudioGroup->NodeId;
238}
239
241NTAPI
243 IN PVOID _context,
245 IN ULONG NotificationCount,
246 IN SIZE_T RequestedBufferSize,
247 OUT PMDL *BufferMdl,
248 OUT PSIZE_T AllocatedBufferSize,
249 OUT PSIZE_T OffsetFromFirstPage,
250 OUT PUCHAR StreamId,
251 OUT PULONG FifoSize)
252{
254 ASSERT(FALSE);
256
257}
259NTAPI
261 IN PVOID _context,
263 IN PMDL BufferMdl,
265{
267 ASSERT(FALSE);
269
270}
271
273NTAPI
275 PVOID _context,
278{
280 ASSERT(FALSE);
282
283}
284
286NTAPI
288 IN PVOID _context,
291{
293 ASSERT(FALSE);
295}
296
297
301 IN PIRP Irp)
302{
303 PIO_STACK_LOCATION IoStack;
304 PHDAUDIO_BUS_INTERFACE_V2 InterfaceHDA;
305 PHDA_PDO_DEVICE_EXTENSION DeviceExtension;
306
307 /* get device extension */
308 DeviceExtension = (PHDA_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
309 ASSERT(DeviceExtension->IsFDO == FALSE);
310
312
313 if (IsEqualGUIDAligned(*IoStack->Parameters.QueryInterface.InterfaceType, GUID_HDAUDIO_BUS_INTERFACE))
314 {
315 InterfaceHDA = (PHDAUDIO_BUS_INTERFACE_V2)IoStack->Parameters.QueryInterface.Interface;
316 InterfaceHDA->Version = IoStack->Parameters.QueryInterface.Version;
317 InterfaceHDA->Size = sizeof(HDAUDIO_BUS_INTERFACE);
318 InterfaceHDA->Context = DeviceExtension;
321
327 InterfaceHDA->FreeDmaBuffer = HDA_FreeDmaBuffer;
328 InterfaceHDA->FreeDmaEngine = HDA_FreeDmaEngine;
336 return STATUS_SUCCESS;
337 }
338 else if (IsEqualGUIDAligned(*IoStack->Parameters.QueryInterface.InterfaceType, GUID_HDAUDIO_BUS_INTERFACE_V2))
339 {
340 InterfaceHDA = (PHDAUDIO_BUS_INTERFACE_V2)IoStack->Parameters.QueryInterface.Interface;
341 InterfaceHDA->Version = IoStack->Parameters.QueryInterface.Version;
342 InterfaceHDA->Size = sizeof(HDAUDIO_BUS_INTERFACE_V2);
343 InterfaceHDA->Context = DeviceExtension;
346
352 InterfaceHDA->FreeDmaBuffer = HDA_FreeDmaBuffer;
353 InterfaceHDA->FreeDmaEngine = HDA_FreeDmaEngine;
361
366 }
367
368 // FIXME
369 // implement support for GUID_HDAUDIO_BUS_INTERFACE_BDL
372}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:115
VOID NTAPI HDA_InterfaceDereference(PVOID BusContext)
VOID NTAPI HDA_GetResourceInformation(IN PVOID _context, OUT PUCHAR CodecAddress, OUT PUCHAR FunctionGroupStartNode)
NTSTATUS NTAPI HDA_UnregisterEventCallback(IN PVOID _context, IN UCHAR Tag)
NTSTATUS NTAPI HDA_TransferCodecVerbs(IN PVOID _context, IN ULONG Count, IN OUT PHDAUDIO_CODEC_TRANSFER CodecTransfer, IN PHDAUDIO_TRANSFER_COMPLETE_CALLBACK Callback, IN PVOID Context)
NTSTATUS NTAPI HDA_SetDmaEngineState(IN PVOID _context, IN HDAUDIO_STREAM_STATE StreamState, IN ULONG NumberOfHandles, IN PHANDLE Handles)
VOID NTAPI HDA_GetWallClockRegister(IN PVOID _context, OUT PULONG *Wallclock)
NTSTATUS NTAPI HDA_ChangeBandwidthAllocation(IN PVOID _context, IN HANDLE Handle, IN PHDAUDIO_STREAM_FORMAT StreamFormat, OUT PHDAUDIO_CONVERTER_FORMAT ConverterFormat)
NTSTATUS NTAPI HDA_AllocateRenderDmaEngine(IN PVOID _context, IN PHDAUDIO_STREAM_FORMAT StreamFormat, IN BOOLEAN Stripe, OUT PHANDLE Handle, OUT PHDAUDIO_CONVERTER_FORMAT ConverterFormat)
NTSTATUS NTAPI HDA_FreeDmaBuffer(IN PVOID _context, IN HANDLE Handle)
NTSTATUS HDA_PDOHandleQueryInterface(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI HDA_RegisterEventCallback(IN PVOID _context, IN PHDAUDIO_UNSOLICITED_RESPONSE_CALLBACK Routine, IN PVOID Context, OUT PUCHAR Tag)
NTSTATUS NTAPI HDA_GetDeviceInformation(IN PVOID _context, OUT PHDAUDIO_DEVICE_INFORMATION DeviceInformation)
NTSTATUS NTAPI HDA_GetLinkPositionRegister(IN PVOID _context, IN HANDLE Handle, OUT PULONG *Position)
NTSTATUS NTAPI HDA_AllocateCaptureDmaEngine(IN PVOID _context, IN UCHAR CodecAddress, IN PHDAUDIO_STREAM_FORMAT StreamFormat, OUT PHANDLE Handle, OUT PHDAUDIO_CONVERTER_FORMAT ConverterFormat)
NTSTATUS NTAPI HDA_AllocateDmaBufferWithNotification(IN PVOID _context, IN HANDLE Handle, IN ULONG NotificationCount, IN SIZE_T RequestedBufferSize, OUT PMDL *BufferMdl, OUT PSIZE_T AllocatedBufferSize, OUT PSIZE_T OffsetFromFirstPage, OUT PUCHAR StreamId, OUT PULONG FifoSize)
NTSTATUS NTAPI HDA_UnregisterNotificationEvent(IN PVOID _context, IN HANDLE Handle, IN PKEVENT NotificationEvent)
NTSTATUS NTAPI HDA_RegisterNotificationEvent(PVOID _context, HANDLE Handle, IN PKEVENT NotificationEvent)
NTSTATUS NTAPI HDA_AllocateDmaBuffer(IN PVOID _context, IN HANDLE Handle, IN SIZE_T RequestedBufferSize, OUT PMDL *BufferMdl, OUT PSIZE_T AllocatedBufferSize, OUT PUCHAR StreamId, OUT PULONG FifoSize)
NTSTATUS NTAPI HDA_FreeDmaBufferWithNotification(IN PVOID _context, IN HANDLE Handle, IN PMDL BufferMdl, IN SIZE_T BufferSize)
NTSTATUS NTAPI HDA_FreeDmaEngine(IN PVOID _context, IN HANDLE Handle)
VOID NTAPI HDA_InterfaceReference(PVOID BusContext)
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define MAX_CODEC_RESPONSES
Definition: driver.h:43
NTSTATUS HDA_SendVerbs(IN PDEVICE_OBJECT DeviceObject, IN PHDA_CODEC_ENTRY Codec, IN PULONG Verbs, OUT PULONG Responses, IN ULONG Count)
Definition: fdo.cpp:138
ULONG Handle
Definition: gdb_input.c:15
struct HDA_PDO_DEVICE_EXTENSION * PHDA_PDO_DEVICE_EXTENSION
VOID(NTAPI * PHDAUDIO_TRANSFER_COMPLETE_CALLBACK)(HDAUDIO_CODEC_TRANSFER *, PVOID)
Definition: hdaudio.h:90
enum _HDAUDIO_STREAM_STATE HDAUDIO_STREAM_STATE
struct _HDAUDIO_DEVICE_INFORMATION HDAUDIO_DEVICE_INFORMATION
VOID(NTAPI * PHDAUDIO_UNSOLICITED_RESPONSE_CALLBACK)(HDAUDIO_CODEC_RESPONSE, PVOID)
Definition: hdaudio.h:95
struct _HDAUDIO_BUS_INTERFACE_V2 * PHDAUDIO_BUS_INTERFACE_V2
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
unsigned int * PULONG
Definition: retypes.h:1
unsigned char * PUCHAR
Definition: retypes.h:3
unsigned int ULONG
Definition: retypes.h:1
#define ASSERT(a)
Definition: mode.c:44
int Count
Definition: noreturn.cpp:7
@ NotificationEvent
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG ResponseCount
Definition: hdaudbus.h:56
ULONG Responses[MAX_CODEC_RESPONSES]
Definition: hdaudbus.h:55
UCHAR Major
Definition: hdaudbus.h:49
UCHAR Minor
Definition: hdaudbus.h:50
UCHAR Addr
Definition: hdaudbus.h:53
PHDA_CODEC_AUDIO_GROUP AudioGroup
Definition: hdaudbus.h:91
PHDA_CODEC_ENTRY Codec
Definition: hdaudbus.h:90
PDEVICE_OBJECT FDO
Definition: hdaudbus.h:92
PALLOCATE_CAPTURE_DMA_ENGINE AllocateCaptureDmaEngine
Definition: hdaudio.h:355
PALLOCATE_DMA_BUFFER_WITH_NOTIFICATION AllocateDmaBufferWithNotification
Definition: hdaudio.h:368
PFREE_DMA_ENGINE FreeDmaEngine
Definition: hdaudio.h:360
PINTERFACE_REFERENCE InterfaceReference
Definition: hdaudio.h:352
PGET_DEVICE_INFORMATION GetDeviceInformation
Definition: hdaudio.h:366
PCHANGE_BANDWIDTH_ALLOCATION ChangeBandwidthAllocation
Definition: hdaudio.h:357
PFREE_DMA_BUFFER FreeDmaBuffer
Definition: hdaudio.h:359
PUNREGISTER_NOTIFICATION_EVENT UnregisterNotificationEvent
Definition: hdaudio.h:371
PSET_DMA_ENGINE_STATE SetDmaEngineState
Definition: hdaudio.h:361
PREGISTER_EVENT_CALLBACK RegisterEventCallback
Definition: hdaudio.h:364
PREGISTER_NOTIFICATION_EVENT RegisterNotificationEvent
Definition: hdaudio.h:370
PGET_LINK_POSITION_REGISTER GetLinkPositionRegister
Definition: hdaudio.h:363
PUNREGISTER_EVENT_CALLBACK UnregisterEventCallback
Definition: hdaudio.h:365
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: hdaudio.h:353
PTRANSFER_CODEC_VERBS TransferCodecVerbs
Definition: hdaudio.h:354
PGET_WALL_CLOCK_REGISTER GetWallClockRegister
Definition: hdaudio.h:362
PFREE_DMA_BUFFER_WITH_NOTIFICATION FreeDmaBufferWithNotification
Definition: hdaudio.h:369
PALLOCATE_DMA_BUFFER AllocateDmaBuffer
Definition: hdaudio.h:358
PGET_RESOURCE_INFORMATION GetResourceInformation
Definition: hdaudio.h:367
PALLOCATE_RENDER_DMA_ENGINE AllocateRenderDmaEngine
Definition: hdaudio.h:356
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
static COORD Position
Definition: mouse.c:34
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
unsigned char UCHAR
Definition: xmlstorage.h:181