OpenOCD
arm720t.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2005 by Dominic Rath *
5  * Dominic.Rath@gmx.de *
6  * *
7  * Copyright (C) 2009 by Øyvind Harboe *
8  * oyvind.harboe@zylin.com *
9  ***************************************************************************/
10 
11 #ifdef HAVE_CONFIG_H
12 #include "config.h"
13 #endif
14 
15 #include "arm720t.h"
16 #include <helper/time_support.h>
17 #include <helper/string_choices.h>
18 #include "target_type.h"
19 #include "register.h"
20 #include "arm_opcodes.h"
21 
22 
23 /*
24  * ARM720 is an ARM7TDMI-S with MMU and ETM7. For information, see
25  * ARM DDI 0229C especially Chapter 9 about debug support.
26  */
27 
28 #if 0
29 #define _DEBUG_INSTRUCTION_EXECUTION_
30 #endif
31 
32 static int arm720t_scan_cp15(struct target *target,
33  uint32_t out, uint32_t *in, int instruction, int clock_arg)
34 {
35  int retval;
36  struct arm720t_common *arm720t = target_to_arm720(target);
37  struct arm_jtag *jtag_info;
38  struct scan_field fields[2];
39  uint8_t out_buf[4];
40  uint8_t instruction_buf = instruction;
41 
42  jtag_info = &arm720t->arm7_9_common.jtag_info;
43 
44  buf_set_u32(out_buf, 0, 32, flip_u32(out, 32));
45 
46  retval = arm_jtag_scann(jtag_info, 0xf, TAP_DRPAUSE);
47  if (retval != ERROR_OK)
48  return retval;
49  retval = arm_jtag_set_instr(jtag_info->tap, jtag_info->intest_instr, NULL, TAP_DRPAUSE);
50  if (retval != ERROR_OK)
51  return retval;
52 
53  fields[0].num_bits = 1;
54  fields[0].out_value = &instruction_buf;
55  fields[0].in_value = NULL;
56 
57  fields[1].num_bits = 32;
58  fields[1].out_value = out_buf;
59  fields[1].in_value = NULL;
60 
61  if (in) {
62  fields[1].in_value = (uint8_t *)in;
63  jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);
65  } else
66  jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);
67 
68  if (clock_arg)
70 
71 #ifdef _DEBUG_INSTRUCTION_EXECUTION_
72  retval = jtag_execute_queue();
73  if (retval != ERROR_OK)
74  return retval;
75 
76  if (in)
77  LOG_DEBUG("out: %8.8x, in: %8.8x, instruction: %i, clock: %i", out, *in, instruction, clock);
78  else
79  LOG_DEBUG("out: %8.8x, instruction: %i, clock: %i", out, instruction, clock_arg);
80 #else
81  LOG_DEBUG("out: %8.8" PRIx32 ", instruction: %i, clock: %i", out, instruction, clock_arg);
82 #endif
83 
84  return ERROR_OK;
85 }
86 
87 static int arm720t_read_cp15(struct target *target, uint32_t opcode, uint32_t *value)
88 {
89  /* fetch CP15 opcode */
90  arm720t_scan_cp15(target, opcode, NULL, 1, 1);
91  /* "DECODE" stage */
93  /* "EXECUTE" stage (1) */
95  arm720t_scan_cp15(target, 0x0, NULL, 0, 1);
96  /* "EXECUTE" stage (2) */
97  arm720t_scan_cp15(target, 0x0, NULL, 0, 1);
98  /* "EXECUTE" stage (3), CDATA is read */
99  arm720t_scan_cp15(target, ARMV4_5_NOP, value, 1, 1);
100 
101  return ERROR_OK;
102 }
103 
104 static int arm720t_write_cp15(struct target *target, uint32_t opcode, uint32_t value)
105 {
106  /* fetch CP15 opcode */
107  arm720t_scan_cp15(target, opcode, NULL, 1, 1);
108  /* "DECODE" stage */
110  /* "EXECUTE" stage (1) */
112  arm720t_scan_cp15(target, 0x0, NULL, 0, 1);
113  /* "EXECUTE" stage (2) */
114  arm720t_scan_cp15(target, value, NULL, 0, 1);
116 
117  return ERROR_OK;
118 }
119 
120 static int arm720t_get_ttb(struct target *target, uint32_t *result)
121 {
122  uint32_t ttb = 0x0;
123 
124  int retval;
125 
126  retval = arm720t_read_cp15(target, 0xee120f10, &ttb);
127  if (retval != ERROR_OK)
128  return retval;
129  retval = jtag_execute_queue();
130  if (retval != ERROR_OK)
131  return retval;
132 
133  ttb &= 0xffffc000;
134 
135  *result = ttb;
136 
137  return ERROR_OK;
138 }
139 
141  int mmu, int d_u_cache, int i_cache)
142 {
143  uint32_t cp15_control;
144  int retval;
145 
146  /* read cp15 control register */
147  retval = arm720t_read_cp15(target, 0xee110f10, &cp15_control);
148  if (retval != ERROR_OK)
149  return retval;
150  retval = jtag_execute_queue();
151  if (retval != ERROR_OK)
152  return retval;
153 
154  if (mmu)
155  cp15_control &= ~0x1U;
156 
157  if (d_u_cache || i_cache)
158  cp15_control &= ~0x4U;
159 
160  retval = arm720t_write_cp15(target, 0xee010f10, cp15_control);
161  return retval;
162 }
163 
165  int mmu, int d_u_cache, int i_cache)
166 {
167  uint32_t cp15_control;
168  int retval;
169 
170  /* read cp15 control register */
171  retval = arm720t_read_cp15(target, 0xee110f10, &cp15_control);
172  if (retval != ERROR_OK)
173  return retval;
174  retval = jtag_execute_queue();
175  if (retval != ERROR_OK)
176  return retval;
177 
178  if (mmu)
179  cp15_control |= 0x1U;
180 
181  if (d_u_cache || i_cache)
182  cp15_control |= 0x4U;
183 
184  retval = arm720t_write_cp15(target, 0xee010f10, cp15_control);
185  return retval;
186 }
187 
189 {
190  struct arm720t_common *arm720t = target_to_arm720(target);
191  int retval;
192 
193  /* examine cp15 control reg */
194  retval = arm720t_read_cp15(target, 0xee110f10, &arm720t->cp15_control_reg);
195  if (retval != ERROR_OK)
196  return retval;
197  retval = jtag_execute_queue();
198  if (retval != ERROR_OK)
199  return retval;
200  LOG_DEBUG("cp15_control_reg: %8.8" PRIx32 "", arm720t->cp15_control_reg);
201 
202  arm720t->armv4_5_mmu.mmu_enabled = arm720t->cp15_control_reg & 0x1U;
204  arm720t->cp15_control_reg & 0x4U;
205  arm720t->armv4_5_mmu.armv4_5_cache.i_cache_enabled = false;
206 
207  /* save i/d fault status and address register */
208  retval = arm720t_read_cp15(target, 0xee150f10, &arm720t->fsr_reg);
209  if (retval != ERROR_OK)
210  return retval;
211  retval = arm720t_read_cp15(target, 0xee160f10, &arm720t->far_reg);
212  if (retval != ERROR_OK)
213  return retval;
214  retval = jtag_execute_queue();
215  return retval;
216 }
217 
219 {
220  struct arm720t_common *arm720t = target_to_arm720(target);
221 
222  /* restore i/d fault status and address register */
223  arm720t_write_cp15(target, 0xee050f10, arm720t->fsr_reg);
224  arm720t_write_cp15(target, 0xee060f10, arm720t->far_reg);
225 }
226 
227 static int arm720t_arch_state(struct target *target)
228 {
229  struct arm720t_common *arm720t = target_to_arm720(target);
230 
232  LOG_USER("MMU: %s, Cache: %s",
235 
236  return ERROR_OK;
237 }
238 
239 static int arm720_mmu(struct target *target, bool *enabled)
240 {
241  if (target->state != TARGET_HALTED) {
242  LOG_TARGET_ERROR(target, "not halted");
244  }
245 
247  return ERROR_OK;
248 }
249 
250 static int arm720_virt2phys(struct target *target,
251  target_addr_t virtual, target_addr_t *physical)
252 {
253  uint32_t cb;
254  struct arm720t_common *arm720t = target_to_arm720(target);
255 
256  uint32_t ret;
257  int retval = armv4_5_mmu_translate_va(target,
258  &arm720t->armv4_5_mmu, virtual, &cb, &ret);
259  if (retval != ERROR_OK)
260  return retval;
261  *physical = ret;
262  return ERROR_OK;
263 }
264 
265 static int arm720t_read_memory(struct target *target,
266  target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
267 {
268  int retval;
269  struct arm720t_common *arm720t = target_to_arm720(target);
270 
271  /* disable cache, but leave MMU enabled */
273  retval = arm720t_disable_mmu_caches(target, 0, 1, 0);
274  if (retval != ERROR_OK)
275  return retval;
276  }
278 
280  retval = arm720t_enable_mmu_caches(target, 0, 1, 0);
281  if (retval != ERROR_OK)
282  return retval;
283  }
284 
285  return retval;
286 }
287 
289  target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
290 {
291  struct arm720t_common *arm720t = target_to_arm720(target);
292 
294 }
295 
297  target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
298 {
299  struct arm720t_common *arm720t = target_to_arm720(target);
300 
302 }
303 
305 {
306  int retval = ERROR_OK;
307  struct arm720t_common *arm720t = target_to_arm720(target);
308  struct reg *dbg_stat = &arm720t->arm7_9_common
310  struct arm *arm = &arm720t->arm7_9_common.arm;
311 
312  retval = target_halt(target);
313  if (retval != ERROR_OK)
314  return retval;
315 
316  int64_t then = timeval_ms();
317  int timeout;
318  while (!(timeout = ((timeval_ms()-then) > 1000))) {
319  if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) == 0) {
320  embeddedice_read_reg(dbg_stat);
321  retval = jtag_execute_queue();
322  if (retval != ERROR_OK)
323  return retval;
324  } else
325  break;
326  if (debug_level >= 3)
327  alive_sleep(100);
328  else
329  keep_alive();
330  }
331  if (timeout) {
332  LOG_ERROR("Failed to halt CPU after 1 sec");
333  return ERROR_TARGET_TIMEOUT;
334  }
335 
337 
338  /* SVC, ARM state, IRQ and FIQ disabled */
339  uint32_t cpsr;
340 
341  cpsr = buf_get_u32(arm->cpsr->value, 0, 32);
342  cpsr &= ~0xff;
343  cpsr |= 0xd3;
345  arm->cpsr->dirty = true;
346 
347  /* start fetching from 0x0 */
348  buf_set_u32(arm->pc->value, 0, 32, 0x0);
349  arm->pc->dirty = true;
350  arm->pc->valid = true;
351 
352  retval = arm720t_disable_mmu_caches(target, 1, 1, 1);
353  if (retval != ERROR_OK)
354  return retval;
355  arm720t->armv4_5_mmu.mmu_enabled = false;
357  arm720t->armv4_5_mmu.armv4_5_cache.i_cache_enabled = false;
358 
360  if (retval != ERROR_OK)
361  return retval;
362 
363  return ERROR_OK;
364 }
365 
366 static int arm720t_init_target(struct command_context *cmd_ctx, struct target *target)
367 {
368  return arm7tdmi_init_target(cmd_ctx, target);
369 }
370 
371 static void arm720t_deinit_target(struct target *target)
372 {
374 }
375 
376 /* FIXME remove forward decls */
377 static int arm720t_mrc(struct target *target, int cpnum,
378  uint32_t op1, uint32_t op2,
379  uint32_t crn, uint32_t crm,
380  uint32_t *value);
381 static int arm720t_mcr(struct target *target, int cpnum,
382  uint32_t op1, uint32_t op2,
383  uint32_t crn, uint32_t crm,
384  uint32_t value);
385 
387  struct arm720t_common *arm720t, struct jtag_tap *tap)
388 {
389  struct arm7_9_common *arm7_9 = &arm720t->arm7_9_common;
390 
391  arm7_9->arm.mrc = arm720t_mrc;
392  arm7_9->arm.mcr = arm720t_mcr;
393 
394  arm7tdmi_init_arch_info(target, arm7_9, tap);
395 
397 
400 
401  arm720t->armv4_5_mmu.armv4_5_cache.ctype = -1;
407  arm720t->armv4_5_mmu.has_tiny_pages = 0;
408  arm720t->armv4_5_mmu.mmu_enabled = false;
409 
410  return ERROR_OK;
411 }
412 
414 {
415  struct arm720t_common *arm720t = calloc(1, sizeof(*arm720t));
416 
417  arm720t->arm7_9_common.arm.arch = ARM_ARCH_V4;
418  return arm720t_init_arch_info(target, arm720t, target->tap);
419 }
420 
421 static int arm720t_mrc(struct target *target, int cpnum,
422  uint32_t op1, uint32_t op2,
423  uint32_t crn, uint32_t crm,
424  uint32_t *value)
425 {
426  if (cpnum != 15) {
427  LOG_ERROR("Only cp15 is supported");
428  return ERROR_FAIL;
429  }
430 
431  /* read "to" r0 */
432  return arm720t_read_cp15(target,
433  ARMV4_5_MRC(cpnum, op1, 0, crn, crm, op2),
434  value);
435 
436 }
437 
438 static int arm720t_mcr(struct target *target, int cpnum,
439  uint32_t op1, uint32_t op2,
440  uint32_t crn, uint32_t crm,
441  uint32_t value)
442 {
443  if (cpnum != 15) {
444  LOG_ERROR("Only cp15 is supported");
445  return ERROR_FAIL;
446  }
447 
448  /* write "from" r0 */
449  return arm720t_write_cp15(target,
450  ARMV4_5_MCR(cpnum, op1, 0, crn, crm, op2),
451  value);
452 }
453 
454 static const struct command_registration arm720t_command_handlers[] = {
455  {
457  },
459 };
460 
462 struct target_type arm720t_target = {
463  .name = "arm720t",
464 
465  .poll = arm7_9_poll,
466  .arch_state = arm720t_arch_state,
467 
468  .halt = arm7_9_halt,
469  .resume = arm7_9_resume,
470  .step = arm7_9_step,
471 
472  .assert_reset = arm7_9_assert_reset,
473  .deassert_reset = arm7_9_deassert_reset,
474  .soft_reset_halt = arm720t_soft_reset_halt,
475 
476  .get_gdb_arch = arm_get_gdb_arch,
477  .get_gdb_reg_list = arm_get_gdb_reg_list,
478 
479  .read_memory = arm720t_read_memory,
480  .write_memory = arm7_9_write_memory_opt,
481  .read_phys_memory = arm720t_read_phys_memory,
482  .write_phys_memory = arm720t_write_phys_memory,
483  .mmu = arm720_mmu,
484  .virt2phys = arm720_virt2phys,
485 
486  .checksum_memory = arm_checksum_memory,
487  .blank_check_memory = arm_blank_check_memory,
488 
489  .run_algorithm = armv4_5_run_algorithm,
490 
491  .add_breakpoint = arm7_9_add_breakpoint,
492  .remove_breakpoint = arm7_9_remove_breakpoint,
493  .add_watchpoint = arm7_9_add_watchpoint,
494  .remove_watchpoint = arm7_9_remove_watchpoint,
495 
496  .commands = arm720t_command_handlers,
497  .target_create = arm720t_target_create,
498  .init_target = arm720t_init_target,
499  .deinit_target = arm720t_deinit_target,
500  .examine = arm7_9_examine,
501  .check_reset = arm7_9_check_reset,
502 };
static int arm720t_get_ttb(struct target *target, uint32_t *result)
Definition: arm720t.c:120
static int arm720t_init_target(struct command_context *cmd_ctx, struct target *target)
Definition: arm720t.c:366
static int arm720t_enable_mmu_caches(struct target *target, int mmu, int d_u_cache, int i_cache)
Definition: arm720t.c:164
static int arm720t_init_arch_info(struct target *target, struct arm720t_common *arm720t, struct jtag_tap *tap)
Definition: arm720t.c:386
static int arm720t_post_debug_entry(struct target *target)
Definition: arm720t.c:188
static int arm720t_write_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Definition: arm720t.c:296
static int arm720t_write_cp15(struct target *target, uint32_t opcode, uint32_t value)
Definition: arm720t.c:104
static int arm720t_arch_state(struct target *target)
Definition: arm720t.c:227
static int arm720t_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Definition: arm720t.c:265
static int arm720_virt2phys(struct target *target, target_addr_t virtual, target_addr_t *physical)
Definition: arm720t.c:250
static int arm720t_read_cp15(struct target *target, uint32_t opcode, uint32_t *value)
Definition: arm720t.c:87
static int arm720t_mcr(struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t value)
Definition: arm720t.c:438
struct target_type arm720t_target
Holds methods for ARM720 targets.
Definition: arm720t.c:462
static int arm720_mmu(struct target *target, bool *enabled)
Definition: arm720t.c:239
static int arm720t_mrc(struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t *value)
Definition: arm720t.c:421
static int arm720t_target_create(struct target *target)
Definition: arm720t.c:413
static void arm720t_pre_restore_context(struct target *target)
Definition: arm720t.c:218
static const struct command_registration arm720t_command_handlers[]
Definition: arm720t.c:454
static int arm720t_scan_cp15(struct target *target, uint32_t out, uint32_t *in, int instruction, int clock_arg)
Definition: arm720t.c:32
static int arm720t_soft_reset_halt(struct target *target)
Definition: arm720t.c:304
static void arm720t_deinit_target(struct target *target)
Definition: arm720t.c:371
static int arm720t_disable_mmu_caches(struct target *target, int mmu, int d_u_cache, int i_cache)
Definition: arm720t.c:140
static int arm720t_read_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Definition: arm720t.c:288
#define ARM720T_COMMON_MAGIC
Definition: arm720t.h:14
static struct arm720t_common * target_to_arm720(struct target *target)
Definition: arm720t.h:26
int arm7_9_write_memory_opt(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int arm7_9_examine(struct target *target)
Perform per-target setup that requires JTAG access.
int arm7_9_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int arm7_9_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add a breakpoint to an ARM7/9 target.
const struct command_registration arm7_9_command_handlers[]
int arm7_9_assert_reset(struct target *target)
Asserts the reset (SRST) on an ARM7/9 target.
int arm7_9_poll(struct target *target)
Polls an ARM7/9 target for its current status.
int arm7_9_halt(struct target *target)
Halt an ARM7/9 target.
int arm7_9_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
Removes a breakpoint from an ARM7/9 target.
int arm7_9_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
Remove a watchpoint from an ARM7/9 target.
int arm7_9_deassert_reset(struct target *target)
Deassert the reset (SRST) signal on an ARM7/9 target.
int arm7_9_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int arm7_9_step(struct target *target, bool current, target_addr_t address, bool handle_breakpoints)
int arm7_9_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
Add a watchpoint to an ARM7/9 target.
int arm7_9_check_reset(struct target *target)
int arm7_9_resume(struct target *target, bool current, target_addr_t address, bool handle_breakpoints, bool debug_execution)
int arm7tdmi_init_arch_info(struct target *target, struct arm7_9_common *arm7_9, struct jtag_tap *tap)
Definition: arm7tdmi.c:621
void arm7tdmi_deinit_target(struct target *target)
Definition: arm7tdmi.c:616
int arm7tdmi_init_target(struct command_context *cmd_ctx, struct target *target)
Definition: arm7tdmi.c:609
int arm_blank_check_memory(struct target *target, struct target_memory_check_block *blocks, int num_blocks, uint8_t erased_value)
Runs ARM code in the target to check whether a memory block holds all ones.
Definition: armv4_5.c:1686
int arm_arch_state(struct target *target)
Definition: armv4_5.c:796
int arm_checksum_memory(struct target *target, target_addr_t address, uint32_t count, uint32_t *checksum)
Runs ARM code in the target to calculate a CRC32 checksum.
Definition: armv4_5.c:1613
@ ARM_ARCH_V4
Definition: arm.h:55
const char * arm_get_gdb_arch(const struct target *target)
Definition: armv4_5.c:1281
int arm_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
Definition: armv4_5.c:1286
void arm_set_cpsr(struct arm *arm, uint32_t cpsr)
Configures host-side ARM records to reflect the specified CPSR.
Definition: armv4_5.c:452
int armv4_5_run_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t entry_point, target_addr_t exit_point, unsigned int timeout_ms, void *arch_info)
Definition: armv4_5.c:1587
static int arm_jtag_scann(struct arm_jtag *jtag_info, uint32_t new_scan_chain, enum tap_state end_state)
Definition: arm_jtag.h:43
static int arm_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr, void *no_verify_capture, enum tap_state end_state)
Definition: arm_jtag.h:31
static void arm7flip32(jtag_callback_data_t arg)
Definition: arm_jtag.h:57
Macros used to generate various ARM or Thumb opcodes.
#define ARMV4_5_MRC(cp, op1, rd, crn, crm, op2)
Definition: arm_opcodes.h:186
#define ARMV4_5_MCR(cp, op1, rd, crn, crm, op2)
Definition: arm_opcodes.h:209
#define ARMV4_5_NOP
Definition: arm_opcodes.h:46
int armv4_5_mmu_read_physical(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Definition: armv4_5_mmu.c:104
int armv4_5_mmu_write_physical(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Definition: armv4_5_mmu.c:134
int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, uint32_t *cb, uint32_t *val)
Definition: armv4_5_mmu.c:16
uint32_t flip_u32(uint32_t value, unsigned int num)
Inverts the ordering of bits inside a 32-bit word (e.g.
Definition: binarybuffer.c:165
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
Definition: binarybuffer.h:104
static void buf_set_u32(uint8_t *_buffer, unsigned int first, unsigned int num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
Definition: binarybuffer.h:34
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:251
uint64_t buffer
Pointer to data buffer to send over SPI.
Definition: dw-spi-helper.h:0
uint32_t size
Size of dw_spi_transaction::buffer.
Definition: dw-spi-helper.h:4
uint32_t address
Starting address. Sector aligned.
Definition: dw-spi-helper.h:0
int embeddedice_read_reg(struct reg *reg)
Queue a read for an EmbeddedICE register into the register cache, not checking the value read.
Definition: embeddedice.c:464
@ EICE_DBG_STAT
Definition: embeddedice.h:21
@ EICE_DBG_STATUS_DBGACK
Definition: embeddedice.h:53
void jtag_add_runtest(unsigned int num_cycles, enum tap_state state)
Goes to TAP_IDLE (if we're not already there), cycle precisely num_cycles in the TAP_IDLE state,...
Definition: jtag/core.c:598
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
Definition: jtag/core.c:1050
void jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, enum tap_state state)
Generate a DR SCAN using the fields passed to the function.
Definition: jtag/core.c:457
void jtag_add_callback(jtag_callback1_t f, jtag_callback_data_t data0)
A simpler version of jtag_add_callback4().
@ TAP_DRPAUSE
Definition: jtag.h:44
intptr_t jtag_callback_data_t
Defines the type of data passed to the jtag_callback_t interface.
Definition: jtag.h:336
int debug_level
Definition: log.c:47
void alive_sleep(uint64_t ms)
Definition: log.c:468
void keep_alive(void)
Definition: log.c:427
#define LOG_USER(expr ...)
Definition: log.h:136
#define ERROR_FAIL
Definition: log.h:174
#define LOG_TARGET_ERROR(target, fmt_str,...)
Definition: log.h:162
#define LOG_ERROR(expr ...)
Definition: log.h:133
#define LOG_DEBUG(expr ...)
Definition: log.h:110
#define ERROR_OK
Definition: log.h:168
static const char * str_enabled_disabled(bool value)
uint32_t far_reg
Definition: arm720t.h:23
uint32_t fsr_reg
Definition: arm720t.h:22
unsigned int common_magic
Definition: arm720t.h:17
uint32_t cp15_control_reg
Definition: arm720t.h:21
struct arm7_9_common arm7_9_common
Definition: arm720t.h:19
struct armv4_5_mmu_common armv4_5_mmu
Definition: arm720t.h:20
Structure for items that are common between both ARM7 and ARM9 targets.
Definition: arm7_9_common.h:28
struct arm arm
Definition: arm7_9_common.h:31
struct arm_jtag jtag_info
JTAG information for target.
Definition: arm7_9_common.h:33
struct reg_cache * eice_cache
Embedded ICE register cache.
Definition: arm7_9_common.h:34
int(* post_debug_entry)(struct target *target)
Callback function called after entering debug mode.
void(* pre_restore_context)(struct target *target)
Callback function called before restoring the processor context.
uint32_t intest_instr
Definition: arm_jtag.h:24
struct jtag_tap * tap
Definition: arm_jtag.h:18
Represents a generic ARM core, with standard application registers.
Definition: arm.h:175
enum arm_arch arch
ARM architecture version.
Definition: arm.h:202
int(* mrc)(struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t *value)
Read coprocessor register.
Definition: arm.h:230
struct reg * cpsr
Handle to the CPSR/xPSR; valid in all core modes.
Definition: arm.h:184
struct reg * pc
Handle to the PC; valid in all core modes.
Definition: arm.h:181
int(* mcr)(struct target *target, int cpnum, uint32_t op1, uint32_t op2, uint32_t crn, uint32_t crm, uint32_t value)
Write coprocessor register.
Definition: arm.h:241
int(* write_memory)(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Definition: armv4_5_mmu.h:18
int(* read_memory)(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Definition: armv4_5_mmu.h:17
int(* get_ttb)(struct target *target, uint32_t *result)
Definition: armv4_5_mmu.h:16
int(* enable_mmu_caches)(struct target *target, int mmu, int d_u_cache, int i_cache)
Definition: armv4_5_mmu.h:21
int(* disable_mmu_caches)(struct target *target, int mmu, int d_u_cache, int i_cache)
Definition: armv4_5_mmu.h:20
struct armv4_5_cache_common armv4_5_cache
Definition: armv4_5_mmu.h:22
const struct command_registration * chain
If non-NULL, the commands in chain will be registered in the same context and scope of this registrat...
Definition: command.h:247
Definition: jtag.h:101
struct reg * reg_list
Definition: register.h:147
Definition: register.h:111
bool valid
Definition: register.h:126
uint8_t * value
Definition: register.h:122
bool dirty
Definition: register.h:124
This structure defines a single scan field in the scan.
Definition: jtag.h:87
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
Definition: jtag.h:93
const uint8_t * out_value
A pointer to value to be scanned into the device.
Definition: jtag.h:91
unsigned int num_bits
The number of bits this field specifies.
Definition: jtag.h:89
This holds methods shared between all instances of a given target type.
Definition: target_type.h:26
const char * name
Name of this type of target.
Definition: target_type.h:31
Definition: target.h:119
struct jtag_tap * tap
Definition: target.h:122
enum target_state state
Definition: target.h:160
Definition: psoc6.c:83
int target_call_event_callbacks(struct target *target, enum target_event event)
Definition: target.c:1774
int target_halt(struct target *target)
Definition: target.c:516
#define ERROR_TARGET_NOT_HALTED
Definition: target.h:786
@ TARGET_EVENT_HALTED
Definition: target.h:255
@ TARGET_HALTED
Definition: target.h:58
#define ERROR_TARGET_TIMEOUT
Definition: target.h:785
int64_t timeval_ms(void)
uint64_t target_addr_t
Definition: types.h:335
#define NULL
Definition: usb.h:16
uint8_t count[4]
Definition: vdebug.c:22