Add a connection_type attribute to each programmer, rather than

trying to hard-code the default port name in main.c.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1047 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2012-01-30 17:08:48 +00:00
parent d02083b738
commit a68791b705
8 changed files with 130 additions and 17 deletions

View File

@ -1,3 +1,18 @@
2012-01-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Add a connection_type attribute to each programmer, rather than
trying to hard-code the default port name in main.c.
* pgm.h: Add conntype to struct pgm.
* lexer.l: Extend grammar for connection_type.
* config_gram.y: (Dito.)
* config.h: Add DEFAULT_USB, for symmetry with default_parallel
and default_serial.
* main.c: Replace old default portname hack by avrdude.conf-based
knowledge.
* usbtiny.c: Drop an old hack that's no longer necessary.
* avrdude.conf.in: Add connection_type to each programmer
definition.
2012-01-27 Rene Liebscher <R.Liebscher@gmx.de> 2012-01-27 Rene Liebscher <R.Liebscher@gmx.de>
* avrdude.conf.in: used parent parts for some other parts, added * avrdude.conf.in: used parent parts for some other parts, added

View File

@ -23,6 +23,7 @@
# jtagmkII_avr32 | jtagmkii_pdi | # jtagmkII_avr32 | jtagmkii_pdi |
# dragon_dw | dragon_jtag | dragon_isp | dragon_pp | # dragon_dw | dragon_jtag | dragon_isp | dragon_pp |
# dragon_hvsp | dragon_pdi | arduino | wiring; # programmer type # dragon_hvsp | dragon_pdi | arduino | wiring; # programmer type
# connection_type = parallel | serial | usb
# baudrate = <num> ; # baudrate for avr910-programmer # baudrate = <num> ; # baudrate for avr910-programmer
# vcc = <num1> [, <num2> ... ] ; # pin number(s) # vcc = <num1> [, <num2> ... ] ; # pin number(s)
# buff = <num1> [, <num2> ... ] ; # pin number(s) # buff = <num1> [, <num2> ... ] ; # pin number(s)
@ -344,12 +345,14 @@ programmer
id = "wiring"; id = "wiring";
desc = "Wiring"; desc = "Wiring";
type = wiring; type = wiring;
connection_type = serial;
; ;
programmer programmer
id = "arduino"; id = "arduino";
desc = "Arduino"; desc = "Arduino";
type = arduino; type = arduino;
connection_type = serial;
; ;
# this will interface with the chips on these programmers: # this will interface with the chips on these programmers:
# #
@ -370,6 +373,7 @@ programmer
id = "avrftdi"; id = "avrftdi";
desc = "FT2232D based generic programmer"; desc = "FT2232D based generic programmer";
type = avrftdi; type = avrftdi;
connection_type = usb;
usbvid = 0x0403; usbvid = 0x0403;
usbpid = 0x6010; usbpid = 0x6010;
usbvendor = ""; usbvendor = "";
@ -397,6 +401,7 @@ programmer
id = "2232HIO"; id = "2232HIO";
desc = "FT2232H based generic programmer"; desc = "FT2232H based generic programmer";
type = avrftdi; type = avrftdi;
connection_type = usb;
usbvid = 0x0403; usbvid = 0x0403;
# Note: This PID is reserved for generic H devices and # Note: This PID is reserved for generic H devices and
# should be programmed into the EEPROM # should be programmed into the EEPROM
@ -423,6 +428,7 @@ programmer
id = "jtagkey"; id = "jtagkey";
desc = "Amontec JTAGKey, JTAGKey-Tiny and JTAGKey2"; desc = "Amontec JTAGKey, JTAGKey-Tiny and JTAGKey2";
type = avrftdi; type = avrftdi;
connection_type = usb;
usbvid = 0x0403; usbvid = 0x0403;
# Note: This PID is used in all JTAGKey variants # Note: This PID is used in all JTAGKey variants
usbpid = 0xCFF8; usbpid = 0xCFF8;
@ -468,18 +474,21 @@ programmer
id = "avrisp"; id = "avrisp";
desc = "Atmel AVR ISP"; desc = "Atmel AVR ISP";
type = stk500; type = stk500;
connection_type = serial;
; ;
programmer programmer
id = "avrispv2"; id = "avrispv2";
desc = "Atmel AVR ISP V2"; desc = "Atmel AVR ISP V2";
type = stk500v2; type = stk500v2;
connection_type = serial;
; ;
programmer programmer
id = "avrispmkII"; id = "avrispmkII";
desc = "Atmel AVR ISP mkII"; desc = "Atmel AVR ISP mkII";
type = stk500v2; type = stk500v2;
connection_type = usb;
; ;
programmer parent "avrispmkII" programmer parent "avrispmkII"
@ -490,6 +499,7 @@ programmer
id = "buspirate"; id = "buspirate";
desc = "The Bus Pirate"; desc = "The Bus Pirate";
type = buspirate; type = buspirate;
connection_type = serial;
; ;
# This is supposed to be the "default" STK500 entry. # This is supposed to be the "default" STK500 entry.
@ -500,66 +510,77 @@ programmer
id = "stk500"; id = "stk500";
desc = "Atmel STK500"; desc = "Atmel STK500";
type = stk500generic; type = stk500generic;
connection_type = serial;
; ;
programmer programmer
id = "stk500v1"; id = "stk500v1";
desc = "Atmel STK500 Version 1.x firmware"; desc = "Atmel STK500 Version 1.x firmware";
type = stk500; type = stk500;
connection_type = serial;
; ;
programmer programmer
id = "mib510"; id = "mib510";
desc = "Crossbow MIB510 programming board"; desc = "Crossbow MIB510 programming board";
type = stk500; type = stk500;
connection_type = serial;
; ;
programmer programmer
id = "stk500v2"; id = "stk500v2";
desc = "Atmel STK500 Version 2.x firmware"; desc = "Atmel STK500 Version 2.x firmware";
type = stk500v2; type = stk500v2;
connection_type = serial;
; ;
programmer programmer
id = "stk500pp"; id = "stk500pp";
desc = "Atmel STK500 V2 in parallel programming mode"; desc = "Atmel STK500 V2 in parallel programming mode";
type = stk500pp; type = stk500pp;
connection_type = serial;
; ;
programmer programmer
id = "stk500hvsp"; id = "stk500hvsp";
desc = "Atmel STK500 V2 in high-voltage serial programming mode"; desc = "Atmel STK500 V2 in high-voltage serial programming mode";
type = stk500hvsp; type = stk500hvsp;
connection_type = serial;
; ;
programmer programmer
id = "stk600"; id = "stk600";
desc = "Atmel STK600"; desc = "Atmel STK600";
type = stk600; type = stk600;
connection_type = usb;
; ;
programmer programmer
id = "stk600pp"; id = "stk600pp";
desc = "Atmel STK600 in parallel programming mode"; desc = "Atmel STK600 in parallel programming mode";
type = stk600pp; type = stk600pp;
connection_type = usb;
; ;
programmer programmer
id = "stk600hvsp"; id = "stk600hvsp";
desc = "Atmel STK600 in high-voltage serial programming mode"; desc = "Atmel STK600 in high-voltage serial programming mode";
type = stk600hvsp; type = stk600hvsp;
connection_type = usb;
; ;
programmer programmer
id = "avr910"; id = "avr910";
desc = "Atmel Low Cost Serial Programmer"; desc = "Atmel Low Cost Serial Programmer";
type = avr910; type = avr910;
connection_type = serial;
; ;
programmer programmer
id = "usbasp"; id = "usbasp";
desc = "USBasp, http://www.fischl.de/usbasp/"; desc = "USBasp, http://www.fischl.de/usbasp/";
type = usbasp; type = usbasp;
connection_type = usb;
usbvid = 0x16C0; # VOTI usbvid = 0x16C0; # VOTI
usbpid = 0x05DC; # Obdev's free shared PID usbpid = 0x05DC; # Obdev's free shared PID
usbvendor = "www.fischl.de"; usbvendor = "www.fischl.de";
@ -584,6 +605,7 @@ programmer
id = "nibobee"; id = "nibobee";
desc = "NIBObee"; desc = "NIBObee";
type = usbasp; type = usbasp;
connection_type = usb;
usbvid = 0x16C0; # VOTI usbvid = 0x16C0; # VOTI
usbpid = 0x092F; # NIBObee PID usbpid = 0x092F; # NIBObee PID
usbvendor = "www.nicai-systems.com"; usbvendor = "www.nicai-systems.com";
@ -594,6 +616,7 @@ programmer
id = "usbasp-clone"; id = "usbasp-clone";
desc = "Any usbasp clone with correct VID/PID"; desc = "Any usbasp clone with correct VID/PID";
type = usbasp; type = usbasp;
connection_type = usb;
usbvid = 0x16C0; # VOTI usbvid = 0x16C0; # VOTI
usbpid = 0x05DC; # Obdev's free shared PID usbpid = 0x05DC; # Obdev's free shared PID
#usbvendor = ""; #usbvendor = "";
@ -604,24 +627,28 @@ programmer
id = "usbtiny"; id = "usbtiny";
desc = "USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/"; desc = "USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/";
type = usbtiny; type = usbtiny;
connection_type = usb;
; ;
programmer programmer
id = "butterfly"; id = "butterfly";
desc = "Atmel Butterfly Development Board"; desc = "Atmel Butterfly Development Board";
type = butterfly; type = butterfly;
connection_type = serial;
; ;
programmer programmer
id = "avr109"; id = "avr109";
desc = "Atmel AppNote AVR109 Boot Loader"; desc = "Atmel AppNote AVR109 Boot Loader";
type = butterfly; type = butterfly;
connection_type = serial;
; ;
programmer programmer
id = "avr911"; id = "avr911";
desc = "Atmel AppNote AVR911 AVROSP"; desc = "Atmel AppNote AVR911 AVROSP";
type = butterfly; type = butterfly;
connection_type = serial;
; ;
# suggested in http://forum.mikrokopter.de/topic-post48317.html # suggested in http://forum.mikrokopter.de/topic-post48317.html
@ -629,6 +656,7 @@ programmer
id = "mkbutterfly"; id = "mkbutterfly";
desc = "Mikrokopter.de Butterfly"; desc = "Mikrokopter.de Butterfly";
type = butterfly_mk; type = butterfly_mk;
connection_type = serial;
; ;
programmer parent "mkbutterfly" programmer parent "mkbutterfly"
@ -640,6 +668,7 @@ programmer
desc = "Atmel JTAG ICE (mkI)"; desc = "Atmel JTAG ICE (mkI)";
baudrate = 115200; # default is 115200 baudrate = 115200; # default is 115200
type = jtagmki; type = jtagmki;
connection_type = serial;
; ;
# easier to type # easier to type
@ -653,11 +682,17 @@ programmer parent "jtag1"
baudrate = 19200; baudrate = 19200;
; ;
# The JTAG ICE mkII has both, serial and USB connectivity. As it is
# mostly used through USB these days (AVR Studio 5 only supporting it
# that way), we make connection_type = usb the default. Users are
# still free to use a serial port with the -P option.
programmer programmer
id = "jtagmkII"; id = "jtagmkII";
desc = "Atmel JTAG ICE mkII"; desc = "Atmel JTAG ICE mkII";
baudrate = 19200; # default is 19200 baudrate = 19200; # default is 19200
type = jtagmkii; type = jtagmkii;
connection_type = usb;
; ;
# easier to type # easier to type
@ -682,6 +717,7 @@ programmer
desc = "Atmel JTAG ICE mkII in ISP mode"; desc = "Atmel JTAG ICE mkII in ISP mode";
baudrate = 115200; baudrate = 115200;
type = jtagmkii_isp; type = jtagmkii_isp;
connection_type = usb;
; ;
# JTAG ICE mkII in debugWire mode # JTAG ICE mkII in debugWire mode
@ -690,6 +726,7 @@ programmer
desc = "Atmel JTAG ICE mkII in debugWire mode"; desc = "Atmel JTAG ICE mkII in debugWire mode";
baudrate = 115200; baudrate = 115200;
type = jtagmkii_dw; type = jtagmkii_dw;
connection_type = usb;
; ;
# JTAG ICE mkII in AVR32 mode # JTAG ICE mkII in AVR32 mode
@ -698,6 +735,7 @@ programmer
desc = "Atmel JTAG ICE mkII im AVR32 mode"; desc = "Atmel JTAG ICE mkII im AVR32 mode";
baudrate = 115200; baudrate = 115200;
type = jtagmkii_avr32; type = jtagmkii_avr32;
connection_type = usb;
; ;
# JTAG ICE mkII in AVR32 mode # JTAG ICE mkII in AVR32 mode
@ -706,6 +744,7 @@ programmer
desc = "Atmel JTAG ICE mkII im AVR32 mode"; desc = "Atmel JTAG ICE mkII im AVR32 mode";
baudrate = 115200; baudrate = 115200;
type = jtagmkii_avr32; type = jtagmkii_avr32;
connection_type = usb;
; ;
# JTAG ICE mkII in PDI mode # JTAG ICE mkII in PDI mode
@ -714,6 +753,7 @@ programmer
desc = "Atmel JTAG ICE mkII PDI mode"; desc = "Atmel JTAG ICE mkII PDI mode";
baudrate = 115200; baudrate = 115200;
type = jtagmkii_pdi; type = jtagmkii_pdi;
connection_type = usb;
; ;
# AVR Dragon in JTAG mode # AVR Dragon in JTAG mode
@ -722,6 +762,7 @@ programmer
desc = "Atmel AVR Dragon in JTAG mode"; desc = "Atmel AVR Dragon in JTAG mode";
baudrate = 115200; baudrate = 115200;
type = dragon_jtag; type = dragon_jtag;
connection_type = usb;
; ;
# AVR Dragon in ISP mode # AVR Dragon in ISP mode
@ -730,6 +771,7 @@ programmer
desc = "Atmel AVR Dragon in ISP mode"; desc = "Atmel AVR Dragon in ISP mode";
baudrate = 115200; baudrate = 115200;
type = dragon_isp; type = dragon_isp;
connection_type = usb;
; ;
# AVR Dragon in PP mode # AVR Dragon in PP mode
@ -738,6 +780,7 @@ programmer
desc = "Atmel AVR Dragon in PP mode"; desc = "Atmel AVR Dragon in PP mode";
baudrate = 115200; baudrate = 115200;
type = dragon_pp; type = dragon_pp;
connection_type = usb;
; ;
# AVR Dragon in HVSP mode # AVR Dragon in HVSP mode
@ -746,6 +789,7 @@ programmer
desc = "Atmel AVR Dragon in HVSP mode"; desc = "Atmel AVR Dragon in HVSP mode";
baudrate = 115200; baudrate = 115200;
type = dragon_hvsp; type = dragon_hvsp;
connection_type = usb;
; ;
# AVR Dragon in debugWire mode # AVR Dragon in debugWire mode
@ -754,6 +798,7 @@ programmer
desc = "Atmel AVR Dragon in debugWire mode"; desc = "Atmel AVR Dragon in debugWire mode";
baudrate = 115200; baudrate = 115200;
type = dragon_dw; type = dragon_dw;
connection_type = usb;
; ;
# AVR Dragon in PDI mode # AVR Dragon in PDI mode
@ -762,12 +807,14 @@ programmer
desc = "Atmel AVR Dragon in PDI mode"; desc = "Atmel AVR Dragon in PDI mode";
baudrate = 115200; baudrate = 115200;
type = dragon_pdi; type = dragon_pdi;
connection_type = usb;
; ;
programmer programmer
id = "pavr"; id = "pavr";
desc = "Jason Kyle's pAVR Serial Programmer"; desc = "Jason Kyle's pAVR Serial Programmer";
type = avr910; type = avr910;
connection_type = serial;
; ;
@HAVE_PARPORT_BEGIN@ Inclusion of the following depends on --enable-parport @HAVE_PARPORT_BEGIN@ Inclusion of the following depends on --enable-parport
@ -777,6 +824,7 @@ programmer
id = "bsd"; id = "bsd";
desc = "Brian Dean's Programmer, http://www.bsdhome.com/avrdude/"; desc = "Brian Dean's Programmer, http://www.bsdhome.com/avrdude/";
type = par; type = par;
connection_type = parallel;
vcc = 2, 3, 4, 5; vcc = 2, 3, 4, 5;
reset = 7; reset = 7;
sck = 8; sck = 8;
@ -788,6 +836,7 @@ programmer
id = "stk200"; id = "stk200";
desc = "STK200"; desc = "STK200";
type = par; type = par;
connection_type = parallel;
buff = 4, 5; buff = 4, 5;
sck = 6; sck = 6;
mosi = 7; mosi = 7;
@ -810,6 +859,7 @@ programmer
id = "dt006"; id = "dt006";
desc = "Dontronics DT006"; desc = "Dontronics DT006";
type = par; type = par;
connection_type = parallel;
reset = 4; reset = 4;
sck = 5; sck = 5;
mosi = 2; mosi = 2;
@ -825,6 +875,7 @@ programmer
id = "alf"; id = "alf";
desc = "Nightshade ALF-PgmAVR, http://nightshade.homeip.net/"; desc = "Nightshade ALF-PgmAVR, http://nightshade.homeip.net/";
type = par; type = par;
connection_type = parallel;
vcc = 2, 3, 4, 5; vcc = 2, 3, 4, 5;
buff = 6; buff = 6;
reset = 7; reset = 7;
@ -841,6 +892,7 @@ programmer
id = "sp12"; id = "sp12";
desc = "Steve Bolt's Programmer"; desc = "Steve Bolt's Programmer";
type = par; type = par;
connection_type = parallel;
vcc = 4,5,6,7,8; vcc = 4,5,6,7,8;
reset = 3; reset = 3;
sck = 2; sck = 2;
@ -852,6 +904,7 @@ programmer
id = "picoweb"; id = "picoweb";
desc = "Picoweb Programming Cable, http://www.picoweb.net/"; desc = "Picoweb Programming Cable, http://www.picoweb.net/";
type = par; type = par;
connection_type = parallel;
reset = 2; reset = 2;
sck = 3; sck = 3;
mosi = 4; mosi = 4;
@ -862,6 +915,7 @@ programmer
id = "abcmini"; id = "abcmini";
desc = "ABCmini Board, aka Dick Smith HOTCHIP"; desc = "ABCmini Board, aka Dick Smith HOTCHIP";
type = par; type = par;
connection_type = parallel;
reset = 4; reset = 4;
sck = 3; sck = 3;
mosi = 2; mosi = 2;
@ -872,6 +926,7 @@ programmer
id = "futurlec"; id = "futurlec";
desc = "Futurlec.com programming cable."; desc = "Futurlec.com programming cable.";
type = par; type = par;
connection_type = parallel;
reset = 3; reset = 3;
sck = 2; sck = 2;
mosi = 1; mosi = 1;
@ -890,6 +945,7 @@ programmer
id = "xil"; id = "xil";
desc = "Xilinx JTAG cable"; desc = "Xilinx JTAG cable";
type = par; type = par;
connection_type = parallel;
mosi = 2; mosi = 2;
sck = 3; sck = 3;
reset = 4; reset = 4;
@ -903,6 +959,7 @@ programmer
id = "dapa"; id = "dapa";
desc = "Direct AVR Parallel Access cable"; desc = "Direct AVR Parallel Access cable";
type = par; type = par;
connection_type = parallel;
vcc = 3; vcc = 3;
reset = 16; reset = 16;
sck = 1; sck = 1;
@ -914,6 +971,7 @@ programmer
id = "atisp"; id = "atisp";
desc = "AT-ISP V1.1 programming cable for AVR-SDK1 from <http://micro-research.co.th/> micro-research.co.th"; desc = "AT-ISP V1.1 programming cable for AVR-SDK1 from <http://micro-research.co.th/> micro-research.co.th";
type = par; type = par;
connection_type = parallel;
reset = ~6; reset = ~6;
sck = ~8; sck = ~8;
mosi = ~7; mosi = ~7;
@ -924,6 +982,7 @@ programmer
id = "ere-isp-avr"; id = "ere-isp-avr";
desc = "ERE ISP-AVR <http://www.ere.co.th/download/sch050713.pdf>"; desc = "ERE ISP-AVR <http://www.ere.co.th/download/sch050713.pdf>";
type = par; type = par;
connection_type = parallel;
reset = ~4; reset = ~4;
sck = 3; sck = 3;
mosi = 2; mosi = 2;
@ -934,6 +993,7 @@ programmer
id = "blaster"; id = "blaster";
desc = "Altera ByteBlaster"; desc = "Altera ByteBlaster";
type = par; type = par;
connection_type = parallel;
sck = 2; sck = 2;
miso = 11; miso = 11;
reset = 3; reset = 3;
@ -953,13 +1013,14 @@ programmer parent "pony-stk200"
# The AT98ISP Cable is a simple parallel dongle for AT89 family. # The AT98ISP Cable is a simple parallel dongle for AT89 family.
# http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2877 # http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2877
programmer programmer
id = "89isp"; id = "89isp";
desc = "Atmel at89isp cable"; desc = "Atmel at89isp cable";
type = par; type = par;
reset = 17; connection_type = parallel;
sck = 1; reset = 17;
mosi = 2; sck = 1;
miso = 10; mosi = 2;
miso = 10;
; ;
@HAVE_PARPORT_END@ @HAVE_PARPORT_END@
@ -990,6 +1051,7 @@ programmer
id = "ponyser"; id = "ponyser";
desc = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts"; desc = "design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts";
type = serbb; type = serbb;
connection_type = serial;
reset = ~3; reset = ~3;
sck = 7; sck = 7;
mosi = 4; mosi = 4;
@ -1011,6 +1073,7 @@ programmer
id = "dasa"; id = "dasa";
desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts"; desc = "serial port banging, reset=rts sck=dtr mosi=txd miso=cts";
type = serbb; type = serbb;
connection_type = serial;
reset = 7; reset = 7;
sck = 4; sck = 4;
mosi = 3; mosi = 3;
@ -1024,6 +1087,7 @@ programmer
id = "dasa3"; id = "dasa3";
desc = "serial port banging, reset=!dtr sck=rts mosi=txd miso=cts"; desc = "serial port banging, reset=!dtr sck=rts mosi=txd miso=cts";
type = serbb; type = serbb;
connection_type = serial;
reset = ~4; reset = ~4;
sck = 7; sck = 7;
mosi = 3; mosi = 3;
@ -1037,6 +1101,7 @@ programmer
id = "c2n232i"; id = "c2n232i";
desc = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts"; desc = "serial port banging, reset=dtr sck=!rts mosi=!txd miso=!cts";
type = serbb; type = serbb;
connection_type = serial;
reset = 4; reset = 4;
sck = ~7; sck = ~7;
mosi = ~3; mosi = ~3;

View File

@ -59,6 +59,9 @@ extern char default_parallel[];
extern char default_serial[]; extern char default_serial[];
extern double default_bitclock; extern double default_bitclock;
/* This name is fixed, it's only here for symmetry with
* default_parallel and default_serial. */
#define DEFAULT_USB "usb"
#if !defined(HAS_YYSTYPE) #if !defined(HAS_YYSTYPE)

View File

@ -91,6 +91,7 @@ static int pin_name;
%token K_BUFF %token K_BUFF
%token K_BUSPIRATE %token K_BUSPIRATE
%token K_CHIP_ERASE_DELAY %token K_CHIP_ERASE_DELAY
%token K_CONNTYPE
%token K_DEDICATED %token K_DEDICATED
%token K_DEFAULT_PARALLEL %token K_DEFAULT_PARALLEL
%token K_DEFAULT_PROGRAMMER %token K_DEFAULT_PROGRAMMER
@ -154,6 +155,7 @@ static int pin_name;
%token K_STK600HVSP %token K_STK600HVSP
%token K_STK600PP %token K_STK600PP
%token K_AVR910 %token K_AVR910
%token K_USB
%token K_USBASP %token K_USBASP
%token K_USBDEV %token K_USBDEV
%token K_USBSN %token K_USBSN
@ -466,6 +468,8 @@ prog_parm :
| |
prog_parm_usb prog_parm_usb
| |
prog_parm_conntype
|
K_DESC TKN_EQUAL TKN_STRING { K_DESC TKN_EQUAL TKN_STRING {
strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN); strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN);
current_prog->desc[PGM_DESCLEN-1] = 0; current_prog->desc[PGM_DESCLEN-1] = 0;
@ -517,6 +521,16 @@ prog_parm_type_id:
K_DRAGON_PP { current_prog->initpgm = stk500v2_dragon_pp_initpgm; } K_DRAGON_PP { current_prog->initpgm = stk500v2_dragon_pp_initpgm; }
; ;
prog_parm_conntype:
K_CONNTYPE TKN_EQUAL prog_parm_conntype_id
;
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; }
;
prog_parm_usb: prog_parm_usb:
K_USBDEV TKN_EQUAL TKN_STRING { K_USBDEV TKN_EQUAL TKN_STRING {
{ {

View File

@ -132,6 +132,7 @@ buspirate { yylval=NULL; return K_BUSPIRATE; }
butterfly { yylval=NULL; return K_BUTTERFLY; } butterfly { yylval=NULL; return K_BUTTERFLY; }
butterfly_mk { yylval=NULL; return K_BUTTERFLY_MK; } butterfly_mk { yylval=NULL; return K_BUTTERFLY_MK; }
chip_erase_delay { yylval=NULL; return K_CHIP_ERASE_DELAY; } chip_erase_delay { yylval=NULL; return K_CHIP_ERASE_DELAY; }
connection_type { yylval=NULL; return K_CONNTYPE; }
desc { yylval=NULL; return K_DESC; } desc { yylval=NULL; return K_DESC; }
default_parallel { yylval=NULL; return K_DEFAULT_PARALLEL; } default_parallel { yylval=NULL; return K_DEFAULT_PARALLEL; }
default_programmer { yylval=NULL; return K_DEFAULT_PROGRAMMER; } default_programmer { yylval=NULL; return K_DEFAULT_PROGRAMMER; }
@ -202,6 +203,7 @@ stk600 { yylval=NULL; return K_STK600; }
stk600hvsp { yylval=NULL; return K_STK600HVSP; } stk600hvsp { yylval=NULL; return K_STK600HVSP; }
stk600pp { yylval=NULL; return K_STK600PP; } stk600pp { yylval=NULL; return K_STK600PP; }
type { yylval=NULL; return K_TYPE; } type { yylval=NULL; return K_TYPE; }
usb { yylval=NULL; return K_USB; }
usbdev { yylval=NULL; return K_USBDEV; } usbdev { yylval=NULL; return K_USBDEV; }
usbpid { yylval=NULL; return K_USBPID; } usbpid { yylval=NULL; return K_USBPID; }
usbproduct { yylval=NULL; return K_USBPRODUCT; } usbproduct { yylval=NULL; return K_USBPRODUCT; }

25
main.c
View File

@ -375,7 +375,7 @@ int main(int argc, char * argv [])
} }
partdesc = NULL; partdesc = NULL;
port = default_parallel; port = NULL;
erase = 0; erase = 0;
calibrate = 0; calibrate = 0;
auto_erase = 1; auto_erase = 1;
@ -763,16 +763,23 @@ int main(int argc, char * argv [])
} }
} }
if ((strcmp(pgm->type, "STK500") == 0) || if (port == NULL) {
(strcmp(pgm->type, "avr910") == 0) || switch (pgm->conntype)
(strcmp(pgm->type, "BusPirate") == 0) || {
(strcmp(pgm->type, "STK500V2") == 0) || case CONNTYPE_PARALLEL:
(strcmp(pgm->type, "JTAGMKII") == 0)) { port = default_parallel;
if (port == default_parallel) { break;
port = default_serial;
case CONNTYPE_SERIAL:
port = default_serial;
break;
case CONNTYPE_USB:
port = DEFAULT_USB;
break;
} }
} }
if (partdesc == NULL) { if (partdesc == NULL) {
fprintf(stderr, fprintf(stderr,
"%s: No AVR part has been specified, use \"-p Part\"\n\n", "%s: No AVR part has been specified, use \"-p Part\"\n\n",

7
pgm.h
View File

@ -56,6 +56,12 @@ typedef enum {
EXIT_DATAHIGH_DISABLED EXIT_DATAHIGH_DISABLED
} exit_datahigh_t; } exit_datahigh_t;
typedef enum {
CONNTYPE_PARALLEL,
CONNTYPE_SERIAL,
CONNTYPE_USB
} conntype_t;
typedef struct programmer_t { typedef struct programmer_t {
LISTID id; LISTID id;
char desc[PGM_DESCLEN]; char desc[PGM_DESCLEN];
@ -66,6 +72,7 @@ typedef struct programmer_t {
exit_vcc_t exit_vcc; exit_vcc_t exit_vcc;
exit_reset_t exit_reset; exit_reset_t exit_reset;
exit_datahigh_t exit_datahigh; exit_datahigh_t exit_datahigh;
conntype_t conntype;
int ppidata; int ppidata;
int ppictrl; int ppictrl;
int baudrate; int baudrate;

View File

@ -207,7 +207,7 @@ static int usbtiny_open(PROGRAMMER* pgm, char* name)
char *dev_name = NULL; char *dev_name = NULL;
// if no -P was given or '-P usb' was given // if no -P was given or '-P usb' was given
if(name == default_parallel || strcmp(name, "usb") == 0) if(strcmp(name, "usb") == 0)
name = NULL; name = NULL;
else { else {
// calculate bus and device names from -P option // calculate bus and device names from -P option