mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-01 14:14:38 +02:00
remove command_input function.
change nand_program_check not return page num.
This commit is contained in:
parent
ee5af659bf
commit
7085493d7c
@ -193,7 +193,8 @@ int nand_markbad(struct nand_in_t *nand_in)
|
||||
}
|
||||
|
||||
int nand_program_check(struct nand_in_t *nand_in,
|
||||
struct nand_out_t *nand_out)
|
||||
struct nand_out_t *nand_out,
|
||||
unsigned int *start_page)
|
||||
{
|
||||
unsigned int i,page_num,cur_page;
|
||||
unsigned short temp;
|
||||
@ -329,7 +330,8 @@ int nand_program_check(struct nand_in_t *nand_in,
|
||||
|
||||
}
|
||||
/* handle_Close(); */
|
||||
return cur_page;
|
||||
*start_page = cur_page;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nand_erase(struct nand_in_t *nand_in)
|
||||
@ -367,7 +369,6 @@ int nand_erase(struct nand_in_t *nand_in)
|
||||
ingenic_dev.file_buff = ret;
|
||||
ingenic_dev.file_len = 8;
|
||||
usb_read_data_from_ingenic(&ingenic_dev);
|
||||
/* ReadFile(hDevice, ret, 8, &nRead, NULL); need to change*/
|
||||
printf(" Finish!");
|
||||
}
|
||||
/* handle_Close(); need to change */
|
||||
@ -455,7 +456,9 @@ int nand_program_file(struct nand_in_t *nand_in,
|
||||
printf("\n No.%d Programming...",k+1);
|
||||
nand_in->length = code_len; /* code length,not page number! */
|
||||
nand_in->buf = code_buf;
|
||||
start_page = nand_program_check(nand_in, &n_out);
|
||||
if ( nand_program_check(nand_in, &n_out, &start_page) == -1)
|
||||
return -1;
|
||||
|
||||
if ( start_page - nand_in->start > hand.nand_ppb )
|
||||
printf("\n Skip a old bad block !");
|
||||
nand_in->start = start_page;
|
||||
@ -478,8 +481,11 @@ int nand_program_file(struct nand_in_t *nand_in,
|
||||
nand_in->length = j;
|
||||
nand_in->buf = code_buf;
|
||||
printf("\n No.%d Programming...",k+1);
|
||||
start_page = nand_program_check(nand_in, &n_out);
|
||||
if ( start_page - nand_in->start > hand.nand_ppb )
|
||||
|
||||
if (nand_program_check(nand_in, &n_out, &start_page) == -1)
|
||||
return -1;
|
||||
|
||||
if (start_page - nand_in->start > hand.nand_ppb)
|
||||
printf(" Skip a old bad block !");
|
||||
#if 0
|
||||
for (i=0; i < nand_in->max_chip; i++) {
|
||||
|
@ -110,16 +110,6 @@ static int handle_fconfig(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int command_input(char *buf) /* read command from stdin */
|
||||
{
|
||||
char *cptr;
|
||||
cptr = fgets(buf, 256, stdin);
|
||||
|
||||
if (cptr != NULL)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int command_interpret(char * com_buf)
|
||||
{
|
||||
char *buf = com_buf;
|
||||
|
@ -140,6 +140,7 @@ int usb_get_ingenic_cpu(struct ingenic_dev *ingenic_dev)
|
||||
memset(&ingenic_dev->cpu_info_buff, 0,
|
||||
ARRAY_SIZE(ingenic_dev->cpu_info_buff));
|
||||
|
||||
sleep(1);
|
||||
status = usb_control_msg(ingenic_dev->usb_handle,
|
||||
/* bmRequestType */ USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
/* bRequest */ VR_GET_CPU_INFO,
|
||||
@ -275,7 +276,6 @@ int usb_ingenic_upload(struct ingenic_dev *ingenic_dev, int stage)
|
||||
usb_send_data_to_ingenic(ingenic_dev);
|
||||
|
||||
if (stage == 2) {
|
||||
sleep(1);
|
||||
usb_get_ingenic_cpu(ingenic_dev);
|
||||
usb_ingenic_flush_cache(ingenic_dev);
|
||||
}
|
||||
@ -295,7 +295,6 @@ int usb_ingenic_upload(struct ingenic_dev *ingenic_dev, int stage)
|
||||
goto out;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
usb_get_ingenic_cpu(ingenic_dev);
|
||||
status = 1;
|
||||
|
||||
|
@ -58,8 +58,9 @@ int main(int argc, char **argv)
|
||||
"This program is Free Software and has ABSOLUTELY NO WARRANTY\n\n");
|
||||
|
||||
int command = 0;
|
||||
char *cptr;
|
||||
char com_buf[256];
|
||||
memset(com_buf, '\n', 256);
|
||||
memset(com_buf, 0, 256);
|
||||
|
||||
while (1) {
|
||||
int c, option_index = 0;
|
||||
@ -107,8 +108,10 @@ int main(int argc, char **argv)
|
||||
|
||||
while (1) {
|
||||
printf("\n inflash :> ");
|
||||
if (!command_input(com_buf))
|
||||
cptr = fgets(com_buf, 256, stdin);
|
||||
if (cptr == NULL)
|
||||
continue;
|
||||
|
||||
if (command_handle(com_buf) == -1 )
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user