Minor changes to the AVRISP project for code clarity.
[pub/USBasp.git] / Projects / AVRISP / Lib / V2Protocol.c
index 6099234..d7343aa 100644 (file)
@@ -301,11 +301,9 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command)
                uint8_t  ProgrammingCommands[3];\r
                uint8_t  PollValue1;\r
                uint8_t  PollValue2;\r
-               uint8_t  ProgData[256];\r
-       } Write_Memory_Params;\r
+               uint8_t  ProgData[256]; // Note, the Jungo driver has a very short ACK timeout period, need to buffer the\r
+       } Write_Memory_Params;      // whole page and ACK the packet as fast as possible to prevent it from aborting\r
        \r
-       uint8_t* NextWriteByte = Write_Memory_Params.ProgData;\r
-\r
        Endpoint_Read_Stream_LE(&Write_Memory_Params, sizeof(Write_Memory_Params) - sizeof(Write_Memory_Params.ProgData));\r
        Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);\r
        \r
@@ -329,6 +327,8 @@ static void V2Protocol_Command_ProgramMemory(uint8_t V2Command)
        uint16_t PollAddress       = 0;\r
        uint8_t  PollValue         = (V2Command == CMD_PROGRAM_FLASH_ISP) ? Write_Memory_Params.PollValue1 :\r
                                                                            Write_Memory_Params.PollValue2;\r
+       uint8_t* NextWriteByte = Write_Memory_Params.ProgData;\r
+\r
        if (Write_Memory_Params.ProgrammingMode & PROG_MODE_PAGED_WRITES_MASK)\r
        {\r
                uint16_t StartAddress = (CurrentAddress & 0xFFFF);\r