summaryrefslogtreecommitdiff
path: root/audio/sysvad/EndpointsCommon/usbhsminipairs.h
blob: 7642324063d0d451cb16d9fbdd3eb9501efd76fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
/*++

Copyright (c) Microsoft Corporation All Rights Reserved

Module Name:

    usbhsminipairs.h

Abstract:

    USB Sideband Audio endpoint filter definitions. 

--*/

#ifndef _SYSVAD_USBHSMINIPAIRS_H_
#define _SYSVAD_USBHSMINIPAIRS_H_

#include "usbhsspeakertopo.h"
#include "usbhsspeakertoptable.h"
#include "usbhsspeakerwavtable.h"

#include "usbhsmictopo.h"
#include "usbhsmictoptable.h"
#include "usbhsmicwavtable.h"

NTSTATUS
CreateMiniportWaveRTSYSVAD
( 
    _Out_       PUNKNOWN *,
    _In_        REFCLSID,
    _In_opt_    PUNKNOWN,
    _In_        POOL_FLAGS,
    _In_        PUNKNOWN,
    _In_opt_    PVOID,
    _In_        PENDPOINT_MINIPAIR
);

NTSTATUS
CreateMiniportTopologySYSVAD
( 
    _Out_       PUNKNOWN *,
    _In_        REFCLSID,
    _In_opt_    PUNKNOWN,
    _In_        POOL_FLAGS,
    _In_        PUNKNOWN,
    _In_opt_    PVOID,
    _In_        PENDPOINT_MINIPAIR
);

/*
* USB Headset speaker miniports.
*
**********************************************************************************************
* Topology/Wave bridge connection for USB Headset Speaker                                    *
*                                                                                            *
*              +---------------------------------+                +-------+                  *
*              | Wave                            |                | Topo  |                  *
*              |                                 |                |       |                  *
*              |      +---------------------+    |                |       |                  *
*              |      |                     |    |                |       |                  *
* System   --->|0-----|1  HW Audio Engine  3|---2|---> Loopback   |       |                  *
*              |      |        Node         |    |                |       |                  *
* Offload  --->|1-----|2                   0|---3|===============>|0---->1|---> Line Out     *
*              |      +---------------------+    |                |       |                  *
*              |                                 |                |       |                  *
*              +---------------------------------+                +-------+                  *
*                                                                                            *
**********************************************************************************************/

static
PHYSICALCONNECTIONTABLE UsbHsSpeakerTopologyPhysicalConnections[] =
{
    {
        KSPIN_TOPO_WAVEOUT_SOURCE,  // TopologyIn
        KSPIN_WAVE_RENDER_SOURCE,   // WaveOut
        CONNECTIONTYPE_WAVE_OUTPUT
    }
};

// A subdevice is created for each HFP device using the reference string in the form of:
// <Base_Reference_String>-<Hashcode>
// where Base_Reference_String is one of the following template names
#define USBHS_SPEAKER_TOPO_NAME    L"TopologyUsbHsSpeaker"
#define USBHS_SPEAKER_WAVE_NAME    L"WaveUsbHsSpeaker"
#define USBHS_MIC_TOPO_NAME        L"TopologyUsbHsMic"
#define USBHS_MIC_WAVE_NAME        L"WaveUsbHsMic"
// And Hashcode is 8-character long hexadecimal value

// A reference string max length is being set to a value to accommodate them both
#define USBHS_INTERFACE_REFSTRING_MAX_LENGTH 100

static
ENDPOINT_MINIPAIR UsbHsSpeakerMiniports =
{
    eUsbHsSpeakerDevice,
    NULL,                               // Will be generated based on BTHHFP_SPEAKER_TOPO_NAME and made unique for each side band interface
    USBHS_SPEAKER_TOPO_NAME,            // template name matches with KSNAME_TopologyBthHfpSpeaker in the inf's [Strings] section
    CreateMiniportTopologySYSVAD,
    &UsbHsSpeakerTopoMiniportFilterDescriptor,
    0, NULL,                            // Interface properties
    NULL,                               // Will be generated based on BTHHFP_SPEAKER_WAVE_NAME and made unique for each side band interface
    USBHS_SPEAKER_WAVE_NAME,            // template name matches with KSNAME_WaveBthHfpSpeaker in the inf's [Strings] section
    CreateMiniportWaveRTSYSVAD,
    &UsbHsSpeakerWaveMiniportFilterDescriptor,
    0, NULL,                            // Interface properties
    1,
    UsbHsSpeakerPinDeviceFormatsAndModes,
    SIZEOF_ARRAY(UsbHsSpeakerPinDeviceFormatsAndModes),
    UsbHsSpeakerTopologyPhysicalConnections,
    SIZEOF_ARRAY(UsbHsSpeakerTopologyPhysicalConnections),
    ENDPOINT_OFFLOAD_SUPPORTED
};


/*
* Headset Microphone miniports.
*
*
************************************************************************************************************************************************
* Topology/Wave bridge connection for USB Headset Microphone                                                                                   *
*              +---------------------------------+                +---------------------------------------------------------+                  *
*              |         +-------------+         |                |      +-------------+     +-------+     +--------+       |                  *
* Capture  <---|1<-------|0    ADC    1|<-------0|<===============|1<----| peak meter  |<----|  mute |<----| volume |<---- 0|<---- Mic in      *
*              |         +-------------+         |                |      +-------------+     +-------+     +--------+       |                  *
*              +---------------------------------+                +---------------------------------------------------------+                  *
*                                                                                                                                              *
************************************************************************************************************************************************/
static
PHYSICALCONNECTIONTABLE UsbHsMicTopologyPhysicalConnections[] =
{
    {
        KSPIN_TOPO_BRIDGE,          // TopologyOut
        KSPIN_WAVE_BRIDGE,          // WaveIn
        CONNECTIONTYPE_TOPOLOGY_OUTPUT
    }
};

static
ENDPOINT_MINIPAIR UsbHsMicMiniports =
{
    eUsbHsMicDevice,
    NULL,                               // Will be generated based on BTHHFP_MIC_TOPO_NAME and made unique for each side band interface
    USBHS_MIC_TOPO_NAME,                // template name matches with KSNAME_TopologyBthHfpMic in the inf's [Strings] section
    CreateMiniportTopologySYSVAD,
    &UsbHsMicTopoMiniportFilterDescriptor,
    0, NULL,                            // Interface properties
    NULL,                               // Will be generated based on BTHHFP_SPEAKER_WAVE_NAME and made unique for each side band interface
    USBHS_MIC_WAVE_NAME,                // template name matches with KSNAME_WaveBthHfpMic in the inf's [Strings] section
    CreateMiniportWaveRTSYSVAD,
    &UsbHsMicWaveMiniportFilterDescriptor,
    0, NULL,                            // Interface properties
    1,
    UsbHsMicPinDeviceFormatsAndModes,
    SIZEOF_ARRAY(UsbHsMicPinDeviceFormatsAndModes),
    UsbHsMicTopologyPhysicalConnections,
    SIZEOF_ARRAY(UsbHsMicTopologyPhysicalConnections),
    ENDPOINT_NO_FLAGS
};

//=============================================================================
//
// Render miniport pairs.
//
static
PENDPOINT_MINIPAIR  g_UsbHsRenderEndpoints[] = 
{
    &UsbHsSpeakerMiniports
};

#define g_cUsbHsRenderEndpoints  (SIZEOF_ARRAY(g_UsbHsRenderEndpoints))

// If the count of Render endpoints changes, update formula below
C_ASSERT(g_cUsbHsRenderEndpoints == 1);

//=============================================================================
//
// Capture miniport pairs.
//
static
PENDPOINT_MINIPAIR  g_UsbHsCaptureEndpoints[] = 
{
    &UsbHsMicMiniports
};

#define g_cUsbHsCaptureEndpoints (SIZEOF_ARRAY(g_UsbHsCaptureEndpoints))

// If the count of Capture endpoints changes, update formula below
C_ASSERT(g_cUsbHsCaptureEndpoints == 1);

//=============================================================================
//
// Total miniports = # endpoints * 2 (topology + wave)
//
// 
// Allow 5 USB Headset Endpoints.
//
#define MAX_USBHS_DEVICES       (5)
#define g_MaxUsbHsMiniports     ((g_cUsbHsRenderEndpoints + g_cUsbHsCaptureEndpoints) * 2 * MAX_USBHS_DEVICES)

// g_MaxUsbHsMiniports is used when calculating the MaxObjects inside AddDevice.
C_ASSERT(g_MaxUsbHsMiniports == 20);

#endif // _SYSVAD_USBHSMINIPAIRS_H_