diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index b3d25f54..f5c0bd1d 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,5 +1,8 @@ 2009-05-22 Arnim Laeuger + * src/flash/flash.c: verify speed-up: use URJ_BUS_READ_START, _NEXT, + and _END instead of monolithic URJ_BUS_READ + * src/flash/jedec.c: rework autoselect probing, better support of x8/x16 capable flash chips diff --git a/urjtag/src/flash/flash.c b/urjtag/src/flash/flash.c index 966fd332..2eb47ce6 100644 --- a/urjtag/src/flash/flash.c +++ b/urjtag/src/flash/flash.c @@ -421,9 +421,14 @@ urj_flashmem (urj_bus_t *bus, FILE *f, uint32_t addr, int noverify) // @@@@ RFHH check error state? bn = fread (b, 1, btr, f); + /* start consecutive read */ + URJ_BUS_READ_START (bus, adr); + for (bc = 0; bc < bn; bc += flash_driver->bus_width) { int j; + uint32_t next_adr = adr + flash_driver->bus_width; + if ((adr & 0xFF) == 0) { urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX"), @@ -438,17 +443,25 @@ urj_flashmem (urj_bus_t *bus, FILE *f, uint32_t addr, int noverify) else data |= b[bc + j] << (j * 8); - readed = URJ_BUS_READ (bus, adr); + readed = URJ_BUS_READ_NEXT (bus, next_adr); if (data != readed) { + /* end consecutive read */ + (void) URJ_BUS_READ_END (bus); + urj_error_set (URJ_ERROR_FLASH_PROGRAM, _("addr: 0x%08lX\n verify error:\nread: 0x%08lX\nexpected: 0x%08lX\n"), (long unsigned) adr, (long unsigned) readed, (long unsigned) data); return URJ_STATUS_FAIL; } - adr += flash_driver->bus_width; + adr = next_adr; } + + /* end consecutive read + this wastes one read access but saves us from determining the for-loop + finish condition twice within the loop */ + (void) URJ_BUS_READ_END (bus); } urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX\nDone.\n"), (long unsigned) adr - flash_driver->bus_width);