33#pragma code_seg("PAGE")
51 DBGPRINT((
"CMiniportWaveCMI[%p]::ProcessResources(%p)",
this, resourceList));
53 if (resourceList->NumberOfInterrupts() < 1) {
54 DBGPRINT((
"Unknown configuration for wave miniport"));
65 DBGPRINT((
"CMiniportWaveCMI[%p]::newDMAChannel(%p)",
this, dmaChannel));
73 ntStatus = (*dmaChannel)->AllocateBuffer(lDMABufferLength,
NULL);
74 lDMABufferLength >>= 1;
86 DBGPRINT((
"CMiniportWaveCMI[%p]::NonDelegatingQueryInterface",
this));
119 DBGPRINT((
"CMiniportWaveCMI[%p]::~CMiniportWaveCMI",
this));
128 for (
int i=0;
i<3;
i++) {
160 DBGPRINT((
"CMiniportWaveCMI[%p]::Init(%p, %p, %p)",
this, UnknownAdapter,
ResourceList, Port_));
167 DBGPRINT((
"QueryInterface(CMIAdapter) failed"));
179 cm = CMIAdapter->getCMI8738Info();
181 cm->WaveMiniport =
this;
183 loadChannelConfigFromRegistry();
185 for (
int i=0;
i<3;
i++)
187 isStreamRunning[
i] =
false;
192 DBGPRINT((
"NewDmaChannel() failed"));
207 ASSERT(OutDeviceDescriptor);
208 DBGPRINT((
"CMiniportWaveCMI[%p]::GetDeviceDescription(%p)",
this, OutDeviceDescriptor));
212 OutDeviceDescriptor->
Master =
true;
224 ASSERT(OutFilterDescriptor);
225 DBGPRINT((
"CMiniportWaveCMI[%p]::GetDescription(%p)",
this, OutFilterDescriptor));
241 DBGPRINT((
"CMiniportWaveCMI::loadChannelConfigFromRegistry()"));
250 DBGPRINT((
"PcNewRegistryKey() failed"));
258 DBGPRINT((
"DriverKey->NewSubKey() failed"));
288 SettingsKey->Release();
289 DriverKey->Release();
301 DBGPRINT((
"CMiniportWaveCMI::storeChannelConfigToRegistry()"));
310 DBGPRINT((
"PcNewRegistryKey() failed"));
318 DBGPRINT((
"DriverKey->NewSubKey() failed"));
335 SettingsKey->Release();
336 DriverKey->Release();
345 DBGPRINT((
"CMiniportWaveCMI[%p]::powerUp()",
this));
348 for (
int i=0;
i<3;
i++) {
359 for (
int i=0;
i<3;
i++) {
371 DBGPRINT((
"CMiniportWaveCMI[%p]::powerDown()",
this));
384 DBGPRINT((
"CMiniportWaveCMI[%p]::isFormatAllowed(%d, %d, %d)",
this, sampleRate, multiChan, AC3));
387 switch (sampleRate) {
396 switch (sampleRate) {
404 switch (sampleRate) {
417 DBGPRINT((
"CMiniportWaveCMI[%p]::validateFormat(%p, %d, %d)",
this,
format, PinID, capture));
484 DBGPRINT((
"CMiniportWaveCMI[%p]::DataRangeIntersection(%d, %p, %p, %d, %p, %p)",
this, PinId, ClientDataRange, MyDataRange,
OutputBufferLength, ResultantFormat, ResultantFormatLength));
487 bool isAC3Pin =
true;
566 pWaveFormatEx->
cbSize = 0;
607 ULONG sampleRate = 0;
614 if (nMaxChannels & 0x01) {
627 if (sampleRate == 0) {
653 DBGPRINT((
"[[DataRangeIntersection] mono format not supported"));
674 switch (nMaxChannels) {
686 DBGPRINT((
"[DataRangeIntersection] MultiChannel Renderer: SampleRate: %d, ClientDataRange->MaxChans: %d, Channels: %d, BitPerSample: %d, BlockAlign: %d, AvgBytesPerSec: %d, ChannelMask: %08X", WaveFormat->
Format.
nSamplesPerSec, ((
PKSDATARANGE_AUDIO)ClientDataRange)->MaximumChannels, WaveFormat->
Format.
nChannels, WaveFormat->
Format.
wBitsPerSample, WaveFormat->
Format.
nBlockAlign, WaveFormat->
Format.
nAvgBytesPerSec, WaveFormat->
dwChannelMask));
700 if (nMaxChannels > 2) {
727 pWaveFormatEx->
cbSize = 0;
747 DBGPRINT((
"CMiniportWaveCMI[%p]::NewStream(%p, %p, %d, %d, %p)",
this, OutStream, OuterUnknown, PinID,
Capture,
DataFormat));
751 DBGPRINT((
"CMiniportWaveCMI[%p]::NewStream(%p, %p, %p, %d, %d, %p, %p, %p)",
this, OutStream, OuterUnknown,
PoolType, PinID,
Capture,
DataFormat, OutDmaChannel, OutServiceGroup));
760 DBGPRINT((
"invalid stream format"));
763 if (cm->enableSPDIFInMonitor) {
775 if (isStreamRunning[streamIndex]) {
776 DBGPRINT((
"Stream %d running, exiting...", streamIndex));
790 DBGPRINT((
"---StreamNo: %d, Bits: %d, Sample Rate: %d, Channels: %d, AC3: %d", streamIndex,
813 DBGPRINT((
"Failed to create stream"));
821 ntStatus =
stream[streamIndex]->Init(
this, streamIndex,
Capture,
DataFormat, DMAChannel[streamIndex], OutServiceGroup);
824 DBGPRINT((
"Failed to init stream"));
825 stream[streamIndex]->Release();
829 *OutServiceGroup =
NULL;
830 *OutDmaChannel =
NULL;
839 *OutDmaChannel = DMAChannel[streamIndex];
840 DMAChannel[streamIndex]->AddRef();
851 DBGPRINT((
"[PropertyHandler_ChannelConfig]"));
909 DBGPRINT((
"CreateMiniportWaveStreamCMI"));
916 if (*MiniportWaveStreamCMI) {
917 (*MiniportWaveStreamCMI)->AddRef();
927 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::prepareStream()",
this));
971 val &= ~SFC_CH1_MASK;
974 val &= ~SFC_CH0_MASK;
979 val &= ~SFC_CH1_MASK;
982 val &= ~SFC_CH0_MASK;
1008 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::setDACChannels()",
this));
1204 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::~CMiniportWaveStreamCMI [streamIndex: %d]",
this,
streamIndex));
1287 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::Init(%p, %d, %d, %p, %p)",
this, Miniport_, streamIndex_, isCaptureStream_,
DataFormat, Port_));
1291 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::Init(%p, %d, %d, %p, %p, %p)",
this, Miniport_, streamIndex_, isCaptureStream_,
DataFormat, DMAChannel_, OutServiceGroup));
1292 DMAChannel = DMAChannel_;
1293 DMAChannel->AddRef();
1296 Miniport = Miniport_;
1299 streamIndex = streamIndex_;
1300 isCaptureStream = isCaptureStream_;
1312 DBGPRINT((
"PcNewServiceGroup() or NewMasterDmaChannel() failed"));
1315 *OutServiceGroup = ServiceGroup;
1316 ServiceGroup->AddRef();
1325 Miniport->isStreamRunning[streamIndex] =
true;
1333 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::SetFormat(%p)",
this,
Format));
1374 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::SetContentId(%d, %p)",
this, contentId, drmRights));
1386 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::AllocateAudioBuffer(0x%x, %p, %p, %p, %p)",
this,
size, userModeBuffer,
bufferSize, bufferOffset, cacheType));
1400 audioBufferMDL =
Port->AllocatePagesForMdl(high,
size);
1402 audioBufferMDL =
Port->AllocateContiguousPagesForMdl(low, high,
size);
1404 if (!audioBufferMDL) {
1405 DBGPRINT((
"AllocateContiguousPagesForMdl()/AllocatePagesForMdl() failed (size: 0x%x)",
size));
1409 dmaAddress =
Port->GetPhysicalPageAddress(audioBufferMDL, 0).LowPart;
1410 dmaMemorySize =
size;
1412 *userModeBuffer = audioBufferMDL;
1424 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::FreeAudioBuffer(%p, %x)",
this,
Mdl,
Size));
1427 audioBufferMDL =
NULL;
1435 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::GetHWLatency(%p)",
this, hwLatency));
1444 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::GetPositionRegister(%p)",
this, hwRegister));
1452 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::GetClockRegister(%p)",
this, hwRegister));
1490 if (
state != NewState) {
1493 DBGPRINT((
"---KSSTATE_ACQUIRE: previous state: %d",
state));
1499 if ((dmaMemorySize == 0) || (dmaAddress == 0)) {
1504 DBGPRINT((
"---dmaAddress: %x, dmaMemorySize: %x, dmaSize: %x", dmaAddress, dmaMemorySize,
dmaSize));
1525 DBGPRINT((
"---DMA Address: HighPart: 0x%08X LowPart: 0x%08X",
DMAChannel->PhysicalAddress().u.HighPart,
DMAChannel->PhysicalAddress().u.LowPart));
1707 if (
Port &&
stream[streamIndex]->ServiceGroup) {
1708 Port->Notify(
stream[streamIndex]->ServiceGroup);
IPortWaveRT * PPORTWAVERT
UInt32 requestedChannelMask
PDMACHANNEL DMAChannel[3]
CMiniportWaveStreamCMI * stream[3]
UInt32 requestedChannelCount
NTSTATUS validateFormat(PKSDATAFORMAT format, ULONG PinID, BOOLEAN capture)
NTSTATUS processResources(PRESOURCELIST resourceList)
NTSTATUS newDMAChannel(PDMACHANNEL *dmaChannel, UInt32 bufferLength)
UInt32 notificationInterval
NTSTATUS isFormatAllowed(UInt32 sampleRate, BOOLEAN multiChan, BOOLEAN AC3)
NTSTATUS loadChannelConfigFromRegistry()
NTSTATUS storeChannelConfigToRegistry()
UInt32 currentChannelCount
~CMiniportWaveStreamCMI()
NTSTATUS setDACChannels()
NTSTATUS Init(CMiniportWaveCMI *Miniport_, UInt32 streamIndex_, bool isCaptureStream_, PKSDATAFORMAT DataFormat, PDMACHANNEL DMAChannel_, PSERVICEGROUP *OutServiceGroup)
CMiniportWaveCMI * Miniport
NTSTATUS setupAC3Passthru()
PSERVICEGROUP ServiceGroup
NTSTATUS setupSPDIFPlayback(bool enableSPDIF)
#define STATUS_NOT_SUPPORTED
KSDATAFORMAT * PKSDATAFORMAT
#define NT_SUCCESS(StatCode)
#define MAX_BITS_PER_SAMPLE_WMA
#define MIN_SAMPLE_RATE_WMA
#define MAX_SAMPLE_RATE_MULTI
#define MIN_BITS_PER_SAMPLE_AC3
#define MIN_BITS_PER_SAMPLE_WMA
@ PIN_WAVE_CAPTURE_SOURCE
@ PIN_WAVE_AC3_RENDER_SINK
#define MAX_SAMPLE_RATE_AC3
#define MAX_SAMPLE_RATE_WMA
#define MAXLEN_DMA_BUFFER
#define MAX_BITS_PER_SAMPLE_AC3
#define MIN_SAMPLE_RATE_AC3
struct _MINIPORT * PMINIPORT
NTSTATUS NTAPI PcNewRegistryKey(OUT PREGISTRYKEY *OutRegistryKey, IN PUNKNOWN OuterUnknown OPTIONAL, IN ULONG RegistryKeyType, IN ACCESS_MASK DesiredAccess, IN PVOID DeviceObject OPTIONAL, IN PVOID SubDevice OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN ULONG CreateOptions OPTIONAL, OUT PULONG Disposition OPTIONAL)
IDrmAudioStream * PDRMAUDIOSTREAM
#define KSPROPERTY_TYPE_SET
#define KSPROPERTY_TYPE_BASICSUPPORT
#define KSPROPERTY_TYPE_GET
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define RtlFillMemory(Dest, Length, Fill)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define KSDATAFORMAT_TYPE_WILDCARD
#define KSDATAFORMAT_SUBTYPE_WILDCARD
#define KSDATAFORMAT_SPECIFIER_WILDCARD
#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF
NTSTATUS NTAPI CreateMiniportWaveCMI(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
NTSTATUS CreateMiniportWaveStreamCMI(CMiniportWaveStreamCMI **MiniportWaveStreamCMI, PUNKNOWN pUnknownOuter, POOL_TYPE PoolType)
STDMETHODIMP_(void) CMiniportWaveCMI
NTSTATUS NTAPI PropertyHandler_ChannelConfig(PPCPROPERTY_REQUEST PropertyRequest)
static PCFILTER_DESCRIPTOR WaveMiniportFilterDescriptor
#define KSDATAFORMAT_SUBTYPE_WMA_SPDIF
static KSDATARANGE_AUDIO WavePinDataRangesAC3Stream[]
#define WAVE_FORMAT_WMA_SPDIF
WAVEFORMATPCMEX * PWAVEFORMATPCMEX
struct _WAVEFORMATEX * PWAVEFORMATEX
WAVEFORMATEXTENSIBLE WAVEFORMATPCMEX
#define WAVE_FORMAT_DOLBY_AC3_SPDIF
#define ExFreePoolWithTag(_P, _T)
@ KeyValuePartialInformation
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define REG_OPTION_NON_VOLATILE
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
__GNU_EXTENSION typedef __int64 * PLONGLONG
BOOLEAN NTAPI IoIsWdmVersionAvailable(IN UCHAR MajorVersion, IN UCHAR MinorVersion)
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
#define STATUS_DEVICE_CONFIGURATION_ERROR
IMiniportWaveCyclic * PMINIPORTWAVECYCLIC
IRegistryKey * PREGISTRYKEY
IDmaChannel * PDMACHANNEL
IMiniportWaveRT * PMINIPORTWAVERT
IResourceList * PRESOURCELIST
IMiniportWaveRTStream * PMINIPORTWAVERTSTREAM
IPortWaveRTStream * PPORTWAVERTSTREAM
IMiniportWaveCyclicStream * PMINIPORTWAVECYCLICSTREAM
IPortWaveCyclic * PPORTWAVECYCLIC
IServiceGroup * PSERVICEGROUP
#define FMT_960_MULTI_PCM
#define FMT_441_MULTI_PCM
#define FMT_480_MULTI_PCM
#define FMT_882_MULTI_PCM
enum _DMA_SPEED DMA_SPEED
enum _DMA_WIDTH DMA_WIDTH
NTSTATUS NTAPI PcNewServiceGroup(OUT PSERVICEGROUP *OutServiceGroup, IN PUNKNOWN OuterUnknown OPTIONAL)
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
PCMITOPOLOGY TopoMiniport
bool enableSPDIFInMonitor
ULONG MaximumSampleFrequency
ULONG MinimumSampleFrequency
WAVEFORMATEX WaveFormatEx
union WAVEFORMATEXTENSIBLE::@3022 Samples
INTERFACE_TYPE InterfaceType
BOOLEAN Dma32BitAddresses
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_In_opt_ PVOID _In_ ULONG bufferLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
_In_ WDFREQUEST _In_ size_t OutputBufferLength
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
#define IsEqualGUIDAligned(guid1, guid2)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE