summaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-11-25 16:38:08 -0800
committerDavid Brownell <dbrownell@users.sourceforge.net>2009-11-25 16:38:08 -0800
commitb715a81f5b95144118d8f946d4191f1dc844783a (patch)
treeb3c553cd43e489f00105d4ba52bccafa1705375f /src/target
parentac06d41fc723c264e989673be16f9f21a1896518 (diff)
downloadopenocd+libswd-b715a81f5b95144118d8f946d4191f1dc844783a.tar.gz
openocd+libswd-b715a81f5b95144118d8f946d4191f1dc844783a.tar.bz2
openocd+libswd-b715a81f5b95144118d8f946d4191f1dc844783a.tar.xz
openocd+libswd-b715a81f5b95144118d8f946d4191f1dc844783a.zip
target: target_get_name() --> target_type_name()
There are two names that may matter on a per-target basis. One is a per-instance name (for example, "at91sam7s.cpu"). The other is the name of its type (for example, "arm7tdmi"), which is shared among multiple targets. Currently target_get_name() returns the type name, which is misleading and is rarely appropriate for target diagnostics. Rename that as target_type_name(). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/target')
-rw-r--r--src/target/breakpoints.c8
-rw-r--r--src/target/embeddedice.c4
-rw-r--r--src/target/etm.c2
-rw-r--r--src/target/target.c18
-rw-r--r--src/target/target.h5
-rw-r--r--src/target/target_type.h2
6 files changed, 24 insertions, 15 deletions
diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c
index 3ab1464e..df797e37 100644
--- a/src/target/breakpoints.c
+++ b/src/target/breakpoints.c
@@ -155,7 +155,9 @@ void breakpoint_remove(struct target *target, uint32_t address)
void breakpoint_clear_target(struct target *target)
{
struct breakpoint *breakpoint;
- LOG_DEBUG("Delete all breakpoints for target: %s", target_get_name( target ));
+
+ LOG_DEBUG("Delete all breakpoints for target: %s",
+ target_type_name(target));
while ((breakpoint = target->breakpoints) != NULL)
{
breakpoint_free(target, breakpoint);
@@ -290,7 +292,9 @@ void watchpoint_remove(struct target *target, uint32_t address)
void watchpoint_clear_target(struct target *target)
{
struct watchpoint *watchpoint;
- LOG_DEBUG("Delete all watchpoints for target: %s", target_get_name( target ));
+
+ LOG_DEBUG("Delete all watchpoints for target: %s",
+ target_type_name(target));
while ((watchpoint = target->watchpoints) != NULL)
{
watchpoint_free(target, watchpoint);
diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c
index 3947e26c..cca9cc06 100644
--- a/src/target/embeddedice.c
+++ b/src/target/embeddedice.c
@@ -281,8 +281,8 @@ embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9)
* in some unusual bits. Let feroceon.c validate it
* and do the appropriate setup itself.
*/
- if (strcmp(target_get_name(target), "feroceon") == 0 ||
- strcmp(target_get_name(target), "dragonite") == 0)
+ if (strcmp(target_type_name(target), "feroceon") == 0 ||
+ strcmp(target_type_name(target), "dragonite") == 0)
break;
LOG_ERROR("unknown EmbeddedICE version "
"(comms ctrl: 0x%8.8" PRIx32 ")",
diff --git a/src/target/etm.c b/src/target/etm.c
index 4e7f9172..2ea7345d 100644
--- a/src/target/etm.c
+++ b/src/target/etm.c
@@ -1374,7 +1374,7 @@ COMMAND_HANDLER(handle_etm_config_command)
arm = target_to_arm(target);
if (!is_arm(arm)) {
command_print(CMD_CTX, "target '%s' is '%s'; not an ARM",
- target->cmd_name, target_get_name(target));
+ target->cmd_name, target_type_name(target));
return ERROR_FAIL;
}
diff --git a/src/target/target.c b/src/target/target.c
index 97a93c06..f46fc67b 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -522,7 +522,7 @@ int target_examine(void)
}
return retval;
}
-const char *target_get_name(struct target *target)
+const char *target_type_name(struct target *target)
{
return target->type->name;
}
@@ -766,7 +766,7 @@ int target_init(struct command_context *cmd_ctx)
if ((retval = target->type->init_target(cmd_ctx, target)) != ERROR_OK)
{
- LOG_ERROR("target '%s' init failed", target_get_name(target));
+ LOG_ERROR("target '%s' init failed", target_type_name(target));
return retval;
}
@@ -1698,7 +1698,7 @@ DumpTargets:
target->target_number,
marker,
target->cmd_name,
- target_get_name(target),
+ target_type_name(target),
Jim_Nvp_value2name_simple(nvp_target_endian,
target->endianness)->name,
target->tap->dotted_name,
@@ -3511,7 +3511,7 @@ void target_handle_event(struct target *target, enum target_event e)
LOG_DEBUG("target: (%d) %s (%s) event: %d (%s) action: %s",
target->target_number,
target->cmd_name,
- target_get_name(target),
+ target_type_name(target),
e,
Jim_Nvp_value2name_simple(nvp_target_event, e)->name,
Jim_GetString(teap->body, NULL));
@@ -3585,16 +3585,20 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target)
case TCFG_TYPE:
/* not setable */
if (goi->isconfigure) {
- Jim_SetResult_sprintf(goi->interp, "not setable: %s", n->name);
+ Jim_SetResult_sprintf(goi->interp,
+ "not settable: %s", n->name);
return JIM_ERR;
} else {
no_params:
if (goi->argc != 0) {
- Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "NO PARAMS");
+ Jim_WrongNumArgs(goi->interp,
+ goi->argc, goi->argv,
+ "NO PARAMS");
return JIM_ERR;
}
}
- Jim_SetResultString(goi->interp, target_get_name(target), -1);
+ Jim_SetResultString(goi->interp,
+ target_type_name(target), -1);
/* loop for more */
break;
case TCFG_EVENT:
diff --git a/src/target/target.h b/src/target/target.h
index ee40209c..61bc68ae 100644
--- a/src/target/target.h
+++ b/src/target/target.h
@@ -280,11 +280,12 @@ struct target* get_current_target(struct command_context *cmd_ctx);
struct target *get_target(const char *id);
/**
- * Get the target name.
+ * Get the target type name.
*
* This routine is a wrapper for the target->type->name field.
+ * Note that this is not an instance-specific name for his target.
*/
-const char *target_get_name(struct target *target);
+const char *target_type_name(struct target *target);
/**
* Examine the specified @a target, letting it perform any
diff --git a/src/target/target_type.h b/src/target/target_type.h
index 9a0709d8..333b58b4 100644
--- a/src/target/target_type.h
+++ b/src/target/target_type.h
@@ -39,7 +39,7 @@ struct target_type
{
/**
* Name of this type of target. Do @b not access this
- * field directly, use target_get_name() instead.
+ * field directly, use target_type_name() instead.
*/
char *name;