X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/1ed6925b5bf417848b83887b32e3ede05a1c691b..bb3879331211a19c3adc3927cac870cc7e36b775:/Projects/AVRISP/Lib/ISPProtocol.c?ds=sidebyside diff --git a/Projects/AVRISP/Lib/ISPProtocol.c b/Projects/AVRISP/Lib/ISPProtocol.c index bfd917a09..9b8666afb 100644 --- a/Projects/AVRISP/Lib/ISPProtocol.c +++ b/Projects/AVRISP/Lib/ISPProtocol.c @@ -35,6 +35,8 @@ #include "ISPProtocol.h" +#if defined(ENABLE_ISP_PROTOCOL) || defined(__DOXYGEN__) + /** Handler for the CMD_ENTER_PROGMODE_ISP command, which attempts to enter programming mode on * the attached device, returning success or failure back to the host. */ @@ -61,7 +63,7 @@ void ISPProtocol_EnterISPMode(void) CurrentAddress = 0; - V2Protocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS); + V2Protocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS); SPI_Init(ISPTarget_GetSPIPrescalerMask() | SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING | SPI_MODE_MASTER); while (Enter_ISP_Params.SynchLoops-- && (ResponseStatus == STATUS_CMD_FAILED)) @@ -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 } Write_Memory_Params; // whole page and ACK the packet as fast as possible to prevent it from aborting - Endpoint_Read_Stream_LE(&Write_Memory_Params, sizeof(Write_Memory_Params) - sizeof(Write_Memory_Params.ProgData)); + 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)) @@ -465,3 +470,5 @@ void ISPProtocol_SPIMulti(void) Endpoint_Write_Byte(STATUS_CMD_OK); Endpoint_ClearIN(); } + +#endif \ No newline at end of file