diff --git a/src/avrdude.1 b/src/avrdude.1 index f5ed848d..28de8edb 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -1988,6 +1988,17 @@ the CS line being managed outside the application. .It Ar help Show help menu and exit. .El +.It Ar serprog +.Bl -tag -offset indent -width indent +.It Ar cs +Sets the chip select (CS) to use on supported programmers. +Programmers supporting the 0x16 serprog command can have more than the default CS (0). +This option allows to choose this additional CS's (1,2,3,...) for programming the AVR. +Here you can find the addition to the serprog spec enabling that: +https://review.coreboot.org/c/flashrom/+/80498 +.It Ar help +Show help menu and exit. +.El .El .Sh FILES .Bl -tag -offset indent -width /dev/ppi0XXX diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 968962f3..314b7ab7 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -1485,8 +1485,8 @@ programmer # serialupdi # The Serprog programmer implementation allows programming # with programmers using the serprog protocol from flashrom. -# See https://flashrom.org/classic_cli_manpage.html#serprog-programmer -# and https://wiki.flashrom.org/Serprog +# See https://flashrom.org/supported_hw/supported_prog/serprog/overview.html +# and https://flashrom.org/supported_hw/supported_prog/serprog/serprog-protocol.html # for details. programmer # serprog diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index 68486c9c..83213daa 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -1645,6 +1645,21 @@ the CS line being managed outside the application. Show help menu and exit. @end table +@cindex Option @code{-x} serprog +@item serprog + +The serprog programmer type accepts the following extended parameter: +@table @code +@item @samp{cs} +Sets the chip select (CS) to use on supported programmers. +Programmers supporting the 0x16 serprog command can have more than the default CS (0). +This option allows to choose this additional CS's (1,2,3,...) for programming the AVR. +Here you can find the addition to the serprog spec enabling that: +https://review.coreboot.org/c/flashrom/+/80498 +@item @samp{help} +Show help menu and exit. +@end table + @end table @page diff --git a/src/serprog.c b/src/serprog.c index 8a17f1ee..66ec8762 100644 --- a/src/serprog.c +++ b/src/serprog.c @@ -1,6 +1,8 @@ /* * avrdude - A Downloader/Uploader for AVR device programmers - * Support for using serprog programmers to program over ISP + * Support for using serprog programmers to program over ISP. + * For information on serprog see: + * https://flashrom.org/supported_hw/supported_prog/serprog/index.html * * Copyright (C) 2024 Sydney Louisa Wilke * used linuxspi.c as a template: @@ -136,12 +138,8 @@ static int perform_serprog_cmd_full(const PROGRAMMER *pgm, uint8_t cmd, if (serial_recv(&pgm->fd, &resp_status_code, 1) < 0 || serial_recv(&pgm->fd, recv_buf, recv_len) < 0) return -1; - if (resp_status_code == S_ACK) - return 0; - else if (resp_status_code == S_NAK) - return 1; - else - return -1; + + return resp_status_code == S_ACK? 0: resp_status_code == S_NAK? 1: -1; } static int perform_serprog_cmd(const PROGRAMMER *pgm, uint8_t cmd, @@ -466,7 +464,11 @@ static int serprog_parseextparams(const PROGRAMMER *pgm, const LISTID extparms) if (str_eq(extended_param, "help")) { msg_error("%s -c %s extended options:\n", progname, pgmid); - msg_error(" -xcs=cs_num Set the chip select to use\n"); + msg_error(" -xcs=cs_num Sets the chip select (CS) to use on supported programmers.\n"); + msg_error(" Programmers supporting the 0x16 serprog command can have more than the default CS (0).\n"); + msg_error(" This option allows to choose this additional CS's (1,2,3,...) for programming the AVR.\n"); + msg_error(" Here you can find the addition to the serprog spec enabling that:\n"); + msg_error(" https://review.coreboot.org/c/flashrom/+/80498\n"); msg_error(" -xhelp Show this help menu and exit\n"); return LIBAVRDUDE_EXIT; } diff --git a/src/serprog.h b/src/serprog.h index 092dd95b..5de51452 100644 --- a/src/serprog.h +++ b/src/serprog.h @@ -1,6 +1,8 @@ /* * avrdude - A Downloader/Uploader for AVR device programmers - * Copyright (C) 2013 Kevin Cuzner + * Copyright (C) 2024 Sydney Louisa Wilke + * used linuxspi.h as a template: + * Copyright (C) 2013 Kevin Cuzner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by