From 7b2906de246bc37af99d432b3edf12e9f5f63521 Mon Sep 17 00:00:00 2001 From: Zachary T Welch Date: Sun, 29 Nov 2009 18:27:45 -0800 Subject: do not extern 'interp' from command.c Adds 'interp' field to command_context, chasing the few remaining references to the global variable outside of the command module. --- src/target/target.c | 11 +++++++---- src/target/target.h | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/target') diff --git a/src/target/target.c b/src/target/target.c index 42972582..31734b8f 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -449,12 +449,12 @@ int target_process_reset(struct command_context *cmd_ctx, enum target_reset_mode jtag_poll_set_enabled(false); sprintf(buf, "ocd_process_reset %s", n->name); - retval = Jim_Eval(interp, buf); + retval = Jim_Eval(cmd_ctx->interp, buf); jtag_poll_set_enabled(save_poll); if (retval != JIM_OK) { - Jim_PrintErrorMessage(interp); + Jim_PrintErrorMessage(cmd_ctx->interp); return ERROR_FAIL; } @@ -759,6 +759,8 @@ err_write_phys_memory(struct target *target, uint32_t address, return ERROR_FAIL; } +static int handle_target(void *priv); + int target_init(struct command_context *cmd_ctx) { struct target *target; @@ -876,7 +878,7 @@ int target_init(struct command_context *cmd_ctx) { if ((retval = target_register_user_commands(cmd_ctx)) != ERROR_OK) return retval; - if ((retval = target_register_timer_callback(handle_target, 100, 1, NULL)) != ERROR_OK) + if ((retval = target_register_timer_callback(&handle_target, 100, 1, cmd_ctx->interp)) != ERROR_OK) return retval; } @@ -1796,8 +1798,9 @@ static void target_call_event_callbacks_all(enum target_event e) { } /* process target state changes */ -int handle_target(void *priv) +static int handle_target(void *priv) { + Jim_Interp *interp = (Jim_Interp *)priv; int retval = ERROR_OK; /* we do not want to recurse here... */ diff --git a/src/target/target.h b/src/target/target.h index af4727ce..3e307142 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -251,7 +251,6 @@ int target_register_commands(struct command_context *cmd_ctx); int target_register_user_commands(struct command_context *cmd_ctx); int target_init(struct command_context *cmd_ctx); int target_examine(void); -int handle_target(void *priv); int target_process_reset(struct command_context *cmd_ctx, enum target_reset_mode reset_mode); -- cgit v1.2.3