summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2010-05-07 14:03:39 +0800
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-05-16 13:39:47 +0200
commitebdd3a1670b8561e238f5c16245cefefd56b6f71 (patch)
tree2253246683fdeb17af517c3a7fb508d01294fda0 /src
parent34f70956ed31c2739d34bae23fa6ca620e5299f8 (diff)
downloadopenocd+libswd-ebdd3a1670b8561e238f5c16245cefefd56b6f71.tar.gz
openocd+libswd-ebdd3a1670b8561e238f5c16245cefefd56b6f71.tar.bz2
openocd+libswd-ebdd3a1670b8561e238f5c16245cefefd56b6f71.tar.xz
openocd+libswd-ebdd3a1670b8561e238f5c16245cefefd56b6f71.zip
NOR/CFI: remove use of cfi_add_byte()
Remove the function cfi_add_byte() and rewrite the only instance of it. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/cfi.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c
index b2d184d4..94ff7b94 100644
--- a/src/flash/nor/cfi.c
+++ b/src/flash/nor/cfi.c
@@ -953,40 +953,6 @@ static int cfi_protect(struct flash_bank *bank, int set, int first, int last)
}
}
-/* FIXME Replace this by a simple memcpy() - still unsure about sideeffects */
-static void cfi_add_byte(struct flash_bank *bank, uint8_t *word, uint8_t byte)
-{
- /* struct target *target = bank->target; */
-
- int i;
-
- /* NOTE:
- * The data to flash must not be changed in endian! We write a bytestrem in
- * target byte order already. Only the control and status byte lane of the flash
- * WSM is interpreted by the CPU in different ways, when read a uint16_t or uint32_t
- * word (data seems to be in the upper or lower byte lane for uint16_t accesses).
- */
-
-#if 0
- if (target->endianness == TARGET_LITTLE_ENDIAN)
- {
-#endif
- /* shift bytes */
- for (i = 0; i < bank->bus_width - 1; i++)
- word[i] = word[i + 1];
- word[bank->bus_width - 1] = byte;
-#if 0
- }
- else
- {
- /* shift bytes */
- for (i = bank->bus_width - 1; i > 0; i--)
- word[i] = word[i - 1];
- word[0] = byte;
- }
-#endif
-}
-
/* Convert code image to target endian */
/* FIXME create general block conversion fcts in target.c?) */
static void cfi_fix_code_endian(struct target *target, uint8_t *dest, const uint32_t *src, uint32_t count)
@@ -1936,12 +1902,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset,
if (fallback)
{
for (i = 0; i < bank->bus_width; i++)
- current_word[i] = 0;
-
- for (i = 0; i < bank->bus_width; i++)
- {
- cfi_add_byte(bank, current_word, *buffer++);
- }
+ current_word[i] = *buffer++;
retval = cfi_write_word(bank, current_word, write_p);
if (retval != ERROR_OK)