1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-23 23:19:20 +02:00

uart/avrdude: various corrections

nanonote-uart.patch:

- avrdude.conf.in: CLK is reserved for clock output

nanonote.patch:

- nanonote.c (pin_map, nanonote_setpin, nanonote_getpin): make pin map
  zero-based
- nanonote.c (nanonote_setpin): instead of having out own delay loop
  setting the pin repeatedly, just add the delay we need to
  pgm->ispdelay+100
- nanonote.c (nanonote_setpin): increase delay for atusb-pgm
- nanonote.c (nanonote_getpin, nanonote_open): begin with all pins set
  to output and switch MISO only when read
This commit is contained in:
Werner Almesberger 2011-02-04 17:51:27 -03:00
parent 1557630a8b
commit 9778f3fb1b
2 changed files with 27 additions and 34 deletions

View File

@ -1,7 +1,7 @@
Index: avrdude/avrdude-5.10/avrdude.conf.in
===================================================================
--- avrdude.orig/avrdude-5.10/avrdude.conf.in 2011-02-03 21:08:13.000000000 -0300
+++ avrdude/avrdude-5.10/avrdude.conf.in 2011-02-03 21:16:34.000000000 -0300
--- avrdude.orig/avrdude-5.10/avrdude.conf.in 2011-02-04 17:26:06.000000000 -0300
+++ avrdude/avrdude-5.10/avrdude.conf.in 2011-02-04 17:26:07.000000000 -0300
@@ -592,6 +592,29 @@
type = avr910;
;
@ -12,7 +12,7 @@ Index: avrdude/avrdude-5.10/avrdude.conf.in
+# DAT1 1
+# DAT0 2
+# VSS -
+# CLK 4
+# CLK - (reserved for clock output)
+# VDD -
+# CMD 5
+# DAT3 7

View File

@ -1,7 +1,7 @@
Index: avrdude/avrdude-5.10/Makefile.am
===================================================================
--- avrdude.orig/avrdude-5.10/Makefile.am 2011-02-01 20:25:15.000000000 -0300
+++ avrdude/avrdude-5.10/Makefile.am 2011-02-01 20:25:54.000000000 -0300
--- avrdude.orig/avrdude-5.10/Makefile.am 2011-02-04 17:40:39.000000000 -0300
+++ avrdude/avrdude-5.10/Makefile.am 2011-02-04 17:40:48.000000000 -0300
@@ -111,6 +111,8 @@
lists.c \
lists.h \
@ -13,8 +13,8 @@ Index: avrdude/avrdude-5.10/Makefile.am
pgm.c \
Index: avrdude/avrdude-5.10/config_gram.y
===================================================================
--- avrdude.orig/avrdude-5.10/config_gram.y 2011-02-01 18:50:48.000000000 -0300
+++ avrdude/avrdude-5.10/config_gram.y 2011-02-01 20:27:31.000000000 -0300
--- avrdude.orig/avrdude-5.10/config_gram.y 2011-02-04 17:40:39.000000000 -0300
+++ avrdude/avrdude-5.10/config_gram.y 2011-02-04 17:40:48.000000000 -0300
@@ -48,6 +48,7 @@
#include "avr.h"
#include "jtagmkI.h"
@ -46,8 +46,8 @@ Index: avrdude/avrdude-5.10/config_gram.y
current_prog->desc[PGM_DESCLEN-1] = 0;
Index: avrdude/avrdude-5.10/lexer.l
===================================================================
--- avrdude.orig/avrdude-5.10/lexer.l 2011-02-01 18:53:11.000000000 -0300
+++ avrdude/avrdude-5.10/lexer.l 2011-02-01 18:53:40.000000000 -0300
--- avrdude.orig/avrdude-5.10/lexer.l 2011-02-04 17:40:39.000000000 -0300
+++ avrdude/avrdude-5.10/lexer.l 2011-02-04 17:40:48.000000000 -0300
@@ -164,6 +164,7 @@
min_write_delay { yylval=NULL; return K_MIN_WRITE_DELAY; }
miso { yylval=NULL; return K_MISO; }
@ -59,8 +59,8 @@ Index: avrdude/avrdude-5.10/lexer.l
Index: avrdude/avrdude-5.10/nanonote.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ avrdude/avrdude-5.10/nanonote.c 2011-02-01 21:33:19.000000000 -0300
@@ -0,0 +1,302 @@
+++ avrdude/avrdude-5.10/nanonote.c 2011-02-04 17:48:11.000000000 -0300
@@ -0,0 +1,295 @@
+/*
+ * avrdude - A Downloader/Uploader for AVR device programmers
+ * Copyright (C) 2000, 2001, 2002, 2003 Brian S. Dean <bsd@bsdhome.com>
@ -128,6 +128,7 @@ Index: avrdude/avrdude-5.10/nanonote.c
+ unsigned port;
+ unsigned bit;
+} pin_map[] = {
+ { 0, 0}, /* 0: not assigned */
+ { 3, 11 }, /* 1: PD11, DAT1 */
+ { 3, 10 }, /* 2: PD12, DAT0 */
+ { 0, 0 }, /* 3: VSS */
@ -197,31 +198,22 @@ Index: avrdude/avrdude-5.10/nanonote.c
+ pin &= PIN_MASK;
+ }
+
+ if (pin < 1 || pin > sizeof(pin_map)/sizeof(*pin_map))
+ if (pin < 1 || pin >= sizeof(pin_map)/sizeof(*pin_map))
+ return -1;
+ if (!pin_map[pin-1].port)
+ if (!pin_map[pin].port)
+ return -1;
+
+#if 0
+fprintf(stderr, "pin %d (%u, %u) = %d\n",
+pin, pin_map[pin-1].port, pin_map[pin-1].bit, value);
+pin, pin_map[pin].port, pin_map[pin].bit, value);
+#endif
+ gpio_set(pin_map[pin-1].port, pin_map[pin-1].bit, value);
+ gpio_set(pin_map[pin].port, pin_map[pin].bit, value);
+
+ {
+ int i;
+
+ /*
+ * @@@ investigate later
+ * We get unstable results with values <= 15 but stable results
+ * with 16.
+ */
+ for (i = 0; i != 100; i++)
+ gpio_get(pin_map[pin-1].port, pin_map[pin-1].bit);
+ }
+
+ if (pgm->ispdelay > 1)
+ bitbang_delay(pgm->ispdelay);
+ /*
+ * We get unstable results with values <= 16 but stable results
+ * with 17 and above.
+ */
+ bitbang_delay(pgm->ispdelay+100);
+
+ return 0;
+}
@ -237,15 +229,16 @@ Index: avrdude/avrdude-5.10/nanonote.c
+ pin &= PIN_MASK;
+ }
+
+ if (pin < 1 || pin > sizeof(pin_map)/sizeof(*pin_map))
+ if (pin < 1 || pin >= sizeof(pin_map)/sizeof(*pin_map))
+ return -1;
+ if (!pin_map[pin].port)
+ return -1;
+
+ v = gpio_get(pin_map[pin-1].port, pin_map[pin-1].bit);
+ gpio_input(pin_map[pin].port, pin_map[pin].bit); /* @@@ hack */
+ v = gpio_get(pin_map[pin].port, pin_map[pin].bit);
+#if 0
+fprintf(stderr, "pin %d (%u, %u): %d\n",
+pin, pin_map[pin-1].port, pin_map[pin-1].bit, v);
+pin, pin_map[pin].port, pin_map[pin].bit, v);
+#endif
+ return pin & PIN_INVERSE ? !v : v;
+}
@ -323,7 +316,7 @@ Index: avrdude/avrdude-5.10/nanonote.c
+ gpio_output(CMD);
+ gpio_output(DAT3);
+ gpio_output(DAT2);
+ gpio_input(DAT1); /* @@@ hack */
+ gpio_output(DAT1);
+
+ nanonote_disable(pgm);
+
@ -366,7 +359,7 @@ Index: avrdude/avrdude-5.10/nanonote.c
Index: avrdude/avrdude-5.10/nanonote.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ avrdude/avrdude-5.10/nanonote.h 2011-02-01 20:27:11.000000000 -0300
+++ avrdude/avrdude-5.10/nanonote.h 2011-02-04 17:40:48.000000000 -0300
@@ -0,0 +1,6 @@
+#ifndef nanonote_h
+#define nanonote_h