From ee5af659bf45ec4038b7d8de7e0a84ea8173824b Mon Sep 17 00:00:00 2001 From: xiangfu Date: Mon, 4 May 2009 16:08:03 +0000 Subject: [PATCH] add some comment --- flash-tool/cmd.c | 11 +++-------- flash-tool/command_line.c | 10 +++++----- flash-tool/ingenic_usb.c | 6 +----- flash-tool/main.c | 10 ++-------- 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/flash-tool/cmd.c b/flash-tool/cmd.c index e6de23c..5405eee 100644 --- a/flash-tool/cmd.c +++ b/flash-tool/cmd.c @@ -212,11 +212,6 @@ int nand_program_check(struct nand_in_t *nand_in, (nand_out->status)[i] = 0; /* set all status to fail */ #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) { printf("\n Device unboot! Boot it first!"); 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! */ #endif 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; - } else { + else page_num = transfer_size / (hand.nand_ps + hand.nand_os); - } + code_len = transfer_size; fread(code_buf, 1, code_len, fp); /* read code from file to buffer */ printf("\n No.%d Programming...",k+1); diff --git a/flash-tool/command_line.c b/flash-tool/command_line.c index 55377f5..aaaad32 100644 --- a/flash-tool/command_line.c +++ b/flash-tool/command_line.c @@ -64,7 +64,7 @@ static const char COMMAND[][30]= "run" }; -int handle_help(void) +static int handle_help(void) { printf("\n Command support in current version:" "\n help print this help;" @@ -91,13 +91,13 @@ int handle_help(void) return 1; } -int handle_version(void) +static int handle_version(void) { printf("\n USB Boot Software current version: %s", CURRENT_VERSION); return 1; } -int handle_fconfig(void) +static int handle_fconfig(void) { if (com_argc < 3) { printf("\n Usage:" @@ -110,7 +110,7 @@ int handle_fconfig(void) return 1; } -int command_input(char *buf) +int command_input(char *buf) /* read command from stdin */ { char *cptr; cptr = fgets(buf, 256, stdin); @@ -159,7 +159,7 @@ int command_interpret(char * com_buf) int command_handle(char *buf) { - int cmd = command_interpret(buf); + int cmd = command_interpret(buf); /* get the command index */ if (!cmd) return -1; diff --git a/flash-tool/ingenic_usb.c b/flash-tool/ingenic_usb.c index fb0ba52..eef1ed0 100644 --- a/flash-tool/ingenic_usb.c +++ b/flash-tool/ingenic_usb.c @@ -3,6 +3,7 @@ * * (C) Copyright 2009 * Author: Marek Lindner + * Author: Xiangfu liu * * This program is free software; you can redistribute it and/or * 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; } - /* 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) { fprintf(stderr, "Error - can't find Ingenic interface\n"); goto out; diff --git a/flash-tool/main.c b/flash-tool/main.c index a545e3b..f54433b 100644 --- a/flash-tool/main.c +++ b/flash-tool/main.c @@ -20,13 +20,8 @@ */ #include -#include -#include #include -#include -#include -#include -#include +#include #include "usb.h" #include "config.h" #include "command_line.h" @@ -104,7 +99,7 @@ int main(int argc, char **argv) if (parse_configure(&hand, CONFIG_FILE_PATH) < 1) return EXIT_FAILURE; - if (command) { + if (command) { /* direct run command */ command_handle(com_buf); printf("\n"); goto out; @@ -122,4 +117,3 @@ out: usb_ingenic_cleanup(&ingenic_dev); return EXIT_SUCCESS; } -