mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-13 09:24:55 +00:00
Parser does not need to know all programmer types now, new programmers
will update only the table in pgm_type.c.
* config_gram.y, lexer.l: removed programmer type keywords,
use now locate_programmer_type() function
* pgm_type.[ch]: added new files for table of programmer types
* main.c: allow list of programmer types by -c ?type
* avrdude.conf.in: changed all type keywords to quoted strings
* doc/avrdude.texi: changed description of type definition, list
of valid types is now included from generated file
* doc/Makefile.am: generate list of programmer types for doc
* all programmers [hc]: add xxx_desc string for description of programmer
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1051 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
139
pgm_type.c
Normal file
139
pgm_type.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright 2007 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* $Id: pgm.c 976 2011-08-23 21:03:36Z joerg_wunsch $ */
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "pgm_type.h"
|
||||
|
||||
#include "arduino.h"
|
||||
#include "avr.h"
|
||||
#include "avr910.h"
|
||||
#include "avrftdi.h"
|
||||
#include "buspirate.h"
|
||||
#include "butterfly.h"
|
||||
#include "jtagmkI.h"
|
||||
#include "jtagmkII.h"
|
||||
#include "par.h"
|
||||
#include "ppi.h"
|
||||
#include "serbb.h"
|
||||
#include "stk500.h"
|
||||
#include "stk500generic.h"
|
||||
#include "stk500v2.h"
|
||||
#include "usbasp.h"
|
||||
#include "usbtiny.h"
|
||||
#include "wiring.h"
|
||||
|
||||
|
||||
const PROGRAMMER_TYPE const programmers_types[] = {
|
||||
{"arduino", arduino_initpgm, arduino_desc},
|
||||
{"avr910", avr910_initpgm, avr910_desc},
|
||||
{"avrftdi", avrftdi_initpgm, avrftdi_desc},
|
||||
{"buspirate", buspirate_initpgm, buspirate_desc},
|
||||
{"butterfly", butterfly_initpgm, butterfly_desc},
|
||||
{"butterfly_mk", butterfly_mk_initpgm, butterfly_mk_desc},
|
||||
{"dragon_dw", jtagmkII_dragon_dw_initpgm, jtagmkII_dragon_dw_desc},
|
||||
{"dragon_hvsp", stk500v2_dragon_hvsp_initpgm, stk500v2_dragon_hvsp_desc},
|
||||
{"dragon_isp", stk500v2_dragon_isp_initpgm, stk500v2_dragon_isp_desc},
|
||||
{"dragon_jtag", jtagmkII_dragon_initpgm, jtagmkII_dragon_desc},
|
||||
{"dragon_pdi", jtagmkII_dragon_pdi_initpgm, jtagmkII_dragon_pdi_desc},
|
||||
{"dragon_pp", stk500v2_dragon_pp_initpgm, stk500v2_dragon_pp_desc},
|
||||
{"jtagmki", jtagmkI_initpgm, jtagmkI_desc},
|
||||
{"jtagmkii", jtagmkII_initpgm, jtagmkII_desc},
|
||||
{"jtagmkii_avr32", jtagmkII_avr32_initpgm, jtagmkII_avr32_desc},
|
||||
{"jtagmkii_dw", jtagmkII_dw_initpgm, jtagmkII_dw_desc},
|
||||
{"jtagmkii_isp", stk500v2_jtagmkII_initpgm, stk500v2_jtagmkII_desc},
|
||||
{"jtagmkii_pdi", jtagmkII_pdi_initpgm, jtagmkII_pdi_desc},
|
||||
{"par", par_initpgm, par_desc},
|
||||
{"serbb", serbb_initpgm, serbb_desc},
|
||||
{"stk500", stk500_initpgm, stk500_desc},
|
||||
{"stk500generic", stk500generic_initpgm, stk500generic_desc},
|
||||
{"stk500v2", stk500v2_initpgm, stk500v2_desc},
|
||||
{"stk500hvsp", stk500hvsp_initpgm, stk500hvsp_desc},
|
||||
{"stk500pp", stk500pp_initpgm, stk500pp_desc},
|
||||
{"stk600", stk600_initpgm, stk600_desc},
|
||||
{"stk600hvsp", stk600hvsp_initpgm, stk600hvsp_desc},
|
||||
{"stk600pp", stk600pp_initpgm, stk600pp_desc},
|
||||
{"usbasp", usbasp_initpgm, usbasp_desc},
|
||||
{"usbtiny", usbtiny_initpgm, usbtiny_desc},
|
||||
{"wiring", wiring_initpgm, wiring_desc},
|
||||
};
|
||||
|
||||
const PROGRAMMER_TYPE * locate_programmer_type(const char * id)
|
||||
{
|
||||
const PROGRAMMER_TYPE * p = NULL;
|
||||
int i;
|
||||
int found;
|
||||
|
||||
found = 0;
|
||||
|
||||
for (i = 0; i < sizeof(programmers_types)/sizeof(programmers_types[0]) && !found; i++) {
|
||||
p = &(programmers_types[i]);
|
||||
if (strcasecmp(id, p->id) == 0)
|
||||
found = 1;
|
||||
}
|
||||
|
||||
if (found)
|
||||
return p;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterate over the list of programmers given as "programmers", and
|
||||
* call the callback function cb for each entry found. cb is being
|
||||
* passed the following arguments:
|
||||
* . the name of the programmer (for -c)
|
||||
* . the descriptive text given in the config file
|
||||
* . the name of the config file this programmer has been defined in
|
||||
* . the line number of the config file this programmer has been defined at
|
||||
* . the "cookie" passed into walk_programmers() (opaque client data)
|
||||
*/
|
||||
/*
|
||||
void walk_programmer_types(LISTID programmer_types, walk_programmer_types_cb cb, void *cookie)
|
||||
{
|
||||
LNODEID ln1;
|
||||
PROGRAMMER * p;
|
||||
|
||||
for (ln1 = lfirst(programmers); ln1; ln1 = lnext(ln1)) {
|
||||
p = ldata(ln1);
|
||||
cb(p->id, p->desc, cookie);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void walk_programmer_types(walk_programmer_types_cb cb, void *cookie)
|
||||
{
|
||||
const PROGRAMMER_TYPE * p;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(programmers_types)/sizeof(programmers_types[0]); i++) {
|
||||
p = &(programmers_types[i]);
|
||||
cb(p->id, p->desc, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user