This is an automated email from Gerrit.

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

-- gerrit

commit e529b3eb7519855a4f5783a9e6bec506d7c2d372
Author: Tomek CEDRO <[email protected]>
Date:   Sun Nov 11 23:33:18 2012 +0100

    Introducing ktlink_swd layout for ft2232 driver. Updated configuration 
files to use ktlink_jtag.
    IMPORTANT: old layout was renamed to ktlink_jtag, please update your 
configurations if necessary!
    
    Change-Id: I46a658398820074ca47e6b73a51ce87d0c79559b
    Signed-off-by: Tomek CEDRO <[email protected]>

diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c
index 754d657..0ec7312 100644
--- a/src/jtag/drivers/ft2232.c
+++ b/src/jtag/drivers/ft2232.c
@@ -200,7 +200,8 @@ static int icebear_jtag_init(void);
 static int cortino_jtag_init(void);
 static int signalyzer_init(void);
 static int signalyzer_h_init(void);
-static int ktlink_init(void);
+static int ktlink_init_jtag(void);
+static int ktlink_init_swd(void);
 static int redbee_init(void);
 static int lisa_l_init(void);
 static int flossjtag_init(void);
@@ -322,8 +323,13 @@ static const struct ft2232_layout  ft2232_layouts[] = {
                .reset = signalyzer_h_reset,
                .blink = signalyzer_h_blink
        },
-       { .name = "ktlink",
-               .init = ktlink_init,
+       { .name = "ktlink_jtag",
+               .init = ktlink_init_jtag,
+               .reset = ktlink_reset,
+               .blink = ktlink_blink
+       },
+       { .name = "ktlink_swd",
+               .init = ktlink_init_swd,
                .reset = ktlink_reset,
                .blink = ktlink_blink
        },
@@ -4312,7 +4318,7 @@ static void signalyzer_h_blink(void)
  * JTAG adapter from KRISTECH
  * http://www.kristech.eu
  *******************************************************************/
-static int ktlink_init(void)
+static int ktlink_init_jtag(void)
 {
        uint8_t swd_en = 0x20;  /* 0x20 SWD disable, 0x00 SWD enable (ADBUS5) */
 
@@ -4360,6 +4366,51 @@ static int ktlink_init(void)
        return ERROR_OK;
 }
 
+/* KT-LINK SWD Support added by Tomasz Boleslaw CEDRO 
(http://www.tomek.cedro.info). */
+static int ktlink_init_swd(void)
+{
+       /* High Byte (ACBUS) members. */
+       static uint8_t nSWCLKen = 0x40, nTDIen = 0x20, TRST = 0x01, nTRSTen = 
0x04, SRST = 0x02, nSRSTen = 0x08, LED = 0x80,
+                       RnW = 0x10;
+       /* Low Byte (ADBUS) members. */
+       static uint8_t SWCLK = 0x01, TDI = 0x02, TDO = 0x04, nSWDIOsel = 0x20;
+
+       nTRST    = TRST;
+       nSRST    = SRST;
+       nTRSTnOE = nTRSTen;
+       nSRSTnOE = nSRSTen;
+
+       /* Set ADBUS Port Data: SWCLK=0, TDI=0,TDO=1, nSWDIOsel=0 */
+       low_output = 0 | TDO;
+       /* Set ADBUS Port Direction (1=Output) */
+       low_direction = 0 | SWCLK | TDI | nSWDIOsel;
+
+       /* initialize low byte port (ADBUS) */
+       if (ft2232_set_data_bits_low_byte(low_output, low_direction) != 
ERROR_OK) {
+               LOG_ERROR("couldn't initialize FT2232 ADBUS with 'ktlink_swd' 
layout");
+               return ERROR_JTAG_INIT_FAILED;
+       }
+
+       /* Set Data Bits High Byte (ACBUS)                                */
+       /* Enable SWD pins  : nTCKen=0, RnW=1, nSRSTen=0, nLED=0, SRST=1  */
+       /* Disable JTAG pins: nTDIen=1, nSWDIOen=1, nTRSTen=1             */
+       high_output = 0 | RnW | SRST | nTDIen | nTRSTen;
+       /* Set ACBUS Port Direction (1=Output) */
+       high_direction = 0 | RnW | nSWCLKen | nTDIen | nTRSTen | nSRSTen | SRST 
| LED;
+
+       /* initialize high byte port (ACBUS) */
+       if (ft2232_set_data_bits_high_byte(high_output, high_direction) != 
ERROR_OK) {
+               LOG_ERROR("couldn't initialize FT2232 ACBUS with 'ktlink_swd' 
layout");
+               return ERROR_JTAG_INIT_FAILED;
+       }
+
+       /* Additional bit-bang signals should be placed in a configuration 
file. */
+
+       LOG_INFO("KT-LINK SWD-Mode initialization complete...");
+       return ERROR_OK;
+}
+
+
 static void ktlink_reset(int trst, int srst)
 {
        enum reset_types jtag_reset_config = jtag_get_reset_config();
@@ -4504,4 +4555,3 @@ struct jtag_interface ft2232_interface_swd = {
        .transfer = ft2232_transfer,
        .bitbang = ft2232_bitbang,
 };
-
diff --git a/tcl/interface/jtag-lock-pick_tiny_2.cfg 
b/tcl/interface/jtag-lock-pick_tiny_2.cfg
index 539f0f9..a12a467 100644
--- a/tcl/interface/jtag-lock-pick_tiny_2.cfg
+++ b/tcl/interface/jtag-lock-pick_tiny_2.cfg
@@ -6,5 +6,5 @@
 
 interface ft2232
 ft2232_device_desc "JTAG-lock-pick Tiny 2"
-ft2232_layout ktlink
+ft2232_layout ktlink_jtag
 ft2232_vid_pid 0x0403 0x8220
diff --git a/tcl/interface/kt-link.cfg b/tcl/interface/kt-link.cfg
index 640e547..c4977fe 100644
--- a/tcl/interface/kt-link.cfg
+++ b/tcl/interface/kt-link.cfg
@@ -6,7 +6,7 @@
 
 interface ft2232
 ft2232_device_desc "KT-LINK"
-ft2232_layout ktlink
+ft2232_layout ktlink_jtag
 ft2232_vid_pid 0x0403 0xBBE2
 
 interface_signal add LED 0x8000

-- 

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to