safemode.c: Obtain progname from avrdude.h rather than trying to roll our

own (duplicate) copy of it.

other files: Constify char pointers.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@725 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Joerg Wunsch 2007-01-30 13:41:54 +00:00
parent 2682d0a227
commit b8a306c048
18 changed files with 57 additions and 37 deletions

View File

@ -1,3 +1,24 @@
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
* safemode.c: Obtain progname from avrdude.h rather than trying to roll our
own (duplicate) copy of it.
* avr910.c: Constify char pointers.
* avrpart.c: (Ditto.)
* avrpart.h: (Ditto.)
* butterfly.c: (Ditto.)
* config.c: (Ditto.)
* config.h: (Ditto.)
* jtagmkI.c: (Ditto.)
* jtagmkII.c: (Ditto.)
* par.c: (Ditto.)
* pgm.c: (Ditto.)
* pgm.h: (Ditto.)
* serbb_posix.c: (Ditto.)
* serbb_win32.c: (Ditto.)
* stk500.c: (Ditto.)
* stk500v2.c: (Ditto.)
* usbasp.c: (Ditto.)
2007-01-29 Joerg Wunsch <j@uriah.heep.sax.de>
* avrpart.c: More backend/library abstraction and generalization:

View File

@ -288,7 +288,7 @@ static void avr910_close(PROGRAMMER * pgm)
}
static void avr910_display(PROGRAMMER * pgm, char * p)
static void avr910_display(PROGRAMMER * pgm, const char * p)
{
return;
}

View File

@ -285,7 +285,7 @@ AVRMEM * avr_locate_mem(AVRPART * p, char * desc)
}
void avr_mem_display(char * prefix, FILE * f, AVRMEM * m, int type,
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type,
int verbose)
{
int i, j;
@ -479,11 +479,11 @@ static char * pin_name(int pinno)
}
void avr_display(FILE * f, AVRPART * p, char * prefix, int verbose)
void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose)
{
int i;
char * buf;
char * px;
const char * px;
LNODEID ln;
AVRMEM * m;

View File

@ -196,7 +196,7 @@ AVRMEM * avr_new_memtype(void);
int avr_initmem(AVRPART * p);
AVRMEM * avr_dup_mem(AVRMEM * m);
AVRMEM * avr_locate_mem(AVRPART * p, char * desc);
void avr_mem_display(char * prefix, FILE * f, AVRMEM * m, int type,
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type,
int verbose);
/* Functions for AVRPART structures */
@ -204,7 +204,7 @@ AVRPART * avr_new_part(void);
AVRPART * avr_dup_part(AVRPART * d);
AVRPART * locate_part(LISTID parts, char * partdesc);
AVRPART * locate_part_by_avr910_devcode(LISTID parts, int devcode);
void avr_display(FILE * f, AVRPART * p, char * prefix, int verbose);
void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose);
typedef void (*walk_avrparts_cb)(const char *name, const char *desc,
const char *cfgname, int cfglineno,

View File

@ -391,7 +391,7 @@ static void butterfly_close(PROGRAMMER * pgm)
}
static void butterfly_display(PROGRAMMER * pgm, char * p)
static void butterfly_display(PROGRAMMER * pgm, const char * p)
{
no_show_func_info();

View File

@ -48,7 +48,7 @@ LISTID part_list;
LISTID programmers;
int lineno;
char * infile;
const char * infile;
extern char * yytext;
@ -270,7 +270,7 @@ void pyytext(void)
}
char * dup_string(char * str)
char * dup_string(const char * str)
{
char * s;
@ -283,7 +283,7 @@ char * dup_string(char * str)
return s;
}
int read_config(char * file)
int read_config(const char * file)
{
FILE * f;

View File

@ -49,7 +49,7 @@ extern PROGRAMMER * current_prog;
extern AVRPART * current_part;
extern AVRMEM * current_mem;
extern int lineno;
extern char * infile;
extern const char * infile;
extern LISTID string_list;
extern LISTID number_list;
extern LISTID part_list;
@ -97,9 +97,9 @@ void print_token(TOKEN * tkn);
void pyytext(void);
char * dup_string(char * str);
char * dup_string(const char * str);
int read_config(char * file);
int read_config(const char * file);
#ifdef __cplusplus
}

View File

@ -100,7 +100,7 @@ static int jtagmkI_getparm(PROGRAMMER * pgm, unsigned char parm,
unsigned char * value);
static int jtagmkI_setparm(PROGRAMMER * pgm, unsigned char parm,
unsigned char value);
static void jtagmkI_print_parms1(PROGRAMMER * pgm, char * p);
static void jtagmkI_print_parms1(PROGRAMMER * pgm, const char * p);
static int jtagmkI_resync(PROGRAMMER *pgm, int maxtries, int signon);
@ -1280,7 +1280,7 @@ static int jtagmkI_setparm(PROGRAMMER * pgm, unsigned char parm,
}
static void jtagmkI_display(PROGRAMMER * pgm, char * p)
static void jtagmkI_display(PROGRAMMER * pgm, const char * p)
{
unsigned char hw, fw;
@ -1298,7 +1298,7 @@ static void jtagmkI_display(PROGRAMMER * pgm, char * p)
}
static void jtagmkI_print_parms1(PROGRAMMER * pgm, char * p)
static void jtagmkI_print_parms1(PROGRAMMER * pgm, const char * p)
{
unsigned char vtarget, jtag_clock;
const char *clkstr;

View File

@ -2070,7 +2070,7 @@ static int jtagmkII_setparm(PROGRAMMER * pgm, unsigned char parm,
}
static void jtagmkII_display(PROGRAMMER * pgm, char * p)
static void jtagmkII_display(PROGRAMMER * pgm, const char * p)
{
unsigned char hw[4], fw[4];

2
par.c
View File

@ -321,7 +321,7 @@ static void par_close(PROGRAMMER * pgm)
pgm->fd.ifd = -1;
}
static void par_display(PROGRAMMER * pgm, char * p)
static void par_display(PROGRAMMER * pgm, const char * p)
{
char vccpins[64];
char buffpins[64];

10
pgm.c
View File

@ -34,7 +34,7 @@ static int pgm_default_3 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem,
static void pgm_default_4 (struct programmer_t *);
static int pgm_default_5 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem,
unsigned long addr, unsigned char data);
static void pgm_default_6 (struct programmer_t *, char *);
static void pgm_default_6 (struct programmer_t *, const char *);
static int pgm_default_open (struct programmer_t *pgm, char * name)
@ -161,13 +161,13 @@ static int pgm_default_5 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem,
return -1;
}
static void pgm_default_6 (struct programmer_t * pgm, char * p)
static void pgm_default_6 (struct programmer_t * pgm, const char * p)
{
pgm_default();
}
void programmer_display(PROGRAMMER * pgm, char * p)
void programmer_display(PROGRAMMER * pgm, const char * p)
{
fprintf(stderr, "%sProgrammer Type : %s\n", p, pgm->type);
fprintf(stderr, "%sDescription : %s\n", p, pgm->desc);
@ -175,11 +175,11 @@ void programmer_display(PROGRAMMER * pgm, char * p)
pgm->display(pgm, p);
}
PROGRAMMER * locate_programmer(LISTID programmers, char * configid)
PROGRAMMER * locate_programmer(LISTID programmers, const char * configid)
{
LNODEID ln1, ln2;
PROGRAMMER * p = NULL;
char * id;
const char * id;
int found;
found = 0;

6
pgm.h
View File

@ -68,7 +68,7 @@ typedef struct programmer_t {
int (*pgm_led) (struct programmer_t * pgm, int value);
int (*vfy_led) (struct programmer_t * pgm, int value);
int (*initialize) (struct programmer_t * pgm, AVRPART * p);
void (*display) (struct programmer_t * pgm, char * p);
void (*display) (struct programmer_t * pgm, const char * p);
void (*enable) (struct programmer_t * pgm);
void (*disable) (struct programmer_t * pgm);
void (*powerup) (struct programmer_t * pgm);
@ -110,8 +110,8 @@ extern "C" {
PROGRAMMER * pgm_new(void);
void programmer_display(PROGRAMMER * pgm, char * p);
PROGRAMMER * locate_programmer(LISTID programmers, char * configid);
void programmer_display(PROGRAMMER * pgm, const char * p);
PROGRAMMER * locate_programmer(LISTID programmers, const char * configid);
typedef void (*walk_programmers_cb)(const char *name, const char *desc,
const char *cfgname, int cfglineno,

View File

@ -23,13 +23,12 @@
#include <stdio.h>
#include "ac_cfg.h"
#include "avrdude.h"
#include "avr.h"
#include "pgm.h"
#include "safemode.h"
/* This value from ac_cfg.h */
char * progname = PACKAGE_NAME;
/*
* Writes the specified fuse in fusename (can be "lfuse", "hfuse", or
* "efuse") and verifies it. Will try up to tries amount of times

View File

@ -190,7 +190,7 @@ static int serbb_highpulsepin(PROGRAMMER * pgm, int pin)
static void serbb_display(PROGRAMMER *pgm, char *p)
static void serbb_display(PROGRAMMER *pgm, const char *p)
{
/* MAYBE */
}

View File

@ -237,7 +237,7 @@ static int serbb_highpulsepin(PROGRAMMER * pgm, int pin)
}
static void serbb_display(PROGRAMMER *pgm, char *p)
static void serbb_display(PROGRAMMER *pgm, const char *p)
{
/* MAYBE */
}

View File

@ -46,7 +46,7 @@
static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value);
static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value);
static void stk500_print_parms1(PROGRAMMER * pgm, char * p);
static void stk500_print_parms1(PROGRAMMER * pgm, const char * p);
static int stk500_is_page_empty(unsigned int address, int page_size,
const unsigned char *buf);
@ -1137,7 +1137,7 @@ static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value)
}
static void stk500_display(PROGRAMMER * pgm, char * p)
static void stk500_display(PROGRAMMER * pgm, const char * p)
{
unsigned maj, min, hdw, topcard;
@ -1168,7 +1168,7 @@ static void stk500_display(PROGRAMMER * pgm, char * p)
}
static void stk500_print_parms1(PROGRAMMER * pgm, char * p)
static void stk500_print_parms1(PROGRAMMER * pgm, const char * p)
{
unsigned vtarget, vadjust, osc_pscale, osc_cmatch, sck_duration;

View File

@ -182,7 +182,7 @@ static struct jtagispentry jtagispcmds[] = {
static int stk500v2_getparm(PROGRAMMER * pgm, unsigned char parm, unsigned char * value);
static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char value);
static void stk500v2_print_parms1(PROGRAMMER * pgm, char * p);
static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p);
static int stk500v2_is_page_empty(unsigned int address, int page_size,
const unsigned char *buf);
@ -2032,7 +2032,7 @@ static int stk500v2_setparm(PROGRAMMER * pgm, unsigned char parm, unsigned char
return stk500v2_setparm_real(pgm, parm, value);
}
static void stk500v2_display(PROGRAMMER * pgm, char * p)
static void stk500v2_display(PROGRAMMER * pgm, const char * p)
{
unsigned char maj, min, hdw, topcard;
const char *topcard_name, *pgmname;
@ -2072,7 +2072,7 @@ static void stk500v2_display(PROGRAMMER * pgm, char * p)
}
static void stk500v2_print_parms1(PROGRAMMER * pgm, char * p)
static void stk500v2_print_parms1(PROGRAMMER * pgm, const char * p)
{
unsigned char vtarget, vadjust, osc_pscale, osc_cmatch, sck_duration;
unsigned char vtarget_jtag[4];

View File

@ -223,7 +223,7 @@ static void usbasp_enable(PROGRAMMER * pgm)
return;
}
static void usbasp_display(PROGRAMMER * pgm, char * p)
static void usbasp_display(PROGRAMMER * pgm, const char * p)
{
return;
}