summaryrefslogtreecommitdiff
path: root/src/jtag/gw16012.c
diff options
context:
space:
mode:
authordrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-01-31 10:59:20 +0000
committerdrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-01-31 10:59:20 +0000
commit4102c784321e68d8d82174148a51d4bcd8f14c82 (patch)
tree0692fbb5a3755271d5eae54da1b0b94c0e9eabbf /src/jtag/gw16012.c
parentc7383a8bea5743ee05928c35eb7c35fd3094b225 (diff)
downloadopenocd+libswd-4102c784321e68d8d82174148a51d4bcd8f14c82.tar.gz
openocd+libswd-4102c784321e68d8d82174148a51d4bcd8f14c82.tar.bz2
openocd+libswd-4102c784321e68d8d82174148a51d4bcd8f14c82.tar.xz
openocd+libswd-4102c784321e68d8d82174148a51d4bcd8f14c82.zip
- 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
Diffstat (limited to 'src/jtag/gw16012.c')
-rw-r--r--src/jtag/gw16012.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/jtag/gw16012.c b/src/jtag/gw16012.c
index 6210a52c..218ac4c6 100644
--- a/src/jtag/gw16012.c
+++ b/src/jtag/gw16012.c
@@ -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);