#pragma hdrstop
#pragma argsused
#include "windows.h"
#include "usbprt.h"
#include "burning.h"
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <Mergemod.h>
//#include <string.h>
int _tmain(int argc, _TCHAR* argv[])
{
unsigned int i=0,j=0,k=0,Num=0,write_mode=0;
int size=0,ret=0;
unsigned long result=0;
unsigned long addr=0;
unsigned long times=0;
unsigned long last_bytes=0;
unsigned long sectors=0;
HANDLE m_hDev = NULL;
unsigned char bin_buffer[1024*64]={};
unsigned char ram_buffer[1024*4]={};
unsigned char buffer[2]={0,0};
unsigned char mcu_type = 0;
char exeFullPath[MAX_PATH + 1]; // Full path
char test_bin[] = "\\test.bin";
unsigned long flashaddress =0;
unsigned long activetime[2]={0,0};
char FilePath[100] = {0};
//strncpy(FilePath,"\\drive_bin\\dut_5315_flash_v01b9.bin",sizeof("\\drive_bin\\dut_5315_flash_v01b9.bin"));
//printf("%s test\n",FilePath);
//return 0;
if(argc < 3)
{
printf("\tNo bin Parameter !\n");
//getchar();
return 0;
}
if(argc < 5)
{
flashaddress = 0x00;
}
else
{
flashaddress = strtol(argv[4],NULL,16);
}
//flashaddress = strtol(argv[4],NULL,16);
//printf("%x,%s,%s,%s,%s,%s,%s,0x%x\n",argc,argv[0],argv[1],argv[2],argv[3],argv[4],argv[5],flashaddress);///显示参数
if(!strcmp(argv[3],"usb"))
{
write_mode = 1; //write the usb mode .
} else if(!strcmp(argv[3],"evk"))
{
write_mode = 4; //write the dut via sws .
}
else
{
printf("\tThe download mode error ! --> Please set \"usb\" or \"evk\" .\n");
return 0;
}
if(!strcmp(argv[1],"8266") || !strcmp(argv[1],"8267") || !strcmp(argv[1],"8366") || !strcmp(argv[1],"8368")){
mcu_type = 2;
}
else if(!strcmp(argv[1],"5562")){
mcu_type = 1;
}
else{
printf("\t Please select the approptiate \' mcu \'\n");
return 0;
}
GetModuleFileName(NULL,exeFullPath,MAX_PATH); //get the absolute path
(strrchr(exeFullPath, '\\'))[0] = 0; // 删除文件名,只获得路径字串 (strrchr(exeFullPath, '\\'))[1] 获得文件名
//strcat(exeFullPath,test_bin);
//printf("\t%s,%d\n",exeFullPath,write_mode);
if(!strcmp(argv[1],"8266"))
{
//strncpy(FilePath,"\\drive_bin\\dut_5325_flash_v0222.bin",sizeof("\\drive_bin\\dut_5325_flash_v0222.bin"));
strcat(exeFullPath,"\\drive_bin\\dut_5325_flash_v0222.bin");
}
if(!strcmp(argv[1],"8267"))
{
//strncpy(FilePath,"drive_bin\dut_8267_flash_v0002.bin",sizeof("drive_bin\\dut_8267_flash_v0002.bin"));
strcat(exeFullPath,"\\drive_bin\\dut_8267_flash_v0002.bin");
}
if(!strcmp(argv[1],"8366"))
{
//strncpy(FilePath,"\\drive_bin\\dut_5315_flash_v01b9.bin",sizeof("\\drive_bin\\dut_5315_flash_v01b9.bin"));
strcat(exeFullPath,"\\drive_bin\\dut_5315_flash_v01b9.bin");
}
if(!strcmp(argv[1],"8368"))
{
//strncpy(FilePath,"\\drive_bin\\dut_5318_flash_v020a.bin",sizeof("\\drive_bin\\dut_5318_flash_v020a.bin"));
strcat(exeFullPath,"\\drive_bin\\dut_5318_flash_v020a.bin");
}
if(!strcmp(argv[1],"5562"))
{
strcat(exeFullPath,"\\drive_bin\\dut_5560_flash.bin");
}
//m_hDev = GetPrintDeviceHandle(0xffff);
if(mcu_type == 1 && write_mode ==1){
m_hDev = GetPrintDeviceHandle2(0xffff);
}
else{
m_hDev = GetPrintDeviceHandle(0xffff);
}
if(write_mode ==4){
if(mcu_type == 1){
bu
#pragma argsused
#include "windows.h"
#include "usbprt.h"
#include "burning.h"
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <Mergemod.h>
//#include <string.h>
int _tmain(int argc, _TCHAR* argv[])
{
unsigned int i=0,j=0,k=0,Num=0,write_mode=0;
int size=0,ret=0;
unsigned long result=0;
unsigned long addr=0;
unsigned long times=0;
unsigned long last_bytes=0;
unsigned long sectors=0;
HANDLE m_hDev = NULL;
unsigned char bin_buffer[1024*64]={};
unsigned char ram_buffer[1024*4]={};
unsigned char buffer[2]={0,0};
unsigned char mcu_type = 0;
char exeFullPath[MAX_PATH + 1]; // Full path
char test_bin[] = "\\test.bin";
unsigned long flashaddress =0;
unsigned long activetime[2]={0,0};
char FilePath[100] = {0};
//strncpy(FilePath,"\\drive_bin\\dut_5315_flash_v01b9.bin",sizeof("\\drive_bin\\dut_5315_flash_v01b9.bin"));
//printf("%s test\n",FilePath);
//return 0;
if(argc < 3)
{
printf("\tNo bin Parameter !\n");
//getchar();
return 0;
}
if(argc < 5)
{
flashaddress = 0x00;
}
else
{
flashaddress = strtol(argv[4],NULL,16);
}
//flashaddress = strtol(argv[4],NULL,16);
//printf("%x,%s,%s,%s,%s,%s,%s,0x%x\n",argc,argv[0],argv[1],argv[2],argv[3],argv[4],argv[5],flashaddress);///显示参数
if(!strcmp(argv[3],"usb"))
{
write_mode = 1; //write the usb mode .
} else if(!strcmp(argv[3],"evk"))
{
write_mode = 4; //write the dut via sws .
}
else
{
printf("\tThe download mode error ! --> Please set \"usb\" or \"evk\" .\n");
return 0;
}
if(!strcmp(argv[1],"8266") || !strcmp(argv[1],"8267") || !strcmp(argv[1],"8366") || !strcmp(argv[1],"8368")){
mcu_type = 2;
}
else if(!strcmp(argv[1],"5562")){
mcu_type = 1;
}
else{
printf("\t Please select the approptiate \' mcu \'\n");
return 0;
}
GetModuleFileName(NULL,exeFullPath,MAX_PATH); //get the absolute path
(strrchr(exeFullPath, '\\'))[0] = 0; // 删除文件名,只获得路径字串 (strrchr(exeFullPath, '\\'))[1] 获得文件名
//strcat(exeFullPath,test_bin);
//printf("\t%s,%d\n",exeFullPath,write_mode);
if(!strcmp(argv[1],"8266"))
{
//strncpy(FilePath,"\\drive_bin\\dut_5325_flash_v0222.bin",sizeof("\\drive_bin\\dut_5325_flash_v0222.bin"));
strcat(exeFullPath,"\\drive_bin\\dut_5325_flash_v0222.bin");
}
if(!strcmp(argv[1],"8267"))
{
//strncpy(FilePath,"drive_bin\dut_8267_flash_v0002.bin",sizeof("drive_bin\\dut_8267_flash_v0002.bin"));
strcat(exeFullPath,"\\drive_bin\\dut_8267_flash_v0002.bin");
}
if(!strcmp(argv[1],"8366"))
{
//strncpy(FilePath,"\\drive_bin\\dut_5315_flash_v01b9.bin",sizeof("\\drive_bin\\dut_5315_flash_v01b9.bin"));
strcat(exeFullPath,"\\drive_bin\\dut_5315_flash_v01b9.bin");
}
if(!strcmp(argv[1],"8368"))
{
//strncpy(FilePath,"\\drive_bin\\dut_5318_flash_v020a.bin",sizeof("\\drive_bin\\dut_5318_flash_v020a.bin"));
strcat(exeFullPath,"\\drive_bin\\dut_5318_flash_v020a.bin");
}
if(!strcmp(argv[1],"5562"))
{
strcat(exeFullPath,"\\drive_bin\\dut_5560_flash.bin");
}
//m_hDev = GetPrintDeviceHandle(0xffff);
if(mcu_type == 1 && write_mode ==1){
m_hDev = GetPrintDeviceHandle2(0xffff);
}
else{
m_hDev = GetPrintDeviceHandle(0xffff);
}
if(write_mode ==4){
if(mcu_type == 1){
bu