[Feature][ZXW-33]merge ZXW 0428 version

Change-Id: I11f167edfea428d9fab198ff00ff1364932d1b0b
diff --git a/ap/lib/libatext/Makefile b/ap/lib/libatext/Makefile
index 0e39b78..4abe2ee 100644
--- a/ap/lib/libatext/Makefile
+++ b/ap/lib/libatext/Makefile
@@ -33,6 +33,15 @@
 LDFLAGS += -shared
 
 
+ifeq ($(USE_VOICE_AT),yes)
+CFLAGS += -I$(zte_lib_path)/libtinyalsa/include
+CFLAGS += -I$(zte_lib_path)/libvoice/include
+LDLIBS += -L$(zte_lib_path)/libvoice
+LDLIBS += -lvoice
+LDLIBS += -L$(zte_lib_path)/libtinyalsa
+LDLIBS += -ltinyalsa
+endif
+
 all: $(LIB_STATIC) $(LIB_SHARED)
 
 $(LIB_STATIC) : $(OBJS)
diff --git a/ap/lib/libatext/ext_audio_func.c b/ap/lib/libatext/ext_audio_func.c
new file mode 100755
index 0000000..f1b45a7
--- /dev/null
+++ b/ap/lib/libatext/ext_audio_func.c
@@ -0,0 +1,508 @@
+/************************************************************************

+*¹¦ÄܽéÉÜ£ºÆ½Ì¨ÄÚ²¿À©Õ¹at¿Í»§¶ËºÍ·þÎñ¶Ë×¢²á£¬ËùÓÐ×¢²á¾ùÔÚext_regist_init½Ó¿ÚÖÐÍê³É£¬ÓÉat_ctlÔÚÆô¶¯Ê±µ÷ÓÃ

+*¸ºÔðÈË£º

+*±¸·ÝÈË£º

+*ÐÞ¸ÄÈÕ£º

+*ÐÞ¸ÄÄÚÈÝ£º

+*°æ±¾ºÅ£º

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

+#if (APP_OS_TYPE == APP_OS_LINUX)

+#include "at_msg.h"

+#include "at_com.h"

+#include "at_context.h"

+#include "ext_dev_func.h"

+#include "ext_cmux_func.h"

+#ifdef _USE_VOICE_ALSA

+#include "tinyalsa/audio_mixer_ctrl.h"

+#include "voice_lib.h"

+#endif

+//#include "ext_regist.h"

+//#include "softap_api.h"

+//#include "at_utils.h"

+//#include "pub/drvs_ret.h"

+//#include "earpiece_api.h"

+#define DRV_SUCCESS 0

+

+/*

+typedef enum

+{

+    VP_PATH_HANDSET    =0,     

+    VP_PATH_SPEAKER,  		

+    VP_PATH_HEADSET,                     

+    VP_PATH_BLUETOOTH,                    

+    VP_PATH_BLUETOOTH_NO_NR,                    

+    VP_PATH_HSANDSPK,

+    

+    VP_PATH_OFF = 255,					

+    

+    MAX_VP_PATH = VP_PATH_OFF               

+}T_ZDrv_VpPath;

+*/

+/*	Voice input channel selection. */

+typedef enum

+{

+	CODEC_INPUT_MICPHONE	=0, 					/*input path in earphone mic*/

+	CODEC_INPUT_HEADSET,							   /*input path in headset*/

+	CODEC_INPUT_BLUETOOTH,							 /*input path in bluetooth*/

+	CODEC_INPUT_HANDSFREE,							 /*input path in mic(handsfree)*/

+	

+	MAX_CODEC_INPUT_PATH			   

+} T_ZDrv_CodecInputPath;

+

+/*	Voice output channel selection. */

+typedef enum

+{

+	CODEC_OUTPUT_RECEIVER	 =0,				/*output path in receiver*/

+	CODEC_OUTPUT_SPEAKER,						  /*output path in speaker*/

+	CODEC_OUTPUT_HEADSET,						  /*output path in headset*/

+	CODEC_OUTPUT_BLUETOOTH, 					/*output path in bluetooth*/

+	CODEC_OUTPUT_HSANDSPK,					   /*output path in both headset and speaker*/

+	

+	

+	MAX_CODEC_OUTPUT_PATH			   

+}T_ZDrv_CodecOutputPath;

+#ifdef _CONFIG_USE_CODEC_EARPIECE_DETECT

+extern SINT32 halEarp_Open(VOID);

+extern SINT32 halEarp_Close(VOID);

+extern SINT32 halEarp_GetPlugStatus(T_ZDrvEarp_State* plug_status);

+#endif

+

+#ifdef _CONFIG_USE_CODEC

+extern SINT32 halAudioConfig_ReadReg (UINT16 regPage, UINT16 regAddress, UINT16 *regValue);

+extern SINT32 halAudioConfig_WriteReg (UINT16 regPage, UINT16 regAddress, UINT16 regValue, UINT16 regMask);

+extern SINT32 halAudioConfig_DumpReg (VOID);

+

+

+int codecWrite_act_func (int at_fd, char * at_paras, void * *res_msg, int * res_msglen)

+{

+	char *at_str = NULL;

+	UINT32 ret = DRV_SUCCESS;

+	UINT8 pPtr[40] = {0};

+	int a[4] = {0};

+	//CHAR b[6] = {0};

+	//CHAR c[6] = {0};

+	//CHAR d[6] = {0};

+	UINT16 reg_page = 0;

+	UINT16 reg_index = 0;

+	UINT16 write_value = 0;

+	UINT16 write_mask = 0;

+	at_str = at_paras;

+	at_print(AT_DEBUG,"codecWrite_act_func, at_paras:%s \n", at_paras);

+

+	//ret = sscanf (at_str, "%[0-9],%[0-9],%[0-9],%[0-9]", a, b, c, d);

+	ret = sscanf (at_str, "%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3]);

+	reg_page = a[0];

+	reg_index = a[1];

+	write_value = a[2];

+	write_mask = a[3];

+	at_print(AT_DEBUG,"zCtrm_ExtAT_WRCODEC reg_page=0x%x, reg_index=0x%x, write_value=0x%x, write_mask=0x%x\n", reg_page, reg_index, write_value, write_mask);

+

+	if (ret == 4) {

+		ret = halAudioConfig_WriteReg (reg_page, reg_index, write_value, write_mask);

+		if (ret == DRV_SUCCESS) {

+			*res_msg = at_ok_build();

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+	}

+

+	*res_msg = at_err_build(ATERR_PROC_FAILED);

+	*res_msglen = strlen (*res_msg);

+	return AT_END;

+}

+

+int codecRead_act_func (int at_fd, char * at_paras, void * *res_msg, int * res_msglen)

+{

+	char *at_str = NULL;

+	at_str = at_paras;

+	UINT32 ret = DRV_SUCCESS;

+	int a[2] = {0};

+	//CHAR b[6] = {0};

+	CHAR re_str[30] = {'\0'};

+

+	UINT16 reg_page = 0;

+	UINT16 reg_index = 0;

+	UINT16 read_value = 0;

+	at_print(AT_DEBUG,"codecRead_act_func, at_paras:%s \n", at_paras);

+

+	//ret = sscanf (at_str, "%[0-9],%[0-9]", a, b);

+	ret = sscanf (at_str, "%d,%d", &a[0], &a[1]);

+	reg_page = a[0];

+	reg_index = a[1];

+	at_print(AT_DEBUG,"codecRead_act_func reg_page=0x%x, reg_index=0x%x \n", reg_page, reg_index);

+

+	if (ret == 2) {

+		ret = halAudioConfig_ReadReg (reg_page, reg_index, &read_value);

+		if (ret == DRV_SUCCESS) {

+

+			sprintf(re_str, "0x%x=0x%x\r\n" , reg_index,read_value);

+			

+			*res_msg = at_query_result_build("reg",re_str);

+

+			//*res_msg = at_ok_build();

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+	}

+

+	*res_msg = at_err_build(ATERR_PROC_FAILED);

+	*res_msglen = strlen (*res_msg);

+	return AT_END;

+}

+

+int codecDump_act_func (int at_fd, char * at_paras, void * *res_msg, int * res_msglen)

+{

+	char *at_str = NULL;

+	at_str = at_paras;

+	UINT32 ret = DRV_SUCCESS;

+	at_print(AT_DEBUG,"codecDump_act_func, at_paras:%s \n", at_paras);

+

+	if (*at_str == '1') {

+		at_print(AT_DEBUG,"codecDump_act_func is ok. \n");

+		ret = halAudioConfig_DumpReg();

+		if (ret == DRV_SUCCESS) {

+			*res_msg = at_ok_build();

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+	}

+

+	*res_msg = at_err_build(ATERR_PROC_FAILED);

+	*res_msglen = strlen (*res_msg);

+	return AT_END;

+

+

+}

+//ƽ̨ÄÚ²¿À©Õ¹atÃüÁ·¢£¬ËùÓÐÀ©Õ¹µÄ¿Í»§¶ËºÍ·þÎñ¶ËatÃüÁ¾ùÐèÒªÔڸú¯ÊýÖУ¬¸Ãº¯Êý»áÔÚat_ctlÓ¦Óóõʼ»¯Ê±£¬Íê³ÉÉÏÊöatÃüÁîµÄ×¢²á

+

+

+int extAtSdev_act_func (int at_fd, char * at_paras, void * *res_msg, int * res_msglen)

+{

+	char *at_str = NULL;

+	UINT32 ret = DRV_SUCCESS;

+	T_ZDrv_VpPath path;

+	

+	UINT8 pPtr[40] = {0};

+	int a = 0;

+	//CHAR b[6] = {0};

+	UINT16 dev_num = 0;

+	at_str = at_paras;

+	at_print(AT_DEBUG,"extAtSdev_act_func, at_paras:%s \n", at_paras);

+

+	ret = sscanf (at_str, "%d", &a);

+	dev_num = a;

+	at_print(AT_DEBUG,"extAtSdev_act_func dev_num=0x%d\n", dev_num);

+

+	if (ret == 1) {

+

+		if(dev_num == 0)

+		{

+		    path = VP_PATH_HANDSET;

+			at_print(AT_DEBUG, "[MDL] extAtSdev_act_func output channel=%d\r",dev_num);

+		}

+		else if(dev_num == 1)

+		{

+		    path = VP_PATH_SPEAKER;

+			at_print(AT_DEBUG, "[MDL] extAtSdev_act_func output channel=%d\r",dev_num);

+		}

+		else if(dev_num == 2)

+		{

+		    path = VP_PATH_HEADSET;

+			at_print(AT_DEBUG, "[MDL] extAtSdev_act_func output channel=%d\r",dev_num);

+		}

+        else 

+        {

+			sprintf ( (char *) pPtr, "\r\n%s\r\n", "+CME ERROR: 6004");		

+		    path = VP_PATH_HANDSET;

+			*res_msg = at_err_build ("pPtr");

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+        }

+

+		ret = zDrvVp_SetPath(path);

+		if (ret == DRV_SUCCESS) {

+			*res_msg = at_ok_build();

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+		*res_msg = at_err_build(ATERR_PROC_FAILED);

+		*res_msglen = strlen (*res_msg);

+		

+		return AT_END;

+	}

+	return AT_END;

+}

+int extAtRxPath_act_func (int at_fd, char * at_paras, void * *res_msg, int * res_msglen)

+{

+	char *at_str = NULL;

+	UINT32 ret = DRV_SUCCESS;

+	T_ZDrv_CodecOutputPath path;

+	

+	UINT8 pPtr[40] = {0};

+	int a[2] = {0};

+	//CHAR b[6] = {0};

+	UINT16 dev_num = 0;

+	UINT16 isenable = 0;

+	at_str = at_paras;

+	at_print(AT_DEBUG,"extAtSdev_act_func, at_paras:%s \n", at_paras);

+

+	ret = sscanf (at_str, "%d %d", &a[0], &a[1]);

+	dev_num = a[0];

+	isenable = a[1];

+	at_print(AT_DEBUG,"extAtSdev_act_func dev_num=0x%d\n", dev_num);

+

+	if (ret == 2) {

+

+		if(dev_num == 0)

+		{

+		    path = CODEC_OUTPUT_RECEIVER;

+			at_print(AT_DEBUG, "[MDL] extAtSdev_act_func output channel=%d\r",dev_num);

+		}

+		else if(dev_num == 1)

+		{

+		    path = CODEC_OUTPUT_SPEAKER;

+			at_print(AT_DEBUG, "[MDL] extAtSdev_act_func output channel=%d\r",dev_num);

+		}

+		else if(dev_num == 2)

+		{

+		    path = CODEC_OUTPUT_HEADSET;

+			at_print(AT_DEBUG, "[MDL] extAtSdev_act_func output channel=%d\r",dev_num);

+		}

+        else 

+        {

+			sprintf ( (char *) pPtr, "\r\n%s\r\n", "+CME ERROR: 6004");		

+		    path = CODEC_OUTPUT_RECEIVER;

+			*res_msg = at_err_build ("pPtr");

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+        }

+		

+		//ret = zDrvVp_SetTxPath(CODEC_INPUT_MICPHONE, TRUE);

+		ret = zDrvVp_SetRxPath(path, isenable);

+		if (ret == DRV_SUCCESS) {

+			*res_msg = at_ok_build();

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+		*res_msg = at_err_build(ATERR_PROC_FAILED);

+		*res_msglen = strlen (*res_msg);

+		

+		return AT_END;

+	}

+	return AT_END;

+}

+int extAtTxPath_act_func (int at_fd, char * at_paras, void * *res_msg, int * res_msglen)

+{

+	char *at_str = NULL;

+	UINT32 ret = DRV_SUCCESS;

+	T_ZDrv_VpPath path;

+	

+	UINT8 pPtr[40] = {0};

+	int a[2] = {0};

+	//CHAR b[6] = {0};

+	UINT16 dev_num = 0;

+	UINT16 isenable = 0;

+	at_str = at_paras;

+	at_print(AT_DEBUG,"extAtSdev_act_func, at_paras:%s \n", at_paras);

+

+	ret = sscanf (at_str, "%d %d", &a[0], &a[1]);

+	dev_num = a[0];

+	isenable = a[1];

+	at_print(AT_DEBUG,"extAtSdev_act_func dev_num=0x%d\n", dev_num);

+

+	if (ret == 2) {

+

+		if(dev_num == 0)

+		{

+			path = CODEC_INPUT_MICPHONE; //IN2P

+			at_print(AT_DEBUG, "[MDL] extAtSdev_act_func output channel=%d\r",dev_num);

+		}

+		else if(dev_num == 1)

+		{

+			path = CODEC_INPUT_HANDSFREE; //CODEC_INPUT_HEADSET IN2P

+			at_print(AT_DEBUG, "[MDL] extAtSdev_act_func output channel=%d\r",dev_num);

+		}

+		else if(dev_num == 2)

+		{

+			path = CODEC_INPUT_HEADSET; //CODEC_INPUT_HANDSFREE IN1P

+			at_print(AT_DEBUG, "[MDL] extAtSdev_act_func output channel=%d\r",dev_num);

+		}

+		else 

+		{

+			sprintf ( (char *) pPtr, "\r\n%s\r\n", "+CME ERROR: 6004"); 	

+			path = VP_PATH_HANDSET;

+			*res_msg = at_err_build ("pPtr");

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+		

+		ret = zDrvVp_SetTxPath(path, isenable);

+		if (ret == DRV_SUCCESS) {

+			*res_msg = at_ok_build();

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+		

+		*res_msg = at_err_build(ATERR_PROC_FAILED);

+		*res_msglen = strlen (*res_msg);

+		

+		return AT_END;

+	}

+	return AT_END;

+}

+#endif

+

+#ifdef _CONFIG_USE_CODEC_EARPIECE_DETECT

+int extAtEarp_act_func (int at_fd, char * at_paras, void * *res_msg, int * res_msglen)

+{

+	char *at_str = NULL;

+	UINT32 ret = DRV_SUCCESS;

+	T_ZDrv_VpPath path;

+	

+	UINT8 pPtr[40] = {0};

+	int a = 0;

+	//CHAR b[6] = {0};

+	UINT16 onOff = 0;

+	at_str = at_paras;

+	at_print(AT_DEBUG,"extAtSdev_act_func, at_paras:%s \n", at_paras);

+

+	ret = sscanf (at_str, "%d", &a);

+	onOff = a;

+	at_print(AT_DEBUG,"extAtSdev_act_func dev_num=0x%d\n", onOff);

+

+	if (ret == 1) {

+		if(onOff == 1)

+		{

+			ret = halEarp_Open();

+		}

+		else

+		{

+			ret = halEarp_Close();

+		}

+		

+		if (ret == DRV_SUCCESS) {

+			*res_msg = at_ok_build();

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+	}

+	*res_msg = at_err_build(ATERR_PROC_FAILED);

+	*res_msglen = strlen (*res_msg);

+	

+	return AT_END;

+}

+#endif

+#ifdef _USE_VOICE_ALSA

+

+

+

+

+

+

+int extAt_VPATH_act_func (int at_fd, char * at_paras, void * *res_msg, int * res_msglen)

+{

+	char *at_str = NULL;

+	UINT32 ret = DRV_SUCCESS;

+	int path;

+	int a = 0;

+	//CHAR b[6] = {0};

+	UINT16 onOff = 0;

+	at_str = at_paras;

+	at_print(AT_DEBUG,"extAt_VPATH_act_func, at_paras:%s \n", at_paras);

+

+	ret = sscanf (at_str, "%d,%d",&path,&a);

+	onOff = a;

+	at_print(AT_DEBUG,"extAt_VPATH_act_func path =%d,onOff=0x%d\n",path, onOff);

+

+	if (ret == 2) {

+		if(onOff == 1)

+		{

+			ret = set_voice_device_mode(path);

+			printf("extAt_VPATH_act_func on vpath,ret=%d\n",ret);

+		}

+		else

+		{

+			//ret = set_voice_device_mode(path);

+			printf("extAt_VPATH_act_func off vpath not support\n");

+			

+		}		

+		if (ret == DRV_SUCCESS) {

+			*res_msg = at_ok_build();

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+	}

+

+	*res_msg = at_err_build(ATERR_PROC_FAILED);

+	*res_msglen = strlen (*res_msg);

+	

+	return AT_END;

+}

+

+int extAt_VALSA_act_func (int at_fd, char * at_paras, void * *res_msg, int * res_msglen)

+{

+	char *at_str = NULL;

+	UINT32 ret = DRV_SUCCESS;

+

+	int mode = 0;

+    int enable = 0;

+	

+	UINT16 onOff = 0;

+	at_str = at_paras;

+	printf("extAt_VALSA_act_func, at_paras:%s \n", at_paras);

+

+	ret = sscanf (at_str, "%d,%d", &mode,&enable);

+	onOff = enable;

+	printf("extAt_VALSA_act_func mode=%d,enable=%d,ret=%d\n",mode,enable,ret);

+

+	if (ret == 2) {

+		if(onOff == 1)

+		{

+			ret = alsa_voice_open(mode);

+			printf("extAt_voice_act_func alsa_voice_open,ret=%d\n",ret);

+		}

+		else

+		{

+			ret = alsa_voice_close(mode);

+			printf("extAt_voice_act_func alsa_voice_close,ret=%d\n",ret);

+			

+		}		

+		if (ret == DRV_SUCCESS) {

+			*res_msg = at_ok_build();

+			*res_msglen = strlen (*res_msg);

+			return AT_END;

+		}

+	}

+	*res_msg = at_err_build(ATERR_PROC_FAILED);

+	*res_msglen = strlen (*res_msg);

+	

+	return AT_END;

+}

+

+#endif

+

+void ext_audio_regist_init(void)

+{

+	printf("ext_audio_regist_init! \n");

+

+#ifdef _CONFIG_USE_CODEC

+	register_serv_func2("WRCODEC=", 0, 0, 0, codecWrite_act_func, NULL);

+	register_serv_func2("RDCODEC=", 0, 0, 0, codecRead_act_func, NULL);

+	register_serv_func2("DUMPCODECREG=", 0, 0, 0, codecDump_act_func, NULL);

+	register_serv_func2("ExtAT_SDEV=", 0, 0, 0, extAtSdev_act_func, NULL);	

+	register_serv_func2("ExtAT_RXPATH=", 0, 0, 0, extAtRxPath_act_func, NULL);	

+	register_serv_func2("ExtAT_TXPATH=", 0, 0, 0, extAtTxPath_act_func, NULL);	

+#endif

+#ifdef _CONFIG_USE_CODEC_EARPIECE_DETECT

+	register_serv_func2("ExtAT_EARP=", 0, 0, 0, extAtEarp_act_func, NULL);

+#endif

+

+#ifdef _USE_VOICE_ALSA

+

+	register_serv_func2("VALSA=", 0, 0, 0, extAt_VALSA_act_func, NULL);

+	register_serv_func2("VPATH=", 0, 0, 0, extAt_VPATH_act_func, NULL);

+	

+#endif

+}

+

+#endif

diff --git a/ap/lib/libatext/ext_ccapp_fnc.c b/ap/lib/libatext/ext_ccapp_fnc.c
index 6e351cf..f0a6b16 100755
--- a/ap/lib/libatext/ext_ccapp_fnc.c
+++ b/ap/lib/libatext/ext_ccapp_fnc.c
@@ -226,9 +226,31 @@
     sscanf(at_paras, "%u, %u", &imsplusInd->act, &imsplusInd->rate);  

     at_print(AT_DEBUG,"[CCAPP] imsplusInd->act= %d imsplusInd->rate= %d\n", imsplusInd->act, imsplusInd->rate);

 

+#ifdef USE_CAP_SUPPORT

+    if(imsplusInd->act == 0) {//ÒôƵÉ豸¹Ø±Õ

+    }

+    else if(imsplusInd->act == 1) {//ÒôƵÉ豸¿ªÆô

+    }

+    else if(imsplusInd->act == 2) {//֪ͨ¿ªÊ¼²¥·Å±¾µØÕñÁåÒô

+    }

+    else if(imsplusInd->act == 3) {//ֹ֪ͨͣ²¥·Å±¾µØÕñÁåÒô

+        T_zCcapp_ImsplusReq imsplusReq;

+

+        imsplusReq.setfg = 0;

+        imsplusReq.act = imsplusInd->rate;

+        ipc_send_message(MODULE_ID_AT_CTL, MODULE_ID_AT_CTL, MSG_CMD_ZIMSPLUS_REQ, sizeof(T_zCcapp_ImsplusReq), (unsigned char *)&imsplusReq,0);    

+    }

+

+    if(imsplusInd->rate == 8000) {

+    }

+    else if(imsplusInd->rate == 16000) {

+    }

+#else

     ipc_send_message(MODULE_ID_AT_CTL, MODULE_ID_CALL_CTRL, MSG_CMD_ZIMSPLUS_IND, sizeof(T_zCcApp_ImsplusInd), (unsigned char *)imsplusInd,0);

     at_print(AT_DEBUG,"[CCAPP]send IMSPLUS %d\n ",MSG_CMD_ZIMSPLUS_IND );

     free(imsplusInd);

+#endif

+

     return AT_CONTINUE;

 }

 

diff --git a/ap/lib/libatext/ext_ftp_func.c b/ap/lib/libatext/ext_ftp_func.c
index 60425af..3f4742a 100755
--- a/ap/lib/libatext/ext_ftp_func.c
+++ b/ap/lib/libatext/ext_ftp_func.c
@@ -317,7 +317,7 @@
 	};
 	memset(reqmsg, 0x00, sizeof(struct zteftp_fota_reqmsg));
 	parse_param2("%d,%s,%s,%s,%s", at_paras, p);
-	at_print(AT_NORMAL, "zteftp_fota_reqmsg %d,%s,%s,%s,%s\n", reqmsg->channel,
+	at_print(AT_NORMAL, "ftp_fota_reqmsg %d,%s,%s,%s,%s\n", reqmsg->channel,
 	         reqmsg->destination,
 	         reqmsg->file_name,
 	         reqmsg->username,
diff --git a/ap/lib/libatext/ext_normal_func.c b/ap/lib/libatext/ext_normal_func.c
index b39c0b2..90116eb 100644
--- a/ap/lib/libatext/ext_normal_func.c
+++ b/ap/lib/libatext/ext_normal_func.c
@@ -602,7 +602,7 @@
 		*res_msg = at_query_result_build("ZTELNET","1");

 		break;

 	default:

-		at_print(AT_DEBUG,"ztelnetSet_rsp:: invaild user_cmd == %d\n", user_cmd);

+		at_print(AT_DEBUG,"lnetSet_rsp:: invaild user_cmd == %d\n", user_cmd);

 		*res_msg = at_err_build(ATERR_PARAM_INVALID);

 	}

 	

@@ -1365,12 +1365,20 @@
 	int32_t simCardFlag = 0;

 	unsigned long   retCode = CPNV_ERROR;

 	int32_t	SimInserted = 0;

+	int ret = 0;

 

 	char *p[] = {

 		&simCardFlag,

 		&cardSlotFlag,

 	};

-	parse_param("%d,%d", at_paras, p);

+	

+	ret = parse_param("%d,%d", at_paras, p);

+	if (ret != AT_PARSE_OK)  // cov M

+	{

+		*res_msg = at_err_build(ATERR_PARAM_INVALID);

+		*res_msglen = strlen(*res_msg);

+		return AT_END;

+	}

 

 	at_print(AT_DEBUG,"zCardSwitch_Set_Req:simCardFlag == %d\n", simCardFlag);

 	

diff --git a/ap/lib/libatext/ext_regist.c b/ap/lib/libatext/ext_regist.c
index 2a4e3f0..e125562 100755
--- a/ap/lib/libatext/ext_regist.c
+++ b/ap/lib/libatext/ext_regist.c
@@ -30,6 +30,9 @@
 	ext_zcat_regist();

 	ext_amt_regist();

 	ext_wdt_regist_init();

+#ifdef _USE_VOICE_ALSA

+	ext_audio_regist_init();

+#endif	

 }

 

 

diff --git a/ap/lib/libatext/ext_regist.h b/ap/lib/libatext/ext_regist.h
index 1cf2466..b648ded 100644
--- a/ap/lib/libatext/ext_regist.h
+++ b/ap/lib/libatext/ext_regist.h
@@ -26,4 +26,7 @@
 

 extern int ext_is_usermode(void);

 extern int ext_kwatchtest_regist(void);

+#ifdef _USE_VOICE_ALSA

+extern void ext_audio_regist_init(void);

+#endif	

 #endif

diff --git a/ap/lib/libatext/ext_socket_func.c b/ap/lib/libatext/ext_socket_func.c
index 1019216..fe4ac1f 100755
--- a/ap/lib/libatext/ext_socket_func.c
+++ b/ap/lib/libatext/ext_socket_func.c
@@ -1456,7 +1456,7 @@
     	*res_msglen = strlen(at_str);
     	return AT_END;
     }
-	//at_print(AT_NORMAL,"zteftp_socketled_reqmsg %d\n", reqmsg->iswitch);
+	//at_print(AT_NORMAL,"ftp_socketled_reqmsg %d\n", reqmsg->iswitch);
 	*res_msg = reqmsg;
 	*res_msglen = sizeof(struct zteftp_socketled_reqmsg);
 	return AT_CONTINUE;
diff --git a/ap/lib/libatext/ext_wdt_func.c b/ap/lib/libatext/ext_wdt_func.c
index e289b5f..db6806d 100644
--- a/ap/lib/libatext/ext_wdt_func.c
+++ b/ap/lib/libatext/ext_wdt_func.c
@@ -167,14 +167,145 @@
 	return AT_END;

 }

 

+

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

+*

+*

+*/

+

+#define RPMSG_IOC_MAGIC     'R'

+

+/*ioctl cmd usd by device*/

+#define RPMSG_CREATE_CHANNEL          _IOW(RPMSG_IOC_MAGIC, 1, char *)

+#define RPMSG_GET_DATASIZE       _IOWR(RPMSG_IOC_MAGIC, 2, char *)

+#define RPMSG_SET_INT            _IOW(RPMSG_IOC_MAGIC, 3, char *)

+#define RPMSG_SET_INT_FLAG        _IOW(RPMSG_IOC_MAGIC, 4, char *)

+#define RPMSG_CLEAR_INT_FLAG      _IOW(RPMSG_IOC_MAGIC, 5, char *)

+#define RPMSG_SET_POLL_FLAG       _IOW(RPMSG_IOC_MAGIC, 6, char *)

+#define RPMSG_CLEAR_POLL_FLAG     _IOW(RPMSG_IOC_MAGIC, 7, char *)

+#define AT_CAP_DEV    "/dev/rpmsg2"

+

+ static void write_lockfile(char *filepath, char *setbuf)

+ {	

+ 	int f, len = 0;	

+	f = open(filepath, O_RDWR);	

+	if (f == -1) {

+	 	at_print(AT_DEBUG,"write_lockfile OPEN FAIL\n");

+		return;	

+	}	

+	len = strlen(setbuf);	

+	if (write(f, setbuf, len) != len) 

+	{	} 

+	else 

+	{	}

+	

+	close(f);

+}

+

+static int pm_apadd_wakelock(int at_fd,char * at_paras,void * *res_msg,int * res_msglen)

+{

+	char strCmd[AT_CMD_MAX] = {0};

+

+	write_lockfile("/sys/power/wake_lock", "test_wakelock");

+

+	*res_msg = at_query_result_build("delete_lock",strCmd);	

+	*res_msglen = strlen(*res_msg);	

+	return AT_END;

+}

+

+static int pm_apdelete_wakelock(int at_fd,char * at_paras,void * *res_msg,int * res_msglen)

+{

+	char strCmd[AT_CMD_MAX] = {0};

+

+	write_lockfile("/sys/power/wake_unlock", "test_wakelock");

+

+	*res_msg = at_query_result_build("delete_lock",strCmd);	

+	*res_msglen = strlen(*res_msg);

+	

+	return AT_END;

+}

+

+

+static int pm_capadd_wakelock(int at_fd,char * at_paras,void * *res_msg,int * res_msglen)

+{

+	char strCmd[AT_CMD_MAX] = {0};

+	unsigned int ctx=0x5a5a;

+	int fd, ret;

+	

+	 at_print(AT_DEBUG,"pm_capadd_wakelock\n");

+

+

+	fd =open(AT_CAP_DEV, O_RDWR);

+	if(fd<0){

+	 	at_print(AT_DEBUG,"cap add  open FAIL\n");

+		return -1;	

+	}

+

+	ret=ioctl(fd, RPMSG_SET_INT_FLAG, NULL);

+	if(ret<0){

+	 	at_print(AT_DEBUG,"cap add  ioctl FAIL\n");

+		return AT_END;	

+	}		

+	ret=write(fd, &ctx, 4);

+	if(ret<0){

+	 	at_print(AT_DEBUG,"cap add  write FAIL\n");

+		return AT_END;	

+	}

+	

+	*res_msg = at_query_result_build("capadd_lock",strCmd);	

+	*res_msglen = strlen(*res_msg);

+	

+	close(fd);

+	

+	return AT_END;

+}

+

+static int pm_capdelete_wakelock(int at_fd,char * at_paras,void * *res_msg,int * res_msglen)

+{

+	char strCmd[AT_CMD_MAX] = {0};

+

+	unsigned int ctx=0x5a5b;

+	int fd, ret;

+	

+	 at_print(AT_DEBUG,"pm_capdelete_wakelock\n");

+

+	fd =open(AT_CAP_DEV, O_RDWR);

+	if(fd<0){

+	 	at_print(AT_DEBUG,"cap add  open FAIL\n");

+		return -1;	

+	}

+

+	ret=ioctl(fd, RPMSG_SET_INT_FLAG, NULL);

+	if(ret<0){

+	 	at_print(AT_DEBUG,"cap add  ioctl FAIL\n");

+		return AT_END;	

+	}		

+	ret=write(fd, &ctx, 4);

+	if(ret<0){

+	 	at_print(AT_DEBUG,"cap add  write FAIL\n");

+		return AT_END;	

+	}

+

+	close(fd);

+	

+	*res_msg = at_query_result_build("capdelete_lock",strCmd);	

+	*res_msglen = strlen(*res_msg);

+	

+	return AT_END;

+}

 void ext_wdt_regist_init(void)

 {

 	//wdt_fd = open(ZX_SOFT_WDT_DEV, O_RDWR);

 	//ioctl(wdt_fd, ZX_WDT_SET_CHECK, FALSE);

 

 	register_serv_func2("WDT=", 0, 0, 0, wdt_act_func, NULL);

-    register_serv_func2("WDT?", 0, 0, 0,wdt_get_nv_state,NULL);

+	register_serv_func2("WDT?", 0, 0, 0,wdt_get_nv_state,NULL);

 	register_serv_func2("WDTP=", 0, 0, 0, wdt_set_nv_priority, NULL);

-    register_serv_func2("WDTP?", 0, 0, 0,wdt_get_nv_priority,NULL);

+	register_serv_func2("WDTP?", 0, 0, 0,wdt_get_nv_priority,NULL);

+

+	register_serv_func2("apadd_lock", 0, 0, 0,pm_apadd_wakelock,NULL);

+	register_serv_func2("apdel_lock", 0, 0, 0,pm_apdelete_wakelock,NULL);

+	register_serv_func2("capadd_lock", 0, 0, 0,pm_capadd_wakelock,NULL);

+	register_serv_func2("capdel_lock", 0, 0, 0,pm_capdelete_wakelock,NULL);		

 }

 

diff --git a/ap/lib/libatreg/Makefile b/ap/lib/libatreg/Makefile
new file mode 100755
index 0000000..ffcee4a
--- /dev/null
+++ b/ap/lib/libatreg/Makefile
@@ -0,0 +1,37 @@
+#*******************************************************************************

+# include ZTE library makefile

+#*******************************************************************************

+include $(COMMON_MK)

+

+LIB_STATIC = libatreg.a

+LIB_SHARED = libatreg.so

+

+OBJS = $(patsubst %.c,%.o,$(wildcard *.c))

+

+CFLAGS += -I$(zte_app_path)/zte_comm/at_ctl/inc

+CFLAGS += -I$(zte_lib_path)/libatutils

+CFLAGS += -I$(LINUX_DIR)/include

+

+CFLAGS += -g -Werror=implicit-function-declaration

+CFLAGS += -I$(zte_app_path)/include

+CFLAGS += -fPIC

+

+LDFLAGS += -shared

+

+

+#*******************************************************************************

+# targets

+#*******************************************************************************

+all: $(LIB_STATIC) $(LIB_SHARED)

+

+$(LIB_STATIC) : $(OBJS)

+	$(AR) rcs $(LIB_STATIC) $(OBJS)

+

+$(LIB_SHARED): $(OBJS)

+	$(CC) $(LDFLAGS) -o $@ $^

+

+romfs:

+	$(ROMFSINST) $(LIB_SHARED) /lib/$(LIB_SHARED)

+

+clean:

+	-$(RM) *.a *.o *.so $(LIB_SHARED) $(LIB_STATIC) $(OBJS)

diff --git a/ap/lib/libatreg/atreg.c b/ap/lib/libatreg/atreg.c
new file mode 100755
index 0000000..c3f1a50
--- /dev/null
+++ b/ap/lib/libatreg/atreg.c
@@ -0,0 +1,550 @@
+/**

+ * @file regist.c

+ * @brief Implementation of regist.c.

+ *

+ * Copyright (C) 2022 Sanechips Technology Co., Ltd.

+ * @author 

+ * 

+ * This program is free software; you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License version 2 as

+ * published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£©

+ *

+ */

+ 

+

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

+ * 				    		  Include header files							   *

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

+#include <stdio.h>

+#include <string.h>

+#include <stdlib.h>

+#include <pthread.h>

+#include <assert.h>

+#include <sys/ipc.h>

+

+#include "atreg_common.h"

+#include "message.h"

+#include "softap_log.h"

+#include "atreg_msg.h"

+

+

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

+ *                             Macro definitions                               *

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

+

+

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

+ * 						       Type definitions					           	   *

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

+

+

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

+ * 					      Local variable definitions						   *

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

+/** ATÉÏÏÂÎijõʼ»¯±êÖ¾ */

+int atreg_ser_cxt_is_init = 0;

+int atreg_info_cxt_is_init = 0;

+

+/** loglevel³õʼ»¯±êÖ¾ */

+static int loglevel_is_init = 0;

+

+/** ¹«¹²²¿·Ö³õʼ»¯±êÖ¾ */

+static int common_is_init = 0;

+

+

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

+ *						  Global variable definitions						   *

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

+

+

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

+ * 					     Local function declarations 		     			   *

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

+

+

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

+ * 				        Local function implementations		   				   *

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

+/**

+ * @brief       ³õʼ»¯ser ATÉÏÏÂÎÄ: atreg_ser_ctx

+ * @param       ÎÞ

+ * @return      ÎÞ

+ * @note        ÎÞ

+ * @warning     ÎÞ

+ */

+static void atreg_ser_init_proc()

+{

+	if(0 == atreg_ser_cxt_is_init) {	

+		memset(&atreg_ser_ctx, 0, sizeof(atreg_ser_ctx));

+	    memset(atreg_ser_dynamic_idpool, 0, sizeof(atreg_ser_dynamic_idpool));

+		

+		INIT_LIST_HEAD(&atreg_ser_ctx.at_ser_list);

+		INIT_LIST_HEAD(&atreg_ser_ctx.at_ser_list_tmp);

+		

+		pthread_mutex_init(&atreg_ser_ctx.at_ser_lock, NULL);

+		pthread_mutex_init(&atreg_ser_ctx.at_ser_lock_tmp, NULL);

+		pthread_mutex_init(&atreg_ser_ctx.at_ser_idpool_lock, NULL);

+		

+		atreg_ser_cxt_is_init++;	

+		slog(ATREG_PRINT, SLOG_NORMAL, "atreg_ser_init_proc init SUCCESS\n");

+	}

+

+	return;

+}

+

+

+/**

+ * @brief       ³õʼ»¯info ATÉÏÏÂÎÄ: atreg_info_ctx

+ * @param       ÎÞ

+ * @return      ÎÞ

+ * @note        ÎÞ

+ * @warning     ÎÞ

+ */

+static void atreg_info_init_proc()

+{

+	if(0 == atreg_info_cxt_is_init) {			

+		memset(&atreg_info_ctx, 0, sizeof(atreg_info_ctx));

+		memset(atreg_info_dynamic_idpool, 0, sizeof(atreg_info_dynamic_idpool));

+		

+		INIT_LIST_HEAD(&atreg_info_ctx.at_info_list);

+		INIT_LIST_HEAD(&atreg_info_ctx.at_info_list_tmp);

+		

+		pthread_mutex_init(&atreg_info_ctx.at_info_lock, NULL);

+		pthread_mutex_init(&atreg_info_ctx.at_info_lock_tmp, NULL);

+		pthread_mutex_init(&atreg_info_ctx.at_info_idpool_lock, NULL);

+		

+		atreg_info_cxt_is_init++;	

+		slog(ATREG_PRINT, SLOG_NORMAL, "atreg_info_init_proc init SUCCESS\n");

+    }

+

+	return;

+}

+

+

+/**

+ * @brief       ´´½¨ÏûÏ¢´¦Àí×ÓÏß³Ì

+ * @param (in)  ATÉÏÏÂÎÄ - common

+ * @return      0 - ³É¹¦

+ *			    ÆäËû - ʧ°Ü

+ * @note        ÎÞ

+ * @warning     ÎÞ

+ */

+static int atreg_create_msg_thread(struct atreg_common_context_t *patreg_common_ctx)

+{

+    return pthread_create(&(patreg_common_ctx->threadid), NULL, (void *)atreg_msg_thread_entry, (void *)patreg_common_ctx);

+}

+

+

+/**

+ * @brief       ³õʼ»¯È«¾ÖATÉÏÏÂÎÄ: atreg_ser_ctx, atreg_info_ctx, atreg_common_ctx

+ * @param (in)  atreg_type ×¢²áµÄATÀàÐÍ: 0-ser, 1-info

+ * @return      0 - ³É¹¦

+ *			    ÆäËû - ʧ°Ü

+ * @note        ÎÞ

+ * @warning     ÎÞ

+ */

+static int atreg_context_init(int atreg_type)

+{

+    if (0 == loglevel_is_init) {

+		loglevel_init();

+		loglevel_is_init++;

+    }

+

+	switch (atreg_type) {

+		case AT_REG_SER:

+			atreg_ser_init_proc();

+			break;

+

+		case AT_REG_INFO:

+			atreg_info_init_proc();

+			break;

+

+		default:

+			break;

+	}

+

+	if (0 == common_is_init) {

+	    sem_init(&atreg_common_ctx.sem_id, 0, 0);	

+	    memset(&atreg_common_ctx.ts, 0, sizeof(struct timespec));

+	

+		/* ÄÚ²¿¶¯Ì¬»ñȡԴģ¿éID£¬³õʼֵΪMODULE_ID_ATDYNAMIC_BASE */

+		atreg_common_ctx.modid = MODULE_ID_ATDYNAMIC_BASE;

+					

+		while ((msgget(atreg_common_ctx.modid, IPC_CREAT|IPC_EXCL|0600)) == -1) {

+	        atreg_common_ctx.modid++;

+			

+			if (atreg_common_ctx.modid > MODULE_ID_ATDYNAMIC_END) 

+				/* µ±at_ctx.modid´óÓÚMODULE_ID_ATDYNAMIC_ENDֵʱ£¬Ö÷¶¯¶ÏÑÔ */

+				softap_assert("atreg dynamic msg pipi not free timely!!!!!!!!!!!");

+		}

+		

+		slog(ATREG_PRINT, SLOG_NORMAL, "atreg_context_init modid 0x%x\n", atreg_common_ctx.modid);

+

+		/* ´´½¨ÏûÏ¢´¦Àí×ÓÏß³Ì */

+		if (0 != atreg_create_msg_thread(&atreg_common_ctx))	

+			return -1;

+

+		common_is_init++;

+	}

+

+	return 0;

+}

+

+

+/**

+ * @brief       Ϊÿ¸ö×¢²áµÄser AT¹¹½¨ÊµÀý

+ * @param (in)  at_cmd_prefix ×¢²áµÄser ATǰ׺

+ * @param (in)  cb ×¢²áµÄ»Øµ÷º¯Êý

+ * @return      ser ATʵÀý

+ * @note        ÎÞ

+ * @warning     ÎÞ

+ */

+static void *atreg_ser_construct_proc(char *at_cmd_prefix, ser_cb_proc cb)

+{

+	struct atreg_ser_instance_t *patreg_ser_instance = NULL;

+	

+	patreg_ser_instance = (struct atreg_ser_instance_t *)malloc(sizeof(struct atreg_ser_instance_t));

+	if(NULL == patreg_ser_instance) {		

+		return NULL;

+	}

+	memset(patreg_ser_instance, 0, sizeof(struct atreg_ser_instance_t));

+

+	strncpy(patreg_ser_instance->at_cmd_prefix, at_cmd_prefix, AT_CMD_PREFIX-1);

+	patreg_ser_instance->req_msg_id = -1;

+	patreg_ser_instance->rsp_msg_id = -1;

+	patreg_ser_instance->cb = cb;

+	

+	return (void *)patreg_ser_instance;

+}

+

+

+/**

+ * @brief       Ϊÿ¸ö×¢²áµÄinfo AT¹¹½¨ÊµÀý

+ * @param (in)  at_cmd_prefix ×¢²áµÄinfo ATǰ׺

+ * @param (in)  cb ×¢²áµÄ»Øµ÷º¯Êý

+ * @return      info ATʵÀý

+ * @note        ÎÞ

+ * @warning     ÎÞ

+ */

+static void *atreg_info_construct_proc(char *at_cmd_prefix, ser_cb_proc cb)

+{

+	struct atreg_info_instance_t *patreg_info_instance = NULL;

+	

+	patreg_info_instance = (struct atreg_info_instance_t *)malloc(sizeof(struct atreg_info_instance_t));

+	if(NULL == patreg_info_instance) {		

+		return NULL;

+	}

+	memset(patreg_info_instance, 0, sizeof(struct atreg_info_instance_t));

+

+	strncpy(patreg_info_instance->at_cmd_prefix, at_cmd_prefix, AT_CMD_PREFIX-1);

+	patreg_info_instance->req_msg_id = -1;

+	patreg_info_instance->cb = cb;

+	

+	return (void *)patreg_info_instance;

+}

+

+

+/**

+ * @brief       Ϊÿ¸ö×¢²áµÄAT¹¹½¨ÊµÀý

+ * @param (in)  at_cmd_prefix ×¢²áµÄATǰ׺

+ * @param (in)  cb ×¢²áµÄ»Øµ÷º¯Êý

+ * @param (in)  atreg_type ×¢²áµÄATÀàÐÍ: 0-ser, 1-info

+ * @return      ATʵÀý

+ * @note        ÎÞ

+ * @warning     ÎÞ

+ */

+static void *atreg_construct(char *at_cmd_prefix, ser_cb_proc cb, int atreg_type)

+{

+	void* patreg = NULL;

+

+	switch (atreg_type) {

+		case AT_REG_SER:

+			patreg = atreg_ser_construct_proc(at_cmd_prefix, cb);

+			break;

+

+		case AT_REG_INFO:

+			patreg = atreg_info_construct_proc(at_cmd_prefix, cb);

+			break;

+

+		default:

+			break;

+	}

+

+	return patreg;

+}

+

+

+/**

+ * @brief        Ϊÿ¸ö×¢²áµÄser AT¶¯Ì¬·ÖÅäreq_msg_idÓërsp_msg_id

+ * @param (out)  patreg_ser_instance ×¢²áµÄser ATʵÀý

+ * @return       ÎÞ

+ * @note         ÎÞ

+ * @warning      ÎÞ

+ */

+static void atreg_ser_allocation_proc(void* patreg_ser_instance)

+{

+	int i,j;

+    pthread_mutex_lock(&atreg_ser_ctx.at_ser_idpool_lock);

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

+		for (j = 7; j >= 0; j--) {

+			if (0 == atreg_ser_dynamic_idpool[i] & (1 << j)) {

+				((struct atreg_ser_instance_t *)patreg_ser_instance)->req_msg_id = 8 * (i + 1) - (j + 1);

+				((struct atreg_ser_instance_t *)patreg_ser_instance)->rsp_msg_id = 8 * (i + 1) - (j + 1) + 1;

+				atreg_ser_dynamic_idpool[i] = atreg_ser_dynamic_idpool[i] | (1 << j);

+				atreg_ser_dynamic_idpool[i] = atreg_ser_dynamic_idpool[i] | (1 << (j - 1));

+				pthread_mutex_unlock(&atreg_ser_ctx.at_ser_idpool_lock);

+

+				return;

+			}

+		}

+	}

+    pthread_mutex_unlock(&atreg_ser_ctx.at_ser_idpool_lock);

+

+	slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_ser_allocation_proc id pool is FULL\n");

+	

+	return;

+}

+

+

+/**

+ * @brief        Ϊÿ¸ö×¢²áµÄinfo AT¶¯Ì¬·ÖÅäreq_msg_id

+ * @param (out)  patreg_info_instance ×¢²áµÄinfo ATʵÀý

+ * @return       ÎÞ

+ * @note         ÎÞ

+ * @warning      ÎÞ

+ */

+static void atreg_info_allocation_proc(void* patreg_info_instance)

+{

+	int i,j;

+    pthread_mutex_lock(&atreg_info_ctx.at_info_idpool_lock);

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

+		for (j = 7; j >= 0; j--) {

+			if (0 == atreg_info_dynamic_idpool[i] & (1 << j)) {

+				((struct atreg_info_instance_t *)patreg_info_instance)->req_msg_id = 8 * (i + 1) - (j + 1) + 512;

+				atreg_info_dynamic_idpool[i] = atreg_info_dynamic_idpool[i] | (1 << j);

+				pthread_mutex_unlock(&atreg_info_ctx.at_info_idpool_lock);

+

+				return;

+			}

+		}

+	}

+    pthread_mutex_unlock(&atreg_info_ctx.at_info_idpool_lock);

+

+	slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_info_allocation_proc id pool is FULL\n");

+	

+	return;

+}

+

+

+/**

+ * @brief        Ϊÿ¸ö×¢²áµÄAT¶¯Ì¬·ÖÅäreq_msg_idÓërsp_msg_id

+ * @param (in)   atreg_type ×¢²áµÄATÀàÐÍ: 0-ser, 1-info

+ * @param (out)  patreg_instance ×¢²áµÄATʵÀý

+ * @return       ÎÞ

+ * @note         ÎÞ

+ * @warning      ÎÞ

+ */

+static void atreg_dynamic_id_allocation(void* patreg_instance, int atreg_type)

+{

+	switch (atreg_type) {

+		case AT_REG_SER:

+			atreg_ser_allocation_proc(patreg_instance);

+			break;

+

+		case AT_REG_INFO:

+			atreg_info_allocation_proc(patreg_instance);

+			break;

+

+		default:

+			break;

+	}

+}

+

+

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

+ * 					    Global function implementations						   *

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

+int reg_at_serv_func(char *at_cmd_prefix, ser_cb_proc cb)

+{

+	int send_ret = -1;

+    struct atreg_ser_instance_t *patreg_ser_instance = NULL;

+	struct atreg_msg_t *patreg_msgdata = NULL;

+

+	if (NULL == at_cmd_prefix || NULL == cb) {

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: register_serv_func para wrong, at_cmd_prefix or cb is NULL\n");

+		return -1;

+    }

+	

+	/* at_context³õʼ»¯ */

+    if (-1 == atreg_context_init(AT_REG_SER))

+		return -1;

+	

+    /* ¹¹½¨atʵÀý */	

+	patreg_ser_instance = (struct atreg_ser_instance_t *)atreg_construct(at_cmd_prefix, cb, AT_REG_SER);

+	if (NULL == patreg_ser_instance) {

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_construct AT %s fail!\n", at_cmd_prefix);

+		return -1;

+	}

+

+	/* ¶¯Ì¬·ÖÅäreq_msg_idÓërsp_msg_id */

+	atreg_dynamic_id_allocation((void *)patreg_ser_instance, AT_REG_SER);

+		

+    /* »º´æatʵÀý */

+    pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock_tmp);

+    list_add_tail((struct list_head *)patreg_ser_instance, &atreg_ser_ctx.at_ser_list_tmp);

+	pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock_tmp);

+

+	/* ×¢²áatÖÁat_ctl */

+	patreg_msgdata = (struct atreg_msg_t *)malloc(sizeof(struct atreg_msg_t));

+	memset(patreg_msgdata, 0, sizeof(struct atreg_msg_t));

+	strncpy(patreg_msgdata->at_cmd_prefix, patreg_ser_instance->at_cmd_prefix, AT_CMD_PREFIX-1);

+	patreg_msgdata->req_msg_id = patreg_ser_instance->req_msg_id;

+	patreg_msgdata->rsp_msg_id = patreg_ser_instance->rsp_msg_id;

+	patreg_msgdata->type = AT_REG_SER;

+	patreg_msgdata->res = -1;

+	

+	send_ret = ipc_send_message2(atreg_common_ctx.modid, MODULE_ID_AT_CTL, MSG_CMD_AT_REG_REQ, sizeof(struct atreg_msg_t), (unsigned char *)patreg_msgdata, 0);

+    if (0 != send_ret) {	

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: register_serv_func ipc fail!\n");

+		return -1;

+    }

+

+	free(patreg_msgdata);

+	

+	atreg_wait_rsp(MSG_CMD_AT_REG_REQ);

+		

+	return 0;

+}

+

+

+int unreg_at_serv_func(char *at_cmd_prefix)

+{

+	int send_ret = -1;

+    struct atreg_ser_instance_t *patreg_ser_instance = NULL;

+	struct atreg_msg_t *patreg_msgdata = NULL;

+

+	if (NULL == at_cmd_prefix) {

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: unregister_serv_func para wrong, at_cmd_prefix=NULL!\n");

+		return -1;

+    }

+

+	

+	patreg_ser_instance = (struct atreg_ser_instance_t *)atreg_search_instance_by_prefix(at_cmd_prefix, AT_REG_SER);

+	if (NULL == patreg_ser_instance) {

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: unreg_at_serv_func AT %s not regist yet\n", at_cmd_prefix);

+		return -1;

+	}

+	

+	patreg_msgdata = (struct atreg_msg_t *)malloc(sizeof(struct atreg_msg_t));

+	memset(patreg_msgdata, 0, sizeof(struct atreg_msg_t));

+	strncpy(patreg_msgdata->at_cmd_prefix, patreg_ser_instance->at_cmd_prefix, AT_CMD_PREFIX-1);

+	patreg_msgdata->req_msg_id = patreg_ser_instance->req_msg_id;

+	patreg_msgdata->rsp_msg_id = patreg_ser_instance->rsp_msg_id;

+	patreg_msgdata->type = AT_REG_SER;

+	patreg_msgdata->res = -1;

+

+	send_ret = ipc_send_message2(atreg_common_ctx.modid, MODULE_ID_AT_CTL, MSG_CMD_AT_UNREG_REQ, sizeof(struct atreg_msg_t), (unsigned char *)patreg_msgdata, 0);

+    if (0 != send_ret) {	

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: unregister_serv_func ipc fail!\n");

+		return -1;

+    }

+	

+	free(patreg_msgdata);

+	

+	atreg_wait_rsp(MSG_CMD_AT_UNREG_REQ);

+

+	return 0;

+}

+

+

+int reg_at_info_func(char *at_cmd_prefix, info_cb_proc cb)

+{

+	int send_ret = -1;

+    struct atreg_info_instance_t *patreg_info_instance = NULL;

+	struct atreg_msg_t *patreg_msgdata = NULL;

+

+	if (NULL == at_cmd_prefix || NULL == cb) {

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: register_info_func para wrong, at_cmd_prefix or cb is NULL\n");

+		return -1;

+    }

+	

+	/* at_context³õʼ»¯ */

+    if (-1 == atreg_context_init(AT_REG_INFO))

+		return -1;

+	

+    /* ¹¹½¨atʵÀý */	

+	patreg_info_instance = (struct atreg_info_instance_t *)atreg_construct(at_cmd_prefix, cb, AT_REG_INFO);

+	if (NULL == patreg_info_instance) {

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_construct AT %s fail!\n", at_cmd_prefix);

+		return -1;

+	}

+

+	/* ¶¯Ì¬·ÖÅäreq_msg_id */

+	atreg_dynamic_id_allocation((void *)patreg_info_instance, AT_REG_INFO);

+	

+    /* »º´æatʵÀý */

+    pthread_mutex_lock(&atreg_info_ctx.at_info_lock_tmp);

+    list_add_tail((struct list_head *)patreg_info_instance, &atreg_info_ctx.at_info_list_tmp);

+	pthread_mutex_unlock(&atreg_info_ctx.at_info_lock_tmp);

+	

+	/* ×¢²áatÖÁat_ctl */

+	patreg_msgdata = (struct atreg_msg_t *)malloc(sizeof(struct atreg_msg_t));

+	memset(patreg_msgdata, 0, sizeof(struct atreg_msg_t));

+	strncpy(patreg_msgdata->at_cmd_prefix, patreg_info_instance->at_cmd_prefix, AT_CMD_PREFIX-1);

+	patreg_msgdata->req_msg_id = patreg_info_instance->req_msg_id;

+	patreg_msgdata->rsp_msg_id = -1;

+	patreg_msgdata->type = AT_REG_INFO;

+	patreg_msgdata->res = -1;

+	

+	send_ret = ipc_send_message2(atreg_common_ctx.modid, MODULE_ID_AT_CTL, MSG_CMD_AT_REG_REQ, sizeof(struct atreg_msg_t), (unsigned char *)patreg_msgdata, 0);

+    if (0 != send_ret) {	

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: register_info_func ipc fail!\n");

+		return -1;

+    }

+	

+	free(patreg_msgdata);

+	

+	atreg_wait_rsp(MSG_CMD_AT_REG_REQ);

+	

+	return 0;

+}

+

+

+int unreg_at_info_func(char *at_cmd_prefix)

+{

+	int send_ret = -1;

+    struct atreg_info_instance_t *patreg_info_instance = NULL;

+	struct atreg_msg_t *patreg_msgdata = NULL;

+

+	if (NULL == at_cmd_prefix) {

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: unregister_info_func para wrong, at_cmd_prefix=NULL!\n");

+		return -1;

+    }

+

+	patreg_info_instance = (struct atreg_info_instance_t *)atreg_search_instance_by_prefix(at_cmd_prefix, AT_REG_INFO);

+	if (NULL == patreg_info_instance) {

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: unreg_at_info_func AT %s not regist yet\n", at_cmd_prefix);

+		return -1;

+	}

+	

+	patreg_msgdata = (struct atreg_msg_t *)malloc(sizeof(struct atreg_msg_t));

+	memset(patreg_msgdata, 0, sizeof(struct atreg_msg_t));

+	strncpy(patreg_msgdata->at_cmd_prefix, patreg_info_instance->at_cmd_prefix, AT_CMD_PREFIX-1);

+	patreg_msgdata->req_msg_id = patreg_info_instance->req_msg_id;

+	patreg_msgdata->rsp_msg_id = -1;

+	patreg_msgdata->type = AT_REG_INFO;

+	patreg_msgdata->res = -1;

+

+	send_ret = ipc_send_message2(atreg_common_ctx.modid, MODULE_ID_AT_CTL, MSG_CMD_AT_UNREG_REQ, sizeof(struct atreg_msg_t), (unsigned char *)patreg_msgdata, 0);

+    if (0 != send_ret) {	

+	    slog(ATREG_PRINT, SLOG_ERR, "Err: unregister_info_func ipc fail!\n");

+		return -1;

+    }

+	

+	free(patreg_msgdata);

+	

+	atreg_wait_rsp(MSG_CMD_AT_UNREG_REQ);

+

+	return 0;

+}

+

diff --git a/ap/lib/libatreg/atreg.h b/ap/lib/libatreg/atreg.h
new file mode 100755
index 0000000..40f3eb0
--- /dev/null
+++ b/ap/lib/libatreg/atreg.h
@@ -0,0 +1,53 @@
+/**

+ * @file regist.h

+ * @brief Inter APIs of libatreg

+ *

+ * Copyright (C) 2022 Sanechips Technology Co., Ltd.

+ * @author 

+ * @ingroup 

+ * 

+ * This program is free software; you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License version 2 as

+ * published by the Free Software Foundation. 

+ *

+ */

+

+

+#ifndef _ATREG_REGIST_H

+#define _ATREG_REGIST_H

+

+

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

+ *                           Include header files                              *

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

+#include "atreg_common.h"

+

+

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

+ *                             Macro definitions                               *

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

+

+

+

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

+ *                             Type definitions                                *

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

+

+

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

+ *                       Global variable declarations                          *

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

+

+

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

+ *                       Global function declarations                          *

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

+int reg_at_serv_func(char *at_cmd_prefix, ser_cb_proc cb);

+int unreg_at_serv_func(char *at_cmd_prefix);

+

+int reg_at_info_func(char *at_cmd_prefix, info_cb_proc cb);

+int unreg_at_info_func(char *at_cmd_prefix);

+

+

+#endif

+

diff --git a/ap/lib/libatreg/atreg_common.c b/ap/lib/libatreg/atreg_common.c
new file mode 100755
index 0000000..84f8667
--- /dev/null
+++ b/ap/lib/libatreg/atreg_common.c
@@ -0,0 +1,264 @@
+/**

+ * @file atreg_common.c

+ * @brief Implementation of the inter APIs of libatreg.

+ *

+ * Copyright (C) 2021 Sanechips Technology Co., Ltd.

+ * @author 

+ * 

+ * This program is free software; you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License version 2 as

+ * published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£©

+ *

+ */

+

+

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

+ * 						       Include header files 						   *

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

+#include <stdio.h>

+#include <string.h>

+#include <stdlib.h>

+

+#include "atreg_common.h"

+#include "at_utils.h"

+

+

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

+ * 						    	Macro definitions							   *

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

+

+

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

+ * 						       	Type definitions							   *

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

+

+ 

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

+ * 					       Local variable definitions						   *

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

+ 

+ 

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

+ * 					       Global variable definitions					       *

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

+ 

+struct atreg_ser_context_t atreg_ser_ctx;

+struct atreg_info_context_t atreg_info_ctx;

+struct atreg_common_context_t atreg_common_ctx;

+

+/** ser - ¶¯Ì¬id³Ø,	·¶Î§: 0~511 */

+unsigned char atreg_ser_dynamic_idpool[ATREG_SER_ID_MAX];

+/** info - ¶¯Ì¬id³Ø,	·¶Î§: 512~768 */

+unsigned char atreg_info_dynamic_idpool[ATREG_INFO_ID_MAX];

+

+extern int atreg_ser_cxt_is_init;

+extern int atreg_info_cxt_is_init;

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

+ * 				           Local function declarations						   *

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

+ 

+ 

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

+ * 					      Local function implementations 					   *

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

+static void *atreg_ser_search_instance_by_prefix_proc(char *at_cmd_prefix)

+{

+	struct atreg_ser_instance_t * entry = NULL;

+	

+	pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock);

+    list_for_each_entry(entry, &atreg_ser_ctx.at_ser_list, list) {

+		if(0 == at_strncmp(at_cmd_prefix, entry->at_cmd_prefix, AT_CMD_PREFIX)) {

+			pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock);

+			

+			return (void *)entry;

+		}

+	}

+	pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock);

+	

+	return NULL;

+}

+

+

+static void *atreg_info_search_instance_by_prefix_proc(char *at_cmd_prefix)

+{

+	struct atreg_info_instance_t * entry = NULL;

+	

+	pthread_mutex_lock(&atreg_info_ctx.at_info_lock);

+	list_for_each_entry(entry, &atreg_info_ctx.at_info_list, list) {

+		if(0 == at_strncmp(at_cmd_prefix, entry->at_cmd_prefix, AT_CMD_PREFIX)) {

+			pthread_mutex_unlock(&atreg_info_ctx.at_info_lock);

+			

+			return (void *)entry;

+		}

+	}

+	pthread_mutex_unlock(&atreg_info_ctx.at_info_lock);

+	

+	return NULL;

+}

+

+

+static void *atreg_ser_search_instance_by_reqid_proc(int req_msg_id)

+{

+	struct atreg_ser_instance_t *entry = NULL;

+	

+    pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock);

+	list_for_each_entry(entry, &atreg_ser_ctx.at_ser_list, list) {

+        if(entry->req_msg_id == req_msg_id) {

+		    pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock);

+			

+			return (void *)entry;

+		}

+    }

+    pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock);

+	

+    return NULL;

+}

+

+

+static void *atreg_info_search_instance_by_reqid_proc(int req_msg_id)

+{

+	struct atreg_info_instance_t *entry = NULL;

+	

+    pthread_mutex_lock(&atreg_info_ctx.at_info_lock);

+	list_for_each_entry(entry, &atreg_info_ctx.at_info_list, list) {

+        if(entry->req_msg_id == req_msg_id) {

+		    pthread_mutex_unlock(&atreg_info_ctx.at_info_lock);

+			

+			return (void *)entry;

+		}

+    }

+    pthread_mutex_unlock(&atreg_info_ctx.at_info_lock);

+	

+    return NULL;

+}

+

+

+static void *atreg_ser_search_instance_tmp_by_reqid_proc(int req_msg_id)

+{

+	struct atreg_ser_instance_t *entry = NULL;

+	

+    pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock_tmp);

+	list_for_each_entry(entry, &atreg_ser_ctx.at_ser_list_tmp, list) {

+        if(entry->req_msg_id == req_msg_id) {

+		    pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock_tmp);

+			

+			return (void *)entry;

+		}

+    }

+    pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock_tmp);

+	

+    return NULL;

+}

+

+

+static void *atreg_info_search_instance_tmp_by_reqid_proc(int req_msg_id)

+{

+	struct atreg_info_instance_t *entry = NULL;

+	

+    pthread_mutex_lock(&atreg_info_ctx.at_info_lock_tmp);

+	list_for_each_entry(entry, &atreg_info_ctx.at_info_list_tmp, list) {

+        if(entry->req_msg_id == req_msg_id) {

+		    pthread_mutex_unlock(&atreg_info_ctx.at_info_lock_tmp);

+			

+			return (void *)entry;

+		}

+    }

+    pthread_mutex_unlock(&atreg_info_ctx.at_info_lock_tmp);

+	

+    return NULL;

+}

+

+

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

+ * 				       	  Global function implementations					   *

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

+void atreg_wait_rsp(int msg_cmd)

+{

+	int ret = -1;

+	

+	if (clock_gettime(CLOCK_REALTIME, &atreg_common_ctx.ts) == -1) {

+		slog(ATREG_PRINT, SLOG_NORMAL, "atreg_wait_rsp clock_gettime fail.\n");

+		return;

+	}

+	atreg_common_ctx.ts.tv_sec += WAIT_RSP_TIMEOUT;

+	

+	while ((ret = sem_timedwait(&atreg_common_ctx.sem_id, &atreg_common_ctx.ts)) == -1 && errno == EINTR)

+		continue;

+	if(-1 == ret) {

+		slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_wait_rsp wait msg(%x) timeout.\n", msg_cmd); 				

+	}

+	else {

+		slog(ATREG_PRINT, SLOG_NORMAL, "atreg_wait_rsp post msg(%x) response.\n", msg_cmd);

+	}

+

+	return;

+}

+

+

+void *atreg_search_instance_by_prefix(char *at_cmd_prefix, int atreg_type)

+{

+	void* patreg = NULL;

+

+	switch (atreg_type) {

+		case AT_REG_SER:

+			patreg = atreg_ser_search_instance_by_prefix_proc(at_cmd_prefix);

+			break;

+

+		case AT_REG_INFO:

+			patreg = atreg_info_search_instance_by_prefix_proc(at_cmd_prefix);

+			break;

+

+		default:

+			break;

+	}

+

+	return patreg;

+}

+

+

+void *atreg_search_instance_tmp_by_reqid(int req_msg_id, int atreg_type)

+{

+	void* patreg = NULL;

+

+	switch (atreg_type) {

+	case AT_REG_SER:

+		patreg = atreg_ser_search_instance_tmp_by_reqid_proc(req_msg_id);

+		break;

+

+	case AT_REG_INFO:

+		patreg = atreg_info_search_instance_tmp_by_reqid_proc(req_msg_id);

+		break;

+

+	default:

+		break;

+	}

+

+	return patreg;

+}

+

+

+struct atreg_instance_and_type_t atreg_search_instance_and_type_by_reqid(int req_msg_id)

+{

+    void* patreg = NULL;

+	struct atreg_instance_and_type_t atreg_instance_and_type = {0};

+

+	if(atreg_ser_cxt_is_init)

+	patreg = atreg_ser_search_instance_by_reqid_proc(req_msg_id);

+	if (NULL != patreg) {

+		atreg_instance_and_type.type = AT_REG_SER;

+		atreg_instance_and_type.instance = patreg;

+

+		return atreg_instance_and_type;

+	}

+	if(atreg_info_cxt_is_init)

+	patreg = atreg_info_search_instance_by_reqid_proc(req_msg_id);

+	if (NULL != patreg) {

+		atreg_instance_and_type.type = AT_REG_INFO;

+		atreg_instance_and_type.instance = patreg;

+

+		return atreg_instance_and_type;

+	}

+	atreg_instance_and_type.type = -1;

+	return atreg_instance_and_type;

+}

+

diff --git a/ap/lib/libatreg/atreg_common.h b/ap/lib/libatreg/atreg_common.h
new file mode 100755
index 0000000..3ea1dc3
--- /dev/null
+++ b/ap/lib/libatreg/atreg_common.h
Binary files differ
diff --git a/ap/lib/libatreg/atreg_thread.c b/ap/lib/libatreg/atreg_thread.c
new file mode 100755
index 0000000..714cd01
--- /dev/null
+++ b/ap/lib/libatreg/atreg_thread.c
@@ -0,0 +1,349 @@
+/**

+ * @file at_thread.c

+ * @brief Implementation of at_thread.c.

+ *

+ * Copyright (C) 2022 Sanechips Technology Co., Ltd.

+ * @author 

+ * 

+ * This program is free software; you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License version 2 as

+ * published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£©

+ *

+ */

+ 

+

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

+ * 				    		  Include header files							   *

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

+#include <stdio.h>

+#include <string.h>

+#include <stdlib.h>

+#include <pthread.h>

+#include <sys/prctl.h>

+#include <sys/ipc.h>

+#include <errno.h>

+

+#include "atreg_common.h"

+#include "message.h"

+#include "softap_log.h"

+#include "atreg_msg.h"

+

+

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

+ *                             Macro definitions                               *

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

+

+

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

+ * 						       Type definitions					           	   *

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

+

+

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

+ * 					      Local variable definitions						   *

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

+

+

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

+ *						  Global variable definitions						   *

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

+

+

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

+ * 					     Local function declarations 		     			   *

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

+

+

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

+ * 				        Local function implementations		   				   *

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

+static void atreg_ser_regist_rsp_proc(struct atreg_msg_t *patreg_msgdata)

+{

+	struct atreg_ser_instance_t *patreg_ser_instance = NULL;

+	

+	if (0 == patreg_msgdata->res) {

+		patreg_ser_instance = (struct atreg_ser_instance_t *)atreg_search_instance_tmp_by_reqid(patreg_msgdata->req_msg_id, AT_REG_SER);

+		if (NULL != patreg_ser_instance) {

+		    pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock_tmp);

+			list_del((struct list_head *)patreg_ser_instance);

+			pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock_tmp);

+			

+			pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock);

+			list_add_tail((struct list_head *)patreg_ser_instance, &atreg_ser_ctx.at_ser_list);

+			pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock);

+			

+			slog(ATREG_PRINT, SLOG_NORMAL, "AT %s regist success!\n", patreg_msgdata->at_cmd_prefix);

+		}

+	} else {

+		patreg_ser_instance = (struct atreg_ser_instance_t *)atreg_search_instance_tmp_by_reqid(patreg_msgdata->req_msg_id, AT_REG_SER);

+        pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock_tmp);

+		list_del((struct list_head *)patreg_ser_instance);

+		pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock_tmp);

+		

+		slog(ATREG_PRINT, SLOG_ERR, "AT %s regist fail!\n", patreg_msgdata->at_cmd_prefix);

+		

+		free(patreg_ser_instance);

+	}

+

+	return;

+}

+

+

+static void atreg_info_regist_rsp_proc(struct atreg_msg_t *patreg_msgdata)

+{

+	struct atreg_info_instance_t *patreg_info_instance = NULL;

+	

+	if (0 == patreg_msgdata->res) {

+		patreg_info_instance = (struct atreg_info_instance_t *)atreg_search_instance_tmp_by_reqid(patreg_msgdata->req_msg_id, AT_REG_INFO);

+		if (NULL != patreg_info_instance) {

+		    pthread_mutex_lock(&atreg_info_ctx.at_info_lock_tmp);

+			list_del((struct list_head *)patreg_info_instance);

+			pthread_mutex_unlock(&atreg_info_ctx.at_info_lock_tmp);

+			

+			pthread_mutex_lock(&atreg_info_ctx.at_info_lock);

+			list_add_tail((struct list_head *)patreg_info_instance, &atreg_info_ctx.at_info_list);

+			pthread_mutex_unlock(&atreg_info_ctx.at_info_lock);

+			

+			slog(ATREG_PRINT, SLOG_NORMAL, "AT %s regist success!\n", patreg_msgdata->at_cmd_prefix);

+		}

+	} else {

+		patreg_info_instance = (struct atreg_info_instance_t *)atreg_search_instance_tmp_by_reqid(patreg_msgdata->req_msg_id, AT_REG_INFO);

+        pthread_mutex_lock(&atreg_info_ctx.at_info_lock_tmp);

+		list_del((struct list_head *)patreg_info_instance);

+		pthread_mutex_unlock(&atreg_info_ctx.at_info_lock_tmp);

+		

+		slog(ATREG_PRINT, SLOG_ERR, "AT %s regist fail!\n", patreg_msgdata->at_cmd_prefix);

+		

+		free(patreg_info_instance);

+	}

+

+	return;

+}

+

+

+static void atreg_regist_rsp_proc(unsigned char *aucDataBuf)

+{

+	struct atreg_msg_t *patreg_msgdata = (struct atreg_msg_t *)aucDataBuf;

+

+	switch (patreg_msgdata->type) {

+	case AT_REG_SER:

+		atreg_ser_regist_rsp_proc(patreg_msgdata);

+		break;

+

+	case AT_REG_INFO:

+		atreg_info_regist_rsp_proc(patreg_msgdata);

+		break;

+

+	default:

+		break;

+	}

+	

+	sem_post(&atreg_common_ctx.sem_id);

+

+	return;

+}

+

+

+static void atreg_ser_unregist_rsp_proc(struct atreg_msg_t *patreg_msgdata)

+{

+	int i = -1;

+	int j = -1;

+	struct atreg_ser_instance_t *patreg_ser_instance = NULL;

+	

+	if (0 == patreg_msgdata->res) {

+		patreg_ser_instance = (struct atreg_ser_instance_t *)atreg_search_instance_by_prefix(patreg_msgdata->at_cmd_prefix, AT_REG_SER);

+		if (NULL != patreg_ser_instance) {

+			pthread_mutex_lock(&atreg_ser_ctx.at_ser_idpool_lock);

+			i = patreg_ser_instance->req_msg_id / 8;

+		    j = patreg_ser_instance->req_msg_id % 8;

+			atreg_ser_dynamic_idpool[i] = atreg_ser_dynamic_idpool[i] & (~(1 << (7 - j)));

+			atreg_ser_dynamic_idpool[i] = atreg_ser_dynamic_idpool[i] & (~(1 << (6 - j)));

+			pthread_mutex_unlock(&atreg_ser_ctx.at_ser_idpool_lock);

+		

+		    pthread_mutex_lock(&atreg_ser_ctx.at_ser_lock);

+			list_del((struct list_head *)patreg_ser_instance);

+			pthread_mutex_unlock(&atreg_ser_ctx.at_ser_lock);

+			

+			free(patreg_ser_instance);

+						

+			slog(ATREG_PRINT, SLOG_NORMAL, "AT %s unregist success!\n", patreg_msgdata->at_cmd_prefix);

+		}

+	} else {	

+		slog(ATREG_PRINT, SLOG_ERR, "AT %s unregist fail!\n", patreg_msgdata->at_cmd_prefix);

+	}

+

+	return;

+}

+

+

+static void atreg_info_unregist_rsp_proc(struct atreg_msg_t *patreg_msgdata)

+{

+	int i = -1;

+	int j = -1;

+	struct atreg_info_instance_t *patreg_info_instance = NULL;

+	

+	if (0 == patreg_msgdata->res) {

+		patreg_info_instance = (struct atreg_info_instance_t *)atreg_search_instance_by_prefix(patreg_msgdata->at_cmd_prefix, AT_REG_INFO);

+		if (NULL != patreg_info_instance) {

+			pthread_mutex_lock(&atreg_info_ctx.at_info_idpool_lock);

+			i = (patreg_info_instance->req_msg_id - 512) / 8;

+		    j = (patreg_info_instance->req_msg_id -512) % 8;

+			atreg_info_dynamic_idpool[i] = atreg_info_dynamic_idpool[i] & (~(1 << (7 - j)));

+			pthread_mutex_unlock(&atreg_info_ctx.at_info_idpool_lock);

+		

+		    pthread_mutex_lock(&atreg_info_ctx.at_info_lock);

+			list_del((struct list_head *)patreg_info_instance);

+			pthread_mutex_unlock(&atreg_info_ctx.at_info_lock);

+			

+			free(patreg_info_instance);

+						

+			slog(ATREG_PRINT, SLOG_NORMAL, "AT %s unregist success!\n", patreg_msgdata->at_cmd_prefix);

+		}

+	} else {	

+		slog(ATREG_PRINT, SLOG_ERR, "AT %s unregist fail!\n", patreg_msgdata->at_cmd_prefix);

+	}

+

+	return;

+}

+

+

+static void atreg_unregist_rsp_proc(unsigned char *aucDataBuf)

+{

+	struct atreg_msg_t *patreg_msgdata = (struct atreg_msg_t *)aucDataBuf;

+

+	switch (patreg_msgdata->type) {

+	case AT_REG_SER:

+		atreg_ser_unregist_rsp_proc(patreg_msgdata);

+		break;

+

+	case AT_REG_INFO:

+		atreg_info_unregist_rsp_proc(patreg_msgdata);

+		break;

+

+	default:

+		break;

+	}

+	

+	sem_post(&atreg_common_ctx.sem_id);

+

+	return;

+}

+

+

+static void atreg_ser_cb_proc(void *patreg_instance, unsigned char *aucDataBuf)

+{	

+    int send_ret = -1;

+	unsigned char res_msg[MAX_MSG_LEN] = {0};

+	struct atreg_ser_instance_t *patreg_ser_instance = (struct atreg_ser_instance_t *)patreg_instance;

+

+	patreg_ser_instance->cb(aucDataBuf, res_msg);

+	

+	send_ret = ipc_send_message2(atreg_common_ctx.modid, MODULE_ID_AT_CTL, patreg_ser_instance->rsp_msg_id, sizeof(res_msg), (unsigned char *)res_msg, 0);

+	if (0 != send_ret) {	

+		slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_ser_cb_proc ipc fail!\n");

+	}

+

+	return;

+}

+

+

+static void atreg_info_cb_proc(void *patreg_instance, unsigned char *aucDataBuf)

+{

+	struct atreg_info_instance_t *patreg_info_instance = (struct atreg_info_instance_t *)patreg_instance;

+

+	patreg_info_instance->cb(aucDataBuf);

+	

+	return;

+}

+

+

+static void atreg_cb_proc(int req_msg_id, unsigned char *aucDataBuf)

+{

+	struct atreg_instance_and_type_t atreg_instance_and_type = {0};

+	

+	atreg_instance_and_type = atreg_search_instance_and_type_by_reqid(req_msg_id);

+

+	switch (atreg_instance_and_type.type) {

+	case AT_REG_SER:

+		atreg_ser_cb_proc(atreg_instance_and_type.instance, aucDataBuf);

+		break;

+

+	case AT_REG_INFO:

+		atreg_info_cb_proc(atreg_instance_and_type.instance, aucDataBuf);

+		break;

+

+	default:

+		break;

+	}

+

+	return;

+}

+

+

+static void atreg_msg_proc(MSG_BUF *msg)

+{

+	if(NULL == msg) {

+		slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_msg_proc the msg is NULL!\n");

+		return;

+	}   

+

+	switch(msg->usMsgCmd) {

+		case MSG_CMD_AT_REG_RSP:

+			atreg_regist_rsp_proc(msg->aucDataBuf);

+			break;

+

+		case MSG_CMD_AT_UNREG_RSP:

+			atreg_unregist_rsp_proc(msg->aucDataBuf);

+			break;

+			

+		default:

+			atreg_cb_proc(msg->usMsgCmd, msg->aucDataBuf);	

+			break;

+	}

+

+	return;

+}

+

+

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

+ * 					    Global function implementations						   *

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

+/** ¸ÃÏ̴߳´½¨Ö®ºó£¬½«²»»áÍ˳ö */

+void atreg_msg_thread_entry(void *arg)

+{	

+	struct atreg_common_context_t *patreg_common_ctx = (struct atreg_common_context_t *)arg;

+	int imsgq = -1;

+	int iret = 0;

+	MSG_BUF msgbuf;

+	long msgsize =  sizeof(MSG_BUF) - sizeof(long);

+	char name[32] = {0};

+

+	if(NULL == patreg_common_ctx)	{

+		slog(ATREG_PRINT, SLOG_ERR, "Err: at_thread_entry the arg is NULL!\n");

+		return;

+	}

+	

+	snprintf(name, 31, "atreg%d", patreg_common_ctx->modid);

+	prctl(PR_SET_NAME, name, 0, 0, 0);

+

+	/* ´´½¨atregÏûÏ¢¶ÓÁÐ */	

+	imsgq = msgget(patreg_common_ctx->modid, IPC_CREAT|0600);

+	if (-1 == imsgq) {

+		slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_thread_entry msgget fail!\n");

+		return;

+	}

+		

+	while(1) {

+		memset(&msgbuf, 0, sizeof(MSG_BUF));

+		

+		iret = msgrcv(imsgq, &msgbuf, msgsize, 0, 0);

+		if (-1 == iret) {

+			slog(ATREG_PRINT, SLOG_ERR, "Err: atreg_thread_entry msgrcv errno=%s\n", errno);

+			continue;

+		}

+		atreg_msg_proc(&msgbuf);

+	}

+

+	slog(ATREG_PRINT, SLOG_NORMAL, "atreg_thread_entry the thread is stop!\n");

+}

+

diff --git a/ap/lib/liblpa/libes10.a b/ap/lib/liblpa/libes10.a
index 5422bc4..427839c 100644
--- a/ap/lib/liblpa/libes10.a
+++ b/ap/lib/liblpa/libes10.a
Binary files differ
diff --git a/ap/lib/libnvram/libnvram.a b/ap/lib/libnvram/libnvram.a
index 915a5b9..f277738 100644
--- a/ap/lib/libnvram/libnvram.a
+++ b/ap/lib/libnvram/libnvram.a
Binary files differ
diff --git a/ap/lib/libnvram/libnvram.so b/ap/lib/libnvram/libnvram.so
index 6393cff..7272e8b 100755
--- a/ap/lib/libnvram/libnvram.so
+++ b/ap/lib/libnvram/libnvram.so
Binary files differ
diff --git a/ap/lib/libnvram/libnvram_sc.a b/ap/lib/libnvram/libnvram_sc.a
index 5c1bd74..8b2c418 100644
--- a/ap/lib/libnvram/libnvram_sc.a
+++ b/ap/lib/libnvram/libnvram_sc.a
Binary files differ
diff --git a/ap/lib/libnvram/libnvram_sc.so b/ap/lib/libnvram/libnvram_sc.so
index 9ae2821..a654f8a 100755
--- a/ap/lib/libnvram/libnvram_sc.so
+++ b/ap/lib/libnvram/libnvram_sc.so
Binary files differ
diff --git a/ap/lib/libps/220A1_all/amt/amt.a b/ap/lib/libps/220A1_all/amt/amt.a
index 203e56c..1ea0ba1 100644
--- a/ap/lib/libps/220A1_all/amt/amt.a
+++ b/ap/lib/libps/220A1_all/amt/amt.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/appstart/appstart.a b/ap/lib/libps/220A1_all/appstart/appstart.a
index 9dc1fb0..c075c5c 100644
--- a/ap/lib/libps/220A1_all/appstart/appstart.a
+++ b/ap/lib/libps/220A1_all/appstart/appstart.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/amr.a b/ap/lib/libps/220A1_all/drv/amr.a
index d37e4dd..a6ba81b 100644
--- a/ap/lib/libps/220A1_all/drv/amr.a
+++ b/ap/lib/libps/220A1_all/drv/amr.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/audio_base.a b/ap/lib/libps/220A1_all/drv/audio_base.a
index 122c16d..15e8f62 100644
--- a/ap/lib/libps/220A1_all/drv/audio_base.a
+++ b/ap/lib/libps/220A1_all/drv/audio_base.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/chip.a b/ap/lib/libps/220A1_all/drv/chip.a
index a61ac47..304182b 100644
--- a/ap/lib/libps/220A1_all/drv/chip.a
+++ b/ap/lib/libps/220A1_all/drv/chip.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/drv_sdk.a b/ap/lib/libps/220A1_all/drv/drv_sdk.a
index 8a61d39..9c92bec 100644
--- a/ap/lib/libps/220A1_all/drv/drv_sdk.a
+++ b/ap/lib/libps/220A1_all/drv/drv_sdk.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/public.a b/ap/lib/libps/220A1_all/drv/public.a
index 0539da1..e905155 100644
--- a/ap/lib/libps/220A1_all/drv/public.a
+++ b/ap/lib/libps/220A1_all/drv/public.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/drv/webrtc.a b/ap/lib/libps/220A1_all/drv/webrtc.a
index f22bda9..e1014de 100644
--- a/ap/lib/libps/220A1_all/drv/webrtc.a
+++ b/ap/lib/libps/220A1_all/drv/webrtc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/gsml1/dwddrv.a b/ap/lib/libps/220A1_all/gsml1/dwddrv.a
index 6af60e0..7dc8767 100644
--- a/ap/lib/libps/220A1_all/gsml1/dwddrv.a
+++ b/ap/lib/libps/220A1_all/gsml1/dwddrv.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/gsml1/l1g.a b/ap/lib/libps/220A1_all/gsml1/l1g.a
index c54a34e..41d9d19 100644
--- a/ap/lib/libps/220A1_all/gsml1/l1g.a
+++ b/ap/lib/libps/220A1_all/gsml1/l1g.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/phy/phy.a b/ap/lib/libps/220A1_all/phy/phy.a
index 649cc8e..a139770 100644
--- a/ap/lib/libps/220A1_all/phy/phy.a
+++ b/ap/lib/libps/220A1_all/phy/phy.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_osa_linux.a b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_osa_linux.a
index db35829..b985f16 100644
--- a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_osa_linux.a
+++ b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_osa_linux.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_psm.a b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_psm.a
index 7de3941..1a71317 100644
--- a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_psm.a
+++ b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_psm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_sup.a b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_sup.a
index e70e31d..3b802a3 100644
--- a/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_sup.a
+++ b/ap/lib/libps/220A1_all/plat/armv7-a/GCC/plat_sup.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/plat_osa_linux.a b/ap/lib/libps/220A1_all/plat/plat_osa_linux.a
index db35829..b985f16 100644
--- a/ap/lib/libps/220A1_all/plat/plat_osa_linux.a
+++ b/ap/lib/libps/220A1_all/plat/plat_osa_linux.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/plat_psm.a b/ap/lib/libps/220A1_all/plat/plat_psm.a
index 7de3941..1a71317 100644
--- a/ap/lib/libps/220A1_all/plat/plat_psm.a
+++ b/ap/lib/libps/220A1_all/plat/plat_psm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/plat/plat_sup.a b/ap/lib/libps/220A1_all/plat/plat_sup.a
index e70e31d..3b802a3 100644
--- a/ap/lib/libps/220A1_all/plat/plat_sup.a
+++ b/ap/lib/libps/220A1_all/plat/plat_sup.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/as_com.a b/ap/lib/libps/220A1_all/ps/as_com.a
index 8dcc8cc..a604b29 100644
--- a/ap/lib/libps/220A1_all/ps/as_com.a
+++ b/ap/lib/libps/220A1_all/ps/as_com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/as_gsm.a b/ap/lib/libps/220A1_all/ps/as_gsm.a
index 398debe..66a95b5 100644
--- a/ap/lib/libps/220A1_all/ps/as_gsm.a
+++ b/ap/lib/libps/220A1_all/ps/as_gsm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/ati.a b/ap/lib/libps/220A1_all/ps/ati.a
index 0775676..6813e4e 100644
--- a/ap/lib/libps/220A1_all/ps/ati.a
+++ b/ap/lib/libps/220A1_all/ps/ati.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/com.a b/ap/lib/libps/220A1_all/ps/com.a
index 402e629..b6bd6a2 100644
--- a/ap/lib/libps/220A1_all/ps/com.a
+++ b/ap/lib/libps/220A1_all/ps/com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/el2_up.a b/ap/lib/libps/220A1_all/ps/el2_up.a
index 7c2293d..3df271a 100644
--- a/ap/lib/libps/220A1_all/ps/el2_up.a
+++ b/ap/lib/libps/220A1_all/ps/el2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/eudbg.a b/ap/lib/libps/220A1_all/ps/eudbg.a
index 547fe41..cb7d416 100644
--- a/ap/lib/libps/220A1_all/ps/eudbg.a
+++ b/ap/lib/libps/220A1_all/ps/eudbg.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/eurrc.a b/ap/lib/libps/220A1_all/ps/eurrc.a
index fc0c413..e2092c1 100644
--- a/ap/lib/libps/220A1_all/ps/eurrc.a
+++ b/ap/lib/libps/220A1_all/ps/eurrc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/l1e.a b/ap/lib/libps/220A1_all/ps/l1e.a
index c86f50b..6a75108 100644
--- a/ap/lib/libps/220A1_all/ps/l1e.a
+++ b/ap/lib/libps/220A1_all/ps/l1e.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/nas.a b/ap/lib/libps/220A1_all/ps/nas.a
index 28aa49e..068b29f 100644
--- a/ap/lib/libps/220A1_all/ps/nas.a
+++ b/ap/lib/libps/220A1_all/ps/nas.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/ul1t.a b/ap/lib/libps/220A1_all/ps/ul1t.a
index 50da3f4..f59136f 100644
--- a/ap/lib/libps/220A1_all/ps/ul1t.a
+++ b/ap/lib/libps/220A1_all/ps/ul1t.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/ul2_up.a b/ap/lib/libps/220A1_all/ps/ul2_up.a
index ddc845f..2010f2d 100644
--- a/ap/lib/libps/220A1_all/ps/ul2_up.a
+++ b/ap/lib/libps/220A1_all/ps/ul2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/urrc.a b/ap/lib/libps/220A1_all/ps/urrc.a
index 13ac144..e9f7545 100644
--- a/ap/lib/libps/220A1_all/ps/urrc.a
+++ b/ap/lib/libps/220A1_all/ps/urrc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/wl1w.a b/ap/lib/libps/220A1_all/ps/wl1w.a
index ab601dd..b1507bf 100644
--- a/ap/lib/libps/220A1_all/ps/wl1w.a
+++ b/ap/lib/libps/220A1_all/ps/wl1w.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ps/wl2_up.a b/ap/lib/libps/220A1_all/ps/wl2_up.a
index 5573837..3485b62 100644
--- a/ap/lib/libps/220A1_all/ps/wl2_up.a
+++ b/ap/lib/libps/220A1_all/ps/wl2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/psbase/base.a b/ap/lib/libps/220A1_all/psbase/base.a
index b9a67cc..1fc3ccd 100644
--- a/ap/lib/libps/220A1_all/psbase/base.a
+++ b/ap/lib/libps/220A1_all/psbase/base.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ref/com.a b/ap/lib/libps/220A1_all/ref/com.a
index d4b8520..f8ebb20 100644
--- a/ap/lib/libps/220A1_all/ref/com.a
+++ b/ap/lib/libps/220A1_all/ref/com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/ref/ref_drv.a b/ap/lib/libps/220A1_all/ref/ref_drv.a
index 68746d5..7a252a9 100644
--- a/ap/lib/libps/220A1_all/ref/ref_drv.a
+++ b/ap/lib/libps/220A1_all/ref/ref_drv.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/tools/tools.a b/ap/lib/libps/220A1_all/tools/tools.a
index 6684b0e..cbcb460 100644
--- a/ap/lib/libps/220A1_all/tools/tools.a
+++ b/ap/lib/libps/220A1_all/tools/tools.a
Binary files differ
diff --git a/ap/lib/libps/220A1_all/usat/usat.a b/ap/lib/libps/220A1_all/usat/usat.a
index 3940209..dd071f9 100644
--- a/ap/lib/libps/220A1_all/usat/usat.a
+++ b/ap/lib/libps/220A1_all/usat/usat.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/amt/amt.a b/ap/lib/libps/220A1_vehicle_dc/amt/amt.a
index 34c315f..0ff39bc 100644
--- a/ap/lib/libps/220A1_vehicle_dc/amt/amt.a
+++ b/ap/lib/libps/220A1_vehicle_dc/amt/amt.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/appstart/appstart.a b/ap/lib/libps/220A1_vehicle_dc/appstart/appstart.a
index 5cef79b..626edae 100644
--- a/ap/lib/libps/220A1_vehicle_dc/appstart/appstart.a
+++ b/ap/lib/libps/220A1_vehicle_dc/appstart/appstart.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/amr.a b/ap/lib/libps/220A1_vehicle_dc/drv/amr.a
index 1151f12..7ef398a 100644
--- a/ap/lib/libps/220A1_vehicle_dc/drv/amr.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/amr.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/audio_base.a b/ap/lib/libps/220A1_vehicle_dc/drv/audio_base.a
index 730a3b0..00f1ae9 100644
--- a/ap/lib/libps/220A1_vehicle_dc/drv/audio_base.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/audio_base.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/chip.a b/ap/lib/libps/220A1_vehicle_dc/drv/chip.a
index 3a46b7f..6cc286c 100644
--- a/ap/lib/libps/220A1_vehicle_dc/drv/chip.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/chip.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/drv_sdk.a b/ap/lib/libps/220A1_vehicle_dc/drv/drv_sdk.a
index b9be381..e666538 100644
--- a/ap/lib/libps/220A1_vehicle_dc/drv/drv_sdk.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/drv_sdk.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/public.a b/ap/lib/libps/220A1_vehicle_dc/drv/public.a
index 43af98f..d688b1b 100644
--- a/ap/lib/libps/220A1_vehicle_dc/drv/public.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/public.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/drv/webrtc.a b/ap/lib/libps/220A1_vehicle_dc/drv/webrtc.a
index ab26dae..833c1e1 100644
--- a/ap/lib/libps/220A1_vehicle_dc/drv/webrtc.a
+++ b/ap/lib/libps/220A1_vehicle_dc/drv/webrtc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/gsml1/dwddrv.a b/ap/lib/libps/220A1_vehicle_dc/gsml1/dwddrv.a
index f1e9c66..2d89451 100644
--- a/ap/lib/libps/220A1_vehicle_dc/gsml1/dwddrv.a
+++ b/ap/lib/libps/220A1_vehicle_dc/gsml1/dwddrv.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/gsml1/l1g.a b/ap/lib/libps/220A1_vehicle_dc/gsml1/l1g.a
index 688ed62..f7d0c58 100644
--- a/ap/lib/libps/220A1_vehicle_dc/gsml1/l1g.a
+++ b/ap/lib/libps/220A1_vehicle_dc/gsml1/l1g.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/phy/phy.a b/ap/lib/libps/220A1_vehicle_dc/phy/phy.a
index 960adfc..8768a92 100644
--- a/ap/lib/libps/220A1_vehicle_dc/phy/phy.a
+++ b/ap/lib/libps/220A1_vehicle_dc/phy/phy.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_osa_linux.a b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_osa_linux.a
index bf2be4b..78968bc 100644
--- a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_osa_linux.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_osa_linux.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_psm.a b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_psm.a
index 9684850..1ea275a 100644
--- a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_psm.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_psm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_sup.a b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_sup.a
index 86148e8..de4e73b 100644
--- a/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_sup.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/armv7-a/GCC/plat_sup.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/plat_osa_linux.a b/ap/lib/libps/220A1_vehicle_dc/plat/plat_osa_linux.a
index bf2be4b..78968bc 100644
--- a/ap/lib/libps/220A1_vehicle_dc/plat/plat_osa_linux.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/plat_osa_linux.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/plat_psm.a b/ap/lib/libps/220A1_vehicle_dc/plat/plat_psm.a
index 9684850..1ea275a 100644
--- a/ap/lib/libps/220A1_vehicle_dc/plat/plat_psm.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/plat_psm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/plat/plat_sup.a b/ap/lib/libps/220A1_vehicle_dc/plat/plat_sup.a
index 86148e8..de4e73b 100644
--- a/ap/lib/libps/220A1_vehicle_dc/plat/plat_sup.a
+++ b/ap/lib/libps/220A1_vehicle_dc/plat/plat_sup.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/as_com.a b/ap/lib/libps/220A1_vehicle_dc/ps/as_com.a
index 92912f0..6a116b0 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/as_com.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/as_com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/as_gsm.a b/ap/lib/libps/220A1_vehicle_dc/ps/as_gsm.a
index cd566b8..ba47da1 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/as_gsm.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/as_gsm.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/ati.a b/ap/lib/libps/220A1_vehicle_dc/ps/ati.a
index f99578b..25f4c4c 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/ati.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/ati.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/com.a b/ap/lib/libps/220A1_vehicle_dc/ps/com.a
index 5266aa7..7ebc15f 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/com.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/el2_up.a b/ap/lib/libps/220A1_vehicle_dc/ps/el2_up.a
index f9ffa93..99afdd3 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/el2_up.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/el2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/eudbg.a b/ap/lib/libps/220A1_vehicle_dc/ps/eudbg.a
index e064419..1d7f9c4 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/eudbg.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/eudbg.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/eurrc.a b/ap/lib/libps/220A1_vehicle_dc/ps/eurrc.a
index 1781b04..7b87f6d 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/eurrc.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/eurrc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/l1e.a b/ap/lib/libps/220A1_vehicle_dc/ps/l1e.a
index cf06248..2c8d624 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/l1e.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/l1e.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/nas.a b/ap/lib/libps/220A1_vehicle_dc/ps/nas.a
index 2a2f52f..84ae344 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/nas.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/nas.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/ul1t.a b/ap/lib/libps/220A1_vehicle_dc/ps/ul1t.a
index eb25ce7..b854971 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/ul1t.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/ul1t.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/ul2_up.a b/ap/lib/libps/220A1_vehicle_dc/ps/ul2_up.a
index 3f69c84..644783e 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/ul2_up.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/ul2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/urrc.a b/ap/lib/libps/220A1_vehicle_dc/ps/urrc.a
index dcd3102..bcabc2d 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/urrc.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/urrc.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/wl1w.a b/ap/lib/libps/220A1_vehicle_dc/ps/wl1w.a
index 810a5ee..e4ba53c 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/wl1w.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/wl1w.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/wl2_up.a b/ap/lib/libps/220A1_vehicle_dc/ps/wl2_up.a
index 324c127..610514a 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ps/wl2_up.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/wl2_up.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/psbase/base.a b/ap/lib/libps/220A1_vehicle_dc/psbase/base.a
index a220ea0..1f15bda 100644
--- a/ap/lib/libps/220A1_vehicle_dc/psbase/base.a
+++ b/ap/lib/libps/220A1_vehicle_dc/psbase/base.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ref/com.a b/ap/lib/libps/220A1_vehicle_dc/ref/com.a
index 8d5ebd4..bdefe4e 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ref/com.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ref/com.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ref/ref_drv.a b/ap/lib/libps/220A1_vehicle_dc/ref/ref_drv.a
index fcab52d..119084e 100644
--- a/ap/lib/libps/220A1_vehicle_dc/ref/ref_drv.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ref/ref_drv.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/tools/tools.a b/ap/lib/libps/220A1_vehicle_dc/tools/tools.a
index 47fd041..737164e 100644
--- a/ap/lib/libps/220A1_vehicle_dc/tools/tools.a
+++ b/ap/lib/libps/220A1_vehicle_dc/tools/tools.a
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/usat/usat.a b/ap/lib/libps/220A1_vehicle_dc/usat/usat.a
index 65351bc..fa62f75 100644
--- a/ap/lib/libps/220A1_vehicle_dc/usat/usat.a
+++ b/ap/lib/libps/220A1_vehicle_dc/usat/usat.a
Binary files differ
diff --git a/ap/lib/libsoft_timer/libsoft_timer.a b/ap/lib/libsoft_timer/libsoft_timer.a
index c95d79c..5928666 100644
--- a/ap/lib/libsoft_timer/libsoft_timer.a
+++ b/ap/lib/libsoft_timer/libsoft_timer.a
Binary files differ
diff --git a/ap/lib/libsoft_timer/libsoft_timer.so b/ap/lib/libsoft_timer/libsoft_timer.so
index 58d20ec..1eca733 100755
--- a/ap/lib/libsoft_timer/libsoft_timer.so
+++ b/ap/lib/libsoft_timer/libsoft_timer.so
Binary files differ
diff --git a/ap/lib/libsoft_timer/libsoft_timer_sc.a b/ap/lib/libsoft_timer/libsoft_timer_sc.a
index 4049e55..027e69c 100644
--- a/ap/lib/libsoft_timer/libsoft_timer_sc.a
+++ b/ap/lib/libsoft_timer/libsoft_timer_sc.a
Binary files differ
diff --git a/ap/lib/libsoft_timer/libsoft_timer_sc.so b/ap/lib/libsoft_timer/libsoft_timer_sc.so
index 16f3af1..1f59c76 100755
--- a/ap/lib/libsoft_timer/libsoft_timer_sc.so
+++ b/ap/lib/libsoft_timer/libsoft_timer_sc.so
Binary files differ
diff --git a/ap/lib/libsoftap/softap_api.c b/ap/lib/libsoftap/softap_api.c
index d76371c..9adba76 100755
--- a/ap/lib/libsoftap/softap_api.c
+++ b/ap/lib/libsoftap/softap_api.c
@@ -326,8 +326,11 @@
 		//¼ì²âsrc_id,dst_idÊÇ·ñÂú×ãºË¼äͨѶµÄÌõ¼þ
 		if (0 == soc_send_condition_check(src_id, dst_id))
 			softap_assert("platform_send_msg failed: confition check failed, src_id = %d, dst_id = %d!", src_id, dst_id);
-
+#ifdef USE_CAP_SUPPORT
+		position = (dst_id & MODULE_ID_CPBASE) ? FAR_PS : NEAR_PS;
+#else
 		position = (dst_id & MODULE_ID_APBASE) ? FAR_PS : NEAR_PS;
+#endif
 
 		socMsgInfo.position = position;
 		socMsgInfo.srcId = src_id;
diff --git a/ap/lib/libsqlite/libsqlite.a b/ap/lib/libsqlite/libsqlite.a
deleted file mode 100644
index 635101f..0000000
--- a/ap/lib/libsqlite/libsqlite.a
+++ /dev/null
Binary files differ
diff --git a/ap/lib/libsqlite/libsqlite.so b/ap/lib/libsqlite/libsqlite.so
deleted file mode 100755
index 96caaef..0000000
--- a/ap/lib/libsqlite/libsqlite.so
+++ /dev/null
Binary files differ
diff --git a/ap/lib/libtinyalsa/Makefile b/ap/lib/libtinyalsa/Makefile
index 78ead51..c41b719 100755
--- a/ap/lib/libtinyalsa/Makefile
+++ b/ap/lib/libtinyalsa/Makefile
@@ -37,6 +37,7 @@
 CFLAGS += -I$(zte_lib_path)/libtinyalsa/include

 CFLAGS += -I$(STAGEDIR)/include

 CFLAGS += -I$(APP_DIR)/include

+CFLAGS += -I$(LINUX_DIR)/include

 CFLAGS += -fPIC

 

 LDFLAGS_SHARED += -shared

@@ -113,9 +114,9 @@
 

 romfs:

 	$(ROMFSINST) $(LIB_SHARED) /lib/$(LIB_SHARED)

-	#$(ROMFSINST) $(EXEC_tinyplay) /bin/$(EXEC_tinyplay)

-	#$(ROMFSINST) $(EXEC_tinycap)  	/bin/$(EXEC_tinycap)

-	#$(ROMFSINST) $(EXEC_tinymix)  	/bin/$(EXEC_tinymix)

+	$(ROMFSINST) $(EXEC_tinyplay) /bin/$(EXEC_tinyplay)

+	$(ROMFSINST) $(EXEC_tinycap)  	/bin/$(EXEC_tinycap)

+	$(ROMFSINST) $(EXEC_tinymix)  	/bin/$(EXEC_tinymix)

 	#$(ROMFSINST) $(EXEC_tinypcminfo) /bin/$(EXEC_tinypcminfo)

 	#$(ROMFSINST) $(EXEC_voltest) /bin/$(EXEC_voltest)

 	cp -v $(EXEC_tinyplay)    $(APP_DIR)/test_tools/

diff --git a/ap/lib/libtinyalsa/audio_mixer_ctrl.c b/ap/lib/libtinyalsa/audio_mixer_ctrl.c
index 68448ab..c4ffb76 100755
--- a/ap/lib/libtinyalsa/audio_mixer_ctrl.c
+++ b/ap/lib/libtinyalsa/audio_mixer_ctrl.c
@@ -930,6 +930,143 @@
 	}
 }
 
+#elif defined _ALSA_CODEC_IN_CAP
+
+static struct audio_para_conf init_default_para[] = { 
+};
+
+static struct audio_para_conf  common_out_para_audio[] = {  
+
+};
+
+
+
+static struct audio_para_conf  common_in_para_audio[] = { 
+};
+
+static struct audio_para_conf  hp_outpath_para_audio[] = { 
+};
+
+
+static struct audio_para_conf  spk_outpath_para_audio[] = {  
+};
+
+static  struct  audio_para_conf  main_mic_inpath_para_audio[] = { 
+};
+
+static  struct  audio_para_conf  aux_mic_inpath_para_audio[] = {
+};
+
+static struct audio_para_conf  handset_inoutpath_para_voice[] = { 
+	{"voice processing path select", {"handset"}},  // handset speak headset bluetooth	
+};
+
+static struct audio_para_conf  headset_inoutpath_para_voice[] = { 
+	{"voice processing path select", {"headset"}},  // handset speak headset bluetooth	
+};
+
+static struct audio_para_conf  spk_inoutpath_para_voice[] = {
+	{"voice processing path select", {"speak"}},  // handset speak headset bluetooth	
+};
+
+static struct audio_para_conf output_dac_vol = 	{};
+
+static struct audio_para_conf input_adc_vol = {};
+
+static struct audio_para_conf dac_mute = {};
+static struct audio_para_conf adc_mute = {};
+
+static struct audio_para_conf spk_path_onoff[] = {
+	
+};
+static struct audio_para_conf rcv_path_onoff[] = {
+
+};
+static struct audio_para_conf earp_path_onoff[] = {
+
+};
+static int output_vol_conversion(int vol)
+{
+
+	return 24;
+}
+
+static int input_vol_conversion(int vol)
+{
+	
+	return 24;
+
+}
+
+#else 
+
+static struct audio_para_conf init_default_para[] = { 
+};
+
+static struct audio_para_conf  common_out_para_audio[] = {  
+
+};
+
+
+
+static struct audio_para_conf  common_in_para_audio[] = { 
+};
+
+static struct audio_para_conf  hp_outpath_para_audio[] = { 
+};
+
+
+static struct audio_para_conf  spk_outpath_para_audio[] = {  
+};
+
+static  struct  audio_para_conf  main_mic_inpath_para_audio[] = { 
+};
+
+static  struct  audio_para_conf  aux_mic_inpath_para_audio[] = {
+};
+
+static struct audio_para_conf  handset_inoutpath_para_voice[] = { 
+	
+};
+
+static struct audio_para_conf  headset_inoutpath_para_voice[] = { 
+};
+
+static struct audio_para_conf  spk_inoutpath_para_voice[] = {
+};
+
+static struct audio_para_conf output_dac_vol = 	{};
+
+static struct audio_para_conf input_adc_vol = {};
+
+static struct audio_para_conf dac_mute = {};
+static struct audio_para_conf adc_mute = {};
+
+static struct audio_para_conf spk_path_onoff[] = {
+	
+};
+static struct audio_para_conf rcv_path_onoff[] = {
+
+};
+static struct audio_para_conf earp_path_onoff[] = {
+
+};
+static int output_vol_conversion(int vol)
+{
+
+	return 24;
+}
+
+static int input_vol_conversion(int vol)
+{
+	
+	return 24;
+
+}
+
+
+
+
 #endif
 
 //static struct audio_para_conf nxp_voice_vol = 	{"voice processing path Volume",{"3"}}; //(range 0->5)
@@ -947,7 +1084,7 @@
 		ctl = mixer_get_ctl_by_name(mixer, control);
 
 	if (!ctl) {
-		fprintf(stderr, "Invalid mixer control\n");
+		fprintf(stderr, "Invalid mixer control(%s)\n",control);
 		return;
 	}
 
@@ -977,6 +1114,38 @@
 	}
 }
 
+static void mix_get_value_wrap(struct mixer *mixer, const char *control, int *values)
+{
+	struct mixer_ctl *ctl;
+	enum mixer_ctl_type type;
+	unsigned int num_ctl_values;
+	unsigned int i;
+	int val;
+
+	if (isdigit(control[0]))
+		ctl = mixer_get_ctl(mixer, atoi(control));
+	else
+		ctl = mixer_get_ctl_by_name(mixer, control);
+
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control(%s)\n",control);
+		return;
+	}
+
+	type = mixer_ctl_get_type(ctl);
+	num_ctl_values = mixer_ctl_get_num_values(ctl);
+
+
+	for (i = 0; i < num_ctl_values; i++) {
+		val = mixer_ctl_get_value(ctl, i);
+		if (val == -EINVAL) {
+			fprintf(stderr, "Error: invalid value for index %d\n", i);
+			return;
+		}
+		*(values+i) = val;
+	}
+
+}
 #ifdef _CPE_AUDIO_PRJ
 int mix_set_output_path(struct mixer *mixer, int path)
 {
@@ -1032,6 +1201,26 @@
 
 	return 0;
 }
+int mix_get_voice_vol(struct mixer *mixer, int *volume)
+{
+
+	return 0;
+}
+
+
+
+int mix_set_tx_voice_vol(struct mixer *mixer, int volume)
+{
+
+	return 0;
+}
+
+int mix_get_tx_voice_vol(struct mixer *mixer, int *volume)
+{
+
+	return 0;
+}
+
 
 int mix_set_voice_mute(struct mixer *mixer, bool enable)
 {
@@ -1040,6 +1229,41 @@
 	return 0;
 }
 
+int mix_get_voice_mute(struct mixer *mixer, bool *enable)
+{
+
+	return 0;
+}
+
+
+int mix_set_rx_voice_mute(struct mixer *mixer, bool enable)
+{
+
+	
+	return 0;
+}
+
+int mix_get_rx_voice_mute(struct mixer *mixer, bool *enable)
+{
+
+	return 0;
+}
+
+
+
+int mix_set_vp_path(struct mixer *mixer, int path)
+{
+
+	return 0;
+}
+
+int mix_get_vp_path(struct mixer *mixer, int *path)
+{
+
+	return 0;
+}
+
+
 int mix_set_voice_path(struct mixer *mixer, int path)
 {
 	int i;
@@ -1061,6 +1285,10 @@
 
 	return 0;
 }
+int set_voice_device_mode(int dev_mode)
+{
+		return 0;
+}
 #else
 int mix_set_output_path(struct mixer *mixer, int path)
 {
@@ -1249,6 +1477,66 @@
 	return 0;
 }
 
+int mix_get_voice_vol(struct mixer *mixer, int *volume)
+{
+	struct mixer_ctl *ctl;
+	int val;
+	
+	printf("%s: start !\n",__func__);
+	char name[] = "voice processing path Volume";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+
+	val = mixer_ctl_get_value(ctl, 0);
+	if((val < 0)||(val > 11)){
+		fprintf(stderr, "Invalid val=%d\n",val);
+		return -2;		
+	}
+	*volume = val;
+	return 0;
+}
+
+int mix_set_tx_voice_vol(struct mixer *mixer, int volume)
+{
+	struct mixer_ctl *ctl;
+	char name[] = "voice processing tx path Volume";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+
+	mixer_ctl_set_value(ctl, 0, volume);
+
+	return 0;
+}
+
+int mix_get_tx_voice_vol(struct mixer *mixer, int *volume)
+{
+	struct mixer_ctl *ctl;
+	int val;
+	
+	printf("%s: start !\n",__func__);
+	char name[] = "voice processing tx path Volume";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+
+	val = mixer_ctl_get_value(ctl, 0);
+	if((val < 0)||(val > 11)){
+		fprintf(stderr, "Invalid val=%d\n",val);
+		return -2;		
+	}
+	*volume = val;
+	return 0;
+}
+
+
 int mix_set_voice_mute(struct mixer *mixer, bool enable)
 {
 	struct mixer_ctl *ctl;
@@ -1264,6 +1552,182 @@
 	return 0;
 }
 
+int mix_get_voice_mute(struct mixer *mixer, bool *enable)
+{
+	struct mixer_ctl *ctl;
+	int val;
+	
+	printf("%s: start !\n",__func__);
+	char name[] = "voice uplink mute";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+
+	val = mixer_ctl_get_value(ctl, 0);
+	if((val != 0)&&(val != 1)){
+		fprintf(stderr, "Invalid val=%d\n",val);
+		return -2;		
+	}
+	*enable = val;
+	return 0;
+}
+
+
+int mix_set_rx_voice_mute(struct mixer *mixer, bool enable)
+{
+	struct mixer_ctl *ctl;
+	char name[] = "voice downlink mute";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+
+	mixer_ctl_set_value(ctl, 0, enable);
+	
+	return 0;
+}
+
+int mix_get_rx_voice_mute(struct mixer *mixer, bool *enable)
+{
+	struct mixer_ctl *ctl;
+	int val;
+	
+	printf("%s: start !\n",__func__);
+	char name[] = "voice downlink mute";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+
+	val = mixer_ctl_get_value(ctl, 0);
+	if((val != 0)&&(val != 1)){
+		fprintf(stderr, "Invalid val=%d\n",val);
+		return -2;		
+	}
+	*enable = val;
+	return 0;
+}
+
+int mix_set_vp_path(struct mixer *mixer, int path)
+{
+    int ret = 0;
+	unsigned int  num_enums;
+	struct mixer_ctl *ctl;
+	char name[] = "voice processing path select";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+    num_enums = mixer_ctl_get_num_enums(ctl);
+
+	if((path < 0)||(path >= num_enums)){
+		fprintf(stderr, "Invalid val=%d\n",path);
+		return -2;		
+	}
+	ret = mixer_ctl_set_value(ctl, 0, path);
+
+	if (ret){
+		fprintf(stderr, "Error: set value,ret=%d\n",ret);	
+		return -2;	
+	}
+	return 0;
+}
+
+
+
+
+int mix_get_vp_path(struct mixer *mixer, int *path)
+{
+	struct mixer_ctl *ctl;
+	int val;
+    unsigned int num_enums;
+	
+	printf("%s: start !\n",__func__);
+	char name[] = "voice processing path select";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+
+    num_enums = mixer_ctl_get_num_enums(ctl);
+
+
+	val = mixer_ctl_get_value(ctl, 0);
+	if((val < 0)||(val >= num_enums)){
+		fprintf(stderr, "Invalid val=%d\n",val);
+		return -2;		
+	}
+	printf("%s: val=%d !\n",__func__,val);
+	*path = val;
+	return 0;
+}
+
+
+
+int mix_set_vp_path_st(struct mixer *mixer, char *path)
+{
+	struct mixer_ctl *ctl;
+	char name[] = "voice processing path select";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+
+	//mixer_ctl_set_value(ctl, 0, path);
+	if (mixer_ctl_set_enum_by_string(ctl, path))
+		fprintf(stderr, "Error: invalid enum value\n");	
+	return 0;
+}
+
+
+
+
+int mix_get_vp_path_st(struct mixer *mixer, int *path)
+{
+	struct mixer_ctl *ctl;
+	int val;
+    unsigned int num_enums;
+    unsigned int i;
+    const char *string;
+	
+	printf("%s: start !\n",__func__);
+	char name[] = "voice processing path select";
+	ctl = mixer_get_ctl_by_name(mixer, name);
+	if (!ctl) {
+		fprintf(stderr, "Invalid mixer control\n");
+		return -1;
+	}
+
+    num_enums = mixer_ctl_get_num_enums(ctl);
+
+
+	val = mixer_ctl_get_value(ctl, 0);
+	if((val < 0)||(val >= num_enums)){
+		fprintf(stderr, "Invalid val=%d\n",val);
+		return -2;		
+	}
+	printf("%s: val=%d !\n",__func__,val);
+	
+    string = mixer_ctl_get_enum_string(ctl, val);	
+
+	if(string == NULL){
+		fprintf(stderr, "Invalid string=%d\n",string);
+		return -2;		
+	}
+	printf("%s: string=%s !\n",__func__,string);
+	path = string;
+	return 0;
+}
+
+
+
 int mix_set_voice_path(struct mixer *mixer, int path)
 {
 	int i;
@@ -1324,4 +1788,51 @@
 	
 	return 0;
 }
+
+int mix_get_voice_path(struct mixer *mixer, int *path)
+{
+
+	mix_get_value_wrap(mixer, "audio path select", path);
+
+	return 0;
+
+}
+#define VOCIE_SND_CARD_NUM 0
+
+
+
+//ÉèÖÃvoiceÒôƵÉ豸ģʽ	dev_mode£ºhandset,speaker,headset	0 ±íʾ³É¹¦£¬ ÆäËü±íʾÓдíÎó
+int set_voice_device_mode(int dev_mode)
+{
+
+	struct mixer *voice_mixer = NULL;
+	printf("%s: start dev_mode=%d!\n",__func__, dev_mode);
+
+	if ((dev_mode < T_OUTPUT_HANDSET ) ||(dev_mode > T_OUTPUT_HEADSET)){
+		printf("%s: dev_mode not support, dev_mode=%d!\n",__func__, dev_mode);
+		return -1;
+	}
+
+	//open mixer dev for  control
+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);
+	if (!voice_mixer) {
+		printf("voice_mixer open failed!\n");
+		return -1;
+	}
+
+	//config mixer dev
+	mix_set_voice_path(voice_mixer, dev_mode);
+
+	//close mixer
+	mixer_close(voice_mixer);
+	voice_mixer = NULL;
+
+
+	return 0;
+	
+	
+}
+
+
+
 #endif
diff --git a/ap/lib/libtinyalsa/include/tinyalsa/audio_mixer_ctrl.h b/ap/lib/libtinyalsa/include/tinyalsa/audio_mixer_ctrl.h
index d4e0a58..3263802 100644
--- a/ap/lib/libtinyalsa/include/tinyalsa/audio_mixer_ctrl.h
+++ b/ap/lib/libtinyalsa/include/tinyalsa/audio_mixer_ctrl.h
@@ -15,8 +15,11 @@
 
 enum t_output_path {
     T_OUTPUT_RECEIVER = 0,
+    T_OUTPUT_HANDSET = T_OUTPUT_RECEIVER,
     T_OUTPUT_SPEAKER  = 1,
     T_OUTPUT_HEADSET  = 2,
+    T_OUTPUT_MAX,
+    
 };
 
 enum t_input_path {
@@ -83,5 +86,6 @@
 int mix_set_voice_path(struct mixer *mixer, int path);
 int mix_set_in_call_tone(struct mixer *mixer, int tontype);
 int mix_set_default_param(struct mixer *mixer);
+int set_voice_device_mode(int dev_mode);
 
 #endif
diff --git a/ap/lib/libupi_ab/libupi_ab.a b/ap/lib/libupi_ab/libupi_ab.a
index 8a67dc2..be2d42a 100644
--- a/ap/lib/libupi_ab/libupi_ab.a
+++ b/ap/lib/libupi_ab/libupi_ab.a
Binary files differ
diff --git a/ap/lib/libupi_ab/libupi_ab.so b/ap/lib/libupi_ab/libupi_ab.so
index aa3eefb..5435c24 100755
--- a/ap/lib/libupi_ab/libupi_ab.so
+++ b/ap/lib/libupi_ab/libupi_ab.so
Binary files differ
diff --git a/ap/lib/libvoice/Makefile b/ap/lib/libvoice/Makefile
index e092fad..31a4d66 100644
--- a/ap/lib/libvoice/Makefile
+++ b/ap/lib/libvoice/Makefile
@@ -23,8 +23,12 @@
 #*******************************************************************************

 LIB_SHARED = libvoice.so

 LIB_STATIC = libvoice.a

-

-OBJS = voice.o 

+ifeq ($(USE_VOICE_ALSA),yes)

+OBJS = voice.o alsa_call.o voice_api.o voiceipc.o

+else

+OBJS = voice.o

+endif

+ 

 CFLAGS += -g

 LDFLAGS += -lpthread

 

@@ -33,6 +37,7 @@
 CFLAGS += -I$(zte_lib_path)/libtinyalsa/include

 CFLAGS += -I$(STAGEDIR)/include

 CFLAGS += -I$(APP_DIR)/include

+CFLAGS += -I$(LINUX_DIR)/include

 CFLAGS += -fPIC

 

 LDFLAGS_SHARED += -shared

@@ -41,14 +46,16 @@
 #*******************************************************************************

 # comp test app and 

 #*******************************************************************************	

-

-

+ifeq ($(USE_VOICE_ALSA),yes)

+EXEC_voiceipc = voiceipc

+endif

 	

 #*******************************************************************************

 # objects

 #*******************************************************************************

-

-

+ifeq ($(USE_VOICE_ALSA),yes)

+voiceipc_OBJECTS += voice_api.o voiceipc.o

+endif

 

 

 #########################for linux######################################

@@ -63,7 +70,29 @@
 LDLIBS += -L$(LIB_DIR)/libtinyalsa

 LDLIBS += -ltinyalsa

 

-all: $(LIB_STATIC) $(LIB_SHARED) 

+ifeq ($(USE_VOICE_ALSA),yes)

+all: $(LIB_STATIC) $(LIB_SHARED) $(EXEC_voiceipc)

+

+$(LIB_STATIC) : $(OBJS)

+	$(AR) rcs $(LIB_STATIC) $(OBJS)

+

+$(LIB_SHARED): $(OBJS)

+	$(CC) $(LDFLAGS) $(LDFLAGS_SHARED) -o $@ $^

+

+	

+$(EXEC_voiceipc): $(voiceipc_OBJECTS)

+	$(CC) $(LDFLAGS) -o $@ $(voiceipc_OBJECTS) -Wl,--start-group $(LDLIBS) -Wl,--end-group

+	

+clean:

+	rm -f $(voiceipc_OBJECTS) $(lib_OBJECTS) $(LIB_SHARED) $(LIB_STATIC) $(EXEC_voiceipc) *.elf *.gdb *.o core

+

+romfs:

+	$(ROMFSINST) $(LIB_SHARED) /lib/$(LIB_SHARED)

+	$(ROMFSINST) $(EXEC_voiceipc) /bin/$(EXEC_voiceipc)

+

+	cp -v $(EXEC_voiceipc)    $(APP_DIR)/test_tools/

+else

+all: $(LIB_STATIC) $(LIB_SHARED)

 

 $(LIB_STATIC) : $(OBJS)

 	$(AR) rcs $(LIB_STATIC) $(OBJS)

@@ -79,7 +108,6 @@
 

 romfs:

 	$(ROMFSINST) $(LIB_SHARED) /lib/$(LIB_SHARED)

-

-	

+endif

 

 

diff --git a/ap/lib/libvoice/alsa_call.c b/ap/lib/libvoice/alsa_call.c
new file mode 100755
index 0000000..72f82ce
--- /dev/null
+++ b/ap/lib/libvoice/alsa_call.c
@@ -0,0 +1,278 @@
+/*****************************************************************************

+** °æÈ¨ËùÓÐ (C)2015, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£

+** 

+** ÎļþÃû³Æ:     alsa_voice.c

+** Îļþ±êʶ:     

+** ÄÚÈÝÕªÒª:    

+** ʹÓ÷½·¨:     

+** 

+** ÐÞ¸ÄÈÕÆÚ        °æ±¾ºÅ      Ð޸ıê¼Ç        ÐÞ¸ÄÈË          ÐÞ¸ÄÄÚÈÝ

+** -----------------------------------------------------------------------------

+** 2019/09/25     V1.0        Create          xxq        ´´½¨

+** 

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

+#ifdef _USE_VOICE_ALSA

+

+#include <stdio.h>

+#include <unistd.h>

+#include <string.h>

+#include <stdlib.h>

+

+#include <stdint.h>

+//#include "volte_drv.h"

+#include <sys/ioctl.h>

+#include <fcntl.h>

+#include <tinyalsa/audio_mixer_ctrl.h>

+

+

+

+#include <stdbool.h> 

+#include "tinyalsa/asoundlib.h"

+#include "tinyalsa/audio_mixer_ctrl.h"

+//#include "audio_res_ctrl.h"

+#include "voice_lib.h"

+

+

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

+*                        ºê¶¨Òå                                           *

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

+

+//#define AVOICE_TEAK_2G_3G_DEV_NUM 3

+//#define AVOICE_SOFT_3G_DEV_NUM 4

+//#define AVOICE_4G_DEV_NUM 2

+//#define AVOICE_5G_DEV_NUM 2

+

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

+*                        ÀàÐͶ¨Òå                                         *

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

+/*

+typedef enum

+{

+    AVOICE_TEAK_2G_3G = 0,     

+    AVOICE_SOFT_3G_NB,//1

+    AVOICE_SOFT_3G_WB, //2   

+    AVOICE_4G_NB, //3                 

+    AVOICE_4G_WB, //4

+    AVOICE_5G_NB,//5    

+    AVOICE_5G_WB,//6      

+    MAX_AVOICE_MODE               

+}T_Alsa_Voice_Mode;

+*/

+

+

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

+*                        ¾Ö²¿º¯ÊýÔ­ÐÍÉùÃ÷                                 *

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

+

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

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

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

+

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

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

+*                          ¾²Ì¬È«¾Ö±äÁ¿                                   *

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

+

+

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

+*                            È«¾Öº¯Êý                                     *

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

+

+

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

+*                            ¾Ö²¿º¯Êý                                     *

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

+

+

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

+/* start for testing  ctm*/

+

+/* data type for voice device  handle */

+

+struct voice_handle

+{

+    struct pcm  *pcm_voice_out;

+    struct pcm  *pcm_voice_in;

+};

+

+/* static  handle */

+static struct voice_handle voice_handle = {0};

+

+static int current_chanl = T_OUTPUT_RECEIVER;//T_OUTPUT_HEADSET;//T_OUTPUT_RECEIVER;

+static int current_vol = T_VOICE_VOL_5_LEVEL;

+static int dev_num = 1;

+static int current_mode = MAX_AVOICE_MODE;

+char* vocie_mode[]={"AVOICE_TEAK_2G_3G","AVOICE_SOFT_3G_NB","AVOICE_SOFT_3G_WB","AVOICE_4G_NB","AVOICE_4G_WB","AVOICE_5G_NB","AVOICE_5G_WB"};

+

+/*

+ * phone call   

+ */

+int alsa_voice_open(int vmode)

+{

+    int ret = 0;

+	//int status = 0;

+    struct pcm_config config_voice = {0};

+    struct mxier *voice_mixer = NULL;

+	

+	printf( "%s: start vocie_mode(%d) %s, current_mode=%d!\n",__func__,vmode,vocie_mode[vmode],current_mode);

+

+    if(vmode >= MAX_AVOICE_MODE||vmode < AVOICE_TEAK_2G_3G)

+	{

+		printf("alsa_voice_open: mode not support fail!\n");

+		return -2;

+	

+	}

+    /* open mixer dev for codec control */

+    if(!(voice_mixer = mixer_open(0))) 

+       printf("mixer open fail, file(%s), line(%d)\n", __FILE__, __LINE__);

+

+

+	if(T_OUTPUT_SPEAKER == current_chanl) {

+		mix_set_voice_path(voice_mixer,T_OUTPUT_SPEAKER);

+		

+		printf("chanl SPEAKER: mix_set_voice_path ret=%d!\n",ret);

+		mix_set_voice_vol(voice_mixer,T_VOICE_VOL_5_LEVEL);

+		

+	    printf("chanl SPEAKER: mix_set_voice_vol ret=%d!\n",ret);

+	}

+	else if (T_OUTPUT_RECEIVER == current_chanl){

+		mix_set_voice_path(voice_mixer, T_OUTPUT_RECEIVER);

+		

+		printf("chanl RECEIVER: mix_set_voice_path ret=%d!\n",ret);

+		mix_set_voice_vol(voice_mixer,T_VOICE_VOL_5_LEVEL);

+		

+	    printf("chanl RECEIVER: mix_set_voice_vol ret=%d!\n",ret);

+	}

+	else if (T_OUTPUT_HEADSET == current_chanl){

+		

+		ret= mix_set_voice_path(voice_mixer, T_OUTPUT_HEADSET);

+		

+	    printf("chanl HEADSET: mix_set_voice_path ret=%d!\n",ret);

+		ret = mix_set_voice_vol(voice_mixer,T_VOICE_VOL_5_LEVEL);

+	    printf("chanl HEADSET: mix_set_voice_vol ret=%d!\n",ret);

+		

+	}	

+	else

+	{

+		printf("alsa_voice_open: chanl not support fail!\n");

+		return -2;

+

+	}

+

+    /*close mixer */

+    mixer_close(voice_mixer);

+    

+    /* open pcm dev for data tranf*/

+    config_voice.channels = 1; /* one channel */ 

+    config_voice.rate = 8000;  /* 8K rate */ 

+    config_voice.period_count = 3; /* buffer num */

+    config_voice.period_size = 640; /* buffer size */

+    config_voice.format = PCM_FORMAT_S16_LE; /* 16-bit signed */

+    if(vmode == AVOICE_TEAK_2G_3G)

+    {

+         dev_num = AVOICE_TEAK_2G_3G_DEV_NUM;

+		 config_voice.rate = 8000;  /* 8K rate */ 

+    }

+	else if(vmode == AVOICE_SOFT_3G_NB)

+    {

+         dev_num = AVOICE_SOFT_3G_DEV_NUM;

+		 config_voice.rate = 8000;  /* 8K rate */  

+    }

+	else if(vmode == AVOICE_SOFT_3G_WB)

+    {

+         dev_num = AVOICE_SOFT_3G_DEV_NUM;

+		 config_voice.rate = 16000;  /* 16K rate */  

+    }

+	else if(vmode == AVOICE_4G_NB)

+    {

+         dev_num = AVOICE_4G_DEV_NUM;

+		 config_voice.rate = 8000;  /* 8K rate */  

+    }

+	else if(vmode == AVOICE_4G_WB)

+    {

+         dev_num = AVOICE_4G_DEV_NUM;

+		 config_voice.rate = 16000;  /* 16K rate */  

+    }

+	else if(vmode == AVOICE_5G_NB)

+    {

+         dev_num = AVOICE_5G_DEV_NUM;

+		 config_voice.rate = 8000;  /* 8K rate */  

+    }

+	else if(vmode == AVOICE_5G_WB)

+    {

+         dev_num = AVOICE_5G_DEV_NUM;

+		 config_voice.rate = 16000;  /* 16K rate */  

+    }

+	else

+	{

+		printf("alsa_voice_open: mode not support fail!\n");

+		return -2;

+	

+	}

+

+

+    if(!(voice_handle.pcm_voice_out = pcm_open(0, dev_num, PCM_OUT, &config_voice))) 

+		printf("pcm_out dev_num=%d open fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);

+	

+	printf("%s:pcm_open pcm_voice_out dev_num=%d end!\n",__func__,dev_num);

+		

+    if(!(voice_handle.pcm_voice_in = pcm_open(0,dev_num,PCM_IN, &config_voice))) 

+		printf("pcm_in open dev_num=%d fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);

+	

+	printf("%s:pcm_open pcm_voice_in dev_num=%d end!\n",__func__,dev_num);

+       

+    if(0 != pcm_prepare(voice_handle.pcm_voice_out)) 

+    	printf("pcm_out dev_num=%d prepare fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);

+	

+	printf("%s: pcm_voice_out pcm_prepare dev_num=%d end!\n",__func__,dev_num);

+		

+    if(0 != pcm_prepare(voice_handle.pcm_voice_in))

+   		printf("pcm_in dev_num=%d prepare fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);

+

+	

+	printf("%s: pcm_voice_in pcm_prepare vmode=%d dev_num=%d end!\n",__func__,vmode,dev_num);

+    current_mode = vmode;

+	printf("%s: end!\n",__func__); 

+	

+    return 0;

+}

+

+int alsa_voice_close(int vmode)

+{

+    int ret = 0;

+	printf("%s: start!\n",__func__); 

+

+    if(vmode >= MAX_AVOICE_MODE||vmode < AVOICE_TEAK_2G_3G)

+	{

+		printf("alsa_voice_close: mode not support fail!\n");

+		return -2;

+	

+	}

+

+if(voice_handle.pcm_voice_in) {

+	ret = pcm_close(voice_handle.pcm_voice_in);

+	voice_handle.pcm_voice_in = 0;

+

+	printf("pcm_close pcm_voice_in	ret=%d!\n",ret);

+}

+

+if(voice_handle.pcm_voice_out) {

+	ret = pcm_close(voice_handle.pcm_voice_out);

+	voice_handle.pcm_voice_out = 0;

+

+	printf("pcm_close pcm_voice_out  ret=%d!\n",ret);

+}

+

+

+

+

+

+	current_mode = MAX_AVOICE_MODE;

+	printf("%s: end!\n",__func__); 

+	

+    return ret; 

+}

+

+

+

+#endif

diff --git a/ap/lib/libvoice/include/voice_ipc.h b/ap/lib/libvoice/include/voice_ipc.h
new file mode 100755
index 0000000..abe83b2
--- /dev/null
+++ b/ap/lib/libvoice/include/voice_ipc.h
@@ -0,0 +1,52 @@
+#ifdef USE_CAP_SUPPORT

+

+#define VOICEIPC_OK 0

+#define VOICEIPC_ERROR -1

+#define VOICE_WAIT_MSG_FROM_CAP -2 //waitting msg from cap

+

+#define VOICE_IPC_CONTROL_CHANNEL "/dev/rpmsg6"

+#define VOICE_IPC_CONTROL_CHANNEL_SIZE 256

+

+#define VOICE_HEAD_LEN (2 * sizeof(int))

+#define VOICE_CONTROL_MAX_LEN 32

+

+enum  voice_ipc_func_type {

+	IPC_SET_VOICE_DEVICE_MODE = 0,

+    IPC_GET_VOICE_DEVICE_MODE = 1,

+    IPC_SET_RX_VOICE_VOL = 2,

+    IPC_GET_RX_VOICE_VOL = 3,

+    IPC_SET_TX_VOICE_VOL = 4,

+    IPC_GET_TX_VOICE_VOL = 5,

+    IPC_SET_TX_VOICE_MUTE_STATE = 6,

+    IPC_GET_TX_VOICE_MUTE_STATE = 7,

+    IPC_SET_RX_VOICE_MUTE_STATE = 8,

+    IPC_GET_RX_VOICE_MUTE_STATE = 9,

+    IPC_SET_LOOPBACK_ENABLE_STATE = 10,

+    IPC_GET_LOOPBACK_ENABLE_STATE = 11,

+

+    IPC_VOICE_FUNC_MAX

+};

+

+typedef struct {

+    int func_id;

+    int param_len;

+    unsigned char param[VOICE_CONTROL_MAX_LEN];

+}voice_ipc_control_msg;

+

+int voice_ipc_init(void);

+void Voice_Ctrl_Rpmsg_Recv(void);

+

+void ipc_set_voice_device_mode(voice_ipc_control_msg msg);

+void ipc_get_voice_device_mode(voice_ipc_control_msg msg);

+void ipc_set_rx_voice_vol(voice_ipc_control_msg msg);

+void ipc_get_rx_voice_vol(voice_ipc_control_msg msg);

+void ipc_set_tx_voice_vol(voice_ipc_control_msg msg);

+void ipc_get_tx_voice_vol(voice_ipc_control_msg msg);

+void ipc_set_tx_voice_mute_state(voice_ipc_control_msg msg);

+void ipc_get_tx_voice_mute_state(voice_ipc_control_msg msg);

+void ipc_set_rx_voice_mute_state(voice_ipc_control_msg msg);

+void ipc_get_rx_voice_mute_state(voice_ipc_control_msg msg);

+void ipc_set_loopback_enable_state(voice_ipc_control_msg msg);

+void ipc_get_loopback_enable_state(voice_ipc_control_msg msg);

+

+#endif

diff --git a/ap/lib/libvoice/include/voice_lib.h b/ap/lib/libvoice/include/voice_lib.h
index d2baae2..6788b77 100644
--- a/ap/lib/libvoice/include/voice_lib.h
+++ b/ap/lib/libvoice/include/voice_lib.h
@@ -8,7 +8,47 @@
 
 #ifndef __VOICE_LIB_H
 #define __VOICE_LIB_H
+#include <linux/volte_drv.h>
 
+#define AVOICE_TEAK_2G_3G_DEV_NUM 2
+#define AVOICE_SOFT_3G_DEV_NUM 4
+#define AVOICE_4G_DEV_NUM 1
+#define AVOICE_5G_DEV_NUM 1
+
+#ifdef _USE_VOICE_ALSA
+
+
+ typedef enum
+ {
+	 AVOICE_TEAK_2G_3G = 0, 	
+	 AVOICE_SOFT_3G_NB,
+	 AVOICE_SOFT_3G_WB,    
+	 AVOICE_4G_NB,					
+	 AVOICE_4G_WB, 
+	 AVOICE_5G_NB,	  
+	 AVOICE_5G_WB,		 
+	 MAX_AVOICE_MODE			   
+ }T_Alsa_Voice_Mode;
+int alsa_voice_open(int vmode);
+int alsa_voice_close(int vmode);
+
+ 
+#endif
+
+ /*  Voice process channel selection. */
+ typedef enum
+ {
+	 VP_PATH_HANDSET	= 0,
+	 VP_PATH_SPEAKER,
+	 VP_PATH_HEADSET,
+	 VP_PATH_BLUETOOTH,
+	 VP_PATH_BLUETOOTH_NO_NR,
+	 VP_PATH_HSANDSPK,
+ 
+	 VP_PATH_OFF = 255,
+ 
+	 MAX_VP_PATH = VP_PATH_OFF
+ } T_ZDrv_VpPath;
  int voice_close(T_Voice_Para *para);
  int voice_open(T_Voice_Para *para);
  int voice_Vploop(int *path);
diff --git a/ap/lib/libvoice/voice.c b/ap/lib/libvoice/voice.c
index 696c2ea..fbc8bf1 100644
--- a/ap/lib/libvoice/voice.c
+++ b/ap/lib/libvoice/voice.c
@@ -22,6 +22,8 @@
 #include <sys/ioctl.h>

 #include <fcntl.h>

 #include <tinyalsa/audio_mixer_ctrl.h>

+#include "voice_lib.h"

+

 

 #define VOICE_DEV_NAME "/dev/voice_device"

 

@@ -216,6 +218,11 @@
 			return 0;

 		}

 	}

+#ifdef _ALSA_CODEC_IN_CAP

+

+		printf("%s: i2s and codec not need config,return!\n",__func__);	

+		return 0;

+#endif

 

 

 	//open mixer dev for codec control

@@ -298,6 +305,10 @@
 			return ;

 		}

 	}

+#ifdef _ALSA_CODEC_IN_CAP

+		printf("%s: i2s and codec not need config,return!\n",__func__); 

+		return ;

+#endif

 

 

 	if (volte_pcm_voice_out) {

diff --git a/ap/lib/libvoice/voice_api.c b/ap/lib/libvoice/voice_api.c
new file mode 100755
index 0000000..e6262fb
--- /dev/null
+++ b/ap/lib/libvoice/voice_api.c
@@ -0,0 +1,423 @@
+/**

+ * @file voice_api.c

+ * @brief Implementation of the public APIs of libvoice.

+ *

+ * Copyright (C) 2023 Sanechips Technology Co., Ltd.

+ * @author 

+ * 

+ * This program is free software; you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License version 2 as

+ * published by the Free Software Foundation. £¨±ØÑ¡£ºGPLv2 Licence£©

+ *

+ */

+

+

+

+#include <stdio.h>

+#include <unistd.h>

+#include <string.h>

+#include <stdlib.h>

+

+#include <stdint.h>

+//#include "volte_drv.h"

+#include <linux/volte_drv.h>

+

+#include <sys/ioctl.h>

+#include <fcntl.h>

+#include <tinyalsa/audio_mixer_ctrl.h>

+#include "voice_lib.h"

+

+#define VOCIE_SND_CARD_NUM 0

+

+

+extern int mix_set_voice_vol(struct mixer *mixer, int volume);

+extern int mix_get_voice_vol(struct mixer *mixer, int *volume);

+extern int mix_set_tx_voice_vol(struct mixer *mixer, int volume);

+extern int mix_get_tx_voice_vol(struct mixer *mixer, int *volume);

+extern int mix_set_voice_mute(struct mixer *mixer, bool enable);

+extern int mix_get_voice_mute(struct mixer *mixer, int *enable);

+extern int mix_set_rx_voice_mute(struct mixer *mixer, bool enable);

+extern int mix_get_rx_voice_mute(struct mixer *mixer, int *enable);

+extern int mix_set_voice_path(struct mixer *mixer, int path);

+extern int mix_set_vp_path(struct mixer *mixer, char path);

+extern int mix_get_vp_path(struct mixer *mixer, int *path);

+extern int mix_get_voice_path(struct mixer *mixer, int *path);

+

+

+	

+#define VOCIE_SND_CARD_NUM 0

+	

+	

+	

+//设置voice音频设备模式 dev_mode:handset,speaker,headset	0 表示成功ï¼?其它表示有错è¯?

+int set_voice_device_mode(int dev_mode)

+{

+

+	struct mixer *voice_mixer = NULL;

+	printf("%s: start dev_mode=%d!\n",__func__, dev_mode);

+

+	if ((dev_mode < T_OUTPUT_HANDSET ) ||(dev_mode >= T_OUTPUT_MAX)){

+		printf("%s: dev_mode not support, dev_mode=%d!\n",__func__, dev_mode);

+		return -1;

+	}

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_set_voice_path(voice_mixer, dev_mode);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;

+

+

+	return 0;

+	

+	

+}

+

+

+

+int sc_audio_set_voice_device_mode(int dev_mode)

+{

+

+	struct mixer *voice_mixer = NULL;

+	printf("%s: start dev_mode=%d!\n",__func__, dev_mode);

+

+	if ((dev_mode < T_OUTPUT_HANDSET ) ||(dev_mode >= T_OUTPUT_MAX)){

+		printf("%s: dev_mode not support, dev_mode=%d!\n",__func__, dev_mode);

+		return -1;

+	}

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+#ifdef _ALSA_CODEC_IN_CAP

+	mix_set_vp_path(voice_mixer,dev_mode);

+

+#else

+	//config mixer dev

+	mix_set_voice_path(voice_mixer, dev_mode);

+#endif

+

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;

+

+

+	return 0;

+	

+	

+}

+

+

+int sc_audio_get_voice_device_mode(int *p_dev_mode)

+{

+	struct mixer *voice_mixer = NULL;

+	printf("%s: start!\n",__func__);

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_get_vp_path(voice_mixer, p_dev_mode);

+

+	

+	if((*p_dev_mode < T_OUTPUT_HANDSET ) ||(*p_dev_mode >= T_OUTPUT_MAX)){

+		printf("%s: dev_mode not support, *p_dev_mode=%d!\n",__func__, *p_dev_mode);

+		//return -1;

+	}

+	printf("%s: start *p_dev_mode=%d!\n",__func__, *p_dev_mode);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;

+

+	return 0;

+	

+}

+

+

+int sc_audio_set_rx_voice_vol(int vol)

+{

+	struct mixer *voice_mixer = NULL;

+	printf("%s: start vol=%d!\n",__func__, vol);

+

+	if ((vol < 0 ) ||(vol > 11)){

+		printf("%s: vol not support, vol=%d!\n",__func__, vol);

+		return -1;

+	}

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_set_voice_vol(voice_mixer, vol);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;

+

+

+	return 0;

+

+

+	

+	

+}

+

+

+

+int sc_audio_get_rx_voice_vol(int     * p_vol)

+{

+	struct mixer *voice_mixer = NULL;

+

+	printf("%s: start!\n",__func__);

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_get_voice_vol(voice_mixer, p_vol);

+	

+

+	if ((*p_vol < 0 ) ||(*p_vol > 11)){

+		printf("%s: vol not support, *p_vol=%d!\n",__func__, *p_vol);

+		//return -1;

+	}

+	printf("%s:  *p_vol=%d!\n",__func__, *p_vol);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;

+

+

+	return 0;

+

+	

+	

+}

+

+

+

+int sc_audio_set_tx_voice_vol(int vol)

+{

+	struct mixer *voice_mixer = NULL;

+	printf("%s: start vol=%d!\n",__func__, vol);

+

+	if ((vol < 0 ) ||(vol > 11)){

+		printf("%s: vol not support, vol=%d!\n",__func__, vol);

+		return -1;

+	}

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_set_tx_voice_vol(voice_mixer, vol);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;

+

+

+	return 0;

+	

+	

+}

+

+

+

+int sc_audio_get_tx_voice_vol(int  *p_vol)

+{

+	struct mixer *voice_mixer = NULL;

+	printf("%s: start!\n",__func__);

+

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_get_tx_voice_vol(voice_mixer, p_vol);

+	

+

+	if((*p_vol < 0 ) ||(*p_vol > 5)){

+		printf("%s: vol not support, *p_vol=%d!\n",__func__, *p_vol);

+		//return -1;

+	}

+	printf("%s:  *p_vol=%d!\n",__func__, *p_vol);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;	

+    return 0;	

+}

+

+

+

+int sc_audio_set_tx_voice_mute_state(int mute         )

+{

+	struct mixer *voice_mixer = NULL;

+	printf("%s: start mute=%d!\n",__func__, mute);

+

+	if((mute != 0 ) &&(mute != 1)) {

+		printf("%s: mute not support, mute=%d!\n",__func__, mute);

+		return -1;

+	}

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_set_voice_mute(voice_mixer, mute);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;

+    return 0;	

+	

+}

+

+int sc_audio_get_tx_voice_mute_state(int *p_mute)

+{

+	struct mixer *voice_mixer = NULL;

+

+	printf("%s: start!\n",__func__);

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_get_voice_mute(voice_mixer, p_mute);

+	

+

+	if((*p_mute != 0 ) &&(*p_mute != 1)) {

+		printf("%s: *p_mute not support, *p_mute=%d!\n",__func__, *p_mute);

+		//close mixer

+	    mixer_close(voice_mixer);

+	    voice_mixer = NULL;	

+		return -1;

+	}

+	printf("%s:  *p_mute=%d!\n",__func__, *p_mute);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;	

+

+    return 0;

+}

+

+

+

+

+

+

+

+int sc_audio_set_rx_voice_mute_state(int mute) 

+{

+	struct mixer *voice_mixer = NULL;

+	printf("%s: start mute=%d!\n",__func__, mute);

+

+	if((mute != 0 ) &&(mute != 1)) {

+		printf("%s: mute not support, mute=%d!\n",__func__, mute);

+		return -1;

+	}

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_set_rx_voice_mute(voice_mixer, mute);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;

+    return 0;	

+	

+}

+

+

+int sc_audio_get_rx_voice_mute_state(int *p_mute){

+	struct mixer *voice_mixer = NULL;

+

+	printf("%s: start!\n",__func__);

+

+	//open mixer dev for  control

+	voice_mixer = mixer_open(VOCIE_SND_CARD_NUM);

+	if (!voice_mixer) {

+		printf("voice_mixer open failed!\n");

+		return -1;

+	}

+

+	//config mixer dev

+	mix_get_rx_voice_mute(voice_mixer, p_mute);

+	

+	if((*p_mute != 0 ) &&(*p_mute != 1)) {

+

+		printf("%s: *p_mute not support, *p_mute=%d!\n",__func__, *p_mute);

+		//close mixer

+	    mixer_close(voice_mixer);

+	    voice_mixer = NULL;

+		return -1;

+	}

+	printf("%s:  *p_mute=%d!\n",__func__, *p_mute);

+

+	//close mixer

+	mixer_close(voice_mixer);

+	voice_mixer = NULL;	

+

+    return 0;

+

+}

+

+int sc_audio_set_loopback_enable_state(int enable)

+{

+    return 0;

+}

+

+int sc_audio_get_loopback_enable_state(int *p_enable)

+{

+    return 0;

+}

+

diff --git a/ap/lib/libvoice/voiceipc.c b/ap/lib/libvoice/voiceipc.c
new file mode 100755
index 0000000..198fe19
--- /dev/null
+++ b/ap/lib/libvoice/voiceipc.c
@@ -0,0 +1,402 @@
+#ifdef USE_CAP_SUPPORT

+#include <stdio.h>

+#include <unistd.h>

+#include <string.h>

+#include <stdlib.h>

+#include <stdint.h>

+#include <sys/ioctl.h>

+#include <fcntl.h>

+#include "voice_ipc.h"

+#include "linux/rpmsg_zx29.h"

+

+extern int sc_audio_set_voice_device_mode(int dev_mode);

+extern int sc_audio_get_voice_device_mode(int *p_dev_mode);

+extern int sc_audio_set_rx_voice_vol(int vol);

+extern int sc_audio_get_rx_voice_vol(int     * p_vol);

+extern int sc_audio_set_tx_voice_vol(int vol);

+extern int sc_audio_get_tx_voice_vol(int  *p_vol);

+extern int sc_audio_set_tx_voice_mute_state(int mute         );

+extern int sc_audio_get_tx_voice_mute_state(int *p_mute);

+extern int sc_audio_set_rx_voice_mute_state(int mute);

+extern int sc_audio_get_rx_voice_mute_state(int *p_mute);

+extern int sc_audio_set_loopback_enable_state(int enable);

+extern int sc_audio_get_loopback_enable_state(int *p_enable);

+

+int voice_ipc_fd = -1;

+voice_ipc_control_msg voice_ctrl_recvmsg[IPC_VOICE_FUNC_MAX] = {0};

+

+void ipc_set_voice_device_mode(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int dev_mode = 0;

+

+    //memcpy(&dev_mode, msg.param, msg.param_len);

+    dev_mode = *((int *)msg.param);

+    ret = sc_audio_set_voice_device_mode(dev_mode);

+

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_get_voice_device_mode(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int *p_dev_mode = NULL;

+

+    p_dev_mode = (int *)msg.param;

+    ret = sc_audio_get_voice_device_mode(p_dev_mode);

+	

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_set_rx_voice_vol(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int vol = 0;

+

+    //memcpy(&dev_mode, msg.param, msg.param_len);

+    vol = *((int *)msg.param);

+    ret = sc_audio_set_rx_voice_vol(vol);

+

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_get_rx_voice_vol(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int *p_vol = NULL;

+

+    p_vol = (int *)msg.param;

+    ret = sc_audio_get_rx_voice_vol(p_vol);

+	

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_set_tx_voice_vol(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int vol = 0;

+

+    //memcpy(&dev_mode, msg.param, msg.param_len);

+    vol = *((int *)msg.param);

+    ret = sc_audio_set_tx_voice_vol(vol);

+

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_get_tx_voice_vol(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int *p_vol = NULL;

+

+    p_vol = (int *)msg.param;

+    ret = sc_audio_get_tx_voice_vol(p_vol);

+	

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_set_tx_voice_mute_state(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int mute = 0;

+

+    //memcpy(&dev_mode, msg.param, msg.param_len);

+    mute = *((int *)msg.param);

+    ret = sc_audio_set_tx_voice_mute_state(mute);

+

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_get_tx_voice_mute_state(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int *p_mute = NULL;

+

+    p_mute = (int *)msg.param;

+    ret = sc_audio_get_tx_voice_mute_state(p_mute);

+	

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_set_rx_voice_mute_state(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int mute = 0;

+

+    //memcpy(&dev_mode, msg.param, msg.param_len);

+    mute = *((int *)msg.param);

+    ret = sc_audio_set_rx_voice_mute_state(mute);

+

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_get_rx_voice_mute_state(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int *p_mute = NULL;

+

+    p_mute = (int *)msg.param;

+    ret = sc_audio_get_rx_voice_mute_state(p_mute);

+	

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_set_loopback_enable_state(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int enable = 0;

+

+    //memcpy(&dev_mode, msg.param, msg.param_len);

+    enable = *((int *)msg.param);

+    ret = sc_audio_set_loopback_enable_state(enable);

+

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void ipc_get_loopback_enable_state(voice_ipc_control_msg msg)

+{

+    int ret = VOICEIPC_OK;

+    int msg_len = 0;

+    int *p_enable = NULL;

+

+    p_enable = (int *)msg.param;

+    ret = sc_audio_get_loopback_enable_state(p_enable);

+	

+    //msg.func_id不变

+    msg.param_len = sizeof(int);

+    memcpy(msg.param, &ret, msg.param_len);

+    msg_len = VOICE_HEAD_LEN + msg.param_len;

+

+    ret = write(voice_ipc_fd, &msg, msg_len);

+    

+    if (0 >= ret){

+		printf("%s: write error(%d)!\n", __func__, ret);

+	}

+}

+

+void voice_msg_proc(voice_ipc_control_msg msg)

+{

+	switch(msg.func_id){

+		case IPC_SET_VOICE_DEVICE_MODE:

+			ipc_set_voice_device_mode(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+		case IPC_GET_VOICE_DEVICE_MODE:

+			ipc_get_voice_device_mode(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_SET_RX_VOICE_VOL:

+			ipc_set_rx_voice_vol(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_GET_RX_VOICE_VOL:

+			ipc_get_rx_voice_vol(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_SET_TX_VOICE_VOL:

+			ipc_set_tx_voice_vol(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_GET_TX_VOICE_VOL:

+			ipc_get_tx_voice_vol(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_SET_TX_VOICE_MUTE_STATE:

+			ipc_set_tx_voice_mute_state(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_GET_TX_VOICE_MUTE_STATE:

+			ipc_get_tx_voice_mute_state(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_SET_RX_VOICE_MUTE_STATE:

+			ipc_set_rx_voice_mute_state(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_GET_RX_VOICE_MUTE_STATE:

+			ipc_get_rx_voice_mute_state(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_SET_LOOPBACK_ENABLE_STATE:

+			ipc_set_loopback_enable_state(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+        case IPC_GET_LOOPBACK_ENABLE_STATE:

+			ipc_get_loopback_enable_state(voice_ctrl_recvmsg[msg.func_id]);

+			break;

+		default:

+			printf("%s: msg func_id(%d) error\n", __func__, msg.func_id);

+			break;

+	}

+}

+

+void Voice_Ctrl_Rpmsg_Recv(void)

+{

+    int read_len = 0;

+    voice_ipc_control_msg tmpbuf = {0};

+    

+    for(;;){

+        read_len = 0;

+		read_len = read(voice_ipc_fd, &tmpbuf, (VOICE_HEAD_LEN + VOICE_CONTROL_MAX_LEN));

+        if (0 >= read_len){

+			continue;

+		}

+

+        //最后再改变func_id,确保其他地方判断func_id改变后有数据可读

+        memcpy(voice_ctrl_recvmsg[tmpbuf.func_id].param, tmpbuf.param, tmpbuf.param_len);

+        voice_ctrl_recvmsg[tmpbuf.func_id].param_len = tmpbuf.param_len;

+        voice_ctrl_recvmsg[tmpbuf.func_id].func_id = tmpbuf.func_id;

+        

+        voice_msg_proc(voice_ctrl_recvmsg[tmpbuf.func_id]);

+    }

+}

+

+int voice_ipc_init(void) //通道初始化

+{

+    voice_ipc_fd = open(VOICE_IPC_CONTROL_CHANNEL, O_RDWR);

+

+    if(0 > voice_ipc_fd){

+        printf("%s: open the channel(%s) error!\n", __func__, VOICE_IPC_CONTROL_CHANNEL);

+        return VOICEIPC_ERROR;

+    }

+

+    if(0 > ioctl(voice_ipc_fd, RPMSG_CREATE_CHANNEL, VOICE_IPC_CONTROL_CHANNEL_SIZE)){

+        printf("%s: ioctl RPMSG_CREATE_CHANNEL fail!\n", __func__);

+        close(voice_ipc_fd);

+        voice_ipc_fd = -1;

+        return VOICEIPC_ERROR;

+    }

+    

+    if(0 > ioctl(voice_ipc_fd, RPMSG_SET_INT_FLAG, NULL)){ //写中断

+        printf("%s: ioctl RPMSG_SET_INT_FLAG fail!\n", __func__);

+        close(voice_ipc_fd);

+        voice_ipc_fd = -1;

+        return VOICEIPC_ERROR;

+    }

+    

+    if(0 > ioctl(voice_ipc_fd, RPMSG_CLEAR_POLL_FLAG, NULL)){ //阻塞方式读数据

+        printf("%s: ioctl RPMSG_CLEAR_POLL_FLAG fail!\n", __func__);

+        close(voice_ipc_fd);

+        voice_ipc_fd = -1;

+        return VOICEIPC_ERROR;

+    }

+    return VOICEIPC_OK;

+}

+

+int main(int argc, char **argv)

+{

+    int ret = 0;

+    

+    ret = voice_ipc_init();

+    

+    if(ret < 0){

+        printf("voice_ipc_init error!\n");

+        return -1;

+    }

+

+    printf("voice_ipc_init %s create success!\n", VOICE_IPC_CONTROL_CHANNEL);

+    

+    Voice_Ctrl_Rpmsg_Recv();

+    

+    return 0;

+}

+

+#endif

diff --git a/ap/lib/libvsim/ght_vsim_api.c b/ap/lib/libvsim/ght_vsim_api.c
index 5d2647f..12a5afa 100755
--- a/ap/lib/libvsim/ght_vsim_api.c
+++ b/ap/lib/libvsim/ght_vsim_api.c
@@ -10,8 +10,10 @@
 extern int32_t zte_mdm_event_regist(zte_mdm_event_ind_callback ind_cb);

 

 extern int32_t zte_atVsimInit(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID);

+extern int32_t zte_atSoftSimInit(SoftSim_COMMAND softssim_apdu_process_fn, uint8_t nSimID);

 

 extern int32_t zte_atVsimClose(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID);

+extern int32_t zte_atSoftSimClose(SoftSim_COMMAND softssim_apdu_process_fn, uint8_t nSimID);

 

 extern int32_t zte_atVsimReset(void);

 

@@ -96,6 +98,12 @@
 	zte_mdm_event_regist(fibo_mdm_event_ind_cb);

     zte_atVsimInit(vsim_apdu_process, nSimID);

 }

+void fibo_SoftSim_init(SoftSim_COMMAND softsim_apdu_process, uint8_t nSimID)

+{

+    printf("[VSIM] fibo_SoftSim_init,%d", nSimID);

+	zte_mdm_event_regist(fibo_mdm_event_ind_cb);

+    zte_atSoftSimInit(softsim_apdu_process, nSimID);

+}

 

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

 ** Function Name: fibo_vsim_close

@@ -109,6 +117,11 @@
     printf("[VSIM] fibo_vsim_close,%d", nSimID);

     zte_atVsimClose(vsim_apdu_process, nSimID);

 }

+void fibo_SoftSim_close(SoftSim_COMMAND softsim_apdu_process, uint8_t nSimID)

+{

+    printf("[VSIM] fibo_SoftSim_close,%d", nSimID);

+    zte_atSoftSimClose(softsim_apdu_process, nSimID);

+}

 

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

 ** Function Name: fibo_set_sim_workmode

diff --git a/ap/lib/libvsim/ght_vsim_api.h b/ap/lib/libvsim/ght_vsim_api.h
index 685794d..b381421 100755
--- a/ap/lib/libvsim/ght_vsim_api.h
+++ b/ap/lib/libvsim/ght_vsim_api.h
@@ -247,7 +247,7 @@
 *********************************************************************/

 

 typedef int (*VSIM_COMMAND)(uint8_t *apdu_req, uint16_t apdu_req_len,uint8_t *apdu_rsp, uint16_t *apdu_rsp_len, uint8_t slot);

-

+typedef int (*SoftSim_COMMAND)(uint8_t *apdu_req, uint16_t apdu_req_len,uint8_t *apdu_rsp, uint16_t *apdu_rsp_len, uint8_t slot);

 

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

 ** Ãû³Æ£º FIBO_MODEM_EVENT

@@ -282,6 +282,7 @@
 **************************************************************************/

 

 extern void fibo_vsim_init(VSIM_COMMAND vsim_apdu_process, uint8_t nSimID);

+extern void fibo_SoftSim_init(SoftSim_COMMAND softsim_apdu_process, uint8_t nSimID);

 

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

 ** Function Name: fibo_vsim_close

@@ -293,6 +294,7 @@
 ***********************************************************/

 

 extern void fibo_vsim_close(VSIM_COMMAND vsim_apdu_process, uint8_t nSimID);

+extern void fibo_SoftSim_close(SoftSim_COMMAND softsim_apdu_process, uint8_t nSimID);

 

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

 ** Function Name: fibo_set_dualsim

diff --git a/ap/lib/libvsim/libvsim.c b/ap/lib/libvsim/libvsim.c
index 22067cd..e0f275b 100755
--- a/ap/lib/libvsim/libvsim.c
+++ b/ap/lib/libvsim/libvsim.c
@@ -37,7 +37,9 @@
 int g_read_thread_state = -1;
 int g_msg_thread_state = -1;
 VSIM_COMMAND g_vsim_apdu_process_cb;
+SoftSim_COMMAND g_softsim_apdu_process_cb;
 zte_mdm_event_ind_callback g_vsim_event_ind_cb;
+unsigned char g_vsim_slot[2];
 
 int32_t zte_mdm_event_ind_cb(E_MODEM_EVENT_ID event_id, void *ind_data, uint32_t  ind_data_len)
 {
@@ -125,7 +127,7 @@
 static void read_thread_entry(void *arg)
 {
 	prctl(PR_SET_NAME, "vsim_read", 0, 0, 0);
-	while(g_vsim_apdu_process_cb)
+	while(g_vsim_event_ind_cb)
 	{
 		VSIM_MSG_BUF msg_in = {0};
 		VSIM_MSG_BUF msg_out = {0};
@@ -150,8 +152,14 @@
 			vsim_set(MSG_CMD_VSIM_SET_STANDBY,0);
 		}
 		msg_in.usDataLen = sizeof(msg_in.aucDataBuf);
-		ret = g_vsim_apdu_process_cb(&msg_out.aucDataBuf[2], msg_out.usDataLen, msg_in.aucDataBuf, 
-		&msg_in.usDataLen, msg_out.aucDataBuf[0]);
+		if(g_vsim_apdu_process_cb && msg_out.aucDataBuf[0] < 2 && g_vsim_slot[msg_out.aucDataBuf[0]] == 1){
+			ret = g_vsim_apdu_process_cb(&msg_out.aucDataBuf[2], msg_out.usDataLen, msg_in.aucDataBuf, 
+			&msg_in.usDataLen, msg_out.aucDataBuf[0]);
+		}
+		if(g_softsim_apdu_process_cb && msg_out.aucDataBuf[0] < 2 && g_vsim_slot[msg_out.aucDataBuf[0]] == 2){
+			ret = g_softsim_apdu_process_cb(&msg_out.aucDataBuf[2], msg_out.usDataLen, msg_in.aucDataBuf, 
+			&msg_in.usDataLen, msg_out.aucDataBuf[0]);
+		}
 		vsim_debug_printf("##vsim## g_vsim_apdu_process_cb ret=0x%x len=%d\n", ret, msg_in.usDataLen);
 		//ÇÐÐéÄ⿨
 		if(is_auth){
@@ -214,7 +222,11 @@
 					char imei[]="862769025435956";
 					fibo_set_IMEI_by_simid(imei,sizeof(imei),1);
 					fibo_mdm_event_regist(zte_mdm_event_ind_cb);
-					fibo_vsim_init(zte_vsim_ind_cb,1);
+					vsim_set(MSG_CMD_VSIM_SET_STANDBY,1);
+					vsim_card_switch_req(1);
+					vsim_set(MSG_CMD_VSIM_SET_SWITCH,1);
+					get_modem_info("AT+CFUN=1\r\n", NULL, NULL);
+					g_vsim_slot[1] = 1;
 				}
 				if(stMsg.aucDataBuf[0] == 2){
 					fibo_vsim_close(zte_vsim_ind_cb,1);
@@ -246,9 +258,13 @@
 
 int32_t zte_atVsimInit(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID)
 {
+	char stat[4] = {0};
+	
+	sc_cfg_get("vsim_stat",stat,sizeof(stat));
 	vsim_debug_printf("##vsim## [%s] start\n", __FUNCTION__);
-	if(vsim_apdu_process_fn == NULL || nSimID != 1){
-		printf("##vsim## init param err fn=0x%x sim=%d\n", vsim_apdu_process_fn, nSimID);
+	if(vsim_apdu_process_fn == NULL || nSimID != 1 || g_vsim_apdu_process_cb || atoi(stat)){
+		printf("##vsim## init param err fn=0x%x old=0x%x sim=%d stat=%d\n", 
+			vsim_apdu_process_fn, g_vsim_apdu_process_cb, nSimID, atoi(stat));
 		return -1;
 	}
 	g_vsim_apdu_process_cb = vsim_apdu_process_fn;
@@ -260,23 +276,113 @@
 		printf("##vsim## init fail read=%d msg=%d\n", g_read_thread_state, g_msg_thread_state);
 		return -1;
 	}
+	g_vsim_slot[1] = 1;
+	sc_cfg_set("vsim_stat","1");
 	vsim_set(MSG_CMD_VSIM_SET_STANDBY,1);//´ËÊ±ÔÆ¿¨Î´½¨ÍøÂçÁ´½Ó£¬ÏÈÇÐÊý¾ÝÔÙÇÐÍø
 	vsim_card_switch_req(1);
 	vsim_set(MSG_CMD_VSIM_SET_SWITCH,1);
+	get_modem_info("AT+ZCARDSWITCH=1,1\r\n", NULL, NULL);
 	get_modem_info("AT+CFUN=1\r\n", NULL, NULL);
 	return 0;
 }
 
-int32_t zte_atVsimClose(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID)
+int32_t zte_atSoftSimInit(SoftSim_COMMAND softssim_apdu_process_fn, uint8_t nSimID)
+{
+	char stat[4] = {0};
+	
+	sc_cfg_get("softsim_stat",stat,sizeof(stat));
+	vsim_debug_printf("##vsim## [%s] start\n", __FUNCTION__);
+	if(softssim_apdu_process_fn == NULL || (nSimID != 1 && nSimID != 0) || g_softsim_apdu_process_cb || atoi(stat)){
+		printf("##vsim## soft init param err fn=0x%x old=0x%x sim=%d\n", 
+			softssim_apdu_process_fn, g_softsim_apdu_process_cb, nSimID, atoi(stat));
+		return -1;
+	}
+	g_vsim_slot[nSimID] = 2;
+	sc_cfg_set("softsim_stat","1");
+	g_softsim_apdu_process_cb = softssim_apdu_process_fn;
+	if(nSimID){
+		vsim_set(MSG_CMD_VSIM_SET_STANDBY,1);//´ËÊ±ÔÆ¿¨Î´½¨ÍøÂçÁ´½Ó£¬ÏÈÇÐÊý¾ÝÔÙÇÐÍø
+		vsim_card_switch_req(1);
+		vsim_set(MSG_CMD_VSIM_SET_SWITCH,1);
+		get_modem_info("AT+ZCARDSWITCH=2,1\r\n", NULL, NULL);
+		get_modem_info("AT+CFUN=1\r\n", NULL, NULL);
+	}else{
+		uint8_t sim = 0;
+		uint8_t ret = 0;
+		zte_GetGTDUALSIM(&sim);
+		if(sim != nSimID)
+			zte_SetGTDUALSIM(nSimID);
+		ret = vsim_get_cardstat_fromps();
+		if(ret >= 0 && nSimID != ret)
+			vsim_card_switch_req(nSimID);
+		get_modem_info("AT+CFUN=0\r\n", NULL, NULL);
+		get_modem_info("AT+CFUN=5\r\n", NULL, NULL);
+		get_modem_info("AT+ZCARDSWITCH=2,0\r\n", NULL, NULL);
+		get_modem_info("AT+CFUN=1\r\n", NULL, NULL);
+		if(sim != nSimID)
+			zte_SetGTDUALSIM(sim);
+		if(ret >= 0 && nSimID != ret)
+			vsim_card_switch_req(ret);
+	}
+	return 0;
+}
+
+int32_t zte_atSoftSimClose(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID)
 {
 	vsim_debug_printf("##vsim## [%s] start\n", __FUNCTION__);
+	if(nSimID != 1 && nSimID != 0){
+		printf("##vsim## soft close param err sim=%d\n", nSimID);
+		return -1;
+	}
+	if(nSimID){
+		zte_SetGTDATASIM(1);
+		get_modem_info("AT+CFUN=0\r\n", NULL, NULL);
+		vsim_card_switch_req(0);
+		zte_SetGTDUALSIM(0);
+		vsim_set(MSG_CMD_VSIM_RESET_FLOW_STATISTIC,1);
+	}else{
+		uint8_t sim = 0;
+		uint8_t ret = 0;
+		zte_GetGTDUALSIM(&sim);
+		if(sim != nSimID)
+			zte_SetGTDUALSIM(nSimID);
+		ret = vsim_get_cardstat_fromps();
+		if(ret >= 0 && nSimID != ret)
+			vsim_card_switch_req(nSimID);
+		get_modem_info("AT+CFUN=0\r\n", NULL, NULL);
+		get_modem_info("AT+CFUN=5\r\n", NULL, NULL);
+		get_modem_info("AT+ZCARDSWITCH=0,0\r\n", NULL, NULL);
+		get_modem_info("AT+CFUN=1\r\n", NULL, NULL);
+		if(sim != nSimID)
+			zte_SetGTDUALSIM(sim);
+		if(ret >= 0 && nSimID != ret)
+			vsim_card_switch_req(ret);
+	}
+	g_vsim_apdu_process_cb = NULL;
+	g_vsim_slot[nSimID] = 0;
+	sc_cfg_set("softsim_stat","0");
+	return 0;
+}
+
+int32_t zte_atVsimClose(SoftSim_COMMAND softssim_apdu_process_fn, uint8_t nSimID)
+{
+	vsim_debug_printf("##vsim## [%s] start\n", __FUNCTION__);
+	if(nSimID != 1 && nSimID != 0){
+		printf("##vsim## close param err sim=%d\n", nSimID);
+		return -1;
+	}
 	zte_SetGTDATASIM(1);
 	get_modem_info("AT+CFUN=0\r\n", NULL, NULL);
 	vsim_card_switch_req(0);
 	zte_SetGTDUALSIM(0);
+	vsim_set(MSG_CMD_VSIM_RESET_FLOW_STATISTIC,1);
+	g_vsim_apdu_process_cb = NULL;
+	g_vsim_slot[1] = 0;
+	sc_cfg_set("vsim_stat","0");
 	return 0;
 }
 
+
 int32_t zte_SetGTDATASIM(uint8_t nSimID)
 {
 	int ret = 0;
diff --git a/ap/lib/libvsim/zte_vsim_api.h b/ap/lib/libvsim/zte_vsim_api.h
index 1552449..c3821dd 100755
--- a/ap/lib/libvsim/zte_vsim_api.h
+++ b/ap/lib/libvsim/zte_vsim_api.h
@@ -236,7 +236,7 @@
 *********************************************************************/

 

 typedef int (*VSIM_COMMAND)(uint8_t *apdu_req, uint16_t apdu_req_len,uint8_t *apdu_rsp, uint16_t *apdu_rsp_len, uint8_t slot);

-

+typedef int (*SoftSim_COMMAND)(uint8_t *apdu_req, uint16_t apdu_req_len,uint8_t *apdu_rsp, uint16_t *apdu_rsp_len, uint8_t slot);

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

 ** Ãû³Æ£º zte_mdm_event_ind_callback

 ** ÃèÊö£º ÏûϢʼþ֪ͨº¯ÊýµÄ½á¹¹¶¨Òå

diff --git a/ap/lib/libwlan_interface/broadcom_interface.c b/ap/lib/libwlan_interface/broadcom_interface.c
index 76492f3..2947c17 100755
--- a/ap/lib/libwlan_interface/broadcom_interface.c
+++ b/ap/lib/libwlan_interface/broadcom_interface.c
@@ -273,11 +273,11 @@
 	

     if(authMode != NULL && encrypType != NULL)

     {  

-        printf("zte_wlan_ssid1_security_set authMode = [%s]\n", authMode);

-		printf("zte_wlan_ssid1_security_set encrypType = [%s]\n", encrypType);   

+        printf("wlan_ssid1_security_set authMode = [%s]\n", authMode);

+		printf("wlan_ssid1_security_set encrypType = [%s]\n", encrypType);   

 		if(NULL == password && (!(!strcmp(authMode, WF_AU_OPEN) && !strcmp(encrypType, WF_ENCRY_NONE))))

 		{

-			printf("zte_wlan_ssid1_security_set password is null\n");

+			printf("wlan_ssid1_security_set password is null\n");

 			return -1;

 		}

 		

@@ -290,7 +290,7 @@
 				len = strlen(password);

 				if(len != 5 || len != 10 || len != 13 || len != 26)

 				{

-					printf("zte_wlan_ssid1_security_set wep psk len = [%s]\n", len);  

+					printf("wlan_ssid1_security_set wep psk len = [%s]\n", len);  

 					return -1;

 				}

 				

@@ -310,7 +310,7 @@
 						}

 						else

 						{

-							printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+							printf("wlan_ssid1_security_set wep psk is same\n");  

 							return 1;

 						}

 					}

@@ -325,7 +325,7 @@
 						}

 						else

 						{

-							printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+							printf("wlan_ssid1_security_set wep psk is same\n");  

 							return 1;

 						}

 					}

@@ -340,7 +340,7 @@
 						}

 						else

 						{

-							printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+							printf("wlan_ssid1_security_set wep psk is same\n");  

 							return 1;

 						}

 					}

@@ -355,7 +355,7 @@
 						}

 						else

 						{

-							printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+							printf("wlan_ssid1_security_set wep psk is same\n");  

 							return 1;

 						}

 					}

@@ -489,8 +489,8 @@
 		

 		if(authMode != NULL && encrypType != NULL)

 		{  

-			printf("zte_wlan_ssid1_security_get authMode = [%s]\n", authMode);   

-			printf("zte_wlan_ssid1_security_get encrypType = [%s]\n", encrypType);   

+			printf("wlan_ssid1_security_get authMode = [%s]\n", authMode);   

+			printf("wlan_ssid1_security_get encrypType = [%s]\n", encrypType);   

 

 			if((!strcmp(authMode, WF_AU_OPEN))  || (!strcmp(authMode, WF_AU_SHARE)) ||  (!strcmp(authMode, WF_AU_WEPAUTO)))

 			{   

@@ -605,13 +605,13 @@
 	ret_for_basic = zte_wlan_ssid1_basic_set(ssid);

     if(-1 == ret_for_basic)

     {

-        printf("zte_wlan_ssid1_basic_set is false\n");

+        printf("wlan_ssid1_basic_set is false\n");

         return -1;

     }

 	ret_for_security = zte_wlan_ssid1_security_set(password);

     if(-1 == ret_for_security)

     {

-        printf("call zte_lan_ssid1_security_set failure .\n");   

+        printf("call lan_ssid1_security_set failure .\n");   

         return -1;

     }

 	

@@ -624,7 +624,7 @@
 		}

 		else

 		{

-			printf("wifi set cmd zte_wlan_ssid1_set error!\n");

+			printf("wifi set cmd wlan_ssid1_set error!\n");

 			return -1;

 		}

     }

diff --git a/ap/lib/libwlan_interface/esp8089_interface.c b/ap/lib/libwlan_interface/esp8089_interface.c
index efa60d6..7677606 100755
--- a/ap/lib/libwlan_interface/esp8089_interface.c
+++ b/ap/lib/libwlan_interface/esp8089_interface.c
@@ -81,11 +81,11 @@
 

     if (authMode != NULL && encrypType != NULL)

     {  

-        printf("zte_wlan_ssid1_security_set authMode = [%s]\n", authMode);

-		printf("zte_wlan_ssid1_security_set encrypType = [%s]\n", encrypType);   

+        printf("wlan_ssid1_security_set authMode = [%s]\n", authMode);

+		printf("wlan_ssid1_security_set encrypType = [%s]\n", encrypType);   

 		if(NULL == password)//&& (!(!strcmp(authMode, WF_AU_OPEN) && !strcmp(encrypType, WF_ENCRY_NONE))))

 		{

-			printf("zte_wlan_ssid1_security_set password is null\n");

+			printf("wlan_ssid1_security_set password is null\n");

 			return -1;

 		}

 

@@ -132,7 +132,7 @@
 				len = strlen(password);

 				if(len != 5 || len != 10 || len != 13 || len != 26)

 				{

-					printf("zte_wlan_ssid1_security_set wep psk len = [%s]\n", len);  

+					printf("wlan_ssid1_security_set wep psk len = [%s]\n", len);  

 					return -1;

 				}

 				sc_cfg_get("DefaultKeyID",DefaultKeyID,sizeof(DefaultKeyID));

@@ -150,7 +150,7 @@
 						}

 						else

 						{

-							printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+							printf("wlan_ssid1_security_set wep psk is same\n");  

 							return 1;

 						}

 					}

@@ -165,7 +165,7 @@
 						}

 						else

 						{

-							printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+							printf("wlan_ssid1_security_set wep psk is same\n");  

 							return 1;

 						}

 					}

@@ -179,7 +179,7 @@
 						}

 						else

 						{

-							printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+							printf("wlan_ssid1_security_set wep psk is same\n");  

 							return 1;

 						}

 					}

@@ -193,7 +193,7 @@
 						}

 						else

 						{

-							printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+							printf("wlan_ssid1_security_set wep psk is same\n");  

 							return 1;

 						}

 					}

@@ -335,8 +335,8 @@
 		

 		if(authMode != NULL && encrypType != NULL)

 		{  

-			printf("zte_wlan_ssid1_security_get authMode = [%s]\n", authMode);   

-			printf("zte_wlan_ssid1_security_get encrypType = [%s]\n", encrypType);   

+			printf("wlan_ssid1_security_get authMode = [%s]\n", authMode);   

+			printf("wlan_ssid1_security_get encrypType = [%s]\n", encrypType);   

 

 			if((!strcmp(authMode, WF_AU_OPEN))  || (!strcmp(authMode, WF_AU_SHARE)) ||  (!strcmp(authMode, WF_AU_WEPAUTO)))

 			{   

@@ -451,13 +451,13 @@
 	ret_for_basic = zte_wlan_ssid1_basic_set(ssid);

     if(-1 == ret_for_basic)

     {

-        printf("zte_wlan_ssid1_basic_set is false\n");

+        printf("wlan_ssid1_basic_set is false\n");

         return -1;

     }

 	ret_for_security = zte_wlan_ssid1_security_set(password);

     if(-1 == ret_for_security)

     {

-        printf("call zte_lan_ssid1_security_set failure .\n");   

+        printf("call lan_ssid1_security_set failure .\n");   

     }

 	if(ret_for_basic == -1 && ret_for_security == -1)

 	{ 

@@ -473,7 +473,7 @@
 		}

 		else

 		{

-			printf("wifi set cmd zte_wlan_ssid1_set error!\n");

+			printf("wifi set cmd wlan_ssid1_set error!\n");

 			return -1;

 		}

     }

diff --git a/ap/lib/libwlan_interface/hostapd_interface.c b/ap/lib/libwlan_interface/hostapd_interface.c
index 6c6e3d2..c2958a1 100644
--- a/ap/lib/libwlan_interface/hostapd_interface.c
+++ b/ap/lib/libwlan_interface/hostapd_interface.c
@@ -80,11 +80,11 @@
 	sc_cfg_get("EncrypType", encrypType, sizeof(encrypType));

 

 	//kw 3  

-    printf("zte_wlan_ssid1_security_set authMode = [%s]\n", authMode);

-	printf("zte_wlan_ssid1_security_set encrypType = [%s]\n", encrypType);   

+    printf("wlan_ssid1_security_set authMode = [%s]\n", authMode);

+	printf("wlan_ssid1_security_set encrypType = [%s]\n", encrypType);   

 	if(NULL == password)//&& (!(!strcmp(authMode, WF_AU_OPEN) && !strcmp(encrypType, WF_ENCRY_NONE))))

 	{

-		printf("zte_wlan_ssid1_security_set password is null\n");

+		printf("wlan_ssid1_security_set password is null\n");

 		return -1;

 	}

 #if 0 //kw 3

@@ -131,7 +131,7 @@
 			len = strlen(password);

 			if(len != 5 && len != 10 && len != 13 && len != 26) //kw 3 ;wep 5,13(no 16)

 			{

-				printf("zte_wlan_ssid1_security_set wep psk len = [%d]\n", len);  

+				printf("wlan_ssid1_security_set wep psk len = [%d]\n", len);  

 				return -1;

 			}

 			sc_cfg_get("DefaultKeyID",DefaultKeyID,sizeof(DefaultKeyID));

@@ -148,7 +148,7 @@
 				}

 				else

 				{

-					printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+					printf("wlan_ssid1_security_set wep psk is same\n");  

 					return 1;

 				}

 			}

@@ -163,7 +163,7 @@
 				}

 				else

 				{

-					printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+					printf("wlan_ssid1_security_set wep psk is same\n");  

 					return 1;

 				}

 			}

@@ -177,7 +177,7 @@
 				}

 				else

 				{

-					printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+					printf("wlan_ssid1_security_set wep psk is same\n");  

 					return 1;

 				}

 			}

@@ -191,7 +191,7 @@
 				}

 				else

 				{

-					printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+					printf("wlan_ssid1_security_set wep psk is same\n");  

 					return 1;

 				}

 			}

@@ -296,8 +296,8 @@
 	sc_cfg_get("AuthMode",authMode,sizeof(authMode));

 	sc_cfg_get("EncrypType",encrypType,sizeof(encrypType));

 

-	printf("zte_wlan_ssid1_security_get authMode = [%s]\n", authMode);   

-	printf("zte_wlan_ssid1_security_get encrypType = [%s]\n", encrypType);   

+	printf("wlan_ssid1_security_get authMode = [%s]\n", authMode);   

+	printf("wlan_ssid1_security_get encrypType = [%s]\n", encrypType);   

 

 	if((!strcmp(authMode, WF_AU_OPEN))  || (!strcmp(authMode, WF_AU_SHARE)) ||  (!strcmp(authMode, WF_AU_WEPAUTO)))

 	{   

@@ -358,13 +358,13 @@
 	ret_for_basic = zte_wlan_ssid1_basic_set(ssid);

     if(-1 == ret_for_basic)

     {

-        printf("zte_wlan_ssid1_basic_set is false\n");

+        printf("wlan_ssid1_basic_set is false\n");

         return -1;

     }

 	ret_for_security = zte_wlan_ssid1_security_set(password);

     if(-1 == ret_for_security)

     {

-        printf("call zte_lan_ssid1_security_set failure .\n");   

+        printf("call lan_ssid1_security_set failure .\n");   

 		return -1;//kw 3

 	}

 	

@@ -377,7 +377,7 @@
 		}

 		else

 		{

-			printf("wifi set cmd zte_wlan_ssid1_set error!\n");

+			printf("wifi set cmd wlan_ssid1_set error!\n");

 			return -1;

 		}

     }

diff --git a/ap/lib/libwlan_interface/realtek_interface.c b/ap/lib/libwlan_interface/realtek_interface.c
index e1725d7..ec79bf3 100755
--- a/ap/lib/libwlan_interface/realtek_interface.c
+++ b/ap/lib/libwlan_interface/realtek_interface.c
@@ -82,11 +82,11 @@
 	sc_cfg_get("EncrypType", encrypType, sizeof(encrypType));

 

 	//kw 3  

-    printf("zte_wlan_ssid1_security_set authMode = [%s]\n", authMode);

-	printf("zte_wlan_ssid1_security_set encrypType = [%s]\n", encrypType);   

+    printf("wlan_ssid1_security_set authMode = [%s]\n", authMode);

+	printf("wlan_ssid1_security_set encrypType = [%s]\n", encrypType);   

 	if(NULL == password)//&& (!(!strcmp(authMode, WF_AU_OPEN) && !strcmp(encrypType, WF_ENCRY_NONE))))

 	{

-		printf("zte_wlan_ssid1_security_set password is null\n");

+		printf("wlan_ssid1_security_set password is null\n");

 		return -1;

 	}

 #if 0 //kw 3

@@ -133,7 +133,7 @@
 			len = strlen(password);

 			if(len != 5 && len != 10 && len != 13 && len != 26) //kw 3 ;wep 5,13(no 16)

 			{

-				printf("zte_wlan_ssid1_security_set wep psk len = [%d]\n", len);  

+				printf("wlan_ssid1_security_set wep psk len = [%d]\n", len);  

 				return -1;

 			}

 			sc_cfg_get("DefaultKeyID",DefaultKeyID,sizeof(DefaultKeyID));

@@ -150,7 +150,7 @@
 				}

 				else

 				{

-					printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+					printf("wlan_ssid1_security_set wep psk is same\n");  

 					return 1;

 				}

 			}

@@ -165,7 +165,7 @@
 				}

 				else

 				{

-					printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+					printf("wlan_ssid1_security_set wep psk is same\n");  

 					return 1;

 				}

 			}

@@ -179,7 +179,7 @@
 				}

 				else

 				{

-					printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+					printf("wlan_ssid1_security_set wep psk is same\n");  

 					return 1;

 				}

 			}

@@ -193,7 +193,7 @@
 				}

 				else

 				{

-					printf("zte_wlan_ssid1_security_set wep psk is same\n");  

+					printf("wlan_ssid1_security_set wep psk is same\n");  

 					return 1;

 				}

 			}

@@ -298,8 +298,8 @@
 	sc_cfg_get("AuthMode",authMode,sizeof(authMode));

 	sc_cfg_get("EncrypType",encrypType,sizeof(encrypType));

 

-	printf("zte_wlan_ssid1_security_get authMode = [%s]\n", authMode);   

-	printf("zte_wlan_ssid1_security_get encrypType = [%s]\n", encrypType);   

+	printf("wlan_ssid1_security_get authMode = [%s]\n", authMode);   

+	printf("wlan_ssid1_security_get encrypType = [%s]\n", encrypType);   

 

 	if((!strcmp(authMode, WF_AU_OPEN))  || (!strcmp(authMode, WF_AU_SHARE)) ||  (!strcmp(authMode, WF_AU_WEPAUTO)))

 	{   

@@ -360,13 +360,13 @@
 	ret_for_basic = zte_wlan_ssid1_basic_set(ssid);

     if(-1 == ret_for_basic)

     {

-        printf("zte_wlan_ssid1_basic_set is false\n");

+        printf("wlan_ssid1_basic_set is false\n");

         return -1;

     }

 	ret_for_security = zte_wlan_ssid1_security_set(password);

     if(-1 == ret_for_security)

     {

-        printf("call zte_lan_ssid1_security_set failure .\n");   

+        printf("call lan_ssid1_security_set failure .\n");   

 		return -1;//kw 3

 	}

 	

@@ -379,7 +379,7 @@
 		}

 		else

 		{

-			printf("wifi set cmd zte_wlan_ssid1_set error!\n");

+			printf("wifi set cmd wlan_ssid1_set error!\n");

 			return -1;

 		}

     }

@@ -665,26 +665,26 @@
 	fp = fopen("/tmp/stalist1", "r");

 	if(NULL == fp)	  

 	{		

-		printf("[zte_get_sta_info_to_file]can not open file /tmp/stalist1.");  

+		printf("[get_sta_info_to_file]can not open file /tmp/stalist1.");  

 		goto END;

 	} 

 	if((tmp_fp1 = fopen("/tmp/maclist", "w+")) == NULL){

-		printf("[zte_get_sta_info_to_file]  can not  open /tmp/maclist\n");

+		printf("[get_sta_info_to_file]  can not  open /tmp/maclist\n");

 		goto END;

 

 	}

 	if((tmp_fp2 = fopen("/tmp/expiredtime", "w+")) == NULL){

-		printf("[zte_get_sta_info_to_file]  can not  open /tmp/expiredtime\n");

+		printf("[get_sta_info_to_file]  can not  open /tmp/expiredtime\n");

 		goto END;

 

 	}

 	if((tmp_fp3 = fopen("/tmp/statelist", "w+")) == NULL)	{

-		printf("[zte_get_sta_info_to_file]  can not  open /tmp/statelist\n");

+		printf("[get_sta_info_to_file]  can not  open /tmp/statelist\n");

 		goto END;

 

 	}

 	if((tmp_fp4 = fopen("/tmp/timelist", "w+")) ==NULL){

-		printf("[zte_get_sta_info_to_file]  can not  open /tmp/timelist\n");

+		printf("[get_sta_info_to_file]  can not  open /tmp/timelist\n");

 		goto END;

 	}

 	

diff --git a/ap/lib/libzcore/min/libbitmap_font.a b/ap/lib/libzcore/min/libbitmap_font.a
index 94ecab3..701b74e 100644
--- a/ap/lib/libzcore/min/libbitmap_font.a
+++ b/ap/lib/libzcore/min/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/min/libttf_font.a b/ap/lib/libzcore/min/libttf_font.a
index 1a0b658..ccab732 100644
--- a/ap/lib/libzcore/min/libttf_font.a
+++ b/ap/lib/libzcore/min/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/min/libzcore.a b/ap/lib/libzcore/min/libzcore.a
index 2972bf0..4200899 100644
--- a/ap/lib/libzcore/min/libzcore.a
+++ b/ap/lib/libzcore/min/libzcore.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/app_fw.a b/ap/lib/libzcore/std/lib/lib/fwp/app_fw.a
index 395b6e0..ffadb10 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/app_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/app_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/bl_psa.a b/ap/lib/libzcore/std/lib/lib/fwp/bl_psa.a
index ea7b449..6d8cdc4 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/bl_psa.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/bl_psa.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/bl_svr.a b/ap/lib/libzcore/std/lib/lib/fwp/bl_svr.a
index c6352e8..72cccbe 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/bl_svr.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/bl_svr.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/font/libbitmap_font.a b/ap/lib/libzcore/std/lib/lib/fwp/font/libbitmap_font.a
index c66b070..79dc0ad 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/font/libbitmap_font.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/font/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/font/libttf_font.a b/ap/lib/libzcore/std/lib/lib/fwp/font/libttf_font.a
index 678ed92..0f0fc0a 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/font/libttf_font.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/font/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/framework.a b/ap/lib/libzcore/std/lib/lib/fwp/framework.a
index c114b7b..4f9fc26 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/framework.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/framework.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/fwkernel.a b/ap/lib/libzcore/std/lib/lib/fwp/fwkernel.a
index 994623e..858babd 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/fwkernel.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/fwkernel.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/gui.a b/ap/lib/libzcore/std/lib/lib/fwp/gui.a
index 665d48d..5ad389a 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/gui.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/gui.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/msm.a b/ap/lib/libzcore/std/lib/lib/fwp/msm.a
index 7bd3d6a..8c116ab 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/msm.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/msm.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/fwp/ui_fw.a b/ap/lib/libzcore/std/lib/lib/fwp/ui_fw.a
index 100c818..65deb1c 100644
--- a/ap/lib/libzcore/std/lib/lib/fwp/ui_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/fwp/ui_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_com.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_com.a
index 2327491..0fe615e 100644
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_com.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_com.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_fwp.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_fwp.a
index e05f2ec..945343b 100644
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_fwp.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_fwp.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_phone.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_phone.a
index 2ab9d78..36179b2 100644
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_phone.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_phone.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_poc.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_poc.a
index 4397a6a..6380718 100644
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_poc.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_poc.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libplatadapt_watch.a b/ap/lib/libzcore/std/lib/lib/libplatadapt_watch.a
index 07bdb9a..51de530 100644
--- a/ap/lib/libzcore/std/lib/lib/libplatadapt_watch.a
+++ b/ap/lib/libzcore/std/lib/lib/libplatadapt_watch.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libzcore_fwp.a b/ap/lib/libzcore/std/lib/lib/libzcore_fwp.a
index d6383b1..31c9521 100644
--- a/ap/lib/libzcore/std/lib/lib/libzcore_fwp.a
+++ b/ap/lib/libzcore/std/lib/lib/libzcore_fwp.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libzcore_phone.a b/ap/lib/libzcore/std/lib/lib/libzcore_phone.a
index 22ff969..8b4a923 100644
--- a/ap/lib/libzcore/std/lib/lib/libzcore_phone.a
+++ b/ap/lib/libzcore/std/lib/lib/libzcore_phone.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libzcore_poc.a b/ap/lib/libzcore/std/lib/lib/libzcore_poc.a
index 2a25ad7..40d7777 100644
--- a/ap/lib/libzcore/std/lib/lib/libzcore_poc.a
+++ b/ap/lib/libzcore/std/lib/lib/libzcore_poc.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/libzcore_watch.a b/ap/lib/libzcore/std/lib/lib/libzcore_watch.a
index 3d1e706..ed9eb6d 100644
--- a/ap/lib/libzcore/std/lib/lib/libzcore_watch.a
+++ b/ap/lib/libzcore/std/lib/lib/libzcore_watch.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/app_fw.a b/ap/lib/libzcore/std/lib/lib/phone/app_fw.a
index 68be7a6..48161cc 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/app_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/app_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/bl_psa.a b/ap/lib/libzcore/std/lib/lib/phone/bl_psa.a
index c9a7fb6..a179613 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/bl_psa.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/bl_psa.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/bl_svr.a b/ap/lib/libzcore/std/lib/lib/phone/bl_svr.a
index 64cdc6f..ab95280 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/bl_svr.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/bl_svr.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/font/libbitmap_font.a b/ap/lib/libzcore/std/lib/lib/phone/font/libbitmap_font.a
index e2d6745..31538e0 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/font/libbitmap_font.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/font/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/font/libttf_font.a b/ap/lib/libzcore/std/lib/lib/phone/font/libttf_font.a
index a49f7d0..92de131 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/font/libttf_font.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/font/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/framework.a b/ap/lib/libzcore/std/lib/lib/phone/framework.a
index 6feb243..4e06272 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/framework.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/framework.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/fwkernel.a b/ap/lib/libzcore/std/lib/lib/phone/fwkernel.a
index 1df8c57..e8d75d7 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/fwkernel.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/fwkernel.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/gui.a b/ap/lib/libzcore/std/lib/lib/phone/gui.a
index 9a9706f..8e46064 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/gui.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/gui.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/msm.a b/ap/lib/libzcore/std/lib/lib/phone/msm.a
index 49b23ae..3aed03b 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/msm.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/msm.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/phone/ui_fw.a b/ap/lib/libzcore/std/lib/lib/phone/ui_fw.a
index 214963d..ab9aa17 100644
--- a/ap/lib/libzcore/std/lib/lib/phone/ui_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/phone/ui_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/app_fw.a b/ap/lib/libzcore/std/lib/lib/poc/app_fw.a
index a122dc1..cac553f 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/app_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/app_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/bl_psa.a b/ap/lib/libzcore/std/lib/lib/poc/bl_psa.a
index 0301bf5..724918e 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/bl_psa.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/bl_psa.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/bl_svr.a b/ap/lib/libzcore/std/lib/lib/poc/bl_svr.a
index 05ca21a..98cb1fd 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/bl_svr.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/bl_svr.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/font/libbitmap_font.a b/ap/lib/libzcore/std/lib/lib/poc/font/libbitmap_font.a
index d8cbb0d..59978ae 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/font/libbitmap_font.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/font/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/font/libttf_font.a b/ap/lib/libzcore/std/lib/lib/poc/font/libttf_font.a
index 01e4098..9acd588 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/font/libttf_font.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/font/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/framework.a b/ap/lib/libzcore/std/lib/lib/poc/framework.a
index d74776f..e39f3dd 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/framework.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/framework.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/fwkernel.a b/ap/lib/libzcore/std/lib/lib/poc/fwkernel.a
index f294b42..4e70a22 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/fwkernel.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/fwkernel.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/gui.a b/ap/lib/libzcore/std/lib/lib/poc/gui.a
index fedfac1..27eb0f4 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/gui.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/gui.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/msm.a b/ap/lib/libzcore/std/lib/lib/poc/msm.a
index 30b31fb..5c2f48f 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/msm.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/msm.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/poc/ui_fw.a b/ap/lib/libzcore/std/lib/lib/poc/ui_fw.a
index 510c9ef..f09416d 100644
--- a/ap/lib/libzcore/std/lib/lib/poc/ui_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/poc/ui_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/app_fw.a b/ap/lib/libzcore/std/lib/lib/watch/app_fw.a
index 320a52c..08d3447 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/app_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/app_fw.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/bl_psa.a b/ap/lib/libzcore/std/lib/lib/watch/bl_psa.a
index d5d1127..285b005 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/bl_psa.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/bl_psa.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/bl_svr.a b/ap/lib/libzcore/std/lib/lib/watch/bl_svr.a
index 000f8eb..bd11b74 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/bl_svr.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/bl_svr.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/font/libbitmap_font.a b/ap/lib/libzcore/std/lib/lib/watch/font/libbitmap_font.a
index d46e279..d68cbcd 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/font/libbitmap_font.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/font/libbitmap_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/font/libttf_font.a b/ap/lib/libzcore/std/lib/lib/watch/font/libttf_font.a
index a294268..39f4fd9 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/font/libttf_font.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/font/libttf_font.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/framework.a b/ap/lib/libzcore/std/lib/lib/watch/framework.a
index 391233a..9ccbccf 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/framework.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/framework.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/fwkernel.a b/ap/lib/libzcore/std/lib/lib/watch/fwkernel.a
index 678d78b..d12402e 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/fwkernel.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/fwkernel.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/gui.a b/ap/lib/libzcore/std/lib/lib/watch/gui.a
index 86da7af..5901d56 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/gui.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/gui.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/msm.a b/ap/lib/libzcore/std/lib/lib/watch/msm.a
index 30dd651..e99e773 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/msm.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/msm.a
Binary files differ
diff --git a/ap/lib/libzcore/std/lib/lib/watch/ui_fw.a b/ap/lib/libzcore/std/lib/lib/watch/ui_fw.a
index c61427c..e6c3e68 100644
--- a/ap/lib/libzcore/std/lib/lib/watch/ui_fw.a
+++ b/ap/lib/libzcore/std/lib/lib/watch/ui_fw.a
Binary files differ
diff --git a/ap/lib/libzte_dmapp/src/libzte_dmapp.c b/ap/lib/libzte_dmapp/src/libzte_dmapp.c
index a86d8d7..297f604 100644
--- a/ap/lib/libzte_dmapp/src/libzte_dmapp.c
+++ b/ap/lib/libzte_dmapp/src/libzte_dmapp.c
@@ -40,7 +40,7 @@
 	char fota_flag_part_name[256] = {'\0'};
 
 	if (path == NULL) {
-		printf("zte_fota_get_flag_partition_name fota_flag_part_name is NULL!\n");
+		printf("fota_get_flag_partition_name fota_flag_part_name is NULL!\n");
 		return -1;
 	}
 
@@ -48,7 +48,7 @@
 	//ÐÂÔö±éÀúfotaflag·ÖÇøÃû´úÂë------------------------------------------------------------------
 	value = zte_fota_browse_fotaflag(ZTE_DUA_FOTAFLAG_BLOCK_PART, fota_flag_part_name, sizeof(fota_flag_part_name));
 	if (1 == value) {
-		printf("[%s:%s]zte_fota_browse_fotaflag error!\n", __FILE__, __FUNCTION__);
+		printf("[%s:%s]fota_browse_fotaflag error!\n", __FILE__, __FUNCTION__);
 		return -1;
 	}
 	sprintf(path, "%s/%s", ZTE_DUA_PART_UPDATED_DEV, fota_flag_part_name);
@@ -64,7 +64,7 @@
 	FILE *fota_flag_file;
 
 	if (fotaflag == NULL) {
-		printf("zte_fota_get_fotaflag fotaflag is NULL!\n");
+		printf("fota_get_fotaflag fotaflag is NULL!\n");
 		return -1;
 	}
 
@@ -75,12 +75,12 @@
 
 	//fota_flag_file = fopen("/dev/zftl6", "wb+");
 	if (fota_flag_file == NULL) {
-		printf("zte_fota_get_fotaflag Fota flag file does not exist!\n");
+		printf("fota_get_fotaflag Fota flag file does not exist!\n");
 		return -1;
 	}
 	read_size = fread(fota_flag_temp, ZTE_FOTA_FLAG_LEN, 1, fota_flag_file);
 	if (read_size <= 0) {
-		printf("zte_fota_get_fotaflag read fota_flag_file failed!\n");
+		printf("fota_get_fotaflag read fota_flag_file failed!\n");
 		return -1;
 	}
 	//fotaflag = (fotaflag_t *)fota_flag_temp;
@@ -104,7 +104,7 @@
 	int write_back = 0;
 	int ret = -1;
 
-	printf("zte_fota_set_stateflag start!\n");
+	printf("fota_set_stateflag start!\n");
 
 	zte_fota_get_fotaflag_partition_path(path);
 
@@ -113,12 +113,12 @@
 
 	//fota_flag_file = fopen("/dev/zftl6", "wb+");
 	if (fota_flag_file == NULL) {
-		printf("zte_fota_set_stateflag Fota flag file does not exist!\n");
+		printf("fota_set_stateflag Fota flag file does not exist!\n");
 		return -1;
 	}
 	read_size = fread(fota_flag_temp, ZTE_FOTA_FLAG_LEN, 1, fota_flag_file);
 	if (read_size <= 0) {
-		printf("zte_fota_set_stateflag read fota_flag_file failed!\n");
+		printf("fota_set_stateflag read fota_flag_file failed!\n");
 		return -1;
 	}
 	fotaflag = (fotaflag_t *)fota_flag_temp;
@@ -132,7 +132,7 @@
 	}
 	if (netdogflag_index >= 0) {
 		fotaflag->netdog_flag[netdogflag_index] = netdogflag_value;
-		printf("zte_fota_set_fotaflag is %d!\n", fotaflag->netdog_flag[netdogflag_index]);
+		printf("fota_set_fotaflag is %d!\n", fotaflag->netdog_flag[netdogflag_index]);
 		write_back = 1;
 	}
 
@@ -141,13 +141,13 @@
 	if (write_back) {
 		write_size = fwrite(fotaflag, 1, ZTE_FOTA_FLAG_LEN, fota_flag_file);
 		if (write_size <= 0) {
-			printf("zte_fota_set_stateflag Write fota_flag_file failed!\n");
+			printf("fota_set_stateflag Write fota_flag_file failed!\n");
 			return -1;
 		}
 		printf("write_size = %d, write fota_flag_file success! End 20160624!\n", write_size);
 		fflush(fota_flag_file);
 		ret = fsync(fileno(fota_flag_file));
-		printf("zte_fota_set_fotaflag fsync ret=%d\n", ret);
+		printf("fota_set_fotaflag fsync ret=%d\n", ret);
 	}
 
 	fclose(fota_flag_file);
@@ -228,7 +228,7 @@
 
 int zte_fota_set_netdogflag(int index, int value)
 {
-	printf("zte_fota_set_netdogflag is %d  %d!\n", index, value);
+	printf("fota_set_netdogflag is %d  %d!\n", index, value);
 	return zte_fota_set_fotaflag(NULL, -1, index, value);
 }
 
@@ -276,12 +276,12 @@
 	char fullpath[256] = {0};
 
 	if (NULL == pathname || NULL == fota_flag_part_name || len <= 0) {
-		printf("zte_fota_browse_fotaflag has invalid parameter!\n");
+		printf("fota_browse_fotaflag has invalid parameter!\n");
 		return 1;
 	}
 	pdir = opendir(pathname);//´ò¿ªÒ»¸ö·¾¶²¢·µ»ØÒ»¸öĿ¼Á÷¡£
 	if (pdir == NULL) {
-		printf("zte_fota_browse_fotaflag opendir %s error!\n", pathname);
+		printf("fota_browse_fotaflag opendir %s error!\n", pathname);
 		return 1;
 	}
 
@@ -297,7 +297,7 @@
 
 		fd = fopen(fullpath, "r");
 		if (NULL == fd) {
-			printf("zte_fota_browse_fotaflag fopen %s failed!\n", fullpath);
+			printf("fota_browse_fotaflag fopen %s failed!\n", fullpath);
 			closedir(pdir);
 			return 1;
 		}
@@ -310,7 +310,7 @@
 				closedir(pdir);
 				return 0;
 			} else {
-				printf("zte_fota_browse_fotaflag over_array_range error!pentry->d_name=%s, strlen(pentry->d_name)=%d\n",
+				printf("fota_browse_fotaflag over_array_range error!pentry->d_name=%s, strlen(pentry->d_name)=%d\n",
 				       pentry->d_name, strlen(pentry->d_name));
 				fclose(fd);
 				closedir(pdir);
diff --git a/ap/lib/libzte_vsim/inc/vsim.h b/ap/lib/libzte_vsim/inc/vsim.h
index 5bb0668..304b1ab 100644
--- a/ap/lib/libzte_vsim/inc/vsim.h
+++ b/ap/lib/libzte_vsim/inc/vsim.h
@@ -845,5 +845,20 @@
 

 extern SINT32 zAmt_GetPublicKey(BYTE *pE, UINT32 *pELen, BYTE *pN, UINT32 *pModulusLen);

 

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

+* º¯ÊýÃû³Æ: zVcard_CmpOpK

+* ¹¦ÄÜÃèÊö: ÑéÖ¤KºÍOPÊÇ·ñÒ»ÖÂ

+* ²ÎÊý˵Ã÷: (IN)	pbK			16	byte	´ýУÑéxmlÖеÄabKÖµ

+					pbOp		16	byte	´ýУÑéxmlÖеÄabOpcÖµ

+					pbEncExp	128	byte	vsim.binÖеÚ0x8-0x87×Ö½ÚÄÚÈÝ£¬Æ«ÒÆÁ¿´Ó0¿ªÊ¼

+					pbEncMod	128	byte	vsim.binÖеÚ0x88-0x107×Ö½ÚÄÚÈÝ

+					pbEncK		128	byte	vsim.binÖеÚ0x108-0x187×Ö½ÚÄÚÈÝ

+					pbEncOP		128	byte	vsim.binÖеÚ0x188-0x207×Ö½ÚÄÚÈÝ

+* ·µ »Ø Öµ: 0	УÑéͨ¹ý

+			1	УÑéʧ°Ü

+* ÆäËü˵Ã÷: ½ö¹©²úÏßУÑéʱʹÓÃ

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

+BYTE zVcard_CmpOpK(BYTE *pbK, BYTE *pbOp, BYTE *pbEncExp, BYTE *pbEncMod, BYTE *pbEncK, BYTE *pbEncOP);

+

 #endif

 

diff --git a/ap/lib/libzte_vsim/libzte_vsim.a b/ap/lib/libzte_vsim/libzte_vsim.a
index e7452d1..50a8a92 100644
--- a/ap/lib/libzte_vsim/libzte_vsim.a
+++ b/ap/lib/libzte_vsim/libzte_vsim.a
Binary files differ