diff options
author | Dean Camera <[email protected]> | 2009-08-28 08:24:50 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2009-08-28 08:24:50 +0000 |
commit | 4bb236e9a05c5bae7a3ae6ee5c17572fa6af7d61 (patch) | |
tree | a28b86f2a5781512ddf67fcf211236528c6583fe /Projects/AVRISP/Lib/V2Protocol.c | |
parent | 489515fbbf0f61ae63bcdd4b858a5fe59e90c0be (diff) | |
download | qmk_firmware-4bb236e9a05c5bae7a3ae6ee5c17572fa6af7d61.tar.gz qmk_firmware-4bb236e9a05c5bae7a3ae6ee5c17572fa6af7d61.zip |
Increase AVRISP command timeout to 240ms up from 150ms to prevent some ISP commands from timing out too early.
Add check to the PROGRAM FLASH ISP and PROGRAM EEPROM ISP handler to return an explicit error when the host attempts to write more data than the device is able to buffer.
Diffstat (limited to 'Projects/AVRISP/Lib/V2Protocol.c')
-rw-r--r-- | Projects/AVRISP/Lib/V2Protocol.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Projects/AVRISP/Lib/V2Protocol.c b/Projects/AVRISP/Lib/V2Protocol.c index 3a1b78efd1..3aa2d89cad 100644 --- a/Projects/AVRISP/Lib/V2Protocol.c +++ b/Projects/AVRISP/Lib/V2Protocol.c @@ -308,6 +308,18 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command) Endpoint_Read_Stream_LE(&Write_Memory_Params, sizeof(Write_Memory_Params) - sizeof(Write_Memory_Params.ProgData));
Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);
+
+ if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))
+ {
+ Endpoint_ClearOUT();
+ Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
+
+ Endpoint_Write_Byte(V2Command);
+ Endpoint_Write_Byte(STATUS_CMD_FAILED);
+ Endpoint_ClearIN();
+ return;
+ }
+
Endpoint_Read_Stream_LE(&Write_Memory_Params.ProgData, Write_Memory_Params.BytesToWrite);
Endpoint_ClearOUT();
@@ -407,7 +419,6 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command) Endpoint_Write_Byte(V2Command);
Endpoint_Write_Byte(ProgrammingStatus);
-
Endpoint_ClearIN();
}
|