From 7de7bc80fcca79e72c45040dc0ff3467e4b10dea Mon Sep 17 00:00:00 2001 From: oharboe Date: Thu, 13 Mar 2008 10:14:41 +0000 Subject: - 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 --- src/jtag/jtag.c | 25 ++++++++++++++----------- src/jtag/jtag.h | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) (limited to 'src/jtag') 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) "); + COMMAND_ANY, "set jtag speed (if supported) []"); register_command(cmd_ctx, NULL, "jtag_device", handle_jtag_device_command, COMMAND_CONFIG, "jtag_device "); 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 { -- cgit v1.2.3