diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/flash/str9xpec.c | 8 | ||||
-rw-r--r-- | src/jtag/core.c | 34 | ||||
-rw-r--r-- | src/jtag/jtag.h | 1 |
3 files changed, 26 insertions, 17 deletions
diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index c1021ba0..bca3b88f 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -318,14 +318,14 @@ static int str9xpec_flash_bank_command(struct command_context_s *cmd_ctx, char * str9xpec_info = malloc(sizeof(str9xpec_flash_controller_t)); bank->driver_priv = str9xpec_info; - /* find out jtag position of flash controller - * it is always after the arm966 core */ - + /* REVISIT verify that the jtag position of flash controller is + * right after *THIS* core, which must be a STR9xx core ... + */ armv4_5 = bank->target->arch_info; arm7_9 = armv4_5->arch_info; jtag_info = &arm7_9->jtag_info; - str9xpec_info->tap = jtag_tap_by_position(jtag_info->tap->abs_chain_position - 1); + str9xpec_info->tap = bank->target->tap; str9xpec_info->isc_enable = 0; str9xpec_build_block_list(bank); diff --git a/src/jtag/core.c b/src/jtag/core.c index 651e6545..c721b91b 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -162,10 +162,22 @@ void jtag_tap_add(struct jtag_tap_s *t) *tap = t; } +/* returns a pointer to the n-th device in the scan chain */ +static inline jtag_tap_t *jtag_tap_by_position(unsigned n) +{ + jtag_tap_t *t = jtag_all_taps(); + + while (t && n-- > 0) + t = t->next_tap; + + return t; +} + jtag_tap_t *jtag_tap_by_string(const char *s) { /* try by name first */ jtag_tap_t *t = jtag_all_taps(); + while (t) { if (0 == strcmp(t->dotted_name, s)) @@ -178,7 +190,16 @@ jtag_tap_t *jtag_tap_by_string(const char *s) if (parse_uint(s, &n) != ERROR_OK) return NULL; - return jtag_tap_by_position(n); + /* FIXME remove this numeric fallback code late June 2010, along + * with all info in the User's Guide that TAPs have numeric IDs. + * Also update "scan_chain" output to not display the numbers. + */ + t = jtag_tap_by_position(n); + if (t) + LOG_WARNING("Specify TAP '%s' by name, not number %u", + t->dotted_name, n); + + return t; } jtag_tap_t *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o) @@ -192,17 +213,6 @@ jtag_tap_t *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o) return t; } -/* returns a pointer to the n-th device in the scan chain */ -jtag_tap_t *jtag_tap_by_position(unsigned n) -{ - jtag_tap_t *t = jtag_all_taps(); - - while (t && n-- > 0) - t = t->next_tap; - - return t; -} - jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p) { p = p ? p->next_tap : jtag_all_taps(); diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index 1564ca65..7cdaa51f 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -185,7 +185,6 @@ extern jtag_tap_t* jtag_all_taps(void); extern const char *jtag_tap_name(const jtag_tap_t *tap); extern jtag_tap_t* jtag_tap_by_string(const char* dotted_name); extern jtag_tap_t* jtag_tap_by_jim_obj(Jim_Interp* interp, Jim_Obj* obj); -extern jtag_tap_t* jtag_tap_by_position(unsigned abs_position); extern jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p); extern unsigned jtag_tap_count_enabled(void); extern unsigned jtag_tap_count(void); |