diff options
author | Paul Fertser <fercerpav@gmail.com> | 2014-08-19 21:16:20 +0400 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2014-10-06 12:03:30 +0000 |
commit | 1f6a66ab7fca983a3cffd4070c42ae965d0fc6cb (patch) | |
tree | ca0a13925736a97bca9fa17c2514e70a743ce4b7 /src/jtag | |
parent | 44394c2a77f68785e2ec87e2245d0f1624086682 (diff) |
hla: add a way to pass arbitrary commands from user to layout and use for ICDI
TI's ICDI adapter supports some additional commands which a user might
want to run for debugging or other purposes, the most useful of them
being "debug unlock" that fully mass-erases the device and unprotects
the flash.
Change-Id: I26990e736094367f92106fa891e9bb8fb0382efb
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2263
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/drivers/ti_icdi_usb.c | 1 | ||||
-rw-r--r-- | src/jtag/hla/hla_interface.c | 22 | ||||
-rw-r--r-- | src/jtag/hla/hla_layout.h | 2 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/jtag/drivers/ti_icdi_usb.c b/src/jtag/drivers/ti_icdi_usb.c index 2f4af7a4..53abbfb4 100644 --- a/src/jtag/drivers/ti_icdi_usb.c +++ b/src/jtag/drivers/ti_icdi_usb.c @@ -777,4 +777,5 @@ struct hl_layout_api_s icdi_usb_layout_api = { .write_mem = icdi_usb_write_mem, .write_debug_reg = icdi_usb_write_debug_reg, .override_target = icdi_usb_override_target, + .custom_command = icdi_send_remote_cmd, }; diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c index 964b0744..ce914ea0 100644 --- a/src/jtag/hla/hla_interface.c +++ b/src/jtag/hla/hla_interface.c @@ -268,6 +268,21 @@ COMMAND_HANDLER(interface_handle_trace_command) return ERROR_OK; } +COMMAND_HANDLER(interface_handle_hla_command) +{ + if (CMD_ARGC != 1) + return ERROR_COMMAND_SYNTAX_ERROR; + + if (!hl_if.layout->api->custom_command) { + LOG_ERROR("The selected adapter doesn't support custom commands"); + return ERROR_FAIL; + } + + hl_if.layout->api->custom_command(hl_if.handle, CMD_ARGV[0]); + + return ERROR_OK; +} + static const struct command_registration hl_interface_command_handlers[] = { { .name = "hla_device_desc", @@ -304,6 +319,13 @@ static const struct command_registration hl_interface_command_handlers[] = { .help = "configure trace reception", .usage = "source_lock_hz [destination_path]", }, + { + .name = "hla_command", + .handler = &interface_handle_hla_command, + .mode = COMMAND_EXEC, + .help = "execute a custom adapter-specific command", + .usage = "hla_command <command>", + }, COMMAND_REGISTRATION_DONE }; diff --git a/src/jtag/hla/hla_layout.h b/src/jtag/hla/hla_layout.h index 6d79d581..df93cb69 100644 --- a/src/jtag/hla/hla_layout.h +++ b/src/jtag/hla/hla_layout.h @@ -76,6 +76,8 @@ struct hl_layout_api_s { /** */ int (*override_target) (const char *targetname); /** */ + int (*custom_command) (void *handle, const char *command); + /** */ enum target_state (*state) (void *fd); }; |