- Fixes '=' whitespace
[openocd.git] / src / target / arm7_9_common.c
index 692ab16f6a0e6327cc12278c268bece08b1359e0..c4b7c6a16c26ef52c40de8346ee4741254d5b08e 100644 (file)
@@ -118,11 +118,11 @@ static int arm7_9_set_software_breakpoints(arm7_9_common_t *arm7_9)
        /* pick a breakpoint unit */
        if (!arm7_9->wp0_used)
        {
-               arm7_9->sw_breakpoints_added=1;
+               arm7_9->sw_breakpoints_added = 1;
                arm7_9->wp0_used = 3;
        } else if (!arm7_9->wp1_used)
        {
-               arm7_9->sw_breakpoints_added=2;
+               arm7_9->sw_breakpoints_added = 2;
                arm7_9->wp1_used = 3;
        }
        else
@@ -131,7 +131,7 @@ static int arm7_9_set_software_breakpoints(arm7_9_common_t *arm7_9)
                return ERROR_FAIL;
        }
 
-       if (arm7_9->sw_breakpoints_added==1)
+       if (arm7_9->sw_breakpoints_added == 1)
        {
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_VALUE], arm7_9->arm_bkpt);
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_MASK], 0x0);
@@ -139,7 +139,7 @@ static int arm7_9_set_software_breakpoints(arm7_9_common_t *arm7_9)
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~EICE_W_CTRL_nOPC & 0xff);
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE);
        }
-       else if (arm7_9->sw_breakpoints_added==2)
+       else if (arm7_9->sw_breakpoints_added == 2)
        {
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_VALUE], arm7_9->arm_bkpt);
                embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_MASK], 0x0);
@@ -218,7 +218,7 @@ int arm7_9_set_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;
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
 
        if (target->state != TARGET_HALTED)
        {
@@ -232,12 +232,12 @@ int arm7_9_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                uint32_t mask = (breakpoint->length == 4) ? 0x3u : 0x1u;
 
                /* reassign a hw breakpoint */
-               if (breakpoint->set==0)
+               if (breakpoint->set == 0)
                {
                        arm7_9_assign_wp(arm7_9, breakpoint);
                }
 
-               if (breakpoint->set==1)
+               if (breakpoint->set == 1)
                {
                        embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_VALUE], breakpoint->address);
                        embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_MASK], mask);
@@ -245,7 +245,7 @@ int arm7_9_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                        embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~EICE_W_CTRL_nOPC & 0xff);
                        embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE);
                }
-               else if (breakpoint->set==2)
+               else if (breakpoint->set == 2)
                {
                        embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_VALUE], breakpoint->address);
                        embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_MASK], mask);
@@ -259,11 +259,11 @@ int arm7_9_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                        return ERROR_OK;
                }
 
-               retval=jtag_execute_queue();
+               retval = jtag_execute_queue();
        }
        else if (breakpoint->type == BKPT_SOFT)
        {
-               if ((retval=arm7_9_set_software_breakpoints(arm7_9)) != ERROR_OK)
+               if ((retval = arm7_9_set_software_breakpoints(arm7_9)) != ERROR_OK)
                        return retval;
 
                /* did we already set this breakpoint? */
@@ -377,7 +377,7 @@ int arm7_9_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                        {
                                return retval;
                        }
-                       if (current_instr==arm7_9->arm_bkpt)
+                       if (current_instr == arm7_9->arm_bkpt)
                                if ((retval = target_write_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr)) != ERROR_OK)
                                {
                                        return retval;
@@ -391,7 +391,7 @@ int arm7_9_unset_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                        {
                                return retval;
                        }
-                       if (current_instr==arm7_9->thumb_bkpt)
+                       if (current_instr == arm7_9->thumb_bkpt)
                                if ((retval = target_write_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr)) != ERROR_OK)
                                {
                                        return retval;
@@ -423,7 +423,7 @@ int arm7_9_add_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                return ERROR_TARGET_NOT_HALTED;
        }
 
-       if (arm7_9->breakpoint_count==0)
+       if (arm7_9->breakpoint_count == 0)
        {
                /* make sure we don't have any dangling breakpoints. This is vital upon
                 * GDB connect/disconnect
@@ -478,7 +478,7 @@ int arm7_9_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
                arm7_9->wp_available++;
 
        arm7_9->breakpoint_count--;
-       if (arm7_9->breakpoint_count==0)
+       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)
@@ -700,9 +700,9 @@ int arm7_9_execute_sys_speed(struct target_s *target)
        }
        arm_jtag_set_instr(jtag_info, 0x4, NULL);
 
-       long long then=timeval_ms();
+       long long then = timeval_ms();
        int timeout;
-       while (!(timeout=((timeval_ms()-then)>1000)))
+       while (!(timeout = ((timeval_ms()-then)>1000)))
        {
                /* read debug status register */
                embeddedice_read_reg(dbg_stat);
@@ -738,7 +738,7 @@ int arm7_9_execute_sys_speed(struct target_s *target)
  */
 int arm7_9_execute_fast_sys_speed(struct target_s *target)
 {
-       static int set=0;
+       static int set = 0;
        static uint8_t check_value[4], check_mask[4];
 
        armv4_5_common_t *armv4_5 = target->arch_info;
@@ -764,7 +764,7 @@ int arm7_9_execute_fast_sys_speed(struct target_s *target)
                 * */
                buf_set_u32(check_value, 0, 32, 0x9);
                buf_set_u32(check_mask, 0, 32, 0x9);
-               set=1;
+               set = 1;
        }
 
        /* read debug status register */
@@ -900,13 +900,13 @@ int arm7_9_poll(target_t *target)
                }
                if ((target->state == TARGET_RUNNING) || (target->state == TARGET_RESET))
                {
-                       int check_pc=0;
+                       int check_pc = 0;
                        if (target->state == TARGET_RESET)
                        {
                                if (target->reset_halt)
                                {
                                        enum reset_types jtag_reset_config = jtag_get_reset_config();
-                                       if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)
+                                       if ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0)
                                        {
                                                check_pc = 1;
                                        }
@@ -1022,7 +1022,7 @@ int arm7_9_assert_reset(target_t *target)
 
        armv4_5_invalidate_core_regs(target);
 
-       if ((target->reset_halt) && ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0))
+       if ((target->reset_halt) && ((jtag_reset_config & RESET_SRST_PULLS_TRST) == 0))
        {
                /* debug entry was already prepared in arm7_9_assert_reset() */
                target->debug_reason = DBG_REASON_DBGRQ;
@@ -1042,7 +1042,7 @@ int arm7_9_assert_reset(target_t *target)
  */
 int arm7_9_deassert_reset(target_t *target)
 {
-       int retval=ERROR_OK;
+       int retval = ERROR_OK;
        LOG_DEBUG("target->state: %s",
                Jim_Nvp_value2name_simple( nvp_target_state,target->state)->name);
 
@@ -1057,12 +1057,12 @@ int arm7_9_deassert_reset(target_t *target)
                if ((retval = target_examine_one(target)) != ERROR_OK)
                        return retval;
 
-               if ((retval=target_poll(target)) != ERROR_OK)
+               if ((retval = target_poll(target)) != ERROR_OK)
                {
                        return retval;
                }
 
-               if ((retval=target_halt(target)) != ERROR_OK)
+               if ((retval = target_halt(target)) != ERROR_OK)
                {
                        return retval;
                }
@@ -1147,17 +1147,17 @@ int arm7_9_soft_reset_halt(struct target_s *target)
        int i;
        int retval;
 
-       if ((retval=target_halt(target)) != ERROR_OK)
+       if ((retval = target_halt(target)) != ERROR_OK)
                return retval;
 
-       long long then=timeval_ms();
+       long long then = timeval_ms();
        int timeout;
-       while (!(timeout=((timeval_ms()-then)>1000)))
+       while (!(timeout = ((timeval_ms()-then)>1000)))
        {
                if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) != 0)
                        break;
                embeddedice_read_reg(dbg_stat);
-               if ((retval=jtag_execute_queue()) != ERROR_OK)
+               if ((retval = jtag_execute_queue()) != ERROR_OK)
                        return retval;
                if (debug_level >= 3)
                {
@@ -1246,7 +1246,7 @@ int arm7_9_soft_reset_halt(struct target_s *target)
  */
 int arm7_9_halt(target_t *target)
 {
-       if (target->state==TARGET_RESET)
+       if (target->state == TARGET_RESET)
        {
                LOG_ERROR("BUG: arm7/9 does not support halt during reset. This is handled in arm7_9_assert_reset()");
                return ERROR_OK;
@@ -1428,7 +1428,7 @@ int arm7_9_debug_entry(target_t *target)
        if (armv4_5_mode_to_number(armv4_5->core_mode)==-1)
                return ERROR_FAIL;
 
-       for (i=0; i<=15; i++)
+       for (i = 0; i <= 15; i++)
        {
                LOG_DEBUG("r%i: 0x%8.8" PRIx32 "", i, context[i]);
                buf_set_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).value, 0, 32, context[i]);
@@ -2240,7 +2240,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
        reg[0] = address;
        arm7_9->write_core_regs(target, 0x1, reg);
 
-       int j=0;
+       int j = 0;
 
        switch (size)
        {
@@ -2272,7 +2272,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
                                buffer += thisrun_accesses * 4;
                                num_accesses += thisrun_accesses;
 
-                               if ((j++%1024)==0)
+                               if ((j++%1024) == 0)
                                {
                                        keep_alive();
                                }
@@ -2310,7 +2310,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
                                buffer += thisrun_accesses * 2;
                                num_accesses += thisrun_accesses;
 
-                               if ((j++%1024)==0)
+                               if ((j++%1024) == 0)
                                {
                                        keep_alive();
                                }
@@ -2347,7 +2347,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
                                buffer += thisrun_accesses * 1;
                                num_accesses += thisrun_accesses;
 
-                               if ((j++%1024)==0)
+                               if ((j++%1024) == 0)
                                {
                                        keep_alive();
                                }
@@ -2362,7 +2362,7 @@ int arm7_9_read_memory(struct target_s *target, uint32_t address, uint32_t size,
        if (armv4_5_mode_to_number(armv4_5->core_mode)==-1)
                return ERROR_FAIL;
 
-       for (i=0; i<=last_reg; i++)
+       for (i = 0; i <= last_reg; i++)
                ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).dirty = ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).valid;
 
        arm7_9->read_xpsr(target, &cpsr, 0);
@@ -2545,7 +2545,7 @@ int arm7_9_write_memory(struct target_s *target, uint32_t address, uint32_t size
        if (armv4_5_mode_to_number(armv4_5->core_mode)==-1)
                return ERROR_FAIL;
 
-       for (i=0; i<=last_reg; i++)
+       for (i = 0; i <= last_reg; i++)
                ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).dirty = ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).valid;
 
        arm7_9->read_xpsr(target, &cpsr, 0);
@@ -2576,12 +2576,12 @@ static int arm7_9_dcc_completion(struct target_s *target, uint32_t exit_point, i
        armv4_5_common_t *armv4_5 = target->arch_info;
        arm7_9_common_t *arm7_9 = armv4_5->arch_info;
 
-       if ((retval=target_wait_state(target, TARGET_DEBUG_RUNNING, 500)) != ERROR_OK)
+       if ((retval = target_wait_state(target, TARGET_DEBUG_RUNNING, 500)) != ERROR_OK)
                return retval;
 
-       int little=target->endianness==TARGET_LITTLE_ENDIAN;
-       int count=dcc_count;
-       uint8_t *buffer=dcc_buffer;
+       int little = target->endianness == TARGET_LITTLE_ENDIAN;
+       int count = dcc_count;
+       uint8_t *buffer = dcc_buffer;
        if (count>2)
        {
                /* Handle first & last using standard embeddedice_write_reg and the middle ones w/the
@@ -2669,18 +2669,18 @@ int arm7_9_bulk_write_memory(target_t *target, uint32_t address, uint32_t count,
 
        buf_set_u32(reg_params[0].value, 0, 32, address);
 
-       dcc_count=count;
-       dcc_buffer=buffer;
+       dcc_count = count;
+       dcc_buffer = buffer;
        retval = armv4_5_run_algorithm_inner(target, 0, NULL, 1, reg_params,
                        arm7_9->dcc_working_area->address, arm7_9->dcc_working_area->address+6*4, 20*1000, &armv4_5_info, arm7_9_dcc_completion);
 
-       if (retval==ERROR_OK)
+       if (retval == ERROR_OK)
        {
-               uint32_t endaddress=buf_get_u32(reg_params[0].value, 0, 32);
+               uint32_t endaddress = buf_get_u32(reg_params[0].value, 0, 32);
                if (endaddress != (address+count*4))
                {
                        LOG_ERROR("DCC write failed, expected end address 0x%08" PRIx32 " got 0x%0" PRIx32 "", (address+count*4), endaddress);
-                       retval=ERROR_FAIL;
+                       retval = ERROR_FAIL;
                }
        }
 
@@ -2734,7 +2734,7 @@ int arm7_9_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(arm7_9_crc_code)/sizeof(uint32_t)); i++)
        {
-               if ((retval=target_write_u32(target, crc_algorithm->address + i*sizeof(uint32_t), arm7_9_crc_code[i])) != ERROR_OK)
+               if ((retval = target_write_u32(target, crc_algorithm->address + i*sizeof(uint32_t), arm7_9_crc_code[i])) != ERROR_OK)
                {
                        return retval;
                }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)