am_c_utilities.h
来自「Motorola synergy audio component」· C头文件 代码 · 共 380 行 · 第 1/2 页
H
380 行
ALL_SOURCES = 0xFF};/* DSP MATRIX destinations. */enum{ UPLINK_SPEECH, CODEC_SPEAKER, USB_SPEAKER, SAP_TX_SLOT_1, SAP_TX_SLOT_2, SAP_TX_SLOT_3, VA_REC, VR, DSC_SPEAKER, MATRIX_DESTINATION_MAX = DSC_SPEAKER, ALL_DESTINATIONS = 0xFF};/*================================================================================================== STRUCTURES AND OTHER TYPEDEFS==================================================================================================*//* This structure mirrors the input parameters for get_gain(). */typedef struct{ UINT8 device ; /* HANDSET, BOOM_HEADSET, CE_BUS_MP3, etc. */ UINT8 source ; /* Where DSP expects to get incoming signal */ UINT8 destination ; /* Where DSP should route signal to */ UINT8 path_type ; /* KEY_TONE, VOICE, DATA . etc */ UINT8 volume ; /* Values between 0 (min vol) and 7 (max vol) */ BOOL in_call ; /* Out-of-call = 0, In-a-call = 1 */} AM_HW_GAIN_DET_PARAMS_TYPE ;/* get_gain() returns a pointer to the structure below. */typedef struct{ UINT32 hardware_gain ; /* 4 bits GCAP or 28 bits CCAP + 3 bits codec */ INT16 dsp_gain_1 ; /* 15 bits in 4.11 format. */ INT16 dsp_gain_2 ; /* 15 bits in 4.11 format for sidetones or CTG. */ INT8 dsp_audio_procedure[6] ; /* DSP data for audio HW correction */} GAIN_STRUCT ;/* The structure below defines the audio gain table and holds the * 1) hardware register bits - These bits are used to setup the physical audio * path. * 2) audio shaping command - Commands (possibly with data, sent to the DSP * and used to improve the audio quality. * 3) DSP gains - Used to boost the audio signal in the digital * domain. * The audio gain table holds the gain for just one volume step. * The volume for the remaining steps are calulated using the volume step * table. Each hardware and DSP gain field has an associated index field which * determines the appropriate volume step table to use. The volume step itself * is used to index the volume step table, and the value indexed is added to a * hardware gain, or multiplied with a DSP gain. */typedef struct{ UINT16 hw_base_gain_1 ; /* Hardware base gain upper word */ UINT16 hw_base_gain_2 ; /* Hardware base gain lower word */ INT16 dsp_base_gain_1 ; /* 4.11 DSP base matrix gain for volume step 0 */ INT16 dsp_base_gain_2 ; /* 4.11 DSP base matrix/ctg gain for volume step 0 */ UINT8 hw_index_1 ; /* Indexes volume step table of OUTPUTAMPCTL for cdma */ UINT8 hw_index_2 ; /* Indexes volume step table of AMPSETUP & INPUTAMPCTL for cdma, */ /* else GCAP gain bits. */ UINT8 dsp_mult_index_1 ; /* Indexes table for multiplier to derive matrix gain levels */ UINT8 dsp_mult_index_2 ; /* Indexes table for multiplier to derive matrix/ctg gain levels */} AM_HW_GAINS_DATA ;#define AM_HW_GAINS_DATA_WIDTH (sizeof(AM_HW_GAINS_DATA))#define AM_HW_GAINS_TBL_TOTAL_BYTES (AM_HW_GAINS_DATA_WIDTH * AM_HW_NO_OF_GAIN_TBLS)/* Support for LCA - extern const AM_HW_GAINS_DATA *am_hw_gain_table is #ifndef'ed to make sure that am_tables.c that includes this header file won't see it because of type disagreement. */#ifndef AM_TABLES_SOURCE_FILE #if( MAKE_MEM_CODE_IN_ROM == TRUE) extern const AM_HW_GAINS_DATA *am_hw_gain_table ; #else extern AM_HW_GAINS_DATA am_hw_gain_table[AM_HW_NO_OF_GAIN_TBLS] ; #endif#else extern AM_HW_GAINS_DATA am_hw_gain_table[AM_HW_NO_OF_GAIN_TBLS] ;#endif/**** Definition of the Audio Procedure Command Table. ****/typedef UINT8 AUD_PROC_TBL_TYPE [ AM_HW_AUD_PROC_CMD_LEN ] ;extern AUD_PROC_TBL_TYPE aud_proc_table [ AM_HW_AUD_PROC_TBL_LEN ] ;/**** Definition of the Volume Step Table. ****/typedef UINT16 AM_HW_VOL_STEP_TBL_TYPE [ AM_HW_VOL_STEP_TBL_SIZE ] ;/* Support for LCA - extern const AM_HW_VOL_STEP_TBL_TYPE *am_hw_vol_step_table is #ifndef'ed to make sure that am_tables.c that includes this header file won't see it because of type disagreement. */#ifndef AM_TABLES_SOURCE_FILE #if( MAKE_MEM_CODE_IN_ROM == TRUE) extern const AM_HW_VOL_STEP_TBL_TYPE *am_hw_vol_step_table ; #else extern AM_HW_VOL_STEP_TBL_TYPE am_hw_vol_step_table[AM_HW_NO_OF_VOL_STEPS_TBLS] ; #endif#else extern AM_HW_VOL_STEP_TBL_TYPE am_hw_vol_step_table[AM_HW_NO_OF_VOL_STEPS_TBLS] ;#endif#define AM_HW_VOL_STEP_TBL_TOTAL_BYTES (AM_HW_VOL_STEP_TBL_SIZE_IN_BYTES * AM_HW_NO_OF_VOL_STEPS_TBLS)#define AM_HW_GAINS_TOTAL_BYTES (AM_HW_GAINS_TBL_TOTAL_BYTES + AM_HW_VOL_STEP_TBL_TOTAL_BYTES)/*================================================================================================== GLOBAL VARIABLE DECLARATIONS==================================================================================================*/extern GAIN_STRUCT gain_struct ; /* The suapi variables below support a timer to prevent * us from toggling the audio power IC too frequently, * because that results in pops and clicks. */extern SU_TIMER_HANDLE am_hardware_delay_timer_handle;extern SU_TASK_HANDLE am_task_handle;extern SU_EVMASK am_event_mask;extern SU_EVNUM am_event_number;/*================================================================================================== FUNCTION PROTOTYPES==================================================================================================*/extern DL_DB_FEATURE_ID_T am_get_accessory_class_feature_id ( void ) ;extern void am_set_accessory_class_feature_id ( DL_DB_FEATURE_ID_T am_new_volume_step_feature_id ) ;extern GAIN_STRUCT *get_gain ( UINT8 device, UINT8 source, UINT8 destination, UINT8 path_type, UINT8 volume, BOOL in_call ) ;extern void am_timer_init ( void );#if (MAKE_NEPTUNE_CHIPSET == TRUE)extern void am_set_is_call_pending ( BOOL is_call_pending ) ;extern BOOL am_get_is_call_pending ( void ) ;#endif /*(MAKE_NEPTUNE_CHIPSET == TRUE)*/BOOL am_get_ptt_session_state ( void ) ;void am_set_ptt_session_state ( BOOL current_ptt_session_state ) ;/* TRUE : If the coder_on can be allowed to be sent to DSP FALSE: If the coder on cannot be allowed to be sent to DSP because AM is still processing HIFI audio */extern BOOL am_query_is_coder_on_allowed( void );voidaud_set_is_coder_on_allowed ( BOOL aud_is_coder_on_set ) ;static UINT8 determine_mic_or_spkr ( UINT8 source, UINT8 destination ) ;static UINT32 get_hardware_gains ( UINT8 volume, UINT8 gain_table_index ) ;#if ( MAKE_NEPTUNE_CHIPSET == TRUE )#if (MAKE_HDW_BB_IC == MAKE_HDW_NEPTUNE_LTS)extern UINT32 get_pcap_gains ( UINT8 volume, UINT8 gain_table_index ) ;extern UINT32 get_seaweed_gains ( UINT8 volume, UINT8 gain_table_index ) ;#endif#endif static INT16 get_dsp_gains ( UINT8 source, UINT8 destination, UINT8 volume, UINT8 gain_table_index, UINT8 dsp_index ) ; static UINT8 determine_gain_table ( UINT8 device, UINT8 path_type, UINT8 in_call, UINT8 mic_or_speaker ) ;/*================================================================================================*/#ifdef __cplusplus}#endif#endif /* AM_C_UTILITIES_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?