summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-09 08:41:14 +0000
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-09 08:41:14 +0000
commita485ded4bff2a4fafbcaf3c1094060b172d2af8d (patch)
tree90a5f97f10f3fcfe33b4f3c443b9e075eace799f
parenta2d18e9111d3bd9a504e15b16a5d8b4bdbded29b (diff)
downloadopenocd+libswd-a485ded4bff2a4fafbcaf3c1094060b172d2af8d.tar.gz
openocd+libswd-a485ded4bff2a4fafbcaf3c1094060b172d2af8d.tar.bz2
openocd+libswd-a485ded4bff2a4fafbcaf3c1094060b172d2af8d.tar.xz
openocd+libswd-a485ded4bff2a4fafbcaf3c1094060b172d2af8d.zip
Improve encapsulation of JTAG event handling:
- Move nvp_jtag_tap_event and jtag_tap_handle_event to tcl.c. - Change both to be static; remove declaration of function from jtag.h. git-svn-id: svn://svn.berlios.de/openocd/trunk@2166 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/jtag/core.c38
-rw-r--r--src/jtag/jtag.h2
-rw-r--r--src/jtag/tcl.c39
3 files changed, 38 insertions, 41 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c
index d838e29b..d45fd67e 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -63,13 +63,6 @@ static char* jtag_event_strings[] =
"JTAG controller reset (RESET or TRST)"
};
-const Jim_Nvp nvp_jtag_tap_event[] = {
- { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
- { .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
-
- { .name = NULL, .value = -1 }
-};
-
static int jtag_trst = 0;
static int jtag_srst = 0;
@@ -1222,37 +1215,6 @@ int jtag_srst_asserted(int *srst_asserted)
return jtag->srst_asserted(srst_asserted);
}
-void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e)
-{
- jtag_tap_event_action_t * jteap;
- int done;
-
- jteap = tap->event_action;
-
- done = 0;
- while (jteap) {
- if (jteap->event == e) {
- done = 1;
- LOG_DEBUG( "JTAG tap: %s event: %d (%s) action: %s\n",
- tap->dotted_name,
- e,
- Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e)->name,
- Jim_GetString(jteap->body, NULL) );
- if (Jim_EvalObj(interp, jteap->body) != JIM_OK) {
- Jim_PrintErrorMessage(interp);
- }
- }
-
- jteap = jteap->next;
- }
-
- if (!done) {
- LOG_DEBUG( "event %d %s - no action",
- e,
- Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name);
- }
-}
-
int jtag_add_statemove(tap_state_t goal_state)
{
tap_state_t cur_state = cmd_queue_cur_state;
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index be6a055c..a4c0a08d 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -611,8 +611,6 @@ extern void jtag_sleep(u32 us);
extern int jtag_call_event_callbacks(enum jtag_event event);
extern int jtag_register_event_callback(int (* callback)(enum jtag_event event, void* priv), void* priv);
-void jtag_tap_handle_event(jtag_tap_t* tap, enum jtag_tap_event e);
-
/*
* The JTAG subsystem defines a number of error codes,
* using codes between -100 and -199.
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 99ed1a36..f26e934a 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -39,7 +39,12 @@
#include <strings.h>
#endif
-extern const Jim_Nvp nvp_jtag_tap_event[];
+static const Jim_Nvp nvp_jtag_tap_event[] = {
+ { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
+ { .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
+
+ { .name = NULL, .value = -1 }
+};
/* jtag interfaces (parport, FTDI-USB, TI-USB, ...)
*/
@@ -443,6 +448,38 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi )
return JIM_ERR;
}
+static void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e)
+{
+ jtag_tap_event_action_t * jteap;
+ int done;
+
+ jteap = tap->event_action;
+
+ done = 0;
+ while (jteap) {
+ if (jteap->event == e) {
+ done = 1;
+ LOG_DEBUG( "JTAG tap: %s event: %d (%s) action: %s\n",
+ tap->dotted_name,
+ e,
+ Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e)->name,
+ Jim_GetString(jteap->body, NULL) );
+ if (Jim_EvalObj(interp, jteap->body) != JIM_OK) {
+ Jim_PrintErrorMessage(interp);
+ }
+ }
+
+ jteap = jteap->next;
+ }
+
+ if (!done) {
+ LOG_DEBUG( "event %d %s - no action",
+ e,
+ Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name);
+ }
+}
+
+
static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
{
Jim_GetOptInfo goi;