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

📄 am_hw_primitive_builder_main.cc

📁 Motorola synergy audio component
💻 CC
📖 第 1 页 / 共 5 页
字号:
                                UINT8 dsp_seq){    UINT8 index_source;    UINT8 index_destination;    AM_AUDIO_INFO hardware_reset_info         = *am_hw_current_info_ptr;    hardware_reset_info.hardware_gain_mic     = 0x00000000;    hardware_reset_info.hardware_gain_speaker = 0x00000000;    hardware_reset_info.tone.type             = tone;    hardware_reset_info.vib_type              = DL_AUDIO_TONE_TYPE_INVALID_TONE;    hardware_reset_info.path_type             = AM_AUDIO_PATH_ID_INVALID_TONE;    hardware_reset_info.dsp_seq               = dsp_seq;    hardware_reset_info.mic                   = HAPI_AUD_IN_SEL_NO_MIC;#if (MAKE_HDW_EMU_BUS == TRUE)    if ((!(DL_AccGetConnectionStatus(DL_ACC_DM_FAST_CHRGR_SIHF)))    &&  (!(DL_AccGetConnectionStatus(DL_ACC_DM_MID_CHRGR_SIHF))) )#endif    {        hardware_reset_info.speaker           = HAPI_AUD_OUT_SEL_NO_SPEAKER;    }    hardware_reset_info.ctg_gain              = 0;    hardware_reset_info.echo_mode             = ECHO_MODE_NONE;    hardware_reset_info.SAP_config            = SAP_DEFAULT_CONFIG;    hardware_reset_info.instruction_mask      = 0;    hardware_reset_info.tone_insertion_method = 0;#if ( (MAKE_FTR_VR == TRUE) || (MAKE_FTR_VA == TRUE) )    hardware_reset_info.va_vr_command         = AM_VA_VR_ABORT_CMD;    hardware_reset_info.va_vr_data_ptr        = NULL;#endif    hardware_reset_info.phone_mode            = ~(1<<AM_HANDSFREE_AUDIO);    hardware_reset_info.dai_mode              = DL_AUDIO_TONE_TYPE_DAI_NORMAL;    hardware_reset_info.dai_type              = 0x0000;    hardware_reset_info.codec_type            = NO_CODEC;    hardware_reset_info.sampling_rate         = AM_SAMPLING_RATE_08_00;    for( index_source = 0; index_source <= MATRIX_SOURCE_MAX; index_source++ )    {        for( index_destination = 0; index_destination <= MATRIX_DESTINATION_MAX; index_destination++ )        {            hardware_reset_info.matrix[ index_source ][ index_destination ] = DISCONNECT_DSP_AUDIO;        }    }    clear_bit(hardware_reset_info.instruction_mask, AM_I_MASK_ACTIVE_AUDIO);    if (tone_path != am_hw_current_info_ptr->path_type)    {        //  Turn off all HW settings.        undo_audio_path ( &hardware_reset_info, AM_HW_TRANSITION_TO_OFF );    }    stop_vibrator();        }voidAM_HW_Primitive_Builder::power_down (){    reset (DL_AUDIO_TONE_TYPE_INVALID_TONE, AM_AUDIO_PATH_ID_INVALID_TONE, 0);}/* DESCRIPTION       Function to execute the incoming audio info data. This function will compare        the current state of the audio to the new state, and update the parts        that need to be update.         INPUTS       info_ptr: pointer to the structure containing audio information.   OUTPUTS       None.   IMPORTANT NOTES:       None.*/voidAM_HW_Primitive_Builder::execute (AM_AUDIO_INFO *info_ptr){    feature_setting =  DL_DbFeatureGetCurrentState (DL_DB_FEATURE_ID_PATH_TYPE, &feature_setting);    static BOOL first_time = TRUE;        //  Determine the type of audio/power IC that is in this phone.    static  UINT8  am_audio_power_ic = HAPI_get_power_ic_type();    //  transition_type is used to determine what (if anything) needs    //  to be turned off before setting up the new audio event.    //  If the new tone type and the old tone type are both hi-fi or both    //  lo-fi, for example, most of the settings do not need to change.    UINT8  transition_type = AM_HW_TRANSITION_NONE;    /**************************************************************************                                AUDIO SETUP TRANSITION TABLE                                     Incoming (New) Tone             Column         1                2                3                   .......................................................       R           :                 :                 :                 :       o           :     LO-FI       :     HI_FI       :      DAI        :       w  .........:_________________:_________________:_________________:          :        |                 |(C)              |(D)              |          :        |       No        |     Lo-Fi       |   Transition    |       1  : LO_FI  |   Transition    |      To         |   Lo-Fi To      |          :        |                 |     Hi-Fi       |      DAI        |    C     :........|_________________|_________________|_________________|    u     :        |(B)              |                 |(B)              |    r     :        |     Hi-Fi       |      No         |     Hi-Fi       |    r  2  : HI_FI  |      To         |   Transition    |      To         |    e     :        |     Lo-Fi       |                 |     Lo-Fi       |    n     :........|_________________|_________________|_________________|    e     :        |                 |(C)              |                 |    t     :        |       No        |     Lo-Fi       |       No        |       3  : DAI    |   Transition    |      To         |   Transition    |          :        |                 |     Hi-Fi       |                 |    T     :........|_________________|_________________|_________________|    o     :        |(A)              |(A)              |(A)              |    n     :        |   Transition    |    Transition   |   Transition    |    e  4  : NONE   |       To        |        To       |       To        |          :        |       On        |        On       |       On        |          :........|_________________|_________________|_________________|    Please note that even a 'No Transition' in the audio setup can still    require a change in the speaker, mic, and amplitudes if there is an    accessory or volume change, for example.     However, hPortWrite()'s will turn off anything on other than what is requested.    **************************************************************************/    if ( am_hw_current_info_ptr->codec_type == NO_CODEC )    {        //  Case (A), if the last codec type is NO_CODEC, then the audio path        //  was completely torn down, and we need to set everything up again        //  regardless of what kind of audio we are going to play.        transition_type = AM_HW_TRANSITION_TO_ON;    }    else    if ( isMultimediaHiFi( am_hw_current_info_ptr->tone.fields.id ) == TRUE )    {        if ( isMultimediaHiFi( info_ptr->tone.fields.id ) == FALSE )        {            //  Case (B), turn off the Stereo DAC and configure the Phone Codec.            transition_type = AM_HW_TRANSITION_HIFI_TO_LOFI;        }    }    else    if ( ( am_hw_current_info_ptr->dai_mode != DL_AUDIO_TONE_TYPE_DAI_NORMAL   )    ||   ( isMultimediaHiFi( am_hw_current_info_ptr->tone.fields.id ) == FALSE ) )    {        if ( isMultimediaHiFi( info_ptr->tone.fields.id ) == TRUE )        {            //  Case (C), we're in DAI mode and need to play Hi-Fi.            transition_type = AM_HW_TRANSITION_LOFI_TO_HIFI;        }        else        if ( ( isMultimediaHiFi( am_hw_current_info_ptr->tone.fields.id ) == FALSE )        &&   ( am_hw_current_info_ptr->dai_mode == DL_AUDIO_TONE_TYPE_DAI_NORMAL   )        &&   ( info_ptr->dai_mode               != DL_AUDIO_TONE_TYPE_DAI_NORMAL   ) )        {            //  Case (D), we're playing Lo-Fi and need to start DAI.            //  Because we're going to cycle power to the phone codec,            //  we'd better stop any current audio.            transition_type = AM_HW_TRANSITION_LOFI_TO_DAI;        }    }    UINT32 delta_I_mask = am_hw_current_info_ptr->instruction_mask ^ info_ptr->instruction_mask;    current_tone_name = info_ptr->tone.fields.id;    //  Only for AUL must we gracefully turn off the last audio event.    if ( am_audio_power_ic == HAPI_POWER_IC_TYPE_AUL )    {        //  Don't turn off settings if the transition doesn't require it.        if ( ( transition_type == AM_HW_TRANSITION_LOFI_TO_HIFI )        ||   ( transition_type == AM_HW_TRANSITION_LOFI_TO_DAI  )        ||   ( transition_type == AM_HW_TRANSITION_HIFI_TO_LOFI )        ||   ( read_bit ( delta_I_mask, AM_I_MASK_SPKR_FILTER ) ) )        {            //  Turn off the HW and stop the DSP for the current tone.            //  Note that we are passing the pointer referencing the            //  audio event about to play.            //  We will use it to minimize the number of changes to be made,            //  which in turn will reduce pops and clicks.            //  am_hw_current_info_ptr is global, so it doesn't need to be passed.            undo_audio_path( info_ptr, transition_type );        }    }    //============   TAKE PHONE OUT OF LOW POWER MODE   ============    if ( read_bit( delta_I_mask, AM_I_MASK_ACTIVE_AUDIO ) )     {        if( read_bit( info_ptr->instruction_mask, AM_I_MASK_ACTIVE_AUDIO ) )        {            //  Take phone out of low power mode.            activate_power( TRUE, info_ptr->codec_type );        }        else        {            //  The active audio state changed and the audio is no longer active.            //  We can have temporarily stuck non-audible va/vr tones on our            //  tone queue which inhibit going into low power mode.            //  This else case was added to make sure we go into low power            //  if the only tone being processed is a non-audible va/vr tone.            //  Put the phone into low power mode so that we don't draw any            //  unnecessary current.            activate_power( FALSE, info_ptr->codec_type );        }    }    //  Set a global flag to indicate to the DL_RESMGR whether    //  or not the stack can begin a multimedia alert.    if ( isMultimediaHiFi( info_ptr->tone.fields.id ) == TRUE )    {        aud_set_is_coder_on_allowed( FALSE );    }    //  Determine the audio and power IC used in this phone,    //  and configure it so we can play audio.    if ( am_audio_power_ic == HAPI_POWER_IC_TYPE_AUL )    {        am_enable_AUL( info_ptr, transition_type );    }    else    if ( am_audio_power_ic == HAPI_POWER_IC_TYPE_PCAP )    {        am_enable_PCAP( info_ptr );    }#if (MAKE_HDW_BB_IC != MAKE_HDW_NEPTUNE_LT && MAKE_NEPTUNE_CHIPSET == TRUE)    //============   UPDATE SPEAKER PATH   =============    // For Razor, we want to implement a delay timer before turning OFF the speaker.    // This is to avoid the pops and clicks caused as a result of the SWB+     // being turned ON and OFF by HAPI when we turn on and off a speaker.    // The toggling of the B+ line causes the amp in the headset to turn ON and OFF,    // which is the direct cause of the 'pops'.    // The delay is to avoid toggling turning off the audio power IC as long    // as the user is using the phone at least once every 10 seconds.    if( info_ptr->speaker != am_hw_current_info_ptr->speaker )    {        SU_TIME        am_time_left;        SU_RET_STATUS  err;                //  Stop the timer to turn off the audio power block since we        //  are going to play an audio event.        suStopTimer( am_hardware_delay_timer_handle, &am_time_left, &err );        aud_hPortWrite( HAPI_AUD_OUT_SEL, info_ptr->speaker, AM_HW_AUD_OUT_SEL );    }  #if (MAKE_HDW_EMU_TYPE == MAKE_HDW_EMU_ATLAS_UL)    AUD_DEVICE_AND_VOLUME_T am_dev_and_vol;    //  Read the currently selected device and volume into a local struct.    am_dev_and_vol = *( AUD_DEVICE_AND_VOLUME_T *)aud_get_device_and_volume();        if ( am_dev_and_vol.device == DL_ACC_DM_EMU_STEREO_HEADSET )    {        //  There are only two audio lines in the EMU bus.        //  The EMU stereo headset can be configured to have two stereo        //  channels, or a microphone and one channel of audio (mono)        //  routed to both of the headset speakers.        if ( info_ptr->mic == HAPI_AUD_IN_SEL_NO_MIC )        {            //  Set the EMU stereo headset to use two stereo channels.            HAPI_EMU_ATLAS_set_headset_mode( HAPI_EMU_HEADSET_STEREO );        }        else        {            //  A valid microphone was selected.             //  Set the EMU stereo headset to use a mic,            //  and route one channel of audio to both speakers.            HAPI_EMU_ATLAS_set_headset_mode( HAPI_EMU_HEADSET_MONO );        }    }  #endif  // (MAKE_HDW_EMU_TYPE == MAKE_HDW_EMU_ATLAS_UL)    suSleep( 14, NULL );#endif  // (MAKE_HDW_BB_IC != MAKE_HDW_NEPTUNE_LT && MAKE_NEPTUNE_CHIPSET == TRUE)    //  When we call HAPI to configure HW for DAI, they first read the    //  audio codec register settings we've set, then the perform a DF_RESET,    //  set up the codec for DAI based on their DAI state, and OR our    //  changes with their DAI setings.    //  HAPI gets the same DAI indication the AM does, so they will know    //  whether to set up or tear down DAI when we call them.    if ( info_ptr->dai_mode != am_hw_current_info_ptr->dai_mode )    {        //  If the DAI mode has changed, call HAPI to do all DAI configuration.        hPortConfigure( HAPI_SMART_AUDIO_DAI_EN );    }    else    if (    (    ( transition_type    == AM_HW_TRANSITION_TO_ON        )              || ( transition_type    == AM_HW_TRANSITION_HIFI_TO_LOFI )              || ( transition_type    == AM_HW_TRANSITION_LOFI_TO_HIFI )              || ( transition_type    == AM_HW_TRANSITION_LOFI_TO_DAI  )            )         &&      ( am_audio_power_ic  == HAPI_POWER_IC_TYPE_AUL        )         &&      ( info_ptr->dai_mode != DL_AUDIO_TONE_TYPE_DAI_NORMAL )       )    {        //  This 2nd case is here because if we have done a DF_RESET to the AUL,        //  then the AUD_CODEC register has been cleared, taking the phone out        //  of DAI mode. Therefore, if this is an AUL product and we are         //  currently in DAI mode, and if the current transaction type required        //  a DF_RESET, then we need to call HAPI to reconfigure the phone        //  for DAI.

⌨️ 快捷键说明

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