|
@@ -88,7 +88,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
private byte[] mSendData = new byte[1024];
|
|
private byte[] mSendData = new byte[1024];
|
|
private byte[] mConfigData = new byte[1024];
|
|
private byte[] mConfigData = new byte[1024];
|
|
private String[] mVersionShow = new String[16];
|
|
private String[] mVersionShow = new String[16];
|
|
- byte[] mGt293xFirmwareData = new byte[500 * 1024];
|
|
|
|
|
|
+ byte[] mGt293xFirmwareData = new byte[400 * 1024];
|
|
|
|
|
|
private boolean isReceiverMessage = true;
|
|
private boolean isReceiverMessage = true;
|
|
private boolean isSendMessage = true;
|
|
private boolean isSendMessage = true;
|
|
@@ -634,7 +634,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
mBytes[3] = 0x07;
|
|
mBytes[3] = 0x07;
|
|
mBytes[4] = 0x0B;
|
|
mBytes[4] = 0x0B;
|
|
mBytes[5] = 0x00;
|
|
mBytes[5] = 0x00;
|
|
- iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes,0,6);
|
|
|
|
|
|
|
|
|
|
//read [0x10175] = 0x80,config is ready
|
|
//read [0x10175] = 0x80,config is ready
|
|
@@ -675,7 +675,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
mBytes[3] = 0x08;
|
|
mBytes[3] = 0x08;
|
|
mBytes[4] = 0x0C;
|
|
mBytes[4] = 0x0C;
|
|
mBytes[5] = 0x00;
|
|
mBytes[5] = 0x00;
|
|
- iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes, 0, 6);
|
|
|
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes, 0, 6);
|
|
|
|
|
|
//read [0x10175] = 0x80,config is ready
|
|
//read [0x10175] = 0x80,config is ready
|
|
//do {
|
|
//do {
|
|
@@ -1275,11 +1275,11 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
}
|
|
}
|
|
|
|
|
|
//发送命令,使得S8xx可以通过IIC向GT79xx的固定地址写任意bytes的数据
|
|
//发送命令,使得S8xx可以通过IIC向GT79xx的固定地址写任意bytes的数据
|
|
- private boolean iicWrite32Bits(byte addrfirstbyte,byte addrsecondbyte,byte addrthirdbyte,byte[] wBuffer,int offset, int length) {
|
|
|
|
|
|
+ private boolean iicWrite32Bits(byte addrfirstbyte,byte addrsecondbyte,byte addrthirdbyte,byte subCommand,byte[] wBuffer,int offset, int length) {
|
|
|
|
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- iicWriteData[1] = (byte)0x8f; //7bit:0-read,1-write;other:command
|
|
|
|
|
|
+ iicWriteData[1] = (byte)(0x80 | subCommand);//0x0f; //7bit:0-read,1-write;other:command
|
|
//iicWriteData[2] = 0x0f; //no command
|
|
//iicWriteData[2] = 0x0f; //no command
|
|
iicWriteData[2] = addrfirstbyte;
|
|
iicWriteData[2] = addrfirstbyte;
|
|
iicWriteData[3] = addrsecondbyte;
|
|
iicWriteData[3] = addrsecondbyte;
|
|
@@ -1295,13 +1295,13 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
int address2 = addrthirdbyte&0xff;
|
|
int address2 = addrthirdbyte&0xff;
|
|
int address = address1|address2;
|
|
int address = address1|address2;
|
|
|
|
|
|
- int sendTimes = length / 57 + 1; //预计是向下取整,所以+1
|
|
|
|
|
|
+ int sendTimes = length/57 + 1; //预计是向下取整,所以+1
|
|
|
|
|
|
//iicByteData[5] = (byte)(length>>8);
|
|
//iicByteData[5] = (byte)(length>>8);
|
|
//iicByteData[6] = (byte)length; //length 一次接收63个数据
|
|
//iicByteData[6] = (byte)length; //length 一次接收63个数据
|
|
|
|
|
|
for (int k = 0; k < sendTimes; k++) {
|
|
for (int k = 0; k < sendTimes; k++) {
|
|
- int finalOffset = offset + k * 57; //每次只能发57bytes数据
|
|
|
|
|
|
+ int finalOffset = offset + k*57; //每次只能发57bytes数据
|
|
|
|
|
|
if(length - (finalOffset -offset) < 57) {
|
|
if(length - (finalOffset -offset) < 57) {
|
|
|
|
|
|
@@ -1318,7 +1318,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointOut, iicWriteData, 0, 0x40, 100);
|
|
i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointOut, iicWriteData, 0, 0x40, 100);
|
|
|
|
|
|
if (i != 0x40) {
|
|
if (i != 0x40) {
|
|
- //editname.setText("iicWrite Failed");
|
|
|
|
|
|
+ //mShow.setText("iicWrite Failed");
|
|
return false;
|
|
return false;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -3028,7 +3028,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
mdata = (byte)0xFF;
|
|
mdata = (byte)0xFF;
|
|
|
|
|
|
IicWriteOneByte(addrfirstbyte, addrsecondbyte, addrthirdbyte, msubcommand, mdata);
|
|
IicWriteOneByte(addrfirstbyte, addrsecondbyte, addrthirdbyte, msubcommand, mdata);
|
|
- //iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,byte[] wBuffer, 0, 1);
|
|
|
|
|
|
+ //iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,(byte)0x0f, byte[] wBuffer, 0, 1);
|
|
SystemClock.sleep(20);
|
|
SystemClock.sleep(20);
|
|
//if (0xFF == gpI2C1->I2CByteRead(0xD807))
|
|
//if (0xFF == gpI2C1->I2CByteRead(0xD807))
|
|
iicRead32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,msubcommand,mBytes, 1);
|
|
iicRead32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,msubcommand,mBytes, 1);
|
|
@@ -3095,7 +3095,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
addrthirdbyte = 0x00;
|
|
addrthirdbyte = 0x00;
|
|
|
|
|
|
//if (!gpI2C1->I2CWrite(BLB_ISP_RAM_ADDR, tmp_fw_info.p_fw_data, tmp_fw_info.fw_len))
|
|
//if (!gpI2C1->I2CWrite(BLB_ISP_RAM_ADDR, tmp_fw_info.p_fw_data, tmp_fw_info.fw_len))
|
|
- if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,mGt293xFirmwareData,fw_data_index, fw_len))
|
|
|
|
|
|
+ if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, (byte)0x0f, mGt293xFirmwareData,fw_data_index, fw_len))
|
|
{
|
|
{
|
|
Update_log = "[FW update]Update ISP Code Fail!";
|
|
Update_log = "[FW update]Update ISP Code Fail!";
|
|
mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
|
|
mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
|
|
@@ -3120,7 +3120,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
addrthirdbyte = 0x00;
|
|
addrthirdbyte = 0x00;
|
|
|
|
|
|
//if (!gpI2C1->I2CWrite(BLD_ISP_RAM_ADDR, tmp_fw_info.p_fw_data, tmp_fw_info.fw_len))
|
|
//if (!gpI2C1->I2CWrite(BLD_ISP_RAM_ADDR, tmp_fw_info.p_fw_data, tmp_fw_info.fw_len))
|
|
- if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,mGt293xFirmwareData,fw_data_index, fw_len))
|
|
|
|
|
|
+ if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, (byte)0x0f, mGt293xFirmwareData,fw_data_index, fw_len))
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -3156,7 +3156,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
addrfirstbyte = 0x01;
|
|
addrfirstbyte = 0x01;
|
|
addrsecondbyte = 0x00;
|
|
addrsecondbyte = 0x00;
|
|
addrthirdbyte = 0x00;
|
|
addrthirdbyte = 0x00;
|
|
- if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, mBytes, 0, 8)) {
|
|
|
|
|
|
+ if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, (byte)0x0f, mBytes, 0, 8)) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
SystemClock.sleep(20);
|
|
SystemClock.sleep(20);
|
|
@@ -3265,7 +3265,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
addrfirstbyte = 0x01;
|
|
addrfirstbyte = 0x01;
|
|
addrsecondbyte = 0x34;
|
|
addrsecondbyte = 0x34;
|
|
addrthirdbyte = 0x10;
|
|
addrthirdbyte = 0x10;
|
|
- if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,pbSendBuf,0, nLen + 4))
|
|
|
|
|
|
+ if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,(byte)0x0f, pbSendBuf,0, nLen + 4))
|
|
//if (!gpI2C1->I2CWrite(BLB_CMD_DATA_ADDR, pbSendBuf, nLen + 4))
|
|
//if (!gpI2C1->I2CWrite(BLB_CMD_DATA_ADDR, pbSendBuf, nLen + 4))
|
|
{
|
|
{
|
|
ret = false;
|
|
ret = false;
|
|
@@ -3277,7 +3277,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
addrfirstbyte = 0x01;
|
|
addrfirstbyte = 0x01;
|
|
addrsecondbyte = 0x24;
|
|
addrsecondbyte = 0x24;
|
|
addrthirdbyte = 0x10;
|
|
addrthirdbyte = 0x10;
|
|
- if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,pbSendBuf,0, nLen + 4))
|
|
|
|
|
|
+ if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,(byte)0x0f, pbSendBuf,0, nLen + 4))
|
|
//if (!gpI2C1->I2CWrite(BLD_CMD_DATA_ADDR, pbSendBuf, nLen + 4))
|
|
//if (!gpI2C1->I2CWrite(BLD_CMD_DATA_ADDR, pbSendBuf, nLen + 4))
|
|
{
|
|
{
|
|
ret = false;
|
|
ret = false;
|
|
@@ -3330,7 +3330,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
addrfirstbyte = 0x01;
|
|
addrfirstbyte = 0x01;
|
|
addrsecondbyte = 0x34;
|
|
addrsecondbyte = 0x34;
|
|
addrthirdbyte = 0x00;
|
|
addrthirdbyte = 0x00;
|
|
- if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,mBytes,0, 13))
|
|
|
|
|
|
+ if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,(byte)0x0f, mBytes,0, 13))
|
|
//if (!gpI2C1->I2CWrite(BLB_CMD_ADDR, cmd, 13))
|
|
//if (!gpI2C1->I2CWrite(BLB_CMD_ADDR, cmd, 13))
|
|
{
|
|
{
|
|
ret = false;
|
|
ret = false;
|
|
@@ -3360,7 +3360,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
addrfirstbyte = 0x01;
|
|
addrfirstbyte = 0x01;
|
|
addrsecondbyte = 0x24;
|
|
addrsecondbyte = 0x24;
|
|
addrthirdbyte = 0x00;
|
|
addrthirdbyte = 0x00;
|
|
- if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,mBytes,0, 13))
|
|
|
|
|
|
+ if (!iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte,(byte)0x0f, mBytes,0, 13))
|
|
//if (!gpI2C1->I2CWrite(BLD_CMD_ADDR, cmd, 13))
|
|
//if (!gpI2C1->I2CWrite(BLD_CMD_ADDR, cmd, 13))
|
|
{
|
|
{
|
|
ret = false;
|
|
ret = false;
|
|
@@ -3485,7 +3485,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
|
|
|
|
//send 0x00 to [0x10174],清除标志
|
|
//send 0x00 to [0x10174],清除标志
|
|
mBytes[0] = 0x00;
|
|
mBytes[0] = 0x00;
|
|
- iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,1);
|
|
|
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes,0,1);
|
|
SystemClock.sleep(15);
|
|
SystemClock.sleep(15);
|
|
|
|
|
|
//send 0x00 0x00 0x04 0x04 0x08 0x00 to [0x10174],通知GT29XX,send cfg
|
|
//send 0x00 0x00 0x04 0x04 0x08 0x00 to [0x10174],通知GT29XX,send cfg
|
|
@@ -3495,7 +3495,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
mBytes[3] = 0x04;
|
|
mBytes[3] = 0x04;
|
|
mBytes[4] = 0x08;
|
|
mBytes[4] = 0x08;
|
|
mBytes[5] = 0x00;
|
|
mBytes[5] = 0x00;
|
|
- iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes,0,6);
|
|
|
|
|
|
//30ms一次轮询[0x10174],如果是0x80,说明GT29XX已准备好,可以send cfg
|
|
//30ms一次轮询[0x10174],如果是0x80,说明GT29XX已准备好,可以send cfg
|
|
do {
|
|
do {
|
|
@@ -3565,7 +3565,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
addrthirdbyte = (byte)0x8C;
|
|
addrthirdbyte = (byte)0x8C;
|
|
}
|
|
}
|
|
|
|
|
|
- iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, mBufferData,0,iconfiglen + 64);
|
|
|
|
|
|
+ iicWrite32Bits(addrfirstbyte, addrsecondbyte, addrthirdbyte, (byte)0x0f, mBufferData,0,iconfiglen + 64);
|
|
|
|
|
|
SystemClock.sleep(30);
|
|
SystemClock.sleep(30);
|
|
|
|
|
|
@@ -3587,7 +3587,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
mBytes[3] = 0x05;
|
|
mBytes[3] = 0x05;
|
|
mBytes[4] = 0x09;
|
|
mBytes[4] = 0x09;
|
|
mBytes[5] = 0x00;
|
|
mBytes[5] = 0x00;
|
|
- iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes,0,6);
|
|
|
|
|
|
//30ms一次轮询[0x10174],如果是0x80,说明GT29XX已接收配置
|
|
//30ms一次轮询[0x10174],如果是0x80,说明GT29XX已接收配置
|
|
do {
|
|
do {
|
|
@@ -3617,7 +3617,7 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
mBytes[3] = 0x06;
|
|
mBytes[3] = 0x06;
|
|
mBytes[4] = 0x0A;
|
|
mBytes[4] = 0x0A;
|
|
mBytes[5] = 0x00;
|
|
mBytes[5] = 0x00;
|
|
- iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, mBytes,0,6);
|
|
|
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)0x0f, mBytes,0,6);
|
|
|
|
|
|
//30ms一次轮询[0x10174],如果是0x80,说明GT29XX已完成
|
|
//30ms一次轮询[0x10174],如果是0x80,说明GT29XX已完成
|
|
do {
|
|
do {
|
|
@@ -3631,6 +3631,27 @@ public class FirmwareUpdate extends AppCompatActivity
|
|
}
|
|
}
|
|
}while(mBytes[0] != (byte)0x80);
|
|
}while(mBytes[0] != (byte)0x80);
|
|
|
|
|
|
|
|
+ SystemClock.sleep(100);
|
|
|
|
+
|
|
|
|
+ if (stringArr.length > iconfiglen + 64) //有USB配置
|
|
|
|
+ {
|
|
|
|
+ SystemClock.sleep(500);
|
|
|
|
+ //strtemplog= "[Cfg update]Update cfg of S8xxx...\n";
|
|
|
|
+ //strUpdateCfgInfoLog = strUpdateCfgInfoLog.concat(strtemplog);
|
|
|
|
+
|
|
|
|
+ iicWrite32Bits((byte)0x01, (byte)0x01, (byte)0x74, (byte)49, mBufferData, iconfiglen + 64,24);
|
|
|
|
+
|
|
|
|
+ SystemClock.sleep(150);
|
|
|
|
+
|
|
|
|
+ IicWriteOneByte((byte)0x01, (byte)0x01, (byte)0x74, (byte)35,(byte)0);
|
|
|
|
+
|
|
|
|
+ SystemClock.sleep(150);
|
|
|
|
+
|
|
|
|
+ isNeedFindDevice = true;
|
|
|
|
+
|
|
|
|
+ openDevices();
|
|
|
|
+ }
|
|
|
|
+
|
|
//mShow.setText("Send cfg finish!!");
|
|
//mShow.setText("Send cfg finish!!");
|
|
Update_log = "[Config update]Send config finish!! Config Version:0x" + Integer.toHexString(mBufferData[34]);
|
|
Update_log = "[Config update]Send config finish!! Config Version:0x" + Integer.toHexString(mBufferData[34]);
|
|
mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
|
|
mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
|