ReactOS  0.4.15-dev-1384-g878186b
CCMITopology Class Reference

#include <mintopo.hpp>

Inheritance diagram for CCMITopology:
Collaboration diagram for CCMITopology:

Public Member Functions

 DECLARE_STD_UNKNOWN ()
 
 DEFINE_STD_CONSTRUCTOR (CCMITopology)
 
 ~CCMITopology ()
 
 STDMETHODIMP_ (NTSTATUS) loadMixerSettingsFromRegistry()
 
 STDMETHODIMP_ (NTSTATUS) storeMixerSettingsToRegistry()
 
 STDMETHODIMP_ (NTSTATUS) loadMixerSettingsFromMemory()
 
 STDMETHODIMP_ (NTSTATUS) storeMixerSettingsToMemory()
 
 STDMETHODIMP_ (NTSTATUS) GetDescription(OUT PPCFILTER_DESCRIPTOR *OutFilterDescriptor)
 
 STDMETHODIMP_ (NTSTATUS) DataRangeIntersection(IN ULONG PinId
 
 STDMETHODIMP_ (NTSTATUS) Init(IN PUNKNOWN UnknownAdapter
 

Static Public Member Functions

static NTSTATUS EventHandler (PPCEVENT_REQUEST EventRequest)
 

Public Attributes

IN PKSDATARANGE DataRange
 
IN PKSDATARANGE IN PKSDATARANGE MatchingDataRange
 
IN PKSDATARANGE IN PKSDATARANGE IN ULONG OutputBufferLength
 
IN PKSDATARANGE IN PKSDATARANGE IN ULONG OUT PVOID ResultantFormat OPTIONAL
 
IN PKSDATARANGE IN PKSDATARANGE IN ULONG OUT PVOID ResultantFormat OUT PULONG ResultantFormatLength
 
IN PRESOURCELIST ResourceList
 
IN PRESOURCELIST IN PPORTTOPOLOGY Port
 
- Public Attributes inherited from CUnknown
union {
   IUnknown   IUnknown
 
   INonDelegatingUnknown   INonDelegatingUnknown
 
}; 
 
LONG m_ref_count
 
PUNKNOWN m_outer_unknown
 

Private Member Functions

NTSTATUS ProcessResources (PRESOURCELIST ResourceList)
 

Private Attributes

PCMIADAPTER CMIAdapter
 
CMI8738Infocm
 
UInt8 auxVolumeRegister
 
UInt8 micVolumeRegister
 
UInt8 mixer1Register
 
UInt8 mixer4Register
 
UInt32 functrl1Register
 
UInt32 chformatRegister
 
UInt32 legacyRegister
 
UInt32 miscctrlRegister
 
UInt32 NodeCache [2 *KSNODE_TOPO_INVALID]
 
UInt32 masterMuteDummy
 
BOOLEAN settingsLoaded
 

Friends

NTSTATUS NTAPI PropertyHandler_OnOff (PPCPROPERTY_REQUEST PropertyRequest)
 
NTSTATUS NTAPI PropertyHandler_Level (PPCPROPERTY_REQUEST PropertyRequest)
 
NTSTATUS NTAPI PropertyHandler_CpuResources (PPCPROPERTY_REQUEST PropertyRequest)
 
NTSTATUS NTAPI PropertyHandler_ComponentId (PPCPROPERTY_REQUEST PropertyRequest)
 
NTSTATUS NTAPI PropertyHandler_Private (PPCPROPERTY_REQUEST PropertyRequest)
 
NTSTATUS NTAPI PropertyHandler_Mux (PPCPROPERTY_REQUEST PropertyRequest)
 

Detailed Description

Definition at line 34 of file mintopo.hpp.

Constructor & Destructor Documentation

◆ ~CCMITopology()

CCMITopology::~CCMITopology ( )

Definition at line 71 of file mintopo.cpp.

72 {
73  PAGED_CODE();
74 
75  DBGPRINT(("CCMITopology::~CCMITopology"));
76 
77  storeMixerSettingsToRegistry(); //or not. during system shutdown, this doesn't seem to work.
78  cm->TopoMiniport = NULL;
79 
80  if (CMIAdapter) {
81  CMIAdapter->Release();
82  }
83 }
PCMIADAPTER CMIAdapter
Definition: mintopo.hpp:38
#define DBGPRINT(...)
Definition: pdo.c:21
PCMITOPOLOGY TopoMiniport
Definition: interfaces.hpp:144
CMI8738Info * cm
Definition: mintopo.hpp:39
#define NULL
Definition: types.h:112
#define PAGED_CODE()

Member Function Documentation

◆ DECLARE_STD_UNKNOWN()

CCMITopology::DECLARE_STD_UNKNOWN ( )

◆ DEFINE_STD_CONSTRUCTOR()

CCMITopology::DEFINE_STD_CONSTRUCTOR ( CCMITopology  )

◆ EventHandler()

static NTSTATUS CCMITopology::EventHandler ( PPCEVENT_REQUEST  EventRequest)
static

◆ ProcessResources()

NTSTATUS CCMITopology::ProcessResources ( PRESOURCELIST  ResourceList)
private

◆ STDMETHODIMP_() [1/7]

CCMITopology::STDMETHODIMP_ ( NTSTATUS  )

◆ STDMETHODIMP_() [2/7]

CCMITopology::STDMETHODIMP_ ( NTSTATUS  )

◆ STDMETHODIMP_() [3/7]

CCMITopology::STDMETHODIMP_ ( NTSTATUS  )

◆ STDMETHODIMP_() [4/7]

CCMITopology::STDMETHODIMP_ ( NTSTATUS  )

◆ STDMETHODIMP_() [5/7]

CCMITopology::STDMETHODIMP_ ( NTSTATUS  )

◆ STDMETHODIMP_() [6/7]

CCMITopology::STDMETHODIMP_ ( NTSTATUS  )

◆ STDMETHODIMP_() [7/7]

CCMITopology::STDMETHODIMP_ ( NTSTATUS  )

Friends And Related Function Documentation

◆ PropertyHandler_ComponentId

NTSTATUS NTAPI PropertyHandler_ComponentId ( PPCPROPERTY_REQUEST  PropertyRequest)
friend

Definition at line 1291 of file mintopo.cpp.

1292 {
1293  PAGED_CODE();
1294  ASSERT(PropertyRequest);
1295  DBGPRINT(("[PropertyHandler_ComponentId]"));
1296 
1298  CCMITopology *that = (CCMITopology *) ((PMINIPORTTOPOLOGY) PropertyRequest->MajorTarget);
1299 
1300  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
1301  if (PropertyRequest->ValueSize >= sizeof(KSCOMPONENTID)) {
1302  PKSCOMPONENTID pComponentId = (PKSCOMPONENTID)PropertyRequest->Value;
1303 
1304  pComponentId->Manufacturer = MANUFACTURER_CM8738;
1305  pComponentId->Product = PRODUCT_CM8738;
1306  pComponentId->Component = COMPONENT_CM8738;
1307  pComponentId->Name = GUID_NULL;
1308  pComponentId->Version = CMIPCI_VERSION;
1309  pComponentId->Revision = that->cm->chipVersion;
1310 
1311  PropertyRequest->ValueSize = sizeof(KSCOMPONENTID);
1312  ntStatus = STATUS_SUCCESS;
1313  } else if (PropertyRequest->ValueSize == 0) {
1314  PropertyRequest->ValueSize = sizeof(KSCOMPONENTID);
1315  ntStatus = STATUS_BUFFER_OVERFLOW;
1316  } else {
1317  PropertyRequest->ValueSize = 0;
1318  ntStatus = STATUS_BUFFER_TOO_SMALL;
1319  }
1320  } else if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) {
1321  if (PropertyRequest->ValueSize >= sizeof(ULONG)) {
1322  PULONG AccessFlags = PULONG(PropertyRequest->Value);
1323 
1325 
1326  PropertyRequest->ValueSize = sizeof(ULONG);
1327  ntStatus = STATUS_SUCCESS;
1328  } else {
1329  PropertyRequest->ValueSize = 0;
1330  ntStatus = STATUS_BUFFER_TOO_SMALL;
1331  }
1332  }
1333 
1334  return ntStatus;
1335 }
struct KSCOMPONENTID * PKSCOMPONENTID
#define DBGPRINT(...)
Definition: pdo.c:21
IMiniportTopology * PMINIPORTTOPOLOGY
Definition: portcls.h:1431
GUID Component
Definition: ks.h:1466
GUID Name
Definition: ks.h:1467
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
ULONG Revision
Definition: ks.h:1469
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
ULONG Version
Definition: ks.h:1468
#define PRODUCT_CM8738
Definition: interfaces.hpp:277
#define KSPROPERTY_TYPE_BASICSUPPORT
Definition: dmksctrl.h:45
GUID Product
Definition: ks.h:1465
#define ASSERT(a)
Definition: mode.c:45
#define MANUFACTURER_CM8738
Definition: interfaces.hpp:289
#define GUID_NULL
Definition: ks.h:106
PUNKNOWN MajorTarget
Definition: portcls.h:258
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define COMPONENT_CM8738
Definition: interfaces.hpp:283
CMI8738Info * cm
Definition: mintopo.hpp:39
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
GUID Manufacturer
Definition: ks.h:1464
#define CMIPCI_VERSION
Definition: interfaces.hpp:292
#define PAGED_CODE()

◆ PropertyHandler_CpuResources

NTSTATUS NTAPI PropertyHandler_CpuResources ( PPCPROPERTY_REQUEST  PropertyRequest)
friend

Definition at line 1239 of file mintopo.cpp.

1240 {
1241  PAGED_CODE();
1242  ASSERT(PropertyRequest);
1243  DBGPRINT(("[PropertyHandler_CpuResources]"));
1244 
1246 
1247  if (PropertyRequest->Node == (ULONG)-1) {
1248  return ntStatus;
1249  }
1250  if (PropertyRequest->Node >= KSNODE_TOPO_INVALID) {
1251  return ntStatus;
1252  }
1253 
1254  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
1255  if (PropertyRequest->ValueSize >= sizeof(LONG)) {
1256  *((PLONG)PropertyRequest->Value) = KSAUDIO_CPU_RESOURCES_NOT_HOST_CPU;
1257 
1258  PropertyRequest->ValueSize = sizeof(LONG);
1259  ntStatus = STATUS_SUCCESS;
1260  } else {
1261  ntStatus = STATUS_BUFFER_TOO_SMALL;
1262  }
1263  } else if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) {
1264  if (PropertyRequest->ValueSize >= (sizeof(KSPROPERTY_DESCRIPTION))) {
1265  PKSPROPERTY_DESCRIPTION PropDesc = PKSPROPERTY_DESCRIPTION(PropertyRequest->Value);
1266 
1269  PropDesc->DescriptionSize = sizeof(KSPROPERTY_DESCRIPTION);
1271  PropDesc->PropTypeSet.Id = VT_I4;
1272  PropDesc->PropTypeSet.Flags = 0;
1273  PropDesc->MembersListCount = 0;
1274  PropDesc->Reserved = 0;
1275 
1276  PropertyRequest->ValueSize = sizeof(KSPROPERTY_DESCRIPTION);
1277  ntStatus = STATUS_SUCCESS;
1278  } else if (PropertyRequest->ValueSize >= sizeof(ULONG)) {
1279  PULONG AccessFlags = PULONG(PropertyRequest->Value);
1280 
1282 
1283  PropertyRequest->ValueSize = sizeof(ULONG);
1284  ntStatus = STATUS_SUCCESS;
1285  }
1286  }
1287 
1288  return ntStatus;
1289 }
#define DBGPRINT(...)
Definition: pdo.c:21
Definition: compat.h:2157
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
const GUID KSPROPTYPESETID_General
Definition: property.c:17
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define KSAUDIO_CPU_RESOURCES_NOT_HOST_CPU
Definition: ksmedia.h:1098
GUID Set
Definition: dmksctrl.h:76
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
long LONG
Definition: pedump.c:60
KSIDENTIFIER PropTypeSet
Definition: ks.h:1541
#define KSPROPERTY_TYPE_BASICSUPPORT
Definition: dmksctrl.h:45
ULONG DescriptionSize
Definition: ks.h:1540
#define ASSERT(a)
Definition: mode.c:45
ULONG Id
Definition: dmksctrl.h:77
ULONG Flags
Definition: dmksctrl.h:78
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG MembersListCount
Definition: ks.h:1542
signed int * PLONG
Definition: retypes.h:5
struct KSPROPERTY_DESCRIPTION * PKSPROPERTY_DESCRIPTION
#define PAGED_CODE()

◆ PropertyHandler_Level

NTSTATUS NTAPI PropertyHandler_Level ( PPCPROPERTY_REQUEST  PropertyRequest)
friend

Definition at line 1101 of file mintopo.cpp.

1102 {
1103  PAGED_CODE();
1104  ASSERT(PropertyRequest);
1105  DBGPRINT(("[PropertyHandler_Level]"));
1106 
1107  CCMITopology *that = (CCMITopology *) ((PMINIPORTTOPOLOGY) PropertyRequest->MajorTarget);
1109  UInt32 channel;
1110  UInt8 mixerValue;
1111 
1112  if ((PropertyRequest->Node == ULONG(-1)) || (PropertyRequest->Node >= KSNODE_TOPO_INVALID) || (PropertyRequest->PropertyItem->Id != KSPROPERTY_AUDIO_VOLUMELEVEL)) {
1113  return ntStatus;
1114  }
1115 
1116  if ( ((PropertyRequest->Verb & KSPROPERTY_TYPE_GET) || (PropertyRequest->Verb & KSPROPERTY_TYPE_SET)) && (PropertyRequest->InstanceSize >= sizeof(LONG)) ) {
1117 
1118  channel = *(PLONG(PropertyRequest->Instance));
1119 
1120  if ((PropertyRequest->Node == KSNODE_TOPO_MICOUT_VOLUME) && (channel != CHAN_LEFT)) {
1121  return STATUS_INVALID_PARAMETER;
1122  }
1123 
1124  if ( ( (channel == CHAN_LEFT) || (channel == CHAN_RIGHT) ) && (PropertyRequest->ValueSize >= sizeof(LONG))) {
1125 
1126  PLONG Level = (PLONG)PropertyRequest->Value;
1127 
1128  for (unsigned int i=0;i<SIZEOF_ARRAY(VolTable);i++)
1129  {
1130  if (VolTable[i].node == PropertyRequest->Node) {
1131  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
1132 
1133  mixerValue = (that->CMIAdapter->readMixer(VolTable[i].reg+channel) >> VolTable[i].shift) & VolTable[i].mask;
1134  *Level = that->NodeCache[(2*PropertyRequest->Node)+channel];
1135 
1136  if (mixerValue != ((*Level >> (VolTable[i].dbshift+16))+VolTable[i].mask)) {
1137  *Level = (mixerValue - VolTable[i].mask) << (16+VolTable[i].dbshift);
1138  that->NodeCache[(2*PropertyRequest->Node)+channel] = *Level;
1139  }
1140  } else
1141  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
1142  if (*Level <= (VolTable[i].min << 16)) {
1143  mixerValue = 0;
1144  that->NodeCache[(2*PropertyRequest->Node)+channel] = VolTable[i].min << 16;
1145  } else
1146  if (*Level >= (VolTable[i].max << 16)) {
1147  mixerValue = VolTable[i].mask;
1148  that->NodeCache[(2*PropertyRequest->Node)+channel] = VolTable[i].max << 16;
1149  } else {
1150  mixerValue = ((*Level >> (VolTable[i].dbshift+16)) + VolTable[i].mask) & VolTable[i].mask;
1151  that->NodeCache[(2*PropertyRequest->Node)+channel] = *Level;
1152  }
1153  that->CMIAdapter->writeMixer(VolTable[i].reg+channel, mixerValue << VolTable[i].shift);
1154  }
1155  ntStatus = STATUS_SUCCESS;
1156  }
1157  }
1158  if (PropertyRequest->Node == KSNODE_TOPO_AUX_VOLUME) {
1159  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
1160  mixerValue = that->auxVolumeRegister;
1161  *Level = that->NodeCache[(2*PropertyRequest->Node)+channel];
1162  if (channel == CHAN_LEFT) {
1163  mixerValue >>= 4;
1164  }
1165  mixerValue &= 0x0F;
1166  if (mixerValue != ((*Level >> 18)+0x0F)) {
1167  *Level = (mixerValue - 0x0F) << 18;
1168  that->NodeCache[(2*PropertyRequest->Node)+channel] = *Level;
1169  }
1170  } else
1171  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
1172  if (*Level <= (-30 << 16)) {
1173  mixerValue = 0;
1174  that->NodeCache[(2*PropertyRequest->Node)+channel] = -30 << 16;
1175  } else
1176  if (*Level >= 0) {
1177  mixerValue = 0x0F;
1178  that->NodeCache[(2*PropertyRequest->Node)+channel] = 0;
1179  } else {
1180  mixerValue = ((*Level >> 18) + 0x0F) & 0x0F;
1181  that->NodeCache[(2*PropertyRequest->Node)+channel] = *Level;
1182  }
1183 
1184  if (channel == CHAN_RIGHT) {
1185  that->auxVolumeRegister = (that->auxVolumeRegister & 0xF0) | mixerValue;
1186  } else if (channel == CHAN_LEFT) {
1187  that->auxVolumeRegister = (that->auxVolumeRegister & 0x0F) | (mixerValue << 4);
1188  }
1189  that->CMIAdapter->writeUInt8(REG_MIXER3, that->auxVolumeRegister);
1190  }
1191  ntStatus = STATUS_SUCCESS;
1192  }
1193  if ((PropertyRequest->Node == KSNODE_TOPO_MICIN_VOLUME) && (channel == CHAN_LEFT)) {
1194  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
1195  *Level = that->NodeCache[(2*PropertyRequest->Node)];
1196  mixerValue = that->micVolumeRegister >> 1 & 0x7;
1197  if (mixerValue != ((*Level >> 19)+0x07)) {
1198  *Level = (mixerValue - 0x07) << 19;
1199  that->NodeCache[(2*PropertyRequest->Node)] = *Level;
1200  }
1201  } else if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
1202  if (*Level <= (-56 << 16)) {
1203  mixerValue = 0;
1204  that->NodeCache[(2*PropertyRequest->Node)] = -56 << 16;
1205  } else if (*Level >= 0) {
1206  mixerValue = 0x07;
1207  that->NodeCache[(2*PropertyRequest->Node)] = 0;
1208  } else {
1209  mixerValue = ((*Level >> 19) + 0x07) & 0x07;
1210  that->NodeCache[(2*PropertyRequest->Node)] = *Level;
1211  }
1212  that->micVolumeRegister &= ~(0x07 << 1);
1213  that->micVolumeRegister |= mixerValue << 1;
1214  that->CMIAdapter->writeUInt8(REG_MIXER2, that->micVolumeRegister);
1215  }
1216  ntStatus = STATUS_SUCCESS;
1217  }
1218  if ((NT_SUCCESS(ntStatus)) && (PropertyRequest->Verb & KSPROPERTY_TYPE_GET)) {
1219  PropertyRequest->ValueSize = sizeof(LONG);
1220  }
1221  }
1222  } else if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) {
1223  switch(PropertyRequest->Node) {
1226  case KSNODE_TOPO_CD_VOLUME:
1231  ntStatus = BasicSupportHandler(PropertyRequest);
1232  break;
1233  }
1234  }
1235 
1236  return ntStatus;
1237 }
PCMIADAPTER CMIAdapter
Definition: mintopo.hpp:38
#define max(a, b)
Definition: svc.c:63
#define DBGPRINT(...)
Definition: pdo.c:21
#define shift
Definition: input.c:1756
IMiniportTopology * PMINIPORTTOPOLOGY
Definition: portcls.h:1431
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
DWORD UInt32
Definition: chm_lib.c:104
const VolumeTable VolTable[]
#define CHAN_LEFT
Definition: interfaces.hpp:66
LONG NTSTATUS
Definition: precomp.h:26
#define UInt8
Definition: interfaces.hpp:75
UInt8 micVolumeRegister
Definition: mintopo.hpp:40
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
#define CHAN_RIGHT
Definition: interfaces.hpp:67
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define REG_MIXER3
Definition: cmireg.hpp:146
GLenum GLint GLuint mask
Definition: glext.h:6028
long LONG
Definition: pedump.c:60
#define KSPROPERTY_TYPE_BASICSUPPORT
Definition: dmksctrl.h:45
const PCPROPERTY_ITEM * PropertyItem
Definition: portcls.h:261
#define SIZEOF_ARRAY(ar)
Definition: cdrom.h:1482
#define ASSERT(a)
Definition: mode.c:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define for
Definition: utility.h:88
static int reg
Definition: i386-dis.c:1283
PUNKNOWN MajorTarget
Definition: portcls.h:258
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
static NTSTATUS BasicSupportHandler(PPCPROPERTY_REQUEST PropertyRequest)
Definition: mintopo.cpp:1031
#define STATUS_SUCCESS
Definition: shellext.h:65
UInt8 auxVolumeRegister
Definition: mintopo.hpp:40
UInt32 NodeCache[2 *KSNODE_TOPO_INVALID]
Definition: mintopo.hpp:42
#define REG_MIXER2
Definition: cmireg.hpp:139
signed int * PLONG
Definition: retypes.h:5
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
Definition: dlist.c:348
#define PAGED_CODE()

◆ PropertyHandler_Mux

NTSTATUS NTAPI PropertyHandler_Mux ( PPCPROPERTY_REQUEST  PropertyRequest)
friend

◆ PropertyHandler_OnOff

NTSTATUS NTAPI PropertyHandler_OnOff ( PPCPROPERTY_REQUEST  PropertyRequest)
friend

Definition at line 480 of file mintopo.cpp.

481 {
482  PAGED_CODE();
483  ASSERT(PropertyRequest);
484  DBGPRINT(("[PropertyHandler_OnOff]"));
485 
486  CCMITopology *that = (CCMITopology *) ((PMINIPORTTOPOLOGY) PropertyRequest->MajorTarget);
487 
489  UInt8 mask, reg;
490  LONG channel;
491 
492  if (PropertyRequest->Node == ULONG(-1)) {
493  return ntStatus;
494  }
495 
496  if ( ((PropertyRequest->Verb & KSPROPERTY_TYPE_GET) || (PropertyRequest->Verb & KSPROPERTY_TYPE_SET)) && (PropertyRequest->InstanceSize >= sizeof(LONG)) ) {
497  channel = *(PLONG(PropertyRequest->Instance));
498  if (PropertyRequest->ValueSize >= sizeof(BOOL)) {
499 
500  if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_MUTE) {
501  PBOOL Muted = PBOOL(PropertyRequest->Value);
502  switch (PropertyRequest->Node) {
503 
505  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
506  *Muted = (that->CMIAdapter->readUInt8(REG_MIXER1) & MUTE_WAVE);
507  }
508  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
509  if (*Muted) {
510  that->CMIAdapter->setUInt8Bit(REG_MIXER1, MUTE_WAVE);
511  } else {
512  that->CMIAdapter->clearUInt8Bit(REG_MIXER1, MUTE_WAVE);
513  }
514  }
515  ntStatus = STATUS_SUCCESS;
516  break;
517 
519  switch (channel) {
520  case CHAN_LEFT: mask = MUTE_AUX_L; break;
521  case CHAN_RIGHT: mask = MUTE_AUX_R; break;
522  default: return ntStatus;
523  }
524 
525  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
526  *Muted = !(that->micVolumeRegister & mask);
527  }
528  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
529  if (*Muted) {
530  that->micVolumeRegister &= ~mask;
531  } else {
532  that->micVolumeRegister |= mask;
533  }
534  that->CMIAdapter->writeUInt8(REG_MIXER2, that->micVolumeRegister);
535  }
536  ntStatus = STATUS_SUCCESS;
537  break;
538 
540  if (channel != CHAN_LEFT) {
541  return ntStatus;
542  }
543 
544  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
545  *Muted = !(that->CMIAdapter->readMixer(SBREG_OUTPUTCTRL) & EN_MIC);
546  }
547  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
548  if (*Muted) {
549  that->CMIAdapter->clearMixerBit(SBREG_OUTPUTCTRL, EN_MIC);
550  } else {
551  that->CMIAdapter->setMixerBit(SBREG_OUTPUTCTRL, EN_MIC);
552  }
553  }
554  ntStatus = STATUS_SUCCESS;
555  break;
556 
557  case KSNODE_TOPO_CD_MUTE:
558  switch (channel) {
559  case CHAN_LEFT: mask = EN_CD_L; break;
560  case CHAN_RIGHT: mask = EN_CD_R; break;
561  default: return ntStatus;
562  }
563  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
564  *Muted = !(that->CMIAdapter->readMixer(SBREG_OUTPUTCTRL) & mask);
565  }
566  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
567  if (*Muted) {
568  that->CMIAdapter->clearMixerBit(SBREG_OUTPUTCTRL, mask);
569  } else {
570  that->CMIAdapter->setMixerBit(SBREG_OUTPUTCTRL, mask);
571  }
572  }
573  ntStatus = STATUS_SUCCESS;
574  break;
575 
577  switch (channel) {
578  case CHAN_LEFT: mask = EN_LINEIN_L; break;
579  case CHAN_RIGHT: mask = EN_LINEIN_R; break;
580  default: return ntStatus;
581  }
582  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
583  *Muted = !(that->CMIAdapter->readMixer(SBREG_OUTPUTCTRL) & mask);
584  }
585  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
586  if (*Muted) {
587  that->CMIAdapter->clearMixerBit(SBREG_OUTPUTCTRL, mask);
588  } else {
589  that->CMIAdapter->setMixerBit(SBREG_OUTPUTCTRL, mask);
590  }
591  }
592  ntStatus = STATUS_SUCCESS;
593  break;
594 
596  if (channel != CHAN_LEFT) {
597  return ntStatus;
598  }
599  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
600  *Muted = !(that->CMIAdapter->readMixer(SBREG_IN_CTRL_L) & EN_MIC);
601  }
602  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
603  if (*Muted) {
604  that->CMIAdapter->clearMixerBit(SBREG_IN_CTRL_L, EN_MIC);
605  that->CMIAdapter->clearMixerBit(SBREG_IN_CTRL_R, EN_MIC);
606  } else {
607  that->CMIAdapter->setMixerBit(SBREG_IN_CTRL_L, EN_MIC);
608  that->CMIAdapter->setMixerBit(SBREG_IN_CTRL_R, EN_MIC);
609  }
610  }
611  ntStatus = STATUS_SUCCESS;
612  break;
613 
615  switch (channel) {
616  case CHAN_LEFT: mask = EN_CD_L; reg = SBREG_IN_CTRL_L; break;
617  case CHAN_RIGHT: mask = EN_CD_R; reg = SBREG_IN_CTRL_R; break;
618  default: return ntStatus;
619  }
620  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
621  *Muted = !(that->CMIAdapter->readMixer(reg) & mask);
622  }
623  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
624  if (*Muted) {
625  that->CMIAdapter->clearMixerBit(reg, mask);
626  } else {
627  that->CMIAdapter->setMixerBit(reg, mask);
628  }
629  }
630  ntStatus = STATUS_SUCCESS;
631  break;
632 
634  switch (channel) {
635  case CHAN_LEFT: mask = EN_LINEIN_L; reg = SBREG_IN_CTRL_L; break;
636  case CHAN_RIGHT: mask = EN_LINEIN_R; reg = SBREG_IN_CTRL_R; break;
637  default: return ntStatus;
638  }
639  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
640  *Muted = !(that->CMIAdapter->readMixer(reg) & mask);
641  }
642  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
643  if (*Muted) {
644  that->CMIAdapter->clearMixerBit(reg, mask);
645  } else {
646  that->CMIAdapter->setMixerBit(reg, mask);
647  }
648  }
649  ntStatus = STATUS_SUCCESS;
650  break;
651 
652 
654  switch (channel) {
655  case CHAN_LEFT: mask = MUTE_RAUX_L; break;
656  case CHAN_RIGHT: mask = MUTE_RAUX_R; break;
657  default: return ntStatus;
658  }
659  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
660  *Muted = !(that->micVolumeRegister & mask) ;
661  }
662  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
663  if (*Muted) {
664  that->micVolumeRegister &= ~mask;
665  } else {
666  that->micVolumeRegister |= mask;
667  }
668  that->CMIAdapter->writeUInt8(REG_MIXER2, that->micVolumeRegister);
669  }
670  ntStatus = STATUS_SUCCESS;
671  break;
672 
674  switch (channel) {
675  case CHAN_LEFT: mask = EN_WAVEIN_L; break;
676  case CHAN_RIGHT: mask = EN_WAVEIN_R; break;
677  default: return ntStatus;
678  }
679  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
680 // *Muted = !(that->CMIAdapter->readUInt8(REG_MIXER1) & mask);
681  *Muted = !(that->cm->enableSPDIFIn);
682  ntStatus = STATUS_SUCCESS;
683  }
684  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
685  if (*Muted) {
686  that->cm->enableSPDIFIn = FALSE;
687  that->CMIAdapter->clearUInt8Bit(REG_MIXER1, mask);
688  } else {
689  that->cm->enableSPDIFIn = TRUE;
690  that->CMIAdapter->setUInt8Bit(REG_MIXER1, mask);
691  }
692  ntStatus = STATUS_SUCCESS;
693  }
694  break;
695 
697  channel = (1 << channel);
698  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
699  *Muted = that->masterMuteDummy & channel;
700  }
701  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
702  if (*Muted) {
703  that->masterMuteDummy |= channel;
704  } else {
705  that->masterMuteDummy &= ~channel;
706  }
707  }
708  ntStatus = STATUS_SUCCESS;
709  break;
710  }
711  }
712 
713  if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_LOUDNESS) {
714  PBOOL LoudnessOn = PBOOL(PropertyRequest->Value);
715  switch (PropertyRequest->Node) {
717  if (channel == CHAN_LEFT) {
718  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
719  *LoudnessOn = (that->CMIAdapter->readMixer(SBREG_EXTENSION) & EN_MICBOOST);
720  }
721  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
722  if (*LoudnessOn) {
723  that->CMIAdapter->setMixerBit(SBREG_EXTENSION, EN_MICBOOST);
724  } else {
725  that->CMIAdapter->clearMixerBit(SBREG_EXTENSION, EN_MICBOOST);
726  }
727  }
728  ntStatus = STATUS_SUCCESS;
729  }
730  break;
732  if (channel == CHAN_LEFT) {
733  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
734  *LoudnessOn = !(that->CMIAdapter->readUInt8(REG_MIXER2) & DIS_MICGAIN);
735  }
736  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
737  if (*LoudnessOn) {
738  that->CMIAdapter->clearUInt8Bit(REG_MIXER2, DIS_MICGAIN);
739  } else {
740  that->CMIAdapter->setUInt8Bit(REG_MIXER2, DIS_MICGAIN);
741  }
742  }
743  ntStatus = STATUS_SUCCESS;
744  }
745  break;
746  case KSNODE_TOPO_IEC_5V:
747  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
748  *LoudnessOn = (that->CMIAdapter->readUInt32(REG_MISCCTRL) & EN_SPDO5V);
749  }
750  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
751  if (*LoudnessOn) {
752  that->CMIAdapter->setUInt32Bit(REG_MISCCTRL, EN_SPDO5V);
753  } else {
754  that->CMIAdapter->clearUInt32Bit(REG_MISCCTRL, EN_SPDO5V);
755  }
756  }
757  ntStatus = STATUS_SUCCESS;
758  break;
759  case KSNODE_TOPO_IEC_OUT:
760  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
761  if (that->cm) {
762  *LoudnessOn = that->cm->enableSPDIFOut;
763  }
764  }
765  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
766  if (that->cm) {
767  that->cm->enableSPDIFOut = (*LoudnessOn);
768  }
769  }
770  ntStatus = STATUS_SUCCESS;
771  break;
772 
774  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
775  if (that->cm->chipVersion <= 37) {
776  *LoudnessOn = (that->CMIAdapter->readUInt8(REG_MIXER4) & INV_SPDIFI1);
777  } else {
778  *LoudnessOn = (that->CMIAdapter->readUInt32(REG_CHFORMAT) & INV_SPDIFI2);
779  }
780  }
781  if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
782  if (*LoudnessOn) {
783  if (that->cm->chipVersion <= 37) {
784  that->CMIAdapter->setUInt8Bit(REG_MIXER4, INV_SPDIFI1);
785  } else {
786  that->CMIAdapter->setUInt32Bit(REG_CHFORMAT, INV_SPDIFI2);
787  }
788  } else {
789  if (that->cm->chipVersion <= 37) {
790  that->CMIAdapter->clearUInt8Bit(REG_MIXER4, INV_SPDIFI1);
791  } else {
792  that->CMIAdapter->clearUInt32Bit(REG_CHFORMAT, INV_SPDIFI2);
793  }
794  }
795  }
796  ntStatus = STATUS_SUCCESS;
797  break;
798 
800  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
801  *LoudnessOn = (that->CMIAdapter->readUInt8(REG_MIXER1) & EN_SPDI2DAC);
802  }
803  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
804  if (*LoudnessOn) {
805  that->CMIAdapter->setUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
806  } else {
807  that->CMIAdapter->clearUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
808  }
809  if (that->cm) {
810  that->cm->enableSPDIFInMonitor = *LoudnessOn;
811  }
812  }
813  ntStatus = STATUS_SUCCESS;
814  break;
815 
817  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
818  if (that->cm->chipVersion <= 37) {
819  *LoudnessOn = (that->CMIAdapter->readUInt32(REG_CHFORMAT) & SEL_SPDIFI1);
820  } else {
821  *LoudnessOn = (that->CMIAdapter->readUInt32(REG_MISCCTRL) & SEL_SPDIFI2);
822  }
823  }
824  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
825  if (*LoudnessOn) {
826  if (that->cm->chipVersion <= 37) {
827  that->CMIAdapter->setUInt32Bit(REG_CHFORMAT, SEL_SPDIFI1);
828  } else {
829  that->CMIAdapter->setUInt32Bit(REG_MISCCTRL, SEL_SPDIFI2);
830  }
831  } else {
832  if (that->cm->chipVersion <= 37) {
833  that->CMIAdapter->clearUInt32Bit(REG_CHFORMAT, SEL_SPDIFI1);
834  } else {
835  that->CMIAdapter->clearUInt32Bit(REG_MISCCTRL, SEL_SPDIFI2);
836  }
837  }
838  }
839  ntStatus = STATUS_SUCCESS;
840  break;
841 
842  case KSNODE_TOPO_XCHG_FB:
843  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
844  *LoudnessOn = (that->CMIAdapter->readUInt8(REG_MIXER1) & REAR2FRONT);
845  }
846  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
847  if (*LoudnessOn) {
848  that->CMIAdapter->setUInt8Bit(REG_MIXER1, REAR2FRONT);
849  } else {
850  that->CMIAdapter->clearUInt8Bit(REG_MIXER1, REAR2FRONT);
851  }
852  }
853  ntStatus = STATUS_SUCCESS;
854  break;
855 
857  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
858  *LoudnessOn = (that->CMIAdapter->readUInt32(REG_LEGACY) & BASS2LINE);
859  }
860  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
861  if (*LoudnessOn) {
862  that->CMIAdapter->setUInt32Bit(REG_LEGACY, BASS2LINE);
863  } else {
864  that->CMIAdapter->clearUInt32Bit(REG_LEGACY, BASS2LINE);
865  }
866  }
867  ntStatus = STATUS_SUCCESS;
868  break;
869 
871  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
872  *LoudnessOn = (that->CMIAdapter->readUInt32(REG_LEGACY) & CENTER2LINE);
873  }
874  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
875  if (*LoudnessOn) {
876  that->CMIAdapter->setUInt32Bit(REG_LEGACY, CENTER2LINE);
877  } else {
878  that->CMIAdapter->clearUInt32Bit(REG_LEGACY, CENTER2LINE);
879  }
880  }
881  ntStatus = STATUS_SUCCESS;
882  break;
883 
885  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
886  *LoudnessOn = (that->CMIAdapter->readUInt32(REG_LEGACY) & EN_SPDCOPYRHT);
887  }
888  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
889  if (*LoudnessOn) {
890  that->CMIAdapter->setUInt32Bit(REG_LEGACY, EN_SPDCOPYRHT);
891  } else {
892  that->CMIAdapter->clearUInt32Bit(REG_LEGACY, EN_SPDCOPYRHT);
893  }
894  }
895  ntStatus = STATUS_SUCCESS;
896  break;
897 
899  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
900  *LoudnessOn = (that->CMIAdapter->readUInt32(REG_CHFORMAT) & POLVALID);
901  }
902  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
903  if (*LoudnessOn) {
904  that->CMIAdapter->setUInt32Bit(REG_CHFORMAT, POLVALID);
905  } else {
906  that->CMIAdapter->clearUInt32Bit(REG_CHFORMAT, POLVALID);
907  }
908  }
909  ntStatus = STATUS_SUCCESS;
910  break;
911 
913  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
914  *LoudnessOn = (that->CMIAdapter->readUInt32(REG_FUNCTRL1) & LOOP_SPDF);
915  }
916  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
917  if (*LoudnessOn) {
918  that->CMIAdapter->setUInt32Bit(REG_FUNCTRL1, LOOP_SPDF);
919  } else {
920  that->CMIAdapter->clearUInt32Bit(REG_FUNCTRL1, LOOP_SPDF);
921  }
922  }
923  ntStatus = STATUS_SUCCESS;
924  break;
925 
927  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
928  *LoudnessOn = (that->CMIAdapter->readUInt8(REG_MIXER1) & REAR2LINE);
929  }
930  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded)) {
931  if (*LoudnessOn) {
932  that->CMIAdapter->setUInt8Bit(REG_MIXER1, REAR2LINE);
933  } else {
934  that->CMIAdapter->clearUInt8Bit(REG_MIXER1, REAR2LINE);
935  }
936  }
937  ntStatus = STATUS_SUCCESS;
938  break;
939 
941  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
942  *LoudnessOn = (that->CMIAdapter->readUInt8(REG_MIXER4) & CENTER2MIC) && (that->cm->chipVersion > 37);
943  }
944  if ((PropertyRequest->Verb & KSPROPERTY_TYPE_SET) && !(that->settingsLoaded) && (that->cm->chipVersion > 37)) {
945  if (*LoudnessOn) {
946  that->CMIAdapter->setUInt8Bit(REG_MIXER4, CENTER2MIC);
947  } else {
948  that->CMIAdapter->clearUInt8Bit(REG_MIXER4, CENTER2MIC);
949  }
950  }
951  ntStatus = STATUS_SUCCESS;
952  break;
953  }
954  }
955 
956  if ((NT_SUCCESS(ntStatus)) && (PropertyRequest->Verb & KSPROPERTY_TYPE_GET)) {
957  PropertyRequest->ValueSize = sizeof(BOOL);
958  }
959 
960  }
961  } else if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) {
962  bool supported = false;
963  if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_MUTE) {
964  switch (PropertyRequest->Node) {
965  case KSNODE_TOPO_CD_MUTE:
976  supported = true;
977  }
978  }
979 
980  if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_LOUDNESS) {
981  switch (PropertyRequest->Node) {
984  case KSNODE_TOPO_IEC_5V:
985  case KSNODE_TOPO_IEC_OUT:
989  case KSNODE_TOPO_XCHG_FB:
996  supported = true;
997  }
998  if ((PropertyRequest->Node == KSNODE_TOPO_CENTER2MIC) && (that->cm->chipVersion > 37)) {
999  supported = true;
1000  }
1001  }
1002 
1003  if (supported) {
1004  if (PropertyRequest->ValueSize >= (sizeof(KSPROPERTY_DESCRIPTION))) {
1005  PKSPROPERTY_DESCRIPTION PropDesc = PKSPROPERTY_DESCRIPTION(PropertyRequest->Value);
1006 
1008  PropDesc->DescriptionSize = sizeof(KSPROPERTY_DESCRIPTION);
1010  PropDesc->PropTypeSet.Id = VT_BOOL;
1011  PropDesc->PropTypeSet.Flags = 0;
1012  PropDesc->MembersListCount = 0;
1013  PropDesc->Reserved = 0;
1014 
1015  PropertyRequest->ValueSize = sizeof(KSPROPERTY_DESCRIPTION);
1016  ntStatus = STATUS_SUCCESS;
1017  } else if (PropertyRequest->ValueSize >= sizeof(ULONG)) {
1018  PULONG AccessFlags = PULONG(PropertyRequest->Value);
1019 
1021 
1022  PropertyRequest->ValueSize = sizeof(ULONG);
1023  ntStatus = STATUS_SUCCESS;
1024  }
1025  }
1026  }
1027 
1028  return ntStatus;
1029 }
#define SBREG_IN_CTRL_L
Definition: cmireg.hpp:167
PCMIADAPTER CMIAdapter
Definition: mintopo.hpp:38
#define REG_FUNCTRL1
Definition: cmireg.hpp:43
#define DBGPRINT(...)
Definition: pdo.c:21
#define SEL_SPDIFI2
Definition: cmireg.hpp:113
IMiniportTopology * PMINIPORTTOPOLOGY
Definition: portcls.h:1431
#define EN_WAVEIN_R
Definition: cmireg.hpp:133
#define EN_WAVEIN_L
Definition: cmireg.hpp:132
#define TRUE
Definition: types.h:120
#define EN_SPDCOPYRHT
Definition: cmireg.hpp:103
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define CENTER2MIC
Definition: cmireg.hpp:150
#define CHAN_LEFT
Definition: interfaces.hpp:66
#define EN_SPDI2DAC
Definition: cmireg.hpp:130
LONG NTSTATUS
Definition: precomp.h:26
#define UInt8
Definition: interfaces.hpp:75
#define REG_CHFORMAT
Definition: cmireg.hpp:60
const GUID KSPROPTYPESETID_General
Definition: property.c:17
UInt8 micVolumeRegister
Definition: mintopo.hpp:40
#define REG_MISCCTRL
Definition: cmireg.hpp:111
bool enableSPDIFOut
Definition: interfaces.hpp:145
#define CHAN_RIGHT
Definition: interfaces.hpp:67
#define REAR2LINE
Definition: cmireg.hpp:135
#define EN_MICBOOST
Definition: cmireg.hpp:171
#define BOOL
Definition: nt_native.h:43
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define BASS2LINE
Definition: cmireg.hpp:100
GUID Set
Definition: dmksctrl.h:76
#define REG_LEGACY
Definition: cmireg.hpp:98
#define INV_SPDIFI2
Definition: cmireg.hpp:66
#define REAR2FRONT
Definition: cmireg.hpp:134
#define SBREG_EXTENSION
Definition: cmireg.hpp:170
GLenum GLint GLuint mask
Definition: glext.h:6028
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define SBREG_OUTPUTCTRL
Definition: cmireg.hpp:160
#define EN_CD_L
Definition: cmireg.hpp:162
KSIDENTIFIER PropTypeSet
Definition: ks.h:1541
BOOL * PBOOL
Definition: windef.h:161
#define KSPROPERTY_TYPE_BASICSUPPORT
Definition: dmksctrl.h:45
const PCPROPERTY_ITEM * PropertyItem
Definition: portcls.h:261
ULONG DescriptionSize
Definition: ks.h:1540
#define ASSERT(a)
Definition: mode.c:45
ULONG Id
Definition: dmksctrl.h:77
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EN_SPDO5V
Definition: cmireg.hpp:121
UInt32 masterMuteDummy
Definition: mintopo.hpp:43
#define EN_LINEIN_R
Definition: cmireg.hpp:165
#define MUTE_AUX_R
Definition: cmireg.hpp:142
static int reg
Definition: i386-dis.c:1283
#define EN_MIC
Definition: cmireg.hpp:161
#define SBREG_IN_CTRL_R
Definition: cmireg.hpp:168
#define REG_MIXER4
Definition: cmireg.hpp:148
ULONG Flags
Definition: dmksctrl.h:78
#define EN_CD_R
Definition: cmireg.hpp:163
#define REG_MIXER1
Definition: cmireg.hpp:129
#define POLVALID
Definition: cmireg.hpp:64
PUNKNOWN MajorTarget
Definition: portcls.h:258
#define LOOP_SPDF
Definition: cmireg.hpp:50
bool enableSPDIFIn
Definition: interfaces.hpp:146
#define MUTE_RAUX_L
Definition: cmireg.hpp:143
BOOLEAN settingsLoaded
Definition: mintopo.hpp:44
#define CENTER2LINE
Definition: cmireg.hpp:99
CMI8738Info * cm
Definition: mintopo.hpp:39
#define MUTE_AUX_L
Definition: cmireg.hpp:141
unsigned int * PULONG
Definition: retypes.h:1
#define MUTE_RAUX_R
Definition: cmireg.hpp:144
unsigned int ULONG
Definition: retypes.h:1
bool enableSPDIFInMonitor
Definition: interfaces.hpp:147
#define INV_SPDIFI1
Definition: cmireg.hpp:149
#define DIS_MICGAIN
Definition: cmireg.hpp:140
#define STATUS_SUCCESS
Definition: shellext.h:65
#define SEL_SPDIFI1
Definition: cmireg.hpp:71
ULONG MembersListCount
Definition: ks.h:1542
#define REG_MIXER2
Definition: cmireg.hpp:139
signed int * PLONG
Definition: retypes.h:5
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
struct KSPROPERTY_DESCRIPTION * PKSPROPERTY_DESCRIPTION
#define EN_LINEIN_L
Definition: cmireg.hpp:164
#define PAGED_CODE()
#define MUTE_WAVE
Definition: cmireg.hpp:136

◆ PropertyHandler_Private

NTSTATUS NTAPI PropertyHandler_Private ( PPCPROPERTY_REQUEST  PropertyRequest)
friend

Definition at line 1337 of file mintopo.cpp.

1338 {
1339  PAGED_CODE();
1340  ASSERT(PropertyRequest);
1341  DBGPRINT(("[PropertyHandler_Private]"));
1342 
1344  CCMITopology *that = (CCMITopology *) ((PMINIPORTTOPOLOGY) PropertyRequest->MajorTarget);
1345 
1346  if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET) {
1347  if (PropertyRequest->PropertyItem->Id != KSPROPERTY_CMI_GET) {
1349  }
1350 
1351  if (PropertyRequest->ValueSize == 0) {
1352  PropertyRequest->ValueSize = sizeof(CMIDATA);
1353  return STATUS_BUFFER_OVERFLOW;
1354  } else if (PropertyRequest->ValueSize < sizeof (CMIDATA)) {
1355  PropertyRequest->ValueSize = 0;
1356  return STATUS_BUFFER_TOO_SMALL;
1357  }
1358 
1359  CMIDATA* cmiData = (CMIDATA*)PropertyRequest->Value;
1360 #ifdef WAVERT
1362 #else
1364 #endif
1366  cmiData->maxChannels = that->cm->maxChannels;
1367  cmiData->IOBase = (USHORT)((ULONG_PTR)that->cm->IOBase);
1368  cmiData->MPUBase = (USHORT)((ULONG_PTR)that->cm->MPUBase);
1369  cmiData->enableSPDO = that->cm->enableSPDIFOut;
1371  cmiData->enableSPDI = that->cm->enableSPDIFIn;
1372  cmiData->formatMask = that->cm->formatMask;
1373  cmiData->exchangeFrontBack = (that->CMIAdapter->readUInt8(REG_MIXER1) & REAR2FRONT);
1374  cmiData->enableSPDO5V = (that->CMIAdapter->readUInt32(REG_MISCCTRL) & EN_SPDO5V);
1375  cmiData->enableBass2Line = (that->CMIAdapter->readUInt32(REG_LEGACY) & BASS2LINE);
1376  cmiData->enableCenter2Line = (that->CMIAdapter->readUInt32(REG_LEGACY) & CENTER2LINE);
1377  cmiData->enableRear2Line = (that->CMIAdapter->readUInt8(REG_MIXER1) & REAR2LINE);
1378  cmiData->enableCenter2Mic = (that->CMIAdapter->readUInt8(REG_MIXER4) & CENTER2MIC) && (that->cm->chipVersion > 37);
1380  cmiData->invertValidBitSPDI = (that->CMIAdapter->readUInt32(REG_CHFORMAT) & POLVALID);
1381  cmiData->loopSPDI = (that->CMIAdapter->readUInt32(REG_FUNCTRL1) & LOOP_SPDF);
1382  if (that->cm->chipVersion <= 37) {
1383  cmiData->select2ndSPDI = (that->CMIAdapter->readUInt32(REG_CHFORMAT) & SEL_SPDIFI1);
1384  cmiData->invertPhaseSPDI = (that->CMIAdapter->readUInt8(REG_MIXER4) & INV_SPDIFI1);
1385  } else {
1386  cmiData->select2ndSPDI = (that->CMIAdapter->readUInt32(REG_MISCCTRL) & SEL_SPDIFI2);
1387  cmiData->invertPhaseSPDI = (that->CMIAdapter->readUInt32(REG_CHFORMAT) & INV_SPDIFI2);
1388  }
1389 
1390  PropertyRequest->ValueSize = sizeof(CMIDATA);
1391  ntStatus = STATUS_SUCCESS;
1392  } else if (PropertyRequest->Verb & KSPROPERTY_TYPE_SET) {
1393  if (PropertyRequest->PropertyItem->Id != KSPROPERTY_CMI_SET) {
1395  }
1396 
1397  if (PropertyRequest->ValueSize == 0) {
1398  PropertyRequest->ValueSize = sizeof(CMIDATA);
1399  return STATUS_BUFFER_OVERFLOW;
1400  } else if (PropertyRequest->ValueSize < sizeof (CMIDATA)) {
1401  PropertyRequest->ValueSize = 0;
1402  return STATUS_BUFFER_TOO_SMALL;
1403  }
1404  CMIDATA* cmiData = (CMIDATA*)PropertyRequest->Value;
1405  that->cm->enableSPDIFIn = cmiData->enableSPDI;
1406  that->cm->enableSPDIFOut = cmiData->enableSPDO;
1407  that->cm->formatMask = cmiData->formatMask;
1409 
1410  if (cmiData->enableSPDI) {
1411  that->CMIAdapter->setUInt8Bit(REG_MIXER1, EN_WAVEIN_L | EN_WAVEIN_R);
1412  } else {
1413  that->CMIAdapter->clearUInt8Bit(REG_MIXER1, EN_WAVEIN_L | EN_WAVEIN_R);
1414  }
1415 
1416  if (cmiData->exchangeFrontBack) {
1417  that->CMIAdapter->setUInt8Bit(REG_MIXER1, REAR2FRONT);
1418  } else {
1419  that->CMIAdapter->clearUInt8Bit(REG_MIXER1, REAR2FRONT);
1420  }
1421  if (cmiData->enableSPDO5V) {
1422  that->CMIAdapter->setUInt32Bit(REG_MISCCTRL, EN_SPDO5V);
1423  } else {
1424  that->CMIAdapter->clearUInt32Bit(REG_MISCCTRL, EN_SPDO5V);
1425  }
1426  if (cmiData->enableSPDIMonitor) {
1427  that->CMIAdapter->setUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
1428  } else {
1429  that->CMIAdapter->clearUInt8Bit(REG_MIXER1, EN_SPDI2DAC);
1430  }
1431  if (cmiData->enableBass2Line) {
1432  that->CMIAdapter->setUInt32Bit(REG_LEGACY, BASS2LINE);
1433  } else {
1434  that->CMIAdapter->clearUInt32Bit(REG_LEGACY, BASS2LINE);
1435  }
1436  if (cmiData->enableCenter2Line) {
1437  that->CMIAdapter->setUInt32Bit(REG_LEGACY, CENTER2LINE);
1438  } else {
1439  that->CMIAdapter->clearUInt32Bit(REG_LEGACY, CENTER2LINE);
1440  }
1441  if (cmiData->enableRear2Line) {
1442  that->CMIAdapter->setUInt8Bit(REG_MIXER1, REAR2LINE);
1443  } else {
1444  that->CMIAdapter->clearUInt8Bit(REG_MIXER1, REAR2LINE);
1445  }
1446  if (that->cm->chipVersion > 37) {
1447  if (cmiData->enableCenter2Mic) {
1448  that->CMIAdapter->setUInt8Bit(REG_MIXER4, CENTER2MIC);
1449  } else {
1450  that->CMIAdapter->clearUInt8Bit(REG_MIXER4, CENTER2MIC);
1451  }
1452  }
1454  that->CMIAdapter->setUInt32Bit(REG_LEGACY, EN_SPDCOPYRHT);
1455  } else {
1456  that->CMIAdapter->clearUInt32Bit(REG_LEGACY, EN_SPDCOPYRHT);
1457  }
1458  if (cmiData->invertValidBitSPDI) {
1459  that->CMIAdapter->setUInt32Bit(REG_CHFORMAT, POLVALID);
1460  } else {
1461  that->CMIAdapter->clearUInt32Bit(REG_CHFORMAT, POLVALID);
1462  }
1463  if (cmiData->loopSPDI) {
1464  that->CMIAdapter->setUInt32Bit(REG_FUNCTRL1, LOOP_SPDF);
1465  } else {
1466  that->CMIAdapter->clearUInt32Bit(REG_FUNCTRL1, LOOP_SPDF);
1467  }
1468  if (cmiData->select2ndSPDI) {
1469  if (that->cm->chipVersion <= 37) {
1470  that->CMIAdapter->setUInt32Bit(REG_CHFORMAT, SEL_SPDIFI1);
1471  } else {
1472  that->CMIAdapter->setUInt32Bit(REG_MISCCTRL, SEL_SPDIFI2);
1473  }
1474  } else {
1475  if (that->cm->chipVersion <= 37) {
1476  that->CMIAdapter->clearUInt32Bit(REG_CHFORMAT, SEL_SPDIFI1);
1477  } else {
1478  that->CMIAdapter->clearUInt32Bit(REG_MISCCTRL, SEL_SPDIFI2);
1479  }
1480  }
1481  if (cmiData->invertPhaseSPDI) {
1482  if (that->cm->chipVersion <= 37) {
1483  that->CMIAdapter->setUInt8Bit(REG_MIXER4, INV_SPDIFI1);
1484  } else {
1485  that->CMIAdapter->setUInt32Bit(REG_CHFORMAT, INV_SPDIFI2);
1486  }
1487  } else {
1488  if (that->cm->chipVersion <= 37) {
1489  that->CMIAdapter->clearUInt8Bit(REG_MIXER4, INV_SPDIFI1);
1490  } else {
1491  that->CMIAdapter->clearUInt32Bit(REG_CHFORMAT, INV_SPDIFI2);
1492  }
1493  }
1494 
1495  that->storeMixerSettingsToRegistry();
1496 
1497  ntStatus = STATUS_SUCCESS;
1498  } else if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT) {
1499  if (PropertyRequest->ValueSize >= sizeof(ULONG)) {
1500  PULONG AccessFlags = PULONG(PropertyRequest->Value);
1501 
1503 
1504  PropertyRequest->ValueSize = sizeof(ULONG);
1505  ntStatus = STATUS_SUCCESS;
1506  } else {
1507  PropertyRequest->ValueSize = 0;
1508  ntStatus = STATUS_BUFFER_TOO_SMALL;
1509  }
1510  }
1511 
1512  return ntStatus;
1513 }
UInt32 invertPhaseSPDI
Definition: property.h:79
UInt32 maxChannels
Definition: property.h:68
UInt32 * IOBase
Definition: interfaces.hpp:141
PCMIADAPTER CMIAdapter
Definition: mintopo.hpp:38
#define REG_FUNCTRL1
Definition: cmireg.hpp:43
UInt32 enableSPDIMonitor
Definition: property.h:69
#define DBGPRINT(...)
Definition: pdo.c:21
UInt32 enableSPDI
Definition: property.h:83
int hardwareRevision
Definition: property.h:65
#define SEL_SPDIFI2
Definition: cmireg.hpp:113
IMiniportTopology * PMINIPORTTOPOLOGY
Definition: portcls.h:1431
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define EN_WAVEIN_R
Definition: cmireg.hpp:133
#define EN_WAVEIN_L
Definition: cmireg.hpp:132
UInt32 formatMask
Definition: property.h:82
#define EN_SPDCOPYRHT
Definition: cmireg.hpp:103
#define KSPROPERTY_CMI_GET
Definition: property.h:39
#define CENTER2MIC
Definition: cmireg.hpp:150
#define EN_SPDI2DAC
Definition: cmireg.hpp:130
LONG NTSTATUS
Definition: precomp.h:26
#define REG_CHFORMAT
Definition: cmireg.hpp:60
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
UInt32 loopSPDI
Definition: property.h:81
UInt32 invertValidBitSPDI
Definition: property.h:80
char driverVersion[32]
Definition: property.h:64
#define REG_MISCCTRL
Definition: cmireg.hpp:111
bool enableSPDIFOut
Definition: interfaces.hpp:145
#define REAR2LINE
Definition: cmireg.hpp:135
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define BASS2LINE
Definition: cmireg.hpp:100
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define REG_LEGACY
Definition: cmireg.hpp:98
#define INV_SPDIFI2
Definition: cmireg.hpp:66
#define REAR2FRONT
Definition: cmireg.hpp:134
UInt32 enableCenter2Mic
Definition: property.h:74
UInt32 enableSPDOCopyright
Definition: property.h:77
UInt32 enableCenter2Line
Definition: property.h:72
UInt32 * MPUBase
Definition: interfaces.hpp:142
UInt16 MPUBase
Definition: property.h:67
CMIDATA cmiData
Definition: main.h:78
UInt32 enableSPDO5V
Definition: property.h:76
UInt32 enableSPDO
Definition: property.h:75
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
#define KSPROPERTY_TYPE_BASICSUPPORT
Definition: dmksctrl.h:45
const PCPROPERTY_ITEM * PropertyItem
Definition: portcls.h:261
#define KSPROPERTY_CMI_SET
Definition: property.h:40
#define ASSERT(a)
Definition: mode.c:45
if(!(yy_init))
Definition: macro.lex.yy.c:714
UInt32 exchangeFrontBack
Definition: property.h:70
#define EN_SPDO5V
Definition: cmireg.hpp:121
UInt32 formatMask
Definition: interfaces.hpp:148
UInt32 enableRear2Line
Definition: property.h:73
#define REG_MIXER4
Definition: cmireg.hpp:148
UInt16 IOBase
Definition: property.h:66
UInt32 maxChannels
Definition: interfaces.hpp:136
#define REG_MIXER1
Definition: cmireg.hpp:129
UInt32 enableBass2Line
Definition: property.h:71
#define POLVALID
Definition: cmireg.hpp:64
PUNKNOWN MajorTarget
Definition: portcls.h:258
#define LOOP_SPDF
Definition: cmireg.hpp:50
bool enableSPDIFIn
Definition: interfaces.hpp:146
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define CENTER2LINE
Definition: cmireg.hpp:99
unsigned short USHORT
Definition: pedump.c:61
#define CMIVERSION
Definition: debug.hpp:31
CMI8738Info * cm
Definition: mintopo.hpp:39
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
bool enableSPDIFInMonitor
Definition: interfaces.hpp:147
#define INV_SPDIFI1
Definition: cmireg.hpp:149
#define STATUS_SUCCESS
Definition: shellext.h:65
#define SEL_SPDIFI1
Definition: cmireg.hpp:71
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
#define PAGED_CODE()
UInt32 select2ndSPDI
Definition: property.h:78

Member Data Documentation

◆ auxVolumeRegister

UInt8 CCMITopology::auxVolumeRegister
private

Definition at line 40 of file mintopo.hpp.

Referenced by PropertyHandler_Level().

◆ chformatRegister

UInt32 CCMITopology::chformatRegister
private

Definition at line 41 of file mintopo.hpp.

◆ cm

CMI8738Info* CCMITopology::cm
private

◆ CMIAdapter

PCMIADAPTER CCMITopology::CMIAdapter
private

◆ DataRange

IN PKSDATARANGE CCMITopology::DataRange

Definition at line 64 of file mintopo.hpp.

◆ functrl1Register

UInt32 CCMITopology::functrl1Register
private

Definition at line 41 of file mintopo.hpp.

◆ legacyRegister

UInt32 CCMITopology::legacyRegister
private

Definition at line 41 of file mintopo.hpp.

◆ masterMuteDummy

UInt32 CCMITopology::masterMuteDummy
private

Definition at line 43 of file mintopo.hpp.

Referenced by PropertyHandler_OnOff().

◆ MatchingDataRange

IN PKSDATARANGE IN PKSDATARANGE CCMITopology::MatchingDataRange

Definition at line 64 of file mintopo.hpp.

◆ micVolumeRegister

UInt8 CCMITopology::micVolumeRegister
private

Definition at line 40 of file mintopo.hpp.

Referenced by PropertyHandler_Level(), and PropertyHandler_OnOff().

◆ miscctrlRegister

UInt32 CCMITopology::miscctrlRegister
private

Definition at line 41 of file mintopo.hpp.

◆ mixer1Register

UInt8 CCMITopology::mixer1Register
private

Definition at line 40 of file mintopo.hpp.

◆ mixer4Register

UInt8 CCMITopology::mixer4Register
private

Definition at line 40 of file mintopo.hpp.

◆ NodeCache

UInt32 CCMITopology::NodeCache[2 *KSNODE_TOPO_INVALID]
private

Definition at line 42 of file mintopo.hpp.

Referenced by PropertyHandler_Level().

◆ OPTIONAL

IN PKSDATARANGE IN PKSDATARANGE IN ULONG OUT PVOID ResultantFormat CCMITopology::OPTIONAL

Definition at line 64 of file mintopo.hpp.

◆ OutputBufferLength

IN PKSDATARANGE IN PKSDATARANGE IN ULONG CCMITopology::OutputBufferLength

Definition at line 64 of file mintopo.hpp.

◆ Port

IN PRESOURCELIST IN PPORTTOPOLOGY CCMITopology::Port

Definition at line 77 of file mintopo.hpp.

◆ ResourceList

IN PRESOURCELIST CCMITopology::ResourceList

Definition at line 77 of file mintopo.hpp.

◆ ResultantFormatLength

IN PKSDATARANGE IN PKSDATARANGE IN ULONG OUT PVOID ResultantFormat OUT PULONG CCMITopology::ResultantFormatLength
Initial value:

Definition at line 70 of file mintopo.hpp.

◆ settingsLoaded

BOOLEAN CCMITopology::settingsLoaded
private

Definition at line 44 of file mintopo.hpp.

Referenced by PropertyHandler_OnOff().


The documentation for this class was generated from the following files: