From 351ef7bf3cce048ec854c8d19d8af5aa2b97c3a9 Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Tue, 26 Feb 2019 13:40:23 +0100 Subject: [PATCH] target/cortex_m: Use 'bool' instead of 'int' Change-Id: I273d24997e2c844015e144a15981f8f0af522261 Signed-off-by: Marc Schink Reviewed-on: http://openocd.zylin.com/4950 Tested-by: jenkins Reviewed-by: Antonio Borneo --- src/target/cortex_m.c | 12 ++++++------ src/target/cortex_m.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index d751fd854..4bada398d 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -265,7 +265,7 @@ static int cortex_m_endreset_event(struct target *target) return retval; } - cortex_m->fpb_enabled = 1; + cortex_m->fpb_enabled = true; /* Restore FPB registers */ for (i = 0; i < cortex_m->fp_num_code + cortex_m->fp_num_lit; i++) { @@ -1180,7 +1180,7 @@ int cortex_m_set_breakpoint(struct target *target, struct breakpoint *breakpoint LOG_ERROR("Unhandled Cortex-M Flash Patch Breakpoint architecture revision"); return ERROR_FAIL; } - comparator_list[fp_num].used = 1; + comparator_list[fp_num].used = true; comparator_list[fp_num].fpcr_value = fpcr_value; target_write_u32(target, comparator_list[fp_num].fpcr_address, comparator_list[fp_num].fpcr_value); @@ -1195,7 +1195,7 @@ int cortex_m_set_breakpoint(struct target *target, struct breakpoint *breakpoint return retval; } - cortex_m->fpb_enabled = 1; + cortex_m->fpb_enabled = true; } } else if (breakpoint->type == BKPT_SOFT) { uint8_t code[4]; @@ -1254,7 +1254,7 @@ int cortex_m_unset_breakpoint(struct target *target, struct breakpoint *breakpoi LOG_DEBUG("Invalid FP Comparator number in breakpoint"); return ERROR_OK; } - comparator_list[fp_num].used = 0; + comparator_list[fp_num].used = false; comparator_list[fp_num].fpcr_value = 0; target_write_u32(target, comparator_list[fp_num].fpcr_address, comparator_list[fp_num].fpcr_value); @@ -1351,7 +1351,7 @@ int cortex_m_set_watchpoint(struct target *target, struct watchpoint *watchpoint LOG_ERROR("Can not find free DWT Comparator"); return ERROR_FAIL; } - comparator->used = 1; + comparator->used = true; watchpoint->set = dwt_num + 1; comparator->comp = watchpoint->address; @@ -1408,7 +1408,7 @@ int cortex_m_unset_watchpoint(struct target *target, struct watchpoint *watchpoi } comparator = cortex_m->dwt_comparator_list + dwt_num; - comparator->used = 0; + comparator->used = false; comparator->function = 0; target_write_u32(target, comparator->dwt_comparator_address + 8, comparator->function); diff --git a/src/target/cortex_m.h b/src/target/cortex_m.h index 22d9735e5..b375d1111 100644 --- a/src/target/cortex_m.h +++ b/src/target/cortex_m.h @@ -136,14 +136,14 @@ #define FPCR_REPLACE_BKPT_BOTH (3 << 30) struct cortex_m_fp_comparator { - int used; + bool used; int type; uint32_t fpcr_value; uint32_t fpcr_address; }; struct cortex_m_dwt_comparator { - int used; + bool used; uint32_t comp; uint32_t mask; uint32_t function; @@ -174,7 +174,7 @@ struct cortex_m_common { int fp_num_code; int fp_code_available; int fp_rev; - int fpb_enabled; + bool fpb_enabled; struct cortex_m_fp_comparator *fp_comparator_list; /* Data Watchpoint and Trace (DWT) */