diff options
author | Paul Fertser <fercerpav@gmail.com> | 2019-04-01 05:42:24 +0200 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2019-05-14 19:36:53 +0100 |
commit | 7060286175166bb78c803c79121d20dd6eddd693 (patch) | |
tree | b3b576823aaa2c881c43cbdba3a50b01839eefbd /src | |
parent | 3f8f7352d2f64411df6eee48a63c71e7bded6056 (diff) | |
download | riscv-openocd-7060286175166bb78c803c79121d20dd6eddd693.zip riscv-openocd-7060286175166bb78c803c79121d20dd6eddd693.tar.gz riscv-openocd-7060286175166bb78c803c79121d20dd6eddd693.tar.bz2 |
target/esirisc_trace: change prototype of trace dump functions
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 esirisc_trace_dump*() functions 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: Ia43bff112372cbb76e1aea9f59f4a9b6df05c15d
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/5079
Tested-by: jenkins
Reviewed-by: Steven Stallion <sstallion@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/target/esirisc_trace.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/target/esirisc_trace.c b/src/target/esirisc_trace.c index 8df555a..d07a0da 100644 --- a/src/target/esirisc_trace.c +++ b/src/target/esirisc_trace.c @@ -593,7 +593,7 @@ done: return retval; } -static int esirisc_trace_dump(struct command_context *cmd_ctx, const char *filename, +static int esirisc_trace_dump(struct command_invocation *cmd, const char *filename, uint8_t *buffer, uint32_t size) { struct fileio *fileio; @@ -602,24 +602,24 @@ static int esirisc_trace_dump(struct command_context *cmd_ctx, const char *filen retval = fileio_open(&fileio, filename, FILEIO_WRITE, FILEIO_BINARY); if (retval != ERROR_OK) { - command_print(cmd_ctx, "could not open dump file: %s", filename); + command_print(cmd->ctx, "could not open dump file: %s", filename); return retval; } retval = fileio_write(fileio, size, buffer, &size_written); if (retval == ERROR_OK) - command_print(cmd_ctx, "trace data dumped to: %s", filename); + command_print(cmd->ctx, "trace data dumped to: %s", filename); else - command_print(cmd_ctx, "could not write dump file: %s", filename); + command_print(cmd->ctx, "could not write dump file: %s", filename); fileio_close(fileio); return retval; } -static int esirisc_trace_dump_buffer(struct command_context *cmd_ctx, const char *filename) +static int esirisc_trace_dump_buffer(struct command_invocation *cmd, const char *filename) { - struct target *target = get_current_target(cmd_ctx); + struct target *target = get_current_target(cmd->ctx); struct esirisc_common *esirisc = target_to_esirisc(target); struct esirisc_trace *trace_info = &esirisc->trace_info; uint8_t *buffer; @@ -629,7 +629,7 @@ static int esirisc_trace_dump_buffer(struct command_context *cmd_ctx, const char size = esirisc_trace_buffer_size(trace_info); buffer = calloc(1, size); if (buffer == NULL) { - command_print(cmd_ctx, "out of memory"); + command_print(cmd->ctx, "out of memory"); return ERROR_FAIL; } @@ -637,7 +637,7 @@ static int esirisc_trace_dump_buffer(struct command_context *cmd_ctx, const char if (retval != ERROR_OK) goto done; - retval = esirisc_trace_dump(cmd_ctx, filename, buffer, size); + retval = esirisc_trace_dump(cmd, filename, buffer, size); done: free(buffer); @@ -645,16 +645,16 @@ done: return retval; } -static int esirisc_trace_dump_memory(struct command_context *cmd_ctx, const char *filename, +static int esirisc_trace_dump_memory(struct command_invocation *cmd, const char *filename, target_addr_t address, uint32_t size) { - struct target *target = get_current_target(cmd_ctx); + struct target *target = get_current_target(cmd->ctx); uint8_t *buffer; int retval; buffer = calloc(1, size); if (buffer == NULL) { - command_print(cmd_ctx, "out of memory"); + command_print(cmd->ctx, "out of memory"); return ERROR_FAIL; } @@ -662,7 +662,7 @@ static int esirisc_trace_dump_memory(struct command_context *cmd_ctx, const char if (retval != ERROR_OK) goto done; - retval = esirisc_trace_dump(cmd_ctx, filename, buffer, size); + retval = esirisc_trace_dump(cmd, filename, buffer, size); done: free(buffer); @@ -853,12 +853,12 @@ COMMAND_HANDLER(handle_esirisc_trace_dump_command) return ERROR_FAIL; } - return esirisc_trace_dump_buffer(CMD_CTX, CMD_ARGV[0]); + return esirisc_trace_dump_buffer(CMD, CMD_ARGV[0]); } else { COMMAND_PARSE_ADDRESS(CMD_ARGV[0], address); COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], size); - return esirisc_trace_dump_memory(CMD_CTX, CMD_ARGV[2], address, size); + return esirisc_trace_dump_memory(CMD, CMD_ARGV[2], address, size); } } |