1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-01 18:22:28 +02:00

add some comment

This commit is contained in:
xiangfu 2009-05-04 16:08:03 +00:00
parent 37327ca07f
commit ee5af659bf
4 changed files with 11 additions and 26 deletions

View File

@ -212,11 +212,6 @@ int nand_program_check(struct nand_in_t *nand_in,
(nand_out->status)[i] = 0; /* set all status to fail */ (nand_out->status)[i] = 0; /* set all status to fail */
#endif #endif
/* if (handle_Open(nand_in->dev)==-1) { */
/* printf("\n Can not connect device!"); */
/* return -1; */
/* } needs change*/
if (usb_get_ingenic_cpu(&ingenic_dev) < 3) { if (usb_get_ingenic_cpu(&ingenic_dev) < 3) {
printf("\n Device unboot! Boot it first!"); printf("\n Device unboot! Boot it first!");
return -1; return -1;
@ -450,11 +445,11 @@ int nand_program_file(struct nand_in_t *nand_in,
(nand_out->status)[i] = 1; /* set all status to success! */ (nand_out->status)[i] = 1; /* set all status to success! */
#endif #endif
for (k = 0; k < m; k++) { for (k = 0; k < m; k++) {
if (nand_in->option == NO_OOB) { if (nand_in->option == NO_OOB)
page_num = transfer_size / hand.nand_ps; page_num = transfer_size / hand.nand_ps;
} else { else
page_num = transfer_size / (hand.nand_ps + hand.nand_os); page_num = transfer_size / (hand.nand_ps + hand.nand_os);
}
code_len = transfer_size; code_len = transfer_size;
fread(code_buf, 1, code_len, fp); /* read code from file to buffer */ fread(code_buf, 1, code_len, fp); /* read code from file to buffer */
printf("\n No.%d Programming...",k+1); printf("\n No.%d Programming...",k+1);

View File

@ -64,7 +64,7 @@ static const char COMMAND[][30]=
"run" "run"
}; };
int handle_help(void) static int handle_help(void)
{ {
printf("\n Command support in current version:" printf("\n Command support in current version:"
"\n help print this help;" "\n help print this help;"
@ -91,13 +91,13 @@ int handle_help(void)
return 1; return 1;
} }
int handle_version(void) static int handle_version(void)
{ {
printf("\n USB Boot Software current version: %s", CURRENT_VERSION); printf("\n USB Boot Software current version: %s", CURRENT_VERSION);
return 1; return 1;
} }
int handle_fconfig(void) static int handle_fconfig(void)
{ {
if (com_argc < 3) { if (com_argc < 3) {
printf("\n Usage:" printf("\n Usage:"
@ -110,7 +110,7 @@ int handle_fconfig(void)
return 1; return 1;
} }
int command_input(char *buf) int command_input(char *buf) /* read command from stdin */
{ {
char *cptr; char *cptr;
cptr = fgets(buf, 256, stdin); cptr = fgets(buf, 256, stdin);
@ -159,7 +159,7 @@ int command_interpret(char * com_buf)
int command_handle(char *buf) int command_handle(char *buf)
{ {
int cmd = command_interpret(buf); int cmd = command_interpret(buf); /* get the command index */
if (!cmd) if (!cmd)
return -1; return -1;

View File

@ -3,6 +3,7 @@
* *
* (C) Copyright 2009 * (C) Copyright 2009
* Author: Marek Lindner <lindner_marek@yahoo.de> * Author: Marek Lindner <lindner_marek@yahoo.de>
* Author: Xiangfu liu <xiangfu.z@gmail.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -116,11 +117,6 @@ int usb_ingenic_init(struct ingenic_dev *ingenic_dev)
goto out; goto out;
} }
/* if (usb_set_configuration(ingenic_dev->usb_handle, 1) < 0) { */
/* fprintf(stderr, "Error - can't set Ingenic configuration: %s\n", usb_strerror()); */
/* goto out; */
/* } */
if (get_ingenic_interface(ingenic_dev) < 1) { if (get_ingenic_interface(ingenic_dev) < 1) {
fprintf(stderr, "Error - can't find Ingenic interface\n"); fprintf(stderr, "Error - can't find Ingenic interface\n");
goto out; goto out;

View File

@ -20,13 +20,8 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <getopt.h>
#include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <getopt.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "usb.h" #include "usb.h"
#include "config.h" #include "config.h"
#include "command_line.h" #include "command_line.h"
@ -104,7 +99,7 @@ int main(int argc, char **argv)
if (parse_configure(&hand, CONFIG_FILE_PATH) < 1) if (parse_configure(&hand, CONFIG_FILE_PATH) < 1)
return EXIT_FAILURE; return EXIT_FAILURE;
if (command) { if (command) { /* direct run command */
command_handle(com_buf); command_handle(com_buf);
printf("\n"); printf("\n");
goto out; goto out;
@ -122,4 +117,3 @@ out:
usb_ingenic_cleanup(&ingenic_dev); usb_ingenic_cleanup(&ingenic_dev);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }