stlink: add hardware srst functions to stlink/v2
authorSpencer Oliver <spen@spen-soft.co.uk>
Thu, 19 Apr 2012 14:45:06 +0000 (15:45 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Mon, 30 Apr 2012 13:04:38 +0000 (13:04 +0000)
Change-Id: Ib82b6a1116b9f396f1933cc5526733334254fd62
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/579
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Mathias K├╝ster <kesmtp@freenet.de>
src/jtag/drivers/stlink_usb.c
src/jtag/stlink/stlink_layout.h

index 6fe958e84e5c79c9a0278a946e87c521a2cc96ae..d40436a0a6fdda28c70bd8efd753055f7fc1f080 100644 (file)
@@ -719,6 +719,8 @@ static enum target_state stlink_usb_v2_get_status(void *handle)
 
        if (status & S_HALT)
                return TARGET_HALTED;
+       else if (status & S_RESET_ST)
+               return TARGET_RESET;
 
        return TARGET_RUNNING;
 }
@@ -783,6 +785,32 @@ static int stlink_usb_reset(void *handle)
        return h->databuf[0] == STLINK_DEBUG_ERR_OK ? ERROR_OK : ERROR_FAIL;
 }
 
+static int stlink_usb_assert_srst(void *handle, int srst)
+{
+       int res;
+       struct stlink_usb_handle_s *h;
+
+       assert(handle != NULL);
+
+       h = (struct stlink_usb_handle_s *)handle;
+
+       if (h->jtag_api == STLINK_JTAG_API_V1)
+               return ERROR_COMMAND_NOTFOUND;
+
+       stlink_usb_init_buffer(handle, STLINK_RX_EP, 2);
+
+       h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND;
+       h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_DRIVE_NRST;
+       h->cmdbuf[h->cmdidx++] = srst;
+
+       res = stlink_usb_xfer(handle, h->databuf, 2);
+
+       if (res != ERROR_OK)
+               return res;
+
+       return h->databuf[0] == STLINK_DEBUG_ERR_OK ? ERROR_OK : ERROR_FAIL;
+}
+
 /** */
 static int stlink_usb_run(void *handle)
 {
@@ -1223,6 +1251,8 @@ struct stlink_layout_api_s stlink_usb_layout_api = {
        /** */
        .reset = stlink_usb_reset,
        /** */
+       .assert_srst = stlink_usb_assert_srst,
+       /** */
        .run = stlink_usb_run,
        /** */
        .halt = stlink_usb_halt,
index 59e6174cf90b6d142172320624f053a710f5e3b2..e0da75c74743f3b3049168d8087f8f9e6c0de54b 100644 (file)
@@ -37,6 +37,8 @@ struct stlink_layout_api_s {
        /** */
        int (*reset) (void *fd);
        /** */
+       int (*assert_srst) (void *fd, int srst);
+       /** */
        int (*run) (void *fd);
        /** */
        int (*halt) (void *fd);

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)