📄 cxpolarisprop.cpp
字号:
/*+++ *******************************************************************\
*
* Copyright and Disclaimer:
*
* ---------------------------------------------------------------
* This software is provided "AS IS" without warranty of any kind,
* either expressed or implied, including but not limited to the
* implied warranties of noninfringement, merchantability and/or
* fitness for a particular purpose.
* ---------------------------------------------------------------
*
* Copyright (c) 2008 Conexant Systems, Inc.
* All rights reserved.
*
\******************************************************************* ---*/
#include "device.h"
#include "miscfuncs.h"
#include "Cusbintf.h"
#include "PolarisUsbInterface.h"
#include "debug.h"
#include "CxPolarisControl.h"
#include "CxPolarisProp.h"
#include "pcbconfig.h"
/////////////////////////////////////////////////////////////////////////////////////////
//CxPolarisControlProp::static_setEP1AltSetting
//
// Set the EP1 Alternate setting
//
NTSTATUS
CxPolarisControlProp::
static_setEP1AltSetting(
PIRP p_irp,
PPROPERTY_CXPOLARIS_ALT_SETTING p_request,
CXPOLARIS_ALT_SETTING* p_data)
{
NTSTATUS status=STATUS_UNSUCCESSFUL;
Device* p_device = getDevice(p_irp);
if(!p_device)
{
return STATUS_UNSUCCESSFUL;
}
PPCB_CONFIG pcb_config;
pcb_config = p_device->getPcbConfig()->getCurrentPcb();
if(!pcb_config)
{
return STATUS_UNSUCCESSFUL;
}
DbgLogInfo(("CxPolarisControlProp::setep1alt() set %d\n",p_request->data));
status=p_device->getPolarisUsbInterface()->selectInterface(pcb_config->hs_config_info[0].interface_info.ts1_index, p_request->data);//interface 1
return status;
}
/////////////////////////////////////////////////////////////////////////////////////////
//CxPolarisControlProp::static_getEP1AltSetting
//
// Get the EP1 Alternate setting
//
NTSTATUS
CxPolarisControlProp::
static_getEP1AltSetting(
PIRP p_irp,
PPROPERTY_CXPOLARIS_ALT_SETTING p_request,
CXPOLARIS_ALT_SETTING* p_data)
{
Device* p_device = getDevice(p_irp);
if(!p_device)
{
return STATUS_UNSUCCESSFUL;
}
DbgLogInfo(("CxPolarisControlProp::getep1alt() get from device and send to application \n"));
return STATUS_UNSUCCESSFUL;
}
/////////////////////////////////////////////////////////////////////////////////////////
//CxPolarisControlProp::static_setEP2AltSetting
//
// Set the EP2 Alternate setting
//
NTSTATUS
CxPolarisControlProp::
static_setEP2AltSetting(
PIRP p_irp,
PPROPERTY_CXPOLARIS_ALT_SETTING p_request,
CXPOLARIS_ALT_SETTING* p_data)
{
NTSTATUS status=STATUS_UNSUCCESSFUL;
Device* p_device = getDevice(p_irp);
if(!p_device)
{
return STATUS_UNSUCCESSFUL;
}
PPCB_CONFIG pcb_config;
pcb_config = p_device->getPcbConfig()->getCurrentPcb();
if(!pcb_config)
{
return STATUS_UNSUCCESSFUL;
}
DbgLogInfo(("CxPolarisControlProp::setep2alt() set %d\n",p_request->data));
status=p_device->getPolarisUsbInterface()->selectInterface(pcb_config->hs_config_info[0].interface_info.ts2_index, p_request->data);//interface 1
return status;
}
/////////////////////////////////////////////////////////////////////////////////////////
//CxPolarisControlProp::static_getEP2AltSetting
//
// Get the EP2 Alternate setting
//
NTSTATUS
CxPolarisControlProp::
static_getEP2AltSetting(
PIRP p_irp,
PPROPERTY_CXPOLARIS_ALT_SETTING p_request,
CXPOLARIS_ALT_SETTING* p_data)
{
Device* p_device = getDevice(p_irp);
if(!p_device)
{
return STATUS_UNSUCCESSFUL;
}
DbgLogInfo(("CxPolarisControlProp::getep2alt() get from device and send to application \n"));
return STATUS_UNSUCCESSFUL;
}
/////////////////////////////////////////////////////////////////////////////////////////
//CxPolarisControlProp::static_setEP3AltSetting
//
// Set the EP3 Alternate setting
//
NTSTATUS
CxPolarisControlProp::
static_setEP3AltSetting(
PIRP p_irp,
PPROPERTY_CXPOLARIS_ALT_SETTING_EP3 p_request,
CXPOLARIS_ALT_SETTING_EP3* p_data)
{
NTSTATUS status=STATUS_UNSUCCESSFUL;
Device* p_device = getDevice(p_irp);
if(!p_device)
{
return STATUS_UNSUCCESSFUL;
}
PPCB_CONFIG pcb_config;
DWORD tmp = 0;
tmp = p_device->getCurrentConfig();
pcb_config = p_device->getPcbConfig()->getCurrentPcb();
if(!pcb_config)
{
return STATUS_UNSUCCESSFUL;
}
status=p_device->getPolarisUsbInterface()->selectInterface(pcb_config->hs_config_info[tmp].interface_info.audio_index, p_request->data);
DbgLogInfo(("CxPolarisControlProp::static_setEP3AltSetting():pcb_config->hs_config_info[0].interface_info.audio_index=%d",pcb_config->hs_config_info[0].interface_info.audio_index));
/*TODO To set audio decoder correspondingly later on
p_device->lockDeviceState();
if(p_device->isRunning())
{
p_device->unlockDeviceState();
return STATUS_UNSUCCESSFUL;
}
DWORD audio_frequency = 48000;
switch(p_request->data)
{
case CXPOLARIS_ALT0_32:
audio_frequency = 32000;
p_device->setSamplerate(32000);
p_device->getFx2Firmware()->selectInterface(3, 0);
break;
case CXPOLARIS_ALT0_441:
audio_frequency = 44100;
p_device->setSamplerate(44100);
p_device->getFx2Firmware()->selectInterface(3,0);
break;
case CXPOLARIS_ALT0_48:
audio_frequency = 48000;
p_device->setSamplerate(48000);
p_device->getFx2Firmware()->selectInterface(3, 0);
break;
case CXPOLARIS_ALT0_96:
audio_frequency = 96000;
p_device->setSamplerate(96000);
p_device->getFx2Firmware()->selectInterface(3, 0);
break;
case CXPOLARIS_ALT1_32:
audio_frequency = 32000;
p_device->setSamplerate(32000);
p_device->getFx2Firmware()->selectInterface(3, 1);
break;
case CXPOLARIS_ALT1_441:
audio_frequency = 44100;
p_device->setSamplerate(44100);
p_device->getFx2Firmware()->selectInterface(3, 1);
break;
case CXPOLARIS_ALT1_48:
audio_frequency = 48000;
p_device->setSamplerate(48000);
p_device->getFx2Firmware()->selectInterface(3, 1);
break;
case CXPOLARIS_ALT2_96:
audio_frequency = 96000;
p_device->setSamplerate(96000);
p_device->getFx2Firmware()->selectInterface(3, 2);
break;
}
p_device->getDecoder()->setAudioFrequency(audio_frequency);
//Set it in the audio decoder if necessary.
p_device->getAudio()->setFrequency(audio_frequency);
p_device->unlockDeviceState();
*/
return status;
}
/////////////////////////////////////////////////////////////////////////////////////////
//CxPolarisControlProp::static_getEP3AltSetting
//
// Get the EP3 Alternate setting
//
NTSTATUS
CxPolarisControlProp::
static_getEP3AltSetting(
PIRP p_irp,
PPROPERTY_CXPOLARIS_ALT_SETTING_EP3 p_request,
CXPOLARIS_ALT_SETTING_EP3* p_data)
{
Device* p_device = getDevice(p_irp);
if(!p_device)
{
return STATUS_UNSUCCESSFUL;
}
DbgLogInfo(("CxPolarisControlProp::getep3alt() get from device and send to application \n"));
return STATUS_UNSUCCESSFUL;
}
/////////////////////////////////////////////////////////////////////////////////////////
//CxPolarisControlProp::static_setEP4AltSetting
//
// Set the EP4 Alternate setting
//
NTSTATUS
CxPolarisControlProp::
static_setEP4AltSetting(
PIRP p_irp,
PPROPERTY_CXPOLARIS_ALT_SETTING p_request,
CXPOLARIS_ALT_SETTING* p_data)
{
NTSTATUS status=STATUS_UNSUCCESSFUL;
Device* p_device = getDevice(p_irp);
if(!p_device)
{
return STATUS_UNSUCCESSFUL;
}
DbgLogInfo(("CxPolarisControlProp::setep4alt() set %d\n",p_request->data));
PPCB_CONFIG pcb_config;
DWORD tmp = 0;
tmp = p_device->getCurrentConfig();
pcb_config = p_device->getPcbConfig()->getCurrentPcb();
if(!pcb_config)
{
return STATUS_UNSUCCESSFUL;
}
status=p_device->getPolarisUsbInterface()->selectInterface(pcb_config->hs_config_info[tmp].interface_info.video_index, p_request->data);
return status;
}
/////////////////////////////////////////////////////////////////////////////////////////
//CxPolarisControlProp::static_getEP4AltSetting
//
// Get the EP4 Alternate setting
//
NTSTATUS
CxPolarisControlProp::
static_getEP4AltSetting(
PIRP p_irp,
PPROPERTY_CXPOLARIS_ALT_SETTING p_request,
CXPOLARIS_ALT_SETTING* p_data)
{
Device* p_device = getDevice(p_irp);
if(!p_device)
{
return STATUS_UNSUCCESSFUL;
}
return STATUS_UNSUCCESSFUL;
}
/////////////////////////////////////////////////////////////////////////////////////////
//CxPolarisControlProp::static_setEP5AltSetting
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -