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 <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2182
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
__archive__
Paul Fertser 2014-06-20 13:13:27 +04:00 committed by Andreas Fritiofson
parent a87e699edf
commit 64d02ccf82
1 changed files with 31 additions and 0 deletions

View 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));