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.
 
 
 
 
 
 

684 lines
17 KiB

  1. /*
  2. * JTAG to VPI driver
  3. *
  4. * Copyright (C) 2013 Franck Jullien, <elec4fun@gmail.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. #ifdef HAVE_CONFIG_H
  23. #include "config.h"
  24. #endif
  25. #include <jtag/interface.h>
  26. #ifdef HAVE_ARPA_INET_H
  27. #include <arpa/inet.h>
  28. #endif
  29. #ifndef _WIN32
  30. #include <netinet/tcp.h>
  31. #endif
  32. #include "helper/replacements.h"
  33. #define NO_TAP_SHIFT 0
  34. #define TAP_SHIFT 1
  35. #define SERVER_ADDRESS "127.0.0.1"
  36. #define SERVER_PORT 5555
  37. #define XFERT_MAX_SIZE 512
  38. #define CMD_RESET 0
  39. #define CMD_TMS_SEQ 1
  40. #define CMD_SCAN_CHAIN 2
  41. #define CMD_SCAN_CHAIN_FLIP_TMS 3
  42. #define CMD_STOP_SIMU 4
  43. /* jtag_vpi server port and address to connect to */
  44. static int server_port = SERVER_PORT;
  45. static char *server_address;
  46. /* Send CMD_STOP_SIMU to server when OpenOCD exits? */
  47. static bool stop_sim_on_exit;
  48. static int sockfd;
  49. static struct sockaddr_in serv_addr;
  50. /* One jtag_vpi "packet" as sent over a TCP channel. */
  51. struct vpi_cmd {
  52. union {
  53. uint32_t cmd;
  54. unsigned char cmd_buf[4];
  55. };
  56. unsigned char buffer_out[XFERT_MAX_SIZE];
  57. unsigned char buffer_in[XFERT_MAX_SIZE];
  58. union {
  59. uint32_t length;
  60. unsigned char length_buf[4];
  61. };
  62. union {
  63. uint32_t nb_bits;
  64. unsigned char nb_bits_buf[4];
  65. };
  66. };
  67. static char *jtag_vpi_cmd_to_str(int cmd_num)
  68. {
  69. switch (cmd_num) {
  70. case CMD_RESET:
  71. return "CMD_RESET";
  72. case CMD_TMS_SEQ:
  73. return "CMD_TMS_SEQ";
  74. case CMD_SCAN_CHAIN:
  75. return "CMD_SCAN_CHAIN";
  76. case CMD_SCAN_CHAIN_FLIP_TMS:
  77. return "CMD_SCAN_CHAIN_FLIP_TMS";
  78. case CMD_STOP_SIMU:
  79. return "CMD_STOP_SIMU";
  80. default:
  81. return "<unknown>";
  82. }
  83. }
  84. static int jtag_vpi_send_cmd(struct vpi_cmd *vpi)
  85. {
  86. int retval;
  87. /* Optional low-level JTAG debug */
  88. if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
  89. if (vpi->nb_bits > 0) {
  90. /* command with a non-empty data payload */
  91. char *char_buf = buf_to_hex_str(vpi->buffer_out,
  92. (vpi->nb_bits > DEBUG_JTAG_IOZ)
  93. ? DEBUG_JTAG_IOZ
  94. : vpi->nb_bits);
  95. LOG_DEBUG_IO("sending JTAG VPI cmd: cmd=%s, "
  96. "length=%" PRIu32 ", "
  97. "nb_bits=%" PRIu32 ", "
  98. "buf_out=0x%s%s",
  99. jtag_vpi_cmd_to_str(vpi->cmd),
  100. vpi->length,
  101. vpi->nb_bits,
  102. char_buf,
  103. (vpi->nb_bits > DEBUG_JTAG_IOZ) ? "(...)" : "");
  104. free(char_buf);
  105. } else {
  106. /* command without data payload */
  107. LOG_DEBUG_IO("sending JTAG VPI cmd: cmd=%s, "
  108. "length=%" PRIu32 ", "
  109. "nb_bits=%" PRIu32,
  110. jtag_vpi_cmd_to_str(vpi->cmd),
  111. vpi->length,
  112. vpi->nb_bits);
  113. }
  114. }
  115. /* Use little endian when transmitting/receiving jtag_vpi cmds.
  116. The choice of little endian goes against usual networking conventions
  117. but is intentional to remain compatible with most older OpenOCD builds
  118. (i.e. builds on little-endian platforms). */
  119. h_u32_to_le(vpi->cmd_buf, vpi->cmd);
  120. h_u32_to_le(vpi->length_buf, vpi->length);
  121. h_u32_to_le(vpi->nb_bits_buf, vpi->nb_bits);
  122. retry_write:
  123. retval = write_socket(sockfd, vpi, sizeof(struct vpi_cmd));
  124. if (retval < 0) {
  125. /* Account for the case when socket write is interrupted. */
  126. #ifdef _WIN32
  127. int wsa_err = WSAGetLastError();
  128. if (wsa_err == WSAEINTR)
  129. goto retry_write;
  130. #else
  131. if (errno == EINTR)
  132. goto retry_write;
  133. #endif
  134. /* Otherwise this is an error using the socket, most likely fatal
  135. for the connection. B*/
  136. log_socket_error("jtag_vpi xmit");
  137. /* TODO: Clean way how adapter drivers can report fatal errors
  138. to upper layers of OpenOCD and let it perform an orderly shutdown? */
  139. exit(-1);
  140. } else if (retval < (int)sizeof(struct vpi_cmd)) {
  141. /* This means we could not send all data, which is most likely fatal
  142. for the jtag_vpi connection (the underlying TCP connection likely not
  143. usable anymore) */
  144. LOG_ERROR("Could not send all data through jtag_vpi connection.");
  145. exit(-1);
  146. }
  147. /* Otherwise the packet has been sent successfully. */
  148. return ERROR_OK;
  149. }
  150. static int jtag_vpi_receive_cmd(struct vpi_cmd *vpi)
  151. {
  152. unsigned bytes_buffered = 0;
  153. while (bytes_buffered < sizeof(struct vpi_cmd)) {
  154. int bytes_to_receive = sizeof(struct vpi_cmd) - bytes_buffered;
  155. int retval = read_socket(sockfd, ((char *)vpi) + bytes_buffered, bytes_to_receive);
  156. if (retval < 0) {
  157. #ifdef _WIN32
  158. int wsa_err = WSAGetLastError();
  159. if (wsa_err == WSAEINTR) {
  160. /* socket read interrupted by WSACancelBlockingCall() */
  161. continue;
  162. }
  163. #else
  164. if (errno == EINTR) {
  165. /* socket read interrupted by a signal */
  166. continue;
  167. }
  168. #endif
  169. /* Otherwise, this is an error when accessing the socket. */
  170. log_socket_error("jtag_vpi recv");
  171. exit(-1);
  172. } else if (retval == 0) {
  173. /* Connection closed by the other side */
  174. LOG_ERROR("Connection prematurely closed by jtag_vpi server.");
  175. exit(-1);
  176. }
  177. /* Otherwise, we have successfully received some data */
  178. bytes_buffered += retval;
  179. }
  180. /* Use little endian when transmitting/receiving jtag_vpi cmds. */
  181. vpi->cmd = le_to_h_u32(vpi->cmd_buf);
  182. vpi->length = le_to_h_u32(vpi->length_buf);
  183. vpi->nb_bits = le_to_h_u32(vpi->nb_bits_buf);
  184. return ERROR_OK;
  185. }
  186. /**
  187. * jtag_vpi_reset - ask to reset the JTAG device
  188. * @param trst 1 if TRST is to be asserted
  189. * @param srst 1 if SRST is to be asserted
  190. */
  191. static int jtag_vpi_reset(int trst, int srst)
  192. {
  193. struct vpi_cmd vpi;
  194. memset(&vpi, 0, sizeof(struct vpi_cmd));
  195. vpi.cmd = CMD_RESET;
  196. vpi.length = 0;
  197. return jtag_vpi_send_cmd(&vpi);
  198. }
  199. /**
  200. * jtag_vpi_tms_seq - ask a TMS sequence transition to JTAG
  201. * @param bits TMS bits to be written (bit0, bit1 .. bitN)
  202. * @param nb_bits number of TMS bits (between 1 and 8)
  203. *
  204. * Write a series of TMS transitions, where each transition consists in :
  205. * - writing out TCK=0, TMS=\<new_state>, TDI=\<???>
  206. * - writing out TCK=1, TMS=\<new_state>, TDI=\<???> which triggers the transition
  207. * The function ensures that at the end of the sequence, the clock (TCK) is put
  208. * low.
  209. */
  210. static int jtag_vpi_tms_seq(const uint8_t *bits, int nb_bits)
  211. {
  212. struct vpi_cmd vpi;
  213. int nb_bytes;
  214. memset(&vpi, 0, sizeof(struct vpi_cmd));
  215. nb_bytes = DIV_ROUND_UP(nb_bits, 8);
  216. vpi.cmd = CMD_TMS_SEQ;
  217. memcpy(vpi.buffer_out, bits, nb_bytes);
  218. vpi.length = nb_bytes;
  219. vpi.nb_bits = nb_bits;
  220. return jtag_vpi_send_cmd(&vpi);
  221. }
  222. /**
  223. * jtag_vpi_path_move - ask a TMS sequence transition to JTAG
  224. * @param cmd path transition
  225. *
  226. * Write a series of TMS transitions, where each transition consists in :
  227. * - writing out TCK=0, TMS=\<new_state>, TDI=\<???>
  228. * - writing out TCK=1, TMS=\<new_state>, TDI=\<???> which triggers the transition
  229. * The function ensures that at the end of the sequence, the clock (TCK) is put
  230. * low.
  231. */
  232. static int jtag_vpi_path_move(struct pathmove_command *cmd)
  233. {
  234. uint8_t trans[DIV_ROUND_UP(cmd->num_states, 8)];
  235. memset(trans, 0, DIV_ROUND_UP(cmd->num_states, 8));
  236. for (int i = 0; i < cmd->num_states; i++) {
  237. if (tap_state_transition(tap_get_state(), true) == cmd->path[i])
  238. buf_set_u32(trans, i, 1, 1);
  239. tap_set_state(cmd->path[i]);
  240. }
  241. return jtag_vpi_tms_seq(trans, cmd->num_states);
  242. }
  243. /**
  244. * jtag_vpi_tms - ask a tms command
  245. * @param cmd tms command
  246. */
  247. static int jtag_vpi_tms(struct tms_command *cmd)
  248. {
  249. return jtag_vpi_tms_seq(cmd->bits, cmd->num_bits);
  250. }
  251. static int jtag_vpi_state_move(tap_state_t state)
  252. {
  253. if (tap_get_state() == state)
  254. return ERROR_OK;
  255. uint8_t tms_scan = tap_get_tms_path(tap_get_state(), state);
  256. int tms_len = tap_get_tms_path_len(tap_get_state(), state);
  257. int retval = jtag_vpi_tms_seq(&tms_scan, tms_len);
  258. if (retval != ERROR_OK)
  259. return retval;
  260. tap_set_state(state);
  261. return ERROR_OK;
  262. }
  263. static int jtag_vpi_queue_tdi_xfer(uint8_t *bits, int nb_bits, int tap_shift)
  264. {
  265. struct vpi_cmd vpi;
  266. int nb_bytes = DIV_ROUND_UP(nb_bits, 8);
  267. memset(&vpi, 0, sizeof(struct vpi_cmd));
  268. vpi.cmd = tap_shift ? CMD_SCAN_CHAIN_FLIP_TMS : CMD_SCAN_CHAIN;
  269. if (bits)
  270. memcpy(vpi.buffer_out, bits, nb_bytes);
  271. else
  272. memset(vpi.buffer_out, 0xff, nb_bytes);
  273. vpi.length = nb_bytes;
  274. vpi.nb_bits = nb_bits;
  275. int retval = jtag_vpi_send_cmd(&vpi);
  276. if (retval != ERROR_OK)
  277. return retval;
  278. retval = jtag_vpi_receive_cmd(&vpi);
  279. if (retval != ERROR_OK)
  280. return retval;
  281. /* Optional low-level JTAG debug */
  282. if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
  283. char *char_buf = buf_to_hex_str(vpi.buffer_in,
  284. (nb_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : nb_bits);
  285. LOG_DEBUG_IO("recvd JTAG VPI data: nb_bits=%d, buf_in=0x%s%s",
  286. nb_bits, char_buf, (nb_bits > DEBUG_JTAG_IOZ) ? "(...)" : "");
  287. free(char_buf);
  288. }
  289. if (bits)
  290. memcpy(bits, vpi.buffer_in, nb_bytes);
  291. return ERROR_OK;
  292. }
  293. /**
  294. * jtag_vpi_queue_tdi - short description
  295. * @param bits bits to be queued on TDI (or NULL if 0 are to be queued)
  296. * @param nb_bits number of bits
  297. * @param tap_shift
  298. */
  299. static int jtag_vpi_queue_tdi(uint8_t *bits, int nb_bits, int tap_shift)
  300. {
  301. int nb_xfer = DIV_ROUND_UP(nb_bits, XFERT_MAX_SIZE * 8);
  302. int retval;
  303. while (nb_xfer) {
  304. if (nb_xfer == 1) {
  305. retval = jtag_vpi_queue_tdi_xfer(bits, nb_bits, tap_shift);
  306. if (retval != ERROR_OK)
  307. return retval;
  308. } else {
  309. retval = jtag_vpi_queue_tdi_xfer(bits, XFERT_MAX_SIZE * 8, NO_TAP_SHIFT);
  310. if (retval != ERROR_OK)
  311. return retval;
  312. nb_bits -= XFERT_MAX_SIZE * 8;
  313. if (bits)
  314. bits += XFERT_MAX_SIZE;
  315. }
  316. nb_xfer--;
  317. }
  318. return ERROR_OK;
  319. }
  320. /**
  321. * jtag_vpi_clock_tms - clock a TMS transition
  322. * @param tms the TMS to be sent
  323. *
  324. * Triggers a TMS transition (ie. one JTAG TAP state move).
  325. */
  326. static int jtag_vpi_clock_tms(int tms)
  327. {
  328. const uint8_t tms_0 = 0;
  329. const uint8_t tms_1 = 1;
  330. return jtag_vpi_tms_seq(tms ? &tms_1 : &tms_0, 1);
  331. }
  332. /**
  333. * jtag_vpi_scan - launches a DR-scan or IR-scan
  334. * @param cmd the command to launch
  335. *
  336. * Launch a JTAG IR-scan or DR-scan
  337. *
  338. * Returns ERROR_OK if OK, ERROR_xxx if a read/write error occurred.
  339. */
  340. static int jtag_vpi_scan(struct scan_command *cmd)
  341. {
  342. int scan_bits;
  343. uint8_t *buf = NULL;
  344. int retval = ERROR_OK;
  345. scan_bits = jtag_build_buffer(cmd, &buf);
  346. if (cmd->ir_scan) {
  347. retval = jtag_vpi_state_move(TAP_IRSHIFT);
  348. if (retval != ERROR_OK)
  349. return retval;
  350. } else {
  351. retval = jtag_vpi_state_move(TAP_DRSHIFT);
  352. if (retval != ERROR_OK)
  353. return retval;
  354. }
  355. if (cmd->end_state == TAP_DRSHIFT) {
  356. retval = jtag_vpi_queue_tdi(buf, scan_bits, NO_TAP_SHIFT);
  357. if (retval != ERROR_OK)
  358. return retval;
  359. } else {
  360. retval = jtag_vpi_queue_tdi(buf, scan_bits, TAP_SHIFT);
  361. if (retval != ERROR_OK)
  362. return retval;
  363. }
  364. if (cmd->end_state != TAP_DRSHIFT) {
  365. /*
  366. * As our JTAG is in an unstable state (IREXIT1 or DREXIT1), move it
  367. * forward to a stable IRPAUSE or DRPAUSE.
  368. */
  369. retval = jtag_vpi_clock_tms(0);
  370. if (retval != ERROR_OK)
  371. return retval;
  372. if (cmd->ir_scan)
  373. tap_set_state(TAP_IRPAUSE);
  374. else
  375. tap_set_state(TAP_DRPAUSE);
  376. }
  377. retval = jtag_read_buffer(buf, cmd);
  378. if (retval != ERROR_OK)
  379. return retval;
  380. free(buf);
  381. if (cmd->end_state != TAP_DRSHIFT) {
  382. retval = jtag_vpi_state_move(cmd->end_state);
  383. if (retval != ERROR_OK)
  384. return retval;
  385. }
  386. return ERROR_OK;
  387. }
  388. static int jtag_vpi_runtest(int cycles, tap_state_t state)
  389. {
  390. int retval;
  391. retval = jtag_vpi_state_move(TAP_IDLE);
  392. if (retval != ERROR_OK)
  393. return retval;
  394. retval = jtag_vpi_queue_tdi(NULL, cycles, NO_TAP_SHIFT);
  395. if (retval != ERROR_OK)
  396. return retval;
  397. return jtag_vpi_state_move(state);
  398. }
  399. static int jtag_vpi_stableclocks(int cycles)
  400. {
  401. uint8_t tms_bits[4];
  402. int cycles_remain = cycles;
  403. int nb_bits;
  404. int retval;
  405. const int CYCLES_ONE_BATCH = sizeof(tms_bits) * 8;
  406. assert(cycles >= 0);
  407. /* use TMS=1 in TAP RESET state, TMS=0 in all other stable states */
  408. memset(&tms_bits, (tap_get_state() == TAP_RESET) ? 0xff : 0x00, sizeof(tms_bits));
  409. /* send the TMS bits */
  410. while (cycles_remain > 0) {
  411. nb_bits = (cycles_remain < CYCLES_ONE_BATCH) ? cycles_remain : CYCLES_ONE_BATCH;
  412. retval = jtag_vpi_tms_seq(tms_bits, nb_bits);
  413. if (retval != ERROR_OK)
  414. return retval;
  415. cycles_remain -= nb_bits;
  416. }
  417. return ERROR_OK;
  418. }
  419. static int jtag_vpi_execute_queue(void)
  420. {
  421. struct jtag_command *cmd;
  422. int retval = ERROR_OK;
  423. for (cmd = jtag_command_queue; retval == ERROR_OK && cmd;
  424. cmd = cmd->next) {
  425. switch (cmd->type) {
  426. case JTAG_RESET:
  427. retval = jtag_vpi_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst);
  428. break;
  429. case JTAG_RUNTEST:
  430. retval = jtag_vpi_runtest(cmd->cmd.runtest->num_cycles,
  431. cmd->cmd.runtest->end_state);
  432. break;
  433. case JTAG_STABLECLOCKS:
  434. retval = jtag_vpi_stableclocks(cmd->cmd.stableclocks->num_cycles);
  435. break;
  436. case JTAG_TLR_RESET:
  437. retval = jtag_vpi_state_move(cmd->cmd.statemove->end_state);
  438. break;
  439. case JTAG_PATHMOVE:
  440. retval = jtag_vpi_path_move(cmd->cmd.pathmove);
  441. break;
  442. case JTAG_TMS:
  443. retval = jtag_vpi_tms(cmd->cmd.tms);
  444. break;
  445. case JTAG_SLEEP:
  446. jtag_sleep(cmd->cmd.sleep->us);
  447. break;
  448. case JTAG_SCAN:
  449. retval = jtag_vpi_scan(cmd->cmd.scan);
  450. break;
  451. default:
  452. LOG_ERROR("BUG: unknown JTAG command type 0x%X",
  453. cmd->type);
  454. retval = ERROR_FAIL;
  455. break;
  456. }
  457. }
  458. return retval;
  459. }
  460. static int jtag_vpi_init(void)
  461. {
  462. int flag = 1;
  463. sockfd = socket(AF_INET, SOCK_STREAM, 0);
  464. if (sockfd < 0) {
  465. LOG_ERROR("Could not create socket");
  466. return ERROR_FAIL;
  467. }
  468. memset(&serv_addr, 0, sizeof(serv_addr));
  469. serv_addr.sin_family = AF_INET;
  470. serv_addr.sin_port = htons(server_port);
  471. if (!server_address)
  472. server_address = strdup(SERVER_ADDRESS);
  473. serv_addr.sin_addr.s_addr = inet_addr(server_address);
  474. if (serv_addr.sin_addr.s_addr == INADDR_NONE) {
  475. LOG_ERROR("inet_addr error occurred");
  476. return ERROR_FAIL;
  477. }
  478. if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
  479. close(sockfd);
  480. LOG_ERROR("Can't connect to %s : %u", server_address, server_port);
  481. return ERROR_COMMAND_CLOSE_CONNECTION;
  482. }
  483. if (serv_addr.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) {
  484. /* This increases performance dramatically for local
  485. * connections, which is the most likely arrangement
  486. * for a VPI connection. */
  487. setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int));
  488. }
  489. LOG_INFO("Connection to %s : %u succeed", server_address, server_port);
  490. return ERROR_OK;
  491. }
  492. static int jtag_vpi_stop_simulation(void)
  493. {
  494. struct vpi_cmd cmd;
  495. memset(&cmd, 0, sizeof(struct vpi_cmd));
  496. cmd.length = 0;
  497. cmd.nb_bits = 0;
  498. cmd.cmd = CMD_STOP_SIMU;
  499. return jtag_vpi_send_cmd(&cmd);
  500. }
  501. static int jtag_vpi_quit(void)
  502. {
  503. if (stop_sim_on_exit) {
  504. if (jtag_vpi_stop_simulation() != ERROR_OK)
  505. LOG_WARNING("jtag_vpi: failed to send \"stop simulation\" command");
  506. }
  507. if (close_socket(sockfd) != 0) {
  508. LOG_WARNING("jtag_vpi: could not close jtag_vpi client socket");
  509. log_socket_error("jtag_vpi");
  510. }
  511. free(server_address);
  512. return ERROR_OK;
  513. }
  514. COMMAND_HANDLER(jtag_vpi_set_port)
  515. {
  516. if (CMD_ARGC == 0)
  517. LOG_WARNING("You need to set a port number");
  518. else
  519. COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], server_port);
  520. LOG_INFO("Set server port to %u", server_port);
  521. return ERROR_OK;
  522. }
  523. COMMAND_HANDLER(jtag_vpi_set_address)
  524. {
  525. free(server_address);
  526. if (CMD_ARGC == 0) {
  527. LOG_WARNING("You need to set an address");
  528. server_address = strdup(SERVER_ADDRESS);
  529. } else
  530. server_address = strdup(CMD_ARGV[0]);
  531. LOG_INFO("Set server address to %s", server_address);
  532. return ERROR_OK;
  533. }
  534. COMMAND_HANDLER(jtag_vpi_stop_sim_on_exit_handler)
  535. {
  536. if (CMD_ARGC != 1) {
  537. LOG_ERROR("jtag_vpi_stop_sim_on_exit expects 1 argument (on|off)");
  538. return ERROR_COMMAND_SYNTAX_ERROR;
  539. } else {
  540. COMMAND_PARSE_ON_OFF(CMD_ARGV[0], stop_sim_on_exit);
  541. }
  542. return ERROR_OK;
  543. }
  544. static const struct command_registration jtag_vpi_command_handlers[] = {
  545. {
  546. .name = "jtag_vpi_set_port",
  547. .handler = &jtag_vpi_set_port,
  548. .mode = COMMAND_CONFIG,
  549. .help = "set the port of the VPI server",
  550. .usage = "tcp_port_num",
  551. },
  552. {
  553. .name = "jtag_vpi_set_address",
  554. .handler = &jtag_vpi_set_address,
  555. .mode = COMMAND_CONFIG,
  556. .help = "set the address of the VPI server",
  557. .usage = "ipv4_addr",
  558. },
  559. {
  560. .name = "jtag_vpi_stop_sim_on_exit",
  561. .handler = &jtag_vpi_stop_sim_on_exit_handler,
  562. .mode = COMMAND_CONFIG,
  563. .help = "Configure if simulation stop command shall be sent "
  564. "before OpenOCD exits (default: off)",
  565. .usage = "<on|off>",
  566. },
  567. COMMAND_REGISTRATION_DONE
  568. };
  569. static struct jtag_interface jtag_vpi_interface = {
  570. .supported = DEBUG_CAP_TMS_SEQ,
  571. .execute_queue = jtag_vpi_execute_queue,
  572. };
  573. struct adapter_driver jtag_vpi_adapter_driver = {
  574. .name = "jtag_vpi",
  575. .transports = jtag_only,
  576. .commands = jtag_vpi_command_handlers,
  577. .init = jtag_vpi_init,
  578. .quit = jtag_vpi_quit,
  579. .jtag_ops = &jtag_vpi_interface,
  580. };