Add architecture guards to all architecture-specific files, so that they can be bulk...
[pub/USBasp.git] / Projects / AVRISP-MKII / Lib / ISP / ISPProtocol.c
index 7368125..f757ac1 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2011.
+     Copyright (C) Dean Camera, 2012.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -73,7 +73,7 @@ void ISPProtocol_EnterISPMode(void)
 
        /* Continuously attempt to synchronize with the target until either the number of attempts specified
         * by the host has exceeded, or the the device sends back the expected response values */
 
        /* Continuously attempt to synchronize with the target until either the number of attempts specified
         * by the host has exceeded, or the the device sends back the expected response values */
-       while (Enter_ISP_Params.SynchLoops-- && !(TimeoutExpired))
+       while (Enter_ISP_Params.SynchLoops-- && TimeoutTicksRemaining)
        {
                uint8_t ResponseBytes[4];
 
        {
                uint8_t ResponseBytes[4];
 
@@ -515,13 +515,15 @@ void ISPProtocol_SPIMulti(void)
        }
 }
 
        }
 }
 
-/** Blocking delay for a given number of milliseconds.
+/** Blocking delay for a given number of milliseconds. This provides a simple wrapper around
+ *  the avr-libc provided delay function, so that the delay function can be called with a
+ *  constant value (to prevent run-time floating point operations being required).
  *
  *  \param[in] DelayMS  Number of milliseconds to delay for
  */
 void ISPProtocol_DelayMS(uint8_t DelayMS)
 {
  *
  *  \param[in] DelayMS  Number of milliseconds to delay for
  */
 void ISPProtocol_DelayMS(uint8_t DelayMS)
 {
-       while (DelayMS-- && !(TimeoutExpired))
+       while (DelayMS-- && TimeoutTicksRemaining)
          Delay_MS(1);
 }
 
          Delay_MS(1);
 }