You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(37) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Zach W. <zw...@us...> - 2009-11-11 23:03:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 158698e3331b446243b863ab8b58ebee2c56f0cc (commit) via 46d9ba4c8b675deb96ac533885500eb62b6c9909 (commit) via a1a3ee579ca8485f7840c7140e4a006f83b797d2 (commit) via 2d3cc1eac126990c5cd4ca8a47b0c09814dc1e5c (commit) via f93c98081f58f1487d518356a05edf219b0237c3 (commit) from 2821115ab8c501e1db660df1fc18621847226d09 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 158698e3331b446243b863ab8b58ebee2c56f0cc Author: Zachary T Welch <zw...@su...> Date: Wed Nov 11 10:20:55 2009 -0800 improve command registration Eliminate duplicate code for linking commands into a list. Adds a check to ensure the command does not already exist; if it does, return that one instead of creating a duplicate. diff --git a/src/helper/command.c b/src/helper/command.c index 5ac5c30..f960127 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -191,13 +191,53 @@ static void command_helptext_add(Jim_Obj *cmd_list, const char *help) /* nice short description of source file */ #define __THIS__FILE__ "command.c" -command_t* register_command(command_context_t *context, command_t *parent, char *name, int (*handler)(struct command_context_s *context, char* name, char** args, int argc), enum command_mode mode, char *help) +/** + * Find a command by name from a list of commands. + * @returns The named command if found, or NULL. + */ +static struct command_s *command_find(struct command_s **head, const char *name) +{ + assert(head); + for (struct command_s *cc = *head; cc; cc = cc->next) + { + if (strcmp(cc->name, name) == 0) + return cc; + } + return NULL; +} + +/** + * Add the command to the end of linked list. + * @returns Returns false if the named command already exists in the list. + * Returns true otherwise. + */ +static void command_add_child(struct command_s **head, struct command_s *c) { - command_t *c, *p; + assert(head); + if (NULL == *head) + { + *head = c; + return; + } + struct command_s *cc = *head; + while (cc->next) cc = cc->next; + cc->next = c; +} +command_t* register_command(command_context_t *context, + command_t *parent, char *name, + int (*handler)(struct command_context_s *context, + char* name, char** args, int argc), + enum command_mode mode, char *help) +{ if (!context || !name) return NULL; + struct command_s **head = parent ? &parent->children : &context->commands; + struct command_s *c = command_find(head, name); + if (NULL != c) + return c; + c = malloc(sizeof(command_t)); c->name = strdup(name); @@ -207,35 +247,7 @@ command_t* register_command(command_context_t *context, command_t *parent, char c->mode = mode; c->next = NULL; - /* place command in tree */ - if (parent) - { - if (parent->children) - { - /* find last child */ - for (p = parent->children; p && p->next; p = p->next); - if (p) - p->next = c; - } - else - { - parent->children = c; - } - } - else - { - if (context->commands) - { - /* find last command */ - for (p = context->commands; p && p->next; p = p->next); - if (p) - p->next = c; - } - else - { - context->commands = c; - } - } + command_add_child(head, c); command_helptext_add(command_name_list(c), help); commit 46d9ba4c8b675deb96ac533885500eb62b6c9909 Author: Zachary T Welch <zw...@su...> Date: Wed Nov 11 09:40:28 2009 -0800 add help regardless of callback Add help for commands regardless of whether a handler is involved. With this, all sorts of new commands can be found in 'help' text. Hopefully, all of them have been documented.... Sadly, the lsort function appears to handle nested lists poorly, such that sub-commands do not group with their parents. diff --git a/src/helper/command.c b/src/helper/command.c index a4ac4af..5ac5c30 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -237,6 +237,8 @@ command_t* register_command(command_context_t *context, command_t *parent, char } } + command_helptext_add(command_name_list(c), help); + /* just a placeholder, no handler */ if (c->handler == NULL) return c; @@ -257,8 +259,6 @@ command_t* register_command(command_context_t *context, command_t *parent, char free((void *)full_name); - command_helptext_add(command_name_list(c), help); - return c; } commit a1a3ee579ca8485f7840c7140e4a006f83b797d2 Author: Zachary T Welch <zw...@su...> Date: Wed Nov 11 08:20:09 2009 -0800 eliminate duplicate helptext management Add helpers to manage adding entries to the helptext list. Adds support for arbitrarily nested commands. diff --git a/src/helper/command.c b/src/helper/command.c index 86158d7..a4ac4af 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -162,6 +162,32 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return (retval == ERROR_OK)?JIM_OK:JIM_ERR; } +static Jim_Obj *command_name_list(struct command_s *c) +{ + Jim_Obj *cmd_list = c->parent ? + command_name_list(c->parent) : + Jim_NewListObj(interp, NULL, 0); + Jim_ListAppendElement(interp, cmd_list, + Jim_NewStringObj(interp, c->name, -1)); + + return cmd_list; +} + +static void command_helptext_add(Jim_Obj *cmd_list, const char *help) +{ + Jim_Obj *cmd_entry = Jim_NewListObj(interp, NULL, 0); + Jim_ListAppendElement(interp, cmd_entry, cmd_list); + Jim_ListAppendElement(interp, cmd_entry, + Jim_NewStringObj(interp, help ? : "", -1)); + + /* accumulate help text in Tcl helptext list. */ + Jim_Obj *helptext = Jim_GetGlobalVariableStr(interp, + "ocd_helptext", JIM_ERRMSG); + if (Jim_IsShared(helptext)) + helptext = Jim_DuplicateObj(interp, helptext); + Jim_ListAppendElement(interp, helptext, cmd_entry); +} + /* nice short description of source file */ #define __THIS__FILE__ "command.c" @@ -179,8 +205,6 @@ command_t* register_command(command_context_t *context, command_t *parent, char c->children = NULL; c->handler = handler; c->mode = mode; - if (!help) - help=""; c->next = NULL; /* place command in tree */ @@ -233,24 +257,8 @@ command_t* register_command(command_context_t *context, command_t *parent, char free((void *)full_name); - /* accumulate help text in Tcl helptext list. */ - Jim_Obj *helptext = Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); - if (Jim_IsShared(helptext)) - helptext = Jim_DuplicateObj(interp, helptext); - Jim_Obj *cmd_entry = Jim_NewListObj(interp, NULL, 0); - - Jim_Obj *cmd_list = Jim_NewListObj(interp, NULL, 0); - - /* maximum of two levels :-) */ - if (c->parent != NULL) - { - Jim_ListAppendElement(interp, cmd_list, Jim_NewStringObj(interp, c->parent->name, -1)); - } - Jim_ListAppendElement(interp, cmd_list, Jim_NewStringObj(interp, c->name, -1)); + command_helptext_add(command_name_list(c), help); - Jim_ListAppendElement(interp, cmd_entry, cmd_list); - Jim_ListAppendElement(interp, cmd_entry, Jim_NewStringObj(interp, help, -1)); - Jim_ListAppendElement(interp, helptext, cmd_entry); return c; } @@ -851,20 +859,11 @@ void register_jim(struct command_context_s *cmd_ctx, const char *name, int (*cmd { Jim_CreateCommand(interp, name, cmd, NULL, NULL); - /* FIX!!! it would be prettier to invoke add_help_text... - * accumulate help text in Tcl helptext list. */ - Jim_Obj *helptext = Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); - if (Jim_IsShared(helptext)) - helptext = Jim_DuplicateObj(interp, helptext); - - Jim_Obj *cmd_entry = Jim_NewListObj(interp, NULL, 0); - Jim_Obj *cmd_list = Jim_NewListObj(interp, NULL, 0); - Jim_ListAppendElement(interp, cmd_list, Jim_NewStringObj(interp, name, -1)); + Jim_ListAppendElement(interp, cmd_list, + Jim_NewStringObj(interp, name, -1)); - Jim_ListAppendElement(interp, cmd_entry, cmd_list); - Jim_ListAppendElement(interp, cmd_entry, Jim_NewStringObj(interp, help, -1)); - Jim_ListAppendElement(interp, helptext, cmd_entry); + command_helptext_add(cmd_list, help); } /* return global variable long value or 0 upon failure */ commit 2d3cc1eac126990c5cd4ca8a47b0c09814dc1e5c Author: Zachary T Welch <zw...@su...> Date: Wed Nov 11 05:26:17 2009 -0800 add command_name helper The command_name function returns a malloced string for a given command and its parents. This can be used to display a message to the user, but it is used internally to handle registration and syntax errors. This helps permit arbitrary command nesting. diff --git a/src/helper/command.c b/src/helper/command.c index c632702..86158d7 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -217,32 +217,22 @@ command_t* register_command(command_context_t *context, command_t *parent, char if (c->handler == NULL) return c; - /* If this is a two level command, e.g. "flash banks", then the - * "unknown" proc in startup.tcl must redirect to this command. - * - * "flash banks" is translated by "unknown" to "flash_banks" - * if such a proc exists - */ - /* Print help for command */ - const char *t1=""; - const char *t2=""; - const char *t3=""; - /* maximum of two levels :-) */ - if (c->parent != NULL) - { - t1 = c->parent->name; - t2="_"; - } - t3 = c->name; - const char *full_name = alloc_printf("ocd_%s%s%s", t1, t2, t3); - Jim_CreateCommand(interp, full_name, script_command, c, NULL); - free((void *)full_name); + const char *full_name = command_name(c, '_'); + + const char *ocd_name = alloc_printf("ocd_%s", full_name); + Jim_CreateCommand(interp, ocd_name, script_command, c, NULL); + free((void *)ocd_name); /* we now need to add an overrideable proc */ - const char *override_name = alloc_printf("proc %s%s%s {args} {if {[catch {eval ocd_%s%s%s $args}]==0} {return \"\"} else { return -code error }", t1, t2, t3, t1, t2, t3); + const char *override_name = alloc_printf("proc %s {args} {" + "if {[catch {eval ocd_%s $args}] == 0} " + "{return \"\"} else {return -code error}}", + full_name, full_name); Jim_Eval_Named(interp, override_name, __THIS__FILE__, __LINE__); free((void *)override_name); + free((void *)full_name); + /* accumulate help text in Tcl helptext list. */ Jim_Obj *helptext = Jim_GetGlobalVariableStr(interp, "ocd_helptext", JIM_ERRMSG); if (Jim_IsShared(helptext)) @@ -404,6 +394,28 @@ void command_print(command_context_t *context, const char *format, ...) va_end(ap); } +static char *__command_name(struct command_s *c, char delim, unsigned extra) +{ + char *name; + unsigned len = strlen(c->name); + if (NULL == c->parent) { + // allocate enough for the name, child names, and '\0' + name = malloc(len + extra + 1); + strcpy(name, c->name); + } else { + // parent's extra must include both the space and name + name = __command_name(c->parent, delim, 1 + len + extra); + char dstr[2] = { delim, 0 }; + strcat(name, dstr); + strcat(name, c->name); + } + return name; +} +char *command_name(struct command_s *c, char delim) +{ + return __command_name(c, delim, 0); +} + static int run_command(command_context_t *context, command_t *c, char *words[], unsigned num_words) { @@ -419,17 +431,12 @@ static int run_command(command_context_t *context, if (retval == ERROR_COMMAND_SYNTAX_ERROR) { /* Print help for command */ - const char *t1=""; - const char *t2=""; - const char *t3=""; - /* maximum of two levels :-) */ - if (c->parent != NULL) - { - t1 = c->parent->name; - t2=" "; - } - t3 = c->name; - command_run_linef(context, "help {%s%s%s}", t1, t2, t3); + char *full_name = command_name(c, ' '); + if (NULL != full_name) { + command_run_linef(context, "help %s", full_name); + free(full_name); + } else + retval = -ENOMEM; } else if (retval == ERROR_COMMAND_CLOSE_CONNECTION) { diff --git a/src/helper/command.h b/src/helper/command.h index 0b86b88..732fa52 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -84,6 +84,16 @@ typedef struct command_s struct command_s *next; } command_t; +/** + * @param c The command to be named. + * @param delim The character to place between command names. + * @returns A malloc'd string containing the full command name, + * which may include one or more ancestor components. Multiple names + * are separated by single spaces. The caller must free() the string + * when done with it. + */ +char *command_name(struct command_s *c, char delim); + command_t* register_command(command_context_t *context, command_t *parent, char *name, int (*handler)(struct command_context_s *context, commit f93c98081f58f1487d518356a05edf219b0237c3 Author: Zachary T Welch <zw...@su...> Date: Wed Nov 11 07:19:13 2009 -0800 wrap help command Use continuation characters to wrap the help command into 80 columns. diff --git a/src/helper/startup.tcl b/src/helper/startup.tcl index 2c90972..73c4cf1 100644 --- a/src/helper/startup.tcl +++ b/src/helper/startup.tcl @@ -49,7 +49,10 @@ proc help {args} { global ocd_helptext set cmd $args foreach a [lsort $ocd_helptext] { - if {[string length $cmd]==0||[string first $cmd $a]!=-1||[string first $cmd [lindex $a 1]]!=-1} { + if {[string length $cmd] == 0 || \ + [string first $cmd $a] != -1 || \ + [string first $cmd [lindex $a 1]] != -1} \ + { set w 50 set cmdname [lindex $a 0] set h [lindex $a 1] @@ -57,19 +60,24 @@ proc help {args} { while 1 { if {$n > [string length $h]} {break} - set next_a [expr $n+$w] - if {[string length $h]>$n+$w} { - set xxxx [string range $h $n [expr $n+$w]] - for {set lastpos [expr [string length $xxxx]-1]} {$lastpos>=0&&[string compare [string range $xxxx $lastpos $lastpos] " "]!=0} {set lastpos [expr $lastpos-1]} { + set next_a [expr $n + $w] + if {[string length $h] > $n + $w} \ + { + set xxxx [string range $h $n [expr $n + $w]] + for {set lastpos [expr [string length $xxxx] - 1]} \ + {$lastpos >= 0 && [string compare \ + [string range $xxxx $lastpos $lastpos] " "] != 0} \ + {set lastpos [expr $lastpos - 1]} \ + { } #set next_a -1 - if {$lastpos!=-1} { - set next_a [expr $lastpos+$n+1] + if {$lastpos != -1} { + set next_a [expr $lastpos + $n + 1] } } - - puts [format "%-25s %s" $cmdname [string range $h $n [expr $next_a-1]] ] + puts [format "%-25s %s" $cmdname \ + [string range $h $n [expr $next_a-1]] ] set cmdname "" set n [expr $next_a] } ----------------------------------------------------------------------- Summary of changes: src/helper/command.c | 206 ++++++++++++++++++++++++++---------------------- src/helper/command.h | 10 +++ src/helper/startup.tcl | 26 ++++-- 3 files changed, 139 insertions(+), 103 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-11 13:43:08
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d796ce0e4d17e8a140ad0efa8c63c828ca185455 (commit) from 583a293a326bcb4b7438871d492cd85c143e3fa1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d796ce0e4d17e8a140ad0efa8c63c828ca185455 Author: David Brownell <dbr...@us...> Date: Wed Nov 11 04:42:50 2009 -0800 ETM cleanup Various cleanups of ETM related code. - Saner error return paths - Simplify arm7_9 init ... no need for extra zeroing! - Shrink some lines - Tweak some diagnostics - Use shorter name for ETM struct type. - Don't exit() and similar. The diagnostics look forward to having this ETM code work with more than just ARM7/ARM9. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index a3c6a56..b6606a1 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -3098,50 +3098,25 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9) arm7_9->common_magic = ARM7_9_COMMON_MAGIC; if ((retval = arm_jtag_setup_connection(&arm7_9->jtag_info)) != ERROR_OK) - { return retval; - } - arm7_9->wp_available = 0; /* this is set up in arm7_9_clear_watchpoints() */ - arm7_9->wp_available_max = 2; - arm7_9->sw_breakpoints_added = 0; - arm7_9->sw_breakpoint_count = 0; - arm7_9->breakpoint_count = 0; - arm7_9->wp0_used = 0; - arm7_9->wp1_used = 0; - arm7_9->wp1_used_default = 0; - arm7_9->use_dbgrq = 0; - - arm7_9->etm_ctx = NULL; - arm7_9->has_single_step = 0; - arm7_9->has_monitor_mode = 0; - arm7_9->has_vector_catch = 0; + /* caller must have allocated via calloc(), so everything's zeroed */ - arm7_9->debug_entry_from_reset = 0; - - arm7_9->dcc_working_area = NULL; + arm7_9->wp_available_max = 2; arm7_9->fast_memory_access = fast_and_dangerous; arm7_9->dcc_downloads = fast_and_dangerous; - arm7_9->need_bypass_before_restart = 0; - armv4_5->arch_info = arm7_9; armv4_5->read_core_reg = arm7_9_read_core_reg; armv4_5->write_core_reg = arm7_9_write_core_reg; armv4_5->full_context = arm7_9_full_context; if ((retval = armv4_5_init_arch_info(target, armv4_5)) != ERROR_OK) - { - return retval; - } - - if ((retval = target_register_timer_callback(arm7_9_handle_target_request, 1, 1, target)) != ERROR_OK) - { return retval; - } - return ERROR_OK; + return target_register_timer_callback(arm7_9_handle_target_request, + 1, 1, target); } int arm7_9_register_commands(struct command_context_s *cmd_ctx) diff --git a/src/target/etb.h b/src/target/etb.h index cc58b65..da9c9b3 100644 --- a/src/target/etb.h +++ b/src/target/etb.h @@ -20,8 +20,6 @@ #ifndef ETB_H #define ETB_H -#include "etm.h" - /* ETB registers */ enum { diff --git a/src/target/etm.c b/src/target/etm.c index 21087b2..b571809 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -670,12 +670,12 @@ static int etm_read_instruction(etm_context_t *ctx, arm_instruction_t *instructi else if (ctx->core_state == ARMV4_5_STATE_JAZELLE) { LOG_ERROR("BUG: tracing of jazelle code not supported"); - exit(-1); + return ERROR_FAIL; } else { LOG_ERROR("BUG: unknown core state encountered"); - exit(-1); + return ERROR_FAIL; } return ERROR_OK; @@ -976,8 +976,7 @@ static int etmv1_analyze_trace(etm_context_t *ctx, struct command_context_s *cmd break; default: /* reserved */ LOG_ERROR("BUG: branch reason code 0x%" PRIx32 " is reserved", ctx->last_branch_reason); - exit(-1); - break; + return ERROR_FAIL; } /* if we got here the branch was a normal PC change @@ -1172,7 +1171,7 @@ static int handle_etm_tracemode_command_update( else { command_print(cmd_ctx, "invalid option '%s'", args[0]); - return ERROR_OK; + return ERROR_INVALID_ARGUMENTS; } uint8_t context_id; @@ -1193,7 +1192,7 @@ static int handle_etm_tracemode_command_update( break; default: command_print(cmd_ctx, "invalid option '%s'", args[1]); - return ERROR_OK; + return ERROR_INVALID_ARGUMENTS; } if (strcmp(args[2], "enable") == 0) @@ -1203,7 +1202,7 @@ static int handle_etm_tracemode_command_update( else { command_print(cmd_ctx, "invalid option '%s'", args[2]); - return ERROR_OK; + return ERROR_INVALID_ARGUMENTS; } if (strcmp(args[3], "enable") == 0) @@ -1213,7 +1212,7 @@ static int handle_etm_tracemode_command_update( else { command_print(cmd_ctx, "invalid option '%s'", args[3]); - return ERROR_OK; + return ERROR_INVALID_ARGUMENTS; } /* IGNORED: @@ -1226,25 +1225,28 @@ static int handle_etm_tracemode_command_update( return ERROR_OK; } -static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { target_t *target = get_current_target(cmd_ctx); - armv4_5_common_t *armv4_5; arm7_9_common_t *arm7_9; + struct etm *etm; + if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } - if (!arm7_9->etm_ctx) - { + etm = arm7_9->etm_ctx; + if (!etm) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } - etmv1_tracemode_t tracemode = arm7_9->etm_ctx->tracemode; + etmv1_tracemode_t tracemode = etm->tracemode; + switch (argc) { case 0: @@ -1256,9 +1258,14 @@ static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char command_print(cmd_ctx, "usage: configure trace mode " "<none | data | address | all> " "<context id bits> <cycle accurate> <branch output>"); - return ERROR_OK; + return ERROR_FAIL; } + /** + * todo: fail if parameters were invalid for this hardware, + * or couldn't be written; display actual hardware state... + */ + command_print(cmd_ctx, "current tracemode configuration:"); switch (tracemode & ETMV1_TRACE_MASK) @@ -1312,13 +1319,13 @@ static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char } /* only update ETM_CTRL register if tracemode changed */ - if (arm7_9->etm_ctx->tracemode != tracemode) + if (etm->tracemode != tracemode) { reg_t *etm_ctrl_reg; - etm_ctrl_reg = etm_reg_lookup(arm7_9->etm_ctx, ETM_CTRL); + etm_ctrl_reg = etm_reg_lookup(etm, ETM_CTRL); if (!etm_ctrl_reg) - return ERROR_OK; + return ERROR_FAIL; etm_get_reg(etm_ctrl_reg); @@ -1328,48 +1335,45 @@ static int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char buf_set_u32(etm_ctrl_reg->value, 8, 1, (tracemode & ETMV1_BRANCH_OUTPUT) >> 9); etm_store_reg(etm_ctrl_reg); - arm7_9->etm_ctx->tracemode = tracemode; + etm->tracemode = tracemode; /* invalidate old trace data */ - arm7_9->etm_ctx->capture_status = TRACE_IDLE; - if (arm7_9->etm_ctx->trace_depth > 0) + etm->capture_status = TRACE_IDLE; + if (etm->trace_depth > 0) { - free(arm7_9->etm_ctx->trace_data); - arm7_9->etm_ctx->trace_data = NULL; + free(etm->trace_data); + etm->trace_data = NULL; } - arm7_9->etm_ctx->trace_depth = 0; + etm->trace_depth = 0; } return ERROR_OK; } -static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_config_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; arm7_9_common_t *arm7_9; etm_portmode_t portmode = 0x0; - etm_context_t *etm_ctx = malloc(sizeof(etm_context_t)); + struct etm *etm_ctx; int i; if (argc != 5) - { - free(etm_ctx); return ERROR_COMMAND_SYNTAX_ERROR; - } target = get_target(args[0]); if (!target) { LOG_ERROR("target '%s' not defined", args[0]); - free(etm_ctx); return ERROR_FAIL; } if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - free(etm_ctx); + command_print(cmd_ctx, "target '%s' is '%s'; not an ARM", + target->cmd_name, target_get_name(target)); return ERROR_FAIL; } @@ -1388,7 +1392,6 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cm break; default: command_print(cmd_ctx, "unsupported ETM port width '%s', must be 4, 8 or 16", args[1]); - free(etm_ctx); return ERROR_FAIL; } @@ -1407,7 +1410,6 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cm else { command_print(cmd_ctx, "unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'", args[2]); - free(etm_ctx); return ERROR_FAIL; } @@ -1422,7 +1424,12 @@ static int handle_etm_config_command(struct command_context_s *cmd_ctx, char *cm else { command_print(cmd_ctx, "unsupported ETM port clocking '%s', must be 'full' or 'half'", args[3]); - free(etm_ctx); + return ERROR_FAIL; + } + + etm_ctx = calloc(1, sizeof(etm_context_t)); + if (!etm_ctx) { + LOG_DEBUG("out of memory"); return ERROR_FAIL; } @@ -1489,15 +1496,15 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } etm = arm7_9->etm_ctx; if (!etm) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } command_print(cmd_ctx, "ETM v%d.%d", @@ -1548,7 +1555,7 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, break; default: LOG_ERROR("Illegal max_port_size"); - exit(-1); + return ERROR_FAIL; } command_print(cmd_ctx, "max. port size: %i", max_port_size); @@ -1568,7 +1575,8 @@ static int handle_etm_info_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_status_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1580,14 +1588,14 @@ static int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cm if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } if (!arm7_9->etm_ctx) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } etm = arm7_9->etm_ctx; @@ -1597,7 +1605,7 @@ static int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cm reg = etm_reg_lookup(etm, ETM_STATUS); if (!reg) - return ERROR_OK; + return ERROR_FAIL; if (etm_get_reg(reg) == ERROR_OK) { unsigned s = buf_get_u32(reg->value, 0, reg->size); @@ -1645,7 +1653,8 @@ static int handle_etm_status_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } -static int handle_etm_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_image_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1655,21 +1664,21 @@ static int handle_etm_image_command(struct command_context_s *cmd_ctx, char *cmd if (argc < 1) { command_print(cmd_ctx, "usage: etm image <file> [base address] [type]"); - return ERROR_OK; + return ERROR_FAIL; } target = get_current_target(cmd_ctx); if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } if (!(etm_ctx = arm7_9->etm_ctx)) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } if (etm_ctx->image) @@ -1698,13 +1707,14 @@ static int handle_etm_image_command(struct command_context_s *cmd_ctx, char *cmd { free(etm_ctx->image); etm_ctx->image = NULL; - return ERROR_OK; + return ERROR_FAIL; } return ERROR_OK; } -static int handle_etm_dump_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_dump_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { fileio_t file; target_t *target; @@ -1716,21 +1726,21 @@ static int handle_etm_dump_command(struct command_context_s *cmd_ctx, char *cmd, if (argc != 1) { command_print(cmd_ctx, "usage: etm dump <file>"); - return ERROR_OK; + return ERROR_FAIL; } target = get_current_target(cmd_ctx); if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } if (!(etm_ctx = arm7_9->etm_ctx)) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } if (etm_ctx->capture_driver->status == TRACE_IDLE) @@ -1743,7 +1753,7 @@ static int handle_etm_dump_command(struct command_context_s *cmd_ctx, char *cmd, { /* TODO: if on-the-fly capture is to be supported, this needs to be changed */ command_print(cmd_ctx, "trace capture not completed"); - return ERROR_OK; + return ERROR_FAIL; } /* read the trace data if it wasn't read already */ @@ -1752,7 +1762,7 @@ static int handle_etm_dump_command(struct command_context_s *cmd_ctx, char *cmd, if (fileio_open(&file, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK) { - return ERROR_OK; + return ERROR_FAIL; } fileio_write_u32(&file, etm_ctx->capture_status); @@ -1772,7 +1782,8 @@ static int handle_etm_dump_command(struct command_context_s *cmd_ctx, char *cmd, return ERROR_OK; } -static int handle_etm_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_load_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { fileio_t file; target_t *target; @@ -1784,39 +1795,39 @@ static int handle_etm_load_command(struct command_context_s *cmd_ctx, char *cmd, if (argc != 1) { command_print(cmd_ctx, "usage: etm load <file>"); - return ERROR_OK; + return ERROR_FAIL; } target = get_current_target(cmd_ctx); if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } if (!(etm_ctx = arm7_9->etm_ctx)) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } if (etm_ctx->capture_driver->status(etm_ctx) & TRACE_RUNNING) { command_print(cmd_ctx, "trace capture running, stop first"); - return ERROR_OK; + return ERROR_FAIL; } if (fileio_open(&file, args[0], FILEIO_READ, FILEIO_BINARY) != ERROR_OK) { - return ERROR_OK; + return ERROR_FAIL; } if (file.size % 4) { command_print(cmd_ctx, "size isn't a multiple of 4, no valid trace data"); fileio_close(&file); - return ERROR_OK; + return ERROR_FAIL; } if (etm_ctx->trace_depth > 0) @@ -1837,7 +1848,7 @@ static int handle_etm_load_command(struct command_context_s *cmd_ctx, char *cmd, { command_print(cmd_ctx, "not enough memory to perform operation"); fileio_close(&file); - return ERROR_OK; + return ERROR_FAIL; } for (i = 0; i < etm_ctx->trace_depth; i++) @@ -1856,7 +1867,8 @@ static int handle_etm_load_command(struct command_context_s *cmd_ctx, char *cmd, return ERROR_OK; } -static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1867,14 +1879,14 @@ static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } if (!(etm_ctx = arm7_9->etm_ctx)) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } if (argc > 0) @@ -1897,7 +1909,8 @@ static int handle_etm_trigger_percent_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_etm_start_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_start_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1909,28 +1922,29 @@ static int handle_etm_start_command(struct command_context_s *cmd_ctx, char *cmd if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } - if (!(etm_ctx = arm7_9->etm_ctx)) + etm_ctx = arm7_9->etm_ctx; + if (!etm_ctx) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } /* invalidate old tracing data */ - arm7_9->etm_ctx->capture_status = TRACE_IDLE; - if (arm7_9->etm_ctx->trace_depth > 0) + etm_ctx->capture_status = TRACE_IDLE; + if (etm_ctx->trace_depth > 0) { - free(arm7_9->etm_ctx->trace_data); - arm7_9->etm_ctx->trace_data = NULL; + free(etm_ctx->trace_data); + etm_ctx->trace_data = NULL; } - arm7_9->etm_ctx->trace_depth = 0; + etm_ctx->trace_depth = 0; etm_ctrl_reg = etm_reg_lookup(etm_ctx, ETM_CTRL); if (!etm_ctrl_reg) - return ERROR_OK; + return ERROR_FAIL; etm_get_reg(etm_ctrl_reg); @@ -1945,7 +1959,8 @@ static int handle_etm_start_command(struct command_context_s *cmd_ctx, char *cmd return ERROR_OK; } -static int handle_etm_stop_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_stop_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1957,19 +1972,19 @@ static int handle_etm_stop_command(struct command_context_s *cmd_ctx, char *cmd, if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } if (!(etm_ctx = arm7_9->etm_ctx)) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } etm_ctrl_reg = etm_reg_lookup(etm_ctx, ETM_CTRL); if (!etm_ctrl_reg) - return ERROR_OK; + return ERROR_FAIL; etm_get_reg(etm_ctrl_reg); @@ -1984,7 +1999,8 @@ static int handle_etm_stop_command(struct command_context_s *cmd_ctx, char *cmd, return ERROR_OK; } -static int handle_etm_analyze_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_etm_analyze_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { target_t *target; armv4_5_common_t *armv4_5; @@ -1996,14 +2012,14 @@ static int handle_etm_analyze_command(struct command_context_s *cmd_ctx, char *c if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) { - command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); - return ERROR_OK; + command_print(cmd_ctx, "ETM: current target isn't an ARM"); + return ERROR_FAIL; } if (!(etm_ctx = arm7_9->etm_ctx)) { command_print(cmd_ctx, "current target doesn't have an ETM configured"); - return ERROR_OK; + return ERROR_FAIL; } if ((retval = etmv1_analyze_trace(etm_ctx, cmd_ctx)) != ERROR_OK) @@ -2024,7 +2040,7 @@ static int handle_etm_analyze_command(struct command_context_s *cmd_ctx, char *c } } - return ERROR_OK; + return retval; } int etm_register_commands(struct command_context_s *cmd_ctx) diff --git a/src/target/etm.h b/src/target/etm.h index c751aac..2335c98 100644 --- a/src/target/etm.h +++ b/src/target/etm.h @@ -115,17 +115,17 @@ typedef enum } etmv1_tracemode_t; /* forward-declare ETM context */ -struct etm_context_s; +struct etm; typedef struct etm_capture_driver_s { char *name; int (*register_commands)(struct command_context_s *cmd_ctx); - int (*init)(struct etm_context_s *etm_ctx); - trace_status_t (*status)(struct etm_context_s *etm_ctx); - int (*read_trace)(struct etm_context_s *etm_ctx); - int (*start_capture)(struct etm_context_s *etm_ctx); - int (*stop_capture)(struct etm_context_s *etm_ctx); + int (*init)(struct etm *etm_ctx); + trace_status_t (*status)(struct etm *etm_ctx); + int (*read_trace)(struct etm *etm_ctx); + int (*start_capture)(struct etm *etm_ctx); + int (*stop_capture)(struct etm *etm_ctx); } etm_capture_driver_t; enum @@ -146,7 +146,7 @@ typedef struct etmv1_trace_data_s * this will have to be split into version independent elements * and a version specific part */ -typedef struct etm_context_s +typedef struct etm { target_t *target; /* target this ETM is connected to */ reg_cache_t *reg_cache; /* ETM register cache */ ----------------------------------------------------------------------- Summary of changes: src/target/arm7_9_common.c | 33 +------ src/target/etb.h | 2 - src/target/etm.c | 202 ++++++++++++++++++++++++-------------------- src/target/etm.h | 14 ++-- 4 files changed, 120 insertions(+), 131 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-11 06:03:54
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 583a293a326bcb4b7438871d492cd85c143e3fa1 (commit) from d570e4f6f6ae13eccc3f701f4e0fe5beb51fb295 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 583a293a326bcb4b7438871d492cd85c143e3fa1 Author: Zachary T Welch <zw...@su...> Date: Tue Nov 10 21:02:30 2009 -0800 fix bug in ARM720: bugfix diff --git a/src/target/arm720t.c b/src/target/arm720t.c index c84ee28..6ce7980 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -405,7 +405,7 @@ static int arm720t_target_create(struct target_s *target, Jim_Interp *interp) { struct arm720t_common_s *arm720t = calloc(1, sizeof(*arm720t)); - arm720t->arm7tdmi_common->arm7_9_common.armv4_5_common.is_armv4 = true; + arm720t->arm7tdmi_common.arm7_9_common.armv4_5_common.is_armv4 = true; return arm720t_init_arch_info(target, arm720t, target->tap); } ----------------------------------------------------------------------- Summary of changes: src/target/arm720t.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-11 04:08:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d570e4f6f6ae13eccc3f701f4e0fe5beb51fb295 (commit) from 61af6a681671eae69256dcc5b9e853cf9b161387 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d570e4f6f6ae13eccc3f701f4e0fe5beb51fb295 Author: David Brownell <dbr...@us...> Date: Tue Nov 10 19:06:10 2009 -0800 ARM720: bugfix The "ARM720 uses the new inheritance/nesting scheme" patch wrongly scrubbed a calloc() from arm720t_target_create(). Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 728e197..c84ee28 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -403,8 +403,9 @@ static int arm720t_init_arch_info(target_t *target, static int arm720t_target_create(struct target_s *target, Jim_Interp *interp) { - struct arm720t_common_s *arm720t = target_to_arm720(target); + struct arm720t_common_s *arm720t = calloc(1, sizeof(*arm720t)); + arm720t->arm7tdmi_common->arm7_9_common.armv4_5_common.is_armv4 = true; return arm720t_init_arch_info(target, arm720t, target->tap); } ----------------------------------------------------------------------- Summary of changes: src/target/arm720t.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-10 20:58:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 61af6a681671eae69256dcc5b9e853cf9b161387 (commit) from 6881c1b6d686c91a8cd604bdcd6098ab62d4dcb9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 61af6a681671eae69256dcc5b9e853cf9b161387 Author: David Brownell <dbr...@us...> Date: Tue Nov 10 11:58:31 2009 -0800 target: MMU-aware init for memory read/write Start switching MMU handling over to a more sensible scheme. Having an mmu() method enables MMU-aware behaviors. Not having one kicks in simpler ones, with no distinction between virtual and physical addresses. Currently only a handful of targets have methods to read/write physical memory: just arm720, arm920, and arm926. They should all initialize OK now, but the arm*20 parts don't do the "extra" stuff arm926 does (which should arguably be target-generic). Also simplify how target_init() loops over all targets by making it be a normal "for" loop, instead of scattering its three parts to the four winds. Signed-off-by: David Brownell <dbr...@us...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 8223ee9..475482d 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -5051,9 +5051,11 @@ about what TAP is the current target, or about MMU configuration. Display contents of address @var{addr}, as 32-bit words (@command{mdw}), 16-bit halfwords (@command{mdh}), or 8-bit bytes (@command{mdb}). +When the current target has an MMU which is present and active, +@var{addr} is interpreted as a virtual address. +Otherwise, or if the optional @var{phys} flag is specified, +@var{addr} is interpreted as a physical address. If @var{count} is specified, displays that many units. -@var{phys} is an optional flag to indicate to use -physical address and bypass MMU (If you want to manipulate the data instead of displaying it, see the @code{mem2array} primitives.) @end deffn @@ -5062,10 +5064,12 @@ see the @code{mem2array} primitives.) @deffnx Command mwh [phys] addr halfword @deffnx Command mwb [phys] addr byte Writes the specified @var{word} (32 bits), -@var{halfword} (16 bits), or @var{byte} (8-bit) pattern, +@var{halfword} (16 bits), or @var{byte} (8-bit) value, at the specified address @var{addr}. -@var{phys} is an optional flag to indicate to use -physical address and bypass MMU +When the current target has an MMU which is present and active, +@var{addr} is interpreted as a virtual address. +Otherwise, or if the optional @var{phys} flag is specified, +@var{addr} is interpreted as a physical address. @end deffn diff --git a/src/target/target.c b/src/target/target.c index 5cdfa5d..1bf680d 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -756,11 +756,12 @@ err_write_phys_memory(struct target_s *target, uint32_t address, int target_init(struct command_context_s *cmd_ctx) { - target_t *target = all_targets; + struct target_s *target; int retval; - while (target) - { + for (target = all_targets; target; target = target->next) { + struct target_type_s *type = target->type; + target_reset_examined(target); if (target->type->examine == NULL) { @@ -773,22 +774,6 @@ int target_init(struct command_context_s *cmd_ctx) return retval; } - /* Set up default functions if none are provided by target */ - if (target->type->virt2phys == NULL) - { - target->type->virt2phys = identity_virt2phys; - } - - if (target->type->read_phys_memory == NULL) - { - target->type->read_phys_memory = err_read_phys_memory; - } - - if (target->type->write_phys_memory == NULL) - { - target->type->write_phys_memory = err_write_phys_memory; - } - /** * @todo MCR/MRC are ARM-specific; don't require them in * all targets, or for ARMs without coprocessors. @@ -833,11 +818,45 @@ int target_init(struct command_context_s *cmd_ctx) target->type->run_algorithm_imp = target->type->run_algorithm; target->type->run_algorithm = target_run_algorithm_imp; - if (target->type->mmu == NULL) - { - target->type->mmu = no_mmu; + /* Sanity-check MMU support ... stub in what we must, to help + * implement it in stages, but warn if we need to do so. + */ + if (type->mmu) { + if (type->write_phys_memory == NULL) { + LOG_ERROR("type '%s' is missing %s", + type->name, + "write_phys_memory"); + type->write_phys_memory = err_write_phys_memory; + } + if (type->read_phys_memory == NULL) { + LOG_ERROR("type '%s' is missing %s", + type->name, + "read_phys_memory"); + type->read_phys_memory = err_read_phys_memory; + } + if (type->virt2phys == NULL) { + LOG_ERROR("type '%s' is missing %s", + type->name, + "virt2phys"); + type->virt2phys = identity_virt2phys; + } + + /* Make sure no-MMU targets all behave the same: make no + * distinction between physical and virtual addresses, and + * ensure that virt2phys() is always an identity mapping. + */ + } else { + if (type->write_phys_memory + || type->read_phys_memory + || type->virt2phys) + LOG_WARNING("type '%s' has broken MMU hooks", + type->name); + + type->mmu = no_mmu; + type->write_phys_memory = type->write_memory; + type->read_phys_memory = type->read_memory; + type->virt2phys = identity_virt2phys; } - target = target->next; } if (all_targets) ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 14 +++++++---- src/target/target.c | 65 +++++++++++++++++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 28 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-10 18:27:24
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 6881c1b6d686c91a8cd604bdcd6098ab62d4dcb9 (commit) via 85944d4144a1df0647e4324d1cf8ae9a276b70e5 (commit) from 627bd197689d71f7beb3e9cd11e2993fe0d4d880 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6881c1b6d686c91a8cd604bdcd6098ab62d4dcb9 Author: David Brownell <dbr...@us...> Date: Tue Nov 10 09:25:26 2009 -0800 target.cfg: (re)move some bogus reset_config lines General rule, this is all board-specific and doesn't belong in target config files. Some of these were just cosmetic. Signed-off-by: David Brownell <dbr...@us...> diff --git a/tcl/board/atmel_sam3u_ek.cfg b/tcl/board/atmel_sam3u_ek.cfg index f7501d0..13d930b 100644 --- a/tcl/board/atmel_sam3u_ek.cfg +++ b/tcl/board/atmel_sam3u_ek.cfg @@ -1 +1,4 @@ source [find target/at91sam3u4e.cfg] + +reset_config srst_only + diff --git a/tcl/target/aduc702x.cfg b/tcl/target/aduc702x.cfg index f7c5ee4..b60c967 100644 --- a/tcl/target/aduc702x.cfg +++ b/tcl/target/aduc702x.cfg @@ -1,7 +1,3 @@ -## -*- tcl -*- -## - - if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME } else { @@ -21,14 +17,9 @@ if { [info exists CPUTAPID] } { set _CPUTAPID 0x3f0f0f0f } - jtag_nsrst_delay 200 jtag_ntrst_delay 200 -# This is for the case that TRST/SRST is not wired on your JTAG adaptor. -# Don't really need them anyways. -reset_config none - ## JTAG scan chain #format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE) jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID diff --git a/tcl/target/at91sam3uXX.cfg b/tcl/target/at91sam3uXX.cfg index 985e052..b948c64 100644 --- a/tcl/target/at91sam3uXX.cfg +++ b/tcl/target/at91sam3uXX.cfg @@ -35,8 +35,6 @@ target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNA # 16K is plenty, the smallest chip has this much $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 16384 -work-area-backup 0 -reset_config srst_only - $_TARGETNAME configure -event gdb-flash-erase-start { halt } diff --git a/tcl/target/str730.cfg b/tcl/target/str730.cfg index fe70802..c98d56c 100644 --- a/tcl/target/str730.cfg +++ b/tcl/target/str730.cfg @@ -21,7 +21,6 @@ if { [info exists CPUTAPID] } { } #use combined on interfaces or targets that can't set TRST/SRST separately -#reset_config trst_and_srst srst_pulls_trst reset_config trst_and_srst srst_pulls_trst #jtag scan chain diff --git a/tcl/target/str750.cfg b/tcl/target/str750.cfg index 22d87f8..5439c33 100644 --- a/tcl/target/str750.cfg +++ b/tcl/target/str750.cfg @@ -22,7 +22,6 @@ if { [info exists CPUTAPID] } { jtag_khz 10 #use combined on interfaces or targets that can't set TRST/SRST separately -#reset_config trst_and_srst srst_pulls_trst reset_config trst_and_srst srst_pulls_trst #jtag scan chain commit 85944d4144a1df0647e4324d1cf8ae9a276b70e5 Author: Thomas Kindler <mai...@t-...> Date: Tue Nov 10 09:16:12 2009 -0800 stm32.cfg: remove reset_config Here's a patch for the double-reset problem on STM32. I've tested downloading and debugging with GDB and Eclipse, and everything seems to work fine. This effectively sets reset_config to none. trst_only would also be ok, but that's better left to a board configuration file since not all boards wire it up. The NVIC is used to trigger reset, which at least on this chip also pulses nSRST so the whole system does get rest -- exactly once. Signed-off-by: David Brownell <dbr...@us...> diff --git a/tcl/target/stm32.cfg b/tcl/target/stm32.cfg index 619824c..242bbbe 100644 --- a/tcl/target/stm32.cfg +++ b/tcl/target/stm32.cfg @@ -26,9 +26,6 @@ jtag_khz 1000 jtag_nsrst_delay 100 jtag_ntrst_delay 100 -#use combined on interfaces or targets that can't set TRST/SRST separately -reset_config trst_and_srst - #jtag scan chain if { [info exists CPUTAPID ] } { set _CPUTAPID $CPUTAPID ----------------------------------------------------------------------- Summary of changes: tcl/board/atmel_sam3u_ek.cfg | 3 +++ tcl/target/aduc702x.cfg | 9 --------- tcl/target/at91sam3uXX.cfg | 2 -- tcl/target/stm32.cfg | 3 --- tcl/target/str730.cfg | 1 - tcl/target/str750.cfg | 1 - 6 files changed, 3 insertions(+), 16 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-10 14:03:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 627bd197689d71f7beb3e9cd11e2993fe0d4d880 (commit) from c202ba7d34bd7feba88d7c0ee1aa9ef7be18bca9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 627bd197689d71f7beb3e9cd11e2993fe0d4d880 Author: Michael Bruck <mb...@di...> Date: Tue Oct 27 22:41:00 2009 +0100 arm11: add etmr/etmw registers to access ETM via DBGTAP scan chain First cut of these commands. Ãyvind tinkered a bit with the number parsing to bring it up to speed + rebased it. Ready for testing. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/arm11.c b/src/target/arm11.c index 9d885de..fe39d6e 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -2143,6 +2143,59 @@ static int arm11_mcr(target_t *target, int cpnum, return arm11_mrc_inner(target, cpnum, op1, op2, CRn, CRm, &value, false); } +static int arm11_handle_etm_read_write(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, bool read) +{ + if (argc != (read ? 2 : 3)) + { + LOG_ERROR("Invalid number of arguments."); + return ERROR_COMMAND_SYNTAX_ERROR; + } + + arm11_common_t * arm11 = arm11_find_target(args[0]); + + if (!arm11) + { + LOG_ERROR("Parameter 1 is not the target name of an ARM11 device."); + return ERROR_COMMAND_SYNTAX_ERROR; + } + + uint32_t address; + COMMAND_PARSE_NUMBER(u32, args[1], address); + + if (!read) + { + uint32_t value; + COMMAND_PARSE_NUMBER(u32, args[2], value); + + LOG_INFO("ETM write register 0x%02" PRIx32 " (%" PRId32 ") = 0x%08" PRIx32 " (%" PRId32 ")", + address, address, value, value); + + CHECK_RETVAL(arm11_write_etm(arm11, address, value)); + } + else + { + uint32_t value; + + CHECK_RETVAL(arm11_read_etm(arm11, address, &value)); + + LOG_INFO("ETM read register 0x%02" PRIx32 " (%" PRId32 ") = 0x%08" PRIx32 " (%" PRId32 ")", + address, address, value, value); + } + + return ERROR_OK; +} + +int arm11_handle_etmr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, true); +} + +int arm11_handle_etmw(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + return arm11_handle_etm_read_write(cmd_ctx, cmd, args, argc, false); +} + + #define ARM11_HANDLER(x) .x = arm11_##x target_type_t arm11_target = { @@ -2196,6 +2249,14 @@ int arm11_register_commands(struct command_context_s *cmd_ctx) top_cmd = register_command(cmd_ctx, NULL, "arm11", NULL, COMMAND_ANY, NULL); + register_command(cmd_ctx, top_cmd, "etmr", + arm11_handle_etmr, COMMAND_ANY, + "Read Embedded Trace Macrocell (ETM) register. etmr <jtag_target> <ETM register address>"); + + register_command(cmd_ctx, top_cmd, "etmw", + arm11_handle_etmw, COMMAND_ANY, + "Write Embedded Trace Macrocell (ETM) register. etmr <jtag_target> <ETM register address> <value>"); + /* "hardware_step" is only here to check if the default * simulate + breakpoint implementation is broken. * TEMPORARY! NOT DOCUMENTED! diff --git a/src/target/arm11.h b/src/target/arm11.h index be5e77b..100fc26 100644 --- a/src/target/arm11.h +++ b/src/target/arm11.h @@ -184,4 +184,9 @@ typedef struct arm11_reg_state_s int arm11_register_commands(struct command_context_s *cmd_ctx); +int arm11_read_etm(arm11_common_t * arm11, uint8_t address, uint32_t *value); +int arm11_write_etm(arm11_common_t * arm11, uint8_t address, uint32_t value); + + + #endif /* ARM11_H */ diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index 0e1160f..fc7a55c 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -940,3 +940,79 @@ int arm11_read_memory_word(arm11_common_t * arm11, uint32_t address, uint32_t * } +/** Write Embedded Trace Macrocell (ETM) via Scan chain 6 + * + * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0318e/Bcfddjeh.html#Bcfggcbe + * + * \param arm11 Target state variable. + * \param address 7 bit ETM register address + * \param value Value to be written + * + * \return Error status + * + * \remarks This is a stand-alone function that executes the JTAG command queue. + */ +int arm11_write_etm(arm11_common_t * arm11, uint8_t address, uint32_t value) +{ + CHECK_RETVAL(arm11_add_debug_SCAN_N(arm11, 0x06, ARM11_TAP_DEFAULT)); + + /* Uses INTEST for read and write */ + arm11_add_IR(arm11, ARM11_INTEST, ARM11_TAP_DEFAULT); + + scan_field_t chain6_fields[3]; + + uint8_t nRW = 1; + + arm11_setup_field(arm11, 32, &value, NULL, chain6_fields + 0); + arm11_setup_field(arm11, 7, &address, NULL, chain6_fields + 1); + arm11_setup_field(arm11, 1, &nRW, NULL, chain6_fields + 2); + + arm11_add_dr_scan_vc(asizeof(chain6_fields), chain6_fields, TAP_IDLE); + + CHECK_RETVAL(jtag_execute_queue()); + + return ERROR_OK; +} + +/** Read Embedded Trace Macrocell (ETM) via Scan chain 6 + * + * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0318e/Bcfddjeh.html#Bcfggcbe + * + * \param arm11 Target state variable. + * \param address 7 bit ETM register address + * \param value Pointer that receives value that was read + * + * \return Error status + * + * \remarks This is a stand-alone function that executes the JTAG command queue. + */ +int arm11_read_etm(arm11_common_t * arm11, uint8_t address, uint32_t * value) +{ + CHECK_RETVAL(arm11_add_debug_SCAN_N(arm11, 0x06, ARM11_TAP_DEFAULT)); + + /* Uses INTEST for read and write */ + arm11_add_IR(arm11, ARM11_INTEST, ARM11_TAP_DEFAULT); + + scan_field_t chain6_fields[3]; + + uint8_t nRW = 0; + + arm11_setup_field(arm11, 32, NULL, NULL, chain6_fields + 0); + arm11_setup_field(arm11, 7, &address, NULL, chain6_fields + 1); + arm11_setup_field(arm11, 1, &nRW, NULL, chain6_fields + 2); + + arm11_add_dr_scan_vc(asizeof(chain6_fields), chain6_fields, TAP_IDLE); + + /* Data is made available in Capture-DR and shifted out on the next access */ + + arm11_setup_field(arm11, 32, NULL, value, chain6_fields + 0); + arm11_setup_field(arm11, 7, &address, NULL, chain6_fields + 1); + arm11_setup_field(arm11, 1, &nRW, NULL, chain6_fields + 2); + + arm11_add_dr_scan_vc(asizeof(chain6_fields), chain6_fields, TAP_IDLE); + + CHECK_RETVAL(jtag_execute_queue()); + + return ERROR_OK; +} + ----------------------------------------------------------------------- Summary of changes: src/target/arm11.c | 61 ++++++++++++++++++++++++++++++++++++ src/target/arm11.h | 5 +++ src/target/arm11_dbgtap.c | 76 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-10 13:14:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via c202ba7d34bd7feba88d7c0ee1aa9ef7be18bca9 (commit) from 1f357869c19cccdb3259eae10c1124af5c9510ff (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c202ba7d34bd7feba88d7c0ee1aa9ef7be18bca9 Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Oct 26 14:39:32 2009 +0100 ARM11: remove old mrc/mcr commands Switch to new commands in config scripts Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 86f5748..8223ee9 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -1502,7 +1502,7 @@ proc setc15 @{regs value@} @{ echo [format "set p15 0x%04x, 0x%08x" $regs $value] - arm11 mcr $TARGETNAME 15 [expr ($regs>>12)&0x7] \ + mcr 15 [expr ($regs>>12)&0x7] \ [expr ($regs>>0)&0xf] [expr ($regs>>4)&0xf] \ [expr ($regs>>8)&0x7] $value @} @@ -5796,15 +5796,6 @@ Without arguments, the current settings are displayed. @subsection ARM11 specific commands @cindex ARM11 -@deffn Command {arm11 mcr} pX opc1 CRn CRm opc2 value -Write @var{value} to a coprocessor @var{pX} register -passing parameters @var{CRn}, -@var{CRm}, opcodes @var{opc1} and @var{opc2}, -and the MCR instruction. -(The difference beween this and the MCR2 instruction is -one bit in the encoding, effecively a fifth parameter.) -@end deffn - @deffn Command {arm11 memwrite burst} [value] Displays the value of the memwrite burst-enable flag, which is enabled by default. Burst writes are only used @@ -5821,15 +5812,6 @@ which is enabled by default. If @var{value} is defined, first assigns that. @end deffn -@deffn Command {arm11 mrc} pX opc1 CRn CRm opc2 -Read a coprocessor @var{pX} register passing parameters @var{CRn}, -@var{CRm}, opcodes @var{opc1} and @var{opc2}, -and the MRC instruction. -(The difference beween this and the MRC2 instruction is -one bit in the encoding, effecively a fifth parameter.) -Displays the result. -@end deffn - @deffn Command {arm11 step_irq_enable} [value] Displays the value of the flag controlling whether IRQs are enabled during single stepping; diff --git a/src/target/arm11.c b/src/target/arm11.c index 6cdfa64..9d885de 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -2087,101 +2087,6 @@ static arm11_common_t * arm11_find_target(const char * arg) return 0; } -static int arm11_handle_mrc_mcr(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc, bool read) -{ - int retval; - - if (argc != (read ? 6 : 7)) - { - LOG_ERROR("Invalid number of arguments."); - return ERROR_COMMAND_SYNTAX_ERROR; - } - - arm11_common_t * arm11 = arm11_find_target(args[0]); - - if (!arm11) - { - LOG_ERROR("Parameter 1 is not a the JTAG chain position of an ARM11 device."); - return ERROR_COMMAND_SYNTAX_ERROR; - } - - if (arm11->target->state != TARGET_HALTED) - { - LOG_WARNING("target was not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - uint32_t values[6]; - - for (size_t i = 0; i < (read ? 5 : 6); i++) - { - COMMAND_PARSE_NUMBER(u32, args[i + 1], values[i]); - - if (values[i] > arm11_coproc_instruction_limits[i]) - { - LOG_ERROR("Parameter %ld out of bounds (%" PRId32 " max).", - (long)(i + 2), - arm11_coproc_instruction_limits[i]); - return ERROR_COMMAND_SYNTAX_ERROR; - } - } - - uint32_t instr = 0xEE000010 | - (values[0] << 8) | - (values[1] << 21) | - (values[2] << 16) | - (values[3] << 0) | - (values[4] << 5); - - if (read) - instr |= 0x00100000; - - retval = arm11_run_instr_data_prepare(arm11); - if (retval != ERROR_OK) - return retval; - - if (read) - { - uint32_t result; - retval = arm11_run_instr_data_from_core_via_r0(arm11, instr, &result); - if (retval != ERROR_OK) - return retval; - - LOG_INFO("MRC p%d, %d, R0, c%d, c%d, %d = 0x%08" PRIx32 " (%" PRId32 ")", - (int)(values[0]), - (int)(values[1]), - (int)(values[2]), - (int)(values[3]), - (int)(values[4]), result, result); - } - else - { - retval = arm11_run_instr_data_to_core_via_r0(arm11, instr, values[5]); - if (retval != ERROR_OK) - return retval; - - LOG_INFO("MRC p%d, %d, R0 (#0x%08" PRIx32 "), c%d, c%d, %d", - (int)(values[0]), (int)(values[1]), - values[5], - (int)(values[2]), (int)(values[3]), (int)(values[4])); - } - - return arm11_run_instr_data_finish(arm11); -} - -static int arm11_handle_mrc(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) -{ - return arm11_handle_mrc_mcr(cmd_ctx, cmd, args, argc, true); -} - -static int arm11_handle_mcr(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) -{ - return arm11_handle_mrc_mcr(cmd_ctx, cmd, args, argc, false); -} - static int arm11_mrc_inner(target_t *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value, bool read) @@ -2300,10 +2205,6 @@ int arm11_register_commands(struct command_context_s *cmd_ctx) "DEBUG ONLY - Hardware single stepping" " (default: disabled)"); - register_command(cmd_ctx, top_cmd, "mcr", - arm11_handle_mcr, COMMAND_ANY, - "Write Coprocessor register. mcr <jtag_target> <coprocessor> <opcode 1> <CRn> <CRm> <opcode 2> <32bit value to write>. All parameters are numbers only."); - mw_cmd = register_command(cmd_ctx, top_cmd, "memwrite", NULL, COMMAND_ANY, NULL); register_command(cmd_ctx, mw_cmd, "burst", @@ -2315,9 +2216,6 @@ int arm11_register_commands(struct command_context_s *cmd_ctx) "Terminate program if transfer error was found" " (default: enabled)"); - register_command(cmd_ctx, top_cmd, "mrc", - arm11_handle_mrc, COMMAND_ANY, - "Read Coprocessor register. mrc <jtag_target> <coprocessor> <opcode 1> <CRn> <CRm> <opcode 2>. All parameters are numbers only."); register_command(cmd_ctx, top_cmd, "step_irq_enable", arm11_handle_bool_step_irq_enable, COMMAND_ANY, "Enable interrupts while stepping" diff --git a/tcl/board/csb732.cfg b/tcl/board/csb732.cfg index 1787323..9022faf 100644 --- a/tcl/board/csb732.cfg +++ b/tcl/board/csb732.cfg @@ -19,13 +19,13 @@ proc csb732_init { } { # We assume the interpreter latency is enough. # Allow access to all coprocessors - arm11 mcr imx35.cpu 15 0 15 1 0 0x2001 + mcr 15 0 15 1 0 0x2001 # Disable MMU, caches, write buffer - arm11 mcr imx35.cpu 15 0 1 0 0 0x78 + mcr 15 0 1 0 0 0x78 # Grant manager access to all domains - arm11 mcr imx35.cpu 15 0 3 0 0 0xFFFFFFFF + mcr 15 0 3 0 0 0xFFFFFFFF # Set ARM clock to 532 MHz, AHB to 133 MHz mww 0x53F80004 0x1000 diff --git a/tcl/target/c100helper.tcl b/tcl/target/c100helper.tcl index b5e0164..54fe07f 100644 --- a/tcl/target/c100helper.tcl +++ b/tcl/target/c100helper.tcl @@ -436,22 +436,22 @@ proc initC100 {} { # */ # mov r0, #0 # mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */ - arm11 mcr c100.cpu 15 0 7 7 0 0x0 + mcr 15 0 7 7 0 0x0 # mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */ - arm11 mcr c100.cpu 15 0 8 7 0 0x0 + mcr 15 0 8 7 0 0x0 # /* # * disable MMU stuff and caches # */ # mrc p15, 0, r0, c1, c0, 0 - arm11 mrc c100.cpu 15 0 1 0 0 + mrc 15 0 1 0 0 # bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS) # bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM) # orr r0, r0, #0x00000002 @ set bit 2 (A) Align # orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache # orr r0, r0, #0x00400000 @ set bit 22 (U) # mcr p15, 0, r0, c1, c0, 0 - arm11 mcr c100.cpu 15 0 1 0 0 0x401002 + mcr 15 0 1 0 0 0x401002 # This is from bsp_init() in u-boot/boards/mindspeed/ooma-darwin/board.c # APB init # // Setting APB Bus Wait states to 1, set post write diff --git a/tcl/target/imx.cfg b/tcl/target/imx.cfg index 16773fa..bfcc652 100644 --- a/tcl/target/imx.cfg +++ b/tcl/target/imx.cfg @@ -10,7 +10,7 @@ proc setc15 {regs value} { echo [format "set p15 0x%04x, 0x%08x" $regs $value] - arm11 mcr $TARGETNAME 15 [expr ($regs>>12)&0x7] [expr ($regs>>0)&0xf] [expr ($regs>>4)&0xf] [expr ($regs>>8)&0x7] $value + mcr 15 [expr ($regs>>12)&0x7] [expr ($regs>>0)&0xf] [expr ($regs>>4)&0xf] [expr ($regs>>8)&0x7] $value } ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 20 +-------- src/target/arm11.c | 102 --------------------------------------------- tcl/board/csb732.cfg | 6 +- tcl/target/c100helper.tcl | 8 ++-- tcl/target/imx.cfg | 2 +- 5 files changed, 9 insertions(+), 129 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-10 13:12:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 1f357869c19cccdb3259eae10c1124af5c9510ff (commit) from 2a4d3c03cd9f6ec1d761a6fb8795d6aac95e9fe3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1f357869c19cccdb3259eae10c1124af5c9510ff Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Nov 10 13:09:15 2009 +0100 telo.cfg: fix search paths Add the missing "target/" prefix for scripts in the target folder. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/tcl/board/telo.cfg b/tcl/board/telo.cfg index 7d638d7..c4e5d67 100644 --- a/tcl/board/telo.cfg +++ b/tcl/board/telo.cfg @@ -1,10 +1,10 @@ -source [find c100.cfg] +source [find target/c100.cfg] # basic register defintion for C100 -source [find c100regs.tcl] +source [find target/c100regs.tcl] # board-config info -source [find c100config.tcl] +source [find target/c100config.tcl] # C100 helper functions -source [find c100helper.tcl] +source [find target/c100helper.tcl] # Telo board & C100 support trst and srst diff --git a/tcl/target/telo.cfg b/tcl/target/telo.cfg index 7d638d7..c4e5d67 100644 --- a/tcl/target/telo.cfg +++ b/tcl/target/telo.cfg @@ -1,10 +1,10 @@ -source [find c100.cfg] +source [find target/c100.cfg] # basic register defintion for C100 -source [find c100regs.tcl] +source [find target/c100regs.tcl] # board-config info -source [find c100config.tcl] +source [find target/c100config.tcl] # C100 helper functions -source [find c100helper.tcl] +source [find target/c100helper.tcl] # Telo board & C100 support trst and srst ----------------------------------------------------------------------- Summary of changes: tcl/board/telo.cfg | 8 ++++---- tcl/target/telo.cfg | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-10 11:01:37
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 2a4d3c03cd9f6ec1d761a6fb8795d6aac95e9fe3 (commit) from 508e5c803fcc49ffe16a2e539545081df65633f7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2a4d3c03cd9f6ec1d761a6fb8795d6aac95e9fe3 Author: David Brownell <dbr...@us...> Date: Tue Nov 10 02:01:20 2009 -0800 Target: minor cleanup - improve some names -- a "default" prefix is not descriptive - add doxygen @todo entries for some issues - avr8 isn't ever going to need those MMU hooks Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/avrt.c b/src/target/avrt.c index d3e6282..98433cf 100644 --- a/src/target/avrt.c +++ b/src/target/avrt.c @@ -94,10 +94,6 @@ target_type_t avr_target = .register_commands = avr_register_commands, .target_create = avr_target_create, .init_target = avr_init_target, -/* - .virt2phys = avr_virt2phys, - .mmu = avr_mmu -*/ }; int avr_register_commands(struct command_context_s *cmd_ctx) diff --git a/src/target/target.c b/src/target/target.c index b7df1d8..5cdfa5d 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -460,13 +460,14 @@ int target_process_reset(struct command_context_s *cmd_ctx, enum target_reset_mo return retval; } -static int default_virt2phys(struct target_s *target, uint32_t virtual, uint32_t *physical) +static int identity_virt2phys(struct target_s *target, + uint32_t virtual, uint32_t *physical) { *physical = virtual; return ERROR_OK; } -static int default_mmu(struct target_s *target, int *enabled) +static int no_mmu(struct target_s *target, int *enabled) { *enabled = 0; return ERROR_OK; @@ -738,7 +739,7 @@ int target_mcr(struct target_s *target, int cpnum, uint32_t op1, uint32_t op2, u } static int -default_read_phys_memory(struct target_s *target, uint32_t address, +err_read_phys_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { LOG_ERROR("Not implemented: %s", __func__); @@ -746,7 +747,7 @@ default_read_phys_memory(struct target_s *target, uint32_t address, } static int -default_write_phys_memory(struct target_s *target, uint32_t address, +err_write_phys_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { LOG_ERROR("Not implemented: %s", __func__); @@ -775,19 +776,23 @@ int target_init(struct command_context_s *cmd_ctx) /* Set up default functions if none are provided by target */ if (target->type->virt2phys == NULL) { - target->type->virt2phys = default_virt2phys; + target->type->virt2phys = identity_virt2phys; } if (target->type->read_phys_memory == NULL) { - target->type->read_phys_memory = default_read_phys_memory; + target->type->read_phys_memory = err_read_phys_memory; } if (target->type->write_phys_memory == NULL) { - target->type->write_phys_memory = default_write_phys_memory; + target->type->write_phys_memory = err_write_phys_memory; } + /** + * @todo MCR/MRC are ARM-specific; don't require them in + * all targets, or for ARMs without coprocessors. + */ if (target->type->mcr == NULL) { target->type->mcr = default_mcr; @@ -810,6 +815,12 @@ int target_init(struct command_context_s *cmd_ctx) } + /** + * @todo get rid of those *memory_imp() methods, now that all + * callers are using target_*_memory() accessors ... and make + * sure the "physical" paths handle the same issues. + */ + /* a non-invasive way(in terms of patches) to add some code that * runs before the type->write/read_memory implementation */ @@ -824,7 +835,7 @@ int target_init(struct command_context_s *cmd_ctx) if (target->type->mmu == NULL) { - target->type->mmu = default_mmu; + target->type->mmu = no_mmu; } target = target->next; } @@ -4780,10 +4791,11 @@ int target_register_user_commands(struct command_context_s *cmd_ctx) "loads active fast load image to current target " "- mainly for profiling purposes"); - + /** @todo don't register virt2phys() unless target supports it */ register_command(cmd_ctx, NULL, "virt2phys", handle_virt2phys_command, COMMAND_ANY, "translate a virtual address into a physical address"); + register_command(cmd_ctx, NULL, "reg", handle_reg_command, COMMAND_EXEC, "display or set a register"); ----------------------------------------------------------------------- Summary of changes: src/target/avrt.c | 4 ---- src/target/target.c | 30 +++++++++++++++++++++--------- 2 files changed, 21 insertions(+), 13 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-10 10:37:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 508e5c803fcc49ffe16a2e539545081df65633f7 (commit) via 65e3471d7849b4c1515ca1a71f7b46111ea5b934 (commit) via 0df56714a006540b398132dfef044c2bd6b2ed72 (commit) from 031591ead57807c4a23141d8141ea579b8deb2a0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 508e5c803fcc49ffe16a2e539545081df65633f7 Author: David Brownell <dbr...@us...> Date: Tue Nov 10 01:36:59 2009 -0800 ARM920: implement basic MMU ops mmu() works; virt2phys() fails and logs an error. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm920t.c b/src/target/arm920t.c index dd9fae3..e043aee 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -460,6 +460,25 @@ int arm920t_arch_state(struct target_s *target) return ERROR_OK; } +static int arm920_mmu(struct target_s *target, int *enabled) +{ + if (target->state != TARGET_HALTED) { + LOG_ERROR("%s: target not halted", __func__); + return ERROR_TARGET_INVALID; + } + + *enabled = target_to_arm920(target)->armv4_5_mmu.mmu_enabled; + return ERROR_OK; +} + +static int arm920_virt2phys(struct target_s *target, + uint32_t virt, uint32_t *phys) +{ + /** @todo Implement this! */ + LOG_ERROR("%s: not implemented", __func__); + return ERROR_FAIL; +} + /** Reads a buffer, in the specified word size, with current MMU settings. */ int arm920t_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { @@ -1389,6 +1408,9 @@ target_type_t arm920t_target = .write_memory = arm920t_write_memory, .read_phys_memory = arm920t_read_phys_memory, .write_phys_memory = arm920t_write_phys_memory, + .mmu = arm920_mmu, + .virt2phys = arm920_virt2phys, + .bulk_write_memory = arm7_9_bulk_write_memory, .checksum_memory = arm7_9_checksum_memory, .blank_check_memory = arm7_9_blank_check_memory, commit 65e3471d7849b4c1515ca1a71f7b46111ea5b934 Author: David Brownell <dbr...@us...> Date: Tue Nov 10 01:35:50 2009 -0800 ARM720: implement basic MMU ops mmu() works; virt2phys() fails and logs an error. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 673296e..728e197 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -247,6 +247,25 @@ static int arm720t_arch_state(struct target_s *target) return ERROR_OK; } +static int arm720_mmu(struct target_s *target, int *enabled) +{ + if (target->state != TARGET_HALTED) { + LOG_ERROR("%s: target not halted", __func__); + return ERROR_TARGET_INVALID; + } + + *enabled = target_to_arm720(target)->armv4_5_mmu.mmu_enabled; + return ERROR_OK; +} + +static int arm720_virt2phys(struct target_s *target, + uint32_t virt, uint32_t *phys) +{ + /** @todo Implement this! */ + LOG_ERROR("%s: not implemented", __func__); + return ERROR_FAIL; +} + static int arm720t_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { @@ -512,6 +531,9 @@ target_type_t arm720t_target = .write_memory = arm7_9_write_memory, .read_phys_memory = arm720t_read_phys_memory, .write_phys_memory = arm720t_write_phys_memory, + .mmu = arm720_mmu, + .virt2phys = arm720_virt2phys, + .bulk_write_memory = arm7_9_bulk_write_memory, .checksum_memory = arm7_9_checksum_memory, .blank_check_memory = arm7_9_blank_check_memory, commit 0df56714a006540b398132dfef044c2bd6b2ed72 Author: David Brownell <dbr...@us...> Date: Tue Nov 10 01:33:59 2009 -0800 Target: fix bad error messages And shrink a few too-long lines. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/target.c b/src/target/target.c index 66e8699..b7df1d8 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -663,13 +663,13 @@ void target_reset_examined(struct target_s *target) static int default_mrc(struct target_s *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value) { - LOG_ERROR("Not implemented"); + LOG_ERROR("Not implemented: %s", __func__); return ERROR_FAIL; } static int default_mcr(struct target_s *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t value) { - LOG_ERROR("Not implemented"); + LOG_ERROR("Not implemented: %s", __func__); return ERROR_FAIL; } @@ -737,19 +737,22 @@ int target_mcr(struct target_s *target, int cpnum, uint32_t op1, uint32_t op2, u return target->type->mcr(target, cpnum, op1, op2, CRn, CRm, value); } -static int default_read_phys_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) +static int +default_read_phys_memory(struct target_s *target, uint32_t address, + uint32_t size, uint32_t count, uint8_t *buffer) { - LOG_ERROR("Not implemented"); + LOG_ERROR("Not implemented: %s", __func__); return ERROR_FAIL; } -static int default_write_phys_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) +static int +default_write_phys_memory(struct target_s *target, uint32_t address, + uint32_t size, uint32_t count, uint8_t *buffer) { - LOG_ERROR("Not implemented"); + LOG_ERROR("Not implemented: %s", __func__); return ERROR_FAIL; } - int target_init(struct command_context_s *cmd_ctx) { target_t *target = all_targets; ----------------------------------------------------------------------- Summary of changes: src/target/arm720t.c | 22 ++++++++++++++++++++++ src/target/arm920t.c | 22 ++++++++++++++++++++++ src/target/target.c | 17 ++++++++++------- 3 files changed, 54 insertions(+), 7 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-10 08:50:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 031591ead57807c4a23141d8141ea579b8deb2a0 (commit) from 151a270695416824940ca64016b3dcd75d9c75fa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 031591ead57807c4a23141d8141ea579b8deb2a0 Author: Ãyvind Harboe <oyv...@zy...> Date: Sun Nov 8 19:50:35 2009 +0100 httpd: fix warnings, more robust error handling, improved MIME handling The httpd is work in progress... No mime type set by default. Let the browser guess. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/server/httpd.c b/src/server/httpd.c index 0ddeb97..d8659b0 100644 --- a/src/server/httpd.c +++ b/src/server/httpd.c @@ -123,7 +123,7 @@ static int httpd_Jim_Command_writeform(Jim_Interp *interp, int argc, const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val", name); - retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__); + retcode = Jim_Eval_Named(interp, script, __FILE__, __LINE__); free((void *) script); if (retcode != JIM_OK) return retcode; @@ -164,7 +164,7 @@ httpd_Jim_Command_formfetch(Jim_Interp *interp, const char *script = alloc_printf("set dummy_val $httppostdata(%s); set dummy_val", name); - int retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__); + int retcode = Jim_Eval_Named(interp, script, __FILE__, __LINE__); free((void *) script); if (retcode != JIM_OK) { @@ -288,10 +288,10 @@ static int handle_request(struct MHD_Connection * connection, const char * url) const char *script = alloc_printf( "global httpdata; source {%s}; set httpdata", url); - retcode = Jim_Eval_Named(interp, script, "httpd.c", __LINE__); + retcode = Jim_Eval_Named(interp, script, __FILE__, __LINE__); free((void *) script); - if (retcode == JIM_ERR) + if (retcode != JIM_OK) { printf("Tcl failed\n"); const char *t = httpd_exec_cgi_tcl_error(interp); @@ -341,7 +341,10 @@ static int handle_request(struct MHD_Connection * connection, const char * url) LOG_DEBUG("Serving %s length=%zu", url, len); /* serve file directly */ response = MHD_create_response_from_data(len, data, MHD_YES, MHD_NO); + /* Should we expose mimetype via tcl here or just let the browser + guess? MHD_add_response_header(response, "Content-Type", "image/png"); + */ ret = MHD_queue_response(connection, MHD_HTTP_OK, response); MHD_destroy_response(response); @@ -353,7 +356,7 @@ static int handle_request(struct MHD_Connection * connection, const char * url) static int ahc_echo_inner(void * cls, struct MHD_Connection * connection, const char * url, const char * method, const char * version, - const char * upload_data, unsigned int * upload_data_size, void ** ptr) + const char * upload_data, size_t * upload_data_size, void ** ptr) { int post = 0; @@ -442,7 +445,7 @@ static int ahc_echo_inner(void * cls, struct MHD_Connection * connection, static int ahc_echo(void * cls, struct MHD_Connection * connection, const char * url, const char * method, const char * version, - const char * upload_data, unsigned int * upload_data_size, void ** ptr) + const char * upload_data, size_t * upload_data_size, void ** ptr) { int result; ----------------------------------------------------------------------- Summary of changes: src/server/httpd.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-10 08:38:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 151a270695416824940ca64016b3dcd75d9c75fa (commit) from db6c2871dd3f106ca8b5dc8828a17f8b729de181 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 151a270695416824940ca64016b3dcd75d9c75fa Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Nov 10 08:36:19 2009 +0100 tcl: HostOs now picks up eCos as well during compile time Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/helper/command.c b/src/helper/command.c index d29b6ec..5d69ffb 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -770,6 +770,8 @@ command_context_t* command_init() HostOs = "cygwin"; #elif defined(__MINGW32__) HostOs = "mingw32"; +#elif defined(__ECOS) + HostOs = "ecos"; #else #warn unrecognized host OS... HostOs = "other"; ----------------------------------------------------------------------- Summary of changes: src/helper/command.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-10 06:41:43
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via db6c2871dd3f106ca8b5dc8828a17f8b729de181 (commit) via 841721929a63bb77379b1598d91ed85b85021734 (commit) via 23d88e57748bece953ddf1063017152243abc93a (commit) via 8d6dcb9d39f0f948ef44beff991337b830fc4567 (commit) from ef6387a0c90913b888aea33ac7a275a246e3e8e3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit db6c2871dd3f106ca8b5dc8828a17f8b729de181 Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 21:24:45 2009 -0800 svf,xsvf,arm7_9_common: trim forard declarations Remove forward declarations by reordering command registration. diff --git a/src/svf/svf.c b/src/svf/svf.c index 9c597bf..ba6ed1b 100644 --- a/src/svf/svf.c +++ b/src/svf/svf.c @@ -210,7 +210,6 @@ static int svf_read_command_from_file(int fd); static int svf_check_tdo(void); static int svf_add_check_para(uint8_t enabled, int buffer_offset, int bit_len); static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str); -static int handle_svf_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int svf_fd = 0; static char *svf_command_buffer = NULL; @@ -225,14 +224,6 @@ static int svf_buffer_index = 0, svf_buffer_size = 0; static int svf_quiet = 0; -int svf_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "svf", handle_svf_command, - COMMAND_EXEC, "run svf <file>"); - - return ERROR_OK; -} - static void svf_free_xxd_para(svf_xxr_para_t *para) { if (NULL != para) @@ -1468,3 +1459,12 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str) return ERROR_OK; } + +int svf_register_commands(struct command_context_s *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "svf", + &handle_svf_command, COMMAND_EXEC, + "run svf <file>"); + + return ERROR_OK; +} diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index b251ec5..a3c6a56 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -39,16 +39,6 @@ int arm7_9_debug_entry(target_t *target); -/* command handler forward declarations */ -int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_write_xpsr_im8_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_read_core_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_write_core_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_dbgrq_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_fast_memory_access_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_dcc_downloads_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_arm7_9_etm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - /** * Clear watchpoints for an ARM7/9 target. * @@ -2881,31 +2871,6 @@ int arm7_9_blank_check_memory(struct target_s *target, uint32_t address, uint32_ return ERROR_OK; } -int arm7_9_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *arm7_9_cmd; - - arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9", NULL, COMMAND_ANY, "arm7/9 specific commands"); - - register_command(cmd_ctx, arm7_9_cmd, "write_xpsr", handle_arm7_9_write_xpsr_command, COMMAND_EXEC, "write program status register <value> <not cpsr | spsr>"); - register_command(cmd_ctx, arm7_9_cmd, "write_xpsr_im8", handle_arm7_9_write_xpsr_im8_command, COMMAND_EXEC, "write program status register <8bit immediate> <rotate> <not cpsr | spsr>"); - - register_command(cmd_ctx, arm7_9_cmd, "write_core_reg", handle_arm7_9_write_core_reg_command, COMMAND_EXEC, "write core register <num> <mode> <value>"); - - register_command(cmd_ctx, arm7_9_cmd, "dbgrq", handle_arm7_9_dbgrq_command, - COMMAND_ANY, "use EmbeddedICE dbgrq instead of breakpoint for target halt requests <enable | disable>"); - register_command(cmd_ctx, arm7_9_cmd, "fast_memory_access", handle_arm7_9_fast_memory_access_command, - COMMAND_ANY, "use fast memory accesses instead of slower but potentially safer accesses <enable | disable>"); - register_command(cmd_ctx, arm7_9_cmd, "dcc_downloads", handle_arm7_9_dcc_downloads_command, - COMMAND_ANY, "use DCC downloads for larger memory writes <enable | disable>"); - - armv4_5_register_commands(cmd_ctx); - - etm_register_commands(cmd_ctx); - - return ERROR_OK; -} - int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { uint32_t value; @@ -3178,3 +3143,41 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9) return ERROR_OK; } + +int arm7_9_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *arm7_9_cmd; + + arm7_9_cmd = register_command(cmd_ctx, NULL, "arm7_9", + NULL, COMMAND_ANY, "arm7/9 specific commands"); + + register_command(cmd_ctx, arm7_9_cmd, "write_xpsr", + handle_arm7_9_write_xpsr_command, COMMAND_EXEC, + "write program status register <value> <not cpsr | spsr>"); + register_command(cmd_ctx, arm7_9_cmd, "write_xpsr_im8", + handle_arm7_9_write_xpsr_im8_command, COMMAND_EXEC, + "write program status register " + "<8bit immediate> <rotate> <not cpsr | spsr>"); + + register_command(cmd_ctx, arm7_9_cmd, "write_core_reg", + handle_arm7_9_write_core_reg_command, COMMAND_EXEC, + "write core register <num> <mode> <value>"); + + register_command(cmd_ctx, arm7_9_cmd, "dbgrq", + handle_arm7_9_dbgrq_command, COMMAND_ANY, + "use EmbeddedICE dbgrq instead of breakpoint " + "for target halt requests <enable | disable>"); + register_command(cmd_ctx, arm7_9_cmd, "fast_memory_access", + handle_arm7_9_fast_memory_access_command, COMMAND_ANY, + "use fast memory accesses instead of slower " + "but potentially safer accesses <enable | disable>"); + register_command(cmd_ctx, arm7_9_cmd, "dcc_downloads", + handle_arm7_9_dcc_downloads_command, COMMAND_ANY, + "use DCC downloads for larger memory writes <enable | disable>"); + + armv4_5_register_commands(cmd_ctx); + + etm_register_commands(cmd_ctx); + + return ERROR_OK; +} diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index 719470e..17af9ea 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -123,7 +123,6 @@ LSDR 1 TDI (0) #define XSTATE_MAX_PATH 12 -static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int xsvf_fd = 0; @@ -161,14 +160,6 @@ static tap_state_t xsvf_to_tap(int xsvf_state) -int xsvf_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "xsvf", handle_xsvf_command, - COMMAND_EXEC, "run xsvf <file> [virt2] [quiet]"); - - return ERROR_OK; -} - static int xsvf_read_buffer(int num_bits, int fd, uint8_t* buf) { int num_bytes; @@ -1059,6 +1050,14 @@ static int handle_xsvf_command(struct command_context_s *cmd_ctx, char *cmd, cha return ERROR_OK; } +int xsvf_register_commands(struct command_context_s *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "xsvf", + &handle_xsvf_command, COMMAND_EXEC, + "run xsvf <file> [virt2] [quiet]"); + + return ERROR_OK; +} #if 0 /* this comment style used to try and keep uncrustify from adding * at begin of line */ commit 841721929a63bb77379b1598d91ed85b85021734 Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 21:23:38 2009 -0800 command.c: make commands static Removes useless declarations, moving the handler functions to appear before their use in the (much bigger) command registriation function. diff --git a/src/helper/command.c b/src/helper/command.c index bd317e6..d29b6ec 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -47,9 +47,6 @@ int fast_and_dangerous = 0; Jim_Interp *interp = NULL; -int handle_sleep_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_fast_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - int run_command(command_context_t *context, command_t *c, char *words[], int num_words); static void tcl_output(void *privData, const char *file, int line, const char *function, const char *string) @@ -688,6 +685,54 @@ static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return retcode; } +/* sleep command sleeps for <n> miliseconds + * this is useful in target startup scripts + */ +static int handle_sleep_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) +{ + bool busy = false; + if (argc == 2) + { + if (strcmp(args[1], "busy") == 0) + busy = true; + else + return ERROR_COMMAND_SYNTAX_ERROR; + } + else if (argc < 1 || argc > 2) + return ERROR_COMMAND_SYNTAX_ERROR; + + unsigned long duration = 0; + int retval = parse_ulong(args[0], &duration); + if (ERROR_OK != retval) + return retval; + + if (!busy) + { + long long then = timeval_ms(); + while (timeval_ms() - then < (long long)duration) + { + target_call_timer_callbacks_now(); + usleep(1000); + } + } + else + busy_sleep(duration); + + return ERROR_OK; +} + +static int handle_fast_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + if (argc != 1) + return ERROR_COMMAND_SYNTAX_ERROR; + + fast_and_dangerous = strcmp("enable", args[0]) == 0; + + return ERROR_OK; +} + + command_context_t* command_init() { command_context_t* context = malloc(sizeof(command_context_t)); @@ -777,53 +822,6 @@ int command_context_mode(command_context_t *cmd_ctx, enum command_mode mode) return ERROR_OK; } -/* sleep command sleeps for <n> miliseconds - * this is useful in target startup scripts - */ -int handle_sleep_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) -{ - bool busy = false; - if (argc == 2) - { - if (strcmp(args[1], "busy") == 0) - busy = true; - else - return ERROR_COMMAND_SYNTAX_ERROR; - } - else if (argc < 1 || argc > 2) - return ERROR_COMMAND_SYNTAX_ERROR; - - unsigned long duration = 0; - int retval = parse_ulong(args[0], &duration); - if (ERROR_OK != retval) - return retval; - - if (!busy) - { - long long then = timeval_ms(); - while (timeval_ms() - then < (long long)duration) - { - target_call_timer_callbacks_now(); - usleep(1000); - } - } - else - busy_sleep(duration); - - return ERROR_OK; -} - -int handle_fast_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) -{ - if (argc != 1) - return ERROR_COMMAND_SYNTAX_ERROR; - - fast_and_dangerous = strcmp("enable", args[0]) == 0; - - return ERROR_OK; -} - void process_jim_events(void) { #if !BUILD_ECOSBOARD commit 23d88e57748bece953ddf1063017152243abc93a Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 21:22:48 2009 -0800 server: remove useless declarations Remove server command declarations, make handler routines static. diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 3ed2b1f..284def3 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2249,7 +2249,7 @@ int gdb_init(void) return ERROR_OK; } -int handle_gdb_sync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_sync_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc != 0) { @@ -2269,12 +2269,12 @@ int handle_gdb_sync_command(struct command_context_s *cmd_ctx, char *cmd, char * } /* daemon configuration command gdb_port */ -int handle_gdb_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { return server_port_command(cmd_ctx, cmd, args, argc, &gdb_port); } -int handle_gdb_memory_map_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_memory_map_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc == 1) { @@ -2295,7 +2295,7 @@ int handle_gdb_memory_map_command(struct command_context_s *cmd_ctx, char *cmd, return ERROR_COMMAND_SYNTAX_ERROR; } -int handle_gdb_flash_program_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_flash_program_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc == 1) { @@ -2316,7 +2316,7 @@ int handle_gdb_flash_program_command(struct command_context_s *cmd_ctx, char *cm return ERROR_COMMAND_SYNTAX_ERROR; } -int handle_gdb_report_data_abort_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_report_data_abort_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc == 1) { @@ -2338,7 +2338,7 @@ int handle_gdb_report_data_abort_command(struct command_context_s *cmd_ctx, char } /* gdb_breakpoint_override */ -int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc == 0) { @@ -2373,17 +2373,25 @@ int handle_gdb_breakpoint_override_command(struct command_context_s *cmd_ctx, ch int gdb_register_commands(command_context_t *command_context) { - register_command(command_context, NULL, "gdb_sync", handle_gdb_sync_command, - COMMAND_ANY, "next stepi will return immediately allowing GDB fetch register state without affecting target state"); - register_command(command_context, NULL, "gdb_port", handle_gdb_port_command, - COMMAND_ANY, "daemon configuration command gdb_port"); - register_command(command_context, NULL, "gdb_memory_map", handle_gdb_memory_map_command, - COMMAND_CONFIG, "enable or disable memory map"); - register_command(command_context, NULL, "gdb_flash_program", handle_gdb_flash_program_command, - COMMAND_CONFIG, "enable or disable flash program"); - register_command(command_context, NULL, "gdb_report_data_abort", handle_gdb_report_data_abort_command, - COMMAND_CONFIG, "enable or disable reporting data aborts"); - register_command(command_context, NULL, "gdb_breakpoint_override", handle_gdb_breakpoint_override_command, - COMMAND_EXEC, "hard/soft/disable - force breakpoint type for gdb 'break' commands."); + register_command(command_context, NULL, "gdb_sync", + handle_gdb_sync_command, COMMAND_ANY, + "next stepi will return immediately allowing GDB to " + "fetch register state without affecting target state"); + register_command(command_context, NULL, "gdb_port", + handle_gdb_port_command, COMMAND_ANY, + "daemon configuration command gdb_port"); + register_command(command_context, NULL, "gdb_memory_map", + handle_gdb_memory_map_command, COMMAND_CONFIG, + "enable or disable memory map"); + register_command(command_context, NULL, "gdb_flash_program", + handle_gdb_flash_program_command, COMMAND_CONFIG, + "enable or disable flash program"); + register_command(command_context, NULL, "gdb_report_data_abort", + handle_gdb_report_data_abort_command, COMMAND_CONFIG, + "enable or disable reporting data aborts"); + register_command(command_context, NULL, "gdb_breakpoint_override", + handle_gdb_breakpoint_override_command, COMMAND_EXEC, + "hard/soft/disable - force type of breakpoint " + "used by gdb 'break' commands."); return ERROR_OK; } diff --git a/src/server/server.c b/src/server/server.c index 03f0ee6..0501869 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -41,7 +41,6 @@ service_t *services = NULL; /* shutdown_openocd == 1: exit the main event loop, and quit the debugger */ static int shutdown_openocd = 0; -int handle_shutdown_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); /* set when using pipes rather than tcp */ int server_use_pipes = 0; @@ -534,22 +533,25 @@ int server_quit(void) return ERROR_OK; } -int server_register_commands(command_context_t *context) +/* tell the server we want to shut down */ +static int handle_shutdown_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { - register_command(context, NULL, "shutdown", handle_shutdown_command, - COMMAND_ANY, "shut the server down"); + shutdown_openocd = 1; - return ERROR_OK; + return ERROR_COMMAND_CLOSE_CONNECTION; } -/* tell the server we want to shut down */ -int handle_shutdown_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +int server_register_commands(command_context_t *context) { - shutdown_openocd = 1; + register_command(context, NULL, "shutdown", + handle_shutdown_command, COMMAND_ANY, + "shut the server down"); - return ERROR_COMMAND_CLOSE_CONNECTION; + return ERROR_OK; } + int server_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, unsigned short *out) { diff --git a/src/server/tcl_server.c b/src/server/tcl_server.c index 178d86b..2e93e36 100644 --- a/src/server/tcl_server.c +++ b/src/server/tcl_server.c @@ -36,9 +36,6 @@ typedef struct tcl_connection_s { static unsigned short tcl_port = 6666; -/* commands */ -static int handle_tcl_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - /* handlers */ static int tcl_new_connection(connection_t *connection); static int tcl_input(connection_t *connection); @@ -173,14 +170,16 @@ int tcl_init(void) return retval; } -int tcl_register_commands(command_context_t *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "tcl_port", handle_tcl_port_command, COMMAND_CONFIG, "port on which to listen for incoming TCL syntax"); - return ERROR_OK; -} - static int handle_tcl_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { return server_port_command(cmd_ctx, cmd, args, argc, &tcl_port); } + +int tcl_register_commands(command_context_t *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "tcl_port", + handle_tcl_port_command, COMMAND_CONFIG, + "port on which to listen for incoming TCL syntax"); + return ERROR_OK; +} diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index c9c60bb..84959e3 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -32,9 +32,6 @@ static unsigned short telnet_port = 4444; -int handle_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int handle_telnet_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - static char *negotiate = "\xFF\xFB\x03" /* IAC WILL Suppress Go Ahead */ "\xFF\xFB\x01" /* IAC WILL Echo */ @@ -608,24 +605,30 @@ int telnet_init(char *banner) return ERROR_OK; } -int telnet_register_commands(command_context_t *command_context) -{ - register_command(command_context, NULL, "exit", handle_exit_command, - COMMAND_EXEC, "exit telnet session"); - - register_command(command_context, NULL, "telnet_port", handle_telnet_port_command, - COMMAND_ANY, "port on which to listen for incoming telnet connections"); - - return ERROR_OK; -} - /* daemon configuration command telnet_port */ -int handle_telnet_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_telnet_port_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { return server_port_command(cmd_ctx, cmd, args, argc, &telnet_port); } -int handle_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_exit_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { return ERROR_COMMAND_CLOSE_CONNECTION; } + +int telnet_register_commands(command_context_t *command_context) +{ + register_command(command_context, NULL, "exit", + &handle_exit_command, COMMAND_EXEC, + "exit telnet session"); + + register_command(command_context, NULL, "telnet_port", + &handle_telnet_port_command, COMMAND_ANY, + "port on which to listen for incoming telnet connections"); + + return ERROR_OK; +} + + commit 8d6dcb9d39f0f948ef44beff991337b830fc4567 Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 21:21:06 2009 -0800 jtag: remove useless declarations Contrary to my previous assessment, some opportunities to remove forward declarations were overlooked. Remove them by moving the definitions of the command registration and interface structure to the end of files. diff --git a/src/jtag/amt_jtagaccel.c b/src/jtag/amt_jtagaccel.c index e3f440c..abfaadc 100644 --- a/src/jtag/amt_jtagaccel.c +++ b/src/jtag/amt_jtagaccel.c @@ -72,15 +72,6 @@ static int data_mode = IEEE1284_MODE_EPP | IEEE1284_DATA ; #endif // PARPORT_USE_PPDEV -static int amt_jtagaccel_execute_queue(void); -static int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx); -static int amt_jtagaccel_speed(int speed); -static int amt_jtagaccel_init(void); -static int amt_jtagaccel_quit(void); - -static int amt_jtagaccel_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - /* tap_move[i][j]: tap movement command to go from state i to state j * 0: Test-Logic-Reset * 1: Run-Test/Idle @@ -101,28 +92,6 @@ static uint8_t amt_jtagaccel_tap_move[6][6][2] = }; -jtag_interface_t amt_jtagaccel_interface = -{ - .name = "amt_jtagaccel", - - .execute_queue = amt_jtagaccel_execute_queue, - - .speed = amt_jtagaccel_speed, - .register_commands = amt_jtagaccel_register_commands, - .init = amt_jtagaccel_init, - .quit = amt_jtagaccel_quit, -}; - -static int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "parport_port", amt_jtagaccel_handle_parport_port_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "rtck", amt_jtagaccel_handle_rtck_command, - COMMAND_CONFIG, NULL); - - return ERROR_OK; -} - static void amt_jtagaccel_reset(int trst, int srst) { if (trst == 1) @@ -571,3 +540,24 @@ static int amt_jtagaccel_handle_rtck_command(struct command_context_s *cmd_ctx, return ERROR_OK; } + +static int amt_jtagaccel_register_commands(struct command_context_s *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "parport_port", + amt_jtagaccel_handle_parport_port_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "rtck", + amt_jtagaccel_handle_rtck_command, COMMAND_CONFIG, + NULL); + + return ERROR_OK; +} + +jtag_interface_t amt_jtagaccel_interface = { + .name = "amt_jtagaccel", + .register_commands = &amt_jtagaccel_register_commands, + .init = &amt_jtagaccel_init, + .quit = &amt_jtagaccel_quit, + .speed = &amt_jtagaccel_speed, + .execute_queue = &amt_jtagaccel_execute_queue, + }; diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index b3389cc..243479d 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -90,20 +90,6 @@ #endif #endif -static int ft2232_execute_queue(void); -static int ft2232_speed(int speed); -static int ft2232_speed_div(int speed, int* khz); -static int ft2232_khz(int khz, int* jtag_speed); -static int ft2232_register_commands(struct command_context_s* cmd_ctx); -static int ft2232_init(void); -static int ft2232_quit(void); - -static int ft2232_handle_device_desc_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc); -static int ft2232_handle_serial_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc); -static int ft2232_handle_layout_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc); -static int ft2232_handle_vid_pid_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc); -static int ft2232_handle_latency_command(struct command_context_s* cmd_ctx, char* cmd, char** args, int argc); - /** * Send out \a num_cycles on the TCK line while the TAP(s) are in a * stable state. Calling code must ensure that current state is stable, @@ -349,18 +335,6 @@ static void move_to_state(tap_state_t goal_state) clock_tms(0x4b, tms_bits, tms_count, 0); } -jtag_interface_t ft2232_interface = -{ - .name = "ft2232", - .execute_queue = ft2232_execute_queue, - .speed = ft2232_speed, - .speed_div = ft2232_speed_div, - .khz = ft2232_khz, - .register_commands = ft2232_register_commands, - .init = ft2232_init, - .quit = ft2232_quit, -}; - static int ft2232_write(uint8_t* buf, int size, uint32_t* bytes_written) { #if BUILD_FT2232_FTD2XX == 1 @@ -590,21 +564,6 @@ static int ft2232_khz(int khz, int* jtag_speed) return ERROR_OK; } -static int ft2232_register_commands(struct command_context_s* cmd_ctx) -{ - register_command(cmd_ctx, NULL, "ft2232_device_desc", ft2232_handle_device_desc_command, - COMMAND_CONFIG, "the USB device description of the FTDI FT2232 device"); - register_command(cmd_ctx, NULL, "ft2232_serial", ft2232_handle_serial_command, - COMMAND_CONFIG, "the serial number of the FTDI FT2232 device"); - register_command(cmd_ctx, NULL, "ft2232_layout", ft2232_handle_layout_command, - COMMAND_CONFIG, "the layout of the FT2232 GPIO signals used to control output-enables and reset signals"); - register_command(cmd_ctx, NULL, "ft2232_vid_pid", ft2232_handle_vid_pid_command, - COMMAND_CONFIG, "the vendor ID and product ID of the FTDI FT2232 device"); - register_command(cmd_ctx, NULL, "ft2232_latency", ft2232_handle_latency_command, - COMMAND_CONFIG, "set the FT2232 latency timer to a new value"); - return ERROR_OK; -} - static void ft2232_end_state(tap_state_t state) { if (tap_is_state_stable(state)) @@ -1804,7 +1763,7 @@ static int ft2232_execute_command(jtag_command_t *cmd) return retval; } -static int ft2232_execute_queue() +static int ft2232_execute_queue(void) { jtag_command_t* cmd = jtag_command_queue; /* currently processed command */ int retval; @@ -4011,3 +3970,37 @@ static void ktlink_blink(void) buffer_write(high_output); buffer_write(high_direction); } + +static int ft2232_register_commands(struct command_context_s* cmd_ctx) +{ + register_command(cmd_ctx, NULL, "ft2232_device_desc", + ft2232_handle_device_desc_command, COMMAND_CONFIG, + "the USB device description of the FTDI FT2232 device"); + register_command(cmd_ctx, NULL, "ft2232_serial", + ft2232_handle_serial_command, COMMAND_CONFIG, + "the serial number of the FTDI FT2232 device"); + register_command(cmd_ctx, NULL, "ft2232_layout", + ft2232_handle_layout_command, COMMAND_CONFIG, + "the layout of the FT2232 GPIO signals used " + "to control output-enables and reset signals"); + register_command(cmd_ctx, NULL, "ft2232_vid_pid", + ft2232_handle_vid_pid_command, COMMAND_CONFIG, + "the vendor ID and product ID of the FTDI FT2232 device"); + register_command(cmd_ctx, NULL, "ft2232_latency", + ft2232_handle_latency_command, COMMAND_CONFIG, + "set the FT2232 latency timer to a new value"); + + return ERROR_OK; +} + + +jtag_interface_t ft2232_interface = { + .name = "ft2232", + .register_commands = &ft2232_register_commands, + .init = &ft2232_init, + .quit = &ft2232_quit, + .speed = &ft2232_speed, + .speed_div = &ft2232_speed_div, + .khz = &ft2232_khz, + .execute_queue = &ft2232_execute_queue, + }; diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c index 4b0ffd7..35473ab 100644 --- a/src/jtag/gw16012.c +++ b/src/jtag/gw16012.c @@ -78,34 +78,6 @@ static uint8_t gw16012_control_value = 0x0; static int device_handle; #endif -static int gw16012_execute_queue(void); -static int gw16012_register_commands(struct command_context_s *cmd_ctx); -static int gw16012_speed(int speed); -static int gw16012_init(void); -static int gw16012_quit(void); - -static int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -jtag_interface_t gw16012_interface = -{ - .name = "gw16012", - - .execute_queue = gw16012_execute_queue, - - .speed = gw16012_speed, - .register_commands = gw16012_register_commands, - .init = gw16012_init, - .quit = gw16012_quit, -}; - -static int gw16012_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "parport_port", gw16012_handle_parport_port_command, - COMMAND_CONFIG, NULL); - - return ERROR_OK; -} - static void gw16012_data(uint8_t value) { value = (value & 0x7f) | gw16012_msb; @@ -589,3 +561,21 @@ static int gw16012_handle_parport_port_command(struct command_context_s *cmd_ctx return ERROR_OK; } + +static int gw16012_register_commands(struct command_context_s *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "parport_port", + gw16012_handle_parport_port_command, COMMAND_CONFIG, + NULL); + + return ERROR_OK; +} + +jtag_interface_t gw16012_interface = { + .name = "gw16012", + .register_commands = &gw16012_register_commands, + .init = &gw16012_init, + .quit = &gw16012_quit, + .speed = &gw16012_speed, + .execute_queue = &gw16012_execute_queue, + }; diff --git a/src/jtag/parport.c b/src/jtag/parport.c index 12a5eea..fdf7df4 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -118,43 +118,6 @@ static unsigned long dataport; static unsigned long statusport; #endif -/* low level command set - */ -static int parport_read(void); -static void parport_write(int tck, int tms, int tdi); -static void parport_reset(int trst, int srst); -static void parport_led(int on); - -static int parport_speed(int speed); -static int parport_register_commands(struct command_context_s *cmd_ctx); -static int parport_init(void); -static int parport_quit(void); - -/* interface commands */ -static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -jtag_interface_t parport_interface = -{ - .name = "parport", - - .execute_queue = bitbang_execute_queue, - - .speed = parport_speed, - .register_commands = parport_register_commands, - .init = parport_init, - .quit = parport_quit, -}; - -static bitbang_interface_t parport_bitbang = -{ - .read = parport_read, - .write = parport_write, - .reset = parport_reset, - .blink = parport_led -}; - static int parport_read(void) { int data = 0; @@ -244,18 +207,6 @@ static int parport_speed(int speed) return ERROR_OK; } -static int parport_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "parport_port", parport_handle_parport_port_command, - COMMAND_CONFIG, "either the address of the I/O port or the number of the '/dev/parport' device"); - register_command(cmd_ctx, NULL, "parport_cable", parport_handle_parport_cable_command, - COMMAND_CONFIG, "the layout of the parallel port cable used to connect to the target"); - register_command(cmd_ctx, NULL, "parport_write_on_exit", parport_handle_write_on_exit_command, - COMMAND_CONFIG, "configure the parallel driver to write a known value to the parallel interface"); - - return ERROR_OK; -} - #if PARPORT_USE_GIVEIO == 1 static int parport_get_giveio_access(void) { @@ -282,6 +233,13 @@ static int parport_get_giveio_access(void) } #endif +static bitbang_interface_t parport_bitbang = { + .read = &parport_read, + .write = &parport_write, + .reset = &parport_reset, + .blink = &parport_led, + }; + static int parport_init(void) { cable_t *cur_cable; @@ -479,3 +437,32 @@ static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ct return ERROR_OK; } + +static int parport_register_commands(struct command_context_s *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "parport_port", + parport_handle_parport_port_command, COMMAND_CONFIG, + "either the address of the I/O port " + "or the number of the '/dev/parport' device"); + + register_command(cmd_ctx, NULL, "parport_cable", + parport_handle_parport_cable_command, COMMAND_CONFIG, + "the layout of the parallel port cable " + "used to connect to the target"); + + register_command(cmd_ctx, NULL, "parport_write_on_exit", + parport_handle_write_on_exit_command, COMMAND_CONFIG, + "configure the parallel driver to write " + "a known value to the parallel interface"); + + return ERROR_OK; +} + +jtag_interface_t parport_interface = { + .name = "parport", + .register_commands = &parport_register_commands, + .init = &parport_init, + .quit = &parport_quit, + .speed = &parport_speed, + .execute_queue = &bitbang_execute_queue, + }; diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 574f266..71efc8b 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -51,32 +51,6 @@ static const Jim_Nvp nvp_jtag_tap_event[] = { extern jtag_interface_t *jtag_interface; -/* jtag commands */ -static int handle_interface_list_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc); -static int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_jtag_rclk_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -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); - -static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *argv); -static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *argv); -static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args); - -static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_verify_jtag_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_tms_sequence_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - - enum jtag_tap_cfg_param { JCFG_EVENT }; @@ -604,59 +578,6 @@ void jtag_notify_event(enum jtag_event event) } -int jtag_register_commands(struct command_context_s *cmd_ctx) -{ - register_jim(cmd_ctx, "jtag", jim_jtag_command, "perform jtag tap actions"); - - register_command(cmd_ctx, NULL, "interface", handle_interface_command, - COMMAND_CONFIG, "try to configure interface"); - register_command(cmd_ctx, NULL, - "interface_list", &handle_interface_list_command, - COMMAND_ANY, "list all built-in interfaces"); - register_command(cmd_ctx, NULL, "jtag_khz", handle_jtag_khz_command, - COMMAND_ANY, "set maximum jtag speed (if supported); " - "parameter is maximum khz, or 0 for adaptive clocking (RTCK)."); - register_command(cmd_ctx, NULL, "jtag_rclk", handle_jtag_rclk_command, - COMMAND_ANY, "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed"); - register_command(cmd_ctx, NULL, "reset_config", handle_reset_config_command, - COMMAND_ANY, - "reset_config " - "[none|trst_only|srst_only|trst_and_srst] " - "[srst_pulls_trst|trst_pulls_srst|combined|separate] " - "[srst_gates_jtag|srst_nogate] " - "[trst_push_pull|trst_open_drain] " - "[srst_push_pull|srst_open_drain]"); - register_command(cmd_ctx, NULL, "jtag_nsrst_delay", handle_jtag_nsrst_delay_command, - 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"); - - register_command(cmd_ctx, NULL, "jtag_reset", handle_jtag_reset_command, - COMMAND_EXEC, "toggle reset lines <trst> <srst>"); - register_command(cmd_ctx, NULL, "runtest", handle_runtest_command, - COMMAND_EXEC, "move to Run-Test/Idle, and execute <num_cycles>"); - register_command(cmd_ctx, NULL, "irscan", handle_irscan_command, - COMMAND_EXEC, "execute IR scan <device> <instr> [dev2] [instr2] ..."); - register_jim(cmd_ctx, "drscan", Jim_Command_drscan, "execute DR scan <device> <num_bits> <value> <num_bits1> <value2> ..."); - register_jim(cmd_ctx, "flush_count", Jim_Command_flush_count, "returns number of times the JTAG queue has been flushed"); - register_jim(cmd_ctx, "pathmove", Jim_Command_pathmove, "move JTAG to state1 then to state2, state3, etc. <state1>,<state2>,<stat3>..."); - - register_command(cmd_ctx, NULL, "verify_ircapture", handle_verify_ircapture_command, - COMMAND_ANY, "verify value captured during Capture-IR <enable | disable>"); - register_command(cmd_ctx, NULL, "verify_jtag", handle_verify_jtag_command, - COMMAND_ANY, "verify value capture <enable | disable>"); - register_command(cmd_ctx, NULL, "tms_sequence", handle_tms_sequence_command, - COMMAND_ANY, "choose short(default) or long tms_sequence <short | long>"); - return ERROR_OK; -} - static int default_khz(int khz, int *jtag_speed) { LOG_ERROR("Translation from khz to jtag_speed not implemented"); @@ -681,6 +602,22 @@ static int default_srst_asserted(int *srst_asserted) return ERROR_OK; } +static int handle_interface_list_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) +{ + if (strcmp(cmd, "interface_list") == 0 && argc > 0) + return ERROR_COMMAND_SYNTAX_ERROR; + + command_print(cmd_ctx, "The following JTAG interfaces are available:"); + for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) + { + const char *name = jtag_interfaces[i]->name; + command_print(cmd_ctx, "%u: %s", i + 1, name); + } + + return ERROR_OK; +} + static int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { @@ -726,22 +663,6 @@ static int handle_interface_command(struct command_context_s *cmd_ctx, return ERROR_JTAG_INVALID_INTERFACE; } -static int handle_interface_list_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc) -{ - if (strcmp(cmd, "interface_list") == 0 && argc > 0) - return ERROR_COMMAND_SYNTAX_ERROR; - - command_print(cmd_ctx, "The following JTAG interfaces are available:"); - for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) - { - const char *name = jtag_interfaces[i]->name; - command_print(cmd_ctx, "%u: %s", i + 1, name); - } - - return ERROR_OK; -} - static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { jtag_tap_t *tap; @@ -1501,3 +1422,90 @@ static int handle_tms_sequence_command(struct command_context_s *cmd_ctx, char * return ERROR_OK; } + +int jtag_register_commands(struct command_context_s *cmd_ctx) +{ + register_jim(cmd_ctx, "jtag", jim_jtag_command, + "perform jtag tap actions"); + + register_command(cmd_ctx, NULL, "interface", + handle_interface_command, COMMAND_CONFIG, + "try to configure interface"); + register_command(cmd_ctx, NULL, "interface_list", + &handle_interface_list_command, COMMAND_ANY, + "list all built-in interfaces"); + + register_command(cmd_ctx, NULL, "jtag_khz", + handle_jtag_khz_command, COMMAND_ANY, + "set maximum jtag speed (if supported); " + "parameter is maximum khz, or 0 for adaptive clocking (RTCK)."); + register_command(cmd_ctx, NULL, "jtag_rclk", + handle_jtag_rclk_command, COMMAND_ANY, + "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed"); + register_command(cmd_ctx, NULL, "reset_config", + handle_reset_config_command, COMMAND_ANY, + "reset_config " + "[none|trst_only|srst_only|trst_and_srst] " + "[srst_pulls_trst|trst_pulls_srst|combined|separate] " + "[srst_gates_jtag|srst_nogate] " + "[trst_push_pull|trst_open_drain] " + "[srst_push_pull|srst_open_drain]"); + + register_command(cmd_ctx, NULL, "jtag_nsrst_delay", + handle_jtag_nsrst_delay_command, 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"); + + register_command(cmd_ctx, NULL, "jtag_reset", + handle_jtag_reset_command, COMMAND_EXEC, + "toggle reset lines <trst> <srst>"); + register_command(cmd_ctx, NULL, "runtest", + handle_runtest_command, COMMAND_EXEC, + "move to Run-Test/Idle, and execute <num_cycles>"); + register_command(cmd_ctx, NULL, "irscan", + handle_irscan_command, COMMAND_EXEC, + "execute IR scan <device> <instr> [dev2] [instr2] ..."); + + register_jim(cmd_ctx, "drscan", Jim_Command_drscan, + "execute DR scan <device> " + "<num_bits> <value> <num_bits1> <value2> ..."); + + register_jim(cmd_ctx, "flush_count", Jim_Command_flush_count, + "returns number of times the JTAG queue has been flushed"); + + register_jim(cmd_ctx, "pathmove", Jim_Command_pathmove, + "<state1>,<state2>,<state3>... " + "- move JTAG to state1 then to state2, state3, etc."); + + register_command(cmd_ctx, NULL, "verify_ircapture", + handle_verify_ircapture_command, COMMAND_ANY, + "verify value captured during Capture-IR <enable | disable>"); + register_command(cmd_ctx, NULL, "verify_jtag", + handle_verify_jtag_command, COMMAND_ANY, + "verify value capture <enable | disable>"); + + register_command(cmd_ctx, NULL, "tms_sequence", + handle_tms_sequence_command, COMMAND_ANY, + "choose short(default) or long tms_sequence <short | long>"); + + return ERROR_OK; +} + + diff --git a/src/jtag/vsllink.c b/src/jtag/vsllink.c index 3c1a046..b008467 100644 --- a/src/jtag/vsllink.c +++ b/src/jtag/vsllink.c @@ -176,23 +176,6 @@ typedef struct static int pending_scan_results_length; static pending_scan_result_t pending_scan_results_buffer[MAX_PENDING_SCAN_RESULTS]; -/* External interface functions */ -static int vsllink_execute_queue(void); -static int vsllink_speed(int speed); -static int vsllink_khz(int khz, int *jtag_speed); -static int vsllink_speed_div(int jtag_speed, int *khz); -static int vsllink_register_commands(struct command_context_s *cmd_ctx); -static int vsllink_init(void); -static int vsllink_quit(void); - -/* CLI command handler functions */ -static int vsllink_handle_usb_vid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_usb_pid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_usb_bulkin_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_usb_bulkout_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_usb_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int vsllink_handle_mode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - /* Queue command functions */ static void vsllink_end_state(tap_state_t state); static void vsllink_state_move_dma(void); @@ -255,21 +238,6 @@ static int last_tms; static vsllink_jtag_t* vsllink_jtag_handle = NULL; -/***************************************************************************/ -/* External interface implementation */ - -jtag_interface_t vsllink_interface = -{ - .name = "vsllink", - .execute_queue = vsllink_execute_queue, - .speed = vsllink_speed, - .khz = vsllink_khz, - .speed_div = vsllink_speed_div, - .register_commands = vsllink_register_commands, - .init = vsllink_init, - .quit = vsllink_quit -}; - static void reset_command_pointer(void) { if (vsllink_mode == VSLLINK_MODE_NORMAL) @@ -1357,24 +1325,6 @@ static void vsllink_simple_command(uint8_t command) } } -static int vsllink_register_commands(struct command_context_s *cmd_ctx) -{ - register_command(cmd_ctx, NULL, "vsllink_usb_vid", vsllink_handle_usb_vid_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_pid", vsllink_handle_usb_pid_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", vsllink_handle_usb_bulkin_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", vsllink_handle_usb_bulkout_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_usb_interface", vsllink_handle_usb_interface_command, - COMMAND_CONFIG, NULL); - register_command(cmd_ctx, NULL, "vsllink_mode", vsllink_handle_mode_command, - COMMAND_CONFIG, NULL); - - return ERROR_OK; -} - static int vsllink_handle_mode_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc != 1) { @@ -1932,3 +1882,38 @@ static void vsllink_debug_buffer(uint8_t *buffer, int length) } } #endif // _DEBUG_USB_COMMS_ || _DEBUG_JTAG_IO_ + +static int vsllink_register_commands(struct command_context_s *cmd_ctx) +{ + register_command(cmd_ctx, NULL, "vsllink_usb_vid", + vsllink_handle_usb_vid_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_usb_pid", + vsllink_handle_usb_pid_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_usb_bulkin", + vsllink_handle_usb_bulkin_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_usb_bulkout", + vsllink_handle_usb_bulkout_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_usb_interface", + vsllink_handle_usb_interface_command, COMMAND_CONFIG, + NULL); + register_command(cmd_ctx, NULL, "vsllink_mode", + vsllink_handle_mode_command, COMMAND_CONFIG, + NULL); + + return ERROR_OK; +} + +jtag_interface_t vsllink_interface = { + .name = "vsllink", + .register_commands = &vsllink_register_commands, + .init = &vsllink_init, + .quit = &vsllink_quit, + .khz = &vsllink_khz, + .speed = &vsllink_speed, + .speed_div = &vsllink_speed_div, + .execute_queue = &vsllink_execute_queue, + }; ----------------------------------------------------------------------- Summary of changes: src/helper/command.c | 98 +++++++++++----------- src/jtag/amt_jtagaccel.c | 52 +++++------- src/jtag/ft2232.c | 77 ++++++++--------- src/jtag/gw16012.c | 46 ++++------ src/jtag/parport.c | 85 ++++++++----------- src/jtag/tcl.c | 198 +++++++++++++++++++++++--------------------- src/jtag/vsllink.c | 85 ++++++++----------- src/server/gdb_server.c | 44 ++++++---- src/server/server.c | 20 +++-- src/server/tcl_server.c | 17 ++-- src/server/telnet_server.c | 35 ++++---- src/svf/svf.c | 18 ++-- src/target/arm7_9_common.c | 73 +++++++++-------- src/xsvf/xsvf.c | 17 ++-- 14 files changed, 415 insertions(+), 450 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-10 04:27:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ef6387a0c90913b888aea33ac7a275a246e3e8e3 (commit) from 2351641b8f4d0f09912ef0c8bf11578b841230e7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ef6387a0c90913b888aea33ac7a275a246e3e8e3 Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 19:24:06 2009 -0800 target.c: remove useless declarations This patch removes the last batch of forward references from the tree, moving the target command registration routines to the end of the file. diff --git a/src/target/target.c b/src/target/target.c index 6e5d3fb..66e8699 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -43,35 +43,7 @@ #include "jtag.h" -static int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -static int handle_reg_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_poll_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_wait_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_md_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_mw_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_verify_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_test_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_bp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc); -static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_fast_load_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -static int jim_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv); static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv); -static int jim_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv); -static int jim_target(Jim_Interp *interp, int argc, Jim_Obj *const *argv); static int target_array2mem(Jim_Interp *interp, target_t *target, int argc, Jim_Obj *const *argv); static int target_mem2array(Jim_Interp *interp, target_t *target, int argc, Jim_Obj *const *argv); @@ -1251,19 +1223,6 @@ void target_free_all_working_areas(struct target_s *target) target_free_all_working_areas_restore(target, 1); } -int target_register_commands(struct command_context_s *cmd_ctx) -{ - - register_command(cmd_ctx, NULL, "targets", - handle_targets_command, COMMAND_EXEC, - "change current command line target (one parameter) " - "or list targets (no parameters)"); - - register_jim(cmd_ctx, "target", jim_target, "configure target"); - - return ERROR_OK; -} - int target_arch_state(struct target_s *target) { int retval; @@ -1658,68 +1617,6 @@ int target_write_u8(struct target_s *target, uint32_t address, uint8_t value) return retval; } -int target_register_user_commands(struct command_context_s *cmd_ctx) -{ - int retval = ERROR_OK; - - - /* script procedures */ - register_command(cmd_ctx, NULL, "profile", handle_profile_command, COMMAND_EXEC, "profiling samples the CPU PC"); - register_jim(cmd_ctx, "ocd_mem2array", jim_mem2array, "read memory and return as a TCL array for script processing <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>"); - register_jim(cmd_ctx, "ocd_array2mem", jim_array2mem, "convert a TCL array to memory locations and write the values <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>"); - - register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY, - "same args as load_image, image stored in memory - mainly for profiling purposes"); - - register_command(cmd_ctx, NULL, "fast_load", handle_fast_load_command, COMMAND_ANY, - "loads active fast load image to current target - mainly for profiling purposes"); - - - register_command(cmd_ctx, NULL, "virt2phys", handle_virt2phys_command, COMMAND_ANY, "translate a virtual address into a physical address"); - register_command(cmd_ctx, NULL, "reg", handle_reg_command, COMMAND_EXEC, "display or set a register"); - register_command(cmd_ctx, NULL, "poll", handle_poll_command, COMMAND_EXEC, "poll target state"); - register_command(cmd_ctx, NULL, "wait_halt", handle_wait_halt_command, COMMAND_EXEC, "wait for target halt [time (s)]"); - register_command(cmd_ctx, NULL, "halt", handle_halt_command, COMMAND_EXEC, "halt target"); - register_command(cmd_ctx, NULL, "resume", handle_resume_command, COMMAND_EXEC, "resume target [addr]"); - register_command(cmd_ctx, NULL, "step", handle_step_command, COMMAND_EXEC, "step one instruction from current PC or [addr]"); - register_command(cmd_ctx, NULL, "reset", handle_reset_command, COMMAND_EXEC, "reset target [run | halt | init] - default is run"); - register_command(cmd_ctx, NULL, "soft_reset_halt", handle_soft_reset_halt_command, COMMAND_EXEC, "halt the target and do a soft reset"); - - register_command(cmd_ctx, NULL, "mdw", handle_md_command, COMMAND_EXEC, "display memory words [phys] <addr> [count]"); - register_command(cmd_ctx, NULL, "mdh", handle_md_command, COMMAND_EXEC, "display memory half-words [phys] <addr> [count]"); - register_command(cmd_ctx, NULL, "mdb", handle_md_command, COMMAND_EXEC, "display memory bytes [phys] <addr> [count]"); - - register_command(cmd_ctx, NULL, "mww", handle_mw_command, COMMAND_EXEC, "write memory word [phys] <addr> <value> [count]"); - register_command(cmd_ctx, NULL, "mwh", handle_mw_command, COMMAND_EXEC, "write memory half-word [phys] <addr> <value> [count]"); - register_command(cmd_ctx, NULL, "mwb", handle_mw_command, COMMAND_EXEC, "write memory byte [phys] <addr> <value> [count]"); - - register_command(cmd_ctx, NULL, "bp", - handle_bp_command, COMMAND_EXEC, - "list or set breakpoint [<address> <length> [hw]]"); - register_command(cmd_ctx, NULL, "rbp", - handle_rbp_command, COMMAND_EXEC, - "remove breakpoint <address>"); - register_command(cmd_ctx, NULL, "wp", - handle_wp_command, COMMAND_EXEC, - "list or set watchpoint " - "[<address> <length> <r/w/a> [value] [mask]]"); - register_command(cmd_ctx, NULL, "rwp", - handle_rwp_command, COMMAND_EXEC, - "remove watchpoint <address>"); - - register_command(cmd_ctx, NULL, "load_image", handle_load_image_command, COMMAND_EXEC, "load_image <file> <address> ['bin'|'ihex'|'elf'|'s19'] [min_address] [max_length]"); - register_command(cmd_ctx, NULL, "dump_image", handle_dump_image_command, COMMAND_EXEC, "dump_image <file> <address> <size>"); - register_command(cmd_ctx, NULL, "verify_image", handle_verify_image_command, COMMAND_EXEC, "verify_image <file> [offset] [type]"); - register_command(cmd_ctx, NULL, "test_image", handle_test_image_command, COMMAND_EXEC, "test_image <file> [offset] [type]"); - - if ((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK) - return retval; - if ((retval = trace_register_commands(cmd_ctx)) != ERROR_OK) - return retval; - - return retval; -} - static int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target = all_targets; @@ -4835,3 +4732,130 @@ static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return JIM_OK; } + +int target_register_commands(struct command_context_s *cmd_ctx) +{ + + register_command(cmd_ctx, NULL, "targets", + handle_targets_command, COMMAND_EXEC, + "change current command line target (one parameter) " + "or list targets (no parameters)"); + + register_jim(cmd_ctx, "target", jim_target, "configure target"); + + return ERROR_OK; +} + +int target_register_user_commands(struct command_context_s *cmd_ctx) +{ + int retval = ERROR_OK; + if ((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK) + return retval; + + if ((retval = trace_register_commands(cmd_ctx)) != ERROR_OK) + return retval; + + register_command(cmd_ctx, NULL, "profile", + handle_profile_command, COMMAND_EXEC, + "profiling samples the CPU PC"); + + register_jim(cmd_ctx, "ocd_mem2array", jim_mem2array, + "read memory and return as a TCL array for script processing " + "<ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>"); + + register_jim(cmd_ctx, "ocd_array2mem", jim_array2mem, + "convert a TCL array to memory locations and write the values " + "<ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>"); + + register_command(cmd_ctx, NULL, "fast_load_image", + handle_fast_load_image_command, COMMAND_ANY, + "same args as load_image, image stored in memory " + "- mainly for profiling purposes"); + + register_command(cmd_ctx, NULL, "fast_load", + handle_fast_load_command, COMMAND_ANY, + "loads active fast load image to current target " + "- mainly for profiling purposes"); + + + register_command(cmd_ctx, NULL, "virt2phys", + handle_virt2phys_command, COMMAND_ANY, + "translate a virtual address into a physical address"); + register_command(cmd_ctx, NULL, "reg", + handle_reg_command, COMMAND_EXEC, + "display or set a register"); + + register_command(cmd_ctx, NULL, "poll", + handle_poll_command, COMMAND_EXEC, + "poll target state"); + register_command(cmd_ctx, NULL, "wait_halt", + handle_wait_halt_command, COMMAND_EXEC, + "wait for target halt [time (s)]"); + register_command(cmd_ctx, NULL, "halt", + handle_halt_command, COMMAND_EXEC, + "halt target"); + register_command(cmd_ctx, NULL, "resume", + handle_resume_command, COMMAND_EXEC, + "resume target [addr]"); + register_command(cmd_ctx, NULL, "reset", + handle_reset_command, COMMAND_EXEC, + "reset target [run | halt | init] - default is run"); + register_command(cmd_ctx, NULL, "soft_reset_halt", + handle_soft_reset_halt_command, COMMAND_EXEC, + "halt the target and do a soft reset"); + + register_command(cmd_ctx, NULL, "step", + handle_step_command, COMMAND_EXEC, + "step one instruction from current PC or [addr]"); + + register_command(cmd_ctx, NULL, "mdw", + handle_md_command, COMMAND_EXEC, + "display memory words [phys] <addr> [count]"); + register_command(cmd_ctx, NULL, "mdh", + handle_md_command, COMMAND_EXEC, + "display memory half-words [phys] <addr> [count]"); + register_command(cmd_ctx, NULL, "mdb", + handle_md_command, COMMAND_EXEC, + "display memory bytes [phys] <addr> [count]"); + + register_command(cmd_ctx, NULL, "mww", + handle_mw_command, COMMAND_EXEC, + "write memory word [phys] <addr> <value> [count]"); + register_command(cmd_ctx, NULL, "mwh", + handle_mw_command, COMMAND_EXEC, + "write memory half-word [phys] <addr> <value> [count]"); + register_command(cmd_ctx, NULL, "mwb", + handle_mw_command, COMMAND_EXEC, + "write memory byte [phys] <addr> <value> [count]"); + + register_command(cmd_ctx, NULL, "bp", + handle_bp_command, COMMAND_EXEC, + "list or set breakpoint [<address> <length> [hw]]"); + register_command(cmd_ctx, NULL, "rbp", + handle_rbp_command, COMMAND_EXEC, + "remove breakpoint <address>"); + + register_command(cmd_ctx, NULL, "wp", + handle_wp_command, COMMAND_EXEC, + "list or set watchpoint " + "[<address> <length> <r/w/a> [value] [mask]]"); + register_command(cmd_ctx, NULL, "rwp", + handle_rwp_command, COMMAND_EXEC, + "remove watchpoint <address>"); + + register_command(cmd_ctx, NULL, "load_image", + handle_load_image_command, COMMAND_EXEC, + "load_image <file> <address> " + "['bin'|'ihex'|'elf'|'s19'] [min_address] [max_length]"); + register_command(cmd_ctx, NULL, "dump_image", + handle_dump_image_command, COMMAND_EXEC, + "dump_image <file> <address> <size>"); + register_command(cmd_ctx, NULL, "verify_image", + handle_verify_image_command, COMMAND_EXEC, + "verify_image <file> [offset] [type]"); + register_command(cmd_ctx, NULL, "test_image", + handle_test_image_command, COMMAND_EXEC, + "test_image <file> [offset] [type]"); + + return ERROR_OK; +} ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 230 ++++++++++++++++++++++++++++----------------------- 1 files changed, 127 insertions(+), 103 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-10 03:44:17
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 2351641b8f4d0f09912ef0c8bf11578b841230e7 (commit) via 6cd97f48d032e3ead3ee94c56699e162f7032ddd (commit) via 041c319d9dbdc8159cef3257b7f607aaf91b468c (commit) via 712d3fc0fb3ed69342a649d8bbb0d6d901a64720 (commit) via 4cd02c63e9213b7f33ec4ac33d481fb00e00708f (commit) via 770716e9e079f3fb088994e28aa08edfc5afd2fb (commit) via 8b5c5c054d7ae08990e817a52bd28a326b27e54a (commit) via 5c95741df7a582ef4901bc18f85f7c4f38b252dd (commit) from 7269ba5eb6c4c0e3b8dfceba9d5f2c2f4dfc1618 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2351641b8f4d0f09912ef0c8bf11578b841230e7 Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 09:20:34 2009 -0800 {pic32m,stm32}x.c: remove useless declarations Remove useless forward declarations. Moves command registrations to end of files. Moves flash structure definitions to end of files. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/src/flash/pic32mx.c b/src/flash/pic32mx.c index d9966bf..78ed185 100644 --- a/src/flash/pic32mx.c +++ b/src/flash/pic32mx.c @@ -57,58 +57,8 @@ struct pic32mx_devs_s { { 0x00, NULL, 0 } }; -static int pic32mx_register_commands(struct command_context_s *cmd_ctx); -static int pic32mx_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int pic32mx_erase(struct flash_bank_s *bank, int first, int last); -static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last); -static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); static int pic32mx_write_row(struct flash_bank_s *bank, uint32_t address, uint32_t srcaddr); static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint32_t word); -static int pic32mx_probe(struct flash_bank_s *bank); -static int pic32mx_auto_probe(struct flash_bank_s *bank); -//static int pic32mx_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int pic32mx_protect_check(struct flash_bank_s *bank); -static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size); - -#if 0 -int pic32mx_handle_lock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -int pic32mx_handle_unlock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -#endif -static int pic32mx_handle_chip_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -//static int pic32mx_chip_erase(struct flash_bank_s *bank); - -flash_driver_t pic32mx_flash = -{ - .name = "pic32mx", - .register_commands = pic32mx_register_commands, - .flash_bank_command = pic32mx_flash_bank_command, - .erase = pic32mx_erase, - .protect = pic32mx_protect, - .write = pic32mx_write, - .probe = pic32mx_probe, - .auto_probe = pic32mx_auto_probe, - .erase_check = default_flash_mem_blank_check, - .protect_check = pic32mx_protect_check, - .info = pic32mx_info -}; - -static int pic32mx_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *pic32mx_cmd = register_command(cmd_ctx, NULL, "pic32mx", NULL, COMMAND_ANY, "pic32mx flash specific commands"); - -#if 0 - register_command(cmd_ctx, pic32mx_cmd, "lock", pic32mx_handle_lock_command, COMMAND_EXEC, - "lock device"); - register_command(cmd_ctx, pic32mx_cmd, "unlock", pic32mx_handle_unlock_command, COMMAND_EXEC, - "unlock protected device"); -#endif - register_command(cmd_ctx, pic32mx_cmd, "chip_erase", pic32mx_handle_chip_erase_command, COMMAND_EXEC, - "erase device"); - register_command(cmd_ctx, pic32mx_cmd, "pgm_word", pic32mx_handle_pgm_word_command, COMMAND_EXEC, - "program a word"); - return ERROR_OK; -} /* flash bank pic32mx <base> <size> 0 0 <target#> */ @@ -932,3 +882,38 @@ static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, ch return ERROR_OK; } + +static int pic32mx_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *pic32mx_cmd = register_command(cmd_ctx, NULL, "pic32mx", + NULL, COMMAND_ANY, "pic32mx flash specific commands"); +#if 0 + register_command(cmd_ctx, pic32mx_cmd, "lock", + pic32mx_handle_lock_command, COMMAND_EXEC, + "lock device"); + register_command(cmd_ctx, pic32mx_cmd, "unlock", + pic32mx_handle_unlock_command, COMMAND_EXEC, + "unlock protected device"); +#endif + register_command(cmd_ctx, pic32mx_cmd, "chip_erase", + pic32mx_handle_chip_erase_command, COMMAND_EXEC, + "erase device"); + register_command(cmd_ctx, pic32mx_cmd, "pgm_word", + pic32mx_handle_pgm_word_command, COMMAND_EXEC, + "program a word"); + return ERROR_OK; +} + +flash_driver_t pic32mx_flash = { + .name = "pic32mx", + .register_commands = &pic32mx_register_commands, + .flash_bank_command = &pic32mx_flash_bank_command, + .erase = &pic32mx_erase, + .protect = &pic32mx_protect, + .write = &pic32mx_write, + .probe = &pic32mx_probe, + .auto_probe = &pic32mx_auto_probe, + .erase_check = &default_flash_mem_blank_check, + .protect_check = &pic32mx_protect_check, + .info = &pic32mx_info, + }; diff --git a/src/flash/stm32x.c b/src/flash/stm32x.c index 158f264..2ca5fa9 100644 --- a/src/flash/stm32x.c +++ b/src/flash/stm32x.c @@ -29,56 +29,8 @@ #include "binarybuffer.h" -static int stm32x_register_commands(struct command_context_s *cmd_ctx); -static int stm32x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int stm32x_erase(struct flash_bank_s *bank, int first, int last); -static int stm32x_protect(struct flash_bank_s *bank, int set, int first, int last); -static int stm32x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int stm32x_probe(struct flash_bank_s *bank); -static int stm32x_auto_probe(struct flash_bank_s *bank); -//static int stm32x_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int stm32x_protect_check(struct flash_bank_s *bank); -static int stm32x_info(struct flash_bank_s *bank, char *buf, int buf_size); - -static int stm32x_handle_lock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int stm32x_handle_unlock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int stm32x_handle_options_read_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int stm32x_handle_options_write_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int stm32x_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int stm32x_mass_erase(struct flash_bank_s *bank); -flash_driver_t stm32x_flash = -{ - .name = "stm32x", - .register_commands = stm32x_register_commands, - .flash_bank_command = stm32x_flash_bank_command, - .erase = stm32x_erase, - .protect = stm32x_protect, - .write = stm32x_write, - .probe = stm32x_probe, - .auto_probe = stm32x_auto_probe, - .erase_check = default_flash_mem_blank_check, - .protect_check = stm32x_protect_check, - .info = stm32x_info -}; - -static int stm32x_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stm32x", NULL, COMMAND_ANY, "stm32x flash specific commands"); - - register_command(cmd_ctx, stm32x_cmd, "lock", stm32x_handle_lock_command, COMMAND_EXEC, - "lock device"); - register_command(cmd_ctx, stm32x_cmd, "unlock", stm32x_handle_unlock_command, COMMAND_EXEC, - "unlock protected device"); - register_command(cmd_ctx, stm32x_cmd, "mass_erase", stm32x_handle_mass_erase_command, COMMAND_EXEC, - "mass erase device"); - register_command(cmd_ctx, stm32x_cmd, "options_read", stm32x_handle_options_read_command, COMMAND_EXEC, - "read device option bytes"); - register_command(cmd_ctx, stm32x_cmd, "options_write", stm32x_handle_options_write_command, COMMAND_EXEC, - "write device option bytes"); - return ERROR_OK; -} - /* flash bank stm32x <base> <size> 0 0 <target#> */ static int stm32x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) @@ -1228,3 +1180,41 @@ static int stm32x_handle_mass_erase_command(struct command_context_s *cmd_ctx, c return ERROR_OK; } + +static int stm32x_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stm32x", + NULL, COMMAND_ANY, "stm32x flash specific commands"); + + register_command(cmd_ctx, stm32x_cmd, "lock", + stm32x_handle_lock_command, COMMAND_EXEC, + "lock device"); + register_command(cmd_ctx, stm32x_cmd, "unlock", + stm32x_handle_unlock_command, COMMAND_EXEC, + "unlock protected device"); + register_command(cmd_ctx, stm32x_cmd, "mass_erase", + stm32x_handle_mass_erase_command, COMMAND_EXEC, + "mass erase device"); + register_command(cmd_ctx, stm32x_cmd, "options_read", + stm32x_handle_options_read_command, COMMAND_EXEC, + "read device option bytes"); + register_command(cmd_ctx, stm32x_cmd, "options_write", + stm32x_handle_options_write_command, COMMAND_EXEC, + "write device option bytes"); + + return ERROR_OK; +} + +flash_driver_t stm32x_flash = { + .name = "stm32x", + .register_commands = &stm32x_register_commands, + .flash_bank_command = &stm32x_flash_bank_command, + .erase = &stm32x_erase, + .protect = &stm32x_protect, + .write = &stm32x_write, + .probe = &stm32x_probe, + .auto_probe = &stm32x_auto_probe, + .erase_check = &default_flash_mem_blank_check, + .protect_check = &stm32x_protect_check, + .info = &stm32x_info, + }; commit 6cd97f48d032e3ead3ee94c56699e162f7032ddd Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 09:20:34 2009 -0800 str{7,9}x*.c: remove useless forward declarations Remove useless forward declarations. Moves command registrations to end of files. Moves flash structure definitions to end of files. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/src/flash/str7x.c b/src/flash/str7x.c index 650c0bc..ed107f3 100644 --- a/src/flash/str7x.c +++ b/src/flash/str7x.c @@ -45,43 +45,6 @@ str7x_mem_layout_t mem_layout_str7bank1[] = { {0x00002000, 0x02000, 0x20000} }; -static int str7x_register_commands(struct command_context_s *cmd_ctx); -static int str7x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int str7x_erase(struct flash_bank_s *bank, int first, int last); -static int str7x_protect(struct flash_bank_s *bank, int set, int first, int last); -static int str7x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int str7x_probe(struct flash_bank_s *bank); -//static int str7x_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str7x_protect_check(struct flash_bank_s *bank); -static int str7x_info(struct flash_bank_s *bank, char *buf, int buf_size); - -static int str7x_handle_disable_jtag_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -flash_driver_t str7x_flash = -{ - .name = "str7x", - .register_commands = str7x_register_commands, - .flash_bank_command = str7x_flash_bank_command, - .erase = str7x_erase, - .protect = str7x_protect, - .write = str7x_write, - .probe = str7x_probe, - .auto_probe = str7x_probe, - .erase_check = default_flash_blank_check, - .protect_check = str7x_protect_check, - .info = str7x_info -}; - -static int str7x_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *str7x_cmd = register_command(cmd_ctx, NULL, "str7x", NULL, COMMAND_ANY, NULL); - - register_command(cmd_ctx, str7x_cmd, "disable_jtag", str7x_handle_disable_jtag_command, COMMAND_EXEC, - "disable jtag access"); - - return ERROR_OK; -} - static int str7x_get_flash_adr(struct flash_bank_s *bank, uint32_t reg) { str7x_flash_bank_t *str7x_info = bank->driver_priv; @@ -707,3 +670,29 @@ static int str7x_handle_disable_jtag_command(struct command_context_s *cmd_ctx, return ERROR_OK; } + +static int str7x_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *str7x_cmd = register_command(cmd_ctx, NULL, "str7x", + NULL, COMMAND_ANY, "str7x flash specific commands"); + + register_command(cmd_ctx, str7x_cmd, "disable_jtag", + str7x_handle_disable_jtag_command, COMMAND_EXEC, + "disable jtag access"); + + return ERROR_OK; +} + +flash_driver_t str7x_flash = { + .name = "str7x", + .register_commands = &str7x_register_commands, + .flash_bank_command = &str7x_flash_bank_command, + .erase = &str7x_erase, + .protect = &str7x_protect, + .write = &str7x_write, + .probe = &str7x_probe, + .auto_probe = &str7x_probe, + .erase_check = &default_flash_blank_check, + .protect_check = &str7x_protect_check, + .info = &str7x_info, + }; diff --git a/src/flash/str9x.c b/src/flash/str9x.c index fe6c086..893baf5 100644 --- a/src/flash/str9x.c +++ b/src/flash/str9x.c @@ -33,43 +33,6 @@ static uint32_t bank1start = 0x00080000; -static int str9x_register_commands(struct command_context_s *cmd_ctx); -static int str9x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int str9x_erase(struct flash_bank_s *bank, int first, int last); -static int str9x_protect(struct flash_bank_s *bank, int set, int first, int last); -static int str9x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int str9x_probe(struct flash_bank_s *bank); -//static int str9x_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9x_protect_check(struct flash_bank_s *bank); -static int str9x_info(struct flash_bank_s *bank, char *buf, int buf_size); - -static int str9x_handle_flash_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -flash_driver_t str9x_flash = -{ - .name = "str9x", - .register_commands = str9x_register_commands, - .flash_bank_command = str9x_flash_bank_command, - .erase = str9x_erase, - .protect = str9x_protect, - .write = str9x_write, - .probe = str9x_probe, - .auto_probe = str9x_probe, - .erase_check = default_flash_blank_check, - .protect_check = str9x_protect_check, - .info = str9x_info -}; - -static int str9x_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *str9x_cmd = register_command(cmd_ctx, NULL, "str9x", NULL, COMMAND_ANY, NULL); - - register_command(cmd_ctx, str9x_cmd, "flash_config", str9x_handle_flash_config_command, COMMAND_EXEC, - "configure str9 flash controller"); - - return ERROR_OK; -} - static int str9x_build_block_list(struct flash_bank_s *bank) { str9x_flash_bank_t *str9x_info = bank->driver_priv; @@ -714,3 +677,29 @@ static int str9x_handle_flash_config_command(struct command_context_s *cmd_ctx, target_write_u32(target, FLASH_CR, 0x18); return ERROR_OK; } + +static int str9x_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *str9x_cmd = register_command(cmd_ctx, NULL, "str9x", + NULL, COMMAND_ANY, "str9x flash commands"); + + register_command(cmd_ctx, str9x_cmd, "flash_config", + str9x_handle_flash_config_command, COMMAND_EXEC, + "configure str9 flash controller"); + + return ERROR_OK; +} + +flash_driver_t str9x_flash = { + .name = "str9x", + .register_commands = &str9x_register_commands, + .flash_bank_command = &str9x_flash_bank_command, + .erase = &str9x_erase, + .protect = &str9x_protect, + .write = &str9x_write, + .probe = &str9x_probe, + .auto_probe = &str9x_probe, + .erase_check = &default_flash_blank_check, + .protect_check = &str9x_protect_check, + .info = &str9x_info, + }; diff --git a/src/flash/str9xpec.c b/src/flash/str9xpec.c index 711ee7a..73b9a1d 100644 --- a/src/flash/str9xpec.c +++ b/src/flash/str9xpec.c @@ -28,77 +28,10 @@ #include "arm7_9_common.h" -static int str9xpec_register_commands(struct command_context_s *cmd_ctx); -static int str9xpec_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int str9xpec_erase(struct flash_bank_s *bank, int first, int last); -static int str9xpec_protect(struct flash_bank_s *bank, int set, int first, int last); -static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int str9xpec_probe(struct flash_bank_s *bank); -static int str9xpec_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_protect_check(struct flash_bank_s *bank); -static int str9xpec_erase_check(struct flash_bank_s *bank); -static int str9xpec_info(struct flash_bank_s *bank, char *buf, int buf_size); - static int str9xpec_erase_area(struct flash_bank_s *bank, int first, int last); static int str9xpec_set_address(struct flash_bank_s *bank, uint8_t sector); static int str9xpec_write_options(struct flash_bank_s *bank); -static int str9xpec_handle_flash_options_cmap_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_handle_flash_options_lvdthd_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_handle_flash_options_lvdsel_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_handle_flash_options_lvdwarn_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_handle_flash_options_read_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_handle_flash_options_write_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_handle_flash_lock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_handle_flash_unlock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_handle_flash_enable_turbo_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int str9xpec_handle_flash_disable_turbo_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -flash_driver_t str9xpec_flash = -{ - .name = "str9xpec", - .register_commands = str9xpec_register_commands, - .flash_bank_command = str9xpec_flash_bank_command, - .erase = str9xpec_erase, - .protect = str9xpec_protect, - .write = str9xpec_write, - .probe = str9xpec_probe, - .auto_probe = str9xpec_probe, - .erase_check = str9xpec_erase_check, - .protect_check = str9xpec_protect_check, - .info = str9xpec_info -}; - -static int str9xpec_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec", NULL, COMMAND_ANY, "str9xpec flash specific commands"); - - register_command(cmd_ctx, str9xpec_cmd, "enable_turbo", str9xpec_handle_flash_enable_turbo_command, COMMAND_EXEC, - "enable str9xpec turbo mode"); - register_command(cmd_ctx, str9xpec_cmd, "disable_turbo", str9xpec_handle_flash_disable_turbo_command, COMMAND_EXEC, - "disable str9xpec turbo mode"); - register_command(cmd_ctx, str9xpec_cmd, "options_cmap", str9xpec_handle_flash_options_cmap_command, COMMAND_EXEC, - "configure str9xpec boot sector"); - register_command(cmd_ctx, str9xpec_cmd, "options_lvdthd", str9xpec_handle_flash_options_lvdthd_command, COMMAND_EXEC, - "configure str9xpec lvd threshold"); - register_command(cmd_ctx, str9xpec_cmd, "options_lvdsel", str9xpec_handle_flash_options_lvdsel_command, COMMAND_EXEC, - "configure str9xpec lvd selection"); - register_command(cmd_ctx, str9xpec_cmd, "options_lvdwarn", str9xpec_handle_flash_options_lvdwarn_command, COMMAND_EXEC, - "configure str9xpec lvd warning"); - register_command(cmd_ctx, str9xpec_cmd, "options_read", str9xpec_handle_flash_options_read_command, COMMAND_EXEC, - "read str9xpec options"); - register_command(cmd_ctx, str9xpec_cmd, "options_write", str9xpec_handle_flash_options_write_command, COMMAND_EXEC, - "write str9xpec options"); - register_command(cmd_ctx, str9xpec_cmd, "lock", str9xpec_handle_flash_lock_command, COMMAND_EXEC, - "lock str9xpec device"); - register_command(cmd_ctx, str9xpec_cmd, "unlock", str9xpec_handle_flash_unlock_command, COMMAND_EXEC, - "unlock str9xpec device"); - register_command(cmd_ctx, str9xpec_cmd, "part_id", str9xpec_handle_part_id_command, COMMAND_EXEC, - "print part id of str9xpec flash bank <num>"); - - return ERROR_OK; -} - int str9xpec_set_instr(jtag_tap_t *tap, uint32_t new_instr, tap_state_t end_state) { if (tap == NULL) { @@ -1229,3 +1162,59 @@ static int str9xpec_handle_flash_disable_turbo_command(struct command_context_s return ERROR_OK; } + +static int str9xpec_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *str9xpec_cmd = register_command(cmd_ctx, NULL, "str9xpec", + NULL, COMMAND_ANY, "str9xpec flash specific commands"); + + register_command(cmd_ctx, str9xpec_cmd, "enable_turbo", + str9xpec_handle_flash_enable_turbo_command, + COMMAND_EXEC, "enable str9xpec turbo mode"); + register_command(cmd_ctx, str9xpec_cmd, "disable_turbo", + str9xpec_handle_flash_disable_turbo_command, + COMMAND_EXEC, "disable str9xpec turbo mode"); + register_command(cmd_ctx, str9xpec_cmd, "options_cmap", + str9xpec_handle_flash_options_cmap_command, + COMMAND_EXEC, "configure str9xpec boot sector"); + register_command(cmd_ctx, str9xpec_cmd, "options_lvdthd", + str9xpec_handle_flash_options_lvdthd_command, + COMMAND_EXEC, "configure str9xpec lvd threshold"); + register_command(cmd_ctx, str9xpec_cmd, "options_lvdsel", + str9xpec_handle_flash_options_lvdsel_command, + COMMAND_EXEC, "configure str9xpec lvd selection"); + register_command(cmd_ctx, str9xpec_cmd, "options_lvdwarn", + str9xpec_handle_flash_options_lvdwarn_command, + COMMAND_EXEC, "configure str9xpec lvd warning"); + register_command(cmd_ctx, str9xpec_cmd, "options_read", + str9xpec_handle_flash_options_read_command, + COMMAND_EXEC, "read str9xpec options"); + register_command(cmd_ctx, str9xpec_cmd, "options_write", + str9xpec_handle_flash_options_write_command, + COMMAND_EXEC, "write str9xpec options"); + register_command(cmd_ctx, str9xpec_cmd, "lock", + str9xpec_handle_flash_lock_command, + COMMAND_EXEC, "lock str9xpec device"); + register_command(cmd_ctx, str9xpec_cmd, "unlock", + str9xpec_handle_flash_unlock_command, + COMMAND_EXEC, "unlock str9xpec device"); + register_command(cmd_ctx, str9xpec_cmd, "part_id", + str9xpec_handle_part_id_command, + COMMAND_EXEC, "print part id of str9xpec flash bank <num>"); + + return ERROR_OK; +} + +flash_driver_t str9xpec_flash = { + .name = "str9xpec", + .register_commands = &str9xpec_register_commands, + .flash_bank_command = &str9xpec_flash_bank_command, + .erase = &str9xpec_erase, + .protect = &str9xpec_protect, + .write = &str9xpec_write, + .probe = &str9xpec_probe, + .auto_probe = &str9xpec_probe, + .erase_check = &str9xpec_erase_check, + .protect_check = &str9xpec_protect_check, + .info = &str9xpec_info, + }; commit 041c319d9dbdc8159cef3257b7f607aaf91b468c Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 09:20:33 2009 -0800 flash/<various>.c: remove useless declarations Remove useless forward declarations. Moves flash structure definitions to end of files. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/src/flash/cfi.c b/src/flash/cfi.c index 93e661c..b448a30 100644 --- a/src/flash/cfi.c +++ b/src/flash/cfi.c @@ -29,39 +29,12 @@ #include "binarybuffer.h" -static int cfi_register_commands(struct command_context_s *cmd_ctx); -static int cfi_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int cfi_erase(struct flash_bank_s *bank, int first, int last); -static int cfi_protect(struct flash_bank_s *bank, int set, int first, int last); -static int cfi_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int cfi_probe(struct flash_bank_s *bank); -static int cfi_auto_probe(struct flash_bank_s *bank); -static int cfi_protect_check(struct flash_bank_s *bank); -static int cfi_info(struct flash_bank_s *bank, char *buf, int buf_size); - -//static int cfi_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - #define CFI_MAX_BUS_WIDTH 4 #define CFI_MAX_CHIP_WIDTH 4 /* defines internal maximum size for code fragment in cfi_intel_write_block() */ #define CFI_MAX_INTEL_CODESIZE 256 -flash_driver_t cfi_flash = -{ - .name = "cfi", - .register_commands = cfi_register_commands, - .flash_bank_command = cfi_flash_bank_command, - .erase = cfi_erase, - .protect = cfi_protect, - .write = cfi_write, - .probe = cfi_probe, - .auto_probe = cfi_auto_probe, - .erase_check = default_flash_blank_check, - .protect_check = cfi_protect_check, - .info = cfi_info -}; - static cfi_unlock_addresses_t cfi_unlock_addresses[] = { [CFI_UNLOCK_555_2AA] = { .unlock1 = 0x555, .unlock2 = 0x2aa }, @@ -2655,3 +2628,17 @@ static int cfi_info(struct flash_bank_s *bank, char *buf, int buf_size) return ERROR_OK; } + +flash_driver_t cfi_flash = { + .name = "cfi", + .register_commands = &cfi_register_commands, + .flash_bank_command = &cfi_flash_bank_command, + .erase = &cfi_erase, + .protect = &cfi_protect, + .write = &cfi_write, + .probe = &cfi_probe, + .auto_probe = &cfi_auto_probe, + .erase_check = &default_flash_blank_check, + .protect_check = &cfi_protect_check, + .info = &cfi_info, + }; diff --git a/src/flash/ecos.c b/src/flash/ecos.c index 8583544..401fdf2 100644 --- a/src/flash/ecos.c +++ b/src/flash/ecos.c @@ -26,15 +26,6 @@ #include "image.h" -static int ecosflash_register_commands(struct command_context_s *cmd_ctx); -static int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int ecosflash_erase(struct flash_bank_s *bank, int first, int last); -static int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int last); -static int ecosflash_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int ecosflash_probe(struct flash_bank_s *bank); -static int ecosflash_protect_check(struct flash_bank_s *bank); -static int ecosflash_info(struct flash_bank_s *bank, char *buf, int buf_size); - #if 0 static uint32_t ecosflash_get_flash_status(flash_bank_t *bank); static void ecosflash_set_flash_mode(flash_bank_t *bank,int mode); @@ -42,21 +33,6 @@ static uint32_t ecosflash_wait_status_busy(flash_bank_t *bank, uint32_t waitbits static int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); #endif -flash_driver_t ecosflash_flash = -{ - .name = "ecosflash", - .register_commands = ecosflash_register_commands, - .flash_bank_command = ecosflash_flash_bank_command, - .erase = ecosflash_erase, - .protect = ecosflash_protect, - .write = ecosflash_write, - .probe = ecosflash_probe, - .auto_probe = ecosflash_probe, - .erase_check = default_flash_blank_check, - .protect_check = ecosflash_protect_check, - .info = ecosflash_info -}; - typedef struct ecosflash_flash_bank_s { struct target_s *target; @@ -458,3 +434,17 @@ static int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, cha return ERROR_OK; } #endif + +flash_driver_t ecosflash_flash = { + .name = "ecosflash", + .register_commands = &ecosflash_register_commands, + .flash_bank_command = &ecosflash_flash_bank_command, + .erase = &ecosflash_erase, + .protect = &ecosflash_protect, + .write = &ecosflash_write, + .probe = &ecosflash_probe, + .auto_probe = &ecosflash_probe, + .erase_check = &default_flash_blank_check, + .protect_check = &ecosflash_protect_check, + .info = &ecosflash_info + }; diff --git a/src/flash/faux.c b/src/flash/faux.c index c5928ad..474dee5 100644 --- a/src/flash/faux.c +++ b/src/flash/faux.c @@ -25,30 +25,6 @@ #include "image.h" -static int faux_register_commands(struct command_context_s *cmd_ctx); -static int faux_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int faux_erase(struct flash_bank_s *bank, int first, int last); -static int faux_protect(struct flash_bank_s *bank, int set, int first, int last); -static int faux_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int faux_probe(struct flash_bank_s *bank); -static int faux_protect_check(struct flash_bank_s *bank); -static int faux_info(struct flash_bank_s *bank, char *buf, int buf_size); - -flash_driver_t faux_flash = -{ - .name = "faux", - .register_commands = faux_register_commands, - .flash_bank_command = faux_flash_bank_command, - .erase = faux_erase, - .protect = faux_protect, - .write = faux_write, - .probe = faux_probe, - .auto_probe = faux_probe, - .erase_check = default_flash_blank_check, - .protect_check = faux_protect_check, - .info = faux_info -}; - typedef struct faux_flash_bank_s { struct target_s *target; @@ -151,3 +127,17 @@ static int faux_probe(struct flash_bank_s *bank) { return ERROR_OK; } + +flash_driver_t faux_flash = { + .name = "faux", + .register_commands = &faux_register_commands, + .flash_bank_command = &faux_flash_bank_command, + .erase = &faux_erase, + .protect = &faux_protect, + .write = &faux_write, + .probe = &faux_probe, + .auto_probe = &faux_probe, + .erase_check = &default_flash_blank_check, + .protect_check = &faux_protect_check, + .info = &faux_info + }; commit 712d3fc0fb3ed69342a649d8bbb0d6d901a64720 Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 09:20:33 2009 -0800 flash/<assorted>.c: remove useless declarations Remove useless forward declarations. Moves command registrations to end of files. Moves flash structure definitions to end of files. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/src/flash/aduc702x.c b/src/flash/aduc702x.c index a4007d0..7d6fa24 100644 --- a/src/flash/aduc702x.c +++ b/src/flash/aduc702x.c @@ -29,16 +29,6 @@ #include "time_support.h" -static int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int aduc702x_register_commands(struct command_context_s *cmd_ctx); -static int aduc702x_erase(struct flash_bank_s *bank, int first, int last); -static int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int last); -static int aduc702x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int aduc702x_write_single(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int aduc702x_probe(struct flash_bank_s *bank); -static int aduc702x_info(struct flash_bank_s *bank, char *buf, int buf_size); -static int aduc702x_protect_check(struct flash_bank_s *bank); static int aduc702x_build_sector_list(struct flash_bank_s *bank); static int aduc702x_check_flash_completion(target_t* target, unsigned int timeout_ms); static int aduc702x_set_write_enable(target_t *target, int enable); @@ -69,26 +59,6 @@ typedef struct working_area_t *write_algorithm; } aduc702x_flash_bank_t; -flash_driver_t aduc702x_flash = -{ - .name = "aduc702x", - .register_commands = aduc702x_register_commands, - .flash_bank_command = aduc702x_flash_bank_command, - .erase = aduc702x_erase, - .protect = aduc702x_protect, - .write = aduc702x_write, - .probe = aduc702x_probe, - .auto_probe = aduc702x_probe, - .erase_check = default_flash_blank_check, - .protect_check = aduc702x_protect_check, - .info = aduc702x_info -}; - -static int aduc702x_register_commands(struct command_context_s *cmd_ctx) -{ - return ERROR_OK; -} - /* flash bank aduc702x 0 0 0 0 <target#> * The ADC7019-28 devices all have the same flash layout */ static int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) @@ -452,3 +422,15 @@ static int aduc702x_check_flash_completion(target_t* target, unsigned int timeou else return ERROR_OK; } +flash_driver_t aduc702x_flash = { + .name = "aduc702x", + .flash_bank_command = &aduc702x_flash_bank_command, + .erase = &aduc702x_erase, + .protect = &aduc702x_protect, + .write = &aduc702x_write, + .probe = &aduc702x_probe, + .auto_probe = &aduc702x_probe, + .erase_check = &default_flash_blank_check, + .protect_check = &aduc702x_protect_check, + .info = &aduc702x_info + }; diff --git a/src/flash/avrf.c b/src/flash/avrf.c index 2b95b8a..b045909 100644 --- a/src/flash/avrf.c +++ b/src/flash/avrf.c @@ -56,46 +56,18 @@ avrf_type_t avft_chips_info[] = {"atmega128", 0x9702, 256, 512, 8, 512}, }; -static int avrf_register_commands(struct command_context_s *cmd_ctx); -static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int avrf_erase(struct flash_bank_s *bank, int first, int last); -static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last); -static int avrf_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int avrf_probe(struct flash_bank_s *bank); -static int avrf_auto_probe(struct flash_bank_s *bank); -//static int avrf_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int avrf_protect_check(struct flash_bank_s *bank); -static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size); - -static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -extern int avr_jtag_sendinstr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out); -extern int avr_jtag_senddat(jtag_tap_t *tap, uint32_t *dr_in, uint32_t dr_out, int len); - -extern int mcu_write_ir(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int ir_len, int rti); -extern int mcu_write_dr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int dr_len, int rti); -extern int mcu_write_ir_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int ir_len, int rti); -extern int mcu_write_dr_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int dr_len, int rti); -extern int mcu_write_ir_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int ir_len, int rti); -extern int mcu_write_dr_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int dr_len, int rti); -extern int mcu_write_ir_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int ir_len, int rti); -extern int mcu_write_dr_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int dr_len, int rti); -extern int mcu_execute_queue(void); - -flash_driver_t avr_flash = -{ - .name = "avr", - .register_commands = avrf_register_commands, - .flash_bank_command = avrf_flash_bank_command, - .erase = avrf_erase, - .protect = avrf_protect, - .write = avrf_write, - .probe = avrf_probe, - .auto_probe = avrf_auto_probe, - .erase_check = default_flash_mem_blank_check, - .protect_check = avrf_protect_check, - .info = avrf_info -}; +int avr_jtag_sendinstr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out); +int avr_jtag_senddat(jtag_tap_t *tap, uint32_t *dr_in, uint32_t dr_out, int len); + +int mcu_write_ir(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int ir_len, int rti); +int mcu_write_dr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int dr_len, int rti); +int mcu_write_ir_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int ir_len, int rti); +int mcu_write_dr_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int dr_len, int rti); +int mcu_write_ir_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int ir_len, int rti); +int mcu_write_dr_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int dr_len, int rti); +int mcu_write_ir_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int ir_len, int rti); +int mcu_write_dr_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int dr_len, int rti); +int mcu_execute_queue(void); /* avr program functions */ static int avr_jtag_reset(avr_common_t *avr, uint32_t reset) @@ -208,17 +180,6 @@ static int avr_jtagprg_writeflashpage(avr_common_t *avr, uint8_t *page_buf, uint return ERROR_OK; } -/* interface command */ -static int avrf_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr", NULL, COMMAND_ANY, "avr flash specific commands"); - - register_command(cmd_ctx, avr_cmd, "mass_erase", avrf_handle_mass_erase_command, COMMAND_EXEC, - "mass erase device"); - - return ERROR_OK; -} - static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) { avrf_flash_bank_t *avrf_info; @@ -487,3 +448,29 @@ static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, cha LOG_DEBUG("%s", __FUNCTION__); return ERROR_OK; } + +static int avrf_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr", + NULL, COMMAND_ANY, "avr flash specific commands"); + + register_command(cmd_ctx, avr_cmd, "mass_erase", + avrf_handle_mass_erase_command, COMMAND_EXEC, + "mass erase device"); + + return ERROR_OK; +} + +flash_driver_t avr_flash = { + .name = "avr", + .register_commands = &avrf_register_commands, + .flash_bank_command = &avrf_flash_bank_command, + .erase = &avrf_erase, + .protect = &avrf_protect, + .write = &avrf_write, + .probe = &avrf_probe, + .auto_probe = &avrf_auto_probe, + .erase_check = &default_flash_mem_blank_check, + .protect_check = &avrf_protect_check, + .info = &avrf_info, + }; diff --git a/src/flash/ocl.c b/src/flash/ocl.c index a2dac50..51ccc96 100644 --- a/src/flash/ocl.c +++ b/src/flash/ocl.c @@ -26,32 +26,6 @@ #include "embeddedice.h" -static int ocl_register_commands(struct command_context_s *cmd_ctx); -static int ocl_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int ocl_erase(struct flash_bank_s *bank, int first, int last); -static int ocl_protect(struct flash_bank_s *bank, int set, int first, int last); -static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int ocl_probe(struct flash_bank_s *bank); -static int ocl_erase_check(struct flash_bank_s *bank); -static int ocl_protect_check(struct flash_bank_s *bank); -static int ocl_info(struct flash_bank_s *bank, char *buf, int buf_size); -static int ocl_auto_probe(struct flash_bank_s *bank); - -flash_driver_t ocl_flash = -{ - .name = "ocl", - .register_commands = ocl_register_commands, - .flash_bank_command = ocl_flash_bank_command, - .erase = ocl_erase, - .protect = ocl_protect, - .write = ocl_write, - .probe = ocl_probe, - .erase_check = ocl_erase_check, - .protect_check = ocl_protect_check, - .info = ocl_info, - .auto_probe = ocl_auto_probe -}; - typedef struct ocl_priv_s { arm_jtag_t *jtag_info; @@ -59,11 +33,6 @@ typedef struct ocl_priv_s unsigned int bufalign; } ocl_priv_t; -static int ocl_register_commands(struct command_context_s *cmd_ctx) -{ - return ERROR_OK; -} - static int ocl_erase_check(struct flash_bank_s *bank) { return ERROR_OK; @@ -378,3 +347,16 @@ static int ocl_auto_probe(struct flash_bank_s *bank) return ERROR_OK; } + +flash_driver_t ocl_flash = { + .name = "ocl", + .flash_bank_command = &ocl_flash_bank_command, + .erase = &ocl_erase, + .protect = &ocl_protect, + .write = &ocl_write, + .probe = &ocl_probe, + .erase_check = &ocl_erase_check, + .protect_check = &ocl_protect_check, + .info = &ocl_info, + .auto_probe = &ocl_auto_probe, + }; diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index b482ce2..bd561a6 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -34,39 +34,14 @@ #define DID0_VER(did0) ((did0 >> 28)&0x07) -static int stellaris_register_commands(struct command_context_s *cmd_ctx); -static int stellaris_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int stellaris_erase(struct flash_bank_s *bank, int first, int last); -static int stellaris_protect(struct flash_bank_s *bank, int set, int first, int last); -static int stellaris_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int stellaris_auto_probe(struct flash_bank_s *bank); -static int stellaris_probe(struct flash_bank_s *bank); -static int stellaris_protect_check(struct flash_bank_s *bank); -static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size); static int stellaris_read_part_info(struct flash_bank_s *bank); static uint32_t stellaris_get_flash_status(flash_bank_t *bank); static void stellaris_set_flash_mode(flash_bank_t *bank,int mode); //static uint32_t stellaris_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout); -static int stellaris_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int stellaris_mass_erase(struct flash_bank_s *bank); -flash_driver_t stellaris_flash = -{ - .name = "stellaris", - .register_commands = stellaris_register_commands, - .flash_bank_command = stellaris_flash_bank_command, - .erase = stellaris_erase, - .protect = stellaris_protect, - .write = stellaris_write, - .probe = stellaris_probe, - .auto_probe = stellaris_auto_probe, - .erase_check = default_flash_mem_blank_check, - .protect_check = stellaris_protect_check, - .info = stellaris_info -}; - static struct { uint32_t partno; char *partname; @@ -264,14 +239,6 @@ static int stellaris_flash_bank_command(struct command_context_s *cmd_ctx, char return ERROR_OK; } -static int stellaris_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris", NULL, COMMAND_ANY, "stellaris flash specific commands"); - - register_command(cmd_ctx, stm32x_cmd, "mass_erase", stellaris_handle_mass_erase_command, COMMAND_EXEC, "mass erase device"); - return ERROR_OK; -} - static int stellaris_info(struct flash_bank_s *bank, char *buf, int buf_size) { int printed, device_class; @@ -1192,3 +1159,29 @@ static int stellaris_handle_mass_erase_command(struct command_context_s *cmd_ctx return ERROR_OK; } + +static int stellaris_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *stm32x_cmd = register_command(cmd_ctx, NULL, "stellaris", + NULL, COMMAND_ANY, "stellaris flash specific commands"); + + register_command(cmd_ctx, stm32x_cmd, "mass_erase", + stellaris_handle_mass_erase_command, COMMAND_EXEC, + "mass erase device"); + return ERROR_OK; +} + + +flash_driver_t stellaris_flash = { + .name = "stellaris", + .register_commands = &stellaris_register_commands, + .flash_bank_command = &stellaris_flash_bank_command, + .erase = &stellaris_erase, + .protect = &stellaris_protect, + .write = &stellaris_write, + .probe = &stellaris_probe, + .auto_probe = &stellaris_auto_probe, + .erase_check = &default_flash_mem_blank_check, + .protect_check = &stellaris_protect_check, + .info = &stellaris_info, + }; diff --git a/src/flash/tms470.c b/src/flash/tms470.c index 58210ac..1348697 100644 --- a/src/flash/tms470.c +++ b/src/flash/tms470.c @@ -24,31 +24,6 @@ #include "tms470.h" -static int tms470_register_commands(struct command_context_s *cmd_ctx); -static int tms470_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int tms470_erase(struct flash_bank_s *bank, int first, int last); -static int tms470_protect(struct flash_bank_s *bank, int set, int first, int last); -static int tms470_write(struct flash_bank_s *bank, uint8_t * buffer, uint32_t offset, uint32_t count); -static int tms470_probe(struct flash_bank_s *bank); -static int tms470_auto_probe(struct flash_bank_s *bank); -static int tms470_erase_check(struct flash_bank_s *bank); -static int tms470_protect_check(struct flash_bank_s *bank); -static int tms470_info(struct flash_bank_s *bank, char *buf, int buf_size); - -flash_driver_t tms470_flash = { - .name = "tms470", - .register_commands = tms470_register_commands, - .flash_bank_command = tms470_flash_bank_command, - .erase = tms470_erase, - .protect = tms470_protect, - .write = tms470_write, - .probe = tms470_probe, - .auto_probe = tms470_auto_probe, - .erase_check = tms470_erase_check, - .protect_check = tms470_protect_check, - .info = tms470_info -}; - /* ---------------------------------------------------------------------- Internal Support, Helpers ---------------------------------------------------------------------- */ @@ -1260,3 +1235,17 @@ static int tms470_flash_bank_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } + +flash_driver_t tms470_flash = { + .name = "tms470", + .register_commands = &tms470_register_commands, + .flash_bank_command = &tms470_flash_bank_command, + .erase = &tms470_erase, + .protect = &tms470_protect, + .write = &tms470_write, + .probe = &tms470_probe, + .auto_probe = &tms470_auto_probe, + .erase_check = &tms470_erase_check, + .protect_check = &tms470_protect_check, + .info = &tms470_info, + }; commit 4cd02c63e9213b7f33ec4ac33d481fb00e00708f Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 09:20:33 2009 -0800 flash/at91sam[37].c: remove useless declarations Remove useless forward declarations. Moves command registration to end of file. Moves flash structure definitions to end of files. Changes a few references to global flash structure to local refs. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/src/flash/at91sam3.c b/src/flash/at91sam3.c index aff4d98..7d3d82c 100644 --- a/src/flash/at91sam3.c +++ b/src/flash/at91sam3.c @@ -2508,19 +2508,16 @@ sam3_register_commands(struct command_context_s *cmd_ctx) return ERROR_OK; } - -flash_driver_t at91sam3_flash = -{ - .name = "at91sam3", - .register_commands = sam3_register_commands, - - .flash_bank_command = sam3_flash_bank_command, - .erase = sam3_erase, - .protect = sam3_protect, - .write = sam3_write, - .probe = sam3_probe, - .auto_probe = sam3_auto_probe, - .erase_check = sam3_erase_check, - .protect_check = sam3_protect_check, - .info = sam3_info -}; +flash_driver_t at91sam3_flash = { + .name = "at91sam3", + .register_commands = &sam3_register_commands, + .flash_bank_command = &sam3_flash_bank_command, + .erase = &sam3_erase, + .protect = &sam3_protect, + .write = &sam3_write, + .probe = &sam3_probe, + .auto_probe = &sam3_auto_probe, + .erase_check = &sam3_erase_check, + .protect_check = &sam3_protect_check, + .info = &sam3_info, + }; diff --git a/src/flash/at91sam7.c b/src/flash/at91sam7.c index 7d93c9e..134c9e5 100644 --- a/src/flash/at91sam7.c +++ b/src/flash/at91sam7.c @@ -52,38 +52,13 @@ #include "at91sam7.h" #include "binarybuffer.h" - -static int at91sam7_register_commands(struct command_context_s *cmd_ctx); -static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int at91sam7_erase(struct flash_bank_s *bank, int first, int last); -static int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last); -static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int at91sam7_probe(struct flash_bank_s *bank); -//static int at91sam7_auto_probe(struct flash_bank_s *bank); -static int at91sam7_erase_check(struct flash_bank_s *bank); static int at91sam7_protect_check(struct flash_bank_s *bank); -static int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size); +static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); static uint32_t at91sam7_get_flash_status(target_t *target, int bank_number); static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode); static uint32_t at91sam7_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout); static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen); -static int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -flash_driver_t at91sam7_flash = -{ - .name = "at91sam7", - .register_commands = at91sam7_register_commands, - .flash_bank_command = at91sam7_flash_bank_command, - .erase = at91sam7_erase, - .protect = at91sam7_protect, - .write = at91sam7_write, - .probe = at91sam7_probe, - .auto_probe = at91sam7_probe, - .erase_check = at91sam7_erase_check, - .protect_check = at91sam7_protect_check, - .info = at91sam7_info -}; static uint32_t MC_FMR[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 }; static uint32_t MC_FCR[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 }; @@ -112,14 +87,6 @@ static long SRAMSIZ[16] = { }; #endif -static int at91sam7_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7", NULL, COMMAND_ANY, NULL); - - register_command(cmd_ctx, at91sam7_cmd, "gpnvm", at91sam7_handle_gpnvm_command, COMMAND_EXEC, - "at91sam7 gpnvm <bit> set | clear, set or clear one gpnvm bit"); - return ERROR_OK; -} static uint32_t at91sam7_get_flash_status(target_t *target, int bank_number) { @@ -567,7 +534,7 @@ static int at91sam7_read_part_info(struct flash_bank_s *bank) /* create a new flash bank element */ flash_bank_t *fb = malloc(sizeof(flash_bank_t)); fb->target = target; - fb->driver = &at91sam7_flash; + fb->driver = bank->driver; fb->driver_priv = malloc(sizeof(at91sam7_flash_bank_t)); fb->next = NULL; @@ -820,7 +787,7 @@ static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char * /* create a new bank element */ flash_bank_t *fb = malloc(sizeof(flash_bank_t)); fb->target = target; - fb->driver = &at91sam7_flash; + fb->driver = bank->driver; fb->driver_priv = malloc(sizeof(at91sam7_flash_bank_t)); fb->next = NULL; @@ -1151,7 +1118,7 @@ static int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char { return ERROR_FLASH_BANK_INVALID; } - if (bank->driver != &at91sam7_flash) + if (strcmp(bank->driver->name, "at91sam7")) { command_print(cmd_ctx, "not an at91sam7 flash bank '%s'", args[0]); return ERROR_FLASH_BANK_INVALID; @@ -1210,3 +1177,30 @@ static int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char return ERROR_OK; } + +static int at91sam7_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7", + NULL, COMMAND_ANY, NULL); + + register_command(cmd_ctx, at91sam7_cmd, "gpnvm", + at91sam7_handle_gpnvm_command, COMMAND_EXEC, + "at91sam7 gpnvm <bit> set | clear, " + "set or clear one gpnvm bit"); + + return ERROR_OK; +} + +flash_driver_t at91sam7_flash = { + .name = "at91sam7", + .register_commands = &at91sam7_register_commands, + .flash_bank_command = &at91sam7_flash_bank_command, + .erase = &at91sam7_erase, + .protect = &at91sam7_protect, + .write = &at91sam7_write, + .probe = &at91sam7_probe, + .auto_probe = &at91sam7_probe, + .erase_check = &at91sam7_erase_check, + .protect_check = &at91sam7_protect_check, + .info = &at91sam7_info, + }; commit 770716e9e079f3fb088994e28aa08edfc5afd2fb Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 09:20:33 2009 -0800 flash/lpc2???.c: remove useless declarations Remove useless forward declarations. Moves command registrations to end of files. Moves flash structure definitions to end of files. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/src/flash/lpc2000.c b/src/flash/lpc2000.c index ed9c7c3..e71629e 100644 --- a/src/flash/lpc2000.c +++ b/src/flash/lpc2000.c @@ -53,43 +53,6 @@ * - 176x (tested with LPC1768) */ -static int lpc2000_register_commands(struct command_context_s *cmd_ctx); -static int lpc2000_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int lpc2000_erase(struct flash_bank_s *bank, int first, int last); -static int lpc2000_protect(struct flash_bank_s *bank, int set, int first, int last); -static int lpc2000_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); -static int lpc2000_probe(struct flash_bank_s *bank); -static int lpc2000_erase_check(struct flash_bank_s *bank); -static int lpc2000_protect_check(struct flash_bank_s *bank); -static int lpc2000_info(struct flash_bank_s *bank, char *buf, int buf_size); - -static int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -flash_driver_t lpc2000_flash = -{ - .name = "lpc2000", - .register_commands = lpc2000_register_commands, - .flash_bank_command = lpc2000_flash_bank_command, - .erase = lpc2000_erase, - .protect = lpc2000_protect, - .write = lpc2000_write, - .probe = lpc2000_probe, - .auto_probe = lpc2000_probe, - .erase_check = lpc2000_erase_check, - .protect_check = lpc2000_protect_check, - .info = lpc2000_info -}; - -static int lpc2000_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *lpc2000_cmd = register_command(cmd_ctx, NULL, "lpc2000", NULL, COMMAND_ANY, NULL); - - register_command(cmd_ctx, lpc2000_cmd, "part_id", lpc2000_handle_part_id_command, COMMAND_EXEC, - "print part id of lpc2000 flash bank <num>"); - - return ERROR_OK; -} - static int lpc2000_build_sector_list(struct flash_bank_s *bank) { lpc2000_flash_bank_t *lpc2000_info = bank->driver_priv; @@ -812,3 +775,31 @@ static int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, cha return ERROR_OK; } + +static int lpc2000_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *lpc2000_cmd = register_command(cmd_ctx, NULL, "lpc2000", + NULL, COMMAND_ANY, NULL); + + register_command(cmd_ctx, lpc2000_cmd, "part_id", + lpc2000_handle_part_id_command, COMMAND_EXEC, + "print part id of lpc2000 flash bank <num>"); + + return ERROR_OK; +} + +flash_driver_t lpc2000_flash = { + .name = "lpc2000", + .register_commands = &lpc2000_register_commands, + .flash_bank_command = &lpc2000_flash_bank_command, + .erase = &lpc2000_erase, + .protect = &lpc2000_protect, + .write = &lpc2000_write, + .probe = &lpc2000_probe, + .auto_probe = &lpc2000_probe, + .erase_check = &lpc2000_erase_check, + .protect_check = &lpc2000_protect_check, + .info = &lpc2000_info, + }; + + diff --git a/src/flash/lpc288x.c b/src/flash/lpc288x.c index 61aa3a0..4827c21 100644 --- a/src/flash/lpc288x.c +++ b/src/flash/lpc288x.c @@ -84,6 +84,7 @@ /* F_CLK_TIME */ #define FCT_CLK_DIV_MASK 0x0FFF +#if 0 static int lpc288x_register_commands(struct command_context_s *cmd_ctx); static int lpc288x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); static int lpc288x_erase(struct flash_bank_s *bank, int first, int last); @@ -93,31 +94,12 @@ static int lpc288x_probe(struct flash_bank_s *bank); static int lpc288x_erase_check(struct flash_bank_s *bank); static int lpc288x_protect_check(struct flash_bank_s *bank); static int lpc288x_info(struct flash_bank_s *bank, char *buf, int buf_size); +#endif static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout); static void lpc288x_load_timer(int erase, struct target_s *target); static void lpc288x_set_flash_clk(struct flash_bank_s *bank); static uint32_t lpc288x_system_ready(struct flash_bank_s *bank); -flash_driver_t lpc288x_flash = -{ - .name = "lpc288x", - .register_commands = lpc288x_register_commands, - .flash_bank_command = lpc288x_flash_bank_command, - .erase = lpc288x_erase, - .protect = lpc288x_protect, - .write = lpc288x_write, - .probe = lpc288x_probe, - .auto_probe = lpc288x_probe, - .erase_check = lpc288x_erase_check, - .protect_check = lpc288x_protect_check, - .info = lpc288x_info -}; - -static int lpc288x_register_commands(struct command_context_s *cmd_ctx) -{ - return ERROR_OK; -} - static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout) { uint32_t status; @@ -499,3 +481,16 @@ static int lpc288x_protect(struct flash_bank_s *bank, int set, int first, int la return ERROR_OK; } + +flash_driver_t lpc288x_flash = { + .name = "lpc288x", + .flash_bank_command = &lpc288x_flash_bank_command, + .erase = &lpc288x_erase, + .protect = &lpc288x_protect, + .write = &lpc288x_write, + .probe = &lpc288x_probe, + .auto_probe = &lpc288x_probe, + .erase_check = &lpc288x_erase_check, + .protect_check = &lpc288x_protect_check, + .info = &lpc288x_info, + }; diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c index e15d93b..f2daab4 100644 --- a/src/flash/lpc2900.c +++ b/src/flash/lpc2900.c @@ -171,21 +171,6 @@ typedef struct lpc2900_flash_bank_s } lpc2900_flash_bank_t; - - -static int lpc2900_register_commands(struct command_context_s *cmd_ctx); -static int lpc2900_flash_bank_command(struct command_context_s *cmd_ctx, - char *cmd, char **args, int argc, - struct flash_bank_s *bank); -static int lpc2900_erase(struct flash_bank_s *bank, int first, int last); -static int lpc2900_protect(struct flash_bank_s *bank, int set, int first, int last); -static int lpc2900_write(struct flash_bank_s *bank, - uint8_t *buffer, uint32_t offset, uint32_t count); -static int lpc2900_probe(struct flash_bank_s *bank); -static int lpc2900_erase_check(struct flash_bank_s *bank); -static int lpc2900_protect_check(struct flash_bank_s *bank); -static int lpc2900_info(struct flash_bank_s *bank, char *buf, int buf_size); - static uint32_t lpc2900_wait_status(flash_bank_t *bank, uint32_t mask, int timeout); static void lpc2900_setup(struct flash_bank_s *bank); static uint32_t lpc2900_is_ready(struct flash_bank_s *bank); commit 8b5c5c054d7ae08990e817a52bd28a326b27e54a Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 09:20:33 2009 -0800 flash/*nand*.c: remove useless declarations Remove useless forward declarations. Moves command registration to end of files. Moves flash structure definition to end of files. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/src/flash/lpc3180_nand_controller.c b/src/flash/lpc3180_nand_controller.c index ac079c6..309890c 100644 --- a/src/flash/lpc3180_nand_controller.c +++ b/src/flash/lpc3180_nand_controller.c @@ -24,37 +24,8 @@ #include "lpc3180_nand_controller.h" #include "nand.h" -static int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device); -static int lpc3180_register_commands(struct command_context_s *cmd_ctx); -static int lpc3180_init(struct nand_device_s *device); static int lpc3180_reset(struct nand_device_s *device); -static int lpc3180_command(struct nand_device_s *device, uint8_t command); -static int lpc3180_address(struct nand_device_s *device, uint8_t address); -static int lpc3180_write_data(struct nand_device_s *device, uint16_t data); -static int lpc3180_read_data(struct nand_device_s *device, void *data); -static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size); -static int lpc... [truncated message content] |
From: David B. <dbr...@us...> - 2009-11-09 23:50:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 7269ba5eb6c4c0e3b8dfceba9d5f2c2f4dfc1618 (commit) from d70d9634bf6ab73ec4f2ac1e77012785770b460a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7269ba5eb6c4c0e3b8dfceba9d5f2c2f4dfc1618 Author: David Brownell <dbr...@us...> Date: Mon Nov 9 14:46:23 2009 -0800 Revert "target: add target->type->has_mmu fn" This patch introduced a bug preventing flash writes from working on Cortex-M3 targets like the STM32. Moreover, it's the wrong approach for handling no-MMU targets. The right way to handle no-MMU targets is to provide accessors for physical addresses, and use them everywhere; and any code which tries to work with virtual-to-physical mappings should use a identity mapping (which can be defaulted). And ... we can tell if a target has an MMU by seeing if it's got an mmu() method. No such methood means no MMU. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 6b015ca..12f0eec 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -56,12 +56,6 @@ extern uint8_t armv7m_gdb_dummy_cpsr_value[]; extern reg_t armv7m_gdb_dummy_cpsr_reg; #endif -static int cortex_m3_has_mmu(struct target_s *target, bool *has_mmu) -{ - *has_mmu = false; - return ERROR_OK; -} - static int cortexm3_dap_read_coreregister_u32(swjdp_common_t *swjdp, uint32_t *value, int regnum) { @@ -1998,6 +1992,5 @@ target_type_t cortexm3_target = .register_commands = cortex_m3_register_commands, .target_create = cortex_m3_target_create, .init_target = cortex_m3_init_target, - .has_mmu = cortex_m3_has_mmu, .examine = cortex_m3_examine, }; diff --git a/src/target/target.c b/src/target/target.c index 90c143f..6e5d3fb 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -496,13 +496,7 @@ static int default_virt2phys(struct target_s *target, uint32_t virtual, uint32_t static int default_mmu(struct target_s *target, int *enabled) { - LOG_ERROR("Not implemented."); - return ERROR_FAIL; -} - -static int default_has_mmu(struct target_s *target, bool *has_mmu) -{ - *has_mmu = true; + *enabled = 0; return ERROR_OK; } @@ -773,32 +767,14 @@ int target_mcr(struct target_s *target, int cpnum, uint32_t op1, uint32_t op2, u static int default_read_phys_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { - int retval; - bool mmu; - retval = target->type->has_mmu(target, &mmu); - if (retval != ERROR_OK) - return retval; - if (mmu) - { - LOG_ERROR("Not implemented"); - return ERROR_FAIL; - } - return target_read_memory(target, address, size, count, buffer); + LOG_ERROR("Not implemented"); + return ERROR_FAIL; } static int default_write_phys_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { - int retval; - bool mmu; - retval = target->type->has_mmu(target, &mmu); - if (retval != ERROR_OK) - return retval; - if (mmu) - { - LOG_ERROR("Not implemented"); - return ERROR_FAIL; - } - return target_write_memory(target, address, size, count, buffer); + LOG_ERROR("Not implemented"); + return ERROR_FAIL; } @@ -875,10 +851,6 @@ int target_init(struct command_context_s *cmd_ctx) { target->type->mmu = default_mmu; } - if (target->type->has_mmu == NULL) - { - target->type->has_mmu = default_has_mmu; - } target = target->next; } diff --git a/src/target/target_type.h b/src/target/target_type.h index 23ed40e..dd469db 100644 --- a/src/target/target_type.h +++ b/src/target/target_type.h @@ -199,16 +199,8 @@ struct target_type_s */ int (*write_phys_memory)(struct target_s *target, uint32_t phys_address, uint32_t size, uint32_t count, uint8_t *buffer); - /* returns true if the mmu is enabled. Default implementation returns error. */ int (*mmu)(struct target_s *target, int *enabled); - /* returns true if the target has an mmu. This can only be - determined after the target has been examined. - - Default implementation returns success and has_mmu==true. - */ - int (*has_mmu)(struct target_s *target, bool *has_mmu); - /* Read coprocessor - arm specific. Default implementation returns error. */ int (*mrc)(struct target_s *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value); ----------------------------------------------------------------------- Summary of changes: src/target/cortex_m3.c | 7 ------- src/target/target.c | 38 +++++--------------------------------- src/target/target_type.h | 8 -------- 3 files changed, 5 insertions(+), 48 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-09 22:16:54
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d70d9634bf6ab73ec4f2ac1e77012785770b460a (commit) from 9253ce9baea6f7b5ef3fc53b4bc0cfbff48194f4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d70d9634bf6ab73ec4f2ac1e77012785770b460a Author: David Brownell <dbr...@us...> Date: Mon Nov 9 13:16:32 2009 -0800 finish removing deprecated/obsolete commands It's been about a year since these were deprecated and, in most cases, removed. There's no point in carrying that documentation, or backwards compatibility for "jtag_device" and "jtag_speed", around forever. (Or a few remnants of obsolete code...) Removed a few obsolete uses of "jtag_speed": - The Calao stuff hasn't worked since July 2008. (Those Atmel targets need to work with a 32KHz core clock after reset until board-specific init-reset code sets up the PLL and enables a faster JTAg clock.) - Parport speed controls don't actually work (tops out at about 1 MHz on typical HW). - In general, speed controls need to live in board.cfg files (or sometimes target.cfg files), not interface.cfg ... Signed-off-by: David Brownell <dbr...@us...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 8e1d1a8..86f5748 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -81,7 +81,6 @@ Free Documentation License''. * TFTP:: TFTP * GDB and OpenOCD:: Using GDB and OpenOCD * Tcl Scripting API:: Tcl Scripting API -* Upgrading:: Deprecated/Removed Commands * FAQ:: Frequently Asked Questions * Tcl Crash Course:: Tcl Crash Course * License:: GNU Free Documentation License @@ -6507,91 +6506,6 @@ We should add support for a variable like Tcl variable is jim, not real tcl). @end quotation -@node Upgrading -@chapter Deprecated/Removed Commands -@cindex Deprecated/Removed Commands -Certain OpenOCD commands have been deprecated or -removed during the various revisions. - -Upgrade your scripts as soon as possible. -These descriptions for old commands may be removed -a year after the command itself was removed. -This means that in January 2010 this chapter may -become much shorter. - -@itemize @bullet -@item @b{arm7_9 fast_writes} -@cindex arm7_9 fast_writes -@*Use @command{arm7_9 fast_memory_access} instead. -@xref{arm7_9 fast_memory_access}. -@item @b{endstate} -@cindex endstate -@*An buggy old command that would not really work since background polling would wipe out the global endstate -@item @b{arm7_9 force_hw_bkpts} -@*Use @command{gdb_breakpoint_override} instead. Note that GDB will use hardware breakpoints -for flash if the GDB memory map has been set up(default when flash is declared in -target configuration). @xref{gdb_breakpoint_override}. -@item @b{arm7_9 sw_bkpts} -@*On by default. @xref{gdb_breakpoint_override}. -@item @b{daemon_startup} -@*this config option has been removed, simply adding @option{init} and @option{reset halt} to -the end of your config script will give the same behaviour as using @option{daemon_startup reset} -and @option{target cortex_m3 little reset_halt 0}. -@item @b{dump_binary} -@*use @option{dump_image} command with same args. @xref{dump_image}. -@item @b{flash erase} -@*use @option{flash erase_sector} command with same args. @xref{flash erase_sector}. -@item @b{flash write} -@*use @option{flash write_bank} command with same args. @xref{flash write_bank}. -@item @b{flash write_binary} -@*use @option{flash write_bank} command with same args. @xref{flash write_bank}. -@item @b{flash auto_erase} -@*use @option{flash write_image} command passing @option{erase} as the first parameter. @xref{flash write_image}. - -@item @b{jtag_device} -@*use the @command{jtag newtap} command, converting from positional syntax -to named prefixes, and naming the TAP. -@xref{jtag newtap}. -Note that if you try to use the old command, a message will tell you the -right new command to use; and that the fourth parameter in the old syntax -was never actually used. -@example -OLD: jtag_device 8 0x01 0xe3 0xfe -NEW: jtag newtap CHIPNAME TAPNAME \ - -irlen 8 -ircapture 0x01 -irmask 0xe3 -@end example - -@item @b{jtag_speed} value -@*@xref{JTAG Speed}. -Usually, a value of zero means maximum -speed. The actual effect of this option depends on the JTAG interface used. -@itemize @minus -@item wiggler: maximum speed / @var{number} -@item ft2232: 6MHz / (@var{number}+1) -@item amt jtagaccel: 8 / 2**@var{number} -@item jlink: maximum speed in kHz (0-12000), 0 will use RTCK -@item rlink: 24MHz / @var{number}, but only for certain values of @var{number} -@comment end speed list. -@end itemize - -@item @b{load_binary} -@*use @option{load_image} command with same args. @xref{load_image}. -@item @b{run_and_halt_time} -@*This command has been removed for simpler reset behaviour, it can be simulated with the -following commands: -@smallexample -reset run -sleep 100 -halt -@end smallexample -@item @b{target} <@var{type}> <@var{endian}> <@var{jtag-position}> -@*use the create subcommand of @option{target}. -@item @b{target_script} <@var{target#}> <@var{eventname}> <@var{scriptname}> -@*use <@var{target_name}> configure -event <@var{eventname}> "script <@var{scriptname}>" -@item @b{working_area} -@*use the @option{configure} subcommand of @option{target} to set the work-area-virt, work-area-phy, work-area-size, and work-area-backup properties of the target. -@end itemize - @node FAQ @chapter FAQ @cindex faq diff --git a/src/jtag/core.c b/src/jtag/core.c index 8bb45bc..bbe7425 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -1569,13 +1569,6 @@ static int jtag_set_speed(int speed) return jtag ? jtag->speed(speed) : ERROR_OK; } -int jtag_config_speed(int speed) -{ - LOG_DEBUG("handle jtag speed"); - clock_mode = CLOCK_MODE_SPEED; - return jtag_set_speed(speed); -} - int jtag_config_khz(unsigned khz) { LOG_DEBUG("handle jtag khz"); diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index c5bee07..1dfefde 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -254,31 +254,25 @@ int jtag_call_event_callbacks(enum jtag_event event); /// @returns The current JTAG speed setting. int jtag_get_speed(void); + /** * Given a @a speed setting, use the interface @c speed_div callback to * adjust the setting. * @param speed The speed setting to convert back to readable KHz. * @returns ERROR_OK if the interface has not been initialized or on success; - * otherwise, the error code produced by the @c speed_div callback. + * otherwise, the error code produced by the @c speed_div callback. */ int jtag_get_speed_readable(int *speed); -/** - * Set the JTAG speed. This routine will call the underlying - * interface @c speed callback, if the interface has been initialized. - * @param speed The new speed setting. - * @returns ERROR_OK during configuration or on success, or an error - * code returned from the interface @c speed callback. - */ -int jtag_config_speed(int speed); - /// Attempt to configure the interface for the specified KHz. int jtag_config_khz(unsigned khz); + /** * Attempt to enable RTCK/RCLK. If that fails, fallback to the * specified frequency. */ int jtag_config_rclk(unsigned fallback_speed_khz); + /// Retreives the clock speed of the JTAG interface in KHz. unsigned jtag_get_speed_khz(void); diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index c064a82..574f266 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -55,10 +55,8 @@ extern jtag_interface_t *jtag_interface; static int handle_interface_list_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int handle_jtag_rclk_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); 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); @@ -615,15 +613,11 @@ int jtag_register_commands(struct command_context_s *cmd_ctx) register_command(cmd_ctx, NULL, "interface_list", &handle_interface_list_command, COMMAND_ANY, "list all built-in interfaces"); - register_command(cmd_ctx, NULL, "jtag_speed", handle_jtag_speed_command, - COMMAND_ANY, "(DEPRECATED) set jtag speed (if supported)"); register_command(cmd_ctx, NULL, "jtag_khz", handle_jtag_khz_command, COMMAND_ANY, "set maximum jtag speed (if supported); " "parameter is maximum khz, or 0 for adaptive clocking (RTCK)."); register_command(cmd_ctx, NULL, "jtag_rclk", handle_jtag_rclk_command, COMMAND_ANY, "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed"); - register_command(cmd_ctx, NULL, "jtag_device", handle_jtag_device_command, - COMMAND_CONFIG, "(DEPRECATED) jtag_device <ir_length> <ir_expected> <ir_mask>"); register_command(cmd_ctx, NULL, "reset_config", handle_reset_config_command, COMMAND_ANY, "reset_config " @@ -748,67 +742,6 @@ static int handle_interface_list_command(struct command_context_s *cmd_ctx, return ERROR_OK; } -static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) -{ - int e; - char buf[1024]; - Jim_Obj *newargs[ 10 ]; - /* - * CONVERT SYNTAX - * argv[-1] = command - * argv[ 0] = ir length - * argv[ 1] = ir capture - * argv[ 2] = ir mask - * argv[ 3] = not actually used by anything but in the docs - */ - - if (argc < 4) { - command_print(cmd_ctx, "OLD DEPRECATED SYNTAX: Please use the NEW syntax"); - return ERROR_OK; - } - command_print(cmd_ctx, "OLD SYNTAX: DEPRECATED - translating to new syntax"); - command_print(cmd_ctx, "jtag newtap CHIP TAP -irlen %s -ircapture %s -irvalue %s", - args[0], - args[1], - args[2]); - command_print(cmd_ctx, "Example: STM32 has 2 taps, the cortexM3(len4) + boundaryscan(len5)"); - command_print(cmd_ctx, "jtag newtap stm32 cortexm3 ....., thus creating the tap: \"stm32.cortexm3\""); - command_print(cmd_ctx, "jtag newtap stm32 boundary ....., and the tap: \"stm32.boundary\""); - command_print(cmd_ctx, "And then refer to the taps by the dotted name."); - - newargs[0] = Jim_NewStringObj(interp, "jtag", -1); - newargs[1] = Jim_NewStringObj(interp, "newtap", -1); - sprintf(buf, "chip%d", jtag_tap_count()); - newargs[2] = Jim_NewStringObj(interp, buf, -1); - sprintf(buf, "tap%d", jtag_tap_count()); - newargs[3] = Jim_NewStringObj(interp, buf, -1); - newargs[4] = Jim_NewStringObj(interp, "-irlen", -1); - newargs[5] = Jim_NewStringObj(interp, args[0], -1); - newargs[6] = Jim_NewStringObj(interp, "-ircapture", -1); - newargs[7] = Jim_NewStringObj(interp, args[1], -1); - newargs[8] = Jim_NewStringObj(interp, "-irmask", -1); - newargs[9] = Jim_NewStringObj(interp, args[2], -1); - - command_print(cmd_ctx, "NEW COMMAND:"); - sprintf(buf, "%s %s %s %s %s %s %s %s %s %s", - Jim_GetString(newargs[0], NULL), - Jim_GetString(newargs[1], NULL), - Jim_GetString(newargs[2], NULL), - Jim_GetString(newargs[3], NULL), - Jim_GetString(newargs[4], NULL), - Jim_GetString(newargs[5], NULL), - Jim_GetString(newargs[6], NULL), - Jim_GetString(newargs[7], NULL), - Jim_GetString(newargs[8], NULL), - Jim_GetString(newargs[9], NULL)); - - e = jim_jtag_command(interp, 10, newargs); - if (e != JIM_OK) { - command_print(cmd_ctx, "%s", Jim_GetString(Jim_GetResult(interp), NULL)); - } - return e; -} - static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { jtag_tap_t *tap; @@ -1106,29 +1039,6 @@ static int handle_jtag_ntrst_assert_width_command(struct command_context_s *cmd_ 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; - - command_print(cmd_ctx, "OLD SYNTAX: DEPRECATED - " - "use jtag_khz, not jtag_speed"); - - if (argc > 1) - return ERROR_COMMAND_SYNTAX_ERROR; - if (argc == 1) - { - LOG_DEBUG("handle jtag speed"); - - unsigned cur_speed = 0; - COMMAND_PARSE_NUMBER(uint, args[0], cur_speed); - - retval = jtag_config_speed(cur_speed); - } - command_print(cmd_ctx, "jtag_speed: %d", jtag_get_speed()); - - return retval; -} - static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc > 1) diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 2a0aefc..b251ec5 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -38,7 +38,6 @@ int arm7_9_debug_entry(target_t *target); -int arm7_9_enable_sw_bkpts(struct target_s *target); /* command handler forward declarations */ int handle_arm7_9_write_xpsr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); diff --git a/src/target/arm7_9_common.h b/src/target/arm7_9_common.h index 9c42b6b..c0145d9 100644 --- a/src/target/arm7_9_common.h +++ b/src/target/arm7_9_common.h @@ -47,7 +47,6 @@ typedef struct arm7_9_common_s uint32_t arm_bkpt; /**< ARM breakpoint instruction */ uint16_t thumb_bkpt; /**< Thumb breakpoint instruction */ - bool force_hw_bkpts; int sw_breakpoints_added; /**< Specifies which watchpoint software breakpoints are setup on */ int sw_breakpoint_count; /**< keep track of number of software breakpoints we have set */ diff --git a/src/target/target.c b/src/target/target.c index 3e4c00d..90c143f 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1282,10 +1282,10 @@ void target_free_all_working_areas(struct target_s *target) int target_register_commands(struct command_context_s *cmd_ctx) { - register_command(cmd_ctx, NULL, "targets", handle_targets_command, COMMAND_EXEC, "change the current command line target (one parameter) or lists targets (with no parameter)"); - - - + register_command(cmd_ctx, NULL, "targets", + handle_targets_command, COMMAND_EXEC, + "change current command line target (one parameter) " + "or list targets (no parameters)"); register_jim(cmd_ctx, "target", jim_target, "configure target"); diff --git a/tcl/board/topas910.cfg b/tcl/board/topas910.cfg index 01ace63..ce7c87a 100644 --- a/tcl/board/topas910.cfg +++ b/tcl/board/topas910.cfg @@ -99,7 +99,7 @@ proc topas910_init { } { mww 0xf4300004 0x00000000 sleep 10 -# jtag_speed 10000 +# jtag_khz NNNN # remap off in case of IROM boot mww 0xf0000004 0x00000001 diff --git a/tcl/board/topasa900.cfg b/tcl/board/topasa900.cfg index 699b42e..a8a6caf 100644 --- a/tcl/board/topasa900.cfg +++ b/tcl/board/topasa900.cfg @@ -105,7 +105,7 @@ proc topasa900_init { } { mww 0xf4300004 0x00000000 sleep 10 -# jtag_speed 10000 +# jtag_khz NNNN # remap off in case of IROM boot mww 0xf0000004 0x00000001 diff --git a/tcl/interface/calao-usb-a9260.cfg b/tcl/interface/calao-usb-a9260.cfg index 57c68d6..a9d7dec 100644 --- a/tcl/interface/calao-usb-a9260.cfg +++ b/tcl/interface/calao-usb-a9260.cfg @@ -5,12 +5,7 @@ # # See calao-usb-a9260-c01.cfg and calao-usb-a9260-c02.cfg. # -# Note: You must have an OpenOCD version where jtag_speed sets two values. -# trunk r606 contains the fix for this particular issue which can -# be seen if jtag_speed does not set two separate values. -# -jtag_speed 1200 0 jtag_nsrst_delay 200 jtag_ntrst_delay 200 diff --git a/tcl/interface/openocd-usb.cfg b/tcl/interface/openocd-usb.cfg index 8bb9ffe..4000b23 100644 --- a/tcl/interface/openocd-usb.cfg +++ b/tcl/interface/openocd-usb.cfg @@ -9,6 +9,3 @@ ft2232_vid_pid 0x0403 0x6010 ft2232_device_desc "Dual RS232" ft2232_layout "oocdlink" ft2232_latency 2 -# 6/(1+n) Mhz TCLK -jtag_speed 1 - diff --git a/tcl/interface/parport.cfg b/tcl/interface/parport.cfg index 6aaf80b..2a2668d 100644 --- a/tcl/interface/parport.cfg +++ b/tcl/interface/parport.cfg @@ -5,5 +5,4 @@ interface parport parport_port 0xc8b8 parport_cable wiggler -jtag_speed 0 diff --git a/tcl/interface/parport_dlc5.cfg b/tcl/interface/parport_dlc5.cfg index defda3f..0f94c65 100644 --- a/tcl/interface/parport_dlc5.cfg +++ b/tcl/interface/parport_dlc5.cfg @@ -7,5 +7,4 @@ interface parport parport_port /dev/parport0 parport_cable dlc5 -jtag_speed 0 ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 86 ----------------------------------- src/jtag/core.c | 7 --- src/jtag/jtag.h | 14 ++---- src/jtag/tcl.c | 90 ------------------------------------- src/target/arm7_9_common.c | 1 - src/target/arm7_9_common.h | 1 - src/target/target.c | 8 ++-- tcl/board/topas910.cfg | 2 +- tcl/board/topasa900.cfg | 2 +- tcl/interface/calao-usb-a9260.cfg | 5 -- tcl/interface/openocd-usb.cfg | 3 - tcl/interface/parport.cfg | 1 - tcl/interface/parport_dlc5.cfg | 1 - 13 files changed, 10 insertions(+), 211 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-09 21:04:03
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 9253ce9baea6f7b5ef3fc53b4bc0cfbff48194f4 (commit) from 3885ab5a5af7ece410ce3eeb1059da3ea950436a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9253ce9baea6f7b5ef3fc53b4bc0cfbff48194f4 Author: David Brownell <dbr...@us...> Date: Mon Nov 9 12:02:23 2009 -0800 User's Guide: Flash/NAND doc tweaks Rename the "Drivers, Options, and Commands" sections to be just "Driver List" matching the earlier reference. Add an example of parallel CFI flash. Signed-off-by: David Brownell <dbr...@us...> diff --git a/doc/openocd.texi b/doc/openocd.texi index d869f38..8e1d1a8 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -3688,7 +3688,7 @@ The @var{num} parameter is a value shown by @command{flash banks}. @end deffn @anchor{Flash Driver List} -@section Flash Drivers, Options, and Commands +@section Flash Driver List As noted above, the @command{flash bank} command requires a driver name, and allows driver-specific options and behaviors. Some drivers also activate driver-specific commands. @@ -3704,7 +3704,7 @@ specific external chip select on the CPU. Frequently the first such chip is used to boot the system. Your board's @code{reset-init} handler might need to configure additional chip selects using other commands (like: @command{mww} to -configure a bus and its timings) , or +configure a bus and its timings), or perhaps configure a GPIO pin that controls the ``write protect'' pin on the flash chip. The CFI driver can use a target-specific working area to significantly @@ -3725,6 +3725,15 @@ wide on a sixteen bit bus: flash bank cfi 0x00000000 0x01000000 2 2 $_TARGETNAME flash bank cfi 0x01000000 0x01000000 2 2 $_TARGETNAME @end example + +To configure one bank of 32 MBytes +built from two sixteen bit (two byte) wide parts wired in parallel +to create a thirty-two bit (four byte) bus with doubled throughput: + +@example +flash bank cfi 0x00000000 0x02000000 2 4 $_TARGETNAME +@end example + @c "cfi part_id" disabled @end deffn @@ -4620,7 +4629,7 @@ with the wrong ECC data can cause them to be marked as bad. @end deffn @anchor{NAND Driver List} -@section NAND Drivers, Options, and Commands +@section NAND Driver List As noted above, the @command{nand device} command allows driver-specific options and behaviors. Some controllers also activate controller-specific commands. ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-09 18:46:24
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 3885ab5a5af7ece410ce3eeb1059da3ea950436a (commit) via 42cafc9369088d2a5d5f633358a2a42aa7bbc0de (commit) via 994a63c3fee11b8c65891ead6b03b2b716044541 (commit) via 81fbc637185fb0007dbe84c866794800851295b5 (commit) via 5e9d18f027954c5f5e883934d6c54cb20817ea9f (commit) via 1712d7835e0fbba60d578b52b21b95b046805757 (commit) from 4882647f3ee7fc0680c49fbd27a484359fd7e86a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3885ab5a5af7ece410ce3eeb1059da3ea950436a Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 04:22:23 2009 -0800 src/target: remove 'extern' and wrap headers Remove extern keywords from function prototypes and wrap long lines. diff --git a/src/target/algorithm.h b/src/target/algorithm.h index 15e3cf2..600580c 100644 --- a/src/target/algorithm.h +++ b/src/target/algorithm.h @@ -45,9 +45,12 @@ typedef struct reg_param_s enum param_direction direction; } reg_param_t; -extern void init_mem_param(mem_param_t *param, uint32_t address, uint32_t size, enum param_direction direction); -extern void destroy_mem_param(mem_param_t *param); -extern void init_reg_param(reg_param_t *param, char *reg_name, uint32_t size, enum param_direction direction); -extern void destroy_reg_param(reg_param_t *param); +void init_mem_param(mem_param_t *param, + uint32_t address, uint32_t size, enum param_direction dir); +void destroy_mem_param(mem_param_t *param); + +void init_reg_param(reg_param_t *param, + char *reg_name, uint32_t size, enum param_direction dir); +void destroy_reg_param(reg_param_t *param); #endif /* ALGORITHM_H */ diff --git a/src/target/arm926ejs.h b/src/target/arm926ejs.h index 01e3c09..0712c53 100644 --- a/src/target/arm926ejs.h +++ b/src/target/arm926ejs.h @@ -46,10 +46,12 @@ target_to_arm926(struct target_s *target) } -extern int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, jtag_tap_t *tap); -extern int arm926ejs_register_commands(struct command_context_s *cmd_ctx); -extern int arm926ejs_arch_state(struct target_s *target); -extern int arm926ejs_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); -extern int arm926ejs_soft_reset_halt(struct target_s *target); +int arm926ejs_init_arch_info(target_t *target, + arm926ejs_common_t *arm926ejs, jtag_tap_t *tap); +int arm926ejs_register_commands(struct command_context_s *cmd_ctx); +int arm926ejs_arch_state(struct target_s *target); +int arm926ejs_write_memory(struct target_s *target, + uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); +int arm926ejs_soft_reset_halt(struct target_s *target); #endif /* ARM926EJS_H */ diff --git a/src/target/arm966e.h b/src/target/arm966e.h index e8346f9..8d0ee50 100644 --- a/src/target/arm966e.h +++ b/src/target/arm966e.h @@ -41,8 +41,9 @@ target_to_arm966(struct target_s *target) arm9tdmi_common.arm7_9_common.armv4_5_common); } -extern int arm966e_init_arch_info(target_t *target, arm966e_common_t *arm966e, jtag_tap_t *tap); -extern int arm966e_register_commands(struct command_context_s *cmd_ctx); -extern int arm966e_write_cp15(target_t *target, int reg_addr, uint32_t value); +int arm966e_init_arch_info(target_t *target, + arm966e_common_t *arm966e, jtag_tap_t *tap); +int arm966e_register_commands(struct command_context_s *cmd_ctx); +int arm966e_write_cp15(target_t *target, int reg_addr, uint32_t value); #endif /* ARM966E_H */ diff --git a/src/target/arm9tdmi.h b/src/target/arm9tdmi.h index 8bf2713..c098d82 100644 --- a/src/target/arm9tdmi.h +++ b/src/target/arm9tdmi.h @@ -51,34 +51,34 @@ enum arm9tdmi_vector ARM9TDMI_FIQ_VECTOR = 0x80, }; -extern int arm9tdmi_init_target(struct command_context_s *cmd_ctx, - struct target_s *target); +int arm9tdmi_init_target(struct command_context_s *cmd_ctx, + struct target_s *target); int arm9tdmi_examine(struct target_s *target); -extern int arm9tdmi_init_arch_info(target_t *target, - arm9tdmi_common_t *arm9tdmi, jtag_tap_t *tap); -extern int arm9tdmi_register_commands(struct command_context_s *cmd_ctx); +int arm9tdmi_init_arch_info(target_t *target, + arm9tdmi_common_t *arm9tdmi, jtag_tap_t *tap); +int arm9tdmi_register_commands(struct command_context_s *cmd_ctx); -extern int arm9tdmi_clock_out(arm_jtag_t *jtag_info, - uint32_t instr, uint32_t out, uint32_t *in, int sysspeed); -extern int arm9tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in); -extern int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, - void *in, int size, int be); -extern void arm9tdmi_read_core_regs(target_t *target, - uint32_t mask, uint32_t* core_regs[16]); -extern void arm9tdmi_write_core_regs(target_t *target, - uint32_t mask, uint32_t core_regs[16]); +int arm9tdmi_clock_out(arm_jtag_t *jtag_info, + uint32_t instr, uint32_t out, uint32_t *in, int sysspeed); +int arm9tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in); +int arm9tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, + void *in, int size, int be); +void arm9tdmi_read_core_regs(target_t *target, + uint32_t mask, uint32_t* core_regs[16]); +void arm9tdmi_write_core_regs(target_t *target, + uint32_t mask, uint32_t core_regs[16]); -extern int arm9tdmi_examine_debug_reason(target_t *target); +int arm9tdmi_examine_debug_reason(target_t *target); -extern void arm9tdmi_load_word_regs(target_t *target, uint32_t mask); -extern void arm9tdmi_load_hword_reg(target_t *target, int num); -extern void arm9tdmi_load_byte_reg(target_t *target, int num); -extern void arm9tdmi_store_word_regs(target_t *target, uint32_t mask); -extern void arm9tdmi_store_hword_reg(target_t *target, int num); -extern void arm9tdmi_store_byte_reg(target_t *target, int num); +void arm9tdmi_load_word_regs(target_t *target, uint32_t mask); +void arm9tdmi_load_hword_reg(target_t *target, int num); +void arm9tdmi_load_byte_reg(target_t *target, int num); +void arm9tdmi_store_word_regs(target_t *target, uint32_t mask); +void arm9tdmi_store_hword_reg(target_t *target, int num); +void arm9tdmi_store_byte_reg(target_t *target, int num); -extern void arm9tdmi_branch_resume(target_t *target); -extern void arm9tdmi_enable_single_step(target_t *target, uint32_t next_pc); -extern void arm9tdmi_disable_single_step(target_t *target); +void arm9tdmi_branch_resume(target_t *target); +void arm9tdmi_enable_single_step(target_t *target, uint32_t next_pc); +void arm9tdmi_disable_single_step(target_t *target); #endif /* ARM9TDMI_H */ diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h index 3ff883a..442b45c 100644 --- a/src/target/arm_adi_v5.h +++ b/src/target/arm_adi_v5.h @@ -111,39 +111,48 @@ static inline uint8_t dap_ap_get_select(swjdp_common_t *swjdp) } /* Internal functions used in the module, partial transactions, use with caution */ -extern int dap_dp_write_reg(swjdp_common_t *swjdp, uint32_t value, uint8_t reg_addr); -/* extern int swjdp_write_apacc(swjdp_common_t *swjdp, uint32_t value, uint8_t reg_addr); */ -extern int dap_dp_read_reg(swjdp_common_t *swjdp, uint32_t *value, uint8_t reg_addr); -/* extern int swjdp_read_apacc(swjdp_common_t *swjdp, uint32_t *value, uint8_t reg_addr); */ -extern int dap_setup_accessport(swjdp_common_t *swjdp, uint32_t csw, uint32_t tar); -extern int dap_ap_select(swjdp_common_t *swjdp,uint8_t apsel); - -extern int dap_ap_write_reg(swjdp_common_t *swjdp, uint32_t reg_addr, uint8_t* out_value_buf); -extern int dap_ap_write_reg_u32(swjdp_common_t *swjdp, uint32_t reg_addr, uint32_t value); -extern int dap_ap_read_reg(swjdp_common_t *swjdp, uint32_t reg_addr, uint8_t *in_value_buf); -extern int dap_ap_read_reg_u32(swjdp_common_t *swjdp, uint32_t reg_addr, uint32_t *value); +int dap_dp_write_reg(swjdp_common_t *swjdp, uint32_t value, uint8_t reg_addr); +/* int swjdp_write_apacc(swjdp_common_t *swjdp, uint32_t value, uint8_t reg_addr); */ +int dap_dp_read_reg(swjdp_common_t *swjdp, uint32_t *value, uint8_t reg_addr); +/* int swjdp_read_apacc(swjdp_common_t *swjdp, uint32_t *value, uint8_t reg_addr); */ +int dap_setup_accessport(swjdp_common_t *swjdp, uint32_t csw, uint32_t tar); +int dap_ap_select(swjdp_common_t *swjdp,uint8_t apsel); + +int dap_ap_write_reg(swjdp_common_t *swjdp, uint32_t addr, uint8_t* out_buf); +int dap_ap_write_reg_u32(swjdp_common_t *swjdp, uint32_t addr, uint32_t value); +int dap_ap_read_reg(swjdp_common_t *swjdp, uint32_t addr, uint8_t *in_buf); +int dap_ap_read_reg_u32(swjdp_common_t *swjdp, uint32_t addr, uint32_t *value); /* External interface, partial operations must be completed with swjdp_transaction_endcheck() */ -extern int swjdp_transaction_endcheck(swjdp_common_t *swjdp); +int swjdp_transaction_endcheck(swjdp_common_t *swjdp); /* MEM-AP memory mapped bus single uint32_t register transfers, without endcheck */ -extern int mem_ap_read_u32(swjdp_common_t *swjdp, uint32_t address, uint32_t *value); -extern int mem_ap_write_u32(swjdp_common_t *swjdp, uint32_t address, uint32_t value); +int mem_ap_read_u32(swjdp_common_t *swjdp, uint32_t address, uint32_t *value); +int mem_ap_write_u32(swjdp_common_t *swjdp, uint32_t address, uint32_t value); /* MEM-AP memory mapped bus transfers, single registers, complete transactions */ -extern int mem_ap_read_atomic_u32(swjdp_common_t *swjdp, uint32_t address, uint32_t *value); -extern int mem_ap_write_atomic_u32(swjdp_common_t *swjdp, uint32_t address, uint32_t value); +int mem_ap_read_atomic_u32(swjdp_common_t *swjdp, + uint32_t address, uint32_t *value); +int mem_ap_write_atomic_u32(swjdp_common_t *swjdp, + uint32_t address, uint32_t value); /* MEM-AP memory mapped bus block transfers */ -extern int mem_ap_read_buf_u8(swjdp_common_t *swjdp, uint8_t *buffer, int count, uint32_t address); -extern int mem_ap_read_buf_u16(swjdp_common_t *swjdp, uint8_t *buffer, int count, uint32_t address); -extern int mem_ap_read_buf_u32(swjdp_common_t *swjdp, uint8_t *buffer, int count, uint32_t address); -extern int mem_ap_write_buf_u8(swjdp_common_t *swjdp, uint8_t *buffer, int count, uint32_t address); -extern int mem_ap_write_buf_u16(swjdp_common_t *swjdp, uint8_t *buffer, int count, uint32_t address); -extern int mem_ap_write_buf_u32(swjdp_common_t *swjdp, uint8_t *buffer, int count, uint32_t address); +int mem_ap_read_buf_u8(swjdp_common_t *swjdp, + uint8_t *buffer, int count, uint32_t address); +int mem_ap_read_buf_u16(swjdp_common_t *swjdp, + uint8_t *buffer, int count, uint32_t address); +int mem_ap_read_buf_u32(swjdp_common_t *swjdp, + uint8_t *buffer, int count, uint32_t address); + +int mem_ap_write_buf_u8(swjdp_common_t *swjdp, + uint8_t *buffer, int count, uint32_t address); +int mem_ap_write_buf_u16(swjdp_common_t *swjdp, + uint8_t *buffer, int count, uint32_t address); +int mem_ap_write_buf_u32(swjdp_common_t *swjdp, + uint8_t *buffer, int count, uint32_t address); /* Initialisation of the debug system, power domains and registers */ -extern int ahbap_debugport_init(swjdp_common_t *swjdp); +int ahbap_debugport_init(swjdp_common_t *swjdp); /* Commands for user dap access */ diff --git a/src/target/arm_disassembler.h b/src/target/arm_disassembler.h index b841d6c..8021e7c 100644 --- a/src/target/arm_disassembler.h +++ b/src/target/arm_disassembler.h @@ -197,11 +197,13 @@ typedef struct arm_instruction_s } arm_instruction_t; -extern int arm_evaluate_opcode(uint32_t opcode, uint32_t address, arm_instruction_t *instruction); -extern int thumb_evaluate_opcode(uint16_t opcode, uint32_t address, arm_instruction_t *instruction); -extern int thumb2_opcode(target_t *target, uint32_t address, +int arm_evaluate_opcode(uint32_t opcode, uint32_t address, arm_instruction_t *instruction); -extern int arm_access_size(arm_instruction_t *instruction); +int thumb_evaluate_opcode(uint16_t opcode, uint32_t address, + arm_instruction_t *instruction); +int thumb2_opcode(target_t *target, uint32_t address, + arm_instruction_t *instruction); +int arm_access_size(arm_instruction_t *instruction); #define COND(opcode) (arm_condition_strings[(opcode & 0xf0000000) >> 28]) diff --git a/src/target/arm_jtag.h b/src/target/arm_jtag.h index f4b04e8..c7d12cb 100644 --- a/src/target/arm_jtag.h +++ b/src/target/arm_jtag.h @@ -36,9 +36,10 @@ typedef struct arm_jtag_s uint32_t intest_instr; } arm_jtag_t; -extern int arm_jtag_set_instr(arm_jtag_t *jtag_info, uint32_t new_instr, void *verify_capture); -extern int arm_jtag_scann(arm_jtag_t *jtag_info, uint32_t new_scan_chain); -extern int arm_jtag_setup_connection(arm_jtag_t *jtag_info); +int arm_jtag_set_instr(arm_jtag_t *jtag_info, + uint32_t new_instr, void *verify_capture); +int arm_jtag_scann(arm_jtag_t *jtag_info, uint32_t new_scan_chain); +int arm_jtag_setup_connection(arm_jtag_t *jtag_info); /* JTAG buffers to host, be and le buffers, flipping variants */ int arm_jtag_buf_to_u32_flip(uint8_t *in_buf, void *priv, struct scan_field_s *field); diff --git a/src/target/arm_simulator.h b/src/target/arm_simulator.h index bad904b..9e7b040 100644 --- a/src/target/arm_simulator.h +++ b/src/target/arm_simulator.h @@ -37,12 +37,11 @@ struct arm_sim_interface enum armv4_5_mode (*get_mode)(struct arm_sim_interface *sim); }; - /* armv4_5 version */ -extern int arm_simulate_step(struct target_s *target, uint32_t *dry_run_pc); +int arm_simulate_step(struct target_s *target, uint32_t *dry_run_pc); /* a generic arm simulator. Caller must implement the sim interface */ -extern int arm_simulate_step_core(target_t *target, uint32_t *dry_run_pc, struct arm_sim_interface *sim); - +int arm_simulate_step_core(target_t *target, + uint32_t *dry_run_pc, struct arm_sim_interface *sim); #endif /* ARM_SIMULATOR_H */ diff --git a/src/target/armv4_5.h b/src/target/armv4_5.h index fb7926b..d76ce75 100644 --- a/src/target/armv4_5.h +++ b/src/target/armv4_5.h @@ -108,7 +108,8 @@ typedef struct armv4_5_core_reg_s armv4_5_common_t *armv4_5_common; } armv4_5_core_reg_t; -extern reg_cache_t* armv4_5_build_reg_cache(target_t *target, armv4_5_common_t *armv4_5_common); +reg_cache_t* armv4_5_build_reg_cache(target_t *target, + armv4_5_common_t *armv4_5_common); /* map psr mode bits to linear number */ static __inline int armv4_5_mode_to_number(enum armv4_5_mode mode) @@ -147,15 +148,20 @@ static __inline enum armv4_5_mode armv4_5_number_to_mode(int number) } }; -extern int armv4_5_arch_state(struct target_s *target); -extern int armv4_5_get_gdb_reg_list(target_t *target, reg_t **reg_list[], int *reg_list_size); +int armv4_5_arch_state(struct target_s *target); +int armv4_5_get_gdb_reg_list(target_t *target, + reg_t **reg_list[], int *reg_list_size); -extern int armv4_5_register_commands(struct command_context_s *cmd_ctx); -extern int armv4_5_init_arch_info(target_t *target, armv4_5_common_t *armv4_5); +int armv4_5_register_commands(struct command_context_s *cmd_ctx); +int armv4_5_init_arch_info(target_t *target, armv4_5_common_t *armv4_5); -extern int armv4_5_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_params, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info); +int armv4_5_run_algorithm(struct target_s *target, + int num_mem_params, mem_param_t *mem_params, + int num_reg_params, reg_param_t *reg_params, + uint32_t entry_point, uint32_t exit_point, + int timeout_ms, void *arch_info); -extern int armv4_5_invalidate_core_regs(target_t *target); +int armv4_5_invalidate_core_regs(target_t *target); /* ARM mode instructions */ diff --git a/src/target/armv4_5_cache.h b/src/target/armv4_5_cache.h index 44bc212..71e3203 100644 --- a/src/target/armv4_5_cache.h +++ b/src/target/armv4_5_cache.h @@ -42,10 +42,13 @@ typedef struct armv4_5_cache_common_s int d_u_cache_enabled; } armv4_5_cache_common_t; -extern int armv4_5_identify_cache(uint32_t cache_type_reg, armv4_5_cache_common_t *cache); -extern int armv4_5_cache_state(uint32_t cp15_control_reg, armv4_5_cache_common_t *cache); +int armv4_5_identify_cache(uint32_t cache_type_reg, + armv4_5_cache_common_t *cache); +int armv4_5_cache_state(uint32_t cp15_control_reg, + armv4_5_cache_common_t *cache); -extern int armv4_5_handle_cache_info_command(struct command_context_s *cmd_ctx, armv4_5_cache_common_t *armv4_5_cache); +int armv4_5_handle_cache_info_command(struct command_context_s *cmd_ctx, + armv4_5_cache_common_t *armv4_5_cache); enum { diff --git a/src/target/armv4_5_mmu.h b/src/target/armv4_5_mmu.h index 0c9b550..b0c39a7 100644 --- a/src/target/armv4_5_mmu.h +++ b/src/target/armv4_5_mmu.h @@ -42,9 +42,17 @@ enum extern char* armv4_5_page_type_names[]; -extern uint32_t armv4_5_mmu_translate_va(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu, uint32_t va, int *type, uint32_t *cb, int *domain, uint32_t *ap); -extern int armv4_5_mmu_read_physical(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); -extern int armv4_5_mmu_write_physical(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); +uint32_t armv4_5_mmu_translate_va(target_t *target, + armv4_5_mmu_common_t *armv4_5_mmu, uint32_t va, int *type, + uint32_t *cb, int *domain, uint32_t *ap); + +int armv4_5_mmu_read_physical(target_t *target, + armv4_5_mmu_common_t *armv4_5_mmu, + uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); + +int armv4_5_mmu_write_physical(target_t *target, + armv4_5_mmu_common_t *armv4_5_mmu, + uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); enum { diff --git a/src/target/armv7m.h b/src/target/armv7m.h index 217f0e3..7601685 100644 --- a/src/target/armv7m.h +++ b/src/target/armv7m.h @@ -50,7 +50,7 @@ enum armv7m_regtype ARMV7M_REGISTER_MEMMAP }; -extern char *armv7m_exception_string(int number); +char *armv7m_exception_string(int number); /* offsets into armv7m core register cache */ enum @@ -134,24 +134,31 @@ typedef struct armv7m_core_reg_s armv7m_common_t *armv7m_common; } armv7m_core_reg_t; -extern reg_cache_t *armv7m_build_reg_cache(target_t *target); -extern enum armv7m_mode armv7m_number_to_mode(int number); -extern int armv7m_mode_to_number(enum armv7m_mode mode); +reg_cache_t *armv7m_build_reg_cache(target_t *target); +enum armv7m_mode armv7m_number_to_mode(int number); +int armv7m_mode_to_number(enum armv7m_mode mode); -extern int armv7m_arch_state(struct target_s *target); -extern int armv7m_get_gdb_reg_list(target_t *target, reg_t **reg_list[], int *reg_list_size); +int armv7m_arch_state(struct target_s *target); +int armv7m_get_gdb_reg_list(target_t *target, + reg_t **reg_list[], int *reg_list_size); -extern int armv7m_register_commands(struct command_context_s *cmd_ctx); -extern int armv7m_init_arch_info(target_t *target, armv7m_common_t *armv7m); +int armv7m_register_commands(struct command_context_s *cmd_ctx); +int armv7m_init_arch_info(target_t *target, armv7m_common_t *armv7m); -extern int armv7m_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_params, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info); +int armv7m_run_algorithm(struct target_s *target, + int num_mem_params, mem_param_t *mem_params, + int num_reg_params, reg_param_t *reg_params, + uint32_t entry_point, uint32_t exit_point, + int timeout_ms, void *arch_info); -extern int armv7m_invalidate_core_regs(target_t *target); +int armv7m_invalidate_core_regs(target_t *target); -extern int armv7m_restore_context(target_t *target); +int armv7m_restore_context(target_t *target); -extern int armv7m_checksum_memory(struct target_s *target, uint32_t address, uint32_t count, uint32_t* checksum); -extern int armv7m_blank_check_memory(struct target_s *target, uint32_t address, uint32_t count, uint32_t* blank); +int armv7m_checksum_memory(struct target_s *target, + uint32_t address, uint32_t count, uint32_t* checksum); +int armv7m_blank_check_memory(struct target_s *target, + uint32_t address, uint32_t count, uint32_t* blank); /* Thumb mode instructions */ diff --git a/src/target/breakpoints.h b/src/target/breakpoints.h index 9145966..781c91b 100644 --- a/src/target/breakpoints.h +++ b/src/target/breakpoints.h @@ -58,12 +58,17 @@ typedef struct watchpoint_s int unique_id; } watchpoint_t; -extern void breakpoint_clear_target(struct target_s *target); -extern int breakpoint_add(struct target_s *target, uint32_t address, uint32_t length, enum breakpoint_type type); -extern void breakpoint_remove(struct target_s *target, uint32_t address); -extern breakpoint_t* breakpoint_find(struct target_s *target, uint32_t address); -extern int watchpoint_add(struct target_s *target, uint32_t address, uint32_t length, enum watchpoint_rw rw, uint32_t value, uint32_t mask); -extern void watchpoint_remove(struct target_s *target, uint32_t address); -extern void watchpoint_clear_target(struct target_s *target); +void breakpoint_clear_target(struct target_s *target); +int breakpoint_add(struct target_s *target, + uint32_t address, uint32_t length, enum breakpoint_type type); +void breakpoint_remove(struct target_s *target, uint32_t address); + +breakpoint_t* breakpoint_find(struct target_s *target, uint32_t address); + +void watchpoint_clear_target(struct target_s *target); +int watchpoint_add(struct target_s *target, + uint32_t address, uint32_t length, + enum watchpoint_rw rw, uint32_t value, uint32_t mask); +void watchpoint_remove(struct target_s *target, uint32_t address); #endif /* BREAKPOINTS_H */ diff --git a/src/target/cortex_a8.h b/src/target/cortex_a8.h index b4cb327..42cb062 100644 --- a/src/target/cortex_a8.h +++ b/src/target/cortex_a8.h @@ -143,8 +143,13 @@ target_to_cortex_a8(struct target_s *target) armv7a_common.armv4_5_common); } -extern int cortex_a8_init_arch_info(target_t *target, cortex_a8_common_t *cortex_a8, jtag_tap_t *tap); -int cortex_a8_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); -int cortex_a8_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); +int cortex_a8_init_arch_info(target_t *target, + cortex_a8_common_t *cortex_a8, jtag_tap_t *tap); +int cortex_a8_read_memory(struct target_s *target, + uint32_t address, uint32_t size, + uint32_t count, uint8_t *buffer); +int cortex_a8_write_memory(struct target_s *target, + uint32_t address, uint32_t size, + uint32_t count, uint8_t *buffer); #endif /* CORTEX_A8_H */ diff --git a/src/target/embeddedice.h b/src/target/embeddedice.h index 08e42c9..b1ba989 100644 --- a/src/target/embeddedice.h +++ b/src/target/embeddedice.h @@ -93,17 +93,25 @@ typedef struct embeddedice_reg_s arm_jtag_t *jtag_info; } embeddedice_reg_t; -extern reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7_9); -extern int embeddedice_setup(target_t *target); -extern int embeddedice_read_reg(reg_t *reg); -extern void embeddedice_write_reg(reg_t *reg, uint32_t value); -extern int embeddedice_read_reg_w_check(reg_t *reg, uint8_t* check_value, uint8_t* check_mask); -extern void embeddedice_store_reg(reg_t *reg); -extern void embeddedice_set_reg(reg_t *reg, uint32_t value); -extern int embeddedice_set_reg_w_exec(reg_t *reg, uint8_t *buf); -extern int embeddedice_receive(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size); -extern int embeddedice_send(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size); -extern int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, uint32_t timeout); +reg_cache_t* embeddedice_build_reg_cache(target_t *target, + arm7_9_common_t *arm7_9); + +int embeddedice_setup(target_t *target); + +int embeddedice_read_reg(reg_t *reg); +int embeddedice_read_reg_w_check(reg_t *reg, + uint8_t* check_value, uint8_t* check_mask); + +void embeddedice_write_reg(reg_t *reg, uint32_t value); +void embeddedice_store_reg(reg_t *reg); + +void embeddedice_set_reg(reg_t *reg, uint32_t value); +int embeddedice_set_reg_w_exec(reg_t *reg, uint8_t *buf); + +int embeddedice_receive(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size); +int embeddedice_send(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size); + +int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, uint32_t timeout); /* If many embeddedice_write_reg() follow eachother, then the >1 invocations can be this faster version of * embeddedice_write_reg diff --git a/src/target/etb.h b/src/target/etb.h index 0eeb02b..cc58b65 100644 --- a/src/target/etb.h +++ b/src/target/etb.h @@ -56,6 +56,6 @@ typedef struct etb_reg_s extern etm_capture_driver_t etb_capture_driver; -extern reg_cache_t* etb_build_reg_cache(etb_t *etb); +reg_cache_t* etb_build_reg_cache(etb_t *etb); #endif /* ETB_H */ diff --git a/src/target/etm.h b/src/target/etm.h index b2426c7..c751aac 100644 --- a/src/target/etm.h +++ b/src/target/etm.h @@ -200,8 +200,10 @@ typedef enum BR_RSVD7 = 0x7, /* reserved */ } etmv1_branch_reason_t; -extern reg_cache_t* etm_build_reg_cache(target_t *target, arm_jtag_t *jtag_info, etm_context_t *etm_ctx); -extern int etm_setup(target_t *target); +reg_cache_t* etm_build_reg_cache(target_t *target, + arm_jtag_t *jtag_info, etm_context_t *etm_ctx); + +int etm_setup(target_t *target); int etm_register_commands(struct command_context_s *cmd_ctx); diff --git a/src/target/image.h b/src/target/image.h index 551524e..8b70b3b 100644 --- a/src/target/image.h +++ b/src/target/image.h @@ -100,12 +100,16 @@ typedef struct image_mot_s uint8_t *buffer; } image_mot_t; -extern int image_open(image_t *image, char *url, char *type_string); -extern int image_read_section(image_t *image, int section, uint32_t offset, uint32_t size, uint8_t *buffer, uint32_t *size_read); -extern void image_close(image_t *image); -extern int image_add_section(image_t *image, uint32_t base, uint32_t size, int flags, uint8_t *data); +int image_open(image_t *image, char *url, char *type_string); +int image_read_section(image_t *image, int section, uint32_t offset, + uint32_t size, uint8_t *buffer, uint32_t *size_read); +void image_close(image_t *image); -extern int image_calculate_checksum(uint8_t* buffer, uint32_t nbytes, uint32_t* checksum); +int image_add_section(image_t *image, uint32_t base, uint32_t size, + int flags, uint8_t *data); + +int image_calculate_checksum(uint8_t* buffer, uint32_t nbytes, + uint32_t* checksum); #define ERROR_IMAGE_FORMAT_ERROR (-1400) #define ERROR_IMAGE_TYPE_UNKNOWN (-1401) diff --git a/src/target/mips32.h b/src/target/mips32.h index bc88bc3..005798d 100644 --- a/src/target/mips32.h +++ b/src/target/mips32.h @@ -124,18 +124,32 @@ typedef struct mips32_core_reg_s #define MIPS32_SDBBP 0x7000003F #define MIPS16_SDBBP 0xE801 -extern int mips32_arch_state(struct target_s *target); -extern int mips32_init_arch_info(target_t *target, mips32_common_t *mips32, jtag_tap_t *tap); -extern int mips32_restore_context(target_t *target); -extern int mips32_save_context(target_t *target); -extern reg_cache_t *mips32_build_reg_cache(target_t *target); -extern int mips32_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_params, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info); -extern int mips32_configure_break_unit(struct target_s *target); -extern int mips32_enable_interrupts(struct target_s *target, int enable); -extern int mips32_examine(struct target_s *target); - -extern int mips32_register_commands(struct command_context_s *cmd_ctx); -extern int mips32_invalidate_core_regs(target_t *target); -extern int mips32_get_gdb_reg_list(target_t *target, reg_t **reg_list[], int *reg_list_size); +int mips32_arch_state(struct target_s *target); + +int mips32_init_arch_info(target_t *target, + mips32_common_t *mips32, jtag_tap_t *tap); + +int mips32_restore_context(target_t *target); +int mips32_save_context(target_t *target); + +reg_cache_t *mips32_build_reg_cache(target_t *target); + +int mips32_run_algorithm(struct target_s *target, + int num_mem_params, mem_param_t *mem_params, + int num_reg_params, reg_param_t *reg_params, + uint32_t entry_point, uint32_t exit_point, + int timeout_ms, void *arch_info); + +int mips32_configure_break_unit(struct target_s *target); + +int mips32_enable_interrupts(struct target_s *target, int enable); + +int mips32_examine(struct target_s *target); + +int mips32_register_commands(struct command_context_s *cmd_ctx); + +int mips32_invalidate_core_regs(target_t *target); +int mips32_get_gdb_reg_list(target_t *target, + reg_t **reg_list[], int *reg_list_size); #endif /*MIPS32_H*/ diff --git a/src/target/mips32_dmaacc.h b/src/target/mips32_dmaacc.h index e44ddad..c8a64fb 100644 --- a/src/target/mips32_dmaacc.h +++ b/src/target/mips32_dmaacc.h @@ -34,15 +34,23 @@ #define RETRY_ATTEMPTS 0 -extern int mips32_dmaacc_read_mem(mips_ejtag_t *ejtag_info, uint32_t addr, int size, int count, void *buf); -extern int mips32_dmaacc_write_mem(mips_ejtag_t *ejtag_info, uint32_t addr, int size, int count, void *buf); +int mips32_dmaacc_read_mem(mips_ejtag_t *ejtag_info, + uint32_t addr, int size, int count, void *buf); +int mips32_dmaacc_write_mem(mips_ejtag_t *ejtag_info, + uint32_t addr, int size, int count, void *buf); -extern int mips32_dmaacc_read_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint8_t *buf); -extern int mips32_dmaacc_read_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint16_t *buf); -extern int mips32_dmaacc_read_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint32_t *buf); +int mips32_dmaacc_read_mem8(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint8_t *buf); +int mips32_dmaacc_read_mem16(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint16_t *buf); +int mips32_dmaacc_read_mem32(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint32_t *buf); -extern int mips32_dmaacc_write_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint8_t *buf); -extern int mips32_dmaacc_write_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint16_t *buf); -extern int mips32_dmaacc_write_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint32_t *buf); +int mips32_dmaacc_write_mem8(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint8_t *buf); +int mips32_dmaacc_write_mem16(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint16_t *buf); +int mips32_dmaacc_write_mem32(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint32_t *buf); #endif diff --git a/src/target/mips32_pracc.h b/src/target/mips32_pracc.h index 8443f87..866f6f5 100644 --- a/src/target/mips32_pracc.h +++ b/src/target/mips32_pracc.h @@ -37,22 +37,34 @@ #define NEG16(v) (((~(v)) + 1) & 0xFFFF) /*#define NEG18(v) (((~(v)) + 1) & 0x3FFFF)*/ -extern int mips32_pracc_read_mem(mips_ejtag_t *ejtag_info, uint32_t addr, int size, int count, void *buf); -extern int mips32_pracc_write_mem(mips_ejtag_t *ejtag_info, uint32_t addr, int size, int count, void *buf); +int mips32_pracc_read_mem(mips_ejtag_t *ejtag_info, + uint32_t addr, int size, int count, void *buf); +int mips32_pracc_write_mem(mips_ejtag_t *ejtag_info, + uint32_t addr, int size, int count, void *buf); -extern int mips32_pracc_read_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint8_t *buf); -extern int mips32_pracc_read_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint16_t *buf); -extern int mips32_pracc_read_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint32_t *buf); -extern int mips32_pracc_read_u32(mips_ejtag_t *ejtag_info, uint32_t addr, uint32_t *buf); +int mips32_pracc_read_mem8(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint8_t *buf); +int mips32_pracc_read_mem16(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint16_t *buf); +int mips32_pracc_read_mem32(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint32_t *buf); +int mips32_pracc_read_u32(mips_ejtag_t *ejtag_info, + uint32_t addr, uint32_t *buf); -extern int mips32_pracc_write_mem8(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint8_t *buf); -extern int mips32_pracc_write_mem16(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint16_t *buf); -extern int mips32_pracc_write_mem32(mips_ejtag_t *ejtag_info, uint32_t addr, int count, uint32_t *buf); -extern int mips32_pracc_write_u32(mips_ejtag_t *ejtag_info, uint32_t addr, uint32_t *buf); +int mips32_pracc_write_mem8(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint8_t *buf); +int mips32_pracc_write_mem16(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint16_t *buf); +int mips32_pracc_write_mem32(mips_ejtag_t *ejtag_info, + uint32_t addr, int count, uint32_t *buf); +int mips32_pracc_write_u32(mips_ejtag_t *ejtag_info, + uint32_t addr, uint32_t *buf); -extern int mips32_pracc_read_regs(mips_ejtag_t *ejtag_info, uint32_t *regs); -extern int mips32_pracc_write_regs(mips_ejtag_t *ejtag_info, uint32_t *regs); +int mips32_pracc_read_regs(mips_ejtag_t *ejtag_info, uint32_t *regs); +int mips32_pracc_write_regs(mips_ejtag_t *ejtag_info, uint32_t *regs); -extern int mips32_pracc_exec(mips_ejtag_t *ejtag_info, int code_len, uint32_t *code, int num_param_in, uint32_t *param_in, int num_param_out, uint32_t *param_out, int cycle); +int mips32_pracc_exec(mips_ejtag_t *ejtag_info, int code_len, uint32_t *code, + int num_param_in, uint32_t *param_in, + int num_param_out, uint32_t *param_out, int cycle); #endif diff --git a/src/target/mips_ejtag.h b/src/target/mips_ejtag.h index 274392a..69ede52 100644 --- a/src/target/mips_ejtag.h +++ b/src/target/mips_ejtag.h @@ -111,15 +111,16 @@ typedef struct mips_ejtag_s uint32_t ejtag_ctrl; } mips_ejtag_t; -extern int mips_ejtag_set_instr(mips_ejtag_t *ejtag_info, int new_instr, void *delete_me_and_submit_patch); -extern int mips_ejtag_enter_debug(mips_ejtag_t *ejtag_info); -extern int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info); -extern int mips_ejtag_get_impcode(mips_ejtag_t *ejtag_info, uint32_t *impcode); -extern int mips_ejtag_get_idcode(mips_ejtag_t *ejtag_info, uint32_t *idcode); -extern int mips_ejtag_drscan_32(mips_ejtag_t *ejtag_info, uint32_t *data); +int mips_ejtag_set_instr(mips_ejtag_t *ejtag_info, + int new_instr, void *delete_me_and_submit_patch); +int mips_ejtag_enter_debug(mips_ejtag_t *ejtag_info); +int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info); +int mips_ejtag_get_impcode(mips_ejtag_t *ejtag_info, uint32_t *impcode); +int mips_ejtag_get_idcode(mips_ejtag_t *ejtag_info, uint32_t *idcode); +int mips_ejtag_drscan_32(mips_ejtag_t *ejtag_info, uint32_t *data); -extern int mips_ejtag_init(mips_ejtag_t *ejtag_info); -extern int mips_ejtag_config_step(mips_ejtag_t *ejtag_info, int enable_step); -extern int mips_ejtag_read_debug(mips_ejtag_t *ejtag_info, uint32_t* debug_reg); +int mips_ejtag_init(mips_ejtag_t *ejtag_info); +int mips_ejtag_config_step(mips_ejtag_t *ejtag_info, int enable_step); +int mips_ejtag_read_debug(mips_ejtag_t *ejtag_info, uint32_t* debug_reg); #endif /* MIPS_EJTAG */ diff --git a/src/target/mips_m4k.h b/src/target/mips_m4k.h index 8e81d8f..e11f06a 100644 --- a/src/target/mips_m4k.h +++ b/src/target/mips_m4k.h @@ -35,17 +35,19 @@ typedef struct mips_m4k_common_s mips32_common_t mips32_common; } mips_m4k_common_t; -extern int mips_m4k_bulk_write_memory(struct target_s *target, uint32_t address, uint32_t count, uint8_t *buffer); - -extern void mips_m4k_enable_breakpoints(struct target_s *target); -extern int mips_m4k_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint); -extern int mips_m4k_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint); -extern int mips_m4k_add_breakpoint(struct target_s *target, breakpoint_t *breakpoint); -extern int mips_m4k_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint); -extern int mips_m4k_set_watchpoint(struct target_s *target, watchpoint_t *watchpoint); -extern int mips_m4k_unset_watchpoint(struct target_s *target, watchpoint_t *watchpoint); -extern int mips_m4k_add_watchpoint(struct target_s *target, watchpoint_t *watchpoint); -extern int mips_m4k_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint); -extern void mips_m4k_enable_watchpoints(struct target_s *target); +int mips_m4k_bulk_write_memory(struct target_s *target, + uint32_t address, uint32_t count, uint8_t *buffer); + +void mips_m4k_enable_breakpoints(struct target_s *target); +int mips_m4k_set_breakpoint(struct target_s *target, breakpoint_t *bp); +int mips_m4k_unset_breakpoint(struct target_s *target, breakpoint_t *bp); +int mips_m4k_add_breakpoint(struct target_s *target, breakpoint_t *bp); +int mips_m4k_remove_breakpoint(struct target_s *target, breakpoint_t *bp); + +void mips_m4k_enable_watchpoints(struct target_s *target); +int mips_m4k_set_watchpoint(struct target_s *target, watchpoint_t *wp); +int mips_m4k_unset_watchpoint(struct target_s *target, watchpoint_t *wp); +int mips_m4k_add_watchpoint(struct target_s *target, watchpoint_t *wp); +int mips_m4k_remove_watchpoint(struct target_s *target, watchpoint_t *wp); #endif /*MIPS_M4K_H*/ diff --git a/src/target/register.h b/src/target/register.h index d139379..e7904e5 100644 --- a/src/target/register.h +++ b/src/target/register.h @@ -62,10 +62,13 @@ typedef struct reg_arch_type_s struct reg_arch_type_s *next; } reg_arch_type_t; -extern reg_t* register_get_by_name(reg_cache_t *first, char *name, int search_all); -extern reg_cache_t** register_get_last_cache_p(reg_cache_t **first); -extern int register_reg_arch_type(int (*get)(reg_t *reg), int (*set)(reg_t *reg, uint8_t *buf)); -extern reg_arch_type_t* register_get_arch_type(int id); -extern void register_init_dummy(reg_t *reg); +reg_t* register_get_by_name(reg_cache_t *first, char *name, int search_all); +reg_cache_t** register_get_last_cache_p(reg_cache_t **first); + +int register_reg_arch_type(int (*get)(reg_t *reg), + int (*set)(reg_t *reg, uint8_t *buf)); +reg_arch_type_t* register_get_arch_type(int id); + +void register_init_dummy(reg_t *reg); #endif /* REGISTER_H */ diff --git a/src/target/target_request.h b/src/target/target_request.h index b457bd9..433c592 100644 --- a/src/target/target_request.h +++ b/src/target/target_request.h @@ -42,8 +42,9 @@ typedef struct debug_msg_receiver_s struct debug_msg_receiver_s *next; } debug_msg_receiver_t; -extern int target_request(target_t *target, uint32_t request); -extern int delete_debug_msg_receiver(struct command_context_s *cmd_ctx, target_t *target); -extern int target_request_register_commands(struct command_context_s *cmd_ctx); +int target_request(target_t *target, uint32_t request); +int delete_debug_msg_receiver(struct command_context_s *cmd_ctx, + target_t *target); +int target_request_register_commands(struct command_context_s *cmd_ctx); #endif /* TARGET_REQUEST_H */ diff --git a/src/target/trace.h b/src/target/trace.h index 0a9ccc5..f6615f5 100644 --- a/src/target/trace.h +++ b/src/target/trace.h @@ -51,8 +51,8 @@ typedef enum trace_status TRACE_OVERFLOWED = 0x8, } trace_status_t; -extern int trace_point(struct target_s *target, uint32_t number); -extern int trace_register_commands(struct command_context_s *cmd_ctx); +int trace_point(struct target_s *target, uint32_t number); +int trace_register_commands(struct command_context_s *cmd_ctx); #define ERROR_TRACE_IMAGE_UNAVAILABLE -(1500) #define ERROR_TRACE_INSTRUCTION_UNAVAILABLE -(1501) commit 42cafc9369088d2a5d5f633358a2a42aa7bbc0de Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 04:21:36 2009 -0800 target.h: remove extern keyword and wrap Removes 'extern' keyword from function prototypes and wraps long lines. diff --git a/src/target/target.h b/src/target/target.h index 1bbf40f..5a61170 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -249,53 +249,65 @@ typedef struct target_timer_callback_s struct target_timer_callback_s *next; } target_timer_callback_t; -extern int target_register_commands(struct command_context_s *cmd_ctx); -extern int target_register_user_commands(struct command_context_s *cmd_ctx); -extern int target_init(struct command_context_s *cmd_ctx); -extern int target_examine(void); -extern int handle_target(void *priv); -extern int target_process_reset(struct command_context_s *cmd_ctx, enum target_reset_mode reset_mode); - -extern int target_register_event_callback(int (*callback)(struct target_s *target, enum target_event event, void *priv), void *priv); -extern int target_unregister_event_callback(int (*callback)(struct target_s *target, enum target_event event, void *priv), void *priv); -extern int target_poll(target_t *target); -extern int target_resume(target_t *target, int current, uint32_t address, int handle_breakpoints, int debug_execution); -extern int target_halt(target_t *target); -extern int target_call_event_callbacks(target_t *target, enum target_event event); - -/* The period is very approximate, the callback can happen much more often +int target_register_commands(struct command_context_s *cmd_ctx); +int target_register_user_commands(struct command_context_s *cmd_ctx); +int target_init(struct command_context_s *cmd_ctx); +int target_examine(void); +int handle_target(void *priv); +int target_process_reset(struct command_context_s *cmd_ctx, + enum target_reset_mode reset_mode); + +int target_register_event_callback( + int (*callback)(struct target_s *target, + enum target_event event, void *priv), + void *priv); +int target_unregister_event_callback( + int (*callback)(struct target_s *target, + enum target_event event, void *priv), + void *priv); +int target_poll(target_t *target); +int target_resume(target_t *target, int current, uint32_t address, + int handle_breakpoints, int debug_execution); +int target_halt(target_t *target); +int target_call_event_callbacks(target_t *target, enum target_event event); + +/** + * The period is very approximate, the callback can happen much more often * or much more rarely than specified */ -extern int target_register_timer_callback(int (*callback)(void *priv), int time_ms, int periodic, void *priv); -extern int target_unregister_timer_callback(int (*callback)(void *priv), void *priv); -extern int target_call_timer_callbacks(void); -/* invoke this to ensure that e.g. polling timer callbacks happen before +int target_register_timer_callback(int (*callback)(void *priv), + int time_ms, int periodic, void *priv); +int target_unregister_timer_callback(int (*callback)(void *priv), void *priv); + +int target_call_timer_callbacks(void); +/** + * Invoke this to ensure that e.g. polling timer callbacks happen before * a syncrhonous command completes. */ -extern int target_call_timer_callbacks_now(void); +int target_call_timer_callbacks_now(void); -extern target_t* get_current_target(struct command_context_s *cmd_ctx); -extern target_t *get_target(const char *id); +target_t* get_current_target(struct command_context_s *cmd_ctx); +target_t *get_target(const char *id); /** * Get the target name. * * This routine is a wrapper for the target->type->name field. */ -extern const char *target_get_name(struct target_s *target); +const char *target_get_name(struct target_s *target); /** * Examine the specified @a target. * * This routine is a wrapper for target->type->examine. */ -extern int target_examine_one(struct target_s *target); +int target_examine_one(struct target_s *target); /// @returns @c true if the target has been examined. -extern bool target_was_examined(struct target_s *target); +bool target_was_examined(struct target_s *target); /// Sets the @c examined flag for the given target. -extern void target_set_examined(struct target_s *target); +void target_set_examined(struct target_s *target); /// Reset the @c examined flag for the given target. -extern void target_reset_examined(struct target_s *target); +void target_reset_examined(struct target_s *target); /** @@ -303,28 +315,28 @@ extern void target_reset_examined(struct target_s *target); * * This routine is a wrapper for target->type->add_breakpoint. */ -extern int target_add_breakpoint(struct target_s *target, +int target_add_breakpoint(struct target_s *target, struct breakpoint_s *breakpoint); /** * Remove the @a breakpoint for @a target. * * This routine is a wrapper for target->type->remove_breakpoint. */ -extern int target_remove_breakpoint(struct target_s *target, +int target_remove_breakpoint(struct target_s *target, struct breakpoint_s *breakpoint); /** * Add the @a watchpoint for @a target. * * This routine is a wrapper for target->type->add_watchpoint. */ -extern int target_add_watchpoint(struct target_s *target, +int target_add_watchpoint(struct target_s *target, struct watchpoint_s *watchpoint); /** * Remove the @a watchpoint for @a target. * * This routine is a wrapper for target->type->remove_watchpoint. */ -extern int target_remove_watchpoint(struct target_s *target, +int target_remove_watchpoint(struct target_s *target, struct watchpoint_s *watchpoint); /** @@ -332,7 +344,7 @@ extern int target_remove_watchpoint(struct target_s *target, * * This routine is a wrapper for target->type->get_gdb_reg_list. */ -extern int target_get_gdb_reg_list(struct target_s *target, +int target_get_gdb_reg_list(struct target_s *target, struct reg_s **reg_list[], int *reg_list_size); /** @@ -347,7 +359,7 @@ int target_step(struct target_s *target, * * This routine is a wrapper for target->type->run_algorithm. */ -extern int target_run_algorithm(struct target_s *target, +int target_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, uint32_t entry_point, uint32_t exit_point, @@ -359,7 +371,7 @@ extern int target_run_algorithm(struct target_s *target, * * This routine is a wrapper for target->type->read_memory. */ -extern int target_read_memory(struct target_s *target, +int target_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); /** * Write @a count items of @a size bytes to the memory of @a target at @@ -367,7 +379,7 @@ extern int target_read_memory(struct target_s *target, * * This routine is wrapper for target->type->write_memory. */ -extern int target_write_memory(struct target_s *target, +int target_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); /** @@ -377,7 +389,7 @@ extern int target_write_memory(struct target_s *target, * * This routine is wrapper for target->type->bulk_write_memory. */ -extern int target_bulk_write_memory(struct target_s *target, +int target_bulk_write_memory(struct target_s *target, uint32_t address, uint32_t count, uint8_t *buffer); /* @@ -404,11 +416,15 @@ extern int target_bulk_write_memory(struct target_s *target, * write operation, thus making this fn suitable to e.g. write to special * peripheral registers which do not support byte operations. */ -extern int target_write_buffer(struct target_s *target, uint32_t address, uint32_t size, uint8_t *buffer); -extern int target_read_buffer(struct target_s *target, uint32_t address, uint32_t size, uint8_t *buffer); -extern int target_checksum_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t* crc); -extern int target_blank_check_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t* blank); -extern int target_wait_state(target_t *target, enum target_state state, int ms); +int target_write_buffer(struct target_s *target, + uint32_t address, uint32_t size, uint8_t *buffer); +int target_read_buffer(struct target_s *target, + uint32_t address, uint32_t size, uint8_t *buffer); +int target_checksum_memory(struct target_s *target, + uint32_t address, uint32_t size, uint32_t* crc); +int target_blank_check_memory(struct target_s *target, + uint32_t address, uint32_t size, uint32_t* blank); +int target_wait_state(target_t *target, enum target_state state, int ms); /** Return the *name* of this targets current state */ const char *target_state_name( target_t *target ); @@ -424,23 +440,25 @@ const char *target_state_name( target_t *target ); * upon resuming or resetting the CPU. * */ -extern int target_alloc_working_area(struct target_s *target, uint32_t size, working_area_t **area); -extern int target_free_working_area(struct target_s *target, working_area_t *area); -extern int target_free_working_area_restore(struct target_s *target, working_area_t *area, int restore); -extern void target_free_all_working_areas(struct target_s *target); -extern void target_free_all_working_areas_restore(struct target_s *target, int restore); +int target_alloc_working_area(struct target_s *target, + uint32_t size, working_area_t **area); +int target_free_working_area(struct target_s *target, working_area_t *area); +int target_free_working_area_restore(struct target_s *target, + working_area_t *area, int restore); +void target_free_all_working_areas(struct target_s *target); +void target_free_all_working_areas_restore(struct target_s *target, int restore); extern target_t *all_targets; extern target_event_callback_t *target_event_callbacks; extern target_timer_callback_t *target_timer_callbacks; -extern uint32_t target_buffer_get_u32(target_t *target, const uint8_t *buffer); -extern uint16_t target_buffer_get_u16(target_t *target, const uint8_t *buffer); -extern uint8_t target_buffer_get_u8 (target_t *target, const uint8_t *buffer); -extern void target_buffer_set_u32(target_t *target, uint8_t *buffer, uint32_t value); -extern void target_buffer_set_u16(target_t *target, uint8_t *buffer, uint16_t value); -extern void target_buffer_set_u8 (target_t *target, uint8_t *buffer, uint8_t value); +uint32_t target_buffer_get_u32(target_t *target, const uint8_t *buffer); +uint16_t target_buffer_get_u16(target_t *target, const uint8_t *buffer); +uint8_t target_buffer_get_u8 (target_t *target, const uint8_t *buffer); +void target_buffer_set_u32(target_t *target, uint8_t *buffer, uint32_t value); +void target_buffer_set_u16(target_t *target, uint8_t *buffer, uint16_t value); +void target_buffer_set_u8 (target_t *target, uint8_t *buffer, uint8_t value); int target_read_u32(struct target_s *target, uint32_t address, uint32_t *value); int target_read_u16(struct target_s *target, uint32_t address, uint16_t *value); @@ -468,6 +486,7 @@ void target_all_handle_event(enum target_event e); #define ERROR_TARGET_NOT_EXAMINED (-311) extern const Jim_Nvp nvp_error_target[]; -extern const char *target_strerror_safe(int err); + +const char *target_strerror_safe(int err); #endif /* TARGET_H */ commit 994a63c3fee11b8c65891ead6b03b2b716044541 Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 03:38:34 2009 -0800 src/{server,pld,svf,xsvf}: remove 'extern' keyword Removes 'extern' keyword from function declarations in header filess. diff --git a/src/pld/pld.h b/src/pld/pld.h index e4cfc07..c6d3c92 100644 --- a/src/pld/pld.h +++ b/src/pld/pld.h @@ -39,9 +39,11 @@ typedef struct pld_device_s struct pld_device_s *next; } pld_device_t; -extern int pld_register_commands(struct command_context_s *cmd_ctx); -extern int pld_init(struct command_context_s *cmd_ctx); -extern pld_device_t *get_pld_device_by_num(int num); +int pld_register_commands(struct command_context_s *cmd_ctx); + +int pld_init(struct command_context_s *cmd_ctx); + +pld_device_t *get_pld_device_by_num(int num); #define ERROR_PLD_DEVICE_INVALID (-1000) #define ERROR_PLD_FILE_LOAD_FAILED (-1001) diff --git a/src/server/gdb_server.h b/src/server/gdb_server.h index ea981f3..4e334bc 100644 --- a/src/server/gdb_server.h +++ b/src/server/gdb_server.h @@ -54,8 +54,8 @@ typedef struct gdb_service_s struct target_s *target; } gdb_service_t; -extern int gdb_init(void); -extern int gdb_register_commands(command_context_t *command_context); +int gdb_init(void); +int gdb_register_commands(command_context_t *command_context); #define ERROR_GDB_BUFFER_TOO_SMALL (-800) #define ERROR_GDB_TIMEOUT (-801) diff --git a/src/server/server.h b/src/server/server.h index dab28ec..d4f1b6b 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -69,11 +69,17 @@ typedef struct service_s struct service_s *next; } service_t; -extern int add_service(char *name, enum connection_type type, unsigned short port, int max_connections, new_connection_handler_t new_connection_handler, input_handler_t input_handler, connection_closed_handler_t connection_closed_handler, void *priv); -extern int server_init(void); -extern int server_quit(void); -extern int server_loop(command_context_t *command_context); -extern int server_register_commands(command_context_t *context); +int add_service(char *name, enum connection_type type, unsigned short port, + int max_connections, new_connection_handler_t new_connection_handler, + input_handler_t in_handler, connection_closed_handler_t close_handler, + void *priv); + +int server_init(void); +int server_quit(void); + +int server_loop(command_context_t *command_context); + +int server_register_commands(command_context_t *context); int server_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, unsigned short *port); diff --git a/src/server/tcl_server.h b/src/server/tcl_server.h index c90dc8e..d6c9e10 100644 --- a/src/server/tcl_server.h +++ b/src/server/tcl_server.h @@ -22,7 +22,7 @@ #include "server.h" -extern int tcl_init(void); -extern int tcl_register_commands(command_context_t *cmd_ctx); +int tcl_init(void); +int tcl_register_commands(command_context_t *cmd_ctx); #endif /* _TCL_SERVER_H_ */ diff --git a/src/server/telnet_server.h b/src/server/telnet_server.h index 541d720..8f0d24a 100644 --- a/src/server/telnet_server.h +++ b/src/server/telnet_server.h @@ -68,7 +68,7 @@ typedef struct telnet_service_s char *banner; } telnet_service_t; -extern int telnet_init(char *banner); -extern int telnet_register_commands(command_context_t *command_context); +int telnet_init(char *banner); +int telnet_register_commands(command_context_t *command_context); #endif /* TELNET_SERVER_H */ diff --git a/src/svf/svf.h b/src/svf/svf.h index 83123fc..329fea9 100644 --- a/src/svf/svf.h +++ b/src/svf/svf.h @@ -22,7 +22,7 @@ #include "command.h" -extern int svf_register_commands(struct command_context_s *cmd_ctx); +int svf_register_commands(struct command_context_s *cmd_ctx); /** * svf_add_statemove() moves from the current state to @a goal_state. @@ -35,7 +35,7 @@ extern int svf_register_commands(struct command_context_s *cmd_ctx); * SVF specification for single-argument STATE commands (and also used * for various other state transitions). */ -extern int svf_add_statemove(tap_state_t goal_state); +int svf_add_statemove(tap_state_t goal_state); /** * svf_tap_state_is_stable() returns true for stable non-SHIFT states @@ -43,6 +43,6 @@ extern int svf_add_statemove(tap_state_t goal_state); * @param state The TAP state in question * @return true iff the state is stable and not a SHIFT state. */ -extern bool svf_tap_state_is_stable(tap_state_t state); +bool svf_tap_state_is_stable(tap_state_t state); #endif /* SVF_H */ diff --git a/src/xsvf/xsvf.h b/src/xsvf/xsvf.h index 017af88..93cccf0 100644 --- a/src/xsvf/xsvf.h +++ b/src/xsvf/xsvf.h @@ -22,7 +22,7 @@ #include "command.h" -extern int xsvf_register_commands(struct command_context_s *cmd_ctx); +int xsvf_register_commands(struct command_context_s *cmd_ctx); #define ERROR_XSVF_EOF (-200) #define ERROR_XSVF_FAILED (-201) commit 81fbc637185fb0007dbe84c866794800851295b5 Author: Zachary T Welch <zw...@su...> Date: Mon Nov 9 03:10:11 2009 -0800 src/flash: remove 'extern' and wrap headers Removes 'extern' keywords from function prototypes in the flash headers. Wraps long lines to fit into 80 columns. Adds multiple inclusion protection for s3c2xx_nand.h. diff --git a/src/flash/flash.h b/src/flash/flash.h index 05c4b2c..fd3c4c2 100644 --- a/src/flash/flash.h +++ b/src/flash/flash.h @@ -127,7 +127,8 @@ typedef struct flash_driver_s * * @returns ERROR_OK if successful; otherwise, an error code. */ - int (*flash_bank_command)(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); + int (*flash_bank_command)(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc, struct flash_bank_s *bank); /** * Bank/sector erase routine (target-specific). When @@ -166,7 +167,8 @@ typedef struct flash_driver_s * @param count The number of bytes to write. * @returns ERROR_OK if successful; otherwise, an error code. */ - int (*write)(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count); + int (*write)(struct flash_bank_s *bank, + uint8_t *buffer, uint32_t offset, uint32_t count); /** * Probe to determine what kind of flash is present. @@ -265,15 +267,16 @@ typedef struct flash_bank_s } flash_bank_t; /// Registers the 'flash' subsystem commands -extern int flash_register_commands(struct command_context_s *cmd_ctx); +int flash_register_commands(struct command_context_s *cmd_ctx); /// Initializes the 'flash' subsystem drivers -extern int flash_init_drivers(struct command_context_s *cmd_ctx); +int flash_init_drivers(struct command_context_s *cmd_ctx); /** * Erases @a length bytes in the @a target flash, starting at @a addr. * @returns ERROR_OK if successful; otherwise, an error code. */ -extern int flash_erase_address_range(struct target_s *target, uint32_t addr, uint32_t length); +int flash_erase_address_range(struct target_s *target, + uint32_t addr, uint32_t length); /** * Writes @a image into the @a target flash. The @a written parameter * will contain the @@ -284,35 +287,36 @@ extern int flash_erase_address_range(struct target_s *target, uint32_t addr, uin * erase the corresponding banks or sectors before programming. * @returns ERROR_OK if successful; otherwise, an error code. */ -extern int flash_write(struct target_s *target, struct image_s *image, uint32_t *written, int erase); +int flash_write(struct target_s *target, + struct image_s *image, uint32_t *written, int erase); /** * Forces targets to re-examine their erase/protection state. * This routine must be called when the system may modify the status. */ -extern void flash_set_dirty(void); +void flash_set_dirty(void); /// @returns The number of flash banks currently defined. -extern int flash_get_bank_count(void); +int flash_get_bank_count(void); /** * Provides default erased-bank check handling. Checks to see if * the flash driver knows they are erased; if things look uncertain, * this routine will call default_flash_mem_blank_check() to confirm. * @returns ERROR_OK if successful; otherwise, an error code. */ -extern int default_flash_blank_check(struct flash_bank_s *bank); +int default_flash_blank_check(struct flash_bank_s *bank); /** * Provides a default blank flash memory check. Ensures the contents * of the given bank have truly been erased. * @param bank The flash bank. * @returns ERROR_OK if successful; otherwise, an error code. */ -extern int default_flash_mem_blank_check(struct flash_bank_s *bank); +int default_flash_mem_blank_check(struct flash_bank_s *bank); /** * Returns a flash bank by the specified flash_bank_s bank_number, @a num. * @param num The flash bank number. * @returns A flash_bank_t for flash bank @a num, or NULL */ -extern flash_bank_t *get_flash_bank_by_num(int num); +flash_bank_t *get_flash_bank_by_num(int num); /** * Retreives @a bank from a command argument, reporting errors parsing * the bank identifier or retreiving the specified bank. @@ -321,21 +325,21 @@ extern flash_bank_t *get_flash_bank_by_num(int num); * @param bank On output, contians a pointer to the bank or NULL. * @returns ERROR_OK on success, or an error indicating the problem. */ -int flash_command_get... [truncated message content] |
From: David B. <dbr...@us...> - 2009-11-09 18:41:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 4882647f3ee7fc0680c49fbd27a484359fd7e86a (commit) from 526347f95928b7968345dafc72c4664217e3772c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4882647f3ee7fc0680c49fbd27a484359fd7e86a Author: David Brownell <dbr...@us...> Date: Mon Nov 9 09:40:55 2009 -0800 User's Guide: bugfix global state info The "$ocd_HOSTOS" variable was wrongly documented. Fix its documentation, and its value on Linux. Shrink a few of the too-long lines. Signed-off-by: David Brownell <dbr...@us...> diff --git a/doc/openocd.texi b/doc/openocd.texi index e84f4c8..d869f38 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -6476,10 +6476,8 @@ called "flash_banks". @section OpenOCD specific Global Variables -@subsection HostOS - Real Tcl has ::tcl_platform(), and platform::identify, and many other -variables. JimTCL, as implemented in OpenOCD creates $HostOS which +variables. JimTCL, as implemented in OpenOCD creates $ocd_HOSTOS which holds one of the following values: @itemize @bullet diff --git a/src/helper/command.c b/src/helper/command.c index ca83ec6..bd317e6 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -717,7 +717,7 @@ command_context_t* command_init() * "winxx" is generic. */ HostOs = "winxx"; -#elif defined(__LINUX__) +#elif defined(__linux__) HostOs = "linux"; #elif defined(__DARWIN__) HostOs = "darwin"; @@ -726,9 +726,11 @@ command_context_t* command_init() #elif defined(__MINGW32__) HostOs = "mingw32"; #else +#warn unrecognized host OS... HostOs = "other"; #endif - Jim_SetGlobalVariableStr(interp, "ocd_HOSTOS", Jim_NewStringObj(interp, HostOs , strlen(HostOs))); + Jim_SetGlobalVariableStr(interp, "ocd_HOSTOS", + Jim_NewStringObj(interp, HostOs , strlen(HostOs))); Jim_CreateCommand(interp, "ocd_find", jim_find, NULL, NULL); Jim_CreateCommand(interp, "echo", jim_echo, NULL, NULL); @@ -749,16 +751,19 @@ command_context_t* command_init() #endif if (Jim_Eval_Named(interp, startup_tcl, "embedded:startup.tcl",1) == JIM_ERR) { - LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD compile time)"); + LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD)"); Jim_PrintErrorMessage(interp); exit(-1); } - register_command(context, NULL, "sleep", handle_sleep_command, - COMMAND_ANY, "<n> [busy] - sleep for n milliseconds. \"busy\" means busy wait"); - - register_command(context, NULL, "fast", handle_fast_command, - COMMAND_ANY, "fast <enable/disable> - place at beginning of config files. Sets defaults to fast and dangerous."); + register_command(context, NULL, "sleep", + handle_sleep_command, COMMAND_ANY, + "<n> [busy] - sleep for n milliseconds. " + "\"busy\" means busy wait"); + register_command(context, NULL, "fast", + handle_fast_command, COMMAND_ANY, + "fast <enable/disable> - place at beginning of " + "config files. Sets defaults to fast and dangerous."); return context; } ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 4 +--- src/helper/command.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-09 18:35:10
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 526347f95928b7968345dafc72c4664217e3772c (commit) from 2689f58f2a0afa296a29ab301a4c1665b914caab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 526347f95928b7968345dafc72c4664217e3772c Author: David Brownell <dbr...@us...> Date: Mon Nov 9 09:34:51 2009 -0800 EmbeddedICE: minor cleanups Add comments (Doxygen and normal), remove unused code, shrink some overlong lines. Get rid of a forward decl. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c index faeef38..4801cf7 100644 --- a/src/target/embeddedice.c +++ b/src/target/embeddedice.c @@ -31,15 +31,21 @@ #define ARRAY_SIZE(x) ((int)(sizeof(x)/sizeof((x)[0]))) -#if 0 -static bitfield_desc_t embeddedice_comms_ctrl_bitfield_desc[] = -{ - {"R", 1}, - {"W", 1}, - {"reserved", 26}, - {"version", 4} -}; -#endif +/** + * @file + * + * This provides lowlevel glue to the EmbeddedICE (or EmbeddedICE-RT) + * module found on scan chain 2 in ARM7, ARM9, and some other families + * of ARM cores. + * + * EmbeddedICE provides basic watchpoint/breakpoint hardware and a Debug + * Communications Channel (DCC) used to read or write 32-bit words to + * OpenOCD-aware code running on the target CPU. + * Newer modules also include vector catch hardware. Some versions + * support hardware single-stepping, "monitor mode" debug (which is not + * currently supported by OpenOCD), or extended reporting on why the + * core entered debug mode. + */ /* * From: ARM9E-S TRM, DDI 0165, table C-4 (and similar, for other cores) @@ -140,9 +146,25 @@ static const struct { static int embeddedice_reg_arch_type = -1; -static int embeddedice_get_reg(reg_t *reg); +static int embeddedice_get_reg(reg_t *reg) +{ + int retval; + + if ((retval = embeddedice_read_reg(reg)) != ERROR_OK) + LOG_ERROR("error queueing EmbeddedICE register read"); + else if ((retval = jtag_execute_queue()) != ERROR_OK) + LOG_ERROR("EmbeddedICE register read failed"); + + return retval; +} -reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7_9) +/** + * Probe EmbeddedICE module and set up local records of its registers. + * Different versions of the modules have different capabilities, such as + * hardware support for vector_catch, single stepping, and monitor mode. + */ +reg_cache_t * +embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7_9) { int retval; reg_cache_t *reg_cache = malloc(sizeof(reg_cache_t)); @@ -153,7 +175,7 @@ reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7 int i; int eice_version = 0; - /* register a register arch-type for EmbeddedICE registers only once */ + /* register arch-type for EmbeddedICE registers only once */ if (embeddedice_reg_arch_type == -1) embeddedice_reg_arch_type = register_reg_arch_type( embeddedice_get_reg, embeddedice_set_reg_w_exec); @@ -267,12 +289,17 @@ reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7 if (strcmp(target_get_name(target), "feroceon") == 0 || strcmp(target_get_name(target), "dragonite") == 0) break; - LOG_ERROR("unknown EmbeddedICE version (comms ctrl: 0x%8.8" PRIx32 ")", buf_get_u32(reg_list[EICE_COMMS_CTRL].value, 0, 32)); + LOG_ERROR("unknown EmbeddedICE version " + "(comms ctrl: 0x%8.8" PRIx32 ")", + buf_get_u32(reg_list[EICE_COMMS_CTRL].value, 0, 32)); } return reg_cache; } +/** + * Initialize EmbeddedICE module, if needed. + */ int embeddedice_setup(target_t *target) { int retval; @@ -296,25 +323,13 @@ int embeddedice_setup(target_t *target) return jtag_execute_queue(); } -static int embeddedice_get_reg(reg_t *reg) -{ - int retval; - if ((retval = embeddedice_read_reg(reg)) != ERROR_OK) - { - LOG_ERROR("BUG: error scheduling EmbeddedICE register read"); - return retval; - } - - if ((retval = jtag_execute_queue()) != ERROR_OK) - { - LOG_ERROR("register read failed"); - return retval; - } - - return ERROR_OK; -} - -int embeddedice_read_reg_w_check(reg_t *reg, uint8_t* check_value, uint8_t* check_mask) +/** + * Queue a read for an EmbeddedICE register into the register cache, + * optionally checking the value read. + * Note that at this level, all registers are 32 bits wide. + */ +int embeddedice_read_reg_w_check(reg_t *reg, + uint8_t *check_value, uint8_t *check_mask) { embeddedice_reg_t *ice_reg = reg->arch_info; uint8_t reg_addr = ice_reg->addr & 0x1f; @@ -327,6 +342,7 @@ int embeddedice_read_reg_w_check(reg_t *reg, uint8_t* check_value, uint8_t* chec arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL); + /* bits 31:0 -- data (ignored here) */ fields[0].tap = ice_reg->jtag_info->tap; fields[0].num_bits = 32; fields[0].out_value = reg->value; @@ -334,6 +350,7 @@ int embeddedice_read_reg_w_check(reg_t *reg, uint8_t* check_value, uint8_t* chec fields[0].check_value = NULL; fields[0].check_mask = NULL; + /* bits 36:32 -- register */ fields[1].tap = ice_reg->jtag_info->tap; fields[1].num_bits = 5; fields[1].out_value = field1_out; @@ -342,6 +359,7 @@ int embeddedice_read_reg_w_check(reg_t *reg, uint8_t* check_value, uint8_t* chec fields[1].check_value = NULL; fields[1].check_mask = NULL; + /* bit 37 -- 0/read */ fields[2].tap = ice_reg->jtag_info->tap; fields[2].num_bits = 1; fields[2].out_value = field2_out; @@ -350,8 +368,10 @@ int embeddedice_read_reg_w_check(reg_t *reg, uint8_t* check_value, uint8_t* chec fields[2].check_value = NULL; fields[2].check_mask = NULL; + /* traverse Update-DR, setting address for the next read */ jtag_add_dr_scan(3, fields, jtag_get_end_state()); + /* bits 31:0 -- the data we're reading (and maybe checking) */ fields[0].in_value = reg->value; fields[0].check_value = check_value; fields[0].check_mask = check_mask; @@ -362,14 +382,19 @@ int embeddedice_read_reg_w_check(reg_t *reg, uint8_t* check_value, uint8_t* chec */ buf_set_u32(fields[1].out_value, 0, 5, eice_regs[EICE_COMMS_CTRL].addr); + /* traverse Update-DR, reading but with no other side effects */ jtag_add_dr_scan_check(3, fields, jtag_get_end_state()); return ERROR_OK; } -/* receive <size> words of 32 bit from the DCC - * we pretend the target is always going to be fast enough - * (relative to the JTAG clock), so we don't need to handshake +/** + * Receive a block of size 32-bit words from the DCC. + * We assume the target is always going to be fast enough (relative to + * the JTAG clock) that the debugger won't need to poll the handshake + * bit. The JTAG clock is usually at least six times slower than the + * functional clock, so the 50+ JTAG clocks needed to receive the word + * allow hundreds of instruction cycles (per word) in the target. */ int embeddedice_receive(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size) { @@ -420,11 +445,19 @@ int embeddedice_receive(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size) return jtag_execute_queue(); } +/** + * Queue a read for an EmbeddedICE register into the register cache, + * not checking the value read. + */ int embeddedice_read_reg(reg_t *reg) { return embeddedice_read_reg_w_check(reg, NULL, NULL); } +/** + * Queue a write for an EmbeddedICE register, updating the register cache. + * Uses embeddedice_write_reg(). + */ void embeddedice_set_reg(reg_t *reg, uint32_t value) { embeddedice_write_reg(reg, value); @@ -435,19 +468,23 @@ void embeddedice_set_reg(reg_t *reg, uint32_t value) } +/** + * Write an EmbeddedICE register, updating the register cache. + * Uses embeddedice_set_reg(); not queued. + */ int embeddedice_set_reg_w_exec(reg_t *reg, uint8_t *buf) { int retval; - embeddedice_set_reg(reg, buf_get_u32(buf, 0, reg->size)); + embeddedice_set_reg(reg, buf_get_u32(buf, 0, reg->size)); if ((retval = jtag_execute_queue()) != ERROR_OK) - { LOG_ERROR("register write failed"); - return retval; - } - return ERROR_OK; + return retval; } +/** + * Queue a write for an EmbeddedICE register, bypassing the register cache. + */ void embeddedice_write_reg(reg_t *reg, uint32_t value) { embeddedice_reg_t *ice_reg = reg->arch_info; @@ -461,17 +498,24 @@ void embeddedice_write_reg(reg_t *reg, uint32_t value) uint8_t reg_addr = ice_reg->addr & 0x1f; embeddedice_write_reg_inner(ice_reg->jtag_info->tap, reg_addr, value); - } +/** + * Queue a write for an EmbeddedICE register, using cached value. + * Uses embeddedice_write_reg(). + */ void embeddedice_store_reg(reg_t *reg) { embeddedice_write_reg(reg, buf_get_u32(reg->value, 0, reg->size)); } -/* send <size> words of 32 bit to the DCC - * we pretend the target is always going to be fast enough - * (relative to the JTAG clock), so we don't need to handshake +/** + * Send a block of size 32-bit words to the DCC. + * We assume the target is always going to be fast enough (relative to + * the JTAG clock) that the debugger won't need to poll the handshake + * bit. The JTAG clock is usually at least six times slower than the + * functional clock, so the 50+ JTAG clocks needed to receive the word + * allow hundreds of instruction cycles (per word) in the target. */ int embeddedice_send(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size) { @@ -515,7 +559,8 @@ int embeddedice_send(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size) return ERROR_OK; } -/* wait for DCC control register R/W handshake bit to become active +/** + * Poll DCC control register until read or write handshake completes. */ int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, uint32_t timeout) { @@ -558,8 +603,7 @@ int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, uint32_t timeout) jtag_add_dr_scan(3, fields, jtag_get_end_state()); gettimeofday(&lap, NULL); - do - { + do { jtag_add_dr_scan(3, fields, jtag_get_end_state()); if ((retval = jtag_execute_queue()) != ERROR_OK) return retval; @@ -568,20 +612,25 @@ int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, uint32_t timeout) return ERROR_OK; gettimeofday(&now, NULL); - } - while ((uint32_t)((now.tv_sec-lap.tv_sec)*1000 + (now.tv_usec-lap.tv_usec)/1000) <= timeout); + } while ((uint32_t)((now.tv_sec - lap.tv_sec) * 1000 + + (now.tv_usec - lap.tv_usec) / 1000) <= timeout); return ERROR_TARGET_TIMEOUT; } #ifndef HAVE_JTAG_MINIDRIVER_H -/* this is the inner loop of the open loop DCC write of data to target */ -void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, uint8_t *buffer, int little, int count) +/** + * This is an inner loop of the open loop DCC write of data to target + */ +void embeddedice_write_dcc(jtag_tap_t *tap, + int reg_addr, uint8_t *buffer, int little, int count) { int i; + for (i = 0; i < count; i++) { - embeddedice_write_reg_inner(tap, reg_addr, fast_target_buffer_get_u32(buffer, little)); + embeddedice_write_reg_inner(tap, reg_addr, + fast_target_buffer_get_u32(buffer, little)); buffer += 4; } } ----------------------------------------------------------------------- Summary of changes: src/target/embeddedice.c | 153 ++++++++++++++++++++++++++++++---------------- 1 files changed, 101 insertions(+), 52 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-09 10:52:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 2689f58f2a0afa296a29ab301a4c1665b914caab (commit) from da3196bf5e52a6d01f27cf228f87e395523cf901 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2689f58f2a0afa296a29ab301a4c1665b914caab Author: Zachary T Welch <zw...@su...> Date: Sat Nov 7 23:20:33 2009 -0800 Overhaul time support API This patch changes the duration_* API in several ways. First, it updates the API to use better names. Second, string formatting has been removed from the API (with its associated malloc). Finally, a new function added to convert the time into seconds, which can be used (or formatted) by the caller. This eliminates hidden calls to malloc that require associated calls to free(). This patch also removes the useless extern keyword from prototypes, and it eliminates the duration_t typedef (use 'struct duration'). These API also allows proper error checking, as it is possible for gettimeofday to fail in certain circumstances. The consumers have all been chased to use this new API as well, as there were relatively few cases doing this type of measurement. In most cases, the code performs additional checks for errors, but the calling code looks much cleaner in every case. diff --git a/src/flash/flash.c b/src/flash/flash.c index 329ade6..22c6069 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -503,8 +503,6 @@ static int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, int retval; int address; int length; - duration_t duration; - char *duration_text; target_t *target = get_current_target(cmd_ctx); @@ -528,16 +526,16 @@ static int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, /* We can't know if we did a resume + halt, in which case we no longer know the erased state */ flash_set_dirty(); - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); - if ((retval = flash_erase_address_range(target, address, length)) == ERROR_OK) + retval = flash_erase_address_range(target, address, length); + + if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) { - if ((retval = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) - { - return retval; - } - command_print(cmd_ctx, "erased address 0x%8.8x length %i in %s", address, length, duration_text); - free(duration_text); + command_print(cmd_ctx, "erased address 0x%8.8x (length %i)" + " in %fs (%0.3f kb/s)", address, length, + duration_elapsed(&bench), duration_kbps(&bench, length)); } return retval; @@ -613,19 +611,16 @@ static int handle_flash_erase_command(struct command_context_s *cmd_ctx, first, last, p->num_sectors)) != ERROR_OK) return retval; - duration_t duration; - char *duration_text; - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); - if ((retval = flash_driver_erase(p, first, last)) == ERROR_OK) { - if ((retval = duration_stop_measure(&duration, - &duration_text)) != ERROR_OK) - return retval; - command_print(cmd_ctx, "erased sectors %i through %i " - "on flash bank %i in %s", - (int) first, (int) last, (int) bank_nr, - duration_text); - free(duration_text); + retval = flash_driver_erase(p, first, last); + + if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) + { + command_print(cmd_ctx, "erased sectors %" PRIu32 " " + "through %" PRIu32" on flash bank %" PRIu32 " " + "in %fs", first, last, bank_nr, duration_elapsed(&bench)); } return ERROR_OK; @@ -683,10 +678,7 @@ static int handle_flash_write_image_command(struct command_context_s *cmd_ctx, c image_t image; uint32_t written; - duration_t duration; - char *duration_text; - - int retval, retvaltemp; + int retval; if (argc < 1) { @@ -728,7 +720,8 @@ static int handle_flash_write_image_command(struct command_context_s *cmd_ctx, c return ERROR_FAIL; } - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); if (argc >= 2) { @@ -756,23 +749,13 @@ static int handle_flash_write_image_command(struct command_context_s *cmd_ctx, c return retval; } - if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) + if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) { - image_close(&image); - return retvaltemp; + command_print(cmd_ctx, "wrote %" PRIu32 " byte from file %s " + "in %fs (%0.3f kb/s)", written, args[0], + duration_elapsed(&bench), duration_kbps(&bench, written)); } - float speed; - - speed = written / 1024.0; - speed /= ((float)duration.duration.tv_sec - + ((float)duration.duration.tv_usec / 1000000.0)); - command_print(cmd_ctx, - "wrote %" PRIu32 " byte from file %s in %s (%f kb/s)", - written, args[0], duration_text, speed); - - free(duration_text); - image_close(&image); return retval; @@ -780,7 +763,7 @@ static int handle_flash_write_image_command(struct command_context_s *cmd_ctx, c static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - int err = ERROR_OK, retval; + int err = ERROR_OK; uint32_t address; uint32_t pattern; uint32_t count; @@ -789,8 +772,6 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm uint32_t wrote = 0; uint32_t cur_size = 0; uint32_t chunk_count; - char *duration_text; - duration_t duration; target_t *target = get_current_target(cmd_ctx); uint32_t i; uint32_t wordsize; @@ -843,7 +824,8 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm exit(-1); } - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); for (wrote = 0; wrote < (count*wordsize); wrote += cur_size) { @@ -872,24 +854,14 @@ static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cm return ERROR_FAIL; } } - } - if ((retval = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) + if (duration_measure(&bench) == ERROR_OK) { - return retval; + command_print(cmd_ctx, "wrote %" PRIu32 " bytes to 0x%8.8" PRIx32 + " in %fs (%0.3f kb/s)", wrote, address, + duration_elapsed(&bench), duration_kbps(&bench, wrote)); } - - float speed; - - speed = wrote / 1024.0; - speed /= ((float)duration.duration.tv_sec - + ((float)duration.duration.tv_usec / 1000000.0)); - command_print(cmd_ctx, - "wrote %" PRIu32 " bytes to 0x%8.8" PRIx32 " in %s (%f kb/s)", - wrote, address, duration_text, speed); - - free(duration_text); return ERROR_OK; } @@ -898,17 +870,13 @@ static int handle_flash_write_bank_command(struct command_context_s *cmd_ctx, ch uint32_t offset; uint8_t *buffer; uint32_t buf_cnt; - fileio_t fileio; - duration_t duration; - char *duration_text; - - if (argc != 3) return ERROR_COMMAND_SYNTAX_ERROR; - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); flash_bank_t *p; int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &p); @@ -935,24 +903,13 @@ static int handle_flash_write_bank_command(struct command_context_s *cmd_ctx, ch free(buffer); buffer = NULL; - int retvaltemp; - if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) - { - fileio_close(&fileio); - return retvaltemp; - } - if (retval == ERROR_OK) + if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) { - float elapsed = (float)duration.duration.tv_sec; - elapsed += (float)duration.duration.tv_usec / 1000000.0; - float speed = (float)fileio.size / elapsed; - command_print(cmd_ctx, - "wrote %lld byte from file %s to flash bank %u " - "at offset 0x%8.8" PRIx32 " in %s (%f kb/s)", + command_print(cmd_ctx, "wrote %lld byte from file %s to flash bank %u" + " at offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)", fileio.size, args[1], p->bank_number, offset, - duration_text, speed / 1024); + duration_elapsed(&bench), duration_kbps(&bench, fileio.size)); } - free(duration_text); fileio_close(&fileio); diff --git a/src/flash/mflash.c b/src/flash/mflash.c index bf759c9..5a392a4 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -215,11 +215,11 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) uint8_t status, error; target_t *target = mflash_bank->target; uint32_t mg_task_reg = mflash_bank->base + MG_REG_OFFSET; - duration_t duration; int ret; long long t = 0; - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); while (time) { @@ -275,10 +275,11 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) } } - duration_stop_measure(&duration, NULL); - - t = duration.duration.tv_usec/1000; - t += duration.duration.tv_sec*1000; + ret = duration_measure(&bench); + if (ERROR_OK == ret) + t = duration_elapsed(&bench) * 1000.0; + else + LOG_ERROR("mflash: duration measurement failed: %d", ret); if (t > time) break; @@ -427,14 +428,14 @@ static int mg_mflash_do_read_sects(void *buff, uint32_t sect_num, uint32_t sect_ int ret; target_t *target = mflash_bank->target; uint8_t *buff_ptr = buff; - duration_t duration; if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, mg_io_cmd_read)) != ERROR_OK) return ret; address = mflash_bank->base + MG_BUFFER_OFFSET; - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); for (i = 0; i < sect_cnt; i++) { ret = mg_dsk_wait(mg_io_wait_drq, MG_OEM_DISK_WAIT_TIME_NORMAL); @@ -453,11 +454,10 @@ static int mg_mflash_do_read_sects(void *buff, uint32_t sect_num, uint32_t sect_ LOG_DEBUG("mflash: %" PRIu32 " (0x%8.8" PRIx32 ") sector read", sect_num + i, (sect_num + i) * MG_MFLASH_SECTOR_SIZE); - duration_stop_measure(&duration, NULL); - - if ((duration.duration.tv_sec * 1000 + duration.duration.tv_usec / 1000) > 3000) { + ret = duration_measure(&bench); + if ((ERROR_OK == ret) && (duration_elapsed(&bench) > 3)) { LOG_INFO("mflash: read %" PRIu32 "'th sectors", sect_num + i); - duration_start_measure(&duration); + duration_start(&bench); } } @@ -500,14 +500,14 @@ static int mg_mflash_do_write_sects(void *buff, uint32_t sect_num, uint32_t sect int ret; target_t *target = mflash_bank->target; uint8_t *buff_ptr = buff; - duration_t duration; if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, cmd)) != ERROR_OK) return ret; address = mflash_bank->base + MG_BUFFER_OFFSET; - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); for (i = 0; i < sect_cnt; i++) { ret = mg_dsk_wait(mg_io_wait_drq, MG_OEM_DISK_WAIT_TIME_NORMAL); @@ -526,11 +526,10 @@ static int mg_mflash_do_write_sects(void *buff, uint32_t sect_num, uint32_t sect LOG_DEBUG("mflash: %" PRIu32 " (0x%8.8" PRIx32 ") sector write", sect_num + i, (sect_num + i) * MG_MFLASH_SECTOR_SIZE); - duration_stop_measure(&duration, NULL); - - if ((duration.duration.tv_sec * 1000 + duration.duration.tv_usec / 1000) > 3000) { + ret = duration_measure(&bench); + if ((ERROR_OK == ret) && (duration_elapsed(&bench) > 3)) { LOG_INFO("mflash: wrote %" PRIu32 "'th sectors", sect_num + i); - duration_start_measure(&duration); + duration_start(&bench); } } @@ -708,8 +707,6 @@ static int mg_write_cmd(struct command_context_s *cmd_ctx, char *cmd, char **arg uint32_t address, buf_cnt, cnt, res, i; uint8_t *buffer; fileio_t fileio; - duration_t duration; - char *duration_text; int ret; if (argc != 3) { @@ -731,7 +728,8 @@ static int mg_write_cmd(struct command_context_s *cmd_ctx, char *cmd, char **arg cnt = fileio.size / MG_FILEIO_CHUNK; res = fileio.size % MG_FILEIO_CHUNK; - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); for (i = 0; i < cnt; i++) { if ((ret = fileio_read(&fileio, MG_FILEIO_CHUNK, buffer, &buf_cnt)) != @@ -749,21 +747,19 @@ static int mg_write_cmd(struct command_context_s *cmd_ctx, char *cmd, char **arg goto mg_write_cmd_err; } - duration_stop_measure(&duration, &duration_text); - - command_print(cmd_ctx, "wrote %lli byte from file %s in %s (%f kB/s)", - fileio.size, args[1], duration_text, - (float)fileio.size / 1024.0 / ((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0))); + if (duration_measure(&bench) == ERROR_OK) + { + command_print(cmd_ctx, "wrote %lli byte from file %s " + "in %fs (%0.3f kB/s)", fileio.size, args[1], + duration_elapsed(&bench), duration_kbps(&bench, fileio.size)); + } - free(duration_text); free(buffer); fileio_close(&fileio); return ERROR_OK; mg_write_cmd_err: - duration_stop_measure(&duration, &duration_text); - free(duration_text); free(buffer); fileio_close(&fileio); @@ -775,8 +771,6 @@ static int mg_dump_cmd(struct command_context_s *cmd_ctx, char *cmd, char **args uint32_t address, size_written, size, cnt, res, i; uint8_t *buffer; fileio_t fileio; - duration_t duration; - char *duration_text; int ret; if (argc != 4) { @@ -799,7 +793,8 @@ static int mg_dump_cmd(struct command_context_s *cmd_ctx, char *cmd, char **args cnt = size / MG_FILEIO_CHUNK; res = size % MG_FILEIO_CHUNK; - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); for (i = 0; i < cnt; i++) { if ((ret = mg_mflash_read(address, buffer, MG_FILEIO_CHUNK)) != ERROR_OK) @@ -817,21 +812,20 @@ static int mg_dump_cmd(struct command_context_s *cmd_ctx, char *cmd, char **args goto mg_dump_cmd_err; } - duration_stop_measure(&duration, &duration_text); - - command_print(cmd_ctx, "dump image (address 0x%8.8" PRIx32 " size %" PRIu32 ") to file %s in %s (%f kB/s)", - address, size, args[1], duration_text, - (float)size / 1024.0 / ((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0))); + if (duration_measure(&bench) == ERROR_OK) + { + command_print(cmd_ctx, "dump image (address 0x%8.8" PRIx32 " " + "size %" PRIu32 ") to file %s in %fs (%0.3f kB/s)", + address, size, args[1], + duration_elapsed(&bench), duration_kbps(&bench, size)); + } - free(duration_text); free(buffer); fileio_close(&fileio); return ERROR_OK; mg_dump_cmd_err: - duration_stop_measure(&duration, &duration_text); - free(duration_text); free(buffer); fileio_close(&fileio); diff --git a/src/flash/nand.c b/src/flash/nand.c index 81a04f7..8f67624 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -1330,8 +1330,6 @@ static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cm fileio_t fileio; - duration_t duration; - char *duration_text; if (argc < 3) { @@ -1372,7 +1370,8 @@ static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cm } } - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); if (fileio_open(&fileio, args[1], FILEIO_READ, FILEIO_BINARY) != ERROR_OK) { @@ -1478,11 +1477,13 @@ static int handle_nand_write_command(struct command_context_s *cmd_ctx, char *cm free(page); oob = NULL; page = NULL; - duration_stop_measure(&duration, &duration_text); - command_print(cmd_ctx, "wrote file %s to NAND flash %s up to offset 0x%8.8" PRIx32 " in %s", - args[1], args[0], offset, duration_text); - free(duration_text); - duration_text = NULL; + if (duration_measure(&bench) == ERROR_OK) + { + command_print(cmd_ctx, "wrote file %s to NAND flash %s " + "up to offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)", + args[1], args[0], offset, duration_elapsed(&bench), + duration_kbps(&bench, fileio.size)); + } return ERROR_OK; } @@ -1506,8 +1507,6 @@ static int handle_nand_dump_command(struct command_context_s *cmd_ctx, char *cmd } fileio_t fileio; - duration_t duration; - char *duration_text; uint8_t *page = NULL; uint32_t page_size = 0; @@ -1560,7 +1559,8 @@ static int handle_nand_dump_command(struct command_context_s *cmd_ctx, char *cmd return ERROR_OK; } - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); while (size > 0) { @@ -1596,10 +1596,12 @@ static int handle_nand_dump_command(struct command_context_s *cmd_ctx, char *cmd oob = NULL; fileio_close(&fileio); - duration_stop_measure(&duration, &duration_text); - command_print(cmd_ctx, "dumped %lld byte in %s", fileio.size, duration_text); - free(duration_text); - duration_text = NULL; + if (duration_measure(&bench) == ERROR_OK) + { + command_print(cmd_ctx, "dumped %lld byte in %fs (%0.3f kb/s)", + fileio.size, duration_elapsed(&bench), + duration_kbps(&bench, fileio.size)); + } return ERROR_OK; } diff --git a/src/helper/time_support.c b/src/helper/time_support.c index 865f245..9b86e52 100644 --- a/src/helper/time_support.c +++ b/src/helper/time_support.c @@ -28,7 +28,6 @@ #endif #include "time_support.h" -#include "log.h" /* calculate difference between two struct timeval values */ @@ -83,29 +82,30 @@ int timeval_add_time(struct timeval *result, int sec, int usec) return 0; } -void duration_start_measure(duration_t *duration) +int duration_start(struct duration *duration) { - gettimeofday(&duration->start, NULL); + return gettimeofday(&duration->start, NULL); } -int duration_stop_measure(duration_t *duration, char **text) +int duration_measure(struct duration *duration) { struct timeval end; + int retval = gettimeofday(&end, NULL); + if (0 == retval) + timeval_subtract(&duration->elapsed, &end, &duration->start); + return retval; +} - gettimeofday(&end, NULL); - - timeval_subtract(&duration->duration, &end, &duration->start); - - if (text) - { - float t; - t = duration->duration.tv_sec; - t += (float)duration->duration.tv_usec/1000000.0; - *text = malloc(100); - snprintf(*text, 100, "%fs", t); - } +float duration_elapsed(struct duration *duration) +{ + float t = duration->elapsed.tv_sec; + t += (float)duration->elapsed.tv_usec / 1000000.0; + return t; +} - return ERROR_OK; +float duration_kbps(struct duration *duration, size_t count) +{ + return count / (1024.0 * duration_elapsed(duration)); } long long timeval_ms() diff --git a/src/helper/time_support.h b/src/helper/time_support.h index a803676..9e8e61f 100644 --- a/src/helper/time_support.h +++ b/src/helper/time_support.h @@ -37,19 +37,27 @@ # endif #endif -extern int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); -extern int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y); -extern int timeval_add_time(struct timeval *result, int sec, int usec); -/* gettimeofday() timeval in 64 bit ms */ -extern long long timeval_ms(void); +int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); +int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y); +int timeval_add_time(struct timeval *result, int sec, int usec); -typedef struct duration_s +/// @returns gettimeofday() timeval as 64-bit in ms +long long timeval_ms(void); + +struct duration { struct timeval start; - struct timeval duration; -} duration_t; + struct timeval elapsed; +}; + +/// Update the duration->start field to start the @a duration measurement. +int duration_start(struct duration *duration); +/// Update the duration->elapsed field to finish the @a duration measurment. +int duration_measure(struct duration *duration); -extern void duration_start_measure(duration_t *duration); -extern int duration_stop_measure(duration_t *duration, char **text); +/// @returns Elapsed time in seconds. +float duration_elapsed(struct duration *duration); +/// @returns KB/sec for the elapsed @a duration and @a count bytes. +float duration_kbps(struct duration *duration, size_t count); #endif /* TIME_SUPPORT_H */ diff --git a/src/target/target.c b/src/target/target.c index 5eec09c..3e4c00d 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2507,20 +2507,17 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm uint32_t min_address = 0; uint32_t max_address = 0xffffffff; int i; - int retvaltemp; - image_t image; - duration_t duration; - char *duration_text; - int retval = parse_load_image_command_args(cmd_ctx, args, argc, &image, &min_address, &max_address); if (ERROR_OK != retval) return retval; target_t *target = get_current_target(cmd_ctx); - duration_start_measure(&duration); + + struct duration bench; + duration_start(&bench); if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK) { @@ -2580,20 +2577,13 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm free(buffer); } - if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) + if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) { - image_close(&image); - return retvaltemp; + command_print(cmd_ctx, "downloaded %" PRIu32 " bytes " + "in %fs (%0.3f kb/s)", image_size, + duration_elapsed(&bench), duration_kbps(&bench, image_size)); } - if (retval == ERROR_OK) - { - command_print(cmd_ctx, "downloaded %u byte in %s", - (unsigned int)image_size, - duration_text); - } - free(duration_text); - image_close(&image); return retval; @@ -2607,8 +2597,6 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm uint8_t buffer[560]; int retvaltemp; - duration_t duration; - char *duration_text; target_t *target = get_current_target(cmd_ctx); @@ -2628,7 +2616,8 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm return ERROR_OK; } - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); int retval = ERROR_OK; while (size > 0) @@ -2654,14 +2643,11 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm if ((retvaltemp = fileio_close(&fileio)) != ERROR_OK) return retvaltemp; - if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) - return retvaltemp; - - if (retval == ERROR_OK) + if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) { - command_print(cmd_ctx, "dumped %lld byte in %s", - fileio.size, duration_text); - free(duration_text); + command_print(cmd_ctx, + "dumped %lld bytes in %fs (%0.3f kb/s)", fileio.size, + duration_elapsed(&bench), duration_kbps(&bench, fileio.size)); } return retval; @@ -2673,15 +2659,12 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct uint32_t buf_cnt; uint32_t image_size; int i; - int retval, retvaltemp; + int retval; uint32_t checksum = 0; uint32_t mem_checksum = 0; image_t image; - duration_t duration; - char *duration_text; - target_t *target = get_current_target(cmd_ctx); if (argc < 1) @@ -2695,7 +2678,8 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct return ERROR_FAIL; } - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); if (argc >= 2) { @@ -2802,20 +2786,12 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct image_size += buf_cnt; } done: - - if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) - { - image_close(&image); - return retvaltemp; - } - - if (retval == ERROR_OK) + if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) { - command_print(cmd_ctx, "verified %u bytes in %s", - (unsigned int)image_size, - duration_text); + command_print(cmd_ctx, "verified %" PRIu32 " bytes " + "in %fs (%0.3f kb/s)", image_size, + duration_elapsed(&bench), duration_kbps(&bench, image_size)); } - free(duration_text); image_close(&image); @@ -4672,15 +4648,13 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha image_t image; - duration_t duration; - char *duration_text; - int retval = parse_load_image_command_args(cmd_ctx, args, argc, &image, &min_address, &max_address); if (ERROR_OK != retval) return retval; - duration_start_measure(&duration); + struct duration bench; + duration_start(&bench); if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK) { @@ -4753,13 +4727,16 @@ static int handle_fast_load_image_command(struct command_context_s *cmd_ctx, cha free(buffer); } - duration_stop_measure(&duration, &duration_text); - if (retval == ERROR_OK) + if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) { - command_print(cmd_ctx, "Loaded %u bytes in %s", (unsigned int)image_size, duration_text); - command_print(cmd_ctx, "NB!!! image has not been loaded to target, issue a subsequent 'fast_load' to do so."); + command_print(cmd_ctx, "Loaded %" PRIu32 " bytes " + "in %fs (%0.3f kb/s)", image_size, + duration_elapsed(&bench), duration_kbps(&bench, image_size)); + + command_print(cmd_ctx, + "WARNING: image has not been loaded to target!" + "You can issue a 'fast_load' to finish loading."); } - free(duration_text); image_close(&image); ----------------------------------------------------------------------- Summary of changes: src/flash/flash.c | 117 ++++++++++++++------------------------------ src/flash/mflash.c | 74 +++++++++++++--------------- src/flash/nand.c | 32 +++++++------ src/helper/time_support.c | 34 +++++++------- src/helper/time_support.h | 28 +++++++---- src/target/target.c | 83 ++++++++++++-------------------- 6 files changed, 153 insertions(+), 215 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-09 00:53:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via da3196bf5e52a6d01f27cf228f87e395523cf901 (commit) via e41147bf7546307a2eff8d4ad6fc93e0d08eefb3 (commit) from b2d01a9e6a2f4967344c177e25923a44a71df187 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit da3196bf5e52a6d01f27cf228f87e395523cf901 Author: Zachary T Welch <zw...@su...> Date: Fri Nov 6 03:50:26 2009 -0800 Add private header for ARM11 internals. Reduces confusion about location of associated routines and reduces clutter in the arm11 header. Removes extra whitespace around the lines touched by these changes. diff --git a/src/target/arm11.c b/src/target/arm11.c index fb57ee5..6cdfa64 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -27,6 +27,7 @@ #endif #include "arm11.h" +#include "arm11_dbgtap.h" #include "armv4_5.h" #include "arm_simulator.h" #include "time_support.h" diff --git a/src/target/arm11.h b/src/target/arm11.h index fe08353..be5e77b 100644 --- a/src/target/arm11.h +++ b/src/target/arm11.h @@ -184,50 +184,4 @@ typedef struct arm11_reg_state_s int arm11_register_commands(struct command_context_s *cmd_ctx); -/* internals */ - -void arm11_setup_field (arm11_common_t * arm11, int num_bits, void * in_data, void * out_data, scan_field_t * field); -void arm11_add_IR (arm11_common_t * arm11, uint8_t instr, tap_state_t state); -int arm11_add_debug_SCAN_N (arm11_common_t * arm11, uint8_t chain, tap_state_t state); -void arm11_add_debug_INST (arm11_common_t * arm11, uint32_t inst, uint8_t * flag, tap_state_t state); -int arm11_read_DSCR (arm11_common_t * arm11, uint32_t *dscr); -int arm11_write_DSCR (arm11_common_t * arm11, uint32_t dscr); - -enum target_debug_reason arm11_get_DSCR_debug_reason(uint32_t dscr); - -int arm11_run_instr_data_prepare (arm11_common_t * arm11); -int arm11_run_instr_data_finish (arm11_common_t * arm11); -int arm11_run_instr_no_data (arm11_common_t * arm11, uint32_t * opcode, size_t count); -int arm11_run_instr_no_data1 (arm11_common_t * arm11, uint32_t opcode); -int arm11_run_instr_data_to_core (arm11_common_t * arm11, uint32_t opcode, uint32_t * data, size_t count); -int arm11_run_instr_data_to_core_noack (arm11_common_t * arm11, uint32_t opcode, uint32_t * data, size_t count); -int arm11_run_instr_data_to_core1 (arm11_common_t * arm11, uint32_t opcode, uint32_t data); -int arm11_run_instr_data_from_core (arm11_common_t * arm11, uint32_t opcode, uint32_t * data, size_t count); -int arm11_run_instr_data_from_core_via_r0 (arm11_common_t * arm11, uint32_t opcode, uint32_t * data); -int arm11_run_instr_data_to_core_via_r0 (arm11_common_t * arm11, uint32_t opcode, uint32_t data); - -int arm11_add_dr_scan_vc(int num_fields, scan_field_t *fields, tap_state_t state); -int arm11_add_ir_scan_vc(int num_fields, scan_field_t *fields, tap_state_t state); - -/** Used to make a list of read/write commands for scan chain 7 - * - * Use with arm11_sc7_run() - */ -typedef struct arm11_sc7_action_s -{ - bool write; /**< Access mode: true for write, false for read. */ - uint8_t address; /**< Register address mode. Use enum #arm11_sc7 */ - uint32_t value; /**< If write then set this to value to be written. - In read mode this receives the read value when the - function returns. */ -} arm11_sc7_action_t; - -int arm11_sc7_run(arm11_common_t * arm11, arm11_sc7_action_t * actions, size_t count); - -/* Mid-level helper functions */ -void arm11_sc7_clear_vbw(arm11_common_t * arm11); -void arm11_sc7_set_vcr(arm11_common_t * arm11, uint32_t value); - -int arm11_read_memory_word(arm11_common_t * arm11, uint32_t address, uint32_t * result); - #endif /* ARM11_H */ diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index c9812a1..0e1160f 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -24,7 +24,7 @@ #include "config.h" #endif -#include "arm11.h" +#include "arm11_dbgtap.h" #include "time_support.h" @@ -41,7 +41,7 @@ behavior of the FTDI driver IIRC was to go via RTI. Conversely there may be other places in this code where the ARM11 code relies on the driver to hit through RTI when coming from Update-?R. */ -tap_state_t arm11_move_pi_to_si_via_ci[] = +static const tap_state_t arm11_move_pi_to_si_via_ci[] = { TAP_IREXIT2, TAP_IRUPDATE, TAP_DRSELECT, TAP_IRSELECT, TAP_IRCAPTURE, TAP_IRSHIFT }; @@ -56,7 +56,7 @@ int arm11_add_ir_scan_vc(int num_fields, scan_field_t *fields, tap_state_t state return ERROR_OK; } -tap_state_t arm11_move_pd_to_sd_via_cd[] = +static const tap_state_t arm11_move_pd_to_sd_via_cd[] = { TAP_DREXIT2, TAP_DRUPDATE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT }; @@ -548,7 +548,7 @@ int arm11_run_instr_data_to_core(arm11_common_t * arm11, uint32_t opcode, uint32 * https://lists.berlios.de/pipermail/openocd-development/2009-July/009698.html * https://lists.berlios.de/pipermail/openocd-development/2009-August/009865.html */ -tap_state_t arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay[] = +static const tap_state_t arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay[] = { TAP_DREXIT2, TAP_DRUPDATE, TAP_IDLE, TAP_IDLE, TAP_IDLE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT }; diff --git a/src/target/arm11_dbgtap.h b/src/target/arm11_dbgtap.h new file mode 100644 index 0000000..f8a793f --- /dev/null +++ b/src/target/arm11_dbgtap.h @@ -0,0 +1,69 @@ +#ifndef ARM11_DBGTAP_H +#define ARM11_DBGTAP_H + +#include "arm11.h" + +/* ARM11 internals */ + +void arm11_setup_field(arm11_common_t *arm11, int num_bits, + void *in_data, void *out_data, scan_field_t *field); +void arm11_add_IR(arm11_common_t *arm11, + uint8_t instr, tap_state_t state); +int arm11_add_debug_SCAN_N(arm11_common_t *arm11, + uint8_t chain, tap_state_t state); +void arm11_add_debug_INST(arm11_common_t *arm11, + uint32_t inst, uint8_t *flag, tap_state_t state); +int arm11_read_DSCR(arm11_common_t *arm11, uint32_t *dscr); +int arm11_write_DSCR(arm11_common_t *arm11, uint32_t dscr); + +enum target_debug_reason arm11_get_DSCR_debug_reason(uint32_t dscr); + +int arm11_run_instr_data_prepare(arm11_common_t *arm11); +int arm11_run_instr_data_finish(arm11_common_t *arm11); +int arm11_run_instr_no_data(arm11_common_t *arm11, + uint32_t *opcode, size_t count); +int arm11_run_instr_no_data1(arm11_common_t *arm11, uint32_t opcode); +int arm11_run_instr_data_to_core(arm11_common_t *arm11, + uint32_t opcode, uint32_t *data, size_t count); +int arm11_run_instr_data_to_core_noack(arm11_common_t *arm11, + uint32_t opcode, uint32_t *data, size_t count); +int arm11_run_instr_data_to_core1(arm11_common_t *arm11, + uint32_t opcode, uint32_t data); +int arm11_run_instr_data_from_core(arm11_common_t *arm11, + uint32_t opcode, uint32_t *data, size_t count); +int arm11_run_instr_data_from_core_via_r0(arm11_common_t *arm11, + uint32_t opcode, uint32_t *data); +int arm11_run_instr_data_to_core_via_r0(arm11_common_t *arm11, + uint32_t opcode, uint32_t data); + +int arm11_add_dr_scan_vc(int num_fields, scan_field_t *fields, + tap_state_t state); +int arm11_add_ir_scan_vc(int num_fields, scan_field_t *fields, + tap_state_t state); + +/** + * Used with arm11_sc7_run to make a list of read/write commands for + * scan chain 7 + */ +typedef struct arm11_sc7_action_s +{ + bool write; /**< Access mode: true for write, false for read. */ + uint8_t address; /**< Register address mode. Use enum #arm11_sc7 */ + /** + * If write then set this to value to be written. In read mode + * this receives the read value when the function returns. + */ + uint32_t value; +} arm11_sc7_action_t; + +int arm11_sc7_run(arm11_common_t *arm11, + arm11_sc7_action_t *actions, size_t count); + +/* Mid-level helper functions */ +void arm11_sc7_clear_vbw(arm11_common_t *arm11); +void arm11_sc7_set_vcr(arm11_common_t *arm11, uint32_t value); + +int arm11_read_memory_word(arm11_common_t *arm11, + uint32_t address, uint32_t *result); + +#endif // ARM11_DBGTAP_H commit e41147bf7546307a2eff8d4ad6fc93e0d08eefb3 Author: Zachary T Welch <zw...@su...> Date: Fri Nov 6 03:36:46 2009 -0800 ARM11: remove exports and forward decls Unneeded exports cause confusion about the module interfaces. Make almost everything static in the arm11.c module. diff --git a/src/target/arm11.c b/src/target/arm11.c index 9cb80f1..fb57ee5 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -49,65 +49,13 @@ #define FNC_INFO_NOTIMPLEMENTED #endif -static int arm11_on_enter_debug_state(arm11_common_t * arm11); - -bool arm11_config_memwrite_burst = true; -bool arm11_config_memwrite_error_fatal = true; -uint32_t arm11_vcr = 0; -bool arm11_config_step_irq_enable = false; -bool arm11_config_hardware_step = false; - -#define ARM11_HANDLER(x) \ - .x = arm11_##x - - -static int arm11_mrc(target_t *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value); -static int arm11_mcr(target_t *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t value); - -target_type_t arm11_target = -{ - .name = "arm11", - - ARM11_HANDLER(poll), - ARM11_HANDLER(arch_state), - - ARM11_HANDLER(target_request_data), - - ARM11_HANDLER(halt), - ARM11_HANDLER(resume), - ARM11_HANDLER(step), - - ARM11_HANDLER(assert_reset), - ARM11_HANDLER(deassert_reset), - ARM11_HANDLER(soft_reset_halt), - - ARM11_HANDLER(get_gdb_reg_list), - - ARM11_HANDLER(read_memory), - ARM11_HANDLER(write_memory), - - ARM11_HANDLER(bulk_write_memory), - - ARM11_HANDLER(checksum_memory), - - ARM11_HANDLER(add_breakpoint), - ARM11_HANDLER(remove_breakpoint), - ARM11_HANDLER(add_watchpoint), - ARM11_HANDLER(remove_watchpoint), - - ARM11_HANDLER(run_algorithm), - - ARM11_HANDLER(register_commands), - ARM11_HANDLER(target_create), - ARM11_HANDLER(init_target), - ARM11_HANDLER(examine), - .mrc = arm11_mrc, - .mcr = arm11_mcr, - -}; - -int arm11_regs_arch_type = -1; +static bool arm11_config_memwrite_burst = true; +static bool arm11_config_memwrite_error_fatal = true; +static uint32_t arm11_vcr = 0; +static bool arm11_config_step_irq_enable = false; +static bool arm11_config_hardware_step = false; +static int arm11_regs_arch_type = -1; enum arm11_regtype { @@ -297,21 +245,32 @@ enum arm11_regcache_ids #define ARM11_GDB_REGISTER_COUNT 26 -uint8_t arm11_gdb_dummy_fp_value[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static uint8_t arm11_gdb_dummy_fp_value[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -reg_t arm11_gdb_dummy_fp_reg = +static reg_t arm11_gdb_dummy_fp_reg = { "GDB dummy floating-point register", arm11_gdb_dummy_fp_value, 0, 1, 96, NULL, 0, NULL, 0 }; -uint8_t arm11_gdb_dummy_fps_value[] = {0, 0, 0, 0}; +static uint8_t arm11_gdb_dummy_fps_value[] = {0, 0, 0, 0}; -reg_t arm11_gdb_dummy_fps_reg = +static reg_t arm11_gdb_dummy_fps_reg = { "GDB dummy floating-point status register", arm11_gdb_dummy_fps_value, 0, 1, 32, NULL, 0, NULL, 0 }; +static int arm11_on_enter_debug_state(arm11_common_t *arm11); +static int arm11_step(struct target_s *target, int current, + uint32_t address, int handle_breakpoints); +/* helpers */ +static int arm11_build_reg_cache(target_t *target); +static int arm11_set_reg(reg_t *reg, uint8_t *buf); +static int arm11_get_reg(reg_t *reg); + +static void arm11_record_register_history(arm11_common_t * arm11); +static void arm11_dump_reg_changes(arm11_common_t * arm11); + /** Check and if necessary take control of the system * @@ -320,7 +279,7 @@ reg_t arm11_gdb_dummy_fps_reg = * available a pointer to a word holding the * DSCR can be passed. Otherwise use NULL. */ -int arm11_check_init(arm11_common_t * arm11, uint32_t * dscr) +static int arm11_check_init(arm11_common_t *arm11, uint32_t *dscr) { FNC_INFO; @@ -378,7 +337,7 @@ int arm11_check_init(arm11_common_t * arm11, uint32_t * dscr) * or on other occasions that stop the processor. * */ -static int arm11_on_enter_debug_state(arm11_common_t * arm11) +static int arm11_on_enter_debug_state(arm11_common_t *arm11) { int retval; FNC_INFO; @@ -577,7 +536,7 @@ void arm11_dump_reg_changes(arm11_common_t * arm11) * This is called in preparation for the RESTART function. * */ -int arm11_leave_debug_state(arm11_common_t * arm11) +static int arm11_leave_debug_state(arm11_common_t *arm11) { FNC_INFO; int retval; @@ -694,7 +653,7 @@ int arm11_leave_debug_state(arm11_common_t * arm11) return ERROR_OK; } -void arm11_record_register_history(arm11_common_t * arm11) +static void arm11_record_register_history(arm11_common_t *arm11) { for (size_t i = 0; i < ARM11_REGCACHE_COUNT; i++) { @@ -708,7 +667,7 @@ void arm11_record_register_history(arm11_common_t * arm11) /* poll current target status */ -int arm11_poll(struct target_s *target) +static int arm11_poll(struct target_s *target) { FNC_INFO; int retval; @@ -753,7 +712,7 @@ int arm11_poll(struct target_s *target) return ERROR_OK; } /* architecture specific status reply */ -int arm11_arch_state(struct target_s *target) +static int arm11_arch_state(struct target_s *target) { arm11_common_t * arm11 = target->arch_info; @@ -766,7 +725,8 @@ int arm11_arch_state(struct target_s *target) } /* target request support */ -int arm11_target_request_data(struct target_s *target, uint32_t size, uint8_t *buffer) +static int arm11_target_request_data(struct target_s *target, + uint32_t size, uint8_t *buffer) { FNC_INFO_NOTIMPLEMENTED; @@ -774,7 +734,7 @@ int arm11_target_request_data(struct target_s *target, uint32_t size, uint8_t *b } /* target execution control */ -int arm11_halt(struct target_s *target) +static int arm11_halt(struct target_s *target) { FNC_INFO; @@ -839,7 +799,8 @@ int arm11_halt(struct target_s *target) return ERROR_OK; } -int arm11_resume(struct target_s *target, int current, uint32_t address, int handle_breakpoints, int debug_execution) +static int arm11_resume(struct target_s *target, int current, + uint32_t address, int handle_breakpoints, int debug_execution) { FNC_INFO; @@ -989,7 +950,8 @@ static uint32_t arm11_sim_get_reg(struct arm_sim_interface *sim, int reg) return buf_get_u32(arm11->reg_list[reg].value, 0, 32); } -static void arm11_sim_set_reg(struct arm_sim_interface *sim, int reg, uint32_t value) +static void arm11_sim_set_reg(struct arm_sim_interface *sim, + int reg, uint32_t value) { arm11_common_t * arm11 = (arm11_common_t *)sim->user_data; @@ -998,7 +960,8 @@ static void arm11_sim_set_reg(struct arm_sim_interface *sim, int reg, uint32_t v buf_set_u32(arm11->reg_list[reg].value, 0, 32, value); } -static uint32_t arm11_sim_get_cpsr(struct arm_sim_interface *sim, int pos, int bits) +static uint32_t arm11_sim_get_cpsr(struct arm_sim_interface *sim, + int pos, int bits) { arm11_common_t * arm11 = (arm11_common_t *)sim->user_data; @@ -1013,7 +976,8 @@ static enum armv4_5_state arm11_sim_get_state(struct arm_sim_interface *sim) return ARMV4_5_STATE_ARM; } -static void arm11_sim_set_state(struct arm_sim_interface *sim, enum armv4_5_state mode) +static void arm11_sim_set_state(struct arm_sim_interface *sim, + enum armv4_5_state mode) { // arm11_common_t * arm11 = (arm11_common_t *)sim->user_data; @@ -1048,7 +1012,8 @@ static int arm11_simulate_step(target_t *target, uint32_t *dry_run_pc) } -int arm11_step(struct target_s *target, int current, uint32_t address, int handle_breakpoints) +static int arm11_step(struct target_s *target, int current, + uint32_t address, int handle_breakpoints) { FNC_INFO; @@ -1203,7 +1168,7 @@ int arm11_step(struct target_s *target, int current, uint32_t address, int handl return ERROR_OK; } -int arm11_assert_reset(target_t *target) +static int arm11_assert_reset(target_t *target) { FNC_INFO; int retval; @@ -1265,12 +1230,12 @@ int arm11_assert_reset(target_t *target) return ERROR_OK; } -int arm11_deassert_reset(target_t *target) +static int arm11_deassert_reset(target_t *target) { return ERROR_OK; } -int arm11_soft_reset_halt(struct target_s *target) +static int arm11_soft_reset_halt(struct target_s *target) { FNC_INFO_NOTIMPLEMENTED; @@ -1278,7 +1243,8 @@ int arm11_soft_reset_halt(struct target_s *target) } /* target register access for gdb */ -int arm11_get_gdb_reg_list(struct target_s *target, struct reg_s **reg_list[], int *reg_list_size) +static int arm11_get_gdb_reg_list(struct target_s *target, + struct reg_s **reg_list[], int *reg_list_size) { FNC_INFO; @@ -1313,7 +1279,8 @@ int arm11_get_gdb_reg_list(struct target_s *target, struct reg_s **reg_list[], i * to read/write a range of data to a "port". a "port" is an action on * read memory address for some peripheral. */ -int arm11_read_memory_inner(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer, +static int arm11_read_memory_inner(struct target_s *target, + uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer, bool arm11_config_memrw_no_increment) { /** \todo TODO: check if buffer cast to uint32_t* and uint16_t* might cause alignment problems */ @@ -1400,7 +1367,7 @@ int arm11_read_memory_inner(struct target_s *target, uint32_t address, uint32_t return arm11_run_instr_data_finish(arm11); } -int arm11_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) +static int arm11_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { return arm11_read_memory_inner(target, address, size, count, buffer, false); } @@ -1410,7 +1377,8 @@ int arm11_read_memory(struct target_s *target, uint32_t address, uint32_t size, * to read/write a range of data to a "port". a "port" is an action on * read memory address for some peripheral. */ -int arm11_write_memory_inner(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer, +static int arm11_write_memory_inner(struct target_s *target, + uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer, bool arm11_config_memrw_no_increment) { int retval; @@ -1548,13 +1516,15 @@ int arm11_write_memory_inner(struct target_s *target, uint32_t address, uint32_t return arm11_run_instr_data_finish(arm11); } -int arm11_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) +static int arm11_write_memory(struct target_s *target, + uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { return arm11_write_memory_inner(target, address, size, count, buffer, false); } /* write target memory in multiples of 4 byte, optimized for writing large quantities of data */ -int arm11_bulk_write_memory(struct target_s *target, uint32_t address, uint32_t count, uint8_t *buffer) +static int arm11_bulk_write_memory(struct target_s *target, + uint32_t address, uint32_t count, uint8_t *buffer) { FNC_INFO; @@ -1571,7 +1541,8 @@ int arm11_bulk_write_memory(struct target_s *target, uint32_t address, uint32_t * fallback code will read data from the target and calculate the CRC on the * host. */ -int arm11_checksum_memory(struct target_s *target, uint32_t address, uint32_t count, uint32_t* checksum) +static int arm11_checksum_memory(struct target_s *target, + uint32_t address, uint32_t count, uint32_t* checksum) { return ERROR_FAIL; } @@ -1579,7 +1550,8 @@ int arm11_checksum_memory(struct target_s *target, uint32_t address, uint32_t co /* target break-/watchpoint control * rw: 0 = write, 1 = read, 2 = access */ -int arm11_add_breakpoint(struct target_s *target, breakpoint_t *breakpoint) +static int arm11_add_breakpoint(struct target_s *target, + breakpoint_t *breakpoint) { FNC_INFO; @@ -1610,7 +1582,8 @@ int arm11_add_breakpoint(struct target_s *target, breakpoint_t *breakpoint) return ERROR_OK; } -int arm11_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint) +static int arm11_remove_breakpoint(struct target_s *target, + breakpoint_t *breakpoint) { FNC_INFO; @@ -1621,14 +1594,16 @@ int arm11_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint) return ERROR_OK; } -int arm11_add_watchpoint(struct target_s *target, watchpoint_t *watchpoint) +static int arm11_add_watchpoint(struct target_s *target, + watchpoint_t *watchpoint) { FNC_INFO_NOTIMPLEMENTED; return ERROR_OK; } -int arm11_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint) +static int arm11_remove_watchpoint(struct target_s *target, + watchpoint_t *watchpoint) { FNC_INFO_NOTIMPLEMENTED; @@ -1637,9 +1612,11 @@ int arm11_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint) // HACKHACKHACK - FIXME mode/state /* target algorithm support */ -int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, - int num_reg_params, reg_param_t *reg_params, uint32_t entry_point, uint32_t exit_point, - int timeout_ms, void *arch_info) +static int arm11_run_algorithm(struct target_s *target, + int num_mem_params, mem_param_t *mem_params, + int num_reg_params, reg_param_t *reg_params, + uint32_t entry_point, uint32_t exit_point, + int timeout_ms, void *arch_info) { arm11_common_t *arm11 = target->arch_info; // enum armv4_5_state core_state = arm11->core_state; @@ -1801,7 +1778,7 @@ restore: return retval; } -int arm11_target_create(struct target_s *target, Jim_Interp *interp) +static int arm11_target_create(struct target_s *target, Jim_Interp *interp) { FNC_INFO; @@ -1823,14 +1800,15 @@ int arm11_target_create(struct target_s *target, Jim_Interp *interp) return ERROR_OK; } -int arm11_init_target(struct command_context_s *cmd_ctx, struct target_s *target) +static int arm11_init_target(struct command_context_s *cmd_ctx, + struct target_s *target) { /* Initialize anything we can set up without talking to the target */ return arm11_build_reg_cache(target); } /* talk to the target and set things up */ -int arm11_examine(struct target_s *target) +static int arm11_examine(struct target_s *target) { int retval; @@ -1912,7 +1890,7 @@ int arm11_examine(struct target_s *target) /** Load a register that is marked !valid in the register cache */ -int arm11_get_reg(reg_t *reg) +static int arm11_get_reg(reg_t *reg) { FNC_INFO; @@ -1935,7 +1913,7 @@ int arm11_get_reg(reg_t *reg) } /** Change a value in the register cache */ -int arm11_set_reg(reg_t *reg, uint8_t *buf) +static int arm11_set_reg(reg_t *reg, uint8_t *buf) { FNC_INFO; @@ -1950,7 +1928,7 @@ int arm11_set_reg(reg_t *reg, uint8_t *buf) return ERROR_OK; } -int arm11_build_reg_cache(target_t *target) +static int arm11_build_reg_cache(target_t *target) { arm11_common_t *arm11 = target->arch_info; @@ -2012,7 +1990,8 @@ int arm11_build_reg_cache(target_t *target) return ERROR_OK; } -int arm11_handle_bool(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, bool * var, char * name) +static int arm11_handle_bool(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc, bool * var, char * name) { if (argc == 0) { @@ -2048,7 +2027,7 @@ int arm11_handle_bool(struct command_context_s *cmd_ctx, char *cmd, char **args, } #define BOOL_WRAPPER(name, print_name) \ -int arm11_handle_bool_##name(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) \ +static int arm11_handle_bool_##name(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) \ { \ return arm11_handle_bool(cmd_ctx, cmd, args, argc, &arm11_config_##name, print_name); \ } @@ -2058,7 +2037,7 @@ BOOL_WRAPPER(memwrite_error_fatal, "fatal error mode for memory writes") BOOL_WRAPPER(step_irq_enable, "IRQs while stepping") BOOL_WRAPPER(hardware_step, "hardware single step") -int arm11_handle_vcr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int arm11_handle_vcr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { switch (argc) { case 0: @@ -2074,7 +2053,7 @@ int arm11_handle_vcr(struct command_context_s *cmd_ctx, char *cmd, char **args, return ERROR_OK; } -const uint32_t arm11_coproc_instruction_limits[] = +static const uint32_t arm11_coproc_instruction_limits[] = { 15, /* coprocessor */ 7, /* opcode 1 */ @@ -2084,7 +2063,7 @@ const uint32_t arm11_coproc_instruction_limits[] = 0xFFFFFFFF, /* value */ }; -arm11_common_t * arm11_find_target(const char * arg) +static arm11_common_t * arm11_find_target(const char * arg) { jtag_tap_t * tap; target_t * t; @@ -2107,7 +2086,8 @@ arm11_common_t * arm11_find_target(const char * arg) return 0; } -int arm11_handle_mrc_mcr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, bool read) +static int arm11_handle_mrc_mcr(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc, bool read) { int retval; @@ -2189,17 +2169,21 @@ int arm11_handle_mrc_mcr(struct command_context_s *cmd_ctx, char *cmd, char **ar return arm11_run_instr_data_finish(arm11); } -int arm11_handle_mrc(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int arm11_handle_mrc(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { return arm11_handle_mrc_mcr(cmd_ctx, cmd, args, argc, true); } -int arm11_handle_mcr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int arm11_handle_mcr(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { return arm11_handle_mrc_mcr(cmd_ctx, cmd, args, argc, false); } -static int arm11_mrc_inner(target_t *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value, bool read) +static int arm11_mrc_inner(target_t *target, int cpnum, + uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, + uint32_t *value, bool read) { int retval; @@ -2241,16 +2225,61 @@ static int arm11_mrc_inner(target_t *target, int cpnum, uint32_t op1, uint32_t o return arm11_run_instr_data_finish(arm11); } -static int arm11_mrc(target_t *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value) +static int arm11_mrc(target_t *target, int cpnum, + uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t *value) { return arm11_mrc_inner(target, cpnum, op1, op2, CRn, CRm, value, true); } -static int arm11_mcr(target_t *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t value) +static int arm11_mcr(target_t *target, int cpnum, + uint32_t op1, uint32_t op2, uint32_t CRn, uint32_t CRm, uint32_t value) { return arm11_mrc_inner(target, cpnum, op1, op2, CRn, CRm, &value, false); } +#define ARM11_HANDLER(x) .x = arm11_##x + +target_type_t arm11_target = { + .name = "arm11", + + ARM11_HANDLER(poll), + ARM11_HANDLER(arch_state), + + ARM11_HANDLER(target_request_data), + + ARM11_HANDLER(halt), + ARM11_HANDLER(resume), + ARM11_HANDLER(step), + + ARM11_HANDLER(assert_reset), + ARM11_HANDLER(deassert_reset), + ARM11_HANDLER(soft_reset_halt), + + ARM11_HANDLER(get_gdb_reg_list), + + ARM11_HANDLER(read_memory), + ARM11_HANDLER(write_memory), + + ARM11_HANDLER(bulk_write_memory), + + ARM11_HANDLER(checksum_memory), + + ARM11_HANDLER(add_breakpoint), + ARM11_HANDLER(remove_breakpoint), + ARM11_HANDLER(add_watchpoint), + ARM11_HANDLER(remove_watchpoint), + + ARM11_HANDLER(run_algorithm), + + ARM11_HANDLER(register_commands), + ARM11_HANDLER(target_create), + ARM11_HANDLER(init_target), + ARM11_HANDLER(examine), + + ARM11_HANDLER(mrc), + ARM11_HANDLER(mcr), + }; + int arm11_register_commands(struct command_context_s *cmd_ctx) { diff --git a/src/target/arm11.h b/src/target/arm11.h index 67320de..fe08353 100644 --- a/src/target/arm11.h +++ b/src/target/arm11.h @@ -182,62 +182,7 @@ typedef struct arm11_reg_state_s target_t * target; } arm11_reg_state_t; -/* poll current target status */ -int arm11_poll(struct target_s *target); -/* architecture specific status reply */ -int arm11_arch_state(struct target_s *target); - -/* target request support */ -int arm11_target_request_data(struct target_s *target, uint32_t size, uint8_t *buffer); - -/* target execution control */ -int arm11_halt(struct target_s *target); -int arm11_resume(struct target_s *target, int current, uint32_t address, int handle_breakpoints, int debug_execution); -int arm11_step(struct target_s *target, int current, uint32_t address, int handle_breakpoints); -int arm11_examine(struct target_s *target); - -/* target reset control */ -int arm11_assert_reset(struct target_s *target); -int arm11_deassert_reset(struct target_s *target); -int arm11_soft_reset_halt(struct target_s *target); - -/* target register access for gdb */ -int arm11_get_gdb_reg_list(struct target_s *target, struct reg_s **reg_list[], int *reg_list_size); - -/* target memory access -* size: 1 = byte (8bit), 2 = half-word (16bit), 4 = word (32bit) -* count: number of items of <size> -*/ -int arm11_read_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); -int arm11_write_memory(struct target_s *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); - -/* write target memory in multiples of 4 byte, optimized for writing large quantities of data */ -int arm11_bulk_write_memory(struct target_s *target, uint32_t address, uint32_t count, uint8_t *buffer); - -int arm11_checksum_memory(struct target_s *target, uint32_t address, uint32_t count, uint32_t* checksum); - -/* target break-/watchpoint control -* rw: 0 = write, 1 = read, 2 = access -*/ -int arm11_add_breakpoint(struct target_s *target, breakpoint_t *breakpoint); -int arm11_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint); -int arm11_add_watchpoint(struct target_s *target, watchpoint_t *watchpoint); -int arm11_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint); - -/* target algorithm support */ -int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info); - int arm11_register_commands(struct command_context_s *cmd_ctx); -int arm11_target_create(struct target_s *target, Jim_Interp *interp); -int arm11_init_target(struct command_context_s *cmd_ctx, struct target_s *target); - -/* helpers */ -int arm11_build_reg_cache(target_t *target); -int arm11_set_reg(reg_t *reg, uint8_t *buf); -int arm11_get_reg(reg_t *reg); - -void arm11_record_register_history(arm11_common_t * arm11); -void arm11_dump_reg_changes(arm11_common_t * arm11); /* internals */ ----------------------------------------------------------------------- Summary of changes: src/target/arm11.c | 248 +++++++++++++++++++++++++-------------------- src/target/arm11.h | 101 ------------------ src/target/arm11_dbgtap.c | 8 +- src/target/arm11_dbgtap.h | 69 +++++++++++++ 4 files changed, 212 insertions(+), 214 deletions(-) create mode 100644 src/target/arm11_dbgtap.h hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-08 21:45:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via b2d01a9e6a2f4967344c177e25923a44a71df187 (commit) from 7d9df4b13474b25c3170c30a0bee52c387d3d049 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b2d01a9e6a2f4967344c177e25923a44a71df187 Author: David Brownell <dbr...@us...> Date: Sun Nov 8 12:44:28 2009 -0800 ARM: minor simulator cleanup Make several functions be static. Shrink some of the overlong lines. Use pure tab indents in some places that mixed in spaces. This gives a minor object code shrink (about 2% on amd64). Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm_simulator.c b/src/target/arm_simulator.c index 2d35af9..bef1405 100644 --- a/src/target/arm_simulator.c +++ b/src/target/arm_simulator.c @@ -31,7 +31,8 @@ #include "binarybuffer.h" -uint32_t arm_shift(uint8_t shift, uint32_t Rm, uint32_t shift_amount, uint8_t *carry) +static uint32_t arm_shift(uint8_t shift, uint32_t Rm, + uint32_t shift_amount, uint8_t *carry) { uint32_t return_value = 0; shift_amount &= 0xff; @@ -74,8 +75,11 @@ uint32_t arm_shift(uint8_t shift, uint32_t Rm, uint32_t shift_amount, uint8_t *c { if ((shift_amount > 0) && (shift_amount <= 32)) { - /* right shifts of unsigned values are guaranteed to be logical (shift in zeroes) - * simulate an arithmetic shift (shift in signed-bit) by adding the signed-bit manually */ + /* C right shifts of unsigned values are guaranteed to + * be logical (shift in zeroes); simulate an arithmetic + * shift (shift in signed-bit) by adding the sign bit + * manually + */ return_value = Rm >> shift_amount; if (Rm & 0x80000000) return_value |= 0xffffffff << (32 - shift_amount); @@ -123,7 +127,9 @@ uint32_t arm_shift(uint8_t shift, uint32_t Rm, uint32_t shift_amount, uint8_t *c } -uint32_t arm_shifter_operand(struct arm_sim_interface *sim, int variant, union arm_shifter_operand shifter_operand, uint8_t *shifter_carry_out) +static uint32_t arm_shifter_operand(struct arm_sim_interface *sim, + int variant, union arm_shifter_operand shifter_operand, + uint8_t *shifter_carry_out) { uint32_t return_value; int instruction_size; @@ -147,7 +153,9 @@ uint32_t arm_shifter_operand(struct arm_sim_interface *sim, int variant, union a if (shifter_operand.immediate_shift.Rm == 15) Rm += 2 * instruction_size; - return_value = arm_shift(shifter_operand.immediate_shift.shift, Rm, shifter_operand.immediate_shift.shift_imm, shifter_carry_out); + return_value = arm_shift(shifter_operand.immediate_shift.shift, + Rm, shifter_operand.immediate_shift.shift_imm, + shifter_carry_out); } else if (variant == 2) /* register shift */ { @@ -158,7 +166,8 @@ uint32_t arm_shifter_operand(struct arm_sim_interface *sim, int variant, union a if (shifter_operand.register_shift.Rm == 15) Rm += 2 * instruction_size; - return_value = arm_shift(shifter_operand.immediate_shift.shift, Rm, Rs, shifter_carry_out); + return_value = arm_shift(shifter_operand.immediate_shift.shift, + Rm, Rs, shifter_carry_out); } else { @@ -169,7 +178,7 @@ uint32_t arm_shifter_operand(struct arm_sim_interface *sim, int variant, union a return return_value; } -int pass_condition(uint32_t cpsr, uint32_t opcode) +static int pass_condition(uint32_t cpsr, uint32_t opcode) { switch ((opcode & 0xf0000000) >> 28) { @@ -259,7 +268,7 @@ int pass_condition(uint32_t cpsr, uint32_t opcode) return 0; } -int thumb_pass_branch_condition(uint32_t cpsr, uint16_t opcode) +static int thumb_pass_branch_condition(uint32_t cpsr, uint16_t opcode) { return pass_condition(cpsr, (opcode & 0x0f00) << 20); } @@ -268,7 +277,8 @@ int thumb_pass_branch_condition(uint32_t cpsr, uint16_t opcode) * if the dry_run_pc argument is provided, no state is changed, * but the new pc is stored in the variable pointed at by the argument */ -int arm_simulate_step_core(target_t *target, uint32_t *dry_run_pc, struct arm_sim_interface *sim) +int arm_simulate_step_core(target_t *target, + uint32_t *dry_run_pc, struct arm_sim_interface *sim) { uint32_t current_pc = sim->get_reg(sim, 15); arm_instruction_t instruction; @@ -313,13 +323,14 @@ int arm_simulate_step_core(target_t *target, uint32_t *dry_run_pc, struct arm_si if (retval != ERROR_OK) return retval; retval = thumb_evaluate_opcode(opcode, current_pc, &instruction); - if (retval != ERROR_OK) + if (retval != ERROR_OK) return retval; instruction_size = 2; /* check condition code (only for branch (1) instructions) */ - if ((opcode & 0xf000) == 0xd000 && - !thumb_pass_branch_condition(sim->get_cpsr(sim, 0, 32), opcode)) + if ((opcode & 0xf000) == 0xd000 + && !thumb_pass_branch_condition( + sim->get_cpsr(sim, 0, 32), opcode)) { if (dry_run_pc) { @@ -431,7 +442,10 @@ int arm_simulate_step_core(target_t *target, uint32_t *dry_run_pc, struct arm_si else Rn = 0; - shifter_operand = arm_shifter_operand(sim, instruction.info.data_proc.variant, instruction.info.data_proc.shifter_operand, &carry_out); + shifter_operand = arm_shifter_operand(sim, + instruction.info.data_proc.variant, + instruction.info.data_proc.shifter_operand, + &carry_out); /* adjust Rn in case the PC is being read */ if (instruction.info.data_proc.Rn == 15) @@ -520,7 +534,8 @@ int arm_simulate_step_core(target_t *target, uint32_t *dry_run_pc, struct arm_si else if (instruction.info.load_store.offset_mode == 1) { uint32_t offset; - uint32_t Rm = sim->get_reg_mode(sim, instruction.info.load_store.offset.reg.Rm); + uint32_t Rm = sim->get_reg_mode(sim, + instruction.info.load_store.offset.reg.Rm); uint8_t shift = instruction.info.load_store.offset.reg.shift; uint8_t shift_imm = instruction.info.load_store.offset.reg.shift_imm; uint8_t carry = sim->get_cpsr(sim, 29, 1); @@ -540,29 +555,34 @@ int arm_simulate_step_core(target_t *target, uint32_t *dry_run_pc, struct arm_si if (instruction.info.load_store.index_mode == 0) { /* offset mode - * we load from the modified address, but don't change the base address register */ + * we load from the modified address, but don't change + * the base address register + */ load_address = modified_address; modified_address = Rn; } else if (instruction.info.load_store.index_mode == 1) { /* pre-indexed mode - * we load from the modified address, and write it back to the base address register */ + * we load from the modified address, and write it + * back to the base address register + */ load_address = modified_address; } else if (instruction.info.load_store.index_mode == 2) { /* post-indexed mode - * we load from the unmodified address, and write the modified address back */ - load_address = Rn; + * we load from the unmodified address, and write the + * modified address back + */ + load_address = Rn; } if ((!dry_run_pc) || (instruction.info.load_store.Rd == 15)) { - if ((retval = target_read_u32(target, load_address, &load_value)) != ERROR_OK) - { + retval = target_read_u32(target, load_address, &load_value); + if (retval != ERROR_OK) return retval; - } } if (dry_run_pc) @@ -697,7 +717,8 @@ int arm_simulate_step_core(target_t *target, uint32_t *dry_run_pc, struct arm_si } else { - uint32_t Rn = sim->get_reg_mode(sim, instruction.info.load_store_multiple.Rn); + uint32_t Rn = sim->get_reg_mode(sim, + instruction.info.load_store_multiple.Rn); int bits_set = 0; enum armv4_5_mode mode = sim->get_mode(sim); @@ -739,7 +760,8 @@ int arm_simulate_step_core(target_t *target, uint32_t *dry_run_pc, struct arm_si /* base register writeback */ if (instruction.info.load_store_multiple.W) - sim->set_reg_mode(sim, instruction.info.load_store_multiple.Rn, Rn); + sim->set_reg_mode(sim, + instruction.info.load_store_multiple.Rn, Rn); } } @@ -782,14 +804,16 @@ static uint32_t armv4_5_get_reg_mode(struct arm_sim_interface *sim, int reg) { armv4_5_common_t *armv4_5 = (armv4_5_common_t *)sim->user_data; - return buf_get_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, reg).value, 0, 32); + return buf_get_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, + armv4_5->core_mode, reg).value, 0, 32); } static void armv4_5_set_reg_mode(struct arm_sim_interface *sim, int reg, uint32_t value) { armv4_5_common_t *armv4_5 = (armv4_5_common_t *)sim->user_data; - buf_set_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, reg).value, 0, 32, value); + buf_set_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, + armv4_5->core_mode, reg).value, 0, 32, value); } static uint32_t armv4_5_get_cpsr(struct arm_sim_interface *sim, int pos, int bits) ----------------------------------------------------------------------- Summary of changes: src/target/arm_simulator.c | 74 +++++++++++++++++++++++++++++--------------- 1 files changed, 49 insertions(+), 25 deletions(-) hooks/post-receive -- Main OpenOCD repository |