summaryrefslogtreecommitdiff
path: root/src/jtag/ft2232.c
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-03-01 21:01:11 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-03-01 21:01:11 +0000
commit38228317921901e87beb70cba0c170092470e3e5 (patch)
treefe679ad1cd0b2936a67a40ed6be675a3ce33d097 /src/jtag/ft2232.c
parentf8c97a5d2e15c630479406cf5cc6a6e384336110 (diff)
downloadopenocd+libswd-38228317921901e87beb70cba0c170092470e3e5.tar.gz
openocd+libswd-38228317921901e87beb70cba0c170092470e3e5.tar.bz2
openocd+libswd-38228317921901e87beb70cba0c170092470e3e5.tar.xz
openocd+libswd-38228317921901e87beb70cba0c170092470e3e5.zip
Nicolas Pitre nico at cam.org add ft2232 layout for the Marvell SheevaPlug
git-svn-id: svn://svn.berlios.de/openocd/trunk@1390 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/jtag/ft2232.c')
-rw-r--r--src/jtag/ft2232.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c
index 115cd7c2..50ff6548 100644
--- a/src/jtag/ft2232.c
+++ b/src/jtag/ft2232.c
@@ -124,6 +124,7 @@ int turtle_init(void);
int comstick_init(void);
int stm32stick_init(void);
int axm0432_jtag_init(void);
+int sheevaplug_init(void);
/* reset procedures for supported layouts */
void usbjtag_reset(int trst, int srst);
@@ -134,6 +135,7 @@ void turtle_reset(int trst, int srst);
void comstick_reset(int trst, int srst);
void stm32stick_reset(int trst, int srst);
void axm0432_jtag_reset(int trst, int srst);
+void sheevaplug_reset(int trst, int srst);
/* blink procedures for layouts that support a blinking led */
void olimex_jtag_blink(void);
@@ -153,6 +155,7 @@ ft2232_layout_t ft2232_layouts[] =
{ "comstick", comstick_init, comstick_reset, NULL },
{ "stm32stick", stm32stick_init, stm32stick_reset, NULL },
{ "axm0432_jtag", axm0432_jtag_init, axm0432_jtag_reset, NULL },
+ {"sheevaplug", sheevaplug_init, sheevaplug_reset, NULL },
{ NULL, NULL, NULL },
};
@@ -1253,6 +1256,26 @@ void stm32stick_reset(int trst, int srst)
}
+
+void sheevaplug_reset(int trst, int srst)
+{
+ if (trst == 1)
+ high_output &= ~nTRST;
+ else if (trst == 0)
+ high_output |= nTRST;
+
+ if (srst == 1)
+ high_output &= ~nSRSTnOE;
+ else if (srst == 0)
+ high_output |= nSRSTnOE;
+
+ /* command "set data bits high byte" */
+ BUFFER_ADD = 0x82;
+ BUFFER_ADD = high_output;
+ BUFFER_ADD = high_direction;
+ LOG_DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction);
+}
+
int ft2232_execute_queue()
{
jtag_command_t* cmd = jtag_command_queue; /* currently processed command */
@@ -2261,6 +2284,57 @@ int stm32stick_init(void)
}
+int sheevaplug_init(void)
+{
+ u8 buf[3];
+ u32 bytes_written;
+
+ low_output = 0x08;
+ low_direction = 0x1b;
+
+ /* initialize low byte for jtag */
+ buf[0] = 0x80; /* command "set data bits low byte" */
+ buf[1] = low_output; /* value (TMS=1,TCK=0, TDI=0, nOE=0) */
+ buf[2] = low_direction; /* dir (output=1), TCK/TDI/TMS=out, TDO=in */
+ 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 'sheevaplug' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ nTRSTnOE = 0x1;
+ nTRST = 0x02;
+ nSRSTnOE = 0x4;
+ nSRST = 0x08;
+
+ high_output = 0x0;
+ high_direction = 0x0f;
+
+ /* nTRST is always push-pull */
+ high_output &= ~nTRSTnOE;
+ high_output |= nTRST;
+
+ /* nSRST is always open-drain */
+ high_output |= nSRSTnOE;
+ high_output &= ~nSRST;
+
+ /* initialize high port */
+ buf[0] = 0x82; /* command "set data bits high byte" */
+ buf[1] = high_output; /* value */
+ buf[2] = high_direction; /* all outputs - xRST */
+ 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 'sheevaplug' layout");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ return ERROR_OK;
+}
+
void olimex_jtag_blink(void)
{
/* Olimex ARM-USB-OCD has a LED connected to ACBUS3