This is an automated email from Gerrit.

Karl Palsson ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/3403

-- gerrit

commit 2b599d0175c0229b15978070900f51c2be2879a7
Author: Karl Palsson <[email protected]>
Date:   Wed Apr 13 23:42:48 2016 +0000

    drivers: cmsis-dap: pull up common connect code
    
    Just a minor deduplication
    
    Change-Id: Idd256883e5f6d4bd4dcc18462dd5468991f507b3
    Signed-off-by: Karl Palsson <[email protected]>

diff --git a/src/jtag/drivers/cmsis_dap_usb.c b/src/jtag/drivers/cmsis_dap_usb.c
index 889c14c..00ecd45 100644
--- a/src/jtag/drivers/cmsis_dap_usb.c
+++ b/src/jtag/drivers/cmsis_dap_usb.c
@@ -764,17 +764,6 @@ static int cmsis_dap_swd_open(void)
 {
        int retval;
 
-       if (cmsis_dap_handle == NULL) {
-               /* SWD init */
-               retval = cmsis_dap_usb_open();
-               if (retval != ERROR_OK)
-                       return retval;
-
-               retval = cmsis_dap_get_caps_info();
-               if (retval != ERROR_OK)
-                       return retval;
-       }
-
        if (!(cmsis_dap_handle->caps & INFO_CAPS_SWD)) {
                LOG_ERROR("CMSIS-DAP: SWD not supported");
                return ERROR_JTAG_DEVICE_ERROR;
@@ -795,6 +784,14 @@ static int cmsis_dap_init(void)
        int retval;
        uint8_t *data;
 
+       retval = cmsis_dap_usb_open();
+       if (retval != ERROR_OK)
+               return retval;
+
+       retval = cmsis_dap_get_caps_info();
+       if (retval != ERROR_OK)
+               return retval;
+
        if (swd_mode) {
                retval = cmsis_dap_swd_open();
                if (retval != ERROR_OK)
@@ -802,16 +799,6 @@ static int cmsis_dap_init(void)
        }
 
        if (cmsis_dap_handle == NULL) {
-
-               /* JTAG init */
-               retval = cmsis_dap_usb_open();
-               if (retval != ERROR_OK)
-                       return retval;
-
-               retval = cmsis_dap_get_caps_info();
-               if (retval != ERROR_OK)
-                       return retval;
-
                /* Connect in JTAG mode */
                if (!(cmsis_dap_handle->caps & INFO_CAPS_JTAG)) {
                        LOG_ERROR("CMSIS-DAP: JTAG not supported");

-- 

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to