aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP-MKII/Lib/ISP
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-07-13 11:26:03 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-07-13 11:26:03 +0000
commit666c0fa4c31b2c9f7f02f6d0e09551e24dc4680c (patch)
tree6fd57a5b9cd741895fbaf55f6c56708d521d7748 /Projects/AVRISP-MKII/Lib/ISP
parent03130342451003093e654edc5b031718d544e9ba (diff)
downloadlufa-666c0fa4c31b2c9f7f02f6d0e09551e24dc4680c.tar.gz
lufa-666c0fa4c31b2c9f7f02f6d0e09551e24dc4680c.tar.bz2
lufa-666c0fa4c31b2c9f7f02f6d0e09551e24dc4680c.zip
Remove the timeout period extension code from the AVRISP project, as no single command should ever exceed the maximum timeout period. Extend timeout period to 1 second per command, so that an accidental timeout will never occur.
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/ISP')
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c11
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c19
2 files changed, 7 insertions, 23 deletions
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
index 2ce11a8ee..d6e02fa2b 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
@@ -76,7 +76,7 @@ void ISPProtocol_EnterISPMode(void)
/* Continuously attempt to synchronize with the target until either the number of attempts specified
* by the host has exceeded, or the the device sends back the expected response values */
- while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus == STATUS_CMD_FAILED) && TimeoutMSRemaining)
+ while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus == STATUS_CMD_FAILED) && TimeoutTicksRemaining)
{
uint8_t ResponseBytes[4];
@@ -552,13 +552,8 @@ void ISPProtocol_SPIMulti(void)
*/
void ISPProtocol_DelayMS(uint8_t DelayMS)
{
- while (DelayMS-- && TimeoutMSRemaining)
- {
- if (TimeoutMSRemaining)
- TimeoutMSRemaining--;
-
- _delay_ms(1);
- }
+ while (DelayMS-- && TimeoutTicksRemaining)
+ _delay_ms(1);
}
#endif \ No newline at end of file
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
index 9a74aabb2..430c9158a 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
@@ -129,9 +129,9 @@ uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, const uint1
SPI_SendByte(PollAddress >> 8);
SPI_SendByte(PollAddress & 0xFF);
}
- while ((SPI_TransferByte(0x00) == PollValue) && TimeoutMSRemaining);
+ while ((SPI_TransferByte(0x00) == PollValue) && TimeoutTicksRemaining);
- if (!(TimeoutMSRemaining))
+ if (!(TimeoutTicksRemaining))
ProgrammingStatus = STATUS_CMD_TOUT;
break;
@@ -141,9 +141,6 @@ uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode, const uint1
break;
}
- if (ProgrammingStatus == STATUS_CMD_OK)
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
-
return ProgrammingStatus;
}
@@ -160,17 +157,9 @@ uint8_t ISPTarget_WaitWhileTargetBusy(void)
SPI_SendByte(0x00);
SPI_SendByte(0x00);
}
- while ((SPI_ReceiveByte() & 0x01) && TimeoutMSRemaining);
+ while ((SPI_ReceiveByte() & 0x01) && TimeoutTicksRemaining);
- if (TimeoutMSRemaining)
- {
- TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
- return STATUS_CMD_OK;
- }
- else
- {
- return STATUS_RDY_BSY_TOUT;
- }
+ return TimeoutTicksRemaining ? STATUS_CMD_OK : STATUS_RDY_BSY_TOUT;
}
/** Sends a low-level LOAD EXTENDED ADDRESS command to the target, for addressing of memory beyond the