From 3bea5f30eef75f47b71a7610d0e36d0444a44049 Mon Sep 17 00:00:00 2001
From: Joerg Wunsch <j@uriah.heep.sax.de>
Date: Thu, 10 Aug 2006 15:41:19 +0000
Subject: [PATCH] Reverse the argument order for CMD_CHIP_ERASE_HVSP; AVR068
 and stk500.exe differ here.

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@600 81a1dc3b-b13d-400b-aceb-764788c761c2
---
 stk500v2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/stk500v2.c b/stk500v2.c
index e57876a3..70157c70 100644
--- a/stk500v2.c
+++ b/stk500v2.c
@@ -459,8 +459,12 @@ static int stk500hv_chip_erase(PROGRAMMER * pgm, AVRPART * p, enum hvmode mode)
     buf[2] = p->chiperasepolltimeout;
   } else {
     buf[0] = CMD_CHIP_ERASE_HVSP;
-    buf[1] = p->chiperasepolltimeout;
-    buf[2] = p->chiperasetime;
+    /*
+     * AVR068 has them the other way around, but that's the sequence
+     * Atmel's stk500.exe is issuing.
+     */
+    buf[1] = p->chiperasetime;
+    buf[2] = p->chiperasepolltimeout;
   }
   result = stk500v2_command(pgm, buf, 3, sizeof(buf));
   usleep(p->chip_erase_delay);