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.
 
 
 
 
 
 

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