feat:网络升级流程完善

1、局域网升级流程 - 初步测试OK
2、云端升级流程 - 初步测试OK
3、云端升级上报升级进度 - 初步测试OK
This commit is contained in:
caocong
2026-02-10 17:45:08 +08:00
parent f16825ea2b
commit 3041468aa7
23 changed files with 1184 additions and 336 deletions

View File

@@ -601,12 +601,12 @@ __attribute__((section(".non_0_wait"))) void NetWork_Parameter_Get(void)
//MCU<43><55>ʼ<EFBFBD><CABC>IP
g_netinfo.device_ip[0] = 192;
g_netinfo.device_ip[1] = 168;
g_netinfo.device_ip[2] = MACAddr[4];
g_netinfo.device_ip[3] = MACAddr[5];
g_netinfo.device_ip[2] = g_netinfo.mac_addr[4];
g_netinfo.device_ip[3] = g_netinfo.mac_addr[5];
//MCU<43><55>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
g_netinfo.gateway[0] = 192;
g_netinfo.gateway[1] = 168;
g_netinfo.gateway[2] = MACAddr[4];
g_netinfo.gateway[2] = g_netinfo.mac_addr[4];
g_netinfo.gateway[3] = 1;
//MCU<43><55>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
g_netinfo.subnet[0] = 255;
@@ -775,9 +775,16 @@ __attribute__((section(".non_0_wait"))) uint8_t WCHNET_LIB_Init(void)
Dbg_Println(DBG_BIT_NET_STATUS_bit,"version error.\n");
}
/*<2A><>ȡMAC <20><>ַ*/
g_netinfo.mac_addr[2] = SRAM_Read_Byte(SRAM_Register_Start_ADDRESS + Register_NETMACKADDR_OFFSET );
g_netinfo.mac_addr[3] = SRAM_Read_Byte(SRAM_Register_Start_ADDRESS + Register_NETMACKADDR_OFFSET + 1);
g_netinfo.mac_addr[4] = SRAM_Read_Byte(SRAM_Register_Start_ADDRESS + Register_NETMACKADDR_OFFSET + 2);
g_netinfo.mac_addr[5] = SRAM_Read_Byte(SRAM_Register_Start_ADDRESS + Register_NETMACKADDR_OFFSET + 3);
//<2F><>ȡоƬ<D0BE>Դ<EFBFBD><D4B4><EFBFBD>MAC <20><>ַ
// GetMACAddress(MACAddr);
// Dbg_Print_Buff(DBG_BIT_NET_STATUS_bit, "NET MAC:", MACAddr, 6);
Dbg_Print_Buff(DBG_BIT_NET_STATUS_bit, "NET MAC:", g_netinfo.mac_addr, 6);
NetWork_Parameter_Get();
@@ -814,6 +821,8 @@ __attribute__((section(".non_0_wait"))) uint8_t WCHNET_LIB_Init(void)
server_info.net_sta = NET_PHY_WAIT;
SRAM_Write_Byte(0x00,SRAM_IAP_UPGRADE_Reply_NUM_ADDRESS);
return 0;
}

View File

@@ -6,6 +6,7 @@
*/
#include "tftp_function.h"
#include "net_function.h"
#include "blv_netcomm_function.h"
#include "sram_mem_addr.h"
#include "flash_mem_addr.h"
#include "spi_flash.h"
@@ -125,10 +126,10 @@ __attribute__((section(".non_0_wait"))) uint8_t IAP_tftp_process_write(uint8_t s
memcpy(&tftp_args.to_ip[0],to_ip,4);
tftp_args.to_port = to_port;
tftp_args.block = 0;
tftp_args.tot_bytes = 0;
IAPVarTypeStruct_Ptr.TotalCount =0;
IAPVarTypeStruct_Ptr.Write_Block = 0;
IAPVarTypeStruct_Ptr.TotalCount = 0;
IAPVarTypeStruct_Ptr.IapErrFlag = 0;
Dbg_Println(DBG_BIT_NET_STATUS_bit,"ip:%d.%d.%d.%d, port:%d",to_ip[0], to_ip[1], to_ip[2], to_ip[3], to_port);
/*BLV_C1 -- <20><><EFBFBD><EFBFBD>Flash<73><68><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD><EFBFBD>ٲ<EFBFBD><D9B2><EFBFBD>ͬʱ<CDAC><CAB1>SRAM<41>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>flash<73><68>*/
@@ -147,7 +148,55 @@ __attribute__((section(".non_0_wait"))) uint8_t IAP_tftp_process_write(uint8_t s
return 0x01;
}
TFTP_send_ack_packet(g_netinfo.SocketId[SocketIdnex_TFTPDATA], to_ip, to_port, tftp_args.block); //ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><D7BD><EFBFBD>
TFTP_send_ack_packet(g_netinfo.SocketId[SocketIdnex_TFTPDATA], to_ip, to_port, IAPVarTypeStruct_Ptr.Write_Block); //ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><D7BD><EFBFBD>
return 0x00;
}
/*******************************************************************************
* Function Name : IAP_tftp_process_read
* Description : TFTP<54><50><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><D7BD><EFBFBD> - <20><><EFBFBD>Ͷ<EFBFBD>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD>
*******************************************************************************/
uint8_t IAP_tftp_process_read(uint8_t s, uint8_t* to_ip, int to_port)
{
uint8_t data_buffer[150];
uint32_t sendlen = 0;
memset(data_buffer,0,sizeof(data_buffer));
Dbg_Println(DBG_BIT_NET_STATUS_bit,"%s",__func__);
IAPVarTypeStruct_Ptr.TotalCount = 0x00;
IAPVarTypeStruct_Ptr.IapErrFlag = 0x00;
if(IAPVarTypeStruct_Ptr.IapFileType == TFTP_IAP_DataType_APP)
{
Dbg_Println(DBG_BIT_NET_STATUS_bit,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ");
IAPVarTypeStruct_Ptr.FlashWriteAddress = SRAM_IAP_APP_FILE_ADDRESS; //<2F><><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ַ - <20><><EFBFBD><EFBFBD><EFBFBD>ȱ<EFBFBD><C8B1><EFBFBD><EFBFBD><EFBFBD>SRAM<41><4D>
}else if(IAPVarTypeStruct_Ptr.IapFileType == TFTP_IAP_DataType_CONFIG)
{
Dbg_Println(DBG_BIT_NET_STATUS_bit,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ");
IAPVarTypeStruct_Ptr.FlashWriteAddress = SRAM_IAP_LOGIC_DataStart_ADDRESS; //<2F><><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ַ - <20><><EFBFBD><EFBFBD><EFBFBD>ȱ<EFBFBD><C8B1><EFBFBD><EFBFBD><EFBFBD>SRAM<41><4D>
}else{
return 1;
}
data_buffer[0] = 0x00;
data_buffer[1] = 0x01;
memcpy(&data_buffer[2], IAPVarTypeStruct_Ptr.FtpFileName, IAPVarTypeStruct_Ptr.FtpFileNameLen); //<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ȥ<EFBFBD><C8A5>ȡ<EFBFBD>ļ<EFBFBD> <20>ܳ<EFBFBD><DCB3><EFBFBD>
sendlen += IAPVarTypeStruct_Ptr.FtpFileNameLen+2;
data_buffer[sendlen++] = 0;
data_buffer[sendlen++] = 'o'; //octet <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׼ʹ<D7BC>ð<EFBFBD>λ<EFBFBD><CEBB>
data_buffer[sendlen++] = 'c';
data_buffer[sendlen++] = 't';
data_buffer[sendlen++] = 'e';
data_buffer[sendlen++] = 't';
data_buffer[sendlen++] = 0;
Dbg_Println(DBG_BIT_NET_STATUS_bit,"FtpFileNameLen:%d , name:%s",IAPVarTypeStruct_Ptr.FtpFileNameLen,IAPVarTypeStruct_Ptr.FtpFileName);
Dbg_Println(DBG_BIT_NET_STATUS_bit,"SocketId:%d , port:%d , len:%d , IP:%d.%d.%d.%d",s,to_port,sendlen,to_ip[0],to_ip[1],to_ip[2],to_ip[3]);
WCHNET_SocketUdpSendTo(s, data_buffer, &sendlen, to_ip, to_port);
return 0x00;
}
@@ -171,6 +220,11 @@ __attribute__((section(".non_0_wait"))) void TFTP_IAP_Data_Processing(uint8_t s,
Dbg_Println(DBG_BIT_NET_STATUS_bit,"%s block:%d - %d",__func__,IAPVarTypeStruct_Ptr.Write_Block,TFTP_Pack_Get_Block(pkt_buf));
if( pkt_buf_len > TFTP_DATA_LEN_MAX ) {
Dbg_Println(DBG_BIT_NET_STATUS_bit,"%s Data_len:%d Error",__func__,pkt_buf_len);
return ;
}
if( (pkt_buf_len > TFTP_DATA_PKT_HDR_LEN) && ( TFTP_Pack_Get_Block(pkt_buf) == (IAPVarTypeStruct_Ptr.Write_Block + 1) ) )
{
pkt_buf_len = pkt_buf_len - TFTP_DATA_PKT_HDR_LEN;
@@ -189,7 +243,7 @@ __attribute__((section(".non_0_wait"))) void TFTP_IAP_Data_Processing(uint8_t s,
if( IAPVarTypeStruct_Ptr.Write_Block == 0x00 )
{
temp_val = data_buffer[0] + (data_buffer[1]<<8) + (data_buffer[2]<<16) + (data_buffer[3]<<24);
Dbg_Println(DBG_BIT_NET_STATUS_bit,"temp_var : %08X ,block :%d",temp_val,IAPVarTypeStruct_Ptr.Write_Block);
Dbg_Println(DBG_BIT_NET_STATUS_bit,"temp_var : %X ,block :%d",temp_val,IAPVarTypeStruct_Ptr.Write_Block);
if( (temp_val & 0x2FFE0000) != 0x20000000 )
{
Dbg_Println(DBG_BIT_NET_STATUS_bit,"<EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>");
@@ -208,7 +262,7 @@ __attribute__((section(".non_0_wait"))) void TFTP_IAP_Data_Processing(uint8_t s,
// break;
// }
IAPVarTypeStruct_Ptr.IapErrFlag = 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><D6BE>һ
//IAPVarTypeStruct_Ptr.IapErrFlag = 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><D6BE>һ
Dbg_Println(DBG_BIT_NET_STATUS_bit,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> data_buffer[0] & 0x2FFE0000 = %X; data_buffer[1]=%X\n", (data_buffer[0] & 0x2FFE0000), data_buffer[1]);
}else if( IAPVarTypeStruct_Ptr.Write_Block > APP_BLOCK_MAX ){
@@ -253,7 +307,7 @@ __attribute__((section(".non_0_wait"))) void TFTP_IAP_Data_Processing(uint8_t s,
{
IAPVarTypeStruct_Ptr.Write_Block++;
SRAM_DMA_Write_Buff(data_buffer,pkt_buf_len,IAPVarTypeStruct_Ptr.FlashWriteAddress); //д<><D0B4>SRAM<41><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Dbg_Println(DBG_BIT_NET_STATUS_bit,"д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>%08X,д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: byte<74><65>%d", IAPVarTypeStruct_Ptr.FlashWriteAddress, pkt_buf_len);
Dbg_Println(DBG_BIT_NET_STATUS_bit,"д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>%X,д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: byte<74><65>%d", IAPVarTypeStruct_Ptr.FlashWriteAddress, pkt_buf_len);
/*<2A>Գ<EFBFBD><D4B3>Ƚ<EFBFBD><C8BD><EFBFBD>4Byte<74><65><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ַƫ<D6B7><C6AB>ʹ<EFBFBD><CAB9> <20><><EFBFBD><EFBFBD><E8B2BB>Ҫ<EFBFBD>ֽڶ<D6BD><DAB6><EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><CCAB>Ҫ*/
// pkt_buf_len = (pkt_buf_len + 3) / 4;
@@ -268,7 +322,16 @@ __attribute__((section(".non_0_wait"))) void TFTP_IAP_Data_Processing(uint8_t s,
TFTP_send_ack_packet(s, ip_addr, Port, IAPVarTypeStruct_Ptr.Write_Block); //<2F><>ÿ<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0>Ļظ<C4BB><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׽<EFBFBD><D7BD><EFBFBD> <20><>ַ <20>˿ںͿ<DABA><CDBF><EFBFBD>
if( IAPVarTypeStruct_Ptr.Write_Block == IAPVarTypeStruct_Ptr.BlockSize )
if( (IAPVarTypeStruct_Ptr.BLVIapFlag != 0x01)
&& (IAPVarTypeStruct_Ptr.Write_Block != 0x00)
&& (IAPVarTypeStruct_Ptr.Write_Block % 50 == 0x00)
&& (IAPVarTypeStruct_Ptr.BlockSize != IAPVarTypeStruct_Ptr.Write_Block) )
{
/* <20><><EFBFBD>ƶ˷<C6B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD><CFB1>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
UDP_BLVIAPPlan_Cmd_SendPack(IAPPlan_State_Underway); //<2F><><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>
}
if( (IAPVarTypeStruct_Ptr.BLVIapFlag != 0x01) && (IAPVarTypeStruct_Ptr.Write_Block == IAPVarTypeStruct_Ptr.BlockSize) )
{
uint8_t md5[16] = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
uint16_t crc_data_len = 0;
@@ -283,23 +346,17 @@ __attribute__((section(".non_0_wait"))) void TFTP_IAP_Data_Processing(uint8_t s,
{
//<2F>ļ<EFBFBD>MD5У<35><D0A3><EFBFBD>ɹ<EFBFBD>
Dbg_Println(DBG_BIT_NET_STATUS_bit,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>Md5<EFBFBD><EFBFBD>ȷ");
//Ϊɶ<CEAA><C9B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ˻ظ<CBBB><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>һ<EFBFBD><D2BB>
// switch(IAPVarTypeStruct_Ptr->IapType)
// {
// case IAPTFTPWRITE: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Dbg_Println(DBG_BIT_NET_STATUS_bit,"<22><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>״̬..");
// SRAM_Write_Byte(IAP_STATE_COMPLETE, SRAM_IAP_NET_UPGRADE_Flag_ADDRESS);
// LOG_LogicInfo_DebugRecord("<22><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>״̬..");
// break;
// case IAPTFTPREAD: //<2F>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Dbg_Println(DBG_BIT_NET_STATUS_bit,"<22><>¼<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>״̬..");
// LOG_LogicInfo_DebugRecord("<22><>¼<EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>״̬..");
// SRAM_Write_Byte(CLOUD_IAP_TFTP_STATE_COMPLETE, SRAM_IAP_NET_UPGRADE_Flag_ADDRESS);
// break;
// }
if( IAPVarTypeStruct_Ptr.FunType == TFTP_FUNTYPE_CloudIAP )
{
Dbg_Println(DBG_BIT_NET_STATUS_bit,"<EFBFBD><EFBFBD>¼<EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>״̬..");
LOG_LogicInfo_DebugRecord("<EFBFBD><EFBFBD>¼<EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>״̬..");
SRAM_Write_Byte(TFTP_FUNTYPE_CloudIAP, SRAM_IAP_NET_UPGRADE_Flag_ADDRESS);
}
Dbg_Println(DBG_BIT_NET_STATUS_bit,"<EFBFBD><EFBFBD>APPд<EFBFBD><EFBFBD>Flash<EFBFBD><EFBFBD>..");
//Cloud_IAP_Plan_SendPack(args,IAPVarTypeStruct_Ptr,IAPPlan_State_CheckSucc); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>У<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UDP_BLVIAPPlan_Cmd_SendPack(IAPPlan_State_CheckSucc); //<2F><><EFBFBD><EFBFBD>IAP<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - У<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SPI_FLASH_APP_Data_Erase();
for(uint32_t i = 0;i < IAPVarTypeStruct_Ptr.BlockSize; i++ )
@@ -358,6 +415,8 @@ __attribute__((section(".non_0_wait"))) void TFTP_IAP_Data_Processing(uint8_t s,
Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"<EFBFBD>̼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ!");
//ֱ<>ӿ<EFBFBD><D3BF>Ź<EFBFBD><C5B9><EFBFBD>λ
NVIC_SystemReset();
while(1);
}else{
//MD5У<35><D0A3>ʧ<EFBFBD><CAA7>
@@ -401,7 +460,7 @@ __attribute__((section(".non_0_wait"))) void TFTP_IAP_Data_Processing(uint8_t s,
// break;
// }
//Cloud_IAP_Plan_SendPack(args,IAPVarTypeStruct_Ptr,IAPPlan_State_CheckSucc); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD>У<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UDP_BLVIAPPlan_Cmd_SendPack(IAPPlan_State_CheckSucc); //<2F><><EFBFBD><EFBFBD>IAP<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - У<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SPI_FLASH_Logic_File_Erase(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@ -495,6 +554,11 @@ void UDPSocket_TFTP_CMD_AppCallBack(struct _SOCK_INF * SocketInf,uint32_t ipaddr
/*TFTP<54><50><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
}else if( TFTP_Pack_Get_Opcode(buff) == TFTP_DATA )
{
/*TFTP<54><50><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
}else {
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD><EFBFBD>*/
@@ -527,6 +591,8 @@ void UDPSocket_TFTP_DATA_AppCallBack(struct _SOCK_INF * SocketInf,uint32_t ipadd
// }
}
/*******************************************************************************
* Function Name : Internal_TFTP_Task
* Description : TFTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@ -563,14 +629,25 @@ __attribute__((section(".non_0_wait"))) void Internal_TFTP_Task(void)
{
IAPVarTypeStruct_Ptr.processing_tick = SysTick_1ms;
IAPVarTypeStruct_Ptr.status = STA_INIT_IDLE;
if(IAPVarTypeStruct_Ptr.FunType == TFTP_FUNTYPE_CloudIAP)
{
//<2F><><EFBFBD>ƶ˷<C6B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
//TFTP_CMD_ACK(server_info.goal_ip, server_info.goal_port); //<2F>ظ<EFBFBD>TFTP<54><50><EFBFBD><EFBFBD>
Dbg_Println(DBG_BIT_NET_STATUS_bit,"<EFBFBD><EFBFBD><EFBFBD>ƶ˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>...");
IAP_tftp_process_read(g_netinfo.SocketId[SocketIdnex_TFTPDATA], server_info.goal_ip, IAPVarTypeStruct_Ptr.TFTP_Port);
}
}
break;
case STA_INIT_IDLE:
//<2F><><EFBFBD>ƶ˷<C6B6><CBB7>Ͷ<EFBFBD>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
if( SysTick_1ms - IAPVarTypeStruct_Ptr.processing_tick > 30000) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ͷ<EFBFBD><CDB7>׽<EFBFBD><D7BD><EFBFBD>
if( SysTick_1ms - IAPVarTypeStruct_Ptr.processing_tick > 60000 ) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ͷ<EFBFBD><CDB7>׽<EFBFBD><D7BD><EFBFBD>
{
//Cloud_IAP_Plan_SendPack(tftp_args,IAPVarTypeStruct_Ptr,IAPPlan_State_IAPTimeout); //<2F><><EFBFBD><EFBFBD>IAP<41><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
UDP_BLVIAPPlan_Cmd_SendPack(IAPPlan_State_IAPTimeout); //<2F><><EFBFBD><EFBFBD>IAP<41><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
Dbg_Println(DBG_BIT_NET_STATUS_bit,"TFTP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ");
IAPVarTypeStruct_Ptr.status = STA_END;
@@ -626,6 +703,7 @@ __attribute__((section(".non_0_wait"))) void Internal_TFTP_Task(void)
}
break;
case STA_INIT_CONNECT: //
break;
}
}

View File

@@ -61,7 +61,8 @@ typedef struct
uint8_t enable; //TFTP <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>״̬ 0X01:ʹ<>ܣ<EFBFBD>0x00:ûʹ<C3BB><CAB9>
uint8_t FunType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0x01:<3A><><EFBFBD><EFBFBD>IAP<41><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x02:<3A>ƶ<EFBFBD>IAP<41><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x03:LOG<4F><47>־<EFBFBD>ϴ<EFBFBD>
uint8_t NewIapFlag; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̱<EFBFBD>־λ - 2022-01-05
uint8_t BLVIapFlag; //BLV<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̱<EFBFBD>־λ
uint8_t BLVIapResult; //BLV<4C><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8_t IapErrFlag; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
@@ -105,7 +106,9 @@ typedef struct
}tftp_connection_args;
extern IAPVarTypeStruct IAPVarTypeStruct_Ptr;
extern tftp_connection_args tftp_args;
uint8_t bytes_cmp(uint8_t *src,uint8_t *dat,uint32_t len);
void Internal_TFTP_Task(void);
#endif /* NETLIB_TFTP_FUNCTION_H_ */