X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Flpc288x.c;h=89f79e3213a665623a8693757238fa5525faa9a6;hb=b1a1a48b30243d3582a8443f4baf3dd500683eda;hp=57107658861e98dd8e5717d75c00f352dcad9450;hpb=cbf4760e15d217c0a83e65f13bddfcbfad7d2fec;p=openocd diff --git a/src/flash/nor/lpc288x.c b/src/flash/nor/lpc288x.c index 57107658..89f79e32 100644 --- a/src/flash/nor/lpc288x.c +++ b/src/flash/nor/lpc288x.c @@ -277,7 +277,7 @@ static int lpc288x_erase(struct flash_bank *bank, int first, int last) return ERROR_OK; } -static int lpc288x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int lpc288x_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) { uint8_t page_buffer[FLASH_PAGE_SIZE]; uint32_t status, source_offset, dest_offset; @@ -350,22 +350,13 @@ static int lpc288x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offs target_write_u32(target, F_CTRL, FC_CS | FC_SET_DATA | FC_WEN | FC_FUNC); target_write_u32(target, F_CTRL, FC_CS | FC_WEN | FC_FUNC); - /*would be better to use the clean target_write_buffer() interface but - * it seems not to be a LOT slower.... - * bulk_write_memory() is no quicker :(*/ -#if 1 - if (target_write_memory(target, offset + dest_offset, 4, 128, - page_buffer) != ERROR_OK) { - LOG_ERROR("Write failed s %" PRIx32 " p %" PRIx32 "", sector, page); - return ERROR_FLASH_OPERATION_FAILED; - } -#else + if (target_write_buffer(target, offset + dest_offset, FLASH_PAGE_SIZE, page_buffer) != ERROR_OK) { LOG_INFO("Write to flash buffer failed"); return ERROR_FLASH_OPERATION_FAILED; } -#endif + dest_offset += FLASH_PAGE_SIZE; source_offset += count; bytes_remaining -= count;