]> git.sur5r.net Git - openocd/commitdiff
bitbang: add jtag_add_tms_seq support
authorØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 1 Mar 2010 07:25:18 +0000 (08:25 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 16 Mar 2010 20:44:38 +0000 (21:44 +0100)
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/jtag/drivers/at91rm9200.c
src/jtag/drivers/bitbang.c
src/jtag/drivers/dummy.c
src/jtag/drivers/ep93xx.c
src/jtag/drivers/parport.c
src/jtag/drivers/usb_blaster.c

index abaf3adb7eea31415a0d4e045e896e59416656ed..89d7000ca71e78cf8b90780130aa295dc0764c82 100644 (file)
@@ -126,6 +126,7 @@ struct jtag_interface at91rm9200_interface =
 {
        .name = "at91rm9200",
 
+       .supported = DEBUG_CAP_TMS_SEQ,
        .execute_queue = bitbang_execute_queue,
 
        .speed = at91rm9200_speed,
index 83c2d29ecf6b8e896c536bdd816677ee6b006ca8..6159ef7a59aaa8094ee14961b3058b0b6aa18089 100644 (file)
@@ -91,6 +91,31 @@ static void bitbang_state_move(int skip)
        tap_set_state(tap_get_end_state());
 }
 
+
+/**
+ * Clock a bunch of TMS (or SWDIO) transitions, to change the JTAG
+ * (or SWD) state machine.
+ */
+static int bitbang_execute_tms(struct jtag_command *cmd)
+{
+       unsigned        num_bits = cmd->cmd.tms->num_bits;
+       const uint8_t   *bits = cmd->cmd.tms->bits;
+
+       DEBUG_JTAG_IO("TMS: %d bits", num_bits);
+
+       int tms = 0;
+       for (unsigned i = 0; i < num_bits; i++)
+       {
+               tms = ((bits[i/8] >> (i % 8)) & 1);
+               bitbang_interface->write(0, tms, 0);
+               bitbang_interface->write(1, tms, 0);
+       }
+       bitbang_interface->write(CLOCK_IDLE(), tms, 0);
+
+       return ERROR_OK;
+}
+
+
 static void bitbang_path_move(struct pathmove_command *cmd)
 {
        int num_states = cmd->num_states;
@@ -312,6 +337,9 @@ int bitbang_execute_queue(void)
 #endif
                                jtag_sleep(cmd->cmd.sleep->us);
                                break;
+                       case JTAG_TMS:
+                               retval = bitbang_execute_tms(cmd);
+                               break;
                        default:
                                LOG_ERROR("BUG: unknown JTAG command type encountered");
                                exit(-1);
index 1880712a82c439469f770b33d15269eafeacdff0..7cb0e33c5e1406cdf7bcf8254107a915e7a0fc2f 100644 (file)
@@ -164,6 +164,7 @@ static const struct command_registration dummy_command_handlers[] = {
 struct jtag_interface dummy_interface = {
                .name = "dummy",
 
+               .supported = DEBUG_CAP_TMS_SEQ,
                .commands = dummy_command_handlers,
 
                .execute_queue = &bitbang_execute_queue,
index 61dc76ede4bdc86dfb4308f1486c6e5ca7477577..0959a5692246138374939adf04e0be3def934a74 100644 (file)
@@ -57,6 +57,7 @@ struct jtag_interface ep93xx_interface =
 {
        .name = "ep93xx",
 
+       .supported = DEBUG_CAP_TMS_SEQ,
        .execute_queue = bitbang_execute_queue,
 
        .speed = ep93xx_speed,
index fa3373b0cd32e4b7802154d0cfdeefda007a4773..2323ec56a95fa1b2736aff941a4eb0e5f4eb869c 100644 (file)
@@ -524,6 +524,7 @@ static const struct command_registration parport_command_handlers[] = {
 
 struct jtag_interface parport_interface = {
        .name = "parport",
+       .supported = DEBUG_CAP_TMS_SEQ,
        .commands = parport_command_handlers,
 
        .init = parport_init,
index 3703323bfb76aacd6d910fe1a05bf57f8cde72cc..59c5715bdf401ee281ff01deaba0bfaaa9a768d0 100644 (file)
@@ -580,6 +580,7 @@ static const struct command_registration usb_blaster_command_handlers[] = {
 struct jtag_interface usb_blaster_interface = {
        .name = "usb_blaster",
        .commands = usb_blaster_command_handlers,
+       .supported = DEBUG_CAP_TMS_SEQ,
 
        .execute_queue = bitbang_execute_queue,