From e43979e7020ea9d05a3c0a2af444f292eacb6c53 Mon Sep 17 00:00:00 2001 From: zwelch Date: Tue, 23 Jun 2009 22:35:09 +0000 Subject: - Replace 'if(' with 'if ('. git-svn-id: svn://svn.berlios.de/openocd/trunk@2357 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/target/arm720t.c | 6 +- src/target/arm7_9_common.c | 38 ++++---- src/target/arm7tdmi.c | 12 +-- src/target/arm_jtag.c | 4 +- src/target/arm_simulator.c | 16 ++-- src/target/armv7m.c | 6 +- src/target/cortex_m3.c | 8 +- src/target/feroceon.c | 2 +- src/target/image.c | 6 +- src/target/mips32_pracc.c | 4 +- src/target/mips_ejtag.c | 4 +- src/target/mips_m4k.c | 12 +-- src/target/oocd_trace.c | 2 +- src/target/target.c | 232 ++++++++++++++++++++++----------------------- src/target/xscale.c | 18 ++-- 15 files changed, 185 insertions(+), 185 deletions(-) (limited to 'src/target') diff --git a/src/target/arm720t.c b/src/target/arm720t.c index afa5599c..cdc5fd77 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -97,11 +97,11 @@ int arm720t_scan_cp15(target_t *target, uint32_t out, uint32_t *in, int instruct buf_set_u32(out_buf, 0, 32, flip_u32(out, 32)); jtag_set_end_state(TAP_DRPAUSE); - if((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK) + if ((retval = arm_jtag_scann(jtag_info, 0xf)) != ERROR_OK) { return retval; } - if((retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL)) != ERROR_OK) + if ((retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL)) != ERROR_OK) { return retval; } @@ -130,7 +130,7 @@ int arm720t_scan_cp15(target_t *target, uint32_t out, uint32_t *in, int instruct jtag_add_runtest(0, jtag_get_end_state()); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ - if((retval = jtag_execute_queue()) != ERROR_OK) + if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; } diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 58c16d92..48ba007e 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -469,7 +469,7 @@ int arm7_9_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint) armv4_5_common_t *armv4_5 = target->arch_info; arm7_9_common_t *arm7_9 = armv4_5->arch_info; - if((retval = arm7_9_unset_breakpoint(target, breakpoint)) != ERROR_OK) + if ((retval = arm7_9_unset_breakpoint(target, breakpoint)) != ERROR_OK) { return retval; } @@ -481,7 +481,7 @@ int arm7_9_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint) if (arm7_9->breakpoint_count==0) { /* make sure we don't have any dangling breakpoints */ - if((retval = arm7_9_clear_watchpoints(arm7_9)) != ERROR_OK) + if ((retval = arm7_9_clear_watchpoints(arm7_9)) != ERROR_OK) { return retval; } @@ -526,12 +526,12 @@ int arm7_9_set_watchpoint(struct target_s *target, watchpoint_t *watchpoint) embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_VALUE], watchpoint->address); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_MASK], mask); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_MASK], watchpoint->mask); - if( watchpoint->mask != 0xffffffffu ) + if ( watchpoint->mask != 0xffffffffu ) embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_VALUE], watchpoint->value); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], 0xff & ~EICE_W_CTRL_nOPC & ~rw_mask); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE | EICE_W_CTRL_nOPC | (watchpoint->rw & 1)); - if((retval = jtag_execute_queue()) != ERROR_OK) + if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; } @@ -543,12 +543,12 @@ int arm7_9_set_watchpoint(struct target_s *target, watchpoint_t *watchpoint) embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_VALUE], watchpoint->address); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_MASK], mask); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_MASK], watchpoint->mask); - if( watchpoint->mask != 0xffffffffu ) + if ( watchpoint->mask != 0xffffffffu ) embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_VALUE], watchpoint->value); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_MASK], 0xff & ~EICE_W_CTRL_nOPC & ~rw_mask); embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE], EICE_W_CTRL_ENABLE | EICE_W_CTRL_nOPC | (watchpoint->rw & 1)); - if((retval = jtag_execute_queue()) != ERROR_OK) + if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; } @@ -593,7 +593,7 @@ int arm7_9_unset_watchpoint(struct target_s *target, watchpoint_t *watchpoint) if (watchpoint->set == 1) { embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], 0x0); - if((retval = jtag_execute_queue()) != ERROR_OK) + if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; } @@ -602,7 +602,7 @@ int arm7_9_unset_watchpoint(struct target_s *target, watchpoint_t *watchpoint) else if (watchpoint->set == 2) { embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE], 0x0); - if((retval = jtag_execute_queue()) != ERROR_OK) + if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; } @@ -663,7 +663,7 @@ int arm7_9_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint) if (watchpoint->set) { - if((retval = arm7_9_unset_watchpoint(target, watchpoint)) != ERROR_OK) + if ((retval = arm7_9_unset_watchpoint(target, watchpoint)) != ERROR_OK) { return retval; } @@ -1942,7 +1942,7 @@ void arm7_9_enable_eice_step(target_t *target, uint32_t next_pc) uint32_t current_pc; current_pc = buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32); - if(next_pc != current_pc) + if (next_pc != current_pc) { /* setup an inverse breakpoint on the current PC * - comparator 1 matches the current address @@ -2297,7 +2297,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size, retval = arm7_9_execute_fast_sys_speed(target); else retval = arm7_9_execute_sys_speed(target); - if(retval != ERROR_OK) + if (retval != ERROR_OK) { return retval; } @@ -2335,7 +2335,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size, retval = arm7_9_execute_fast_sys_speed(target); else retval = arm7_9_execute_sys_speed(target); - if(retval != ERROR_OK) + if (retval != ERROR_OK) { return retval; } @@ -2451,7 +2451,7 @@ int arm7_9_write_memory(struct target_s *target, uint32_t address, uint32_t size retval = arm7_9_execute_fast_sys_speed(target); else retval = arm7_9_execute_sys_speed(target); - if(retval != ERROR_OK) + if (retval != ERROR_OK) { return retval; } @@ -2487,7 +2487,7 @@ int arm7_9_write_memory(struct target_s *target, uint32_t address, uint32_t size retval = arm7_9_execute_fast_sys_speed(target); else retval = arm7_9_execute_sys_speed(target); - if(retval != ERROR_OK) + if (retval != ERROR_OK) { return retval; } @@ -2522,7 +2522,7 @@ int arm7_9_write_memory(struct target_s *target, uint32_t address, uint32_t size retval = arm7_9_execute_fast_sys_speed(target); else retval = arm7_9_execute_sys_speed(target); - if(retval != ERROR_OK) + if (retval != ERROR_OK) { return retval; } @@ -2608,7 +2608,7 @@ static int arm7_9_dcc_completion(struct target_s *target, uint32_t exit_point, i } } - if((retval = target_halt(target))!= ERROR_OK) + if ((retval = target_halt(target))!= ERROR_OK) { return retval; } @@ -3087,7 +3087,7 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9) arm7_9->common_magic = ARM7_9_COMMON_MAGIC; - if((retval = arm_jtag_setup_connection(&arm7_9->jtag_info)) != ERROR_OK) + if ((retval = arm_jtag_setup_connection(&arm7_9->jtag_info)) != ERROR_OK) { return retval; } @@ -3120,12 +3120,12 @@ int arm7_9_init_arch_info(target_t *target, arm7_9_common_t *arm7_9) armv4_5->write_core_reg = arm7_9_write_core_reg; armv4_5->full_context = arm7_9_full_context; - if((retval = armv4_5_init_arch_info(target, armv4_5)) != ERROR_OK) + if ((retval = armv4_5_init_arch_info(target, armv4_5)) != ERROR_OK) { return retval; } - if((retval = target_register_timer_callback(arm7_9_handle_target_request, 1, 1, target)) != ERROR_OK) + if ((retval = target_register_timer_callback(arm7_9_handle_target_request, 1, 1, target)) != ERROR_OK) { return retval; } diff --git a/src/target/arm7tdmi.c b/src/target/arm7tdmi.c index 02886c36..32f18309 100644 --- a/src/target/arm7tdmi.c +++ b/src/target/arm7tdmi.c @@ -110,14 +110,14 @@ int arm7tdmi_examine_debug_reason(target_t *target) fields[1].out_value = NULL; fields[1].in_value = databus; - if((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK) + if ((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK) { return retval; } arm_jtag_set_instr(&arm7_9->jtag_info, arm7_9->jtag_info.intest_instr, NULL); jtag_add_dr_scan(2, fields, jtag_set_end_state(TAP_DRPAUSE)); - if((retval = jtag_execute_queue()) != ERROR_OK) + if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; } @@ -171,7 +171,7 @@ int arm7tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in) scan_field_t fields[2]; jtag_set_end_state(TAP_DRPAUSE); - if((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK) + if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK) { return retval; } @@ -195,7 +195,7 @@ int arm7tdmi_clock_data_in(arm_jtag_t *jtag_info, uint32_t *in) #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { - if((retval = jtag_execute_queue()) != ERROR_OK) + if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; } @@ -262,7 +262,7 @@ int arm7tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, scan_field_t fields[2]; jtag_set_end_state(TAP_DRPAUSE); - if((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK) + if ((retval = arm_jtag_scann(jtag_info, 0x1)) != ERROR_OK) { return retval; } @@ -286,7 +286,7 @@ int arm7tdmi_clock_data_in_endianness(arm_jtag_t *jtag_info, void *in, int size, #ifdef _DEBUG_INSTRUCTION_EXECUTION_ { - if((retval = jtag_execute_queue()) != ERROR_OK) + if ((retval = jtag_execute_queue()) != ERROR_OK) { return retval; } diff --git a/src/target/arm_jtag.c b/src/target/arm_jtag.c index f38b7c58..2db49e52 100644 --- a/src/target/arm_jtag.c +++ b/src/target/arm_jtag.c @@ -69,7 +69,7 @@ int arm_jtag_set_instr(arm_jtag_t *jtag_info, uint32_t new_instr, void *no_veri int arm_jtag_scann(arm_jtag_t *jtag_info, uint32_t new_scan_chain) { int retval = ERROR_OK; - if(jtag_info->cur_scan_chain != new_scan_chain) + if (jtag_info->cur_scan_chain != new_scan_chain) { uint32_t values[1]; int num_bits[1]; @@ -77,7 +77,7 @@ int arm_jtag_scann(arm_jtag_t *jtag_info, uint32_t new_scan_chain) values[0]=new_scan_chain; num_bits[0]=jtag_info->scann_size; - if((retval = arm_jtag_set_instr(jtag_info, jtag_info->scann_instr, NULL)) != ERROR_OK) + if ((retval = arm_jtag_set_instr(jtag_info, jtag_info->scann_instr, NULL)) != ERROR_OK) { return retval; } diff --git a/src/target/arm_simulator.c b/src/target/arm_simulator.c index afea204d..6de9e513 100644 --- a/src/target/arm_simulator.c +++ b/src/target/arm_simulator.c @@ -280,11 +280,11 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc) uint32_t opcode; /* get current instruction, and identify it */ - if((retval = target_read_u32(target, current_pc, &opcode)) != ERROR_OK) + if ((retval = target_read_u32(target, current_pc, &opcode)) != ERROR_OK) { return retval; } - if((retval = arm_evaluate_opcode(opcode, current_pc, &instruction)) != ERROR_OK) + if ((retval = arm_evaluate_opcode(opcode, current_pc, &instruction)) != ERROR_OK) { return retval; } @@ -309,11 +309,11 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc) { uint16_t opcode; - if((retval = target_read_u16(target, current_pc, &opcode)) != ERROR_OK) + if ((retval = target_read_u16(target, current_pc, &opcode)) != ERROR_OK) { return retval; } - if((retval = thumb_evaluate_opcode(opcode, current_pc, &instruction)) != ERROR_OK) + if ((retval = thumb_evaluate_opcode(opcode, current_pc, &instruction)) != ERROR_OK) { return retval; } @@ -350,7 +350,7 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc) else { target = buf_get_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, instruction.info.b_bl_bx_blx.reg_operand).value, 0, 32); - if(instruction.info.b_bl_bx_blx.reg_operand == 15) + if (instruction.info.b_bl_bx_blx.reg_operand == 15) { target += 2 * instruction_size; } @@ -545,9 +545,9 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc) load_address = Rn; } - if((!dry_run_pc) || (instruction.info.load_store.Rd == 15)) + if ((!dry_run_pc) || (instruction.info.load_store.Rd == 15)) { - if((retval = target_read_u32(target, load_address, &load_value)) != ERROR_OK) + if ((retval = target_read_u32(target, load_address, &load_value)) != ERROR_OK) { return retval; } @@ -614,7 +614,7 @@ int arm_simulate_step(target_t *target, uint32_t *dry_run_pc) { if (instruction.info.load_store_multiple.register_list & (1 << i)) { - if((!dry_run_pc) || (i == 15)) + if ((!dry_run_pc) || (i == 15)) { target_read_u32(target, Rn, &load_values[i]); } diff --git a/src/target/armv7m.c b/src/target/armv7m.c index b5d358c4..eef9b500 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -295,7 +295,7 @@ static int armv7m_run_and_wait(struct target_s *target, uint32_t entry_point, in int retval; /* This code relies on the target specific resume() and poll()->debug_entry() * sequence to write register values to the processor and the read them back */ - if((retval = target_resume(target, 0, entry_point, 1, 1)) != ERROR_OK) + if ((retval = target_resume(target, 0, entry_point, 1, 1)) != ERROR_OK) { return retval; } @@ -409,7 +409,7 @@ int armv7m_run_algorithm(struct target_s *target, int num_mem_params, mem_param_ for (i = 0; i < num_mem_params; i++) { if (mem_params[i].direction != PARAM_OUT) - if((retval = target_read_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK) + if ((retval = target_read_buffer(target, mem_params[i].address, mem_params[i].size, mem_params[i].value)) != ERROR_OK) { return retval; } @@ -600,7 +600,7 @@ int armv7m_checksum_memory(struct target_s *target, uint32_t address, uint32_t c /* convert flash writing code into a buffer in target endianness */ for (i = 0; i < (sizeof(cortex_m3_crc_code)/sizeof(uint16_t)); i++) - if((retval = target_write_u16(target, crc_algorithm->address + i*sizeof(uint16_t), cortex_m3_crc_code[i])) != ERROR_OK) + if ((retval = target_write_u16(target, crc_algorithm->address + i*sizeof(uint16_t), cortex_m3_crc_code[i])) != ERROR_OK) { return retval; } diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 7bdd1222..1ffa604b 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -932,11 +932,11 @@ int cortex_m3_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint) { uint8_t code[4]; buf_set_u32(code, 0, 32, ARMV7M_T_BKPT(0x11)); - if((retval = target_read_memory(target, breakpoint->address & 0xFFFFFFFE, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_read_memory(target, breakpoint->address & 0xFFFFFFFE, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } - if((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, breakpoint->length, 1, code)) != ERROR_OK) + if ((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, breakpoint->length, 1, code)) != ERROR_OK) { return retval; } @@ -977,14 +977,14 @@ int cortex_m3_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint /* restore original instruction (kept in target endianness) */ if (breakpoint->length == 4) { - if((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, 4, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, 4, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } } else { - if((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, 2, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_write_memory(target, breakpoint->address & 0xFFFFFFFE, 2, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } diff --git a/src/target/feroceon.c b/src/target/feroceon.c index 66cf005f..0dc26dc0 100644 --- a/src/target/feroceon.c +++ b/src/target/feroceon.c @@ -566,7 +566,7 @@ int feroceon_bulk_write_memory(target_t *target, uint32_t address, uint32_t coun target_buffer_set_u32(target, dcc_code_buf + i*4, dcc_code[i]); /* write DCC code to working area */ - if((retval = target_write_memory(target, arm7_9->dcc_working_area->address, 4, dcc_size/4, dcc_code_buf)) != ERROR_OK) + if ((retval = target_write_memory(target, arm7_9->dcc_working_area->address, 4, dcc_size/4, dcc_code_buf)) != ERROR_OK) { return retval; } diff --git a/src/target/image.c b/src/target/image.c index f463ae62..c6f3df52 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -345,7 +345,7 @@ static int image_elf_read_headers(image_t *image) elf->header = malloc(sizeof(Elf32_Ehdr)); - if(elf->header == NULL) + if (elf->header == NULL) { LOG_ERROR("insufficient memory to perform operation "); return ERROR_FILEIO_OPERATION_FAILED; @@ -395,7 +395,7 @@ static int image_elf_read_headers(image_t *image) } elf->segments = malloc(elf->segment_count*sizeof(Elf32_Phdr)); - if(elf->segments == NULL) + if (elf->segments == NULL) { LOG_ERROR("insufficient memory to perform operation "); return ERROR_FILEIO_OPERATION_FAILED; @@ -636,7 +636,7 @@ static int image_mot_buffer_complete(image_t *image) cal_checksum += (uint8_t)checksum; bytes_read += 2; - if( cal_checksum != 0xFF ) + if ( cal_checksum != 0xFF ) { /* checksum failed */ LOG_ERROR("incorrect record checksum found in S19 file"); diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c index 61a0ae54..4e032f65 100644 --- a/src/target/mips32_pracc.c +++ b/src/target/mips32_pracc.c @@ -278,7 +278,7 @@ int mips32_pracc_read_mem(mips_ejtag_t *ejtag_info, uint32_t addr, int size, int case 2: return mips32_pracc_read_mem16(ejtag_info, addr, count, (uint16_t*)buf); case 4: - if(count==1) + if (count==1) return mips32_pracc_read_u32(ejtag_info, addr, (uint32_t*)buf); else return mips32_pracc_read_mem32(ejtag_info, addr, count, (uint32_t*)buf); @@ -562,7 +562,7 @@ int mips32_pracc_write_mem(mips_ejtag_t *ejtag_info, uint32_t addr, int size, in case 2: return mips32_pracc_write_mem16(ejtag_info, addr, count,(uint16_t*)buf); case 4: - if(count==1) + if (count==1) return mips32_pracc_write_u32(ejtag_info, addr, (uint32_t*)buf); else return mips32_pracc_write_mem32(ejtag_info, addr, count, (uint32_t*)buf); diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c index eebd5fb7..5985cfd3 100644 --- a/src/target/mips_ejtag.c +++ b/src/target/mips_ejtag.c @@ -212,7 +212,7 @@ int mips_ejtag_enter_debug(mips_ejtag_t *ejtag_info) ejtag_ctrl = ejtag_info->ejtag_ctrl; mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl); LOG_DEBUG("ejtag_ctrl: 0x%8.8" PRIx32 "", ejtag_ctrl); - if((ejtag_ctrl & EJTAG_CTRL_BRKST) == 0) + if ((ejtag_ctrl & EJTAG_CTRL_BRKST) == 0) LOG_DEBUG("Failed to enter Debug Mode!"); return ERROR_OK; @@ -294,7 +294,7 @@ int mips_ejtag_init(mips_ejtag_t *ejtag_info) ejtag_info->impcode & (1<<0) ? " MIPS64": " MIPS32" ); - if((ejtag_info->impcode & (1<<14)) == 0) + if ((ejtag_info->impcode & (1<<14)) == 0) LOG_DEBUG("EJTAG: DMA Access Mode Support Enabled"); /* set initial state for ejtag control reg */ diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index 6eb6ad84..be88df84 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -531,7 +531,7 @@ int mips_m4k_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint) { uint32_t verify = 0xffffffff; - if((retval = target_read_memory(target, breakpoint->address, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_read_memory(target, breakpoint->address, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } @@ -554,7 +554,7 @@ int mips_m4k_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint) { uint16_t verify = 0xffff; - if((retval = target_read_memory(target, breakpoint->address, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_read_memory(target, breakpoint->address, breakpoint->length, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } @@ -619,7 +619,7 @@ int mips_m4k_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint) } if (current_instr == MIPS32_SDBBP) { - if((retval = target_write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } @@ -637,7 +637,7 @@ int mips_m4k_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint) if (current_instr == MIPS16_SDBBP) { - if((retval = target_write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } @@ -750,7 +750,7 @@ int mips_m4k_read_memory(struct target_s *target, uint32_t address, uint32_t siz /* if noDMA off, use DMAACC mode for memory read */ int retval; - if(ejtag_info->impcode & EJTAG_IMP_NODMA) + if (ejtag_info->impcode & EJTAG_IMP_NODMA) retval = mips32_pracc_read_mem(ejtag_info, address, size, count, (void *)buffer); else retval = mips32_dmaacc_read_mem(ejtag_info, address, size, count, (void *)buffer); @@ -825,7 +825,7 @@ int mips_m4k_write_memory(struct target_s *target, uint32_t address, uint32_t si } /* if noDMA off, use DMAACC mode for memory write */ - if(ejtag_info->impcode & EJTAG_IMP_NODMA) + if (ejtag_info->impcode & EJTAG_IMP_NODMA) return mips32_pracc_write_mem(ejtag_info, address, size, count, (void *)buffer); else return mips32_dmaacc_write_mem(ejtag_info, address, size, count, (void *)buffer); diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c index f7af10d2..3edfdc0b 100644 --- a/src/target/oocd_trace.c +++ b/src/target/oocd_trace.c @@ -104,7 +104,7 @@ static int oocd_trace_init(etm_context_t *etm_ctx) oocd_trace->tty_fd = open(oocd_trace->tty, O_RDWR | O_NOCTTY | O_NONBLOCK); - if(oocd_trace->tty_fd < 0) + if (oocd_trace->tty_fd < 0) { LOG_ERROR("can't open tty"); return ERROR_ETM_CAPTURE_INIT_FAILED; diff --git a/src/target/target.c b/src/target/target.c index b7917cad..3505f9c2 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -144,7 +144,7 @@ const char *target_strerror_safe( int err ) const Jim_Nvp *n; n = Jim_Nvp_value2name_simple( nvp_error_target, err ); - if( n->name == NULL ){ + if ( n->name == NULL ){ return "unknown"; } else { return n->name; @@ -245,7 +245,7 @@ static int max_target_number(void) x = -1; t = all_targets; while( t ){ - if( x < t->target_number ){ + if ( x < t->target_number ){ x = (t->target_number)+1; } t = t->next; @@ -263,7 +263,7 @@ static int new_target_number(void) x = -1; t = all_targets; while(t){ - if( x < t->target_number ){ + if ( x < t->target_number ){ x = t->target_number; } t = t->next; @@ -353,7 +353,7 @@ static target_t *get_target_by_num(int num) target_t *target = all_targets; while (target){ - if( target->target_number == num ){ + if ( target->target_number == num ){ return target; } target = target->next; @@ -429,7 +429,7 @@ int target_process_reset(struct command_context_s *cmd_ctx, enum target_reset_mo int retval; Jim_Nvp *n; n = Jim_Nvp_value2name_simple( nvp_reset_modes, reset_mode ); - if( n->name == NULL ){ + if ( n->name == NULL ){ LOG_ERROR("invalid reset mode"); return ERROR_FAIL; } @@ -446,7 +446,7 @@ int target_process_reset(struct command_context_s *cmd_ctx, enum target_reset_mo target_continuous_poll = save_poll; - if(retval != JIM_OK) { + if (retval != JIM_OK) { Jim_PrintErrorMessage(interp); return ERROR_FAIL; } @@ -685,9 +685,9 @@ int target_init(struct command_context_s *cmd_ctx) if (all_targets) { - if((retval = target_register_user_commands(cmd_ctx)) != ERROR_OK) + if ((retval = target_register_user_commands(cmd_ctx)) != ERROR_OK) return retval; - if((retval = target_register_timer_callback(handle_target, 100, 1, NULL)) != ERROR_OK) + if ((retval = target_register_timer_callback(handle_target, 100, 1, NULL)) != ERROR_OK) return retval; } @@ -983,7 +983,7 @@ int target_alloc_working_area(struct target_s *target, uint32_t size, working_ar { int retval; new_wa->backup = malloc(new_wa->size); - if((retval = target_read_memory(target, new_wa->address, 4, new_wa->size / 4, new_wa->backup)) != ERROR_OK) + if ((retval = target_read_memory(target, new_wa->address, 4, new_wa->size / 4, new_wa->backup)) != ERROR_OK) { free(new_wa->backup); free(new_wa); @@ -1017,7 +1017,7 @@ int target_free_working_area_restore(struct target_s *target, working_area_t *ar if (restore&&target->backup_working_area) { int retval; - if((retval = target_write_memory(target, area->address, 4, area->size / 4, area->backup)) != ERROR_OK) + if ((retval = target_write_memory(target, area->address, 4, area->size / 4, area->backup)) != ERROR_OK) return retval; } @@ -1504,9 +1504,9 @@ int target_register_user_commands(struct command_context_s *cmd_ctx) register_command(cmd_ctx, NULL, "verify_image", handle_verify_image_command, COMMAND_EXEC, "verify_image [offset] [type]"); register_command(cmd_ctx, NULL, "test_image", handle_test_image_command, COMMAND_EXEC, "test_image [offset] [type]"); - if((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK) + if ((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK) return retval; - if((retval = trace_register_commands(cmd_ctx)) != ERROR_OK) + if ((retval = trace_register_commands(cmd_ctx)) != ERROR_OK) return retval; return retval; @@ -1703,7 +1703,7 @@ int handle_target(void *priv) if (!powerDropout && !srstAsserted) { /* polling may fail silently until the target has been examined */ - if((retval = target_poll(target)) != ERROR_OK) + if ((retval = target_poll(target)) != ERROR_OK) return retval; } } @@ -1983,7 +1983,7 @@ static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, ch { const Jim_Nvp *n; n = Jim_Nvp_name2value_simple( nvp_reset_modes, args[0] ); - if( (n->name == NULL) || (n->value == RESET_UNKNOWN) ){ + if ( (n->name == NULL) || (n->value == RESET_UNKNOWN) ){ return ERROR_COMMAND_SYNTAX_ERROR; } reset_mode = n->value; @@ -2308,7 +2308,7 @@ static int handle_load_image_command(struct command_context_s *cmd_ctx, char *cm free(buffer); } - if((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) + if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) { image_close(&image); return retvaltemp; @@ -2384,10 +2384,10 @@ static int handle_dump_image_command(struct command_context_s *cmd_ctx, char *cm address += this_run_size; } - if((retvaltemp = fileio_close(&fileio)) != ERROR_OK) + if ((retvaltemp = fileio_close(&fileio)) != ERROR_OK) return retvaltemp; - if((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) + if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) return retvaltemp; if (retval==ERROR_OK) @@ -2476,13 +2476,13 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct image_calculate_checksum( buffer, buf_cnt, &checksum ); retval = target_checksum_memory(target, image.sections[i].base_address, buf_cnt, &mem_checksum); - if( retval != ERROR_OK ) + if ( retval != ERROR_OK ) { free(buffer); break; } - if( checksum != mem_checksum ) + if ( checksum != mem_checksum ) { /* failed crc checksum, fall back to a binary compare */ uint8_t *data; @@ -2538,7 +2538,7 @@ static int handle_verify_image_command_internal(struct command_context_s *cmd_ct } done: - if((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) + if ((retvaltemp = duration_stop_measure(&duration, &duration_text)) != ERROR_OK) { image_close(&image); return retvaltemp; @@ -2938,7 +2938,7 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, } else if (target->state == TARGET_RUNNING) { /* We want to quickly sample the PC. */ - if((retval = target_halt(target)) != ERROR_OK) + if ((retval = target_halt(target)) != ERROR_OK) { free(samples); return retval; @@ -2958,7 +2958,7 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, if ((numSamples>=maxSample) || ((now.tv_sec >= timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec))) { command_print(cmd_ctx, "Profiling completed. %d samples.", numSamples); - if((retval = target_poll(target)) != ERROR_OK) + if ((retval = target_poll(target)) != ERROR_OK) { free(samples); return retval; @@ -2967,7 +2967,7 @@ static int handle_profile_command(struct command_context_s *cmd_ctx, char *cmd, { target_resume(target, 1, 0, 0, 0); /* current pc, addr = 0, do not handle breakpoints, not debugging */ } - if((retval = target_poll(target)) != ERROR_OK) + if ((retval = target_poll(target)) != ERROR_OK) { free(samples); return retval; @@ -3379,7 +3379,7 @@ void target_handle_event( target_t *target, enum target_event e ) done = 0; while( teap ){ - if( teap->event == e ){ + if ( teap->event == e ){ done = 1; LOG_DEBUG( "target: (%d) %s (%s) event: %d (%s) action: %s\n", target->target_number, @@ -3395,7 +3395,7 @@ void target_handle_event( target_t *target, enum target_event e ) } teap = teap->next; } - if( !done ){ + if ( !done ){ LOG_DEBUG( "event: %d %s - no action", e, Jim_Nvp_value2name_simple( nvp_target_event, e )->name ); @@ -3441,34 +3441,34 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) Jim_SetEmptyResult( goi->interp ); /* Jim_GetOpt_Debug( goi ); */ - if( target->type->target_jim_configure ){ + if ( target->type->target_jim_configure ){ /* target defines a configure function */ /* target gets first dibs on parameters */ e = (*(target->type->target_jim_configure))( target, goi ); - if( e == JIM_OK ){ + if ( e == JIM_OK ){ /* more? */ continue; } - if( e == JIM_ERR ){ + if ( e == JIM_ERR ){ /* An error */ return e; } /* otherwise we 'continue' below */ } e = Jim_GetOpt_Nvp( goi, nvp_config_opts, &n ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ Jim_GetOpt_NvpUnknown( goi, nvp_config_opts, 0 ); return e; } switch( n->value ){ case TCFG_TYPE: /* not setable */ - if( goi->isconfigure ){ + if ( goi->isconfigure ){ Jim_SetResult_sprintf( goi->interp, "not setable: %s", n->name ); return JIM_ERR; } else { no_params: - if( goi->argc != 0 ){ + if ( goi->argc != 0 ){ Jim_WrongNumArgs( goi->interp, goi->argc, goi->argv, "NO PARAMS"); return JIM_ERR; } @@ -3477,24 +3477,24 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) /* loop for more */ break; case TCFG_EVENT: - if( goi->argc == 0 ){ + if ( goi->argc == 0 ){ Jim_WrongNumArgs( goi->interp, goi->argc, goi->argv, "-event ?event-name? ..."); return JIM_ERR; } e = Jim_GetOpt_Nvp( goi, nvp_target_event, &n ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ Jim_GetOpt_NvpUnknown( goi, nvp_target_event, 1 ); return e; } - if( goi->isconfigure ){ - if( goi->argc != 1 ){ + if ( goi->isconfigure ){ + if ( goi->argc != 1 ){ Jim_WrongNumArgs( goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?"); return JIM_ERR; } } else { - if( goi->argc != 0 ){ + if ( goi->argc != 0 ){ Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name?"); return JIM_ERR; } @@ -3506,20 +3506,20 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) teap = target->event_action; /* replace existing? */ while( teap ){ - if( teap->event == (enum target_event)n->value ){ + if ( teap->event == (enum target_event)n->value ){ break; } teap = teap->next; } - if( goi->isconfigure ){ - if( teap == NULL ){ + if ( goi->isconfigure ){ + if ( teap == NULL ){ /* create new */ teap = calloc( 1, sizeof(*teap) ); } teap->event = n->value; Jim_GetOpt_Obj( goi, &o ); - if( teap->body ){ + if ( teap->body ){ Jim_DecrRefCount( interp, teap->body ); } teap->body = Jim_DuplicateObj( goi->interp, o ); @@ -3541,7 +3541,7 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) Jim_SetEmptyResult(goi->interp); } else { /* get */ - if( teap == NULL ){ + if ( teap == NULL ){ Jim_SetEmptyResult( goi->interp ); } else { Jim_SetResult( goi->interp, Jim_DuplicateObj( goi->interp, teap->body ) ); @@ -3552,15 +3552,15 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) break; case TCFG_WORK_AREA_VIRT: - if( goi->isconfigure ){ + if ( goi->isconfigure ){ target_free_all_working_areas(target); e = Jim_GetOpt_Wide( goi, &w ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return e; } target->working_area_virt = w; } else { - if( goi->argc != 0 ){ + if ( goi->argc != 0 ){ goto no_params; } } @@ -3569,15 +3569,15 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) break; case TCFG_WORK_AREA_PHYS: - if( goi->isconfigure ){ + if ( goi->isconfigure ){ target_free_all_working_areas(target); e = Jim_GetOpt_Wide( goi, &w ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return e; } target->working_area_phys = w; } else { - if( goi->argc != 0 ){ + if ( goi->argc != 0 ){ goto no_params; } } @@ -3586,15 +3586,15 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) break; case TCFG_WORK_AREA_SIZE: - if( goi->isconfigure ){ + if ( goi->isconfigure ){ target_free_all_working_areas(target); e = Jim_GetOpt_Wide( goi, &w ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return e; } target->working_area_size = w; } else { - if( goi->argc != 0 ){ + if ( goi->argc != 0 ){ goto no_params; } } @@ -3603,16 +3603,16 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) break; case TCFG_WORK_AREA_BACKUP: - if( goi->isconfigure ){ + if ( goi->isconfigure ){ target_free_all_working_areas(target); e = Jim_GetOpt_Wide( goi, &w ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return e; } /* make this exactly 1 or 0 */ target->backup_working_area = (!!w); } else { - if( goi->argc != 0 ){ + if ( goi->argc != 0 ){ goto no_params; } } @@ -3621,20 +3621,20 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) break; case TCFG_ENDIAN: - if( goi->isconfigure ){ + if ( goi->isconfigure ){ e = Jim_GetOpt_Nvp( goi, nvp_target_endian, &n ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ Jim_GetOpt_NvpUnknown( goi, nvp_target_endian, 1 ); return e; } target->endianness = n->value; } else { - if( goi->argc != 0 ){ + if ( goi->argc != 0 ){ goto no_params; } } n = Jim_Nvp_value2name_simple( nvp_target_endian, target->endianness ); - if( n->name == NULL ){ + if ( n->name == NULL ){ target->endianness = TARGET_LITTLE_ENDIAN; n = Jim_Nvp_value2name_simple( nvp_target_endian, target->endianness ); } @@ -3643,20 +3643,20 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) break; case TCFG_VARIANT: - if( goi->isconfigure ){ - if( goi->argc < 1 ){ + if ( goi->isconfigure ){ + if ( goi->argc < 1 ){ Jim_SetResult_sprintf( goi->interp, "%s ?STRING?", n->name ); return JIM_ERR; } - if( target->variant ){ + if ( target->variant ){ free((void *)(target->variant)); } e = Jim_GetOpt_String( goi, &cp, NULL ); target->variant = strdup(cp); } else { - if( goi->argc != 0 ){ + if ( goi->argc != 0 ){ goto no_params; } } @@ -3664,22 +3664,22 @@ static int target_configure( Jim_GetOptInfo *goi, target_t *target ) /* loop for more */ break; case TCFG_CHAIN_POSITION: - if( goi->isconfigure ){ + if ( goi->isconfigure ){ Jim_Obj *o; jtag_tap_t *tap; target_free_all_working_areas(target); e = Jim_GetOpt_Obj( goi, &o ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return e; } tap = jtag_tap_by_jim_obj( goi->interp, o ); - if( tap == NULL ){ + if ( tap == NULL ){ return JIM_ERR; } /* make this exactly 1 or 0 */ target->tap = tap; } else { - if( goi->argc != 0 ){ + if ( goi->argc != 0 ){ goto no_params; } } @@ -3756,7 +3756,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) /* commands here are in an NVP table */ e = Jim_GetOpt_Nvp( &goi, target_options, &n ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ Jim_GetOpt_NvpUnknown( &goi, target_options, 0 ); return e; } @@ -3765,7 +3765,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) switch( n->value ){ case TS_CMD_CONFIGURE: - if( goi.argc < 2 ){ + if ( goi.argc < 2 ){ Jim_WrongNumArgs( goi.interp, goi.argc, goi.argv, "missing: -option VALUE ..."); return JIM_ERR; } @@ -3773,7 +3773,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) return target_configure( &goi, target ); case TS_CMD_CGET: // some things take params - if( goi.argc < 1 ){ + if ( goi.argc < 1 ){ Jim_WrongNumArgs( goi.interp, 0, goi.argv, "missing: ?-option?"); return JIM_ERR; } @@ -3789,7 +3789,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) * argv[3] = optional count. */ - if( (goi.argc == 2) || (goi.argc == 3) ){ + if ( (goi.argc == 2) || (goi.argc == 3) ){ /* all is well */ } else { mwx_error: @@ -3798,17 +3798,17 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } e = Jim_GetOpt_Wide( &goi, &a ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ goto mwx_error; } e = Jim_GetOpt_Wide( &goi, &b ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ goto mwx_error; } if (goi.argc == 3) { e = Jim_GetOpt_Wide( &goi, &c ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ goto mwx_error; } } else { @@ -3831,7 +3831,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } for( x = 0 ; x < c ; x++ ){ e = target_write_memory( target, a, b, 1, target_buf ); - if( e != ERROR_OK ){ + if ( e != ERROR_OK ){ Jim_SetResult_sprintf( interp, "Error writing @ 0x%08x: %d\n", (int)(a), e ); return JIM_ERR; } @@ -3849,17 +3849,17 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) * argv[1] = address * argv[2] = optional count */ - if( (goi.argc == 2) || (goi.argc == 3) ){ + if ( (goi.argc == 2) || (goi.argc == 3) ){ Jim_SetResult_sprintf( goi.interp, "expected: %s ADDR [COUNT]", n->name ); return JIM_ERR; } e = Jim_GetOpt_Wide( &goi, &a ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return JIM_ERR; } - if( goi.argc ){ + if ( goi.argc ){ e = Jim_GetOpt_Wide( &goi, &c ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return JIM_ERR; } } else { @@ -3883,11 +3883,11 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) /* count is now in 'BYTES' */ while( c > 0 ){ y = c; - if( y > 16 ){ + if ( y > 16 ){ y = 16; } e = target_read_memory( target, a, b, y / b, target_buf ); - if( e != ERROR_OK ){ + if ( e != ERROR_OK ){ Jim_SetResult_sprintf( interp, "error reading target @ 0x%08lx", (int)(a) ); return JIM_ERR; } @@ -3925,7 +3925,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } /* ascii-ify the bytes */ for( x = 0 ; x < y ; x++ ){ - if( (target_buf[x] >= 0x20) && + if ( (target_buf[x] >= 0x20) && (target_buf[x] <= 0x7e) ){ /* good */ } else { @@ -3954,31 +3954,31 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) return target_array2mem( goi.interp, target, goi.argc, goi.argv ); break; case TS_CMD_EXAMINE: - if( goi.argc ){ + if ( goi.argc ){ Jim_WrongNumArgs( goi.interp, 2, argv, "[no parameters]"); return JIM_ERR; } if (!target->tap->enabled) goto err_tap_disabled; e = target->type->examine( target ); - if( e != ERROR_OK ){ + if ( e != ERROR_OK ){ Jim_SetResult_sprintf( interp, "examine-fails: %d", e ); return JIM_ERR; } return JIM_OK; case TS_CMD_POLL: - if( goi.argc ){ + if ( goi.argc ){ Jim_WrongNumArgs( goi.interp, 2, argv, "[no parameters]"); return JIM_ERR; } if (!target->tap->enabled) goto err_tap_disabled; - if( !(target_was_examined(target)) ){ + if ( !(target_was_examined(target)) ){ e = ERROR_TARGET_NOT_EXAMINED; } else { e = target->type->poll( target ); } - if( e != ERROR_OK ){ + if ( e != ERROR_OK ){ Jim_SetResult_sprintf( interp, "poll-fails: %d", e ); return JIM_ERR; } else { @@ -3986,18 +3986,18 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } break; case TS_CMD_RESET: - if( goi.argc != 2 ){ + if ( goi.argc != 2 ){ Jim_WrongNumArgs( interp, 2, argv, "t|f|assert|deassert BOOL"); return JIM_ERR; } e = Jim_GetOpt_Nvp( &goi, nvp_assert, &n ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ Jim_GetOpt_NvpUnknown( &goi, nvp_assert, 1 ); return e; } /* the halt or not param */ e = Jim_GetOpt_Wide( &goi, &a); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return e; } if (!target->tap->enabled) @@ -4008,14 +4008,14 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) target_free_all_working_areas_restore(target, 0); /* do the assert */ - if( n->value == NVP_ASSERT ){ + if ( n->value == NVP_ASSERT ){ target->type->assert_reset( target ); } else { target->type->deassert_reset( target ); } return JIM_OK; case TS_CMD_HALT: - if( goi.argc ){ + if ( goi.argc ){ Jim_WrongNumArgs( goi.interp, 0, argv, "halt [no parameters]"); return JIM_ERR; } @@ -4025,23 +4025,23 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) return JIM_OK; case TS_CMD_WAITSTATE: /* params: statename timeoutmsecs */ - if( goi.argc != 2 ){ + if ( goi.argc != 2 ){ Jim_SetResult_sprintf( goi.interp, "%s STATENAME TIMEOUTMSECS", n->name ); return JIM_ERR; } e = Jim_GetOpt_Nvp( &goi, nvp_target_state, &n ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ Jim_GetOpt_NvpUnknown( &goi, nvp_target_state,1 ); return e; } e = Jim_GetOpt_Wide( &goi, &a ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return e; } if (!target->tap->enabled) goto err_tap_disabled; e = target_wait_state( target, n->value, a ); - if( e != ERROR_OK ){ + if ( e != ERROR_OK ){ Jim_SetResult_sprintf( goi.interp, "target: %s wait %s fails (%d) %s", target->cmd_name, @@ -4074,7 +4074,7 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) return JIM_OK; } case TS_CMD_CURSTATE: - if( goi.argc != 0 ){ + if ( goi.argc != 0 ){ Jim_WrongNumArgs( goi.interp, 0, argv, "[no parameters]"); return JIM_ERR; } @@ -4082,12 +4082,12 @@ static int tcl_target_func( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) Jim_Nvp_value2name_simple(nvp_target_state,target->state)->name,-1); return JIM_OK; case TS_CMD_INVOKE_EVENT: - if( goi.argc != 1 ){ + if ( goi.argc != 1 ){ Jim_SetResult_sprintf( goi.interp, "%s ?EVENTNAME?",n->name); return JIM_ERR; } e = Jim_GetOpt_Nvp( &goi, nvp_target_event, &n ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ Jim_GetOpt_NvpUnknown( &goi, nvp_target_event, 1 ); return e; } @@ -4113,7 +4113,7 @@ static int target_create( Jim_GetOptInfo *goi ) struct command_context_s *cmd_ctx; cmd_ctx = Jim_GetAssocData(goi->interp, "context"); - if( goi->argc < 3 ){ + if ( goi->argc < 3 ){ Jim_WrongNumArgs( goi->interp, 1, goi->argv, "?name? ?type? ..options..."); return JIM_ERR; } @@ -4122,7 +4122,7 @@ static int target_create( Jim_GetOptInfo *goi ) Jim_GetOpt_Obj( goi, &new_cmd ); /* does this command exist? */ cmd = Jim_GetCommand( goi->interp, new_cmd, JIM_ERRMSG ); - if( cmd ){ + if ( cmd ){ cp = Jim_GetString( new_cmd, NULL ); Jim_SetResult_sprintf(goi->interp, "Command/target: %s Exists", cp); return JIM_ERR; @@ -4133,15 +4133,15 @@ static int target_create( Jim_GetOptInfo *goi ) cp = cp2; /* now does target type exist */ for( x = 0 ; target_types[x] ; x++ ){ - if( 0 == strcmp( cp, target_types[x]->name ) ){ + if ( 0 == strcmp( cp, target_types[x]->name ) ){ /* found */ break; } } - if( target_types[x] == NULL ){ + if ( target_types[x] == NULL ){ Jim_SetResult_sprintf( goi->interp, "Unknown target type %s, try one of ", cp ); for( x = 0 ; target_types[x] ; x++ ){ - if( target_types[x+1] ){ + if ( target_types[x+1] ){ Jim_AppendStrings( goi->interp, Jim_GetResult(goi->interp), target_types[x]->name, @@ -4209,13 +4209,13 @@ static int target_create( Jim_GetOptInfo *goi ) e=JIM_ERR; } - if( e != JIM_OK ){ + if ( e != JIM_OK ){ free( target->type ); free( target ); return e; } - if( target->endianness == TARGET_ENDIAN_UNKNOWN ){ + if ( target->endianness == TARGET_ENDIAN_UNKNOWN ){ /* default endian to little if not specified */ target->endianness = TARGET_LITTLE_ENDIAN; } @@ -4225,10 +4225,10 @@ static int target_create( Jim_GetOptInfo *goi ) target->variant = strdup(""); /* create the target specific commands */ - if( target->type->register_commands ){ + if ( target->type->register_commands ){ (*(target->type->register_commands))( cmd_ctx ); } - if( target->type->target_create ){ + if ( target->type->target_create ){ (*(target->type->target_create))( target, goi->interp ); } @@ -4285,14 +4285,14 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) Jim_GetOpt_Setup( &goi, interp, argc-1, argv+1 ); - if( goi.argc == 0 ){ + if ( goi.argc == 0 ){ Jim_WrongNumArgs(interp, 1, argv, "missing: command ..."); return JIM_ERR; } /* Jim_GetOpt_Debug( &goi ); */ r = Jim_GetOpt_Enum( &goi, target_cmds, &x ); - if( r != JIM_OK ){ + if ( r != JIM_OK ){ return r; } @@ -4301,14 +4301,14 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) Jim_Panic(goi.interp,"Why am I here?"); return JIM_ERR; case TG_CMD_CURRENT: - if( goi.argc != 0 ){ + if ( goi.argc != 0 ){ Jim_WrongNumArgs( goi.interp, 1, goi.argv, "Too many parameters"); return JIM_ERR; } Jim_SetResultString( goi.interp, get_current_target( cmd_ctx )->cmd_name, -1 ); return JIM_OK; case TG_CMD_TYPES: - if( goi.argc != 0 ){ + if ( goi.argc != 0 ){ Jim_WrongNumArgs( goi.interp, 1, goi.argv, "Too many parameters" ); return JIM_ERR; } @@ -4320,7 +4320,7 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } return JIM_OK; case TG_CMD_NAMES: - if( goi.argc != 0 ){ + if ( goi.argc != 0 ){ Jim_WrongNumArgs( goi.interp, 1, goi.argv, "Too many parameters" ); return JIM_ERR; } @@ -4334,25 +4334,25 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) } return JIM_OK; case TG_CMD_CREATE: - if( goi.argc < 3 ){ + if ( goi.argc < 3 ){ Jim_WrongNumArgs( goi.interp, goi.argc, goi.argv, "?name ... config options ..."); return JIM_ERR; } return target_create( &goi ); break; case TG_CMD_NUMBER: - if( goi.argc != 1 ){ + if ( goi.argc != 1 ){ Jim_SetResult_sprintf( goi.interp, "expected: target number ?NUMBER?"); return JIM_ERR; } e = Jim_GetOpt_Wide( &goi, &w ); - if( e != JIM_OK ){ + if ( e != JIM_OK ){ return JIM_ERR; } { target_t *t; t = get_target_by_num(w); - if( t == NULL ){ + if ( t == NULL ){ Jim_SetResult_sprintf( goi.interp,"Target: number %d does not exist", (int)(w)); return JIM_ERR; } @@ -4360,7 +4360,7 @@ static int jim_target( Jim_Interp *interp, int argc, Jim_Obj *const *argv ) return JIM_OK; } case TG_CMD_COUNT: - if( goi.argc != 0 ){ + if ( goi.argc != 0 ){ Jim_WrongNumArgs( goi.interp, 0, goi.argv, ""); return JIM_ERR; } diff --git a/src/target/xscale.c b/src/target/xscale.c index 058e8d75..6c04b97e 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -2189,12 +2189,12 @@ int xscale_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint) if (breakpoint->length == 4) { /* keep the original instruction in target endianness */ - if((retval = target_read_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_read_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } /* write the original instruction in target endianness (arm7_9->arm_bkpt is host endian) */ - if((retval = target_write_u32(target, breakpoint->address, xscale->arm_bkpt)) != ERROR_OK) + if ((retval = target_write_u32(target, breakpoint->address, xscale->arm_bkpt)) != ERROR_OK) { return retval; } @@ -2202,12 +2202,12 @@ int xscale_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint) else { /* keep the original instruction in target endianness */ - if((retval = target_read_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_read_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } /* write the original instruction in target endianness (arm7_9->arm_bkpt is host endian) */ - if((retval = target_write_u32(target, breakpoint->address, xscale->thumb_bkpt)) != ERROR_OK) + if ((retval = target_write_u32(target, breakpoint->address, xscale->thumb_bkpt)) != ERROR_OK) { return retval; } @@ -2286,14 +2286,14 @@ int xscale_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint) /* restore original instruction (kept in target endianness) */ if (breakpoint->length == 4) { - if((retval = target_write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } } else { - if((retval = target_write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK) + if ((retval = target_write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK) { return retval; } @@ -3606,7 +3606,7 @@ int xscale_handle_cp15(command_context_t *cmd_ctx, char *cmd, char **args, int a } uint32_t reg_no = 0; reg_t *reg = NULL; - if(argc > 0) + if (argc > 0) { reg_no = strtoul(args[0], NULL, 0); /*translate from xscale cp15 register no to openocd register*/ @@ -3643,7 +3643,7 @@ int xscale_handle_cp15(command_context_t *cmd_ctx, char *cmd, char **args, int a reg = &xscale->reg_cache->reg_list[reg_no]; } - if(argc == 1) + if (argc == 1) { uint32_t value; @@ -3652,7 +3652,7 @@ int xscale_handle_cp15(command_context_t *cmd_ctx, char *cmd, char **args, int a value = buf_get_u32(reg->value, 0, 32); command_print(cmd_ctx, "%s (/%i): 0x%" PRIx32 "", reg->name, (int)(reg->size), value); } - else if(argc == 2) + else if (argc == 2) { uint32_t value = strtoul(args[1], NULL, 0); -- cgit v1.2.3