target/cortex_m: Use 'bool' instead of 'int'

Change-Id: I273d24997e2c844015e144a15981f8f0af522261
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4950
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Marc Schink 2019-02-26 13:40:23 +01:00 committed by Tomas Vanek
parent f426d8dd33
commit 351ef7bf3c
2 changed files with 9 additions and 9 deletions

View File

@ -265,7 +265,7 @@ static int cortex_m_endreset_event(struct target *target)
return retval; return retval;
} }
cortex_m->fpb_enabled = 1; cortex_m->fpb_enabled = true;
/* Restore FPB registers */ /* Restore FPB registers */
for (i = 0; i < cortex_m->fp_num_code + cortex_m->fp_num_lit; i++) { 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"); LOG_ERROR("Unhandled Cortex-M Flash Patch Breakpoint architecture revision");
return ERROR_FAIL; return ERROR_FAIL;
} }
comparator_list[fp_num].used = 1; comparator_list[fp_num].used = true;
comparator_list[fp_num].fpcr_value = fpcr_value; comparator_list[fp_num].fpcr_value = fpcr_value;
target_write_u32(target, comparator_list[fp_num].fpcr_address, target_write_u32(target, comparator_list[fp_num].fpcr_address,
comparator_list[fp_num].fpcr_value); comparator_list[fp_num].fpcr_value);
@ -1195,7 +1195,7 @@ int cortex_m_set_breakpoint(struct target *target, struct breakpoint *breakpoint
return retval; return retval;
} }
cortex_m->fpb_enabled = 1; cortex_m->fpb_enabled = true;
} }
} else if (breakpoint->type == BKPT_SOFT) { } else if (breakpoint->type == BKPT_SOFT) {
uint8_t code[4]; 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"); LOG_DEBUG("Invalid FP Comparator number in breakpoint");
return ERROR_OK; return ERROR_OK;
} }
comparator_list[fp_num].used = 0; comparator_list[fp_num].used = false;
comparator_list[fp_num].fpcr_value = 0; comparator_list[fp_num].fpcr_value = 0;
target_write_u32(target, comparator_list[fp_num].fpcr_address, target_write_u32(target, comparator_list[fp_num].fpcr_address,
comparator_list[fp_num].fpcr_value); 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"); LOG_ERROR("Can not find free DWT Comparator");
return ERROR_FAIL; return ERROR_FAIL;
} }
comparator->used = 1; comparator->used = true;
watchpoint->set = dwt_num + 1; watchpoint->set = dwt_num + 1;
comparator->comp = watchpoint->address; 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 = cortex_m->dwt_comparator_list + dwt_num;
comparator->used = 0; comparator->used = false;
comparator->function = 0; comparator->function = 0;
target_write_u32(target, comparator->dwt_comparator_address + 8, target_write_u32(target, comparator->dwt_comparator_address + 8,
comparator->function); comparator->function);

View File

@ -136,14 +136,14 @@
#define FPCR_REPLACE_BKPT_BOTH (3 << 30) #define FPCR_REPLACE_BKPT_BOTH (3 << 30)
struct cortex_m_fp_comparator { struct cortex_m_fp_comparator {
int used; bool used;
int type; int type;
uint32_t fpcr_value; uint32_t fpcr_value;
uint32_t fpcr_address; uint32_t fpcr_address;
}; };
struct cortex_m_dwt_comparator { struct cortex_m_dwt_comparator {
int used; bool used;
uint32_t comp; uint32_t comp;
uint32_t mask; uint32_t mask;
uint32_t function; uint32_t function;
@ -174,7 +174,7 @@ struct cortex_m_common {
int fp_num_code; int fp_num_code;
int fp_code_available; int fp_code_available;
int fp_rev; int fp_rev;
int fpb_enabled; bool fpb_enabled;
struct cortex_m_fp_comparator *fp_comparator_list; struct cortex_m_fp_comparator *fp_comparator_list;
/* Data Watchpoint and Trace (DWT) */ /* Data Watchpoint and Trace (DWT) */