summaryrefslogtreecommitdiff
path: root/src/jtag/bitbang.c
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-01-09 07:42:45 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-01-09 07:42:45 +0000
commit9324e6280edfda501d1cf52e5d46b1c4aa083935 (patch)
treec3a361a162932dc68ac4c2ae9f9e04f5b867e09c /src/jtag/bitbang.c
parentebd5afbb0e879aeb124f62fdf0bdb6ff5889834b (diff)
downloadopenocd_libswd-9324e6280edfda501d1cf52e5d46b1c4aa083935.tar.gz
openocd_libswd-9324e6280edfda501d1cf52e5d46b1c4aa083935.tar.bz2
openocd_libswd-9324e6280edfda501d1cf52e5d46b1c4aa083935.tar.xz
openocd_libswd-9324e6280edfda501d1cf52e5d46b1c4aa083935.zip
Dick Hollenbeck <dick@softplc.com> adds jtag_add_clocks() and implements those in the bitbang and ft2232.c. nearly a full rewrite of the xsvf.c. improved some messaging only affected by _DEBUG_JTAG_IO_
git-svn-id: svn://svn.berlios.de/openocd/trunk@1308 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/jtag/bitbang.c')
-rw-r--r--src/jtag/bitbang.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/jtag/bitbang.c b/src/jtag/bitbang.c
index 2d04e108..e4191d14 100644
--- a/src/jtag/bitbang.c
+++ b/src/jtag/bitbang.c
@@ -37,6 +37,10 @@
#include <stdlib.h>
#include <unistd.h>
+
+static void bitbang_stableclocks(int num_cycles);
+
+
bitbang_interface_t *bitbang_interface;
/* DANGER!!!! clock absolutely *MUST* be 0 in idle or reset won't work!
@@ -61,6 +65,8 @@ bitbang_interface_t *bitbang_interface;
int bitbang_execute_queue(void);
+
+
/* The bitbang driver leaves the TCK 0 when in idle */
void bitbang_end_state(enum tap_state state)
@@ -153,6 +159,21 @@ void bitbang_runtest(int num_cycles)
bitbang_state_move();
}
+
+static void bitbang_stableclocks(int num_cycles)
+{
+ int i;
+
+ /* send num_cycles clocks onto the cable */
+ for (i = 0; i < num_cycles; i++)
+ {
+ bitbang_interface->write(1, 0, 0);
+ bitbang_interface->write(0, 0, 0);
+ }
+}
+
+
+
void bitbang_scan(int ir_scan, enum scan_type type, u8 *buffer, int scan_size)
{
enum tap_state saved_end_state = end_state;
@@ -247,7 +268,7 @@ int bitbang_execute_queue(void)
{
case JTAG_END_STATE:
#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG("end_state: %i", cmd->cmd.end_state->end_state);
+ LOG_DEBUG("end_state: %s", jtag_state_name(cmd->cmd.end_state->end_state) );
#endif
if (cmd->cmd.end_state->end_state != -1)
bitbang_end_state(cmd->cmd.end_state->end_state);
@@ -264,15 +285,20 @@ int bitbang_execute_queue(void)
break;
case JTAG_RUNTEST:
#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG("runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, cmd->cmd.runtest->end_state);
+ LOG_DEBUG("runtest %i cycles, end in %s", cmd->cmd.runtest->num_cycles, jtag_state_name(cmd->cmd.runtest->end_state) );
#endif
if (cmd->cmd.runtest->end_state != -1)
bitbang_end_state(cmd->cmd.runtest->end_state);
bitbang_runtest(cmd->cmd.runtest->num_cycles);
break;
+
+ case JTAG_STABLECLOCKS:
+ bitbang_stableclocks(cmd->cmd.stableclocks->num_cycles);
+ break;
+
case JTAG_STATEMOVE:
#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG("statemove end in %i", cmd->cmd.statemove->end_state);
+ LOG_DEBUG("statemove end in %s", jtag_state_name(cmd->cmd.statemove->end_state));
#endif
if (cmd->cmd.statemove->end_state != -1)
bitbang_end_state(cmd->cmd.statemove->end_state);
@@ -280,13 +306,14 @@ int bitbang_execute_queue(void)
break;
case JTAG_PATHMOVE:
#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG("pathmove: %i states, end in %i", cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]);
+ LOG_DEBUG("pathmove: %i states, end in %s", cmd->cmd.pathmove->num_states,
+ jtag_state_name(cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]));
#endif
bitbang_path_move(cmd->cmd.pathmove);
break;
case JTAG_SCAN:
#ifdef _DEBUG_JTAG_IO_
- LOG_DEBUG("%s scan end in %i", (cmd->cmd.scan->ir_scan) ? "IR" : "DR", cmd->cmd.scan->end_state);
+ LOG_DEBUG("%s scan end in %s", (cmd->cmd.scan->ir_scan) ? "IR" : "DR", jtag_state_name(cmd->cmd.scan->end_state) );
#endif
if (cmd->cmd.scan->end_state != -1)
bitbang_end_state(cmd->cmd.scan->end_state);