audio_power_up.cc

来自「Motorola synergy audio component」· CC 代码 · 共 502 行 · 第 1/2 页

CC
502
字号
#ifdef __cplusplusextern "C" {#endif/*==================================================================================================                                                                                   Module Name:  audio_power_up.c    General Description: Functions needed for Audio Manager to run during power up.====================================================================================================                               Motorola Confidential Proprietary                           Advanced Technology and Software Operations                        (c) Copyright Motorola 1999, All Rights Reserved  Revision History:                            Modification     TrackingAuthor                          Date          Number     Description of Changes-------------------------   ------------    ----------   -------------------------------------------Ravi Subramanyan             05/25/2005     LIBff87431   Feature:13698 - MME support for ClearTalk Support Ravi Subramanyan             10/11/2003     LIBdd60209   Haptics Updates for E398                                                         - Speakerphone compand parameters should follow                                                            haptics settings.Ravi Subramanyan             09/09/2003     LIBdd34023   Need to add place holders in the code for future                                                          companding parametersRavi Subramanyan             08/15/2003     LIBdd30789   Modify the upper bound check for gain table to the                                                          exact size checkRavi Subramanyan             08/08/2003     LIBdd25168   Move the compander parameters into the file systemRavi Subramanyan             07/31/2003     LIBdd19939   Change Audio Gain Table design so that it can be BRed                                                          to common MME Ravi Subramanyan             05/30/2003     LIBbb96110   Single Binary audio gainsMark Taraba                  02/15/2000     CSGce27128   Initial file creation====================================================================================================                                        INCLUDE FILES==================================================================================================*/#include  <ENGINE_AUDIO/aud_pwr_up.h>#include  <ENGINE_AUDIO/am_c_utilities.h>#include  <audio/AM_SendMessage.h>#include  <ENGINE_AUDIO/aud_prim_ids.h>#include  <audio/am_hw_primitive_builder_main.h>#include  <ENGINE_HAPI/hapi_mdi_message_ids.h>/*==================================================================================================                                 LOCAL FUNCTION PROTOTYPES==================================================================================================*//*==================================================================================================                                     LOCAL CONSTANTS==================================================================================================*//*==================================================================================================                          LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)==================================================================================================*//*==================================================================================================                                        LOCAL MACROS==================================================================================================*//*==================================================================================================                                      LOCAL VARIABLES==================================================================================================*//*==================================================================================================                                     GLOBAL VARIABLES==================================================================================================*/const W_CHAR audio_gains_flash[] = { '/','a','/','g','a','i','n','_','t','a','b','l','e','.','b','i','n',0};const W_CHAR audio_params_flash[] = { '/','a','/','p','a','r','a','m','_','t','a','b','l','e','.','b','i','n',0};/*==================================================================================================                                     LOCAL FUNCTIONS==================================================================================================*//*==================================================================================================                                       GLOBAL FUNCTIONS==================================================================================================*//*==================================================================================================FUNCTION: aud_read_gainsDESCRIPTION:    Reads the audio gains out of the file into the corresponding   gain arrays at powerup.ARGUMENTS PASSED:   None  RETURN VALUE:   NonePRE-CONDITIONS:   None POST-CONDITIONS:   NoneIMPORTANT NOTES:   None==================================================================================================*/ voidaud_read_gains (void)                                                           {    DL_FS_HANDLE_T file_handle;    DL_FS_RESULT_T read_result , close_result;    DL_FS_SIZE_T   file_size;    UINT32         elem_read = 0;    if (DL_FsFileExist (audio_gains_flash))    {        file_handle = DL_FsOpenFile(audio_gains_flash, DL_FS_READ_MODE, DL_FS_OWNER_AUDIO);        file_size = DL_FsGetFileSize(file_handle);        if ( ( file_handle != DL_FS_HANDLE_INVALID )        &&   ( file_size == AM_HW_GAINS_TOTAL_BYTES ) )        {            /* This would read the gains currently stored in the file audio_gains into the              array am_hw_gain_table */            read_result = DL_FsReadFile( am_hw_gain_table, /* base address of base gain table   */                                         AM_HW_GAINS_DATA_WIDTH, /* record size */                                         AM_HW_NO_OF_GAIN_TBLS, /* No of records */                                         file_handle,    /* File pointer to read from */                                         &elem_read );   /* Variable to store number of suc reads */            if ( ( read_result == DL_FS_RESULT_READ_SUCCESS )            &&   ( elem_read   == AM_HW_NO_OF_GAIN_TBLS ) )            {                read_result = DL_FsReadFile( am_hw_vol_step_table, /* base address of vol step table */                                             AM_HW_VOL_STEP_TBL_SIZE_IN_BYTES, /* record size */                                             AM_HW_NO_OF_VOL_STEPS_TBLS,  /* No of records */                                             file_handle,    /* File pointer to read from */                                             &elem_read );   /* Variable to store number of suc reads */                if ( ( read_result != DL_FS_RESULT_READ_SUCCESS )                ||   ( elem_read   != AM_HW_NO_OF_VOL_STEPS_TBLS ) )                {                    /* Delete file before panicing so that the file can be flexed                       in without reflashing the phone */                    DL_FsDeleteFile(audio_gains_flash,DL_FS_OWNER_AUDIO) ;                     suPanic( AUD_LOG_GAINS_VOL_STEP_READ_ERROR, 0);                 }            }             else            {                 DL_FsDeleteFile(audio_gains_flash,DL_FS_OWNER_AUDIO) ;                 suPanic( AUD_LOG_GAINS_BASE_GAIN_READ_ERROR, 0);             }                                       }                close_result = DL_FsCloseFile(file_handle);          }}/*==================================================================================================FUNCTION: aud_read_paramsDESCRIPTION:    Reads the audio parameters like companding, audio shaping, haptics coefficients, AVC parameters etc   out of the file into the corresponding gain arrays at powerup.ARGUMENTS PASSED:   None  RETURN VALUE:   NonePRE-CONDITIONS:   None POST-CONDITIONS:   NoneIMPORTANT NOTES:   None==================================================================================================*/ voidaud_read_params (void)                                                           {    DL_FS_HANDLE_T file_handle;    DL_FS_RESULT_T read_result,                     close_result;    DL_FS_SIZE_T   file_size;    UINT32         elem_read = 0;     if (DL_FsFileExist (audio_params_flash))    {        file_handle = DL_FsOpenFile(audio_params_flash, DL_FS_READ_MODE, DL_FS_OWNER_AUDIO);        file_size = DL_FsGetFileSize(file_handle);        if ( ( file_handle != DL_FS_HANDLE_INVALID )        &&   ( file_size == AM_AUDIO_PARAMS_TOTAL_BYTES ) )        {            read_result = DL_FsReadFile( am_audio_shaping_table_rx, /* base address of as rx table   */                                         sizeof(UINT16), /* record size */                                         (AM_COMP_TOTAL_NO_OF_PARAMETERS),  /* No of records */                                         file_handle,    /* File pointer to read from */                                         &elem_read );   /* Variable to store number of suc reads */            if ( ( read_result != DL_FS_RESULT_READ_SUCCESS )            ||   ( elem_read   != (AM_COMP_TOTAL_NO_OF_PARAMETERS) ) )            {                /* Delete file before panicing so that the file can be flexed                   in without reflashing the phone */                 DL_FsDeleteFile(audio_params_flash,DL_FS_OWNER_AUDIO) ;                  suPanic(AUD_LOG_AS_PARAMS_RX_READ_ERROR, 0);            }            read_result = DL_FsReadFile( am_audio_shaping_table_tx, /* base address of as tx table   */                                         sizeof(UINT16), /* record size */                                         (MCU_DSP_AUDIO_AS_FILTER_COEFFS_WORD_LEN + 1), /* No of records */                                         file_handle,    /* File pointer to read from */                                         &elem_read );   /* Variable to store number of suc reads */            if ( ( read_result != DL_FS_RESULT_READ_SUCCESS )            ||   ( elem_read   != (MCU_DSP_AUDIO_AS_FILTER_COEFFS_WORD_LEN + 1) ) )            {                /* Delete file before panicing so that the file can be flexed                   in without reflashing the phone */                 DL_FsDeleteFile(audio_params_flash,DL_FS_OWNER_AUDIO) ;                  suPanic(AUD_LOG_AS_PARAMS_TX_READ_ERROR, 0);            }            read_result = DL_FsReadFile( am_audio_shaping_table_st, /* base address of as st table   */                                         sizeof(UINT16), /* record size */                                         (MCU_DSP_AUDIO_AS_FILTER_COEFFS_WORD_LEN + 1), /* No of records */                                         file_handle,    /* File pointer to read from */                                         &elem_read );   /* Variable to store number of suc reads */            if ( ( read_result != DL_FS_RESULT_READ_SUCCESS )            ||   ( elem_read   != (MCU_DSP_AUDIO_AS_FILTER_COEFFS_WORD_LEN + 1) ) )            {                /* Delete file before panicing so that the file can be flexed                   in without reflashing the phone */                 DL_FsDeleteFile(audio_params_flash,DL_FS_OWNER_AUDIO) ; 

⌨️ 快捷键说明

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