aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorHsiangkai Wang <hsiangkai@gmail.com>2013-07-11 10:30:41 +0800
committerSpencer Oliver <spen@spen-soft.co.uk>2013-09-13 19:38:04 +0000
commite8d844a0fd8c4474b2652b9d82d73433bbb01337 (patch)
treeb49fcb075617019478ef78a2c1c3160148bcd583 /src/target
parent24dd226e896a84391a3da383d6a0b542e9934f53 (diff)
downloadriscv-openocd-e8d844a0fd8c4474b2652b9d82d73433bbb01337.zip
riscv-openocd-e8d844a0fd8c4474b2652b9d82d73433bbb01337.tar.gz
riscv-openocd-e8d844a0fd8c4474b2652b9d82d73433bbb01337.tar.bz2
aice: add target name to nds command messages
Change-Id: Ie6c786c6880fb554af54ed27f1c159326f60a701 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1583 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target')
-rw-r--r--src/target/nds32_cmd.c111
1 files changed, 68 insertions, 43 deletions
diff --git a/src/target/nds32_cmd.c b/src/target/nds32_cmd.c
index 0892364..c11df37 100644
--- a/src/target/nds32_cmd.c
+++ b/src/target/nds32_cmd.c
@@ -59,7 +59,8 @@ COMMAND_HANDLER(handle_nds32_dssim_command)
nds32->step_isr_enable = false;
}
- command_print(CMD_CTX, "$INT_MASK.DSSIM: %d", nds32->step_isr_enable);
+ command_print(CMD_CTX, "%s: $INT_MASK.DSSIM: %d", target_name(target),
+ nds32->step_isr_enable);
return ERROR_OK;
}
@@ -89,7 +90,8 @@ COMMAND_HANDLER(handle_nds32_memory_access_command)
aice_memory_access(aice, memory->access_channel);
} else {
- command_print(CMD_CTX, "memory access channel: %s",
+ command_print(CMD_CTX, "%s: memory access channel: %s",
+ target_name(target),
NDS_MEMORY_ACCESS_NAME[memory->access_channel]);
}
@@ -110,12 +112,13 @@ COMMAND_HANDLER(handle_nds32_memory_mode_command)
if (CMD_ARGC > 0) {
if (nds32->edm.access_control == false) {
- command_print(CMD_CTX, "Target does not support ACC_CTL. "
- "Set memory mode to MEMORY");
+ command_print(CMD_CTX, "%s does not support ACC_CTL. "
+ "Set memory mode to MEMORY", target_name(target));
nds32->memory.mode = NDS_MEMORY_SELECT_MEM;
} else if (nds32->edm.direct_access_local_memory == false) {
- command_print(CMD_CTX, "Target does not support direct access "
- "local memory. Set memory mode to MEMORY");
+ command_print(CMD_CTX, "%s does not support direct access "
+ "local memory. Set memory mode to MEMORY",
+ target_name(target));
nds32->memory.mode = NDS_MEMORY_SELECT_MEM;
/* set to ACC_CTL */
@@ -127,12 +130,14 @@ COMMAND_HANDLER(handle_nds32_memory_mode_command)
nds32->memory.mode = NDS_MEMORY_SELECT_MEM;
} else if (strcmp(CMD_ARGV[0], "ilm") == 0) {
if (nds32->memory.ilm_base == 0)
- command_print(CMD_CTX, "Target does not support ILM");
+ command_print(CMD_CTX, "%s does not support ILM",
+ target_name(target));
else
nds32->memory.mode = NDS_MEMORY_SELECT_ILM;
} else if (strcmp(CMD_ARGV[0], "dlm") == 0) {
if (nds32->memory.dlm_base == 0)
- command_print(CMD_CTX, "Target does not support DLM");
+ command_print(CMD_CTX, "%s does not support DLM",
+ target_name(target));
else
nds32->memory.mode = NDS_MEMORY_SELECT_DLM;
}
@@ -142,7 +147,8 @@ COMMAND_HANDLER(handle_nds32_memory_mode_command)
}
}
- command_print(CMD_CTX, "memory mode: %s",
+ command_print(CMD_CTX, "%s: memory mode: %s",
+ target_name(target),
NDS_MEMORY_SELECT_NAME[nds32->memory.mode]);
return ERROR_OK;
@@ -169,41 +175,51 @@ COMMAND_HANDLER(handle_nds32_cache_command)
/* D$ write back */
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_WBALL, 0);
if (result != ERROR_OK) {
- command_print(CMD_CTX, "Write back data cache...failed");
+ command_print(CMD_CTX, "%s: Write back data cache...failed",
+ target_name(target));
return result;
}
- command_print(CMD_CTX, "Write back data cache...done");
+ command_print(CMD_CTX, "%s: Write back data cache...done",
+ target_name(target));
/* D$ invalidate */
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_INVALALL, 0);
if (result != ERROR_OK) {
- command_print(CMD_CTX, "Invalidate data cache...failed");
+ command_print(CMD_CTX, "%s: Invalidate data cache...failed",
+ target_name(target));
return result;
}
- command_print(CMD_CTX, "Invalidate data cache...done");
+ command_print(CMD_CTX, "%s: Invalidate data cache...done",
+ target_name(target));
} else {
if (dcache->line_size == 0)
- command_print(CMD_CTX, "No data cache");
+ command_print(CMD_CTX, "%s: No data cache",
+ target_name(target));
else
- command_print(CMD_CTX, "Data cache disabled");
+ command_print(CMD_CTX, "%s: Data cache disabled",
+ target_name(target));
}
if ((icache->line_size != 0) && (icache->enable == true)) {
/* I$ invalidate */
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1I_INVALALL, 0);
if (result != ERROR_OK) {
- command_print(CMD_CTX, "Invalidate instruction cache...failed");
+ command_print(CMD_CTX, "%s: Invalidate instruction cache...failed",
+ target_name(target));
return result;
}
- command_print(CMD_CTX, "Invalidate instruction cache...done");
+ command_print(CMD_CTX, "%s: Invalidate instruction cache...done",
+ target_name(target));
} else {
if (icache->line_size == 0)
- command_print(CMD_CTX, "No instruction cache");
+ command_print(CMD_CTX, "%s: No instruction cache",
+ target_name(target));
else
- command_print(CMD_CTX, "Instruction cache disabled");
+ command_print(CMD_CTX, "%s: Instruction cache disabled",
+ target_name(target));
}
} else
command_print(CMD_CTX, "No valid parameter");
@@ -228,7 +244,8 @@ COMMAND_HANDLER(handle_nds32_icache_command)
if (CMD_ARGC > 0) {
if (icache->line_size == 0) {
- command_print(CMD_CTX, "No instruction cache");
+ command_print(CMD_CTX, "%s: No instruction cache",
+ target_name(target));
return ERROR_OK;
}
@@ -237,13 +254,16 @@ COMMAND_HANDLER(handle_nds32_icache_command)
/* I$ invalidate */
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1I_INVALALL, 0);
if (result != ERROR_OK) {
- command_print(CMD_CTX, "Invalidate instruction cache...failed");
+ command_print(CMD_CTX, "%s: Invalidate instruction cache...failed",
+ target_name(target));
return result;
}
- command_print(CMD_CTX, "Invalidate instruction cache...done");
+ command_print(CMD_CTX, "%s: Invalidate instruction cache...done",
+ target_name(target));
} else {
- command_print(CMD_CTX, "Instruction cache disabled");
+ command_print(CMD_CTX, "%s: Instruction cache disabled",
+ target_name(target));
}
} else if (strcmp(CMD_ARGV[0], "enable") == 0) {
uint32_t value;
@@ -256,7 +276,7 @@ COMMAND_HANDLER(handle_nds32_icache_command)
} else if (strcmp(CMD_ARGV[0], "dump") == 0) {
/* TODO: dump cache content */
} else {
- command_print(CMD_CTX, "No valid parameter");
+ command_print(CMD_CTX, "%s: No valid parameter", target_name(target));
}
}
@@ -279,7 +299,7 @@ COMMAND_HANDLER(handle_nds32_dcache_command)
if (CMD_ARGC > 0) {
if (dcache->line_size == 0) {
- command_print(CMD_CTX, "No data cache");
+ command_print(CMD_CTX, "%s: No data cache", target_name(target));
return ERROR_OK;
}
@@ -288,22 +308,27 @@ COMMAND_HANDLER(handle_nds32_dcache_command)
/* D$ write back */
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_WBALL, 0);
if (result != ERROR_OK) {
- command_print(CMD_CTX, "Write back data cache...failed");
+ command_print(CMD_CTX, "%s: Write back data cache...failed",
+ target_name(target));
return result;
}
- command_print(CMD_CTX, "Write back data cache...done");
+ command_print(CMD_CTX, "%s: Write back data cache...done",
+ target_name(target));
/* D$ invalidate */
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_INVALALL, 0);
if (result != ERROR_OK) {
- command_print(CMD_CTX, "Invalidate data cache...failed");
+ command_print(CMD_CTX, "%s: Invalidate data cache...failed",
+ target_name(target));
return result;
}
- command_print(CMD_CTX, "Invalidate data cache...done");
+ command_print(CMD_CTX, "%s: Invalidate data cache...done",
+ target_name(target));
} else {
- command_print(CMD_CTX, "Data cache disabled");
+ command_print(CMD_CTX, "%s: Data cache disabled",
+ target_name(target));
}
} else if (strcmp(CMD_ARGV[0], "enable") == 0) {
uint32_t value;
@@ -316,7 +341,7 @@ COMMAND_HANDLER(handle_nds32_dcache_command)
} else if (strcmp(CMD_ARGV[0], "dump") == 0) {
/* TODO: dump cache content */
} else {
- command_print(CMD_CTX, "No valid parameter");
+ command_print(CMD_CTX, "%s: No valid parameter", target_name(target));
}
}
@@ -341,9 +366,11 @@ COMMAND_HANDLER(handle_nds32_auto_break_command)
}
if (nds32->auto_convert_hw_bp)
- command_print(CMD_CTX, "convert sw break to hw break on ROM: on");
+ command_print(CMD_CTX, "%s: convert sw break to hw break on ROM: on",
+ target_name(target));
else
- command_print(CMD_CTX, "convert sw break to hw break on ROM: off");
+ command_print(CMD_CTX, "%s: convert sw break to hw break on ROM: off",
+ target_name(target));
return ERROR_OK;
}
@@ -366,9 +393,9 @@ COMMAND_HANDLER(handle_nds32_virtual_hosting_command)
}
if (nds32->virtual_hosting)
- LOG_INFO("virtual hosting: on");
+ command_print(CMD_CTX, "%s: virtual hosting: on", target_name(target));
else
- LOG_INFO("virtual hosting: off");
+ command_print(CMD_CTX, "%s: virtual hosting: off", target_name(target));
return ERROR_OK;
}
@@ -391,9 +418,9 @@ COMMAND_HANDLER(handle_nds32_global_stop_command)
}
if (nds32->global_stop)
- LOG_INFO("global stop: on");
+ LOG_INFO("%s: global stop: on", target_name(target));
else
- LOG_INFO("global stop: off");
+ LOG_INFO("%s: global stop: off", target_name(target));
return ERROR_OK;
}
@@ -416,9 +443,9 @@ COMMAND_HANDLER(handle_nds32_soft_reset_halt_command)
}
if (nds32->soft_reset_halt)
- LOG_INFO("soft-reset-halt: on");
+ LOG_INFO("%s: soft-reset-halt: on", target_name(target));
else
- LOG_INFO("soft-reset-halt: off");
+ LOG_INFO("%s: soft-reset-halt: off", target_name(target));
return ERROR_OK;
}
@@ -451,8 +478,6 @@ COMMAND_HANDLER(handle_nds32_login_edm_passcode_command)
nds32->edm_passcode = strdup(CMD_ARGV[0]);
- LOG_INFO("set EDM passcode: %s", nds32->edm_passcode);
-
return ERROR_OK;
}
@@ -632,9 +657,9 @@ COMMAND_HANDLER(handle_nds32_query_endian_command)
nds32_get_mapped_reg(nds32, IR0, &value_psw);
if (value_psw & 0x20)
- command_print(CMD_CTX, "BE");
+ command_print(CMD_CTX, "%s: BE", target_name(target));
else
- command_print(CMD_CTX, "LE");
+ command_print(CMD_CTX, "%s: LE", target_name(target));
return ERROR_OK;
}