mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-01 16:25:20 +02:00
change the fw_args_t , don't use typedef
This commit is contained in:
parent
60daa40873
commit
346f1528d6
102
flash-tool/cmd.c
102
flash-tool/cmd.c
@ -31,10 +31,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <confuse.h>
|
#include <confuse.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
struct nand_in nand_in;
|
static struct nand_in_t nand_in;
|
||||||
struct nand_out nand_out;
|
static struct nand_out_t nand_out;
|
||||||
struct fw_args_t fw_args;
|
static struct fw_args_t fw_args;
|
||||||
unsigned int total_size;
|
unsigned int total_size;
|
||||||
|
|
||||||
static int parse_configure(char * file_path)
|
static int parse_configure(char * file_path)
|
||||||
@ -287,45 +288,88 @@ int nprog(int com_argc, char **com_argv)
|
|||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
if (com_argc < 6)
|
int index;
|
||||||
{
|
int c;
|
||||||
printf("\n Usage:"
|
char *image_file;
|
||||||
" nprog (1) (2) (3) (4) (5) "
|
char *help = "\n Usage: nprog [options] ..."
|
||||||
"\n 1:start page number"
|
"\n -s\tstart page number"
|
||||||
"\n 2:image file name"
|
"\n -i\timage file name"
|
||||||
"\n 3:device index number"
|
"\n -d\tdevice index number"
|
||||||
"\n 4:flash index number"
|
"\n -f\tflash index number"
|
||||||
"\n 5:image type -n:no oob,-o:with oob no ecc,-e:with oob and ecc");
|
"\n image type:"
|
||||||
|
"\n \t-n:\tno oob"
|
||||||
|
"\n \t-o:\twith oob no ecc"
|
||||||
|
"\n \t-e:\twith oob and ecc";
|
||||||
|
opterr = 0;
|
||||||
|
if (com_argc != 10) {
|
||||||
|
printf("\n not enough argument.");
|
||||||
|
printf("%s", help);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < MAX_DEV_NUM; i++)
|
for (i = 0; i < MAX_DEV_NUM; i++)
|
||||||
(nand_in.cs_map)[i] = 0;
|
(nand_in.cs_map)[i] = 0;
|
||||||
if (atoi(com_argv[4]) >= MAX_DEV_NUM) {
|
|
||||||
printf("\n Flash index number overflow!");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
(nand_in.cs_map)[atoi(com_argv[4])] = 1;
|
|
||||||
nand_in.start = atoi(com_argv[1]);
|
|
||||||
nand_in.dev = atoi(com_argv[3]);
|
|
||||||
|
|
||||||
if (!strcmp(com_argv[5],"-e"))
|
while ((c = getopt (com_argc, com_argv, "s:i:d:f:noe")) != -1)
|
||||||
nand_in.option = OOB_ECC;
|
switch (c)
|
||||||
else if (!strcmp(com_argv[5],"-o"))
|
{
|
||||||
nand_in.option = OOB_NO_ECC;
|
|
||||||
else
|
|
||||||
nand_in.option = NO_OOB;
|
|
||||||
|
|
||||||
|
case 's':
|
||||||
|
nand_in.start = atoi(optarg);
|
||||||
|
break;
|
||||||
|
case 'i':
|
||||||
|
image_file = optarg;
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
nand_in.dev = atoi(optarg);
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
(nand_in.cs_map)[atoi(optarg)] = 1;
|
||||||
|
if (atoi(optarg) >= MAX_DEV_NUM) {
|
||||||
|
printf("\n Flash index number overflow!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
nand_in.option = NO_OOB;
|
||||||
|
break;
|
||||||
|
case 'o':
|
||||||
|
nand_in.option = OOB_NO_ECC;
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
nand_in.option = OOB_ECC;
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
if (optopt == 's' ||
|
||||||
|
optopt == 'i' ||
|
||||||
|
optopt == 'd' ||
|
||||||
|
optopt == 'f')
|
||||||
|
printf ("Option -%c requires an argument.\n", optopt);
|
||||||
|
else if (isprint (optopt))
|
||||||
|
printf ("Unknown option `-%c'.\n", optopt);
|
||||||
|
else
|
||||||
|
printf ("Unknown option character `\\x%x'.\n", optopt);
|
||||||
|
printf("%s", help);
|
||||||
|
return -1;
|
||||||
|
default:
|
||||||
|
printf("%s", help);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (Hand.nand_plane > 1)
|
if (Hand.nand_plane > 1)
|
||||||
/* API_Nand_Program_File_Planes(&nand_in,&nand_out,com_argv[2]); */
|
/* API_Nand_Program_File_Planes(&nand_in,&nand_out,com_argv[2]); */
|
||||||
else
|
else
|
||||||
/* API_Nand_Program_File(&nand_in,&nand_out,com_argv[2]); */
|
/* API_Nand_Program_File(&nand_in,&nand_out,com_argv[2]); */
|
||||||
#if 0
|
|
||||||
printf("\n Flash check result:");
|
printf("\n Flash check result:");
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
printf(" %d", (nand_out.status)[i]);
|
printf(" %d", (nand_out.status)[i]);
|
||||||
|
printf("nprog %d %s %d %d %d", nand_in.start,
|
||||||
|
image_file,
|
||||||
|
nand_in.dev,
|
||||||
|
(nand_in.cs_map)[atoi(optarg)],
|
||||||
|
nand_in.option);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
printf("\n not implement yet!! ");
|
||||||
printf("\n not implement yet!!");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user