summaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-10 22:29:36 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-13 10:55:00 -0800
commita585bdf7269ce5c861c83ee3294ba1f074e9c877 (patch)
tree0b50307192186d4516609e9043be1be1dd3ebc2d /src/target
parent5b6df55a1e5e4c0f531bc336691bc7c9a6a0df87 (diff)
downloadopenocd_libswd-a585bdf7269ce5c861c83ee3294ba1f074e9c877.tar.gz
openocd_libswd-a585bdf7269ce5c861c83ee3294ba1f074e9c877.tar.bz2
openocd_libswd-a585bdf7269ce5c861c83ee3294ba1f074e9c877.tar.xz
openocd_libswd-a585bdf7269ce5c861c83ee3294ba1f074e9c877.zip
add CMD_NAME macro for command handlers
By introducing the CMD_NAME macro, this parameter may be integrated as args[-1] in command.[ch], without touching any other call sites.
Diffstat (limited to 'src/target')
-rw-r--r--src/target/arm720t.c2
-rw-r--r--src/target/arm920t.c4
-rw-r--r--src/target/arm926ejs.c2
-rw-r--r--src/target/arm966e.c2
-rw-r--r--src/target/cortex_m3.c2
-rw-r--r--src/target/target.c6
-rw-r--r--src/target/xscale.c14
7 files changed, 16 insertions, 16 deletions
diff --git a/src/target/arm720t.c b/src/target/arm720t.c
index 6a5a4e74..af326bf4 100644
--- a/src/target/arm720t.c
+++ b/src/target/arm720t.c
@@ -424,7 +424,7 @@ COMMAND_HANDLER(arm720t_handle_cp15_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
diff --git a/src/target/arm920t.c b/src/target/arm920t.c
index 5576f60f..81f5c6af 100644
--- a/src/target/arm920t.c
+++ b/src/target/arm920t.c
@@ -1203,7 +1203,7 @@ COMMAND_HANDLER(arm920t_handle_cp15_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
@@ -1257,7 +1257,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c
index 6f347d87..77405a87 100644
--- a/src/target/arm926ejs.c
+++ b/src/target/arm926ejs.c
@@ -740,7 +740,7 @@ COMMAND_HANDLER(arm926ejs_handle_cp15_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
diff --git a/src/target/arm966e.c b/src/target/arm966e.c
index e61943a3..62ccaa80 100644
--- a/src/target/arm966e.c
+++ b/src/target/arm966e.c
@@ -174,7 +174,7 @@ COMMAND_HANDLER(arm966e_handle_cp15_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c
index 50842319..86469c4e 100644
--- a/src/target/cortex_m3.c
+++ b/src/target/cortex_m3.c
@@ -1902,7 +1902,7 @@ COMMAND_HANDLER(handle_cortex_m3_mask_interrupts_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
diff --git a/src/target/target.c b/src/target/target.c
index 21c0526f..8cc46ecd 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2046,7 +2046,7 @@ COMMAND_HANDLER(handle_wait_halt_command)
int retval = parse_uint(args[0], &ms);
if (ERROR_OK != retval)
{
- command_print(cmd_ctx, "usage: %s [seconds]", cmd);
+ command_print(cmd_ctx, "usage: %s [seconds]", CMD_NAME);
return ERROR_COMMAND_SYNTAX_ERROR;
}
// convert seconds (given) to milliseconds (needed)
@@ -2256,7 +2256,7 @@ COMMAND_HANDLER(handle_md_command)
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned size = 0;
- switch (cmd[2]) {
+ switch (CMD_NAME[2]) {
case 'w': size = 4; break;
case 'h': size = 2; break;
case 'b': size = 1; break;
@@ -2333,7 +2333,7 @@ COMMAND_HANDLER(handle_mw_command)
target_t *target = get_current_target(cmd_ctx);
unsigned wordsize;
uint8_t value_buf[4];
- switch (cmd[2])
+ switch (CMD_NAME[2])
{
case 'w':
wordsize = 4;
diff --git a/src/target/xscale.c b/src/target/xscale.c
index 6f2d6ee3..e18d5916 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -3127,7 +3127,7 @@ COMMAND_HANDLER(xscale_handle_mmu_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
@@ -3163,13 +3163,13 @@ COMMAND_HANDLER(xscale_handle_idcache_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
- if (strcmp(cmd, "icache") == 0)
+ if (strcmp(CMD_NAME, "icache") == 0)
icache = 1;
- else if (strcmp(cmd, "dcache") == 0)
+ else if (strcmp(CMD_NAME, "dcache") == 0)
dcache = 1;
if (argc >= 1)
@@ -3302,7 +3302,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
@@ -3429,7 +3429,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
@@ -3499,7 +3499,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
if (target->state != TARGET_HALTED)
{
- command_print(cmd_ctx, "target must be stopped for \"%s\" command", cmd);
+ command_print(cmd_ctx, "target must be stopped for \"%s\" command", CMD_NAME);
return ERROR_OK;
}
uint32_t reg_no = 0;