Added const where possible to the source functions in the Projects directory.
[pub/USBasp.git] / Projects / AVRISP / Lib / XPROG / TINYNVM.c
index f4b90ff..3ddd2ed 100644 (file)
@@ -37,6 +37,7 @@
 #include "TINYNVM.h"\r
 \r
 #if defined(ENABLE_XPROG_PROTOCOL) || defined(__DOXYGEN__)\r
+#warning TPI Protocol support is currently incomplete and is not suitable for general use.\r
 \r
 /** Busy-waits while the NVM controller is busy performing a NVM operation, such as a FLASH page read.\r
  *\r
  */\r
 bool TINYNVM_WaitWhileNVMBusBusy(void)\r
 {\r
-       TCNT0 = 0;\r
-       TIFR0 = (1 << OCF1A);\r
-                       \r
-       uint8_t TimeoutMS = TINY_NVM_BUSY_TIMEOUT_MS;\r
-       \r
        /* Poll the STATUS register to check to see if NVM access has been enabled */\r
-       while (TimeoutMS)\r
+       while (TimeoutMSRemaining)\r
        {\r
                /* Send the SLDCS command to read the TPI STATUS register to see the NVM bus is active */\r
                XPROGTarget_SendByte(TPI_CMD_SLDCS | TPI_STATUS_REG);\r
                if (XPROGTarget_ReceiveByte() & TPI_STATUS_NVM)\r
                  return true;\r
-\r
-               if (TIFR0 & (1 << OCF1A))\r
-               {\r
-                       TIFR0 = (1 << OCF1A);\r
-                       TimeoutMS--;\r
-               }\r
        }\r
        \r
        return false;\r