* buspirate.c: Optimised buspirate_cmd() - reading 1kB EEPROM now

takes only 14 sec instead of almost 2 mins with the original
  implementation.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@844 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Michal Ludvig 2009-10-08 05:00:41 +00:00
parent 69622989b7
commit b7766d1400
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2009-10-08 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c: Optimised buspirate_cmd() - reading 1kB EEPROM now
takes only 14 sec instead of almost 2 mins with the original
implementation.
2009-10-08 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c, buspirate.h: Support for the BusPirate programmer

View File

@ -280,7 +280,7 @@ static int buspirate_cmd(struct programmer_t *pgm,
snprintf(buf, sizeof(buf), "0x%02x 0x%02x 0x%02x 0x%02x\n",
cmd[0], cmd[1], cmd[2], cmd[3]);
buspirate_send(pgm, buf);
while (1) {
while (i < 4) {
rcvd = buspirate_readline(pgm, NULL, 0);
/* WRITE: 0xAC READ: 0x04 */
if (sscanf(rcvd, "WRITE: 0x%x READ: 0x%x", &spi_write, &spi_read) == 2) {
@ -289,10 +289,16 @@ static int buspirate_cmd(struct programmer_t *pgm,
if (buspirate_is_prompt(rcvd))
break;
}
if (i != 4) {
fprintf(stderr, "%s: error: SPI has not read 4 bytes back\n", progname);
return -1;
}
/* wait for prompt */
while (buspirate_getc(pgm) != '>')
/* do nothing */;
return 0;
}