- merged several changes from XScale

- complain about identify_chain scan with all bits one (jtag communication problem)
- add 0x80000 as a valid size for lpc2000_v2 flash banks (previously only the user accessible 0x7d000 were valid)


git-svn-id: svn://svn.berlios.de/openocd/trunk@129 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
drath 2007-01-31 10:59:20 +00:00
parent c7383a8bea
commit 4102c78432
6 changed files with 88 additions and 8 deletions

View File

@ -47,6 +47,8 @@
* - 213x
* - 214x
* - 2101|2|3
* - 2364|6|8
* - 2378
*/
int lpc2000_register_commands(struct command_context_s *cmd_ctx);
@ -171,6 +173,7 @@ int lpc2000_build_sector_list(struct flash_bank_s *bank)
case 256 * 1024:
num_sectors = 15;
break;
case 512 * 1024:
case 500 * 1024:
num_sectors = 27;
break;

View File

@ -25,6 +25,10 @@
#include "jtag.h"
#if 1
#define _DEBUG_GW16012_IO_
#endif
/* system includes */
/* system includes */
@ -123,6 +127,10 @@ void gw16012_data(u8 value)
{
value = (value & 0x7f) | gw16012_msb;
gw16012_msb ^= 0x80; /* toggle MSB */
#ifdef _DEBUG_GW16012_IO_
DEBUG("%2.2x", value);
#endif
#if PARPORT_USE_PPDEV == 1
ioctl(device_handle, PPWDATA, &value);
@ -141,6 +149,10 @@ void gw16012_control(u8 value)
{
gw16012_control_value = value;
#ifdef _DEBUG_GW16012_IO_
DEBUG("%2.2x", gw16012_control_value);
#endif
#if PARPORT_USE_PPDEV == 1
ioctl(device_handle, PPWCONTROL, &gw16012_control_value);
#else
@ -160,6 +172,10 @@ void gw16012_input(u8 *value)
#else
*value = inb(gw16012_port + 1);
#endif
#ifdef _DEBUG_GW16012_IO_
DEBUG("%2.2x", *value);
#endif
}
/* (1) assert or (0) deassert reset lines */
@ -211,6 +227,37 @@ void gw16012_state_move(void)
cur_state = end_state;
}
void gw16012_path_move(pathmove_command_t *cmd)
{
int num_states = cmd->num_states;
int state_count;
state_count = 0;
while (num_states)
{
gw16012_control(0x0); /* single-bit mode */
if (tap_transitions[cur_state].low == cmd->path[state_count])
{
gw16012_data(0x0); /* TCK cycle with TMS low */
}
else if (tap_transitions[cur_state].high == cmd->path[state_count])
{
gw16012_data(0x2); /* TCK cycle with TMS high */
}
else
{
ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_strings[cur_state], tap_state_strings[cmd->path[state_count]]);
exit(-1);
}
cur_state = cmd->path[state_count];
state_count++;
num_states--;
}
end_state = cur_state;
}
void gw16012_runtest(int num_cycles)
{
enum tap_state saved_end_state = end_state;
@ -343,6 +390,12 @@ int gw16012_execute_queue(void)
gw16012_end_state(cmd->cmd.statemove->end_state);
gw16012_state_move();
break;
case JTAG_PATHMOVE:
#ifdef _DEBUG_JTAG_IO_
DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
#endif
gw16012_path_move(cmd->cmd.pathmove);
break;
case JTAG_SCAN:
if (cmd->cmd.scan->end_state != -1)
gw16012_end_state(cmd->cmd.scan->end_state);

View File

@ -95,6 +95,14 @@ tap_transition_t tap_transitions[16] =
{TAP_SDS, TAP_RTI} /* UI */
};
char* jtag_event_strings[] =
{
"SRST asserted",
"TRST asserted",
"SRST released",
"TRST released"
};
enum tap_state end_state = TAP_TLR;
enum tap_state cur_state = TAP_TLR;
int jtag_trst = 0;
@ -184,6 +192,18 @@ char* jtag_interface = NULL;
int jtag_speed = -1;
/* forward declarations */
int jtag_add_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
int jtag_add_dr_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
int jtag_add_plain_ir_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
int jtag_add_plain_dr_scan(int num_fields, scan_field_t *fields, enum tap_state endstate);
int jtag_add_statemove(enum tap_state endstate);
int jtag_add_pathmove(int num_states, enum tap_state *path);
int jtag_add_runtest(int num_cycles, enum tap_state endstate);
int jtag_add_reset(int trst, int srst);
int jtag_add_end_state(enum tap_state endstate);
int jtag_add_sleep(u32 us);
int jtag_execute_queue(void);
int jtag_cancel_queue(void);
/* jtag commands */
int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
@ -255,7 +275,7 @@ int jtag_call_event_callbacks(enum jtag_event event)
{
jtag_event_callback_t *callback = jtag_event_callbacks;
DEBUG("jtag event: %i", event);
DEBUG("jtag event: %s", jtag_event_strings[event]);
while (callback)
{
@ -1128,7 +1148,8 @@ int jtag_examine_chain()
int i;
int bit_count;
int device_count = 0;
u8 valid = 0x0;
u8 zero_check = 0x0;
u8 one_check = 0xff;
field.device = 0;
field.num_bits = sizeof(idcode_buffer) * 8;
@ -1150,11 +1171,12 @@ int jtag_examine_chain()
for (i = 0; i < JTAG_MAX_CHAIN_SIZE * 4; i++)
{
valid |= idcode_buffer[i];
zero_check |= idcode_buffer[i];
one_check &= idcode_buffer[i];
}
/* if there wasn't a single non-zero bit, the scan isn't valid */
if (!valid)
/* if there wasn't a single non-zero bit or if all bits were one, the scan isn't valid */
if ((zero_check == 0x00) || (one_check == 0xff))
{
ERROR("JTAG communication failure, check connection, JTAG interface, target power etc.");
exit(-1);

View File

@ -25,7 +25,7 @@
#include "command.h"
#if 0
#if 1
#define _DEBUG_JTAG_IO_
#endif
@ -199,6 +199,8 @@ enum jtag_event
JTAG_TRST_RELEASED,
};
extern char* jtag_event_strings[];
extern int jtag_trst;
extern int jtag_srst;

View File

@ -99,7 +99,7 @@ cable_t cables[] =
{ "dlc5", 0x10, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x10 },
{ "triton", 0x80, 0x08, 0x04, 0x01, 0x02, 0x00, 0x00, 0x80, 0x00 },
{ "lattice", 0x40, 0x10, 0x04, 0x02, 0x01, 0x08, 0x00, 0x00, 0x18 },
{ "flashlink", 0x20, 0x10, 0x02, 0x01, 0x04, 0x20,0x30, 0x20, 0x00 },
{ "flashlink", 0x20, 0x10, 0x02, 0x01, 0x04, 0x20, 0x30, 0x20, 0x00 },
{ NULL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
};

View File

@ -18,7 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#define OPENOCD_VERSION "Open On-Chip Debugger (2006-01-26 13:30 CET)"
#define OPENOCD_VERSION "Open On-Chip Debugger (2007-01-31 12:00 CET)"
#ifdef HAVE_CONFIG_H
#include "config.h"