11#define STR_MODULENAME "AC97 Common: "
92 {{
FALSE,
L"DisablePCBeep"},
97 {
FALSE,
L"DisableHeadphone"},
98 {
FALSE,
L"DisableMonoOut"},
101 {
FALSE,
L"DisableLineIn"},
103 {
FALSE,
L"DisableSurround"},
104 {
FALSE,
L"DisableCenterLFE"}}
109#pragma code_seg("PAGE")
123 "Allocation failures cause a system crash"))
174 u.Port.Start.QuadPart;
178 u.Port.Start.QuadPart;
181 " Bus Master = 0x%p\n"
204 DOUT (
DBG_ERROR, (
"Probing of hardware configuration failed!"));
239 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::~CAC97AdapterCommon]"));
249void CAC97AdapterCommon::DumpConfig (
void)
502 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::NonDelegatingQueryInterface]"));
589 ntStatus = ReadCodecRegister (AC97Reg, &wOriginal);
595 ntStatus = WriteCodecRegister (AC97Reg,
601 ntStatus = ReadCodecRegister (AC97Reg, &wCodecReg);
607 (wCodecReg & 0x2020))
617 WriteCodecRegister (AC97Reg, wOriginal, 0xFFFF);
641 DWORD dwGlobalStatus;
662 if (wCodecReg != 0x8000)
747 if (wCodecReg == 0x8000)
761 if (wCodecReg == 0x8000)
830 if (wCodecReg & 0x0100)
844 if (wCodecReg & 0x0100)
901 (wCodecReg & 0x0F00) != 0x0A00)
908 (wCodecReg & 0x000F) != 0x000A)
998 dwGlobalStatus = ReadBMControlRegister32 (
GLOB_STA);
1066 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::AcquireCodecSemiphore]"));
1074 if (ulCount++ > 100)
1110 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::ReadCodecRegister]"));
1124 DOUT (
DBG_ERROR, (
"ReadCodecRegister couldn't acquire the semiphore"
1148 DOUT (
DBG_ERROR, (
"ReadCodecRegister timed out for register %s",
1166 "REG_INVALID", *
wData));
1178 "REG_INVALID", *
wData));
1205 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::WriteCodecRegister]"));
1218 if (
wMask != 0xffff)
1223 ntStatus = ReadCodecRegister (
reg, &TempData);
1226 DOUT (
DBG_ERROR, (
"WriteCodecRegiser read for mask failed"));
1248 DOUT (
DBG_ERROR, (
"WriteCodecRegister failed for register %s",
1270 "REG_INVALID", TempData));
1288 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::PrimaryCodecReady]"));
1299 WriteBMControlRegister (
GLOB_CNT, dwRegValue);
1304 ULONG WaitCycles = 200;
1318 }
while (WaitCycles--);
1348 ULONG WaitCycles = 200;
1368 if ((wCodecReg & 0x0f) == 0x0f)
1375 }
while (WaitCycles--);
1378 if ((wCodecReg & 0x0f) != 0x0f)
1380 DOUT (
DBG_ERROR, (
"PowerUpCodec timed out. CoDec not powered up."));
1406 WORD wOldRateReg, wCodecReg;
1409 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::ProgramSampleRate]"));
1483 ntStatus = ReadCodecRegister (
Register, &wOldRateReg);
1500 ntStatus = ReadCodecRegister (
Register, &wCodecReg);
1515 WriteCodecRegister (
Register, wOldRateReg, 0xFFFF);
1541 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::PowerChangeNotify]"));
1569 switch (NewState.DeviceState)
1590 ntStatus = RestoreCodecRegisters ();
1600 DOUT (
DBG_ERROR, (
"PowerChangeState failed to restore the codec."));
1654 ulReg = ReadBMControlRegister32 (
GLOB_CNT);
1684 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::QueryPowerChangeState]"));
1693 switch (NewState.DeviceState)
1727 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::QueryDeviceCapabilities]"));
1749 ULONG ulDisposition;
1750 ULONG ulResultLength;
1771 ntStatus = DriverKey->NewSubKey (&SettingsKey,
1784 if (
NULL != KeyInfo)
1797 ntStatus = SettingsKey->QueryValueKey (&sKeyName,
1843 SettingsKey->Release ();
1847 DriverKey->Release ();
1889 ULONG ulDisposition;
1890 ULONG ulResultLength;
1912 ntStatus = DriverKey->NewSubKey (&SettingsKey,
1925 if (
NULL != KeyInfo)
1932 ntStatus = SettingsKey->QueryValueKey (&sKeyName,
1958 SettingsKey->Release ();
1962 DriverKey->Release ();
1975NTSTATUS CAC97AdapterCommon::RestoreCodecRegisters (
void)
1979 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::RestoreCodecRegisters]"));
2009STDMETHODIMP_(
void) CAC97AdapterCommon::ReadChannelConfigDefault
2020 ULONG ulDisposition;
2021 ULONG ulResultLength;
2024 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::ReadChannelConfigDefault]"));
2046 ntStatus = DriverKey->NewSubKey (&SettingsKey,
2059 if (
NULL != KeyInfo)
2065 ntStatus = SettingsKey->QueryValueKey (&sKeyName,
2084 *pdwChannelConfig = *(
PDWORD)PartialInfo->
Data;
2093 *pdwChannelConfig = *(
PDWORD)PartialInfo->
Data;
2106 SettingsKey->Release ();
2110 DriverKey->Release ();
2121STDMETHODIMP_(
void) CAC97AdapterCommon::WriteChannelConfigDefault (
DWORD dwChannelConfig)
2128 ULONG ulDisposition;
2130 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::WriteChannelConfigDefault]"));
2148 ntStatus = DriverKey->NewSubKey (&SettingsKey,
2161 ntStatus = SettingsKey->SetValueKey (&sKeyName,
2167 DOUT (
DBG_ERROR, (
"Could not write the ChannelConfig to registry."));
2171 SettingsKey->Release ();
2175 DriverKey->Release ();
2192STDMETHODIMP_(
void) CAC97AdapterCommon::WriteBMControlRegister
2198 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::WriteBMControlRegister] (UCHAR)"));
2202 DOUT (
DBG_REGS, (
"WriteBMControlRegister wrote 0x%2x to 0x%4p.",
2211STDMETHODIMP_(
void) CAC97AdapterCommon::WriteBMControlRegister
2217 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::WriteBMControlRegister (USHORT)]"));
2221 DOUT (
DBG_REGS, (
"WriteBMControlRegister wrote 0x%4x to 0x%4p",
2230STDMETHODIMP_(
void) CAC97AdapterCommon::WriteBMControlRegister
2236 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::WriteBMControlRegister (ULONG)]"));
2240 DOUT (
DBG_REGS, (
"WriteBMControlRegister wrote 0x%8x to 0x%4p.",
2256 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::ReadBMControlRegister8]"));
2260 DOUT (
DBG_REGS, (
"ReadBMControlRegister read 0x%2x from 0x%4p.", ucValue,
2278 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::ReadBMControlRegister16]"));
2282 DOUT (
DBG_REGS, (
"ReadBMControlRegister read 0x%4x = 0x%4p", usValue,
2300 DOUT (
DBG_PRINT, (
"[CAC97AdapterCommon::ReadBMControlRegister32]"));
2304 DOUT (
DBG_REGS, (
"ReadBMControlRegister read 0x%8x = 0x%4p", ulValue,
STDMETHODIMP_(void) CAC97AdapterCommon
NTSTATUS NewAdapterCommon(OUT PUNKNOWN *Unknown, IN REFCLSID, IN PUNKNOWN UnknownOuter OPTIONAL, _When_((PoolType &NonPagedPoolMustSucceed) !=0, __drv_reportError("Must succeed pool allocations are forbidden. " "Allocation failures cause a system crash")) IN POOL_TYPE PoolType)
@ AC97REG_SURROUND_VOLUME
@ AC97REG_RECORD_SAMPLERATE
@ AC97REG_CENTER_LFE_VOLUME
@ AC97REG_SURROUND_SAMPLERATE
@ AC97REG_FRONT_SAMPLERATE
AC97REG_INVALID AC97Register _Out_ PWORD wData
NTSTATUS SetAC97Default(void)
NTSTATUS PrimaryCodecReady(void)
DEVICE_POWER_STATE m_PowerState
static tHardwareConfig m_stHardwareConfig
NTSTATUS PowerUpCodec(void)
static tAC97Registers m_stAC97Registers[64]
PAC97MINIPORTTOPOLOGY m_Topology
PDEVICE_OBJECT m_pDeviceObject
IN PDEVICE_OBJECT DeviceObject
NTSTATUS AcquireCodecSemiphore(void)
AC97REG_INVALID AC97Register Register
AC97REG_INVALID AC97Register _In_ WORD _In_ WORD wMask
NTSTATUS Check6thBitSupport(IN AC97Register, IN TopoNodeConfig)
NTSTATUS ProbeHWConfig(void)
BOOL DisableAC97Pin(IN TopoPinConfig)
#define STATUS_NOT_SUPPORTED
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
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)
#define DOUT(lvl, strings)
@ PINC_CENTER_LFE_PRESENT
@ NODEC_6BIT_CENTER_LFE_VOLUME
@ NODEC_3D_DEPTH_ADJUSTABLE
@ NODEC_PCM_DOUBLERATE_SUPPORTED
@ NODEC_MIC_VARIABLERATE_SUPPORTED
@ NODEC_6BIT_HPOUT_VOLUME
@ NODEC_SURROUND_DAC_PRESENT
@ NODEC_CENTER_DAC_PRESENT
@ NODEC_PCM_VARIABLERATE_SUPPORTED
@ NODEC_3D_CENTER_ADJUSTABLE
@ NODEC_6BIT_SURROUND_VOLUME
@ NODEC_SIMUL_STEREO_PRESENT
@ NODEC_6BIT_MONOOUT_VOLUME
@ NODEC_6BIT_MASTER_VOLUME
@ NODEC_PCM_VSR_INDEPENDENT_RATES
IAC97AdapterCommon * PADAPTERCOMMON
#define __drv_reportError(why)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeDelayExecutionThread(mode, foo, t)
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
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 * u
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
ULONG NTAPI READ_PORT_ULONG(IN PULONG Port)
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
USHORT NTAPI READ_PORT_USHORT(IN PUSHORT Port)
const ULONG GLOB_CNT_PRIE
const ULONG GLOB_CNT_ACLOFF
const ULONG GLOB_CNT_COLD
#define ExFreePoolWithTag(_P, _T)
#define KeStallExecutionProcessor(MicroSeconds)
#define _Use_decl_annotations_
#define _Analysis_assume_
@ KeyValuePartialInformation
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define REG_OPTION_NON_VOLATILE
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
#define UNREFERENCED_PARAMETER(P)
#define READ_PORT_UCHAR(p)
#define WRITE_PORT_UCHAR(p, d)
IRegistryKey * PREGISTRYKEY
IResourceList * PRESOURCELIST
IAdapterPowerManagement * PADAPTERPOWERMANAGEMENT
#define STATUS_DEVICE_NOT_READY
PULONG MinorVersion OPTIONAL
#define STATUS_INVALID_PARAMETER
#define STATUS_IO_TIMEOUT
#define STATUS_NO_SUCH_DEVICE
#define STATUS_UNSUCCESSFUL
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
#define IsEqualGUIDAligned(guid1, guid2)
#define DBG_PRINT(ppi, ch, level)
_In_ DWORD _Out_ _In_ WORD wFlags
@ NonPagedPoolMustSucceed