summaryrefslogtreecommitdiff
path: root/src/jtag
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-03-13 10:14:41 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-03-13 10:14:41 +0000
commit7de7bc80fcca79e72c45040dc0ff3467e4b10dea (patch)
treee322b5dc09a96caca5e4d0d3a3391f3d6ef2c906 /src/jtag
parenta3dbb9cee672e4c3d5e526b6b2a847e78c06b637 (diff)
downloadopenocd+libswd-7de7bc80fcca79e72c45040dc0ff3467e4b10dea.tar.gz
openocd+libswd-7de7bc80fcca79e72c45040dc0ff3467e4b10dea.tar.bz2
openocd+libswd-7de7bc80fcca79e72c45040dc0ff3467e4b10dea.tar.xz
openocd+libswd-7de7bc80fcca79e72c45040dc0ff3467e4b10dea.zip
- adds two speeds to jtag_speed. reset and post reset speed. Default
is post reset = reset speed. - removed infinite loop's and exit()'s upon poor arm7/9 communication - cleaned up error messages a bit. Push ERROR() up into fn's that fail and can say something meaningful about what failed. git-svn-id: svn://svn.berlios.de/openocd/trunk@511 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/jtag')
-rw-r--r--src/jtag/jtag.c25
-rw-r--r--src/jtag/jtag.h1
2 files changed, 15 insertions, 11 deletions
diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c
index 2503a165..c2db331d 100644
--- a/src/jtag/jtag.c
+++ b/src/jtag/jtag.c
@@ -218,6 +218,7 @@ jtag_interface_t *jtag = NULL;
/* configuration */
jtag_interface_t *jtag_interface = NULL;
int jtag_speed = 0;
+int jtag_speed_post_reset = 0;
/* forward declarations */
@@ -1407,7 +1408,7 @@ int jtag_register_commands(struct command_context_s *cmd_ctx)
register_command(cmd_ctx, NULL, "interface", handle_interface_command,
COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "jtag_speed", handle_jtag_speed_command,
- COMMAND_ANY, "set jtag speed (if supported) <speed>");
+ COMMAND_ANY, "set jtag speed (if supported) <reset speed> [<post reset speed, default value is reset speed>]");
register_command(cmd_ctx, NULL, "jtag_device", handle_jtag_device_command,
COMMAND_CONFIG, "jtag_device <ir_length> <ir_expected> <ir_mask>");
register_command(cmd_ctx, NULL, "reset_config", handle_reset_config_command,
@@ -1695,17 +1696,19 @@ int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd
int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
- if (argc == 0)
- command_print(cmd_ctx, "jtag_speed: %i", jtag_speed);
+ int cur_speed = 0;
+ if ((argc<1) || (argc>2))
+ return ERROR_COMMAND_SYNTAX_ERROR;
- if (argc > 0)
- {
- jtag_speed = strtoul(args[0], NULL, 0);
- /* this command can be called during CONFIG,
- * in which case jtag isn't initialized */
- if (jtag)
- jtag->speed(jtag_speed);
- }
+ if (argc >= 1)
+ cur_speed = jtag_speed = jtag_speed_post_reset = strtoul(args[0], NULL, 0);
+ if (argc == 2)
+ cur_speed = jtag_speed_post_reset = strtoul(args[1], NULL, 0);
+
+ /* this command can be called during CONFIG,
+ * in which case jtag isn't initialized */
+ if (jtag)
+ jtag->speed(cur_speed);
return ERROR_OK;
}
diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index e14d388e..0e9a9302 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -222,6 +222,7 @@ extern enum tap_state end_state;
extern enum tap_state cur_state;
extern int jtag_speed;
+extern int jtag_speed_post_reset;
enum reset_types
{