summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomek CEDRO <cederom@tlen.pl>2011-06-21 21:56:22 +0200
committerTomek CEDRO <cederom@tlen.pl>2011-06-21 21:56:22 +0200
commit7bf31a6da0224d58fe8c196c5bdb1764790d080c (patch)
tree3c6be7dc66c3b7e68f540b1d25d83bd52b41a634 /src
parente16521d3a16778fdacb62f97611a3b03baa65edc (diff)
downloadopenocd+libswd-7bf31a6da0224d58fe8c196c5bdb1764790d080c.tar.gz
openocd+libswd-7bf31a6da0224d58fe8c196c5bdb1764790d080c.tar.bz2
openocd+libswd-7bf31a6da0224d58fe8c196c5bdb1764790d080c.tar.xz
openocd+libswd-7bf31a6da0224d58fe8c196c5bdb1764790d080c.zip
INTERFACE/SIGNAL: Added "find" option to tcl command interface_signal. Fixed "del" command. Added syntax check. Minor backend cosmetics.
Diffstat (limited to 'src')
-rw-r--r--src/interface/interface.c8
-rw-r--r--src/jtag/adapter.c29
2 files changed, 30 insertions, 7 deletions
diff --git a/src/interface/interface.c b/src/interface/interface.c
index e19bbc5b..1c65a8fe 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -43,9 +43,9 @@ oocd_interface_signal_t *oocd_interface_signal_find(char *name){
LOG_ERROR("Interface does not yet exist!");
return NULL;
}
- // Check if interface signal to work on already exists
+ // Check if interface signal to already exists
if (!jtag_interface->signal){
- LOG_WARNING("There are no signals defined yet.");
+ LOG_DEBUG("No interface signals defined.");
return NULL;
}
// Check if signal name is correct
@@ -64,7 +64,7 @@ oocd_interface_signal_t *oocd_interface_signal_find(char *name){
sig=sig->next;
}
// If signal is not found return null pointer.
- LOG_DEBUG("Signal %s not (yet) on the list.", name);
+ LOG_DEBUG("Signal %s not defined.", name);
return NULL;
}
/** Add new signal to the interface.
@@ -160,7 +160,7 @@ int oocd_interface_signal_del(char *name){
}
// Check if interface any signal exist
if (!jtag_interface->signal){
- LOG_DEBUG("There are no signals defined yet.");
+ LOG_ERROR("Signal list is empty!");
return ERROR_FAIL;
}
diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c
index 00affbdc..628bfaee 100644
--- a/src/jtag/adapter.c
+++ b/src/jtag/adapter.c
@@ -219,6 +219,10 @@ COMMAND_HANDLER(handle_interface_signal_command)
char signame[32];
if (!strncasecmp(CMD_ARGV[0], "add", 3)){
+ if (CMD_ARGC<3){
+ LOG_ERROR("Usage: interface_signal add signal_name signal_mask");
+ return ERROR_FAIL;
+ }
if (!strncpy(signame, CMD_ARGV[1], 32)){
LOG_ERROR("Unable to copy signal name from parameter list!");
return ERROR_FAIL;
@@ -233,8 +237,12 @@ COMMAND_HANDLER(handle_interface_signal_command)
return oocd_interface_signal_add(signame, sigmask);
} else if (!strncasecmp(CMD_ARGV[0], "del", 3)){
+ if (CMD_ARGC<2){
+ LOG_ERROR("Usage: interface_signal del signal_name");
+ return ERROR_FAIL;
+ }
// We are going to delete specified signal.
- return oocd_interface_signal_del(signame);
+ return oocd_interface_signal_del((char *)CMD_ARGV[1]);
} else if (!strncasecmp(CMD_ARGV[0], "list", 4)){
//We are going to list available signals.
@@ -249,6 +257,21 @@ COMMAND_HANDLER(handle_interface_signal_command)
// Also print warning if interface driver does not support bit-baning.
if (!jtag_interface->bitbang) command_print(CMD_CTX, "WARNING: This interface does not support bit-baning!");
return ERROR_OK;
+
+ } else if (!strncasecmp(CMD_ARGV[0], "find", 4)){
+ if (CMD_ARGC<2){
+ LOG_ERROR("Usage: interface_signal find signal_name");
+ return ERROR_FAIL;
+ }
+ // Find the signal and print its details.
+ oocd_interface_signal_t *sig;
+ if ( (sig=oocd_interface_signal_find((char *)CMD_ARGV[1])) != NULL ){
+ command_print(CMD_CTX, "%s: mask=0x%08X value=0x%08X", sig->name, sig->mask, sig->value);
+ return ERROR_OK;
+ }
+ // Or return information and error if not found.
+ command_print(CMD_CTX, "Signal not found!");
+ return ERROR_FAIL;
}
// For unknown parameter print error and return error code.
command_print(CMD_CTX, "Unknown parameter!");
@@ -568,8 +591,8 @@ static const struct command_registration interface_command_handlers[] = {
.name = "interface_signal",
.handler = handle_interface_signal_command,
.mode = COMMAND_ANY,
- .help = "List, Remove or Add interface signal with mask and value",
- .usage = "(add|del|list) signal_name [mask]",
+ .help = "List, Find, Remove and Add interface signal mask",
+ .usage = "(add|del|find|list) signal_name [mask]",
},
{
.name = "reset_config",