X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/4a09da20989dfe0c41dc1272fa6dce1e11539c15..bb4880a9ee83d195adfaf6816c47a3fb92f40172:/Bootloaders/DFU/BootloaderDFU.c diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c index 8cc5fd409..6bea9b25f 100644 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@ -32,13 +32,6 @@ * * Main source file for the DFU class bootloader. This file contains the complete bootloader logic. */ - -/** Configuration define. Define this token to true to case the bootloader to reject all memory commands - * until a memory erase has been performed. When used in conjunction with the lockbits of the AVR, this - * can protect the AVR's firmware from being dumped from a secured AVR. When false, memory operations are - * allowed at any time. - */ -#define SECURE_MODE false #define INCLUDE_FROM_BOOTLOADER_C #include "BootloaderDFU.h" @@ -57,7 +50,7 @@ bool RunBootloader = true; /** Flag to indicate if the bootloader is waiting to exit. When the host requests the bootloader to exit and * jump to the application address it specifies, it sends two sequential commands which must be properly - * acknowedged. Upon reception of the first the RunBootloader flag is cleared and the WaitForExit flag is set, + * acknowledged. Upon reception of the first the RunBootloader flag is cleared and the WaitForExit flag is set, * causing the bootloader to wait for the final exit command before shutting down. */ bool WaitForExit = false; @@ -305,7 +298,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket) Endpoint_ClearSetupOUT(); - /* Send ZLP to the host to acknowedge the request */ + /* Acknowledge status stage */ + while (!(Endpoint_IsSetupINReady())); Endpoint_ClearSetupIN(); break; @@ -392,7 +386,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket) Endpoint_ClearSetupIN(); - /* Send ZLP to the host to acknowedge the request */ + /* Acknowledge status stage */ while (!(Endpoint_IsSetupOUTReceived())); Endpoint_ClearSetupOUT(); @@ -415,6 +409,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket) Endpoint_ClearSetupIN(); + /* Acknowledge status stage */ while (!(Endpoint_IsSetupOUTReceived())); Endpoint_ClearSetupOUT(); @@ -424,9 +419,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket) /* Reset the status value variable to the default OK status */ DFU_Status = OK; - - Endpoint_ClearSetupIN(); + /* Acknowledge status stage */ + while (!(Endpoint_IsSetupINReady())); + Endpoint_ClearSetupIN(); + break; case DFU_GETSTATE: Endpoint_ClearSetupReceived(); @@ -436,6 +433,7 @@ EVENT_HANDLER(USB_UnhandledControlPacket) Endpoint_ClearSetupIN(); + /* Acknowledge status stage */ while (!(Endpoint_IsSetupOUTReceived())); Endpoint_ClearSetupOUT(); @@ -446,6 +444,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket) /* Reset the current state variable to the default idle state */ DFU_State = dfuIDLE; + /* Acknowledge status stage */ + while (!(Endpoint_IsSetupINReady())); Endpoint_ClearSetupIN(); break;