diff options
author | ntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-10-26 09:05:57 +0000 |
---|---|---|
committer | ntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-10-26 09:05:57 +0000 |
commit | 89d0e422c9698dd9a1fcbd7d4b6c8490633b0029 (patch) | |
tree | cd2835f56ac05356eb9a9f63aa63d62f50bbf717 /src/flash/str9xpec.c | |
parent | e27696f6b04459e935a0a5f65f7f668cb02970dd (diff) | |
download | riscv-openocd-89d0e422c9698dd9a1fcbd7d4b6c8490633b0029.zip riscv-openocd-89d0e422c9698dd9a1fcbd7d4b6c8490633b0029.tar.gz riscv-openocd-89d0e422c9698dd9a1fcbd7d4b6c8490633b0029.tar.bz2 |
- corrected str91x bank1 programming issues
- str91x protect_check fixed
- bank number now correctly given to str91x flash_config command
git-svn-id: svn://svn.berlios.de/openocd/trunk@211 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash/str9xpec.c')
-rw-r--r-- | src/flash/str9xpec.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index 7a8fb2f..a89a5a5 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -125,6 +125,12 @@ int str9xpec_register_commands(struct command_context_s *cmd_ctx) int str9xpec_set_instr(int chain_pos, u32 new_instr, enum tap_state end_state) { jtag_device_t *device = jtag_get_device(chain_pos); + + if (device == NULL) + { + DEBUG("Invalid Target"); + return ERROR_TARGET_INVALID; + } if (buf_get_u32(device->cur_instr, 0, device->ir_length) != new_instr) { @@ -154,7 +160,8 @@ u8 str9xpec_isc_status(int chain_pos) scan_field_t field; u8 status; - str9xpec_set_instr(chain_pos, ISC_NOOP, TAP_PI); + if (str9xpec_set_instr(chain_pos, ISC_NOOP, TAP_PI) != ERROR_OK) + return ISC_STATUS_ERROR; field.device = chain_pos; field.num_bits = 8; @@ -189,7 +196,8 @@ int str9xpec_isc_enable(struct flash_bank_s *bank) return ERROR_OK; /* enter isc mode */ - str9xpec_set_instr(chain_pos, ISC_ENABLE, TAP_RTI); + if (str9xpec_set_instr(chain_pos, ISC_ENABLE, TAP_RTI) != ERROR_OK) + return ERROR_TARGET_INVALID; /* check ISC status */ status = str9xpec_isc_status(chain_pos); @@ -214,7 +222,8 @@ int str9xpec_isc_disable(struct flash_bank_s *bank) if (!str9xpec_info->isc_enable) return ERROR_OK; - str9xpec_set_instr(chain_pos, ISC_DISABLE, TAP_RTI); + if (str9xpec_set_instr(chain_pos, ISC_DISABLE, TAP_RTI) != ERROR_OK) + return ERROR_TARGET_INVALID; /* delay to handle aborts */ jtag_add_sleep(50); @@ -273,10 +282,10 @@ int str9xpec_build_block_list(struct flash_bank_s *bank) switch (bank->size) { - case 256 * 1024: + case (256 * 1024): b0_sectors = 4; break; - case 512 * 1024: + case (512 * 1024): b0_sectors = 8; break; default: @@ -284,7 +293,9 @@ int str9xpec_build_block_list(struct flash_bank_s *bank) exit(-1); } + /* include bank 1 sectors */ num_sectors = b0_sectors + 4; + bank->size += (32 * 1024); bank->num_sectors = num_sectors; bank->sectors = malloc(sizeof(flash_sector_t) * num_sectors); @@ -1327,6 +1338,7 @@ int str9xpec_handle_flash_disable_turbo_command(struct command_context_s *cmd_ct if( str9xpec_info->devarm ) { dev0->next = str9xpec_info->devarm; jtag_num_devices++; + str9xpec_info->devarm = NULL; } return ERROR_OK; |