FreeCalypso > hg > freecalypso-sw
diff loadtools/flprogsrec.c @ 405:a212b4968b29
fc-loadtool flash: another refactoring: geometry vs. command set
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 17 Jun 2014 00:33:05 +0000 |
parents | f027c6fbe37e |
children | 81d387690063 |
line wrap: on
line diff
--- a/loadtools/flprogsrec.c Mon Jun 16 01:15:17 2014 +0000 +++ b/loadtools/flprogsrec.c Tue Jun 17 00:33:05 2014 +0000 @@ -1,7 +1,6 @@ /* - * In this module we are going to implement the flash program-srec and - * flash program-m0 commands: programming flash using S-record files - * as the data source. + * This module implements the flash program-srec and flash program-m0 commands: + * programming flash using S-record files as the data source. */ #include <sys/types.h> @@ -25,11 +24,6 @@ if (flash_get_cfi(bank) < 0) return(-1); bi = flash_bank_info + bank; - if (bi->cfi->cmdset_style != 2) { - fprintf(stderr, -"error: this command is currently only implemented for AMD-style flash\n"); - return(-1); - } srr.filename = imgfile; resp = open_srec_file(&srr); if (resp < 0) @@ -40,7 +34,7 @@ return(resp); } sprintf(shortarg, "%lx", (u_long) bi->base_addr); - targv[0] = "AMFB"; + targv[0] = bi->ops->loadagent_setbase_cmd; targv[1] = shortarg; targv[2] = 0; printf("Setting flash base address: %s %s\n", targv[0], targv[1]); @@ -54,7 +48,7 @@ fclose(srr.openfile); return(resp); } - targv[0] = "AMFW"; + targv[0] = bi->ops->loadagent_program_cmd; targv[1] = shortarg; targv[2] = longarg; targv[3] = 0; @@ -98,8 +92,8 @@ fclose(srr.openfile); return(-1); } - srr.addr &= bi->cfi->total_size - 1; - if (srr.addr + srr.datalen > bi->cfi->total_size) { + srr.addr &= bi->geom->total_size - 1; + if (srr.addr + srr.datalen > bi->geom->total_size) { fprintf(stderr, "%s line %d: goes past the end of the flash bank\n", srr.filename, srr.lineno);