summaryrefslogtreecommitdiff
path: root/src/flash/lpc2000.c
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-28 10:44:41 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-28 10:44:41 +0000
commit86ca2270f40d650a849e778518e7aa9c2c713341 (patch)
tree76d0f52c9637707506e8df254f733d32c5b9b269 /src/flash/lpc2000.c
parentb008ff7ae1f5e646311b3901772be8c9ddaecd0c (diff)
downloadopenocd+libswd-86ca2270f40d650a849e778518e7aa9c2c713341.tar.gz
openocd+libswd-86ca2270f40d650a849e778518e7aa9c2c713341.tar.bz2
openocd+libswd-86ca2270f40d650a849e778518e7aa9c2c713341.tar.xz
openocd+libswd-86ca2270f40d650a849e778518e7aa9c2c713341.zip
Pavel Chromy cleaned up checks for halted, error messages, etc.
git-svn-id: svn://svn.berlios.de/openocd/trunk@374 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash/lpc2000.c')
-rw-r--r--src/flash/lpc2000.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c
index 396f910c..5d9781ac 100644
--- a/src/flash/lpc2000.c
+++ b/src/flash/lpc2000.c
@@ -416,6 +416,11 @@ int lpc2000_erase(struct flash_bank_s *bank, int first, int last)
u32 result_table[2];
int status_code;
+ if (bank->target->state != TARGET_HALTED)
+ {
+ return ERROR_TARGET_NOT_HALTED;
+ }
+
param_table[0] = first;
param_table[1] = last;
param_table[2] = lpc2000_info->cclk;
@@ -476,6 +481,11 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
int i;
working_area_t *download_area;
+ if (bank->target->state != TARGET_HALTED)
+ {
+ return ERROR_TARGET_NOT_HALTED;
+ }
+
/* allocate a working area */
if (target_alloc_working_area(target, lpc2000_info->cmd51_max_buffer, &download_area) != ERROR_OK)
{
@@ -645,7 +655,6 @@ int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd,
u32 param_table[5];
u32 result_table[2];
int status_code;
- lpc2000_flash_bank_t *lpc2000_info;
if (argc < 1)
{
@@ -659,7 +668,6 @@ int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd,
return ERROR_OK;
}
- lpc2000_info = bank->driver_priv;
if (bank->target->state != TARGET_HALTED)
{
return ERROR_TARGET_NOT_HALTED;