From 64d02ccf82b865293e495e51cbdec6f12bb9ff96 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Fri, 20 Jun 2014 13:13:27 +0400 Subject: [PATCH] jtag/drivers/ftdi: declare standard JTAG signals on SWD init Unfortunately, this means they're available for config files only after selecting swd transport. Change-Id: Ia2afc1f3bfdba8d81efbb8ab964b174c0f7e2811 Signed-off-by: Paul Fertser Reviewed-on: http://openocd.zylin.com/2182 Tested-by: jenkins Reviewed-by: Andreas Fritiofson --- src/jtag/drivers/ftdi.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c index 9d344473..292a4410 100644 --- a/src/jtag/drivers/ftdi.c +++ b/src/jtag/drivers/ftdi.c @@ -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)); -- 2.39.5