X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fjtag%2Fdrivers%2Fftdi.c;h=e7f3c3dcea292bbc1eaf7464ecb38cbe43af5d93;hp=e69707e5a70ee31236b1b010ef9908b2f5af49f2;hb=4db695c66c9240232a0c7a4af494657ea0e18da5;hpb=1003bc7be7c471d28794280be69632c5f074789f diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c index e69707e5a7..e7f3c3dcea 100644 --- a/src/jtag/drivers/ftdi.c +++ b/src/jtag/drivers/ftdi.c @@ -53,11 +53,11 @@ * * This code uses information contained in the MPSSE specification which was * found here: - * http://www.ftdichip.com/Documents/AppNotes/AN2232C-01_MPSSE_Cmnd.pdf + * https://www.ftdichip.com/Support/Documents/AppNotes/AN2232C-01_MPSSE_Cmnd.pdf * Hereafter this is called the "MPSSE Spec". * - * The datasheet for the ftdichip.com's FT2232D part is here: - * http://www.ftdichip.com/Documents/DataSheets/DS_FT2232D.pdf + * The datasheet for the ftdichip.com's FT2232H part is here: + * https://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT2232H.pdf * * Also note the issue with code 0x4b (clock data to TMS) noted in * http://developer.intra2net.com/mailarchive/html/libftdi/2009/msg00292.html @@ -69,6 +69,7 @@ #endif /* project specific includes */ +#include #include #include #include @@ -89,7 +90,6 @@ static char *ftdi_device_desc; static char *ftdi_serial; -static char *ftdi_location; static uint8_t ftdi_channel; static uint8_t ftdi_jtag_mode = JTAG_MODE; @@ -439,11 +439,11 @@ static void ftdi_execute_scan(struct jtag_command *cmd) while (cmd->cmd.scan->num_fields > 0 && cmd->cmd.scan->fields[cmd->cmd.scan->num_fields - 1].num_bits == 0) { cmd->cmd.scan->num_fields--; - LOG_DEBUG("discarding trailing empty field"); + DEBUG_JTAG_IO("discarding trailing empty field"); } if (cmd->cmd.scan->num_fields == 0) { - LOG_DEBUG("empty scan, doing nothing"); + DEBUG_JTAG_IO("empty scan, doing nothing"); return; } @@ -658,7 +658,7 @@ static int ftdi_initialize(void) for (int i = 0; ftdi_vid[i] || ftdi_pid[i]; i++) { mpsse_ctx = mpsse_open(&ftdi_vid[i], &ftdi_pid[i], ftdi_device_desc, - ftdi_serial, ftdi_location, ftdi_channel); + ftdi_serial, jtag_usb_get_location(), ftdi_channel); if (mpsse_ctx) break; } @@ -694,6 +694,17 @@ static int ftdi_quit(void) { mpsse_close(mpsse_ctx); + struct signal *sig = signals; + while (sig) { + struct signal *next = sig->next; + free((void *)sig->name); + free(sig); + sig = next; + } + + free(ftdi_device_desc); + free(ftdi_serial); + free(swd_cmd_queue); return ERROR_OK; @@ -725,21 +736,6 @@ COMMAND_HANDLER(ftdi_handle_serial_command) return ERROR_OK; } -#ifdef HAVE_LIBUSB_GET_PORT_NUMBERS -COMMAND_HANDLER(ftdi_handle_location_command) -{ - if (CMD_ARGC == 1) { - if (ftdi_location) - free(ftdi_location); - ftdi_location = strdup(CMD_ARGV[0]); - } else { - return ERROR_COMMAND_SYNTAX_ERROR; - } - - return ERROR_OK; -} -#endif - COMMAND_HANDLER(ftdi_handle_channel_command) { if (CMD_ARGC == 1) @@ -954,15 +950,6 @@ static const struct command_registration ftdi_command_handlers[] = { .help = "set the serial number of the FTDI device", .usage = "serial_string", }, -#ifdef HAVE_LIBUSB_GET_PORT_NUMBERS - { - .name = "ftdi_location", - .handler = &ftdi_handle_location_command, - .mode = COMMAND_CONFIG, - .help = "set the USB bus location of the FTDI device", - .usage = ":port[,port]...", - }, -#endif { .name = "ftdi_channel", .handler = &ftdi_handle_channel_command, @@ -1068,7 +1055,7 @@ static void ftdi_swd_swdio_en(bool enable) if (oe->data_mask) ftdi_set_signal(oe, enable ? '1' : '0'); else { - /* Sets TDI/DO pin (pin 2) to input during rx when both pins are connected + /* Sets TDI/DO pin to input during rx when both pins are connected to SWDIO */ if (enable) direction |= jtag_direction_init & 0x0002U;