From: Zachary T Welch Date: Fri, 4 Dec 2009 00:25:51 +0000 (-0800) Subject: separate Jim from jtag/core.c X-Git-Tag: v0.4.0-rc1~128 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=79a73a786ee0f95b49d86abbdea1e985049c5b1f;p=openocd separate Jim from jtag/core.c After previous efforts, only one Jim routine remained in jtag/core.c, and moving it to jtag/tcl.c painlessly finishes separating these layers. The headers need separating, but the implementation is clean. --- diff --git a/src/jtag/core.c b/src/jtag/core.c index 9230cc2b..433b50bf 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -244,17 +244,6 @@ struct jtag_tap *jtag_tap_by_string(const char *s) return t; } -struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o) -{ - const char *cp = Jim_GetString(o, NULL); - struct jtag_tap *t = cp ? jtag_tap_by_string(cp) : NULL; - if (NULL == cp) - cp = "(unknown)"; - if (NULL == t) - Jim_SetResult_sprintf(interp, "Tap '%s' could not be found", cp); - return t; -} - struct jtag_tap* jtag_tap_next_enabled(struct jtag_tap* p) { p = p ? p->next_tap : jtag_all_taps(); diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 81bafbb6..9704c302 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -51,6 +51,17 @@ static const Jim_Nvp nvp_jtag_tap_event[] = { extern struct jtag_interface *jtag_interface; +struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o) +{ + const char *cp = Jim_GetString(o, NULL); + struct jtag_tap *t = cp ? jtag_tap_by_string(cp) : NULL; + if (NULL == cp) + cp = "(unknown)"; + if (NULL == t) + Jim_SetResult_sprintf(interp, "Tap '%s' could not be found", cp); + return t; +} + static bool scan_is_safe(tap_state_t state) { switch (state)