FreeCalypso > hg > freecalypso-sw
comparison loadtools/flmisc.c @ 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 | 431023033c86 |
comparison
equal
deleted
inserted
replaced
405:a212b4968b29 | 406:0b8e5072abde |
---|---|
44 fprintf(stderr, | 44 fprintf(stderr, |
45 "error: specified offset+length exceed flash bank size (0x%lx)\n", | 45 "error: specified offset+length exceed flash bank size (0x%lx)\n", |
46 (u_long) bi->geom->total_size); | 46 (u_long) bi->geom->total_size); |
47 return(-1); | 47 return(-1); |
48 } | 48 } |
49 /* reset flash to read mode */ | |
50 if (bi->ops->reset_cmd(bi) < 0) | |
51 return(-1); | |
49 sprintf(targ_start, "%lx", (u_long) bi->base_addr + offset); | 52 sprintf(targ_start, "%lx", (u_long) bi->base_addr + offset); |
50 sprintf(targ_len, "%lx", len); | 53 sprintf(targ_len, "%lx", len); |
51 targv[0] = "blankchk"; | 54 targv[0] = "blankchk"; |
52 targv[1] = targ_start; | 55 targv[1] = targ_start; |
53 targv[2] = targ_len; | 56 targv[2] = targ_len; |
109 default: | 112 default: |
110 fprintf(stderr, | 113 fprintf(stderr, |
111 "internal bug: bad format in flashcmd_dump2file()\n"); | 114 "internal bug: bad format in flashcmd_dump2file()\n"); |
112 return(-1); | 115 return(-1); |
113 } | 116 } |
117 /* reset flash to read mode */ | |
118 if (bi->ops->reset_cmd(bi) < 0) | |
119 return(-1); | |
114 return loadtool_memdump(bi->base_addr + offset, dumplen, argv[2], | 120 return loadtool_memdump(bi->base_addr + offset, dumplen, argv[2], |
115 format); | 121 format); |
116 } | 122 } |
117 | 123 |
118 flashcmd_erase(argc, argv, bank) | 124 flashcmd_erase(argc, argv, bank) |
210 } | 216 } |
211 if (tpinterf_send_cmd() < 0) | 217 if (tpinterf_send_cmd() < 0) |
212 return(-1); | 218 return(-1); |
213 return tpinterf_pass_output(1); | 219 return tpinterf_pass_output(1); |
214 } | 220 } |
221 | |
222 flashcmd_reset(argc, argv, bank) | |
223 char **argv; | |
224 { | |
225 struct flash_bank_info *bi; | |
226 | |
227 if (argc > 2) { | |
228 fprintf(stderr, "error: too many arguments\n"); | |
229 return(-1); | |
230 } | |
231 if (flash_get_cfi(bank) < 0) | |
232 return(-1); | |
233 bi = flash_bank_info + bank; | |
234 return bi->ops->reset_cmd(bi); | |
235 } |