Initial commit: TXW82x FPV v2.7.0.7-42229 SDK + project sources

This commit is contained in:
2026-07-06 11:30:13 +08:00
commit e76462eeb7
3451 changed files with 1415300 additions and 0 deletions

61
sdk/include/lib/ota/fw.h Normal file
View File

@@ -0,0 +1,61 @@
#ifndef __FW_H__
#define __FW_H__
#ifdef __cplusplus
extern "C" {
#endif
enum fw_code
{
FW_CODE_OK = 0,
FW_OTA_INIT_ERR, //ota初始化错误
FW_CODE_LEN_TOO_SHORT, // 数据长度太短
FW_ID_CHECKSUM_ERR, //客户id校验错误
FW_HEAD_CHECK_ERR, //头校验错误
FW_OUT_OFF_ORDER_ERR, //ota长度超过配置的长度
FW_VERIFY_ERR, //写入校验错误
FW_END_ERR, //ota结束回写校验码错误
};
#define fw_ota_dbg(fmt, ...) //os_printf(fmt, ##__VA_ARGS__)
/* The OTA marker and marker size are only applicable to huge-ic chips. */
#define OTA_FLASH_MARKER 0x5A69
#define OTA_FLASH_MARKER_SIZE 2
#define OTA_VERIFY_READ_BUF_SIZE 256
/* OTA info */
struct ota_fwinfo {
struct spi_nor_flash *flash0;
uint32 addr0;
struct spi_nor_flash *flash1;
uint32 addr1;
};
/* OTA control */
struct ota_ctrl {
struct ota_fwinfo ota_info;
struct spi_nor_flash *p_flash;
uint32 base_addr;
uint32 local_off;
uint32 marker;
uint32 earse_locate;
uint8 verify_read_buf[OTA_VERIFY_READ_BUF_SIZE];
};
extern int32 libota_write_fw_ah(uint32 tot_len, uint32 off, uint8 *data, uint16 len);
extern int32 libotaV2_write_fw(uint32 tot_len, uint8 is_once_earse, uint8 isSector, uint8 isVerify, uint32 off, uint8 *data, uint16 len);
extern int32 ota_fwinfo_get(struct ota_fwinfo *pinfo);
#ifdef TXW4002ACK803
#define libota_write_fw(tot_len,off,data,len) libota_write_fw_ah(tot_len,off,data,len)
#else
#define libota_write_fw(tot_len,off,data,len) libotaV2_write_fw(tot_len,0,0,0,off,data,len)
#endif
#ifdef __cplusplus
}
#endif
#endif