]> git.sur5r.net Git - openocd/commitdiff
added t/nsrst_assert_width commands
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 29 Sep 2009 06:07:50 +0000 (06:07 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 29 Sep 2009 06:07:50 +0000 (06:07 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2768 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/jtag/core.c
src/jtag/jtag.h
src/jtag/tcl.c

index ff9f3e0ff3ad802b0776ae3c7b7367a0c708fff1..78f67db33b8306464454bfc075fe5ac42c872cf3 100644 (file)
@@ -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;
+}
index f716806b48c7330658203c62c232fa4ebcac6641..938d854bccc05debb1155e421f14a9d6d5d604b8 100644 (file)
@@ -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.
index aa32085b0f22104d56387ad48dd89f49c344d3df..53c19e1a1b1feb6e324a3ae2a9d7961618443722 100644 (file)
@@ -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;