Factor out all the ISP related code into a seperate ISPProtocol set of files in the...
[pub/USBasp.git] / Projects / AVRISP / Lib / V2ProtocolTarget.c
index 80e8be1..b5de9ba 100644 (file)
 \r
 /** \file\r
  *\r
- *  Target-related functions for the V2 Protocol decoder.\r
+ *  Target-related functions for the ISP Protocol decoder.\r
  */\r
 \r
 #include "V2ProtocolTarget.h"\r
 \r
-/** Current memory address for FLASH/EEPROM memory read/write commands */\r
-uint32_t CurrentAddress;\r
-\r
 /** Converts the given AVR Studio SCK duration parameter (set by a SET PARAM command from the host) to the nearest\r
  *  possible SPI clock prescaler mask for passing to the SPI_Init() routine.\r
  *\r
  *  \return Nearest SPI prescaler mask for the given SCK frequency\r
  */\r
-uint8_t V2Protocol_GetSPIPrescalerMask(void)\r
+uint8_t ISPTarget_GetSPIPrescalerMask(void)\r
 {\r
        static const uint8_t SPIMaskFromSCKDuration[] =\r
        {\r
@@ -81,7 +78,7 @@ uint8_t V2Protocol_GetSPIPrescalerMask(void)
  *\r
  *  \param[in] ResetTarget Boolean true when the target should be held in reset, false otherwise\r
  */\r
-void V2Protocol_ChangeTargetResetLine(bool ResetTarget)\r
+void ISPTarget_ChangeTargetResetLine(bool ResetTarget)\r
 {\r
        if (ResetTarget)\r
        {\r
@@ -109,8 +106,8 @@ void V2Protocol_ChangeTargetResetLine(bool ResetTarget)
  *  \return V2 Protocol status \ref STATUS_CMD_OK if the no timeout occurred, \ref STATUS_RDY_BSY_TOUT or\r
  *          \ref STATUS_CMD_TOUT otherwise\r
  */\r
-uint8_t V2Protocol_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAddress, uint8_t PollValue,\r
-                                       uint8_t DelayMS, uint8_t ReadMemCommand)\r
+uint8_t ISPTarget_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAddress, uint8_t PollValue,\r
+                                      uint8_t DelayMS, uint8_t ReadMemCommand)\r
 {\r
        uint8_t ProgrammingStatus = STATUS_CMD_OK;\r
 \r
@@ -139,7 +136,7 @@ uint8_t V2Protocol_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAdd
                        break;          \r
                case PROG_MODE_WORD_READYBUSY_MASK:\r
                case PROG_MODE_PAGED_READYBUSY_MASK:\r
-                       ProgrammingStatus = V2Protocol_WaitWhileTargetBusy();\r
+                       ProgrammingStatus = ISPTarget_WaitWhileTargetBusy();\r
                        break;\r
        }\r
 \r
@@ -151,7 +148,7 @@ uint8_t V2Protocol_WaitForProgComplete(uint8_t ProgrammingMode, uint16_t PollAdd
  *\r
  *  \return V2 Protocol status \ref STATUS_CMD_OK if the no timeout occurred, \ref STATUS_RDY_BSY_TOUT otherwise\r
  */\r
-uint8_t V2Protocol_WaitWhileTargetBusy(void)\r
+uint8_t ISPTarget_WaitWhileTargetBusy(void)\r
 {\r
        TCNT0 = 0;\r
        \r
@@ -174,7 +171,7 @@ uint8_t V2Protocol_WaitWhileTargetBusy(void)
  *  64KB boundary. This sends the command with the correct address as indicated by the current address\r
  *  pointer variable set by the host when a SET ADDRESS command is issued.\r
  */\r
-void V2Protocol_LoadExtendedAddress(void)\r
+void ISPTarget_LoadExtendedAddress(void)\r
 {\r
        SPI_SendByte(0x4D);\r
        SPI_SendByte(0x00);\r