* avrdude.conf.in: Add avr910 and pavr programmers.

* config_gram.y: Add parsing of avr910 programmer.
* lexer.l: Add avr910 token.
* avr910.c: [this is still work in progress]
Add some debug output.
Add probe for programmer presense.
* main.c: Set port to default_serial if programmer type is avr910.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@292 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Theodore A. Roth 2003-03-16 18:19:37 +00:00
parent 5a74a905b4
commit a13d87de00
6 changed files with 134 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2003-03-16 Theodore A. Roth <troth@openavr.org>
* avrdude.conf.in: Add avr910 and pavr programmers.
* config_gram.y: Add parsing of avr910 programmer.
* lexer.l: Add avr910 token.
* avr910.c: [this is still work in progress]
Add some debug output.
Add probe for programmer presense.
* main.c: Set port to default_serial if programmer type is avr910.
2003-03-13 Theodore A. Roth <troth@openavr.org> 2003-03-13 Theodore A. Roth <troth@openavr.org>
* ser_posix.c, ser_win32.c, serial.h: * ser_posix.c, ser_win32.c, serial.h:

View File

@ -39,45 +39,73 @@
extern char * progname; extern char * progname;
extern int do_cycles; extern int do_cycles;
#define show_func_info() \
fprintf(stderr, "%s: %d: called %s()\n", __FILE__, __LINE__, __FUNCTION__)
static int avr910_send(PROGRAMMER * pgm, char * buf, size_t len) static int avr910_send(PROGRAMMER * pgm, char * buf, size_t len)
{ {
show_func_info();
return serial_send(pgm->fd, buf, len); return serial_send(pgm->fd, buf, len);
} }
static int avr910_recv(PROGRAMMER * pgm, char * buf, size_t len) static int avr910_recv(PROGRAMMER * pgm, char * buf, size_t len)
{ {
show_func_info();
return serial_recv(pgm->fd, buf, len); return serial_recv(pgm->fd, buf, len);
} }
static int avr910_drain(PROGRAMMER * pgm, int display) static int avr910_drain(PROGRAMMER * pgm, int display)
{ {
show_func_info();
/* Do nothing. */
return serial_drain(pgm->fd, display); return serial_drain(pgm->fd, display);
} }
static int avr910_rdy_led(PROGRAMMER * pgm, int value) static int avr910_rdy_led(PROGRAMMER * pgm, int value)
{ {
show_func_info();
/* Do nothing. */
return 0; return 0;
} }
static int avr910_err_led(PROGRAMMER * pgm, int value) static int avr910_err_led(PROGRAMMER * pgm, int value)
{ {
show_func_info();
/* Do nothing. */
return 0; return 0;
} }
static int avr910_pgm_led(PROGRAMMER * pgm, int value) static int avr910_pgm_led(PROGRAMMER * pgm, int value)
{ {
show_func_info();
/* Do nothing. */
return 0; return 0;
} }
static int avr910_vfy_led(PROGRAMMER * pgm, int value) static int avr910_vfy_led(PROGRAMMER * pgm, int value)
{ {
show_func_info();
/* Do nothing. */
return 0; return 0;
} }
@ -87,6 +115,8 @@ static int avr910_vfy_led(PROGRAMMER * pgm, int value)
*/ */
static int avr910_chip_erase(PROGRAMMER * pgm, AVRPART * p) static int avr910_chip_erase(PROGRAMMER * pgm, AVRPART * p)
{ {
show_func_info();
return 0; return 0;
} }
@ -95,6 +125,8 @@ static int avr910_chip_erase(PROGRAMMER * pgm, AVRPART * p)
*/ */
static int avr910_program_enable(PROGRAMMER * pgm, AVRPART * p) static int avr910_program_enable(PROGRAMMER * pgm, AVRPART * p)
{ {
show_func_info();
return -1; return -1;
} }
@ -104,6 +136,10 @@ static int avr910_program_enable(PROGRAMMER * pgm, AVRPART * p)
*/ */
static void avr910_powerup(PROGRAMMER * pgm) static void avr910_powerup(PROGRAMMER * pgm)
{ {
show_func_info();
/* Do nothing. */
return; return;
} }
@ -113,6 +149,10 @@ static void avr910_powerup(PROGRAMMER * pgm)
*/ */
static void avr910_powerdown(PROGRAMMER * pgm) static void avr910_powerdown(PROGRAMMER * pgm)
{ {
show_func_info();
/* Do nothing. */
return; return;
} }
@ -122,30 +162,79 @@ static void avr910_powerdown(PROGRAMMER * pgm)
*/ */
static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p) static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
{ {
char pn[8];
char sw[2];
char hw[2];
unsigned char c;
show_func_info();
/* Programmer returns exactly 7 chars _without_ the null.*/
avr910_send(pgm, "S", 1);
memset (pn, 0, sizeof(pn));
avr910_recv(pgm, pn, sizeof(pn)-1);
/* Get the HW and SW versions to see if the programmer is present. */
avr910_send(pgm, "V", 1);
avr910_recv(pgm, sw, sizeof(sw));
avr910_send(pgm, "v", 1);
avr910_recv(pgm, hw, sizeof(hw));
fprintf(stderr, "Found programmer: %s\n", pn);
fprintf(stderr, " Software Version = %c.%c; "
"Hardware Version = %c.%c\n", sw[0], sw[1], hw[0], hw[1]);
/* Get list of devices that the programmer supports. */
avr910_send(pgm, "t", 1);
while (1) {
avr910_recv(pgm, &c, 1);
if (c == 0)
break;
fprintf(stderr, "Device code: 0x%02x\n", c);
};
return 0; return 0;
} }
static int avr910_save(PROGRAMMER * pgm) static int avr910_save(PROGRAMMER * pgm)
{ {
show_func_info();
/* Do nothing. */
return 0; return 0;
} }
static void avr910_restore(PROGRAMMER * pgm) static void avr910_restore(PROGRAMMER * pgm)
{ {
show_func_info();
/* Do nothing. */
return; return;
} }
static void avr910_disable(PROGRAMMER * pgm) static void avr910_disable(PROGRAMMER * pgm)
{ {
show_func_info();
return; return;
} }
static void avr910_enable(PROGRAMMER * pgm) static void avr910_enable(PROGRAMMER * pgm)
{ {
show_func_info();
/* Do nothing. */
return; return;
} }
@ -157,12 +246,16 @@ static void avr910_enable(PROGRAMMER * pgm)
static int avr910_cmd(PROGRAMMER * pgm, unsigned char cmd[4], static int avr910_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
unsigned char res[4]) unsigned char res[4])
{ {
return 0; show_func_info();
return 0;
} }
static void avr910_open(PROGRAMMER * pgm, char * port) static void avr910_open(PROGRAMMER * pgm, char * port)
{ {
show_func_info();
strcpy(pgm->port, port); strcpy(pgm->port, port);
pgm->fd = serial_open(port, 19200); pgm->fd = serial_open(port, 19200);
@ -174,6 +267,8 @@ static void avr910_open(PROGRAMMER * pgm, char * port)
static void avr910_close(PROGRAMMER * pgm) static void avr910_close(PROGRAMMER * pgm)
{ {
show_func_info();
serial_close(pgm->fd); serial_close(pgm->fd);
pgm->fd = -1; pgm->fd = -1;
} }
@ -181,12 +276,16 @@ static void avr910_close(PROGRAMMER * pgm)
static void avr910_display(PROGRAMMER * pgm, char * p) static void avr910_display(PROGRAMMER * pgm, char * p)
{ {
show_func_info();
return; return;
} }
void avr910_initpgm(PROGRAMMER * pgm) void avr910_initpgm(PROGRAMMER * pgm)
{ {
show_func_info();
strcpy(pgm->type, "avr910"); strcpy(pgm->type, "avr910");
/* /*

View File

@ -15,7 +15,7 @@
# programmer # programmer
# id = <id1> [, <id2> [, <id3>] ...] ; # <idN> are quoted strings # id = <id1> [, <id2> [, <id3>] ...] ; # <idN> are quoted strings
# desc = <description> ; # quoted string # desc = <description> ; # quoted string
# type = par | stk500 ; # programmer type # type = par | stk500 | avr910; # programmer type
# vcc = <num1> [, <num2> ... ] ; # pin number(s) # vcc = <num1> [, <num2> ... ] ; # pin number(s)
# reset = <num> ; # pin number # reset = <num> ; # pin number
# sck = <num> ; # pin number # sck = <num> ; # pin number
@ -203,6 +203,18 @@ programmer
type = stk500; type = stk500;
; ;
programmer
id = "avr910";
desc = "Atmel Low Cost Serial Programmer";
type = avr910;
;
programmer
id = "pavr";
desc = "Jason Kyle's pAVR Serial Programmer";
type = avr910;
;
programmer programmer
id = "stk200"; id = "stk200";
desc = "STK200"; desc = "STK200";

View File

@ -33,6 +33,7 @@
#include "ppi.h" #include "ppi.h"
#include "pgm.h" #include "pgm.h"
#include "stk500.h" #include "stk500.h"
#include "avr910.h"
#include "avr.h" #include "avr.h"
extern char * progname; extern char * progname;
@ -101,6 +102,7 @@ static int parse_cmdbits(OPCODE * op);
%token K_SCK %token K_SCK
%token K_SIZE %token K_SIZE
%token K_STK500 %token K_STK500
%token K_AVR910
%token K_TYPE %token K_TYPE
%token K_VCC %token K_VCC
%token K_VFYLED %token K_VFYLED
@ -284,6 +286,12 @@ prog_parm :
} }
} | } |
K_TYPE TKN_EQUAL K_AVR910 {
{
avr910_initpgm(current_prog);
}
} |
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;

View File

@ -152,6 +152,7 @@ retry_pulse { yylval=NULL; return K_RETRY_PULSE; }
serial { yylval=NULL; return K_SERIAL; } serial { yylval=NULL; return K_SERIAL; }
size { yylval=NULL; return K_SIZE; } size { yylval=NULL; return K_SIZE; }
stk500 { yylval=NULL; return K_STK500; } stk500 { yylval=NULL; return K_STK500; }
avr910 { yylval=NULL; return K_AVR910; }
type { yylval=NULL; return K_TYPE; } type { yylval=NULL; return K_TYPE; }
vcc { yylval=NULL; return K_VCC; } vcc { yylval=NULL; return K_VCC; }
vfyled { yylval=NULL; return K_VFYLED; } vfyled { yylval=NULL; return K_VFYLED; }

View File

@ -610,7 +610,8 @@ int main(int argc, char * argv [])
exit(1); exit(1);
} }
if (strcmp(pgm->type, "STK500") == 0) { if ((strcmp(pgm->type, "STK500") == 0)
|| (strcmp(pgm->type, "avr910") == 0)){
if (port == default_parallel) { if (port == default_parallel) {
port = default_serial; port = default_serial;
} }