]> git.sur5r.net Git - openocd/commitdiff
jtag/drivers/ftdi: declare standard JTAG signals on SWD init
authorPaul Fertser <fercerpav@gmail.com>
Fri, 20 Jun 2014 09:13:27 +0000 (13:13 +0400)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Sat, 28 Jun 2014 09:36:17 +0000 (09:36 +0000)
Unfortunately, this means they're available for config files only
after selecting swd transport.

Change-Id: Ia2afc1f3bfdba8d81efbb8ab964b174c0f7e2811
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2182
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
src/jtag/drivers/ftdi.c

index 9d3444738930fb5065cdeddd2bbad935e1fdfddc..292a44107417075a74c646a231c88cb00e9bb96a 100644 (file)
@@ -901,11 +901,42 @@ static const struct command_registration ftdi_command_handlers[] = {
        COMMAND_REGISTRATION_DONE
 };
 
+static int create_default_signal(const char *name, uint16_t data_mask)
+{
+       struct signal *sig = create_signal(name);
+       if (!sig) {
+               LOG_ERROR("failed to create signal %s", name);
+               return ERROR_FAIL;
+       }
+       sig->invert_data = false;
+       sig->data_mask = data_mask;
+       sig->invert_oe = false;
+       sig->oe_mask = 0;
+
+       return ERROR_OK;
+}
+
+static int create_signals(void)
+{
+       if (create_default_signal("TCK", 0x01) != ERROR_OK)
+               return ERROR_FAIL;
+       if (create_default_signal("TDI", 0x02) != ERROR_OK)
+               return ERROR_FAIL;
+       if (create_default_signal("TDO", 0x04) != ERROR_OK)
+               return ERROR_FAIL;
+       if (create_default_signal("TMS", 0x08) != ERROR_OK)
+               return ERROR_FAIL;
+       return ERROR_OK;
+}
+
 static int ftdi_swd_init(void)
 {
        LOG_INFO("FTDI SWD mode enabled");
        swd_mode = true;
 
+       if (create_signals() != ERROR_OK)
+               return ERROR_FAIL;
+
        swd_cmd_queue_alloced = 10;
        swd_cmd_queue = malloc(swd_cmd_queue_alloced * sizeof(*swd_cmd_queue));