diff options
author | Tomas Vanek <vanekt@fbl.cz> | 2015-11-08 09:22:42 +0100 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2018-12-11 13:24:55 +0000 |
commit | d5f82eea3d8f5a467bcbe40b43bf2daf74896984 (patch) | |
tree | 76da0b1c13aad62d732a700bb65eca1a1bc08825 /src/jtag | |
parent | 68f09deb4f60e109d387cfb037e25a94be01e0eb (diff) | |
download | riscv-openocd-d5f82eea3d8f5a467bcbe40b43bf2daf74896984.zip riscv-openocd-d5f82eea3d8f5a467bcbe40b43bf2daf74896984.tar.gz riscv-openocd-d5f82eea3d8f5a467bcbe40b43bf2daf74896984.tar.bz2 |
jtag: cmsis-dap: developer tool - enter a command by hex nuber
Handy to test vendor commands in a CMSIS-DAP adapter.
Change-Id: Ieeaa276edf770b1a3076a186e9056b4e5180362a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/3103
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/jtag')
-rw-r--r-- | src/jtag/drivers/cmsis_dap_usb.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c index 035cc44..9d6bf7f 100644 --- a/src/jtag/drivers/cmsis_dap_usb.c +++ b/src/jtag/drivers/cmsis_dap_usb.c @@ -1670,6 +1670,30 @@ COMMAND_HANDLER(cmsis_dap_handle_info_command) return ERROR_OK; } +COMMAND_HANDLER(cmsis_dap_handle_cmd_command) +{ + int retval; + unsigned i; + uint8_t *buffer = cmsis_dap_handle->packet_buffer; + + buffer[0] = 0; /* report number */ + + for (i = 0; i < CMD_ARGC; i++) + buffer[i + 1] = strtoul(CMD_ARGV[i], NULL, 16); + + retval = cmsis_dap_usb_xfer(cmsis_dap_handle, CMD_ARGC + 1); + + if (retval != ERROR_OK) { + LOG_ERROR("CMSIS-DAP command failed."); + return ERROR_JTAG_DEVICE_ERROR; + } + + LOG_INFO("Returned data %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8, + buffer[1], buffer[2], buffer[3], buffer[4]); + + return ERROR_OK; +} + COMMAND_HANDLER(cmsis_dap_handle_vid_pid_command) { if (CMD_ARGC > MAX_USB_IDS * 2) { @@ -1729,6 +1753,13 @@ static const struct command_registration cmsis_dap_subcommand_handlers[] = { .usage = "", .help = "show cmsis-dap info", }, + { + .name = "cmd", + .handler = &cmsis_dap_handle_cmd_command, + .mode = COMMAND_EXEC, + .usage = "", + .help = "issue cmsis-dap command", + }, COMMAND_REGISTRATION_DONE }; |