[Feature][ZXW-179]merge P52U02 version

Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I4fa8f86757e71388ae88400914dae8b50cd00338
diff --git a/cp/ps/driver/inc/misc/drvs_voiceprocess.h b/cp/ps/driver/inc/misc/drvs_voiceprocess.h
index a5ab9f4..570a460 100755
--- a/cp/ps/driver/inc/misc/drvs_voiceprocess.h
+++ b/cp/ps/driver/inc/misc/drvs_voiceprocess.h
@@ -184,6 +184,41 @@
 	UINT32 sampfs;

 

 } T_HalAudioLoopTestPra;

+

+#ifdef ECALL_SUPPORT

+typedef enum

+{

+    ECALL_ST_INIT = 0,

+	ECALL_ST_OPEN,				

+	ECALL_ST_START,		

+    ECALL_ST_IDLE,

+    ECALL_ST_RX_IDLE,

+    ECALL_ST_TX_IDLE,

+    ECALL_ST_INUSE,

+    ECALL_ST_RX_INUSE,

+    ECALL_ST_TX_INUSE,     

+	ECALL_ST_STOP,

+	ECALL_ST_CLOSE,	

+    ECALL_ST_MAX

+} T_Ecall_State;

+

+ 

+typedef struct

+{

+	T_DrvEcall_Opt	opt;

+	ZOSS_TIMER_ID timerId ;

+	ZOSS_SEMAPHORE_ID wrSemaphore; 

+	ZOSS_SEMAPHORE_ID rdSemaphore;

+	T_Ecall_State ecallSta;

+    T_Ecall_State ecallRxSta;

+	T_Ecall_State ecallTxSta;	

+	unsigned char* rxDataBuf;

+	unsigned char* txDataBuf;

+	int dataBufSize;

+

+} T_Hal_EcallData; 

+#endif

+

 typedef struct

 {

 	//use for vp data process

@@ -248,6 +283,9 @@
     BOOL vpLoopBkRunning;//23 

 	BOOL rxMuteEn; //24

 	BOOL firstRegZCATFlag; //25

+#ifdef ECALL_SUPPORT	

+	T_Hal_EcallData	ecallData;//26

+#endif	

 } T_zDrvVoice_GbVar; //T_zDrvVoice_GbVar

 

 typedef struct

diff --git a/cp/ps/driver/inc/misc/drvs_volte.h b/cp/ps/driver/inc/misc/drvs_volte.h
index fd31c2d..980e0e3 100755
--- a/cp/ps/driver/inc/misc/drvs_volte.h
+++ b/cp/ps/driver/inc/misc/drvs_volte.h
@@ -60,6 +60,17 @@
 

 } T_DrvVoice_3G_Opt;

 

+#ifdef ECALL_SUPPORT

+ typedef struct 

+ {

+	 

+	 SINT32 (*drv_Get_Ecall_State)(VOID); 		   

+	 SINT32 (*drv_Ecall_Read)(UINT8 *pBuf,UINT32 *inSize);			

+	 SINT32 (*drv_Ecall_Write)(UINT8 *pBuf,UINT32 inSize);		

+ 

+ } T_DrvEcall_Opt;

+#endif

+

  typedef struct 

  {

      void (*drv_dtmfrx_report_cb)(char *dtmf_string, unsigned char string_len);

@@ -82,5 +93,8 @@
 SINT32 zDrvVolte_AmrDecoder(UINT8 *pInputBuf,UINT32 inSize,UINT8 *pOutputBuf,UINT32* pPutSize);

 VOID zDrvVolte_AmrEncoderDeinit(VOID);

 VOID zDrvVolte_AmrDecoderDeinit(VOID);

+#ifdef ECALL_SUPPORT

+VOID zDrvEcall_SetCallbacks(T_DrvEcall_Opt ecallObj);

+#endif

 #endif

 

diff --git a/cp/ps/driver/src/chipsets/src/audio_base/audio_lib/amr/lib/armv7-a/GCC/amr.a b/cp/ps/driver/src/chipsets/src/audio_base/audio_lib/amr/lib/armv7-a/GCC/amr.a
index df1f587..f84072c 100755
--- a/cp/ps/driver/src/chipsets/src/audio_base/audio_lib/amr/lib/armv7-a/GCC/amr.a
+++ b/cp/ps/driver/src/chipsets/src/audio_base/audio_lib/amr/lib/armv7-a/GCC/amr.a
Binary files differ
diff --git a/cp/ps/driver/src/chipsets/src/audio_base/i2s/hal_i2s.c b/cp/ps/driver/src/chipsets/src/audio_base/i2s/hal_i2s.c
index dfd7946..983a92a 100755
--- a/cp/ps/driver/src/chipsets/src/audio_base/i2s/hal_i2s.c
+++ b/cp/ps/driver/src/chipsets/src/audio_base/i2s/hal_i2s.c
@@ -2755,6 +2755,21 @@
 	i2sDmaState[tId][I2S_RX].channel = (tId == I2S_1) ? (DMA_CH_I2S0_RX0) : (DMA_CH_I2S1_RX0);

 	i2sDmaState[tId][I2S_RX].ch = dma_request_channel(mask, zx29_dma_filter_fn, (void*)(i2sDmaState[tId][I2S_RX].channel));

 

+    if(i2sDmaState[tId][I2S_RX].ch == NULL){

+        for(i = 0; i <= 5; i++){

+            zOss_Sleep(1);

+            i2sDmaState[tId][I2S_RX].ch = dma_request_channel(mask, zx29_dma_filter_fn, (void*)(i2sDmaState[tId][I2S_RX].channel));

+            

+            if(i2sDmaState[tId][I2S_RX].ch != NULL){

+                break;

+            }

+            else if(i == 5){

+                zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "i2s_DmaRxInit error, i2sDmaState[%d][%d].ch is NULL\n", tId, I2S_RX);

+                return DRV_ERROR;

+            }

+        }

+    }

+

 	for (i = 0; i < I2S_OUT_BUF_NUM; i++) {

 		temp[i].dest_addr 	= i2sDmaState[tId][I2S_RX].dma_phyaddr  + (i2sStream->rxLen) * i;

 		temp[i].src_addr	= (tId == I2S_1) ? (ZX29_I2S0_PHYS + 0x1c) : (ZX29_I2S1_PHYS + 0x1c);

@@ -2825,6 +2840,21 @@
 	i2sDmaState[tId][I2S_TX].channel = (tId == I2S_1) ? (DMA_CH_I2S0_TX) : (DMA_CH_I2S1_TX);

 	i2sDmaState[tId][I2S_TX].ch = dma_request_channel(mask, zx29_dma_filter_fn, (void*)(i2sDmaState[tId][I2S_TX].channel));

 

+    if(i2sDmaState[tId][I2S_TX].ch == NULL){

+        for(i = 0; i <= 5; i++){

+            zOss_Sleep(1);

+            i2sDmaState[tId][I2S_TX].ch = dma_request_channel(mask, zx29_dma_filter_fn, (void*)(i2sDmaState[tId][I2S_TX].channel));

+            

+            if(i2sDmaState[tId][I2S_TX].ch != NULL){

+                break;

+            }

+            else if(i == 5){

+                zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "i2s_DmaTxInit error, i2sDmaState[%d][%d].ch is NULL\n", tId, I2S_TX);

+                return DRV_ERROR;

+            }

+        }

+    }

+

 	for (i = 0; i < I2S_OUT_BUF_NUM; i++) {

 		temp[i].src_addr 	= i2sDmaState[tId][I2S_TX].dma_phyaddr + (txStream->txLen) * i;

 		temp[i].dest_addr	= (tId == I2S_1) ? (ZX29_I2S0_PHYS + 0x1c) : (ZX29_I2S1_PHYS + 0x1c);

diff --git a/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c b/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c
index 0acd415..8193de0 100755
--- a/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c
+++ b/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c
@@ -60,7 +60,20 @@
 /****************************************************************************

 * 	                                           Local Types

 ****************************************************************************/

+	typedef enum

+	{

+		VBUF_SEM = 0,//voice buffer

+		ECALL_SEM,		

+		SEM_MAX

+	} T_Sem_Owner;

 

+	typedef enum

+	{

+		DIR_RX,

+		DIR_TX, 	

+		DIR_ALL,

+		DIR_MAX

+	} T_Data_Dir_Type;

 

 /****************************************************************************

 * 	                                           Local Constants

@@ -72,6 +85,11 @@
 SINT32 voice_ToneMixerStop(VOID);//xiu gai chu sheng ming

 SINT32 zDrvI2S_Read_Start_Do(T_ZDrvI2S_Id tId, T_ZDrvI2s_Params *params);//xiu gai chu sheng ming

 SINT32 zDrvI2S_Write_Start_Do(T_ZDrvI2S_Id tId, T_ZDrvI2s_Params *params);//xiu gai chu sheng ming

+#ifdef ECALL_SUPPORT

+SINT32 drv_Get_Ecall_State(VOID);	

+SINT32 drv_Ecall_Read(UINT8 *pBuf,UINT32 *inSize);

+SINT32 drv_Ecall_Write(UINT8 *pBuf,UINT32 inSize);	   

+#endif

 /****************************************************************************

 * 	                                          Global Constants

 ****************************************************************************/

@@ -110,6 +128,9 @@
     FALSE, //23 vpLoopBkRunning

 	FALSE, //24 rxMuteEn

 	FALSE, //25 firstRegZCATFlag

+#ifdef ECALL_SUPPORT	

+	0 //26 ecallData

+#endif

 };

 

 static T_zDrvVp_State s_vpState =

@@ -155,6 +176,15 @@
 static UINT32 s_TxAllDataSaveLen = 0;

 #endif

 */

+#ifdef ECALL_SUPPORT

+//extern T_DrvEcall_Opt  gDrvEcall_Obj; 

+T_DrvEcall_Opt t_ecallObj ={

+	drv_Get_Ecall_State,		  

+	drv_Ecall_Read,		   

+	drv_Ecall_Write,  

+

+};

+#endif

 

 extern T_ZDrv_VpInOutBuffer vpInOutBuffer;

 

@@ -224,6 +254,8 @@
 SINT32 voice_RcdStart(T_ZDrvRcd_InfoParam *pParam);//xiu gai chu sheng ming

 SINT32 zDrvI2S_Read_Start(T_ZDrvI2S_Id tId, T_ZDrvI2s_Params *params, T_ZDrvI2S_Cfg *ptCfg);//xiu gai chu sheng ming

 SINT32 zDrvI2S_Write_Start(T_ZDrvI2S_Id tId, T_ZDrvI2s_Params *params, T_ZDrvI2S_Cfg *ptCfg);//xiu gai chu sheng ming

+SINT32 zDrvExtAudio_GetBuf(UINT8 **pBuf, UINT32 *uiLen);

+

 /****************************************************************************

 * 	                                          Function Definitions

 ****************************************************************************/

@@ -290,6 +322,387 @@
 #endif

 

 

+#ifdef ECALL_SUPPORT

+SINT32 rdsem_count_Init(T_Sem_Owner owner)

+{

+	UINT32 i = 0;

+	UINT32 semCount = 0;

+	SINT32 Count = 0;

+    ZOSS_SEMAPHORE_ID rdSem;	

+    if(owner == ECALL_SEM){

+	    rdSem = g_voiceVar.ecallData.rdSemaphore;		

+		semCount = zOss_GetSemaphoreCount(rdSem);

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "rdsem_count_Init owner=%d, rxSem count=%d\n",owner,semCount);

+

+		Count = semCount;

+		if(Count > 0)  {

+			for(i = 0; i < Count; i++) {

+				zOss_GetSemaphore(rdSem, ZOSS_NO_WAIT);

+			}

+		}

+    }

+	return DRV_SUCCESS;

+}

+

+SINT32 wrsem_count_Init(T_Sem_Owner owner)

+{

+	UINT32 i = 0;

+	UINT32 semCount = 0;

+	SINT32 Count = 0;

+

+    ZOSS_SEMAPHORE_ID wrSem;	

+    if(owner == ECALL_SEM){

+		wrSem = g_voiceVar.ecallData.wrSemaphore;

+

+		semCount = zOss_GetSemaphoreCount(wrSem);

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "wrsem_count_Init owner=%d, txSem count=%d \n",owner,semCount);

+

+		

+		Count = 3 - semCount;	

+		if(Count > 0) {

+			for(i = 0; i < Count; i++) {

+				zOss_PutSemaphore(wrSem);

+			}

+		} else if(Count < 0) {

+			Count = 0 - Count;

+			for(i = 0; i < Count; i++) {

+				zOss_GetSemaphore(wrSem, ZOSS_NO_WAIT);

+			}

+		}

+    }

+ 

+	return DRV_SUCCESS;

+}

+void ecallTimerCallBack(SINT32 para)

+{

+//	complete_all(&s_voice_completion);

+	zOss_PutSemaphore(g_voiceVar.ecallData.wrSemaphore);

+	zOss_PutSemaphore(g_voiceVar.ecallData.rdSemaphore);

+//	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecallTimerCallBack timer=%u\n", cpu_clock(0)>>10);

+}

+SINT32 ecall_Init(VOID)

+{

+

+	g_voiceVar.ecallData.rdSemaphore = zOss_CreateSemaphore("ecall_rd_sem", 0);

+	if(NULL == g_voiceVar.ecallData.rdSemaphore) {

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "create ecall_rd_sem err \n");

+		return DRV_ERROR;

+	}

+

+	g_voiceVar.ecallData.wrSemaphore  = zOss_CreateSemaphore("ecall_wr_sem", 0);

+	if(NULL == g_voiceVar.ecallData.wrSemaphore) {

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "create ecall_wr_sem err \n");

+	    zOss_DeleteSemaphore(g_voiceVar.ecallData.rdSemaphore);

+    	g_voiceVar.ecallData.rdSemaphore = ZOSS_NULL;		

+		return DRV_ERROR;

+	}

+	

+	 g_voiceVar.ecallData.timerId  = zOss_CreateTimer("ecall_frameTimer", ecallTimerCallBack, 0, TRUE);

+	 zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall TimerId=%p\n", g_voiceVar.ecallData.timerId);

+	if(!g_voiceVar.ecallData.timerId)

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_frameTimer  failed\n");

+	    zOss_DeleteSemaphore(g_voiceVar.ecallData.rdSemaphore);

+    	g_voiceVar.ecallData.rdSemaphore = ZOSS_NULL;	

+	    zOss_DeleteSemaphore(g_voiceVar.ecallData.wrSemaphore);

+    	g_voiceVar.ecallData.wrSemaphore = ZOSS_NULL;			

+		return DRV_ERROR;

+	}

+	g_voiceVar.ecallData.ecallSta = ECALL_ST_INIT;	

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Init success. \r\n");

+

+

+

+

+	

+	return DRV_SUCCESS;	

+}

+#define ECALL_NB_MEM_SIZE		320

+#define ECALL_WB_MEM_SIZE		640

+

+SINT32 ecall_Open(UINT32 fs)

+{

+	SINT32 ret = DRV_SUCCESS;

+	int bufsize;

+	

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Open  start \n" );

+

+	if ((g_voiceVar.ecallData.ecallSta !=  ECALL_ST_CLOSE)&&(g_voiceVar.ecallData.ecallSta !=  ECALL_ST_INIT))

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Open error: ecallSta =%d\n", g_voiceVar.ecallData.ecallSta);

+		return DRV_ERR_OPEN_TIMES;

+	}

+

+	if(fs == 8000)

+	{

+		bufsize = ECALL_NB_MEM_SIZE;

+

+	}

+	else if(fs == 16000)

+	{

+		bufsize = ECALL_WB_MEM_SIZE;

+

+	}

+	else

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Open error: fs =%d\n", fs);

+		return DRV_ERR_INVALID_PARAM;

+

+	}

+

+

+	g_voiceVar.ecallData.rxDataBuf = zOss_Malloc(bufsize);

+	if (g_voiceVar.ecallData.rxDataBuf == NULL)

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall Failed to allocate rxDataBuf\n");

+		return DRV_ERROR;

+	}

+	g_voiceVar.ecallData.txDataBuf = zOss_Malloc(bufsize);

+	if (g_voiceVar.ecallData.txDataBuf == NULL)

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall Failed to allocate txDataBuf\n");

+	    zOss_Free(g_voiceVar.ecallData.rxDataBuf);		

+		return DRV_ERROR;

+	}

+	g_voiceVar.ecallData.dataBufSize = bufsize;

+

+	g_voiceVar.ecallData.ecallSta = ECALL_ST_OPEN;

+	g_voiceVar.ecallData.ecallRxSta = ECALL_ST_RX_IDLE;

+	g_voiceVar.ecallData.ecallTxSta = ECALL_ST_TX_IDLE;

+

+	

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Open  end!\n");

+

+	return DRV_SUCCESS;

+

+}

+

+

+SINT32 ecall_Close(VOID)

+{

+	SINT32 ret = DRV_SUCCESS;

+

+	if (g_voiceVar.ecallData.ecallSta ==  ECALL_ST_CLOSE)

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Close error: ecallSta =%d\n", g_voiceVar.ecallData.ecallSta);

+		return DRV_ERR_NOT_OPENED;

+	}

+

+	if ((g_voiceVar.ecallData.txDataBuf == NULL)||(g_voiceVar.ecallData.txDataBuf == NULL) || (g_voiceVar.ecallData.dataBufSize  == 0)) 

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Close buf para is null !\n");

+		return DRV_ERROR;

+	}

+

+	zOss_Free(g_voiceVar.ecallData.rxDataBuf);

+	zOss_Free(g_voiceVar.ecallData.txDataBuf);

+

+	g_voiceVar.ecallData.dataBufSize = 0;

+	g_voiceVar.ecallData.rxDataBuf = NULL;

+	g_voiceVar.ecallData.txDataBuf = NULL;

+	g_voiceVar.ecallData.ecallSta = ECALL_ST_CLOSE;

+

+	

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Close  end!\n");

+

+	return DRV_SUCCESS;

+

+

+

+}

+

+

+SINT32 ecall_Start(VOID)

+{

+	SINT32 ret = DRV_SUCCESS;

+

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Start start\n");

+	if((g_voiceVar.ecallData.ecallSta != ECALL_ST_OPEN)&&(g_voiceVar.ecallData.ecallSta != ECALL_ST_STOP))

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Start not support ecallSta=%d\n",g_voiceVar.ecallData.ecallSta);

+		ret = DRV_ERR_START_TIMES;

+	}

+

+

+	zOss_StartTimer(g_voiceVar.ecallData.timerId, 20, ecallTimerCallBack, 0);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Start zOss_StartTimer start\n");

+	g_voiceVar.ecallData.ecallSta = ECALL_ST_START;	

+	

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO,  "ecall_Start end \n");

+

+	return DRV_SUCCESS;

+}

+

+SINT32 ecall_Stop(VOID)

+{

+	SINT32  ret = DRV_SUCCESS;

+	if(g_voiceVar.ecallData.ecallSta != ECALL_ST_STOP)

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Stop not support ecallSta=%d\n",g_voiceVar.ecallData.ecallSta);

+		ret = DRV_ERR_START_TIMES;

+	}  

+

+	zOss_PutSemaphore(g_voiceVar.ecallData.rdSemaphore);

+	zOss_PutSemaphore(g_voiceVar.ecallData.wrSemaphore);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Stop put rd wr sem\n");	

+	zOss_StopTimer(g_voiceVar.ecallData.timerId);

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Stop zOss_StopTimer\n");

+

+	g_voiceVar.ecallData.ecallSta = ECALL_ST_STOP;	

+

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Stop end\n");

+	return ret;

+}

+

+SINT32 update_ecall_state(T_Data_Dir_Type dir)

+{

+	int ret = DRV_SUCCESS;

+

+	

+	if(g_voiceVar.ecallData.opt.drv_Get_Ecall_State == NULL)

+	{	

+		return DRV_ERR_NOT_SUPPORTED;

+	}

+

+	if(g_voiceVar.ecallData.opt.drv_Get_Ecall_State() == 1)	

+	{						

+		if((dir == DIR_RX)&&(g_voiceVar.ecallData.ecallRxSta != ECALL_ST_RX_INUSE))

+		{

+			wrsem_count_Init(ECALL_SEM);

+			g_voiceVar.ecallData.ecallRxSta = ECALL_ST_RX_INUSE;

+			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "update_ecall_state rx state change old ecallRxSta = %d\n", g_voiceVar.ecallData.ecallRxSta);

+			

+		}

+		else if((dir == DIR_TX)&&(g_voiceVar.ecallData.ecallTxSta != ECALL_ST_TX_INUSE))

+		{

+

+			rdsem_count_Init(ECALL_SEM);			

+			g_voiceVar.ecallData.ecallTxSta = ECALL_ST_TX_INUSE;	

+			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "update_ecall_state tx state change old ecallTxSta = %d\n", g_voiceVar.ecallData.ecallTxSta);

+			

+		}

+		else

+		{

+			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "update_ecall_state return 1,but dir not support dir = %d\n",dir);

+			ret = DRV_ERR_NOT_SUPPORTED;			

+		}	

+		

+

+	}

+	else

+	{

+	    if(dir == DIR_RX)

+		{

+			g_voiceVar.ecallData.ecallRxSta = ECALL_ST_RX_IDLE;	

+		

+	    }

+		else if(dir == DIR_TX)

+		{

+			g_voiceVar.ecallData.ecallTxSta = ECALL_ST_TX_IDLE;

+

+		}

+		else

+		{

+			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "update_ecall_state return 0,but dir not support dir = %d\n",dir);

+			ret = DRV_ERR_NOT_SUPPORTED;

+

+		}		

+

+	}	

+	if((g_voiceVar.ecallData.ecallRxSta == ECALL_ST_RX_IDLE)&&(g_voiceVar.ecallData.ecallTxSta == ECALL_ST_TX_IDLE))

+	{

+		if(g_voiceVar.ecallData.ecallSta == ECALL_ST_START)

+		{

+	    	ret = ecall_Stop();	

+			if (ret != DRV_SUCCESS)

+			{

+				zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "update_ecall_state ecall_Start err\n");

+			}

+		}

+		

+	}

+	else

+	{

+		if(g_voiceVar.ecallData.ecallSta != ECALL_ST_START)

+		{

+			ret = ecall_Start();

+			if (ret != DRV_SUCCESS)

+			{

+				zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "update_ecall_state ecall_Stop err\n");

+			}		

+		}

+	}

+	

+	return ret;

+}

+

+

+SINT32 ecall_GetRxBuf(UINT8 **pBuf, UINT32 *uiLen)

+{

+

+	SINT32 ret = DRV_SUCCESS;

+

+	if ((NULL == pBuf) || (NULL == uiLen))

+	{

+

+	    zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_GetRxBuf error, ipara is null \n");

+		//zDrv_ASSERT(0);		

+		return DRV_ERR_INVALID_PARAM;

+	}

+

+	if ((g_voiceVar.ecallData.ecallSta == ECALL_ST_INIT)||(g_voiceVar.ecallData.ecallSta == ECALL_ST_CLOSE) ) 

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_GetRxBuf error, invalid ecallSta = %d\n", g_voiceVar.ecallData.ecallSta);

+	

+		return DRV_ERR_NOT_OPENED;

+	}

+	if ((g_voiceVar.ecallData.txDataBuf == NULL) || (g_voiceVar.ecallData.dataBufSize == 0)) 

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_GetRxBuf error, return para is null !\n");

+		return DRV_ERROR;

+	}

+

+

+	*pBuf = g_voiceVar.ecallData.rxDataBuf;

+	*uiLen = g_voiceVar.ecallData.dataBufSize;

+	

+

+	return ret;

+}

+

+SINT32 ecall_GetTxBuf(UINT8 **pBuf, UINT32 *uiLen)

+{

+

+	SINT32 ret = DRV_SUCCESS;

+

+	if ((NULL == pBuf) || (NULL == uiLen) )

+	{

+		//zDrv_ASSERT(0);

+	    zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_GetTxBuf error, ipara is null \n");

+		//zDrv_ASSERT(0);				

+		return DRV_ERR_INVALID_PARAM;

+	}

+

+	if ((g_voiceVar.ecallData.ecallSta == ECALL_ST_INIT)||(g_voiceVar.ecallData.ecallSta == ECALL_ST_CLOSE) ) 

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_GetTxBuf error, invalid ecallSta = %d\n", g_voiceVar.ecallData.ecallSta);

+	

+		return DRV_ERR_NOT_OPENED;

+	}

+	if ((g_voiceVar.ecallData.txDataBuf == NULL)||(g_voiceVar.ecallData.txDataBuf == NULL) || (g_voiceVar.ecallData.dataBufSize  == 0)) 

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_GetTxBuf error, return para is null !\n");

+		return DRV_ERROR;

+	}

+

+

+	*pBuf = g_voiceVar.ecallData.txDataBuf;

+	*uiLen = g_voiceVar.ecallData.dataBufSize;

+

+	return ret;

+}

+#endif

+

 SINT32 zDrv_Init(VOID)

 {

 	if (g_voiceVar.g_isUseTdm != 1)

@@ -489,6 +902,48 @@
 #endif	

 	return ret;

 }

+#ifdef ECALL_SUPPORT

+SINT32 ecall_Write(const UINT8 *pBuf, UINT32 uiLen)

+{

+	int ret = 0;

+	if(g_voiceVar.ecallData.opt.drv_Ecall_Write == NULL)

+	{	

+		return DRV_ERR_NOT_SUPPORTED;

+	}

+	if( g_voiceVar.ecallData.ecallRxSta == ECALL_ST_RX_INUSE)

+	{

+		zOss_GetSemaphore(g_voiceVar.ecallData.wrSemaphore, 60);

+		ret = g_voiceVar.ecallData.opt.drv_Ecall_Write(pBuf, uiLen);

+	}

+	else

+	{

+		ret = g_voiceVar.ecallData.opt.drv_Ecall_Write(pBuf, uiLen);		

+		

+	}	

+	return ret;

+}

+SINT32 ecall_Read(const UINT8 **pBuf, UINT32 *uiLen)

+{

+	int ret = 0;

+

+	if(g_voiceVar.ecallData.opt.drv_Ecall_Read == NULL)

+	{	

+		return DRV_ERR_NOT_SUPPORTED;

+	}

+	if( g_voiceVar.ecallData.ecallTxSta == ECALL_ST_TX_INUSE)

+	{

+	    zOss_GetSemaphore(g_voiceVar.ecallData.rdSemaphore,  60);

+		ret = g_voiceVar.ecallData.opt.drv_Ecall_Read(*pBuf, uiLen);

+	}

+	else

+	{

+		ret = zDrvExtAudio_Read(pBuf, uiLen);

+	}

+

+

+	return ret;

+}

+#endif

 SINT32 zDrvExtAudio_Write_Stop()

 {

 	int ret = 0;

@@ -771,7 +1226,14 @@
 	vp_rxsem_count_Init();

 	vp_txsem_count_Init();

 #endif

-	

+#ifdef ECALL_SUPPORT

+	if(g_voiceVar.audio_ctrlFlag.isUseEcall == 1)

+	{

+		rdsem_count_Init(ECALL_SEM);

+		wrsem_count_Init(ECALL_SEM);

+        //zDrvEcall_SetCallbacks(t_ecallObj);//for test

+	}

+#endif		

 	g_voiceVar.muteCount = 0;

 	s_speechState.txSaveLen = 0;

 	s_speechState.rxSaveLen = 0;

@@ -867,7 +1329,27 @@
         }

         zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_CfgParam zDrvVp_DtmfSoftwareStart end\n");

     }

-    

+#ifdef ECALL_SUPPORT	

+	if(g_voiceVar.audio_ctrlFlag.isUseEcall == 1)

+	{

+

+	   if(g_voiceVar.volteIsWb == 1)

+	   {

+	   	   ret = ecall_Open(16000);

+	   }

+	   else

+	   {

+		   ret = ecall_Open(8000);

+

+	   }

+	   if (ret != DRV_SUCCESS)

+	   {

+		   zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Open error,ret=%d", ret);

+	   }

+	   

+	

+	}

+#endif	

 	return ret;

 }

 

@@ -1455,7 +1937,16 @@
         g_voiceVar.dtmfDirSel = DTMF_IDLE;

         zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_Close zDrvVp_DtmfSoftwareStop end\n");

     }

-

+#ifdef ECALL_SUPPORT

+	if(g_voiceVar.audio_ctrlFlag.isUseEcall == 1)

+	{

+		ret = ecall_Close();

+		if (ret != DRV_SUCCESS)

+		{

+		   zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Open error,ret=%d", ret);

+		}	

+	}

+#endif	

 	g_voiceVar.vpI2sStatus = VP_I2S_IDLE;

 	g_voiceVar.voiceMode = MAX_VOICE_MODE;

 	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_Close,g_voiceVar.vpI2sStatus=%d\n", g_voiceVar.vpI2sStatus);

@@ -1507,7 +1998,7 @@
 	}

 	

 	zOss_StartTimer(s_voiceTimerId, 20, voiceTimerCallBack, 0);

-	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_VoiceI2sStart zOss_StartTimer\n");

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_VoiceI2sStart VB zOss_StartTimer\n");

 

 	ret = zDrvI2S_Write_Start(I2S_2, &s_speechState.i2sWriteParam, s_vpState.pVpInnerI2sCfg);

 

@@ -1523,6 +2014,19 @@
 	{

 		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_VoiceI2sStart error12:zDrvI2S_Write I2S_2 ret=%d", ret);

 	}

+	

+	ret += zDrvI2S_GetBuf(I2S_2, &write_buf, &write_len);

+	if (ret != DRV_SUCCESS)

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_VoiceI2sStart error13:zDrvI2S_GetBuf I2S_2 ret=%d", ret);

+		return DRV_ERROR;

+	}

+	zOss_Memset(write_buf, 0, write_len);

+	ret = zDrvI2S_Write(I2S_2, write_buf, write_len);

+	if (ret != DRV_SUCCESS)

+	{

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_VoiceI2sStart error14:zDrvI2S_Write I2S_2 ret=%d", ret);

+	}

 

 	voicebuffer_dlqueue_write(s_speechState.pVpTempRxOutPutBuffer, s_speechState.totalFrameBufSize);

 #else	

@@ -1792,6 +2296,16 @@
 	//zDrvI2s_TxRlsSemaBeforeStop(I2S_1);

 	zDrvExtAudio_RlsAllSemaBeforeStop();

 #endif

+#ifdef ECALL_SUPPORT

+	if(g_voiceVar.audio_ctrlFlag.isUseEcall == 1)

+	{

+    	ret = ecall_Stop();	

+		if (ret != DRV_SUCCESS)

+		{

+			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvVp_VoiceWorkStop ecall_Stop err\n");

+		}

+	}

+#endif	

 	zDrvI2s_RxRlsSemaBeforeStop(I2S_2);

 	zDrvI2s_TxRlsSemaBeforeStop(I2S_2);

 

@@ -1909,7 +2423,16 @@
 		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_VolteReadStop zOss_StopTimer\n");

 #endif

 	}

-

+#ifdef ECALL_SUPPORT	

+	if(g_voiceVar.audio_ctrlFlag.isUseEcall == 1)

+	{

+    	ret = ecall_Stop();	

+		if (ret != DRV_SUCCESS)

+		{

+			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvVolte_ReadStop ecall_Stop err\n");

+		}

+	}

+#endif

 	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvVolte_ReadStop\n");

 	return ret;

 }

@@ -2070,8 +2593,10 @@
 	SINT32  ret = DRV_SUCCESS;

 	UINT8 *write_buf = NULL;

 	UINT32 write_len = 0;

+	UINT8 *e_write_buf = NULL;

+	UINT32 e_write_len = 0;

 	UINT32 i = 0, j = 0;

-

+    UINT8 e_reg_flag = 0;

 #ifdef TEST_WHITE_NOISE

 	// UINT32 tempCount = 0;

 	//zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "test the white noise");

@@ -2090,7 +2615,27 @@
 		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_WriteDataToCodec write data length err,count=%d,writebuffersize=%d \n", count, s_speechState.i2sWriteParam.buffersize);

 		return DRV_ERR_INVALID_PARAM;

 	}

+#ifdef ECALL_SUPPORT	

+	if((g_voiceVar.audio_ctrlFlag.isUseEcall == 1)&&(g_voiceVar.ecallData.opt.drv_Get_Ecall_State != NULL))

+	{

+	 	e_reg_flag = 1;

+	}

+	else

+	{

+		e_reg_flag = 0;

 

+	}

+	

+	if(e_reg_flag == 1)

+	{		

+		ret = update_ecall_state(DIR_RX); 

+		if (ret == DRV_ERR_NOT_SUPPORTED)

+		{

+			zOss_Printf(SUBMDL_HAL, PRINT_LEVEL_NORMAL, "vp_WriteDataToCodec get__ecall_state fun not register or invalid para !\n");

+	

+		}	

+	}	

+#endif

 

 #ifdef  CONFIG_VOICE_BUFFER_DRV  	

 

@@ -2154,7 +2699,24 @@
 	}

 

 #else

-	ret = zDrvExtAudio_GetBuf(&write_buf, &write_len);

+	if (e_reg_flag == 1)

+	{

+#ifdef ECALL_SUPPORT	

+		ret = ecall_GetRxBuf(&e_write_buf,&e_write_len);

+		if ((ret == DRV_SUCCESS) && (e_write_buf != NULL) && (e_write_len == s_speechState.i2sWriteParam.buffersize))

+		{

+

+			zOss_Memcpy(e_write_buf, pBuf, s_speechState.totalFrameBufSize);

+

+		}

+#endif		

+		ret = zDrvExtAudio_GetBuf(&write_buf, &write_len);

+

+	}

+	else

+	{

+		ret = zDrvExtAudio_GetBuf(&write_buf, &write_len);

+	}

 	if ((ret == DRV_SUCCESS) && (write_buf != NULL) && (write_len == s_speechState.i2sWriteParam.buffersize))

 	{

 		if (pBuf !=  s_speechState.pVpTempRxInBuffer)

@@ -2226,8 +2788,12 @@
     		}

         }

         #endif

-        

+

+#ifdef ECALL_SUPPORT

+        if ((g_voiceVar.vProcIsNormal == TRUE)&&(g_voiceVar.ecallData.ecallRxSta != ECALL_ST_RX_INUSE))

+#else        

 		if (g_voiceVar.vProcIsNormal == TRUE)

+#endif		

 		{

 

 			ret = VoiceProc_RxProcess(& s_speechState.pVpTempRxInBuffer, & s_speechState.pVpTempRxOutPutBuffer, s_speechState.frameCount);

@@ -2306,7 +2872,31 @@
 		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_WriteDataToCodec zDrvI2S_GetBuf:I2S1:ret=%d,write_buf = %p,write_len = %d.\n", ret, write_buf, write_len);

 		return DRV_ERROR;

 	}

-	ret = zDrvExtAudio_Write(write_buf, write_len);

+	if(e_reg_flag == 1)

+	{	

+#ifdef ECALL_SUPPORT

+		ret = ecall_Write(e_write_buf, e_write_len);

+		if (ret != DRV_SUCCESS)

+		{

+			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "ecall_Write err ret=%d !\n", ret);

+

+		}		

+		if( g_voiceVar.ecallData.ecallRxSta == ECALL_ST_RX_INUSE)

+		{

+		    zOss_Memset(write_buf, 0, write_len);//need  mute rx		

+		}

+#endif		

+		ret = zDrvExtAudio_Write(write_buf, write_len);

+

+

+

+

+

+	}

+	else

+	{

+		ret = zDrvExtAudio_Write(write_buf, write_len);

+	}

 

 #endif

 

@@ -2330,6 +2920,8 @@
 	UINT8 temp8bit = 0;

 	UINT8 *ptemp8bit = NULL;

 #endif

+	UINT8 e_reg_flag = 0;

+

 	if (pBuf == NULL)

 	{

 		return DRV_ERR_INVALID_PARAM;

@@ -2340,6 +2932,31 @@
 		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_ReadDataFromCodec read data length err,count=%d,readbuffersize=%d \n", count, s_speechState.i2sReadParam.buffersize);

 		return DRV_ERR_INVALID_PARAM;

 	}

+#ifdef ECALL_SUPPORT	

+	if((g_voiceVar.audio_ctrlFlag.isUseEcall == 1)&&(g_voiceVar.ecallData.opt.drv_Get_Ecall_State != NULL))

+	{

+		e_reg_flag = 1;

+	}

+	else

+	{

+		e_reg_flag = 0;

+

+	}

+

+

+	

+

+	if(e_reg_flag == 1)

+	{		

+		ret = update_ecall_state(DIR_TX); 

+		if (ret == DRV_ERR_NOT_SUPPORTED)

+		{

+			zOss_Printf(SUBMDL_HAL, PRINT_LEVEL_NORMAL, "vp_ReadDataFromCodec get__ecall_state fun not register !\n");

+	

+		}	

+	}	

+#endif

+	

 #ifdef  CONFIG_VOICE_BUFFER_DRV  

 

 //	wait_for_completion_timeout(&s_voice_completion, 60);

@@ -2372,7 +2989,28 @@
 	}

 	

 #else 

-	ret = zDrvExtAudio_Read(&read_buf, &read_len);

+#ifdef ECALL_SUPPORT

+	if ((e_reg_flag == 1)&&(g_voiceVar.ecallData.ecallTxSta == ECALL_ST_TX_INUSE))		

+	{	

+

+

+		ret = ecall_GetTxBuf(&read_buf,&read_len);

+		if(ret != DRV_SUCCESS)

+		{

+			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp vp_ReadDataFromCodec ecall_GetRxBuf err ret=%d\n", ret);

+			return DRV_ERROR;

+		}

+		

+		ret = ecall_Read(&read_buf, &read_len);

+

+	}

+	else

+	{

+		ret = zDrvExtAudio_Read(&read_buf, &read_len);

+	}	

+#else

+    ret = zDrvExtAudio_Read(&read_buf, &read_len);

+#endif	

 	if ((ret == DRV_SUCCESS) && (read_buf != NULL) && (read_len == s_speechState.i2sReadParam.buffersize))

 	{

 		if ((s_speechState.pVpI2sCfg->tClkMode == PCM_TIME_MODE) && (s_speechState.pVpI2sCfg->tPcmSlotNum != PCM_1TIME_SLOT))

@@ -2426,11 +3064,14 @@
 		        pVpTxInAllDataBuffer=(UINT8 *)0x25500000+s_TxAllDataSaveLen;

 		#endif

 		*/

-		ret = zDrvExtAudio_FreeBuf(read_buf);

-		if (ret  != DRV_SUCCESS)

+		if (e_reg_flag != 1)

 		{

-			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp vp_ReadDataFromCodec err ret=%d\n", ret);

-			return DRV_ERROR;

+			ret = zDrvExtAudio_FreeBuf(read_buf);

+			if (ret  != DRV_SUCCESS)

+			{

+				zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp vp_ReadDataFromCodec err ret=%d\n", ret);

+				return DRV_ERROR;

+			}

 		}

 	#ifdef CONFIG_CP_USE_SOFT_DTMF_DETECT

 		for (i = 0; i < (s_speechState.vpCfgParam.samples_per_frame / 80); )

@@ -2484,8 +3125,11 @@
     			voice_MixerDataTx(s_speechState.pVpTempTxInBuffer, 320,  s_speechState.pVpTempTxInBuffer);

     		}

         }

-        

+#ifdef ECALL_SUPPORT

+        if ((g_voiceVar.vProcIsNormal == TRUE)&&(g_voiceVar.ecallData.ecallTxSta != ECALL_ST_TX_INUSE))

+#else    

 		if (g_voiceVar.vProcIsNormal == TRUE)

+#endif		

 		{

 			ret = VoiceProc_TxProcess(&s_speechState.pVpTempTxInBuffer, NULL, &s_speechState.pVpTempTxOutPutBuffer, s_speechState.frameCount);

 			if (ret != DRV_SUCCESS)

@@ -2925,13 +3569,13 @@
 //	init_completion(&s_voice_completion);

 	s_voiceRdSema = zOss_CreateSemaphore("voice_rx_sem", 0);

 	if(NULL == s_voiceRdSema) {

-		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "create iis1_rx_sem err \n");

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "create voice_rx_sem err \n");

 		return DRV_ERROR;

 	}

 

 	s_voiceWrSema  = zOss_CreateSemaphore("voice_tx_sem", 0);

 	if(NULL == s_voiceWrSema) {

-		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "create iis2_rx_sem err \n");

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "create voice_tx_sem err \n");

 		return DRV_ERROR;

 	}

 	

@@ -2983,7 +3627,16 @@
 		return ZOSS_ERROR;

 	}

 	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvVp_Init create success.\n");

-

+#ifdef ECALL_SUPPORT	

+	if(g_voiceVar.audio_ctrlFlag.isUseEcall == 1)

+	{

+    	ret = ecall_Init();	

+		if (ret != DRV_SUCCESS)

+		{

+			return ZOSS_ERROR;

+		}

+	}

+#endif

 	voice_InitCodec();

 

 	ret = voice_CreateRcdSemAndThread();

@@ -3380,6 +4033,38 @@
 		//  pVoiceLoopOutSaveBuffer =  s_speechState.pVpTempRxInBuffer;

 #endif

 

+        if (FALSE == g_voiceVar.firstRegZCATFlag) {

+            ret = zCatAgt_Audio_Reg(10,VP_INOUT_BAK_BUFFER_SIZE,(UINT32)vpInOutBuffer.p_voiceRxInBuffer);

+            if(ret != DRV_SUCCESS){

+                zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_Open RXIN register zCatAgt_Audio_Reg err\n");

+            }

+            

+            ret = zCatAgt_Audio_Reg(12,VP_INOUT_BAK_BUFFER_SIZE,(UINT32)vpInOutBuffer.p_voiceTxInBuffer);

+            if(ret != DRV_SUCCESS){

+                zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_Open TXIN register zCatAgt_Audio_Reg err\n");

+            }

+                

+    		ret = zCatAgt_Audio_Reg(13,VP_INOUT_BAK_BUFFER_SIZE,(UINT32)vpInOutBuffer.p_voiceTxOutPutBuffer);

+            if(ret != DRV_SUCCESS){

+                zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_Open TXOUT register zCatAgt_Audio_Reg err\n");

+            }

+

+#ifdef _USE_VP_OUTPUT_RXOUT_DATA

+    		ret = zCatAgt_Audio_Reg(11, VP_INOUT_BAK_BUFFER_SIZE, (UINT32)vpInOutBuffer.p_voiceRxOutPutBuffer);

+            if(ret != DRV_SUCCESS){

+                zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_Open RXOUT register zCatAgt_Audio_Reg err\n");

+            }

+

+#else

+    		ret = zCatAgt_Audio_Reg(11,VP_INOUT_NOBAK_BUFSIZE,(UINT32)vpInOutBuffer.p_voiceRxOutPutBuffer);

+            if(ret != DRV_SUCCESS){

+                zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_Open RXOUT register zCatAgt_Audio_Reg err\n");

+            }

+#endif

+

+            g_voiceVar.firstRegZCATFlag = TRUE;   

+        }

+        

 		zOss_Sleep(500);

 		ret = zDrvVp_LoopStartDo();

 		if (ret != DRV_SUCCESS)

@@ -4617,5 +5302,43 @@
 	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, " zDrvVp_GetVoiceState pVoiceState=%p.\n", *pVoiceState);

 	return DRV_SUCCESS;

 }

+#ifdef ECALL_SUPPORT

+/*******************************************************************************

+* Function: zDrvEcall_SetOperations

+* Description: This function is used to set the ecall callback function.

+* Parameters: 

+*   Input:

+*           VoiceObjPtr:The pointer to ecall callback function type. 

+*   Output:None

+*

+* Returns: none

+*

+* Others: 

+********************************************************************************/

+VOID zDrvEcall_SetCallbacks(T_DrvEcall_Opt ecallObj)

+{

+    g_voiceVar.ecallData.opt = ecallObj;

+}

 

 

+SINT32 drv_Get_Ecall_State(VOID)	

+{

+	SINT32 ret = DRV_SUCCESS;

+	//zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, " zDrvVp_GetVoiceState pVoiceState=%p.\n", *pVoiceState);

+	return 1;

+}

+

+SINT32 drv_Ecall_Read(UINT8 *pBuf,UINT32 *inSize)

+{

+	SINT32 ret = DRV_SUCCESS;

+	//zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, " drv_Ecall_Read\n");

+	return DRV_SUCCESS;

+}

+

+SINT32 drv_Ecall_Write(UINT8 *pBuf,UINT32 inSize)	   

+{

+	SINT32 ret = DRV_SUCCESS;

+	//zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "drv_Ecall_Write\n");

+	return DRV_SUCCESS;

+}

+#endif

diff --git a/cp/ps/modem/com/src/appstart/inc/version_number.h b/cp/ps/modem/com/src/appstart/inc/version_number.h
index 2c77941..5e2a2fc 100755
--- a/cp/ps/modem/com/src/appstart/inc/version_number.h
+++ b/cp/ps/modem/com/src/appstart/inc/version_number.h
@@ -1,9 +1,9 @@
 #if defined _CHIP_ZX297520
-#define VERSION_NUMBER "7520SCV2.01.01.02P50U04_mt_01"
+#define VERSION_NUMBER "7520SCV2.01.01.02P52U02"
 #endif
 #if defined _CHIP_ZX297520V2
-#define VERSION_NUMBER "7520V2SCV2.01.01.02P50U04_mt_01"
+#define VERSION_NUMBER "7520V2SCV2.01.01.02P52U02"
 #endif
 #if defined _CHIP_ZX297520V3
-#define VERSION_NUMBER "7520V3SCV2.01.01.02P50U04_mt_01"
+#define VERSION_NUMBER "7520V3SCV2.01.01.02P52U02"
 #endif
diff --git a/cp/ps/modem/ps/inc/apuiccint.h b/cp/ps/modem/ps/inc/apuiccint.h
index 05cbe68..bfc9135 100755
--- a/cp/ps/modem/ps/inc/apuiccint.h
+++ b/cp/ps/modem/ps/inc/apuiccint.h
@@ -651,8 +651,10 @@
 #define   Z_APUICC_KEYID_LSADF_1     (WORD)(Z_APUICC_KEYID_USIMONLY_BASE + 75)   /* LSA Descriptor files¿ÉÒÔÓжà¸ö£¬½«À´¸ù¾ÝÐèÇó¿ÉÀ©³ä */

 #define   Z_APUICC_KEYID_LSADF_2     (WORD)(Z_APUICC_KEYID_USIMONLY_BASE + 76)

 #define   Z_APUICC_KEYID_LSADF_3     (WORD)(Z_APUICC_KEYID_USIMONLY_BASE + 77)

+#define   Z_APUICC_KEYID_FDNURI      (WORD)(Z_APUICC_KEYID_USIMONLY_BASE + 78)

+#define   Z_APUICC_KEYID_SDNURI      (WORD)(Z_APUICC_KEYID_USIMONLY_BASE + 79)

 

-#define   Z_APUICC_KEYID_SM_BASE     (WORD)(Z_APUICC_KEYID_LSADF_3 + 1)  

+#define   Z_APUICC_KEYID_SM_BASE     (WORD)(Z_APUICC_KEYID_SDNURI + 1)  

 

 #define   Z_APUICC_KEYID_SM_PSC      (WORD)(Z_APUICC_KEYID_SM_BASE + 0)  

 #define   Z_APUICC_KEYID_SM_CC       (WORD)(Z_APUICC_KEYID_SM_BASE + 1)   

@@ -970,8 +972,12 @@
 #define    Z_UICC_PBR_MAX_KEYIDNUM      ZPS_UICC_PBR_MAX_KEYIDNUM                                  

 #define    ZPS_UICC_PBR_MAX_LEN                                 (BYTE)255  

 #define    Z_UICC_PBR_MAX_LEN           ZPS_UICC_PBR_MAX_LEN                

-#define    ZPS_UICC_LEN_APN           (BYTE)101    

-#define    Z_UICC_LEN_APN               ZPS_UICC_LEN_APN         

+#define    ZPS_UICC_LEN_APN                                     (BYTE)101    

+#define    Z_UICC_LEN_APN               ZPS_UICC_LEN_APN

+#define    ZPS_UICC_LEN_FDNURI                                  (BYTE)255

+#define    Z_UICC_LEN_FDNURI            ZPS_UICC_LEN_FDNURI   

+#define    ZPS_UICC_LEN_SDNURI                                  (BYTE)255

+#define    Z_UICC_LEN_SDNURI            ZPS_UICC_LEN_SDNURI 

 /**************************************************************************

 *                          UiccManagerºÍAp½Ó¿ÚÖк궨Òå                               *

 **************************************************************************/

@@ -1794,6 +1800,15 @@
     BITS                                    bOperatorCsgListAndIndFg:1;    /* Service n¡ã90 Operator CSG Lists and corresponding indications */

     BITS                                    bSuppSmOverIpFg:1;             /* Service n¡ã91 Support for SM-over-IP */

     BITS                                    :5;

+

+    BITS                                    :2;

+    BITS                                    bUriSupByUiccFg:1;             /* Service n¡ã99 URI support by UICC */

+    BITS                                    :5;

+

+    BITS                                    :7;

+    BITS                                    bECallDataOverImsFg:1;         /* Service n¡ã112 eCall Data over IMS*/

+

+    BYTE                                    bPadding[3];

 }T_zPS_UICC_Ust,

 T_z_UICC_Ust;

 

@@ -1971,12 +1986,12 @@
   

   BYTE                                           bCpbCfgId; 

   BYTE                                           bExt3RecId;

-    BYTE                                           abPadding1[2];

+  BYTE                                           abPadding1[2];

 

   BYTE                                           abAlphaId[ZPS_UICC_LEN_SDN];

 

   BYTE                                           abDialNumSsc[10];

-    BYTE                                           abPadding3[2];

+  BYTE                                           abPadding3[2];

 }T_zPS_UICC_Sdn,

 T_z_UICC_Sdn;

 

@@ -1986,10 +2001,10 @@
 {

   BYTE                                            bRecType;

   BYTE                                            bIdent;

-    BYTE                                            abPadding1[2];

+  BYTE                                            abPadding1[2];

 

   BYTE                                            abExtData[11];

-    BYTE                                            bPadding2;

+  BYTE                                            bPadding2;

 }T_zPS_UICC_Ext2,

 T_z_UICC_Ext2;

 

@@ -1999,10 +2014,10 @@
 {

   BYTE                                            bRecType;

   BYTE                                            bIdent;

-    BYTE                                            abPadding1[2];

+  BYTE                                            abPadding1[2];

 

   BYTE                                            abExtData[11];

-    BYTE                                            bPadding2;

+  BYTE                                            bPadding2;

 }T_zPS_UICC_Ext3,

 T_z_UICC_Ext3;

 

@@ -2011,10 +2026,10 @@
 typedef struct

 {

   BYTE                                             bRecId;

-    BYTE                                             abPadding1[3];

+  BYTE                                             abPadding1[3];

 

   BYTE                                             abStatusReport[29];

-    BYTE                                             abPadding2[3];

+  BYTE                                             abPadding2[3];

 }T_zPS_UICC_Smsr,

 T_z_UICC_Smsr;

 

@@ -2548,6 +2563,24 @@
 }T_zPS_UICC_Vbs,

 T_z_UICC_Vbs;

 

+/* 4.2.97 EFFDNURI */

+typedef struct

+{

+    BYTE                                           bUriAddrLen;

+    BYTE                                           bMaxAlphaIdLen;          /*±íÃ÷µ±Ç°¿¨Ö§³ÖµÄAlphaId×î´ó³¤¶È*/

+    BYTE                                           abUriAddr[ZPS_UICC_LEN_FDNURI];

+    BYTE                                           abAlphaId[ZPS_UICC_LEN_FDNURI];

+}T_z_UICC_FdnUri;

+

+/* 4.2.99 EFSDNURI */

+typedef struct

+{

+    BYTE                                           bUriAddrLen;

+    BYTE                                           bMaxAlphaIdLen;          /*±íÃ÷µ±Ç°¿¨Ö§³ÖµÄAlphaId×î´ó³¤¶È*/

+    BYTE                                           abUriAddr[ZPS_UICC_LEN_SDNURI];

+    BYTE                                           abAlphaId[ZPS_UICC_LEN_SDNURI];

+}T_z_UICC_SdnUri;

+

 /*4.4.1.1   EFSai */

 typedef struct

 {

@@ -5518,6 +5551,18 @@
 } T_zPS_ApUicc_OprtPsdev_Ind,

 T_zApUicc_OprtPsdev_Ind;

 

+typedef struct {

+    BYTE                                         bSrcIndex;  /* 0xff */      

+    BYTE                                         bDesIndex;  /* 0xff */           

+    BYTE                                         bDevKeyId;

+    BYTE                                         bStartRec;

+    BYTE                                         bEndRec;

+    BYTE                                         bMsgCount;

+    BYTE                                         abPadding[2];

+    PBYTE                                       pbRstAddr;

+} T_zPS_ApUicc_ReadDirectDev_Ind,

+T_zApUicc_ReadDirectDev_Ind;

+

 /*==============================================================================

  Ô­ÓZPS_ApUicc_WriteItemInd_Ev

  ˵Ã÷: ͨ¹ýpsDev×é×°ÏûÏ¢£¬Í¨ÖªuiccMng½øÐÐÊý¾Ý¸üÐÂ

diff --git a/cp/ps/modem/ps/inc/atipscom.h b/cp/ps/modem/ps/inc/atipscom.h
index a94555b..a64ec13 100755
--- a/cp/ps/modem/ps/inc/atipscom.h
+++ b/cp/ps/modem/ps/inc/atipscom.h
@@ -227,13 +227,14 @@
 #define Z_ATI_NV_BeepCall                                  (BYTE)(Z_ATI_NV_CustomMcc + 1)

 #define Z_ATI_NV_Msisdn1                                   (BYTE)(Z_ATI_NV_BeepCall + 1)

 #define Z_ATI_NV_Msisdn2                                   (BYTE)(Z_ATI_NV_Msisdn1 + 1)

+#define Z_ATI_NV_EcallCapa                                 (BYTE)(Z_ATI_NV_Msisdn2 + 1)

 #ifdef BTRUNK_SUPPORT

-#define Z_ATI_NV_PttTruncUser                              (BYTE)(Z_ATI_NV_Msisdn2 + 1)

+#define Z_ATI_NV_PttTruncUser                              (BYTE)(Z_ATI_NV_EcallCapa + 1)

 #define Z_ATI_NV_PttIOTFlag                                (BYTE)(Z_ATI_NV_PttTruncUser + 1)

 #define Z_ATI_NV_PttSubWayFlag                             (BYTE)(Z_ATI_NV_PttIOTFlag + 1)

 #define Z_ATI_NV_PrvEnd                                    (BYTE)(Z_ATI_NV_PttSubWayFlag + 0)

 #else

-#define Z_ATI_NV_PrvEnd                                    (BYTE)(Z_ATI_NV_Msisdn2 + 0)

+#define Z_ATI_NV_PrvEnd                                    (BYTE)(Z_ATI_NV_EcallCapa + 0)

 #endif

 

 

@@ -326,9 +327,16 @@
 #define Z_UiccId_EST_BIN                                      (BYTE)45

 #define Z_UiccId_ACL_BIN                                      (BYTE)46

 #define Z_UiccId_ICCID_BIN                                    (BYTE)47

-#define Z_UiccId_OPL_REC                                   (BYTE)48

-#define Z_UiccId_PNN_REC                                   (BYTE)49

-#define Z_UiccId_LAST                                         (BYTE)Z_UiccId_PNN_REC

+#define Z_UiccId_OPL_REC                                      (BYTE)48

+#define Z_UiccId_PNN_REC                                      (BYTE)49

+#define Z_UiccId_FDN_REC                                      (BYTE)50

+#define Z_UiccId_SDN_REC                                      (BYTE)51

+#define Z_UiccId_FDNURI_REC                                   (BYTE)52

+#define Z_UiccId_SDNURI_REC                                   (BYTE)53

+#define Z_UiccId_EXT2_REC                                     (BYTE)54

+#define Z_UiccId_EXT3_REC                                     (BYTE)55

+#define Z_UiccId_LAST                                         (BYTE)Z_UiccId_EXT3_REC

+

 

 /* FPLMN */

 #define    ZPS_UICC_LEN_FPLMN                                   (BYTE)85  

@@ -1285,6 +1293,12 @@
     BYTE                            abMsisdnNum[Z_DEV_MAX_MSISDN_NUM];

 }T_zAti_NV_Msisdn;

 

+typedef struct

+{

+    BYTE              bEcallMode;/*0-not sup ecall 1-ecall only 2-ecall & normal call*/

+    BYTE              abPadding[3];

+}T_zAti_NV_EcallCapa;

+

 #ifdef BTRUNK_SUPPORT

 typedef struct  

 {

@@ -1923,6 +1937,8 @@
     BYTE                            abPadding[3];

 #endif

     BYTE                            bRoamNetSerch; /*¹úÄÚÂþÓÎÍøÂçËÑË÷¹¦ÄÜ¿ª¹Ø*/

+    BYTE                            bCecnSet;

+    BYTE                            abPadding2[2];

 }T_zDev_AtMem_Mmia_PrivateMem;

 

 typedef struct {

diff --git a/cp/ps/modem/ps/inc/atipsint.h b/cp/ps/modem/ps/inc/atipsint.h
index 5fc107f..2fa876b 100755
--- a/cp/ps/modem/ps/inc/atipsint.h
+++ b/cp/ps/modem/ps/inc/atipsint.h
@@ -1012,6 +1012,10 @@
 /*=======================  MOC REQÖеÄbECallTypeºê¶¨Òå ===========================*/

 #define Z_MMIACC_NORMAL_CALL                                     (BYTE)0

 #define Z_MMIACC_EMERGENCY_CALL                                  (BYTE)1

+#define Z_MMIACC_ECALL_TESTCALL                                  (BYTE)2

+#define Z_MMIACC_ECALL_RECONFIGCALL                              (BYTE)3

+#define Z_MMIACC_ECALL_MANU                                      (BYTE)4

+#define Z_MMIACC_ECALL_AUTO                                      (BYTE)5

 

 /*=======================  MOC REQÖеÄbCallTypeºê¶¨Òå£¬ËæeÐÐÖÐORIG/CONN ÏûϢҲʹÓà =====================*/

 #define Z_MMIACC_VOICE_CALL                                      (BYTE)0

@@ -1558,6 +1562,9 @@
 #define Z_CSVOICE_NOT_SPT                         (BYTE)0

 #define Z_CSVOICE_SPT_ONLYEMC                     (BYTE)1

 #define Z_CSVOICE_SPT                             (BYTE)2

+

+#define MSD_MAX_LENGTH                           (BYTE)140

+

 #ifdef _USE_LPP_ECID

 /*ClientExtId Addr×î´ó³¤¶È*/

 #define Z_MAX_CLENTADDR_LEN                  (BYTE)20

@@ -1578,8 +1585,8 @@
 #define    Z_HORIZON_VERTIC_VEL            (BYTE)1

 #define    Z_HORIZON_VEL_UNCERT            (BYTE)2

 #define    Z_HORIZON_VERTIC_VEL_UNCERT     (BYTE)3

-

 #endif

+

 typedef enum  

 {

     EV_ZATI2_BEGIN           = 0x9000,

@@ -2311,6 +2318,29 @@
     T_z_PlmnId abOperatePlmn[Z_MAX_OPERATE_PLMNNUM];

 }T_zMmiaUmm_OperPlmn;

 

+/*MMIA_UMM_ECALLSPT_QUERY_REQ_EV, MMIA_UMM_ECALLONLY_QUERY_REQ_EV*/

+typedef struct {

+    BYTE                        bSrcIndex;

+    BYTE                        bDesIndex;

+    BYTE                        abPadding[2];

+}T_zMmiaUmm_eCallSpt_QueryReq, T_zMmiaUmm_eCallOnly_QueryReq;

+

+/*MMIA_UMM_ECALLSPT_QUERY_CNF_EV*/

+typedef struct {

+   BYTE            bSrcIndex;

+   BYTE            bDesIndex;

+   BYTE            beCallOverIms;

+   BYTE            bUiccSpteCall;

+}T_zMmiaUmm_eCallSpt_QueryCnf;

+

+/*MMIA_UMM_ECALLONLY_QUERY_CNF_EV*/

+typedef struct {

+   BYTE            bSrcIndex;

+   BYTE            bDesIndex;

+   BYTE            beCallOnly; /*Z_VALID, Z_INVALID*/

+   BYTE            bPadding;

+}T_zMmiaUmm_eCallOnly_QueryCnf;

+

 /*PDPµØÖ·*/

 typedef struct 

 {

@@ -5399,7 +5429,11 @@
 

     T_z_CallNum                 tCalledNum;    

     BYTE                        bReialFlag; // 0:²»ÊÇredial,  1: ÊÇredial·¢ÆðµÄºô½Ð

-    BYTE                        abReialPadding[3];

+    BYTE                        abReialPadding;

+

+    BYTE                        bPsdone; /*CECALL ¸Ãֵȡ0£¬ZECALL¸Ãֵȡ1*/

+    BYTE                        bMsdLen;

+    BYTE                        abMSD[MSD_MAX_LENGTH];

 }T_zMmiaCc_Moc_Req;

 

 /*==============================================================================

@@ -5900,6 +5934,30 @@
     BYTE                        bPadding;

 }T_zMmiaCC_StopLocalVoice_Ind,T_zMmiaCC_StartLocalVoice_Ind;

 

+/*==============================================================================

+ Ô­ÓMMIA_CC_CECN_IND_EV(CC->ATI)

+ ˵Ã÷: Éϱ¨+CECN: <data_type>

+==============================================================================*/

+typedef struct {

+   BYTE            bSrcIndex;

+   BYTE            bDesIndex;

+   BYTE            bDataType;//0-updated MSD for the eCall is provided to the network by the MT,1-request for updated MSD

+   BYTE            bPadding;

+}T_zMmiaCc_Cecn_Ind;

+

+

+/*==============================================================================

+ Ô­ÓMMIA_CC_ZECALL_IND_EV(CC->ATI)

+ ˵Ã÷: CC½«CECALLת½»IMS´¦Àí

+==============================================================================*/

+typedef struct {

+   BYTE            bSrcIndex;

+   BYTE            bDesIndex;

+   BYTE            beCallType;

+   BYTE            bMsdLen;

+   BYTE            abMSD[MSD_MAX_LENGTH];

+}T_zMmiaCc_ZECALL_Ind;

+

 typedef struct

 {

     BYTE                        bStatus;        /* ²Î¼ûºê¶¨Òå */

diff --git a/cp/ps/modem/ps/inc/ps.h b/cp/ps/modem/ps/inc/ps.h
old mode 100644
new mode 100755
index d12bf8e..e10064f
--- a/cp/ps/modem/ps/inc/ps.h
+++ b/cp/ps/modem/ps/inc/ps.h
@@ -354,7 +354,11 @@
 #define SUBMDL_Z_ENMEL2                       (BYTE)(SUBMDL_PSBASE + 112)

 #define SUBMDL_Z_TSM                          (BYTE)(SUBMDL_PSBASE + 113)

 #define SUBMDL_Z_LPP                          (BYTE)(SUBMDL_PSBASE + 114)

-#define SUBMDL_PSEND                          (BYTE)SUBMDL_Z_LPP

+

+#define SUBMDL_Z_IVS                           (BYTE)(SUBMDL_PSBASE + 115)

+#define SUBMDL_Z_PSAP                           (BYTE)(SUBMDL_PSBASE + 116)

+

+#define SUBMDL_PSEND                          (BYTE)SUBMDL_Z_PSAP

 

 /*end add  by WGrop for W optimize 12-11-6 -----WEIYUZHEN*/

 

diff --git a/cp/ps/modem/ps/src/nas/ati/inc/zat_api.h b/cp/ps/modem/ps/src/nas/ati/inc/zat_api.h
old mode 100644
new mode 100755
index 689278f..8d0a863
--- a/cp/ps/modem/ps/src/nas/ati/inc/zat_api.h
+++ b/cp/ps/modem/ps/src/nas/ati/inc/zat_api.h
@@ -177,6 +177,8 @@
     ZAT2_MM_ZLC,

     ZAT2_MM_ZRMNETSH,

     ZAT2_MM_ZSCISCAN,

+    ZAT2_MM_ZNECALL,

+    ZAT2_MM_ZECALLONLY,

     ZAT2_MM_END,       

 

     /*-----------CCÄ£¿é-------------*/

@@ -213,6 +215,12 @@
     ZAT2_CC_ZREDIAL,  // for VoLTE

     ZAT2_CC_ZLRBT,

     ZAT2_CC_ZCWA,

+    ZAT2_CC_ZBEEPNUM,

+    ZAT2_CC_CECN,

+    ZAT2_CC_CECALL,

+    ZAT2_CC_ZNECALLNUM,

+    ZAT2_CC_ZECALL,

+    ZAT2_CC_ZECALLCAPA,

     ZAT2_CC_END,       

 

     /*-----------SMSÄ£¿é-------------*/

diff --git a/cp/ps/modem/ps/src/nas/ati/inc/zat_fnc.h b/cp/ps/modem/ps/src/nas/ati/inc/zat_fnc.h
index 1e37e38..95c6f07 100755
--- a/cp/ps/modem/ps/src/nas/ati/inc/zat_fnc.h
+++ b/cp/ps/modem/ps/src/nas/ati/inc/zat_fnc.h
@@ -394,6 +394,16 @@
 T_ZAt_ParseCmd2MsgRslt zAt_PsDecCcCbstReq( T_ZAt_DecCmdInfo * pDecCmdInfo );

 T_ZAt_ParseCmd2MsgRslt zAt_PsDecCcCcugReq( T_ZAt_DecCmdInfo * pDecCmdInfo );

 T_ZAt_ParseCmd2MsgRslt zAt_PsDecCcCmodReq( T_ZAt_DecCmdInfo * pDecCmdInfo );

+#ifdef ECALL_SUPPORT

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecCecallReq(T_ZAt_DecCmdInfo * pDecCmdInfo);

+#endif

+#endif

+#ifdef ECALL_SUPPORT

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecCecnSetReq(T_ZAt_DecCmdInfo * pDecCmdInfo);

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecCecnQryReq(T_ZAt_DecCmdInfo * pDecCmdInfo);

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecZnecallnumReq(T_ZAt_DecCmdInfo * pDecCmdInfo);

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecEcallCapaSetReq(T_ZAt_DecCmdInfo * pDecCmdInfo);

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecEcallCapaQryReq(T_ZAt_DecCmdInfo * pDecCmdInfo);

 #endif

 T_ZAt_ParseCmd2MsgRslt zAt_PsDecCcCrReq( T_ZAt_DecCmdInfo * pDecCmdInfo );

 T_ZAt_ParseCmd2MsgRslt zAt_PsDecCcCrcReq( T_ZAt_DecCmdInfo * pDecCmdInfo );

@@ -783,8 +793,10 @@
 UINT16 zAt_PsEncMmZssdomainQueryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo);

 UINT16 zAt_PsEncMmSpnQueryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo);

 UINT16 zAt_PsEncMmSysconfigQueryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo);

-#ifdef USE_VOICE_SUPPORT

 UINT16 zAt_PsEncMmCsVoiceSptQryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo);

+#ifdef ECALL_SUPPORT

+UINT16 zAt_PsEncZnecallQryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo);

+UINT16 zAt_PsEncZecallonlyQryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo);

 #endif

 UINT16 zAt_PsEncZiccidInd(T_ZAt_EncCmdInfo * pEncCmdInfo);

 UINT16 zAt_PsEncZplmnBandQueryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo);

@@ -809,6 +821,10 @@
 UINT16 zAt_PsEncCcColpInd(T_ZAt_EncCmdInfo * pEncCmdInfo);

 UINT16 zAt_PsEncCcCcwaInd(T_ZAt_EncCmdInfo * pEncCmdInfo);

 UINT16 zAt_PsEncCeerCcActionCnf( T_ZAt_EncCmdInfo * pEncCmdInfo );

+#ifdef ECALL_SUPPORT

+UINT16 zAt_EncCcCecnInd(T_ZAt_EncCmdInfo * pEncCmdInfo);

+UINT16 zAt_EncCcZEcallInd(T_ZAt_EncCmdInfo * pEncCmdInfo);

+#endif

 #endif

 UINT16 zAt_PsEncCeerSmActionCnf( T_ZAt_EncCmdInfo * pEncCmdInfo );

 UINT16 zAt_PsEncCeerUmmActionCnf(T_ZAt_EncCmdInfo * pEncCmdInfo);

@@ -1209,6 +1225,8 @@
 T_ZAt_ParseCmd2MsgRslt zAt_PsDecNvrweccSetReq(T_ZAt_DecCmdInfo *pDecCmdInfo);

 T_ZAt_ParseCmd2MsgRslt zAt_PsDecZchnelSetReq(T_ZAt_DecCmdInfo * pDecCmdInfo);

 T_ZAt_ParseCmd2MsgRslt zAt_PsDecZchnelQryReq(T_ZAt_DecCmdInfo * pDecCmdInfo);

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecBeepNumSetReq(T_ZAt_DecCmdInfo *pDecCmdInfo);

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecBeepNumQryReq(T_ZAt_DecCmdInfo *pDecCmdInfo);

 #ifdef USE_VOICE_SUPPORT

 T_ZAt_ParseCmd2MsgRslt zAt_PsDecZcwaSetReq(T_ZAt_DecCmdInfo * pDecCmdInfo);

 T_ZAt_ParseCmd2MsgRslt zAt_PsDecZcwaQryReq(T_ZAt_DecCmdInfo *pDecCmdInfo);

diff --git a/cp/ps/modem/ps/src/nas/ati/inc/zati_com.h b/cp/ps/modem/ps/src/nas/ati/inc/zati_com.h
index 9da34d4..68d7fe9 100755
--- a/cp/ps/modem/ps/src/nas/ati/inc/zati_com.h
+++ b/cp/ps/modem/ps/src/nas/ati/inc/zati_com.h
@@ -537,6 +537,34 @@
 /**********************SMÄ£¿éʹÓõÄCID*******************/

 #define Z_ATI_SM_MIN_CID           (BYTE)1

 #define Z_ATI_SM_MAX_CID           (BYTE)4

+

+

+/**********************ECALL TYPE************************/

+#define Z_ATI_NOTSUP_ECALL     (BYTE)0/*eCall not support*/

+#define Z_ATI_ECALL_ONLY     (BYTE)1/*eCall Only support*/

+#define Z_ATI_ECALL_NORMCALL    (BYTE)2/*eCall and Normal call support*/

+/**********************NUM OR URI************************/

+#define  Z_ATI_ECALL_NUM_NOT_SUP      (BYTE)0

+#define  Z_ATI_ECALL_NUM_SUP      (BYTE)1

+#define  Z_ATI_ECALL_URI_NOT_SUP      (BYTE)0

+#define  Z_ATI_ECALL_URI_SUP      (BYTE)1

+/**********************ecall type*************************/

+#define Z_ATI_TEST_ECALL      (BYTE)0/*test call*/

+#define Z_ATI_RECFG_ECALL      (BYTE)1/*reconfiguration call eCall*/

+#define Z_ATI_MANUINIT_ECALL      (BYTE)2/*manually initiated eCall*/

+#define Z_ATI_AUTOINIT_ECALL      (BYTE)3/*automatically initated eCall*/

+/*********************ps done***************************/

+#define Z_ATI_PSDONE_CECALL        (BYTE)0/*+CECALL*/

+#define Z_ATI_PSDONE_ZECALL        (BYTE)1/*+ZECALL*/

+/*********************num type*************************/

+#define Z_ATI_TEST_NUM      (BYTE)0/*test num*/

+#define Z_ATI_RECFG_NUM      (BYTE)1/*reconfiguration number num*/

+/**********************ECALL CAPA**********************/

+#define Z_ATI_ECALL_NOT_SUP        (BYTE)0/*NOT SUP ECALL*/

+#define Z_ATI_ECALL_ONLY        (BYTE)1/*ECALL ONLY*/

+#define Z_ATI_ECALL_NORMALCALL        (BYTE)2/*NORMAL & ECALL*/

+

+

 #ifdef DSDS_VSIM

 /**********************´ý»ú²à״̬***************************/

 #define Z_ATI_CARD_DEACT           (BYTE)0

@@ -1596,6 +1624,16 @@
 VOID zAti_GrrRptRxlevInd(VOID* pBuff);

 VOID zAti_McrRptRxlevInd(VOID* pBuff);

 VOID zAti_HandleUlParaInd(VOID* pBuff);

+#ifdef ECALL_SUPPORT

+BYTE zAt_GetEcallSupStat(PBYTE pbEcallType,  PBYTE pbIsNum, PBYTE pbIsUri);

+VOID zAti_UpdateDialNum(PBYTE abNum, PBYTE pbcdSscLen);

+VOID zAti_GetCcECallType(BYTE *pbECallType);

+VOID zAti_GetAtECallType(BYTE *pbCcECallType);

+VOID zAt_GetFdnEcallNum(T_z_CallNum* ptTestNum, T_z_CallNum* ptReCfgNum, BYTE bInsNo);

+VOID zAt_GetFdnEcallUri(T_z_UICC_FdnUri* ptTestUri, T_z_UICC_FdnUri* ptRecfgUri, BYTE bInsNo);

+VOID zAt_GetSdnEcallNum(T_z_CallNum* ptTestNum, T_z_CallNum* ptReCfgNum, BYTE bInsNo);

+VOID zAt_GetSdnEcallUri(T_z_UICC_SdnUri* ptTestUri, T_z_UICC_SdnUri* ptRecfgUri, BYTE bInsNo);

+#endif

 #ifdef USE_VOICE_SUPPORT

 BYTE zAti_HexArrayToLong (DWORD *pdwPara, BYTE *pbArray, BYTE bArraySize);

 VOID zAti_DecArrayToLong(DWORD *pdwPara, BYTE *pbArray, BYTE bArraySize);

diff --git a/cp/ps/modem/ps/src/nas/ati/src/zat_fnc.c b/cp/ps/modem/ps/src/nas/ati/src/zat_fnc.c
index f076e2e..a297034 100755
--- a/cp/ps/modem/ps/src/nas/ati/src/zat_fnc.c
+++ b/cp/ps/modem/ps/src/nas/ati/src/zat_fnc.c
@@ -3695,6 +3695,320 @@
     }

     return zAt_PsDecFinishParse(&prsCmd2Msg, pDecCmdStr, &tCmod, sizeof(T_zApMmia_CC_Cmod), TRUE); 

 }

+#ifdef ECALL_SUPPORT

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecCecallReq(T_ZAt_DecCmdInfo * pDecCmdInfo)

+{

+    CHAR* pDecCmdStr = pDecCmdInfo->strParam;

+    CHAR strSubBuf[ZAT2_SUB_PARAM_MAX_LEN] = {0};

+    T_ZAt_ParseCmd2MsgRslt     prsCmd2Msg = {0};

+    BYTE bFormat = 0;

+    SINT16 iStrlen = -1;

+    BYTE bCardEcallType = Z_ATI_NOTSUP_ECALL;

+    BYTE IsSupNum = Z_ATI_ECALL_NUM_NOT_SUP;

+    BYTE IsSupUri = Z_ATI_ECALL_URI_NOT_SUP;

+    T_z_CallNum testNum = {0};

+    T_z_CallNum ReCfgNum = {0};

+

+    T_zMmiaCc_Moc_Req *ptMocReq = (T_zMmiaCc_Moc_Req*)zAti_GetUB(sizeof(T_zMmiaCc_Moc_Req));

+    prsCmd2Msg.pMsgBody = (VOID*)ptMocReq;

+    prsCmd2Msg.iMsgLen = sizeof(T_zMmiaCc_Moc_Req);

+

+    ptMocReq->bCallType = Z_APMMIA_CALLTYPE_VOICE;

+

+    if(pDecCmdInfo->curCmdId == ZAT2_CC_CECALL)

+    {

+        ptMocReq->bPsdone = Z_ATI_PSDONE_CECALL;

+    }

+    else

+    {

+        ptMocReq->bPsdone = Z_ATI_PSDONE_ZECALL;

+    }

+

+    /*+CECALL=<type_of_eCall>,<format>,<msd_data_length>,<msd_data>*/

+    if(!(zAt_PsDecNextParamDecimalNumByteNeed( &prsCmd2Msg, strSubBuf, &pDecCmdStr, &ptMocReq->bECallType, NULL))

+        || ptMocReq->bECallType > Z_ATI_AUTOINIT_ECALL)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    if(!zAt_PsDecNextParamDecimalNumByte( &prsCmd2Msg, strSubBuf, &pDecCmdStr, &bFormat, NULL))

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    if(!zAt_PsDecNextParamDecimalNumByteNeed( &prsCmd2Msg, strSubBuf, &pDecCmdStr, &ptMocReq->bMsdLen, NULL))

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    iStrlen = zAt_GetNextParamStr(strSubBuf, ZAT2_PARAM_STRING, &pDecCmdStr);

+    if ((iStrlen <= 0) || (iStrlen > MSD_MAX_LENGTH*2))

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    if ((iStrlen = zAt_DecStr2ArrByCscsType(ptMocReq->abMSD, MSD_MAX_LENGTH, strSubBuf, (UINT16)iStrlen, ZAT2_CSCS_HEX)) == -1)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    if(ptMocReq->bMsdLen == 0 || iStrlen != ptMocReq->bMsdLen)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    if(strlen((const char *)pDecCmdStr) != 0)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    zAti_GetCcECallType(&ptMocReq->bECallType);

+

+    if(ptMocReq->bECallType == Z_MMIACC_ECALL_TESTCALL || ptMocReq->bECallType == Z_MMIACC_ECALL_RECONFIGCALL)

+    {

+        if((Z_FAIL == zAt_GetEcallSupStat(&bCardEcallType, &IsSupNum, &IsSupUri)) || 

+            (bCardEcallType == Z_ATI_NOTSUP_ECALL) || (IsSupNum == Z_ATI_ECALL_NUM_NOT_SUP))

+        {

+            zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+            return zAt_GetParseRslt2(&prsCmd2Msg, ZAT2_OPTNOTALW_ERR);

+        }

+

+        if(bCardEcallType == Z_ATI_ECALL_ONLY)

+        {

+            zAt_GetFdnEcallNum(&testNum, &ReCfgNum, g_zAti_CurInstance);//¶ÁÈ¡FDN

+        }

+        else

+        {

+            zAt_GetSdnEcallNum(&testNum, &ReCfgNum, g_zAti_CurInstance);//¶ÁÈ¡SDN

+        }

+

+        if(ptMocReq->bECallType == Z_MMIACC_ECALL_TESTCALL)

+        {

+            ptMocReq->tCalledNum = testNum;

+        }

+        else

+        {

+            ptMocReq->tCalledNum = ReCfgNum;

+        }

+

+        if(ptMocReq->tCalledNum.bNumLen == 0)

+        {

+            zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+            return zAt_GetParseRslt2(&prsCmd2Msg, ZAT2_OPTNOTALW_ERR);

+        }

+    }

+

+    return prsCmd2Msg;

+}

+#endif

+#endif

+#ifdef ECALL_SUPPORT

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecCecnSetReq(T_ZAt_DecCmdInfo * pDecCmdInfo)

+{

+    CHAR* pDecCmdStr = pDecCmdInfo->strParam;

+    CHAR strSubBuf[ZAT2_SUB_PARAM_MAX_LEN] = {0};

+    T_ZAt_ParseCmd2MsgRslt     prsCmd2Msg = {0};

+    T_zDev_AtMem_Mmia_PrivateMem tAtData    = {0};

+    BYTE bSetPara = Z_APMMIA_INVALID;

+

+    if(zAt_PsDecCmdFirstParamOmitted(&prsCmd2Msg, pDecCmdStr, NULL))

+    {

+        return prsCmd2Msg;

+    }

+

+    /*+CECN=[<n>]*/

+    if(!(zAt_PsDecNextParamDecimalNumByte( &prsCmd2Msg, strSubBuf, &pDecCmdStr, &bSetPara, NULL))

+        || bSetPara > Z_APMMIA_VALID)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    if(strlen((const char *)pDecCmdStr) != 0)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    zDev_AtMemReadItem(Z_AtMem_ID_MmiaPrvtMem, 0, (PBYTE)&tAtData, g_zAti_CurInstance);

+    tAtData.bCecnSet = bSetPara;

+    zDev_AtMemWriteItem(Z_AtMem_ID_MmiaPrvtMem, 0 ,(PBYTE)&tAtData, g_zAti_CurInstance);

+

+    zOss_Memcpy(g_zAt_EncBuf, g_zAt_OK, strlen((const char *)g_zAt_OK));

+    prsCmd2Msg.decRslt2nd = ZAT2_CMD_REPLY_DIRECT;

+

+    return prsCmd2Msg;

+}

+

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecCecnQryReq(T_ZAt_DecCmdInfo * pDecCmdInfo)

+{

+    CHAR * pStrWalk = g_zAt_EncBuf;

+    T_ZAt_ParseCmd2MsgRslt     prsCmd2Msg = {0};

+    T_zDev_AtMem_Mmia_PrivateMem tAtData    = {0};

+

+    zDev_AtMemReadItem(Z_AtMem_ID_MmiaPrvtMem, 0, (PBYTE)&tAtData, g_zAti_CurInstance);

+

+    sprintf((char *)pStrWalk, "%s+CECN: %d%s%s", g_zAt_CRLF, tAtData.bCecnSet, g_zAt_CRLF, g_zAt_OK);

+

+    prsCmd2Msg.decRslt2nd = ZAT2_CMD_REPLY_DIRECT;

+    return prsCmd2Msg;

+}

+

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecZnecallnumReq(T_ZAt_DecCmdInfo * pDecCmdInfo)

+{

+    CHAR* pStrWalk = g_zAt_EncBuf;

+    CHAR* pDecCmdStr = pDecCmdInfo->strParam;

+    CHAR strSubBuf[ZAT2_SUB_PARAM_MAX_LEN] = {0};

+    T_ZAt_ParseCmd2MsgRslt     prsCmd2Msg = {0};

+    BYTE bEcallType = Z_ATI_NOTSUP_ECALL;

+    BYTE IsSupNum = Z_ATI_ECALL_NUM_NOT_SUP;

+    BYTE IsSupUri = Z_ATI_ECALL_URI_NOT_SUP;

+    T_z_CallNum testNum = {0};

+    T_z_CallNum ReCfgNum = {0};

+    T_z_UICC_FdnUri *ptTestFdnUri = NULL;

+    T_z_UICC_FdnUri *ptRecfgFdnUri = NULL;

+    T_z_UICC_SdnUri *ptTestSdnUri = NULL;

+    T_z_UICC_SdnUri *ptRecfgSdnUri = NULL;

+    BYTE i = 0;

+

+    if(Z_FAIL == zAt_GetEcallSupStat(&bEcallType, &IsSupNum, &IsSupUri))

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg, ZAT2_OPTNOTALW_ERR);

+    }

+

+    pStrWalk += sprintf((char *)pStrWalk, "%s+ZNECALLNUM: ", g_zAt_CRLF);

+

+    if(bEcallType == Z_ATI_ECALL_ONLY)

+    {

+        ptTestFdnUri = (T_z_UICC_FdnUri*)zAti_GetUB(sizeof(T_z_UICC_FdnUri));

+        ptRecfgFdnUri = (T_z_UICC_FdnUri*)zAti_GetUB(sizeof(T_z_UICC_FdnUri));

+

+        if(IsSupNum == Z_ATI_ECALL_NUM_SUP)

+        {

+            zAt_GetFdnEcallNum(&testNum, &ReCfgNum, g_zAti_CurInstance);//¶ÁÈ¡FDN

+        }

+

+        if(IsSupUri == Z_ATI_ECALL_URI_SUP)

+        {

+            zAt_GetFdnEcallUri(ptTestFdnUri, ptRecfgFdnUri, g_zAti_CurInstance);//¶ÁÈ¡FDNURI

+        }

+

+        pStrWalk += sprintf((char *)pStrWalk, "\"");

+        zAt_EncBcd2NumStrByCscsType(pStrWalk, testNum.abNum, testNum.bNumLen, ZAT2_CSCS_GSM);

+        pStrWalk += strlen((const char *)pStrWalk);

+

+        pStrWalk += sprintf((char *)pStrWalk, "\",\"");

+        zAt_EncBcd2NumStrByCscsType(pStrWalk, ReCfgNum.abNum, ReCfgNum.bNumLen, ZAT2_CSCS_GSM);

+        pStrWalk += strlen((const char *)pStrWalk);

+

+        pStrWalk += sprintf((char *)pStrWalk, "\",\"");

+

+        for(i = 0; i < ptTestFdnUri->bUriAddrLen; i++)

+        {

+            pStrWalk += sprintf((char *)pStrWalk, "%c", ptTestFdnUri->abUriAddr[i]);

+        }

+

+        pStrWalk += sprintf((char *)pStrWalk, "\",\"");

+

+        for(i = 0; i < ptRecfgFdnUri->bUriAddrLen; i++)

+        {

+            pStrWalk += sprintf((char *)pStrWalk, "%c", ptRecfgFdnUri->abUriAddr[i]);

+        }

+        pStrWalk += sprintf((char *)pStrWalk, "\"");

+

+        zAti_RetUB((VOID**)&ptTestFdnUri);

+        zAti_RetUB((VOID**)&ptRecfgFdnUri);

+    }

+    else if(bEcallType == Z_ATI_ECALL_NORMCALL)

+    {

+        ptTestSdnUri = (T_z_UICC_SdnUri*)zAti_GetUB(sizeof(T_z_UICC_SdnUri));

+        ptRecfgSdnUri = (T_z_UICC_SdnUri*)zAti_GetUB(sizeof(T_z_UICC_SdnUri));

+

+        if(IsSupNum == Z_ATI_ECALL_NUM_SUP)

+        {

+            zAt_GetSdnEcallNum(&testNum, &ReCfgNum, g_zAti_CurInstance);//¶ÁÈ¡FDN

+        }

+        if(IsSupUri == Z_ATI_ECALL_URI_SUP)

+        {

+            zAt_GetSdnEcallUri(ptTestSdnUri, ptRecfgSdnUri, g_zAti_CurInstance);//¶ÁÈ¡SDNURI

+        }

+

+        pStrWalk += sprintf((char *)pStrWalk, "\"");

+        zAt_EncBcd2NumStrByCscsType(pStrWalk, testNum.abNum, testNum.bNumLen, ZAT2_CSCS_GSM);

+        pStrWalk += strlen((const char *)pStrWalk);

+

+        pStrWalk += sprintf((char *)pStrWalk, "\",\"");

+        zAt_EncBcd2NumStrByCscsType(pStrWalk, ReCfgNum.abNum, ReCfgNum.bNumLen, ZAT2_CSCS_GSM);

+        pStrWalk += strlen((const char *)pStrWalk);

+

+        pStrWalk += sprintf((char *)pStrWalk, "\",\"");

+

+        for(i = 0; i < ptTestSdnUri->bUriAddrLen; i++)

+        {

+            pStrWalk += sprintf((char *)pStrWalk, "%c", ptTestSdnUri->abUriAddr[i]);

+        }

+

+        pStrWalk += sprintf((char *)pStrWalk, "\",\"");

+

+        for(i = 0; i < ptRecfgSdnUri->bUriAddrLen; i++)

+        {

+            pStrWalk += sprintf((char *)pStrWalk, "%c", ptRecfgSdnUri->abUriAddr[i]);

+        }

+        pStrWalk += sprintf((char *)pStrWalk, "\"");

+

+        zAti_RetUB((VOID**)&ptTestSdnUri);

+        zAti_RetUB((VOID**)&ptRecfgSdnUri);

+    }

+    else

+    {

+        pStrWalk += sprintf((char *)pStrWalk, "\"\",\"\",\"\",\"\"");//IMSÒªÇóûÓÐʱÉϱ¨¿Õ

+    }

+

+    sprintf((char *)pStrWalk, "%s%s", g_zAt_CRLF, g_zAt_OK);

+

+    return zAt_GetParseRslt(ZAT2_CMD_REPLY_DIRECT);

+}

+

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecEcallCapaSetReq(T_ZAt_DecCmdInfo * pDecCmdInfo)

+{

+    CHAR* pDecCmdStr = pDecCmdInfo->strParam;

+    CHAR strSubBuf[ZAT2_SUB_PARAM_MAX_LEN] = {0};

+    T_ZAt_ParseCmd2MsgRslt     prsCmd2Msg = {0};

+    T_zAti_NV_EcallCapa    tEcallCapa = {0};

+    BYTE bSetPara = 0;

+

+    /*+ZECALLCAPA=<n>*/

+    if(!(zAt_PsDecNextParamDecimalNumByteNeed( &prsCmd2Msg, strSubBuf, &pDecCmdStr, &bSetPara, NULL))

+        || bSetPara > Z_ATI_ECALL_NORMALCALL)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    if(strlen((const char *)pDecCmdStr) != 0)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    zDev_NV_AtiReadItem(Z_ATI_NV_EcallCapa, (BYTE*)&tEcallCapa);

+

+    if(tEcallCapa.bEcallMode != bSetPara)

+    {

+        tEcallCapa.bEcallMode = bSetPara;

+        zDev_NV_AtiWriteItem(Z_ATI_NV_EcallCapa, (BYTE*)&tEcallCapa);

+    }

+

+    zOss_Memcpy(g_zAt_EncBuf, g_zAt_OK, strlen((const char *)g_zAt_OK));

+    return zAt_GetParseRslt(ZAT2_CMD_REPLY_DIRECT);    

+}

+

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecEcallCapaQryReq(T_ZAt_DecCmdInfo * pDecCmdInfo)

+{

+    T_zAti_NV_EcallCapa    tEcallCapa = {0};

+

+    zDev_NV_AtiReadItem(Z_ATI_NV_EcallCapa, (BYTE*)&tEcallCapa);

+

+    sprintf((char *)g_zAt_EncBuf, "%s+ZECALLCAPA: %d%s%s",g_zAt_CRLF, tEcallCapa.bEcallMode, g_zAt_CRLF, g_zAt_OK);

+

+    return zAt_GetParseRslt(ZAT2_CMD_REPLY_DIRECT);

+}

 #endif

 /*+Cr */

 T_ZAt_ParseCmd2MsgRslt zAt_PsDecCcCrReq(T_ZAt_DecCmdInfo * pDecCmdInfo)

@@ -18483,7 +18797,7 @@
     return (UINT16)sprintf((char *)pEncCmdInfo->pStrCmd, "%s^SYSCONFIG: %d,%d,%d,%d%s%s", g_zAt_CRLF, pSysconfigQueryCnf->bMode, pSysconfigQueryCnf->bacqorder, 

         pSysconfigQueryCnf->broam, pSysconfigQueryCnf->bSrvdomain, g_zAt_CRLF, g_zAt_OK);

 }

-#ifdef USE_VOICE_SUPPORT

+

 UINT16 zAt_PsEncMmCsVoiceSptQryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo)

 {

     T_zMmiaUmm_CsVoiceQry_Cnf *pCsVoiceQueryCnf = (T_zMmiaUmm_CsVoiceQry_Cnf*) pEncCmdInfo->pMsgBody;

@@ -18492,6 +18806,26 @@
     return (UINT16)sprintf((char *)pEncCmdInfo->pStrCmd,"%s^ZCSVOICESPT: %d%s%s", g_zAt_CRLF,

         pCsVoiceQueryCnf->bCsVoiceSupFlg, g_zAt_CRLF, g_zAt_OK);

 }

+#ifdef ECALL_SUPPORT

+UINT16 zAt_PsEncZnecallQryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo)

+{

+    T_zMmiaUmm_eCallSpt_QueryCnf *ptCnf = (T_zMmiaUmm_eCallSpt_QueryCnf*)pEncCmdInfo->pMsgBody;

+

+    zOss_Printf(SUBMDL_Z_ATI, PRINT_LEVEL_NORMAL,"\n zAt_PsEncZnecallQryCnf, beCallOverIms: %d, bUiccSpteCall: %d", ptCnf->beCallOverIms, ptCnf->bUiccSpteCall);

+

+     return (UINT16)sprintf((char *)pEncCmdInfo->pStrCmd, "%s+ZNECALL: %d,%d%s%s", g_zAt_CRLF, 

+        ptCnf->beCallOverIms, ptCnf->bUiccSpteCall, g_zAt_CRLF, g_zAt_OK);

+}

+

+UINT16 zAt_PsEncZecallonlyQryCnf(T_ZAt_EncCmdInfo * pEncCmdInfo)

+{

+    T_zMmiaUmm_eCallOnly_QueryCnf *ptCnf = (T_zMmiaUmm_eCallOnly_QueryCnf*)pEncCmdInfo->pMsgBody;

+

+    zOss_Printf(SUBMDL_Z_ATI, PRINT_LEVEL_NORMAL,"\n zAt_PsEncZecallonlyQryCnf, eCallOnly: %d", ptCnf->beCallOnly);

+

+    return (UINT16)sprintf((char *)pEncCmdInfo->pStrCmd, "%s+ZECALLONLY: %d%s%s", g_zAt_CRLF, 

+        ptCnf->beCallOnly, g_zAt_CRLF, g_zAt_OK);

+}

 #endif

 /**************************************************************************

 * º¯ÊýÃû³Æ£º zAt_PsEncMmZattQueryCnf

@@ -18943,6 +19277,54 @@
     return (UINT16)sprintf((char *)pEncCmdInfo->pStrCmd, "%s+CR: %s%s",  g_zAt_CRLF, ZAT2_CC_CALL_TYPE[pCrInd->bSrvType - 1] , g_zAt_CRLF);

 }

 #ifdef USE_VOICE_SUPPORT

+#ifdef ECALL_SUPPORT

+UINT16 zAt_EncCcCecnInd(T_ZAt_EncCmdInfo * pEncCmdInfo)

+{

+    CHAR * pStrWalk = pEncCmdInfo->pStrCmd;

+    T_zDev_AtMem_Mmia_PrivateMem tAtData    = {0};

+    T_zMmiaCc_Cecn_Ind *pCecnInd = (T_zMmiaCc_Cecn_Ind*) pEncCmdInfo->pMsgBody;

+

+    zOss_Printf(SUBMDL_Z_ATI, PRINT_LEVEL_NORMAL, "zAt_EncCcCecnInd : ATI Recv Msd Req From Cc");

+

+    zDev_AtMemReadItem(Z_AtMem_ID_MmiaPrvtMem, 0, (PBYTE)&tAtData, g_zAti_CurInstance);

+

+    /*+CECN: <data_type>*/

+    if(tAtData.bCecnSet == 1)

+    {

+        return sprintf((char *)pStrWalk, "%s+CECN: %d%s", g_zAt_CRLF, pCecnInd->bDataType, g_zAt_CRLF);

+    }

+

+    return 0;

+}

+

+UINT16 zAt_EncCcZEcallInd(T_ZAt_EncCmdInfo * pEncCmdInfo)

+{

+    BYTE i = 0;

+    CHAR * pStrWalk = pEncCmdInfo->pStrCmd;

+    T_zMmiaCc_ZECALL_Ind *pZEcallInd = (T_zMmiaCc_ZECALL_Ind*) pEncCmdInfo->pMsgBody;

+

+    zOss_Printf(SUBMDL_Z_ATI, PRINT_LEVEL_NORMAL, "zAt_EncCcZEcallInd: ATI Recv zeCallInd");

+

+    zAti_GetAtECallType(&pZEcallInd->beCallType);

+

+    pStrWalk += sprintf((char *)pStrWalk, "%s+ZECALL: %d,1,%d", g_zAt_CRLF, pZEcallInd->beCallType, pZEcallInd->bMsdLen);

+

+    if(pZEcallInd->bMsdLen > MSD_MAX_LENGTH)

+    {

+        pZEcallInd->bMsdLen = MSD_MAX_LENGTH;

+    }

+

+    pStrWalk += sprintf((char *)pStrWalk, ",\"");

+    for(i = 0; i < pZEcallInd->bMsdLen; i++)

+    {

+        pStrWalk += sprintf((char *)pStrWalk, "%02X", pZEcallInd->abMSD[i]);

+    }

+

+    sprintf((char *)pStrWalk, "\"%s", g_zAt_CRLF);

+

+    return (UINT16)strlen((const char *)pEncCmdInfo->pStrCmd);

+}

+#endif

 /**************************************************************************

 * º¯ÊýÃû³Æ£º zAt_PsEncCcCringInd

 * ¹¦ÄÜÃèÊö£º ¸ù¾ÝZ_APMMIA_CringInd_EvÏûÏ¢¼°¶ÔÓ¦µÄ½á¹¹Ìå,±àÂëµÃ¶ÔÓ¦µÄATÃüÁî

@@ -22527,6 +22909,139 @@
     return g_zAti_atDataEx[Z_ATI_INSNO_1].bZcwaFg;

 }

 #endif

+

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecBeepNumSetReq(T_ZAt_DecCmdInfo *pDecCmdInfo)

+{

+    CHAR* pDecCmdStr = pDecCmdInfo->strParam;   /* ¼Ç¼²ÎÊý×ֶεÄÓÎ×ßÖ¸Õë */

+    CHAR strSubBuf[ZAT2_SUB_PARAM_MAX_LEN] = {0};    /* ´æ·Å½ØÈ¡µÄ²ÎÊý×Ö·û´® */

+    T_ZAt_ParseCmd2MsgRslt   prsCmd2Msg = {0};

+    T_zAti_NV_BeepCallNum tBeepCall = {0};

+    T_zAti_NV_BeepCallNum tTempBeepCall = {0};

+    BYTE bMode = 0;

+    BYTE abCallNum[Z_DEV_MAX_BEEPCALL_NUM + 1] = {0};

+    CHAR strNum[Z_DEV_MAX_BEEPCALL_NUM * 2 + 1] = {0};

+    WORD strNumLen = 0;

+    BOOL bPlusFlag = FALSE;

+    WORD wNumLen = 0;

+    SINT16 iDecBcdRet = -1;

+    BYTE i = 0, j = 0;

+    BYTE bCheckedNum = 0;

+    BYTE bMinNumLen = 0;

+    BYTE bDevNum = 0;

+    BYTE bIsExtist = Z_INVALID;

+

+    /*+ZBEEPNUM=<mode>,<num>*/

+    if(!zAt_PsDecNextParamDecimalNumBoolNeed(&prsCmd2Msg, strSubBuf, &pDecCmdStr, &bMode, NULL))

+    {

+        return prsCmd2Msg;

+    }

+

+    wNumLen = strlen((const char *)pDecCmdStr);

+

+    if(wNumLen > Z_DEV_MAX_BEEPCALL_NUM*2 || wNumLen == 0)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    for (strNumLen = 0; strNumLen < wNumLen; strNumLen++, pDecCmdStr++)

+    {

+        strNum[strNumLen] = ZAT2_UPCASE(*pDecCmdStr);

+    }

+

+    iDecBcdRet = zAt_DecCallNum2Bcd(abCallNum, &bPlusFlag, strNum, strNumLen, Z_DEV_MAX_BEEPCALL_NUM);

+    if (iDecBcdRet == -1 || iDecBcdRet == 0)

+    {

+        return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+    }

+

+    zDev_NV_AtiReadItem(Z_ATI_NV_BeepCall, (PBYTE)&tBeepCall);

+    zOss_Memcpy(&tTempBeepCall, &tBeepCall, sizeof(T_zAti_NV_BeepCallNum));

+

+    bCheckedNum = sizeof(abCallNum);

+

+    for(i = 0; i < tBeepCall.bCallNum && i < Z_DEV_MAX_BEEPCALL_GROUP; i++)

+    {

+        bDevNum = sizeof(tBeepCall.atCallGroup[i].abCallNum);

+        bMinNumLen = (bDevNum < bCheckedNum)? bDevNum : bCheckedNum;

+

+        if((tBeepCall.atCallGroup[i].bNumLen == iDecBcdRet) && (iDecBcdRet <= bMinNumLen)

+         && (0 == memcmp(tBeepCall.atCallGroup[i].abCallNum, abCallNum, iDecBcdRet)))

+        {

+            bIsExtist = Z_VALID;

+            break;

+        }

+    }

+

+    if(bMode == 0)//ɾ³ý

+    {

+        if(bIsExtist == Z_VALID)

+        {

+            zOss_Memset(&tBeepCall.atCallGroup[i], 0, sizeof(T_zAti_NV_BeepNumInfo));

+

+            for(j = i; j < (tBeepCall.bCallNum - 1) && j < (Z_DEV_MAX_BEEPCALL_GROUP - 1); j++)

+            {

+                tBeepCall.atCallGroup[j] = tBeepCall.atCallGroup[j + 1];

+            }

+            zOss_Memset(&tBeepCall.atCallGroup[j], 0, sizeof(T_zAti_NV_BeepNumInfo));

+            tBeepCall.bCallNum -= 1;

+        }

+        else

+        {

+            return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_CMD_PARAM_ERR);

+        }

+    }

+    else //Ôö¼Ó

+    {

+        if(tBeepCall.bCallNum >= Z_DEV_MAX_BEEPCALL_GROUP)

+        {

+            return zAt_GetParseRslt2(&prsCmd2Msg,ZAT2_OPTNOTALW_ERR);

+        }

+        else

+        {

+            if(bIsExtist == Z_INVALID)

+            {

+                zOss_Memcpy(tBeepCall.atCallGroup[tBeepCall.bCallNum].abCallNum, abCallNum, Z_DEV_MAX_BEEPCALL_NUM);

+                tBeepCall.atCallGroup[tBeepCall.bCallNum].bNumLen = (BYTE)iDecBcdRet;

+                tBeepCall.bCallNum += 1;

+            }

+        }

+    }

+

+    if(0 != memcmp(&tTempBeepCall, &tBeepCall, sizeof(T_zAti_NV_BeepCallNum)))

+    {

+        zDev_NV_AtiWriteItem(Z_ATI_NV_BeepCall, (PBYTE)&tBeepCall);

+    }

+

+    zOss_Memcpy(g_zAt_EncBuf, g_zAt_OK, strlen((const char *)g_zAt_OK));

+    return zAt_GetParseRslt(ZAT2_CMD_REPLY_DIRECT);

+}

+

+T_ZAt_ParseCmd2MsgRslt zAt_PsDecBeepNumQryReq(T_ZAt_DecCmdInfo *pDecCmdInfo)

+{

+    BYTE i = 0;

+    CHAR * pStrWalk = g_zAt_EncBuf;

+    T_zAti_NV_BeepCallNum tBeepCall = {0};

+

+    zDev_NV_AtiReadItem(Z_ATI_NV_BeepCall, (PBYTE)&tBeepCall);

+

+    for(i = 0; i < tBeepCall.bCallNum && i < Z_DEV_MAX_BEEPCALL_GROUP; i++)

+    {

+        pStrWalk += sprintf((char *)pStrWalk, "%s+ZBEEPNUM: %d,", g_zAt_CRLF, i+1);

+

+        zAt_EncBcd2NumStrByCscsType(pStrWalk, (UINT8 *)tBeepCall.atCallGroup[i].abCallNum, 

+                tBeepCall.atCallGroup[i].bNumLen, ZAT2_CSCS_GSM);

+            pStrWalk += strlen((const char *)pStrWalk);

+    }

+

+    if(i > 0)

+    {

+        pStrWalk += sprintf((char *)pStrWalk, "%s", g_zAt_CRLF);

+    }

+

+    sprintf((char *)pStrWalk, "%s", g_zAt_OK);

+

+    return zAt_GetParseRslt(ZAT2_CMD_REPLY_DIRECT);

+}

 /**************************************************************************

 * º¯ÊýÃû³Æ£º zAt_PsDecZEpdcptmrlenReq

 * ¹¦ÄÜÃèÊö£º ¸ù¾ÝµÚ1²½½âÎö½á¹û£¬½âÎö+ZEPDCPTMRLENÉèÖÃÇëÇ󣬲¢Ö±½ÓÌîдÉèÖýá¹û

diff --git a/cp/ps/modem/ps/src/nas/ati/src/zat_var.c b/cp/ps/modem/ps/src/nas/ati/src/zat_var.c
index 62d5059..b3ee326 100755
--- a/cp/ps/modem/ps/src/nas/ati/src/zat_var.c
+++ b/cp/ps/modem/ps/src/nas/ati/src/zat_var.c
@@ -141,9 +141,11 @@
     {   "+ZCOPS",       ZAT2_MM_ZCOPS,          ""                                  },

     {   "+ZSCAN",       ZAT2_MM_ZSCAN,          ""                                  },

     {   "+ZSCISCAN",       ZAT2_MM_ZSCISCAN,          ""                                  },

-#ifdef USE_VOICE_SUPPORT

-    {   "^ZCSVOICESPT",       ZAT2_MM_ZCSVOICESPT,       ""      },

+#ifdef ECALL_SUPPORT

+    {   "+ZNECALL",         ZAT2_MM_ZNECALL,         ""                             },

+    {   "+ZECALLONLY",      ZAT2_MM_ZECALLONLY,      ""                             },

 #endif

+    {   "^ZCSVOICESPT",     ZAT2_MM_ZCSVOICESPT,       ""                           },

     {   "+ZRMNETSH",     ZAT2_MM_ZRMNETSH,    "+ZRMNETSH: (0-2)"    },

     /********************************* CCÄ£¿é ************************************/

     {   "+CEER",       ZAT2_CC_CEER,          "+CEER: (0,1)"                                  },

@@ -151,6 +153,7 @@
     {   "+CR",         ZAT2_CC_CR,            "+CR: (0,1)"                        },

     {   "+CRC",        ZAT2_CC_CRC,           "+CRC: (0,1)"                       },

     {   "+CVMOD",      ZAT2_CC_CVMOD,         "+CVMOD: (0-3)"                     },

+    {   "+ZBEEPNUM",     ZAT2_CC_ZBEEPNUM,       ""                               },

 #if defined (USE_VOICE_SUPPORT)

     {   "A",           ZAT2_CC_A,             ""                                  },

     {   "+ZREDIAL",    ZAT2_CC_ZREDIAL,       ""                                  },  // for VoLTE

@@ -171,9 +174,17 @@
     {   "+VTD",        ZAT2_CC_VTD,           ""                                  },

     {   "+FCLASS",     ZAT2_CC_FCLASS,        "+FCLASS: (0,1,1.0,2,2.0,8,80)"     },

     {   "+ZCLS",       ZAT2_CC_ZCLS,          ""                                  },

-    {   "+ZCCSTATE",       ZAT2_CC_ZCCSTATE,         ""},

+    {   "+ZCCSTATE",       ZAT2_CC_ZCCSTATE,         ""          },

+#ifdef ECALL_SUPPORT

+    {   "+CECALL",     ZAT2_CC_CECALL,     "+CECALL: (0-3),(1)"    },

+    {   "+ZECALL",     ZAT2_CC_ZECALL,     ""                    },

 #endif

-

+#endif

+#ifdef ECALL_SUPPORT

+    {   "+CECN",       ZAT2_CC_CECN,       "+CECN: (0,1)"         },

+    {   "+ZNECALLNUM",    ZAT2_CC_ZNECALLNUM,        ""          },

+    {   "+ZECALLCAPA",    ZAT2_CC_ZECALLCAPA,      "+ZECALLCAPA: (0-2)"        },

+#endif

     /********************************* SMSÄ£¿é ***********************************/

     {   "+CGSMS",      ZAT2_SMS_CGSMS,        "+CGSMS: (0-3)"                     },

     {   "+CMGC",       ZAT2_SMS_CMGC,         ""                                  },

@@ -776,10 +787,17 @@
 

     /******************************************* ^SYSINFO  *****************************************/

     { ZAT2_MM_SYSINFO, ZAT2_CO_ACTION_REQ, AP_MMIA_SYSINFO_REQ_EV,    zAt_PsDecCommonReq       },

-#ifdef USE_VOICE_SUPPORT

+

     /*******************************************^ZCSVOICESPT*********************************/

     { ZAT2_MM_ZCSVOICESPT, ZAT2_CO_ACTION_REQ, MMIA_UMM_CSVOICE_QUERY_REQ_EV, zAt_PsDecCommonReq },

+#ifdef ECALL_SUPPORT

+    /*******************************************+ZNECALL******************************************/

+    { ZAT2_MM_ZNECALL,   ZAT2_CO_QUERY_REQ,   MMIA_UMM_ECALLSPT_QUERY_REQ_EV,   zAt_PsDecCommonReq},

+

+    /*******************************************+ZECALLONLY***********************************/

+    { ZAT2_MM_ZECALLONLY,   ZAT2_CO_QUERY_REQ,   MMIA_UMM_ECALLONLY_QUERY_REQ_EV,   zAt_PsDecCommonReq},

 #endif

+

     /******************************************* ^SPN  *********************************************/

     { ZAT2_MM_SPN,    ZAT2_CO_SET_REQ,    AP_UICC_READ_REQ_EV,   zAt_PsDecMmSpnSetReq  },

 

@@ -861,7 +879,11 @@
     /******************************************** D ************************************************/

     { ZAT2_CC_D,       ZAT2_CO_SET_REQ,    AP_MMIA_CC_SETUP_REQ_EV,   zAt_PsDecCcSetupReq      },

     { ZAT2_CC_D,       ZAT2_CO_ACTION_REQ, MMIA_CC_MODIFY_REQ_EV,      zAt_PsDecModifyReq       },

-

+#ifdef ECALL_SUPPORT

+    /*****************************************+CECALL*********************************/

+    { ZAT2_CC_CECALL,       ZAT2_CO_SET_REQ,      MMIA_CC_MOC_REQ_EV,      zAt_PsDecCecallReq      },

+    { ZAT2_CC_ZECALL,       ZAT2_CO_SET_REQ,      MMIA_CC_MOC_REQ_EV,      zAt_PsDecCecallReq      },

+#endif

     /***************+ZREDIAL ÓàÖ¾ÃúÈ·ÈÏÕâ¸öÃüÁîÇëÇóûÓÐÏìÓ¦½á¹û**********/

     { ZAT2_CC_ZREDIAL,       ZAT2_CO_SET_REQ,    AP_MMIA_CC_SETUP_REQ_EV,   zAt_PsDecZredialReq      },  // for VoLTE

 

@@ -877,6 +899,18 @@
     { ZAT2_CC_CCUG,    ZAT2_CO_SET_REQ,    AP_MMIA_CC_CCUG_SET_REQ_EV,         zAt_PsDecCcCcugReq    },

     { ZAT2_CC_CCUG,    ZAT2_CO_QUERY_REQ,  AP_MMIA_CC_CCUG_QUERY_REQ_EV,   zAt_PsDecCommonReq      },

 #endif

+#ifdef ECALL_SUPPORT

+    /**************************************+ZNECALLNUM************************************/

+    { ZAT2_CC_ZNECALLNUM,    ZAT2_CO_QUERY_REQ,    0,    zAt_PsDecZnecallnumReq     },

+

+    /**************************************+CECN**********************************/

+    {ZAT2_CC_CECN,  ZAT2_CO_SET_REQ,    0,   zAt_PsDecCecnSetReq    },

+    {ZAT2_CC_CECN,  ZAT2_CO_QUERY_REQ,    0,   zAt_PsDecCecnQryReq    },

+

+    /***************************************+ZECALLCAPA**********************************/

+    { ZAT2_CC_ZECALLCAPA,   ZAT2_CO_SET_REQ,    0,    zAt_PsDecEcallCapaSetReq    },

+    { ZAT2_CC_ZECALLCAPA,   ZAT2_CO_QUERY_REQ,    0,    zAt_PsDecEcallCapaQryReq    },

+#endif

     /******************************************* +CEER *********************************************/

     { ZAT2_CC_CEER,    ZAT2_CO_SET_REQ,                          0,                                 zAt_PsDecCeerSetReq      },

     { ZAT2_CC_CEER,    ZAT2_CO_QUERY_REQ,                          0,                                 zAt_PsDecCeerQryReq      },

@@ -942,8 +976,11 @@
 

     /*******************************************+ZCWA******************************************/

     { ZAT2_CC_ZCWA,    ZAT2_CO_SET_REQ,    0,   zAt_PsDecZcwaSetReq    },

-    {ZAT2_CC_ZCWA,    ZAT2_CO_QUERY_REQ,    0,          zAt_PsDecZcwaQryReq},

+    { ZAT2_CC_ZCWA,    ZAT2_CO_QUERY_REQ,    0,          zAt_PsDecZcwaQryReq},

 #endif

+    /************************************+ZBEEPNUM************************************/

+    { ZAT2_CC_ZBEEPNUM,    ZAT2_CO_SET_REQ,    0,    zAt_PsDecBeepNumSetReq   },

+    { ZAT2_CC_ZBEEPNUM,    ZAT2_CO_QUERY_REQ,    0,    zAt_PsDecBeepNumQryReq   },

     /***********************************************************************************************

     SMSÄ£¿é

     ************************************************************************************************/    

@@ -1839,9 +1876,15 @@
     

     /********************************* ^SYSCONFIG *********************************/

     {  MMIA_UMM_SYSCONFIG_QUERY_CNF_EV,zAt_PsEncMmSysconfigQueryCnf, ZAT2_CO_CNF  },

-#ifdef USE_VOICE_SUPPORT

+

     /*********************************^ZCSVOICESPT********************************/

     {  MMIA_UMM_CSVOICE_QUERY_CNF_EV, zAt_PsEncMmCsVoiceSptQryCnf, ZAT2_CO_CNF},

+#ifdef ECALL_SUPPORT

+    /*********************************+ZNECALL*******************************/

+    { MMIA_UMM_ECALLSPT_QUERY_CNF_EV,    zAt_PsEncZnecallQryCnf,    ZAT2_CO_CNF   },

+

+    /*********************************+ZECALLONLY****************************/

+    { MMIA_UMM_ECALLONLY_QUERY_CNF_EV,    zAt_PsEncZecallonlyQryCnf,    ZAT2_CO_CNF   },

 #endif

     /********************************** +ZATT *************************************/

     {   MMIA_UMM_ZATT_QUERY_CNF_EV,   zAt_PsEncMmZattQueryCnf,   ZAT2_CO_CNF},

@@ -1954,6 +1997,13 @@
 

     /************************************* +VTS**************************************/

     {MMIA_CC_DTMF_CNF_EV,      zAt_PsEncCcDtmfSetCnf,         ZAT2_CO_CNF   },

+#ifdef ECALL_SUPPORT

+    /*************************************+CECN**********************************/

+    {MMIA_CC_CECN_IND_EV,     zAt_EncCcCecnInd,      ZAT2_CO_IND    },

+

+    /*************************************+ZECALL*************************/

+    {MMIA_CC_ZECALL_IND_EV,    zAt_EncCcZEcallInd,     ZAT2_CO_IND    },

+#endif

 #endif

     /*****************************************************************

     SMSÄ£¿é

diff --git a/cp/ps/modem/ps/src/nas/ati/src/zati_com.c b/cp/ps/modem/ps/src/nas/ati/src/zati_com.c
index 422dc53..075fb4f 100755
--- a/cp/ps/modem/ps/src/nas/ati/src/zati_com.c
+++ b/cp/ps/modem/ps/src/nas/ati/src/zati_com.c
@@ -441,6 +441,12 @@
         case Z_UiccId_ICCID_BIN:

         case Z_UiccId_OPL_REC:

         case Z_UiccId_PNN_REC:

+#ifdef ECALL_SUPPORT

+        case Z_UiccId_FDN_REC:

+        case Z_UiccId_SDN_REC:

+        case Z_UiccId_FDNURI_REC:

+        case Z_UiccId_SDNURI_REC:

+#endif

             dwCmdRlt = zDev_ReadItem_NoBackup(bKeyId, bStartRec, bEndRec, (PBYTE)pValBuf, g_zAti_CurInstance);

             break;

 

@@ -1030,6 +1036,10 @@
     case AP_MMIA_CEND_IND_EV:

     case MMIA_CC_CALL_STATE_IND_EV:

     case AP_MMIA_REDIALEND_IND_EV:

+#ifdef ECALL_SUPPORT

+    case MMIA_CC_CECN_IND_EV:

+    case MMIA_CC_ZECALL_IND_EV:

+#endif

     /* PDP ²¿·Ö  */

     case MMIA_SM_PDP_ACTIVATE_IND_EV:

     case MMIA_ESM_MT_EPS_BEARER_ACT_IND_EV:

@@ -2636,3 +2646,322 @@
     return Z_INVALID;

 }

 

+#ifdef ECALL_SUPPORT

+BYTE zAt_GetEcallSupStat(PBYTE pbEcallType,  PBYTE pbIsNum, PBYTE pbIsUri)

+{

+    DWORD dwRet = 0;

+    T_z_UICC_UstSst *ptUst = NULL;

+    T_z_UICC_Est  *ptEst = NULL;

+

+    if(pbEcallType == NULL || pbIsNum == NULL || pbIsUri == NULL)

+    {

+        return Z_FAIL;

+    }

+

+    ptUst = (T_z_UICC_UstSst*)zAti_GetUB(sizeof(T_z_UICC_UstSst));

+

+    dwRet = zAti_ReadItem(Z_UiccId_USTSST, 1, 1, (VOID *)ptUst);

+

+    if(dwRet != Z_APUICC_CMD_OK || ptUst->bFlag != 1)

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+        zAti_RetUB((VOID**)&ptUst);

+        return Z_FAIL;

+    }

+

+    ptEst = (T_z_UICC_Est*)zAti_GetUB(sizeof(T_z_UICC_Est));

+

+    dwRet = zAti_ReadItem(Z_UiccId_EST_BIN, 1, 1, (VOID*)ptEst);

+

+    if(dwRet != Z_APUICC_CMD_OK)

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+        zAti_RetUB((VOID**)&ptUst);

+        zAti_RetUB((VOID**)&ptEst);

+        return Z_FAIL;

+    }

+    //Service n¡ã89 is "available" and FDN is enabled

+    if(ptUst->val.tUst.bECallDataFg == 1 && ptUst->val.tUst.bFdnFg == 1 && ptEst->bFdn == 1)

+    {

+        (*pbEcallType) = Z_ATI_ECALL_ONLY;

+        (*pbIsNum) = Z_ATI_ECALL_NUM_SUP;

+    }

+    //Service n¡ã112 and Service n¡ã 99 are "available" and FDN is enabled

+    if(ptUst->val.tUst.bECallDataOverImsFg == 1 && ptUst->val.tUst.bUriSupByUiccFg == 1 && ptUst->val.tUst.bFdnFg == 1 && ptEst->bFdn == 1)

+    {

+        (*pbEcallType) = Z_ATI_ECALL_ONLY;

+        (*pbIsUri) = Z_ATI_ECALL_URI_SUP;

+    }

+    //Service n¡ã89 and Service n¡ã4 are "available" and FDN is disabled

+    if(ptUst->val.tUst.bECallDataFg == 1 && ptUst->val.tUst.bSdnFg == 1 && (ptUst->val.tUst.bFdnFg == 0 || ptEst->bFdn == 0))

+    {

+        (*pbEcallType) = Z_ATI_ECALL_NORMCALL;

+        (*pbIsNum) = Z_ATI_ECALL_NUM_SUP;

+    }

+    //Service n¡ã 112 and Service n¡ã99 and Service n¡ã4 are "available" and FDN is disabled

+    if(ptUst->val.tUst.bECallDataOverImsFg == 1 && ptUst->val.tUst.bUriSupByUiccFg == 1 && ptUst->val.tUst.bSdnFg == 1 && 

+        (ptUst->val.tUst.bFdnFg == 0 || ptEst->bFdn == 0))

+    {

+        (*pbEcallType) = Z_ATI_ECALL_NORMCALL;

+        (*pbIsUri) = Z_ATI_ECALL_URI_SUP;

+    }

+

+    zAti_RetUB((VOID**)&ptUst);

+    zAti_RetUB((VOID**)&ptEst);

+    return Z_SUCC;

+}

+

+VOID zAt_GetFdnEcallNum(T_z_CallNum* ptTestNum, T_z_CallNum* ptReCfgNum, BYTE bInsNo)

+{

+    BYTE i = 0;

+    BYTE bRecNum = 0;

+    T_z_UICC_Fdn *ptFdn = NULL;

+    bRecNum = zDev_GetRecNum(Z_UiccId_FDN_REC, bInsNo);

+

+    if(bRecNum < 2)

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+        return;

+    }

+

+    ptFdn = (T_z_UICC_Fdn*)zAti_GetUB(sizeof(T_z_UICC_Fdn));

+

+    if (Z_APUICC_CMD_OK == zAti_ReadItem(Z_UiccId_FDN_REC, 1, 1, (VOID *)ptFdn))

+    {

+        zOss_Memset(ptTestNum->abNum, 0xff, ZPS_MaxCallNum_Len);

+        zAti_UpdateDialNum(ptFdn->abDialNumSsc, &ptFdn->bBcdSscLen);

+        ptTestNum->bNumLen = ptFdn->bBcdSscLen;

+        ptTestNum->bNumType = ptFdn->bTonNpi;

+        if(ptTestNum->bNumLen > 0)

+        {

+            zOss_Memcpy(ptTestNum->abNum, ptFdn->abDialNumSsc, ptTestNum->bNumLen);

+        }

+    }

+    else

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+    }

+

+    zOss_Memset(ptFdn, 0, sizeof(T_z_UICC_Fdn));

+    if (Z_APUICC_CMD_OK == zAti_ReadItem(Z_UiccId_FDN_REC, 2, 2, (VOID *)ptFdn))

+    {

+        zOss_Memset(ptReCfgNum->abNum, 0xff, ZPS_MaxCallNum_Len);

+        zAti_UpdateDialNum(ptFdn->abDialNumSsc, &ptFdn->bBcdSscLen);

+        ptReCfgNum->bNumLen = ptFdn->bBcdSscLen;

+        ptReCfgNum->bNumType = ptFdn->bTonNpi;

+        if(ptReCfgNum->bNumLen > 0)

+        {

+            zOss_Memcpy(ptReCfgNum->abNum, ptFdn->abDialNumSsc, ptReCfgNum->bNumLen);

+        }

+    }

+    else

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+    }

+

+    zAti_RetUB((VOID**)&ptFdn);

+

+    return;

+}

+

+VOID zAt_GetFdnEcallUri(T_z_UICC_FdnUri* ptTestUri, T_z_UICC_FdnUri* ptRecfgUri, BYTE bInsNo)

+{

+    BYTE bRecNum = 0;

+

+    bRecNum = zDev_GetRecNum(Z_UiccId_FDNURI_REC, bInsNo);

+

+    if(bRecNum < 2)

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+        return;

+    }

+

+    if(Z_APUICC_CMD_OK != zAti_ReadItem(Z_UiccId_FDNURI_REC, 1, 1, (VOID *)ptTestUri))

+    {

+        ptTestUri->bUriAddrLen = 0;

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+    }

+

+    if(Z_APUICC_CMD_OK != zAti_ReadItem(Z_UiccId_FDNURI_REC, 2, 2, (VOID *)ptRecfgUri))

+    {

+        ptRecfgUri->bUriAddrLen = 0;

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+    }

+}

+

+VOID zAt_GetSdnEcallNum(T_z_CallNum* ptTestNum, T_z_CallNum* ptReCfgNum, BYTE bInsNo)

+{

+    BYTE i = 0;

+    BYTE bRecNum = 0;

+    T_z_UICC_Sdn *ptSdn = NULL;

+    bRecNum = zDev_GetRecNum(Z_UiccId_SDN_REC, bInsNo);

+

+    if(bRecNum < 2)

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+        return;

+    }

+

+    ptSdn = (T_z_UICC_Sdn*)zAti_GetUB(sizeof(T_z_UICC_Sdn));

+

+    if (Z_APUICC_CMD_OK == zAti_ReadItem(Z_UiccId_SDN_REC, bRecNum -1, bRecNum - 1, (VOID *)ptSdn))

+    {

+        zOss_Memset(ptTestNum->abNum, 0xff, ZPS_MaxCallNum_Len);

+        zAti_UpdateDialNum(ptSdn->abDialNumSsc, &ptSdn->bBcdSscLen);

+        ptTestNum->bNumLen = ptSdn->bBcdSscLen;

+        ptTestNum->bNumType = ptSdn->bTonNpi;

+        if(ptTestNum->bNumLen > 0)

+        {

+            zOss_Memcpy(ptTestNum->abNum, ptSdn->abDialNumSsc, ptTestNum->bNumLen);

+        }

+    }

+    else

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+    }

+

+    zOss_Memset(ptSdn, 0, sizeof(T_z_UICC_Sdn));

+    if (Z_APUICC_CMD_OK == zAti_ReadItem(Z_UiccId_SDN_REC, bRecNum, bRecNum, (VOID *)ptSdn))

+    {

+        zOss_Memset(ptReCfgNum->abNum, 0xff, ZPS_MaxCallNum_Len);

+        zAti_UpdateDialNum(ptSdn->abDialNumSsc, &ptSdn->bBcdSscLen);

+        ptReCfgNum->bNumLen = ptSdn->bBcdSscLen;

+        ptReCfgNum->bNumType = ptSdn->bTonNpi;

+        if(ptReCfgNum->bNumLen > 0)

+        {

+            zOss_Memcpy(ptReCfgNum->abNum, ptSdn->abDialNumSsc, ptReCfgNum->bNumLen);

+        }

+    }

+    else

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+    }

+

+    zAti_RetUB((VOID**)&ptSdn);

+

+    return;

+}

+

+VOID zAt_GetSdnEcallUri(T_z_UICC_SdnUri* ptTestUri, T_z_UICC_SdnUri* ptRecfgUri, BYTE bInsNo)

+{

+    BYTE bRecNum = 0;

+

+    bRecNum = zDev_GetRecNum(Z_UiccId_SDNURI_REC, bInsNo);

+

+    if(bRecNum < 2)

+    {

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+        return;

+    }

+

+    if(Z_APUICC_CMD_OK != zAti_ReadItem(Z_UiccId_SDNURI_REC, bRecNum - 1, bRecNum - 1, (VOID *)ptTestUri))

+    {

+        ptTestUri->bUriAddrLen = 0;

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+    }

+

+    if(Z_APUICC_CMD_OK != zAti_ReadItem(Z_UiccId_SDNURI_REC, bRecNum, bRecNum, (VOID *)ptRecfgUri))

+    {

+        ptRecfgUri->bUriAddrLen = 0;

+        zAti_SendExpt2TraceAgt(ERR_InvalidMsg,  TRACE_ERR_LEVEL_NORMAL,"");

+    }

+}

+

+VOID zAti_UpdateDialNum(PBYTE abNum, PBYTE pbcdSscLen)

+{

+    BYTE i = 0;

+    BYTE bBcdNum = 0;

+

+    if ((*pbcdSscLen) <= 1)

+    {

+        (*pbcdSscLen) = 0;

+    }

+    else if ((*pbcdSscLen) > 11)

+    {

+        if ((*pbcdSscLen) == 0xff)  /* ¿¨ÉϺÅÂë¶ÎÈ«Fʱ£¬×ªÎªºÅÂ볤¶ÈΪ0 */

+        {

+            (*pbcdSscLen) = 0;

+        }

+        else

+        {

+            (*pbcdSscLen) = 10;

+        } 

+    }

+    else

+    {

+        (*pbcdSscLen) -= 1;

+    }

+

+    for(i = 0; i < (*pbcdSscLen); i++)

+    {

+        if((abNum[i] & 0x0f) != 0xf)

+        {

+            bBcdNum++;

+        }

+        else

+        {

+            break;

+        }

+

+        if(((abNum[i] >> 4) & 0x0f) != 0xf)

+        {

+            bBcdNum++;

+        }

+        else

+        {

+            break;

+        }

+    }

+

+    (*pbcdSscLen) = (bBcdNum/2) + (bBcdNum%2);

+

+    return;

+}

+

+VOID zAti_GetCcECallType(BYTE *pbAtECallType)

+{

+    switch(*pbAtECallType)

+    {

+        case Z_ATI_TEST_ECALL:

+            (*pbAtECallType) = Z_MMIACC_ECALL_TESTCALL;

+            break;

+        case Z_ATI_RECFG_ECALL:

+            (*pbAtECallType) = Z_MMIACC_ECALL_RECONFIGCALL;

+            break;

+        case Z_ATI_MANUINIT_ECALL:

+            (*pbAtECallType) = Z_MMIACC_ECALL_MANU;

+            break;

+        case Z_ATI_AUTOINIT_ECALL:

+            (*pbAtECallType) = Z_MMIACC_ECALL_AUTO;

+            break;

+        default:

+            break;

+    }

+

+    return;

+}

+

+VOID zAti_GetAtECallType(BYTE *pbCcECallType)

+{

+    switch(*pbCcECallType)

+    {

+        case Z_MMIACC_ECALL_TESTCALL:

+            (*pbCcECallType) = Z_ATI_TEST_ECALL;

+            break;

+        case Z_MMIACC_ECALL_RECONFIGCALL:

+            (*pbCcECallType) = Z_ATI_RECFG_ECALL;

+            break;

+        case Z_MMIACC_ECALL_MANU:

+            (*pbCcECallType) = Z_ATI_MANUINIT_ECALL;

+            break;

+        case Z_MMIACC_ECALL_AUTO:

+            (*pbCcECallType) = Z_ATI_AUTOINIT_ECALL;

+            break;

+        default:

+            break;

+    }

+

+    return;

+}

+#endif

+

diff --git a/cp/ps/modem/ps/src/nas/ati/src/zati_fnc.c b/cp/ps/modem/ps/src/nas/ati/src/zati_fnc.c
index 8fc095d..cb9adba 100755
--- a/cp/ps/modem/ps/src/nas/ati/src/zati_fnc.c
+++ b/cp/ps/modem/ps/src/nas/ati/src/zati_fnc.c
@@ -133,7 +133,7 @@
     {MMIA_CC_CSTA_QUERY_REQ_EV,                Z_ATI_TASKID_CC  },

     {MMIA_CC_DTMF_REQ_EV,              Z_ATI_TASKID_CC  },

     {MMIA_CC_MTC_RSP_EV,                Z_ATI_TASKID_CC  },

-    //{MMIA_CC_CSTA_SET_REQ_EV,           Z_ATI_TASKID_CC},

+    {MMIA_CC_MOC_REQ_EV,           Z_ATI_TASKID_CC},

     //{MMIA_CC_CSTA_QUERY_REQ_EV,         Z_ATI_TASKID_CC},

     {MMIA_CC_STATE_REQ_EV,        Z_ATI_TASKID_CC},

     {MMIA_CC_OPEN_VOICECHNL_REQ_EV,     Z_ATI_TASKID_CC},

@@ -209,8 +209,10 @@
     {MMIA_UMM_CS_SRV_CNF_EV, Z_ATI_TASKID_UMM },

     {MMIA_UMM_IMS_REGISTER_STATES_EV, Z_ATI_TASKID_UMM},

     {MMIA_UMM_XCELLINFO_REQ_EV, Z_ATI_TASKID_UMM},

-#ifdef USE_VOICE_SUPPORT

     {MMIA_UMM_CSVOICE_QUERY_REQ_EV, Z_ATI_TASKID_UMM},

+#ifdef ECALL_SUPPORT

+    {MMIA_UMM_ECALLSPT_QUERY_REQ_EV, Z_ATI_TASKID_UMM},

+    {MMIA_UMM_ECALLONLY_QUERY_REQ_EV, Z_ATI_TASKID_UMM},

 #endif

 

     /************************SS Massage************************/

@@ -2919,6 +2921,7 @@
             || dwMsgId == MMIA_CC_OPEN_VOICECHNL_REQ_EV

             || dwMsgId == MMIA_CC_SRVCC_NOTOPEN_VOICECHNL_REQ_EV

             || dwMsgId == MMIA_AS_EM_LTE_HO_SET_REQ_EV

+            || dwMsgId == MMIA_CC_MOC_REQ_EV

        /************** LTE GoTaÄ£¿é Ï·¢³É¹¦ºó£¬Ö±½Ó»Ø¸´OK*********************/

         ||zAti_IsGotaReplyOK(dwMsgId))

         {

diff --git a/cp/ps/plat/src/oss/osa/linux/src/linux_kernel.c b/cp/ps/plat/src/oss/osa/linux/src/linux_kernel.c
index 094112b..7d5728b 100755
--- a/cp/ps/plat/src/oss/osa/linux/src/linux_kernel.c
+++ b/cp/ps/plat/src/oss/osa/linux/src/linux_kernel.c
@@ -1281,6 +1281,54 @@
     return (ZOSS_THREAD_ID)thread;

 }

 

+ZOSS_THREAD_ID zOss_CreateNormalThread(

+                    const CHAR *thread_name,    /* name                 */

+                    VOID (*entry)(SINT32),      /* entry                */

+                    SINT32 arg,                 /* arguments pointer    */

+                    UINT32 stack_size,          /* stack size           */

+                    SINT32 priority,            /* priority             */

+                    UINT32 preempt,             /* useless              */

+                    UINT32 auto_start)          /* auto start           */

+{

+    int ret;

+    struct task_struct *task;

+    struct sched_param param;

+    linux_thread_t *thread;

+    linux_create_thread_t *create_thread;

+

+    create_thread = (linux_create_thread_t *)kmalloc(sizeof(linux_create_thread_t), GFP_ATOMIC);

+    zOss_AssertEx(create_thread != NULL, NULL);

+

+    thread = linux_thread_alloc();

+    if (thread == NULL) {

+        kfree((void *)create_thread);

+        zOss_ASSERT(0);

+        return NULL;

+    }

+    strncpy(thread->user_area.threadname, thread_name, MAX_THREADNAME_LEN);

+

+    create_thread->entry   = entry;

+    create_thread->arg     = arg;

+    create_thread->thread  = thread;

+

+#ifdef CONFIG_STACK_SIZE

+    if(stack_size >= 8192)

+        create_thread =(void *)((unsigned long)create_thread + 1);

+      	

+#endif

+    task = kthread_create(linux_thread_entry,(void *)create_thread, thread_name);

+

+    task->zoss_thread = thread;

+    thread->task = task;

+

+    if (priority != 0)

+        set_user_nice(task, priority);

+    if (auto_start)

+        wake_up_process(task);

+

+    return (ZOSS_THREAD_ID)thread;

+}

+

 /*******************************************************************************

 * ¹¦ÄÜÃèÊö:     ²Ù×÷ϵͳÊÊÅä²ãµÄÏß³ÌÍ˳öº¯Êý

 * ²ÎÊý˵Ã÷:     

diff --git a/cp/ps/project/zx297520v3/config/ps/ps_cfg.mk b/cp/ps/project/zx297520v3/config/ps/ps_cfg.mk
index 47d363e..134b508 100755
--- a/cp/ps/project/zx297520v3/config/ps/ps_cfg.mk
+++ b/cp/ps/project/zx297520v3/config/ps/ps_cfg.mk
@@ -378,4 +378,6 @@
 DEFINE += -D_R2_SUPPORT

 endif

 

-

+ifeq ($(USE_ECALL_SUPPORT),yes)

+DEFINE += -DECALL_SUPPORT

+endif