openwrt: avrdude does not like GPIO0 in its pin definitions, this patch spreads the GPIO0 love

This commit is contained in:
Bart Van Der Meerssche 2010-11-05 21:26:27 +01:00
parent 54e38ad77e
commit 66e2cebf10
1 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,95 @@
--- avrdude-5.10/config_gram.y.orig 2010-11-05 11:01:14.895247246 +0100
+++ avrdude-5.10/config_gram.y 2010-11-05 11:02:15.219259178 +0100
@@ -1212,10 +1212,10 @@
value = v->value.number;
- if ((value <= 0) || (value >= 18)) {
+ if ((value < 0) || (value >= 18)) {
fprintf(stderr,
"%s: error at line %d of %s: pin must be in the "
- "range 1-17\n",
+ "range 0-17\n",
progname, lineno, infile);
exit(1);
}
--- avrdude-5.10/gpio.c.orig 2010-11-05 20:46:03.363248072 +0100
+++ avrdude-5.10/gpio.c 2010-11-05 20:46:10.051256461 +0100
@@ -101,6 +101,26 @@
+static int gpio_rdy_led(PROGRAMMER * pgm, int value)
+{
+ /* nothing */
+}
+
+static int gpio_err_led(PROGRAMMER * pgm, int value)
+{
+ /* nothing */
+}
+
+static int gpio_pgm_led(PROGRAMMER * pgm, int value)
+{
+ /* nothing */
+}
+
+static int gpio_vfy_led(PROGRAMMER * pgm, int value)
+{
+ /* nothing */
+}
+
static void gpio_display(PROGRAMMER *pgm, const char *p)
{
/* nothing */
@@ -128,40 +148,34 @@
static int gpio_open(PROGRAMMER *pgm, char *port)
{
- int i;
-
- bitbang_check_prerequisites(pgm);
-
if ((gpio_fd = open("/dev/gpio", O_RDWR)) < 0) {
perror("cannot open /dev/gpio");
return -1;
}
- for (i = 0; i < N_PINS; i++) {
- if (i == PIN_AVR_MISO)
- _gpio_dir(pgm->pinno[i], AVRDUDE_GPIO_DIR_IN);
- else
- _gpio_dir(pgm->pinno[i], AVRDUDE_GPIO_DIR_OUT);
- }
+ _gpio_dir(pgm->pinno[PIN_AVR_RESET], AVRDUDE_GPIO_DIR_OUT);
+ _gpio_dir(pgm->pinno[PIN_AVR_SCK], AVRDUDE_GPIO_DIR_OUT);
+ _gpio_dir(pgm->pinno[PIN_AVR_MOSI], AVRDUDE_GPIO_DIR_OUT);
+ _gpio_dir(pgm->pinno[PIN_AVR_MISO], AVRDUDE_GPIO_DIR_IN);
- return(0);
+ return 0;
}
static void gpio_close(PROGRAMMER *pgm)
{
gpio_setpin(pgm, pgm->pinno[PIN_AVR_RESET], 1);
close(gpio_fd);
- return;
+ return 0;
}
void gpio_initpgm(PROGRAMMER *pgm)
{
strcpy(pgm->type, "GPIO");
- pgm->rdy_led = bitbang_rdy_led;
- pgm->err_led = bitbang_err_led;
- pgm->pgm_led = bitbang_pgm_led;
- pgm->vfy_led = bitbang_vfy_led;
+ pgm->rdy_led = gpio_rdy_led;
+ pgm->err_led = gpio_err_led;
+ pgm->pgm_led = gpio_pgm_led;
+ pgm->vfy_led = gpio_vfy_led;
pgm->initialize = bitbang_initialize;
pgm->display = gpio_display;
pgm->enable = gpio_enable;