|
各位大侠,
小弟最近在用MTK META函数开发校准程序时发现,始终同步不了手机,也进不了META模式。各位高手如有经验,麻烦指点一下小弟。下面是小弟写的一些代码,麻烦看一下,哪块是否有问题!谢谢啦!!
int meta_handle,cycle;
METAAPP_RESULT metaapp_result,connect;
META_Connect_Req META_connect_req;
META_Connect_Report p_report;
META_COMM_BAUDRATE rate;
BOOT_RESULT boot;
BBCHIP_TYPE type;
STATUS_E status;
unsigned int meta_ver_required_by_target;
int bootstop;
char message[20];
unsigned int ms_scan_timeout = 1000;
unsigned short com_port;
int p_scanstop = 1;
unsigned char m_msp_err_code;
metaapp_result = METAAPP_GetAvailableHandle(&meta_handle); // get META handle
metaapp_result = METAAPP_Init(meta_handle);
metaapp_result = METAAPP_NVRAM_Init(meta_handle,"D:\\TestSys\\database\\BPLGUInfoCustom");
//---------------------Connect with target ----------------------------------
META_connect_req.com_port = 3;
META_connect_req.boot_meta_arg.m_bbchip_type = AUTO_DETECT_BBCHIP;
META_connect_req.boot_meta_arg.m_ext_clock = AUTO_DETECT_EXT_CLOCK;
META_connect_req.baudrate[0] = META_BAUD115200;
META_connect_req.baudrate[1] = META_BAUD230400;
META_connect_req.baudrate[2] = META_BAUD460800;
META_connect_req.baudrate[3] = META_BAUD921600;
META_connect_req.baudrate[4] = META_BAUD_END;
META_connect_req.flowctrl = META_SW_FLOWCTRL;
META_connect_req.ms_connect_timeout = 30000;
META_connect_req.boot_meta_arg.m_ms_boot_timeout = 10000;
bootstop = 0;
bootstop = 0;
cycle=0;
do
{
cycle++;
ibwrt (deviceP,"OUT1", strlen("OUT1"));
ibwrt (deviceP,"VSET 4", strlen("VSET 4"));
Delay(1);
connect = METAAPP_DisconnectWithTarget( meta_handle );
connect =METAAPP_ConnectWithTarget(meta_handle, &META_connect_req, &bootstop,&p_report);
status = p_report.boot_meta_ret;
boot = p_report.boot_result;
type =boot.m_bbchip_type;
m_msp_err_code = boot.m_msp_err_code;
meta_ver_required_by_target=p_report.meta_ver_required_by_target;
rate = p_report.final_baudrate;
ibwrt (deviceP,"OUT0", strlen("OUT1"));
Delay(1);
} while(connect&&cycle<3);
connect =METAAPP_BOOT_FAIL
status =INVAILID STATUS_E:1
type=UNKOWN_BBCHIP_TYPE
m_msp_err_code=0;
meta_ver_required_by_target=0; |
|