Fixes regression in interface command registration. master branch currently fails to build with --enable-minidriver-dummy (and other interfaces).
-- Øyvind Harboe US toll free 1-866-980-3434 / International +47 51 63 25 00 http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and flash programmer
From 6917bc8b9feab21fbbf98c897b13bf960c4f1bcf Mon Sep 17 00:00:00 2001 From: =?utf-8?q?=C3=98yvind=20Harboe?= <oyvind.har...@zylin.com> Date: Fri, 27 Nov 2009 19:36:40 +0100 Subject: [PATCH] interface: interfaces can use a callback or a static array MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit A static array is convenient when it's just a list of classic style OpenOCD commands, otherwise a callback is much more flexible of course. Signed-off-by: Øyvind Harboe <oyvind.har...@zylin.com> --- src/jtag/interface.h | 8 ++++++++ src/jtag/tcl.c | 7 +++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/jtag/interface.h b/src/jtag/interface.h index d55782a..99ba74f 100644 --- a/src/jtag/interface.h +++ b/src/jtag/interface.h @@ -204,6 +204,14 @@ struct jtag_interface { /** * The interface driver may register additional commands to expose * additional features not covered by the standard command set. + * @param cmd_ctx The context in which commands should be registered. + * @returns ERROR_OK on success, or an error code on failure. + */ + int (*register_commands)(struct command_context* cmd_ctx); + + /** + * The interface driver may register additional commands to expose + * additional features not covered by the standard command set. */ const struct command_registration *commands; diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index e755dd7..57b706c 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -636,6 +636,13 @@ COMMAND_HANDLER(handle_interface_command) if (strcmp(CMD_ARGV[0], jtag_interfaces[i]->name) != 0) continue; + if (NULL != jtag_interfaces[i]->register_commands) + { + int retval = jtag_interfaces[i]->register_commands(CMD_CTX); + if (ERROR_OK != retval) + return retval; + } + if (NULL != jtag_interfaces[i]->commands) { int retval = register_commands(CMD_CTX, NULL, -- 1.6.3.3
_______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development