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.
 
 
 
 
 
 

785 lines
19 KiB

  1. /***************************************************************************
  2. * *
  3. * Copyright (C) 2012 by Spencer Oliver *
  4. * spen@spen-soft.co.uk *
  5. * *
  6. * This program is free software; you can redistribute it and/or modify *
  7. * it under the terms of the GNU General Public License as published by *
  8. * the Free Software Foundation; either version 2 of the License, or *
  9. * (at your option) any later version. *
  10. * *
  11. * This program is distributed in the hope that it will be useful, *
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  14. * GNU General Public License for more details. *
  15. * *
  16. * You should have received a copy of the GNU General Public License *
  17. * along with this program; if not, write to the *
  18. * Free Software Foundation, Inc., *
  19. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
  20. ***************************************************************************/
  21. #ifdef HAVE_CONFIG_H
  22. #include "config.h"
  23. #endif
  24. /* project specific includes */
  25. #include <helper/binarybuffer.h>
  26. #include <jtag/interface.h>
  27. #include <jtag/hla/hla_layout.h>
  28. #include <jtag/hla/hla_transport.h>
  29. #include <jtag/hla/hla_interface.h>
  30. #include <target/target.h>
  31. #include <target/cortex_m.h>
  32. #include <libusb.h>
  33. #define ICDI_WRITE_ENDPOINT 0x02
  34. #define ICDI_READ_ENDPOINT 0x83
  35. #define ICDI_WRITE_TIMEOUT 1000
  36. #define ICDI_READ_TIMEOUT 1000
  37. #define ICDI_PACKET_SIZE 2048
  38. #define PACKET_START "$"
  39. #define PACKET_END "#"
  40. struct icdi_usb_handle_s {
  41. libusb_context *usb_ctx;
  42. libusb_device_handle *usb_dev;
  43. char *read_buffer;
  44. char *write_buffer;
  45. int max_packet;
  46. int read_count;
  47. uint32_t max_rw_packet; /* max X packet (read/write memory) transfers */
  48. };
  49. static int icdi_usb_read_mem(void *handle, uint32_t addr, uint32_t size,
  50. uint32_t count, uint8_t *buffer);
  51. static int icdi_usb_write_mem(void *handle, uint32_t addr, uint32_t size,
  52. uint32_t count, const uint8_t *buffer);
  53. static int remote_escape_output(const char *buffer, int len, char *out_buf, int *out_len, int out_maxlen)
  54. {
  55. int input_index, output_index;
  56. output_index = 0;
  57. for (input_index = 0; input_index < len; input_index++) {
  58. char b = buffer[input_index];
  59. if (b == '$' || b == '#' || b == '}' || b == '*') {
  60. /* These must be escaped. */
  61. if (output_index + 2 > out_maxlen)
  62. break;
  63. out_buf[output_index++] = '}';
  64. out_buf[output_index++] = b ^ 0x20;
  65. } else {
  66. if (output_index + 1 > out_maxlen)
  67. break;
  68. out_buf[output_index++] = b;
  69. }
  70. }
  71. *out_len = input_index;
  72. return output_index;
  73. }
  74. static int remote_unescape_input(const char *buffer, int len, char *out_buf, int out_maxlen)
  75. {
  76. int input_index, output_index;
  77. int escaped;
  78. output_index = 0;
  79. escaped = 0;
  80. for (input_index = 0; input_index < len; input_index++) {
  81. char b = buffer[input_index];
  82. if (output_index + 1 > out_maxlen)
  83. LOG_ERROR("Received too much data from the target.");
  84. if (escaped) {
  85. out_buf[output_index++] = b ^ 0x20;
  86. escaped = 0;
  87. } else if (b == '}')
  88. escaped = 1;
  89. else
  90. out_buf[output_index++] = b;
  91. }
  92. if (escaped)
  93. LOG_ERROR("Unmatched escape character in target response.");
  94. return output_index;
  95. }
  96. static int icdi_send_packet(void *handle, int len)
  97. {
  98. unsigned char cksum = 0;
  99. struct icdi_usb_handle_s *h = handle;
  100. int result, retry = 0;
  101. int transferred = 0;
  102. assert(handle != NULL);
  103. /* check we have a large enough buffer for checksum "#00" */
  104. if (len + 3 > h->max_packet) {
  105. LOG_ERROR("packet buffer too small");
  106. return ERROR_FAIL;
  107. }
  108. /* calculate checksum - offset start of packet */
  109. for (int i = 1; i < len; i++)
  110. cksum += h->write_buffer[i];
  111. len += sprintf(&h->write_buffer[len], PACKET_END "%02x", cksum);
  112. #ifdef _DEBUG_USB_COMMS_
  113. char buffer[50];
  114. char ch = h->write_buffer[1];
  115. if (ch == 'x' || ch == 'X')
  116. LOG_DEBUG("writing packet: <binary>");
  117. else {
  118. memcpy(buffer, h->write_buffer, len >= 50 ? 50-1 : len);
  119. buffer[len] = 0;
  120. LOG_DEBUG("writing packet: %s", buffer);
  121. }
  122. #endif
  123. while (1) {
  124. result = libusb_bulk_transfer(h->usb_dev, ICDI_WRITE_ENDPOINT, (unsigned char *)h->write_buffer, len,
  125. &transferred, ICDI_WRITE_TIMEOUT);
  126. if (result != 0 || transferred != len) {
  127. LOG_DEBUG("Error TX Data %d", result);
  128. return ERROR_FAIL;
  129. }
  130. /* check that the client got the message ok, or shall we resend */
  131. result = libusb_bulk_transfer(h->usb_dev, ICDI_READ_ENDPOINT, (unsigned char *)h->read_buffer, h->max_packet,
  132. &transferred, ICDI_READ_TIMEOUT);
  133. if (result != 0 || transferred < 1) {
  134. LOG_DEBUG("Error RX Data %d", result);
  135. return ERROR_FAIL;
  136. }
  137. #ifdef _DEBUG_USB_COMMS_
  138. LOG_DEBUG("received reply: '%c' : count %d", h->read_buffer[0], transferred);
  139. #endif
  140. if (h->read_buffer[0] == '-') {
  141. LOG_DEBUG("Resending packet %d", ++retry);
  142. } else {
  143. if (h->read_buffer[0] != '+')
  144. LOG_DEBUG("Unexpected Reply from ICDI: %c", h->read_buffer[0]);
  145. break;
  146. }
  147. if (retry == 3) {
  148. LOG_DEBUG("maximum nack retries attempted");
  149. return ERROR_FAIL;
  150. }
  151. }
  152. retry = 0;
  153. h->read_count = transferred;
  154. while (1) {
  155. /* read reply from icdi */
  156. result = libusb_bulk_transfer(h->usb_dev, ICDI_READ_ENDPOINT, (unsigned char *)h->read_buffer + h->read_count,
  157. h->max_packet - h->read_count, &transferred, ICDI_READ_TIMEOUT);
  158. #ifdef _DEBUG_USB_COMMS_
  159. LOG_DEBUG("received data: count %d", transferred);
  160. #endif
  161. /* check for errors but retry for timeout */
  162. if (result != 0) {
  163. if (result == LIBUSB_ERROR_TIMEOUT) {
  164. LOG_DEBUG("Error RX timeout %d", result);
  165. } else {
  166. LOG_DEBUG("Error RX Data %d", result);
  167. return ERROR_FAIL;
  168. }
  169. }
  170. h->read_count += transferred;
  171. /* we need to make sure we have a full packet, including checksum */
  172. if (h->read_count > 5) {
  173. /* check that we have received an packet delimiter
  174. * we do not validate the checksum
  175. * reply should contain $...#AA - so we check for # */
  176. if (h->read_buffer[h->read_count - 3] == '#')
  177. return ERROR_OK;
  178. }
  179. if (retry++ == 3) {
  180. LOG_DEBUG("maximum data retries attempted");
  181. break;
  182. }
  183. }
  184. return ERROR_FAIL;
  185. }
  186. static int icdi_send_cmd(void *handle, const char *cmd)
  187. {
  188. struct icdi_usb_handle_s *h = handle;
  189. int cmd_len = snprintf(h->write_buffer, h->max_packet, PACKET_START "%s", cmd);
  190. return icdi_send_packet(handle, cmd_len);
  191. }
  192. static int icdi_send_remote_cmd(void *handle, const char *data)
  193. {
  194. struct icdi_usb_handle_s *h = handle;
  195. size_t cmd_len = sprintf(h->write_buffer, PACKET_START "qRcmd,");
  196. cmd_len += hexify(h->write_buffer + cmd_len, data, 0, h->max_packet - cmd_len);
  197. return icdi_send_packet(handle, cmd_len);
  198. }
  199. static int icdi_get_cmd_result(void *handle)
  200. {
  201. struct icdi_usb_handle_s *h = handle;
  202. int offset = 0;
  203. char ch;
  204. assert(handle != NULL);
  205. do {
  206. ch = h->read_buffer[offset++];
  207. if (offset > h->read_count)
  208. return ERROR_FAIL;
  209. } while (ch != '$');
  210. if (memcmp("OK", h->read_buffer + offset, 2) == 0)
  211. return ERROR_OK;
  212. if (h->read_buffer[offset] == 'E') {
  213. /* get error code */
  214. char result;
  215. if (unhexify(&result, h->read_buffer + offset + 1, 1) != 1)
  216. return ERROR_FAIL;
  217. return result;
  218. }
  219. /* for now we assume everything else is ok */
  220. return ERROR_OK;
  221. }
  222. static int icdi_usb_idcode(void *handle, uint32_t *idcode)
  223. {
  224. *idcode = 0;
  225. return ERROR_OK;
  226. }
  227. static int icdi_usb_write_debug_reg(void *handle, uint32_t addr, uint32_t val)
  228. {
  229. uint8_t buf[4];
  230. /* REVISIT: There's no target pointer here so there's no way to use target_buffer_set_u32().
  231. * I guess all supported chips are little-endian anyway. */
  232. h_u32_to_le(buf, val);
  233. return icdi_usb_write_mem(handle, addr, 4, 1, buf);
  234. }
  235. static enum target_state icdi_usb_state(void *handle)
  236. {
  237. int result;
  238. struct icdi_usb_handle_s *h = handle;
  239. uint32_t dhcsr;
  240. uint8_t buf[4];
  241. result = icdi_usb_read_mem(h, DCB_DHCSR, 4, 1, buf);
  242. if (result != ERROR_OK)
  243. return TARGET_UNKNOWN;
  244. /* REVISIT: There's no target pointer here so there's no way to use target_buffer_get_u32().
  245. * I guess all supported chips are little-endian anyway. */
  246. dhcsr = le_to_h_u32(buf);
  247. if (dhcsr & S_HALT)
  248. return TARGET_HALTED;
  249. return TARGET_RUNNING;
  250. }
  251. static int icdi_usb_version(void *handle)
  252. {
  253. struct icdi_usb_handle_s *h = handle;
  254. char version[20];
  255. /* get info about icdi */
  256. int result = icdi_send_remote_cmd(handle, "version");
  257. if (result != ERROR_OK)
  258. return result;
  259. if (h->read_count < 8) {
  260. LOG_ERROR("Invalid Reply Received");
  261. return ERROR_FAIL;
  262. }
  263. /* convert reply */
  264. if (unhexify(version, h->read_buffer + 2, 4) != 4) {
  265. LOG_WARNING("unable to get ICDI version");
  266. return ERROR_OK;
  267. }
  268. /* null terminate and print info */
  269. version[4] = 0;
  270. LOG_INFO("ICDI Firmware version: %s", version);
  271. return ERROR_OK;
  272. }
  273. static int icdi_usb_query(void *handle)
  274. {
  275. int result;
  276. struct icdi_usb_handle_s *h = handle;
  277. result = icdi_send_cmd(handle, "qSupported");
  278. if (result != ERROR_OK)
  279. return result;
  280. /* check result */
  281. result = icdi_get_cmd_result(handle);
  282. if (result != ERROR_OK) {
  283. LOG_ERROR("query supported failed: 0x%x", result);
  284. return ERROR_FAIL;
  285. }
  286. /* from this we can get the max packet supported */
  287. /* query packet buffer size */
  288. char *offset = strstr(h->read_buffer, "PacketSize");
  289. if (offset) {
  290. char *separator;
  291. int max_packet;
  292. max_packet = strtol(offset + 11, &separator, 16);
  293. if (!max_packet)
  294. LOG_ERROR("invalid max packet, using defaults");
  295. else
  296. h->max_packet = max_packet;
  297. LOG_DEBUG("max packet supported : %i bytes", h->max_packet);
  298. }
  299. /* if required re allocate packet buffer */
  300. if (h->max_packet != ICDI_PACKET_SIZE) {
  301. h->read_buffer = realloc(h->read_buffer, h->max_packet);
  302. h->write_buffer = realloc(h->write_buffer, h->max_packet);
  303. if (h->read_buffer == 0 || h->write_buffer == 0) {
  304. LOG_ERROR("unable to reallocate memory");
  305. return ERROR_FAIL;
  306. }
  307. }
  308. /* set extended mode */
  309. result = icdi_send_cmd(handle, "!");
  310. if (result != ERROR_OK)
  311. return result;
  312. /* check result */
  313. result = icdi_get_cmd_result(handle);
  314. if (result != ERROR_OK) {
  315. LOG_ERROR("unable to enable extended mode: 0x%x", result);
  316. return ERROR_FAIL;
  317. }
  318. return ERROR_OK;
  319. }
  320. static int icdi_usb_reset(void *handle)
  321. {
  322. /* we do this in hla_target.c */
  323. return ERROR_OK;
  324. }
  325. static int icdi_usb_assert_srst(void *handle, int srst)
  326. {
  327. /* TODO not supported yet */
  328. return ERROR_COMMAND_NOTFOUND;
  329. }
  330. static int icdi_usb_run(void *handle)
  331. {
  332. int result;
  333. /* resume target at current address */
  334. result = icdi_send_cmd(handle, "c");
  335. if (result != ERROR_OK)
  336. return result;
  337. /* check result */
  338. result = icdi_get_cmd_result(handle);
  339. if (result != ERROR_OK) {
  340. LOG_ERROR("continue failed: 0x%x", result);
  341. return ERROR_FAIL;
  342. }
  343. return result;
  344. }
  345. static int icdi_usb_halt(void *handle)
  346. {
  347. int result;
  348. /* this query halts the target ?? */
  349. result = icdi_send_cmd(handle, "?");
  350. if (result != ERROR_OK)
  351. return result;
  352. /* check result */
  353. result = icdi_get_cmd_result(handle);
  354. if (result != ERROR_OK) {
  355. LOG_ERROR("halt failed: 0x%x", result);
  356. return ERROR_FAIL;
  357. }
  358. return result;
  359. }
  360. static int icdi_usb_step(void *handle)
  361. {
  362. int result;
  363. /* step target at current address */
  364. result = icdi_send_cmd(handle, "s");
  365. if (result != ERROR_OK)
  366. return result;
  367. /* check result */
  368. result = icdi_get_cmd_result(handle);
  369. if (result != ERROR_OK) {
  370. LOG_ERROR("step failed: 0x%x", result);
  371. return ERROR_FAIL;
  372. }
  373. return result;
  374. }
  375. static int icdi_usb_read_regs(void *handle)
  376. {
  377. /* currently unsupported */
  378. return ERROR_OK;
  379. }
  380. static int icdi_usb_read_reg(void *handle, int num, uint32_t *val)
  381. {
  382. int result;
  383. struct icdi_usb_handle_s *h = handle;
  384. char cmd[10];
  385. snprintf(cmd, sizeof(cmd), "p%x", num);
  386. result = icdi_send_cmd(handle, cmd);
  387. if (result != ERROR_OK)
  388. return result;
  389. /* check result */
  390. result = icdi_get_cmd_result(handle);
  391. if (result != ERROR_OK) {
  392. LOG_ERROR("register read failed: 0x%x", result);
  393. return ERROR_FAIL;
  394. }
  395. /* convert result */
  396. uint8_t buf[4];
  397. if (unhexify((char *)buf, h->read_buffer + 2, 4) != 4) {
  398. LOG_ERROR("failed to convert result");
  399. return ERROR_FAIL;
  400. }
  401. *val = le_to_h_u32(buf);
  402. return result;
  403. }
  404. static int icdi_usb_write_reg(void *handle, int num, uint32_t val)
  405. {
  406. int result;
  407. char cmd[20];
  408. uint8_t buf[4];
  409. h_u32_to_le(buf, val);
  410. int cmd_len = snprintf(cmd, sizeof(cmd), "P%x=", num);
  411. hexify(cmd + cmd_len, (const char *)buf, 4, sizeof(cmd));
  412. result = icdi_send_cmd(handle, cmd);
  413. if (result != ERROR_OK)
  414. return result;
  415. /* check result */
  416. result = icdi_get_cmd_result(handle);
  417. if (result != ERROR_OK) {
  418. LOG_ERROR("register write failed: 0x%x", result);
  419. return ERROR_FAIL;
  420. }
  421. return result;
  422. }
  423. static int icdi_usb_read_mem_int(void *handle, uint32_t addr, uint32_t len, uint8_t *buffer)
  424. {
  425. int result;
  426. struct icdi_usb_handle_s *h = handle;
  427. char cmd[20];
  428. snprintf(cmd, sizeof(cmd), "x%" PRIx32 ",%" PRIx32, addr, len);
  429. result = icdi_send_cmd(handle, cmd);
  430. if (result != ERROR_OK)
  431. return result;
  432. /* check result */
  433. result = icdi_get_cmd_result(handle);
  434. if (result != ERROR_OK) {
  435. LOG_ERROR("memory read failed: 0x%x", result);
  436. return ERROR_FAIL;
  437. }
  438. /* unescape input */
  439. int read_len = remote_unescape_input(h->read_buffer + 5, h->read_count - 8, (char *)buffer, len);
  440. if (read_len != (int)len) {
  441. LOG_ERROR("read more bytes than expected: actual 0x%x expected 0x%" PRIx32, read_len, len);
  442. return ERROR_FAIL;
  443. }
  444. return ERROR_OK;
  445. }
  446. static int icdi_usb_write_mem_int(void *handle, uint32_t addr, uint32_t len, const uint8_t *buffer)
  447. {
  448. int result;
  449. struct icdi_usb_handle_s *h = handle;
  450. size_t cmd_len = snprintf(h->write_buffer, h->max_packet, PACKET_START "X%" PRIx32 ",%" PRIx32 ":", addr, len);
  451. int out_len;
  452. cmd_len += remote_escape_output((const char *)buffer, len, h->write_buffer + cmd_len,
  453. &out_len, h->max_packet - cmd_len);
  454. if (out_len < (int)len) {
  455. /* for now issue a error as we have no way of allocating a larger buffer */
  456. LOG_ERROR("memory buffer too small: requires 0x%x actual 0x%" PRIx32, out_len, len);
  457. return ERROR_FAIL;
  458. }
  459. result = icdi_send_packet(handle, cmd_len);
  460. if (result != ERROR_OK)
  461. return result;
  462. /* check result */
  463. result = icdi_get_cmd_result(handle);
  464. if (result != ERROR_OK) {
  465. LOG_ERROR("memory write failed: 0x%x", result);
  466. return ERROR_FAIL;
  467. }
  468. return ERROR_OK;
  469. }
  470. static int icdi_usb_read_mem(void *handle, uint32_t addr, uint32_t size,
  471. uint32_t count, uint8_t *buffer)
  472. {
  473. int retval = ERROR_OK;
  474. struct icdi_usb_handle_s *h = handle;
  475. uint32_t bytes_remaining;
  476. /* calculate byte count */
  477. count *= size;
  478. while (count) {
  479. bytes_remaining = h->max_rw_packet;
  480. if (count < bytes_remaining)
  481. bytes_remaining = count;
  482. retval = icdi_usb_read_mem_int(handle, addr, bytes_remaining, buffer);
  483. if (retval != ERROR_OK)
  484. return retval;
  485. buffer += bytes_remaining;
  486. addr += bytes_remaining;
  487. count -= bytes_remaining;
  488. }
  489. return retval;
  490. }
  491. static int icdi_usb_write_mem(void *handle, uint32_t addr, uint32_t size,
  492. uint32_t count, const uint8_t *buffer)
  493. {
  494. int retval = ERROR_OK;
  495. struct icdi_usb_handle_s *h = handle;
  496. uint32_t bytes_remaining;
  497. /* calculate byte count */
  498. count *= size;
  499. while (count) {
  500. bytes_remaining = h->max_rw_packet;
  501. if (count < bytes_remaining)
  502. bytes_remaining = count;
  503. retval = icdi_usb_write_mem_int(handle, addr, bytes_remaining, buffer);
  504. if (retval != ERROR_OK)
  505. return retval;
  506. buffer += bytes_remaining;
  507. addr += bytes_remaining;
  508. count -= bytes_remaining;
  509. }
  510. return retval;
  511. }
  512. static int icdi_usb_override_target(const char *targetname)
  513. {
  514. return !strcmp(targetname, "cortex_m");
  515. }
  516. static int icdi_usb_close(void *handle)
  517. {
  518. struct icdi_usb_handle_s *h = handle;
  519. if (!h)
  520. return ERROR_OK;
  521. if (h->usb_dev)
  522. libusb_close(h->usb_dev);
  523. if (h->usb_ctx)
  524. libusb_exit(h->usb_ctx);
  525. if (h->read_buffer)
  526. free(h->read_buffer);
  527. if (h->write_buffer)
  528. free(h->write_buffer);
  529. free(handle);
  530. return ERROR_OK;
  531. }
  532. static int icdi_usb_open(struct hl_interface_param_s *param, void **fd)
  533. {
  534. int retval;
  535. struct icdi_usb_handle_s *h;
  536. LOG_DEBUG("icdi_usb_open");
  537. h = calloc(1, sizeof(struct icdi_usb_handle_s));
  538. if (h == 0) {
  539. LOG_ERROR("unable to allocate memory");
  540. return ERROR_FAIL;
  541. }
  542. LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x", param->transport,
  543. param->vid, param->pid);
  544. if (libusb_init(&h->usb_ctx) != 0) {
  545. LOG_ERROR("libusb init failed");
  546. goto error_open;
  547. }
  548. h->usb_dev = libusb_open_device_with_vid_pid(h->usb_ctx, param->vid, param->pid);
  549. if (!h->usb_dev) {
  550. LOG_ERROR("open failed");
  551. goto error_open;
  552. }
  553. if (libusb_claim_interface(h->usb_dev, 2)) {
  554. LOG_DEBUG("claim interface failed");
  555. goto error_open;
  556. }
  557. /* check if mode is supported */
  558. retval = ERROR_OK;
  559. switch (param->transport) {
  560. #if 0
  561. /* TODO place holder as swd is not currently supported */
  562. case HL_TRANSPORT_SWD:
  563. #endif
  564. case HL_TRANSPORT_JTAG:
  565. break;
  566. default:
  567. retval = ERROR_FAIL;
  568. break;
  569. }
  570. if (retval != ERROR_OK) {
  571. LOG_ERROR("mode (transport) not supported by device");
  572. goto error_open;
  573. }
  574. /* allocate buffer */
  575. h->read_buffer = malloc(ICDI_PACKET_SIZE);
  576. h->write_buffer = malloc(ICDI_PACKET_SIZE);
  577. h->max_packet = ICDI_PACKET_SIZE;
  578. if (h->read_buffer == 0 || h->write_buffer == 0) {
  579. LOG_DEBUG("malloc failed");
  580. goto error_open;
  581. }
  582. /* query icdi version etc */
  583. retval = icdi_usb_version(h);
  584. if (retval != ERROR_OK)
  585. goto error_open;
  586. /* query icdi support */
  587. retval = icdi_usb_query(h);
  588. if (retval != ERROR_OK)
  589. goto error_open;
  590. *fd = h;
  591. /* set the max target read/write buffer in bytes
  592. * as we are using gdb binary packets to transfer memory we have to
  593. * reserve half the buffer for any possible escape chars plus
  594. * at least 64 bytes for the gdb packet header */
  595. h->max_rw_packet = (((h->max_packet - 64) / 4) * 4) / 2;
  596. return ERROR_OK;
  597. error_open:
  598. icdi_usb_close(h);
  599. return ERROR_FAIL;
  600. }
  601. struct hl_layout_api_s icdi_usb_layout_api = {
  602. .open = icdi_usb_open,
  603. .close = icdi_usb_close,
  604. .idcode = icdi_usb_idcode,
  605. .state = icdi_usb_state,
  606. .reset = icdi_usb_reset,
  607. .assert_srst = icdi_usb_assert_srst,
  608. .run = icdi_usb_run,
  609. .halt = icdi_usb_halt,
  610. .step = icdi_usb_step,
  611. .read_regs = icdi_usb_read_regs,
  612. .read_reg = icdi_usb_read_reg,
  613. .write_reg = icdi_usb_write_reg,
  614. .read_mem = icdi_usb_read_mem,
  615. .write_mem = icdi_usb_write_mem,
  616. .write_debug_reg = icdi_usb_write_debug_reg,
  617. .override_target = icdi_usb_override_target,
  618. .custom_command = icdi_send_remote_cmd,
  619. };