I want to add a interface_mode command with only one parameter, default is
JTAG mode.
In configuration file, it will be as follow to use SWJ interface:
        interface_mode swj

in jtag_register_commands in tcl.c, add:
register_command(cmd_ctx, NULL, "interface_mode",
handle_interface_mode_command,
  COMMAND_ANY, "set debug interface mode [jtag|swj]");

And handle_interface_mode_command will be:
static int handle_interface_mode_command(struct command_context_s *cmd_ctx,
char *cmd, char **args, int argc)
{
 if (argc != 1)
  return ERROR_COMMAND_SYNTAX_ERROR;
 int retval = ERROR_OK;
 if (strcmp(*args, "jtag") == 0)
 {
  // jtag mode
  set_jtag_intarface();
 }
 else if (strcmp(*args, "swj") == 0)
 {
  // swj mode
  set_swj_intarface();
 }
 else
 {
  // mode not supported
  LOG_ERROR("%s is not supported.", *args);
  return ERROR_FAIL;
 }
 return ERROR_OK;
}

set_jtag_intarface and set_swj_interface will be implemented in core.c.
Is that OK?

-- 
Best Regards, SimonQian
http://www.SimonQian.com <http://www.simonqian.com/>
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to