[USBAUDIO]
[reactos.git] / reactos / drivers / usb / usbaudio / usbaudio.h
index fd74365..813ac59 100644 (file)
 #include <debug.h>
 
 #define USBAUDIO_TAG 'AbsU'
+#define USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE (0x24)
+
+/* Universal Serial Bus Device Class Definition for Terminal Types Section 2.2 */
+#define USB_AUDIO_STREAMING_TERMINAL_TYPE (0x0101)
+
+#define USB_AUDIO_MICROPHONE_TERMINAL_TYPE (0x0201)
+#define USB_AUDIO_DESKTOP_MICROPHONE_TERMINAL_TYPE (0x0202)
+#define USB_AUDIO_PERSONAL_MICROPHONE_TERMINAL_TYPE (0x0203)
+#define USB_AUDIO_OMMNI_MICROPHONE_TERMINAL_TYPE (0x0204)
+#define USB_AUDIO_ARRAY_MICROPHONE_TERMINAL_TYPE (0x0205)
+#define USB_AUDIO_ARRAY_PROCESSING_MICROPHONE_TERMINAL_TYPE (0x0206)
+
+#define USB_AUDIO_SPEAKER_TERMINAL_TYPE (0x0301)
+#define USB_HEADPHONES_SPEAKER_TERMINAL_TYPE (0x0302)
+#define USB_AUDIO_HMDA_TERMINAL_TYPE (0x0303)
+#define USB_AUDIO_DESKTOP_SPEAKER_TERMINAL_TYPE (0x0304)
+#define USB_AUDIO_ROOM_SPEAKER_TERMINAL_TYPE (0x0305)
+#define USB_AUDIO_COMMUNICATION_SPEAKER_TERMINAL_TYPE (0x0306)
+#define USB_AUDIO_SUBWOOFER_TERMINAL_TYPE (0x0307)
+#define USB_AUDIO_UNDEFINED_TERMINAL_TYPE (0xFFFF)
+
+#define USB_AUDIO_INPUT_TERMINAL (0x02)
+#define USB_AUDIO_OUTPUT_TERMINAL (0x03)
+
+#include <pshpack1.h>
+
+typedef struct
+{
+    UCHAR bLength;
+    UCHAR bDescriptorType;
+    UCHAR bDescriptorSubtype;
+    USHORT bcdADC;
+    USHORT wTotalLength;
+    UCHAR bInCollection;
+    UCHAR baInterfaceNr;
+}USB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR, *PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR;
+
+typedef struct
+{
+    UCHAR bLength;
+    UCHAR bDescriptorType;
+    UCHAR bDescriptorSubtype;
+    UCHAR bTerminalID;
+    USHORT wTerminalType;
+    UCHAR bAssocTerminal;
+    UCHAR bSourceID;
+    UCHAR iTerminal;
+}USB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR, *PUSB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR;
+
+
+typedef struct
+{
+    UCHAR bLength;
+    UCHAR bDescriptorType;
+    UCHAR bDescriptorSubtype;
+    UCHAR bTerminalID;
+    USHORT wTerminalType;
+    UCHAR bAssocTerminal;
+    UCHAR bNrChannels;
+    USHORT wChannelConfig;
+    UCHAR iChannelNames;
+    UCHAR iTerminal;
+}USB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR, *PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR;
+
+typedef struct
+{
+    UCHAR bLength;
+    UCHAR bDescriptorType;
+    UCHAR bDescriptorSubtype;
+    UCHAR bTerminalLink;
+    UCHAR bDelay;
+    USHORT wFormatTag;
+}USB_AUDIO_STREAMING_INTERFACE_DESCRIPTOR, *PUSB_AUDIO_STREAMING_INTERFACE_DESCRIPTOR;
+
+typedef struct
+{
+    UCHAR bLength;
+    UCHAR bDescriptorType;
+    UCHAR bDescriptorSubtype;
+    UCHAR bFormatType;
+    UCHAR bNrChannels;
+    UCHAR bSubframeSize;
+    UCHAR bBitResolution;
+    UCHAR bSamFreqType;
+    UCHAR tSamFreq[1];
+}USB_AUDIO_STREAMING_FORMAT_TYPE_DESCRIPTOR, *PUSB_AUDIO_STREAMING_FORMAT_TYPE_DESCRIPTOR;
+
+#include <poppack.h>
 
 typedef struct __DEVICE_EXTENSION__
 {
@@ -22,6 +110,33 @@ typedef struct __DEVICE_EXTENSION__
 
 }DEVICE_EXTENSION, *PDEVICE_EXTENSION;
 
+typedef struct
+{
+    PDEVICE_EXTENSION DeviceExtension;                           /* device extension */
+    PDEVICE_OBJECT LowerDevice;                                  /* lower device*/
+
+}FILTER_CONTEXT, *PFILTER_CONTEXT;
+
+typedef struct
+{
+    PDEVICE_EXTENSION DeviceExtension;                           /* device extension */
+    PDEVICE_OBJECT LowerDevice;                                  /* lower device*/
+    LIST_ENTRY IrpListHead;                                      /* irp list*/
+    LIST_ENTRY DoneIrpListHead;                                  /* irp done list head */
+    KSPIN_LOCK IrpListLock;                                      /* irp list lock*/
+    PUCHAR Buffer;                                               /* iso buffer*/
+    ULONG BufferSize;                                            /* iso buffer size */
+    PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor;               /* interface descriptor */
+
+}PIN_CONTEXT, *PPIN_CONTEXT;
+
+/* filter.c */
+
+NTSTATUS
+NTAPI
+USBAudioCreateFilterContext(
+    PKSDEVICE Device);
+
 /* pool.c */
 PVOID
 NTAPI
@@ -35,6 +150,11 @@ FreeFunction(
 
 /* usbaudio.c */
 
+NTSTATUS
+SubmitUrbSync(
+    IN PDEVICE_OBJECT Device,
+    IN PURB Urb);
+
 NTSTATUS
 NTAPI
 USBAudioAddDevice(
@@ -127,3 +247,44 @@ USBAudioPnPSetPower(
   _In_ DEVICE_POWER_STATE To,
   _In_ DEVICE_POWER_STATE From
 );
+
+/* pin.c*/
+
+NTSTATUS
+NTAPI
+USBAudioPinCreate(
+    _In_ PKSPIN Pin,
+    _In_ PIRP Irp);
+
+NTSTATUS
+NTAPI
+USBAudioPinClose(
+    _In_ PKSPIN Pin,
+    _In_ PIRP Irp);
+
+NTSTATUS
+NTAPI
+USBAudioPinProcess(
+    _In_ PKSPIN Pin);
+
+VOID
+NTAPI
+USBAudioPinReset(
+    _In_ PKSPIN Pin);
+
+NTSTATUS
+NTAPI
+USBAudioPinSetDataFormat(
+    _In_ PKSPIN Pin,
+    _In_opt_ PKSDATAFORMAT OldFormat,
+    _In_opt_ PKSMULTIPLE_ITEM OldAttributeList,
+    _In_ const KSDATARANGE* DataRange,
+    _In_opt_ const KSATTRIBUTE_LIST* AttributeRange);
+
+NTSTATUS
+NTAPI
+USBAudioPinSetDeviceState(
+    _In_ PKSPIN Pin,
+    _In_ KSSTATE ToState,
+    _In_ KSSTATE FromState);
+