blob: 570a46055e18ccf9f680e421b3caad7f1ceed9d8 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*******************************************************************************
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
29typedef 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. */
38typedef 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
52typedef 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
70typedef 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
85typedef 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
105typedef struct
106{
107 char* pPresetRx;
108 unsigned long PresetLengthRx;
109 char* pPresetTx;
110 unsigned long PresetLengthTx;
111} zDrvVp_NxpParamsTool;
112
113typedef struct
114{
115 char* pPresetRx;
116 unsigned long PresetLengthRx;
117 char* pPresetTx;
118 unsigned long PresetLengthTx;
119} zDrvVp_ParamsTool;
120
121typedef 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;*/
131typedef 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;
158typedef 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
170typedef 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;
180typedef struct _T_HalAudioLoopTestPra
181{
182 UINT8 *src;/*tone data frequence*/
183 UINT8 *dest;/*tone data sample frequence*/
184 UINT32 sampfs;
185
186} T_HalAudioLoopTestPra;
xf.lice873192023-11-08 17:10:35 -0800187
188#ifdef ECALL_SUPPORT
189typedef enum
190{
191 ECALL_ST_INIT = 0,
192 ECALL_ST_OPEN,
193 ECALL_ST_START,
194 ECALL_ST_IDLE,
195 ECALL_ST_RX_IDLE,
196 ECALL_ST_TX_IDLE,
197 ECALL_ST_INUSE,
198 ECALL_ST_RX_INUSE,
199 ECALL_ST_TX_INUSE,
200 ECALL_ST_STOP,
201 ECALL_ST_CLOSE,
202 ECALL_ST_MAX
203} T_Ecall_State;
204
205
206typedef struct
207{
208 T_DrvEcall_Opt opt;
209 ZOSS_TIMER_ID timerId ;
210 ZOSS_SEMAPHORE_ID wrSemaphore;
211 ZOSS_SEMAPHORE_ID rdSemaphore;
212 T_Ecall_State ecallSta;
213 T_Ecall_State ecallRxSta;
214 T_Ecall_State ecallTxSta;
215 unsigned char* rxDataBuf;
216 unsigned char* txDataBuf;
217 int dataBufSize;
218
219} T_Hal_EcallData;
220#endif
221
lh9ed821d2023-04-07 01:36:19 -0700222typedef struct
223{
224 //use for vp data process
225 UINT8* pVpTempRxInBuffer; //pVpRxInBuffer
226 UINT8* pVpTempTxInBuffer; //pVpTxInBuffer
227 UINT8* pVpTempRxOutPutBuffer;//pVpRxOutPutBuffer
228 UINT8* pVpTempTxOutPutBuffer;//pVpTxOutPutBuffer
229
230 T_ZDrvI2S_Cfg *pVpI2sCfg; //i2s cfg
231
232 T_ZDrvVp_Cfg vpCfgParam; //s_cfgParam
233
234 T_ZDrvI2s_Params i2sWriteParam; //s_VpI2sWriteParam
235 T_ZDrvI2s_Params i2sReadParam; //s_vpI2sReadParam
236
237 UINT32 frameCount; //s_vpFrameCount
238 UINT32 totalFrameBufSize; //s_vpTotalFrameBufSize
239 UINT32 inOutBufUseSize; //s_inOutBufUseSize
240 UINT32 rxSaveLen; //s_rxSaveLen
241 UINT32 txSaveLen; //s_txSaveLen
242 UINT32 saveLen; //save_len
243
244 UINT8 pcmSlotNum; //s_vpPcmSlotNum
245 UINT8 pcmWbSecDataPosition; //s_vpPcmWbSecDataPosition
246
247 UINT8 volteVpWriteStopFlag;//s_volteVpWriteStopFlag
248 UINT8 volteVpReadStopFlag;//s_volteVpReadStopFlag
249 UINT8 volteVpCfgEnFlag; // s_volteVpCfgEnFlag
250 BOOL firstWriteDataFlag;//s_firstWriteDataFlag
251 BOOL firstReadDataFlag;//s_firstReadDataFlag
252 BOOL i2sIsRstFlag;//s_i2sIsRstFlag
253} T_zDrvVp_SpeechState; // T_zDrvVp_SpeechState
254
255typedef struct
256{
xf.libdd93d52023-05-12 07:10:14 -0700257 UINT8 volteIsWb; //1 g_volteIsWb
258 UINT8 isUseSlicCodec; //2 g_isUseSlicCodec
259 UINT8 g_isUseTdm; //3
lh9ed821d2023-04-07 01:36:19 -0700260//for voice data process
xf.libdd93d52023-05-12 07:10:14 -0700261 UINT8 voiceInGsmTdMode; //4 g_voiceInGsmTdMode
262 UINT8 voiceInVolteMode; //5 g_voiceInVolteMode
lh9ed821d2023-04-07 01:36:19 -0700263
xf.libdd93d52023-05-12 07:10:14 -0700264 BOOL innerI2sIsMaster;//6 arm i2s2 g_innerI2sIsMaster
265 BOOL innerI2sIsI2sMode; //7 g_innerI2sIsI2sMode
266 BOOL vpLoopRuning; //8 g_vpLoopRuning
267 BOOL muteEn; //9 g_vpMuteEn
268 //BOOL nxpIsNormal; //10 g_vpNxpIsNormal
269 BOOL vProcIsNormal; //11 voice processing is normal flag
270 T_Vp_I2sStatus vpI2sStatus; //12 VpI2sStatus
lh9ed821d2023-04-07 01:36:19 -0700271
xf.libdd93d52023-05-12 07:10:14 -0700272 T_ZDrv_VpPath vpPath;//13 VP_PATH_HEADSET;//VP_PATH_SPEAKER; //VP_PATH_HANDSET; g_vpPath
273 T_ZDrv_VpPath vpLoopPath; //14 g_vpLoopPath
274 T_ZDrv_VpVol vpVol; //15 g_vpVol
275 T_ZDrvVoice_MODE voiceMode; //16 g_vpVoiceMode
276 SINT8 vpInitGain; //17 s_vpInitGain
277 T_Audio_NvFlag audio_ctrlFlag;//18 USE 32byte
lh9ed821d2023-04-07 01:36:19 -0700278
xf.libdd93d52023-05-12 07:10:14 -0700279 UINT8 dtmfDirSel;//19
280 UINT32 sample_rate;//20
281 UINT8 useDtmfLoop;//21
282 SINT32 muteCount;//22 mute_count
lh758261d2023-07-13 05:52:04 -0700283 BOOL vpLoopBkRunning;//23
284 BOOL rxMuteEn; //24
xf.liaa4d92f2023-09-13 00:18:58 -0700285 BOOL firstRegZCATFlag; //25
xf.lice873192023-11-08 17:10:35 -0800286#ifdef ECALL_SUPPORT
287 T_Hal_EcallData ecallData;//26
288#endif
lh9ed821d2023-04-07 01:36:19 -0700289} T_zDrvVoice_GbVar; //T_zDrvVoice_GbVar
290
291typedef struct
292{
293 //use for store memory address
294 UINT8* pVpRxInBuffer; //s_pVpRxInBuffer
295 UINT8* pVpTxInBuffer; //s_pVpTxInBuffer
296 UINT8* pVpRxOutPutBuffer; //s_pVpRxOutPutBuffer
297 UINT8* pVpTxOutPutBuffer; //s_pVpTxOutPutBuffer
298
299 UINT32 inOutBufSize; //s_inOutBufSize
300
301 T_ZDrvI2S_Cfg *pVpInnerI2sCfg; //s_pVpInnerI2sCfg
302 T_ZDrvI2S_Cfg *pVpExtI2sCfg; //s_pVpExtI2sCfg
303 T_ZDrvI2S_Cfg *pVpExtI2sWbCfg; //s_pVpExtI2sWbCfg
304 T_ZDrvTdm_Cfg *s_pVpTdmCfg;
305 T_ZDrvTdm_Cfg *s_pVpTdmWbCfg;
306 T_ZDrvTdm_Cfg *pVpTdmCfg;
307
308 T_ZDrvRpMsg_Msg pMsg;
309 SINT32 pMsgBuf[2];
310 //SINT32 muteCount;//mute_count
311
312 ZOSS_THREAD_ID vpThread ; //s_VpThread
313 ZOSS_THREAD_ID rcvDtmfThread ; //s_rcvDtmfThread
314 ZOSS_SEMAPHORE_ID vpSemaphore; //s_VpSemaphore
315 ZOSS_SEMAPHORE_ID vpThreadQuitSema;
316
317 ZOSS_THREAD_ID vpLoopThread; //s_VpLoopThread
318 ZOSS_SEMAPHORE_ID vpLoopSemaphore; //s_VpLoopSemaphore
319
320 T_zDrvVp_SpeechState *vpState;
321// T_zDrvVoice_GbVar wrapVpGbVar;
322} T_zDrvVp_State; //T_zDrvVp_State
323
324SINT32 zDrvVp_SetPath(T_ZDrv_VpPath path);
325SINT32 zDrvVp_SetVol(T_ZDrv_VpVol volume);
326SINT32 zDrvVp_SetGain(SINT32 vgain, UINT32 channel);
327/* 0 lowpower;1 sms;2 call standard;3 alarm beep;*/
328SINT32 zDrvVp_ToneMixerStart(T_ZDrvVp_ToneNum toneNum);
329SINT32 zDrvVp_SetMute(UINT32 enable, UINT32 channel);
330SINT32 zDrvVp_RcdOnOff(UINT32 on);
331SINT32 zDrvVp_DtmfTone(UINT32 Num);
332SINT32 zDrvVp_Loop(T_ZDrv_VpPath path);
333SINT32 zDrvVp_RingStart(VOID);
334SINT32 zDrvVp_RingStop(VOID);
335VOID zDrvVp_SetUseSlicFlag(BOOL useSlic);
336SINT32 zDrvVp_NxpSetParam(zDrvVp_NxpParamsTool *NxpParamsTool);
337SINT32 zDrvVp_NxpGetParam(zDrvVp_NxpParamsTool *NxpParamsTool);
338SINT32 zDrvVp_SetFmPath(T_ZDrv_VpPath path, BOOL enable);
339SINT32 zDrvVp_SetParam(zDrvVp_ParamsTool *paramsTool);
340SINT32 zDrvVp_GetParam(zDrvVp_ParamsTool *paramsTool);
341SINT32 zDrvVp_SetNvParam(zDrvVp_ParamsTool *paramsTool);
342SINT32 zDrvVp_GetNvParam(zDrvVp_ParamsTool *paramsTool);
343
344
345#endif