ソースを参照

能成功升级GT7288固件

Signed-off-by: robbin <robbin@wingcool.cn>
robbin 4 年 前
コミット
5f5fb3988c

+ 427 - 1164
app/src/main/java/com/example/administrator/wingcool_gt9_apk/FirmwareUpdate.java

@@ -98,24 +98,26 @@ public class FirmwareUpdate extends AppCompatActivity
     private TextView mShow;
     private TextView tvUpDataResult;
     
-    int FW_HEAD_LENGTH	=		14;
-    int FW_SECTION_LENGTH	=	0x2000; 	/** 8K */
-    int FW_DSP_ISP_LENGTH	=	0x1000;	/**  4K */
+    int FW_HEAD_LENGTH	=		0x80;
+    int FW_SECTION_LENGTH	=	0x1000; 	/** 4K */
+    int FW_DSP_ISP_LENGTH	=	0x800;	/**  2K */
     int FW_DSP_LENGTH	=		0x1000;	/** 4K */
-    int FW_BOOT_LENGTH	=		0x800;	/**  2K */
-    int FW_SS51_LENGTH	=		(4 * FW_SECTION_LENGTH);	/**  32K */
-    int FW_BOOT_ISP_LENGTH	=	0x800;	/**  2k */
-    int FW_GLINK_LENGTH	=		0x3000;	/**  12k */
-    int FW_GWAKE_LENGTH		=	(4 * FW_SECTION_LENGTH) ; /**  32k */
+    //int FW_BOOT_LENGTH	=		0x800;	/**  2K */
+    int FW_SS51_LENGTH	=		(8 * FW_SECTION_LENGTH);	/**  32K */
+    //int FW_BOOT_ISP_LENGTH	=	0x800;	/**  2k */
+    //int FW_GLINK_LENGTH	=		0x3000;	/**  12k */
+    //int FW_GWAKE_LENGTH		=	(4 * FW_SECTION_LENGTH) ; /**  32k */
 
     int FW_HEAD_OFFSET   =       0;
-    int FW_SS51_OFFSET	 =		(FW_HEAD_OFFSET + FW_HEAD_LENGTH);
-    int FW_DSP_OFFSET	=		(FW_SS51_OFFSET + FW_SS51_LENGTH);
-    int FW_BOOT_OFFSET	=		(FW_DSP_OFFSET + FW_DSP_LENGTH);
-    int FW_BOOT_ISP_OFFSET	=	(FW_BOOT_OFFSET + FW_BOOT_LENGTH);
-    int FW_GLINK_OFFSET		=	(FW_BOOT_ISP_OFFSET + FW_BOOT_ISP_LENGTH);
-    int FW_GWAKE_OFFSET		=	(FW_GLINK_OFFSET + FW_GLINK_LENGTH);
-    int FW_DSP_ISP_OFFSET	=	(FW_GWAKE_OFFSET + FW_GWAKE_LENGTH);
+    int FW_DSP_ISP_OFFSET	=	(FW_HEAD_OFFSET + FW_HEAD_LENGTH);
+    int FW_DSP_OFFSET	=		(FW_DSP_ISP_OFFSET + FW_DSP_ISP_LENGTH);
+    int FW_SS51_OFFSET	 =		(FW_DSP_OFFSET + FW_DSP_LENGTH);
+
+    //int FW_BOOT_OFFSET	=		(FW_DSP_OFFSET + FW_DSP_LENGTH);
+    //int FW_BOOT_ISP_OFFSET	=	(FW_BOOT_OFFSET + FW_BOOT_LENGTH);
+    //int FW_GLINK_OFFSET		=	(FW_BOOT_ISP_OFFSET + FW_BOOT_ISP_LENGTH);
+    //int FW_GWAKE_OFFSET		=	(FW_GLINK_OFFSET + FW_GLINK_LENGTH);
+
 
     private byte mSendGetGt9VersionData[]={
             0x03,0x00,0x0f,(byte)0x81,0x40,0x00,0x06,0x00,
@@ -147,6 +149,28 @@ public class FirmwareUpdate extends AppCompatActivity
     public String Update_log2;
     String updateLogShow= "";
 
+    //==============头部信息是大端在前======================//
+    //typedef struct _ST_SUBSYS_FW_INFO {
+    byte type;    //32
+    int ilength;  //33,34
+    int address;  //35,36
+    private byte[] RES = new byte[3];  //37-39
+    //}ST_SUBSYS_FW_INFO, *PST_SUBSYS_FW_INFO;
+
+    //typedef struct _ST_FW_INFO {
+    long llength;    //0-3
+    int checksum;    //4,5
+    private byte[] target_mask = new byte[6];  //6-11
+    private byte[] target_mask_version = new byte[3];  //12-14
+    private byte[] pid = new byte[6];  //15-20
+    private byte[] version = new byte[3];  //21-23
+    byte subsystem_count; //24
+    byte chip_type;  //25
+    private byte[] reserved = new byte[6];  //26-31
+    //ST_SUBSYS_FW_INFO subsystem[12];
+    //}ST_FW_INFO, *PST_FW_INFO;
+    //====================================================//
+
     Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
@@ -158,8 +182,6 @@ public class FirmwareUpdate extends AppCompatActivity
             switch (msg.what) {
                 case CONNECTED_SUCCESS://车机和手机连接成功
                     btnReadVersion.setEnabled(true);
-                    btn_update.setEnabled(true);
-                    btn_AutoUpdate.setEnabled(true);
                     //loopReceiverMessage();
                     break;
 
@@ -268,7 +290,7 @@ public class FirmwareUpdate extends AppCompatActivity
             @Override
             public void run() {
                  SystemClock.sleep(100);
-                 Update_log1 =  "";  //升级成功
+                 Update_log1 =  "UPDATE START...";  //升级成功
                  updateLogShow =  "";
                  Update_log2 =  "";
                  mHandler.sendEmptyMessage(UPDATE_FW);
@@ -495,31 +517,52 @@ public class FirmwareUpdate extends AppCompatActivity
                 mSendData = mSendGetGt9VersionData;
                 isSendMessage = false;
 
+                iicWriteCommand((byte)0x12,(byte)0,(byte)0,0,57);
+
+                while(true) {
+                    SystemClock.sleep(100);
+
+                    iicRead((byte) 0x81, (byte) 0x4e, mBytes, 1);
+                    if (mBytes[0] == (byte)0)
+                    {
+                        break;
+                    }
+
+                    iicWriteCommand((byte) 0x0f, (byte) 0x81, (byte) 0x4e, 0, 1);
+                }
+
                 addressH = (byte)0x81;
                 addressL = (byte)0x40;
                 iicRead(addressH,addressL,mBytes,32);
 
-                int v = mBytes[5] & 0xFF;
+                int v = mBytes[4] & 0xFF;
                 String hv = Integer.toHexString(v);
                 if (hv.length() < 2){
                     hv = "0" + hv;
                 }
                 mVersionShow[0] = hv;
 
-                v = mBytes[6] & 0xFF;
+                v = mBytes[5] & 0xFF;
                 hv = Integer.toHexString(v);
                 if (hv.length() < 2){
                     hv = "0" + hv;
                 }
                 mVersionShow[1] = hv;
 
-                v = mBytes[7] & 0xFF;
+                v = mBytes[6] & 0xFF;
                 hv = Integer.toHexString(v);
                 if (hv.length() < 2){
                     hv = "0" + hv;
                 }
                 mVersionShow[2] = hv;
 
+                v = mBytes[7] & 0xFF;
+                hv = Integer.toHexString(v);
+                if (hv.length() < 2){
+                    hv = "0" + hv;
+                }
+                mVersionShow[3] = hv;
+
                 if (mBytes[0] == 0x39 && mBytes[1] == 0x31 && mBytes[2] == 0x31 && mBytes[3] == 0x32){
                     mShow.setText( "GT9110H_" + mVersionShow[1].toString() + mVersionShow[0].toString() );//输出显示
                 }
@@ -527,12 +570,15 @@ public class FirmwareUpdate extends AppCompatActivity
                     mShow.setText( "GT6108H_" + mVersionShow[1].toString() + mVersionShow[0].toString() );//输出显示
                 }
                 else if (mBytes[0] == 0x37 && mBytes[1] == 0x32 && mBytes[2] == 0x38 && mBytes[3] == 0x38){
-                    mShow.setText( "GT7288_" + mVersionShow[0].toString() + "." + mVersionShow[1].toString() + "." + mVersionShow[2].toString());//输出显示
+                    mShow.setText( "GT7288_" + mVersionShow[0] + "." + mVersionShow[1] + "." + mVersionShow[2] + "." + mVersionShow[3]);//输出显示
                 }
                 else{
                     mShow.setText( "Null" );//输出显示
                 }
 
+                btn_update.setEnabled(true);
+                btn_AutoUpdate.setEnabled(true);
+
                 break;
 
             case R.id.btnAutoUpdate:
@@ -667,6 +713,54 @@ public class FirmwareUpdate extends AppCompatActivity
 
     };
 
+    //发送命令,使得S818可以通过IIC向GT9的固定地址写任意bytes的数据
+    private  boolean iicWriteCommand(byte command,byte addressHigh,byte addressLow,int offset,int length) {
+        int i;
+
+        iicWriteData[1] = 0x01; //write GT9PT command
+        iicWriteData[2] = command; //command
+        iicWriteData[3] = addressHigh;
+        iicWriteData[4] = addressLow;
+        iicWriteData[5] = 0x00;
+        iicWriteData[6] = 0x39;  //length 57
+
+        int address1 = ((addressHigh&0xff)<<8);
+        int address2 = addressLow&0xff;
+        int address = address1|address2;
+
+        int sendTimes = length/57 + 1;  //预计是向下取整,所以+1
+
+        for (int k = 0; k < sendTimes; k++) {
+            int finalOffset = offset + k*57; //每次只能发57bytes数据
+
+            if(length - (finalOffset -offset) < 57) {
+
+                iicWriteData[6] = (byte) (length - (finalOffset -offset));  //length
+            }
+            else
+            {
+                iicWriteData[6] = 0x39;
+            }
+
+            for (int j = 7; j < 64; j++) {
+                iicWriteData[j] = 0;//wBuffer[finalOffset + j -7];
+            }
+            i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointOut, iicWriteData, 0, 0x40, 100);
+
+            if (i != 0x40) {
+                //editname.setText("iicWrite Failed");
+                return false;
+
+            }
+
+            address = address + 57;
+            iicWriteData[3] = (byte)(address>>8);
+            iicWriteData[4] = (byte)address;
+        }
+
+        return true;
+    }
+
     //发送命令,使得S818可以通过IIC向GT9的固定地址读取任意bytes的数据
     private boolean iicRead(byte addressHigh,byte addressLow,byte[] wBuffer,int length) {
 
@@ -922,7 +1016,7 @@ public class FirmwareUpdate extends AppCompatActivity
         }
 
         maddressHigh = (byte)0x40;
-        maddressLow = (byte)0xB0;  //_rRW_MISCTL__SWRST_B0_
+        maddressLow = (byte)0xB0;  //_bRW_MISCTL__TMR0_EN
         if (0x00 == iicByteRead(maddressHigh,maddressLow))
         {
             //FwUpdateMessage(L"[FW update]Disable watch dog", MSG_NOR);
@@ -939,12 +1033,24 @@ public class FirmwareUpdate extends AppCompatActivity
             return false;
         }
 
-
         maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x4B;  //_bRW_MISCTL__CACHE_EN
+        maddressLow = (byte)0x10;  //_bRW_MISCTL__CACHE_EN
         byte mdata = (byte)0x00;
         byte msubcommand =0x0f ;  //no command
         if (!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+        {
+            //  FwUpdateMessage(L"[FW update]Clear cache enable failed", MSG_ERR);
+            //  mError.setText("[FW update]Clear cache enable failed");
+            Update_log = "[FW update]Clear 0x4010 enable failed";
+            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+            return false;
+        }
+
+        maddressHigh = (byte)0x40;
+        maddressLow = (byte)0x4B;  //_bRW_MISCTL__CACHE_EN
+        mdata = (byte)0x00;
+        //msubcommand =0x0f ;  //no command
+        if (!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
         {
           //  FwUpdateMessage(L"[FW update]Clear cache enable failed", MSG_ERR);
           //  mError.setText("[FW update]Clear cache enable failed");
@@ -954,20 +1060,56 @@ public class FirmwareUpdate extends AppCompatActivity
         }
         // FwUpdateMessage(L"[FW update]Clear cache enable", MSG_NOR);
 
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;  //_rRW_MISCTL__BOOT_CTL_
+        maddressHigh = (byte)0x41;
+        maddressLow = (byte)0x84;   //_bWO_MISCTL__CPU_SWRST_PULSE
+        mdata = (byte)0x01;
+        if (!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+        {
+            //FwUpdateMessage(L"[FW update]Clear update ctrlflag failed", MSG_ERR);
+            // mError.setText("[FW update]Clear update ctrlflag failed");
+            Update_log = "[FW update]set _bWO_MISCTL__CPU_SWRST_PULSE failed";
+            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+            return false;
+        }
+
+        maddressHigh = (byte)0x42;
+        maddressLow = (byte)0x18;  //_rRW_MISCTL__BOOT_OPT_B0_
         mdata = (byte)0x00;
         if (!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+        {
+            //FwUpdateMessage(L"[FW update]Clear update ctrlflag failed", MSG_ERR);
+            // mError.setText("[FW update]Clear update ctrlflag failed");
+            Update_log = "[FW update]Clear _rRW_MISCTL__BOOT_OPT_B0_ failed";
+            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+            return false;
+        }
+
+        maddressHigh = (byte)0x40;
+        maddressLow = (byte)0x48;  //_bRW_MISCTL__SRAM_BANK
+        mdata = (byte)0x04;
+        if (!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+        {
+            //FwUpdateMessage(L"[FW update]Clear update ctrlflag failed", MSG_ERR);
+            // mError.setText("[FW update]Clear update ctrlflag failed");
+            Update_log = "[FW update]set _bRW_MISCTL__SRAM_BANK failed";
+            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+            return false;
+        }
+
+        maddressHigh = (byte)0x40;
+        maddressLow = (byte)0x4D;  //_rRW_MISCTL__BOOT_CTL_
+        mdata = (byte)0x01;
+        if (!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
         {
             //FwUpdateMessage(L"[FW update]Clear update ctrlflag failed", MSG_ERR);
            // mError.setText("[FW update]Clear update ctrlflag failed");
-            Update_log = "[FW update]Clear update ctrlflag failed";
+            Update_log = "[FW update]set 0x404D failed";
             mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
             return false;
         }
        // FwUpdateMessage(L"[FW update]Clear update ctrlflag", MSG_NOR);
        // mError.setText("[FW update]Clear update ctrlflag");
-        Update_log = "[FW update]Clear update ctrlflag";
+        Update_log = "[FW update]Enter Update Mode";
         mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
 
         return true;
@@ -1063,6 +1205,7 @@ public class FirmwareUpdate extends AppCompatActivity
     }
 
     byte[] mGt9FirmwareData = new byte[88*1024+512];
+    byte[] m_nComparBuf = new byte[88*1024+512];
     /**
     public void readFile() throws IOException {
         //打开文件输入流
@@ -1081,6 +1224,7 @@ public class FirmwareUpdate extends AppCompatActivity
         byte msubcommand =0x0f ;  //no command
         byte mdata = (byte)0x02;
 
+        /*
         if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata)) {
 
            // FwUpdateMessage(L"Set boot from sram failed", MSG_ERR);
@@ -1130,7 +1274,7 @@ public class FirmwareUpdate extends AppCompatActivity
             mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
             return false;
         }
-
+        */
 
         maddressHigh = (byte)0xC0;
         maddressLow = (byte)0x00;   //_bRW_MISCTL__SRAM_BANK   3
@@ -1175,15 +1319,15 @@ public class FirmwareUpdate extends AppCompatActivity
                 else {
 
                     if(bottonMode == 3) {
-                        InputStream config = getResources().openRawResource(R.raw.gt9110h_config_2018110802);
+                        //InputStream config = getResources().openRawResource(R.raw.gt9110h_config_2018110802);
                         //InputStream config = getResources().openRawResource(R.raw.xinjian);\
-                        config.read(mConfigData);
+                        //config.read(mConfigData);
 
-                        InputStream fis = getResources().openRawResource(R.raw.gt9110h_2002);
+                        InputStream fis = getResources().openRawResource(R.raw.gt7288_06_00_21_00);
                         //gt9110h_config_20181108
                         fis.read(mGt9FirmwareData);
 
-                        config.close();
+                        //config.close();
                         fis.close();
                     }
 
@@ -1227,1192 +1371,311 @@ public class FirmwareUpdate extends AppCompatActivity
         //return false;
         //int mOffset = mGt9FirmwareData.length - mDspIsplength;
 
-//mGt9FirmwareData
-if(true) {
-    if (mGt9FirmwareData[1] == 0x01 && mGt9FirmwareData[2] == 0x60) {
-        if (!iicWrite(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, FW_DSP_ISP_LENGTH)) {
-            // FwUpdateMessage(L"Set boot from sram failed", MSG_ERR);
-           // mError.setText("burn 4k dsp_isp failed");
-            Update_log = "burn 4k dsp_isp failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-
-            return false;
+        //mGt9FirmwareData
+        if(true) {
+            //if (mGt9FirmwareData[1] == 0x01 && mGt9FirmwareData[2] == 0x60) {
+                if (!iicWrite(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, FW_DSP_ISP_LENGTH)) {
+                    // FwUpdateMessage(L"Set boot from sram failed", MSG_ERR);
+                   // mError.setText("burn 4k dsp_isp failed");
+                    Update_log = "burn 2k dsp_isp failed";
+                    mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
 
-        } else {
-            //mError.setText("burn 4k dsp_isp successed");
-            Update_log = "burn 4k dsp_isp successed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-    } else {
-       // mError.setText("get FW data error, burn 4k dsp_isp failed");
-        Update_log = "get FW data error, burn 4k dsp_isp failed";
-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                    return false;
 
+                } else {
+                    //mError.setText("burn 4k dsp_isp successed");
+                    Update_log = "burn 2k dsp_isp successed";
+                    mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                }
+            /*
+            } else {
+               // mError.setText("get FW data error, burn 4k dsp_isp failed");
+                Update_log = "get FW data error, burn 4k dsp_isp failed";
+                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
 
 
-        return false;
-    }
 
-        // if (!recallCheck(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, FW_DSP_ISP_LENGTH)) {
-        maddressHigh = (byte) 0xC0;
-        maddressLow = (byte) 0x00;
-        //if (!recallCheck(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, 2500))
-        //    {
-        //    mError.setText("recall check error,burn 4k dsp_isp failed");
-        //    return false;
-        //}
-        //else
-        {
-            //if (!recallCheck(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET+2500, 100))
-            if (!recallCheck(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, FW_DSP_ISP_LENGTH)) {
-                //mError.setText("recall check error,burn 4k dsp_isp failed");
-                Update_log = "recall check error,burn 4k dsp_isp failed";
-                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
                 return false;
-            } else {
-                //mError.setText("recall check success,burn 4k dsp_isp failed");
-                Update_log = "recall check success,burn 4k dsp_isp success";
-                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-                //return false;
-
             }
-        }
-
+            */
+
+                // if (!recallCheck(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, FW_DSP_ISP_LENGTH)) {
+                maddressHigh = (byte) 0xC0;
+                maddressLow = (byte) 0x00;
+                //if (!recallCheck(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, 2500))
+                //    {
+                //    mError.setText("recall check error,burn 4k dsp_isp failed");
+                //    return false;
+                //}
+                //else
+                {
+                    //if (!recallCheck(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET+2500, 100))
+                    if (!recallCheck(maddressHigh, maddressLow, mGt9FirmwareData, FW_DSP_ISP_OFFSET, FW_DSP_ISP_LENGTH)) {
+                        //mError.setText("recall check error,burn 4k dsp_isp failed");
+                        Update_log = "recall check error,burn 2k dsp_isp failed";
+                        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                        return false;
+                    } else {
+                        //mError.setText("recall check success,burn 4k dsp_isp failed");
+                        Update_log = "recall check success,burn 2k dsp_isp success";
+                        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                        //return false;
 
-    maddressHigh = (byte) 0x42;
-    maddressLow = (byte) 0x18;   //_rRW_MISCTL__BOOT_OPT_B0_   4
-    msubcommand = 0x0f;  //no command
-    mdata = (byte) 0x00;
+                    }
+                }
 
-    if (!iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata)) {
-        //mError.setText("set scramble failed");
-        Update_log = "set scramble failed";
-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        return false;
-    }
 
-    maddressHigh = (byte) 0x40;
-    maddressLow = (byte) 0x48;   //_bRW_MISCTL__SRAM_BANK   5
-    msubcommand = 0x0f;  //no command
-    mdata = (byte) 0x03;
+            maddressHigh = (byte) 0x40;
+            maddressLow = (byte) 0x4D;   //_rRW_MISCTL__BOOT_OPT_B0_   4
+            msubcommand = 0x0f;  //no command
+            mdata = (byte) 0x00;
 
-    if (!iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata)) {
-        //mError.setText("select bank3 failed");
-        Update_log = "select bank3 failed";
-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        return false;
-    }
+            if (!iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata)) {
+                //mError.setText("set scramble failed");
+                Update_log = "set scramble failed";
+                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                return false;
+            }
+/*
+            byte RegData[] = { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 };
 
+            maddressHigh = (byte) 0x80;
+            maddressLow = (byte) 0x06;   //_bRW_MISCTL__SRAM_BANK   5
 
-}
-        return true;
-//return false;
-    }
+            if (!iicWrite(maddressHigh,maddressLow,RegData,0,8))
+            {
+                Update_log = "write 0x8006 failed";
+                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                return false;
 
-    byte[] eraseBuf = new byte[0x800+0x1000];
-    private boolean eraseBootLoader() {
+            }
+*/
+            maddressHigh = (byte) 0x80;
+            maddressLow = (byte) 0x06;   //_bRW_MISCTL__SRAM_BANK   5
+            msubcommand = 0x0f;  //no command
+            mdata = (byte) 0x55;
+
+            iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata);
+            maddressLow++;
+            iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata);
+            maddressLow++;
+            iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata);
+            maddressLow++;
+            iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata);
+            maddressLow++;
+            iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata);
+            maddressLow++;
+            iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata);
+            maddressLow++;
+            iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata);
+            maddressLow++;
+            iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata);
+
+
+            maddressHigh = (byte) 0x41;
+            maddressLow = (byte) 0x80;   //_rRW_MISCTL__SWRST_B0_
+            msubcommand = 0x0f;  //no command
+            mdata = (byte) 0x08;
+
+            if (!iicByteWrite(maddressHigh, maddressLow, msubcommand, mdata)) {
+                //mError.setText("select bank3 failed");
+                Update_log = "select _rRW_MISCTL__SWRST_B0_ failed";
+                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                return false;
+            }
 
+            SystemClock.sleep(15);
 
+            iicRead((byte) 0x80, (byte) 0x06, mBytes, 2);
+            if ((mBytes[0] != (byte)0xAA) && (mBytes[1] != (byte)0xBB))
+            {
+                Update_log = "0x8006 flag is wrong";
+                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+                return false;
 
-        //memset(pBuf, 0xFF, 0x800);
-        for (int i = 0; i < 0x1800; i++)
-        {
-            eraseBuf[i] = (byte)0xFF;
+            }
         }
+        return true;
+        //return false;
+    }
 
-        byte maddressHigh = (byte)0x41;
-        byte maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x0C;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        maddressHigh = (byte)0x42;
-        maddressLow = (byte)0x18;  //_rRW_MISCTL__BOOT_OPT_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x00;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        maddressHigh = (byte)0x41;
-        maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x04;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x48;  //_bRW_MISCTL__SRAM_BANK
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x03;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
+    int GetCheckSum(byte[] pBuf, int offser, int nLength)
+    {
+        int CheckSum = 0;
 
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;
-        //int mOffset = 0;
-        // int mBootlength = 0x800;
+        for (int i = 0; i < nLength; i += 2) {
+            CheckSum += (((int)pBuf[i + offser]) << 8);
+            CheckSum += pBuf[i + offser + 1];
+        }
+        return CheckSum;
+    }
 
+    private boolean updateProc() {
 
-       // iicWrite(maddressHigh,maddressLow,pBuf,0,0x800);
-       if(! iicWrite(maddressHigh,maddressLow,eraseBuf,0,0x800))
+        if (!enterUpdateMode())  //NO1
         {
-            // FwUpdateMessage(L"Set boot from sram failed", MSG_ERR);
-         //   mError.setText("burn fw_boot failed");
-            Update_log = "burn fw_boot failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+            //FwUpdateMessage(L"[FW update]Enter update mode failed", MSG_ERR);
             return false;
-
         }
-        else
-        {
-          //  mError.setText("burn fw_boot successed");
-            Update_log = "burn fw_boot successed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
 
+        if (!burnDspIsp()) {   //NO2
+                // FwUpdateMessage(L"[FW update]Burn DSP isp failed", MSG_ERR);
+                return false;
         }
-        SystemClock.sleep(1);
 
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;  //_rRW_MISCTL__BOOT_CTL_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x06;
+        int offset = FW_DSP_OFFSET;
+        int ilength;
+        int iaddress;
+        byte btype;
 
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
+        Update_log = "Update Section Start...";
+        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
 
-        int nTryTimes = 1000;
-        byte  bRet;
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;
-        do
+        for (int i = 1,j = 0; i < mGt9FirmwareData[24]; i++,j++)
         {
-            bRet = iicByteRead(maddressHigh,maddressLow);
-            if (bRet == 0)
-            {
-                break;
-            }
-        }
-        while ((--nTryTimes) != 0);
+            int len;
+            int checksum;
+            int tempindex;
 
-        if (nTryTimes == 0)
-        {
-            // FwUpdateMessage(L"move data to flash failed", MSG_ERR);
-          //  mError.setText("[eraseBoot]move data to flash failed");
-            Update_log = "[eraseBoot]move data to flash failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+            tempindex = 40 + j * 8;
 
-            return false;
-        }
+            ilength = (int)mGt9FirmwareData[tempindex + 1] * 256 + mGt9FirmwareData[tempindex + 2];  //m_pFwInfo->subsystem[i].length
+            iaddress = (int)mGt9FirmwareData[tempindex + 3] * 256 + mGt9FirmwareData[tempindex + 4];  //subSys->address
+            btype = mGt9FirmwareData[tempindex];
 
+            for (int offsetindex = 0; offsetindex < ilength; offsetindex += FW_SECTION_LENGTH, iaddress += 0x10)
+            {
+                if (offsetindex + FW_SECTION_LENGTH > ilength)
+                {
+                    len = ilength - offsetindex;
+                }
+                else
+                {
+                    len = FW_SECTION_LENGTH;
+                }
 
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;
-        if (!recallCheck(maddressHigh, maddressLow, eraseBuf, 0, 0x800)) {
-                // mError.setText("recall check error,erase bootloader ");
-                Update_log = "recall check error,erase bootloader ";
-                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-                return false;
-        } else {
-                // mError.setText("recall check success,erase bootloader");
-                Update_log = "recall check success,erase bootloader ";
-                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-                //return false;
 
-        }
+                checksum = GetCheckSum(mGt9FirmwareData, offset, len);
+
+                checksum += len;
+
+                checksum += iaddress;
+
+                checksum = 0 - checksum;
+
+                byte maddressHigh = (byte)0x81;
+                byte maddressLow = (byte)0x00;   //0x8100
+                byte msubcommand =0x0f ;  //no command
+                byte mdata = (byte)(len >> 8);
+                if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+                    return false;
+
+                maddressLow++;  //8101
+                mdata = (byte)len;
+                if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+                    return false;
+
+                maddressHigh = (byte)0x81;
+                maddressLow = (byte)0x02;  //0x8102
+                mdata = (byte)(iaddress >> 8);
+                if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+                    return false;
+
+                maddressLow++;  //0x8103
+                mdata = (byte)iaddress;
+                if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+                    return false;
+
+                maddressHigh = (byte)0x81;
+                maddressLow = (byte)0x04;
+                if (!iicWrite(maddressHigh,maddressLow,mGt9FirmwareData,offset + offsetindex,len))
+                    return false;
+
+                maddressHigh = (byte)((0x8104 + len) >> 8);
+                maddressLow = (byte)(0x8104 + len);
+                mdata = (byte)(checksum >> 8);
+                if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+                    return false;
+
+                maddressLow++;  //地址加1
+                mdata = (byte)checksum;
+                if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+                    return false;
+
+                maddressHigh = (byte)0x80;
+                maddressLow = (byte)0x22;
+                mdata = (byte)0;
+                if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+                    return false;
+
+                maddressHigh = (byte)0x80;
+                maddressLow = (byte)0x20;
+                mdata = btype;
+                if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+                    return false;
+
+                maddressHigh = (byte)0x80;
+                maddressLow = (byte)0x22;
+                byte readcount = 0;
+                while(readcount < 50) {
+                    iicRead(maddressHigh, maddressLow, mBytes, 1);
+
+                    if (mBytes[0] == 0xBB)
+                    {
+                        break;
+                    }
 
-        return true;
-    }
+                    readcount++;
+                }
 
-    private boolean burnFwGwakeSection(int offSet, byte wAddresshigh,byte wAddresslow, int wLen, byte bBankCmd)
-    {
-        byte maddressHigh = (byte)0x41;
-        byte maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_  hold dsp
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x0c;
+                maddressHigh = (byte)0x81;
+                maddressLow = (byte)0x04;
+                if (!iicRead(maddressHigh, maddressLow, m_nComparBuf, len))
+                    return false;
 
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
+                while (--len >= 0)
+                {
+                    if (m_nComparBuf[len] != mGt9FirmwareData[offset + offsetindex + len])
+                    {
+                        return false;
+                    }
+                }
+            }
 
-        maddressHigh = (byte)0x42;
-        maddressLow = (byte)0x18;  //_rRW_MISCTL__BOOT_OPT_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x00;
+            offset += ilength;
+        }
 
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
+        Update_log = "Update Section FW Success";
+        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
 
-        maddressHigh = (byte)0x41;
-        maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_  release dsp
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x04;
+        /*
+        byte cmd[] = { 0x60, 0x00, (byte)0xA0 };
 
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+        if (!iicWrite((byte)0x80,(byte)0x40,cmd,0,3))
             return false;
+        */
 
-        SystemClock.sleep(1);
-
-        byte bank =  (byte)((bBankCmd >> 4) & 0x0F);
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x48;  //_rRW_MISCTL__SWRST_B0_  release dsp
-        //byte msubcommand =0x0f ;  //no command
-        mdata = bank;
+        if(!iicByteWrite((byte)0x80,(byte)0x40, (byte)0x0f, (byte)0x60))
+            return false;
+        if(!iicByteWrite((byte)0x80,(byte)0x41, (byte)0x0f, (byte)0x00))
+            return false;
+        if(!iicByteWrite((byte)0x80,(byte)0x42, (byte)0x0f, (byte)0xA0))
+            return false;
 
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
+        if(!iicByteWrite((byte)0x40,(byte)0xB0,(byte)0x0f,(byte)0x00))
             return false;
 
-       // int mOffset = 0x00;
-        Update_log2="";
-        if(! iicWrite(wAddresshigh,wAddresslow,mGt9FirmwareData,offSet,wLen))
-        {
-            // FwUpdateMessage(L"Set boot from sram failed", MSG_ERR);
-          //  mError.setText("burn [fwGwOrLink] section failed");
-            Update_log2 = "burn [fwGwOrLink] section failed\n";
-           // mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+        if(!iicByteWrite((byte)0x41,(byte)0x80,(byte)0x0f,(byte)0x01))
             return false;
 
-        }
-        else
-        {
-           // mError.setText("burn [fwGwOrLink] section successed");
-            Update_log2 =Update_log2.concat("burn [fwGwOrLink] section successed\n") ;
-         //   mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
+        SystemClock.sleep(30);
 
-        }
-
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;  //_rRW_MISCTL__SWRST_B0_  release dsp
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)(bBankCmd & 0x0f);
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        int nTryTimes = 1000;
-        byte  bRet;
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;
-        do
-        {
-            bRet = iicByteRead(maddressHigh,maddressLow);
-            if (bRet == 0)
-            {
-                break;
-            }
-        }
-        while ((--nTryTimes) != 0);
-
-        if (nTryTimes == 0)
-        {
-           // FwUpdateMessage(L"move data to flash failed", MSG_ERR);
-           // mError.setText("[fwGwOrLink]move data to flash failed");
-            //Update_log = "[fwGwOrLink]move data to flash failed";
-            Update_log2 =Update_log2.concat("[fwGwOrLink]move data to flash failed\n") ;
-            //mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-        if (!recallCheck(wAddresshigh,wAddresslow,mGt9FirmwareData,offSet,wLen)) {
-            //mError.setText("recall check error[fwGwOrLink] ");
-            Update_log2 =Update_log2.concat("recall check error[fwGwOrLink]\n") ;
-            //mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        } else {
-           // mError.setText("recall check success[fwGwOrLink]");
-           // Update_log = "recall check success[fwGwOrLink]";
-            Update_log2 =Update_log2.concat("recall check success[fwGwOrLink]\n") ;
-           // mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            //return false;
-        }
-       // FwUpdateMessage(L"move data to flash complete......", MSG_NOR);
-     //   mError.setText("[fwGwOrLink]move data to flash complet");
-       // Update_log = "[fwGwOrLink]move data to flash complet";
-       // mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-
-        Update_log2 =Update_log2.concat("[fwGwOrLink]move data to flash complet\n") ;
-
-        return true;
-    }
-    private boolean burnFwGwake() {
-
-
-        byte maddressHigh = (byte)0x50;
-        byte maddressLow = (byte)0x94;  //_rRW_MISCTL__SWRST_B0_
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x00;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        //burnFwGwakeSection(mGt9FirmwareData,FW_GWAKE_OFFSET, 0x90,0x00, FW_SECTION_LENGTH,0x3A);
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;
-        mdata = (byte)0x3A;
-        if (!burnFwGwakeSection(FW_GWAKE_OFFSET, maddressHigh,maddressLow, FW_SECTION_LENGTH,mdata))
-        {
-           // FwUpdateMessage(L"[update gwake]Begin burn seciton1 failed", MSG_ERR);
-         //   mError.setText("[fwGw]Begin burn seciton1 failed");
-            Update_log = "[fwGw]Begin burn seciton1 failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-        else
-        {
-           // FwUpdateMessage(L"[update gwake]Begin burn seciton1 seccessfully", MSG_NOR);
-           // mError.setText("[fwGw]Begin burn seciton1 seccessfully");
-            Update_log = "[fwGw]Begin burn seciton1 seccessfully";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-        // FwUpdateMessage(L"[update gwake]Begin burn seciton2", MSG_NOR);
-        mdata = (byte)0x3B;
-        if (!burnFwGwakeSection(FW_GWAKE_OFFSET+FW_SECTION_LENGTH, maddressHigh,maddressLow, FW_SECTION_LENGTH,mdata))
-        {
-           // FwUpdateMessage(L"[update gwake]Begin burn seciton2 failed", MSG_ERR);
-           // mError.setText("[update gwake]Begin burn seciton2 failed");
-            Update_log = "[update gwake]Begin burn seciton2 failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-        else
-        {
-           // FwUpdateMessage(L"[update gwake]Begin burn seciton2 seccessfully", MSG_NOR);
-          //  mError.setText("[update gwake]Begin burn seciton2 seccessfully");
-            Update_log = "[update gwake]Begin burn seciton2 seccessfully";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-        //FwUpdateMessage(L"[update gwake]Begin burn seciton3", MSG_NOR);
-        mdata = (byte)0x3C;
-        if (!burnFwGwakeSection(FW_GWAKE_OFFSET+FW_SECTION_LENGTH*2, maddressHigh,maddressLow, FW_SECTION_LENGTH,mdata))
-        {
-           // FwUpdateMessage(L"[update gwake]Begin burn seciton3 failed", MSG_ERR);
-          //  mError.setText("[update gwake]Begin burn seciton3 failed");
-            Update_log = "[update gwake]Begin burn seciton3 failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-        else
-        {
-            //FwUpdateMessage(L"[update gwake]Begin burn seciton3 seccessfully", MSG_NOR);
-           // mError.setText("[update gwake]Begin burn seciton3 seccessfully");
-            Update_log = "[update gwake]Begin burn seciton3 seccessfully";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-        //FwUpdateMessage(L"[update gwake]Begin burn seciton4", MSG_NOR);
-        mdata = (byte)0x3D;
-        if (!burnFwGwakeSection(FW_GWAKE_OFFSET+FW_SECTION_LENGTH*3, maddressHigh,maddressLow, FW_SECTION_LENGTH,mdata))
-        {
-           // FwUpdateMessage(L"[update gwake]Begin burn seciton4 failed", MSG_ERR);
-            //mError.setText("[update gwake]Begin burn seciton4 failed");
-            Update_log = "[update gwake]Begin burn seciton4 failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-        else
-        {
-            //FwUpdateMessage(L"[update gwake]Begin burn seciton4 seccessfully", MSG_NOR);
-            //mError.setText("[update gwake]Begin burn seciton4 seccessfully");
-            Update_log = "[update gwake]Begin burn seciton4 seccessfully";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-
-        }
-
-        //FwUpdateMessage(L"[update gwake]burn gwake firmware seccessfully----<<", MSG_NOR);
-       // mError.setText("[update gwake]burn gwake firmware seccessfully----<<");
-        Update_log = "[update gwake]burn gwake firmware seccessfully----<<";
+        Update_log = "upgrade is finished";
         mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
 
         return true;
     }
 
-    private boolean burnFwSection(byte[] wBuffer,int offSet, byte wAddresshigh,byte wAddresslow, int wLen, byte bBankCmd)
-    {
-        byte maddressHigh = (byte)0x41;
-        byte maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_  hold dsp
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x0c;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        maddressHigh = (byte)0x42;
-        maddressLow = (byte)0x18;  //_rRW_MISCTL__BOOT_OPT_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x00;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-/**
-        maddressHigh = (byte)0x41;
-        maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_  release dsp
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x04;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
- */
-
-        byte bank =  (byte)((bBankCmd >> 4) & 0x0F);
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x48;  //_rRW_
-        mdata = bank;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x49;  //_rRW_
-        mdata =(byte)0x01;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        // int mOffset = 0x00;
-        Update_log2= "";
-        if(! iicWrite(wAddresshigh,wAddresslow,wBuffer,offSet,wLen))
-        {
-            // FwUpdateMessage(L"Set boot from sram failed", MSG_ERR);
-           // mError.setText("burn fw51 section failed");
-            Update_log2 = "burn fw51 section failed\n";
-            //mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-
-        }
-        else
-        {
-          //  mError.setText("burn fw51 section successed");
-            Update_log2 = "burn fw51 section successed\n";
-           // mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-        maddressHigh = (byte)0x41;
-        maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_  release dsp
-        mdata = (byte)(0x04);
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        SystemClock.sleep(1);
-
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;  //_rRW_MISCTL__SWRST_B0_  release dsp
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)(bBankCmd & 0x0f);
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        int nTryTimes = 1000;
-        byte  bRet;
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;
-        do
-        {
-            bRet = iicByteRead(maddressHigh,maddressLow);
-            if (bRet == 0)
-            {
-                break;
-            }
-        }
-        while ((--nTryTimes) != 0);
-
-        if (nTryTimes == 0)
-        {
-            // FwUpdateMessage(L"move data to flash failed", MSG_ERR);
-           // mError.setText("[fw51]move data to flash failed");
-           // Update_log = "[fw51]move data to flash failed";
-           // mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            Update_log2 =Update_log2.concat("[fw51]move data to flash failed\n") ;
-            return false;
-        }
-
-
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x48;  //_rRW_
-        mdata = (byte)((bBankCmd >> 4) & 0x0F);
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x49;  //_rRW_
-        mdata = (byte)(0x01);
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        if (!recallCheck(wAddresshigh,wAddresslow,wBuffer,offSet,wLen)) {
-           // mError.setText("recall check error[fw51] ");
-           // Update_log = "recall check error[fw51] ";
-           // mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-
-            Update_log2 =Update_log2.concat("[fw51]move data to flash failed\n") ;
-            return false;
-        } else {
-          //  mError.setText("recall check success[fw51]");
-           // Update_log = "recall check success[fw51] ";
-           // mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-
-            Update_log2 =Update_log2.concat("recall check success[fw51]\n") ;
-            //return false;
-        }
-        // FwUpdateMessage(L"move data to flash complete......", MSG_NOR);
-
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x49;  //_rRW_
-        mdata = (byte)(0x00);
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-      //  mError.setText("[fw51]move data to flash complet");
-       // Update_log = "[fw51]move data to flash complete ";
-       // mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        Update_log2 =Update_log2.concat("[fw51]move data to flash complete\n") ;
-
-        return true;
-    }
-
-    private boolean burnFwSS51() {
-
-       // FwUpdateMessage(L"[update SS51]Begin burn ss51 firmware---->>", MSG_NOR);
-
-       // FwUpdateMessage(L"[update SS51]Clear burn flag", MSG_NOR);
-
-        byte maddressHigh = (byte)0x50;
-        byte maddressLow = (byte)0x94;  //_rRW_MISCTL__SWRST_B0_
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x00;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        maddressHigh = (byte)0xC0;
-        maddressLow = (byte)0x00;
-        mdata = (byte)0x01;
-        // FwUpdateMessage(L"[update SS51]Begin burn seciton1", MSG_NOR);
-        if (!burnFwSection(mGt9FirmwareData,FW_SS51_OFFSET, maddressHigh,maddressLow, FW_SECTION_LENGTH,mdata))
-        {
-           // FwUpdateMessage(L"[update SS51]Begin burn seciton1 failed", MSG_ERR);
-            //mShow.setText("[update SS51]Begin burn seciton1 failed");
-            Update_log = "[update SS51]Begin burn seciton1 failed ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-        else
-        {
-            //FwUpdateMessage(L"[update SS51]Begin burn seciton1 seccessfully", MSG_NOR);
-           // mShow.setText("[update SS51]Begin burn seciton1 seccessfully");
-            Update_log = "[update SS51]Begin burn seciton1 seccessfully ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-        maddressHigh = (byte)0xE0;
-        maddressLow = (byte)0x00;
-        mdata = (byte)0x02;
-        // FwUpdateMessage(L"[update SS51]Begin burn seciton2", MSG_NOR);
-        if (!burnFwSection(mGt9FirmwareData,FW_SS51_OFFSET+FW_SECTION_LENGTH, maddressHigh,maddressLow, FW_SECTION_LENGTH,mdata))
-        {
-            // FwUpdateMessage(L"[update SS51]Begin burn seciton1 failed", MSG_ERR);
-          //  mShow.setText("[update SS51]Begin burn seciton2 failed");
-            return false;
-        }
-        else
-        {
-            //FwUpdateMessage(L"[update SS51]Begin burn seciton1 seccessfully", MSG_NOR);
-          //  mShow.setText("[update SS51]Begin burn seciton2 seccessfully");
-        }
-
-        maddressHigh = (byte)0xC0;
-        maddressLow = (byte)0x00;
-        mdata = (byte)0x13;
-        // FwUpdateMessage(L"[update SS51]Begin burn seciton2", MSG_NOR);
-        if (!burnFwSection(mGt9FirmwareData,FW_SS51_OFFSET+FW_SECTION_LENGTH*2, maddressHigh,maddressLow, FW_SECTION_LENGTH,mdata))
-        {
-            // FwUpdateMessage(L"[update SS51]Begin burn seciton1 failed", MSG_ERR);
-           // mShow.setText("[update SS51]Begin burn seciton3 failed");
-            return false;
-        }
-        else
-        {
-            //FwUpdateMessage(L"[update SS51]Begin burn seciton1 seccessfully", MSG_NOR);
-           // mShow.setText("[update SS51]Begin burn seciton3 seccessfully");
-        }
-
-        maddressHigh = (byte)0xE0;
-        maddressLow = (byte)0x00;
-        mdata = (byte)0x14;
-        // FwUpdateMessage(L"[update SS51]Begin burn seciton2", MSG_NOR);
-        if (!burnFwSection(mGt9FirmwareData,FW_SS51_OFFSET+FW_SECTION_LENGTH*3, maddressHigh,maddressLow, FW_SECTION_LENGTH,mdata))
-        {
-            // FwUpdateMessage(L"[update SS51]Begin burn seciton1 failed", MSG_ERR);
-           // mShow.setText("[update SS51]Begin burn seciton4 failed");
-            return false;
-        }
-        else
-        {
-            //FwUpdateMessage(L"[update SS51]Begin burn seciton1 seccessfully", MSG_NOR);
-          //  mShow.setText("[update SS51]Begin burn seciton4 seccessfully");
-        }
-
-       // FwUpdateMessage(L"[update SS51]burn ss51 firmware seccessfully----<<", MSG_NOR);
-        //mShow.setText("[update SS51]burn ss51 firmware seccessfully----<<");
-        return true;
-    }
-
-    private boolean burnFwDSP() {
-       // FwUpdateMessage(L"[update DSP]Begin burn dsp firmware---->>", MSG_NOR);
-
-       // FwUpdateMessage(L"[update DSP]hold ss51 & dsp", MSG_NOR);
-        byte maddressHigh = (byte)0x41;
-        byte maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x0c;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        // FwUpdateMessage(L"[update DSP]set scramble", MSG_NOR);
-        maddressHigh = (byte)0x42;
-        maddressLow = (byte)0x18;  //_rRW_MISCTL__SWRST_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x00;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        // FwUpdateMessage(L"[update DSP]hold ss51 & release dsp", MSG_NOR);
-
-         maddressHigh = (byte)0x41;
-         maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_
-       // byte msubcommand =0x0f ;  //no command
-         mdata = (byte)0x04;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        // FwUpdateMessage(L"[update DSP]select bank3", MSG_NOR);
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x48;  //_rRW_MISCTL__SWRST_B0_
-        // byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x03;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;  //_rRW_MISCTL__SWRST_B0_
-        // byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x03;
-        // FwUpdateMessage(L"[update DSP]burn 4k dsp firmware", MSG_NOR);
-        //if (!m_pI2CDevice->I2CWrite(0x9000, m_pbBuf + FW_DSP_OFFSET, FW_DSP_LENGTH))
-        if(!iicWrite(maddressHigh,maddressLow,mGt9FirmwareData,FW_DSP_OFFSET,FW_DSP_LENGTH))
-        {
-           // FwUpdateMessage(L"[update DSP]burn 4k dsp firmware failed", MSG_ERR);
-          //  mError.setText("[update DSP]burn 4k dsp firmware failed");
-            Update_log = "[update DSP]burn 4k dsp firmware failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-
-        //Sleep(1);
-        SystemClock.sleep(1);
-        //FwUpdateMessage(L"[update DSP]send burn cmd to move data to flash from sram", MSG_NOR);
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;  //_rRW_MISCTL__SWRST_B0_
-        // byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x05;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata)) {
-            return false;
-        }
-
-        // FwUpdateMessage(L"[update DSP]Wait for the burn is complete......", MSG_NOR);
-
-        int nTryTimes = 1000;
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;  //_rRW_MISCTL__SWRST_B0_
-        do
-        {
-            if (iicByteRead(maddressHigh,maddressLow)== 0)
-            {
-                break;
-            }
-        }
-        while (nTryTimes-- != 0);
-
-        if (nTryTimes == 0)
-        {
-           // FwUpdateMessage(L"[update DSP]move data to flash failed", MSG_ERR);
-           // mError.setText("[update DSP]move data to flash failed");
-            Update_log = "[update DSP]move data to flash failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-        else{
-            Update_log = "[update DSP]move data to flash success";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-        //FwUpdateMessage(L"[update DSP]recall check 4k dsp firmware", MSG_NOR);
-        // if (!RecallCheck(m_pbBuf + FW_DSP_OFFSET, 0x9000, FW_DSP_LENGTH))
-        {
-            // FwUpdateMessage(L"[update DSP]recall check 4k dsp firmware failed", MSG_ERR);
-            // return false;
-        }
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;  //_rRW_MISCTL__SWRST_B0_
-        if (!recallCheck(maddressHigh,maddressLow,mGt9FirmwareData,FW_DSP_OFFSET,FW_DSP_LENGTH)) {
-            //mError.setText("recall check error[fwDSP] ");
-            Update_log = "recall check error[fwDSP] ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        } else {
-        //    mError.setText("recall check success[fwDSP]");
-            Update_log = "recall check success[fwDSP]";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            //return false;
-        }
-       // FwUpdateMessage(L"[update DSP]burn DSP firmware seccessfully----<<", MSG_NOR);
-        //mError.setText("[update DSP]burn DSP firmware seccessfully----<<");
-        Update_log = "[update DSP]burn DSP firmware seccessfully----<<";
-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-
-        return true;
-    }
-
-    private boolean burnFwLink() {
-
-
-        // if (FW_GLINK_OFFSET > m_nBinFileLen)
-        {
-            //  FwUpdateMessage(L"[update Link]needn`t burn Link", MSG_NOR);
-            //   return true;
-        }
-
-        // FwUpdateMessage(L"[update Link]Begin burn link firmware---->>", MSG_NOR);
-
-        // FwUpdateMessage(L"[update Link]Clear burn flag", MSG_NOR);
-        byte maddressHigh = (byte)0x50;
-        byte maddressLow = (byte)0x94;  //_rRW_MISCTL__SWRST_B0_
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x00;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        // FwUpdateMessage(L"[update Link]Begin burn seciton1", MSG_NOR);
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;
-        mdata = (byte)0x38;
-       // if (!BurnFwGwakeSection(m_pbBuf + FW_GLINK_OFFSET, 0x9000, FW_SECTION_LENGTH, 0x38))
-        if(!burnFwGwakeSection(FW_GLINK_OFFSET,maddressHigh,maddressLow,FW_SECTION_LENGTH,mdata))
-        {
-           // FwUpdateMessage(L"[update Link]Begin burn seciton1 failed", MSG_ERR);
-           // mError.setText("[update Link]Begin burn seciton1 failed");
-            Update_log = "[update Link]Begin burn seciton1 failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-        else
-        {
-           // FwUpdateMessage(L"[update Link]Begin burn seciton1 seccessfully", MSG_NOR);
-           // mError.setText("[update Link]Begin burn seciton1 seccessfully");
-            Update_log = "[update Link]Begin burn seciton1 seccessfully";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-        //  FwUpdateMessage(L"[update Link]Begin burn seciton2", MSG_NOR);
-
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;
-        mdata = (byte)0x39;
-        // if (!BurnFwGwakeSection(m_pbBuf + FW_GLINK_OFFSET, 0x9000, FW_SECTION_LENGTH, 0x38))
-        if(!burnFwGwakeSection(FW_GLINK_OFFSET+FW_SECTION_LENGTH,maddressHigh,maddressLow,FW_GLINK_LENGTH -FW_SECTION_LENGTH,mdata))
-        {
-            // FwUpdateMessage(L"[update Link]Begin burn seciton1 failed", MSG_ERR);
-           // mError.setText("[update Link]Begin burn seciton2 failed");
-            Update_log = "[update Link]Begin burn seciton2 failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-        else
-        {
-            // FwUpdateMessage(L"[update Link]Begin burn seciton1 seccessfully", MSG_NOR);
-           // mError.setText("[update Link]Begin burn seciton2 seccessfully");
-            Update_log = "[update Link]Begin burn seciton2 seccessfully";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-       // FwUpdateMessage(L"[update Link]burn link firmware seccessfully----<<", MSG_NOR);
-       // mError.setText("[update Link]burn link firmware seccessfully----<<");
-        Update_log = "[update Link]burn link firmware seccessfully----<<";
-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        return true;
-    }
-
-    private boolean burnFwBoot() {
-        //  FwUpdateMessage(L"[update bootloader]Begin burn bootloader firmware---->>.", MSG_NOR);
-
-        // FwUpdateMessage(L"[update bootloader]hold ss51 & dsp", MSG_NOR);
-        byte maddressHigh = (byte)0x41;
-        byte maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x0c;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        // FwUpdateMessage(L"[update bootloader]set scramble", MSG_NOR);
-
-        maddressHigh = (byte)0x42;
-        maddressLow = (byte)0x18;  //_rRW_MISCTL__SWRST_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x00;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        //FwUpdateMessage(L"[update bootloader]hold ss51 & release dsp", MSG_NOR);
-        maddressHigh = (byte)0x41;
-        maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x04;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        // FwUpdateMessage(L"[update bootloader]select bank3", MSG_NOR);
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x48;  //_rRW_MISCTL__SWRST_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x03;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;  //_rRW_MISCTL__SWRST_B0_
-        // FwUpdateMessage(L"[update bootloader]burn 2k bootloader firmware", MSG_NOR);
-        // if (!m_pI2CDevice->I2CWrite(0x9000, m_pbBuf + FW_BOOT_OFFSET, FW_BOOT_LENGTH))
-        if(!iicWrite(maddressHigh,maddressLow,mGt9FirmwareData,FW_BOOT_OFFSET,FW_BOOT_LENGTH))
-        {
-            //  FwUpdateMessage(L"[update bootloader]burn fw_boot failed", MSG_ERR);
-            return false;
-        }
-        // Sleep(1);
-        SystemClock.sleep(1);
-        // FwUpdateMessage(L"[update bootloader]send burn cmd to move data to flash from sram", MSG_NOR);
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;  //_rRW_MISCTL__SWRST_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x06;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        // FwUpdateMessage(L"[update bootloader]Wait for the burn is complete......", MSG_NOR);
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;
-        int nTryTimes = 1000;
-        do
-        {
-            //if (m_pI2CDevice->I2CByteRead(_rRW_MISCTL__BOOT_CTL_) == 0)
-            if(iicByteRead(maddressHigh,maddressLow) == 0)
-            {
-                break;
-            }
-        }
-        while ((--nTryTimes) != 0);
-
-        if (nTryTimes == 0)
-        {
-           // FwUpdateMessage(L"[update bootloader]move data to flash failed", MSG_ERR);
-            //mError.setText("[update bootloader]move data to flash failed");
-            Update_log = "[update bootloader]move data to flash failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;  //_rRW_MISCTL__SWRST_B0_
-        if (!recallCheck(maddressHigh,maddressLow,mGt9FirmwareData,FW_BOOT_OFFSET,FW_BOOT_LENGTH)) {
-            //mError.setText("recall check error[fwBoot] ");
-            //mError.setText("[update bootloader]move data to flash failed");
-            Update_log = "recall check error[fwBoot] ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        } else {
-           // mError.setText("recall check success[fwBoot]");
-            Update_log = "recall check success[fwBoot] ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            //return false;
-        }
-        // FwUpdateMessage(L"[update bootloader]recall check 2k bootloader firmware", MSG_NOR);
-        //if (!RecallCheck(m_pbBuf + FW_BOOT_OFFSET, 0x9000, FW_BOOT_LENGTH))
-        {
-            //  FwUpdateMessage(L"[update bootloader]recall check 2k bootloader firmware failed", MSG_ERR);
-            // return false;
-        }
-
-       // FwUpdateMessage(L"[update bootloader]burn bootloader firmware seccessfully----<<", MSG_NOR);
-       // mError.setText("[[update bootloader]burn bootloader firmware seccessfully----<<");
-        Update_log = "[update bootloader]burn bootloader firmware seccessfully----<< ";
-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-
-        return true;
-    }
-
-    private boolean burnFwBootIsp() {
-        // if (FW_BOOT_ISP_OFFSET > m_nBinFileLen)
-        {
-            //   FwUpdateMessage(L"[update boot_isp]needn`t burn boot_isp", MSG_NOR);
-            //   return true;
-        }
-
-        // FwUpdateMessage(L"[update bootisp]Begin burn boot_isp firmware---->>", MSG_NOR);
-
-        // FwUpdateMessage(L"[update bootisp]hold ss51 & dsp", MSG_NOR);
-        byte maddressHigh = (byte)0x41;
-        byte maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x0c;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        //FwUpdateMessage(L"[update bootisp]set scramble", MSG_NOR);
-        maddressHigh = (byte)0x42;
-        maddressLow = (byte)0x18;  //_rRW_MISCTL__SWRST_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x00;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        //  FwUpdateMessage(L"[update bootisp]hold ss51 & release dsp", MSG_NOR);
-        maddressHigh = (byte)0x41;
-        maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x04;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-        // FwUpdateMessage(L"[update bootisp]select bank3", MSG_NOR);
-        maddressHigh = (byte)0x40;
-        maddressLow = (byte)0x48;  //_rRW_MISCTL__SWRST_B0_
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x03;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-
-        // FwUpdateMessage(L"[update bootisp]burn 2k bootloader firmware", MSG_NOR);
-        //if (!m_pI2CDevice->I2CWrite(0x9000, m_pbBuf + FW_BOOT_ISP_OFFSET, FW_BOOT_ISP_LENGTH))
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;
-        if(!iicWrite(maddressHigh,maddressLow,mGt9FirmwareData,FW_BOOT_ISP_OFFSET,FW_BOOT_ISP_LENGTH))
-        {
-            //FwUpdateMessage(L"[update bootisp]burn fw_boot failed", MSG_ERR);
-            //mError.setText("[update bootisp]burn fw_boot failed");
-            Update_log = "[update bootisp]burn fw_boot failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-
-        // Sleep(1);  //1ms
-        SystemClock.sleep(1);
-        //  FwUpdateMessage(L"[update bootisp]send burn cmd to move data to flash from sram", MSG_NOR);
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;  //
-        //byte msubcommand =0x0f ;  //no command
-        mdata = (byte)0x07;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            return false;
-
-       // FwUpdateMessage(L"[update bootisp]Wait for the burn is complete......", MSG_NOR);
-       // mError.setText("[update bootisp]Wait for the burn is complete......");
-        Update_log = "[update bootisp]Wait for the burn is complete.....";
-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-
-        int nTryTimes = 1000;
-        maddressHigh = (byte)0x50;
-        maddressLow = (byte)0x94;
-        do
-        {
-            //if (m_pI2CDevice->I2CByteRead(_rRW_MISCTL__BOOT_CTL_) == 0)
-            if(iicByteRead(maddressHigh,maddressLow)==0)
-            {
-                break;
-            }
-        }
-        while ((--nTryTimes) != 0);
-
-        if (nTryTimes == 0)
-        {
-           // FwUpdateMessage(L"[update bootisp]move data to flash failed", MSG_ERR);
-           // mError.setText("[update bootisp]move data to flash failed");
-            Update_log = "[update bootisp]move data to flash failed";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-
-            return false;
-        }
-
-        maddressHigh = (byte)0x90;
-        maddressLow = (byte)0x00;  //_rRW_MISCTL__SWRST_B0_
-        if (!recallCheck(maddressHigh,maddressLow,mGt9FirmwareData,FW_BOOT_ISP_OFFSET,FW_BOOT_ISP_LENGTH)) {
-            //mError.setText("recall check error[fwBootISP] ");
-            Update_log = "recall check error[fwBootISP] ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        } else {
-            //mError.setText("recall check success[fwBootISP]");
-            Update_log = "recall check success[fwBootISP] ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            //return false;
-        }
-        //FwUpdateMessage(L"[update bootisp]recall check 2k bootloader firmware", MSG_NOR);
-        // if (!RecallCheck(m_pbBuf + FW_BOOT_ISP_OFFSET, 0x9000, FW_BOOT_ISP_LENGTH))
-        {
-            // FwUpdateMessage(L"[update bootisp]recall check 2k bootloader firmware failed", MSG_ERR);
-            //  return false;
-        }
-
-       // FwUpdateMessage(L"[update bootisp]burn bootloader firmware seccessfully----<<", MSG_NOR);
-      //  mError.setText("[update bootisp]burn bootloader firmware seccessfully----<<");
-        Update_log = "[update bootisp]burn bootloader firmware seccessfully----<< ";
-        mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        return true;
-
-    }
-
-    private boolean burnFinish() {
-
-        // FwUpdateMessage(L"[FW update]send burn finish flag", MSG_NOR);
-        byte maddressHigh = (byte)0x50;
-        byte maddressLow = (byte)0x94;  //_rRW_MISCTL__SWRST_B0_
-        byte msubcommand =0x0f ;  //no command
-        byte mdata = (byte)0x99;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata)) {
-           // mError.setText("[FW update]send burn finish flag failed");
-            Update_log = "[FW update]send burn finish flag failed ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-            return false;
-        }
-
-        //RebootFromSram
-        maddressHigh = (byte)0x41;
-        maddressLow = (byte)0x80;  //_rRW_MISCTL__SWRST_B0_
-        msubcommand =0x05 ;  //RebootFromSram command
-        mdata = (byte)0x80;
-
-        if(!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata)) {
-
-            maddressHigh = (byte)0x80;
-            maddressLow = (byte)0x40;
-            msubcommand =0x04 ;  //Reset IC command
-            mdata = (byte)0x00;
-            if (!iicByteWrite(maddressHigh,maddressLow,msubcommand,mdata))
-            {
-               // FwUpdateMessage(L"[FW update]Touch IC reset failed", MSG_ERR);
-               // mError.setText("[FW update]Touch IC reset failed");
-                Update_log = "[FW update]Touch IC reset failed ";
-                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-                return false;
-            }
-            //FwUpdateMessage(L"[FW update]ResetTouch IC ", MSG_NOR);
-           // mError.setText("[FW update]ResetTouch IC ");
-            Update_log = "[FW update]ResetTouch IC, UPDATE SUCCESS!!! ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-        //自动发送配置
-        if(bottonMode == 3) {
-            maddressHigh = (byte) 0x80;
-            maddressLow = (byte) 0x47;
-            //iicWrite(maddressHigh,maddressLow,mConfigData,0,186);
-            if (!iicWrite(maddressHigh, maddressLow, mConfigData, 0, 186)) {
-
-                Update_log = "[FW auto-update]Send Config failed ";
-                mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-                return false;
-            }
-            Update_log = "[FW auto-update]Send Config  SUCCESS!!! ";
-            mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
-        }
-
-        return true;
-    }
-
-    private boolean updateProc() {
-
-        if (!enterUpdateMode())  //NO1
-        {
-            //FwUpdateMessage(L"[FW update]Enter update mode failed", MSG_ERR);
-            return false;
-        }
-
-        if (!burnDspIsp()) {   //NO2
-                // FwUpdateMessage(L"[FW update]Burn DSP isp failed", MSG_ERR);
-                return false;
-        }
-
-        if (!eraseBootLoader()) {  //NO3
-                return false;
-        }
-
-        if (!burnFwGwake()) {  //NO8
-            //FwUpdateMessage(L"[FW update]Burn Gwake failed", MSG_ERR);
-            return false;
-        }
-
-        if (!burnFwSS51()) {  //NO5
-            //FwUpdateMessage(L"[FW update]Burn SS51 failed", MSG_ERR);
-            return false;
-        }
-
-        if (!burnFwDSP()) {  //NO9
-            //FwUpdateMessage(L"[FW update]Burn DSP failed", MSG_ERR);
-            return false;
-        }
-
-        if (!burnFwLink()) {  //NO7
-            // FwUpdateMessage(L"[FW update]Burn link failed", MSG_ERR);
-            return false;
-        }
-
-        if (!burnFwBoot()) {  //NO4
-            // FwUpdateMessage(L"[FW update]Burn boot failed", MSG_ERR);
-            return false;
-        }
-
-        if (!burnFwBootIsp()) {  //NO6
-            // FwUpdateMessage(L"[FW update]Burn boot isp failed", MSG_ERR);
-            return false;
-        }
-
-
-        burnFinish();
-
-        return true;
-    }
-
     @Override
     protected void onDestroy() {
         super.onDestroy();

+ 43 - 3
app/src/main/java/com/example/administrator/wingcool_gt9_apk/GT9MainActivity.java

@@ -93,6 +93,7 @@ public class GT9MainActivity extends AppCompatActivity
     private TextView tvIPAddress;
     private Context mShowID;
     private Button btnExit;
+    private Button btnUpgradeMode;
 
     private Button btnDataAnalysis;
     private Context mDataAnalysisContext;
@@ -123,7 +124,7 @@ public class GT9MainActivity extends AppCompatActivity
                     //String avalue = "S818 is connected";
 
                     mShow.setText(R.string.connected);//????????
-
+                    /*
                     iicWrite((byte)0x12,(byte)0,(byte)0,0,57);
 
                     while(true) {
@@ -173,7 +174,7 @@ public class GT9MainActivity extends AppCompatActivity
                         tvIPAddress.setText( "Null" );//输出显示
                     }
                     //tvIPAddress.setText("IP Address : " + GetIPAddress());
-
+                    */
                     break;
                 case CONNECTED_FAILED://??????????????????
                     //String bvalue = "S818 is disconnected";
@@ -413,6 +414,7 @@ public class GT9MainActivity extends AppCompatActivity
         initData();
         openDevices();
         //GetIPAddress();
+        //CloseHidIic();
     }
 
     private void initView() {
@@ -432,9 +434,33 @@ public class GT9MainActivity extends AppCompatActivity
         btnExit = (Button) findViewById(R.id.Exit);
         btnExit.setOnClickListener(this);
 
+        btnUpgradeMode = (Button) findViewById(R.id.UpgradeMode);
+        btnUpgradeMode.setOnClickListener(this);
+
         mDataAnalysisContext = GT9MainActivity.this;
         btnDataAnalysis = (Button) findViewById(R.id.DataAnalysis);
     }
+    private void CloseHidIic()
+    {
+        if (isS818Device)
+        {
+            iicWrite((byte)0x12,(byte)0,(byte)0,0,57);
+
+            while(true) {
+                SystemClock.sleep(100);
+
+                iicRead((byte) 0x81, (byte) 0x4e, mBytes, 1);
+                if (mBytes[0] == (byte)0)
+                {
+                    break;
+                }
+
+                iicWrite((byte) 0x0f, (byte) 0x81, (byte) 0x4e, 0, 1);
+            }
+
+        }
+
+    }
 
 
 
@@ -578,7 +604,22 @@ public class GT9MainActivity extends AppCompatActivity
                 }
 
                 break;
+            case R.id.UpgradeMode:
+                iicWrite((byte)0x12,(byte)0,(byte)0,0,57);
+
+                while(true) {
+                    SystemClock.sleep(100);
 
+                    iicRead((byte) 0x81, (byte) 0x4e, mBytes, 1);
+                    if (mBytes[0] == (byte)0)
+                    {
+                        break;
+                    }
+
+                    iicWrite((byte) 0x0f, (byte) 0x81, (byte) 0x4e, 0, 1);
+                }
+
+                break;
             default:
                 break;
         }
@@ -650,7 +691,6 @@ public class GT9MainActivity extends AppCompatActivity
                         // }
                     }  //while (isNeedFindDevice)
                 }  //while(1)
-
             }   //ThreadPool
         });   //ThreadPool
     }

+ 22 - 0
app/src/main/res/layout-hdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-land-hdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-land-mdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-land-xhdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-land-xxhdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-land-xxxhdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-land/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-mdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-xhdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-xxhdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout-xxxhdpi/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

+ 22 - 0
app/src/main/res/layout/activity_gt9_main.xml

@@ -379,6 +379,28 @@
                 app:layout_constraintTop_toTopOf="parent"
                 app:layout_constraintVertical_bias="0.376" />
 
+            <Button
+                android:id="@+id/UpgradeMode"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_marginStart="8dp"
+                android:layout_marginLeft="8dp"
+                android:layout_marginTop="0dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginRight="8dp"
+                android:layout_marginBottom="0dp"
+                android:background="@drawable/bg_mainactivity_buttonframe_line"
+                android:text="@string/upgrademode"
+                android:textColor="#FFFFf0"
+                android:textAllCaps="false"
+                android:textSize="30dp"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintHorizontal_bias="0.515"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintVertical_bias="0.376" />
+
             <Button
                 android:id="@+id/Exit"
                 android:layout_width="match_parent"

BIN
app/src/main/res/raw/gt7288_06_00_21_00.BIN


+ 1 - 0
app/src/main/res/values-en/strings.xml

@@ -12,6 +12,7 @@
     <string name="ramoperation">Ram Operation</string>
     <string name="testoperation">Test Operation</string>
     <string name="contactus">Contact Us</string>
+    <string name="upgrademode">Upgrade Mode</string>
     <string name="exit">Exit</string>
 
     <string name="chooseconfig">choose config</string>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -12,6 +12,7 @@
     <string name="ramoperation">Ram 操 作</string>
     <string name="testoperation">测 试 操 作</string>
     <string name="contactus">联 系 我 们</string>
+    <string name="upgrademode">升 级 模 式</string>
     <string name="exit">退  出</string>
 
     <string name="chooseconfig">选择配置文件</string>