FreeCalypso > hg > freecalypso-sw
changeset 406:0b8e5072abde
fc-loadtool flash: reset to read mode added where appropriate
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 17 Jun 2014 00:53:07 +0000 |
parents | a212b4968b29 |
children | f2cc551e597f |
files | loadtools/flmain.c loadtools/flmisc.c |
diffstat | 2 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/loadtools/flmain.c Tue Jun 17 00:33:05 2014 +0000 +++ b/loadtools/flmain.c Tue Jun 17 00:53:07 2014 +0000 @@ -200,6 +200,7 @@ extern int flashcmd_program_m0(); extern int flashcmd_program_srec(); extern int flashcmd_quickprog(); +extern int flashcmd_reset(); extern int flashcmd_sectors(); static struct cmdtab { @@ -216,6 +217,7 @@ {"program-m0", flashcmd_program_m0}, {"program-srec", flashcmd_program_srec}, {"quickprog", flashcmd_quickprog}, + {"reset", flashcmd_reset}, {"sectors", flashcmd_sectors}, {0, 0} };
--- a/loadtools/flmisc.c Tue Jun 17 00:33:05 2014 +0000 +++ b/loadtools/flmisc.c Tue Jun 17 00:53:07 2014 +0000 @@ -46,6 +46,9 @@ (u_long) bi->geom->total_size); return(-1); } + /* reset flash to read mode */ + if (bi->ops->reset_cmd(bi) < 0) + return(-1); sprintf(targ_start, "%lx", (u_long) bi->base_addr + offset); sprintf(targ_len, "%lx", len); targv[0] = "blankchk"; @@ -111,6 +114,9 @@ "internal bug: bad format in flashcmd_dump2file()\n"); return(-1); } + /* reset flash to read mode */ + if (bi->ops->reset_cmd(bi) < 0) + return(-1); return loadtool_memdump(bi->base_addr + offset, dumplen, argv[2], format); } @@ -212,3 +218,18 @@ return(-1); return tpinterf_pass_output(1); } + +flashcmd_reset(argc, argv, bank) + char **argv; +{ + struct flash_bank_info *bi; + + if (argc > 2) { + fprintf(stderr, "error: too many arguments\n"); + return(-1); + } + if (flash_get_cfi(bank) < 0) + return(-1); + bi = flash_bank_info + bank; + return bi->ops->reset_cmd(bi); +}