📄 flashtool.h
字号:
unsigned short m_nand_pagesize;
unsigned short m_nand_sparesize;
unsigned short m_nand_pages_per_block;
unsigned char m_nand_io_interface;
unsigned char m_nand_addr_cycle;
unsigned int m_fat_begin_addr;
unsigned int m_fat_length;
// internal sram report
STATUS_E m_int_sram_ret;
unsigned int m_int_sram_size;
// external ram report
STATUS_E m_ext_ram_ret;
HW_RAMType_E m_ext_ram_type;
HW_ChipSelect_E m_ext_ram_chip_select;
unsigned int m_ext_ram_size;
//DL Handle
DL_HANDLE_T m_dl_handle;
} DA_REPORT_T;
int __stdcall ConvertDAReportToString(const DA_REPORT_T *p_da_report,
char *p_storage_hint,
unsigned int storage_hint_size,
char *p_detail_report,
unsigned int detail_report_size);
//------------------------------------------------------------------------------
// prototype of callback function
//------------------------------------------------------------------------------
typedef int (__stdcall *CALLBACK_BEFORE_PROCESS)(const DA_REPORT_T *p_da_report, void *usr_arg);
typedef int (__stdcall *CALLBACK_SET_HIGHSPEED_BAUDRATE)(unsigned char BaudrateId, unsigned int *p_baudrate, void *usr_arg);
typedef int (__stdcall *CALLBACK_FLASH_DOWNLOAD_INIT)(void *usr_arg);
typedef int (__stdcall *CALLBACK_FLASH_DOWNLOAD)(unsigned char finished_percentage, unsigned int sent_bytes, unsigned int total_bytes, void *usr_arg);
typedef int (__stdcall *CALLBACK_FLASH_FORMAT_INIT)(void *usr_arg);
typedef int (__stdcall *CALLBACK_FLASH_FORMAT)(unsigned char finished_percentage, void *usr_arg);
typedef struct {
unsigned int m_fmt_begin_addr;
unsigned int m_fmt_length;
unsigned int m_total_blocks;
unsigned int m_bad_blocks;
unsigned int m_err_blocks;
} FormatStatisticsReport_S;
typedef int (__stdcall *CALLBACK_FLASH_FORMAT_STATISTICS)(const FormatStatisticsReport_S *p_report, void *usr_arg);
typedef int (__stdcall *CALLBACK_FLASH_READBACK_INIT)(const char *rb_filepath, void *usr_arg);
typedef int (__stdcall *CALLBACK_FLASH_READBACK)(unsigned char finished_percentage, unsigned int read_bytes, unsigned int total_bytes, void *usr_arg);
//------------------------------------------------------------------------------
// FLASHTOOL_ARG structure
//------------------------------------------------------------------------------
#define WAIT_STATE_AUTO_DETECT_BY_FREQUENCY NULL
typedef struct {
BBCHIP_TYPE bbchip;
EXT_CLOCK ext_clock;
unsigned int *p_bank0_mem_cfg;
unsigned int *p_bank1_mem_cfg;
DA_HANDLE_T da_handle;
CALLBACK_BROM_WRITE_BUF_INIT cb_download_da_init;
void *cb_download_da_init_arg;
CALLBACK_BROM_WRITE_BUF cb_download_da;
void *cb_download_da_arg;
CALLBACK_BEFORE_PROCESS cb_before_process;
void *cb_before_process_arg;
CALLBACK_SET_HIGHSPEED_BAUDRATE cb_set_high_speed_baudrate;
void *cb_set_high_speed_baudrate_arg;
unsigned int ms_boot_timeout;
unsigned int max_start_cmd_retry_count;
DA_INFO da_info;
// [OUT] the PC side bbchip name
const char *p_bbchip_name;
// This callback function will be invoke after BootROM start cmd is passed.
// You can issue other BootROM command by brom_handle and hCOM which provides callback arguments,
// or do whatever you want otherwise.
CALLBACK_IN_BROM_STAGE cb_in_brom_stage;
void *cb_in_brom_stage_arg;
unsigned char m_baudrate_full_sync_count;
// speed-up BootROM stage baudrate
_BOOL m_speedup_brom_baudrate;
HW_StorageType_E m_storage_type;
HW_ChipSelect_E m_storage_chip_select[2];
// DRAM Setting from BootLoader
unsigned int m_nand_acccon;
_BOOL m_enable_dram_setting; // manually assign : _TRUE
unsigned int m_emi_gen_a;
unsigned int m_emi_gen_b;
unsigned int m_emi_gen_c;
unsigned int m_emi_dram_con_i_mode;
unsigned int m_emi_dram_con_i_ext_mode;
unsigned int m_emi_dram_con_k;
unsigned int m_emi_dram_con_l;
}FLASHTOOL_ARG;
//------------------------------------------------------------------------------
// flash download
//------------------------------------------------------------------------------
typedef enum {
FORMAT_FAT_AUTO = 0, // automatically format the FAT area on flash
FORMAT_FAT_MANUAL // format according to the format begin_addr and length
} FORMAT_FAT_OPTION;
typedef struct {
FORMAT_FAT_OPTION option;
// begin_addr and length only take effect when option is FORMAT_MANUAL
unsigned int fat_begin_addr;
unsigned int fat_length;
// enable/disable erase validation
_BOOL m_validation;
} FORMAT_FAT_CONFIG_T;
typedef struct {
DL_HANDLE_T dl_handle;
CALLBACK_FLASH_DOWNLOAD_INIT cb_download_flash_init;
void *cb_download_flash_init_arg;
ACCURACY download_accuracy;
CALLBACK_FLASH_DOWNLOAD cb_download_flash;
void *cb_download_flash_arg;
CALLBACK_FLASH_FORMAT_INIT cb_format_report_init;
void *cb_format_report_init_arg;
CALLBACK_FLASH_FORMAT cb_format_report;
void *cb_format_report_arg;
ROM_INFO rom_info;
// The flag of enable_tgt_res_layout_check is used to control whether if target resource
// layout checking operation will be performed.
// _TRUE: Enable target resource layout checking operation.
// _FALSE: Disable target resource layout checking operation.
_BOOL enable_tgt_res_layout_check;
// This array is used to store the index of DL_HANDLE if and only if you got the
// (FT_DL_HANDLE_ERROR|FTHND_RES_DOWNLOAD_SELECT_INCOMPLETE) error code.
// In order to maintain target side resource and jump table integrity, each index points
// to a resource which is required to download but you DID NOT select it.
unsigned short required_resource_count;
unsigned short required_resource[MAX_RESOURCE_ENTRY];
// The flag to check if target side baseband chip ECO version is corresponding to ROM file on PC side.
_BOOL enable_bbchip_eco_check;
// format option
_BOOL enable_fat_format;
FORMAT_FAT_CONFIG_T fmt_fat;
// trigger watch dog timeout after downloading
_BOOL enable_wdt_timeout;
unsigned short ms_wdt_timeout_interval;
// NFB
// enable/disable NFB download method
_BOOL m_nfb_enable;
// boot loader
BL_INFO m_bl_info;
CALLBACK_FLASH_DOWNLOAD_INIT m_cb_download_bloader_init;
void *m_cb_download_bloader_init_arg;
CALLBACK_FLASH_DOWNLOAD m_cb_download_bloader;
void *m_cb_download_bloader_arg;
// format statistics callback
CALLBACK_FLASH_FORMAT_STATISTICS m_cb_format_statistics;
void *m_cb_format_statistics_arg;
// DL Handle List
DL_HANDLE_LIST_T dl_handle_list;
}FLASHTOOL_DOWNLOAD_ARG;
extern int __stdcall FlashDownload(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_DOWNLOAD_ARG *p_dl_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
extern int __stdcall FlashDownload_ByhCOM(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_DOWNLOAD_ARG *p_dl_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
extern int __stdcall AutoBoot_FlashDownload(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_DOWNLOAD_ARG *p_dl_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
extern int __stdcall AutoBoot_FlashDownload_ByhCOM(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_DOWNLOAD_ARG *p_dl_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
//------------------------------------------------------------------------------
// flash readback
//------------------------------------------------------------------------------
typedef struct {
RB_HANDLE_T rb_handle;
CALLBACK_FLASH_READBACK_INIT cb_readback_flash_init;
void *cb_readback_flash_init_arg;
ACCURACY readback_accuracy;
CALLBACK_FLASH_READBACK cb_readback_flash;
void *cb_readback_flash_arg;
RB_INFO rb_info;
}FLASHTOOL_READBACK_ARG;
extern int __stdcall FlashReadback(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_READBACK_ARG *p_rb_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
extern int __stdcall FlashReadback_ByhCOM(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_READBACK_ARG *p_rb_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
extern int __stdcall AutoBoot_FlashReadback(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_READBACK_ARG *p_rb_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
extern int __stdcall AutoBoot_FlashReadback_ByhCOM(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_READBACK_ARG *p_rb_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
//------------------------------------------------------------------------------
// flash format
//------------------------------------------------------------------------------
typedef struct {
unsigned int format_addr;
unsigned int format_length;
CALLBACK_FLASH_FORMAT_INIT cb_format_report_init;
void *cb_format_report_init_arg;
CALLBACK_FLASH_FORMAT cb_format_report;
void *cb_format_report_arg;
// format statistics callback
CALLBACK_FLASH_FORMAT_STATISTICS m_cb_format_statistics;
void *m_cb_format_statistics_arg;
NUTL_EraseFlag_E m_erase_flag;
// enable/disable erase validation
_BOOL m_validation;
}FLASHTOOL_FORMAT_ARG;
extern int __stdcall FlashFormat(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_FORMAT_ARG *p_fmt_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
extern int __stdcall FlashFormat_ByhCOM(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_FORMAT_ARG *p_fmt_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
extern int __stdcall AutoBoot_FlashFormat(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_FORMAT_ARG *p_fmt_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
extern int __stdcall AutoBoot_FlashFormat_ByhCOM(
COM_PORT_SETTING *p_com_setting,
FLASHTOOL_ARG *p_arg,
FLASHTOOL_FORMAT_ARG *p_fmt_arg,
int *p_stopflag,
DA_REPORT_T *p_da_report);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -