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)
{
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;
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);
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);
switch (bank->size)
{
- case 256 * 1024:
+ case (256 * 1024):
b0_sectors = 4;
break;
- case 512 * 1024:
+ case (512 * 1024):
b0_sectors = 8;
break;
default:
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);
WARNING("overriding flash base address for STR91x device with 0x00000000");
bank->base = 0x00000000;
}
-
- str9xpec_info->target = get_target_by_num(strtoul(args[5], NULL, 0));
- if (!str9xpec_info->target)
- {
- ERROR("no target '%s' configured", args[5]);
- exit(-1);
- }
/* find out jtag position of flash controller
* it is always after the arm966 core */
- armv4_5 = str9xpec_info->target->arch_info;
+ armv4_5 = bank->target->arch_info;
arm7_9 = armv4_5->arch_info;
jtag_info = &arm7_9->jtag_info;
if( str9xpec_info->devarm ) {
dev0->next = str9xpec_info->devarm;
jtag_num_devices++;
+ str9xpec_info->devarm = NULL;
}
return ERROR_OK;