libjaylink: Update to 0.1.0 release
[openocd.git] / src / jtag / drivers / cmsis_dap_usb.c
index a07064be5d904e80fcfdf2c9d17906de087d8b27..dd37522ad169e595cc05cedd0a2f3caed93e0cdb 100644 (file)
@@ -118,6 +118,13 @@ static bool swd_mode;
  * Bit 7: nRESET
  */
 
+#define SWJ_PIN_TCK               (1<<0)
+#define SWJ_PIN_TMS               (1<<1)
+#define SWJ_PIN_TDI               (1<<2)
+#define SWJ_PIN_TDO               (1<<3)
+#define SWJ_PIN_TRST              (1<<5)
+#define SWJ_PIN_SRST              (1<<7)
+
 /* CMSIS-DAP SWD Commands */
 #define CMD_DAP_SWD_CONFIGURE     0x13
 
@@ -309,9 +316,11 @@ static int cmsis_dap_usb_open(void)
        int packet_size = PACKET_SIZE;
 
        /* atmel cmsis-dap uses 512 byte reports */
+       /* except when it doesn't e.g. with mEDBG on SAMD10 Xplained
+        * board */
        /* TODO: HID report descriptor should be parsed instead of
         * hardcoding a match by VID */
-       if (target_vid == 0x03eb)
+       if (target_vid == 0x03eb && target_pid != 0x2145)
                packet_size = 512 + 1;
 
        cmsis_dap_handle->packet_buffer = malloc(packet_size);
@@ -764,12 +773,12 @@ static int cmsis_dap_get_status(void)
 
        if (retval == ERROR_OK) {
                LOG_INFO("SWCLK/TCK = %d SWDIO/TMS = %d TDI = %d TDO = %d nTRST = %d nRESET = %d",
-                       (d & (0x01 << 0)) ? 1 : 0,      /* Bit 0: SWCLK/TCK */
-                       (d & (0x01 << 1)) ? 1 : 0,      /* Bit 1: SWDIO/TMS */
-                       (d & (0x01 << 2)) ? 1 : 0,      /* Bit 2: TDI */
-                       (d & (0x01 << 3)) ? 1 : 0,      /* Bit 3: TDO */
-                       (d & (0x01 << 5)) ? 1 : 0,      /* Bit 5: nTRST */
-                       (d & (0x01 << 7)) ? 1 : 0);     /* Bit 7: nRESET */
+                       (d & SWJ_PIN_TCK) ? 1 : 0,
+                       (d & SWJ_PIN_TMS) ? 1 : 0,
+                       (d & SWJ_PIN_TDI) ? 1 : 0,
+                       (d & SWJ_PIN_TDO) ? 1 : 0,
+                       (d & SWJ_PIN_TRST) ? 1 : 0,
+                       (d & SWJ_PIN_SRST) ? 1 : 0);
        }
 
        return retval;
@@ -990,8 +999,17 @@ static int cmsis_dap_quit(void)
 
 static void cmsis_dap_execute_reset(struct jtag_command *cmd)
 {
-       int retval = cmsis_dap_cmd_DAP_SWJ_Pins(cmd->cmd.reset->srst ? 0 : (1 << 7), \
-                       (1 << 7), 0, NULL);
+       /* Set both TRST and SRST even if they're not enabled as
+        * there's no way to tristate them */
+       uint8_t pins = 0;
+
+       if (!cmd->cmd.reset->srst)
+               pins |= SWJ_PIN_SRST;
+       if (!cmd->cmd.reset->trst)
+               pins |= SWJ_PIN_TRST;
+
+       int retval = cmsis_dap_cmd_DAP_SWJ_Pins(pins,
+                       SWJ_PIN_TRST | SWJ_PIN_SRST, 0, NULL);
        if (retval != ERROR_OK)
                LOG_ERROR("CMSIS-DAP: Interface reset failed");
 }

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)