diff options
author | Zachary T Welch <zw@superlucidity.net> | 2009-11-29 18:27:45 -0800 |
---|---|---|
committer | Zachary T Welch <zw@superlucidity.net> | 2009-11-30 16:29:34 -0800 |
commit | 7b2906de246bc37af99d432b3edf12e9f5f63521 (patch) | |
tree | 90fd60bb7ac07e23e61a74a6f67a6ea80d06e7f5 /src/target | |
parent | 8e8a359af2a5ab3cc7c795e147aa0ca3ec06288f (diff) | |
download | openocd_libswd-7b2906de246bc37af99d432b3edf12e9f5f63521.tar.gz openocd_libswd-7b2906de246bc37af99d432b3edf12e9f5f63521.tar.bz2 openocd_libswd-7b2906de246bc37af99d432b3edf12e9f5f63521.tar.xz openocd_libswd-7b2906de246bc37af99d432b3edf12e9f5f63521.zip |
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.
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/target.c | 11 | ||||
-rw-r--r-- | src/target/target.h | 1 |
2 files changed, 7 insertions, 5 deletions
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); |