aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-02-21 06:26:33 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-02-21 06:26:33 +0000
commite322f14620a1064efc4b3a98cf701efc48da81cc (patch)
treeb1d236f9627fcf0386279077dad2136d321d47fb /Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
parent12a01ed72d0d6dbf243160302314870e7b29cc07 (diff)
downloadlufa-e322f14620a1064efc4b3a98cf701efc48da81cc.tar.gz
lufa-e322f14620a1064efc4b3a98cf701efc48da81cc.tar.bz2
lufa-e322f14620a1064efc4b3a98cf701efc48da81cc.zip
More fixes to the AVRISP command timeout system so that it should no longer lock up while processing command no matter what the conditions.
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c')
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
index 45c1d225d..7bef25e6e 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
@@ -350,7 +350,6 @@ uint8_t XPROGTarget_ReceiveByte(void)
#if defined(XPROG_VIA_HARDWARE_USART)
/* Wait until a byte has been received before reading */
- uint8_t TimeoutMSRemaining = 100;
while (!(UCSR1A & (1 << RXC1)) && TimeoutMSRemaining)
{
/* Manage software timeout */
@@ -365,7 +364,6 @@ uint8_t XPROGTarget_ReceiveByte(void)
#else
/* Wait until a byte has been received before reading */
SoftUSART_BitCount = BITS_IN_USART_FRAME;
- uint8_t TimeoutMSRemaining = 100;
while (SoftUSART_BitCount && TimeoutMSRemaining)
{
/* Manage software timeout */
@@ -376,6 +374,9 @@ uint8_t XPROGTarget_ReceiveByte(void)
}
}
+ if (TimeoutMSRemaining)
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+
/* Throw away the parity and stop bits to leave only the data (start bit is already discarded) */
return (uint8_t)SoftUSART_Data;
#endif
@@ -468,7 +469,6 @@ static void XPROGTarget_SetRxMode(void)
}
/* Wait until DATA line has been pulled up to idle by the target */
- uint8_t TimeoutMSRemaining = 100;
while (!(BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK) && TimeoutMSRemaining)
{
/* Manage software timeout */
@@ -480,6 +480,9 @@ static void XPROGTarget_SetRxMode(void)
}
#endif
+ if (TimeoutMSRemaining)
+ TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
+
IsSending = false;
}