Change-Id: I96e5f13b12da2970eafc5fca24b7952d427eeca9
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2235
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
* List all TAPs that have been created.
*/
static struct jtag_tap *__jtag_all_taps;
* List all TAPs that have been created.
*/
static struct jtag_tap *__jtag_all_taps;
-/**
- * The number of TAPs in the __jtag_all_taps list, used to track the
- * assigned chain position to new TAPs
- */
-static unsigned jtag_num_taps;
static enum reset_types jtag_reset_config = RESET_NONE;
tap_state_t cmd_queue_cur_state = TAP_RESET;
static enum reset_types jtag_reset_config = RESET_NONE;
tap_state_t cmd_queue_cur_state = TAP_RESET;
unsigned jtag_tap_count(void)
{
unsigned jtag_tap_count(void)
{
+ struct jtag_tap *t = jtag_all_taps();
+ unsigned n = 0;
+ while (t) {
+ n++;
+ t = t->next_tap;
+ }
+ return n;
}
unsigned jtag_tap_count_enabled(void)
}
unsigned jtag_tap_count_enabled(void)
/** Append a new TAP to the chain of all taps. */
void jtag_tap_add(struct jtag_tap *t)
{
/** Append a new TAP to the chain of all taps. */
void jtag_tap_add(struct jtag_tap *t)
{
- t->abs_chain_position = jtag_num_taps++;
+ unsigned jtag_num_taps = 0;
struct jtag_tap **tap = &__jtag_all_taps;
struct jtag_tap **tap = &__jtag_all_taps;
+ while (*tap != NULL) {
+ jtag_num_taps++;
+ t->abs_chain_position = jtag_num_taps;
}
/* returns a pointer to the n-th device in the scan chain */
}
/* returns a pointer to the n-th device in the scan chain */