Fix PDITarget_ReceiveByte() not discarding the start bit properly, and reading in...
[pub/USBasp.git] / Projects / AVRISP / Lib / ISPProtocol.c
index bfd917a..6e81ac8 100644 (file)
@@ -28,6 +28,8 @@
   this software.\r
 */\r
 \r
+#if defined(ENABLE_ISP_PROTOCOL) || defined(__DOXYGEN__)\r
+\r
 /** \file\r
  *\r
  *  ISP Protocol handler, to process V2 Protocol wrapped ISP commands used in Atmel programmer devices.\r
@@ -61,7 +63,7 @@ void ISPProtocol_EnterISPMode(void)
        \r
        CurrentAddress = 0;\r
 \r
-       V2Protocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);    \r
+       V2Protocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS); \r
        SPI_Init(ISPTarget_GetSPIPrescalerMask() | SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING | SPI_MODE_MASTER);\r
                \r
        while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus == STATUS_CMD_FAILED))\r
@@ -136,7 +138,10 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
                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
-       Endpoint_Read_Stream_LE(&Write_Memory_Params, sizeof(Write_Memory_Params) - sizeof(Write_Memory_Params.ProgData));\r
+       Endpoint_Read_Stream_LE(&Write_Memory_Params, (sizeof(Write_Memory_Params) -\r
+                                                      sizeof(Write_Memory_Params.ProgData)));\r
+\r
+\r
        Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);\r
        \r
        if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))\r
@@ -465,3 +470,5 @@ void ISPProtocol_SPIMulti(void)
        Endpoint_Write_Byte(STATUS_CMD_OK);\r
        Endpoint_ClearIN();\r
 }\r
+\r
+#endif
\ No newline at end of file