verify speed-up: use URJ_BUS_READ_START, _NEXT,

and _END instead of monolithic URJ_BUS_READ


git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1618 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 16 years ago
parent 6e813203d3
commit 64b645b989

@ -1,5 +1,8 @@
2009-05-22 Arnim Laeuger <arniml>
* 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

@ -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);

Loading…
Cancel
Save