summaryrefslogtreecommitdiff
path: root/src/jtag/dummy.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/dummy.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/dummy.c')
-rw-r--r--src/jtag/dummy.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/src/jtag/dummy.c b/src/jtag/dummy.c
index bfdf0dcc..434a28de 100644
--- a/src/jtag/dummy.c
+++ b/src/jtag/dummy.c
@@ -32,8 +32,13 @@ static tap_state_t dummy_state = TAP_RESET;
static int dummy_clock; /* edge detector */
+static int clock_count; /* count clocks in any stable state, only stable states */
+
+
static tap_state_t tap_state_transition(tap_state_t cur_state, int tms);
+static u32 dummy_data;
+
int dummy_speed(int speed);
int dummy_register_commands(struct command_context_s *cmd_ctx);
@@ -76,7 +81,9 @@ bitbang_interface_t dummy_bitbang =
int dummy_read(void)
{
- return 1;
+ int data = 1 & dummy_data;
+ dummy_data = (dummy_data >> 1) | (1<<31);
+ return data;
}
@@ -88,9 +95,30 @@ void dummy_write(int tck, int tms, int tdi)
if( tck )
{
int old_state = dummy_state;
- dummy_state = tap_state_transition( dummy_state, tms );
+ dummy_state = tap_state_transition( old_state, tms );
+
if( old_state != dummy_state )
- LOG_DEBUG( "dummy_tap=%s", jtag_state_name(dummy_state) );
+ {
+ if( clock_count )
+ {
+ LOG_DEBUG("dummy_tap: %d stable clocks", clock_count);
+ clock_count = 0;
+ }
+
+ LOG_DEBUG("dummy_tap: %s", jtag_state_name(dummy_state) );
+
+#if defined(DEBUG)
+ if(dummy_state == TAP_DRCAPTURE)
+ dummy_data = 0x01255043;
+#endif
+ }
+ else
+ {
+ /* this is a stable state clock edge, no change of state here,
+ * simply increment clock_count for subsequent logging
+ */
+ ++clock_count;
+ }
}
dummy_clock = tck;
}
@@ -99,8 +127,11 @@ void dummy_write(int tck, int tms, int tdi)
void dummy_reset(int trst, int srst)
{
dummy_clock = 0;
- dummy_state = TAP_RESET;
- LOG_DEBUG( "reset to %s", jtag_state_name(dummy_state) );
+
+ if (trst || (srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
+ dummy_state = TAP_RESET;
+
+ LOG_DEBUG("reset to: %s", jtag_state_name(dummy_state) );
}
static int dummy_khz(int khz, int *jtag_speed)