📄 flashtool_api.h
字号:
UART_BAUDRATE m_baudrate;
unsigned char m_baudrate_full_sync_count;
// set high-speed baudrate callback
CALLBACK_SET_HIGHSPEED_BAUDRATE m_cb_set_high_speed_baudrate;
void * m_cb_set_high_speed_baudrate_arg;
} FlashTool_ChangeBaudrate_Arg;
extern int __stdcall FlashTool_ChangeBaudrate(FLASHTOOL_API_HANDLE_T ft_handle, const FlashTool_ChangeBaudrate_Arg *p_arg);
//------------------------------------------------------------------------------
// Enable WatchDog Timeout
//------------------------------------------------------------------------------
extern int __stdcall FlashTool_EnableWatchDogTimeout(FLASHTOOL_API_HANDLE_T ft_handle, unsigned int ms_timeout_interval);
//------------------------------------------------------------------------------
// Download
//------------------------------------------------------------------------------
typedef struct {
// single DL_HANDLE
DL_HANDLE_T m_dl_handle;
// multi DL_HANDLE List
DL_HANDLE_LIST_T m_dl_handle_list;
// da report callback
CALLBACK_DA_REPORT m_cb_da_report;
void * m_cb_da_report_arg;
// DL_HANDLE download progress callback
ACCURACY m_download_accuracy;
CALLBACK_DOWNLOAD_PROGRESS_INIT m_cb_download_flash_init;
void * m_cb_download_flash_init_arg;
CALLBACK_DOWNLOAD_PROGRESS m_cb_download_flash;
void * m_cb_download_flash_arg;
// Boot Loader download progress callback
CALLBACK_BOOTLOADER_DOWNLOAD_PROGRESS_INIT m_cb_download_bloader_init;
void * m_cb_download_bloader_init_arg;
CALLBACK_BOOTLOADER_DOWNLOAD_PROGRESS m_cb_download_bloader;
void * m_cb_download_bloader_arg;
// security post-process notify callback
CALLBACK_SECURITY_POST_PROCESS_NOTIFY m_cb_security_post_process_notify;
void * m_cb_security_post_process_notify_arg;
// The flag of m_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 m_enable_tgt_res_layout_check;
// The flag to check if target side baseband chip version is corresponding to ROM file on PC side.
_BOOL m_enable_bbchip_ver_check;
} FlashTool_Download_Arg;
typedef struct {
// dummy
} FlashTool_Download_Result;
extern int __stdcall FlashTool_Download(
FLASHTOOL_API_HANDLE_T ft_handle,
const FlashTool_Download_Arg *p_dl_arg,
FlashTool_Download_Result *p_dl_result);
//------------------------------------------------------------------------------
// Readback
//------------------------------------------------------------------------------
typedef struct {
HW_StorageType_E m_storage_type;
RB_HANDLE_T m_rb_handle;
// readback progress callback
ACCURACY m_readback_accuracy;
CALLBACK_READBACK_PROGRESS_INIT m_cb_readback_flash_init;
void * m_cb_readback_flash_init_arg;
CALLBACK_READBACK_PROGRESS m_cb_readback_flash;
void * m_cb_readback_flash_arg;
} FlashTool_Readback_Arg;
typedef struct {
// dummy
} FlashTool_Readback_Result;
extern int __stdcall FlashTool_Readback(
FLASHTOOL_API_HANDLE_T ft_handle,
const FlashTool_Readback_Arg *p_rb_arg,
FlashTool_Readback_Result *p_rb_result);
//------------------------------------------------------------------------------
// Format
//------------------------------------------------------------------------------
typedef struct {
// automatically format the FAT area on flash
_BOOL m_auto_format_fat;
// enable/disable erase validation
_BOOL m_validation;
// begin_addr and length only take effect when option is m_enable_auto_format_fat is _FALSE
unsigned int m_format_begin_addr;
unsigned int m_format_length;
} FORMAT_CONFIG_T;
typedef struct {
HW_StorageType_E m_storage_type;
// format config
FORMAT_CONFIG_T m_format_cfg;
// only take effect on NAND flash
NUTL_EraseFlag_E m_erase_flag;
// format progress callback
CALLBACK_FORMAT_PROGRESS_INIT m_cb_format_report_init;
void * m_cb_format_report_init_arg;
CALLBACK_FORMAT_PROGRESS m_cb_format_report;
void * m_cb_format_report_arg;
// format statistics callback
CALLBACK_FORMAT_STATISTICS m_cb_format_statistics;
void * m_cb_format_statistics_arg;
} FlashTool_Format_Arg;
typedef struct {
FormatStatisticsReport_T m_format_statistics;
} FlashTool_Format_Result;
extern int __stdcall FlashTool_Format(
FLASHTOOL_API_HANDLE_T ft_handle,
const FlashTool_Format_Arg *p_fmt_arg,
FlashTool_Format_Result *p_fmt_result);
//------------------------------------------------------------------------------
// SEC_RO read/write
//------------------------------------------------------------------------------
typedef struct {
unsigned int m_addr;
unsigned int m_len;
} SecRO_Info_T;
typedef struct {
unsigned int m_len;
unsigned char * m_data;
} SecRO_T;
extern int __stdcall FlashTool_SecRO_GetInfo(FLASHTOOL_API_HANDLE_T ft_handle, SecRO_Info_T *p_sec_ro_info);
extern int __stdcall FlashTool_SecRO_Read(FLASHTOOL_API_HANDLE_T ft_handle, SecRO_T *p_sec_ro);
extern int __stdcall FlashTool_SecRO_Write(FLASHTOOL_API_HANDLE_T ft_handle, const SecRO_T *p_sec_ro);
//------------------------------------------------------------------------------
// CustPara read/write
//------------------------------------------------------------------------------
typedef struct {
unsigned int m_addr;
unsigned int m_len;
} CustPara_Info_T;
typedef struct {
unsigned int m_len;
unsigned char * m_data;
} CustPara_T;
extern int __stdcall FlashTool_CustPara_GetInfo(FLASHTOOL_API_HANDLE_T ft_handle, CustPara_Info_T *p_cust_para_info);
extern int __stdcall FlashTool_CustPara_Read(FLASHTOOL_API_HANDLE_T ft_handle, CustPara_T *p_cust_para);
extern int __stdcall FlashTool_CustPara_Write(FLASHTOOL_API_HANDLE_T ft_handle, const CustPara_T *p_cust_para);
//------------------------------------------------------------------------------
// Update FlashTool Config
//------------------------------------------------------------------------------
typedef struct {
unsigned int m_lockdown:1;
unsigned int m_disable_code_download:1;
unsigned int m_disable_code_readback:1;
unsigned int m_disable_code_format:1;
unsigned int m_disable_sec_ro_download:1;
unsigned int m_disable_sec_ro_readback:1;
unsigned int m_disable_fat_download:1;
unsigned int m_disable_fat_readback:1;
unsigned int m_disable_fat_format:1;
unsigned int m_restricted_area_access_forbidden:1;
} SecurityBitCtrl_T;
typedef union {
SecurityBitCtrl_T m_bit_ctrl;
unsigned int m_uint32;
} SecurityCfg_U;
typedef struct {
SecurityCfg_U m_security_cfg;
} FlashToolCfg_T;
extern int __stdcall FlashTool_UpdateConfig(FLASHTOOL_API_HANDLE_T ft_handle, const FlashToolCfg_T *p_ft_cfg);
//------------------------------------------------------------------------------
// Get Project ID
//------------------------------------------------------------------------------
extern int __stdcall FlashTool_GetProjectId(FLASHTOOL_API_HANDLE_T ft_handle, char *output_buf, unsigned int output_buf_len);
//------------------------------------------------------------------------------
// OTP read/write
//------------------------------------------------------------------------------
typedef enum {
PARAM_READ = 0
,PARAM_WRITE
,PARAM_OPERATION_END
} PARAM_OPERATION;
typedef enum {
OTP_READ = 0
,OTP_WRITE
,OTP_LOCK
,OTP_WRITE_AND_LOCK
,OTP_OPERATION_END
} OTP_OPERATION;
typedef struct {
unsigned int m_addr;
unsigned int m_len;
unsigned char * m_data;
} OTP_T;
extern int __stdcall FlashTool_OTP_CheckDevice(FLASHTOOL_API_HANDLE_T ft_handle);
extern int __stdcall FlashTool_OTP_GetSize(FLASHTOOL_API_HANDLE_T ft_handle, unsigned int * otp_size);
extern int __stdcall FlashTool_OTP_Read(FLASHTOOL_API_HANDLE_T ft_handle, OTP_T * p_otp);
extern int __stdcall FlashTool_OTP_Write(FLASHTOOL_API_HANDLE_T ft_handle, const OTP_T * p_otp);
extern int __stdcall FlashTool_OTP_Lock(FLASHTOOL_API_HANDLE_T ft_handle);
extern int __stdcall FlashTool_OTP_LockCheckStatus(FLASHTOOL_API_HANDLE_T ft_handle);
//------------------------------------------------------------------------------
// Repair Tool : Exception Record Retriever
//------------------------------------------------------------------------------
extern int __stdcall RepairTool_GetDIRInfo( FLASHTOOL_API_HANDLE_T ft_handle, char * fn_dir);
extern int __stdcall RepairTool_GetExceptionRecord( FLASHTOOL_API_HANDLE_T ft_handle, char * fn_exceptionlog, char * fn_store);
//------------------------------------------------------------------------------
// ROM Writer : Extract/Inject NFB Images
//------------------------------------------------------------------------------
#define DEFAULT_STORING_EXTRACT_NFB "C:\\MTK_ExtractNFB.bin"
#define MAX_FILENAME_LENGTH 256
typedef struct {
// post-process callback
CALLBACK_PROGRESS_INIT m_cb_progress_init;
void * m_cb_progress_init_arg;
CALLBACK_PROGRESS m_cb_progress;
void * m_cb_progress_arg;
} FlashTool_Progress_Arg;
typedef struct {
// dummy
} FlashTool_Progress_RESULT;
extern int __stdcall FlashTool_ExtractNFB( FLASHTOOL_API_HANDLE_T ft_handle, char * fn_store, const FlashTool_Progress_Arg *p_pgs_arg);
extern int __stdcall FlashTool_InjectNFB( FLASHTOOL_API_HANDLE_T ft_handle, char * fn_store, const FlashTool_Progress_Arg *p_pgs_arg);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -