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>
This commit is contained in:
Tomas Vanek 2015-11-08 09:22:42 +01:00 committed by Spencer Oliver
parent 68f09deb4f
commit d5f82eea3d
1 changed files with 31 additions and 0 deletions

View File

@ -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
};