diff options
author | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-11 07:08:14 +0000 |
---|---|---|
committer | zwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2009-06-11 07:08:14 +0000 |
commit | 08382e06014c118ede5f5688e39792ea675e2204 (patch) | |
tree | dee55786d07d611f4991e0d490b8fd51d519c65f | |
parent | 04cb1210733537aa65d2975515a8be137dbd0b2b (diff) | |
download | openocd+libswd-08382e06014c118ede5f5688e39792ea675e2204.tar.gz openocd+libswd-08382e06014c118ede5f5688e39792ea675e2204.tar.bz2 openocd+libswd-08382e06014c118ede5f5688e39792ea675e2204.tar.xz openocd+libswd-08382e06014c118ede5f5688e39792ea675e2204.zip |
Out-of-line jtag_tap_next_enabled and simplify its logic.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2185 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r-- | src/jtag/core.c | 12 | ||||
-rw-r--r-- | src/jtag/jtag.h | 28 |
2 files changed, 13 insertions, 27 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c index 1c14c8ea..4208167b 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -202,6 +202,18 @@ jtag_tap_t *jtag_tap_by_position(unsigned n) return t; } +jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p) +{ + p = p ? p->next_tap : jtag_all_taps(); + while (p) + { + if (p->enabled) + return p; + p = p->next_tap; + } + return NULL; +} + const char *jtag_tap_name(const jtag_tap_t *tap) { return (tap == NULL) ? "(unknown)" : tap->dotted_name; diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index 9ce73471..476409bb 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -180,36 +180,10 @@ 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); -static __inline__ jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p) -{ - if (p == NULL) - { - /* start at the head of list */ - p = jtag_all_taps(); - } - else - { - /* start *after* this one */ - p = p->next_tap; - } - while (p) - { - if (p->enabled) - { - break; - } - else - { - p = p->next_tap; - } - } - - return p; -} - enum reset_line_mode { LINE_OPEN_DRAIN = 0x0, |