⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chips.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            if ( __cKeyShift < ( -1*(char)NORMALKEY_OFFSET) )
                __cKeyShift= -1* (char)NORMALKEY_OFFSET;
            //_bCHIPSTmp=MSG_KEYDOWN;
            break ;

        case CHIPS_NORMAL :
            //_bCHIPSTmp=MSG_KEYNORMAL;
            __cKeyShift=NULL;
            break ;

        case CHIPS_TOGGLE :
            break ;

        case CHIPS_LEVEL :
            return __cKeyShift ;

        case CHIPS_SUPPORT :
            return TRUE ;

        default :
            break ;
    }
#ifdef KARAOKE  // WWH_HC2500
    KARAOKE_SurroundControl(__bSurround);
    KARAOKE_KeyShift(__cKeyShift + NORMALKEY_OFFSET);
#endif  //#else
    CHIPS_OpenAudio ( TRUE );
//#endif
	// Brian1.00, use MSG_KEY to Replace MSG_KEYUP, MSG_KEYDWON and MSG_KEYNORMAL 
    //OSD_OUTPUT_MACRO((BYTE)_bCHIPSTmp, __cKeyShift+ NORMALKEY_OFFSET, 1);
	OSD_OUTPUT_MACRO(MSG_KEY, (WORD)(__cKeyShift+ NORMALKEY_OFFSET), 1);
	
    return TRUE;
}


// LLY.278-1, add for setting Equalizer mode
//  ***********************************************************************
//  Function    :   CHIPS_SoundEffect
//  Description :   Set some "Sound Effect" mode, ex. Surround/ Equalizer
//  Arguments   :   bAction, specify the desired action
//                  CHIPS_TOGGLE, toggle all mode
//                  CHIPS_SETTING, set the desired parameter
//  Return      :   TRUE, program ok
//                  FALSE, don't support this feature
//  Side Effect :
//  ***********************************************************************
// LLY2.78b, re-adjust the procedure while program EQ mode
// [1] Let it can run-time switch EQ mode
// [2] Send "EQ setting" message first
// [3] Enter pause mode before start EQ setting
// [4] Restore original command after EQ setting ok
//Kevin2.81 review AVSys:
//1. Modify EQ key control
//- to be similar to AMP's and to meet the 908 EQ UI design. 
//2. Modify  user-defined EQ key control
//- meet the 908 EQ UI design. 
//- to make the key controls the same between 28 & 908, doesn't enable this in CT9928, but enable it in CT908    
BYTE CHIPS_SoundEffect(BYTE bAction)
{
#ifdef  SUPPORT_EQUALIZER
    // LLY.278a, performance issue while EQ mode setting
    // In DVD player mode: only support EQ mode setting while non-playing
    // Others: always let it go
    //if(__bAUXChannel==AUX_CHANNEL_DVD && __btPlaying)
    //    return  FALSE;

    //Kevin2.81, Filter if the desired function is supported or not in one place
    if (!_CHIPS_FilterFunSupport(CHIPS_SOUNDEFFECT))
        return FALSE;  
        
    __dwTimeEQ = UTL_GetSysTimer();         
    

    //---------- enter/exit EQ mode ----------//
    if (bAction==EQ_MODE_ENTER_EXIT)
    {
        if ( (__bSoundEffect&EQ_ADJUST_USER_DEFINED_EQ) || (__bSoundEffect&EQ_ADJUST_MAIN_EQ) )
        {   
            //exit EQ
            __bSoundEffect &= ~(EQ_ADJUST_USER_DEFINED_EQ|EQ_ADJUST_MAIN_EQ); 
            OSD_OUTPUT_MACRO(MSG_SOUND_EFFECT, CLEAR_MSG, NULL); 
            //OSD_OUTPUT_MACRO(MSG_USEREQ, CLEAR_MSG, NULL); 
        }
        else
        {            
            //enter EQ
            //will go thru the following main EQ adjust mode            
            ///OSD_OUTPUT_MACRO(MSG_SOUND_EFFECT, __bSoundEffect, 0x3);
            __bSoundEffect |= EQ_ADJUST_MAIN_EQ;
        }            

        ///return TRUE;        
    }


    //---------- in main EQ adjust mode ----------//
    if ( __bSoundEffect&EQ_ADJUST_MAIN_EQ )
    {
        __bSoundEffect &= ~EQ_ADJUST_MAIN_EQ;      
        
        switch(bAction)
        {
#ifdef SUPPORT_USER_DEFINED_EQ            
        case    KEY_RIGHT:
        case    KEY_PLAY:
        case    KEY_ENTER:
        case    KEY_PLAY_PAUSE:
            if (__bSoundEffect == SOUND_EFFECT_USER_DEFINED)
            {
                __bSoundEffect |= EQ_ADJUST_USER_DEFINED_EQ; //set the bit of "user defined EQ adjustable" 
                bAction=KEY_NO_KEY;
                //otherwise, KEY_RIGHT will go thru the following user-defined EQ adjust mode
                __bBandSelect = BAND_SELECT_BEGIN;
            }
            break;               
#endif            
        case    KEY_DOWN:
            //Kevin2.78AVSys
            if(__bSoundEffect < SOUND_EFFECT_MODE_END)
                __bSoundEffect++;
            break;
    
        case    KEY_UP:
            //Kevin2.78AVSys
            if(__bSoundEffect > SOUND_EFFECT_MODE_BEGIN)            
                __bSoundEffect--;
            break;
                   
            //Kevin, currently not write to EEPROM
        default:
            break;
        }        
        
        //merge into below later ??? ne careful about 908 UI         
        //if ( bAction==KEY_UP || bAction==KEY_DOWN)
        if ( bAction==KEY_UP || bAction==KEY_DOWN || bAction==EQ_MODE_ENTER_EXIT)
        {
            // Display final EQ mode info. first
            OSD_OUTPUT_MACRO(MSG_SOUND_EFFECT, __bSoundEffect, 0x3);
    
            if(__bAUXChannel == AUX_CHANNEL_DVD)
            {
                // Freeze CDIF first or it might overflow
                // becasue it take more time to do EQ setting
                if(__bServoAutoCtrl == FALSE) //~DVD/CDDA
                {
                    if ( !HAL_CheckCDIF(HAL_CDIF_STOP, NULL) )
                    {
                        __btFreeze = TRUE ;
                        HAL_CheckCDIF (HAL_CDIF_FREEZE_TIME, NULL) ;
                    }
                }
            }
            // Start EQ mode setting
            // wyc2.80, rename function name to AMP_SetEQMode
            AMP_SetEQMode(__bSoundEffect);     
        }
        
        if (!(__bSoundEffect&EQ_ADJUST_USER_DEFINED_EQ))
            __bSoundEffect |= EQ_ADJUST_MAIN_EQ; 
    }            
    
            
//Kevin2.78AVSys         
#ifdef  SUPPORT_USER_DEFINED_EQ  
    //---------- in user-defined EQ adjust mode ----------//       
    if ( __bSoundEffect&EQ_ADJUST_USER_DEFINED_EQ )
    {
        __bSoundEffect &= ~EQ_ADJUST_USER_DEFINED_EQ;
        
        switch(bAction)
        {    
        case    KEY_LEFT:
            if (__bBandSelect > BAND_SELECT_BEGIN)
                __bBandSelect--;
            else
            {
                OSD_OUTPUT_MACRO(MSG_USEREQ, CLEAR_MSG, NULL); 
                OSD_OUTPUT_MACRO(MSG_SOUND_EFFECT, __bSoundEffect, 0x3); 
                __bSoundEffect|=EQ_ADJUST_MAIN_EQ;            
                return TRUE;
            }   
            break;
        case    KEY_RIGHT:
            if (__bBandSelect < BAND_SELECT_END)
                __bBandSelect++;
            break;               
        case    KEY_DOWN:
            if (__bPerAmp[__bBandSelect] > 0) 
                __bPerAmp[__bBandSelect]--;
            break;
        case    KEY_UP:
            if (__bPerAmp[__bBandSelect] < MAX_PER_BAND_AMP) 
                __bPerAmp[__bBandSelect]++;
            break;
                   
            //Kevin, currently not write to EEPROM
        default:
            break;
        }        
        
        __wTemp = MAKEWORD(__bPerAmp[__bBandSelect], __bBandSelect);
        __bKeyMessage = MSG_USEREQ; //see msgchk.txt. MSG_VOLOUME needs to check key. CLEAR_MSG NULL doesn't have to check key.  
        // Display final EQ mode info. first
        OSD_OUTPUT_MACRO(MSG_USEREQ, __wTemp, 0xFF);

        if ( bAction==KEY_UP || bAction==KEY_DOWN)
        {
            if(__bAUXChannel == AUX_CHANNEL_DVD)
            {
                // Freeze CDIF first or it might overflow
                // becasue it take more time to do EQ setting
                if(__bServoAutoCtrl == FALSE) //~DVD/CDDA
                {
                    if ( !HAL_CheckCDIF(HAL_CDIF_STOP, NULL) )
                    {
                        __btFreeze = TRUE ;
                        HAL_CheckCDIF (HAL_CDIF_FREEZE_TIME, NULL) ;
                    }
                }
            }
            // Start EQ mode setting
            // wyc2.80, rename function name to AMP_SetEQMode
            AMP_SetEQMode(__bSoundEffect);      //pass params: __bBandSelect, __bPerAmp, __bSoundEffect 
                                                //tell Hong/YC to modify this function later   
        }        

        __bSoundEffect |= EQ_ADJUST_USER_DEFINED_EQ;    
    }                
#endif //#ifdef  SUPPORT_USER_DEFINED_EQ 
   
    return  TRUE;
#endif  // #ifdef SUPPORT_EQUALIZER
    return  FALSE;

}
                                                           

 
// LLY2.78b-2 create ...
//  **************************************************************************
//  Function    :   CHIPS_Channel_ReMapping
//  Description :   Re-mapping the audio channel output
//                  It will calculate the desired channel mapping mode
//                  And, keep final value in _bChannelMapping
//                  CHANNEL_REMAPPING_NONE, normal output
//                  CHANNEL_REMAPPING_2_TO_2_DOT_1, 2 --> 2.1 mode
//                  CHANNEL_REMAPPING_2_TO_5_DOT_1, 2 --> 5.1 mode
//  Arguments   :   None.
//  Return      :   None
//  Side Effect :   _bChannelRemapping, _bCHIPSTmp
//  **************************************************************************
void CHIPS_Channel_ReMapping(void)
{
#ifdef  SUPPORT_CHANNEL_REMAPPING
//#define _DEBUG_CHANNEL_REMAPPING

    // Step 0: Nothing need to do while AMP not initialize
    if( !(__bInitialStatus & AMP_INITIAL_OK) )
        return;

    // Step 1: Calculate the desired channel remapping mode
    // if non-DVD player mode, always enable 2 -> 2.1 mode
    if(__bAUXChannel != AUX_CHANNEL_DVD)
    {
        _bCHIPSTmp=CHANNEL_REMAPPING_2_TO_2_DOT_1;
    }
    else  // others, must base on setup setting and audio source
    {
        if(__wDiscType & BOOK_DVD)
        {
            // if "audio output setting is 5.1 ch", and "audio source channel is 2 ch"
            // always enable 2 -> 5.1 mode
            if( (__SetupInfo.bAudioAnalogOut ==SETUP_AUDIO_OUTPUT_51CH) && (__bACHN==2) )
            {
                _bCHIPSTmp=CHANNEL_REMAPPING_2_TO_5_DOT_1;
            }
            // if "audio output setting 2 ch", don't care the audio source
            // always enable 2 -> 2.1 mode
            else if(__SetupInfo.bAudioAnalogOut ==SETUP_AUDIO_OUTPUT_2CH)
            {
                _bCHIPSTmp=CHANNEL_REMAPPING_2_TO_2_DOT_1;
            }
            // others, ie SPDIF-RAW/ SPDIF-PCM/ "audio source is non-2ch + setup is 5.1 ch"
            // restore to normal mode
            else
            {
                _bCHIPSTmp=CHANNEL_REMAPPING_NONE;
            }
        }
        else
        {
            // if "audio setting is 2 ch"
            // enable 2 -> 2.1 mode
            if(__SetupInfo.bAudioAnalogOut ==SETUP_AUDIO_OUTPUT_2CH)
            {
                _bCHIPSTmp=CHANNEL_REMAPPING_2_TO_2_DOT_1;
            }
            // others, ie SPDIF-PCM/ SPDIF-RAW/ 5.1 Ch
            // enable 2 -> 5.1 mode
            else
            {
                _bCHIPSTmp=CHANNEL_REMAPPING_2_TO_5_DOT_1;
            }
        }
    }

    // Step 2: Compare the desired mode with current mode
    //         if different: keep it value, and do the correspond setting
    //         if same: nothing need to do
    if(_bCHIPSTmp==_bChannelRemapping)
        return;

    // keep it value in _bChannelRemapping
    _bChannelRemapping=_bCHIPSTmp;

#ifdef  _DEBUG_CHANNEL_REMAPPING
    switch(_bChannelRemapping)
    {
    case    CHANNEL_REMAPPING_NONE:
        //strcpy(__bMsgString, "Normal");
		CT_strcpy(__bMsgString, "Normal"); //Kevin2.31, use CT_strxxx functions instead of string library to save code size 
        OSD_Output(MSG_STRING, NULL, 0x1);
        break;
    case    CHANNEL_REMAPPING_2_TO_2_DOT_1:
        //strcpy(__bMsgString, "2 to 2.1");
		CT_strcpy(__bMsgString, "2 to 2.1"); //Kevin2.31, use CT_strxxx functions instead of string library to save code size 
        OSD_Output(MSG_STRING, NULL, 0x1);
        break;
    case    CHANNEL_REMAPPING_2_TO_5_DOT_1:
        //strcpy(__bMsgString, "2 to 5.1");
		CT_strcpy(__bMsgString, "2 to 5.1"); //Kevin2.31, use CT_strxxx functions instead of string library to save code size 
        OSD_Output(MSG_STRING, NULL, 0x1);
        break;
    }
#endif  // #ifdef _DEBUG_CHANNEL_REMAPPING

    // do the correspond setting
    // wyc2.80, remane function name to AMP_ChannelReMapping
    AMP_ChannelReMapping(_bChannelRemapping);

#endif  // #ifdef SUPPORT_CHANNEL_REMAPPING
}



//  *********************************************************************
//  Function    :   CHIPS_ProLogicControl
//  Description :   set ProLogic|| DM 
//  Arguments   :   None      
//  Return      :   None
//  Side Effect :   None
//  *********************************************************************
//Kevin1.08, create
void    CHIPS_ProLogicControl(void)
{
//#define         W99AV_DM_PROLOGIC_ENABLE        0x0175c //1:enable  0:disable (If src > 2 ch, enable will be of no use)
//#define         W99AV_DM_PROLOGIC_OCFG          0x00de2 
//bit[2:0] chancfg       
//    011: L,R,C
//    110: L,R,Ls,Rs
//    111: L,R,Ls,Rs,C
//bit[5:3] decmode
//    000: ProLogic I
//    001: Virtual
//    010: Music     
//    011: Movie      
//    100: Matrix
//bit[7:6] samprate
//    00 : 48K
//    01 : 44.1K
//    10 : 32K

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -