37 lines
1003 B
C
37 lines
1003 B
C
#ifndef __UPDATE_H
|
|
#define __UPDATE_H
|
|
|
|
#include <stdint.h>
|
|
#include "bsp.h"
|
|
#include "Public.h"
|
|
|
|
/*与HC32F460BootLoader一致的boot参数结构(已在bsp.h定义boot_para_t)*/
|
|
|
|
//主机下发升级请求载荷结构体 (CMD = 0x81)
|
|
typedef struct {
|
|
uint16_t PackageNum;
|
|
uint32_t AppSize;
|
|
uint32_t AppCrc32;
|
|
}__attribute__ ((packed))UpDataRequset_t, *UDReq;
|
|
|
|
//帧头结构体 - 0x7D + 6字节MAC (与HC32F460BootLoader一致)
|
|
typedef struct {
|
|
uint8_t Header;
|
|
uint8_t DevMac[6];
|
|
uint8_t Cmd;
|
|
uint8_t PayloadLen;
|
|
}__attribute__((packed))UpdateFrameHeader_t, *pUpdateFrameHeader;
|
|
|
|
//输入接口函数定义,需根据接口重新定义
|
|
#define U_DBG_LOG(...) Debug_Printf(__VA_ARGS__)
|
|
#define U_DELAY_MS(x) rt_thread_delay(x)
|
|
#define U_SYSTEM_TESET() NVIC_SystemReset()
|
|
#define SAVE_BOOT_PARA(addr) dev_boot_write_param(*(addr))
|
|
#define READ_BOOT_PARA(addr) dev_boot_read_param(addr)
|
|
|
|
//输出接口
|
|
void Update(uint8_t *PayLoad);
|
|
void UpdateInit(void);
|
|
#endif
|
|
|