Skip to content

Commit 1214f99

Browse files
committed
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
1 parent eb7ccaf commit 1214f99

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2021-12-03 Joerg Wunsch <[email protected]>
2+
3+
Submitted by Alex Sverdlin:
4+
patch #10153: linuxspi: Support "-E reset" and "-E noreset"
5+
* linuxspi.c (linuxspi_parseexitspecs): New function
6+
17
2021-11-27 Joerg Wunsch <[email protected]>
28

39
bug #58440: linuxgpio PIN limit too low

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ Current:
135135
patch #9304: [Bug #48767] Implemented WinSock variation of "ser_drain(...)" functionality
136136
patch #8996: Remove lock byte read mask (bug#21954, bug#46759)
137137
patch #8923: Enable TPI for linuxgpio
138+
patch #10153: linuxspi: Support "-E reset" and "-E noreset"
138139

139140
* Internals:
140141
- New avrdude.conf keyword "family_id", used to verify SIB attributes

linuxspi.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,19 @@ static int linuxspi_open(PROGRAMMER *pgm, char *port)
245245

246246
static void linuxspi_close(PROGRAMMER *pgm)
247247
{
248+
switch (pgm->exit_reset) {
249+
case EXIT_RESET_ENABLED:
250+
linuxspi_reset_mcu(pgm, true);
251+
break;
252+
253+
case EXIT_RESET_DISABLED:
254+
linuxspi_reset_mcu(pgm, false);
255+
break;
256+
257+
default:
258+
break;
259+
}
260+
248261
close(fd_linehandle);
249262
close(fd_spidev);
250263
close(fd_gpiochip);
@@ -354,6 +367,26 @@ static int linuxspi_chip_erase(PROGRAMMER *pgm, AVRPART *p)
354367
return 0;
355368
}
356369

370+
static int linuxspi_parseexitspecs(PROGRAMMER *pgm, char *s)
371+
{
372+
char *cp;
373+
374+
while ((cp = strtok(s, ","))) {
375+
s = 0;
376+
if (!strcmp(cp, "reset")) {
377+
pgm->exit_reset = EXIT_RESET_ENABLED;
378+
continue;
379+
}
380+
if (!strcmp(cp, "noreset")) {
381+
pgm->exit_reset = EXIT_RESET_DISABLED;
382+
continue;
383+
}
384+
return -1;
385+
}
386+
387+
return 0;
388+
}
389+
357390
void linuxspi_initpgm(PROGRAMMER *pgm)
358391
{
359392
strcpy(pgm->type, LINUXSPI);
@@ -376,6 +409,7 @@ void linuxspi_initpgm(PROGRAMMER *pgm)
376409
/* optional functions */
377410
pgm->setup = linuxspi_setup;
378411
pgm->teardown = linuxspi_teardown;
412+
pgm->parseexitspecs = linuxspi_parseexitspecs;
379413
}
380414

381415
const char linuxspi_desc[] = "SPI using Linux spidev driver";

0 commit comments

Comments
 (0)