Make loops in AVRISP-MKII Clone project's XPROG protocol infinite rather than looping...
authorDean Camera <dean@fourwalledcubicle.com>
Fri, 25 Jun 2010 13:19:05 +0000 (13:19 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Fri, 25 Jun 2010 13:19:05 +0000 (13:19 +0000)
Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c

index f981504..e0e2479 100644 (file)
@@ -77,7 +77,7 @@ static void TINYNVM_SendWriteNVMRegister(const uint8_t Address)
 bool TINYNVM_WaitWhileNVMBusBusy(void)
 {
        /* Poll the STATUS register to check to see if NVM access has been enabled */
 bool TINYNVM_WaitWhileNVMBusBusy(void)
 {
        /* Poll the STATUS register to check to see if NVM access has been enabled */
-       while (TimeoutMSRemaining)
+       for (;;)
        {
                /* Send the SLDCS command to read the TPI STATUS register to see the NVM bus is active */
                XPROGTarget_SendByte(TPI_CMD_SLDCS | TPI_STATUS_REG);
        {
                /* Send the SLDCS command to read the TPI STATUS register to see the NVM bus is active */
                XPROGTarget_SendByte(TPI_CMD_SLDCS | TPI_STATUS_REG);
@@ -95,8 +95,6 @@ bool TINYNVM_WaitWhileNVMBusBusy(void)
                        return true;
                }
        }
                        return true;
                }
        }
-
-       return false;
 }
 
 /** Waits while the target's NVM controller is busy performing an operation, exiting if the
 }
 
 /** Waits while the target's NVM controller is busy performing an operation, exiting if the
@@ -107,7 +105,7 @@ bool TINYNVM_WaitWhileNVMBusBusy(void)
 bool TINYNVM_WaitWhileNVMControllerBusy(void)
 {
        /* Poll the STATUS register to check to see if NVM access has been enabled */
 bool TINYNVM_WaitWhileNVMControllerBusy(void)
 {
        /* Poll the STATUS register to check to see if NVM access has been enabled */
-       while (TimeoutMSRemaining)
+       for (;;)
        {
                /* Send the SIN command to read the TPI STATUS register to see the NVM bus is busy */
                TINYNVM_SendReadNVMRegister(XPROG_Param_NVMCSRRegAddr);
        {
                /* Send the SIN command to read the TPI STATUS register to see the NVM bus is busy */
                TINYNVM_SendReadNVMRegister(XPROG_Param_NVMCSRRegAddr);
@@ -125,8 +123,6 @@ bool TINYNVM_WaitWhileNVMControllerBusy(void)
                        return true;
                }
        }
                        return true;
                }
        }
-
-       return false;
 }
 
 /** Reads memory from the target's memory spaces.
 }
 
 /** Reads memory from the target's memory spaces.
index 150ad3e..2caee6a 100644 (file)
@@ -72,7 +72,7 @@ static void XMEGANVM_SendNVMRegAddress(const uint8_t Register)
 bool XMEGANVM_WaitWhileNVMBusBusy(void)
 {
        /* Poll the STATUS register to check to see if NVM access has been enabled */
 bool XMEGANVM_WaitWhileNVMBusBusy(void)
 {
        /* Poll the STATUS register to check to see if NVM access has been enabled */
-       while (TimeoutMSRemaining)
+       for (;;)
        {
                /* Send the LDCS command to read the PDI STATUS register to see the NVM bus is active */
                XPROGTarget_SendByte(PDI_CMD_LDCS | PDI_STATUS_REG);
        {
                /* Send the LDCS command to read the PDI STATUS register to see the NVM bus is active */
                XPROGTarget_SendByte(PDI_CMD_LDCS | PDI_STATUS_REG);
@@ -90,8 +90,6 @@ bool XMEGANVM_WaitWhileNVMBusBusy(void)
                        return true;
                }
        }
                        return true;
                }
        }
-       
-       return false;
 }
 
 /** Waits while the target's NVM controller is busy performing an operation, exiting if the
 }
 
 /** Waits while the target's NVM controller is busy performing an operation, exiting if the
@@ -102,7 +100,7 @@ bool XMEGANVM_WaitWhileNVMBusBusy(void)
 bool XMEGANVM_WaitWhileNVMControllerBusy(void)
 {
        /* Poll the NVM STATUS register while the NVM controller is busy */
 bool XMEGANVM_WaitWhileNVMControllerBusy(void)
 {
        /* Poll the NVM STATUS register while the NVM controller is busy */
-       while (TimeoutMSRemaining)
+       for (;;)
        {
                /* Send a LDS command to read the NVM STATUS register to check the BUSY flag */
                XPROGTarget_SendByte(PDI_CMD_LDS | (PDI_DATSIZE_4BYTES << 2));
        {
                /* Send a LDS command to read the NVM STATUS register to check the BUSY flag */
                XPROGTarget_SendByte(PDI_CMD_LDS | (PDI_DATSIZE_4BYTES << 2));
@@ -121,8 +119,6 @@ bool XMEGANVM_WaitWhileNVMControllerBusy(void)
                        return true;
                }
        }
                        return true;
                }
        }
-       
-       return false;
 }
 
 /** Retrieves the CRC value of the given memory space.
 }
 
 /** Retrieves the CRC value of the given memory space.
index 5598791..07efbb1 100644 (file)
@@ -192,8 +192,6 @@ static void XPROGTarget_SetTxMode(void)
 
        UCSR1B &= ~(1 << RXEN1);
        UCSR1B |=  (1 << TXEN1);
 
        UCSR1B &= ~(1 << RXEN1);
        UCSR1B |=  (1 << TXEN1);
-               
-       IsSending = true;
 
     if (TimeoutMSRemaining)
          TimeoutMSRemaining = COMMAND_TIMEOUT_MS;
 
     if (TimeoutMSRemaining)
          TimeoutMSRemaining = COMMAND_TIMEOUT_MS;