📄 chips.c
字号:
#include "winav.h"
#include "isr.h"
#include "digest.h"
#include "cc.h"
#include "w99av.h"
#include "input.h"
#include "chips.h"
#include "utl.h"
#include "osd.h"
#include "hal.h"
//TCC028, need reference setup from this release
#include "setup.h"
#ifdef KARAOKE //WWH_HC2500
#include "karaoke.h"
#endif
#include "ucode.h"
#include "cdinfo.h"
#include "avsys.h"
#include "servo.h" // LLY2.78b
#include "navigate.h" // LLY2.78b-2
#include "initial.h" // LLY2.78b-2
#include "amp.h" //Kevin2.80
// Notice: Don't include <string.h> earier than "winav.h"
//#include <string.h> // LLY2.78b
extern BYTE __bModePlay;
extern BYTE __bModeCmd;
extern BIT __btVoiceCancel;
// LLY.161, remove to HAL.C
// LLY.103-1, support DTS or pure CDDA switching
// TRUE, means DTS CDDA; FALSE, means pure CDDA
//BYTE __bCDDA_DTS=TRUE;
// DVD_102Micky, support MIC on/off
// TRUE, means trun on Microphone, else turn off
// TCC274, remove because not used by any module
//char _bMICOn=FALSE;
// TCC274, CHIPS_Initial will initial variables.
//char _b3DLevel=CHIPS_DEFAULT_3DLEVEL;
//char _bEcho=CHIPS_DEFAULT_ECHO ;
//char _bDualMode = 0 ; // Dual Mode
//char _bLFE = 1 ; // LFE enable
//BYTE _bChannelMode = CHIPS_LRD ;
//BYTE _bSurround= CHIPS_DEFAULT_SURROUND; // Record Surround kind
//DWORD _dwVolAudio= VOLUME_DEFAULT;
//char _cKeyShift= CHIPS_DEFAULT_KEY; // Key adjustment; Up/Down
//char _bAudType = 0 ;
//BYTE _bSpDifMode = 0 ; // 1:output compressed bitstream, 0:output stereo lpcm
//BYTE _bForceSpdifOn = 0 ;
char __b3DLevel ;
char __bEchoLevel ;
BYTE __bSurround ; // Record Surround kind
// LLY.278, add for sound effect variables
// Notice: SOUND_EFFECT may contain Surround/ Equalize !!
BYTE __bSoundEffect;
BYTE __bVocal ;
// Chuan0.81, The SAVCR of CT908 is 20 bit
DWORD __wVolAudio ;
//DWORD __dwPreVolAudio; //Kevin1.00, add
#ifndef NO_MIC_INPUT //Kevin1.10
DWORD __wMICVol;
BYTE _bVolOrMIC; //1: MIC 0:VOLUME
#endif
char __cKeyShift ; // Key adjustment; Up/Down
char _bDualMode ;
char _bAudType ;
BYTE _bSpDifMode ; // 1:output compressed bitstream, 0:output stereo lpcm (Kevin0.84a add)2:disable spdif output
//BYTE _bForceSpdifOn ; // TCC274, remove this variable.
BYTE _bChannelMode ;
char _bLFE ;
BYTE _bChannelRemapping;
// wyc.278-AVSys, add one variable __bAMPVol for control AMP main volume.
#ifdef SUPPORT_AV_SYSTEM
BYTE __bPerVol[AUDIO_CHANNEL_END+1]; // Record each per-channel volume degree.
BYTE __bAudioChannel; // represent current adjusted audio channel.
BYTE __bAMPVol;
// LLY.277a-2, move from CC.C
DWORD __dwTimeAMP; // the time while accessing AMP
BYTE __bAMPActive; // AMP mode
//Kevin2.81 review AVSys, add user defined EQ
#ifdef SUPPORT_EQUALIZER
#ifdef SUPPORT_USER_DEFINED_EQ
BYTE __bPerAmp[BAND_SELECT_END-BAND_SELECT_BEGIN+1]; // Record per-band amp degree.
BYTE __bBandSelect; // represent current adjusted band.
#endif
DWORD __dwTimeEQ; // the time while accessing user defined EQ
//BYTE __bSoundEffect;
#endif
#endif // #ifdef SUPPORT_AV_SYSTEM
// ** TCH1.54; char _bAC3Kok = VOCAL_ON ; // AC3 Karaoke Mode
//Kevin2.80 move initialization of _dwACR1, _dwACR2, & _dwACR3 from chips.c to _INITIAL_Variables_PowerON()
DWORD _dwACR1, _dwACR2, _dwACR3;
// TCC051, for reduce sram
WORD _wCHIPSTmp ;
BYTE _bCHIPSTmp; // LLY.051-1
DWORD _dwCHIPSTemp; // LLY.273
DWORD __dwVOLUME_MAX; //jyliu.yhi
#ifdef RUNTIME_UNZIP_DSP_UCODE
BYTE _bCurDSPType; //Kevin2.31
//BYTE _bPARSECode; //Kevin2.31
#endif
// protected
WORD _TuneCDDA ( WORD wChannel );
void _AudioByPass(BYTE bByPass);
void _SetPCMLen (BYTE bSampleRate) ;
void _SetAudType (BYTE bType) ;
void _ChangeDSPCode (BYTE bType) ;
void _SetAudio (BYTE bAudio) ;
void _SetDualMode (void) ;
BYTE _CHIPS_FilterFunSupport(BYTE bType);
void CHIPS_ControlAnalogOutput(void); //Kevin1.24a
// Brian.170, SW MIC Detect
#ifdef ENABLE_AUTOVOCAL
#define MIC_INPUT_THRESHOLD_HIGH 1450L
#define MIC_INPUT_THRESHOLD_LOW 1280L
#ifdef SW_MIC_DETECT
extern bit __sbMICDetect;
#endif
#endif
// *********************************************************************
// Function : CHIPS_Initial
// Description : It will initial the global variables set to w9922qf
// : to it's default value.
// : Will write the variables to chip only when issue CHIPS_OpenAudio
// Arguments : wInit: The type to initial (Can use || to combine settings)
// CHIPS_INIT_KEY : key control
// CHIPS_INIT_SURROUND : surround type
// CHIPS_INIT_ECHO : echo level
// CHIPS_INIT_3DLEVEL : 3d level
// CHIPS_INIT_VOL : volume level
// CHIPS_INIT_CHANNELMODE : channel mode
// CHIPS_INIT_AC3KOKMODE : ac3 karaoke mode
// CHIPS_INIT_DUALMODE : ac3 dual mode
// CHIPS_INIT_AUDTYPE : audio type
// CHIPS_INIT_ALL : all above settings
// CHIPS_INIT_BYPASS : bypass all setting
// Return : None
// Change :
// Side Effect :
// *********************************************************************
void CHIPS_Initial(WORD wInit)
{
if (wInit != CHIPS_INIT_BYPASS)
{
if (wInit & CHIPS_INIT_KEY) // Initial KEY value
{
// TCC274, use global
__cKeyShift = CHIPS_DEFAULT_KEY ;
}
if (wInit & CHIPS_INIT_SURROUND) // Initial Surround Type
{
// TCC274, use global
__bSurround = CHIPS_DEFAULT_SURROUND ;
// LLY.278-4, initial EQ mode as standard
__bSoundEffect = SOUND_EFFECT_STANDARD;
//Kevin2.81 review AVSys, add user-defined EQ
#ifdef SUPPORT_USER_DEFINED_EQ
for (__bBandSelect=BAND_SELECT_BEGIN; __bBandSelect<=BAND_SELECT_END; __bBandSelect++)
__bPerAmp[__bBandSelect] = DEFAULT_PER_BAND_AMP;
__bBandSelect=BAND_SELECT_BEGIN;
#endif
}
if (wInit & CHIPS_INIT_ECHO) // Initial Echo level
{
// TCC274, use global
__bEchoLevel = CHIPS_DEFAULT_ECHO ;
}
if (wInit & CHIPS_INIT_3DLEVEL) // Initial 3D Level
{
// TCC274, use global
__b3DLevel = CHIPS_DEFAULT_3DLEVEL ;
}
if (wInit & CHIPS_INIT_VOL) // Initial Voice Level
{
// TCC274, use global
__wVolAudio = CHIPS_DEFAULT_VOL ;
//jyliu.yhi
if(__wDiscType == BOOK_CDDA)
{
__dwVOLUME_MAX = VOLUME_MAX_CDDA;
}
else
{
__dwVOLUME_MAX = VOLUME_MAX;
}
__wVolAudio = __dwVOLUME_MAX;
//Kevin1.00, add
//__dwPreVolAudio = 0;
#ifndef NO_MIC_INPUT //Kevin1.10
_bVolOrMIC = 0; //1: MIC Volume 0: Main Volume
#endif
#ifdef SUPPORT_AV_SYSTEM
//Kevin2.81-2, init. amp vol
CHIPS_EPPROMReadWriteVolume(READ_FROM_EPPROM);
// wyc2.80, rename function name to AMP_SetChannelVolume
for(_dwTemp=0;_dwTemp<=8;_dwTemp++) // KCHong, 20030115
AMP_SetChannelVolume(_dwTemp,TRUE);
#endif
}
if (wInit & CHIPS_INIT_CHANNELMODE) // Initial Channel Mode
{
// LLY2.78b-2, program audio channel remapping mode base on
// the setup value and audio source
CHIPS_Channel_ReMapping();
switch (__SetupInfo.bAudioAnalogOut)
{
case SETUP_AUDIO_ANALOG_OUT_2CH :
_bChannelMode = CHIPS_LRD ;
_bLFE = 0 ;
break ;
case SETUP_AUDIO_ANALOG_OUT_51CH :
if (__SetupInfo.bAudioCenter == SETUP_AUDIO_CENTER_ON)
{
if (__SetupInfo.bAudioRear == SETUP_AUDIO_REAR_ON)
_bChannelMode = CHIPS_LCRLSRS ;
else
_bChannelMode = CHIPS_LCR ;
}
else
{
if (__SetupInfo.bAudioRear == SETUP_AUDIO_REAR_ON)
_bChannelMode = CHIPS_LRLSRS ;
else
_bChannelMode = CHIPS_LRD ;
}
if (__SetupInfo.bAudioSubwoofer == SETUP_AUDIO_SUBWOOFER_ON)
_bLFE = 1 ;
else
_bLFE = 0 ;
break ;
//case SETUP_AUDIO_ANALOG_OUT_OFF:
// break;
}
switch (__SetupInfo.bAudioDigitalOut)
{
case SETUP_AUDIO_DIGITAL_OUT_SPDIF_PCM :
_bSpDifMode = 0 ; //pcm
break ;
case SETUP_AUDIO_DIGITAL_OUT_SPDIF_RAW :
_bSpDifMode = 1 ; //raw
break ;
case SETUP_AUDIO_DIGITAL_OUT_OFF:
_bSpDifMode = 2; //off
break;
}
}
if (wInit & CHIPS_INIT_AC3KOKMODE) // Initial AC3 Karaoke Mode
{
__bVocal = CHIPS_DEFAULT_AC3KOKMODE ;
}
if (wInit & CHIPS_INIT_DUALMODE) // Initial Dual Mode
{
// TCC274, call function to set variable
//_bDualMode = CHIPS_DEFAULT_DUALMODE ;
_SetDualMode () ;
}
if (wInit & CHIPS_INIT_AUDTYPE) // Initial Audio Type
{
// TCC274, call function to set variable
//_bAudType = CHIPS_DEFAULT_AUDTYPE ;
_SetAudio (__bAudioType) ;
}
}
//CHIPS_OpenAudio (TRUE) ;
#ifdef KARAOKE // WWH_HC2500
KARAOKE_Initial();
#endif
//Kevin2.81-2, comment
/*
#ifdef SUPPORT_AV_SYSTEM
//Kevin2.80, merge CHIPS_InitialAMPVolume() into CHIPS_Initial()
if (wInit & CHIPS_INIT_AMPVOL) // Initial AMP volume
{
__bAMPVol = DEFAULT_ALL_CHANNEL_VOLUME;
for (_bCHIPSTmp=0; _bCHIPSTmp < EPROM_PER_CHANNEL_VOLUME_BYTE; _bCHIPSTmp++)
__bPerVol[_bCHIPSTmp] = DEFAULT_OTHER_CHANNEL_DEGREE;
// wyc.277a-2, initial the per-channel volume in initial state.
// wyc2.80, rename function name to AMP_SetChannelVolume
AMP_SetChannelVolume(AUDIO_CHANNEL_ALL, TRUE);
AMP_SetChannelVolume(AUDIO_CHANNEL_BASS, TRUE);
AMP_SetChannelVolume(AUDIO_CHANNEL_TREBLE, TRUE);
// LLY.278-4, initial EQ mode as standard
//HAL1_ProgramEQMode(__bSoundEffect);
}
#endif // #ifdef SUPPORT_AV_SYSTEM
*/
}
// *********************************************************************
// Function : CHIPS_KeyControl
// Description : It will do key control according to the parameter
// Arguments : bKey: The type of command
// CHIPS_UP : control up 1 level
// CHIPS_DOWN : control down 1 level
// CHIPS_NORMAL : set to default level
// CHIPS_TOGGLE : toggle between levels in range
// CHIPS_LEVEL : return current level
// CHIPS_SUPPORT : return if this function supported
// Return : TRUE : Supported/Succeeded
// : FALSE : Not supported
// Change : Will turn off surround.
// Will open audio if mute
// Side Effect : Only MPEG1 and AC3 support key control
// *********************************************************************
BYTE CHIPS_KeyControl(BYTE bKey)
{
//Kevin2.81, Filter if the desired function is supported or not in one file
if (!_CHIPS_FilterFunSupport(CHIPS_KEYCONTROL))
return FALSE;
//Kevin1.01, avoid the bo noise when pressing key +/-
CHIPS_OpenAudio (FALSE);
//Kevin0.84a, surround & key can coexist
/*
if (__bSurround )
{
__bSurround=0;
OSD_Output(MSG_SURROUND, __bSurround, 0x0);
}
*/
// key-up/down will open volume
if (__btMute)
{
__btMute= FALSE;
OSD_OUTPUT_MACRO(MSG_MUTE, __btMute, 0 );
}
switch (bKey)
{
case CHIPS_UP :
__cKeyShift++;
if ( __cKeyShift > NORMALKEY_OFFSET )
__cKeyShift= NORMALKEY_OFFSET;
//_bCHIPSTmp=MSG_KEYUP;
break ;
case CHIPS_DOWN :
__cKeyShift--;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -