- renamed jtag_interface_t.support_statemove to jtag_interface_t.support_pathmove (it is used to indicate jtag_add_pathmove support)

- fixed small bug in str7x.c that printed an address instead of the target number in an error message
- added support for Olimex ARM-USB-OCD. The new ft2232 layout is called "olimex-jtag"


git-svn-id: svn://svn.berlios.de/openocd/trunk@87 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
drath 2006-08-17 14:53:15 +00:00
parent 9a830747b2
commit 5fcd1d704c
8 changed files with 153 additions and 14 deletions

View File

@ -166,7 +166,7 @@ int str7x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
str7x_info->target = get_target_by_num(strtoul(args[6], NULL, 0));
if (!str7x_info->target)
{
ERROR("no target '%i' configured", args[6]);
ERROR("no target '%s' configured", args[6]);
exit(-1);
}

View File

@ -117,7 +117,7 @@ jtag_interface_t amt_jtagaccel_interface =
.execute_queue = amt_jtagaccel_execute_queue,
.support_statemove = 0,
.support_pathmove = 0,
.speed = amt_jtagaccel_speed,
.register_commands = amt_jtagaccel_register_commands,

View File

@ -142,7 +142,11 @@ void bitbang_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
for (bit_cnt = 0; bit_cnt < scan_size; bit_cnt++)
{
if ((buffer[bit_cnt/8] >> (bit_cnt % 8)) & 0x1) {
/* if we're just reading the scan, but don't care about the output
* default to outputting 'low', this also makes valgrind traces more readable,
* as it removes the dependency on an uninitialised value
*/
if ((type != SCAN_IN) && ((buffer[bit_cnt/8] >> (bit_cnt % 8)) & 0x1)) {
bitbang_interface->write(0, (bit_cnt==scan_size-1) ? 1 : 0, 1);
bitbang_interface->write(1, (bit_cnt==scan_size-1) ? 1 : 0, 1);
} else {

View File

@ -67,7 +67,7 @@ jtag_interface_t ep93xx_interface =
.execute_queue = bitbang_execute_queue,
.support_statemove = 0,
.support_pathmove = 0,
.speed = ep93xx_speed,
.register_commands = ep93xx_register_commands,

View File

@ -83,19 +83,29 @@ typedef struct ft2232_layout_s
char* name;
int(*init)(void);
void(*reset)(int trst, int srst);
void(*blink)(void);
} ft2232_layout_t;
/* init procedures for supported layouts */
int usbjtag_init(void);
int jtagkey_init(void);
int olimex_jtag_init(void);
/* reset procedures for supported layouts */
void usbjtag_reset(int trst, int srst);
void jtagkey_reset(int trst, int srst);
void olimex_jtag_reset(int trst, int srst);
/* blink procedures for layouts that support a blinking led */
void olimex_jtag_blink(void);
ft2232_layout_t ft2232_layouts[] =
{
{"usbjtag", usbjtag_init, usbjtag_reset},
{"jtagkey", jtagkey_init, jtagkey_reset},
{"jtagkey_prototype_v1", jtagkey_init, jtagkey_reset},
{"signalyzer", usbjtag_init, usbjtag_reset},
{"usbjtag", usbjtag_init, usbjtag_reset, NULL},
{"jtagkey", jtagkey_init, jtagkey_reset, NULL},
{"jtagkey_prototype_v1", jtagkey_init, jtagkey_reset, NULL},
{"signalyzer", usbjtag_init, usbjtag_reset, NULL},
{"olimex-jtag", olimex_jtag_init, olimex_jtag_reset, olimex_jtag_blink},
{NULL, NULL, NULL},
};
@ -128,7 +138,7 @@ jtag_interface_t ft2232_interface =
.execute_queue = ft2232_execute_queue,
.support_statemove = 1,
.support_pathmove = 1,
.speed = ft2232_speed,
.register_commands = ft2232_register_commands,
@ -674,6 +684,40 @@ void jtagkey_reset(int trst, int srst)
DEBUG("trst: %i, srst: %i, high_output: 0x%2.2x, high_direction: 0x%2.2x", trst, srst, high_output, high_direction);
}
void olimex_jtag_reset(int trst, int srst)
{
if (trst == 1)
{
cur_state = TAP_TLR;
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
high_output &= ~nTRSTnOE;
else
high_output &= ~nTRST;
}
else if (trst == 0)
{
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
high_output |= nTRSTnOE;
else
high_output |= nTRST;
}
if (srst == 1)
{
high_output |= nSRST;
}
else if (srst == 0)
{
high_output &= ~nSRST;
}
/* command "set data bits high byte" */
BUFFER_ADD = 0x82;
BUFFER_ADD = high_output;
BUFFER_ADD = high_direction;
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 */
@ -688,6 +732,10 @@ int ft2232_execute_queue()
ft2232_buffer_size = 0;
ft2232_expect_read = 0;
/* blink, if the current layout has that feature */
if (layout->blink)
layout->blink();
while (cmd)
{
switch(cmd->type)
@ -1170,7 +1218,7 @@ int jtagkey_init(void)
}
/* initialize high port */
buf[0] = 0x82; /* command "set data bits low byte" */
buf[0] = 0x82; /* command "set data bits high byte" */
buf[1] = high_output; /* value */
buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */
DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
@ -1184,6 +1232,93 @@ int jtagkey_init(void)
return ERROR_OK;
}
int olimex_jtag_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, nOE=out */
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))
{
ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
return ERROR_JTAG_INIT_FAILED;
}
nTRST = 0x01;
nTRSTnOE = 0x4;
nSRST = 0x02;
nSRSTnOE = 0x00; /* no output enable for nSRST */
high_output = 0x0;
high_direction = 0x0f;
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
high_output |= nTRSTnOE;
high_output &= ~nTRST;
}
else
{
high_output &= ~nTRSTnOE;
high_output |= nTRST;
}
if (jtag_reset_config & RESET_SRST_PUSH_PULL)
{
ERROR("can't set nSRST to push-pull on the Olimex ARM-USB-OCD");
}
else
{
high_output &= ~nSRST;
}
/* turn red LED on */
high_output |= 0x08;
/* 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) */
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))
{
ERROR("couldn't initialize FT2232 with 'JTAGkey' layout");
return ERROR_JTAG_INIT_FAILED;
}
return ERROR_OK;
}
void olimex_jtag_blink(void)
{
/* Olimex ARM-USB-OCD has a LED connected to ACBUS3
* ACBUS3 is bit 3 of the GPIOH port
*/
if (high_output & 0x08)
{
/* set port pin high */
high_output &= 0x07;
}
else
{
/* set port pin low */
high_output |= 0x08;
}
BUFFER_ADD = 0x82;
BUFFER_ADD = high_output;
BUFFER_ADD = high_direction;
}
int ft2232_quit(void)
{
#if BUILD_FT2232_FTD2XX == 1

View File

@ -694,7 +694,7 @@ int jtag_add_pathmove(int num_states, enum tap_state *path)
return ERROR_JTAG_NOT_IMPLEMENTED;
}
if (jtag->support_statemove)
if (jtag->support_pathmove)
{
/* allocate memory for a new list member */
*last_cmd = cmd_queue_alloc(sizeof(jtag_command_t));

View File

@ -25,7 +25,7 @@
#include "command.h"
#if 0
#if 1
#define _DEBUG_JTAG_IO_
#endif
@ -180,7 +180,7 @@ typedef struct jtag_interface_s
/* optional command support
*/
int support_statemove;
int support_pathmove;
/* interface initalization
*/

View File

@ -138,7 +138,7 @@ jtag_interface_t parport_interface =
.execute_queue = bitbang_execute_queue,
.support_statemove = 0,
.support_pathmove = 1,
.speed = parport_speed,
.register_commands = parport_register_commands,