[CMIDriver]

* Update the C-Media 8738/8768 driver to 1.2.6
 * Add it to build

svn path=/trunk/; revision=58644
This commit is contained in:
Jérôme Gardou 2013-04-02 15:25:49 +00:00
parent 9786c38e69
commit ee4368d5ee
38 changed files with 951 additions and 1373 deletions

View file

@ -1,5 +1,6 @@
add_subdirectory(backpln)
add_subdirectory(drivers)
add_subdirectory(drm)
add_subdirectory(filters)
add_subdirectory(legacy)

View file

@ -4,7 +4,7 @@ set_cpp()
remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
spec2def(portcls.sys portcls.spec)
spec2def(portcls.sys portcls.spec ADD_IMPORTLIB)
list(APPEND SOURCE
adapter.cpp

View file

@ -1,3 +1,52 @@
1.2.6:
- small bug in cmicontrol eradicated (thanks, doujinshi)
1.2.5:
- bugfix for cmicontrol (thanks, ian)
1.2.4:
- manifest for installer (thanks, martin)
- half-assed workaround for WaveRT version (DirectSound error code 88780096)
- some fixes for recording (thanks, gazsi222 and reesharr)
1.2.3:
- installer checks for administrative rights and warns user when not present
- small fix for cmicontrol (thanks, personaldustbin)
1.2.2:
- uninstaller fix (thanks, yroggy)
1.2.1:
- implement toggle switch for loop through mode in cmicontrol.exe
- disable 88.2 kHz / 96 kHz on 8738 chips by default
1.2.0:
- Analog-in mute control for recording was inverted - fixed (thanks, mechman)
- CD-in mute control fixed (thanks again, mechman)
1.1.9:
- workaround for WASAPI "bug" which caused random noise to be played - thanks, hanssatink
1.1.8:
- the checkboxes corresponding to the speakers in cmicontrol.exe were too small - fixed
- some other minor fixes
1.1.7:
- make "select secondary S/PDIF-in" stick after a reload (thanks, Marcin)
- the "enable PCM DAC" setting in the control panel was somewhat broken - fixed (thanks, Marcin)
- stupid hibernation bug fixed (thanks, Leto)
1.1.6:
- lots of installer bugs fixed
1.1.5:
- big improvements to the installer
- minor fixes for cmicontrol.exe
1.1.4:
- preliminary support for WMA Pro passthrough (the MCE of Vista is still buggy)
- UART support has been disabled due to stability issues on motherboards with ULi chipsets
1.1.3:
- power management fixes for Vista
- user friendly default values
@ -98,4 +147,4 @@ If you know why this is happening or why the XP mixer tries to render the AC3 pi
0.9.3:
- bug fixes for multi channel audio
- several other minor fixes
- several other minor fixes

View file

@ -0,0 +1,49 @@
add_subdirectory(cmicontrol)
add_subdirectory(cpl)
set_cpp()
# for WaveRT support
remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
list(APPEND SOURCE
adapter.cpp
common.cpp
mintopo.cpp
minwave.cpp
)
add_library(cmipci SHARED
${SOURCE}
cmipci.rc
)
target_link_libraries(cmipci
stdunk
libcntpr
)
set_module_type(cmipci wdmdriver UNICODE ENTRYPOINT 0)
add_importlibs(cmipci
portcls
hal
ntoskrnl)
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
if(MSVC)
#add_target_compile_flags(portcls "/GR-")
set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "/GR-")
else()
#add_target_compile_flags(portcls "-fno-exceptions -fno-rtti")
set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-fno-exceptions -fno-rtti -Wno-write-strings -Wno-switch")
endif()
add_cd_file(TARGET cmipci DESTINATION reactos/system32/drivers FOR all)
if(ARCH STREQUAL "i386")
add_cd_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/CM8738-x32-WaveRT.inf" DESTINATION reactos/inf FOR all)
else()
add_cd_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/CM8738-x64-WaveRT.inf" DESTINATION reactos/inf FOR all)
endif()

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -26,111 +26,22 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define PUT_GUIDS_HERE
#include <initguid.h>
#include "adapter.hpp"
#ifdef _MSC_VER
//#pragma code_seg("PAGE") // GCC ignores pragma code_seg
#pragma code_seg("PAGE")
#endif
const GUID KSNODETYPE_DAC = {0x507AE360L, 0xC554, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_ADC = {0x4D837FE0L, 0xC555, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_AGC = {0xE88C9BA0L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_LOUDNESS = {0x41887440L, 0xC558, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_MUTE = {0x02B223C0L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_TONE = {0x7607E580L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_VOLUME = {0x3A5ACC00L, 0xC557, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_PEAKMETER = {0xa085651e, 0x5f0d, 0x4b36, {0xa8, 0x69, 0xd1, 0x95, 0xd6, 0xab, 0x4b, 0x9e}};
const GUID KSNODETYPE_MUX = {0x2CEAF780, 0xC556, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_STEREO_WIDE = {0xA9E69800L, 0xC558, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_CHORUS = {0x20173F20L, 0xC559, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_REVERB = {0xEF0328E0L, 0xC558, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_SUPERMIX = {0xE573ADC0L, 0xC555, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_SUM = {0xDA441A60L, 0xC556, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_SRC = {0x9DB7B9E0L, 0xC555, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_3D_EFFECTS = {0x55515860L, 0xC559, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}};
const GUID KSNODETYPE_SPDIF_INTERFACE = {0x0605+0xDFF219E0, 0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KSNODETYPE_MICROPHONE = {0x0201+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KSNODETYPE_CD_PLAYER = {0x0703+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KSNODETYPE_LINE_CONNECTOR = {0x0603+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KSNODETYPE_ANALOG_CONNECTOR = {0x601+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KSNODETYPE_SPEAKER = {0x0301+0xDFF219E0,0xF70F, 0x11D0, {0xB9, 0x17, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KSPROPTYPESETID_General = {0x97E99BA0L, 0xBDEA, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
const GUID KSPROPSETID_General = {0x1464EDA5L, 0x6A8F, 0x11D1, {0x9A, 0xA7, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KSPROPSETID_Audio = {0x45FFAAA0L, 0x6E1B, 0x11D0, {0xBC, 0xF2, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
const GUID GUID_NULL ={0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
const GUID KSCATEGORY_AUDIO = {0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KSDATAFORMAT_TYPE_AUDIO = {0x73647561L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
const GUID KSDATAFORMAT_SUBTYPE_PCM = {0x00000001L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
const GUID KSDATAFORMAT_SPECIFIER_WAVEFORMATEX = {0x05589f81L, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
const GUID KSDATAFORMAT_SPECIFIER_DSOUND = {0x518590a2L, 0xa184, 0x11d0, {0x85, 0x22, 0x00, 0xc0, 0x4f, 0xd9, 0xba, 0xf3}};
const GUID KSDATAFORMAT_SUBTYPE_WAVEFORMATEX = {0x00000000L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
const GUID KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF = {0x00000092L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
const GUID KSAUDFNAME_WAVE_VOLUME = {0x185FEDE5L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_WAVE_MUTE = {0x185FEDE6L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_MIC_VOLUME = {0x185FEDEDL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_MASTER_VOLUME = {0x185FEDE3L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_RECORDING_SOURCE = {0x185FEDEFL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_CD_VOLUME = {0x185FEDE9L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_CD_IN_VOLUME = {0x185FEDF3L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_MIC_IN_VOLUME = {0x185FEDF5L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_MICROPHONE_BOOST = {0x2bc31d6aL, 0x96e3, 0x11d2, {0xac, 0x4c, 0x0, 0xc0, 0x4f, 0x8e, 0xfb, 0x68}};
const GUID KSAUDFNAME_CD_MUTE = {0x185FEDEAL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_LINE_MUTE = {0x185FEDECL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_MIC_MUTE = {0x185FEDEEL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_AUX_MUTE = {0x185FEDFDL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_MASTER_MUTE = {0x185FEDE4L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_RECORDING_CONTROL = {0x185FEDFAL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_VOLUME_CONTROL = {0x185FEDF7L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_LINE_IN_VOLUME = {0x185FEDF4L, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSAUDFNAME_AUX_VOLUME = {0x185FEDFCL, 0x9905, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID KSPROPSETID_CMI = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFF}};
const GUID CMINAME_IEC_5V = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF0}};
const GUID CMINAME_IEC_OUT = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF1}};
const GUID CMINAME_IEC_INVERSE = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF2}};
const GUID CMINAME_IEC_MONITOR = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF3}};
const GUID CMINAME_IEC_SELECT = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF5}};
const GUID CMINAME_XCHG_FB = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF6}};
const GUID CMINAME_BASS2LINE = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF7}};
const GUID CMINAME_CENTER2LINE = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF8}};
const GUID CMINAME_IEC_COPYRIGHT = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF9}};
const GUID CMINAME_IEC_POLVALID = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFA}};
const GUID CMINAME_IEC_LOOP = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFB}};
const GUID CMINAME_REAR2LINE = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFC}};
const GUID CMINAME_CENTER2MIC = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFD}};
const GUID CMINAME_DAC = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF4}};
const GUID PRODUCT_CM8738 = {0x9db14e9a, 0x7be7, 0x480d, {0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9c}};
const GUID COMPONENT_CM8738 = {0x9db14e9a, 0x7be7, 0x480d, {0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9d}};
const GUID MANUFACTURER_CM8738 = {0x9db14e9a, 0x7be7, 0x480d, {0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9e}};
NTSTATUS InstallSubdevice(
PDEVICE_OBJECT DeviceObject,
PIRP Irp,
PWCHAR Name,
REFGUID PortClassId,
REFGUID MiniportClassId,
PFNCREATEINSTANCE MiniportCreate,
PUNKNOWN UnknownAdapter,
PRESOURCELIST ResourceList,
REFGUID PortInterfaceId,
PUNKNOWN* OutPortUnknown)
NTSTATUS InstallSubdevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PWCHAR Name, REFGUID PortClassId, REFGUID MiniportClassId, PFNCREATEINSTANCE MiniportCreate, PUNKNOWN UnknownAdapter, PRESOURCELIST ResourceList, REFGUID PortInterfaceId, PUNKNOWN* OutPortUnknown)
{
PAGED_CODE();
DBGPRINT(("InstallSubdevice()"));
NTSTATUS ntStatus;
PPORT Port;
PMINIPORT MiniPort;
////PAGED_CODE();
DBGPRINT(("InstallSubdevice()"));
ntStatus = PcNewPort(&Port, PortClassId);
if (NT_SUCCESS(ntStatus)) {
if (MiniportCreate) {
@ -166,24 +77,19 @@ NTSTATUS InstallSubdevice(
}
NTSTATUS
ProcessResources(
PRESOURCELIST ResourceList,
PRESOURCELIST* UartResourceList)
NTSTATUS ProcessResources(PRESOURCELIST ResourceList, PRESOURCELIST* UartResourceList)
{
NTSTATUS ntStatus;
////PAGED_CODE();
////ASSERT(ResourceList);
////ASSERT(UartResourceList);
//DBGPRINT(("ProcessResources()"));
//DBGPRINT(("NumberOfPorts: %d, NumberOfInterrupts: %d, NumberOfDmas: %d", ResourceList->NumberOfPorts(), ResourceList->NumberOfInterrupts(), ResourceList->NumberOfDmas()));
PAGED_CODE();
ASSERT(ResourceList);
ASSERT(UartResourceList);
DBGPRINT(("ProcessResources()"));
DBGPRINT(("NumberOfPorts: %d, NumberOfInterrupts: %d, NumberOfDmas: %d", ResourceList->NumberOfPorts(), ResourceList->NumberOfInterrupts(), ResourceList->NumberOfDmas()));
#ifdef UART
NTSTATUS ntStatus;
(*UartResourceList) = NULL;
#endif
if ((ResourceList->NumberOfPorts() == 0) || (ResourceList->NumberOfPorts() > 2) || (ResourceList->NumberOfInterrupts() != 1) || (ResourceList->NumberOfDmas() != 0)) {
DBGPRINT(("Unexpected configuration"));
return STATUS_DEVICE_CONFIGURATION_ERROR;
@ -203,15 +109,16 @@ ProcessResources(
NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST ResourceList)
{
PAGED_CODE();
ASSERT(DeviceObject);
ASSERT(Irp);
ASSERT(ResourceList);
DBGPRINT(("StartDevice()"));
NTSTATUS ntStatus;
PPORT pPort = 0;
#ifdef UART
ULONG* MPUBase;
#if 0
//PAGED_CODE();
//ASSERT(DeviceObject);
//ASSERT(Irp);
//ASSERT(ResourceList);
DBGPRINT(("StartDevice()"));
#endif
ntStatus = PcNewPort(&pPort,CLSID_PortWaveCyclic);
@ -269,9 +176,7 @@ NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST Resour
PUNKNOWN unknownTopology = NULL;
// install the topology miniport.
ntStatus = InstallSubdevice( DeviceObject, Irp, (PWCHAR) L"Topology",
CLSID_PortTopology, CLSID_PortTopology, CreateMiniportTopologyCMI,
pCMIAdapter, NULL, GUID_NULL, &unknownTopology );
ntStatus = InstallSubdevice(DeviceObject, Irp, L"Topology", CLSID_PortTopology, CLSID_PortTopology, CreateMiniportTopologyCMI, pCMIAdapter, NULL, GUID_NULL, &unknownTopology);
if (!NT_SUCCESS (ntStatus)) {
DBGPRINT(("Topology miniport installation failed"));
return ntStatus;
@ -281,7 +186,7 @@ NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST Resour
// install the UART miniport - execution order important
ntStatus = STATUS_UNSUCCESSFUL;
MPUBase = 0;
for ( UINT i=0; i < ResourceList->NumberOfPorts(); i++ ) {
for (int i=0;i<ResourceList->NumberOfPorts();i++) {
if (ResourceList->FindTranslatedPort(i)->u.Port.Length == 2) {
MPUBase = (UInt32*)ResourceList->FindTranslatedPort(i)->u.Port.Start.QuadPart;
}
@ -289,10 +194,7 @@ NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST Resour
if (MPUBase != 0) {
ntStatus = pCMIAdapter->activateMPU(MPUBase);
if (NT_SUCCESS(ntStatus)) {
ntStatus = InstallSubdevice( DeviceObject, Irp, (PWCHAR) L"Uart",
CLSID_PortDMus, CLSID_MiniportDriverDMusUART, NULL,
pCMIAdapter->getInterruptSync(), UartResourceList,
IID_IPortDMus, NULL );
ntStatus = InstallSubdevice(DeviceObject, Irp, L"Uart", CLSID_PortDMus, CLSID_MiniportDriverDMusUART, NULL, pCMIAdapter->getInterruptSync(), UartResourceList, IID_IPortDMus, NULL);
}
}
if (!NT_SUCCESS(ntStatus)) {
@ -307,13 +209,9 @@ NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST Resour
// install the wave miniport - the order matters here
#ifdef WAVERT
ntStatus = InstallSubdevice(DeviceObject, Irp, (PWCHAR) L"Wave",
CLSID_PortWaveRT, CLSID_PortWaveRT, CreateMiniportWaveCMI,
pCMIAdapter, ResourceList, IID_IPortWaveRT, &unknownWave );
ntStatus = InstallSubdevice(DeviceObject, Irp, L"Wave", CLSID_PortWaveRT, CLSID_PortWaveRT, CreateMiniportWaveCMI, pCMIAdapter, ResourceList, IID_IPortWaveRT, &unknownWave);
#else
ntStatus = InstallSubdevice(DeviceObject, Irp, (PWCHAR) L"Wave",
CLSID_PortWaveCyclic, CLSID_PortWaveCyclic, CreateMiniportWaveCMI,
pCMIAdapter, ResourceList, IID_IPortWaveCyclic, &unknownWave );
ntStatus = InstallSubdevice(DeviceObject, Irp, L"Wave", CLSID_PortWaveCyclic, CLSID_PortWaveCyclic, CreateMiniportWaveCMI, pCMIAdapter, ResourceList, IID_IPortWaveCyclic, &unknownWave);
#endif
if (!NT_SUCCESS(ntStatus)) {
DBGPRINT(("Wave miniport installation failed"));
@ -353,29 +251,22 @@ NTSTATUS StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST Resour
return ntStatus;
}
extern
"C"
NTSTATUS
NTAPI
AddDevice(
PDRIVER_OBJECT DriverObject,
PDEVICE_OBJECT PhysicalDeviceObject)
extern "C" NTSTATUS NTAPI AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject)
{
#if 0
//PAGED_CODE();
DBGPRINT(("AddDevice()"));
#endif
PAGED_CODE();
DBGPRINT(("AddDevice()"));
return PcAddAdapterDevice(DriverObject, PhysicalDeviceObject, (PCPFNSTARTDEVICE)StartDevice, MAX_MINIPORTS, 0);
return PcAddAdapterDevice(DriverObject, PhysicalDeviceObject, (PCPFNSTARTDEVICE)StartDevice, MAX_MINIPORTS, 0);
}
bool CopyResourceDescriptor(PIO_RESOURCE_DESCRIPTOR pInResDescriptor, PIO_RESOURCE_DESCRIPTOR pOutResDescriptor)
{
#if 0
//PAGED_CODE();
//ASSERT(pInResDescriptor);
//ASSERT(pOutResDescriptor);
PAGED_CODE();
ASSERT(pInResDescriptor);
ASSERT(pOutResDescriptor);
DBGPRINT(("CopyResourceDescriptor()"));
#if 0
RtlCopyMemory(pOutResDescriptor, pInResDescriptor, sizeof(IO_RESOURCE_DESCRIPTOR));
#else
pOutResDescriptor->Type = pInResDescriptor->Type;
@ -395,18 +286,14 @@ bool CopyResourceDescriptor(PIO_RESOURCE_DESCRIPTOR pInResDescriptor, PIO_RESOUR
pOutResDescriptor->u.Port.MaximumAddress = pInResDescriptor->u.Port.MaximumAddress;
pOutResDescriptor->u.Port.Length = pInResDescriptor->u.Port.Length;
pOutResDescriptor->u.Port.Alignment = pInResDescriptor->u.Port.Alignment;
#if 0
DBGPRINT((" Port: min %08x.%08x max %08x.%08x, Length: %x, Option: %x", pOutResDescriptor->u.Port.MinimumAddress.HighPart, pOutResDescriptor->u.Port.MinimumAddress.LowPart,
pOutResDescriptor->u.Port.MaximumAddress.HighPart, pOutResDescriptor->u.Port.MaximumAddress.LowPart,
pOutResDescriptor->u.Port.Length, pOutResDescriptor->Option));
#endif
break;
case CmResourceTypeInterrupt:
pOutResDescriptor->u.Interrupt.MinimumVector = pInResDescriptor->u.Interrupt.MinimumVector;
pOutResDescriptor->u.Interrupt.MaximumVector = pInResDescriptor->u.Interrupt.MaximumVector;
#if 0
DBGPRINT((" IRQ: min %x max %x, Option: %d", pOutResDescriptor->u.Interrupt.MinimumVector, pOutResDescriptor->u.Interrupt.MaximumVector, pOutResDescriptor->Option));
#endif
break;
default:
return FALSE;
@ -415,25 +302,19 @@ bool CopyResourceDescriptor(PIO_RESOURCE_DESCRIPTOR pInResDescriptor, PIO_RESOUR
#endif
}
extern
"C"
NTSTATUS
NTAPI
AdapterDispatchPnp(
PDEVICE_OBJECT pDeviceObject,
PIRP pIrp)
extern "C" NTSTATUS AdapterDispatchPnp(PDEVICE_OBJECT pDeviceObject, PIRP pIrp)
{
PAGED_CODE();
ASSERT(pDeviceObject);
ASSERT(pIrp);
DBGPRINT(("AdapterDispatchPnp()"));
NTSTATUS ntStatus = STATUS_SUCCESS;
ULONG resourceListSize;
PIO_RESOURCE_REQUIREMENTS_LIST resourceList, list;
PIO_RESOURCE_DESCRIPTOR descriptor;
PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(pIrp);
////PAGED_CODE();
////ASSERT(pDeviceObject);
////ASSERT(pIrp);
DBGPRINT(("AdapterDispatchPnp()"));
if (pIrpStack->MinorFunction == IRP_MN_FILTER_RESOURCE_REQUIREMENTS) {
DBGPRINT(("[AdapterDispatchPnp] - IRP_MN_FILTER_RESOURCE_REQUIREMENTS"));
@ -460,10 +341,8 @@ AdapterDispatchPnp(
resourceList->List[0].Count = 0;
// copy the resources which have already been assigned
for ( UINT i=0; i < list->List[0].Count; i++ ) {
if (CopyResourceDescriptor( &list->List[0].Descriptors[i],
&resourceList->List[0].Descriptors[resourceList->List[0].Count] ))
{
for (unsigned int i=0;i<list->List[0].Count;i++) {
if (CopyResourceDescriptor(&list->List[0].Descriptors[i], &resourceList->List[0].Descriptors[resourceList->List[0].Count])) {
resourceList->List[0].Count++;
}
}
@ -497,7 +376,7 @@ AdapterDispatchPnp(
descriptor->u.Port.Length = 1;
descriptor->u.Port.Alignment = 0x10;
// DBGPRINT(("number of resource list descriptors: %d", resourceList->List[0].Count));
DBGPRINT(("number of resource list descriptors: %d", resourceList->List[0].Count));
pIrp->IoStatus.Information = (ULONG_PTR)resourceList;
@ -511,55 +390,33 @@ AdapterDispatchPnp(
return ntStatus;
}
extern
"C"
NTSTATUS
NTAPI
DriverEntry(
PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPathName)
extern "C" NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPathName)
{
NTSTATUS ntStatus;
DBGPRINT(("DriverEntry()"));
//bind the adapter driver to the portclass driver
ntStatus = PcInitializeAdapterDriver(DriverObject, RegistryPathName, AddDevice);
PAGED_CODE();
DBGPRINT(("DriverEntry()"));
NTSTATUS ntStatus;
//bind the adapter driver to the portclass driver
ntStatus = PcInitializeAdapterDriver(DriverObject, RegistryPathName, AddDevice);
#ifdef UART
if(NT_SUCCESS(ntStatus)) {
DriverObject->MajorFunction[IRP_MJ_PNP] = AdapterDispatchPnp;
}
if(NT_SUCCESS(ntStatus)) {
DriverObject->MajorFunction[IRP_MJ_PNP] = AdapterDispatchPnp;
}
#endif
#ifdef WAVERT
if (!IoIsWdmVersionAvailable(6,0)) {
ntStatus = STATUS_UNSUCCESSFUL;
}
if (!IoIsWdmVersionAvailable(6,0)) {
ntStatus = STATUS_UNSUCCESSFUL;
}
#endif
return ntStatus;
return ntStatus;
}
#ifdef _MSC_VER
#pragma code_seg()
#endif
int __cdecl _purecall (void)
{
return 0;
return 0;
}
#else
extern "C" {
void __cxa_pure_virtual()
{
// put error handling here
DbgBreakPoint();
}
}
#endif

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -30,7 +30,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "interfaces.hpp"
#include "debug.hpp"
#include "dmusicks.h"
#include "DMusicKS.h"
#ifdef UART
const ULONG MAX_MINIPORTS = 3;
@ -38,7 +38,7 @@ const ULONG MAX_MINIPORTS = 3;
const ULONG MAX_MINIPORTS = 2;
#endif
extern HRESULT NTAPI CreateMiniportWaveCMI
extern NTSTATUS NTAPI CreateMiniportWaveCMI
(
OUT PUNKNOWN * Unknown,
IN REFCLSID,
@ -46,7 +46,7 @@ extern HRESULT NTAPI CreateMiniportWaveCMI
IN POOL_TYPE PoolType
);
extern HRESULT NTAPI CreateMiniportTopologyCMI
extern NTSTATUS NTAPI CreateMiniportTopologyCMI
(
OUT PUNKNOWN * Unknown,
IN REFCLSID,

View file

@ -0,0 +1,33 @@
include_directories(..)
set_cpp()
add_executable(cmicontrol
main.cpp
window.rc
)
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
if(NOT MSVC)
#add_target_compile_flags(cmicontrol "-fno-exceptions -fno-rtti")
set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS "-Wno-write-strings")
endif()
add_importlibs(cmicontrol
user32
gdi32
ole32
advapi32
comctl32
shell32
dsound
setupapi
winmm
msvcrt
kernel32
)
set_module_type(cmicontrol win32gui)
add_cd_file(TARGET cmicontrol DESTINATION reactos/system32/drivers FOR all)

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -139,6 +139,7 @@ UINT findWaveDeviceID()
BOOL playTestTone()
{
SHORT* buffer;
BOOL isChannelChecked;
#if 1
WAVEFORMATEXTENSIBLE wfx;
@ -163,6 +164,18 @@ BOOL playTestTone()
wfx.cbSize = 0;
#endif
isChannelChecked = (SendMessage(GetDlgItem(hWndChild[0], IDC_LEFT), BM_GETCHECK, 0, 0) == BST_CHECKED);
isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_RIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED);
isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_BLEFT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 2);
isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_BRIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 2);
isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_CENTER), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 4);
isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_SUB), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 4);
isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_CLEFT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 6);
isChannelChecked |= (SendMessage(GetDlgItem(hWndChild[0], IDC_CRIGHT), BM_GETCHECK, 0, 0) == BST_CHECKED) && (currentChannelCount > 6);
if (!isChannelChecked)
return FALSE;
if (waveOutOpen(&hWave, findWaveDeviceID(), (WAVEFORMATEX*)&(wfx), 0, 0, CALLBACK_NULL) != MMSYSERR_NOERROR) {
PrintLastError("waveOutOpen()");
return FALSE;
@ -236,7 +249,6 @@ BOOL getCurrentChannelConfig()
DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc, (VOID*)&guid);
if (DirectSoundCreate8(guid, &ds, NULL) != S_OK) {
PrintLastError("DirectSoundCreate8()");
return FALSE;
}
@ -285,6 +297,7 @@ BOOL setCurrentChannelConfig()
case 4: speakerConfig = DSSPEAKER_QUAD; break;
case 6: speakerConfig = DSSPEAKER_5POINT1; break;
case 8: speakerConfig = DSSPEAKER_7POINT1; break;
default: speakerConfig = DSSPEAKER_STEREO; break;
}
if (ds->SetSpeakerConfig(speakerConfig) != S_OK) {
@ -337,13 +350,11 @@ BOOL getDeviceInfo(const GUID* category, CMIDEV* pDev)
BOOL getDeviceInterfaceDetail(const GUID* category, CMIDEV* pDev)
{
SP_DEVICE_INTERFACE_DATA deviceInterfaceData;
DWORD dataSize = 0;
BOOL result;
PTSTR pnpStr = NULL;
HDEVINFO hDevInfoWithInterface;
SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
ULONG ulDeviceInterfaceDetailDataSize = 0;
// get the PnP string
SetupDiGetDeviceInstanceId(pDev->Info, &(pDev->InfoData), NULL, 0, &dataSize);
@ -475,15 +486,17 @@ void cleanUp()
}
}
BOOL openDevice()
BOOL openDevice(bool handleError)
{
if (!getDeviceInfo(&KSCATEGORY_TOPOLOGY, &cmiTopologyDev)) {
PrintLastError("getDeviceInfo()");
if (handleError)
PrintLastError("getDeviceInfo()");
return FALSE;
}
if (!getDeviceInterfaceDetail(&KSCATEGORY_TOPOLOGY, &cmiTopologyDev)) {
PrintLastError("getDeviceInterfaceDetail()");
if (handleError)
PrintLastError("getDeviceInterfaceDetail()");
return FALSE;
}
@ -569,13 +582,19 @@ BOOL setDlgItems(HWND hWnd)
if (cmiData.maxChannels >= 8) {
SendMessage(hWndItem, CB_ADDSTRING, 0, (LPARAM)"7.1 Surround");
}
getCurrentChannelConfig();
SendMessage(hWndItem, CB_SETCURSEL, (currentChannelCount/2)-1, 0);
updateChannelBoxes(hWnd);
if (getCurrentChannelConfig()) {
EnableWindow(GetDlgItem(hWndChild[0], IDB_STARTSTOP), TRUE);
EnableWindow(GetDlgItem(hWndChild[0], IDCB_CHANNELCONFIG), TRUE);
SendMessage(hWndItem, CB_SETCURSEL, (currentChannelCount/2)-1, 0);
updateChannelBoxes(hWnd);
} else {
EnableWindow(GetDlgItem(hWndChild[0], IDB_STARTSTOP), FALSE);
EnableWindow(GetDlgItem(hWndChild[0], IDCB_CHANNELCONFIG), FALSE);
}
// checkboxes
SendMessage(GetDlgItem(hWndChild[0], IDC_EN_PCMDAC), BM_SETCHECK, (cmiData.enablePCMDAC ? BST_CHECKED : BST_UNCHECKED), 0);
SendMessage(GetDlgItem(hWndChild[0], IDC_EXCH_FB), BM_SETCHECK, (cmiData.exchangeFrontBack ? BST_CHECKED : BST_UNCHECKED), 0);
SendMessage(GetDlgItem(hWndChild[0], IDC_EN_SPDIMONITOR), BM_SETCHECK, (cmiData.enableSPDIMonitor ? BST_CHECKED : BST_UNCHECKED), 0);
SendMessage(GetDlgItem(hWndChild[1], IDC_EN_SPDO), BM_SETCHECK, (cmiData.enableSPDO ? BST_CHECKED : BST_UNCHECKED), 0);
SendMessage(GetDlgItem(hWndChild[1], IDC_EN_SPDO5V), BM_SETCHECK, (cmiData.enableSPDO5V ? BST_CHECKED : BST_UNCHECKED), 0);
@ -600,9 +619,8 @@ BOOL setDlgItems(HWND hWnd)
SendMessage(GetDlgItem(hWndChild[2], IDC_FMT_960_DOLBY), BM_SETCHECK, ((cmiData.formatMask & FMT_960_DOLBY) ? BST_CHECKED : BST_UNCHECKED), 0);
// radioboxes
SendMessage(GetDlgItem(hWndChild[0], IDC_EN_BASS2LINE), BM_SETCHECK, (cmiData.enableBass2Line ? BST_CHECKED : BST_UNCHECKED), 0);
SendMessage(GetDlgItem(hWndChild[0], IDC_EN_CENTER2LINE), BM_SETCHECK, (cmiData.enableCenter2Line ? BST_CHECKED : BST_UNCHECKED), 0);
SendMessage(GetDlgItem(hWndChild[0], IDC_EN_REAR2LINE), BM_SETCHECK, (cmiData.enableRear2Line ? BST_CHECKED : BST_UNCHECKED), 0);
SendMessage(GetDlgItem(hWndChild[0], IDC_EN_CLFE2LINE), BM_SETCHECK, ((cmiData.enableCenter2Line | cmiData.enableBass2Line) ? BST_CHECKED : BST_UNCHECKED), 0);
SendMessage(GetDlgItem(hWndChild[0], IDC_NOROUTE_LINE), BM_SETCHECK, ((!cmiData.enableCenter2Line && !cmiData.enableBass2Line && !cmiData.enableRear2Line) ? BST_CHECKED : BST_UNCHECKED), 0);
SendMessage(GetDlgItem(hWndChild[0], IDC_EN_CENTER2MIC), BM_SETCHECK, (cmiData.enableCenter2Mic ? BST_CHECKED : BST_UNCHECKED), 0);
@ -614,12 +632,12 @@ BOOL setDlgItems(HWND hWnd)
BOOL applySettings()
{
cmiData.enablePCMDAC = (SendMessage(GetDlgItem(hWndChild[0], IDC_EN_PCMDAC), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.exchangeFrontBack = (SendMessage(GetDlgItem(hWndChild[0], IDC_EXCH_FB), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableBass2Line = (SendMessage(GetDlgItem(hWndChild[0], IDC_EN_BASS2LINE), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableCenter2Line = (SendMessage(GetDlgItem(hWndChild[0], IDC_EN_CENTER2LINE), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableBass2Line = (SendMessage(GetDlgItem(hWndChild[0], IDC_EN_CLFE2LINE), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableCenter2Line = (SendMessage(GetDlgItem(hWndChild[0], IDC_EN_CLFE2LINE), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableRear2Line = (SendMessage(GetDlgItem(hWndChild[0], IDC_EN_REAR2LINE), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableCenter2Mic = (SendMessage(GetDlgItem(hWndChild[0], IDC_EN_CENTER2MIC), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableCenter2Mic = (SendMessage(GetDlgItem(hWndChild[0], IDC_EN_CENTER2MIC), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableSPDIMonitor = (SendMessage(GetDlgItem(hWndChild[0], IDC_EN_SPDIMONITOR), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableSPDO = (SendMessage(GetDlgItem(hWndChild[1], IDC_EN_SPDO), BM_GETCHECK, 0, 0) == BST_CHECKED);
cmiData.enableSPDO5V = (SendMessage(GetDlgItem(hWndChild[1], IDC_EN_SPDO5V), BM_GETCHECK, 0, 0) == BST_CHECKED);
@ -678,7 +696,7 @@ BOOL initDialog(HWND hWnd)
currentTab = 0;
ShowWindow(hWndChild[0], SW_SHOWDEFAULT);
if (!openDevice()) {
if (!openDevice(TRUE)) {
PrintLastError("openDevice()");
return FALSE;
}
@ -742,7 +760,7 @@ LRESULT CALLBACK TabDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
switch (LOWORD(wParam)) {
case IDB_STARTSTOP:
if (stopTestTone()) {
SetDlgItemText(hWndChild[0], IDB_STARTSTOP, "&Start");
SetDlgItemText(hWndChild[0], IDB_STARTSTOP, "&Play test tone");
return TRUE;
}
if (playTestTone()) {
@ -776,7 +794,9 @@ void printUsage()
"/enableSPDIFo - enable SPDIF-out\r\n" \
"/disableSPDIFo - disable SPDIF-out\r\n"\
"/enableSPDIFi - enable SPDIF-in recording\r\n" \
"/disableSPDIFi - disable SPDIF-in recording\r\n";
"/disableSPDIFi - disable SPDIF-in recording\r\n" \
"/enableLoopThru - enable loop-through from SPDIF-in to SPDIF-out\r\n" \
"/disableLoopThru - disable loop-through from SPDIF-in to SPDIF-out\r\n";
MessageBox(NULL, (LPCSTR)usage, TEXT("Usage Help"), MB_ICONINFORMATION | MB_OK);
return;
@ -807,7 +827,7 @@ void deleteDriverFiles() {
void performUninstall() {
deleteDriverFiles();
RegDeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\CMIDriver");
MessageBox(NULL, "The CMI driver applications were successfully removed from your computer!", "CMIDriver", MB_ICONINFORMATION);
MessageBox(NULL, "The CMI driver applications have been successfully removed from your computer!", "CMIDriver", MB_ICONINFORMATION);
ExitProcess(0);
}
@ -840,6 +860,12 @@ bool checkToken(char* token) {
if (strcmp(token, "DISABLESPDIFI")==0) {
cmiData.enableSPDI = FALSE;
} else
if ((strcmp(token, "ENABLELOOPTHRU")==0) || (strcmp(token, "ENABLELOOPTHROUGH")==0) || (strcmp(token, "ENABLELOOP")==0) ) {
cmiData.loopSPDI = TRUE;
} else
if ((strcmp(token, "DISABLELOOPTHRU")==0) || (strcmp(token, "DISABLELOOPTHROUGH")==0) || (strcmp(token, "DISABLELOOP")==0) ) {
cmiData.loopSPDI = FALSE;
} else
if (strcmp(token, "UNINSTALL")==0) {
performUninstall();
}
@ -847,21 +873,13 @@ bool checkToken(char* token) {
}
int parseArguments(LPSTR szCmdLine) {
BOOL inToken = false;
int i = 0, j;
BOOL inToken = false, result;
int i = 0, j=0;
char token[MAX_TOKEN_SIZE];
if (!openDevice()) {
return FALSE;
}
if (!getDriverData(&cmiTopologyDev)) {
PrintLastError("getDriverData()");
return FALSE;
}
if (!getCurrentChannelConfig()) {
PrintLastError("getCurrentChannelConfig()");
return FALSE;
if (openDevice(FALSE)) {
getDriverData(&cmiTopologyDev);
currentChannelCount = -1;
}
while (szCmdLine[i]) {
@ -889,7 +907,11 @@ int parseArguments(LPSTR szCmdLine) {
}
token[j] = 0;
checkToken(token);
return (setDriverData(&cmiTopologyDev) && setCurrentChannelConfig());
result = setDriverData(&cmiTopologyDev);
if (currentChannelCount != -1)
result |= setCurrentChannelConfig();
return result;
}
void InitURLControl()
@ -929,7 +951,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
}
}
if (hWndMain = FindWindow("cmiControlPanel", NULL)) {
if ((hWndMain = FindWindow("cmiControlPanel", NULL))) {
SetForegroundWindow(hWndMain);
return FALSE;
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -24,8 +24,8 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#ifndef _MAIN_H_
#define _MAIN_H_
#include <math.h>
@ -65,7 +65,6 @@ typedef struct _CMIDEV {
} CMIDEV;
static LRESULT CALLBACK MainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK TabDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
HINSTANCE hInst;
@ -78,4 +77,6 @@ CMIDATA cmiData;
HWAVEOUT hWave;
WAVEHDR pwh;
int currentChannelCount;
HFONT hURLFont;
HFONT hURLFont;
#endif //_MAIN_H_

View file

@ -1 +0,0 @@
!INCLUDE $(NTMAKEENV)\makefile.def

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -38,14 +38,12 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define IDT_SWAPJACKS 104
#define IDD_TAB1 200
#define IDC_EN_PCMDAC 201
#define IDC_EXCH_FB 202
#define IDC_EN_REAR2LINE 203
#define IDC_EN_BASS2LINE 204
#define IDC_EN_CENTER2LINE 205
#define IDC_NOROUTE_LINE 206
#define IDC_EN_CENTER2MIC 207
#define IDC_NOROUTE_MIC 208
#define IDC_EXCH_FB 201
#define IDC_EN_REAR2LINE 202
#define IDC_EN_CLFE2LINE 203
#define IDC_NOROUTE_LINE 205
#define IDC_EN_CENTER2MIC 206
#define IDC_NOROUTE_MIC 207
#define IDCB_CHANNELCONFIG 210
#define IDC_LEFT 211
#define IDC_CLEFT 212
@ -67,6 +65,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define IDC_POLVALID 312
#define IDC_LOOP_SPDF 313
#define IDC_EN_SPDI 314
#define IDC_EN_SPDIMONITOR 315
#define IDD_TAB3 400
#define IDC_FMT_441_PCM 401

View file

@ -1,31 +0,0 @@
TARGETNAME=CMICONTROL
TARGETTYPE=PROGRAM
TARGETPATH=
USE_MSVCRT=1
INCLUDES=..
TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\user32.lib \
$(SDK_LIB_PATH)\comctl32.lib \
$(SDK_LIB_PATH)\shell32.lib \
$(SDK_LIB_PATH)\setupapi.lib \
$(SDK_LIB_PATH)\winmm.lib \
$(SDK_LIB_PATH)\dsound.lib \
$(SDK_LIB_PATH)\ole32.lib
MSC_WARNING_LEVEL=/W3 /WX
SOURCES= main.cpp \
window.rc
UMTYPE=windows
UMENTRY=winmain
C_DEFINES=/DW32 /DWIN32
TARGET_DESTINATION=idw
_NT_TARGET_VERSION=$(_NT_TARGET_VERSION_WIN2K)
MUI=0

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -47,12 +47,12 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define VER_LEGALCOPYRIGHT_YEARS ""
#define VER_LEGALCOPYRIGHT_STR "BSD-style license"
#include "common.ver"
/*#include "common.ver"*/
IDI_APP_ICON ICON DISCARDABLE "window.ico"
IDD_MAIN DIALOGEX DISCARDABLE 0, 0, 310, 176
STYLE DS_SHELLFONT | DS_ABSALIGN | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
IDD_MAIN DIALOG DISCARDABLE 0, 0, 310, 176
STYLE DS_ABSALIGN | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Audio Control Panel (CMI 8738/8768)"
FONT 8, "MS Shell Dlg"
CLASS "cmiControlPanel"
@ -63,38 +63,37 @@ BEGIN
LTEXT " ", IDT_SWAPJACKS, 10,162,180,8
END
IDD_TAB1 DIALOGEX DISCARDABLE 4, 15, 290, 122
STYLE DS_SHELLFONT | WS_CHILD
IDD_TAB1 DIALOG DISCARDABLE 4, 15, 290, 122
STYLE WS_CHILD
FONT 8, "MS Shell Dlg"
BEGIN
AUTOCHECKBOX "Enable PCM DAC", IDC_EN_PCMDAC, 4,4,104,10
AUTOCHECKBOX "Enable PCM DAC", IDC_EN_SPDIMONITOR,4,4,104,10
AUTOCHECKBOX "Exchange Front/Rear Jacks", IDC_EXCH_FB, 4,16,104,10
GROUPBOX "Line-In Jack", IDC_STATIC, 4,30,110,54
AUTORADIOBUTTON "Route Rear to Line-In", IDC_EN_REAR2LINE, 8,40,104,10,WS_GROUP
AUTORADIOBUTTON "Route Bass to Line-In", IDC_EN_BASS2LINE, 8,50,104,10
AUTORADIOBUTTON "Route Center to Line-In", IDC_EN_CENTER2LINE,8,60,104,10
GROUPBOX "Line-In Jack", IDC_STATIC, 4,40,110,44
AUTORADIOBUTTON "Route Rear to Line-In", IDC_EN_REAR2LINE, 8,50,104,10,WS_GROUP
AUTORADIOBUTTON "Route C/LFE to Line-In", IDC_EN_CLFE2LINE, 8,60,104,10
AUTORADIOBUTTON "Don't route", IDC_NOROUTE_LINE, 8,70,104,10
GROUPBOX "Mic-In Jack", IDC_STATIC, 4,86,110,34
AUTORADIOBUTTON "Route Center to Mic-In", IDC_EN_CENTER2MIC, 8,96,104,10,WS_GROUP
AUTORADIOBUTTON "Don't route", IDC_NOROUTE_MIC, 8,106,104,10
GROUPBOX "Channel Configuration", IDC_STATIC, 120,4,160,116
COMBOBOX IDCB_CHANNELCONFIG,124,14,150,50, CBS_DROPDOWNLIST | WS_TABSTOP
AUTOCHECKBOX "L" IDC_LEFT, 130,30,20,20
AUTOCHECKBOX "CL" IDC_CLEFT, 160,30,20,20
AUTOCHECKBOX "C" IDC_CENTER, 190,30,20,20
AUTOCHECKBOX "CR" IDC_CRIGHT, 220,30,20,20
AUTOCHECKBOX "R" IDC_RIGHT, 250,30,20,20
AUTOCHECKBOX "BL" IDC_BLEFT, 130,96,20,20
AUTOCHECKBOX "BR" IDC_BRIGHT, 250,96,20,20
AUTOCHECKBOX "Sub" IDC_SUB, 240,60,30,20
DEFPUSHBUTTON "&Start" IDB_STARTSTOP, 175,98,50,14
AUTOCHECKBOX "L", IDC_LEFT, 130,30,24,20
AUTOCHECKBOX "CL", IDC_CLEFT, 160,30,24,20
AUTOCHECKBOX "C", IDC_CENTER, 190,30,24,20
AUTOCHECKBOX "CR", IDC_CRIGHT, 220,30,24,20
AUTOCHECKBOX "R", IDC_RIGHT, 250,30,24,20
AUTOCHECKBOX "BL", IDC_BLEFT, 130,96,24,20
AUTOCHECKBOX "BR", IDC_BRIGHT, 250,96,24,20
AUTOCHECKBOX "Sub", IDC_SUB, 240,60,30,20
DEFPUSHBUTTON "&Play test tone", IDB_STARTSTOP, 175,98,50,14
END
IDD_TAB2 DIALOGEX DISCARDABLE 4, 15, 290, 122
STYLE DS_SHELLFONT | WS_CHILD
IDD_TAB2 DIALOG DISCARDABLE 4, 15, 290, 122
STYLE WS_CHILD
FONT 8, "MS Shell Dlg"
BEGIN
GROUPBOX "S/PDIF output" IDC_STATIC, 4,4,132,116
GROUPBOX "S/PDIF output", IDC_STATIC, 4,4,132,116
AUTOCHECKBOX "Enable S/PDIF-out", IDC_EN_SPDO, 8,14,110,10
AUTOCHECKBOX "Enable 5V signal levels", IDC_EN_SPDO5V, 8,28,110,10
AUTOCHECKBOX "Enable copyright bit", IDC_EN_SPDCOPYRHT, 8,42,110,10
@ -107,8 +106,8 @@ BEGIN
AUTOCHECKBOX "Loop S/PDIF-in to S/PDIF-out",IDC_LOOP_SPDF, 150,84,110,10
END
IDD_TAB3 DIALOGEX DISCARDABLE 4, 15, 290, 122
STYLE DS_SHELLFONT | WS_CHILD
IDD_TAB3 DIALOG DISCARDABLE 4, 15, 290, 122
STYLE WS_CHILD
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "44.1 kHz", IDC_STATIC, 74,8,40,8
@ -132,8 +131,8 @@ BEGIN
AUTOCHECKBOX "", IDC_FMT_960_DOLBY, 202,44,10,10
END
IDD_TAB4 DIALOGEX DISCARDABLE 4, 15, 290, 124
STYLE DS_SHELLFONT | WS_CHILD
IDD_TAB4 DIALOG DISCARDABLE 4, 15, 290, 124
STYLE WS_CHILD
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "Driver Version:", IDC_STATIC, 4,5,100,10
@ -147,9 +146,9 @@ BEGIN
LTEXT "MPU401 Address:", IDC_STATIC, 4,69,100,8
LTEXT "", IDC_MPUADR, 80,68,60,10, SS_SUNKEN
LTEXT "Application Icon: Copyright (c) Tango Desktop Project,", IDC_STATIC,4,84,176,8
LTEXT "Application Icon: Copyright (c) Tango Desktop Project,", IDC_STATIC,4,84,176,8
CONTROL "http://tango.freedesktop.org/",IDC_URL1,"URLLink",SS_NOTIFY, 178,84,100,8
LTEXT "Copyright (c) 2006-2007 Dogbert <dogber1@gmail.com>", IDC_STATIC,4,96,202,8
CONTROL "http://cmediadrivers.googlepages.com/",IDC_URL2,"URLLink",SS_NOTIFY,54,110,182,22
LTEXT "Copyright (c) 2006-2008 Dogbert <dogber1@gmail.com>", IDC_STATIC,4,96,202,8
CONTROL "http://code.google.com/p/cmediadrivers/",IDC_URL2,"URLLink",SS_NOTIFY,48,110,192,22
END

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -28,34 +28,25 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common.hpp"
#ifdef _MSC_VER
#pragma code_seg("PAGE") /* warning - ignored by GCC compiler */
#pragma code_seg("PAGE")
#endif
NTSTATUS
NewCMIAdapter(
PUNKNOWN *Unknown,
REFCLSID,
PUNKNOWN UnknownOuter,
POOL_TYPE PoolType)
NTSTATUS NewCMIAdapter(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
{
#if 1
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("NewCMIAdapter()"));
ASSERT (Unknown);
#endif
STD_CREATE_BODY_(CCMIAdapter, Unknown, UnknownOuter, PoolType, PCMIADAPTER);
}
STDMETHODIMP_(NTSTATUS) CCMIAdapter::init(PRESOURCELIST ResourceList, PDEVICE_OBJECT aDeviceObject)
{
#if 0
//PAGED_CODE();
//ASSERT(ResourceList);
//ASSERT(aDeviceObject);
//ASSERT(ResourceList->FindTranslatedPort(0));
PAGED_CODE();
ASSERT(ResourceList);
ASSERT(aDeviceObject);
ASSERT(ResourceList->FindTranslatedPort(0));
DBGPRINT(("CCMIAdapter[%p]::init()", this));
#endif
NTSTATUS ntStatus = STATUS_SUCCESS;
@ -65,7 +56,7 @@ STDMETHODIMP_(NTSTATUS) CCMIAdapter::init(PRESOURCELIST ResourceList, PDEVICE_OB
DeviceObject = aDeviceObject;
cm.IOBase = 0;
for ( UINT i=0; i < ResourceList->NumberOfPorts(); i++ ) {
for (unsigned int i=0;i<ResourceList->NumberOfPorts();i++) {
if (ResourceList->FindTranslatedPort(i)->u.Port.Length == 0x100) {
cm.IOBase = (UInt32*)ResourceList->FindTranslatedPort(i)->u.Port.Start.QuadPart;
}
@ -121,7 +112,7 @@ STDMETHODIMP_(NTSTATUS) CCMIAdapter::init(PRESOURCELIST ResourceList, PDEVICE_OB
CCMIAdapter::~CCMIAdapter()
{
//PAGED_CODE ();
PAGED_CODE ();
DBGPRINT(("CCMIAdapter[%p]::~CCMIAdapter()", this));
if (InterruptSync) {
@ -131,13 +122,13 @@ CCMIAdapter::~CCMIAdapter()
}
}
STDMETHODIMP_(NTSTATUS) CCMIAdapter::QueryInterface(REFIID Interface, PVOID* Object)
STDMETHODIMP_(NTSTATUS) CCMIAdapter::NonDelegatingQueryInterface(REFIID Interface, PVOID* Object)
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::NonDelegatingQueryInterface()", this));
//ASSERT(Object);
ASSERT(Object);
// Is it IID_IUnknown?
if (IsEqualGUIDAligned (Interface, IID_IUnknown)) {
@ -166,7 +157,7 @@ STDMETHODIMP_(NTSTATUS) CCMIAdapter::QueryInterface(REFIID Interface, PVOID* Obj
bool CCMIAdapter::queryChip()
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::queryChip()", this));
UInt32 version = readUInt32(REG_INTHLDCLR) & VERSION_MASK;
@ -227,7 +218,7 @@ bool CCMIAdapter::queryChip()
void CCMIAdapter::resetMixer()
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::resetMixer()", this));
writeMixer(0, 0);
@ -236,10 +227,8 @@ void CCMIAdapter::resetMixer()
void CCMIAdapter::resetController()
{
#if 0
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::resetController()", this));
#endif
writeUInt32(REG_INTHLDCLR, 0);
@ -271,11 +260,10 @@ void CCMIAdapter::resetController()
STDMETHODIMP_(NTSTATUS) CCMIAdapter::activateMPU(ULONG* MPUBase)
{
UInt32 LegacyCtrl;
#if 0
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::activateMPU(%X)", this, MPUBase));
#endif
UInt32 LegacyCtrl;
switch ((LONGLONG)MPUBase) {
case 0x300: LegacyCtrl = UART_300; break;
@ -298,10 +286,8 @@ STDMETHODIMP_(NTSTATUS) CCMIAdapter::activateMPU(ULONG* MPUBase)
// XP's order of power states when going to hibernate: D3 -> D0, waking up: D0 -> D3.
STDMETHODIMP_(void) CCMIAdapter::PowerChangeState(POWER_STATE NewState)
{
#if 0
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::PowerChangeState(%p)", this, NewState));
#endif
if (NewState.DeviceState == CurrentPowerState ) {
return;
@ -334,34 +320,28 @@ STDMETHODIMP_(void) CCMIAdapter::PowerChangeState(POWER_STATE NewState)
STDMETHODIMP_(NTSTATUS) CCMIAdapter::QueryPowerChangeState(POWER_STATE NewStateQuery)
{
#if 0
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::QueryPowerChangeState(%p)", this, NewStateQuery));
#endif
return STATUS_SUCCESS;
}
STDMETHODIMP_(NTSTATUS) CCMIAdapter::QueryDeviceCapabilities(PDEVICE_CAPABILITIES PowerDeviceCaps)
{
#if 0
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::QueryDeviceCapabilities(%p)", this, PowerDeviceCaps));
#endif
return STATUS_SUCCESS;
}
STDMETHODIMP_(NTSTATUS) CCMIAdapter::loadSBMixerFromMemory()
{
PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::loadSBMixerFromMemory()", this));
UInt8 sbIndex[] = { 0x04, 0x0A, 0x22, 0x28, 0x2E, 0x30, 0x31, 0x32, 0x33, 0x36, 0x37, 0x38,
0x39, 0x3A, 0x3C, 0x3D, 0x3E, 0xF0 };
#if 0
//PAGED_CODE();
DBGPRINT(("CCMIAdapter[%p]::loadSBMixerFromMemory()", this));
#endif
for ( UINT i = 0; i < (sizeof(sbIndex)/sizeof(sbIndex[0])); i++ ) {
for (unsigned int i = 0; i<(sizeof(sbIndex)/sizeof(sbIndex[0]));i++) {
writeUInt8(REG_SBINDEX, sbIndex[i]);
writeUInt8(REG_SBDATA, mixerCache[i]);
writeUInt8(REG_SBDATA, mixerCache[sbIndex[i]]);
}
return STATUS_SUCCESS;
@ -371,7 +351,7 @@ STDMETHODIMP_(NTSTATUS) CCMIAdapter::loadSBMixerFromMemory()
** non-paged code below
*/
#ifdef _MSC_VER
#pragma code_seg() /* warning - ignored by GCC compiler */
#pragma code_seg()
#endif
STDMETHODIMP_(UInt8) CCMIAdapter::readUInt8(UInt8 reg)
@ -455,15 +435,13 @@ STDMETHODIMP_(void) CCMIAdapter::clearMixerBit(UInt8 index, UInt8 flag)
NTSTATUS NTAPI CCMIAdapter::InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID DynamicContext)
{
ASSERT(InterruptSync);
ASSERT(DynamicContext);
UInt32 status, mask = 0;
CCMIAdapter *CMIAdapter = (CCMIAdapter *)DynamicContext;
#if 0
//ASSERT(InterruptSync);
//ASSERT(DynamicContext);
#endif
if (!(CMIAdapter->cm.WaveMiniport)) {
return STATUS_UNSUCCESSFUL;
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -28,20 +28,19 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _COMMON_HPP_
#define _COMMON_HPP_
#include "ntddk.h"
#include "stdunk.h"
#include "portcls.h"
#include "dmusicks.h"
#include "ksdebug.h"
#include "kcom.h"
#include "ksmedia.h"
#include "interfaces.hpp"
#include "debug.hpp"
#include "cmireg.hpp"
class CCMIAdapter : public ICMIAdapter,
public IAdapterPowerManagement
public IAdapterPowerManagement,
public CUnknown
{
private:
PDEVICE_OBJECT DeviceObject;
@ -55,25 +54,8 @@ private:
void resetController();
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
STDMETHODIMP_(ULONG) AddRef()
{
InterlockedIncrement(&m_Ref);
return m_Ref;
}
STDMETHODIMP_(ULONG) Release()
{
InterlockedDecrement(&m_Ref);
if (!m_Ref)
{
delete this;
return 0;
}
return m_Ref;
}
CCMIAdapter(IUnknown *OuterUnknown){}
DECLARE_STD_UNKNOWN();
DEFINE_STD_CONSTRUCTOR(CCMIAdapter);
~CCMIAdapter();
IMP_IAdapterPowerManagement;
@ -104,7 +86,7 @@ public:
STDMETHODIMP_(void) resetMixer();
static NTSTATUS NTAPI InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID StaticContext);
static NTSTATUS NTAPI InterruptServiceRoutine(PINTERRUPTSYNC InterruptSync, PVOID StaticContext);
STDMETHODIMP_(PCMI8738Info) getCMI8738Info(void)
{
@ -121,9 +103,6 @@ public:
};
friend NTSTATUS NewCCMIAdapter(PCMIADAPTER* OutCMIAdapter, PRESOURCELIST ResourceList);
LONG m_Ref;
};
NTSTATUS NewCMIAdapter(PUNKNOWN* Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType);

View file

@ -0,0 +1,14 @@
add_library(cmicpl SHARED
cmicpl.cpp
cmicpl.rc
)
add_importlibs(cmicpl
shell32
msvcrt
kernel32)
set_module_type(cmicpl cpl UNICODE)
add_cd_file(TARGET cmicpl DESTINATION reactos/system32/drivers FOR all)

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1 +0,0 @@
!INCLUDE $(NTMAKEENV)\makefile.def

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without

View file

@ -1,24 +0,0 @@
TARGETNAME = cmicpl
TARGETTYPE = DYNLINK
TARGETEXT = cpl
DLLENTRY = _DllMainCRTStartup
TARGETLIBS = $(SDK_LIB_PATH)\setupapi.lib \
$(SDK_LIB_PATH)\comctl32.lib \
$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\user32.lib \
$(SDK_LIB_PATH)\shell32.lib
INCLUDES = ..
USE_MSVCRT=1
MSC_WARNING_LEVEL = $(MSC_WARNING_LEVEL) /WX
C_DEFINES = $(CFASTFLAGS) $(C_DEFINES) -DUNICODE -D_UNICODE -DUNDER_NT
UMTYPE = windows
SOURCES = cmicpl.rc \
cmicpl.cpp

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -28,12 +28,15 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _DEBUG_HPP_
#define _DEBUG_HPP_
#define CMIVERSION "1.1.3-debug"
//#define WAVERT
#define UART
#define CMIVERSION "1.2.6"
#define WAVERT
//#define UART //disabled for improved stability on ULi motherboards
#if (DBG)
#define DBGPRINT(msg)
#define DBGPRINT(msg) \
{ \
DbgPrint msg; \
}
#define DBGBREAK \
_asm int 3;
#else
@ -41,5 +44,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define DBGBREAK
#endif
#define INFOPRINT(msg)
#define INFOPRINT(msg) \
{ \
DbgPrint msg; \
}
#endif

View file

@ -1,204 +0,0 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "main.h"
void PrintLastError(LPCSTR function)
{
LPVOID lpMsgBuf;
DWORD errorid = GetLastError();
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, errorid, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL );
MessageBox(NULL, (LPCSTR)lpMsgBuf, function, MB_ICONEXCLAMATION | MB_OK);
LocalFree(lpMsgBuf);
}
BOOL deleteCMIKeys()
{
HKEY key;
unsigned int i;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"), NULL, KEY_SET_VALUE, &key) != ERROR_SUCCESS) {
PrintLastError("RegOpenKeyEx()");
return FALSE;
}
for (i=0;i<NumberOfCMIKeys;i++) {
RegDeleteValue(key, CMIKeys[i]);
}
RegCloseKey(key);
return TRUE;
}
BOOL CMIKeysExist()
{
HKEY key;
unsigned int i;
BOOL result = FALSE;
LONG size;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"), NULL, KEY_SET_VALUE, &key) != ERROR_SUCCESS) {
PrintLastError("RegOpenKeyEx()");
return FALSE;
}
for (i=0;i<NumberOfCMIKeys;i++) {
result |= (RegQueryValue(key, CMIKeys[i], NULL, &size) == ERROR_SUCCESS);
}
RegCloseKey(key);
return result;
}
void writeUninstallerKeys()
{
TCHAR SysDir[MAX_PATH];
unsigned int len;
HKEY key;
if (GetSystemDirectory(SysDir, sizeof(SysDir))==0) {
PrintLastError("GetSystemDirectory()");
return;
}
len = strlen(SysDir);
strcat(SysDir, Uninstaller);
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\CMIDriver"), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &key, NULL) != ERROR_SUCCESS) {
PrintLastError("RegCreateKeyEx()");
return;
}
RegSetValueEx(key, "DisplayName", NULL, REG_SZ, (BYTE*)&DisplayName, sizeof(DisplayName));
RegSetValueEx(key, "URLInfoAbout", NULL, REG_SZ, (BYTE*)&URLInfoAbout, sizeof(URLInfoAbout));
RegSetValueEx(key, "Publisher", NULL, REG_SZ, (BYTE*)&Publisher, sizeof(Publisher));
RegSetValueEx(key, "UninstallString", NULL, REG_SZ, (BYTE*)&SysDir, strlen(SysDir));
SysDir[len] = 0;
strcat(SysDir, DisplayIcon);
RegSetValueEx(key, "DisplayIcon", NULL, REG_SZ, (BYTE*)&SysDir, strlen(SysDir));
RegCloseKey(key);
}
BOOL installDriver(HWND hWnd)
{
TCHAR DriverPath[MAX_PATH];
unsigned int i;
EnableWindow(GetDlgItem(hWnd, IDB_INSTALL), FALSE);
if (GetModuleFileName(NULL, DriverPath, MAX_PATH) == 0) {
PrintLastError("DriverPackageInstall()");
EnableWindow(GetDlgItem(hWnd, IDB_INSTALL), TRUE);
return FALSE;
}
*_tcsrchr(DriverPath, _T('\\')) = _T('\0');
*_tcscat(DriverPath, _T("\\CM8738.inf"));
for (i=0;i<devArraySize;i++) {
if (UpdateDriverForPlugAndPlayDevices(hWnd, devIDs[i], DriverPath, INSTALLFLAG_FORCE, NULL)) {
EnableWindow(GetDlgItem(hWnd, IDB_INSTALL), TRUE);
return TRUE;
}
}
PrintLastError("DriverPackageInstall()");
EnableWindow(GetDlgItem(hWnd, IDB_INSTALL), TRUE);
return FALSE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
case WM_CLOSE:
DestroyWindow(hWnd);
return TRUE;
case WM_DESTROY:
PostQuitMessage(0);
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDB_CLOSE) {
PostQuitMessage(0);
return TRUE;
}
if (LOWORD(wParam) == IDB_INSTALL) {
if (installDriver(hWnd)) {
if (CMIKeysExist()) {
if (MessageBox(hWnd, "The driver has been successfully installed! Do you want to remove the remains of the official C-Media driver?", "Driver Installer", MB_ICONINFORMATION | MB_YESNO) == IDYES) {
deleteCMIKeys();
}
} else {
MessageBox(hWnd, "The driver has been successfully installed!", "Driver Installer", MB_ICONINFORMATION);
}
writeUninstallerKeys();
PostQuitMessage(0);
}
return TRUE;
}
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
WNDCLASSEX wce;
HWND hWnd;
MSG msg;
if (hWnd = FindWindow("cmiDriverInstaller", NULL)) {
SetForegroundWindow(hWnd);
return FALSE;
}
hInst = hInstance;
ZeroMemory(&wce, sizeof(WNDCLASSEX));
wce.cbSize = sizeof(WNDCLASSEX);
wce.lpfnWndProc = DefDlgProc;
wce.style = 0;
wce.cbWndExtra = DLGWINDOWEXTRA;
wce.hInstance = hInstance;
wce.hCursor = LoadCursor(NULL, IDC_ARROW);
wce.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
wce.lpszClassName = "cmiDriverInstaller";
wce.lpszMenuName = NULL;
wce.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
wce.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
if(!RegisterClassEx(&wce)) {
PrintLastError("RegisterClassEx()");
return -1;
}
hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC)WndProc, NULL);
if (!hWnd) {
PrintLastError("CreateDialogParam()");
return -1;
}
while (GetMessage(&msg, (HWND) NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}

View file

@ -1,77 +0,0 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <windows.h>
#include <newdev.h>
#include <tchar.h>
#include "resource.h"
HINSTANCE hInst;
const TCHAR* devIDs[] = {"PCI\\VEN_13F6&DEV_0111",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_011013F6",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_011113F6",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_1144153B",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_3731584D",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_87681092",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_020110B0",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_020210B0",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_020410B0",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_009C145F",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_39201462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_39801462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_50701462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_52801462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_53201462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_53401462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_54501462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_56501462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_59001462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_59201462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_70201462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_70401462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_70411462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_71011462",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_A016147A",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_30021919",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_0577A0A0",
"PCI\\VEN_13F6&DEV_0111&SUBSYS_060417AB",
};
const unsigned int devArraySize = sizeof(devIDs) / sizeof(devIDs[0]);
const char* CMIKeys[] = { "Cmaudio", "CmPCIaudio", "C-Media Mixer" };
const unsigned int NumberOfCMIKeys = sizeof(CMIKeys) / sizeof(CMIKeys[0]);
//uninstaller stuff
const char DisplayName[] = _T("CMI 8738/8768 Audio Driver (remove only)");
const char DisplayIcon[] = _T("\\cmicontrol.exe,0");
const char Uninstaller[] = _T("\\cmicontrol.exe /uninstall");
const char Publisher[] = _T("Dogbert <dogber1@gmail.com>");
const char URLInfoAbout[] = _T("http://cmediadrivers.googlepages.com/");

View file

@ -1 +0,0 @@
!INCLUDE $(NTMAKEENV)\makefile.def

View file

@ -1,36 +0,0 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define IDC_STATIC -1
// icons
#define IDI_APP_ICON 150
// main dialog
#define IDD_MAIN 100
#define IDB_CLOSE 101
#define IDB_INSTALL 102

View file

@ -1,26 +0,0 @@
TARGETNAME=setup
TARGETTYPE=PROGRAM
TARGETPATH=
USE_MSVCRT=1
INCLUDES=..
TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\user32.lib \
$(SDK_LIB_PATH)\newdev.lib
MSC_WARNING_LEVEL=/W3 /WX
SOURCES= main.cpp \
window.rc
UMTYPE=windows
UMENTRY=winmain
C_DEFINES=/DW32 /DWIN32
_NT_TARGET_VERSION=$(_NT_TARGET_VERSION_WIN2K)
TARGET_DESTINATION=idw
MUI=0

View file

@ -1,62 +0,0 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <windows.h>
#include <commctrl.h>
#include "resource.h"
#include <ntverp.h>
#define VER_FILETYPE VFT_DLL
#define VER_FILESUBTYPE VFT2_UNKNOWN
#define VER_FILEDESCRIPTION_STR "Driver Installer (CMI 8738/8768)"
#define VER_INTERNALNAME_STR "install.exe"
#define VER_ORIGINALFILENAME_STR "install.exe"
#ifdef VER_COMPANYNAME_STR
#undef VER_COMPANYNAME_STR
#endif
#define VER_COMPANYNAME_STR "Dogbert"
#ifdef VER_PRODUCTNAME_STR
#undef VER_PRODUCTNAME_STR
#endif
#define VER_PRODUCTNAME_STR ""
#define VER_LEGALCOPYRIGHT_YEARS ""
#define VER_LEGALCOPYRIGHT_STR "BSD-style license"
#include "common.ver"
IDI_APP_ICON ICON DISCARDABLE "..\cmicontrol\window.ico"
IDD_MAIN DIALOGEX DISCARDABLE 0, 0, 120, 54
STYLE DS_SHELLFONT | DS_ABSALIGN | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Driver Installer"
FONT 8, "MS Shell Dlg"
CLASS "cmiDriverInstaller"
BEGIN
DEFPUSHBUTTON "&Install Driver",IDB_INSTALL,10,10,100,14
PUSHBUTTON "&Close",IDB_CLOSE,10,30,100,14
END

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -28,40 +28,44 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _INTERFACES_HPP_
#define _INTERFACES_HPP_
#include <ntddk.h>
#include <portcls.h>
#include <stdunk.h>
#include <debug.h>
#define MAXLEN_DMA_BUFFER 0x18000
#define MAX_OUTPUT_STREAMS 1
#define MAX_INPUT_STREAMS 1
#define MAX_AC3_INPUT_STREAMS 1
#define MAXLEN_DMA_BUFFER 0x18000
#define MAX_OUTPUT_STREAMS 1
#define MAX_INPUT_STREAMS 1
#define MAX_AC3_INPUT_STREAMS 1
// PCM Info
#define MIN_CHANNELS 2
#define MAX_CHANNELS_PCM 8
#define MIN_BITS_PER_SAMPLE_PCM 16
#define MAX_BITS_PER_SAMPLE_PCM 32
#define MIN_SAMPLE_RATE 44100
#define MAX_SAMPLE_RATE 96000
#define MIN_CHANNELS 2
#define MAX_CHANNELS_PCM 8
#define MIN_BITS_PER_SAMPLE_PCM 16
#define MAX_BITS_PER_SAMPLE_PCM 32
#define MIN_SAMPLE_RATE 44100
#define MAX_SAMPLE_RATE 96000
#define MAX_SAMPLE_RATE_MULTI 48000
// AC3 Info
#define MAX_CHANNELS_AC3 2
#define MIN_BITS_PER_SAMPLE_AC3 16
#define MAX_BITS_PER_SAMPLE_AC3 16
#define MIN_SAMPLE_RATE_AC3 48000
#define MAX_SAMPLE_RATE_AC3 48000
#define MAX_CHANNELS_AC3 2
#define MIN_BITS_PER_SAMPLE_AC3 16
#define MAX_BITS_PER_SAMPLE_AC3 16
#define MIN_SAMPLE_RATE_AC3 48000
#define MAX_SAMPLE_RATE_AC3 48000
// WMA-Pro Info
#define MAX_CHANNELS_WMA 2
#define MIN_BITS_PER_SAMPLE_WMA 16
#define MAX_BITS_PER_SAMPLE_WMA 16
#define MIN_SAMPLE_RATE_WMA 44100
#define MAX_SAMPLE_RATE_WMA 48000
#define PCM_OUT_STREAM 0
#define PCM_IN_STREAM 1
#define AC3_OUT_STREAM 2
#define CHAN_LEFT 0
#define CHAN_RIGHT 1
#define CHAN_MASTER (-1)
#define CHAN_LEFT 0
#define CHAN_RIGHT 1
#define CHAN_MASTER (-1)
#define IN_CHANNEL 0
#define OUT_CHANNEL 1
@ -128,18 +132,19 @@ typedef IMiniportWaveCMI *PCMIWAVE;
// structure to avoid the fucking COM crapola
typedef struct CMI8738Info {
int chipVersion;
int maxChannels;
bool canAC3HW, canAC3SW;
bool canMultiChannel;
bool doAC3SW;
bool hasDualDAC;
UInt32* IOBase;
UInt32* MPUBase;
PCMIWAVE WaveMiniport;
int chipVersion;
UInt32 maxChannels;
bool canAC3HW, canAC3SW;
bool canMultiChannel;
bool doAC3SW;
bool hasDualDAC;
UInt32* IOBase;
UInt32* MPUBase;
PCMIWAVE WaveMiniport;
PCMITOPOLOGY TopoMiniport;
bool enableSPDIFOut;
bool enableSPDIFIn;
bool enableSPDIFInMonitor;
UInt32 formatMask;
UInt32 regFUNCTRL0;
} CMI8738Info;
@ -147,12 +152,12 @@ typedef CMI8738Info* PCMI8738Info;
typedef struct VolumeTable {
UInt32 node;
UInt8 reg;
UInt8 reg;
UInt8 mask;
UInt8 shift;
Int32 max;
Int32 max;
Int32 min;
Int32 step;
Int32 step;
Int32 dbshift;
} VolumeTable;
@ -160,94 +165,94 @@ typedef struct VolumeTable {
DECLARE_INTERFACE_(ICMIAdapter,IUnknown)
{
STDMETHOD_(NTSTATUS,init)
( THIS_
( THIS_
PRESOURCELIST ResourceList,
PDEVICE_OBJECT DeviceObject
) PURE;
) PURE;
STDMETHOD_(PINTERRUPTSYNC,getInterruptSync)
( THIS_
( THIS_
void
) PURE;
) PURE;
STDMETHOD_(PDEVICE_OBJECT,getDeviceObject)
( THIS_
( THIS_
void
) PURE;
) PURE;
STDMETHOD_(PCMI8738Info,getCMI8738Info)
( THIS_
( THIS_
void
) PURE;
STDMETHOD_(UInt8, readUInt8)
( THIS_
UInt8 reg
) PURE;
STDMETHOD_(void, writeUInt8)
( THIS_
UInt8 reg,
UInt8 value
) PURE;
STDMETHOD_(void, setUInt8Bit)
( THIS_
UInt8 reg,
UInt8 flag
) PURE;
STDMETHOD_(void, clearUInt8Bit)
( THIS_
UInt8 reg,
UInt8 flag
) PURE;
STDMETHOD_(UInt16, readUInt16)
( THIS_
UInt8 reg
) PURE;
STDMETHOD_(void, writeUInt16)
( THIS_
UInt8 reg,
UInt16 value
) PURE;
STDMETHOD_(UInt32, readUInt32)
( THIS_
UInt8 reg
) PURE;
STDMETHOD_(void, writeUInt32)
( THIS_
UInt8 reg,
UInt32 value
) PURE;
STDMETHOD_(void, setUInt32Bit)
( THIS_
UInt8 reg,
UInt32 flag
) PURE;
STDMETHOD_(void, clearUInt32Bit)
( THIS_
UInt8 reg,
UInt32 flag
) PURE;
STDMETHOD_(UInt8, readMixer)
( THIS_
UInt8 index
) PURE;
STDMETHOD_(void, writeMixer)
( THIS_
UInt8 index,
UInt8 value
) PURE;
STDMETHOD_(void, setMixerBit)
( THIS_
UInt8 index,
UInt8 flag
) PURE;
STDMETHOD_(void, clearMixerBit)
( THIS_
UInt8 index,
UInt8 flag
) PURE;
) PURE;
STDMETHOD_(UInt8, readUInt8)
( THIS_
UInt8 reg
) PURE;
STDMETHOD_(void, writeUInt8)
( THIS_
UInt8 reg,
UInt8 value
) PURE;
STDMETHOD_(void, setUInt8Bit)
( THIS_
UInt8 reg,
UInt8 flag
) PURE;
STDMETHOD_(void, clearUInt8Bit)
( THIS_
UInt8 reg,
UInt8 flag
) PURE;
STDMETHOD_(UInt16, readUInt16)
( THIS_
UInt8 reg
) PURE;
STDMETHOD_(void, writeUInt16)
( THIS_
UInt8 reg,
UInt16 value
) PURE;
STDMETHOD_(UInt32, readUInt32)
( THIS_
UInt8 reg
) PURE;
STDMETHOD_(void, writeUInt32)
( THIS_
UInt8 reg,
UInt32 value
) PURE;
STDMETHOD_(void, setUInt32Bit)
( THIS_
UInt8 reg,
UInt32 flag
) PURE;
STDMETHOD_(void, clearUInt32Bit)
( THIS_
UInt8 reg,
UInt32 flag
) PURE;
STDMETHOD_(UInt8, readMixer)
( THIS_
UInt8 index
) PURE;
STDMETHOD_(void, writeMixer)
( THIS_
UInt8 index,
UInt8 value
) PURE;
STDMETHOD_(void, setMixerBit)
( THIS_
UInt8 index,
UInt8 flag
) PURE;
STDMETHOD_(void, clearMixerBit)
( THIS_
UInt8 index,
UInt8 flag
) PURE;
STDMETHOD_(void,resetMixer)
( THIS_
) PURE;
STDMETHOD_(NTSTATUS,activateMPU)
( THIS_
ULONG* MPUBase
ULONG* MPUBase
) PURE;
STDMETHOD_(NTSTATUS,loadSBMixerFromMemory)
( THIS_
@ -267,19 +272,19 @@ DEFINE_GUID(IID_IMiniportWaveCMI, 0xe8698236, 0xd854, 0x4da7, 0xbf, 0x31, 0x83,
// {9DB14E9A-7BE7-480d-A2FA-32932489DE9C}
#define STATIC_PRODUCT_CM8738 \
0x9db14e9a, 0x7be7, 0x480d, 0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9c
0x9db14e9a, 0x7be7, 0x480d, {0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9c}
DEFINE_GUIDSTRUCT("9DB14E9A-7BE7-480d-A2FA-32932489DE9C", PRODUCT_CM8738);
#define PRODUCT_CM8738 DEFINE_GUIDNAMED(PRODUCT_CM8738)
// {9DB14E9A-7BE7-480d-A2FA-32932489DE9D}
#define STATIC_COMPONENT_CM8738 \
0x9db14e9a, 0x7be7, 0x480d, 0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9d
0x9db14e9a, 0x7be7, 0x480d, {0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9d}
DEFINE_GUIDSTRUCT("9DB14E9A-7BE7-480d-A2FA-32932489DE9D", COMPONENT_CM8738);
#define COMPONENT_CM8738 DEFINE_GUIDNAMED(COMPONENT_CM8738)
// {9DB14E9A-7BE7-480d-A2FA-32932489DE9E}
#define STATIC_MANUFACTURER_CM8738 \
0x9db14e9a, 0x7be7, 0x480d, 0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9e
0x9db14e9a, 0x7be7, 0x480d, {0xa2, 0xfa, 0x32, 0x93, 0x24, 0x89, 0xde, 0x9e}
DEFINE_GUIDSTRUCT("9DB14E9A-7BE7-480d-A2FA-32932489DE9E", MANUFACTURER_CM8738);
#define MANUFACTURER_CM8738 DEFINE_GUIDNAMED(MANUFACTURER_CM8738)
@ -289,87 +294,87 @@ DEFINE_GUIDSTRUCT("9DB14E9A-7BE7-480d-A2FA-32932489DE9E", MANUFACTURER_CM8738);
// topology node names (refer to .inf file)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF0}
#define STATIC_CMINAME_IEC_5V \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF0
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF0", _STATIC_CMINAME_IEC_5V);
#define CMINAME_IEC_5V DEFINE_GUIDNAMED(_STATIC_CMINAME_IEC_5V)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF0}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF0", CMINAME_IEC_5V);
#define CMINAME_IEC_5V DEFINE_GUIDNAMED(CMINAME_IEC_5V)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF1}
#define STATIC_CMINAME_IEC_OUT \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF1
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF1", _STATIC_CMINAME_IEC_OUT);
#define CMINAME_IEC_OUT DEFINE_GUIDNAMED(_STATIC_CMINAME_IEC_OUT)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF1}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF1", CMINAME_IEC_OUT);
#define CMINAME_IEC_OUT DEFINE_GUIDNAMED(CMINAME_IEC_OUT)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF2}
#define STATIC_CMINAME_IEC_INVERSE \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF2
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF2", _STATIC_CMINAME_IEC_INVERSE);
#define CMINAME_IEC_INVERSE DEFINE_GUIDNAMED(_STATIC_CMINAME_IEC_INVERSE)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF2}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF2", CMINAME_IEC_INVERSE);
#define CMINAME_IEC_INVERSE DEFINE_GUIDNAMED(CMINAME_IEC_INVERSE)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF3}
#define STATIC_CMINAME_IEC_MONITOR \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF3
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF3", _STATIC_CMINAME_IEC_MONITOR);
#define CMINAME_IEC_MONITOR DEFINE_GUIDNAMED(_STATIC_CMINAME_IEC_MONITOR)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF3}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF3", CMINAME_IEC_MONITOR);
#define CMINAME_IEC_MONITOR DEFINE_GUIDNAMED(CMINAME_IEC_MONITOR)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF4}
#define STATIC_CMINAME_DAC \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF4
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF4", _STATIC_CMINAME_DAC);
#define CMINAME_DAC DEFINE_GUIDNAMED(_STATIC_CMINAME_DAC)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF4}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF4", CMINAME_DAC);
#define CMINAME_DAC DEFINE_GUIDNAMED(CMINAME_DAC)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF5}
#define STATIC_CMINAME_IEC_SELECT \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF5
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF5", _STATIC_CMINAME_IEC_SELECT);
#define CMINAME_IEC_SELECT DEFINE_GUIDNAMED(_STATIC_CMINAME_IEC_SELECT)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF5}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF5", CMINAME_IEC_SELECT);
#define CMINAME_IEC_SELECT DEFINE_GUIDNAMED(CMINAME_IEC_SELECT)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF6}
#define STATIC_CMINAME_XCHG_FB \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF6
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF6", _STATIC_CMINAME_XCHG_FB);
#define CMINAME_XCHG_FB DEFINE_GUIDNAMED(_STATIC_CMINAME_XCHG_FB)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF6}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF6", CMINAME_XCHG_FB);
#define CMINAME_XCHG_FB DEFINE_GUIDNAMED(CMINAME_XCHG_FB)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF7}
#define STATIC_CMINAME_BASS2LINE \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF7
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF7", _STATIC_CMINAME_BASS2LINE);
#define CMINAME_BASS2LINE DEFINE_GUIDNAMED(_STATIC_CMINAME_BASS2LINE)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF7}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF7", CMINAME_BASS2LINE);
#define CMINAME_BASS2LINE DEFINE_GUIDNAMED(CMINAME_BASS2LINE)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF8}
#define STATIC_CMINAME_CENTER2LINE \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF8
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF8", _STATIC_CMINAME_CENTER2LINE);
#define CMINAME_CENTER2LINE DEFINE_GUIDNAMED(_STATIC_CMINAME_CENTER2LINE)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF8}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF8", CMINAME_CENTER2LINE);
#define CMINAME_CENTER2LINE DEFINE_GUIDNAMED(CMINAME_CENTER2LINE)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF9}
#define STATIC_CMINAME_IEC_COPYRIGHT \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF9
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF9", _STATIC_CMINAME_IEC_COPYRIGHT);
#define CMINAME_IEC_COPYRIGHT DEFINE_GUIDNAMED(_STATIC_CMINAME_IEC_COPYRIGHT)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xF9}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DF9", CMINAME_IEC_COPYRIGHT);
#define CMINAME_IEC_COPYRIGHT DEFINE_GUIDNAMED(CMINAME_IEC_COPYRIGHT)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFA}
#define STATIC_CMINAME_IEC_POLVALID \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFA
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFA", _STATIC_CMINAME_IEC_POLVALID);
#define CMINAME_IEC_POLVALID DEFINE_GUIDNAMED(_STATIC_CMINAME_IEC_POLVALID)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFA}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFA", CMINAME_IEC_POLVALID);
#define CMINAME_IEC_POLVALID DEFINE_GUIDNAMED(CMINAME_IEC_POLVALID)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFB}
#define STATIC_CMINAME_IEC_LOOP \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFB
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFB", _STATIC_CMINAME_IEC_LOOP);
#define CMINAME_IEC_LOOP DEFINE_GUIDNAMED(_STATIC_CMINAME_IEC_LOOP)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFB}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFB", CMINAME_IEC_LOOP);
#define CMINAME_IEC_LOOP DEFINE_GUIDNAMED(CMINAME_IEC_LOOP)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFC}
#define STATIC_CMINAME_REAR2LINE \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFC
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFC", _STATIC_CMINAME_REAR2LINE);
#define CMINAME_REAR2LINE DEFINE_GUIDNAMED(_STATIC_CMINAME_REAR2LINE)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFC}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFC", CMINAME_REAR2LINE);
#define CMINAME_REAR2LINE DEFINE_GUIDNAMED(CMINAME_REAR2LINE)
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFD}
#define STATIC_CMINAME_CENTER2MIC \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFD
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFD", _STATIC_CMINAME_CENTER2MIC);
#define CMINAME_CENTER2MIC DEFINE_GUIDNAMED(_STATIC_CMINAME_CENTER2MIC)
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFD}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFD", CMINAME_CENTER2MIC);
#define CMINAME_CENTER2MIC DEFINE_GUIDNAMED(CMINAME_CENTER2MIC)
//topology pins
enum
@ -462,4 +467,4 @@ enum
KSNODE_WAVE_INVALID
};
#endif //_INTERFACES_HPP_
#endif //_INTERFACES_HPP_

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -29,28 +29,26 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "mintopo.hpp"
#include "mintopotables.hpp"
#define NTSTRSAFE_LIB //for Windows 2000 compatibility
#include "ntstrsafe.h"
#include "NtStrsafe.h"
#ifdef _MSC_VER
#pragma code_seg("PAGE") /* warning - ignored by GCC compiler */
#pragma code_seg("PAGE")
#endif
const GUID KSPROPSETID_CMI = {0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFF}};
HRESULT NTAPI CreateMiniportTopologyCMI(PUNKNOWN* Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
NTSTATUS NTAPI CreateMiniportTopologyCMI(PUNKNOWN* Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
{
//PAGED_CODE();
//ASSERT(Unknown);
PAGED_CODE();
ASSERT(Unknown);
STD_CREATE_BODY_(CCMITopology,Unknown,UnknownOuter,PoolType,PMINIPORTTOPOLOGY);
}
STDMETHODIMP CCMITopology::QueryInterface(REFIID Interface, PVOID* Object)
STDMETHODIMP CCMITopology::NonDelegatingQueryInterface(REFIID Interface, PVOID* Object)
{
//PAGED_CODE();
//ASSERT(Object);
PAGED_CODE();
ASSERT(Object);
DBGPRINT(("CCMITopology::NonDelegatingQueryInterface"));
if (IsEqualGUIDAligned(Interface, IID_IUnknown)) {
if (IsEqualGUIDAligned(Interface,IID_IUnknown)) {
*Object = PVOID(PUNKNOWN(PMINIPORTTOPOLOGY(this)));
} else if (IsEqualGUIDAligned(Interface,IID_IMiniport)) {
*Object = PVOID(PMINIPORT(this));
@ -72,7 +70,7 @@ STDMETHODIMP CCMITopology::QueryInterface(REFIID Interface, PVOID* Object)
CCMITopology::~CCMITopology()
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMITopology::~CCMITopology"));
@ -86,9 +84,9 @@ CCMITopology::~CCMITopology()
STDMETHODIMP CCMITopology::Init(PUNKNOWN UnknownAdapter, PRESOURCELIST ResourceList, PPORTTOPOLOGY Port)
{
//PAGED_CODE();
//ASSERT(UnknownAdapter);
//ASSERT(Port);
PAGED_CODE();
ASSERT(UnknownAdapter);
ASSERT(Port);
DBGPRINT(("CCMITopology::Init"));
NTSTATUS ntStatus = UnknownAdapter->QueryInterface(IID_ICMIAdapter, (PVOID *)&CMIAdapter);
@ -115,8 +113,8 @@ STDMETHODIMP CCMITopology::Init(PUNKNOWN UnknownAdapter, PRESOURCELIST ResourceL
STDMETHODIMP CCMITopology::GetDescription(PPCFILTER_DESCRIPTOR* OutFilterDescriptor)
{
//PAGED_CODE();
//ASSERT(OutFilterDescriptor);
PAGED_CODE();
ASSERT(OutFilterDescriptor);
DBGPRINT(("CCMITopology::GetDescription"));
*OutFilterDescriptor = &MiniportFilterDescriptor;
@ -126,7 +124,7 @@ STDMETHODIMP CCMITopology::GetDescription(PPCFILTER_DESCRIPTOR* OutFilterDescri
STDMETHODIMP CCMITopology::loadMixerSettingsFromRegistry()
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMITopology::loadMixerSettingsFromRegistry"));
PREGISTRYKEY DriverKey;
@ -175,7 +173,7 @@ STDMETHODIMP CCMITopology::loadMixerSettingsFromRegistry()
PropertyRequest.ValueSize = sizeof(DWORD);
PropertyRequest.PropertyItem = &PropertyItem;
for ( UINT i=0; i < SIZEOF_ARRAY(TopologyNodes); i++ ) {
for (unsigned int i=0;i < SIZEOF_ARRAY(TopologyNodes); i++) {
PropertyRequest.Node = i;
Channel = CHAN_LEFT;
@ -217,6 +215,11 @@ STDMETHODIMP CCMITopology::loadMixerSettingsFromRegistry()
*(PBOOL(PropertyRequest.Value)) = false;
PropertyHandler_OnOff(&PropertyRequest);
}
if (i == KSNODE_TOPO_IEC_MONITOR) {
PropertyItem.Id = KSPROPERTY_AUDIO_LOUDNESS;
*(PBOOL(PropertyRequest.Value)) = true;
PropertyHandler_OnOff(&PropertyRequest);
}
}
Channel = CHAN_RIGHT;
@ -242,6 +245,11 @@ STDMETHODIMP CCMITopology::loadMixerSettingsFromRegistry()
}
}
} else {
if (i == KSNODE_TOPO_IEC_OUT) {
PropertyItem.Id = KSPROPERTY_AUDIO_LOUDNESS;
*(PBOOL(PropertyRequest.Value)) = true;
PropertyHandler_OnOff(&PropertyRequest);
}
if (i == KSNODE_TOPO_WAVEOUT_MUTE_IN) {
PropertyItem.Id = KSPROPERTY_AUDIO_MUTE;
*(PBOOL(PropertyRequest.Value)) = true;
@ -258,7 +266,10 @@ STDMETHODIMP CCMITopology::loadMixerSettingsFromRegistry()
cm->formatMask = (*(PLONG)PartialInfo->Data);
}
} else {
cm->formatMask = 0xFFFFFFFF;
cm->formatMask = FMT_441_PCM | FMT_441_MULTI_PCM | FMT_441_DOLBY | FMT_480_PCM | FMT_480_MULTI_PCM | FMT_480_DOLBY;
if (cm->chipVersion >= 68) {
cm->formatMask |= FMT_882_PCM | FMT_882_MULTI_PCM | FMT_882_DOLBY | FMT_960_PCM | FMT_960_MULTI_PCM | FMT_960_DOLBY;
}
}
ExFreePoolWithTag (KeyInfo,'dbrt');
@ -273,7 +284,7 @@ STDMETHODIMP CCMITopology::loadMixerSettingsFromRegistry()
STDMETHODIMP CCMITopology::storeMixerSettingsToRegistry()
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMITopology::storeMixerSettingsToRegistry"));
PREGISTRYKEY DriverKey;
@ -312,7 +323,7 @@ STDMETHODIMP CCMITopology::storeMixerSettingsToRegistry()
PropertyRequest.ValueSize = sizeof(DWORD);
PropertyRequest.PropertyItem = &PropertyItem;
for ( UINT i=0; i < SIZEOF_ARRAY(TopologyNodes); i++ ) {
for (unsigned int i=0;i < SIZEOF_ARRAY(TopologyNodes); i++) {
PropertyRequest.Node = i;
if (IsEqualGUIDAligned(*(TopologyNodes[i].Type), KSNODETYPE_VOLUME)) {
PropertyRequest.Node = i;
@ -433,7 +444,7 @@ STDMETHODIMP CCMITopology::storeMixerSettingsToRegistry()
STDMETHODIMP CCMITopology::loadMixerSettingsFromMemory()
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMITopology::loadMixerSettingsFromMemory"));
CMIAdapter->resetMixer();
@ -453,7 +464,7 @@ STDMETHODIMP CCMITopology::loadMixerSettingsFromMemory()
STDMETHODIMP CCMITopology::storeMixerSettingsToMemory()
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CCMITopology::storeMixerSettingsToMemory"));
mixer1Register = CMIAdapter->readUInt8(REG_MIXER1);
@ -468,14 +479,13 @@ STDMETHODIMP CCMITopology::storeMixerSettingsToMemory()
NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest)
{
//PAGED_CODE();
//ASSERT(PropertyRequest);
PAGED_CODE();
ASSERT(PropertyRequest);
DBGPRINT(("[PropertyHandler_OnOff]"));
CCMITopology *that = (CCMITopology *) ((PMINIPORTTOPOLOGY) PropertyRequest->MajorTarget);
NTSTATUS ntStatus = STATUS_INVALID_PARAMETER;
//UInt8 data, mask, reg;
UInt8 mask, reg;
LONG channel;
@ -603,8 +613,8 @@ NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest)
case KSNODE_TOPO_CD_MUTE_IN:
switch (channel) {
case CHAN_LEFT: mask = EN_LINEIN_L; reg = EN_CD_L; break;
case CHAN_RIGHT: mask = EN_LINEIN_R; reg = EN_CD_R; break;
case CHAN_LEFT: mask = EN_CD_L; reg = SBREG_IN_CTRL_L; break;
case CHAN_RIGHT: mask = EN_CD_R; reg = SBREG_IN_CTRL_R; break;
default: return ntStatus;
}
if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
@ -647,13 +657,13 @@ NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest)
default: return ntStatus;
}
if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
*Muted = (that->micVolumeRegister & mask) ;
*Muted = !(that->micVolumeRegister & mask) ;
}
if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
if (*Muted) {
that->micVolumeRegister |= mask;
} else {
that->micVolumeRegister &= ~mask;
} else {
that->micVolumeRegister |= mask;
}
that->CMIAdapter->writeUInt8(REG_MIXER2, that->micVolumeRegister);
}
@ -709,7 +719,6 @@ NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest)
*LoudnessOn = (that->CMIAdapter->readMixer(SBREG_EXTENSION) & EN_MICBOOST);
}
if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
// DBGPRINT(("setting mic boost: previous state %d, new state %d", (that->CMIAdapter->readMixer(SBREG_EXTENSION) & EN_MICBOOST), (*LoudnessOn)));
if (*LoudnessOn) {
that->CMIAdapter->setMixerBit(SBREG_EXTENSION, EN_MICBOOST);
} else {
@ -791,12 +800,15 @@ NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest)
if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
*LoudnessOn = (that->CMIAdapter->readUInt8(REG_MIXER1) & EN_SPDI2DAC);
}
if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
if (*LoudnessOn) {
that->CMIAdapter->setUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
} else {
that->CMIAdapter->clearUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
}
if (that->cm) {
that->cm->enableSPDIFInMonitor = *LoudnessOn;
}
}
ntStatus = STATUS_SUCCESS;
break;
@ -809,7 +821,7 @@ NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest)
*LoudnessOn = (that->CMIAdapter->readUInt32(REG_MISCCTRL) & SEL_SPDIFI2);
}
}
if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
if (*LoudnessOn) {
if (that->cm->chipVersion <= 37) {
that->CMIAdapter->setUInt32Bit(REG_CHFORMAT, SEL_SPDIFI1);
@ -1018,8 +1030,8 @@ NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest)
static NTSTATUS BasicSupportHandler(PPCPROPERTY_REQUEST PropertyRequest)
{
//PAGED_CODE();
//ASSERT(PropertyRequest);
PAGED_CODE();
ASSERT(PropertyRequest);
DBGPRINT(("[BasicSupportHandler]"));
NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
@ -1045,7 +1057,7 @@ static NTSTATUS BasicSupportHandler(PPCPROPERTY_REQUEST PropertyRequest)
PKSPROPERTY_STEPPING_LONG Range = PKSPROPERTY_STEPPING_LONG(Members + 1);
for ( UINT i=0; i < SIZEOF_ARRAY(VolTable); i++ ) {
for (unsigned int i=0;i<SIZEOF_ARRAY(VolTable);i++) {
if (VolTable[i].node == PropertyRequest->Node) {
Range->Bounds.SignedMaximum = (VolTable[i].max << 16);
Range->Bounds.SignedMinimum = (VolTable[i].min << 16);
@ -1088,8 +1100,8 @@ static NTSTATUS BasicSupportHandler(PPCPROPERTY_REQUEST PropertyRequest)
NTSTATUS NTAPI PropertyHandler_Level(PPCPROPERTY_REQUEST PropertyRequest)
{
//PAGED_CODE();
//ASSERT(PropertyRequest);
PAGED_CODE();
ASSERT(PropertyRequest);
DBGPRINT(("[PropertyHandler_Level]"));
CCMITopology *that = (CCMITopology *) ((PMINIPORTTOPOLOGY) PropertyRequest->MajorTarget);
@ -1113,7 +1125,7 @@ NTSTATUS NTAPI PropertyHandler_Level(PPCPROPERTY_REQUEST PropertyRequest)
PLONG Level = (PLONG)PropertyRequest->Value;
for ( UINT i=0; i <SIZEOF_ARRAY(VolTable); i++ )
for (unsigned int i=0;i<SIZEOF_ARRAY(VolTable);i++)
{
if (VolTable[i].node == PropertyRequest->Node) {
if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
@ -1223,15 +1235,16 @@ NTSTATUS NTAPI PropertyHandler_Level(PPCPROPERTY_REQUEST PropertyRequest)
return ntStatus;
}
NTSTATUS NTAPI PropertyHandler_CpuResources(PPCPROPERTY_REQUEST PropertyRequest)
NTSTATUS NTAPI PropertyHandler_CpuResources(PPCPROPERTY_REQUEST PropertyRequest)
{
//PAGED_CODE();
//ASSERT(PropertyRequest);
PAGED_CODE();
ASSERT(PropertyRequest);
DBGPRINT(("[PropertyHandler_CpuResources]"));
NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
if (PropertyRequest->Node == MAXULONG) {
if (PropertyRequest->Node == (ULONG)-1) {
return ntStatus;
}
if (PropertyRequest->Node >= KSNODE_TOPO_INVALID) {
@ -1277,8 +1290,8 @@ NTSTATUS NTAPI PropertyHandler_CpuResources(PPCPROPERTY_REQUEST PropertyRequest)
NTSTATUS NTAPI PropertyHandler_ComponentId(PPCPROPERTY_REQUEST PropertyRequest)
{
//PAGED_CODE();
//ASSERT(PropertyRequest);
PAGED_CODE();
ASSERT(PropertyRequest);
DBGPRINT(("[PropertyHandler_ComponentId]"));
NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
@ -1323,8 +1336,8 @@ NTSTATUS NTAPI PropertyHandler_ComponentId(PPCPROPERTY_REQUEST PropertyRequest)
NTSTATUS NTAPI PropertyHandler_Private(PPCPROPERTY_REQUEST PropertyRequest)
{
//PAGED_CODE();
//ASSERT(PropertyRequest);
PAGED_CODE();
ASSERT(PropertyRequest);
DBGPRINT(("[PropertyHandler_Private]"));
NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
@ -1351,14 +1364,14 @@ NTSTATUS NTAPI PropertyHandler_Private(PPCPROPERTY_REQUEST PropertyRequest)
#endif
cmiData->hardwareRevision = that->cm->chipVersion;
cmiData->maxChannels = that->cm->maxChannels;
cmiData->IOBase = (USHORT)(ULONG_PTR)that->cm->IOBase;
cmiData->MPUBase = (USHORT)(ULONG_PTR)that->cm->MPUBase;
cmiData->IOBase = (USHORT)((ULONG_PTR)that->cm->IOBase);
cmiData->MPUBase = (USHORT)((ULONG_PTR)that->cm->MPUBase);
cmiData->enableSPDO = that->cm->enableSPDIFOut;
cmiData->enableSPDIMonitor = that->cm->enableSPDIFInMonitor;
cmiData->enableSPDI = that->cm->enableSPDIFIn;
cmiData->formatMask = that->cm->formatMask;
cmiData->exchangeFrontBack = (that->CMIAdapter->readUInt8(REG_MIXER1) & REAR2FRONT);
cmiData->enableSPDO5V = (that->CMIAdapter->readUInt32(REG_MISCCTRL) & EN_SPDO5V);
cmiData->enablePCMDAC = (that->CMIAdapter->readUInt8(REG_MIXER1) & EN_SPDI2DAC);
cmiData->enableBass2Line = (that->CMIAdapter->readUInt32(REG_LEGACY) & BASS2LINE);
cmiData->enableCenter2Line = (that->CMIAdapter->readUInt32(REG_LEGACY) & CENTER2LINE);
cmiData->enableRear2Line = (that->CMIAdapter->readUInt8(REG_MIXER1) & REAR2LINE);
@ -1392,6 +1405,7 @@ NTSTATUS NTAPI PropertyHandler_Private(PPCPROPERTY_REQUEST PropertyRequest)
that->cm->enableSPDIFIn = cmiData->enableSPDI;
that->cm->enableSPDIFOut = cmiData->enableSPDO;
that->cm->formatMask = cmiData->formatMask;
that->cm->enableSPDIFInMonitor = cmiData->enableSPDIMonitor;
if (cmiData->enableSPDI) {
that->CMIAdapter->setUInt8Bit(REG_MIXER1, EN_WAVEIN_L | EN_WAVEIN_R);
@ -1409,7 +1423,7 @@ NTSTATUS NTAPI PropertyHandler_Private(PPCPROPERTY_REQUEST PropertyRequest)
} else {
that->CMIAdapter->clearUInt32Bit(REG_MISCCTRL, EN_SPDO5V);
}
if (cmiData->enablePCMDAC) {
if (cmiData->enableSPDIMonitor) {
that->CMIAdapter->setUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
} else {
that->CMIAdapter->clearUInt8Bit(REG_MIXER1, EN_SPDI2DAC);

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -31,7 +31,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common.hpp"
#include "property.h"
class CCMITopology : public ICMITopology
class CCMITopology : public ICMITopology,
public CUnknown
{
private:
PCMIADAPTER CMIAdapter; // Adapter common object.
@ -44,24 +45,8 @@ private:
NTSTATUS ProcessResources(PRESOURCELIST ResourceList);
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
STDMETHODIMP_(ULONG) AddRef()
{
InterlockedIncrement(&m_Ref);
return m_Ref;
}
STDMETHODIMP_(ULONG) Release()
{
InterlockedDecrement(&m_Ref);
if (!m_Ref)
{
delete this;
return 0;
}
return m_Ref;
}
CCMITopology(IUnknown * OuterUnknown){}
DECLARE_STD_UNKNOWN();
DEFINE_STD_CONSTRUCTOR(CCMITopology);
~CCMITopology();
STDMETHODIMP_(NTSTATUS) loadMixerSettingsFromRegistry();
STDMETHODIMP_(NTSTATUS) storeMixerSettingsToRegistry();
@ -86,7 +71,6 @@ public:
return STATUS_NOT_IMPLEMENTED;
}
// public methods
STDMETHODIMP_(NTSTATUS) Init
(
IN PUNKNOWN UnknownAdapter,
@ -102,9 +86,7 @@ public:
friend NTSTATUS NTAPI PropertyHandler_Private(PPCPROPERTY_REQUEST PropertyRequest);
friend NTSTATUS NTAPI PropertyHandler_Mux(PPCPROPERTY_REQUEST PropertyRequest);
static NTSTATUS NTAPI EventHandler(PPCEVENT_REQUEST EventRequest);
LONG m_Ref;
static NTSTATUS EventHandler(PPCEVENT_REQUEST EventRequest);
};
#endif //_MINTOPO_HPP_

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -30,21 +30,13 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "mintopo.hpp"
#if 0
#ifndef STATIC_KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF
#define STATIC_KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF\
DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_DOLBY_AC3_SPDIF)
DEFINE_GUIDSTRUCT("00000092-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF);
#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_GUIDNAMED( KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF )
/* Warning - Recursive #define for KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF */
#endif
#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)
#endif
NTSTATUS NTAPI PropertyHandler_Level(PPCPROPERTY_REQUEST PropertyRequest);
NTSTATUS NTAPI PropertyHandler_CpuResources(PPCPROPERTY_REQUEST PropertyRequest);
NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest);
NTSTATUS NTAPI PropertyHandler_ComponentId(PPCPROPERTY_REQUEST PropertyRequest);
NTSTATUS NTAPI PropertyHandler_Private(PPCPROPERTY_REQUEST PropertyRequest);
static KSDATARANGE PinDataRangesBridge[] =
{
@ -54,9 +46,9 @@ static KSDATARANGE PinDataRangesBridge[] =
0,
0,
0,
{ STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
{ STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG) },
{ STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) }
{STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG)},
{STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)}
}
}
};
@ -68,15 +60,15 @@ static PKSDATARANGE PinDataRangePointersBridge[] =
static KSDATARANGE WavePinDataRangesAC3Bridge[] =
{
{
{
{
sizeof(KSDATARANGE),
0,
0,
0,
{ STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
{ STATICGUIDOF(KSDATAFORMAT_SUBTYPE_AC3_AUDIO) },
{ STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) }
{STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SUBTYPE_AC3_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)}
}
}
};
@ -103,7 +95,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSCATEGORY_AUDIO, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -122,7 +114,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSNODETYPE_SPDIF_INTERFACE, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -141,7 +133,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSNODETYPE_MICROPHONE, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -160,7 +152,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSNODETYPE_CD_PLAYER, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -179,7 +171,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSNODETYPE_LINE_CONNECTOR, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -198,7 +190,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSNODETYPE_ANALOG_CONNECTOR, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -217,7 +209,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSNODETYPE_ANALOG_CONNECTOR, // Category
&CMINAME_DAC, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -236,7 +228,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSNODETYPE_SPEAKER, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -255,7 +247,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSCATEGORY_AUDIO, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -274,7 +266,7 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
&KSCATEGORY_AUDIO, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
},
@ -293,27 +285,32 @@ static PCPIN_DESCRIPTOR MiniportPins[] =
KSPIN_COMMUNICATION_NONE, // Communication
NULL, // Category
NULL, // Name
{ 0 } // Reserved
{0} // Reserved
}
}
};
NTSTATUS NTAPI PropertyHandler_Level(PPCPROPERTY_REQUEST PropertyRequest);
NTSTATUS NTAPI PropertyHandler_CpuResources(PPCPROPERTY_REQUEST PropertyRequest);
NTSTATUS NTAPI PropertyHandler_OnOff(PPCPROPERTY_REQUEST PropertyRequest);
NTSTATUS NTAPI PropertyHandler_ComponentId(PPCPROPERTY_REQUEST PropertyRequest);
NTSTATUS NTAPI PropertyHandler_Private(PPCPROPERTY_REQUEST PropertyRequest);
static PCPROPERTY_ITEM PropertiesVolume[] =
{
{
&KSPROPSETID_Audio,
KSPROPERTY_AUDIO_VOLUMELEVEL,
KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT,
(PCPFNPROPERTY_HANDLER)PropertyHandler_Level
PropertyHandler_Level
},
{
&KSPROPSETID_Audio,
KSPROPERTY_AUDIO_CPU_RESOURCES,
KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT,
(PCPFNPROPERTY_HANDLER)PropertyHandler_CpuResources
PropertyHandler_CpuResources
}
};
DEFINE_PCAUTOMATION_TABLE_PROP(AutomationVolume,PropertiesVolume);
static PCPROPERTY_ITEM PropertiesLoudness[] =
@ -322,13 +319,13 @@ static PCPROPERTY_ITEM PropertiesLoudness[] =
&KSPROPSETID_Audio,
KSPROPERTY_AUDIO_LOUDNESS,
KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT,
(PCPFNPROPERTY_HANDLER)PropertyHandler_OnOff
PropertyHandler_OnOff
},
{
&KSPROPSETID_Audio,
KSPROPERTY_AUDIO_CPU_RESOURCES,
KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT,
(PCPFNPROPERTY_HANDLER)PropertyHandler_CpuResources
PropertyHandler_CpuResources
}
};
DEFINE_PCAUTOMATION_TABLE_PROP(AutomationLoudness,PropertiesLoudness);
@ -339,13 +336,13 @@ static PCPROPERTY_ITEM PropertiesMute[] =
&KSPROPSETID_Audio,
KSPROPERTY_AUDIO_MUTE,
KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET | KSPROPERTY_TYPE_BASICSUPPORT,
(PCPFNPROPERTY_HANDLER)PropertyHandler_OnOff
PropertyHandler_OnOff
},
{
&KSPROPSETID_Audio,
KSPROPERTY_AUDIO_CPU_RESOURCES,
KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT,
(PCPFNPROPERTY_HANDLER)PropertyHandler_CpuResources
PropertyHandler_CpuResources
}
};
DEFINE_PCAUTOMATION_TABLE_PROP(AutomationMute,PropertiesMute);
@ -356,19 +353,19 @@ static PCPROPERTY_ITEM PropertiesFilter[] =
&KSPROPSETID_General,
KSPROPERTY_GENERAL_COMPONENTID,
KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_BASICSUPPORT,
(PCPFNPROPERTY_HANDLER)PropertyHandler_ComponentId
PropertyHandler_ComponentId
},
{
&KSPROPSETID_CMI,
KSPROPERTY_CMI_GET,
KSPROPERTY_TYPE_GET,
(PCPFNPROPERTY_HANDLER)PropertyHandler_Private
PropertyHandler_Private
},
{
&KSPROPSETID_CMI,
KSPROPERTY_CMI_SET,
KSPROPERTY_TYPE_SET,
(PCPFNPROPERTY_HANDLER)PropertyHandler_Private
PropertyHandler_Private
}
};
DEFINE_PCAUTOMATION_TABLE_PROP(AutomationFilter,PropertiesFilter);

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -30,13 +30,13 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ntddk.h"
#ifdef _MSC_VER
#pragma code_seg("PAGE") /* warning - ignored by GCC compiler */
#pragma code_seg("PAGE")
#endif
HRESULT NTAPI CreateMiniportWaveCMI(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
NTSTATUS NTAPI CreateMiniportWaveCMI(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
{
//PAGED_CODE();
//ASSERT(Unknown);
PAGED_CODE();
ASSERT(Unknown);
#ifdef WAVERT
STD_CREATE_BODY_(CMiniportWaveCMI,Unknown,UnknownOuter,PoolType,PMINIPORTWAVERT);
#else
@ -46,8 +46,8 @@ HRESULT NTAPI CreateMiniportWaveCMI(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN Unknow
NTSTATUS CMiniportWaveCMI::processResources(PRESOURCELIST resourceList)
{
//PAGED_CODE();
//ASSERT (resourceList);
PAGED_CODE();
ASSERT (resourceList);
DBGPRINT(("CMiniportWaveCMI[%p]::ProcessResources(%p)", this, resourceList));
if (resourceList->NumberOfInterrupts() < 1) {
@ -60,8 +60,8 @@ NTSTATUS CMiniportWaveCMI::processResources(PRESOURCELIST resourceList)
#ifndef WAVERT
NTSTATUS CMiniportWaveCMI::newDMAChannel(PDMACHANNEL *dmaChannel, UInt32 bufferLength)
{
//PAGED_CODE();
//ASSERT(dmaChannel);
PAGED_CODE();
ASSERT(dmaChannel);
DBGPRINT(("CMiniportWaveCMI[%p]::newDMAChannel(%p)", this, dmaChannel));
NTSTATUS ntStatus;
@ -70,7 +70,7 @@ NTSTATUS CMiniportWaveCMI::newDMAChannel(PDMACHANNEL *dmaChannel, UInt32 bufferL
if (NT_SUCCESS(ntStatus)) {
ULONG lDMABufferLength = bufferLength;
do {
ntStatus = (*dmaChannel)->AllocateBuffer(lDMABufferLength,NULL);
ntStatus = (*dmaChannel)->AllocateBuffer(lDMABufferLength, NULL);
lDMABufferLength >>= 1;
} while (!NT_SUCCESS(ntStatus) && (lDMABufferLength > (PAGE_SIZE / 2)));
}
@ -79,10 +79,10 @@ NTSTATUS CMiniportWaveCMI::newDMAChannel(PDMACHANNEL *dmaChannel, UInt32 bufferL
#endif
//generic crap
STDMETHODIMP CMiniportWaveCMI::QueryInterface(REFIID Interface, PVOID *Object)
STDMETHODIMP CMiniportWaveCMI::NonDelegatingQueryInterface(REFIID Interface, PVOID *Object)
{
//PAGED_CODE();
//ASSERT(Object);
PAGED_CODE();
ASSERT(Object);
DBGPRINT(("CMiniportWaveCMI[%p]::NonDelegatingQueryInterface"));
if (IsEqualGUIDAligned(Interface,IID_IUnknown)) {
@ -115,7 +115,7 @@ STDMETHODIMP CMiniportWaveCMI::QueryInterface(REFIID Interface, PVOID *Object)
CMiniportWaveCMI::~CMiniportWaveCMI(void)
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CMiniportWaveCMI[%p]::~CMiniportWaveCMI", this));
storeChannelConfigToRegistry(); //or not. during system shutdown, this doesn't seem to work.
@ -132,7 +132,7 @@ CMiniportWaveCMI::~CMiniportWaveCMI(void)
DMAChannel[i] = NULL;
}
#endif
if (isStreamRunning[i]) {
if (isStreamRunning[i]) {
isStreamRunning[i] = false;
stream[i]->Release();
stream[i] = NULL;
@ -151,11 +151,11 @@ STDMETHODIMP CMiniportWaveCMI::Init(PUNKNOWN UnknownAdapter, PRESOURCELIST Resou
STDMETHODIMP CMiniportWaveCMI::Init(PUNKNOWN UnknownAdapter, PRESOURCELIST ResourceList, PPORTWAVECYCLIC Port_)
#endif
{
//PAGED_CODE();
PAGED_CODE();
//ASSERT(UnknownAdapter);
//ASSERT(ResourceList);
//ASSERT(Port_);
ASSERT(UnknownAdapter);
ASSERT(ResourceList);
ASSERT(Port_);
DBGPRINT(("CMiniportWaveCMI[%p]::Init(%p, %p, %p)", this, UnknownAdapter, ResourceList, Port_));
@ -163,7 +163,7 @@ STDMETHODIMP CMiniportWaveCMI::Init(PUNKNOWN UnknownAdapter, PRESOURCELIST Resou
Port->AddRef();
NTSTATUS ntStatus = UnknownAdapter->QueryInterface(IID_ICMIAdapter, (PVOID *) &CMIAdapter);
if (!NT_SUCCESS(ntStatus)) {
if (!NT_SUCCESS(ntStatus)) {
DBGPRINT(("QueryInterface(CMIAdapter) failed"));
return ntStatus;
}
@ -203,8 +203,8 @@ STDMETHODIMP CMiniportWaveCMI::Init(PUNKNOWN UnknownAdapter, PRESOURCELIST Resou
#ifdef WAVERT
STDMETHODIMP_(NTSTATUS) CMiniportWaveCMI::GetDeviceDescription(PDEVICE_DESCRIPTION OutDeviceDescriptor)
{
//PAGED_CODE();
//ASSERT(OutDeviceDescriptor);
PAGED_CODE();
ASSERT(OutDeviceDescriptor);
DBGPRINT(("CMiniportWaveCMI[%p]::GetDeviceDescription(%p)", this, OutDeviceDescriptor));
RtlZeroMemory(OutDeviceDescriptor, sizeof(DEVICE_DESCRIPTION));
@ -220,26 +220,25 @@ STDMETHODIMP_(NTSTATUS) CMiniportWaveCMI::GetDeviceDescription(PDEVICE_DESCRIPTI
STDMETHODIMP CMiniportWaveCMI::GetDescription(PPCFILTER_DESCRIPTOR *OutFilterDescriptor)
{
//PAGED_CODE();
//ASSERT(OutFilterDescriptor);
DBGPRINT(("CMiniportWaveCMI[%p]::GetDescription(%p)", this, OutFilterDescriptor));
PAGED_CODE();
ASSERT(OutFilterDescriptor);
DBGPRINT(("CMiniportWaveCMI[%p]::GetDescription(%p)", this, OutFilterDescriptor));
*OutFilterDescriptor = &WaveMiniportFilterDescriptor;
*OutFilterDescriptor = &WaveMiniportFilterDescriptor;
return STATUS_SUCCESS;
return STATUS_SUCCESS;
}
NTSTATUS CMiniportWaveCMI::loadChannelConfigFromRegistry()
{
//PAGED_CODE();
PAGED_CODE();
PREGISTRYKEY DriverKey;
PREGISTRYKEY SettingsKey;
UNICODE_STRING KeyName;
//DWORD Value, ResultLength;
DWORD ResultLength;
UNICODE_STRING KeyName;
DWORD ResultLength;
PVOID KeyInfo;
DBGPRINT(("CMiniportWaveCMI::loadChannelConfigFromRegistry()"));
DBGPRINT(("CMiniportWaveCMI::loadChannelConfigFromRegistry()"));
if ((!CMIAdapter) || (!(CMIAdapter->getDeviceObject()))) {
return STATUS_UNSUCCESSFUL;
@ -265,7 +264,7 @@ NTSTATUS CMiniportWaveCMI::loadChannelConfigFromRegistry()
RtlInitUnicodeString(&KeyName, L"ChannelCount");
ntStatus = SettingsKey->QueryValueKey(&KeyName, KeyValuePartialInformation, KeyInfo, sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(DWORD), &ResultLength);
if (NT_SUCCESS (ntStatus)) {
PKEY_VALUE_PARTIAL_INFORMATION PartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyInfo;
PKEY_VALUE_PARTIAL_INFORMATION PartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyInfo;
if (PartialInfo->DataLength == sizeof(DWORD)) {
requestedChannelCount = (*(PLONG)PartialInfo->Data);
}
@ -276,7 +275,7 @@ NTSTATUS CMiniportWaveCMI::loadChannelConfigFromRegistry()
RtlInitUnicodeString(&KeyName, L"ChannelMask");
ntStatus = SettingsKey->QueryValueKey(&KeyName, KeyValuePartialInformation, KeyInfo, sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(DWORD), &ResultLength);
if (NT_SUCCESS (ntStatus)) {
PKEY_VALUE_PARTIAL_INFORMATION PartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyInfo;
PKEY_VALUE_PARTIAL_INFORMATION PartialInfo = (PKEY_VALUE_PARTIAL_INFORMATION)KeyInfo;
if (PartialInfo->DataLength == sizeof(DWORD)) {
requestedChannelMask = (*(PLONG)PartialInfo->Data);
}
@ -294,12 +293,12 @@ NTSTATUS CMiniportWaveCMI::loadChannelConfigFromRegistry()
NTSTATUS CMiniportWaveCMI::storeChannelConfigToRegistry()
{
//PAGED_CODE();
PAGED_CODE();
PREGISTRYKEY DriverKey;
PREGISTRYKEY SettingsKey;
UNICODE_STRING KeyName;
DWORD Value;
DBGPRINT(("CMiniportWaveCMI::storeChannelConfigToRegistry()"));
UNICODE_STRING KeyName;
DWORD Value;
DBGPRINT(("CMiniportWaveCMI::storeChannelConfigToRegistry()"));
if ((!CMIAdapter) || (!(CMIAdapter->getDeviceObject()))) {
return STATUS_UNSUCCESSFUL;
@ -342,7 +341,7 @@ NTSTATUS CMiniportWaveCMI::storeChannelConfigToRegistry()
STDMETHODIMP_(void) CMiniportWaveCMI::powerUp(void)
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CMiniportWaveCMI[%p]::powerUp()", this));
KSSTATE oldState[3];
@ -368,7 +367,7 @@ STDMETHODIMP_(void) CMiniportWaveCMI::powerUp(void)
STDMETHODIMP_(void) CMiniportWaveCMI::powerDown(void)
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CMiniportWaveCMI[%p]::powerDown()", this));
if (cm->TopoMiniport) {
@ -380,8 +379,8 @@ STDMETHODIMP_(void) CMiniportWaveCMI::powerDown(void)
NTSTATUS CMiniportWaveCMI::isFormatAllowed(UInt32 sampleRate, BOOLEAN multiChan, BOOLEAN AC3)
{
//PAGED_CODE();
//ASSERT(sampleRate);
PAGED_CODE();
ASSERT(sampleRate);
DBGPRINT(("CMiniportWaveCMI[%p]::isFormatAllowed(%d, %d, %d)", this, sampleRate, multiChan, AC3));
if (multiChan) {
@ -413,26 +412,26 @@ NTSTATUS CMiniportWaveCMI::isFormatAllowed(UInt32 sampleRate, BOOLEAN multiChan,
NTSTATUS CMiniportWaveCMI::validateFormat(PKSDATAFORMAT format, ULONG PinID, BOOLEAN capture)
{
//PAGED_CODE();
//ASSERT(format);
PAGED_CODE();
ASSERT(format);
DBGPRINT(("CMiniportWaveCMI[%p]::validateFormat(%p, %d, %d)", this, format, PinID, capture));
PWAVEFORMATEX waveFormat = PWAVEFORMATEX(format + 1);
DBGPRINT(("---channels: %d, resolution: %d, sample rate: %d, pin: %d, formatMask: %x", waveFormat->nChannels, waveFormat->wBitsPerSample, waveFormat->nSamplesPerSec, PinID, cm->formatMask));
//WaveFormatEx
if ( ( (size_t) format->FormatSize >= sizeof(KSDATAFORMAT_WAVEFORMATEX))
if ( ( format->FormatSize >= sizeof(KSDATAFORMAT_WAVEFORMATEX))
&& IsEqualGUIDAligned(format->MajorFormat,KSDATAFORMAT_TYPE_AUDIO)
&& IsEqualGUIDAligned(format->Specifier,KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) ) {
switch (EXTRACT_WAVEFORMATEX_ID(&format->SubFormat)) {
case WAVE_FORMAT_PCM:
if ((PinID != PIN_WAVE_RENDER_SINK) && (PinID != PIN_WAVE_CAPTURE_SOURCE) && ((int)PinID != -1)) {
if ((PinID != PIN_WAVE_RENDER_SINK) && (PinID != PIN_WAVE_CAPTURE_SOURCE) && (PinID != ((ULONG)-1))) {
if ((PinID == PIN_WAVE_AC3_RENDER_SINK) && !IoIsWdmVersionAvailable(6,0)) {
return STATUS_INVALID_PARAMETER;
}
}
if ( ((waveFormat->wBitsPerSample == 16) || (waveFormat->wBitsPerSample == 24))
if ( ((waveFormat->wBitsPerSample == 16) || (waveFormat->wBitsPerSample == 32))
&& ((waveFormat->nSamplesPerSec == 44100) || (waveFormat->nSamplesPerSec == 48000) || (waveFormat->nSamplesPerSec == 88200) || (waveFormat->nSamplesPerSec == 96000))
&& (waveFormat->nChannels == 2) ) {
if ((capture) && (waveFormat->nSamplesPerSec > 48000) ) {
@ -441,10 +440,10 @@ NTSTATUS CMiniportWaveCMI::validateFormat(PKSDATAFORMAT format, ULONG PinID, BOO
return isFormatAllowed(waveFormat->nSamplesPerSec, FALSE, FALSE);
}
if ( (waveFormat->wBitsPerSample == 16)
&& ((waveFormat->nChannels >= 4) && (waveFormat->nChannels <= (WORD) cm->maxChannels))
&& ((waveFormat->nChannels >= 4) && (waveFormat->nChannels <= cm->maxChannels))
&& ((waveFormat->nSamplesPerSec == 44100) || (waveFormat->nSamplesPerSec == 48000)) ) {
#if OUT_CHANNEL == 1
if ((PinID == PIN_WAVE_RENDER_SINK) || ((int)PinID == -1)) {
if ((PinID == PIN_WAVE_RENDER_SINK) || (PinID == ((ULONG)-1))) {
return isFormatAllowed(waveFormat->nSamplesPerSec, TRUE, FALSE);
}
#else
@ -453,7 +452,7 @@ NTSTATUS CMiniportWaveCMI::validateFormat(PKSDATAFORMAT format, ULONG PinID, BOO
}
break;
case WAVE_FORMAT_DOLBY_AC3_SPDIF:
if ((PinID != PIN_WAVE_AC3_RENDER_SINK) && ((int)PinID != -1)) {
if ((PinID != PIN_WAVE_AC3_RENDER_SINK) && (PinID != ((ULONG)-1))) {
return STATUS_INVALID_PARAMETER;
}
if ( ((waveFormat->wBitsPerSample >= MIN_BITS_PER_SAMPLE_AC3) && (waveFormat->wBitsPerSample <= MAX_BITS_PER_SAMPLE_AC3))
@ -462,6 +461,16 @@ NTSTATUS CMiniportWaveCMI::validateFormat(PKSDATAFORMAT format, ULONG PinID, BOO
return isFormatAllowed(waveFormat->nSamplesPerSec, FALSE, TRUE);
}
break;
case WAVE_FORMAT_WMA_SPDIF:
if ((PinID != PIN_WAVE_AC3_RENDER_SINK) && (PinID != ((ULONG)-1))) {
return STATUS_INVALID_PARAMETER;
}
if ( ((waveFormat->wBitsPerSample >= MIN_BITS_PER_SAMPLE_WMA) && (waveFormat->wBitsPerSample <= MAX_BITS_PER_SAMPLE_WMA))
&& ((waveFormat->nSamplesPerSec >= MIN_SAMPLE_RATE_WMA) && (waveFormat->nSamplesPerSec <= MAX_SAMPLE_RATE_WMA))
&& (waveFormat->nChannels == MAX_CHANNELS_WMA) ) {
return isFormatAllowed(waveFormat->nSamplesPerSec, FALSE, TRUE);
}
break;
}
}
@ -471,10 +480,7 @@ NTSTATUS CMiniportWaveCMI::validateFormat(PKSDATAFORMAT format, ULONG PinID, BOO
// Tests a data range intersection
STDMETHODIMP CMiniportWaveCMI::DataRangeIntersection(ULONG PinId, PKSDATARANGE ClientDataRange, PKSDATARANGE MyDataRange, ULONG OutputBufferLength, PVOID ResultantFormat, PULONG ResultantFormatLength)
{
//PAGED_CODE();
static const GUID KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF = {0x00000092L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
PAGED_CODE();
DBGPRINT(("CMiniportWaveCMI[%p]::DataRangeIntersection(%d, %p, %p, %d, %p, %p)", this, PinId, ClientDataRange, MyDataRange, OutputBufferLength, ResultantFormat, ResultantFormatLength));
if (PinId == PIN_WAVE_AC3_RENDER_SINK) {
@ -489,6 +495,7 @@ STDMETHODIMP CMiniportWaveCMI::DataRangeIntersection(ULONG PinId, PKSDATARANGE C
if (!IsEqualGUIDAligned(ClientDataRange->SubFormat, KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)
&& !IsEqualGUIDAligned(ClientDataRange->SubFormat, KSDATAFORMAT_SUBTYPE_WMA_SPDIF)
&& !IsEqualGUIDAligned(ClientDataRange->SubFormat, KSDATAFORMAT_SUBTYPE_WILDCARD)) {
// check for Vista
isAC3Pin = false;
@ -558,8 +565,13 @@ STDMETHODIMP CMiniportWaveCMI::DataRangeIntersection(ULONG PinId, PKSDATARANGE C
pWaveFormatEx->wBitsPerSample = 16; // SPDIF
pWaveFormatEx->cbSize = 0;
if (isAC3Pin) {
pWaveFormatEx->wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
pWaveFormatEx->nSamplesPerSec = 48000;
if (IsEqualGUIDAligned(ClientDataRange->SubFormat, KSDATAFORMAT_SUBTYPE_WMA_SPDIF)) {
pWaveFormatEx->wFormatTag = WAVE_FORMAT_WMA_SPDIF;
pWaveFormatEx->nSamplesPerSec = min( ((PKSDATARANGE_AUDIO)ClientDataRange)->MaximumSampleFrequency, MAX_SAMPLE_RATE_WMA);
} else {
pWaveFormatEx->wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
pWaveFormatEx->nSamplesPerSec = 48000;
}
} else {
pWaveFormatEx->wFormatTag = WAVE_FORMAT_PCM;
pWaveFormatEx->nSamplesPerSec = min( ((PKSDATARANGE_AUDIO)ClientDataRange)->MaximumSampleFrequency, MAX_SAMPLE_RATE);
@ -572,12 +584,12 @@ STDMETHODIMP CMiniportWaveCMI::DataRangeIntersection(ULONG PinId, PKSDATARANGE C
if ((PinId == PIN_WAVE_RENDER_SINK) || (PinId == PIN_WAVE_CAPTURE_SINK)) {
if (!IsEqualGUIDAligned(ClientDataRange->SubFormat, KSDATAFORMAT_SUBTYPE_PCM) &&
!IsEqualGUIDAligned(ClientDataRange->SubFormat, KSDATAFORMAT_SUBTYPE_WILDCARD)) {
!IsEqualGUIDAligned(ClientDataRange->SubFormat, KSDATAFORMAT_SUBTYPE_WILDCARD)) {
return STATUS_NO_MATCH;
}
if (!IsEqualGUIDAligned(ClientDataRange->MajorFormat, KSDATAFORMAT_TYPE_AUDIO) &&
!IsEqualGUIDAligned(ClientDataRange->MajorFormat, KSDATAFORMAT_TYPE_WILDCARD)) {
!IsEqualGUIDAligned(ClientDataRange->MajorFormat, KSDATAFORMAT_TYPE_WILDCARD)) {
return STATUS_NO_MATCH;
}
@ -643,7 +655,7 @@ STDMETHODIMP CMiniportWaveCMI::DataRangeIntersection(ULONG PinId, PKSDATARANGE C
}
PWAVEFORMATPCMEX WaveFormat = (PWAVEFORMATPCMEX)((PKSDATAFORMAT)ResultantFormat + 1);
if (IsEqualGUIDAligned(ClientDataRange->Specifier, KSDATAFORMAT_SPECIFIER_DSOUND)) {
if (IsEqualGUIDAligned(ClientDataRange->Specifier, KSDATAFORMAT_SPECIFIER_DSOUND)) {
return STATUS_NOT_SUPPORTED;
}
*(PKSDATAFORMAT)ResultantFormat = *MyDataRange;
@ -697,7 +709,7 @@ STDMETHODIMP CMiniportWaveCMI::DataRangeIntersection(ULONG PinId, PKSDATARANGE C
resultantFormatWFX->DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
INIT_WAVEFORMATEX_GUID(&resultantFormatWFX->DataFormat.SubFormat, WAVE_FORMAT_PCM);
if (IsEqualGUIDAligned(ClientDataRange->Specifier, KSDATAFORMAT_SPECIFIER_DSOUND)) {
if (IsEqualGUIDAligned(ClientDataRange->Specifier, KSDATAFORMAT_SPECIFIER_DSOUND)) {
PKSDATAFORMAT_DSOUND resultantFormatDSound;
resultantFormatDSound = (PKSDATAFORMAT_DSOUND)ResultantFormat;
resultantFormatDSound->DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_DSOUND;
@ -728,14 +740,14 @@ STDMETHODIMP CMiniportWaveCMI::NewStream(PMINIPORTWAVERTSTREAM *OutStream, PPORT
STDMETHODIMP CMiniportWaveCMI::NewStream(PMINIPORTWAVECYCLICSTREAM *OutStream, PUNKNOWN OuterUnknown, POOL_TYPE PoolType, ULONG PinID, BOOLEAN Capture, PKSDATAFORMAT DataFormat, PDMACHANNEL* OutDmaChannel, PSERVICEGROUP* OutServiceGroup)
#endif
{
//PAGED_CODE();
//ASSERT(OutStream);
//ASSERT(DataFormat);
PAGED_CODE();
ASSERT(OutStream);
ASSERT(DataFormat);
#ifdef WAVERT
DBGPRINT(("CMiniportWaveCMI[%p]::NewStream(%p, %p, %d, %d, %p)", this, OutStream, OuterUnknown, PinID, Capture, DataFormat));
#else
//ASSERT(OutDmaChannel);
//ASSERT(OutServiceGroup);
ASSERT(OutDmaChannel);
ASSERT(OutServiceGroup);
DBGPRINT(("CMiniportWaveCMI[%p]::NewStream(%p, %p, %p, %d, %d, %p, %p, %p)", this, OutStream, OuterUnknown, PoolType, PinID, Capture, DataFormat, OutDmaChannel, OutServiceGroup));
#endif
@ -748,12 +760,14 @@ STDMETHODIMP CMiniportWaveCMI::NewStream(PMINIPORTWAVECYCLICSTREAM *OutStream, P
DBGPRINT(("invalid stream format"));
return STATUS_UNSUCCESSFUL;
}
CMIAdapter->setUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
if (cm->enableSPDIFInMonitor) {
CMIAdapter->setUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
}
if (Capture) {
streamIndex = PCM_IN_STREAM;
} else if (WAVE_FORMAT_DOLBY_AC3_SPDIF == EXTRACT_WAVEFORMATEX_ID(&DataFormat->SubFormat)) {
} else
if ( (WAVE_FORMAT_DOLBY_AC3_SPDIF == EXTRACT_WAVEFORMATEX_ID(&DataFormat->SubFormat)) || (WAVE_FORMAT_WMA_SPDIF == EXTRACT_WAVEFORMATEX_ID(&DataFormat->SubFormat))) {
streamIndex = AC3_OUT_STREAM;
}
@ -763,7 +777,11 @@ STDMETHODIMP CMiniportWaveCMI::NewStream(PMINIPORTWAVECYCLICSTREAM *OutStream, P
return STATUS_UNSUCCESSFUL;
}
if ((streamIndex == AC3_OUT_STREAM) && isStreamRunning[PCM_OUT_STREAM]) {
#ifdef WAVERT
stream[PCM_OUT_STREAM]->SetState(KSSTATE_STOP);
#else
stream[PCM_OUT_STREAM]->SetState(KSSTATE_STOP_AC3);
#endif
}
if ((streamIndex == PCM_OUT_STREAM) && isStreamRunning[AC3_OUT_STREAM]) {
return STATUS_UNSUCCESSFUL;
@ -771,7 +789,7 @@ STDMETHODIMP CMiniportWaveCMI::NewStream(PMINIPORTWAVECYCLICSTREAM *OutStream, P
DBGPRINT(("---StreamNo: %d, Bits: %d, Sample Rate: %d, Channels: %d, AC3: %d", streamIndex,
waveFormat->wBitsPerSample, waveFormat->nSamplesPerSec, waveFormat->nChannels,
(WAVE_FORMAT_DOLBY_AC3_SPDIF == EXTRACT_WAVEFORMATEX_ID(&DataFormat->SubFormat))));
(WAVE_FORMAT_DOLBY_AC3_SPDIF == EXTRACT_WAVEFORMATEX_ID(&DataFormat->SubFormat)) || (WAVE_FORMAT_WMA_SPDIF == EXTRACT_WAVEFORMATEX_ID(&DataFormat->SubFormat)) ));
// the DAC and ADC can only run at the same sample rate simultaneously
if ((streamIndex == PCM_IN_STREAM) && isStreamRunning[PCM_OUT_STREAM]) {
@ -828,8 +846,8 @@ STDMETHODIMP CMiniportWaveCMI::NewStream(PMINIPORTWAVECYCLICSTREAM *OutStream, P
NTSTATUS NTAPI PropertyHandler_ChannelConfig(PPCPROPERTY_REQUEST PropertyRequest)
{
//PAGED_CODE();
//ASSERT(PropertyRequest);
PAGED_CODE();
ASSERT(PropertyRequest);
DBGPRINT(("[PropertyHandler_ChannelConfig]"));
#ifdef WAVERT
@ -887,7 +905,7 @@ NTSTATUS NTAPI PropertyHandler_ChannelConfig(PPCPROPERTY_REQUEST PropertyRequest
NTSTATUS CreateMiniportWaveStreamCMI(CMiniportWaveStreamCMI **MiniportWaveStreamCMI, PUNKNOWN pUnknownOuter, POOL_TYPE PoolType)
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CreateMiniportWaveStreamCMI"));
#ifdef WAVERT
@ -905,12 +923,11 @@ NTSTATUS CreateMiniportWaveStreamCMI(CMiniportWaveStreamCMI **MiniportWaveStrea
NTSTATUS CMiniportWaveStreamCMI::prepareStream()
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::prepareStream()", this));
DBGPRINT(("---streamIndex: %d, channelNumber: %d", streamIndex, channelNumber));
NTSTATUS ntStatus;
//UInt8 reg;
UInt32 val;
if (state == KSSTATE_RUN) {
@ -923,15 +940,14 @@ NTSTATUS CMiniportWaveStreamCMI::prepareStream()
}
enableSPDIF = ((currentSampleRate == 44100 || currentSampleRate == 48000 || currentSampleRate == 88200 || currentSampleRate == 96000) &&
((currentResolution == 16) || (currentResolution == 24)) && (currentChannelCount == 2)) &&
((currentResolution == 16) || (currentResolution == 32)) && (currentChannelCount == 2)) &&
(Miniport->cm->enableSPDIFOut);
ntStatus = setupSPDIFPlayback(enableSPDIF);
if (!NT_SUCCESS(ntStatus)) {
return ntStatus;
}
if (!isCaptureStream) {
ntStatus = setupSPDIFPlayback(enableSPDIF);
if (!NT_SUCCESS(ntStatus)) {
return ntStatus;
}
ntStatus = setDACChannels();
if (!NT_SUCCESS(ntStatus)) {
return ntStatus;
@ -988,12 +1004,12 @@ NTSTATUS CMiniportWaveStreamCMI::prepareStream()
NTSTATUS CMiniportWaveStreamCMI::setDACChannels()
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::setDACChannels()", this));
NTSTATUS ntStatus = STATUS_SUCCESS;
if (currentChannelCount > 2) {
if ((WORD) Miniport->cm->maxChannels < currentChannelCount ) {
if (Miniport->cm->maxChannels < currentChannelCount) {
return STATUS_INVALID_DEVICE_REQUEST;
}
if ((currentResolution != 16) || (currentChannelCount < 2)) {
@ -1052,11 +1068,9 @@ NTSTATUS CMiniportWaveStreamCMI::setDACChannels()
NTSTATUS CMiniportWaveStreamCMI::setupSPDIFPlayback(bool enableSPDIF)
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::setupSPDIFPlayback(%d)", this, enableSPDIF));
//NTSTATUS ntStatus;
KeWaitForSingleObject(&Miniport->mutex, Executive, KernelMode, false, NULL);
if (enableSPDIF) {
@ -1121,8 +1135,8 @@ NTSTATUS CMiniportWaveStreamCMI::setupSPDIFPlayback(bool enableSPDIF)
NTSTATUS CMiniportWaveStreamCMI::setupAC3Passthru()
{
//PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::setupAC3Passthru()"));
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::setupAC3Passthru() [enableAC3Passthru: %d]", this, enableAC3Passthru));
if (enableAC3Passthru) {
Miniport->CMIAdapter->writeUInt8(REG_MIXER1, Miniport->CMIAdapter->readUInt8(REG_MIXER1) | MUTE_WAVE);
@ -1155,7 +1169,9 @@ NTSTATUS CMiniportWaveStreamCMI::setupAC3Passthru()
}
}
} else {
Miniport->CMIAdapter->setUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
if (Miniport->cm->enableSPDIFInMonitor) {
Miniport->CMIAdapter->setUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
}
Miniport->CMIAdapter->clearUInt32Bit(REG_CHFORMAT, EN_SPDO_AC3_1);
Miniport->CMIAdapter->clearUInt32Bit(REG_MISCCTRL, EN_SPDO_AC3_2);
@ -1183,9 +1199,13 @@ NTSTATUS CMiniportWaveStreamCMI::setupAC3Passthru()
CMiniportWaveStreamCMI::~CMiniportWaveStreamCMI(void)
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::~CMiniportWaveStreamCMI", this));
DBGPRINT(("CMiniportWaveStreamCMI[%p]::~CMiniportWaveStreamCMI [streamIndex: %d]", this, streamIndex));
if (state != KSSTATE_STOP) {
SetState(KSSTATE_STOP);
}
#ifdef WAVERT
if (Port) {
@ -1218,13 +1238,13 @@ CMiniportWaveStreamCMI::~CMiniportWaveStreamCMI(void)
if (Miniport) {
Miniport->Release();
Miniport = NULL;
}
}
}
STDMETHODIMP CMiniportWaveStreamCMI::QueryInterface(REFIID Interface, PVOID *Object)
STDMETHODIMP CMiniportWaveStreamCMI::NonDelegatingQueryInterface(REFIID Interface, PVOID *Object)
{
//PAGED_CODE();
//ASSERT(Object);
PAGED_CODE();
ASSERT(Object);
DBGPRINT(("CMiniportWaveStreamCMI[%p]::NonDelegatingQueryInterface(%p, %p)", this, Interface, Object));
if (IsEqualGUIDAligned(Interface,IID_IUnknown)) {
@ -1256,14 +1276,14 @@ NTSTATUS CMiniportWaveStreamCMI::Init(CMiniportWaveCMI* Miniport_, UInt32 stream
NTSTATUS CMiniportWaveStreamCMI::Init(CMiniportWaveCMI* Miniport_, UInt32 streamIndex_, bool isCaptureStream_, PKSDATAFORMAT DataFormat, PDMACHANNEL DMAChannel_, PSERVICEGROUP* OutServiceGroup)
#endif
{
//PAGED_CODE();
//ASSERT(Miniport_);
//ASSERT(DataFormat);
PAGED_CODE();
ASSERT(Miniport_);
ASSERT(DataFormat);
NTSTATUS ntStatus;
#ifdef WAVERT
//ASSERT(Port_);
ASSERT(Port_);
DBGPRINT(("CMiniportWaveStreamCMI[%p]::Init(%p, %d, %d, %p, %p)", this, Miniport_, streamIndex_, isCaptureStream_, DataFormat, Port_));
Port = Port_;
Port->AddRef();
@ -1309,7 +1329,7 @@ NTSTATUS CMiniportWaveStreamCMI::Init(CMiniportWaveCMI* Miniport_, UInt32 stream
NTSTATUS CMiniportWaveStreamCMI::SetFormat(PKSDATAFORMAT Format)
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::SetFormat(%p)", this, Format));
PWAVEFORMATEX waveFormat = PWAVEFORMATEX(Format + 1);
NTSTATUS ntStatus = Miniport->validateFormat(Format, -1, isCaptureStream);
@ -1340,7 +1360,7 @@ NTSTATUS CMiniportWaveStreamCMI::SetFormat(PKSDATAFORMAT Format)
currentSampleRate = waveFormat->nSamplesPerSec;
currentChannelCount = waveFormat->nChannels;
currentResolution = waveFormat->wBitsPerSample;
enableAC3Passthru = (WAVE_FORMAT_DOLBY_AC3_SPDIF == EXTRACT_WAVEFORMATEX_ID(&Format->SubFormat));
enableAC3Passthru = (WAVE_FORMAT_DOLBY_AC3_SPDIF == EXTRACT_WAVEFORMATEX_ID(&Format->SubFormat)) || (WAVE_FORMAT_WMA_SPDIF == EXTRACT_WAVEFORMATEX_ID(&Format->SubFormat));
KeReleaseMutex(&Miniport->mutex, false);
ntStatus = prepareStream();
@ -1350,40 +1370,41 @@ NTSTATUS CMiniportWaveStreamCMI::SetFormat(PKSDATAFORMAT Format)
// DRM crap - we're supposed to disable every digital interface here
STDMETHODIMP_(NTSTATUS) CMiniportWaveStreamCMI::SetContentId(ULONG contentId, PCDRMRIGHTS drmRights)
{
//PAGED_CODE();
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::SetContentId(%d, %p)", this, contentId, drmRights));
return STATUS_SUCCESS;
}
#ifdef WAVERT
STDMETHODIMP_(NTSTATUS) CMiniportWaveStreamCMI::AllocateAudioBuffer(ULONG size, PMDL *userModeBuffer, ULONG *bufferSize, ULONG *bufferOffset, MEMORY_CACHING_TYPE *cacheType)
{
//PAGED_CODE();
PAGED_CODE();
PHYSICAL_ADDRESS low;
PHYSICAL_ADDRESS high;
DBGPRINT(("CMiniportWaveStreamCMI[%p]::AllocateAudioBuffer(%x, %p, %p, %p, %p)", this, size, userModeBuffer, bufferSize, bufferOffset, cacheType));
PHYSICAL_ADDRESS low;
PHYSICAL_ADDRESS high;
DBGPRINT(("CMiniportWaveStreamCMI[%p]::AllocateAudioBuffer(0x%x, %p, %p, %p, %p)", this, size, userModeBuffer, bufferSize, bufferOffset, cacheType));
if (size <= size % (currentChannelCount * 2)) {
return STATUS_UNSUCCESSFUL;
}
size -= size % (currentChannelCount * 2);
if (size == 0) {
return STATUS_UNSUCCESSFUL;
}
low.QuadPart = 0;
high.HighPart = 0, high.LowPart = MAXULONG;
audioBufferMDL = Port->AllocateContiguousPagesForMdl(low, high, size);
if (!audioBufferMDL) {
DBGPRINT(("AllocateContiguousPagesForMdl() failed"));
if (size <= size % (currentChannelCount * 2)) {
return STATUS_UNSUCCESSFUL;
}
size -= size % (currentChannelCount * 2);
if (size == 0) {
return STATUS_UNSUCCESSFUL;
}
low.HighPart = 0; low.LowPart = 0;
high.HighPart = 0; high.LowPart = MAXULONG;
if (size <= 4096) {
audioBufferMDL = Port->AllocatePagesForMdl(high, size);
} else {
audioBufferMDL = Port->AllocateContiguousPagesForMdl(low, high, size);
}
if (!audioBufferMDL) {
DBGPRINT(("AllocateContiguousPagesForMdl()/AllocatePagesForMdl() failed (size: 0x%x)", size));
return STATUS_INSUFFICIENT_RESOURCES;
}
dmaAddress = Port->GetPhysicalPageAddress(audioBufferMDL, 0).LowPart;
dmaMemorySize = size;
@ -1399,8 +1420,8 @@ STDMETHODIMP_(NTSTATUS) CMiniportWaveStreamCMI::AllocateAudioBuffer(ULONG size,
STDMETHODIMP_(VOID) CMiniportWaveStreamCMI::FreeAudioBuffer(PMDL Mdl, ULONG Size)
{
//PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::FreeAudioBuffer(%p, %x)", this, Mdl, Size));
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::FreeAudioBuffer(%p, %x)", this, Mdl, Size));
Port->FreePagesFromMdl(Mdl);
audioBufferMDL = NULL;
@ -1408,9 +1429,10 @@ STDMETHODIMP_(VOID) CMiniportWaveStreamCMI::FreeAudioBuffer(PMDL Mdl, ULONG Size
dmaMemorySize = 0;
}
STDMETHODIMP_(void) CMiniportWaveStreamCMI::GetHWLatency(PKSRTAUDIO_HWLATENCY hwLatency) {
//PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::GetHWLatency(%p)", this, hwLatency));
STDMETHODIMP_(void) CMiniportWaveStreamCMI::GetHWLatency(PKSRTAUDIO_HWLATENCY hwLatency)
{
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::GetHWLatency(%p)", this, hwLatency));
hwLatency->FifoSize = 32;
hwLatency->ChipsetDelay = 0;
hwLatency->CodecDelay = 4;
@ -1418,18 +1440,18 @@ STDMETHODIMP_(void) CMiniportWaveStreamCMI::GetHWLatency(PKSRTAUDIO_HWLATENCY hw
STDMETHODIMP_(NTSTATUS) CMiniportWaveStreamCMI::GetPositionRegister(PKSRTAUDIO_HWREGISTER hwRegister)
{
//PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::GetPositionRegister(%p)", this, hwRegister));
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::GetPositionRegister(%p)", this, hwRegister));
return STATUS_UNSUCCESSFUL;
return STATUS_UNSUCCESSFUL;
}
STDMETHODIMP_(NTSTATUS) CMiniportWaveStreamCMI::GetClockRegister(PKSRTAUDIO_HWREGISTER hwRegister)
{
//PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::GetClockRegister(%p)", this, hwRegister));
PAGED_CODE();
DBGPRINT(("CMiniportWaveStreamCMI[%p]::GetClockRegister(%p)", this, hwRegister));
return STATUS_UNSUCCESSFUL;
return STATUS_UNSUCCESSFUL;
}
#endif // WAVERT
@ -1438,12 +1460,12 @@ STDMETHODIMP_(NTSTATUS) CMiniportWaveStreamCMI::GetClockRegister(PKSRTAUDIO_HWRE
** non-paged code below
*/
#ifdef _MSC_VER
#pragma code_seg() /* warning - ignored by GCC compiler */
#pragma code_seg()
#endif
STDMETHODIMP CMiniportWaveStreamCMI::SetState(KSSTATE NewState)
{
DBGPRINT(("CMiniportWaveStreamCMI[%p]::SetState(%d)", this, NewState));
DBGPRINT(("CMiniportWaveStreamCMI[%p]::SetState(%d) [streamIndex: %d, channelNumber: %d]", this, NewState, streamIndex, channelNumber));
UInt32 inthld, chen, reset, pause;
UInt8 reg;
@ -1466,9 +1488,7 @@ STDMETHODIMP CMiniportWaveStreamCMI::SetState(KSSTATE NewState)
// STOP -> ACQUIRE -> PAUSE -> PLAY -> PAUSE -> ACQUIRE -> STOP
if (state != NewState) {
switch ((UINT) NewState) {
// LN: The cast on NewState is to satisfy the compiler about
// KSSTATE_STOP_AC3, which is not in the original enum KSSTATE.
switch (NewState) {
case KSSTATE_ACQUIRE:
DBGPRINT(("---KSSTATE_ACQUIRE: previous state: %d", state));
if (state == KSSTATE_PAUSE) {
@ -1483,13 +1503,12 @@ STDMETHODIMP CMiniportWaveStreamCMI::SetState(KSSTATE NewState)
periodSize = dmaSize;
DBGPRINT(("---dmaAddress: %x, dmaMemorySize: %x, dmaSize: %x", dmaAddress, dmaMemorySize, dmaSize));
#else
if (currentResolution == 24) {
dmaSize = (DMAChannel->BufferSize() / (2 * (24 >> 3)) );
if (currentResolution == 32) {
dmaSize = (DMAChannel->BufferSize() / (2 * (32 >> 3)) );
} else {
dmaSize = (DMAChannel->BufferSize() / (2 * (currentResolution >> 3)) );
}
#endif
DBGPRINT(("---streamIndex: %d, channelNumber: %d", streamIndex, channelNumber));
DBGPRINT(("---SampleRate: %d, Resolution: %d, Channels: %d", currentSampleRate, currentResolution, currentChannelCount));
if (periodSize > dmaSize) {
@ -1503,18 +1522,27 @@ STDMETHODIMP CMiniportWaveStreamCMI::SetState(KSSTATE NewState)
Miniport->CMIAdapter->writeUInt32(reg, dmaAddress);
#else
Miniport->CMIAdapter->writeUInt32(reg, DMAChannel->PhysicalAddress().u.LowPart);
DBGPRINT(("---DMA Address: HighPart: 0x%08X LowPart: 0x%08X", DMAChannel->PhysicalAddress().u.HighPart, DMAChannel->PhysicalAddress().u.LowPart));
#endif
// count of samples
reg = channelNumber ? REG_CH1_FRAME2 : REG_CH0_FRAME2;
Miniport->CMIAdapter->writeUInt16(reg, dmaSize-1);
Miniport->CMIAdapter->writeUInt16(reg + 2, periodSize-1);
DBGPRINT(("---DMA Size: 0x%04X, Period Size: 0x%04X, enableSPDIFIn: %d", dmaSize, periodSize, Miniport->cm->enableSPDIFIn));
if (isCaptureStream && (Miniport->cm->enableSPDIFIn)) {
if (isCaptureStream) {
if (Miniport->cm->enableSPDIFIn) {
#if OUT_CHANNEL==0
Miniport->CMIAdapter->setUInt32Bit(REG_FUNCTRL1, SPDF_1);
Miniport->CMIAdapter->setUInt32Bit(REG_FUNCTRL1, SPDF_1);
#else
Miniport->CMIAdapter->setUInt32Bit(REG_FUNCTRL1, SPDF_0);
Miniport->CMIAdapter->setUInt32Bit(REG_FUNCTRL1, SPDF_0);
#endif
} else {
#if OUT_CHANNEL==0
Miniport->CMIAdapter->clearUInt32Bit(REG_FUNCTRL1, SPDF_1);
#else
Miniport->CMIAdapter->clearUInt32Bit(REG_FUNCTRL1, SPDF_0);
#endif
}
}
KeReleaseMutex(&Miniport->mutex, false);
break;
@ -1586,37 +1614,39 @@ STDMETHODIMP CMiniportWaveStreamCMI::SetState(KSSTATE NewState)
}
#ifdef WAVERT
STDMETHODIMP CMiniportWaveStreamCMI::GetPosition(PKSAUDIO_POSITION Position)
{
//ASSERT(Position);
ASSERT(Position);
UInt32 reg;
if ((state == KSSTATE_RUN) && (dmaAddress)) {
reg = (channelNumber) ? REG_CH1_FRAME1 : REG_CH0_FRAME1;
Position->PlayOffset = Miniport->CMIAdapter->readUInt32(reg) - dmaAddress;
Position->WriteOffset = Position->PlayOffset + currentChannelCount * 2 * 8;
Position->WriteOffset = Position->PlayOffset + currentChannelCount * 2 * 8;
} else {
Position->PlayOffset = 0;
Position->WriteOffset = 0;
Position->PlayOffset = 0;
Position->WriteOffset = 0;
}
return STATUS_SUCCESS;
}
#else //WaveCyclic
STDMETHODIMP CMiniportWaveStreamCMI::GetPosition(PULONG Position)
{
//ASSERT(Position);
ASSERT(Position);
UInt32 reg;
if ((DMAChannel) && (state == KSSTATE_RUN)) {
#if 0
// this implementation messes with SPDIF-in recording
reg = (channelNumber) ? REG_CH1_FRAME2 : REG_CH0_FRAME2;
*Position = dmaSize - (Miniport->CMIAdapter->readUInt16(reg)-1);
*Position *= 2 * (currentResolution >> 3);
reg = (channelNumber) ? REG_CH1_FRAME2 : REG_CH0_FRAME2;
*Position = dmaSize - (Miniport->CMIAdapter->readUInt16(reg)-1);
*Position *= 2 * (currentResolution >> 3);
#else
reg = (channelNumber) ? REG_CH1_FRAME1 : REG_CH0_FRAME1;
*Position = Miniport->CMIAdapter->readUInt32(reg);
@ -1640,8 +1670,10 @@ STDMETHODIMP_(ULONG) CMiniportWaveStreamCMI::SetNotificationFreq(ULONG Interval,
if (state == KSSTATE_RUN) {
return 0;
}
periodSize = Interval * currentSampleRate/1000;
*FramingSize = periodSize*currentChannelCount*(currentResolution >> 3);
// periodSize [sample] = interval [ms] * sample rate [Hz] * 1e-3 [milli]
periodSize = Interval * currentSampleRate / 1000;
// FramingSize [byte] = periodSize [sample] * #Channels * resolution [byte];
*FramingSize = periodSize * currentChannelCount * (currentResolution >> 3);
KeWaitForSingleObject(&Miniport->mutex, Executive, KernelMode, FALSE, NULL);
Miniport->CMIAdapter->writeUInt16((channelNumber ? REG_CH1_FRAME2 : REG_CH0_FRAME2) + 2, periodSize-1);
@ -1651,9 +1683,10 @@ STDMETHODIMP_(ULONG) CMiniportWaveStreamCMI::SetNotificationFreq(ULONG Interval,
return Interval;
}
STDMETHODIMP CMiniportWaveStreamCMI::NormalizePhysicalPosition(OUT PLONGLONG PhysicalPosition)
STDMETHODIMP CMiniportWaveStreamCMI::NormalizePhysicalPosition(PLONGLONG PhysicalPosition)
{
*PhysicalPosition = (_100NS_UNITS_PER_SECOND / currentChannelCount * (currentResolution >> 3) * *PhysicalPosition) / currentSampleRate;
// time_pos [ns] = byte_pos [byte] / (1e-9 [nano] * #Channels * resolution [byte] * sample rate [Hz])
*PhysicalPosition = (*PhysicalPosition * 10000000L) / (currentChannelCount * (currentResolution >> 3) * currentSampleRate);
return STATUS_SUCCESS;
}

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -41,7 +41,8 @@ class CMiniportWaveCMI:
#else
public IMiniportWaveCyclic,
#endif
public IMiniportWaveCMI
public IMiniportWaveCMI,
public CUnknown
{
private:
PCMIADAPTER CMIAdapter; // Adapter common object.
@ -55,7 +56,7 @@ private:
CMI8738Info *cm;
UInt32 requestedChannelCount;
UInt32 requestedChannelMask;
LONG m_Ref;
CMiniportWaveStreamCMI *stream[3];
bool isStreamRunning[3];
@ -71,24 +72,8 @@ private:
NTSTATUS loadChannelConfigFromRegistry();
NTSTATUS storeChannelConfigToRegistry();
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
STDMETHODIMP_(ULONG) AddRef()
{
InterlockedIncrement(&m_Ref);
return m_Ref;
}
STDMETHODIMP_(ULONG) Release()
{
InterlockedDecrement(&m_Ref);
if (!m_Ref)
{
delete this;
return 0;
}
return m_Ref;
}
CMiniportWaveCMI(IUnknown * OuterUnknown){}
DECLARE_STD_UNKNOWN();
DEFINE_STD_CONSTRUCTOR(CMiniportWaveCMI);
~CMiniportWaveCMI();
#ifdef WAVERT
IMP_IMiniportWaveRT;
@ -111,7 +96,8 @@ class CMiniportWaveStreamCMI:
#else
public IMiniportWaveCyclicStream,
#endif
public IDrmAudioStream
public IDrmAudioStream,
public CUnknown
{
private:
CMiniportWaveCMI *Miniport;
@ -133,7 +119,6 @@ private:
UInt32 dmaSize; // size of the DMA buffer in frames, NOT in bytes
UInt32 currentChannelCount, currentSampleRate, currentResolution;
bool enableAC3Passthru, enableSPDIF;
LONG m_Ref;
NTSTATUS prepareStream();
NTSTATUS setDACChannels();
@ -141,24 +126,8 @@ private:
NTSTATUS setupAC3Passthru();
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
STDMETHODIMP_(ULONG) AddRef()
{
InterlockedIncrement(&m_Ref);
return m_Ref;
}
STDMETHODIMP_(ULONG) Release()
{
InterlockedDecrement(&m_Ref);
if (!m_Ref)
{
delete this;
return 0;
}
return m_Ref;
}
CMiniportWaveStreamCMI(IUnknown * OuterUnknown){}
DECLARE_STD_UNKNOWN();
DEFINE_STD_CONSTRUCTOR(CMiniportWaveStreamCMI);
~CMiniportWaveStreamCMI();
#ifdef WAVERT
IMP_IMiniportWaveRTStream;

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -28,26 +28,29 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _MINWAVETABLES_HPP_
#define _MINWAVETABLES_HPP_
#define STATIC_KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF\
DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_DOLBY_AC3_SPDIF)
#define STATIC_KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_DOLBY_AC3_SPDIF)
DEFINE_GUIDSTRUCT("00000092-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF);
#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)
/* Warning - Recursive #define for KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF */
#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)
NTSTATUS NTAPI PropertyHandler_ChannelConfig(PPCPROPERTY_REQUEST PropertyRequest);
#define WAVE_FORMAT_WMA_SPDIF 0x164
#define STATIC_KSDATAFORMAT_SUBTYPE_WMA_SPDIF DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_WMA_SPDIF)
DEFINE_GUIDSTRUCT("00000164-0000-0010-8000-00aa00389b71", KSDATAFORMAT_SUBTYPE_WMA_SPDIF);
#define KSDATAFORMAT_SUBTYPE_WMA_SPDIF DEFINE_GUIDNAMED(KSDATAFORMAT_SUBTYPE_WMA_SPDIF)
static KSDATARANGE_AUDIO WavePinDataRangesPCMStream[] =
{
{
{{
sizeof(KSDATARANGE_AUDIO),
0,
0,
0,
{ STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
{ STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM) },
{ STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }
}},
{
{
sizeof(KSDATARANGE_AUDIO),
0,
0,
0,
{STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM)},
{STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)}
}
},
MAX_CHANNELS_PCM,
MIN_BITS_PER_SAMPLE_PCM,
MAX_BITS_PER_SAMPLE_PCM,
@ -59,15 +62,17 @@ static KSDATARANGE_AUDIO WavePinDataRangesPCMStream[] =
static KSDATARANGE_AUDIO WavePinDataRangesAC3Stream[] =
{
{
{{
sizeof(KSDATARANGE_AUDIO),
0,
0,
0,
{ STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
{ STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF) },
{ STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX) }
}},
{
{
sizeof(KSDATARANGE_AUDIO),
0,
0,
0,
{STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)},
{STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)}
}
},
MAX_CHANNELS_AC3,
MIN_BITS_PER_SAMPLE_AC3,
MAX_BITS_PER_SAMPLE_AC3,
@ -75,20 +80,58 @@ static KSDATARANGE_AUDIO WavePinDataRangesAC3Stream[] =
MAX_SAMPLE_RATE_AC3
},
{
{{
sizeof(KSDATARANGE_AUDIO),
0,
0,
0,
{ STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
{ STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF) },
{ STATICGUIDOF(KSDATAFORMAT_SPECIFIER_DSOUND) }
}},
{
{
sizeof(KSDATARANGE_AUDIO),
0,
0,
0,
{STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF)},
{STATICGUIDOF(KSDATAFORMAT_SPECIFIER_DSOUND)}
}
},
MAX_CHANNELS_AC3,
MIN_BITS_PER_SAMPLE_AC3,
MAX_BITS_PER_SAMPLE_AC3,
MIN_SAMPLE_RATE_AC3,
MAX_SAMPLE_RATE_AC3
},
{
{
{
sizeof(KSDATARANGE_AUDIO),
0,
0,
0,
{STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SUBTYPE_WMA_SPDIF)},
{STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)}
}
},
MAX_CHANNELS_WMA,
MIN_BITS_PER_SAMPLE_WMA,
MAX_BITS_PER_SAMPLE_WMA,
MIN_SAMPLE_RATE_WMA,
MIN_SAMPLE_RATE_WMA
},
{
{
{
sizeof(KSDATARANGE_AUDIO),
0,
0,
0,
{STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SUBTYPE_WMA_SPDIF)},
{STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)}
}
},
MAX_CHANNELS_WMA,
MIN_BITS_PER_SAMPLE_WMA,
MAX_BITS_PER_SAMPLE_WMA,
MAX_SAMPLE_RATE_WMA,
MAX_SAMPLE_RATE_WMA
}
};
@ -101,34 +144,40 @@ static PKSDATARANGE WavePinDataRangePointersAC3Stream[] =
{
PKSDATARANGE(&WavePinDataRangesAC3Stream[0]),
PKSDATARANGE(&WavePinDataRangesAC3Stream[1]),
PKSDATARANGE(&WavePinDataRangesAC3Stream[2]),
PKSDATARANGE(&WavePinDataRangesAC3Stream[3]),
};
static KSDATARANGE WavePinDataRangesPCMBridge[] =
{
{{
sizeof(KSDATARANGE),
0,
0,
0,
{ STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
{ STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG) },
{ STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) }
}}
{
{
sizeof(KSDATARANGE),
0,
0,
0,
{STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG)},
{STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)}
}
}
};
static KSDATARANGE WavePinDataRangesAC3Bridge[] =
{
{{
sizeof(KSDATARANGE),
0,
0,
0,
{ STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO) },
{ STATICGUIDOF(KSDATAFORMAT_SUBTYPE_AC3_AUDIO) },
{ STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE) }
}}
{
{
sizeof(KSDATARANGE),
0,
0,
0,
{STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SUBTYPE_AC3_AUDIO)},
{STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)}
}
}
};
static PKSDATARANGE WavePinDataRangePointersPCMBridge[] =
@ -160,7 +209,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
KSPIN_COMMUNICATION_SINK,
&KSCATEGORY_AUDIO,
&KSAUDFNAME_RECORDING_CONTROL,
{ 0 }
{0}
}
},
@ -181,7 +230,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
KSPIN_COMMUNICATION_NONE,
&KSCATEGORY_AUDIO,
NULL,
{ 0 }
{0}
}
},
@ -202,7 +251,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
KSPIN_COMMUNICATION_SINK,
&KSCATEGORY_AUDIO,
&KSAUDFNAME_VOLUME_CONTROL,
{ 0 }
{0}
}
},
@ -223,7 +272,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
KSPIN_COMMUNICATION_NONE,
&KSNODETYPE_SPEAKER,
NULL,
{ 0 }
{0}
}
},
@ -244,7 +293,7 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
KSPIN_COMMUNICATION_SINK,
&KSCATEGORY_AUDIO,
NULL,
{ 0 }
{0}
}
},
@ -266,18 +315,20 @@ static PCPIN_DESCRIPTOR WaveMiniportPins[] =
KSPIN_COMMUNICATION_NONE,
&KSNODETYPE_SPDIF_INTERFACE,
NULL,
{ 0 }
{0}
}
}
};
NTSTATUS NTAPI PropertyHandler_ChannelConfig(PPCPROPERTY_REQUEST PropertyRequest);
static PCPROPERTY_ITEM PropertiesChannels[] =
{
{
&KSPROPSETID_Audio,
KSPROPERTY_AUDIO_CHANNEL_CONFIG,
KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET | KSPROPERTY_TYPE_SET,
(PCPFNPROPERTY_HANDLER)PropertyHandler_ChannelConfig
PropertyHandler_ChannelConfig
}
};
DEFINE_PCAUTOMATION_TABLE_PROP(AutomationChans,PropertiesChannels);

View file

@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2007 dogbert <dogber1@gmail.com>
Copyright (c) 2006-2008 dogbert <dogber1@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -25,17 +25,16 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#ifndef _PROPERTY_H_
#define _PROPERTY_H_
//GUID for the private property
// {2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFF}
#define STATIC_KSPROPSETID_CMI \
0x2B81CDBB, 0xEE6C, 0x4ECC, 0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFF
0x2B81CDBB, 0xEE6C, 0x4ECC, {0x8A, 0xA5, 0x9A, 0x18, 0x8B, 0x02, 0x3D, 0xFF}
DEFINE_GUIDSTRUCT("2B81CDBB-EE6C-4ECC-8AA5-9A188B023DFF", KSPROPSETID_CMI);
#define KSPROPSETID_CMI DEFINE_GUIDNAMED(KSPROPSETID_CMI)
//methods
#define KSPROPERTY_CMI_GET 1
#define KSPROPERTY_CMI_SET 2
@ -67,7 +66,7 @@ typedef struct
UInt16 IOBase;
UInt16 MPUBase;
UInt32 maxChannels;
UInt32 enablePCMDAC;
UInt32 enableSPDIMonitor;
UInt32 exchangeFrontBack;
UInt32 enableBass2Line;
UInt32 enableCenter2Line;
@ -83,3 +82,5 @@ typedef struct
UInt32 formatMask;
UInt32 enableSPDI;
} CMIDATA;
#endif //_PROPERTY_H_