helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should switch to CMD as first parameter. Change prototype of command_print() and command_print_sameline() to pass CMD instead of CMD_CTX. Since the first parameter is currently not used, the change can be done though scripts without manual coding. This patch is created using the command: sed -i PATTERN $(find src/ doc/ -type f) with all the following patters: 's/\(command_print(cmd\)->ctx,/\1,/' 's/\(command_print(CMD\)_CTX,/\1,/' 's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/' 's/\(command_print_sameline(cmd\)->ctx,/\1,/' 's/\(command_print_sameline(CMD\)_CTX,/\1,/' 's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/' This change is inspired by http://openocd.zylin.com/1815 from Paul Fertser but is now done through scripting. Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5081 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
committed by
Tomas Vanek
parent
6916550938
commit
6cb5ba6f11
@@ -103,7 +103,7 @@ static int arm946e_verify_pointer(struct command_invocation *cmd,
|
||||
struct arm946e_common *arm946e)
|
||||
{
|
||||
if (arm946e->common_magic != ARM946E_COMMON_MAGIC) {
|
||||
command_print(cmd->ctx, "target is not an ARM946");
|
||||
command_print(cmd, "target is not an ARM946");
|
||||
return ERROR_TARGET_INVALID;
|
||||
}
|
||||
return ERROR_OK;
|
||||
@@ -563,7 +563,7 @@ COMMAND_HANDLER(arm946e_handle_cp15)
|
||||
return retval;
|
||||
|
||||
if (target->state != TARGET_HALTED) {
|
||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
return ERROR_TARGET_NOT_HALTED;
|
||||
}
|
||||
|
||||
@@ -574,7 +574,7 @@ COMMAND_HANDLER(arm946e_handle_cp15)
|
||||
uint32_t value;
|
||||
retval = arm946e_read_cp15(target, address, &value);
|
||||
if (retval != ERROR_OK) {
|
||||
command_print(CMD_CTX, "%s cp15 reg %" PRIi32 " access failed", target_name(target), address);
|
||||
command_print(CMD, "%s cp15 reg %" PRIi32 " access failed", target_name(target), address);
|
||||
return retval;
|
||||
}
|
||||
retval = jtag_execute_queue();
|
||||
@@ -582,14 +582,14 @@ COMMAND_HANDLER(arm946e_handle_cp15)
|
||||
return retval;
|
||||
|
||||
/* Return value in hex format */
|
||||
command_print(CMD_CTX, "0x%08" PRIx32, value);
|
||||
command_print(CMD, "0x%08" PRIx32, value);
|
||||
} else if (CMD_ARGC == 2) {
|
||||
uint32_t value;
|
||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
|
||||
|
||||
retval = arm946e_write_cp15(target, address, value);
|
||||
if (retval != ERROR_OK) {
|
||||
command_print(CMD_CTX, "%s cp15 reg %" PRIi32 " access failed", target_name(target), address);
|
||||
command_print(CMD, "%s cp15 reg %" PRIi32 " access failed", target_name(target), address);
|
||||
return retval;
|
||||
}
|
||||
if (address == CP15_CTL)
|
||||
@@ -613,7 +613,7 @@ COMMAND_HANDLER(arm946e_handle_idcache)
|
||||
return retval;
|
||||
|
||||
if (target->state != TARGET_HALTED) {
|
||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||
return ERROR_TARGET_NOT_HALTED;
|
||||
}
|
||||
|
||||
@@ -623,9 +623,9 @@ COMMAND_HANDLER(arm946e_handle_idcache)
|
||||
bool bena = ((arm946e->cp15_control_reg & (icache ? CP15_CTL_ICACHE : CP15_CTL_DCACHE)) != 0)
|
||||
&& (arm946e->cp15_control_reg & 0x1);
|
||||
if (csize == 0)
|
||||
command_print(CMD_CTX, "%s-cache absent", icache ? "I" : "D");
|
||||
command_print(CMD, "%s-cache absent", icache ? "I" : "D");
|
||||
else
|
||||
command_print(CMD_CTX, "%s-cache size: %" PRIu32 "K, %s",
|
||||
command_print(CMD, "%s-cache size: %" PRIu32 "K, %s",
|
||||
icache ? "I" : "D", csize, bena ? "enabled" : "disabled");
|
||||
return ERROR_OK;
|
||||
}
|
||||
@@ -643,7 +643,7 @@ COMMAND_HANDLER(arm946e_handle_idcache)
|
||||
|
||||
/* Do not invalidate or change state, if cache is absent */
|
||||
if (csize == 0) {
|
||||
command_print(CMD_CTX, "%s-cache absent, '%s' operation undefined", icache ? "I" : "D", CMD_ARGV[0]);
|
||||
command_print(CMD, "%s-cache absent, '%s' operation undefined", icache ? "I" : "D", CMD_ARGV[0]);
|
||||
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user