embeddedice: fix error handling
[openocd.git] / src / target / embeddedice.c
index 39f87c790afc1c8b5bb45e90f5b8d66f60292a79..5502ad8a8a58590ef184e6d79df3e4efa5682aa1 100644 (file)
@@ -2,7 +2,7 @@
  *   Copyright (C) 2005 by Dominic Rath                                    *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
- *   Copyright (C) 2007,2008 Øyvind Harboe                                 *
+ *   Copyright (C) 2007-2010 Øyvind Harboe                                 *
  *   oyvind.harboe@zylin.com                                               *
  *                                                                         *
  *   Copyright (C) 2008 by Spencer Oliver                                  *
 #endif
 
 #include "embeddedice.h"
+#include "register.h"
+
+/**
+ * @file
+ *
+ * This provides lowlevel glue to the EmbeddedICE (or EmbeddedICE-RT)
+ * module found on scan chain 2 in ARM7, ARM9, and some other families
+ * of ARM cores.  The module is called "EmbeddedICE-RT" if it has
+ * monitor mode support.
+ *
+ * EmbeddedICE provides basic watchpoint/breakpoint hardware and a Debug
+ * Communications Channel (DCC) used to read or write 32-bit words to
+ * OpenOCD-aware code running on the target CPU.
+ * Newer modules also include vector catch hardware.  Some versions
+ * support hardware single-stepping, "monitor mode" debug (which is not
+ * currently supported by OpenOCD), or extended reporting on why the
+ * core entered debug mode.
+ */
 
-#define ARRAY_SIZE(x)  ((int)(sizeof(x)/sizeof((x)[0])))
-
-#if 0
-static bitfield_desc_t embeddedice_comms_ctrl_bitfield_desc[] =
-{
-       {"R", 1},
-       {"W", 1},
-       {"reserved", 26},
-       {"version", 4}
-};
-#endif
+static int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf);
 
 /*
  * From:  ARM9E-S TRM, DDI 0165, table C-4 (and similar, for other cores)
@@ -138,33 +146,47 @@ static const struct {
 };
 
 
-static int embeddedice_reg_arch_type = -1;
+static int embeddedice_get_reg(struct reg *reg)
+{
+       int retval;
 
-static int embeddedice_get_reg(reg_t *reg);
+       if ((retval = embeddedice_read_reg(reg)) != ERROR_OK)
+               LOG_ERROR("error queueing EmbeddedICE register read");
+       else if ((retval = jtag_execute_queue()) != ERROR_OK)
+               LOG_ERROR("EmbeddedICE register read failed");
 
-reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7_9)
+       return retval;
+}
+
+static const struct reg_arch_type eice_reg_type = {
+       .get = embeddedice_get_reg,
+       .set = embeddedice_set_reg_w_exec,
+};
+
+/**
+ * Probe EmbeddedICE module and set up local records of its registers.
+ * Different versions of the modules have different capabilities, such as
+ * hardware support for vector_catch, single stepping, and monitor mode.
+ */
+struct reg_cache *
+embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9)
 {
        int retval;
-       reg_cache_t *reg_cache = malloc(sizeof(reg_cache_t));
-       reg_t *reg_list = NULL;
-       embeddedice_reg_t *arch_info = NULL;
-       arm_jtag_t *jtag_info = &arm7_9->jtag_info;
+       struct reg_cache *reg_cache = malloc(sizeof(struct reg_cache));
+       struct reg *reg_list = NULL;
+       struct embeddedice_reg *arch_info = NULL;
+       struct arm_jtag *jtag_info = &arm7_9->jtag_info;
        int num_regs = ARRAY_SIZE(eice_regs);
        int i;
        int eice_version = 0;
 
-       /* register a register arch-type for EmbeddedICE registers only once */
-       if (embeddedice_reg_arch_type == -1)
-               embeddedice_reg_arch_type = register_reg_arch_type(
-                               embeddedice_get_reg, embeddedice_set_reg_w_exec);
-
        /* vector_catch isn't always present */
        if (!arm7_9->has_vector_catch)
                num_regs--;
 
        /* the actual registers are kept in two arrays */
-       reg_list = calloc(num_regs, sizeof(reg_t));
-       arch_info = calloc(num_regs, sizeof(embeddedice_reg_t));
+       reg_list = calloc(num_regs, sizeof(struct reg));
+       arch_info = calloc(num_regs, sizeof(struct embeddedice_reg));
 
        /* fill in values for the reg cache */
        reg_cache->name = "EmbeddedICE registers";
@@ -172,6 +194,11 @@ reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7
        reg_cache->reg_list = reg_list;
        reg_cache->num_regs = num_regs;
 
+       /* FIXME the second watchpoint unit on Feroceon and Dragonite
+        * seems not to work ... we should have a way to not set up
+        * its four registers here!
+        */
+
        /* set up registers */
        for (i = 0; i < num_regs; i++)
        {
@@ -179,11 +206,9 @@ reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7
                reg_list[i].size = eice_regs[i].width;
                reg_list[i].dirty = 0;
                reg_list[i].valid = 0;
-               reg_list[i].bitfield_desc = NULL;
-               reg_list[i].num_bitfields = 0;
                reg_list[i].value = calloc(1, 4);
                reg_list[i].arch_info = &arch_info[i];
-               reg_list[i].arch_type = embeddedice_reg_arch_type;
+               reg_list[i].type = &eice_reg_type;
                arch_info[i].addr = eice_regs[i].addr;
                arch_info[i].jtag_info = jtag_info;
        }
@@ -203,7 +228,7 @@ reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7
        }
 
        eice_version = buf_get_u32(reg_list[EICE_COMMS_CTRL].value, 28, 4);
-       LOG_DEBUG("Embedded ICE version %d", eice_version);
+       LOG_INFO("Embedded ICE version %d", eice_version);
 
        switch (eice_version)
        {
@@ -264,25 +289,38 @@ reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7
                         * in some unusual bits.  Let feroceon.c validate it
                         * and do the appropriate setup itself.
                         */
-                       if (strcmp(target_get_name(target), "feroceon") == 0 ||
-                           strcmp(target_get_name(target), "dragonite") == 0)
+                       if (strcmp(target_type_name(target), "feroceon") == 0 ||
+                           strcmp(target_type_name(target), "dragonite") == 0)
                                break;
-                       LOG_ERROR("unknown EmbeddedICE version (comms ctrl: 0x%8.8" PRIx32 ")", buf_get_u32(reg_list[EICE_COMMS_CTRL].value, 0, 32));
+                       LOG_ERROR("unknown EmbeddedICE version "
+                               "(comms ctrl: 0x%8.8" PRIx32 ")",
+                               buf_get_u32(reg_list[EICE_COMMS_CTRL].value, 0, 32));
        }
 
+       /* On Feroceon and Dragonite the second unit is seemingly missing. */
+       LOG_INFO("%s: hardware has %d breakpoint/watchpoint unit%s",
+                       target_name(target), arm7_9->wp_available_max,
+                       (arm7_9->wp_available_max != 1) ? "s" : "");
+
        return reg_cache;
 }
 
-int embeddedice_setup(target_t *target)
+/**
+ * Initialize EmbeddedICE module, if needed.
+ */
+int embeddedice_setup(struct target *target)
 {
        int retval;
-       armv4_5_common_t *armv4_5 = target->arch_info;
-       arm7_9_common_t *arm7_9 = armv4_5->arch_info;
+       struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
 
-       /* explicitly disable monitor mode */
+       /* Explicitly disable monitor mode.  For now we only support halting
+        * debug ... we don't know how to talk with a resident debug monitor
+        * that manages break requests.  ARM's "Angel Debug Monitor" is one
+        * common example of such code.
+        */
        if (arm7_9->has_monitor_mode)
        {
-               reg_t *dbg_ctrl = &arm7_9->eice_cache->reg_list[EICE_DBG_CTRL];
+               struct reg *dbg_ctrl = &arm7_9->eice_cache->reg_list[EICE_DBG_CTRL];
 
                embeddedice_read_reg(dbg_ctrl);
                if ((retval = jtag_execute_queue()) != ERROR_OK)
@@ -293,62 +331,56 @@ int embeddedice_setup(target_t *target)
        return jtag_execute_queue();
 }
 
-static int embeddedice_get_reg(reg_t *reg)
-{
-       int retval;
-       if ((retval = embeddedice_read_reg(reg)) != ERROR_OK)
-       {
-               LOG_ERROR("BUG: error scheduling EmbeddedICE register read");
-               return retval;
-       }
-
-       if ((retval = jtag_execute_queue()) != ERROR_OK)
-       {
-               LOG_ERROR("register read failed");
-               return retval;
-       }
-
-       return ERROR_OK;
-}
-
-int embeddedice_read_reg_w_check(reg_t *reg, uint8_t* check_value, uint8_t* check_mask)
+/**
+ * Queue a read for an EmbeddedICE register into the register cache,
+ * optionally checking the value read.
+ * Note that at this level, all registers are 32 bits wide.
+ */
+int embeddedice_read_reg_w_check(struct reg *reg,
+               uint8_t *check_value, uint8_t *check_mask)
 {
-       embeddedice_reg_t *ice_reg = reg->arch_info;
+       struct embeddedice_reg *ice_reg = reg->arch_info;
        uint8_t reg_addr = ice_reg->addr & 0x1f;
-       scan_field_t fields[3];
+       struct scan_field fields[3];
        uint8_t field1_out[1];
        uint8_t field2_out[1];
+       int retval;
 
-       jtag_set_end_state(TAP_IDLE);
-       arm_jtag_scann(ice_reg->jtag_info, 0x2);
+       retval = arm_jtag_scann(ice_reg->jtag_info, 0x2, TAP_IDLE);
+       if (retval != ERROR_OK)
+               return retval;
 
-       arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL);
+       retval = arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
+       if (retval != ERROR_OK)
+               return retval;
 
-       fields[0].tap = ice_reg->jtag_info->tap;
+       /* bits 31:0 -- data (ignored here) */
        fields[0].num_bits = 32;
        fields[0].out_value = reg->value;
        fields[0].in_value = NULL;
        fields[0].check_value = NULL;
        fields[0].check_mask = NULL;
 
-       fields[1].tap = ice_reg->jtag_info->tap;
+       /* bits 36:32 -- register */
        fields[1].num_bits = 5;
        fields[1].out_value = field1_out;
-       buf_set_u32(fields[1].out_value, 0, 5, reg_addr);
+       field1_out[0] = reg_addr;
        fields[1].in_value = NULL;
        fields[1].check_value = NULL;
        fields[1].check_mask = NULL;
 
-       fields[2].tap = ice_reg->jtag_info->tap;
+       /* bit 37 -- 0/read */
        fields[2].num_bits = 1;
        fields[2].out_value = field2_out;
-       buf_set_u32(fields[2].out_value, 0, 1, 0);
+       field2_out[0] = 0;
        fields[2].in_value = NULL;
        fields[2].check_value = NULL;
        fields[2].check_mask = NULL;
 
-       jtag_add_dr_scan(3, fields, jtag_get_end_state());
+       /* traverse Update-DR, setting address for the next read */
+       jtag_add_dr_scan(ice_reg->jtag_info->tap, 3, fields, TAP_IDLE);
 
+       /* bits 31:0 -- the data we're reading (and maybe checking) */
        fields[0].in_value = reg->value;
        fields[0].check_value = check_value;
        fields[0].check_mask = check_mask;
@@ -357,45 +389,51 @@ int embeddedice_read_reg_w_check(reg_t *reg, uint8_t* check_value, uint8_t* chec
         * EICE_COMMS_DATA would read the register twice
         * reading the control register is safe
         */
-       buf_set_u32(fields[1].out_value, 0, 5, eice_regs[EICE_COMMS_CTRL].addr);
+       field1_out[0] = eice_regs[EICE_COMMS_CTRL].addr;
 
-       jtag_add_dr_scan_check(3, fields, jtag_get_end_state());
+       /* traverse Update-DR, reading but with no other side effects */
+       jtag_add_dr_scan_check(ice_reg->jtag_info->tap, 3, fields, TAP_IDLE);
 
        return ERROR_OK;
 }
 
-/* receive <size> words of 32 bit from the DCC
- * we pretend the target is always going to be fast enough
- * (relative to the JTAG clock), so we don't need to handshake
+/**
+ * Receive a block of size 32-bit words from the DCC.
+ * We assume the target is always going to be fast enough (relative to
+ * the JTAG clock) that the debugger won't need to poll the handshake
+ * bit.  The JTAG clock is usually at least six times slower than the
+ * functional clock, so the 50+ JTAG clocks needed to receive the word
+ * allow hundreds of instruction cycles (per word) in the target.
  */
-int embeddedice_receive(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size)
+int embeddedice_receive(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size)
 {
-       scan_field_t fields[3];
+       struct scan_field fields[3];
        uint8_t field1_out[1];
        uint8_t field2_out[1];
+       int retval;
 
-       jtag_set_end_state(TAP_IDLE);
-       arm_jtag_scann(jtag_info, 0x2);
-       arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+       retval = arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
+       if (retval != ERROR_OK)
+               return retval;
+       retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
+       if (retval != ERROR_OK)
+               return retval;
 
-       fields[0].tap = jtag_info->tap;
        fields[0].num_bits = 32;
        fields[0].out_value = NULL;
        fields[0].in_value = NULL;
 
-       fields[1].tap = jtag_info->tap;
        fields[1].num_bits = 5;
        fields[1].out_value = field1_out;
-       buf_set_u32(fields[1].out_value, 0, 5, eice_regs[EICE_COMMS_DATA].addr);
+       field1_out[0] = eice_regs[EICE_COMMS_DATA].addr;
        fields[1].in_value = NULL;
 
-       fields[2].tap = jtag_info->tap;
        fields[2].num_bits = 1;
        fields[2].out_value = field2_out;
-       buf_set_u32(fields[2].out_value, 0, 1, 0);
+       field2_out[0] = 0;
        fields[2].in_value = NULL;
 
-       jtag_add_dr_scan(3, fields, jtag_get_end_state());
+       jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
 
        while (size > 0)
        {
@@ -403,11 +441,10 @@ int embeddedice_receive(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size)
                 * to avoid reading additional data from the DCC data reg
                 */
                if (size == 1)
-                       buf_set_u32(fields[1].out_value, 0, 5,
-                                       eice_regs[EICE_COMMS_CTRL].addr);
+                       field1_out[0] = eice_regs[EICE_COMMS_CTRL].addr;
 
                fields[0].in_value = (uint8_t *)data;
-               jtag_add_dr_scan(3, fields, jtag_get_end_state());
+               jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
                jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)data);
 
                data++;
@@ -417,12 +454,20 @@ int embeddedice_receive(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size)
        return jtag_execute_queue();
 }
 
-int embeddedice_read_reg(reg_t *reg)
+/**
+ * Queue a read for an EmbeddedICE register into the register cache,
+ * not checking the value read.
+ */
+int embeddedice_read_reg(struct reg *reg)
 {
        return embeddedice_read_reg_w_check(reg, NULL, NULL);
 }
 
-void embeddedice_set_reg(reg_t *reg, uint32_t value)
+/**
+ * Queue a write for an EmbeddedICE register, updating the register cache.
+ * Uses embeddedice_write_reg().
+ */
+void embeddedice_set_reg(struct reg *reg, uint32_t value)
 {
        embeddedice_write_reg(reg, value);
 
@@ -432,77 +477,89 @@ void embeddedice_set_reg(reg_t *reg, uint32_t value)
 
 }
 
-int embeddedice_set_reg_w_exec(reg_t *reg, uint8_t *buf)
+/**
+ * Write an EmbeddedICE register, updating the register cache.
+ * Uses embeddedice_set_reg(); not queued.
+ */
+static int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf)
 {
        int retval;
-       embeddedice_set_reg(reg, buf_get_u32(buf, 0, reg->size));
 
+       embeddedice_set_reg(reg, buf_get_u32(buf, 0, reg->size));
        if ((retval = jtag_execute_queue()) != ERROR_OK)
-       {
                LOG_ERROR("register write failed");
-               return retval;
-       }
-       return ERROR_OK;
+       return retval;
 }
 
-void embeddedice_write_reg(reg_t *reg, uint32_t value)
+/**
+ * Queue a write for an EmbeddedICE register, bypassing the register cache.
+ */
+void embeddedice_write_reg(struct reg *reg, uint32_t value)
 {
-       embeddedice_reg_t *ice_reg = reg->arch_info;
+       struct embeddedice_reg *ice_reg = reg->arch_info;
+       int retval;
 
        LOG_DEBUG("%i: 0x%8.8" PRIx32 "", ice_reg->addr, value);
 
-       jtag_set_end_state(TAP_IDLE);
-       arm_jtag_scann(ice_reg->jtag_info, 0x2);
+       retval = arm_jtag_scann(ice_reg->jtag_info, 0x2, TAP_IDLE);
 
-       arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL);
+       retval = arm_jtag_set_instr(ice_reg->jtag_info, ice_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
 
        uint8_t reg_addr = ice_reg->addr & 0x1f;
        embeddedice_write_reg_inner(ice_reg->jtag_info->tap, reg_addr, value);
-
 }
 
-void embeddedice_store_reg(reg_t *reg)
+/**
+ * Queue a write for an EmbeddedICE register, using cached value.
+ * Uses embeddedice_write_reg().
+ */
+void embeddedice_store_reg(struct reg *reg)
 {
        embeddedice_write_reg(reg, buf_get_u32(reg->value, 0, reg->size));
 }
 
-/* send <size> words of 32 bit to the DCC
- * we pretend the target is always going to be fast enough
- * (relative to the JTAG clock), so we don't need to handshake
+/**
+ * Send a block of size 32-bit words to the DCC.
+ * We assume the target is always going to be fast enough (relative to
+ * the JTAG clock) that the debugger won't need to poll the handshake
+ * bit.  The JTAG clock is usually at least six times slower than the
+ * functional clock, so the 50+ JTAG clocks needed to receive the word
+ * allow hundreds of instruction cycles (per word) in the target.
  */
-int embeddedice_send(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size)
+int embeddedice_send(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size)
 {
-       scan_field_t fields[3];
+       struct scan_field fields[3];
        uint8_t field0_out[4];
        uint8_t field1_out[1];
        uint8_t field2_out[1];
+       int retval;
 
-       jtag_set_end_state(TAP_IDLE);
-       arm_jtag_scann(jtag_info, 0x2);
-       arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+       retval = arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
+       if (retval != ERROR_OK)
+               return retval;
+       retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
+       if (retval != ERROR_OK)
+               return retval;
 
-       fields[0].tap = jtag_info->tap;
        fields[0].num_bits = 32;
        fields[0].out_value = field0_out;
        fields[0].in_value = NULL;
 
-       fields[1].tap = jtag_info->tap;
        fields[1].num_bits = 5;
        fields[1].out_value = field1_out;
-       buf_set_u32(fields[1].out_value, 0, 5, eice_regs[EICE_COMMS_DATA].addr);
+       field1_out[0] = eice_regs[EICE_COMMS_DATA].addr;
        fields[1].in_value = NULL;
 
-       fields[2].tap = jtag_info->tap;
        fields[2].num_bits = 1;
        fields[2].out_value = field2_out;
-       buf_set_u32(fields[2].out_value, 0, 1, 1);
+       field2_out[0] = 1;
 
        fields[2].in_value = NULL;
 
        while (size > 0)
        {
-               buf_set_u32(fields[0].out_value, 0, 32, *data);
-               jtag_add_dr_scan(3, fields, jtag_get_end_state());
+               buf_set_u32(field0_out, 0, 32, *data);
+               jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
 
                data++;
                size--;
@@ -512,11 +569,12 @@ int embeddedice_send(arm_jtag_t *jtag_info, uint32_t *data, uint32_t size)
        return ERROR_OK;
 }
 
-/* wait for DCC control register R/W handshake bit to become active
+/**
+ * Poll DCC control register until read or write handshake completes.
  */
-int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, uint32_t timeout)
+int embeddedice_handshake(struct arm_jtag *jtag_info, int hsbit, uint32_t timeout)
 {
-       scan_field_t fields[3];
+       struct scan_field fields[3];
        uint8_t field0_in[4];
        uint8_t field1_out[1];
        uint8_t field2_out[1];
@@ -530,34 +588,36 @@ int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, uint32_t timeout)
        else if (hsbit == EICE_COMM_CTRL_RBIT)
                hsact = 0;
        else
+       {
+               LOG_ERROR("Invalid arguments");
                return ERROR_INVALID_ARGUMENTS;
+       }
 
-       jtag_set_end_state(TAP_IDLE);
-       arm_jtag_scann(jtag_info, 0x2);
-       arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL);
+       retval = arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
+       if (retval != ERROR_OK)
+               return retval;
+       retval = arm_jtag_set_instr(jtag_info, jtag_info->intest_instr, NULL, TAP_IDLE);
+       if (retval != ERROR_OK)
+               return retval;
 
-       fields[0].tap = jtag_info->tap;
        fields[0].num_bits = 32;
        fields[0].out_value = NULL;
        fields[0].in_value = field0_in;
 
-       fields[1].tap = jtag_info->tap;
        fields[1].num_bits = 5;
        fields[1].out_value = field1_out;
-       buf_set_u32(fields[1].out_value, 0, 5, eice_regs[EICE_COMMS_DATA].addr);
+       field1_out[0] = eice_regs[EICE_COMMS_DATA].addr;
        fields[1].in_value = NULL;
 
-       fields[2].tap = jtag_info->tap;
        fields[2].num_bits = 1;
        fields[2].out_value = field2_out;
-       buf_set_u32(fields[2].out_value, 0, 1, 0);
+       field2_out[0] = 0;
        fields[2].in_value = NULL;
 
-       jtag_add_dr_scan(3, fields, jtag_get_end_state());
+       jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
        gettimeofday(&lap, NULL);
-       do
-       {
-               jtag_add_dr_scan(3, fields, jtag_get_end_state());
+       do {
+               jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
                if ((retval = jtag_execute_queue()) != ERROR_OK)
                        return retval;
 
@@ -565,20 +625,26 @@ int embeddedice_handshake(arm_jtag_t *jtag_info, int hsbit, uint32_t timeout)
                        return ERROR_OK;
 
                gettimeofday(&now, NULL);
-       }
-       while ((uint32_t)((now.tv_sec-lap.tv_sec)*1000 + (now.tv_usec-lap.tv_usec)/1000) <= timeout);
+       } while ((uint32_t)((now.tv_sec - lap.tv_sec) * 1000
+                       + (now.tv_usec - lap.tv_usec) / 1000) <= timeout);
 
+       LOG_ERROR("embeddedice handshake timeout");
        return ERROR_TARGET_TIMEOUT;
 }
 
 #ifndef HAVE_JTAG_MINIDRIVER_H
-/* this is the inner loop of the open loop DCC write of data to target */
-void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, uint8_t *buffer, int little, int count)
+/**
+ * This is an inner loop of the open loop DCC write of data to target
+ */
+void embeddedice_write_dcc(struct jtag_tap *tap,
+               int reg_addr, uint8_t *buffer, int little, int count)
 {
        int i;
+
        for (i = 0; i < count; i++)
        {
-               embeddedice_write_reg_inner(tap, reg_addr, fast_target_buffer_get_u32(buffer, little));
+               embeddedice_write_reg_inner(tap, reg_addr,
+                               fast_target_buffer_get_u32(buffer, little));
                buffer += 4;
        }
 }

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)