]> git.sur5r.net Git - openocd/commitdiff
Cleanup and encapsulate IR Capture verification:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 9 Jun 2009 08:41:00 +0000 (08:41 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 9 Jun 2009 08:41:00 +0000 (08:41 +0000)
- Add accessors for setting the jtag_verify_capture_ir flag.
- Use them in handle_verify_ircapture_cpmmand
- Change variable type to bool; make it static.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2164 b42882b7-edfa-0310-969c-e2dbd0fdcd60

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

index 4c393dc2ed8ea8203e2b172833add3e86f90d721..165e19662b278136df7733fbab005a8d5320d4f8 100644 (file)
@@ -87,7 +87,7 @@ static enum reset_types jtag_reset_config = RESET_NONE;
 static tap_state_t cmd_queue_end_state = TAP_RESET;
 tap_state_t cmd_queue_cur_state = TAP_RESET;
 
-int jtag_verify_capture_ir = 1;
+static bool jtag_verify_capture_ir = true;
 static int jtag_verify = 1;
 
 /* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */
@@ -1201,6 +1201,15 @@ bool jtag_will_verify()
        return jtag_verify;
 }
 
+void jtag_set_verify_capture_ir(bool enable)
+{
+       jtag_verify_capture_ir = enable;
+}
+
+bool jtag_will_verify_capture_ir()
+{
+       return jtag_verify_capture_ir;
+}
 
 int jtag_power_dropout(int *dropout)
 {
index d7698ac7589734cd09c14d3ca4b51d2626aca1d5..be6a055c21eedab6ea5461c67f93c33a171551a4 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);
 
-extern int jtag_verify_capture_ir;
-
 void jtag_tap_handle_event(jtag_tap_t* tap, enum jtag_tap_event e);
 
 /*
@@ -708,4 +706,7 @@ unsigned jtag_get_speed_khz(void);
 void jtag_set_verify(bool enable);
 bool jtag_will_verify(void);
 
+void jtag_set_verify_capture_ir(bool enable);
+bool jtag_will_verify_capture_ir(void);
+
 #endif /* JTAG_H */
index 121c19abca4b698783716d096c0fd266777848f0..1ec307abf1b477536fb65b9b81e5bfe21ebfe0c2 100644 (file)
@@ -1304,25 +1304,21 @@ static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const
 
 static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
 {
+       if (argc > 1)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
        if (argc == 1)
        {
                if (strcmp(args[0], "enable") == 0)
-               {
-                       jtag_verify_capture_ir = 1;
-               }
+                       jtag_set_verify_capture_ir(true);
                else if (strcmp(args[0], "disable") == 0)
-               {
-                       jtag_verify_capture_ir = 0;
-               } else
-               {
+                       jtag_set_verify_capture_ir(false);
+               else
                        return ERROR_COMMAND_SYNTAX_ERROR;
-               }
-       } else if (argc != 0)
-       {
-               return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
-       command_print(cmd_ctx, "verify Capture-IR is %s", (jtag_verify_capture_ir) ? "enabled": "disabled");
+       const char *status = jtag_will_verify_capture_ir() ? "enabled": "disabled";
+       command_print(cmd_ctx, "verify Capture-IR is %s", status);
 
        return ERROR_OK;
 }