summaryrefslogtreecommitdiff
path: root/src/flash/cfi.c
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-25 07:32:52 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-25 07:32:52 +0000
commit815c3b353307796fb4d86a1880679dacaed00b6e (patch)
treeb63a1c37b480f52cbb077230e7e3d68ed87c3baf /src/flash/cfi.c
parentd8456e48260519a7e1d5d4b4efee51f985e981c6 (diff)
downloadopenocd+libswd-815c3b353307796fb4d86a1880679dacaed00b6e.tar.gz
openocd+libswd-815c3b353307796fb4d86a1880679dacaed00b6e.tar.bz2
openocd+libswd-815c3b353307796fb4d86a1880679dacaed00b6e.tar.xz
openocd+libswd-815c3b353307796fb4d86a1880679dacaed00b6e.zip
- "flash write_binary" is now "flash write_bank" to clarify the focus of the
command and reduce confusion with "flash write_image". - retired deprecated "flash erase" & "flash write". - added flash_driver_protect/write/erase() that are wafer thin frontend functions to low level driver functions. They implement checks that were inconsistently handled by the drivers, e.g. check for target halted was done in a spotty fashion. - use return ERROR_COMMAND_SYNTAX_ERROR to print out syntax of command instead of having lots of inlined replicas of the command line syntax(some of which were wrong). - use logging instead of dubious translation of error values to human understandable explanations of why things failed. The lower levels log the precise reason and the higher levels can ammend context as the error propagates up the call stack. - simplified flash API slightly with logging instead of allocating and returning information that the caller then has to translate into print statements. git-svn-id: svn://svn.berlios.de/openocd/trunk@337 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash/cfi.c')
-rw-r--r--src/flash/cfi.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/flash/cfi.c b/src/flash/cfi.c
index 66a1c656..82120d8d 100644
--- a/src/flash/cfi.c
+++ b/src/flash/cfi.c
@@ -1375,11 +1375,11 @@ int cfi_spansion_write_block(struct flash_bank_s *bank, u8 *buffer, u32 address,
}
/* allocate working area */
- if (target_alloc_working_area(target, 24 * 4,
- &cfi_info->write_algorithm) != ERROR_OK)
+ retval=target_alloc_working_area(target, 24 * 4,
+ &cfi_info->write_algorithm);
+ if (retval != ERROR_OK)
{
- WARNING("no working area available, can't do block memory writes");
- return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
+ return retval;
}
/* write algorithm code to working area */
@@ -1645,11 +1645,6 @@ int cfi_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
int i;
int retval;
- if (bank->target->state != TARGET_HALTED)
- {
- return ERROR_TARGET_NOT_HALTED;
- }
-
if (offset + count > bank->size)
return ERROR_FLASH_DST_OUT_OF_BANK;