target: change prototype of binprint()

To prepare for handling TCL return values consistently, all calls
to command_print/command_print_sameline should be ready to switch
to CMD as first parameter.

Change prototype of binprint() to pass CMD instead of CMD_CTX.

This change was part of http://openocd.zylin.com/1815 from Paul
Fertser and has been extracted and rebased to simplify the review.

Change-Id: I5ebdc50417d97c791c98ac0cfe2218319809eb7f
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5077
Tested-by: jenkins
bscan_optimization
Paul Fertser 2019-04-01 05:22:35 +02:00 committed by Tomas Vanek
parent 20184ea861
commit fd66dfb61d
1 changed files with 8 additions and 8 deletions

View File

@ -5939,13 +5939,13 @@ COMMAND_HANDLER(handle_ps_command)
}
}
static void binprint(struct command_context *cmd_ctx, const char *text, const uint8_t *buf, int size)
static void binprint(struct command_invocation *cmd, const char *text, const uint8_t *buf, int size)
{
if (text != NULL)
command_print_sameline(cmd_ctx, "%s", text);
command_print_sameline(cmd->ctx, "%s", text);
for (int i = 0; i < size; i++)
command_print_sameline(cmd_ctx, " %02x", buf[i]);
command_print(cmd_ctx, " ");
command_print_sameline(cmd->ctx, " %02x", buf[i]);
command_print(cmd->ctx, " ");
}
COMMAND_HANDLER(handle_test_mem_access_command)
@ -6028,8 +6028,8 @@ COMMAND_HANDLER(handle_test_mem_access_command)
duration_kbps(&bench, count * size));
} else {
command_print(CMD_CTX, "Compare failed");
binprint(CMD_CTX, "ref:", read_ref, host_bufsiz);
binprint(CMD_CTX, "buf:", read_buf, host_bufsiz);
binprint(CMD, "ref:", read_ref, host_bufsiz);
binprint(CMD, "buf:", read_buf, host_bufsiz);
}
next:
free(read_ref);
@ -6114,8 +6114,8 @@ out:
duration_kbps(&bench, count * size));
} else {
command_print(CMD_CTX, "Compare failed");
binprint(CMD_CTX, "ref:", read_ref, num_bytes);
binprint(CMD_CTX, "buf:", read_buf, num_bytes);
binprint(CMD, "ref:", read_ref, num_bytes);
binprint(CMD, "buf:", read_buf, num_bytes);
}
nextw:
free(read_ref);