/* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */
static int jtag_nsrst_delay = 0; /* default to no nSRST delay */
static int jtag_ntrst_delay = 0; /* default to no nTRST delay */
+static int jtag_nsrst_assert_width = 0; /* width of assertion */
+static int jtag_ntrst_assert_width = 0; /* width of assertion */
typedef struct jtag_event_callback_s
{
if (jtag_srst != new_srst) {
jtag_srst = new_srst;
if (jtag_srst)
+ {
LOG_DEBUG("SRST line asserted");
+ if (jtag_nsrst_assert_width)
+ jtag_add_sleep(jtag_nsrst_assert_width * 1000);
+ }
else {
LOG_DEBUG("SRST line released");
if (jtag_nsrst_delay)
if (jtag_trst) {
LOG_DEBUG("TRST line asserted");
tap_set_state(TAP_RESET);
+ if (jtag_ntrst_assert_width)
+ jtag_add_sleep(jtag_ntrst_assert_width * 1000);
} else {
LOG_DEBUG("TRST line released");
if (jtag_ntrst_delay)
{
return jtag_ntrst_delay;
}
+
+
+void jtag_set_nsrst_assert_width(unsigned delay)
+{
+ jtag_nsrst_assert_width = delay;
+}
+unsigned jtag_get_nsrst_assert_width(void)
+{
+ return jtag_nsrst_assert_width;
+}
+void jtag_set_ntrst_assert_width(unsigned delay)
+{
+ jtag_ntrst_assert_width = delay;
+}
+unsigned jtag_get_ntrst_assert_width(void)
+{
+ return jtag_ntrst_assert_width;
+}
static int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_jtag_nsrst_assert_width_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int handle_jtag_ntrst_assert_width_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
COMMAND_ANY, "jtag_nsrst_delay <ms> - delay after deasserting srst in ms");
register_command(cmd_ctx, NULL, "jtag_ntrst_delay", handle_jtag_ntrst_delay_command,
COMMAND_ANY, "jtag_ntrst_delay <ms> - delay after deasserting trst in ms");
+ register_command(cmd_ctx, NULL, "jtag_nsrst_assert_width", handle_jtag_nsrst_assert_width_command,
+ COMMAND_ANY, "jtag_nsrst_assert_width <ms> - delay after asserting srst in ms");
+ register_command(cmd_ctx, NULL, "jtag_ntrst_assert_width", handle_jtag_ntrst_assert_width_command,
+ COMMAND_ANY, "jtag_ntrst_assert_width <ms> - delay after asserting trst in ms");
register_command(cmd_ctx, NULL, "scan_chain", handle_scan_chain_command,
COMMAND_EXEC, "print current scan chain configuration");
return ERROR_OK;
}
+static int handle_jtag_nsrst_assert_width_command(struct command_context_s *cmd_ctx,
+ char *cmd, char **args, int argc)
+{
+ if (argc > 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ if (argc == 1)
+ {
+ unsigned delay;
+ int retval = parse_uint(args[0], &delay);
+ if (ERROR_OK != retval)
+ return retval;
+ jtag_set_nsrst_assert_width(delay);
+ }
+ command_print(cmd_ctx, "jtag_nsrst_assert_width: %u", jtag_get_nsrst_assert_width());
+ return ERROR_OK;
+}
+
+static int handle_jtag_ntrst_assert_width_command(struct command_context_s *cmd_ctx,
+ char *cmd, char **args, int argc)
+{
+ if (argc > 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ if (argc == 1)
+ {
+ unsigned delay;
+ int retval = parse_uint(args[0], &delay);
+ if (ERROR_OK != retval)
+ return retval;
+ jtag_set_ntrst_assert_width(delay);
+ }
+ command_print(cmd_ctx, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
+ return ERROR_OK;
+}
+
static int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int retval = ERROR_OK;