ReactOS 0.4.16-dev-106-g10b08aa
mintopo.cpp File Reference
#include "limits.h"
#include "mintopo.hpp"
#include "mintopotables.hpp"
#include "ntstrsafe.h"
Include dependency graph for mintopo.cpp:

Go to the source code of this file.

Macros

#define NTSTRSAFE_LIB
 

Functions

NTSTATUS NTAPI CreateMiniportTopologyCMI (PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
 
NTSTATUS NTAPI PropertyHandler_OnOff (PPCPROPERTY_REQUEST PropertyRequest)
 
static NTSTATUS BasicSupportHandler (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)
 

Macro Definition Documentation

◆ NTSTRSAFE_LIB

#define NTSTRSAFE_LIB

Definition at line 31 of file mintopo.cpp.

Function Documentation

◆ BasicSupportHandler()

static NTSTATUS BasicSupportHandler ( PPCPROPERTY_REQUEST  PropertyRequest)
static

Definition at line 1031 of file mintopo.cpp.

1032{
1033 PAGED_CODE();
1034 ASSERT(PropertyRequest);
1035 DBGPRINT(("[BasicSupportHandler]"));
1036
1038
1039 if (PropertyRequest->ValueSize >= (sizeof(KSPROPERTY_DESCRIPTION))) {
1040 PKSPROPERTY_DESCRIPTION PropDesc = PKSPROPERTY_DESCRIPTION(PropertyRequest->Value);
1041
1045 PropDesc->PropTypeSet.Id = VT_I4;
1046 PropDesc->PropTypeSet.Flags = 0;
1047 PropDesc->MembersListCount = 1;
1048 PropDesc->Reserved = 0;
1049
1050 if (PropertyRequest->ValueSize >= (sizeof(KSPROPERTY_DESCRIPTION) + sizeof(KSPROPERTY_MEMBERSHEADER) + sizeof(KSPROPERTY_STEPPING_LONG))) {
1052
1054 Members->MembersSize = sizeof(KSPROPERTY_STEPPING_LONG);
1055 Members->MembersCount = 1;
1056 Members->Flags = 0;
1057
1059
1060 for (unsigned int i=0;i<SIZEOF_ARRAY(VolTable);i++) {
1061 if (VolTable[i].node == PropertyRequest->Node) {
1062 Range->Bounds.SignedMaximum = (VolTable[i].max << 16);
1063 Range->Bounds.SignedMinimum = (VolTable[i].min << 16);
1064 Range->SteppingDelta = (VolTable[i].step << 16);
1065 ntStatus = STATUS_SUCCESS;
1066 }
1067 }
1068 if (!NT_SUCCESS(ntStatus)) {
1069 switch (PropertyRequest->Node) {
1071 Range->Bounds.SignedMaximum = 0;
1072 Range->Bounds.SignedMinimum = (-60 << 16);
1073 Range->SteppingDelta = (4 << 16);
1074 ntStatus = STATUS_SUCCESS;
1075 break;
1077 Range->Bounds.SignedMaximum = 0;
1078 Range->Bounds.SignedMinimum = (-56 << 16);
1079 Range->SteppingDelta = (8 << 16);
1080 ntStatus = STATUS_SUCCESS;
1081 break;
1082 }
1083 }
1084 Range->Reserved = 0;
1085
1086 PropertyRequest->ValueSize = sizeof(KSPROPERTY_DESCRIPTION) + sizeof(KSPROPERTY_MEMBERSHEADER) + sizeof(KSPROPERTY_STEPPING_LONG);
1087 } else {
1088 PropertyRequest->ValueSize = sizeof(KSPROPERTY_DESCRIPTION);
1089 ntStatus = STATUS_SUCCESS;
1090 }
1091 } else if (PropertyRequest->ValueSize >= sizeof(ULONG)) {
1092 PULONG AccessFlags = PULONG(PropertyRequest->Value);
1094 PropertyRequest->ValueSize = sizeof(ULONG);
1095 ntStatus = STATUS_SUCCESS;
1096 }
1097
1098 return ntStatus;
1099}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define DBGPRINT(...)
Definition: pdo.c:21
#define SIZEOF_ARRAY(ar)
Definition: cdrom.h:1482
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
@ VT_I4
Definition: compat.h:2298
@ KSNODE_TOPO_MICIN_VOLUME
Definition: interfaces.hpp:409
@ KSNODE_TOPO_AUX_VOLUME
Definition: interfaces.hpp:408
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
#define KSPROPERTY_TYPE_BASICSUPPORT
Definition: dmksctrl.h:45
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
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 KSPROPERTY_MEMBER_STEPPEDRANGES
Definition: ks.h:1559
#define KSPROPTYPESETID_General
Definition: ks.h:858
struct KSPROPERTY_STEPPING_LONG * PKSPROPERTY_STEPPING_LONG
struct KSPROPERTY_DESCRIPTION * PKSPROPERTY_DESCRIPTION
struct KSPROPERTY_MEMBERSHEADER * PKSPROPERTY_MEMBERSHEADER
const VolumeTable VolTable[]
#define ASSERT(a)
Definition: mode.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG Id
Definition: dmksctrl.h:77
ULONG Flags
Definition: dmksctrl.h:78
GUID Set
Definition: dmksctrl.h:76
ULONG DescriptionSize
Definition: ks.h:1540
KSIDENTIFIER PropTypeSet
Definition: ks.h:1541
ULONG MembersListCount
Definition: ks.h:1542
Definition: range.c:39
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
Definition: dlist.c:348

◆ CreateMiniportTopologyCMI()

NTSTATUS NTAPI CreateMiniportTopologyCMI ( PUNKNOWN Unknown,
REFCLSID  ,
PUNKNOWN  UnknownOuter,
POOL_TYPE  PoolType 
)

Definition at line 38 of file mintopo.cpp.

39{
40 PAGED_CODE();
42 STD_CREATE_BODY_(CCMITopology,Unknown,UnknownOuter,PoolType,PMINIPORTTOPOLOGY);
43}
@ Unknown
Definition: i8042prt.h:114
IMiniportTopology * PMINIPORTTOPOLOGY
Definition: portcls.h:1443
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815

◆ PropertyHandler_ComponentId()

NTSTATUS NTAPI PropertyHandler_ComponentId ( PPCPROPERTY_REQUEST  PropertyRequest)

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}
CMI8738Info * cm
Definition: mintopo.hpp:39
#define CMIPCI_VERSION
Definition: interfaces.hpp:292
#define MANUFACTURER_CM8738
Definition: interfaces.hpp:289
#define COMPONENT_CM8738
Definition: interfaces.hpp:283
#define PRODUCT_CM8738
Definition: interfaces.hpp:277
#define GUID_NULL
Definition: ks.h:106
struct KSCOMPONENTID * PKSCOMPONENTID
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
GUID Component
Definition: ks.h:1466
GUID Product
Definition: ks.h:1465
GUID Name
Definition: ks.h:1467
GUID Manufacturer
Definition: ks.h:1464
ULONG Revision
Definition: ks.h:1469
ULONG Version
Definition: ks.h:1468
PUNKNOWN MajorTarget
Definition: portcls.h:258

◆ PropertyHandler_CpuResources()

NTSTATUS NTAPI PropertyHandler_CpuResources ( PPCPROPERTY_REQUEST  PropertyRequest)

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}
@ KSNODE_TOPO_INVALID
Definition: interfaces.hpp:438
#define KSAUDIO_CPU_RESOURCES_NOT_HOST_CPU
Definition: ksmedia.h:1198
long LONG
Definition: pedump.c:60
int32_t * PLONG
Definition: typedefs.h:58

◆ PropertyHandler_Level()

NTSTATUS NTAPI PropertyHandler_Level ( PPCPROPERTY_REQUEST  PropertyRequest)

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)) {
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) {
1231 ntStatus = BasicSupportHandler(PropertyRequest);
1232 break;
1233 }
1234 }
1235
1236 return ntStatus;
1237}
static NTSTATUS BasicSupportHandler(PPCPROPERTY_REQUEST PropertyRequest)
Definition: mintopo.cpp:1031
DWORD UInt32
Definition: chm_lib.c:104
UInt8 auxVolumeRegister
Definition: mintopo.hpp:40
PCMIADAPTER CMIAdapter
Definition: mintopo.hpp:38
UInt8 micVolumeRegister
Definition: mintopo.hpp:40
UInt32 NodeCache[2 *KSNODE_TOPO_INVALID]
Definition: mintopo.hpp:42
#define REG_MIXER3
Definition: cmireg.hpp:146
#define REG_MIXER2
Definition: cmireg.hpp:139
#define UInt8
Definition: interfaces.hpp:75
#define CHAN_RIGHT
Definition: interfaces.hpp:67
@ KSNODE_TOPO_CD_VOLUME
Definition: interfaces.hpp:406
@ KSNODE_TOPO_MICOUT_VOLUME
Definition: interfaces.hpp:402
@ KSNODE_TOPO_LINEOUT_VOLUME
Definition: interfaces.hpp:404
@ KSNODE_TOPO_LINEIN_VOLUME
Definition: interfaces.hpp:407
@ KSNODE_TOPO_WAVEOUT_VOLUME
Definition: interfaces.hpp:400
#define CHAN_LEFT
Definition: interfaces.hpp:66
GLenum GLint GLuint mask
Definition: glext.h:6028
static int reg
Definition: i386-dis.c:1290
@ KSPROPERTY_AUDIO_VOLUMELEVEL
Definition: ksmedia.h:1057
#define for
Definition: utility.h:88
#define shift
Definition: input.c:1755
#define min(a, b)
Definition: monoChain.cc:55
const PCPROPERTY_ITEM * PropertyItem
Definition: portcls.h:261
#define max(a, b)
Definition: svc.c:63
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56

◆ PropertyHandler_OnOff()

NTSTATUS NTAPI PropertyHandler_OnOff ( PPCPROPERTY_REQUEST  PropertyRequest)

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
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;
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;
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;
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
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) {
976 supported = true;
977 }
978 }
979
980 if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_LOUDNESS) {
981 switch (PropertyRequest->Node) {
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}
UInt32 masterMuteDummy
Definition: mintopo.hpp:43
BOOLEAN settingsLoaded
Definition: mintopo.hpp:44
#define MUTE_RAUX_R
Definition: cmireg.hpp:144
#define EN_SPDCOPYRHT
Definition: cmireg.hpp:103
#define SBREG_IN_CTRL_R
Definition: cmireg.hpp:168
#define BASS2LINE
Definition: cmireg.hpp:100
#define SBREG_OUTPUTCTRL
Definition: cmireg.hpp:160
#define SEL_SPDIFI2
Definition: cmireg.hpp:113
#define REG_MIXER1
Definition: cmireg.hpp:129
#define INV_SPDIFI2
Definition: cmireg.hpp:66
#define EN_WAVEIN_R
Definition: cmireg.hpp:133
#define SBREG_IN_CTRL_L
Definition: cmireg.hpp:167
#define REAR2LINE
Definition: cmireg.hpp:135
#define EN_MIC
Definition: cmireg.hpp:161
#define REG_LEGACY
Definition: cmireg.hpp:98
#define SEL_SPDIFI1
Definition: cmireg.hpp:71
#define CENTER2LINE
Definition: cmireg.hpp:99
#define CENTER2MIC
Definition: cmireg.hpp:150
#define REG_MIXER4
Definition: cmireg.hpp:148
#define EN_SPDI2DAC
Definition: cmireg.hpp:130
#define EN_LINEIN_L
Definition: cmireg.hpp:164
#define EN_SPDO5V
Definition: cmireg.hpp:121
#define LOOP_SPDF
Definition: cmireg.hpp:50
#define REG_MISCCTRL
Definition: cmireg.hpp:111
#define MUTE_WAVE
Definition: cmireg.hpp:136
#define EN_LINEIN_R
Definition: cmireg.hpp:165
#define EN_CD_R
Definition: cmireg.hpp:163
#define MUTE_RAUX_L
Definition: cmireg.hpp:143
#define EN_WAVEIN_L
Definition: cmireg.hpp:132
#define MUTE_AUX_R
Definition: cmireg.hpp:142
#define MUTE_AUX_L
Definition: cmireg.hpp:141
#define INV_SPDIFI1
Definition: cmireg.hpp:149
#define SBREG_EXTENSION
Definition: cmireg.hpp:170
#define REG_CHFORMAT
Definition: cmireg.hpp:60
#define DIS_MICGAIN
Definition: cmireg.hpp:140
#define EN_MICBOOST
Definition: cmireg.hpp:171
#define EN_CD_L
Definition: cmireg.hpp:162
#define REG_FUNCTRL1
Definition: cmireg.hpp:43
#define REAR2FRONT
Definition: cmireg.hpp:134
#define POLVALID
Definition: cmireg.hpp:64
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ VT_BOOL
Definition: compat.h:2306
@ KSNODE_TOPO_BASS2LINE
Definition: interfaces.hpp:429
@ KSNODE_TOPO_MICOUT_MUTE
Definition: interfaces.hpp:414
@ KSNODE_TOPO_XCHG_FB
Definition: interfaces.hpp:428
@ KSNODE_TOPO_CENTER2LINE
Definition: interfaces.hpp:430
@ KSNODE_TOPO_REAR2LINE
Definition: interfaces.hpp:434
@ KSNODE_TOPO_MICOUT_LOUDNESS
Definition: interfaces.hpp:411
@ KSNODE_TOPO_CD_MUTE
Definition: interfaces.hpp:412
@ KSNODE_TOPO_AUX_MUTE_IN
Definition: interfaces.hpp:418
@ KSNODE_TOPO_IEC_OUT
Definition: interfaces.hpp:422
@ KSNODE_TOPO_IEC_LOOP
Definition: interfaces.hpp:433
@ KSNODE_TOPO_IEC_POLVALID
Definition: interfaces.hpp:432
@ KSNODE_TOPO_LINEIN_MUTE
Definition: interfaces.hpp:413
@ KSNODE_TOPO_WAVEOUT_MUTE
Definition: interfaces.hpp:401
@ KSNODE_TOPO_IEC_5V
Definition: interfaces.hpp:421
@ KSNODE_TOPO_IEC_INVERSE
Definition: interfaces.hpp:423
@ KSNODE_TOPO_IEC_COPYRIGHT
Definition: interfaces.hpp:431
@ KSNODE_TOPO_AUX_MUTE
Definition: interfaces.hpp:415
@ KSNODE_TOPO_WAVEOUT_MUTE_IN
Definition: interfaces.hpp:420
@ KSNODE_TOPO_IEC_SELECT
Definition: interfaces.hpp:425
@ KSNODE_TOPO_IEC_MONITOR
Definition: interfaces.hpp:424
@ KSNODE_TOPO_CD_MUTE_IN
Definition: interfaces.hpp:419
@ KSNODE_TOPO_CENTER2MIC
Definition: interfaces.hpp:435
@ KSNODE_TOPO_LINEIN_MUTE_IN
Definition: interfaces.hpp:416
@ KSNODE_TOPO_MIC_MUTE_IN
Definition: interfaces.hpp:417
@ KSNODE_TOPO_MASTER_MUTE_DUMMY
Definition: interfaces.hpp:436
@ KSNODE_TOPO_MICIN_LOUDNESS
Definition: interfaces.hpp:410
unsigned int BOOL
Definition: ntddk_ex.h:94
@ KSPROPERTY_AUDIO_MUTE
Definition: ksmedia.h:1066
@ KSPROPERTY_AUDIO_LOUDNESS
Definition: ksmedia.h:1076
#define BOOL
Definition: nt_native.h:43
bool enableSPDIFIn
Definition: interfaces.hpp:146
bool enableSPDIFInMonitor
Definition: interfaces.hpp:147
bool enableSPDIFOut
Definition: interfaces.hpp:145
BOOL * PBOOL
Definition: windef.h:161

◆ PropertyHandler_Private()

NTSTATUS NTAPI PropertyHandler_Private ( PPCPROPERTY_REQUEST  PropertyRequest)

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);
1354 } else if (PropertyRequest->ValueSize < sizeof (CMIDATA)) {
1355 PropertyRequest->ValueSize = 0;
1357 }
1358
1359 CMIDATA* cmiData = (CMIDATA*)PropertyRequest->Value;
1360#ifdef WAVERT
1362#else
1364#endif
1367 cmiData->IOBase = (USHORT)((ULONG_PTR)that->cm->IOBase);
1368 cmiData->MPUBase = (USHORT)((ULONG_PTR)that->cm->MPUBase);
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);
1400 } else if (PropertyRequest->ValueSize < sizeof (CMIDATA)) {
1401 PropertyRequest->ValueSize = 0;
1403 }
1404 CMIDATA* cmiData = (CMIDATA*)PropertyRequest->Value;
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
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 }
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 }
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) {
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 }
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}
#define CMIVERSION
Definition: debug.hpp:31
CMIDATA cmiData
Definition: main.h:77
if(dx< 0)
Definition: linetemp.h:194
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
unsigned short USHORT
Definition: pedump.c:61
#define KSPROPERTY_CMI_SET
Definition: property.h:40
#define KSPROPERTY_CMI_GET
Definition: property.h:39
UInt32 * MPUBase
Definition: interfaces.hpp:142
UInt32 * IOBase
Definition: interfaces.hpp:141
UInt32 maxChannels
Definition: interfaces.hpp:136
UInt32 formatMask
Definition: interfaces.hpp:148
UInt32 enableBass2Line
Definition: property.h:71
int hardwareRevision
Definition: property.h:65
UInt32 loopSPDI
Definition: property.h:81
UInt32 enableSPDO5V
Definition: property.h:76
UInt32 enableCenter2Line
Definition: property.h:72
UInt32 enableSPDIMonitor
Definition: property.h:69
UInt32 enableRear2Line
Definition: property.h:73
UInt32 enableCenter2Mic
Definition: property.h:74
UInt16 IOBase
Definition: property.h:66
UInt32 select2ndSPDI
Definition: property.h:78
UInt32 invertPhaseSPDI
Definition: property.h:79
char driverVersion[32]
Definition: property.h:64
UInt32 formatMask
Definition: property.h:82
UInt32 enableSPDI
Definition: property.h:83
UInt32 enableSPDOCopyright
Definition: property.h:77
UInt32 exchangeFrontBack
Definition: property.h:70
UInt16 MPUBase
Definition: property.h:67
UInt32 invertValidBitSPDI
Definition: property.h:80
UInt32 enableSPDO
Definition: property.h:75
UInt32 maxChannels
Definition: property.h:68
uint32_t ULONG_PTR
Definition: typedefs.h:65
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList