} openjtag_tap_state_t;
/* OPENJTAG access library includes */
-#include <ftdi.h>
+#include "libftdi_helper.h"
/* OpenJTAG vid/pid */
static uint16_t openjtag_vid = 0x0403;
uint8_t latency_timer;
/* Open by device description */
- if (openjtag_device_desc == NULL) {
+ if (!openjtag_device_desc) {
LOG_WARNING("no openjtag device description specified, "
"using default 'Open JTAG Project'");
openjtag_device_desc = "Open JTAG Project";
return ERROR_JTAG_DEVICE_ERROR;
}
- if (ftdi_usb_purge_buffers(&ftdic) < 0) {
- LOG_ERROR("ftdi_purge_buffers: %s", ftdic.error_str);
+ if (ftdi_tcioflush(&ftdic) < 0) {
+ LOG_ERROR("ftdi flush: %s", ftdic.error_str);
return ERROR_JTAG_INIT_FAILED;
}
return ERROR_OK;
err:
- if (usbh != NULL)
+ if (usbh)
jtag_libusb_close(usbh);
return ERROR_JTAG_INIT_FAILED;
}
#endif
jtag_read_buffer(buffer, openjtag_scan_result_buffer[res_count].command);
- if (openjtag_scan_result_buffer[res_count].buffer)
- free(openjtag_scan_result_buffer[res_count].buffer);
+ free(openjtag_scan_result_buffer[res_count].buffer);
res_count++;
}
{
struct jtag_command *cmd = jtag_command_queue;
- while (cmd != NULL) {
+ while (cmd) {
openjtag_execute_command(cmd);
cmd = cmd->next;
}
return ERROR_OK;
}
-static const struct command_registration openjtag_command_handlers[] = {
+static const struct command_registration openjtag_subcommand_handlers[] = {
{
- .name = "openjtag_device_desc",
+ .name = "device_desc",
.handler = openjtag_handle_device_desc_command,
.mode = COMMAND_CONFIG,
.help = "set the USB device description of the OpenJTAG",
.usage = "description-string",
},
{
- .name = "openjtag_variant",
+ .name = "variant",
.handler = openjtag_handle_variant_command,
.mode = COMMAND_CONFIG,
.help = "set the OpenJTAG variant",
COMMAND_REGISTRATION_DONE
};
+static const struct command_registration openjtag_command_handlers[] = {
+ {
+ .name = "openjtag",
+ .mode = COMMAND_ANY,
+ .help = "perform openjtag management",
+ .chain = openjtag_subcommand_handlers,
+ .usage = "",
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
static struct jtag_interface openjtag_interface = {
.execute_queue = openjtag_execute_queue,
};