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