You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

687 lines
17 KiB

  1. /*******************************************************************************
  2. * Driver for OpenJTAG Project (www.openjtag.org) *
  3. * Compatible with libftdi driver. *
  4. * *
  5. * Copyright (C) 2010 by Ivan Meleca <mileca@gmail.com> *
  6. * *
  7. * Copyright (C) 2013 by Ryan Corbin, GlueLogix Inc. <corbin.ryan@gmail.com> *
  8. * Updated to work with OpenOCD v0.7.0. Fixed libftdi read speed issue. *
  9. * *
  10. * Based on usb_blaster.c *
  11. * Copyright (C) 2009 Catalin Patulea *
  12. * Copyright (C) 2006 Kolja Waschk *
  13. * *
  14. * And jlink.c *
  15. * Copyright (C) 2008 by Spencer Oliver *
  16. * spen@spen-soft.co.uk *
  17. * *
  18. * This program is free software; you can redistribute it and/or modify *
  19. * it under the terms of the GNU General Public License as published by *
  20. * the Free Software Foundation; either version 2 of the License, or *
  21. * (at your option) any later version. *
  22. * *
  23. * This program is distributed in the hope that it will be useful, *
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  26. * GNU General Public License for more details. *
  27. * *
  28. * You should have received a copy of the GNU General Public License *
  29. * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  30. ***************************************************************************/
  31. /***************************************************************************
  32. * Version 1.0 Tested on a MCBSTM32 board using a Cortex-M3 (stm32f103x), *
  33. * GDB and Eclipse under Linux (Ubuntu 10.04) *
  34. * *
  35. ***************************************************************************/
  36. #ifdef HAVE_CONFIG_H
  37. #include "config.h"
  38. #endif
  39. #include <jtag/interface.h>
  40. #include <jtag/commands.h>
  41. #include "usb_common.h"
  42. /*
  43. * OpenJTAG-OpenOCD state conversion
  44. */
  45. typedef enum openjtag_tap_state {
  46. OPENJTAG_TAP_INVALID = -1,
  47. OPENJTAG_TAP_RESET = 0,
  48. OPENJTAG_TAP_IDLE = 1,
  49. OPENJTAG_TAP_SELECT_DR = 2,
  50. OPENJTAG_TAP_CAPTURE_DR = 3,
  51. OPENJTAG_TAP_SHIFT_DR = 4,
  52. OPENJTAG_TAP_EXIT1_DR = 5,
  53. OPENJTAG_TAP_PAUSE_DR = 6,
  54. OPENJTAG_TAP_EXIT2_DR = 7,
  55. OPENJTAG_TAP_UPDATE_DR = 8,
  56. OPENJTAG_TAP_SELECT_IR = 9,
  57. OPENJTAG_TAP_CAPURE_IR = 10,
  58. OPENJTAG_TAP_SHIFT_IR = 11,
  59. OPENJTAG_TAP_EXIT1_IR = 12,
  60. OPENJTAG_TAP_PAUSE_IR = 13,
  61. OPENJTAG_TAP_EXIT2_IR = 14,
  62. OPENJTAG_TAP_UPDATE_IR = 15,
  63. } openjtag_tap_state_t;
  64. /* OPENJTAG access library includes */
  65. #include <ftdi.h>
  66. /* OpenJTAG vid/pid */
  67. static uint16_t openjtag_vid = 0x0403;
  68. static uint16_t openjtag_pid = 0x6001;
  69. static char *openjtag_device_desc;
  70. static struct ftdi_context ftdic;
  71. #define OPENJTAG_BUFFER_SIZE 504
  72. #define OPENJTAG_MAX_PENDING_RESULTS 256
  73. struct openjtag_scan_result {
  74. uint32_t bits; /* Length in bits*/
  75. struct scan_command *command; /* Corresponding scan command */
  76. uint8_t *buffer;
  77. };
  78. /* USB RX/TX buffers */
  79. static int usb_tx_buf_offs;
  80. static uint8_t usb_tx_buf[OPENJTAG_BUFFER_SIZE];
  81. static uint32_t usb_rx_buf_len;
  82. static uint8_t usb_rx_buf[OPENJTAG_BUFFER_SIZE];
  83. /* Pending readings */
  84. static struct openjtag_scan_result openjtag_scan_result_buffer[OPENJTAG_MAX_PENDING_RESULTS];
  85. static int openjtag_scan_result_count;
  86. /* Openocd usb handler */
  87. struct openocd {
  88. struct usb_dev_handle *usb_handle;
  89. };
  90. #ifdef _DEBUG_USB_COMMS_
  91. #define DEBUG_TYPE_READ 0
  92. #define DEBUG_TYPE_WRITE 1
  93. #define DEBUG_TYPE_OCD_READ 2
  94. #define DEBUG_TYPE_BUFFER 3
  95. #define LINE_LEN 16
  96. static void openjtag_debug_buffer(uint8_t *buffer, int length, uint8_t type)
  97. {
  98. char line[128];
  99. char s[4];
  100. int i;
  101. int j;
  102. switch (type) {
  103. case DEBUG_TYPE_READ:
  104. sprintf(line, "USB READ %d bytes", length);
  105. break;
  106. case DEBUG_TYPE_WRITE:
  107. sprintf(line, "USB WRITE %d bytes", length);
  108. break;
  109. case DEBUG_TYPE_OCD_READ:
  110. sprintf(line, "TO OpenOCD %d bytes", length);
  111. break;
  112. case DEBUG_TYPE_BUFFER:
  113. sprintf(line, "Buffer %d bytes", length);
  114. break;
  115. }
  116. LOG_DEBUG("%s", line);
  117. for (i = 0; i < length; i += LINE_LEN) {
  118. switch (type) {
  119. case DEBUG_TYPE_READ:
  120. sprintf(line, "USB READ: %04x", i);
  121. break;
  122. case DEBUG_TYPE_WRITE:
  123. sprintf(line, "USB WRITE: %04x", i);
  124. break;
  125. case DEBUG_TYPE_OCD_READ:
  126. sprintf(line, "TO OpenOCD: %04x", i);
  127. break;
  128. case DEBUG_TYPE_BUFFER:
  129. sprintf(line, "BUFFER: %04x", i);
  130. break;
  131. }
  132. for (j = i; j < i + LINE_LEN && j < length; j++) {
  133. sprintf(s, " %02x", buffer[j]);
  134. strcat(line, s);
  135. }
  136. LOG_DEBUG("%s", line);
  137. }
  138. }
  139. #endif
  140. static int8_t openjtag_get_tap_state(int8_t state)
  141. {
  142. switch (state) {
  143. case TAP_DREXIT2: return OPENJTAG_TAP_EXIT2_DR;
  144. case TAP_DREXIT1: return OPENJTAG_TAP_EXIT1_DR;
  145. case TAP_DRSHIFT: return OPENJTAG_TAP_SHIFT_DR;
  146. case TAP_DRPAUSE: return OPENJTAG_TAP_PAUSE_DR;
  147. case TAP_IRSELECT: return OPENJTAG_TAP_SELECT_IR;
  148. case TAP_DRUPDATE: return OPENJTAG_TAP_UPDATE_DR;
  149. case TAP_DRCAPTURE: return OPENJTAG_TAP_CAPTURE_DR;
  150. case TAP_DRSELECT: return OPENJTAG_TAP_SELECT_DR;
  151. case TAP_IREXIT2: return OPENJTAG_TAP_EXIT2_IR;
  152. case TAP_IREXIT1: return OPENJTAG_TAP_EXIT1_IR;
  153. case TAP_IRSHIFT: return OPENJTAG_TAP_SHIFT_IR;
  154. case TAP_IRPAUSE: return OPENJTAG_TAP_PAUSE_IR;
  155. case TAP_IDLE: return OPENJTAG_TAP_IDLE;
  156. case TAP_IRUPDATE: return OPENJTAG_TAP_UPDATE_IR;
  157. case TAP_IRCAPTURE: return OPENJTAG_TAP_CAPURE_IR;
  158. case TAP_RESET: return OPENJTAG_TAP_RESET;
  159. case TAP_INVALID:
  160. default: return OPENJTAG_TAP_INVALID;
  161. }
  162. }
  163. static int openjtag_buf_write(
  164. uint8_t *buf, int size, uint32_t *bytes_written)
  165. {
  166. int retval;
  167. #ifdef _DEBUG_USB_COMMS_
  168. openjtag_debug_buffer(buf, size, DEBUG_TYPE_WRITE);
  169. #endif
  170. retval = ftdi_write_data(&ftdic, buf, size);
  171. if (retval < 0) {
  172. *bytes_written = 0;
  173. LOG_ERROR("ftdi_write_data: %s", ftdi_get_error_string(&ftdic));
  174. return ERROR_JTAG_DEVICE_ERROR;
  175. }
  176. *bytes_written += retval;
  177. return ERROR_OK;
  178. }
  179. static int openjtag_buf_read(uint8_t *buf, uint32_t qty, uint32_t *bytes_read)
  180. {
  181. int retval;
  182. int timeout = 5;
  183. *bytes_read = 0;
  184. while ((*bytes_read < qty) && timeout--) {
  185. retval = ftdi_read_data(&ftdic, buf + *bytes_read,
  186. qty - *bytes_read);
  187. if (retval < 0) {
  188. *bytes_read = 0;
  189. DEBUG_JTAG_IO("ftdi_read_data: %s",
  190. ftdi_get_error_string(&ftdic));
  191. return ERROR_JTAG_DEVICE_ERROR;
  192. }
  193. *bytes_read += retval;
  194. }
  195. #ifdef _DEBUG_USB_COMMS_
  196. openjtag_debug_buffer(buf, *bytes_read, DEBUG_TYPE_READ);
  197. #endif
  198. return ERROR_OK;
  199. }
  200. static int openjtag_sendcommand(uint8_t cmd)
  201. {
  202. uint32_t written;
  203. return openjtag_buf_write(&cmd, 1, &written);
  204. }
  205. static int openjtag_speed(int speed)
  206. {
  207. int clockcmd;
  208. switch (speed) {
  209. case 48000:
  210. clockcmd = 0x00;
  211. break;
  212. case 24000:
  213. clockcmd = 0x20;
  214. break;
  215. case 12000:
  216. clockcmd = 0x40;
  217. break;
  218. case 6000:
  219. clockcmd = 0x60;
  220. break;
  221. case 3000:
  222. clockcmd = 0x80;
  223. break;
  224. case 1500:
  225. clockcmd = 0xA0;
  226. break;
  227. case 750:
  228. clockcmd = 0xC0;
  229. break;
  230. case 375:
  231. clockcmd = 0xE0;
  232. break;
  233. default:
  234. clockcmd = 0xE0;
  235. LOG_WARNING("adapter speed not recognized, reverting to 375 kHz");
  236. break;
  237. }
  238. openjtag_sendcommand(clockcmd);
  239. return ERROR_OK;
  240. }
  241. static int openjtag_init(void)
  242. {
  243. uint8_t latency_timer;
  244. usb_tx_buf_offs = 0;
  245. usb_rx_buf_len = 0;
  246. openjtag_scan_result_count = 0;
  247. LOG_DEBUG("'openjtag' interface using libftdi");
  248. /* Open by device description */
  249. if (openjtag_device_desc == NULL) {
  250. LOG_WARNING("no openjtag device description specified, "
  251. "using default 'Open JTAG Project'");
  252. openjtag_device_desc = "Open JTAG Project";
  253. }
  254. if (ftdi_init(&ftdic) < 0)
  255. return ERROR_JTAG_INIT_FAILED;
  256. /* context, vendor id, product id, description, serial id */
  257. if (ftdi_usb_open_desc(&ftdic, openjtag_vid, openjtag_pid, openjtag_device_desc, NULL) < 0) {
  258. LOG_ERROR("unable to open ftdi device: %s", ftdic.error_str);
  259. return ERROR_JTAG_INIT_FAILED;
  260. }
  261. if (ftdi_usb_reset(&ftdic) < 0) {
  262. LOG_ERROR("unable to reset ftdi device");
  263. return ERROR_JTAG_INIT_FAILED;
  264. }
  265. if (ftdi_set_latency_timer(&ftdic, 2) < 0) {
  266. LOG_ERROR("unable to set latency timer");
  267. return ERROR_JTAG_INIT_FAILED;
  268. }
  269. if (ftdi_get_latency_timer(&ftdic, &latency_timer) < 0) {
  270. LOG_ERROR("unable to get latency timer");
  271. return ERROR_JTAG_INIT_FAILED;
  272. }
  273. LOG_DEBUG("current latency timer: %u", latency_timer);
  274. ftdi_disable_bitbang(&ftdic);
  275. /* was (3000000 / 4) with a comment about a bug in libftdi when using high baudrate */
  276. if (ftdi_set_baudrate(&ftdic, 3000000) < 0) {
  277. LOG_ERROR("Can't set baud rate to max: %s",
  278. ftdi_get_error_string(&ftdic));
  279. return ERROR_JTAG_DEVICE_ERROR;
  280. }
  281. if (ftdi_usb_purge_buffers(&ftdic) < 0) {
  282. LOG_ERROR("ftdi_purge_buffers: %s", ftdic.error_str);
  283. return ERROR_JTAG_INIT_FAILED;
  284. }
  285. /* OpenJTAG speed */
  286. openjtag_sendcommand(0xE0); /*Start at slowest adapter speed*/
  287. /* MSB */
  288. openjtag_sendcommand(0x75);
  289. return ERROR_OK;
  290. }
  291. static int openjtag_quit(void)
  292. {
  293. ftdi_usb_close(&ftdic);
  294. ftdi_deinit(&ftdic);
  295. return ERROR_OK;
  296. }
  297. static void openjtag_write_tap_buffer(void)
  298. {
  299. uint32_t written;
  300. openjtag_buf_write(usb_tx_buf, usb_tx_buf_offs, &written);
  301. openjtag_buf_read(usb_rx_buf, usb_tx_buf_offs, &usb_rx_buf_len);
  302. usb_tx_buf_offs = 0;
  303. }
  304. static int openjtag_execute_tap_queue(void)
  305. {
  306. openjtag_write_tap_buffer();
  307. int res_count = 0;
  308. if (openjtag_scan_result_count && usb_rx_buf_len) {
  309. int count;
  310. int rx_offs = 0;
  311. int len;
  312. /* for every pending result */
  313. while (res_count < openjtag_scan_result_count) {
  314. /* get sent bits */
  315. len = openjtag_scan_result_buffer[res_count].bits;
  316. count = 0;
  317. uint8_t *buffer = openjtag_scan_result_buffer[res_count].buffer;
  318. while (len) {
  319. if (len <= 8) {
  320. DEBUG_JTAG_IO("bits < 8 buf = 0x%X, will be 0x%X",
  321. usb_rx_buf[rx_offs], usb_rx_buf[rx_offs] >> (8 - len));
  322. buffer[count] = usb_rx_buf[rx_offs] >> (8 - len);
  323. len = 0;
  324. } else {
  325. buffer[count] = usb_rx_buf[rx_offs];
  326. len -= 8;
  327. }
  328. rx_offs++;
  329. count++;
  330. }
  331. #ifdef _DEBUG_USB_COMMS_
  332. openjtag_debug_buffer(buffer,
  333. DIV_ROUND_UP(openjtag_scan_result_buffer[res_count].bits, 8), DEBUG_TYPE_OCD_READ);
  334. #endif
  335. jtag_read_buffer(buffer, openjtag_scan_result_buffer[res_count].command);
  336. if (openjtag_scan_result_buffer[res_count].buffer)
  337. free(openjtag_scan_result_buffer[res_count].buffer);
  338. res_count++;
  339. }
  340. }
  341. openjtag_scan_result_count = 0;
  342. return ERROR_OK;
  343. }
  344. static void openjtag_add_byte(char buf)
  345. {
  346. if (usb_tx_buf_offs == OPENJTAG_BUFFER_SIZE) {
  347. DEBUG_JTAG_IO("Forcing execute_tap_queue");
  348. DEBUG_JTAG_IO("TX Buff offs=%d", usb_tx_buf_offs);
  349. openjtag_execute_tap_queue();
  350. }
  351. usb_tx_buf[usb_tx_buf_offs] = buf;
  352. usb_tx_buf_offs++;
  353. }
  354. static void openjtag_add_scan(uint8_t *buffer, int length, struct scan_command *scan_cmd)
  355. {
  356. /* Ensure space to send long chains */
  357. /* We add two byte for each eight (or less) bits, one for command, one for data */
  358. if (usb_tx_buf_offs + (DIV_ROUND_UP(length, 8) * 2) >= OPENJTAG_BUFFER_SIZE) {
  359. DEBUG_JTAG_IO("Forcing execute_tap_queue from scan");
  360. DEBUG_JTAG_IO("TX Buff offs=%d len=%d", usb_tx_buf_offs, DIV_ROUND_UP(length, 8) * 2);
  361. openjtag_execute_tap_queue();
  362. }
  363. openjtag_scan_result_buffer[openjtag_scan_result_count].bits = length;
  364. openjtag_scan_result_buffer[openjtag_scan_result_count].command = scan_cmd;
  365. openjtag_scan_result_buffer[openjtag_scan_result_count].buffer = buffer;
  366. uint8_t command;
  367. uint8_t bits;
  368. int count = 0;
  369. while (length) {
  370. /* write command */
  371. command = 6;
  372. /* last bits? */
  373. if (length <= 8) {
  374. /* tms high */
  375. command |= (1 << 4);
  376. /* bits to transfer */
  377. bits = (length - 1);
  378. command |= bits << 5;
  379. length = 0;
  380. } else {
  381. /* whole byte */
  382. /* bits to transfer */
  383. bits = 7;
  384. command |= (7 << 5);
  385. length -= 8;
  386. }
  387. openjtag_add_byte(command);
  388. openjtag_add_byte(buffer[count]);
  389. count++;
  390. }
  391. openjtag_scan_result_count++;
  392. }
  393. static void openjtag_execute_reset(struct jtag_command *cmd)
  394. {
  395. DEBUG_JTAG_IO("reset trst: %i srst %i",
  396. cmd->cmd.reset->trst, cmd->cmd.reset->srst);
  397. uint8_t buf = 0x00;
  398. if (cmd->cmd.reset->trst) {
  399. buf = 0x03;
  400. } else {
  401. buf |= 0x04;
  402. buf |= 0x05 << 4;
  403. }
  404. openjtag_add_byte(buf);
  405. }
  406. static void openjtag_execute_sleep(struct jtag_command *cmd)
  407. {
  408. jtag_sleep(cmd->cmd.sleep->us);
  409. }
  410. static void openjtag_set_state(uint8_t openocd_state)
  411. {
  412. int8_t state = openjtag_get_tap_state(openocd_state);
  413. uint8_t buf = 0;
  414. buf = 0x01;
  415. buf |= state << 4;
  416. openjtag_add_byte(buf);
  417. }
  418. static void openjtag_execute_statemove(struct jtag_command *cmd)
  419. {
  420. DEBUG_JTAG_IO("state move to %i", cmd->cmd.statemove->end_state);
  421. tap_set_end_state(cmd->cmd.statemove->end_state);
  422. openjtag_set_state(cmd->cmd.statemove->end_state);
  423. tap_set_state(tap_get_end_state());
  424. }
  425. static void openjtag_execute_scan(struct jtag_command *cmd)
  426. {
  427. int scan_size, old_state;
  428. uint8_t *buffer;
  429. DEBUG_JTAG_IO("scan ends in %s", tap_state_name(cmd->cmd.scan->end_state));
  430. /* get scan info */
  431. tap_set_end_state(cmd->cmd.scan->end_state);
  432. scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer);
  433. #ifdef _DEBUG_USB_COMMS_
  434. openjtag_debug_buffer(buffer, (scan_size + 7) / 8, DEBUG_TYPE_BUFFER);
  435. #endif
  436. /* set state */
  437. old_state = tap_get_end_state();
  438. openjtag_set_state(cmd->cmd.scan->ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT);
  439. tap_set_state(cmd->cmd.scan->ir_scan ? TAP_IRSHIFT : TAP_DRSHIFT);
  440. tap_set_end_state(old_state);
  441. openjtag_add_scan(buffer, scan_size, cmd->cmd.scan);
  442. openjtag_set_state(cmd->cmd.scan->ir_scan ? TAP_IRPAUSE : TAP_DRPAUSE);
  443. tap_set_state(cmd->cmd.scan->ir_scan ? TAP_IRPAUSE : TAP_DRPAUSE);
  444. if (tap_get_state() != tap_get_end_state()) {
  445. openjtag_set_state(tap_get_end_state());
  446. tap_set_state(tap_get_end_state());
  447. }
  448. }
  449. static void openjtag_execute_runtest(struct jtag_command *cmd)
  450. {
  451. tap_state_t end_state = cmd->cmd.runtest->end_state;
  452. tap_set_end_state(end_state);
  453. /* only do a state_move when we're not already in IDLE */
  454. if (tap_get_state() != TAP_IDLE) {
  455. openjtag_set_state(TAP_IDLE);
  456. tap_set_state(TAP_IDLE);
  457. }
  458. if (cmd->cmd.runtest->num_cycles > 16)
  459. LOG_WARNING("num_cycles > 16 on run test");
  460. uint8_t command;
  461. command = 7;
  462. command |= ((cmd->cmd.runtest->num_cycles - 1) & 0x0F) << 4;
  463. openjtag_add_byte(command);
  464. tap_set_end_state(end_state);
  465. if (tap_get_end_state() != tap_get_state()) {
  466. openjtag_set_state(end_state);
  467. tap_set_state(end_state);
  468. }
  469. }
  470. static void openjtag_execute_command(struct jtag_command *cmd)
  471. {
  472. DEBUG_JTAG_IO("openjtag_execute_command %i", cmd->type);
  473. switch (cmd->type) {
  474. case JTAG_RESET:
  475. openjtag_execute_reset(cmd);
  476. break;
  477. case JTAG_SLEEP:
  478. openjtag_execute_sleep(cmd);
  479. break;
  480. case JTAG_TLR_RESET:
  481. openjtag_execute_statemove(cmd);
  482. break;
  483. case JTAG_SCAN:
  484. openjtag_execute_scan(cmd);
  485. break;
  486. case JTAG_RUNTEST:
  487. openjtag_execute_runtest(cmd);
  488. break;
  489. case JTAG_PATHMOVE:
  490. /* jlink_execute_pathmove(cmd); break; */
  491. default:
  492. LOG_ERROR("BUG: unknown Open JTAG command type encountered");
  493. exit(-1);
  494. }
  495. }
  496. static int openjtag_execute_queue(void)
  497. {
  498. struct jtag_command *cmd = jtag_command_queue;
  499. while (cmd != NULL) {
  500. openjtag_execute_command(cmd);
  501. cmd = cmd->next;
  502. }
  503. return openjtag_execute_tap_queue();
  504. }
  505. static int openjtag_speed_div(int speed, int *khz)
  506. {
  507. *khz = speed;
  508. return ERROR_OK;
  509. }
  510. static int openjtag_khz(int khz, int *jtag_speed)
  511. {
  512. if (khz >= 48000)
  513. *jtag_speed = 48000;
  514. else if (khz >= 24000)
  515. *jtag_speed = 24000;
  516. else if (khz >= 12000)
  517. *jtag_speed = 12000;
  518. else if (khz >= 6000)
  519. *jtag_speed = 6000;
  520. else if (khz >= 3000)
  521. *jtag_speed = 3000;
  522. else if (khz >= 1500)
  523. *jtag_speed = 1500;
  524. else if (khz >= 750)
  525. *jtag_speed = 750;
  526. else
  527. *jtag_speed = 375;
  528. return ERROR_OK;
  529. }
  530. COMMAND_HANDLER(openjtag_handle_device_desc_command)
  531. {
  532. if (CMD_ARGC == 1)
  533. openjtag_device_desc = strdup(CMD_ARGV[0]);
  534. else
  535. LOG_ERROR("require exactly one argument to "
  536. "openjtag_device_desc <description>");
  537. return ERROR_OK;
  538. }
  539. static const struct command_registration openjtag_command_handlers[] = {
  540. {
  541. .name = "openjtag_device_desc",
  542. .handler = openjtag_handle_device_desc_command,
  543. .mode = COMMAND_CONFIG,
  544. .help = "set the USB device description of the OpenJTAG",
  545. .usage = "description-string",
  546. },
  547. COMMAND_REGISTRATION_DONE
  548. };
  549. struct jtag_interface openjtag_interface = {
  550. .name = "openjtag",
  551. .commands = openjtag_command_handlers,
  552. .execute_queue = openjtag_execute_queue,
  553. .speed = openjtag_speed,
  554. .speed_div = openjtag_speed_div,
  555. .khz = openjtag_khz,
  556. .init = openjtag_init,
  557. .quit = openjtag_quit,
  558. };