diff --git a/flash-tool/cmd.c b/flash-tool/cmd.c index 8844ad7..10e7cff 100644 --- a/flash-tool/cmd.c +++ b/flash-tool/cmd.c @@ -38,10 +38,10 @@ extern int com_argc; extern char com_argv[MAX_ARGC][MAX_COMMAND_LENGTH]; struct ingenic_dev ingenic_dev; -struct hand_t hand; +struct hand hand; -static struct nand_in_t nand_in; -static struct nand_out_t nand_out; +static struct nand_in nand_in; +static struct nand_out nand_out; unsigned int total_size; unsigned char code_buf[4 * 512 * 1024]; unsigned char check_buf[4 * 512 * 1024]; @@ -100,7 +100,7 @@ static int load_file(struct ingenic_dev *ingenic_dev, const char *file_path) /* write args to code */ memcpy(ingenic_dev->file_buff + 8, &hand.fw_args, - sizeof(struct fw_args_t)); + sizeof(struct fw_args)); res = 1; @@ -214,7 +214,7 @@ int error_check(unsigned char *org,unsigned char * obj,unsigned int size) return 1; } -int nand_markbad(struct nand_in_t *nand_in) +int nand_markbad(struct nand_in *nand_in) { if (usb_get_ingenic_cpu(&ingenic_dev) < 3) { printf("\n Device unboot! Boot it first!"); @@ -231,8 +231,8 @@ int nand_markbad(struct nand_in_t *nand_in) return 0; } -int nand_program_check(struct nand_in_t *nand_in, - struct nand_out_t *nand_out, +int nand_program_check(struct nand_in *nand_in, + struct nand_out *nand_out, unsigned int *start_page) { unsigned int i,page_num,cur_page; @@ -340,7 +340,7 @@ int nand_program_check(struct nand_in_t *nand_in, } else { /* (nand_out->status)[i] = 0; */ printf(" fail!"); - struct nand_in_t bad; + struct nand_in bad; cur_page = (ret[3] << 24) | (ret[2] << 16) | (ret[1] << 8) | @@ -356,7 +356,7 @@ int nand_program_check(struct nand_in_t *nand_in, return 0; } -int nand_erase(struct nand_in_t *nand_in) +int nand_erase(struct nand_in *nand_in) { unsigned int start_blk, blk_num, end_block; int i; @@ -408,8 +408,8 @@ int nand_erase(struct nand_in_t *nand_in) return 1; } -int nand_program_file(struct nand_in_t *nand_in, - struct nand_out_t *nand_out, +int nand_program_file(struct nand_in *nand_in, + struct nand_out *nand_out, char *fname) { @@ -417,8 +417,8 @@ int nand_program_file(struct nand_in_t *nand_in, unsigned int start_page = 0, page_num, code_len, offset, transfer_size; FILE *fp; unsigned char status_buf[32]; - struct nand_in_t n_in; - struct nand_out_t n_out; + struct nand_in n_in; + struct nand_out n_out; #ifdef CONFIG_NAND_OUT /* nand_out->status = (unsigned char *)malloc(nand_in->max_chip * sizeof(unsigned char)); */ @@ -527,8 +527,8 @@ int nand_program_file(struct nand_in_t *nand_in, return 1; } -int nand_program_file_planes(struct nand_in_t *nand_in, - struct nand_out_t *nand_out, +int nand_program_file_planes(struct nand_in *nand_in, + struct nand_out *nand_out, char *fname) { printf(" \n not implement yet !"); diff --git a/flash-tool/device_stage2/nandflash/nandflash_4740.c b/flash-tool/device_stage2/nandflash/nandflash_4740.c index 45c2844..ce78d6d 100644 --- a/flash-tool/device_stage2/nandflash/nandflash_4740.c +++ b/flash-tool/device_stage2/nandflash/nandflash_4740.c @@ -49,7 +49,7 @@ static volatile unsigned char *cmdport = (volatile unsigned char *)0xb8008000; static int bus = 8, row = 2, pagesize = 2048, oobsize = 64, ppb = 128; static int bad_block_pos,bad_block_page,force_erase,ecc_pos,wp_pin; -extern struct hand_t Hand; +extern struct hand Hand; //static u8 data_buf[2048] = {0}; static u8 oob_buf[256] = {0}; extern u16 handshake_PKT[4]; diff --git a/flash-tool/device_stage2/nandflash/nandflash_4750.c b/flash-tool/device_stage2/nandflash/nandflash_4750.c index 37e996d..ad10a11 100644 --- a/flash-tool/device_stage2/nandflash/nandflash_4750.c +++ b/flash-tool/device_stage2/nandflash/nandflash_4750.c @@ -39,7 +39,7 @@ static int oobecc = 0; /* Whether the oob data of the binary contains static int bad_block_page = 127; /* Specify the page number of badblock flag inside a block */ static u32 bad_block_pos = 0; /* Specify the badblock flag offset inside the oob */ static u8 oob_buf[256] = {0}; -extern struct hand_t Hand; +extern struct hand Hand; extern u16 handshake_PKT[4]; static inline void __nand_sync(void) diff --git a/flash-tool/device_stage2/usb_boot/boothandler.c b/flash-tool/device_stage2/usb_boot/boothandler.c index 0e5ec35..860aa39 100644 --- a/flash-tool/device_stage2/usb_boot/boothandler.c +++ b/flash-tool/device_stage2/usb_boot/boothandler.c @@ -22,7 +22,7 @@ u32 (*nand_mark_bad) (int bad); void (*nand_enable) (unsigned int csn); void (*nand_disable) (unsigned int csn); -struct hand_t Hand,*Hand_p; +struct hand Hand,*Hand_p; extern u32 Bulk_out_buf[BULK_OUT_BUF_SIZE]; extern u32 Bulk_in_buf[BULK_IN_BUF_SIZE]; extern u16 handshake_PKT[4]; @@ -48,9 +48,9 @@ void dump_data(unsigned int *p, int size) void config_hand() { - struct hand_t *hand_p; - hand_p=(struct hand_t *)Bulk_out_buf; - memcpy(&Hand, (unsigned char *)Bulk_out_buf, sizeof(struct hand_t)); + struct hand *hand_p; + hand_p=(struct hand *)Bulk_out_buf; + memcpy(&Hand, (unsigned char *)Bulk_out_buf, sizeof(struct hand)); #if 0 Hand.nand_bw=hand_p->nand_bw; diff --git a/flash-tool/ingenic_cfg.c b/flash-tool/ingenic_cfg.c index 38ce84e..eecf4f1 100644 --- a/flash-tool/ingenic_cfg.c +++ b/flash-tool/ingenic_cfg.c @@ -25,7 +25,7 @@ extern unsigned int total_size; -int hand_init_def(struct hand_t *hand) +int hand_init_def(struct hand *hand) { /* nand flash info */ /* hand.nand_start=0; */ /* important !!!! */ @@ -55,7 +55,7 @@ int hand_init_def(struct hand_t *hand) return 1; } -int check_dump_cfg(struct hand_t *hand) +int check_dump_cfg(struct hand *hand) { printf("\n Now checking whether all configure args valid: "); /* check PLL */ @@ -131,7 +131,7 @@ int check_dump_cfg(struct hand_t *hand) return 1; } -int parse_configure(struct hand_t *hand, char * file_path) +int parse_configure(struct hand *hand, char * file_path) { hand_init_def(hand); diff --git a/flash-tool/ingenic_cfg.h b/flash-tool/ingenic_cfg.h index 3eca4b2..e640f41 100644 --- a/flash-tool/ingenic_cfg.h +++ b/flash-tool/ingenic_cfg.h @@ -26,8 +26,8 @@ #define CONFIG_FILE_PATH "usb_boot.cfg" -int hand_init_def(struct hand_t *hand); -int check_dump_cfg(struct hand_t *hand); -int parse_configure(struct hand_t *hand, char * file_path); +int hand_init_def(struct hand *hand); +int check_dump_cfg(struct hand *hand); +int parse_configure(struct hand *hand, char * file_path); #endif /*__INGENIC_CFG_H__ */ diff --git a/flash-tool/main.c b/flash-tool/main.c index 97db042..666013d 100644 --- a/flash-tool/main.c +++ b/flash-tool/main.c @@ -29,7 +29,7 @@ #include "ingenic_cfg.h" extern struct ingenic_dev ingenic_dev; -extern struct hand_t hand; +extern struct hand hand; static void help(void) { @@ -62,7 +62,7 @@ int main(int argc, char **argv) char com_buf[256]; memset(com_buf, 0, 256); - while (1) { + while(1) { int c, option_index = 0; c = getopt_long(argc, argv, "hvc:", opts, &option_index); diff --git a/flash-tool/usb_boot_defines.h b/flash-tool/usb_boot_defines.h index 07e6662..53a8abd 100644 --- a/flash-tool/usb_boot_defines.h +++ b/flash-tool/usb_boot_defines.h @@ -27,15 +27,15 @@ #define CODE_SIZE ( 4 * 1024 * 1024 ) /* #define START_ADDR ( 0x80000000 + SDRAM_SIZE - CODE_SIZE ) */ -#define NAND_MAX_BLK_NUM 10000000 /* ((Hand.nand_pn / Hand.nand_ppb) + 1) */ -#define NAND_MAX_PAGE_NUM 1073740824 /*Hand.nand_pn */ -#define NAND_SECTION_NUM 23 -#define MAX_TRANSFER_SIZE 0x100000 -#define MAX_LOAD_SIZE 0x3000 -#define NAND_MAX_BYTE_NUM (Hand.nand_pn * Hand.nand_ps) +#define NAND_MAX_BLK_NUM 10000000 /*((Hand.nand_pn / Hand.nand_ppb) + 1)*/ +#define NAND_MAX_PAGE_NUM 1073740824 /*Hand.nand_pn */ +#define NAND_SECTION_NUM 23 +#define MAX_TRANSFER_SIZE 0x100000 +#define MAX_LOAD_SIZE 0x3000 +#define NAND_MAX_BYTE_NUM (Hand.nand_pn * Hand.nand_ps) #define IOCTL_INBUF_SIZE 512 #define IOCTL_OUTBUF_SIZE 512 -#define MAX_DEV_NUM 16 +#define MAX_DEV_NUM 16 enum CPUTYPE { JZ4740, @@ -92,7 +92,7 @@ enum DATA_STRUCTURE_OB { DS_hand }; -struct fw_args_t { +struct fw_args { /* CPU ID */ unsigned int cpu_id; @@ -122,7 +122,7 @@ struct fw_args_t { /* unsigned char align2; */ } __attribute__((packed)); -struct hand_t { +struct hand { /* nand flash info */ int pt; /* cpu type */ @@ -141,10 +141,10 @@ struct hand_t { unsigned int nand_wppin; unsigned int nand_bpc; /* block number per chip */ - struct fw_args_t fw_args; + struct fw_args fw_args; } __attribute__((packed)); -struct nand_in_t { +struct nand_in { unsigned char dev; unsigned char max_chip; unsigned char *buf; @@ -156,11 +156,11 @@ struct nand_in_t { int (* check) (unsigned char *,unsigned char *,unsigned int); }; -struct nand_out_t { +struct nand_out { unsigned char *status; }; -struct sdram_in_t { +struct sdram_in { unsigned char dev; unsigned char *buf; unsigned int start;