X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/1ed6925b5bf417848b83887b32e3ede05a1c691b..df31b1fd5b0bfbf02a766d32e23a7af075bf4911:/Projects/AVRISP/Lib/V2Protocol.h diff --git a/Projects/AVRISP/Lib/V2Protocol.h b/Projects/AVRISP/Lib/V2Protocol.h index b31147846..1777e0fe1 100644 --- a/Projects/AVRISP/Lib/V2Protocol.h +++ b/Projects/AVRISP/Lib/V2Protocol.h @@ -44,10 +44,20 @@ #include "V2ProtocolConstants.h" #include "V2ProtocolParams.h" #include "ISPProtocol.h" + #include "PDIProtocol.h" + + /* Preprocessor Checks: */ + #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) + #undef ENABLE_ISP_PROTOCOL + + #if !defined(ENABLE_PDI_PROTOCOL) + #define ENABLE_PDI_PROTOCOL + #endif + #endif /* Macros: */ /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */ - #define PROGRAMMER_ID "AVRISP_MK2" + #define PROGRAMMER_ID "AVRISP_MK2" /** Timeout in milliseconds of target busy-wait loops waiting for a command to complete */ #define TARGET_BUSY_TIMEOUT_MS 240 @@ -60,7 +70,16 @@ static inline void V2Protocol_DelayMS(uint8_t DelayMS) { TCNT0 = 0; - while (TCNT0 < DelayMS); + TIFR0 = (1 << OCF1A); + + while (DelayMS) + { + if (TIFR0 & (1 << OCF1A)) + { + TIFR0 = (1 << OCF1A); + DelayMS--; + } + } } /* External Variables: */