lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /*******************************************************************************
|
| 2 | * Copyright (C) 2007, ZTE Corporation.
|
| 3 | *
|
| 4 | * File Name: Drvs_voiceprocess.h
|
| 5 | * File Mark:
|
| 6 | * Description: Provide the interface of using vp
|
| 7 | * Others:
|
| 8 | * Version: V0.5
|
| 9 | * Author: lvwenhua
|
| 10 | * Date: 2012-06-13
|
| 11 | * History 1:
|
| 12 | * Date:
|
| 13 | * Version:
|
| 14 | * Author:
|
| 15 | * Modification:
|
| 16 | * History 2:
|
| 17 | ********************************************************************************/
|
| 18 | #ifndef _DRVS_VP_H
|
| 19 | #define _DRVS_VP_H
|
| 20 |
|
| 21 | #include "drvs_i2s.h"
|
| 22 | #include "drvs_tdm.h"
|
| 23 | #include "drvs_volte.h"
|
| 24 | #include "drvs_rpmsg.h"
|
| 25 | #include "NvParam_drv.h"
|
| 26 |
|
| 27 | #define VOICE_TONE_MIXER_FUNCTION
|
| 28 | //#define TEST_WHITE_NOISE
|
| 29 | typedef enum
|
| 30 | {
|
| 31 | VP_I2S_IDLE = 0,
|
| 32 | VP_I2S_OPEN,
|
| 33 | VP_I2S_INUSE,
|
| 34 | VP_LOOP_ON
|
| 35 | } T_Vp_I2sStatus;
|
| 36 |
|
| 37 | /* Voice process channel selection. */
|
| 38 | typedef enum
|
| 39 | {
|
| 40 | VP_PATH_HANDSET = 0,
|
| 41 | VP_PATH_SPEAKER,
|
| 42 | VP_PATH_HEADSET,
|
| 43 | VP_PATH_BLUETOOTH,
|
| 44 | VP_PATH_BLUETOOTH_NO_NR,
|
| 45 | VP_PATH_HSANDSPK,
|
| 46 |
|
| 47 | VP_PATH_OFF = 255,
|
| 48 |
|
| 49 | MAX_VP_PATH = VP_PATH_OFF
|
| 50 | } T_ZDrv_VpPath;
|
| 51 |
|
| 52 | typedef enum
|
| 53 | {
|
| 54 | VP_VOL_0 = 0,
|
| 55 | VP_VOL_1,
|
| 56 | VP_VOL_2,
|
| 57 | VP_VOL_3,
|
| 58 | VP_VOL_4,
|
| 59 | VP_VOL_5,
|
| 60 | VP_VOL_6,
|
| 61 | VP_VOL_7,
|
| 62 | VP_VOL_8,
|
| 63 | VP_VOL_9,
|
| 64 | VP_VOL_10,
|
| 65 | VP_VOL_11,
|
| 66 |
|
| 67 | MAX_VP_VOL
|
| 68 | } T_ZDrv_VpVol;
|
| 69 |
|
| 70 | typedef enum
|
| 71 | {
|
| 72 | VP_FS_8000 = 0, ///< 8k sampling rate
|
| 73 | VP_FS_11025 = 1, ///< 11.025k sampling rate
|
| 74 | VP_FS_12000 = 2, ///< 12k sampling rate
|
| 75 | VP_FS_16000 = 3, ///< 16k sampling rate
|
| 76 | VP_FS_22050 = 4, ///< 22.050k sampling rate
|
| 77 | VP_FS_24000 = 5, ///< 24k sampling rate
|
| 78 | VP_FS_32000 = 6, ///< 32k sampling rate
|
| 79 | VP_FS_44100 = 7, ///< 44.1k sampling rate
|
| 80 | VP_FS_48000 = 8, ///< 48k sampling rate
|
| 81 | MAX_VP_FS = 9 ///< Max sampling rate count
|
| 82 |
|
| 83 | } T_ZDrv_VpFs;
|
| 84 |
|
| 85 | typedef enum
|
| 86 | {
|
| 87 | VP_DTMF_KEY_0 = 0,
|
| 88 | VP_DTMF_KEY_1,
|
| 89 | VP_DTMF_KEY_2,
|
| 90 | VP_DTMF_KEY_3,
|
| 91 | VP_DTMF_KEY_4,
|
| 92 | VP_DTMF_KEY_5,
|
| 93 | VP_DTMF_KEY_6,
|
| 94 | VP_DTMF_KEY_7,
|
| 95 | VP_DTMF_KEY_8,
|
| 96 | VP_DTMF_KEY_9,
|
| 97 | VP_DTMF_KEY_10, /* * */
|
| 98 | VP_DTMF_KEY_11, /* # */
|
| 99 |
|
| 100 | MAX_VP_DTMF_KEY
|
| 101 | } T_ZDrv_VpDtmfKey;
|
| 102 |
|
| 103 |
|
| 104 | //typedef T_ZDrvVolte_Cfg T_ZDrvVp_Cfg
|
| 105 | typedef struct
|
| 106 | {
|
| 107 | char* pPresetRx;
|
| 108 | unsigned long PresetLengthRx;
|
| 109 | char* pPresetTx;
|
| 110 | unsigned long PresetLengthTx;
|
| 111 | } zDrvVp_NxpParamsTool;
|
| 112 |
|
| 113 | typedef struct
|
| 114 | {
|
| 115 | char* pPresetRx;
|
| 116 | unsigned long PresetLengthRx;
|
| 117 | char* pPresetTx;
|
| 118 | unsigned long PresetLengthTx;
|
| 119 | } zDrvVp_ParamsTool;
|
| 120 |
|
| 121 | typedef enum
|
| 122 | {
|
| 123 | VP_VOICE_SOURCE ,
|
| 124 | VP_AUDIO_SOURCE ,
|
| 125 | VP_FM_SOURCE ,
|
| 126 | VP_EXTERN_AUDIO,
|
| 127 | VP_SOURCE_MAX
|
| 128 | } T_ZDrvVp_SourceType;
|
| 129 |
|
| 130 | /* 0 lowpower;1 sms;2 call standard;3 alarm beep;*/
|
| 131 | typedef enum
|
| 132 | {
|
| 133 | VP_LOWPOWER_TONE ,
|
| 134 | VP_SMS_TONE ,
|
| 135 | VP_CALLSTD_TONE ,
|
| 136 | VP_ALARM_TONE,
|
| 137 | VP_CALL_TIME_TONE,
|
| 138 | VP_0_KEY_TONE,
|
| 139 | VP_1_KEY_TONE,
|
| 140 | VP_2_KEY_TONE,
|
| 141 | VP_3_KEY_TONE,
|
| 142 | VP_4_KEY_TONE,
|
| 143 | VP_5_KEY_TONE,
|
| 144 | VP_6_KEY_TONE,
|
| 145 | VP_7_KEY_TONE,
|
| 146 | VP_8_KEY_TONE,
|
| 147 | VP_9_KEY_TONE,
|
| 148 | VP_HASH_KEY_TONE, //#
|
| 149 | VP_ASTERRIX_KEY_TONE, //*
|
| 150 | VP_RESERVED1_TONE,
|
| 151 | VP_RESERVED2_TONE,
|
| 152 | VP_RESERVED3_TONE,
|
| 153 | VP_RESERVED4_TONE,
|
| 154 | VP_RESERVED5_TONE,
|
| 155 | VP_RESERVED6_TONE,
|
| 156 | VP_TONE_MAX
|
| 157 | } T_ZDrvVp_ToneNum;
|
| 158 | typedef struct _T_HalMixerToneInfo
|
| 159 | {
|
| 160 | BOOL StartMixer;/*mixer flag TRUE start, FALSE stop;*/
|
| 161 | BOOL dataIsWb;/* TRUE wb, FALSE nb, for voice mixer;*/
|
| 162 | UINT32 cur_tone_fcount;/*tone data already processed count*/
|
| 163 | UINT32 tone_total_size;/*tone data total size,unit 2byte*/
|
| 164 | UINT32 inter_mixer_fcount;/*inter ,tone_size/data_mixer_oncesize*/
|
| 165 | UINT32 rem_mixer_count;/*remainder , tone_size%data_mixer_oncesize*/
|
| 166 | UINT16 *ptdata_mixer;/* tone data array pointer */
|
| 167 | UINT32 data_mixer_oncesize;/*the size of a data processing, unit 2byte*/
|
| 168 | } T_HalMixerToneInfo;
|
| 169 |
|
| 170 | typedef struct _T_HalAudioLoopTestInfo
|
| 171 | {
|
| 172 | BOOL startLoopTest;/*audo loop test flag TRUE start, FALSE stop;*/
|
| 173 | UINT32 fs;/*tone data real frequence*/
|
| 174 | UINT32 sampFs;/*tone data sample frequence*/
|
| 175 | UINT8 *ptdata;/* audo loop test data array pointer */
|
| 176 | UINT32 totalSize;/*tone data total size,unit 2byte*/
|
| 177 | T_ZDrv_VpVol outpathvol[4];
|
| 178 |
|
| 179 | } T_HalAudioLoopTestInfo;
|
| 180 | typedef struct _T_HalAudioLoopTestPra
|
| 181 | {
|
| 182 | UINT8 *src;/*tone data frequence*/
|
| 183 | UINT8 *dest;/*tone data sample frequence*/
|
| 184 | UINT32 sampfs;
|
| 185 |
|
| 186 | } T_HalAudioLoopTestPra;
|
| 187 | typedef struct
|
| 188 | {
|
| 189 | //use for vp data process
|
| 190 | UINT8* pVpTempRxInBuffer; //pVpRxInBuffer
|
| 191 | UINT8* pVpTempTxInBuffer; //pVpTxInBuffer
|
| 192 | UINT8* pVpTempRxOutPutBuffer;//pVpRxOutPutBuffer
|
| 193 | UINT8* pVpTempTxOutPutBuffer;//pVpTxOutPutBuffer
|
| 194 |
|
| 195 | T_ZDrvI2S_Cfg *pVpI2sCfg; //i2s cfg
|
| 196 |
|
| 197 | T_ZDrvVp_Cfg vpCfgParam; //s_cfgParam
|
| 198 |
|
| 199 | T_ZDrvI2s_Params i2sWriteParam; //s_VpI2sWriteParam
|
| 200 | T_ZDrvI2s_Params i2sReadParam; //s_vpI2sReadParam
|
| 201 |
|
| 202 | UINT32 frameCount; //s_vpFrameCount
|
| 203 | UINT32 totalFrameBufSize; //s_vpTotalFrameBufSize
|
| 204 | UINT32 inOutBufUseSize; //s_inOutBufUseSize
|
| 205 | UINT32 rxSaveLen; //s_rxSaveLen
|
| 206 | UINT32 txSaveLen; //s_txSaveLen
|
| 207 | UINT32 saveLen; //save_len
|
| 208 |
|
| 209 | UINT8 pcmSlotNum; //s_vpPcmSlotNum
|
| 210 | UINT8 pcmWbSecDataPosition; //s_vpPcmWbSecDataPosition
|
| 211 |
|
| 212 | UINT8 volteVpWriteStopFlag;//s_volteVpWriteStopFlag
|
| 213 | UINT8 volteVpReadStopFlag;//s_volteVpReadStopFlag
|
| 214 | UINT8 volteVpCfgEnFlag; // s_volteVpCfgEnFlag
|
| 215 | BOOL firstWriteDataFlag;//s_firstWriteDataFlag
|
| 216 | BOOL firstReadDataFlag;//s_firstReadDataFlag
|
| 217 | BOOL i2sIsRstFlag;//s_i2sIsRstFlag
|
| 218 | } T_zDrvVp_SpeechState; // T_zDrvVp_SpeechState
|
| 219 |
|
| 220 | typedef struct
|
| 221 | {
|
| 222 | UINT8 volteIsWb; //g_volteIsWb
|
| 223 | UINT8 isUseSlicCodec; //g_isUseSlicCodec
|
| 224 | UINT8 g_isUseTdm;
|
| 225 | //for voice data process
|
| 226 | UINT8 voiceInGsmTdMode; //g_voiceInGsmTdMode
|
| 227 | UINT8 voiceInVolteMode; //g_voiceInVolteMode
|
| 228 |
|
| 229 | BOOL innerI2sIsMaster;//arm i2s2 g_innerI2sIsMaster
|
| 230 | BOOL innerI2sIsI2sMode; //g_innerI2sIsI2sMode
|
| 231 | BOOL vpLoopRuning; //g_vpLoopRuning
|
| 232 | BOOL muteEn; //g_vpMuteEn
|
| 233 | //BOOL nxpIsNormal; //g_vpNxpIsNormal
|
| 234 | BOOL vProcIsNormal; //voice processing is normal flag
|
| 235 | T_Vp_I2sStatus vpI2sStatus; //VpI2sStatus
|
| 236 |
|
| 237 | T_ZDrv_VpPath vpPath;// VP_PATH_HEADSET;//VP_PATH_SPEAKER; //VP_PATH_HANDSET; g_vpPath
|
| 238 | T_ZDrv_VpPath vpLoopPath; //g_vpLoopPath
|
| 239 | T_ZDrv_VpVol vpVol; //g_vpVol
|
| 240 | T_ZDrvVoice_MODE voiceMode; //g_vpVoiceMode
|
| 241 | SINT8 vpInitGain; //s_vpInitGain
|
| 242 | T_Audio_NvFlag audio_ctrlFlag;//USE 32byte
|
| 243 |
|
| 244 | UINT8 dtmfDirSel;
|
| 245 | UINT32 sample_rate;
|
| 246 | UINT8 useDtmfLoop;
|
| 247 | SINT32 muteCount;//mute_count
|
| 248 | } T_zDrvVoice_GbVar; //T_zDrvVoice_GbVar
|
| 249 |
|
| 250 | typedef struct
|
| 251 | {
|
| 252 | //use for store memory address
|
| 253 | UINT8* pVpRxInBuffer; //s_pVpRxInBuffer
|
| 254 | UINT8* pVpTxInBuffer; //s_pVpTxInBuffer
|
| 255 | UINT8* pVpRxOutPutBuffer; //s_pVpRxOutPutBuffer
|
| 256 | UINT8* pVpTxOutPutBuffer; //s_pVpTxOutPutBuffer
|
| 257 |
|
| 258 | UINT32 inOutBufSize; //s_inOutBufSize
|
| 259 |
|
| 260 | T_ZDrvI2S_Cfg *pVpInnerI2sCfg; //s_pVpInnerI2sCfg
|
| 261 | T_ZDrvI2S_Cfg *pVpExtI2sCfg; //s_pVpExtI2sCfg
|
| 262 | T_ZDrvI2S_Cfg *pVpExtI2sWbCfg; //s_pVpExtI2sWbCfg
|
| 263 | T_ZDrvTdm_Cfg *s_pVpTdmCfg;
|
| 264 | T_ZDrvTdm_Cfg *s_pVpTdmWbCfg;
|
| 265 | T_ZDrvTdm_Cfg *pVpTdmCfg;
|
| 266 |
|
| 267 | T_ZDrvRpMsg_Msg pMsg;
|
| 268 | SINT32 pMsgBuf[2];
|
| 269 | //SINT32 muteCount;//mute_count
|
| 270 |
|
| 271 | ZOSS_THREAD_ID vpThread ; //s_VpThread
|
| 272 | ZOSS_THREAD_ID rcvDtmfThread ; //s_rcvDtmfThread
|
| 273 | ZOSS_SEMAPHORE_ID vpSemaphore; //s_VpSemaphore
|
| 274 | ZOSS_SEMAPHORE_ID vpThreadQuitSema;
|
| 275 |
|
| 276 | ZOSS_THREAD_ID vpLoopThread; //s_VpLoopThread
|
| 277 | ZOSS_SEMAPHORE_ID vpLoopSemaphore; //s_VpLoopSemaphore
|
| 278 |
|
| 279 | T_zDrvVp_SpeechState *vpState;
|
| 280 | // T_zDrvVoice_GbVar wrapVpGbVar;
|
| 281 | } T_zDrvVp_State; //T_zDrvVp_State
|
| 282 |
|
| 283 | SINT32 zDrvVp_SetPath(T_ZDrv_VpPath path);
|
| 284 | SINT32 zDrvVp_SetVol(T_ZDrv_VpVol volume);
|
| 285 | SINT32 zDrvVp_SetGain(SINT32 vgain, UINT32 channel);
|
| 286 | /* 0 lowpower;1 sms;2 call standard;3 alarm beep;*/
|
| 287 | SINT32 zDrvVp_ToneMixerStart(T_ZDrvVp_ToneNum toneNum);
|
| 288 | SINT32 zDrvVp_SetMute(UINT32 enable, UINT32 channel);
|
| 289 | SINT32 zDrvVp_RcdOnOff(UINT32 on);
|
| 290 | SINT32 zDrvVp_DtmfTone(UINT32 Num);
|
| 291 | SINT32 zDrvVp_Loop(T_ZDrv_VpPath path);
|
| 292 | SINT32 zDrvVp_RingStart(VOID);
|
| 293 | SINT32 zDrvVp_RingStop(VOID);
|
| 294 | VOID zDrvVp_SetUseSlicFlag(BOOL useSlic);
|
| 295 | SINT32 zDrvVp_NxpSetParam(zDrvVp_NxpParamsTool *NxpParamsTool);
|
| 296 | SINT32 zDrvVp_NxpGetParam(zDrvVp_NxpParamsTool *NxpParamsTool);
|
| 297 | SINT32 zDrvVp_SetFmPath(T_ZDrv_VpPath path, BOOL enable);
|
| 298 | SINT32 zDrvVp_SetParam(zDrvVp_ParamsTool *paramsTool);
|
| 299 | SINT32 zDrvVp_GetParam(zDrvVp_ParamsTool *paramsTool);
|
| 300 | SINT32 zDrvVp_SetNvParam(zDrvVp_ParamsTool *paramsTool);
|
| 301 | SINT32 zDrvVp_GetNvParam(zDrvVp_ParamsTool *paramsTool);
|
| 302 |
|
| 303 |
|
| 304 | #endif
|