Update copyright year to 2010.
[pub/USBasp.git] / Projects / AVRISP-MKII / Lib / XPROG / TINYNVM.c
index 4d879bd..93c2c6e 100644 (file)
@@ -1,13 +1,13 @@
 /*\r
              LUFA Library\r
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
   Permission to use, copy, modify, distribute, and sell this \r
   software and its documentation for any purpose is hereby granted\r
 \r
   Permission to use, copy, modify, distribute, and sell this \r
   software and its documentation for any purpose is hereby granted\r
@@ -119,14 +119,13 @@ bool TINYNVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16_
 \r
 /** Writes byte addressed memory to the target's memory spaces.\r
  *\r
 \r
 /** Writes byte addressed memory to the target's memory spaces.\r
  *\r
- *  \param[in]  WriteCommand  Command to send to the device to write each memory byte\r
  *  \param[in]  WriteAddress  Start address to write to within the target's address space\r
  *  \param[in]  WriteBuffer   Buffer to source data from\r
  *  \param[in]  WriteAddress  Start address to write to within the target's address space\r
  *  \param[in]  WriteBuffer   Buffer to source data from\r
- *\r
+ *  \param[in]  WriteLength   Total number of bytes to write to the device\r
  *\r
  *  \return Boolean true if the command sequence complete successfully\r
  */\r
  *\r
  *  \return Boolean true if the command sequence complete successfully\r
  */\r
-bool TINYNVM_WriteMemory(const uint32_t WriteAddress, const uint8_t Byte)\r
+bool TINYNVM_WriteMemory(const uint32_t WriteAddress, const uint8_t* WriteBuffer, uint16_t WriteLength)\r
 {\r
        /* Wait until the NVM controller is no longer busy */\r
        if (!(TINYNVM_WaitWhileNVMControllerBusy()))\r
 {\r
        /* Wait until the NVM controller is no longer busy */\r
        if (!(TINYNVM_WaitWhileNVMControllerBusy()))\r
@@ -139,9 +138,12 @@ bool TINYNVM_WriteMemory(const uint32_t WriteAddress, const uint8_t Byte)
        /* Send the address of the location to write to */\r
        TINYNVM_SendPointerAddress(WriteAddress);\r
        \r
        /* Send the address of the location to write to */\r
        TINYNVM_SendPointerAddress(WriteAddress);\r
        \r
-       /* Write the byte of data to the target */\r
-       XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT);\r
-       XPROGTarget_SendByte(Byte);\r
+       while (WriteLength--)\r
+       {\r
+               /* Write the byte of data to the target */\r
+               XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);\r
+               XPROGTarget_SendByte(*(WriteBuffer++));\r
+       }\r
        \r
        return true;\r
 }\r
        \r
        return true;\r
 }\r