patch #10153: linuxspi: Support "-E reset" and "-E noreset"

Submitted by Alex Sverdlin:
* linuxspi.c (linuxspi_parseexitspecs): New function




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1506 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2021-12-03 22:30:05 +00:00
parent eb7ccaf92b
commit 1214f99c2b
3 changed files with 41 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2021-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Alex Sverdlin:
patch #10153: linuxspi: Support "-E reset" and "-E noreset"
* linuxspi.c (linuxspi_parseexitspecs): New function
2021-11-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #58440: linuxgpio PIN limit too low

1
NEWS
View File

@ -135,6 +135,7 @@ Current:
patch #9304: [Bug #48767] Implemented WinSock variation of "ser_drain(...)" functionality
patch #8996: Remove lock byte read mask (bug#21954, bug#46759)
patch #8923: Enable TPI for linuxgpio
patch #10153: linuxspi: Support "-E reset" and "-E noreset"
* Internals:
- New avrdude.conf keyword "family_id", used to verify SIB attributes

View File

@ -245,6 +245,19 @@ close_spidev:
static void linuxspi_close(PROGRAMMER *pgm)
{
switch (pgm->exit_reset) {
case EXIT_RESET_ENABLED:
linuxspi_reset_mcu(pgm, true);
break;
case EXIT_RESET_DISABLED:
linuxspi_reset_mcu(pgm, false);
break;
default:
break;
}
close(fd_linehandle);
close(fd_spidev);
close(fd_gpiochip);
@ -354,6 +367,26 @@ static int linuxspi_chip_erase(PROGRAMMER *pgm, AVRPART *p)
return 0;
}
static int linuxspi_parseexitspecs(PROGRAMMER *pgm, char *s)
{
char *cp;
while ((cp = strtok(s, ","))) {
s = 0;
if (!strcmp(cp, "reset")) {
pgm->exit_reset = EXIT_RESET_ENABLED;
continue;
}
if (!strcmp(cp, "noreset")) {
pgm->exit_reset = EXIT_RESET_DISABLED;
continue;
}
return -1;
}
return 0;
}
void linuxspi_initpgm(PROGRAMMER *pgm)
{
strcpy(pgm->type, LINUXSPI);
@ -376,6 +409,7 @@ void linuxspi_initpgm(PROGRAMMER *pgm)
/* optional functions */
pgm->setup = linuxspi_setup;
pgm->teardown = linuxspi_teardown;
pgm->parseexitspecs = linuxspi_parseexitspecs;
}
const char linuxspi_desc[] = "SPI using Linux spidev driver";