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.
 
 
 
 
 
 

662 lines
18 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2005 by Dominic Rath *
  3. * Dominic.Rath@gmx.de *
  4. * *
  5. * Copyright (C) 2007-2010 Øyvind Harboe *
  6. * oyvind.harboe@zylin.com *
  7. * *
  8. * Copyright (C) 2008 by Spencer Oliver *
  9. * spen@spen-soft.co.uk *
  10. * *
  11. * This program is free software; you can redistribute it and/or modify *
  12. * it under the terms of the GNU General Public License as published by *
  13. * the Free Software Foundation; either version 2 of the License, or *
  14. * (at your option) any later version. *
  15. * *
  16. * This program is distributed in the hope that it will be useful, *
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  19. * GNU General Public License for more details. *
  20. * *
  21. * You should have received a copy of the GNU General Public License *
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  23. ***************************************************************************/
  24. #ifdef HAVE_CONFIG_H
  25. #include "config.h"
  26. #endif
  27. #include "embeddedice.h"
  28. #include "register.h"
  29. #include <helper/time_support.h>
  30. /**
  31. * @file
  32. *
  33. * This provides lowlevel glue to the EmbeddedICE (or EmbeddedICE-RT)
  34. * module found on scan chain 2 in ARM7, ARM9, and some other families
  35. * of ARM cores. The module is called "EmbeddedICE-RT" if it has
  36. * monitor mode support.
  37. *
  38. * EmbeddedICE provides basic watchpoint/breakpoint hardware and a Debug
  39. * Communications Channel (DCC) used to read or write 32-bit words to
  40. * OpenOCD-aware code running on the target CPU.
  41. * Newer modules also include vector catch hardware. Some versions
  42. * support hardware single-stepping, "monitor mode" debug (which is not
  43. * currently supported by OpenOCD), or extended reporting on why the
  44. * core entered debug mode.
  45. */
  46. static int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf);
  47. /*
  48. * From: ARM9E-S TRM, DDI 0165, table C-4 (and similar, for other cores)
  49. */
  50. static const struct {
  51. const char *name;
  52. unsigned short addr;
  53. unsigned short width;
  54. } eice_regs[] = {
  55. [EICE_DBG_CTRL] = {
  56. .name = "debug_ctrl",
  57. .addr = 0,
  58. /* width is assigned based on EICE version */
  59. },
  60. [EICE_DBG_STAT] = {
  61. .name = "debug_status",
  62. .addr = 1,
  63. /* width is assigned based on EICE version */
  64. },
  65. [EICE_COMMS_CTRL] = {
  66. .name = "comms_ctrl",
  67. .addr = 4,
  68. .width = 6,
  69. },
  70. [EICE_COMMS_DATA] = {
  71. .name = "comms_data",
  72. .addr = 5,
  73. .width = 32,
  74. },
  75. [EICE_W0_ADDR_VALUE] = {
  76. .name = "watch_0_addr_value",
  77. .addr = 8,
  78. .width = 32,
  79. },
  80. [EICE_W0_ADDR_MASK] = {
  81. .name = "watch_0_addr_mask",
  82. .addr = 9,
  83. .width = 32,
  84. },
  85. [EICE_W0_DATA_VALUE] = {
  86. .name = "watch_0_data_value",
  87. .addr = 10,
  88. .width = 32,
  89. },
  90. [EICE_W0_DATA_MASK] = {
  91. .name = "watch_0_data_mask",
  92. .addr = 11,
  93. .width = 32,
  94. },
  95. [EICE_W0_CONTROL_VALUE] = {
  96. .name = "watch_0_control_value",
  97. .addr = 12,
  98. .width = 9,
  99. },
  100. [EICE_W0_CONTROL_MASK] = {
  101. .name = "watch_0_control_mask",
  102. .addr = 13,
  103. .width = 8,
  104. },
  105. [EICE_W1_ADDR_VALUE] = {
  106. .name = "watch_1_addr_value",
  107. .addr = 16,
  108. .width = 32,
  109. },
  110. [EICE_W1_ADDR_MASK] = {
  111. .name = "watch_1_addr_mask",
  112. .addr = 17,
  113. .width = 32,
  114. },
  115. [EICE_W1_DATA_VALUE] = {
  116. .name = "watch_1_data_value",
  117. .addr = 18,
  118. .width = 32,
  119. },
  120. [EICE_W1_DATA_MASK] = {
  121. .name = "watch_1_data_mask",
  122. .addr = 19,
  123. .width = 32,
  124. },
  125. [EICE_W1_CONTROL_VALUE] = {
  126. .name = "watch_1_control_value",
  127. .addr = 20,
  128. .width = 9,
  129. },
  130. [EICE_W1_CONTROL_MASK] = {
  131. .name = "watch_1_control_mask",
  132. .addr = 21,
  133. .width = 8,
  134. },
  135. /* vector_catch isn't always present */
  136. [EICE_VEC_CATCH] = {
  137. .name = "vector_catch",
  138. .addr = 2,
  139. .width = 8,
  140. },
  141. };
  142. static int embeddedice_get_reg(struct reg *reg)
  143. {
  144. int retval = embeddedice_read_reg(reg);
  145. if (retval != ERROR_OK) {
  146. LOG_ERROR("error queueing EmbeddedICE register read");
  147. return retval;
  148. }
  149. retval = jtag_execute_queue();
  150. if (retval != ERROR_OK)
  151. LOG_ERROR("EmbeddedICE register read failed");
  152. return retval;
  153. }
  154. static const struct reg_arch_type eice_reg_type = {
  155. .get = embeddedice_get_reg,
  156. .set = embeddedice_set_reg_w_exec,
  157. };
  158. /**
  159. * Probe EmbeddedICE module and set up local records of its registers.
  160. * Different versions of the modules have different capabilities, such as
  161. * hardware support for vector_catch, single stepping, and monitor mode.
  162. */
  163. struct reg_cache *embeddedice_build_reg_cache(struct target *target,
  164. struct arm7_9_common *arm7_9)
  165. {
  166. int retval;
  167. struct reg_cache *reg_cache = malloc(sizeof(struct reg_cache));
  168. struct reg *reg_list = NULL;
  169. struct embeddedice_reg *arch_info = NULL;
  170. struct arm_jtag *jtag_info = &arm7_9->jtag_info;
  171. int num_regs = ARRAY_SIZE(eice_regs);
  172. int i;
  173. int eice_version = 0;
  174. /* vector_catch isn't always present */
  175. if (!arm7_9->has_vector_catch)
  176. num_regs--;
  177. /* the actual registers are kept in two arrays */
  178. reg_list = calloc(num_regs, sizeof(struct reg));
  179. arch_info = calloc(num_regs, sizeof(struct embeddedice_reg));
  180. /* fill in values for the reg cache */
  181. reg_cache->name = "EmbeddedICE registers";
  182. reg_cache->next = NULL;
  183. reg_cache->reg_list = reg_list;
  184. reg_cache->num_regs = num_regs;
  185. /* FIXME the second watchpoint unit on Feroceon and Dragonite
  186. * seems not to work ... we should have a way to not set up
  187. * its four registers here!
  188. */
  189. /* set up registers */
  190. for (i = 0; i < num_regs; i++) {
  191. reg_list[i].name = eice_regs[i].name;
  192. reg_list[i].size = eice_regs[i].width;
  193. reg_list[i].dirty = false;
  194. reg_list[i].valid = false;
  195. reg_list[i].value = calloc(1, 4);
  196. reg_list[i].arch_info = &arch_info[i];
  197. reg_list[i].type = &eice_reg_type;
  198. arch_info[i].addr = eice_regs[i].addr;
  199. arch_info[i].jtag_info = jtag_info;
  200. }
  201. /* identify EmbeddedICE version by reading DCC control register */
  202. embeddedice_read_reg(&reg_list[EICE_COMMS_CTRL]);
  203. retval = jtag_execute_queue();
  204. if (retval != ERROR_OK) {
  205. for (i = 0; i < num_regs; i++)
  206. free(reg_list[i].value);
  207. free(reg_list);
  208. free(reg_cache);
  209. free(arch_info);
  210. return NULL;
  211. }
  212. eice_version = buf_get_u32(reg_list[EICE_COMMS_CTRL].value, 28, 4);
  213. LOG_INFO("Embedded ICE version %d", eice_version);
  214. switch (eice_version) {
  215. case 1:
  216. /* ARM7TDMI r3, ARM7TDMI-S r3
  217. *
  218. * REVISIT docs say ARM7TDMI-S r4 uses version 1 but
  219. * that it has 6-bit CTRL and 5-bit STAT... doc bug?
  220. * ARM7TDMI r4 docs say EICE v4.
  221. */
  222. reg_list[EICE_DBG_CTRL].size = 3;
  223. reg_list[EICE_DBG_STAT].size = 5;
  224. break;
  225. case 2:
  226. /* ARM9TDMI */
  227. reg_list[EICE_DBG_CTRL].size = 4;
  228. reg_list[EICE_DBG_STAT].size = 5;
  229. arm7_9->has_single_step = 1;
  230. break;
  231. case 3:
  232. LOG_ERROR("EmbeddedICE v%d handling might be broken",
  233. eice_version);
  234. reg_list[EICE_DBG_CTRL].size = 6;
  235. reg_list[EICE_DBG_STAT].size = 5;
  236. arm7_9->has_single_step = 1;
  237. arm7_9->has_monitor_mode = 1;
  238. break;
  239. case 4:
  240. /* ARM7TDMI r4 */
  241. reg_list[EICE_DBG_CTRL].size = 6;
  242. reg_list[EICE_DBG_STAT].size = 5;
  243. arm7_9->has_monitor_mode = 1;
  244. break;
  245. case 5:
  246. /* ARM9E-S rev 1 */
  247. reg_list[EICE_DBG_CTRL].size = 6;
  248. reg_list[EICE_DBG_STAT].size = 5;
  249. arm7_9->has_single_step = 1;
  250. arm7_9->has_monitor_mode = 1;
  251. break;
  252. case 6:
  253. /* ARM7EJ-S, ARM9E-S rev 2, ARM9EJ-S */
  254. reg_list[EICE_DBG_CTRL].size = 6;
  255. reg_list[EICE_DBG_STAT].size = 10;
  256. /* DBG_STAT has MOE bits */
  257. arm7_9->has_monitor_mode = 1;
  258. break;
  259. case 7:
  260. LOG_ERROR("EmbeddedICE v%d handling might be broken",
  261. eice_version);
  262. reg_list[EICE_DBG_CTRL].size = 6;
  263. reg_list[EICE_DBG_STAT].size = 5;
  264. arm7_9->has_monitor_mode = 1;
  265. break;
  266. default:
  267. /*
  268. * The Feroceon implementation has the version number
  269. * in some unusual bits. Let feroceon.c validate it
  270. * and do the appropriate setup itself.
  271. */
  272. if (strcmp(target_type_name(target), "feroceon") == 0 ||
  273. strcmp(target_type_name(target), "dragonite") == 0)
  274. break;
  275. LOG_ERROR("unknown EmbeddedICE version "
  276. "(comms ctrl: 0x%8.8" PRIx32 ")",
  277. buf_get_u32(reg_list[EICE_COMMS_CTRL].value, 0, 32));
  278. }
  279. /* On Feroceon and Dragonite the second unit is seemingly missing. */
  280. LOG_INFO("%s: hardware has %d breakpoint/watchpoint unit%s",
  281. target_name(target), arm7_9->wp_available_max,
  282. (arm7_9->wp_available_max != 1) ? "s" : "");
  283. return reg_cache;
  284. }
  285. /**
  286. * Free all memory allocated for EmbeddedICE register cache
  287. */
  288. void embeddedice_free_reg_cache(struct reg_cache *reg_cache)
  289. {
  290. if (!reg_cache)
  291. return;
  292. for (unsigned int i = 0; i < reg_cache->num_regs; i++)
  293. free(reg_cache->reg_list[i].value);
  294. free(reg_cache->reg_list[0].arch_info);
  295. free(reg_cache->reg_list);
  296. free(reg_cache);
  297. }
  298. /**
  299. * Initialize EmbeddedICE module, if needed.
  300. */
  301. int embeddedice_setup(struct target *target)
  302. {
  303. int retval;
  304. struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
  305. /* Explicitly disable monitor mode. For now we only support halting
  306. * debug ... we don't know how to talk with a resident debug monitor
  307. * that manages break requests. ARM's "Angel Debug Monitor" is one
  308. * common example of such code.
  309. */
  310. if (arm7_9->has_monitor_mode) {
  311. struct reg *dbg_ctrl = &arm7_9->eice_cache->reg_list[EICE_DBG_CTRL];
  312. embeddedice_read_reg(dbg_ctrl);
  313. retval = jtag_execute_queue();
  314. if (retval != ERROR_OK)
  315. return retval;
  316. buf_set_u32(dbg_ctrl->value, 4, 1, 0);
  317. embeddedice_set_reg_w_exec(dbg_ctrl, dbg_ctrl->value);
  318. }
  319. return jtag_execute_queue();
  320. }
  321. /**
  322. * Queue a read for an EmbeddedICE register into the register cache,
  323. * optionally checking the value read.
  324. * Note that at this level, all registers are 32 bits wide.
  325. */
  326. int embeddedice_read_reg_w_check(struct reg *reg,
  327. uint8_t *check_value, uint8_t *check_mask)
  328. {
  329. struct embeddedice_reg *ice_reg = reg->arch_info;
  330. uint8_t reg_addr = ice_reg->addr & 0x1f;
  331. struct scan_field fields[3];
  332. uint8_t field1_out[1];
  333. uint8_t field2_out[1];
  334. int retval;
  335. retval = arm_jtag_scann(ice_reg->jtag_info, 0x2, TAP_IDLE);
  336. if (retval != ERROR_OK)
  337. return retval;
  338. retval = arm_jtag_set_instr(ice_reg->jtag_info->tap,
  339. ice_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
  340. if (retval != ERROR_OK)
  341. return retval;
  342. /* bits 31:0 -- data (ignored here) */
  343. fields[0].num_bits = 32;
  344. fields[0].out_value = reg->value;
  345. fields[0].in_value = NULL;
  346. fields[0].check_value = NULL;
  347. fields[0].check_mask = NULL;
  348. /* bits 36:32 -- register */
  349. fields[1].num_bits = 5;
  350. fields[1].out_value = field1_out;
  351. field1_out[0] = reg_addr;
  352. fields[1].in_value = NULL;
  353. fields[1].check_value = NULL;
  354. fields[1].check_mask = NULL;
  355. /* bit 37 -- 0/read */
  356. fields[2].num_bits = 1;
  357. fields[2].out_value = field2_out;
  358. field2_out[0] = 0;
  359. fields[2].in_value = NULL;
  360. fields[2].check_value = NULL;
  361. fields[2].check_mask = NULL;
  362. /* traverse Update-DR, setting address for the next read */
  363. jtag_add_dr_scan(ice_reg->jtag_info->tap, 3, fields, TAP_IDLE);
  364. /* bits 31:0 -- the data we're reading (and maybe checking) */
  365. fields[0].in_value = reg->value;
  366. fields[0].check_value = check_value;
  367. fields[0].check_mask = check_mask;
  368. /* when reading the DCC data register, leaving the address field set to
  369. * EICE_COMMS_DATA would read the register twice
  370. * reading the control register is safe
  371. */
  372. field1_out[0] = eice_regs[EICE_COMMS_CTRL].addr;
  373. /* traverse Update-DR, reading but with no other side effects */
  374. jtag_add_dr_scan_check(ice_reg->jtag_info->tap, 3, fields, TAP_IDLE);
  375. return ERROR_OK;
  376. }
  377. /**
  378. * Receive a block of size 32-bit words from the DCC.
  379. * We assume the target is always going to be fast enough (relative to
  380. * the JTAG clock) that the debugger won't need to poll the handshake
  381. * bit. The JTAG clock is usually at least six times slower than the
  382. * functional clock, so the 50+ JTAG clocks needed to receive the word
  383. * allow hundreds of instruction cycles (per word) in the target.
  384. */
  385. int embeddedice_receive(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size)
  386. {
  387. struct scan_field fields[3];
  388. uint8_t field1_out[1];
  389. uint8_t field2_out[1];
  390. int retval;
  391. retval = arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
  392. if (retval != ERROR_OK)
  393. return retval;
  394. retval = arm_jtag_set_instr(jtag_info->tap, jtag_info->intest_instr, NULL, TAP_IDLE);
  395. if (retval != ERROR_OK)
  396. return retval;
  397. fields[0].num_bits = 32;
  398. fields[0].out_value = NULL;
  399. fields[0].in_value = NULL;
  400. fields[1].num_bits = 5;
  401. fields[1].out_value = field1_out;
  402. field1_out[0] = eice_regs[EICE_COMMS_DATA].addr;
  403. fields[1].in_value = NULL;
  404. fields[2].num_bits = 1;
  405. fields[2].out_value = field2_out;
  406. field2_out[0] = 0;
  407. fields[2].in_value = NULL;
  408. jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
  409. while (size > 0) {
  410. /* when reading the last item, set the register address to the DCC control reg,
  411. * to avoid reading additional data from the DCC data reg
  412. */
  413. if (size == 1)
  414. field1_out[0] = eice_regs[EICE_COMMS_CTRL].addr;
  415. fields[0].in_value = (uint8_t *)data;
  416. jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
  417. jtag_add_callback(arm_le_to_h_u32, (jtag_callback_data_t)data);
  418. data++;
  419. size--;
  420. }
  421. return jtag_execute_queue();
  422. }
  423. /**
  424. * Queue a read for an EmbeddedICE register into the register cache,
  425. * not checking the value read.
  426. */
  427. int embeddedice_read_reg(struct reg *reg)
  428. {
  429. return embeddedice_read_reg_w_check(reg, NULL, NULL);
  430. }
  431. /**
  432. * Queue a write for an EmbeddedICE register, updating the register cache.
  433. * Uses embeddedice_write_reg().
  434. */
  435. void embeddedice_set_reg(struct reg *reg, uint32_t value)
  436. {
  437. embeddedice_write_reg(reg, value);
  438. buf_set_u32(reg->value, 0, reg->size, value);
  439. reg->valid = true;
  440. reg->dirty = false;
  441. }
  442. /**
  443. * Write an EmbeddedICE register, updating the register cache.
  444. * Uses embeddedice_set_reg(); not queued.
  445. */
  446. static int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf)
  447. {
  448. int retval;
  449. embeddedice_set_reg(reg, buf_get_u32(buf, 0, reg->size));
  450. retval = jtag_execute_queue();
  451. if (retval != ERROR_OK)
  452. LOG_ERROR("register write failed");
  453. return retval;
  454. }
  455. /**
  456. * Queue a write for an EmbeddedICE register, bypassing the register cache.
  457. */
  458. void embeddedice_write_reg(struct reg *reg, uint32_t value)
  459. {
  460. struct embeddedice_reg *ice_reg = reg->arch_info;
  461. LOG_DEBUG("%i: 0x%8.8" PRIx32 "", ice_reg->addr, value);
  462. arm_jtag_scann(ice_reg->jtag_info, 0x2, TAP_IDLE);
  463. arm_jtag_set_instr(ice_reg->jtag_info->tap, ice_reg->jtag_info->intest_instr, NULL, TAP_IDLE);
  464. uint8_t reg_addr = ice_reg->addr & 0x1f;
  465. embeddedice_write_reg_inner(ice_reg->jtag_info->tap, reg_addr, value);
  466. }
  467. /**
  468. * Queue a write for an EmbeddedICE register, using cached value.
  469. * Uses embeddedice_write_reg().
  470. */
  471. void embeddedice_store_reg(struct reg *reg)
  472. {
  473. embeddedice_write_reg(reg, buf_get_u32(reg->value, 0, reg->size));
  474. }
  475. /**
  476. * Send a block of size 32-bit words to the DCC.
  477. * We assume the target is always going to be fast enough (relative to
  478. * the JTAG clock) that the debugger won't need to poll the handshake
  479. * bit. The JTAG clock is usually at least six times slower than the
  480. * functional clock, so the 50+ JTAG clocks needed to receive the word
  481. * allow hundreds of instruction cycles (per word) in the target.
  482. */
  483. int embeddedice_send(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size)
  484. {
  485. struct scan_field fields[3];
  486. uint8_t field0_out[4];
  487. uint8_t field1_out[1];
  488. uint8_t field2_out[1];
  489. int retval;
  490. retval = arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
  491. if (retval != ERROR_OK)
  492. return retval;
  493. retval = arm_jtag_set_instr(jtag_info->tap, jtag_info->intest_instr, NULL, TAP_IDLE);
  494. if (retval != ERROR_OK)
  495. return retval;
  496. fields[0].num_bits = 32;
  497. fields[0].out_value = field0_out;
  498. fields[0].in_value = NULL;
  499. fields[1].num_bits = 5;
  500. fields[1].out_value = field1_out;
  501. field1_out[0] = eice_regs[EICE_COMMS_DATA].addr;
  502. fields[1].in_value = NULL;
  503. fields[2].num_bits = 1;
  504. fields[2].out_value = field2_out;
  505. field2_out[0] = 1;
  506. fields[2].in_value = NULL;
  507. while (size > 0) {
  508. buf_set_u32(field0_out, 0, 32, *data);
  509. jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
  510. data++;
  511. size--;
  512. }
  513. /* call to jtag_execute_queue() intentionally omitted */
  514. return ERROR_OK;
  515. }
  516. /**
  517. * Poll DCC control register until read or write handshake completes.
  518. */
  519. int embeddedice_handshake(struct arm_jtag *jtag_info, int hsbit, uint32_t timeout)
  520. {
  521. struct scan_field fields[3];
  522. uint8_t field0_in[4];
  523. uint8_t field1_out[1];
  524. uint8_t field2_out[1];
  525. int retval;
  526. uint32_t hsact;
  527. struct timeval now;
  528. struct timeval timeout_end;
  529. if (hsbit == EICE_COMM_CTRL_WBIT)
  530. hsact = 1;
  531. else if (hsbit == EICE_COMM_CTRL_RBIT)
  532. hsact = 0;
  533. else {
  534. LOG_ERROR("Invalid arguments");
  535. return ERROR_COMMAND_SYNTAX_ERROR;
  536. }
  537. retval = arm_jtag_scann(jtag_info, 0x2, TAP_IDLE);
  538. if (retval != ERROR_OK)
  539. return retval;
  540. retval = arm_jtag_set_instr(jtag_info->tap, jtag_info->intest_instr, NULL, TAP_IDLE);
  541. if (retval != ERROR_OK)
  542. return retval;
  543. fields[0].num_bits = 32;
  544. fields[0].out_value = NULL;
  545. fields[0].in_value = field0_in;
  546. fields[1].num_bits = 5;
  547. fields[1].out_value = field1_out;
  548. field1_out[0] = eice_regs[EICE_COMMS_DATA].addr;
  549. fields[1].in_value = NULL;
  550. fields[2].num_bits = 1;
  551. fields[2].out_value = field2_out;
  552. field2_out[0] = 0;
  553. fields[2].in_value = NULL;
  554. jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
  555. gettimeofday(&timeout_end, NULL);
  556. timeval_add_time(&timeout_end, 0, timeout * 1000);
  557. do {
  558. jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_IDLE);
  559. retval = jtag_execute_queue();
  560. if (retval != ERROR_OK)
  561. return retval;
  562. if (buf_get_u32(field0_in, hsbit, 1) == hsact)
  563. return ERROR_OK;
  564. gettimeofday(&now, NULL);
  565. } while (timeval_compare(&now, &timeout_end) <= 0);
  566. LOG_ERROR("embeddedice handshake timeout");
  567. return ERROR_TARGET_TIMEOUT;
  568. }
  569. /**
  570. * This is an inner loop of the open loop DCC write of data to target
  571. */
  572. void embeddedice_write_dcc(struct jtag_tap *tap,
  573. int reg_addr, const uint8_t *buffer, int little, int count)
  574. {
  575. int i;
  576. for (i = 0; i < count; i++) {
  577. embeddedice_write_reg_inner(tap, reg_addr,
  578. fast_target_buffer_get_u32(buffer, little));
  579. buffer += 4;
  580. }
  581. }