FreeCalypso > hg > freecalypso-sw
diff loadtools/flerase.c @ 400:f027c6fbe37e
fc-loadtool flash: first round of refactoring for CFI
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 15 Jun 2014 20:05:54 +0000 |
parents | cd12d1049f91 |
children |
line wrap: on
line diff
--- a/loadtools/flerase.c Sun Jun 15 00:47:06 2014 +0000 +++ b/loadtools/flerase.c Sun Jun 15 20:05:54 2014 +0000 @@ -72,20 +72,27 @@ offset = strtoul(argv[2], &strtoul_endp, 16); if (*strtoul_endp) goto inv; + if (flash_get_cfi(bank) < 0) + return(-1); bi = flash_bank_info + bank; - if (offset >= bi->total_size) { + if (bi->cfi->cmdset_style != 2) { + fprintf(stderr, +"error: this command is currently only implemented for AMD-style flash\n"); + return(-1); + } + if (offset >= bi->cfi->total_size) { fprintf(stderr, "error: specified offset exceeds flash bank size (0x%lx)\n", - (u_long) bi->total_size); + (u_long) bi->cfi->total_size); return(-1); } len = strtoul(argv[3], &strtoul_endp, 16); if (*strtoul_endp) goto inv; - if (len > bi->total_size - offset) { + if (len > bi->cfi->total_size - offset) { fprintf(stderr, "error: specified offset+length exceed flash bank size (0x%lx)\n", - (u_long) bi->total_size); + (u_long) bi->cfi->total_size); return(-1); } if (!len) {