* pgm.c, main.c, avr910.c, butterfly.c, stk500.c: Changed default for powerup, powerdown and LED-commands to do nothing and return OK. Then removed these commands from avr910, butterfly and stk500.

* pgm.c: Fixed wrong type for default_open introduced by the cleanup yesterday.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@409 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Jan-Hinnerk Reichert 2004-01-29 13:23:59 +00:00
parent 4cc71c65bf
commit 4f6c8867b5
5 changed files with 58 additions and 207 deletions

View File

@ -1,3 +1,13 @@
2004-01-28 Jan-Hinnerk Reichert <hinni@despammed.com>
* pgm.c, main.c, avr910.c, butterfly.c, stk500.c:
Changed default for powerup, powerdown and LED-commands
to do nothing and return OK. Then removed these commands
from avr910, butterfly and stk500.
* pgm.c: Fixed wrong type for default_open introduced by
the cleanup yesterday.
2004-01-29 Jan-Hinnerk Reichert <hinni@despammed.com>
* par.c: changed order of port-read/writes in par_txrx().

View File

@ -73,38 +73,6 @@ static void avr910_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg)
}
static int avr910_rdy_led(PROGRAMMER * pgm, int value)
{
/* Do nothing. */
return 0;
}
static int avr910_err_led(PROGRAMMER * pgm, int value)
{
/* Do nothing. */
return 0;
}
static int avr910_pgm_led(PROGRAMMER * pgm, int value)
{
/* Do nothing. */
return 0;
}
static int avr910_vfy_led(PROGRAMMER * pgm, int value)
{
/* Do nothing. */
return 0;
}
/*
* issue the 'chip erase' command to the AVR device
*/
@ -140,28 +108,6 @@ static int avr910_program_enable(PROGRAMMER * pgm, AVRPART * p)
}
/*
* apply power to the AVR processor
*/
static void avr910_powerup(PROGRAMMER * pgm)
{
/* Do nothing. */
return;
}
/*
* remove power from the AVR processor
*/
static void avr910_powerdown(PROGRAMMER * pgm)
{
/* Do nothing. */
return;
}
/*
* initialize the AVR device and prepare it to accept commands
*/
@ -622,16 +568,10 @@ void avr910_initpgm(PROGRAMMER * pgm)
/*
* mandatory functions
*/
pgm->rdy_led = avr910_rdy_led;
pgm->err_led = avr910_err_led;
pgm->pgm_led = avr910_pgm_led;
pgm->vfy_led = avr910_vfy_led;
pgm->initialize = avr910_initialize;
pgm->display = avr910_display;
pgm->enable = avr910_enable;
pgm->disable = avr910_disable;
pgm->powerup = avr910_powerup;
pgm->powerdown = avr910_powerdown;
pgm->program_enable = avr910_program_enable;
pgm->chip_erase = avr910_chip_erase;
pgm->cmd = avr910_cmd;

View File

@ -93,46 +93,6 @@ static void butterfly_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg)
}
static int butterfly_rdy_led(PROGRAMMER * pgm, int value)
{
no_show_func_info();
/* Do nothing. */
return 0;
}
static int butterfly_err_led(PROGRAMMER * pgm, int value)
{
no_show_func_info();
/* Do nothing. */
return 0;
}
static int butterfly_pgm_led(PROGRAMMER * pgm, int value)
{
no_show_func_info();
/* Do nothing. */
return 0;
}
static int butterfly_vfy_led(PROGRAMMER * pgm, int value)
{
no_show_func_info();
/* Do nothing. */
return 0;
}
/*
* issue the 'chip erase' command to the butterfly board
*/
@ -172,31 +132,6 @@ static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p)
}
/*
* apply power to the AVR processor
*/
static void butterfly_powerup(PROGRAMMER * pgm)
{
no_show_func_info();
/* Do nothing. */
return;
}
/*
* remove power from the AVR processor
*/
static void butterfly_powerdown(PROGRAMMER * pgm)
{
no_show_func_info();
/* Do nothing. */
return;
}
/*
* initialize the AVR device and prepare it to accept commands
@ -591,16 +526,10 @@ void butterfly_initpgm(PROGRAMMER * pgm)
/*
* mandatory functions
*/
pgm->rdy_led = butterfly_rdy_led;
pgm->err_led = butterfly_err_led;
pgm->pgm_led = butterfly_pgm_led;
pgm->vfy_led = butterfly_vfy_led;
pgm->initialize = butterfly_initialize;
pgm->display = butterfly_display;
pgm->enable = butterfly_enable;
pgm->disable = butterfly_disable;
pgm->powerup = butterfly_powerup;
pgm->powerdown = butterfly_powerdown;
pgm->program_enable = butterfly_program_enable;
pgm->chip_erase = butterfly_chip_erase;
/* pgm->cmd not supported, use default error message */

76
pgm.c
View File

@ -29,13 +29,35 @@
extern char * progname;
int pgm_default_1 (struct programmer_t *, int);
int pgm_default_2 (struct programmer_t *, AVRPART *);
int pgm_default_3 (struct programmer_t *);
void pgm_default_4 (struct programmer_t *);
int pgm_default_5 (struct programmer_t *, unsigned char cmd[4],
static int pgm_default_2 (struct programmer_t *, AVRPART *);
static void pgm_default_4 (struct programmer_t *);
static int pgm_default_5 (struct programmer_t *, unsigned char cmd[4],
unsigned char res[4]);
void pgm_default_6 (struct programmer_t *, char *);
static void pgm_default_6 (struct programmer_t *, char *);
static int pgm_default_open (struct programmer_t *pgm, char * name)
{
fprintf (stderr, "\n%s: Fatal error: Programmer does not support open()",
progname);
exit(1);
}
static int pgm_default_led (struct programmer_t * pgm, int value)
{
/*
* If programmer has no LEDs, just do nothing.
*/
return 0;
}
static void pgm_default_powerup_powerdown (struct programmer_t * pgm)
{
/*
* If programmer does not support powerup/down, just do nothing.
*/
}
PROGRAMMER * pgm_new(void)
@ -66,22 +88,28 @@ PROGRAMMER * pgm_new(void)
* mandatory functions - these are called without checking to see
* whether they are assigned or not
*/
pgm->rdy_led = pgm_default_1;
pgm->err_led = pgm_default_1;
pgm->pgm_led = pgm_default_1;
pgm->vfy_led = pgm_default_1;
pgm->initialize = pgm_default_2;
pgm->display = pgm_default_6;
pgm->enable = pgm_default_4;
pgm->disable = pgm_default_4;
pgm->powerup = pgm_default_4;
pgm->powerdown = pgm_default_4;
pgm->powerup = pgm_default_powerup_powerdown;
pgm->powerdown = pgm_default_powerup_powerdown;
pgm->program_enable = pgm_default_2;
pgm->chip_erase = pgm_default_2;
pgm->cmd = pgm_default_5;
pgm->open = pgm_default_3;
pgm->open = pgm_default_open;
pgm->close = pgm_default_4;
/*
* predefined functions - these functions have a valid default
* implementation. Hence, they don't need to be defined in
* the programmer.
*/
pgm->rdy_led = pgm_default_led;
pgm->err_led = pgm_default_led;
pgm->pgm_led = pgm_default_led;
pgm->vfy_led = pgm_default_led;
/*
* optional functions - these are checked to make sure they are
* assigned before they are called
@ -100,43 +128,31 @@ PROGRAMMER * pgm_new(void)
}
void pgm_default(void)
static void pgm_default(void)
{
fprintf(stderr, "%s: programmer operation not supported\n", progname);
}
int pgm_default_1 (struct programmer_t * pgm, int value)
static int pgm_default_2 (struct programmer_t * pgm, AVRPART * p)
{
pgm_default();
return -1;
}
int pgm_default_2 (struct programmer_t * pgm, AVRPART * p)
{
pgm_default();
return -1;
}
int pgm_default_3 (struct programmer_t * pgm)
{
pgm_default();
return -1;
}
void pgm_default_4 (struct programmer_t * pgm)
static void pgm_default_4 (struct programmer_t * pgm)
{
pgm_default();
}
int pgm_default_5 (struct programmer_t * pgm, unsigned char cmd[4],
static int pgm_default_5 (struct programmer_t * pgm, unsigned char cmd[4],
unsigned char res[4])
{
pgm_default();
return -1;
}
void pgm_default_6 (struct programmer_t * pgm, char * p)
static void pgm_default_6 (struct programmer_t * pgm, char * p)
{
pgm_default();
}

View File

@ -103,32 +103,11 @@ static int stk500_getsync(PROGRAMMER * pgm)
}
static int stk500_rdy_led(PROGRAMMER * pgm, int value)
{
return 0;
}
static int stk500_err_led(PROGRAMMER * pgm, int value)
{
return 0;
}
static int stk500_pgm_led(PROGRAMMER * pgm, int value)
{
return 0;
}
static int stk500_vfy_led(PROGRAMMER * pgm, int value)
{
return 0;
}
/*
* transmit an AVR device command and return the results; 'cmd' and
* 'res' must point to at least a 4 byte data buffer
*/
static int stk500_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
static int stk500_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
unsigned char res[4])
{
unsigned char buf[32];
@ -252,25 +231,8 @@ static int stk500_program_enable(PROGRAMMER * pgm, AVRPART * p)
}
/*
* apply power to the AVR processor
*/
static void stk500_powerup(PROGRAMMER * pgm)
{
return;
}
/*
* remove power from the AVR processor
*/
static void stk500_powerdown(PROGRAMMER * pgm)
{
return;
}
static int stk500_set_extended_parms(PROGRAMMER * pgm, int n,
static int stk500_set_extended_parms(PROGRAMMER * pgm, int n,
unsigned char * cmd)
{
unsigned char buf[16];
@ -1171,16 +1133,10 @@ void stk500_initpgm(PROGRAMMER * pgm)
/*
* mandatory functions
*/
pgm->rdy_led = stk500_rdy_led;
pgm->err_led = stk500_err_led;
pgm->pgm_led = stk500_pgm_led;
pgm->vfy_led = stk500_vfy_led;
pgm->initialize = stk500_initialize;
pgm->display = stk500_display;
pgm->enable = stk500_enable;
pgm->disable = stk500_disable;
pgm->powerup = stk500_powerup;
pgm->powerdown = stk500_powerdown;
pgm->program_enable = stk500_program_enable;
pgm->chip_erase = stk500_chip_erase;
pgm->cmd = stk500_cmd;