diff options
author | Marc Schink <dev@zapb.de> | 2021-06-04 14:38:17 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-06-18 23:14:27 +0100 |
commit | da770c4fbb9ea20904caf3fcf4b51d7d064d11a8 (patch) | |
tree | 5bb6fbc68167f0f839aca807a44aeb6f47c3fade | |
parent | 4bb1d8b45ecd768b972efb1e3e9cf6e55336f8fd (diff) | |
download | riscv-openocd-da770c4fbb9ea20904caf3fcf4b51d7d064d11a8.zip riscv-openocd-da770c4fbb9ea20904caf3fcf4b51d7d064d11a8.tar.gz riscv-openocd-da770c4fbb9ea20904caf3fcf4b51d7d064d11a8.tar.bz2 |
Use boolean argument for register_get_by_name()
Change-Id: Ie913630c6ab3b600532d8e375e2fc11ca202cf5e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6295
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
-rw-r--r-- | src/target/armv4_5.c | 4 | ||||
-rw-r--r-- | src/target/armv7m.c | 4 | ||||
-rw-r--r-- | src/target/dsp563xx.c | 4 | ||||
-rw-r--r-- | src/target/mips32.c | 4 | ||||
-rw-r--r-- | src/target/nds32.c | 2 | ||||
-rw-r--r-- | src/target/riscv/riscv.c | 10 | ||||
-rw-r--r-- | src/target/stm8.c | 4 | ||||
-rw-r--r-- | src/target/target.c | 4 |
8 files changed, 18 insertions, 18 deletions
diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index 6378ea6..4e1febe 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -1380,7 +1380,7 @@ int armv4_5_run_algorithm_inner(struct target *target, if (reg_params[i].direction == PARAM_IN) continue; - struct reg *reg = register_get_by_name(arm->core_cache, reg_params[i].reg_name, 0); + struct reg *reg = register_get_by_name(arm->core_cache, reg_params[i].reg_name, false); if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); return ERROR_COMMAND_SYNTAX_ERROR; @@ -1452,7 +1452,7 @@ int armv4_5_run_algorithm_inner(struct target *target, struct reg *reg = register_get_by_name(arm->core_cache, reg_params[i].reg_name, - 0); + false); if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); retval = ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 11770b5..a9a5a38 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -559,7 +559,7 @@ int armv7m_start_algorithm(struct target *target, continue; struct reg *reg = - register_get_by_name(armv7m->arm.core_cache, reg_params[i].reg_name, 0); + register_get_by_name(armv7m->arm.core_cache, reg_params[i].reg_name, false); /* uint32_t regvalue; */ if (!reg) { @@ -675,7 +675,7 @@ int armv7m_wait_algorithm(struct target *target, if (reg_params[i].direction != PARAM_OUT) { struct reg *reg = register_get_by_name(armv7m->arm.core_cache, reg_params[i].reg_name, - 0); + false); if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); diff --git a/src/target/dsp563xx.c b/src/target/dsp563xx.c index 21bed89..81ea21e 100644 --- a/src/target/dsp563xx.c +++ b/src/target/dsp563xx.c @@ -1402,7 +1402,7 @@ static int dsp563xx_run_algorithm(struct target *target, struct reg *reg = register_get_by_name(dsp563xx->core_cache, reg_params[i].reg_name, - 0); + false); if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); @@ -1444,7 +1444,7 @@ static int dsp563xx_run_algorithm(struct target *target, struct reg *reg = register_get_by_name(dsp563xx->core_cache, reg_params[i].reg_name, - 0); + false); if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); continue; diff --git a/src/target/mips32.c b/src/target/mips32.c index e1f2b28..c825369 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -473,7 +473,7 @@ int mips32_run_algorithm(struct target *target, int num_mem_params, if (reg_params[i].direction == PARAM_IN) continue; - struct reg *reg = register_get_by_name(mips32->core_cache, reg_params[i].reg_name, 0); + struct reg *reg = register_get_by_name(mips32->core_cache, reg_params[i].reg_name, false); if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); @@ -507,7 +507,7 @@ int mips32_run_algorithm(struct target *target, int num_mem_params, for (int i = 0; i < num_reg_params; i++) { if (reg_params[i].direction != PARAM_OUT) { - struct reg *reg = register_get_by_name(mips32->core_cache, reg_params[i].reg_name, 0); + struct reg *reg = register_get_by_name(mips32->core_cache, reg_params[i].reg_name, false); if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/nds32.c b/src/target/nds32.c index cc6e2da..d524fc2 100644 --- a/src/target/nds32.c +++ b/src/target/nds32.c @@ -997,7 +997,7 @@ int nds32_arch_state(struct target *target) nds32->virtual_hosting ? ", virtual hosting" : ""); /* save pc value to pseudo register pc */ - struct reg *reg = register_get_by_name(target->reg_cache, "pc", 1); + struct reg *reg = register_get_by_name(target->reg_cache, "pc", true); buf_set_u32(reg->value, 0, 32, value_pc); return ERROR_OK; diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 50535e2..37bc0cc 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -1704,7 +1704,7 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params, } /* Save registers */ - struct reg *reg_pc = register_get_by_name(target->reg_cache, "pc", 1); + struct reg *reg_pc = register_get_by_name(target->reg_cache, "pc", true); if (!reg_pc || reg_pc->type->get(reg_pc) != ERROR_OK) return ERROR_FAIL; uint64_t saved_pc = buf_get_u64(reg_pc->value, 0, reg_pc->size); @@ -1713,7 +1713,7 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params, uint64_t saved_regs[32]; for (int i = 0; i < num_reg_params; i++) { LOG_DEBUG("save %s", reg_params[i].reg_name); - struct reg *r = register_get_by_name(target->reg_cache, reg_params[i].reg_name, 0); + struct reg *r = register_get_by_name(target->reg_cache, reg_params[i].reg_name, false); if (!r) { LOG_ERROR("Couldn't find register named '%s'", reg_params[i].reg_name); return ERROR_FAIL; @@ -1747,7 +1747,7 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params, LOG_DEBUG("Disabling Interrupts"); struct reg *reg_mstatus = register_get_by_name(target->reg_cache, - "mstatus", 1); + "mstatus", true); if (!reg_mstatus) { LOG_ERROR("Couldn't find mstatus!"); return ERROR_FAIL; @@ -1828,7 +1828,7 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params, for (int i = 0; i < num_reg_params; i++) { if (reg_params[i].direction == PARAM_IN || reg_params[i].direction == PARAM_IN_OUT) { - struct reg *r = register_get_by_name(target->reg_cache, reg_params[i].reg_name, 0); + struct reg *r = register_get_by_name(target->reg_cache, reg_params[i].reg_name, false); if (r->type->get(r) != ERROR_OK) { LOG_ERROR("get(%s) failed", r->name); return ERROR_FAIL; @@ -1836,7 +1836,7 @@ static int riscv_run_algorithm(struct target *target, int num_mem_params, buf_cpy(r->value, reg_params[i].value, reg_params[i].size); } LOG_DEBUG("restore %s", reg_params[i].reg_name); - struct reg *r = register_get_by_name(target->reg_cache, reg_params[i].reg_name, 0); + struct reg *r = register_get_by_name(target->reg_cache, reg_params[i].reg_name, false); buf_set_u64(buf, 0, info->xlen[0], saved_regs[r->number]); if (r->type->set(r, buf) != ERROR_OK) { LOG_ERROR("set(%s) failed", r->name); diff --git a/src/target/stm8.c b/src/target/stm8.c index 00b524e..a1653bc 100644 --- a/src/target/stm8.c +++ b/src/target/stm8.c @@ -1876,7 +1876,7 @@ static int stm8_run_algorithm(struct target *target, int num_mem_params, continue; struct reg *reg = register_get_by_name(stm8->core_cache, - reg_params[i].reg_name, 0); + reg_params[i].reg_name, false); if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); @@ -1910,7 +1910,7 @@ static int stm8_run_algorithm(struct target *target, int num_mem_params, for (int i = 0; i < num_reg_params; i++) { if (reg_params[i].direction != PARAM_OUT) { struct reg *reg = register_get_by_name(stm8->core_cache, - reg_params[i].reg_name, 0); + reg_params[i].reg_name, false); if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); diff --git a/src/target/target.c b/src/target/target.c index 450e231..dbc99b4 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2342,7 +2342,7 @@ int target_profiling_default(struct target *target, uint32_t *samples, uint32_t sample_count = 0; /* hopefully it is safe to cache! We want to stop/restart as quickly as possible. */ - struct reg *reg = register_get_by_name(target->reg_cache, "pc", 1); + struct reg *reg = register_get_by_name(target->reg_cache, "pc", true); int retval = ERROR_OK; for (;;) { @@ -3134,7 +3134,7 @@ COMMAND_HANDLER(handle_reg_command) } } else { /* access a single register by its name */ - reg = register_get_by_name(target->reg_cache, CMD_ARGV[0], 1); + reg = register_get_by_name(target->reg_cache, CMD_ARGV[0], true); if (!reg) goto not_found; |