summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-29 06:07:50 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-29 06:07:50 +0000
commitc5949a03a7a6cff4d4c209e81736bcb7548a6e88 (patch)
tree01c0fb97cd0fd42c9a1254aa2c97865c7097bcf8 /src
parente3a0647558e4377e633a20d12c386286a927049a (diff)
downloadopenocd+libswd-c5949a03a7a6cff4d4c209e81736bcb7548a6e88.tar.gz
openocd+libswd-c5949a03a7a6cff4d4c209e81736bcb7548a6e88.tar.bz2
openocd+libswd-c5949a03a7a6cff4d4c209e81736bcb7548a6e88.tar.xz
openocd+libswd-c5949a03a7a6cff4d4c209e81736bcb7548a6e88.zip
added t/nsrst_assert_width commands
git-svn-id: svn://svn.berlios.de/openocd/trunk@2768 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/jtag/core.c26
-rw-r--r--src/jtag/jtag.h6
-rw-r--r--src/jtag/tcl.c40
3 files changed, 72 insertions, 0 deletions
diff --git a/src/jtag/core.c b/src/jtag/core.c
index ff9f3e0f..78f67db3 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -93,6 +93,8 @@ static int jtag_verify = 1;
/* 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
{
@@ -661,7 +663,11 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
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)
@@ -685,6 +691,8 @@ void jtag_add_reset(int req_tlr_or_trst, int req_srst)
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)
@@ -1480,3 +1488,21 @@ unsigned jtag_get_ntrst_delay(void)
{
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;
+}
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index f716806b..938d854b 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -289,6 +289,12 @@ unsigned jtag_get_nsrst_delay(void);
void jtag_set_ntrst_delay(unsigned delay);
unsigned jtag_get_ntrst_delay(void);
+void jtag_set_nsrst_assert_width(unsigned delay);
+unsigned jtag_get_nsrst_assert_width(void);
+
+void jtag_set_ntrst_assert_width(unsigned delay);
+unsigned jtag_get_ntrst_assert_width(void);
+
/// @returns The current state of TRST.
int jtag_get_trst(void);
/// @returns The current state of SRST.
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index aa32085b..53c19e1a 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -61,6 +61,8 @@ static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *c
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);
@@ -619,6 +621,10 @@ int jtag_register_commands(struct command_context_s *cmd_ctx)
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");
@@ -979,6 +985,40 @@ static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx,
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;