]> git.sur5r.net Git - openocd/commitdiff
Improve encapsulation of JTAG event handling:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 9 Jun 2009 08:41:14 +0000 (08:41 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 9 Jun 2009 08:41:14 +0000 (08:41 +0000)
- 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

src/jtag/core.c
src/jtag/jtag.h
src/jtag/tcl.c

index d838e29b0b8320869728c7c823eca84bd8b6e0b5..d45fd67ee7515538c9eec187e20f610f5b37617c 100644 (file)
@@ -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;
index be6a055c21eedab6ea5461c67f93c33a171551a4..a4c0a08da25b96f01237fd8e5fc85dd32c2ee886 100644 (file)
@@ -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.
index 99ed1a3682e0def386f03a5ca5af7b542b7b6a9a..f26e934a4d52d74de48ea34004921b2027fc5864 100644 (file)
 #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;