summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo L. Rosa <rodrigorosa.lg@gmail.com>2011-06-10 12:19:32 -0700
committerØyvind Harboe <oyvind.harboe@zylin.com>2011-06-12 11:18:27 +0200
commit56d3927abf2d2c6c49f3ae6ad6c2f353168d5a60 (patch)
treeb1cb4ab373c66bd22813a33af63d7efac256b725
parente899fcaca0d207eadea569b9dd9b2d54afafcfd4 (diff)
downloadopenocd_libswd-56d3927abf2d2c6c49f3ae6ad6c2f353168d5a60.tar.gz
openocd_libswd-56d3927abf2d2c6c49f3ae6ad6c2f353168d5a60.tar.bz2
openocd_libswd-56d3927abf2d2c6c49f3ae6ad6c2f353168d5a60.tar.xz
openocd_libswd-56d3927abf2d2c6c49f3ae6ad6c2f353168d5a60.zip
Added minimodule (ftdi) interface
-rw-r--r--src/jtag/drivers/ft2232.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c
index 8c2382a1..7c283278 100644
--- a/src/jtag/drivers/ft2232.c
+++ b/src/jtag/drivers/ft2232.c
@@ -177,6 +177,7 @@ static int lm3s811_jtag_init(void);
static int icdi_jtag_init(void);
static int olimex_jtag_init(void);
static int flyswatter_init(void);
+static int minimodule_init(void);
static int turtle_init(void);
static int comstick_init(void);
static int stm32stick_init(void);
@@ -197,6 +198,7 @@ static void ftx23_reset(int trst, int srst);
static void jtagkey_reset(int trst, int srst);
static void olimex_jtag_reset(int trst, int srst);
static void flyswatter_reset(int trst, int srst);
+static void minimodule_reset(int trst, int srst);
static void turtle_reset(int trst, int srst);
static void comstick_reset(int trst, int srst);
static void stm32stick_reset(int trst, int srst);
@@ -261,6 +263,10 @@ static const struct ft2232_layout ft2232_layouts[] =
.reset = flyswatter_reset,
.blink = flyswatter_jtag_blink
},
+ { .name = "minimodule",
+ .init = minimodule_init,
+ .reset = minimodule_reset,
+ },
{ .name = "turtelizer2",
.init = turtle_init,
.reset = turtle_reset,
@@ -1565,6 +1571,24 @@ static void flyswatter_reset(int trst, int srst)
LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", trst, srst, low_output, low_direction);
}
+static void minimodule_reset(int trst, int srst)
+{
+ if (srst == 1)
+ {
+ low_output &= ~nSRST;
+ }
+ else if (srst == 0)
+ {
+ low_output |= nSRST;
+ }
+
+ /* command "set data bits low byte" */
+ buffer_write(0x80);
+ buffer_write(low_output);
+ buffer_write(low_direction);
+ LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", trst, srst, low_output, low_direction);
+}
+
static void turtle_reset(int trst, int srst)
{
trst = trst;
@@ -2900,6 +2924,37 @@ static int flyswatter_init(void)
return ERROR_OK;
}
+static int minimodule_init(void)
+{
+ low_output = 0x18;//check if srst should be 1 or 0 initially. (0x08) (flyswatter was 0x18)
+ low_direction = 0xfb;//0xfb;
+
+ /* initialize low byte for jtag */
+ if (ft2232_set_data_bits_low_byte(low_output,low_direction) != ERROR_OK)
+ {
+ LOG_ERROR("couldn't initialize FT2232 with 'minimodule' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+
+ nSRST = 0x20;
+
+ high_output = 0x00;
+ high_direction = 0x05;
+
+ /* turn red LED3 on, LED2 off */
+ //high_output |= 0x08;
+
+ /* initialize high byte for jtag */
+ if (ft2232_set_data_bits_high_byte(high_output,high_direction) != ERROR_OK)
+ {
+ LOG_ERROR("couldn't initialize FT2232 with 'minimodule' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ return ERROR_OK;
+}
+
static int turtle_init(void)
{
low_output = 0x08;