[USBAUDIO]
[reactos.git] / reactos / drivers / usb / usbaudio / usbaudio.h
1 #pragma once
2
3 #include <ntddk.h>
4 #include <portcls.h>
5 #include <ksmedia.h>
6 #include <hubbusif.h>
7 #include <usbbusif.h>
8 #include <usbioctl.h>
9 #include <usb.h>
10 #include <usbdlib.h>
11 #include <debug.h>
12
13 #define USBAUDIO_TAG 'AbsU'
14 #define USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE (0x24)
15
16 /* Universal Serial Bus Device Class Definition for Terminal Types Section 2.2 */
17 #define USB_AUDIO_STREAMING_TERMINAL_TYPE (0x0101)
18
19 #define USB_AUDIO_MICROPHONE_TERMINAL_TYPE (0x0201)
20 #define USB_AUDIO_DESKTOP_MICROPHONE_TERMINAL_TYPE (0x0202)
21 #define USB_AUDIO_PERSONAL_MICROPHONE_TERMINAL_TYPE (0x0203)
22 #define USB_AUDIO_OMMNI_MICROPHONE_TERMINAL_TYPE (0x0204)
23 #define USB_AUDIO_ARRAY_MICROPHONE_TERMINAL_TYPE (0x0205)
24 #define USB_AUDIO_ARRAY_PROCESSING_MICROPHONE_TERMINAL_TYPE (0x0206)
25
26 #define USB_AUDIO_SPEAKER_TERMINAL_TYPE (0x0301)
27 #define USB_HEADPHONES_SPEAKER_TERMINAL_TYPE (0x0302)
28 #define USB_AUDIO_HMDA_TERMINAL_TYPE (0x0303)
29 #define USB_AUDIO_DESKTOP_SPEAKER_TERMINAL_TYPE (0x0304)
30 #define USB_AUDIO_ROOM_SPEAKER_TERMINAL_TYPE (0x0305)
31 #define USB_AUDIO_COMMUNICATION_SPEAKER_TERMINAL_TYPE (0x0306)
32 #define USB_AUDIO_SUBWOOFER_TERMINAL_TYPE (0x0307)
33 #define USB_AUDIO_UNDEFINED_TERMINAL_TYPE (0xFFFF)
34
35
36 #include <pshpack1.h>
37
38 typedef struct
39 {
40 UCHAR bLength;
41 UCHAR bDescriptorType;
42 UCHAR bDescriptorSubtype;
43 USHORT bcdADC;
44 USHORT wTotalLength;
45 UCHAR bInCollection;
46 UCHAR baInterfaceNr;
47 }USB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR, *PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR;
48
49 typedef struct
50 {
51 UCHAR bLength;
52 UCHAR bDescriptorType;
53 UCHAR bDescriptorSubtype;
54 UCHAR bTerminalID;
55 USHORT wTerminalType;
56 UCHAR bAssocTerminal;
57 UCHAR bSourceID;
58 UCHAR iTerminal;
59 }USB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR, *PUSB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR;
60
61
62 typedef struct
63 {
64 UCHAR bLength;
65 UCHAR bDescriptorType;
66 UCHAR bDescriptorSubtype;
67 UCHAR bTerminalID;
68 USHORT wTerminalType;
69 UCHAR bAssocTerminal;
70 UCHAR bNrChannels;
71 USHORT wChannelConfig;
72 UCHAR iChannelNames;
73 UCHAR iTerminal;
74 }USB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR, *PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR;
75 #include <poppack.h>
76
77 typedef struct __DEVICE_EXTENSION__
78 {
79 PDEVICE_OBJECT LowerDevice; /* lower device*/
80 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; /* usb configuration descriptor */
81 PUSB_DEVICE_DESCRIPTOR DeviceDescriptor; /* usb device descriptor */
82 PUSBD_INTERFACE_INFORMATION InterfaceInfo; /* interface information */
83 USBD_CONFIGURATION_HANDLE ConfigurationHandle; /* configuration handle */
84
85 }DEVICE_EXTENSION, *PDEVICE_EXTENSION;
86
87 /* filter.c */
88
89 NTSTATUS
90 NTAPI
91 USBAudioCreateFilterContext(
92 PKSDEVICE Device);
93
94 /* pool.c */
95 PVOID
96 NTAPI
97 AllocFunction(
98 IN ULONG ItemSize);
99
100 VOID
101 NTAPI
102 FreeFunction(
103 IN PVOID Item);
104
105 /* usbaudio.c */
106
107 NTSTATUS
108 NTAPI
109 USBAudioAddDevice(
110 _In_ PKSDEVICE Device
111 );
112
113 NTSTATUS
114 NTAPI
115 USBAudioPnPStart(
116 _In_ PKSDEVICE Device,
117 _In_ PIRP Irp,
118 _In_opt_ PCM_RESOURCE_LIST TranslatedResourceList,
119 _In_opt_ PCM_RESOURCE_LIST UntranslatedResourceList
120 );
121
122 NTSTATUS
123 NTAPI
124 USBAudioPnPQueryStop(
125 _In_ PKSDEVICE Device,
126 _In_ PIRP Irp
127 );
128
129 VOID
130 NTAPI
131 USBAudioPnPCancelStop(
132 _In_ PKSDEVICE Device,
133 _In_ PIRP Irp
134 );
135
136 VOID
137 NTAPI
138 USBAudioPnPStop(
139 _In_ PKSDEVICE Device,
140 _In_ PIRP Irp
141 );
142
143 NTSTATUS
144 NTAPI
145 USBAudioPnPQueryRemove(
146 _In_ PKSDEVICE Device,
147 _In_ PIRP Irp
148 );
149
150 VOID
151 NTAPI
152 USBAudioPnPCancelRemove(
153 _In_ PKSDEVICE Device,
154 _In_ PIRP Irp
155 );
156
157 VOID
158 NTAPI
159 USBAudioPnPRemove(
160 _In_ PKSDEVICE Device,
161 _In_ PIRP Irp
162 );
163
164 NTSTATUS
165 NTAPI
166 USBAudioPnPQueryCapabilities(
167 _In_ PKSDEVICE Device,
168 _In_ PIRP Irp,
169 _Inout_ PDEVICE_CAPABILITIES Capabilities
170 );
171
172 VOID
173 NTAPI
174 USBAudioPnPSurpriseRemoval(
175 _In_ PKSDEVICE Device,
176 _In_ PIRP Irp
177 );
178
179 NTSTATUS
180 NTAPI
181 USBAudioPnPQueryPower(
182 _In_ PKSDEVICE Device,
183 _In_ PIRP Irp,
184 _In_ DEVICE_POWER_STATE DeviceTo,
185 _In_ DEVICE_POWER_STATE DeviceFrom,
186 _In_ SYSTEM_POWER_STATE SystemTo,
187 _In_ SYSTEM_POWER_STATE SystemFrom,
188 _In_ POWER_ACTION Action
189 );
190
191 VOID
192 NTAPI
193 USBAudioPnPSetPower(
194 _In_ PKSDEVICE Device,
195 _In_ PIRP Irp,
196 _In_ DEVICE_POWER_STATE To,
197 _In_ DEVICE_POWER_STATE From
198 );