[DDK] Bring hdaudio.h to DDK formatting. NFC.
[reactos.git] / reactos / include / ddk / hdaudio.h
1 #ifndef _HDAUDIO_H_
2 #define _HDAUDIO_H_
3
4 #ifdef _MSC_VER
5 #pragma warning(disable:4201)
6 #pragma warning(disable:4214)
7 #endif
8
9 DEFINE_GUID(GUID_HDAUDIO_BUS_INTERFACE, 0xd2eaf88b, 0xab18, 0x41a8, 0xb6, 0x64, 0x8d, 0x59, 0x21, 0x67, 0x67, 0x1b);
10 DEFINE_GUID(GUID_HDAUDIO_BUS_INTERFACE_BDL, 0xb4d65397, 0x5634, 0x40b0, 0xb0, 0x68, 0xf5, 0xb9, 0xf8, 0xb9, 0x67, 0xa5);
11 DEFINE_GUID(GUID_HDAUDIO_BUS_INTERFACE_V2, 0xb52af5fb, 0x424b, 0x4bb9, 0xa1, 0x60, 0x5b, 0x38, 0xbe, 0x94, 0xe5, 0x68);
12 DEFINE_GUID(GUID_HDAUDIO_BUS_CLASS, 0xbbd1a745, 0xadd6, 0x4575, 0x9c, 0x2e, 0x9b, 0x42, 0x8d, 0x1c, 0x32, 0x66);
13
14 #ifndef _HDAUDIO_CODEC_TRANSFER_
15 #define _HDAUDIO_CODEC_TRANSFER_
16
17 typedef struct _HDAUDIO_CODEC_COMMAND {
18 union {
19 struct {
20 ULONG Data:8;
21 ULONG VerbId:12;
22 ULONG Node:8;
23 ULONG CodecAddress:4;
24 } Verb8;
25 struct {
26 ULONG Data:16;
27 ULONG VerbId:4;
28 ULONG Node:8;
29 ULONG CodecAddress:4;
30 } Verb16;
31 ULONG Command;
32 };
33 } HDAUDIO_CODEC_COMMAND, *PHDAUDIO_CODEC_COMMAND;
34
35 typedef struct _HDAUDIO_CODEC_RESPONSE {
36 union {
37 struct {
38 union {
39 struct {
40 ULONG Response:26;
41 ULONG Tag:6;
42 } Unsolicited;
43 ULONG Response;
44 };
45 ULONG SDataIn:4;
46 ULONG IsUnsolicitedResponse:1;
47 ULONG :25;
48 ULONG HasFifoOverrun:1;
49 ULONG IsValid:1;
50 };
51 ULONGLONG CompleteResponse;
52 };
53 } HDAUDIO_CODEC_RESPONSE, *PHDAUDIO_CODEC_RESPONSE;
54
55 typedef struct _HDAUDIO_CODEC_TRANSFER {
56 HDAUDIO_CODEC_COMMAND Output;
57 HDAUDIO_CODEC_RESPONSE Input;
58 } HDAUDIO_CODEC_TRANSFER, *PHDAUDIO_CODEC_TRANSFER;
59
60 #endif /* _HDAUDIO_CODEC_TRANSFER_ */
61
62 typedef struct _HDAUDIO_STREAM_FORMAT {
63 ULONG SampleRate;
64 USHORT ValidBitsPerSample;
65 USHORT ContainerSize;
66 USHORT NumberOfChannels;
67 } HDAUDIO_STREAM_FORMAT, *PHDAUDIO_STREAM_FORMAT;
68
69 typedef struct _HDAUDIO_CONVERTER_FORMAT {
70 union {
71 struct {
72 USHORT NumberOfChannels:4;
73 USHORT BitsPerSample:3;
74 USHORT :1;
75 USHORT SampleRate:7;
76 USHORT StreamType:1;
77 };
78 USHORT ConverterFormat;
79 };
80 } HDAUDIO_CONVERTER_FORMAT, *PHDAUDIO_CONVERTER_FORMAT;
81
82 typedef enum _HDAUDIO_STREAM_STATE {
83 ResetState = 0,
84 StopState = 1,
85 PauseState = 1,
86 RunState = 2
87 } HDAUDIO_STREAM_STATE, *PHDAUDIO_STREAM_STATE;
88
89 typedef VOID
90 (NTAPI *PHDAUDIO_TRANSFER_COMPLETE_CALLBACK)(
91 HDAUDIO_CODEC_TRANSFER *,
92 PVOID);
93
94 typedef VOID
95 (NTAPI *PHDAUDIO_UNSOLICITED_RESPONSE_CALLBACK)(
96 HDAUDIO_CODEC_RESPONSE,
97 PVOID);
98
99 typedef struct _HDAUDIO_DEVICE_INFORMATION {
100 USHORT Size; /* size of this structure */
101 USHORT DeviceVersion; /* maj.min (maj is high byte, min is low byte) */
102 USHORT DriverVersion; /* maj.min (maj is high byte, min is low byte) */
103 USHORT CodecsDetected; /* mask of codecs present. Bit number == SDI line number */
104 BOOLEAN IsStripingSupported; /* TRUE if striping (2 SDO lines) is supported */
105 } HDAUDIO_DEVICE_INFORMATION, *PHDAUDIO_DEVICE_INFORMATION;
106
107 typedef struct _HDAUDIO_BUFFER_DESCRIPTOR {
108 PHYSICAL_ADDRESS Address;
109 ULONG Length;
110 ULONG InterruptOnCompletion;
111 } HDAUDIO_BUFFER_DESCRIPTOR, *PHDAUDIO_BUFFER_DESCRIPTOR;
112
113 typedef NTSTATUS
114 (NTAPI *PTRANSFER_CODEC_VERBS)(
115 IN PVOID _context,
116 IN ULONG Count,
117 IN OUT PHDAUDIO_CODEC_TRANSFER CodecTransfer,
118 IN PHDAUDIO_TRANSFER_COMPLETE_CALLBACK Callback,
119 IN PVOID Context);
120
121 typedef NTSTATUS
122 (NTAPI *PALLOCATE_CAPTURE_DMA_ENGINE)(
123 IN PVOID _context,
124 IN UCHAR CodecAddress,
125 IN PHDAUDIO_STREAM_FORMAT StreamFormat,
126 OUT PHANDLE Handle,
127 OUT PHDAUDIO_CONVERTER_FORMAT ConverterFormat);
128
129 typedef NTSTATUS
130 (NTAPI *PALLOCATE_RENDER_DMA_ENGINE)(
131 IN PVOID _context,
132 IN PHDAUDIO_STREAM_FORMAT StreamFormat,
133 IN BOOLEAN Stripe,
134 OUT PHANDLE Handle,
135 OUT PHDAUDIO_CONVERTER_FORMAT ConverterFormat);
136
137 typedef NTSTATUS
138 (NTAPI *PCHANGE_BANDWIDTH_ALLOCATION)(
139 IN PVOID _context,
140 IN HANDLE Handle,
141 IN PHDAUDIO_STREAM_FORMAT StreamFormat,
142 OUT PHDAUDIO_CONVERTER_FORMAT ConverterFormat);
143
144 typedef NTSTATUS
145 (NTAPI *PALLOCATE_DMA_BUFFER)(
146 IN PVOID _context,
147 IN HANDLE Handle,
148 IN SIZE_T RequestedBufferSize,
149 OUT PMDL *BufferMdl,
150 OUT PSIZE_T AllocatedBufferSize,
151 OUT PUCHAR StreamId,
152 OUT PULONG FifoSize);
153
154 typedef NTSTATUS
155 (NTAPI *PFREE_DMA_BUFFER)(
156 IN PVOID _context,
157 IN HANDLE Handle);
158
159 typedef NTSTATUS
160 (NTAPI *PFREE_DMA_ENGINE)(
161 IN PVOID _context,
162 IN HANDLE Handle);
163
164 typedef NTSTATUS
165 (NTAPI *PSET_DMA_ENGINE_STATE)(
166 IN PVOID _context,
167 IN HDAUDIO_STREAM_STATE StreamState,
168 IN ULONG NumberOfHandles,
169 IN PHANDLE Handles);
170
171 typedef VOID
172 (NTAPI *PGET_WALL_CLOCK_REGISTER)(
173 IN PVOID _context,
174 OUT PULONG *Wallclock);
175
176 typedef NTSTATUS
177 (NTAPI *PGET_LINK_POSITION_REGISTER)(
178 IN PVOID _context,
179 IN HANDLE Handle,
180 OUT PULONG *Position);
181
182 typedef NTSTATUS
183 (NTAPI *PREGISTER_EVENT_CALLBACK)(
184 IN PVOID _context,
185 IN PHDAUDIO_UNSOLICITED_RESPONSE_CALLBACK Routine,
186 IN PVOID Context,
187 OUT PUCHAR Tag);
188
189 typedef NTSTATUS
190 (NTAPI *PUNREGISTER_EVENT_CALLBACK)(
191 IN PVOID _context,
192 IN UCHAR Tag);
193
194 typedef NTSTATUS
195 (NTAPI *PGET_DEVICE_INFORMATION)(
196 IN PVOID _context,
197 IN OUT PHDAUDIO_DEVICE_INFORMATION DeviceInformation);
198
199 typedef VOID
200 (NTAPI *PGET_RESOURCE_INFORMATION)(
201 IN PVOID _context,
202 OUT PUCHAR CodecAddress,
203 OUT PUCHAR FunctionGroupStartNode);
204
205 typedef struct _HDAUDIO_BUS_INTERFACE {
206 USHORT Size;
207 USHORT Version;
208 PVOID Context;
209 PINTERFACE_REFERENCE InterfaceReference;
210 PINTERFACE_DEREFERENCE InterfaceDereference;
211 PTRANSFER_CODEC_VERBS TransferCodecVerbs;
212 PALLOCATE_CAPTURE_DMA_ENGINE AllocateCaptureDmaEngine;
213 PALLOCATE_RENDER_DMA_ENGINE AllocateRenderDmaEngine;
214 PCHANGE_BANDWIDTH_ALLOCATION ChangeBandwidthAllocation;
215 PALLOCATE_DMA_BUFFER AllocateDmaBuffer;
216 PFREE_DMA_BUFFER FreeDmaBuffer;
217 PFREE_DMA_ENGINE FreeDmaEngine;
218 PSET_DMA_ENGINE_STATE SetDmaEngineState;
219 PGET_WALL_CLOCK_REGISTER GetWallClockRegister;
220 PGET_LINK_POSITION_REGISTER GetLinkPositionRegister;
221 PREGISTER_EVENT_CALLBACK RegisterEventCallback;
222 PUNREGISTER_EVENT_CALLBACK UnregisterEventCallback;
223 PGET_DEVICE_INFORMATION GetDeviceInformation;
224 PGET_RESOURCE_INFORMATION GetResourceInformation;
225 } HDAUDIO_BUS_INTERFACE, *PHDAUDIO_BUS_INTERFACE;
226
227 typedef void
228 (NTAPI *PHDAUDIO_BDL_ISR)(
229 IN VOID *Context,
230 IN ULONG InterruptBitMask);
231
232 typedef NTSTATUS
233 (NTAPI *PALLOCATE_CONTIGUOUS_DMA_BUFFER)(
234 IN PVOID _context,
235 IN HANDLE Handle,
236 ULONG RequestedBufferSize,
237 OUT PVOID *DataBuffer,
238 OUT PHDAUDIO_BUFFER_DESCRIPTOR *BdlBuffer);
239
240 typedef NTSTATUS
241 (NTAPI *PFREE_CONTIGUOUS_DMA_BUFFER)(
242 IN PVOID _context,
243 IN HANDLE Handle);
244
245 typedef NTSTATUS
246 (NTAPI *PSETUP_DMA_ENGINE_WITH_BDL)(
247 IN PVOID _context,
248 IN HANDLE Handle,
249 IN ULONG BufferLength,
250 IN ULONG Lvi,
251 IN PHDAUDIO_BDL_ISR Isr,
252 IN PVOID Context,
253 OUT PUCHAR StreamId,
254 OUT PULONG FifoSize);
255
256 typedef struct _HDAUDIO_BUS_INTERFACE_BDL {
257 USHORT Size;
258 USHORT Version;
259 PVOID Context;
260 PINTERFACE_REFERENCE InterfaceReference;
261 PINTERFACE_DEREFERENCE InterfaceDereference;
262 PTRANSFER_CODEC_VERBS TransferCodecVerbs;
263 PALLOCATE_CAPTURE_DMA_ENGINE AllocateCaptureDmaEngine;
264 PALLOCATE_RENDER_DMA_ENGINE AllocateRenderDmaEngine;
265 PCHANGE_BANDWIDTH_ALLOCATION ChangeBandwidthAllocation;
266 PALLOCATE_CONTIGUOUS_DMA_BUFFER AllocateContiguousDmaBuffer;
267 PSETUP_DMA_ENGINE_WITH_BDL SetupDmaEngineWithBdl;
268 PFREE_CONTIGUOUS_DMA_BUFFER FreeContiguousDmaBuffer;
269 PFREE_DMA_ENGINE FreeDmaEngine;
270 PSET_DMA_ENGINE_STATE SetDmaEngineState;
271 PGET_WALL_CLOCK_REGISTER GetWallClockRegister;
272 PGET_LINK_POSITION_REGISTER GetLinkPositionRegister;
273 PREGISTER_EVENT_CALLBACK RegisterEventCallback;
274 PUNREGISTER_EVENT_CALLBACK UnregisterEventCallback;
275 PGET_DEVICE_INFORMATION GetDeviceInformation;
276 PGET_RESOURCE_INFORMATION GetResourceInformation;
277 } HDAUDIO_BUS_INTERFACE_BDL, *PHDAUDIO_BUS_INTERFACE_BDL;
278
279 typedef NTSTATUS
280 (NTAPI *PALLOCATE_DMA_BUFFER_WITH_NOTIFICATION)(
281 IN PVOID _context,
282 IN HANDLE Handle,
283 IN ULONG NotificationCount,
284 IN SIZE_T RequestedBufferSize,
285 OUT PMDL *BufferMdl,
286 OUT PSIZE_T AllocatedBufferSize,
287 OUT PSIZE_T OffsetFromFirstPage,
288 OUT PUCHAR StreamId,
289 OUT PULONG FifoSize);
290
291 typedef NTSTATUS
292 (NTAPI *PFREE_DMA_BUFFER_WITH_NOTIFICATION)(
293 IN PVOID _context,
294 IN HANDLE Handle,
295 IN PMDL BufferMdl,
296 IN SIZE_T BufferSize);
297
298 typedef NTSTATUS
299 (NTAPI *PREGISTER_NOTIFICATION_EVENT)(
300 IN PVOID _context,
301 IN HANDLE Handle,
302 IN PKEVENT NotificationEvent);
303
304 typedef NTSTATUS
305 (NTAPI *PUNREGISTER_NOTIFICATION_EVENT)(
306 IN PVOID _context,
307 IN HANDLE Handle,
308 IN PKEVENT NotificationEvent);
309
310 typedef struct _HDAUDIO_BUS_INTERFACE_V2 {
311 USHORT Size;
312 USHORT Version;
313 PVOID Context;
314 PINTERFACE_REFERENCE InterfaceReference;
315 PINTERFACE_DEREFERENCE InterfaceDereference;
316 PTRANSFER_CODEC_VERBS TransferCodecVerbs;
317 PALLOCATE_CAPTURE_DMA_ENGINE AllocateCaptureDmaEngine;
318 PALLOCATE_RENDER_DMA_ENGINE AllocateRenderDmaEngine;
319 PCHANGE_BANDWIDTH_ALLOCATION ChangeBandwidthAllocation;
320 PALLOCATE_DMA_BUFFER AllocateDmaBuffer;
321 PFREE_DMA_BUFFER FreeDmaBuffer;
322 PFREE_DMA_ENGINE FreeDmaEngine;
323 PSET_DMA_ENGINE_STATE SetDmaEngineState;
324 PGET_WALL_CLOCK_REGISTER GetWallClockRegister;
325 PGET_LINK_POSITION_REGISTER GetLinkPositionRegister;
326 PREGISTER_EVENT_CALLBACK RegisterEventCallback;
327 PUNREGISTER_EVENT_CALLBACK UnregisterEventCallback;
328 PGET_DEVICE_INFORMATION GetDeviceInformation;
329 PGET_RESOURCE_INFORMATION GetResourceInformation;
330 PALLOCATE_DMA_BUFFER_WITH_NOTIFICATION AllocateDmaBufferWithNotification;
331 PFREE_DMA_BUFFER_WITH_NOTIFICATION FreeDmaBufferWithNotification;
332 PREGISTER_NOTIFICATION_EVENT RegisterNotificationEvent;
333 PUNREGISTER_NOTIFICATION_EVENT UnregisterNotificationEvent;
334 } HDAUDIO_BUS_INTERFACE_V2, *PHDAUDIO_BUS_INTERFACE_V2;
335
336 #ifdef _MSC_VER
337 #pragma warning(default:4201)
338 #pragma warning(default:4214)
339 #endif
340
341 #endif /* _HDAUDIO_H_ */