mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-15 02:01:07 +00:00
Submitted by Andrew O. Shadoura:
bug #25156: add direct SPI transfer mode * bitbang.c: Implement direct SPI transfers. * bitbang.h: (Ditto.) * par.c: (Ditto.) * pgm.c: (Ditto.) * pgm.h: (Ditto.) * term.c: Add the "spi" and "pgm" commands. * avrdude.1: Document the changes. * doc/avrdude.texi: (Ditto.) git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@797 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
33
bitbang.c
33
bitbang.c
@@ -225,6 +225,39 @@ int bitbang_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* transmit bytes via SPI and return the results; 'cmd' and
|
||||
* 'res' must point to data buffers
|
||||
*/
|
||||
int bitbang_spi(PROGRAMMER * pgm, unsigned char cmd[],
|
||||
unsigned char res[], int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_LED_PGM], 0);
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
res[i] = bitbang_txrx(pgm, cmd[i]);
|
||||
}
|
||||
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_LED_PGM], 1);
|
||||
|
||||
if(verbose >= 2)
|
||||
{
|
||||
fprintf(stderr, "bitbang_cmd(): [ ");
|
||||
for(i = 0; i < count; i++)
|
||||
fprintf(stderr, "%02X ", cmd[i]);
|
||||
fprintf(stderr, "] [ ");
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
fprintf(stderr, "%02X ", res[i]);
|
||||
}
|
||||
fprintf(stderr, "]\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* issue the 'chip erase' command to the AVR device
|
||||
|
||||
Reference in New Issue
Block a user