Fix linuxspi default port
If no port is specified, Avrdude will try to use the default port specified in avrdude.conf. If not present, use port specified in linuxspi.c
This commit is contained in:
parent
60960ba590
commit
6fceea8f71
|
@ -22,7 +22,7 @@
|
|||
# desc = <description> ; # quoted string
|
||||
# type = <type>; # programmer type, quoted string
|
||||
# # supported programmer types can be listed by "-c ?type"
|
||||
# connection_type = parallel | serial | usb
|
||||
# connection_type = parallel | serial | usb | spi
|
||||
# baudrate = <num> ; # baudrate for avr910-programmer
|
||||
# vcc = <num1> [, <num2> ... ] ; # pin number(s)
|
||||
# buff = <num1> [, <num2> ... ] ; # pin number(s)
|
||||
|
@ -337,6 +337,7 @@
|
|||
#
|
||||
default_parallel = "@DEFAULT_PAR_PORT@";
|
||||
default_serial = "@DEFAULT_SER_PORT@";
|
||||
default_spi = "@DEFAULT_SPI_PORT@";
|
||||
# default_bitclock = 2.5;
|
||||
|
||||
#
|
||||
|
@ -1609,6 +1610,7 @@ programmer
|
|||
id = "linuxspi";
|
||||
desc = "Use Linux SPI device in /dev/spidev*";
|
||||
type = "linuxspi";
|
||||
connection_type = spi;
|
||||
reset = 25; # Pi GPIO number - this is J8:22
|
||||
;
|
||||
@HAVE_LINUXSPI_END@
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
char default_programmer[MAX_STR_CONST];
|
||||
char default_parallel[PATH_MAX];
|
||||
char default_serial[PATH_MAX];
|
||||
char default_spi[PATH_MAX];
|
||||
double default_bitclock;
|
||||
|
||||
char string_buf[MAX_STR_CONST];
|
||||
|
|
|
@ -79,6 +79,7 @@ static int pin_name;
|
|||
%token K_DEFAULT_PARALLEL
|
||||
%token K_DEFAULT_PROGRAMMER
|
||||
%token K_DEFAULT_SERIAL
|
||||
%token K_DEFAULT_SPI
|
||||
%token K_DESC
|
||||
%token K_FAMILY_ID
|
||||
%token K_DEVICECODE
|
||||
|
@ -115,6 +116,7 @@ static int pin_name;
|
|||
%token K_RESET
|
||||
%token K_RETRY_PULSE
|
||||
%token K_SERIAL
|
||||
%token K_SPI
|
||||
%token K_SCK
|
||||
%token K_SIGNATURE
|
||||
%token K_SIZE
|
||||
|
@ -254,6 +256,12 @@ def :
|
|||
free_token($3);
|
||||
} |
|
||||
|
||||
K_DEFAULT_SPI TKN_EQUAL TKN_STRING TKN_SEMI {
|
||||
strncpy(default_spi, $3->value.string, PATH_MAX);
|
||||
default_spi[PATH_MAX-1] = 0;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_DEFAULT_BITCLOCK TKN_EQUAL number_real TKN_SEMI {
|
||||
default_bitclock = $3->value.number_real;
|
||||
free_token($3);
|
||||
|
@ -507,7 +515,8 @@ prog_parm_conntype:
|
|||
prog_parm_conntype_id:
|
||||
K_PARALLEL { current_prog->conntype = CONNTYPE_PARALLEL; } |
|
||||
K_SERIAL { current_prog->conntype = CONNTYPE_SERIAL; } |
|
||||
K_USB { current_prog->conntype = CONNTYPE_USB; }
|
||||
K_USB { current_prog->conntype = CONNTYPE_USB; } |
|
||||
K_SPI { current_prog->conntype = CONNTYPE_SPI; }
|
||||
;
|
||||
|
||||
prog_parm_usb:
|
||||
|
|
|
@ -139,6 +139,7 @@ default_bitclock { yylval=NULL; return K_DEFAULT_BITCLOCK; }
|
|||
default_parallel { yylval=NULL; return K_DEFAULT_PARALLEL; }
|
||||
default_programmer { yylval=NULL; return K_DEFAULT_PROGRAMMER; }
|
||||
default_serial { yylval=NULL; return K_DEFAULT_SERIAL; }
|
||||
default_spi { yylval=NULL; return K_DEFAULT_SPI; }
|
||||
delay { yylval=NULL; return K_DELAY; }
|
||||
desc { yylval=NULL; return K_DESC; }
|
||||
family_id { yylval=NULL; return K_FAMILY_ID; }
|
||||
|
@ -222,6 +223,7 @@ sck { yylval=new_token(K_SCK); return K_SCK; }
|
|||
serial { yylval=NULL; return K_SERIAL; }
|
||||
signature { yylval=NULL; return K_SIGNATURE; }
|
||||
size { yylval=NULL; return K_SIZE; }
|
||||
spi { yylval=NULL; return K_SPI; }
|
||||
spmcr { yylval=NULL; return K_SPMCR; }
|
||||
stabdelay { yylval=NULL; return K_STABDELAY; }
|
||||
stk500_devcode { yylval=NULL; return K_STK500_DEVCODE; }
|
||||
|
|
|
@ -635,7 +635,8 @@ typedef enum {
|
|||
typedef enum {
|
||||
CONNTYPE_PARALLEL,
|
||||
CONNTYPE_SERIAL,
|
||||
CONNTYPE_USB
|
||||
CONNTYPE_USB,
|
||||
CONNTYPE_SPI
|
||||
} conntype_t;
|
||||
|
||||
typedef struct programmer_t {
|
||||
|
@ -912,6 +913,7 @@ extern LISTID programmers;
|
|||
extern char default_programmer[];
|
||||
extern char default_parallel[];
|
||||
extern char default_serial[];
|
||||
extern char default_spi[];
|
||||
extern double default_bitclock;
|
||||
|
||||
/* This name is fixed, it's only here for symmetry with
|
||||
|
|
|
@ -382,6 +382,7 @@ int main(int argc, char * argv [])
|
|||
|
||||
default_parallel[0] = 0;
|
||||
default_serial[0] = 0;
|
||||
default_spi[0] = 0;
|
||||
default_bitclock = 0.0;
|
||||
|
||||
init_config();
|
||||
|
@ -921,6 +922,12 @@ int main(int argc, char * argv [])
|
|||
case CONNTYPE_USB:
|
||||
port = DEFAULT_USB;
|
||||
break;
|
||||
|
||||
#ifdef HAVE_LINUXSPI
|
||||
case CONNTYPE_SPI:
|
||||
port = *default_spi ? default_spi : "unknown";
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue