blob: 3b6795fef607dc8550f630f0fd097aa4f3b37a75 [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;
187typedef 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
220typedef struct
221{
xf.libdd93d52023-05-12 07:10:14 -0700222 UINT8 volteIsWb; //1 g_volteIsWb
223 UINT8 isUseSlicCodec; //2 g_isUseSlicCodec
224 UINT8 g_isUseTdm; //3
lh9ed821d2023-04-07 01:36:19 -0700225//for voice data process
xf.libdd93d52023-05-12 07:10:14 -0700226 UINT8 voiceInGsmTdMode; //4 g_voiceInGsmTdMode
227 UINT8 voiceInVolteMode; //5 g_voiceInVolteMode
lh9ed821d2023-04-07 01:36:19 -0700228
xf.libdd93d52023-05-12 07:10:14 -0700229 BOOL innerI2sIsMaster;//6 arm i2s2 g_innerI2sIsMaster
230 BOOL innerI2sIsI2sMode; //7 g_innerI2sIsI2sMode
231 BOOL vpLoopRuning; //8 g_vpLoopRuning
232 BOOL muteEn; //9 g_vpMuteEn
233 //BOOL nxpIsNormal; //10 g_vpNxpIsNormal
234 BOOL vProcIsNormal; //11 voice processing is normal flag
235 T_Vp_I2sStatus vpI2sStatus; //12 VpI2sStatus
lh9ed821d2023-04-07 01:36:19 -0700236
xf.libdd93d52023-05-12 07:10:14 -0700237 T_ZDrv_VpPath vpPath;//13 VP_PATH_HEADSET;//VP_PATH_SPEAKER; //VP_PATH_HANDSET; g_vpPath
238 T_ZDrv_VpPath vpLoopPath; //14 g_vpLoopPath
239 T_ZDrv_VpVol vpVol; //15 g_vpVol
240 T_ZDrvVoice_MODE voiceMode; //16 g_vpVoiceMode
241 SINT8 vpInitGain; //17 s_vpInitGain
242 T_Audio_NvFlag audio_ctrlFlag;//18 USE 32byte
lh9ed821d2023-04-07 01:36:19 -0700243
xf.libdd93d52023-05-12 07:10:14 -0700244 UINT8 dtmfDirSel;//19
245 UINT32 sample_rate;//20
246 UINT8 useDtmfLoop;//21
247 SINT32 muteCount;//22 mute_count
248 BOOL rxMuteEn; //23
lh9ed821d2023-04-07 01:36:19 -0700249} T_zDrvVoice_GbVar; //T_zDrvVoice_GbVar
250
251typedef struct
252{
253 //use for store memory address
254 UINT8* pVpRxInBuffer; //s_pVpRxInBuffer
255 UINT8* pVpTxInBuffer; //s_pVpTxInBuffer
256 UINT8* pVpRxOutPutBuffer; //s_pVpRxOutPutBuffer
257 UINT8* pVpTxOutPutBuffer; //s_pVpTxOutPutBuffer
258
259 UINT32 inOutBufSize; //s_inOutBufSize
260
261 T_ZDrvI2S_Cfg *pVpInnerI2sCfg; //s_pVpInnerI2sCfg
262 T_ZDrvI2S_Cfg *pVpExtI2sCfg; //s_pVpExtI2sCfg
263 T_ZDrvI2S_Cfg *pVpExtI2sWbCfg; //s_pVpExtI2sWbCfg
264 T_ZDrvTdm_Cfg *s_pVpTdmCfg;
265 T_ZDrvTdm_Cfg *s_pVpTdmWbCfg;
266 T_ZDrvTdm_Cfg *pVpTdmCfg;
267
268 T_ZDrvRpMsg_Msg pMsg;
269 SINT32 pMsgBuf[2];
270 //SINT32 muteCount;//mute_count
271
272 ZOSS_THREAD_ID vpThread ; //s_VpThread
273 ZOSS_THREAD_ID rcvDtmfThread ; //s_rcvDtmfThread
274 ZOSS_SEMAPHORE_ID vpSemaphore; //s_VpSemaphore
275 ZOSS_SEMAPHORE_ID vpThreadQuitSema;
276
277 ZOSS_THREAD_ID vpLoopThread; //s_VpLoopThread
278 ZOSS_SEMAPHORE_ID vpLoopSemaphore; //s_VpLoopSemaphore
279
280 T_zDrvVp_SpeechState *vpState;
281// T_zDrvVoice_GbVar wrapVpGbVar;
282} T_zDrvVp_State; //T_zDrvVp_State
283
284SINT32 zDrvVp_SetPath(T_ZDrv_VpPath path);
285SINT32 zDrvVp_SetVol(T_ZDrv_VpVol volume);
286SINT32 zDrvVp_SetGain(SINT32 vgain, UINT32 channel);
287/* 0 lowpower;1 sms;2 call standard;3 alarm beep;*/
288SINT32 zDrvVp_ToneMixerStart(T_ZDrvVp_ToneNum toneNum);
289SINT32 zDrvVp_SetMute(UINT32 enable, UINT32 channel);
290SINT32 zDrvVp_RcdOnOff(UINT32 on);
291SINT32 zDrvVp_DtmfTone(UINT32 Num);
292SINT32 zDrvVp_Loop(T_ZDrv_VpPath path);
293SINT32 zDrvVp_RingStart(VOID);
294SINT32 zDrvVp_RingStop(VOID);
295VOID zDrvVp_SetUseSlicFlag(BOOL useSlic);
296SINT32 zDrvVp_NxpSetParam(zDrvVp_NxpParamsTool *NxpParamsTool);
297SINT32 zDrvVp_NxpGetParam(zDrvVp_NxpParamsTool *NxpParamsTool);
298SINT32 zDrvVp_SetFmPath(T_ZDrv_VpPath path, BOOL enable);
299SINT32 zDrvVp_SetParam(zDrvVp_ParamsTool *paramsTool);
300SINT32 zDrvVp_GetParam(zDrvVp_ParamsTool *paramsTool);
301SINT32 zDrvVp_SetNvParam(zDrvVp_ParamsTool *paramsTool);
302SINT32 zDrvVp_GetNvParam(zDrvVp_ParamsTool *paramsTool);
303
304
305#endif