Sten <debian@sansys-electronic.com>: add support for ICEbear FDTI-based interface.
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 29 Apr 2009 07:38:35 +0000 (07:38 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Wed, 29 Apr 2009 07:38:35 +0000 (07:38 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1565 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/jtag/ft2232.c
src/target/interface/icebear.cfg [new file with mode: 0644]

index 3075b1b495c81aa78f9eaa512987e99ba6b0749e..a7e4e7b929a00e5dec5ab217279cd885b60c663d 100644 (file)
@@ -114,6 +114,7 @@ static int  comstick_init(void);
 static int  stm32stick_init(void);
 static int  axm0432_jtag_init(void);
 static int sheevaplug_init(void);
+static int icebear_jtag_init(void);
 
 /* reset procedures for supported layouts */
 static void usbjtag_reset(int trst, int srst);
@@ -125,6 +126,7 @@ static void comstick_reset(int trst, int srst);
 static void stm32stick_reset(int trst, int srst);
 static void axm0432_jtag_reset(int trst, int srst);
 static void sheevaplug_reset(int trst, int srst);
+static void icebear_jtag_reset(int trst, int srst);
 
 /* blink procedures for layouts that support a blinking led */
 static void olimex_jtag_blink(void);
@@ -146,6 +148,7 @@ ft2232_layout_t            ft2232_layouts[] =
        { "stm32stick",           stm32stick_init,           stm32stick_reset,   NULL                    },
        { "axm0432_jtag",         axm0432_jtag_init,         axm0432_jtag_reset, NULL                    },
        {"sheevaplug",            sheevaplug_init,           sheevaplug_reset,   NULL                    },
+       { "icebear",              icebear_jtag_init,         icebear_jtag_reset, NULL                    },
        { NULL,                   NULL,                      NULL,               NULL                    },
 };
 
@@ -2661,3 +2664,105 @@ static int ft2232_stableclocks(int num_cycles, jtag_command_t* cmd)
 
        return retval;
 }
+
+/* ---------------------------------------------------------------------
+ * Support for IceBear JTAG adapter from Section5:
+ *     http://section5.ch/icebear
+ *
+ * Author: Sten, debian@sansys-electronic.com
+ */
+
+/* Icebear pin layout
+ *
+ * ADBUS5 (nEMU) nSRST | 2   1|        GND (10k->VCC)
+ * GND GND             | 4   3|        n.c.
+ * ADBUS3 TMS          | 6   5|        ADBUS6 VCC
+ * ADBUS0 TCK          | 8   7|        ADBUS7 (GND)
+ * ADBUS4 nTRST                |10   9|        ACBUS0 (GND)
+ * ADBUS1 TDI          |12  11|        ACBUS1 (GND)
+ * ADBUS2 TDO          |14  13|        GND GND
+ *
+ * ADBUS0 O L TCK              ACBUS0 GND
+ * ADBUS1 O L TDI              ACBUS1 GND
+ * ADBUS2 I   TDO              ACBUS2 n.c.
+ * ADBUS3 O H TMS              ACBUS3 n.c.
+ * ADBUS4 O H nTRST
+ * ADBUS5 O H nSRST
+ * ADBUS6 -   VCC
+ * ADBUS7 -   GND
+ */
+static int icebear_jtag_init(void) {
+       u8  buf[3];
+       u32 bytes_written;
+
+       low_direction   = 0x0b; /* output: TCK TDI TMS; input: TDO */
+       low_output      = 0x08; /* high: TMS; low: TCK TDI */
+       nTRST           = 0x10;
+       nSRST           = 0x20;
+
+       if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0) {
+               low_direction   &= ~nTRST;      /* nTRST high impedance */
+       }
+       else {
+               low_direction   |= nTRST;
+               low_output      |= nTRST;
+       }
+
+       low_direction   |= nSRST;
+       low_output      |= nSRST;
+
+       /* initialize low byte for jtag */
+       buf[0] = 0x80;          /* command "set data bits low byte" */
+       buf[1] = low_output;
+       buf[2] = low_direction;
+       LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
+
+       if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) {
+               LOG_ERROR("couldn't initialize FT2232 with 'IceBear' layout (low)");
+               return ERROR_JTAG_INIT_FAILED;
+       }
+
+       high_output    = 0x0;
+       high_direction = 0x00;
+
+
+       /* initialize high port */
+       buf[0] = 0x82;              /* command "set data bits high byte" */
+       buf[1] = high_output;       /* value */
+       buf[2] = high_direction;    /* all outputs (xRST and xRSTnOE) */
+       LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
+
+       if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) {
+               LOG_ERROR("couldn't initialize FT2232 with 'IceBear' layout (high)");
+               return ERROR_JTAG_INIT_FAILED;
+       }
+
+       return ERROR_OK;
+}
+
+static void icebear_jtag_reset(int trst, int srst) {
+
+       if (trst == 1) {
+               low_direction   |= nTRST;
+               low_output      &= ~nTRST;
+       }
+       else if (trst == 0) {
+               if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0)
+                       low_direction   &= ~nTRST;
+               else
+                       low_output      |= nTRST;
+       }
+
+       if (srst == 1) {
+               low_output &= ~nSRST;
+       }
+       else if (srst == 0) {
+               low_output |= nSRST;
+       }
+
+       /* command "set data bits low byte" */
+       BUFFER_ADD = 0x80;
+       BUFFER_ADD = low_output;
+       BUFFER_ADD = low_direction;
+       LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", trst, srst, low_output, low_direction);
+}
diff --git a/src/target/interface/icebear.cfg b/src/target/interface/icebear.cfg
new file mode 100644 (file)
index 0000000..97b50da
--- /dev/null
@@ -0,0 +1,23 @@
+#####################################################
+# IceBear Configuration
+#
+# http://section5.ch/icebear
+#
+# Author: Sten, debian@sansys-electronic.com
+#####################################################
+#
+# Add file /etc/udev/rules.d/45-icebear.rules
+#
+#BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="kcontrol_rules_end"
+#
+#SYSFS{idProduct}=="c140", SYSFS{idVendor}=="0403", MODE="666", GROUP="usb"
+#SYSFS{idProduct}=="c141", SYSFS{idVendor}=="0403", MODE="666", GROUP="usb"
+#
+#LABEL="kcontrol_rules_end"
+#
+
+interface ft2232
+#ft2232_device_desc ""
+ft2232_layout icebear
+ft2232_vid_pid 0x0403 0xc140
+

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)