[Feature][ZXW-65]merged P49 base code

Change-Id: I3e09c0c3d47483bc645f02310380ecb7fc6f4041
diff --git a/cp/ps/driver/inc/misc/drvs_voiceprocess.h b/cp/ps/driver/inc/misc/drvs_voiceprocess.h
index 3b6795f..db2104e 100755
--- a/cp/ps/driver/inc/misc/drvs_voiceprocess.h
+++ b/cp/ps/driver/inc/misc/drvs_voiceprocess.h
@@ -245,7 +245,8 @@
     UINT32 sample_rate;//20

     UINT8 useDtmfLoop;//21

     SINT32 muteCount;//22 mute_count

-	BOOL rxMuteEn; //23

+    BOOL vpLoopBkRunning;//23 

+	BOOL rxMuteEn; //24

 } T_zDrvVoice_GbVar; //T_zDrvVoice_GbVar

 

 typedef struct

diff --git a/cp/ps/driver/src/chipsets/src/audio_base/audio_lib/amr/lib/armv7-a/GCC/amr.a b/cp/ps/driver/src/chipsets/src/audio_base/audio_lib/amr/lib/armv7-a/GCC/amr.a
index fb294e6..0af6537 100644
--- a/cp/ps/driver/src/chipsets/src/audio_base/audio_lib/amr/lib/armv7-a/GCC/amr.a
+++ b/cp/ps/driver/src/chipsets/src/audio_base/audio_lib/amr/lib/armv7-a/GCC/amr.a
Binary files differ
diff --git a/cp/ps/driver/src/chipsets/src/audio_base/audiointf/hal_audextintf.c b/cp/ps/driver/src/chipsets/src/audio_base/audiointf/hal_audextintf.c
index a1899f0..f8869d2 100755
--- a/cp/ps/driver/src/chipsets/src/audio_base/audiointf/hal_audextintf.c
+++ b/cp/ps/driver/src/chipsets/src/audio_base/audiointf/hal_audextintf.c
@@ -177,6 +177,16 @@
 {

 	return zDrvVp_ToneMixerStart(toneNum);

 }

+SINT32 zDrvVp_SetVpLoop_Wrap(int path)

+{

+	return zDrvVp_Loop(path);

+}

+SINT32 zDrvVp_GetVpLoop_Wrap(VOID)

+{

+	zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "%s:vpLoopBkRunning=%d.\n", __func__, g_voiceVar.vpLoopBkRunning);

+    zOss_Printf(SUBMDL_HAL, PRINT_LEVEL_NORMAL,  "%s:vpLoopBkRunning=%d.\n", __func__, g_voiceVar.vpLoopBkRunning);

+	return g_voiceVar.vpLoopBkRunning;

+}

 

 SINT32 zDrvVp_GetSlicFlag(VOID)

 {

diff --git a/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c b/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c
index 81e683d..95f6404 100755
--- a/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c
+++ b/cp/ps/driver/src/chipsets/src/audio_base/voiceprocess/hal_voiceprocess.c
@@ -104,7 +104,8 @@
     0, //sample_rate 20 

 	0, //useDtmfLoop; 21

 	0, //muteCount;//mute_count 22	

-	FALSE,              //rxMuteEn 23

+    FALSE,				//23 vpLoopBkRunning

+	FALSE,              //24 rxMuteEn

 };

 

 static T_zDrvVp_State s_vpState =

@@ -3323,7 +3324,9 @@
 

 	while (1)

 	{

+	    zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO,  "%s: wait vpLoopSemaphore!\n",__FUNCTION__);

 		zOss_GetSemaphore(s_vpState.vpLoopSemaphore, ZOSS_WAIT_FOREVER);

+	    zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO,  "%s: get vpLoopSemaphore, start loop!\n",__FUNCTION__);

 		s_speechState.pVpTempRxInBuffer = s_vpState.pVpRxInBuffer;

 		s_speechState.pVpTempTxInBuffer = s_vpState.pVpTxInBuffer;

 		s_speechState.pVpTempRxOutPutBuffer = s_vpState.pVpRxOutPutBuffer;

@@ -3344,6 +3347,8 @@
 			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvVp_LoopStartDo err! \r\n");

 			continue;

 		}

+		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvVp_Loop thread start! \r\n");

+		g_voiceVar.vpLoopBkRunning = TRUE;			

 

 		while (g_voiceVar.vpI2sStatus == VP_LOOP_ON)

 		{

@@ -3541,6 +3546,7 @@
 			zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "zDrvI2S_Close I2S1 Stop wrong  ret=%d", ret);

 		}

 		zDrvRamlog_PRINTF(RAMLOG_MOD_AUDIO, "vp_LoopProcessThreadEntry work end.\n");

+		g_voiceVar.vpLoopBkRunning = FALSE;	

 	}

 }

 

diff --git a/cp/ps/modem/com/inc/config/atcfg/sys_func_atcfg.h b/cp/ps/modem/com/inc/config/atcfg/sys_func_atcfg.h
index 6c25373..6d45706 100644
--- a/cp/ps/modem/com/inc/config/atcfg/sys_func_atcfg.h
+++ b/cp/ps/modem/com/inc/config/atcfg/sys_func_atcfg.h
@@ -247,7 +247,7 @@
     /*NVÍ·²¿*/

     CHAR    magic[8];  /*ħÊõ×Ö*/

     UINT16    wVersion; /*°æ±¾ºÅ£¬µ±Ç°Èí¼þÔÝδʹÓÃ*/

-    UINT16    wLen;      /*ÐèÒª¿½±´µÄÓÐЧÊý¾ÝµÄ³¤¶È,±¾°æ±¾È¡ÖµÎª783*/

+    UINT16    wLen;      /*ÐèÒª¿½±´µÄÓÐЧÊý¾ÝµÄ³¤¶È,±¾°æ±¾È¡ÖµÎª787*/

 

     UINT8 jtagserver;/* 1:TDÎïÀí²ãµ÷ÊÔ°æ±¾ 0:TDÎïÀí²ã¹Ì»¯°æ±¾£¬ÆäËûÖµÎÞЧ £¬Ä¬ÈÏֵΪ0*/

     UINT8 exceptReset;/* 2:µ¼³öramdumpºóÔÙÖØÆô1:´ò¿ªÒì³£ÖØÆô 0:¹Ø±ÕÒì³£ÖØÆô£¬Ä¬ÈÏֵΪ0 */

@@ -429,6 +429,10 @@
     UINT16 bFreqScanTmax;/*×î´óɨƵÖÜÆÚ,³ö³§Öµ0,µ¥Î»S*/

     UINT16 wFastScanTime;/*¿ìËÙɨƵʱ¼ä¼ä¸ô,µ¥Î»s,ȡֵ:1-65535,³ö³§Öµ10*/

     UINT8 bFastScanFreqFg;/*¿ìËÙɨƵ¹¦ÄÜ¿ª¹Ø,0-¹Ø±Õ,1-´ò¿ª,³ö³§Öµ1*/

+    UINT8 bMultiRfFlag;/*multi RF¹¦ÄÜ¿ª¹Ø,0-¹Ø±Õ,1-´ò¿ª,³ö³§Öµ0*/

+    UINT8 bGpio0Val;/*multi RF¹¦ÄÜGPIO0µÄȡֵ,0-255,ÆäÖÐ255±íʾÎÞЧ,³ö³§Öµ255*/

+    UINT8 bGpio1Val;/*multi RF¹¦ÄÜGPIO1µÄȡֵ,0-255,ÆäÖÐ255±íʾÎÞЧ,³ö³§Öµ255*/

+    UINT8 bGpio2Val;/*multi RF¹¦ÄÜGPIO2µÄȡֵ,0-255,ÆäÖÐ255±íʾÎÞЧ,³ö³§Öµ255*/

     UINT8 bSpare;

 }CommAtSetting;

 /* atÉèÖýṹÌå ²»´æNV*/

@@ -1854,6 +1858,12 @@
 VOID zOss_GetFastFreqScanInfo(CommAtCfgCmdParam * cmdParm);

 UINT8 zOss_GetFastFreqScanFlag(VOID);

 UINT16 zOss_GetFastFreqScanTime(VOID);

+UINT32 zOss_SetMultiRfInfo(CommAtCfgCmdParam * cmdParm);

+VOID zOss_GetMultiRfInfo(CommAtCfgCmdParam * cmdParm);

+UINT8 zOss_GetMultiRfFlag(VOID);

+UINT8 zOss_GetMultiRfGpio0(VOID);

+UINT8 zOss_GetMultiRfGpio1(VOID);

+UINT8 zOss_GetMultiRfGpio2(VOID);

 #ifdef _USE_PSM_TEST

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

  *  º¯ÊýÃû      : zSys_SetPsmFlagToIram

diff --git a/cp/ps/modem/com/src/appstart/inc/version_number.h b/cp/ps/modem/com/src/appstart/inc/version_number.h
old mode 100755
new mode 100644
index aa3e1ff..1182388
--- a/cp/ps/modem/com/src/appstart/inc/version_number.h
+++ b/cp/ps/modem/com/src/appstart/inc/version_number.h
@@ -1,9 +1,9 @@
 #if defined _CHIP_ZX297520
-#define VERSION_NUMBER "7520SCV2.01.01.02P48U02"
+#define VERSION_NUMBER "7520SCV2.01.01.02P49"
 #endif
 #if defined _CHIP_ZX297520V2
-#define VERSION_NUMBER "7520V2SCV2.01.01.02P48U02"
+#define VERSION_NUMBER "7520V2SCV2.01.01.02P49"
 #endif
 #if defined _CHIP_ZX297520V3
-#define VERSION_NUMBER "7520V3SCV2.01.01.02P48U02"
+#define VERSION_NUMBER "7520V3SCV2.01.01.02P49"
 #endif
diff --git a/cp/ps/plat/src/oss/sup/src/sup_nvm.c b/cp/ps/plat/src/oss/sup/src/sup_nvm.c
index d5f927d..ec94572 100755
--- a/cp/ps/plat/src/oss/sup/src/sup_nvm.c
+++ b/cp/ps/plat/src/oss/sup/src/sup_nvm.c
@@ -40,8 +40,10 @@
 **************************************************************************/

 #include "sup_nvm.h"

 #include "drv_api.h"

+#include "drvs_gpio.h"

 #include "oss_cfg.h"

 #include "RWNvConfig.h"

+#include "sys_func_atcfg.h"

 #ifdef _OS_LINUX

 #include <linux/unistd.h>

 #include <linux/ctype.h>

@@ -94,9 +96,21 @@
 #define NVM_FS_RW_BACKUP_SYMBOL_PATH    "/etc_rw/psnv/backup_flag"

 #define NVM_FS_RW_HASH_WORK_PATH        "/etc_rw/psnv/nvrwall.hash"

 

+#define NVRWO_CONVERT_OFFSET   (OS_FLASH_AMT_RW_USER_GGE_SIZE + OS_FLASH_AMT_RW_USER_WCDMA_SIZE + OS_FLASH_AMT_RW_USER_LTEA_SIZE + OS_FLASH_RFCOM_RW_NONFAC_SIZE)

+#define NVRWO_CONVERT_OFFSET1  (OS_FLASH_RFCOM_RW_NONFAC_SIZE)

+#define NVRWO_CONVERT_OFFSET2  (OS_FLASH_RFCOM_RW_NONFAC_BASE_ADDR + OS_FLASH_RFCOM_RW_NONFAC_SIZE + NVRWO_CONVERT_OFFSET1 - OS_FLASH_AMT_RW_USER_GGE_BASE_ADDR)

+#define NVRWO_CONVERT_START    (OS_FLASH_RFCOM_RW_NONFAC_BASE_ADDR + OS_FLASH_RFCOM_RW_NONFAC_SIZE - OS_FLASH_RWO_OFFSET_FROM_NV)

+#define NVRWO_CONVERT_MAX_END ((OS_FLASH_RFCOM_RW_NONFAC_BASE_ADDR + OS_FLASH_RFCOM_RW_NONFAC_SIZE) + 8 * (NVRWO_CONVERT_OFFSET) - OS_FLASH_RWO_OFFSET_FROM_NV)

+

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

 * Êý¾Ý½á¹¹¶¨ÒåÇø

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

+typedef struct

+{

+    UINT32 start;

+    UINT32 len;

+    UINT32 offset;

+} T_zOss_NvRwoConvert;

 

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

 * ¾Ö²¿º¯ÊýÔ­ÐÍ

@@ -114,12 +128,18 @@
 static UINT32 Nvram_RwInit(VOID);

 static SINT32 Nvram_WriteFile(const CHAR *pFile, UINT8 *pBuf, UINT32 len);

 static UINT8  *Nvram_ReadFile(const CHAR *pFile, UINT32 *len);

+static UINT32 Nvram_RwoConvert(UINT32 NvItemID, UINT32 NvItemLen);

 

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

 * È«¾Ö³£Á¿/±äÁ¿

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

 static ZOSS_MUTEX_ID	gNV_Mutex	= NULL;   	   /* Flash²Ù×÷»¥³âÌå   */

 static BOOL             gNV_Inited 	= FALSE;       /* NV¶ÁдʹÄÜ        */

+const T_zOss_NvRwoConvert g_NvRwoConInfo[] = 

+{

+    {OS_FLASH_RFCOM_RW_NONFAC_BASE_ADDR, OS_FLASH_RFCOM_RW_NONFAC_SIZE, NVRWO_CONVERT_OFFSET1},

+    {OS_FLASH_AMT_RW_USER_GGE_BASE_ADDR, OS_FLASH_AMT_RW_USER_GGE_SIZE + OS_FLASH_AMT_RW_USER_WCDMA_SIZE + OS_FLASH_AMT_RW_USER_LTEA_SIZE, NVRWO_CONVERT_OFFSET2},

+};

 

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

 * È«¾Öº¯ÊýʵÏÖ

@@ -188,6 +208,7 @@
 	else if(NvItemID >= OS_FLASH_RWO_OFFSET_FROM_NV && (NvItemID + NvItemLen) <= (OS_FLASH_RWO_OFFSET_FROM_NV + OS_FLASH_RWO_NVRAM_SIZE))

 	{

 		pNvFile = NVM_FS_RWO_FAC_PATH;

+        NvItemID = Nvram_RwoConvert(NvItemID, NvItemLen);

 		NvItemID -= OS_FLASH_RWO_OFFSET_FROM_NV;

 	}

 	else if(NvItemID >= OS_FLASH_RW_OFFSET_FROM_NV && (NvItemID + NvItemLen) <= (OS_FLASH_RW_OFFSET_FROM_NV + OS_FLASH_RW_NVRAM_SIZE))

@@ -758,9 +779,12 @@
 		printk("cpnv read %s fail, len = %d, errno = %d\n", part_name, dwLen, ret);

 		CPPS_KO_FUNC(sys_close)(fd);

 		set_fs(old_fs);

-		return ZOSS_ERROR;

+		if ((strncmp(part_name, NVM_FS_RWO_FAC_PATH, strlen(NVM_FS_RWO_FAC_PATH)) == 0) && (dwStart > NVRWO_CONVERT_START) && ((dwStart + dwLen) <= NVRWO_CONVERT_MAX_END))

+			return ZOSS_SUCCESS;

+		else

+			return ZOSS_ERROR;

 	}

-	

+

 	CPPS_KO_FUNC(sys_close)(fd);

 	set_fs(old_fs);

 	return ZOSS_SUCCESS;

@@ -1035,6 +1059,107 @@
 }

 */

 

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

+* º¯ÊýÃû³Æ£º Nvram_GetRwoIndex

+* ¹¦ÄÜÃèÊö£º Ò»Ì×Èí¼þ¼æÈݶàÌ×É䯵NVʵÏÖ(»ñÈ¡GPIO×éºÏ¶ÔÓ¦µÄË÷ÒýÖµ)

+* ²ÎÊý˵Ã÷£º (IN)

+*            index:  Ë÷ÒýÖµ

+*            (OUT)

+* ·µ »Ø Öµ£ºTRUE: ³É¹¦»ñÈ¡µ½Ë÷ÒýÖµ£»FALSE: ¸Ã¹¦ÄÜδʹÄÜ£¬»òGPIO×éºÏÅäÖôíÎó

+* ÆäËü˵Ã÷£ºÎÞ

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

+static BOOL Nvram_GetRwoIndex(UINT32 *index)

+{

+    BOOL   enable;

+    UINT32 gpio_id;

+    UINT32 gpio_val;

+    gpio_func_id func_id;

+

+    if (index == NULL)

+        return FALSE;

+

+    enable = zOss_GetMultiRfFlag();

+    if (!enable)

+        return FALSE;

+

+    gpio_id = zOss_GetMultiRfGpio0();

+    if (gpio_id > ZX29_GPIO_MAX)

+    {

+        printk("multi rf enable, but gpio0 set error!!!\n");

+        return FALSE; //GPIO×éºÏÅäÖôíÎó

+    }

+

+    *index = 0;

+    func_id = zx29_gpio_get_gpiofunc_id(gpio_id);

+    zx29_gpio_set_direction(gpio_id, 0);

+    zx29_gpio_config(gpio_id, func_id);

+    gpio_val = zx29_gpio_input_data(gpio_id);

+    if (gpio_val == 1)

+		*index = 1 << 0;

+

+    gpio_id = zOss_GetMultiRfGpio1();

+    if (gpio_id > ZX29_GPIO_MAX)

+        return TRUE;

+    func_id = zx29_gpio_get_gpiofunc_id(gpio_id);

+    zx29_gpio_set_direction(gpio_id, 0);

+    zx29_gpio_config(gpio_id, func_id);

+    gpio_val = zx29_gpio_input_data(gpio_id);

+    if (gpio_val == 1)

+		*index |= 1 << 1;

+

+    gpio_id = zOss_GetMultiRfGpio2();

+    if (gpio_id > ZX29_GPIO_MAX)

+        return TRUE;

+    func_id = zx29_gpio_get_gpiofunc_id(gpio_id);

+    zx29_gpio_set_direction(gpio_id, 0);

+    zx29_gpio_config(gpio_id, func_id);

+    gpio_val = zx29_gpio_input_data(gpio_id);

+    if (gpio_val == 1)

+		*index |= 1 << 2;

+

+    return TRUE;

+}

+

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

+* º¯ÊýÃû³Æ£º Nvram_RwoConvert

+* ¹¦ÄÜÃèÊö£º Ò»Ì×Èí¼þ¼æÈݶàÌ×É䯵NVʵÏÖ(NVRWOµÄµØÖ·×ª»»)

+* ²ÎÊý˵Ã÷£º (IN)

+*            NvItemID:  Æ«ÒÆ

+*            NvItemLen: ³¤¶È

+*            (OUT)

+* ·µ »Ø Öµ£º·µ»ØÖµ×ª»»ºóµÄµØÖ·

+* ÆäËü˵Ã÷£ºÎÞ

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

+UINT32 g_NvRwoConIndex = ZOSS_ERROR;

+static UINT32 Nvram_RwoConvert(UINT32 NvItemID, UINT32 NvItemLen)

+{

+    UINT32 i;

+    UINT32 start;

+    UINT32 end;

+

+    if (g_NvRwoConIndex == ZOSS_ERROR)

+    {

+        if (!Nvram_GetRwoIndex(&g_NvRwoConIndex))

+            return NvItemID;

+        printk("multi rf enable, gpios index = %u!!!\n", g_NvRwoConIndex);

+    }

+

+    for (i = 0; i < ARRAY_SIZE(g_NvRwoConInfo); i++)

+    {

+        start = g_NvRwoConInfo[i].start;

+        end   = g_NvRwoConInfo[i].start + g_NvRwoConInfo[i].len;

+

+        if ((NvItemID >= start) && (NvItemID < end) && (NvItemID + NvItemLen > end))

+            zOss_ASSERT(0);

+        if ((NvItemID >= start) && (NvItemID < end) && (NvItemID + NvItemLen <= end))

+        {

+            printk("befor mod NvItemID = %u, after mod NvItemID = %u\n", NvItemID, NvItemID + g_NvRwoConInfo[i].offset + (NVRWO_CONVERT_OFFSET * g_NvRwoConIndex));

+            return NvItemID + g_NvRwoConInfo[i].offset + (NVRWO_CONVERT_OFFSET * g_NvRwoConIndex);

+        }

+    }

+	return NvItemID;

+}

+

 #ifdef __cplusplus

 }

 #endif

diff --git a/cp/ps/project/zx297520v3/config/pub/product_cfg.mk b/cp/ps/project/zx297520v3/config/pub/product_cfg.mk
old mode 100644
new mode 100755
index 49a4622..e9df260
--- a/cp/ps/project/zx297520v3/config/pub/product_cfg.mk
+++ b/cp/ps/project/zx297520v3/config/pub/product_cfg.mk
@@ -439,3 +439,10 @@
 ifeq ($(USE_BTRUNK_SUPPORT),yes)

 DEFINE += -DBTRUNK_SUPPORT

 endif

+

+#===============================================================================

+#LTEµ¥Ä£ºê¿ª¹Ø£º

+#===============================================================================

+ifeq ($(MODEM_TYPE),lte_only)

+DEFINE += -D_USE_LTE_ONLY

+endif