Merge "[BUG][R306][task-view-241][webui] add url filter"
diff --git a/lynq/R306/ap/app/include/mmi_msg.h b/lynq/R306/ap/app/include/mmi_msg.h
new file mode 100644
index 0000000..dc820b7
--- /dev/null
+++ b/lynq/R306/ap/app/include/mmi_msg.h
@@ -0,0 +1,92 @@
+/**
+ * @file mmi_msg.h
+ * @brief ÌṩÁËmmiÏûÏ¢½Ó¿ÚºÍÏûÏ¢½á¹¹¶¨Òå
+ *
+ * Copyright (C) 2017 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.
+ *
+ */
+
+#ifndef __MMI_MSG_H__
+#define __MMI_MSG_H__
+#include "message.h"
+
+
+/*ϵͳÐÅÏ¢²éѯ*/
+typedef struct {
+	signed long     srvStatus;        /*ϵͳ·þÎñ״̬  */
+	signed long     srvDomain;        /*ϵͳ·þÎñÓò    */
+	signed long     roamStatus;       /*ÂþÓÎ״̬      */
+	signed long     sysMode;          /*ϵͳģʽ      */
+	signed long     simState;         /*SIM¿¨×´Ì¬     */
+	signed long     reserve;          /*±£ÁôÖµ       */
+	signed long     sysSubmode;       /*ϵͳ×Óģʽ    */
+} T_zAt_SysinfoRes;
+
+
+/* ÏûÏ¢½á¹¹Ìå */
+typedef struct {
+	unsigned char sms_unread_ind; //0:ÎÞδ¶Á¶ÌÐÅ£» 1:ÓÐδ¶Á¶ÌÐÅ
+	unsigned char sms_memory_full_ind; //0:²»Âú; 1: Âú
+	unsigned char sms_new_ind;
+	unsigned char sms_is_reading;
+	unsigned char sms_unread_count;
+} T_zUfi_SmsStatusInfoInd;
+
+/* ¹Ø»úÖØÆôÏûϢʵ¼Ê²Ù×÷Öµ */
+typedef enum {
+	Ext_Cmd_Base = 0,
+	Ext_Cmd_REBOOT,
+	Ext_Cmd_POWEROFF,
+	Ext_Cmd_POWEROFF_CHARGING,
+	Ext_Cmd_POWEROFF_FAKE,
+	Ext_Cmd_POWEROFF_CLOCK,
+	Ext_Cmd_MAX
+} T_zUfi_ExtCmd;
+
+struct ext_msg_data {
+	int cmd;
+};
+
+//autotest ×Ô¶¯»¯²âÊÔÏûÏ¢Êý¾Ý
+typedef struct  {
+	SINT32 code;
+	SINT32 value;
+} autotest_key_rspmsg;
+
+//ÇëÎâºì½«mmiÄÚ²¿ÏûϢʹÓõÄÏûÏ¢Â룬ҲÌí¼Óµ½ÕâÀï
+enum mmi_msg_cmd {
+	MSG_CMD_CHANNEL_NETWORK_MODE = MSG_CMD_MMI_BASE,
+	MSG_CMD_MULTI_CONNECT_STATUS,//ÊÇ·ñ´æÔÚ¶à·PDP¼¤»î
+	MSG_CMD_CHANNEL_CONNECT_STATUS,
+	MSG_CMD_SMS_STATUS_INFO_IND,
+	MSG_CMD_OUT_REG_GET_SIGNAL_NUM,
+	MSG_CMD_MODIFY_SSID_KEY,
+	MSG_CMD_GET_TRAFFIC_INFO_START,
+	MSG_CMD_GET_TRAFFIC_INFO_END,
+	MSG_CMD_TRAFFIC_INFO_RESET,
+	MSG_CMD_GET_NET_PROVIDER,
+	MSG_CMD_SET_USB_MODE,
+	MSG_CMD_VOIP_STATUS_INFO,
+	MSG_CMD_STA_COUNT_CHANGE,
+	MSG_CMD_POWEROFF_PLUGOUT_RESULT,
+	MSG_CMD_SOCKET_STATE_CHANGE,    //ÄÚÖÃsocket connect state
+	MSG_CMD_MCUSOCKET_STATE_CHANGE, //ÍâÖÃsocket connect state
+	MSG_CMD_MMIGET_WIFI_STANUM,//ÏÂÃæÊÇMMI ÄÚ²¿Ê¹ÓõÄÏûÏ¢
+	MSG_CMD_MMISTART_BACKLIGHTOFF_TIMER,
+	MSG_CMD_MMICHECK_TIP_INFO,
+	MSG_CMD_MMISHOW_SSID_INFO,
+	MSG_CMD_MMIGET_WIFI_DATA,
+	MSG_CMD_RJ11_STATUS_INFO, //ҢԶcpe
+	MSG_CMD_RJ45_STATUS_INFO,
+//#ifdef _ENABLE_AUTOTEST
+	MSG_CMD_AUTOTEST_KEY_REQ,
+//#endif
+};
+
+#endif
+
diff --git a/lynq/R306/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c b/lynq/R306/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c
index e04ba4e..c49510d 100755
--- a/lynq/R306/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c
+++ b/lynq/R306/ap/app/zte_comm/at_ctl/src/atconfig/extat_softap_register.c
@@ -485,57 +485,39 @@
 	return AT_END;

 }

 

-void led_set(char *led_name, int val)

+void set_led_states(char *led_list[], int start_index, int count, int state)

 {

+	int i = 0;

 	char cmd[128];

-	sprintf(cmd,"echo %d > /sys/class/leds/%s/brightness", val , led_name);

-	system(cmd);

+	for (i = start_index; i < start_index + count; i++)

+	{

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

+		sprintf(cmd,"echo %d > /sys/class/leds/%s/brightness", state , led_list[i]);

+		system(cmd);

+	}

 }

 

 int ext_at_led_func(char *at_paras, void ** res_msg)

 {

 	int i = 0;

-	char *led_list[7] = {"modem_r_led",

-					"modem_g_led",

-					"modem_b_led",

-					"battery_r_led",

+	char *led_list[7] = {

 					"battery_g_led",

+					"modem_g_led",

 					"eth_led",

-					"wifi_led"};

-			

-	for(i = 0; i < 7; i++)

-	{

-		led_set(led_list[i], 0);

-	}

-	for(i = 0; i < 7; i++)

-	{

-		led_set(led_list[i], 1);

-		usleep(500000);

-		led_set(led_list[i], 0);

-	}

-

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

-	{

-		led_set(led_list[i], 1);

-	}

+					"wifi_led",

+					"battery_r_led",

+					"modem_r_led",

+					"modem_b_led",};			

+	set_led_states(led_list, 0, 7, 0); // turn off all leds

+	set_led_states(led_list, 0, 4, 1); // turn on all green leds

 	usleep(500000);

-	

-	for(i = 2;i < 5; i++)

-	{

-		led_set(led_list[i], 0);

-	}

+	set_led_states(led_list, 0, 4, 0); // turn off all green leds

+	set_led_states(led_list, 4, 2, 1); // turn on all red leds

 	usleep(500000);

-	led_set(led_list[1], 0);

-	led_set(led_list[2], 1);

+	set_led_states(led_list, 4, 2, 0); // turn off all red leds

+	set_led_states(led_list, 6, 1, 1); // turn on all blue leds

 	usleep(500000);

-	led_set(led_list[0], 0);

-	led_set(led_list[1], 1);

-	usleep(500000);

-

-	for(i = 0; i < 7; i++)

-	{

-		led_set(led_list[i], 0);

-	}

+	set_led_states(led_list, 6, 1, 0); // turn off all blue leds

 	return AT_END;

 }

 

diff --git a/lynq/R306/ap/app/zte_comm/zte_mmi/mmi.c b/lynq/R306/ap/app/zte_comm/zte_mmi/mmi.c
index d745805..2d67763 100755
--- a/lynq/R306/ap/app/zte_comm/zte_mmi/mmi.c
+++ b/lynq/R306/ap/app/zte_comm/zte_mmi/mmi.c
@@ -309,6 +309,9 @@
 	case MSG_CMD_RJ11_STATUS_INFO:
 		zMMI_Handle_Msg_Rj11_Status((VOID *)pstMsg->aucDataBuf);
 		break;
+	case MSG_CMD_RJ45_STATUS_INFO:
+		zMMI_Handle_Msg_Rj45_Status((VOID *)pstMsg->aucDataBuf);
+		break;
 	case MSG_CMD_MODIFY_SSID_KEY:
 		zMMI_Handle_Msg_Get_SSID_Key((VOID *)pstMsg->aucDataBuf);
 		break;
@@ -575,9 +578,9 @@
 		mmi_keyStrokes_init();
 	}
 
-	if (strstr(nv_task_tab, "rj45_task")) {
-		mmi_rj45_init();
-	}
+	//if (strstr(nv_task_tab, "rj45_task")) {
+	//	mmi_rj45_init();
+	//}
 	//³õʼ»¯½öÓëledÏà¹ØµÄÒµÎñ £¬ÇëÎâºìʵÏÖ
 	if (g_showMode == MMI_MODE_LED || g_showMode == MMI_MODE_ALL) {
 	}
diff --git a/lynq/R306/ap/app/zte_comm/zte_mmi/mmi_common.h b/lynq/R306/ap/app/zte_comm/zte_mmi/mmi_common.h
index 532b592..13a7f72 100644
--- a/lynq/R306/ap/app/zte_comm/zte_mmi/mmi_common.h
+++ b/lynq/R306/ap/app/zte_comm/zte_mmi/mmi_common.h
@@ -1199,7 +1199,7 @@
 SINT32 zMMI_Handle_Msg_SmsBox_Sattus(VOID *data);
 SINT32 zMMI_Handle_Msg_Voip_Status(VOID *data);
 SINT32 zMMI_Handle_Msg_Rj11_Status(VOID * data);
-
+SINT32 zMMI_Handle_Msg_Rj45_Status(VOID * data);
 SINT32 zMMI_Handle_Msg_Get_SSID_Key(VOID *data);
 SINT32 zMMI_Handle_Msg_BacklightOff(VOID *data);
 SINT32 zMMI_Handle_Msg_Factory_Reset(VOID *data);
diff --git a/lynq/R306/ap/lib/libsoftap/netapi.c b/lynq/R306/ap/lib/libsoftap/netapi.c
new file mode 100644
index 0000000..7c85dfa
--- /dev/null
+++ b/lynq/R306/ap/lib/libsoftap/netapi.c
@@ -0,0 +1,607 @@
+/**
+ * @file Netapi.c
+ * @brief Implementation of Sanechips
+ *
+ * Copyright (C) 2017 Sanechips Technology Co., Ltd.
+ * @author linxu Gebin
+ *
+ * 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.
+ *
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <syslog.h>
+#include <sys/klog.h>
+#include <sys/msg.h>
+#include <sys/socket.h>
+#include <linux/sockios.h>
+#include <sys/un.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include "softap_api.h"
+#include <net/if.h>
+
+/************************ ÍøÂç½Ó¿Ú ************************/
+
+
+
+//¸ù¾ÝÍøÂçÉ豸Ãû»ñÈ¡¶ÔÓ¦µÄÉ豸ID,°´ÕÕÓÅÏȼ¶ÓëNVÖеÄÉ豸Ãû½øÐÐÆ¥Å䣬ʧ°Ü·µ»Ø-1
+int getDevId_byname(char *dev_name)
+{
+	char ps_wan[NETIF_NAME_LEN] = {0};
+	char psext_wan1[NETIF_NAME_LEN] = {0};
+	char psext_wan2[NETIF_NAME_LEN] = {0};
+	char psext_wan3[NETIF_NAME_LEN] = {0};
+	char psext_wan4[NETIF_NAME_LEN] = {0};
+	char psext_wan5[NETIF_NAME_LEN] = {0};
+	char psext_wan6[NETIF_NAME_LEN] = {0};
+	char psext_wan7[NETIF_NAME_LEN] = {0};
+	char psext_wan8[NETIF_NAME_LEN] = {0};
+	char swwanstr[NETIF_NAME_LEN] = {0};
+	char swlanstr[NETIF_NAME_LEN] = {0};
+	char eth_wan[NETIF_NAME_LEN] = {0};
+	char wifi_wan[NETIF_NAME_LEN] = {0};
+	char eth_lan[NETIF_NAME_LEN] = {0};
+	char wifi_lan[NETIF_NAME_LEN] = {0};
+	char usb_lan[NETIF_NAME_LEN] = {0};
+	char sw_name[NV_NAME_LEN] = {0};
+	char lan_enable[NV_NAME_LEN] = {0};
+	printf("netapi:getDevId_byname start!dev_name=%s\n", dev_name);
+
+	//ȱʡÍâÍø¿ÚΪ¿ÕʱºòÒ²¸øÖ÷¿Ø·¢ÏûÏ¢£¬add by zpm 20160628 begin
+	if (strlen(dev_name) == 0) {
+		return NO_DEV;
+	}
+	//ȱʡÍâÍø¿ÚΪ¿ÕʱºòÒ²¸øÖ÷¿Ø·¢ÏûÏ¢£¬add by zpm 20160628 end
+
+	cfg_get_item("pswan", ps_wan, sizeof(ps_wan));
+	cfg_get_item("ps_ext1", psext_wan1, sizeof(psext_wan1));
+	cfg_get_item("ps_ext2", psext_wan2, sizeof(psext_wan2));
+	cfg_get_item("ps_ext3", psext_wan3, sizeof(psext_wan3));
+	cfg_get_item("ps_ext4", psext_wan4, sizeof(psext_wan4));
+	cfg_get_item("ps_ext5", psext_wan5, sizeof(psext_wan1));
+	cfg_get_item("ps_ext6", psext_wan6, sizeof(psext_wan2));
+	cfg_get_item("ps_ext7", psext_wan7, sizeof(psext_wan3));
+	cfg_get_item("ps_ext8", psext_wan8, sizeof(psext_wan4));
+	cfg_get_item("wifiwan", wifi_wan, sizeof(wifi_wan));
+	cfg_get_item("swwanstr", swwanstr, sizeof(swwanstr));
+	cfg_get_item("swlanstr", swlanstr, sizeof(swlanstr));
+	cfg_get_item("ethwan", eth_wan, sizeof(eth_wan));
+	cfg_get_item("ethlan", eth_lan, sizeof(eth_lan));
+	cfg_get_item("wifilan", wifi_lan, sizeof(wifi_lan));
+	cfg_get_item("usblan", usb_lan, sizeof(usb_lan));
+	cfg_get_item("sw", sw_name, sizeof(sw_name));
+	cfg_get_item("LanEnable", lan_enable, sizeof(lan_enable));
+
+	if (!strncmp(dev_name, ps_wan, strlen(dev_name)))
+		return PS_NET_DEV;
+	if ((0 != strcmp(lan_enable, "0")) && !strncmp(dev_name, usb_lan, strlen(dev_name)))
+		return USB_LAN_DEV;
+	if (!strncmp(dev_name, psext_wan1, strlen(dev_name)))
+		return PS_EXT_DEV1;
+	if (!strncmp(dev_name, psext_wan2, strlen(dev_name)))
+		return PS_EXT_DEV2;
+	if (!strncmp(dev_name, psext_wan3, strlen(dev_name)))
+		return PS_EXT_DEV3;
+	if (!strncmp(dev_name, psext_wan4, strlen(dev_name)))
+		return PS_EXT_DEV4;
+	if (!strncmp(dev_name, psext_wan5, strlen(dev_name)))
+		return PS_EXT_DEV5;
+	if (!strncmp(dev_name, psext_wan6, strlen(dev_name)))
+		return PS_EXT_DEV6;
+	if (!strncmp(dev_name, psext_wan7, strlen(dev_name)))
+		return PS_EXT_DEV7;
+	if (!strncmp(dev_name, psext_wan8, strlen(dev_name)))
+		return PS_EXT_DEV8;
+	//µ±½öÒ»¸öRJ45Íø¿Úʱ£¬Ê¼ÖÕµ±ÍâÍø¿ÚÓã¬ÔÙ¼ÓÉÏeth_type£¬¿ÉÒÔʵÏÖÄÚÍø¹¦ÄÜ
+	if (!strncmp(dev_name, eth_wan, strlen(dev_name)) || !strncmp(dev_name, swwanstr, strlen(dev_name)))
+		return RJ45_WAN_DEV;
+	//µ±´æÔÚÁ½¸öRJ45Íø¿Úʱ£¬ÔÚ´ËÉèÖÃÒ»¸ö¹Ì¶¨µÄÄÚÍøRJ45Íø¿Ú
+	if (!strncmp(dev_name, eth_lan, strlen(dev_name)) || !strncmp(dev_name, swlanstr, strlen(dev_name)))
+		return RJ45_LAN_DEV;
+	if (!strncmp(dev_name, wifi_wan, strlen(dev_name)))
+		return WIFI_WAN_DEV;
+	if (!strncmp(dev_name, wifi_lan, strlen(dev_name)))
+		return WIFI_LAN_DEV;
+
+	return -1;
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º set_pswanstate
+* ¹¦ÄÜÃèÊö£º ÉèÖÃpsÍøÂçÉ豸IPv6״̬NVÖµ
+* ²ÎÊý˵Ã÷£º c_id(IN) :PDP¼¤»îµÄc_id
+*            state(IN):ÍøÂçÉ豸״̬
+* ·µ »Ø Öµ£º
+* ÆäËü˵Ã÷£º
+**************************************************************************/
+
+static void set_pswan_v6state(int c_id, int state)
+{
+	char ps_wan[NV_NAME_LEN] = {0};
+	char pswan_state[NETIF_NAME_LEN] = {0};
+
+	cfg_get_item("pswan", ps_wan, sizeof(ps_wan));
+
+	snprintf(pswan_state, sizeof(pswan_state), "%s%d_ipv6_state", ps_wan, c_id);
+
+	if (state == DEV_STATE_WORKING) {
+		cfg_set(pswan_state, "working");
+		return;
+	}
+
+	if (state == DEV_STATE_CONNECT) {
+		cfg_set(pswan_state, "connect");
+		return;
+	}
+	if (state == DEV_STATE_DEAD) {
+		cfg_set(pswan_state, "dead");
+		return;
+	}
+}
+
+static int pdp_state_check(struct pdp_active_info *actinfo)
+{
+	char pdp_act_state[NV_NAME_LEN] = {0};
+	char nv_pdp_state[NV_NAME_LEN] = {0};
+	sprintf(nv_pdp_state, "pdp_act_state_%d", actinfo->c_id);
+	cfg_get_item(nv_pdp_state, pdp_act_state, sizeof(pdp_act_state));
+	if (0 != strcmp(pdp_act_state, "act")) {
+		cfg_set(nv_pdp_state, "acting");
+		return 0;
+	}
+	return 1;
+}
+
+static void plugin_state_set(unsigned char netdev_id)
+{
+	int plugstate;
+	char rj45_pluginstate[NV_NAME_LEN] = {0};
+	char temp[NV_NAME_LEN] = {0};
+	cfg_get_item("rj45_pluginstate", rj45_pluginstate, sizeof(rj45_pluginstate));
+
+	plugstate = atoi(rj45_pluginstate);
+	if (netdev_id == RJ45_WAN_DEV || netdev_id == SW_WAN_DEV) {
+		plugstate |= RJ45_WAN_IN;
+		sprintf(temp, "%d", plugstate);
+		cfg_set("rj45_pluginstate", temp);
+	} else if (netdev_id == RJ45_LAN_DEV || netdev_id == SW_LAN_DEV) {
+		plugstate |= RJ45_LAN_IN;
+		sprintf(temp, "%d", plugstate);
+		cfg_set("rj45_pluginstate", temp);
+	} else if (netdev_id == USB_LAN_DEV) {
+		plugstate = USB_LAN_IN;
+		sprintf(temp, "%d", plugstate);
+		cfg_set("usb_pluginstate", temp);
+	} else if (netdev_id >= PS_EXT_DEV1 && netdev_id <= PS_EXT_DEV8) {
+		sprintf(temp, "psext%d_pluginstate", netdev_id);
+		cfg_set(temp, "1");
+	}
+}
+
+static void plugout_state_set(unsigned char netdev_id)
+{
+	int plugstate;
+	char rj45_pluginstate[NV_NAME_LEN] = {0};
+	char temp[NV_NAME_LEN] = {0};
+
+	cfg_get_item("rj45_pluginstate", rj45_pluginstate, sizeof(rj45_pluginstate));
+	plugstate = atoi(rj45_pluginstate);
+
+	if (netdev_id == RJ45_WAN_DEV || netdev_id == SW_WAN_DEV) {
+		plugstate &= ~RJ45_WAN_IN;
+		sprintf(temp, "%d", plugstate);
+		cfg_set("rj45_pluginstate", temp);
+	} else if (netdev_id == RJ45_LAN_DEV || netdev_id == SW_LAN_DEV) {
+		plugstate &= ~RJ45_LAN_IN;
+		sprintf(temp, "%d", plugstate);
+		cfg_set("rj45_pluginstate", temp);
+	} else if (netdev_id == USB_LAN_DEV) {
+		plugstate = USB_LAN_OUT;
+		sprintf(temp, "%d", plugstate);
+		cfg_set("usb_pluginstate", temp);
+	} else if (netdev_id >= PS_EXT_DEV1 && netdev_id <= PS_EXT_DEV8) {
+		sprintf(temp, "psext%d_pluginstate", netdev_id);
+		cfg_set(temp, "0");
+	}
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º pdp_act_proc
+* ¹¦ÄÜÃèÊö£º PSÍøÂçÉ豸¼¤»î½Ó¿Ú
+* ²ÎÊý˵Ã÷£º pdp_active_info(IN):PDP¼¤»îÐÅÏ¢
+* ·µ »Ø Öµ£º ²Ù×÷³É¹¦·µ»Ø1.
+* ÆäËü˵Ã÷£º atÏà¹ØÓ¦Óýø³Ìµ÷Óã¬Èçatserver¡¢pcserver¡¢VoLTE¡¢²ÊÐŵÈÓ¦Óýø³Ì£»
+* ½Ó¿ÚÄÚ²¿ÊµÏÖ¶ÔÓÚµÄPSÉ豸µÄ¼¤»î¼°ÏàÓ¦µÄÍøÂçÅäÖÃ
+**************************************************************************/
+int ppp_act_proc(char *ttyname)
+{
+	char cmd[200] = {0};
+	char path_sh[50] = {0};
+
+	slog(NET_PRINT, SLOG_ERR, "netapi:calling ppp_act_proc, %s\n", ttyname);
+	cfg_set("ppp_pdpstate", "");
+	cfg_get_item("path_sh", path_sh, sizeof(path_sh));
+	if (!ttyname)
+		return -1;
+	sprintf(cmd, "%s/pppd_up.sh %s", path_sh, ttyname);
+	slog(NET_PRINT, SLOG_ERR, "cmd is %s\n", cmd);
+	soft_system(cmd);
+	return 0;
+}
+
+int pdp_act_proc(struct pdp_active_info *actinfo, int src_id)
+{
+	int ret = 0;
+	//klocwork
+	//int c_id = actinfo->c_id;
+	//unsigned char ip46flag = actinfo->act_info.ip46flag;
+
+	system("cat /proc/uptime 1>dev/console 2>&1");
+	
+	if (!actinfo || actinfo->act_info.ip46flag == V4V6_INVALID) {
+		slog(NET_PRINT, SLOG_ERR, "pdp_act_proc, src_id = %d, actinfo->act_info.ip46flag == V4V6_INVALID\n", src_id);
+
+		softap_assert("ip46flag error"); //klocwork
+		return -1;
+	}
+	slog(NET_PRINT, SLOG_ERR, "netapi:pdp_act_proc: src_id=0x%x, cid=%d pdp_type=%u ip46flag=%u\n", src_id, actinfo->c_id, actinfo->pdp_type, actinfo->act_info.ip46flag);
+
+#if 1  // cov M  actinfo->pdp_type is unsigned, could not compare with 0
+    if (PDP_PPP < actinfo->pdp_type) {
+#else
+	if (PDP_PPP < actinfo->pdp_type || PDP_LOCAL > actinfo->pdp_type) {
+#endif        
+
+		slog(NET_PRINT, SLOG_ERR, "pdp_act_proc, src_id = %d, pdp_type is error: cid=%d pdp_type=%u ip46flag=%u\n", src_id, actinfo->c_id, actinfo->pdp_type, actinfo->act_info.ip46flag);
+		softap_assert("pdp_type=%u error", actinfo->pdp_type);
+		return -1;
+	}
+
+	if (1 == pdp_state_check(actinfo)) {
+
+		slog(NET_PRINT, SLOG_ERR, "pdp_act_init: already act c_id = %d, src_id = %d\n", actinfo->c_id, src_id);
+		//softap_assert("already act");
+		return -1;
+	}
+
+	if (actinfo->act_info.ip46flag == V6_VALID || actinfo->act_info.ip46flag == V46_VALID) {
+		set_pswan_v6state(actinfo->c_id, DEV_STATE_CONNECT);
+	}
+
+	ret = ipc_send_message(src_id, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_PDP_ACT, sizeof(struct pdp_active_info), (UCHAR *)actinfo, 0);  /*lint !e26 !e55*/
+	if (0 != ret) {
+		softap_assert("send msg to zte_router error");
+		return -1;
+	}
+
+	slog(NET_PRINT, SLOG_ERR, "pdp_act_proc: success!\n");
+	return 0;
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º pdp_deact_proc
+* ¹¦ÄÜÃèÊö£º PSÍøÂçÉ豸ȥ»î½Ó¿Ú
+* ²ÎÊý˵Ã÷£º c_id(IN):PDP¼¤»îc_id.
+* ·µ »Ø Öµ£º ²Ù×÷³É¹¦·µ»Ø1.
+* ÆäËü˵Ã÷£º atÏà¹ØÓ¦Óýø³Ìµ÷Óã¬Èçatserver¡¢pcserver¡¢VoLTE¡¢²ÊÐŵÈÓ¦Óýø³Ì£»
+½Ó¿ÚÄÚ²¿ÊµÏÖ¶ÔÓÚµÄPSÉ豸ȥ»î£»Ö§³Ö46µ¥Õ»È¥»î£¬ËùÒÔÈë²ÎÐèҪָʾ46Çé¿ö
+**************************************************************************/
+int pdp_deact_proc(int c_id, unsigned char ip46flag, int src_id)
+{
+	int ret = 0;
+	struct pdp_deactive_info temp;
+	char nv_pdp_state[NV_NAME_LEN] = {0};
+
+	slog(NET_PRINT, SLOG_ERR, "netapi:pdp_deact_proc: src_id=%d, cid=%d ip46flag=%u\n", src_id, c_id, ip46flag);
+
+	sprintf(nv_pdp_state, "pdp_act_state_%d", c_id);
+
+	temp.c_id = c_id;
+	temp.ip46flag = ip46flag;
+
+	if (ip46flag == V4V6_INVALID) {
+		slog(NET_PRINT, SLOG_ERR, "pdp_deact_proc,src_id = %d, ip46flag is error: cid=%d ip46flag=%u\n", src_id, c_id, ip46flag);
+		softap_assert("ip46flag=%u error", ip46flag);
+		return -1;
+	}
+
+	cfg_set(nv_pdp_state, "deacting");
+	ret = ipc_send_message(src_id, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_PDP_DEACT, sizeof(struct pdp_deactive_info), (UCHAR *)&temp, 0); /*lint !e26 !e55*/
+	if (0 != ret) {
+		softap_assert("send msg to zte_router error");
+		return -1;
+	}
+	slog(NET_PRINT, SLOG_ERR, "pdp_deact_proc: success!\n");
+	return 0;
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º netdev_connect_internet
+* ¹¦ÄÜÃèÊö£º webui·¢Ë͵ÄÁ¬½ÓÇëÇó,½Ó¿ÚÄÚ²¿½øÐÐifconfig up£¬²¢Æô¶¯ÏàÓ¦µÄµØÖ··ÖÅä½ø³Ì
+* ²ÎÊý˵Ã÷£º netdev_id£ºÍøÂçÉ豸¶ÔÓ¦µÄºêÃû£¬²Î¼ûUSB_NET_DEVµÈºêÖµ
+* ·µ »Ø Öµ£º ²Ù×÷³É¹¦·µ»Ø1.
+* ÆäËü˵Ã÷£º É豸Ö÷¿ØÄ£¿éµ÷Óô˽ӿÚǰ£¬ÐèÒª¼ì²âµ±Ç°É豸ÎïÀíͨ·ÒÑͨ£¬·ñÔò²»Ó¦¸Ãµ÷Óô˽ӿڣ»
+* Ö÷¿ØÄ£¿éÐèÒªÑÏ¿ØÖظ´µÄµ÷Óøýӿڣ¬ÒòΪÿµ÷ÓÃÒ»´Î¸Ã½Ó¿Ú£¬ÄÚ²¿½Ô»áÖØÐÂÖ´ÐÐÒ»´ÎÍêÕûµÄµØÖ··ÖÅäÁ÷³Ì£»
+**************************************************************************/
+int netdev_connect_internet(unsigned char netdev_id, int src_id)
+{
+	int ret = 0;
+
+	slog(NET_PRINT, SLOG_ERR, "netapi:netdev_connect_internet: netdev_id=%u\n", netdev_id);
+
+	if (netdev_id != RJ45_WAN_DEV && netdev_id != WIFI_WAN_DEV && netdev_id != RJ45_LAN_DEV && netdev_id != WIFI_LAN_DEV) {
+		slog(NET_PRINT, SLOG_ERR, "connect_internet:%u don't support connect op!\n", netdev_id);
+		softap_assert("netdev_id=%d error", netdev_id);
+		return 0;
+	}
+
+	ret = ipc_send_message(src_id, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_CONNECT, sizeof(unsigned char), (UCHAR *)&netdev_id, 0); /*lint !e26 !e55*/
+	if (0 != ret) {
+		softap_assert("send msg to zte_router error");
+		return 0;
+	}
+	return 1;
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º netdev_disconnect_internet
+* ¹¦ÄÜÃèÊö£º webui·¢Ë͵ĶϿªÁ¬½ÓÇëÇó,½Ó¿ÚÄÚ²¿½øÐÐifconfig down£¬²¢É±µôÏàÓ¦µÄµØÖ··ÖÅä½ø³Ì
+* ²ÎÊý˵Ã÷£º netdev_id£ºÍøÂçÉ豸¶ÔÓ¦µÄºêÃû£¬²Î¼ûUSB_NET_DEVµÈºêÖµ
+* ·µ »Ø Öµ£º ²Ù×÷³É¹¦·µ»Ø1.
+* ÆäËü˵Ã÷£º É豸Ö÷¿ØÄ£¿éµ÷Óô˽ӿÚ
+**************************************************************************/
+int netdev_disconnect_internet(unsigned char netdev_id, int src_id)
+{
+	int ret = 0;
+
+	printf("netapi:netdev_disconnect_internet start!netdev_id=%u\n", netdev_id);
+	slog(NET_PRINT, SLOG_ERR, "netapi:netdev_disconnect_internet: netdev_id=%u\n", netdev_id);
+
+	if (netdev_id != RJ45_WAN_DEV && netdev_id != WIFI_WAN_DEV && netdev_id != RJ45_LAN_DEV && netdev_id != WIFI_LAN_DEV) {
+		slog(NET_PRINT, SLOG_ERR, "disconnect_internet:%u don't support disconnect op!\n", netdev_id);
+		softap_assert("netdev_id=%d error", netdev_id);
+
+		return 0;
+	}
+
+	ret = ipc_send_message(src_id, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_DISCON, sizeof(unsigned char), (UCHAR *)&netdev_id, 0); /*lint !e26 !e55*/
+	if (0 != ret) {
+		softap_assert("send msg to zte_router error");
+		return 0;
+	}
+	return 1;
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º netdev_plugin_proc_byname
+* ¹¦ÄÜÃèÊö£º ÈȲå°ÎÉ豸²åÈë,½Ó¿ÚÄÚ²¿¼ì²âÊÇ·ñÐèÒª½øÐÐ×Ô¶¯²¦ºÅ£¬ÈçÐèÒª£¬Ö´ÐеØÖ··ÖÅä¡¢×éÍøµÈÁ÷³Ì
+* ²ÎÊý˵Ã÷£º netdev_name£ºÍøÂçÉ豸Ãû£¬source_id plug¼ì²âÄ£¿éID
+* ·µ »Ø Öµ£º ²Ù×÷³É¹¦·µ»Ø1.
+* ÆäËü˵Ã÷£º É豸Ö÷¿Øµ÷Óô˽ӿÚʱ£¬±íÃ÷¸ÃÍøÂçÉ豸ÎïÀíͨ·ÒÑͨ£¬¿ÉÒÔ½øÐÐIPÊý¾Ý°üµÄÊÕ·¢ÁË
+**************************************************************************/
+int netdev_plugin_proc_byname(char *netdev_name, int src_id)
+{
+	int netdev_id = 0;
+	slog(NET_PRINT, SLOG_ERR, "netdev_plugin_byname, netdev %s is plugin, src_id = %d\n", netdev_name, src_id);
+	netdev_id = getDevId_byname(netdev_name);
+
+	if (netdev_id == -1) {
+		slog(NET_PRINT, SLOG_ERR, "netdev_plugin_proc_byname,netdev_name is error,please connect main control");
+		return -1;
+	} else {
+		return netdev_plugin_proc(netdev_id, src_id);
+	}
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º netdev_plugout_proc
+* ¹¦ÄÜÃèÊö£º ÈȲå°ÎÉ豸°Î³ö,½Ó¿ÚÄÚ²¿½øÐÐifconfig down£¬²¢É±µôÏàÓ¦µÄµØÖ··ÖÅä½ø³Ì
+* ²ÎÊý˵Ã÷£º netdev_name£ºÍøÂçÉ豸Ãû£¬source_id plug¼ì²âÄ£¿éID
+* ·µ »Ø Öµ£º ²Ù×÷³É¹¦·µ»Ø1.
+* ÆäËü˵Ã÷£º É豸Ö÷¿Øµ÷Óô˽ӿÚʱ£¬±íÃ÷¸ÃÍøÂçÉ豸ÎïÀíͨ·ÒѶϣ¬²»ÒªÔÙ½øÐÐIPÊý¾Ý°üÊÕ·¢
+**************************************************************************/
+int netdev_plugout_proc_byname(char *netdev_name, int src_id)
+{
+	int netdev_id = 0;
+	slog(NET_PRINT, SLOG_ERR, "netdev_plugout_byname, netdev %s is plugout, src_id = %d\n", netdev_name, src_id);
+	netdev_id = getDevId_byname(netdev_name);
+
+	if (netdev_id == -1) {
+		slog(NET_PRINT, SLOG_ERR, "netdev_plugout_proc_byname,netdev_name is error,please connect main control");
+		return -1;
+	} else {
+		return netdev_plugout_proc(netdev_id, src_id);
+	}
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º netdev_plugin_proc
+* ¹¦ÄÜÃèÊö£º ÈȲå°ÎÉ豸²åÈë,½Ó¿ÚÄÚ²¿¼ì²âÊÇ·ñÐèÒª½øÐÐ×Ô¶¯²¦ºÅ£¬ÈçÐèÒª£¬Ö´ÐеØÖ··ÖÅä¡¢×éÍøµÈÁ÷³Ì
+* ²ÎÊý˵Ã÷£º netdev_id£ºÍøÂçÉ豸¶ÔÓ¦µÄºêÃû£¬²Î¼ûUSB_NET_DEVµÈºêÖµ
+* ·µ »Ø Öµ£º ²Ù×÷³É¹¦·µ»Ø1.
+* ÆäËü˵Ã÷£º É豸Ö÷¿Øµ÷Óô˽ӿÚʱ£¬±íÃ÷¸ÃÍøÂçÉ豸ÎïÀíͨ·ÒÑͨ£¬¿ÉÒÔ½øÐÐIPÊý¾Ý°üµÄÊÕ·¢ÁË
+**************************************************************************/
+int netdev_plugin_proc(unsigned char netdev_id, int src_id)
+{
+	int ret = 0;
+
+	printf("netapi:netdev_plugin_proc start!netdev_id=%u\n", netdev_id);
+	slog(NET_PRINT, SLOG_ERR, "netapi:netdev_plugin_proc: netdev_id=%u\n", netdev_id);
+	plugin_state_set(netdev_id);
+	if (netdev_id == RJ45_WAN_DEV || netdev_id == SW_WAN_DEV || netdev_id == RJ45_LAN_DEV || netdev_id == SW_LAN_DEV)
+	{
+		ret = ipc_send_message(MODULE_ID_CALL_CTRL, MODULE_ID_MMI, MSG_CMD_RJ45_STATUS_INFO, 0, NULL, 0);
+		if (0 != ret) {
+			softap_assert("send msg to mmi error");
+		}
+	}
+	ret = ipc_send_message2(src_id, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_PLUGIN, sizeof(unsigned char), (UCHAR *)&netdev_id, 0); /*lint !e26 !e55*/
+
+	if (0 != ret) {
+		softap_assert("send msg to zte_router error");
+		return 0;
+	}
+#ifdef _USE_MBIM	
+	slog(NET_PRINT, SLOG_ERR, "netapi:netdev_plugin_proc: send MSG_CMD_NET_PLUGIN to MBIM\n");
+	ipc_send_message2(src_id, MODULE_ID_MBIM, MSG_CMD_NET_PLUGIN, sizeof(unsigned char), (UCHAR *)&netdev_id, 0); 
+#endif
+	return 1;
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º netdev_plugout_proc
+* ¹¦ÄÜÃèÊö£º ÈȲå°ÎÉ豸°Î³ö,½Ó¿ÚÄÚ²¿½øÐÐifconfig down£¬²¢É±µôÏàÓ¦µÄµØÖ··ÖÅä½ø³Ì
+* ²ÎÊý˵Ã÷£º netdev_id£ºÍøÂçÉ豸¶ÔÓ¦µÄºêÃû£¬²Î¼ûUSB_NET_DEVµÈºêÖµ
+* ·µ »Ø Öµ£º ²Ù×÷³É¹¦·µ»Ø1.
+* ÆäËü˵Ã÷£º É豸Ö÷¿Øµ÷Óô˽ӿÚʱ£¬±íÃ÷¸ÃÍøÂçÉ豸ÎïÀíͨ·ÒѶϣ¬²»ÒªÔÙ½øÐÐIPÊý¾Ý°üÊÕ·¢
+**************************************************************************/
+int netdev_plugout_proc(unsigned char netdev_id, int src_id)
+{
+	int ret = 0;
+
+	printf("netapi:netdev_plugout_proc start!netdev_id=%u\n", netdev_id);
+	slog(NET_PRINT, SLOG_ERR, "netapi:netdev_plugout_proc: netdev_id=%u\n", netdev_id);
+	plugout_state_set(netdev_id);
+	slog(NET_PRINT, SLOG_ERR, "netdev_plugout_proc: netdev_id=%u\n", netdev_id);
+	if (netdev_id == RJ45_WAN_DEV || netdev_id == SW_WAN_DEV || netdev_id == RJ45_LAN_DEV || netdev_id == SW_LAN_DEV)
+	{
+		ret = ipc_send_message(MODULE_ID_CALL_CTRL, MODULE_ID_MMI, MSG_CMD_RJ45_STATUS_INFO, 0, NULL, 0);
+		if (0 != ret) {
+			softap_assert("send msg to mmi error");
+		}
+	}
+	ret = ipc_send_message2(src_id, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_PLUGOUT, sizeof(unsigned char), (UCHAR *)&netdev_id, 0); /*lint !e26 !e55*/
+
+	if (0 != ret) {
+		softap_assert("send msg to zte_router error");
+		return 0;
+	}
+#ifdef _USE_MBIM
+	ipc_send_message2(src_id, MODULE_ID_MBIM, MSG_CMD_NET_PLUGOUT, sizeof(unsigned char), (UCHAR *)&netdev_id, 0);
+#endif
+	return 1;
+}
+/********************************************************************
+* º¯ÊýÃû³Æ£º tcpip_reset_configure
+* ¹¦ÄÜÃèÊö£º »Ö¸´³ö³§ÉèÖÃʱÓÉååzte_blc½ø³Ìµ÷Óã¬É¾³ý³ÌÐòÔËÐÐÖÐÉú³ÉµÄÎļþ
+* ²ÎÊý˵Ã÷£º ÎÞ
+* ·µ »Ø Öµ£º ÎÞ
+* ÆäËü˵Ã÷£º
+**********************************************************************/
+void tcpip_reset_configure()
+{
+	char cmd[200] = {0};
+	char path_script[50] = {0};
+	char path_conf[50] = {0};
+	char path_file[200] = {0};
+	printf("netapi:tcpip_reset_configure start!\n");
+	cfg_get_item("path_conf", path_conf, sizeof(path_conf));
+	sprintf(path_file, "%s/hostname_mac_file", path_conf);
+
+
+	//»Ö¸´³ö³§ÉèÖÃʱɾ³ýhostname_mac_fileÎļþ
+	sprintf(cmd, "/bin/rm -rf %s", path_file);
+	zxic_system(cmd);
+	//»Ö¸´³ö³§ÉèÖÃʱɾ³ýstatic_macip_file  Îļþ
+	memset(path_file, 0, sizeof(path_file));
+	sprintf(path_file, "%s/static_macip_file", path_conf);
+	memset(cmd, 0, sizeof(cmd));
+	sprintf(cmd, "/bin/rm -rf %s", path_file);
+	zxic_system(cmd);
+
+	memset(path_file, 0, sizeof(path_file));
+	sprintf(path_file, "%s/children_device_file", path_conf);
+	memset(cmd, 0, sizeof(cmd));
+	sprintf(cmd, "/bin/rm -rf %s", path_file);
+	zxic_system(cmd);
+
+	memset(path_file, 0, sizeof(path_file));
+	sprintf(path_file, "%s/white_site_file", path_conf);
+	memset(cmd, 0, sizeof(cmd));
+	sprintf(cmd, "/bin/rm -rf %s", path_file);
+	zxic_system(cmd);
+
+	/*reset DDNS status file*/
+	memset(path_file, 0, sizeof(path_file));
+	sprintf(path_file, "%s/inadyn.status", path_conf);
+	memset(cmd, 0, sizeof(cmd));
+	sprintf(cmd, "/bin/rm -rf %s", path_file);
+	zxic_system(cmd);
+
+	//»Ö¸´³ö³§ÉèÖÃʱ½«MAC-IP°ó¶¨¹æÔòÇå¿Õ
+	cfg_get_item("path_sh", path_script, sizeof(path_script));
+	memset(cmd, 0, sizeof(cmd));
+	sprintf(cmd, "%s/config-udhcpd.sh \"lan\" -S", path_script);
+	soft_system(cmd);
+}
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º tc_control
+* ¹¦ÄÜÃèÊö£º Á÷Á¿¿ØÖÆ
+* ²ÎÊý˵Ã÷£º ÐèÒªÁ÷Á¿¼à¿ØµÄÉÏÏÂÐÐÁ¿£¬Êý¾Ý¿¨ÐèÒªÓÐcid£¬ufiģʽ²»ÐèÒª
+*            0±íʾ²»ÐèÒªÁ÷¿Ø£¬µ¥Î»:bit£¬Òòlinux±ê×¼ÃüÁîÊǶÔ×Ö½Ú´¦Àí£¬ËùÒÔ×îÖÕÅäÖÃÖµ»áÕû³ý8
+* ·µ »Ø Öµ£º ²Ù×÷³É¹¦·µ»Ø1.
+* ÆäËü˵Ã÷£º ¸øÐèÒªÁ÷Á¿¿ØÖƵÄÓ¦Óõ÷Óã¬ÈçÉÏÐÐÐèÒªÁ÷¿Ø£¬ÇëµÈÄÜÉÏÍâÍøºóÔÙµ÷Ó㬷ñÔòÎÞ·¨»ñÈ¡ÍâÍø¿Ú½øÐÐÁ÷¿Ø
+*                 Õý³£¹Ø»úÖØÐ¿ª»ú£¬Ö®Ç°ÉèÖõÄÁ÷¿ØÒÀÈ»ÓÐЧ
+**************************************************************************/
+int tc_control(struct tc_control_info *tcinfo, int src_id)
+{
+	int ret = 0;
+
+	printf("netapi:tc_control start! c_id:%d, down:%u, up:%u\n, src:%d \n", tcinfo->c_id, tcinfo->tc_downlink, tcinfo->tc_uplink, src_id);
+
+	ret = ipc_send_message(src_id, MODULE_ID_MAIN_CTRL, MSG_CMD_NET_TC_CTRL, sizeof(struct tc_control_info), (UCHAR *)tcinfo, 0);
+	if (0 != ret) {
+		softap_assert("send msg to zte_router error");
+		return 0;
+	}
+	return 1;
+}
+
+#define SIOCDEVPRIVATE 0X89F0
+#define SIOCVLAN		SIOCDEVPRIVATE+0x0	
+
+/**************************************************************************
+* º¯ÊýÃû³Æ£º set_ethwan_mode
+* ¹¦ÄÜÃèÊö£º ÉèÖÃswitchÉ豸eth0.200Íø¿Ú¶ÔÓ¦µÄport3Ϊwan¿Ú»¹ÊÇlan¿Ú
+* ²ÎÊý˵Ã÷£º mode:1 => wan¿Ú£¬0 => lan¿Ú
+* ·µ »Ø Öµ£º ÎÞ.
+* ÆäËü˵Ã÷£º 
+**************************************************************************/
+void set_ethwan_port_mode(int mode)
+{
+	struct ifreq ifr;
+	int fd;
+	char eth_name[IFNAMSIZ] = {'e','t','h','0'};
+	
+	if(mode != 0 && mode != 1)
+	{
+		return;
+	}
+	slog(NET_PRINT, SLOG_ERR, "set_ethwan_port_mode() mode=%d\n", mode);	
+	if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+		slog(NET_PRINT, SLOG_ERR, "set_eth200_mode() socket(AF_INET,SOCK_STREAM) fail");
+		return;
+	}
+	memset(&ifr, 0, sizeof(ifr));
+	memcpy((void*)ifr.ifr_name, (void*)eth_name, strlen("eth0"));//gmacÍø¿ÚÃû³Æeth0£¬ºóÐø¿¼ÂÇÊÇ·ñͨ¹ýÐÂÔönvÏî»ñÈ¡
+	ifr.ifr_data = (void*)&mode;
+
+	if (ioctl(fd, SIOCVLAN, &ifr) < 0 && errno != EINVAL) {
+		slog(NET_PRINT, SLOG_ERR, "set_eth200_mode() ioctl fail");		
+		close(fd);
+		return;
+	}
+
+	close(fd);
+
+}
+
+
diff --git a/lynq/R306/boot/common/src/loader/cpu/m0/start.S b/lynq/R306/boot/common/src/loader/cpu/m0/start.S
new file mode 100755
index 0000000..c1d22c1
--- /dev/null
+++ b/lynq/R306/boot/common/src/loader/cpu/m0/start.S
@@ -0,0 +1,243 @@
+/*
+ * (C) Copyright 2016 ZXIC Inc.
+ *
+ */
+
+#include <config.h>
+#include <board.h>
+#include <load_mode.h>
+
+.globl stack_setup
+
+stack:
+#if (CONFIG_DL_DISABLE)
+	.word	0x045A0000    /* DL port: 0x5A->Disable. */
+#else
+	.word	0x04000000    /* DL port: 0x00->Enable. */
+#endif
+	.word	0x3537585A    /* = string "57XZ" */
+	.word	0x31563132    /* = string "1V12" */
+	.word	0x00001E70	  /* zdata size = 8K - HdrSize = 8192 - 400 = 7792 Bytes = 0x1E70*/
+
+	/* NOT used now, Just reverse memory for RSA/HASH in near future. */
+	.word	0x00000000    /*puk_rsa_d*/
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+
+	.word	0x00000000    /*puk_rsa_n*/
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+
+	.word	0x00000000    /*hash_y*/
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000
+	.word	0x00000000	/* VID+PID */
+#if defined(CFG_ZLOAD)
+	.word	0x00102800
+	.word	_start - 0x100000 + 0x8A001    /* TBD: MACRO instead of number. */
+#else
+	.word	0x0008A000
+	.word	_start + 0x1
+#endif
+	.word	loop + 1
+	.word	loop + 1
+	
+.globl _bss_start
+_bss_start:
+	.word __bss_start
+	nop
+	nop
+
+.globl _bss_end
+_bss_end:
+	.word __bss_end
+
+.globl _para_start
+_para_start:
+	.word __para_start
+
+.globl _para_end
+_para_end:
+	.word __para_end
+	
+.globl _start
+_start:
+	ldr	r3, =0x0013C800
+	mov	r0, #3 
+	lsl	r2, r0, #28
+	mvn	r0, r2
+	ldr	r2, [r3, #0x4]
+	and	r0, r0, r2
+	str	r0, [r3, #0x4]
+	ldr	r3, =0x0013D040
+	ldr	r0, [r3]
+	ldr	r2, =0x0100
+	mvn	r2, r2
+	and	r0, r0, r2
+	str	r0, [r3]
+	ldr	r0, [r3, #0x18]
+	ldr	r2, =0x0100
+	ORR	r0, r0, r2
+	str	r0, [r3, #0x18]
+	
+#if defined(CFG_ZLOAD)
+	/* check stage1 state */
+	ldr	r3,=CFG_START_STAGE1_ADDR
+	ldr	r4,=CFG_START_STAGE1_STATE
+	ldr	r5, [r3]
+	cmp r4, r5
+	beq set_stack
+	
+	ldr	r0, =0x8a000
+	msr	MSP, r0
+	
+	bl copy_to_iram1
+	ldr	r3,=0x1001B1    /* 0x1b1 = 0x194(header len) + 0x1c(first Ins. offset) + 0x1(16bit thumb instruction) */
+	mov	pc,r3
+set_stack:
+	/* Set up the stack */
+	ldr	r2, =0x100000
+	ldr	r3,=0x194    /*header len=0x194*/
+	add	r2,r3
+	ldr	r0, [r2]
+	msr	MSP, r0
+
+#else
+
+	/* Set up the stack */
+	ldr	r2, =stack
+	ldr	r3,=0x194    /*header len=0x194*/
+	add	r2,r3
+	ldr	r0, [r2]
+	msr	MSP, r0
+
+#endif    /* CFG_ZLOAD */	
+
+/* clear the bss */
+clear_bss:
+	ldr 	r3, =_bss_start
+	ldr	r0, [r3]       /* find start of bss segment     */
+	ldr 	r3, =_bss_end
+	ldr	r1, [r3]       /* stop here                     */
+	cmp	r0, r1
+	beq	clbss_over
+	mov 	r2, #0x0   /* clear value                   */
+clbss_l:
+	str	r2, [r0]       /* clear BSS location            */
+	add	r0, r0, #4     /* increment clear index pointer */
+	cmp	r0, r1         /* are we at the end yet         */	
+	bne	clbss_l        /* keep clearing till at end     */
+clbss_over:
+
+/* remove the para section */
+	ldr	r3, =_para_start
+	ldr 	r4, [r3]
+	ldr	r3, =_para_end
+	ldr 	r1, [r3]
+	sub	r1, r1, r4
+	ldr 	r3, =_bss_end	
+	ldr	r0, [r3]
+	add	r1, r1, r0
+	cmp	r0, r1
+	beq	remove_over
+re_move:	
+	ldr	r2, [r0]
+	str	r2, [r4]
+	add 	r4, r4, #4
+	add	r0, r0, #4    /* increment clear index pointer    */
+	cmp	r0, r1        /* are we at the end yet            */	
+	bne	re_move
+remove_over:
+
+	b	start_armboot
+
+loop:
+	b loop
+
diff --git a/lynq/R306/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_mifi_mini.c b/lynq/R306/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_mifi_mini.c
index 8b6cbc4..75cccd8 100755
--- a/lynq/R306/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_mifi_mini.c
+++ b/lynq/R306/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_mifi_mini.c
@@ -478,12 +478,20 @@
 {
 	unsigned int poweron_type = reg32(POWERON_TYPE_ADDR);	 //ÁÙʱʹÓÃ
 
+/*
 	if (poweron_type == POWER_ON_CHARGING) {
 		pmu_pull_off_ps_hold();
 	} else {
 		pmu_pull_on_ps_hold();
 	}
 
+*/
+#if 1
+	zx234290_set_softon(1);
+#else
+	zx234290_set_softon(0);
+	pmu_pull_off_ps_hold();
+#endif
 	display_boot_animation(poweron_type);
 
 	return 0;