OpenOCD
avr32_ap7k.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2010 by Oleksandr Tymoshenko <gonzo@bluezbox.com> *
5  * Based on mips_m4k code: *
6  * Copyright (C) 2008 by Spencer Oliver <spen@spen-soft.co.uk> *
7  * Copyright (C) 2008 by David T.L. Wong *
8  ***************************************************************************/
9 
10 #ifdef HAVE_CONFIG_H
11 #include "config.h"
12 #endif
13 
14 #include "jtag/jtag.h"
15 #include "register.h"
16 #include "algorithm.h"
17 #include "target.h"
18 #include "breakpoints.h"
19 #include "target_type.h"
20 #include "avr32_jtag.h"
21 #include "avr32_mem.h"
22 #include "avr32_regs.h"
23 #include "avr32_ap7k.h"
24 
25 static const char * const avr32_core_reg_list[] = {
26  "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
27  "r9", "r10", "r11", "r12", "sp", "lr", "pc", "sr"
28 };
29 
30 static const struct avr32_core_reg
32  {0, NULL, NULL},
33  {1, NULL, NULL},
34  {2, NULL, NULL},
35  {3, NULL, NULL},
36  {4, NULL, NULL},
37  {5, NULL, NULL},
38  {6, NULL, NULL},
39  {7, NULL, NULL},
40  {8, NULL, NULL},
41  {9, NULL, NULL},
42  {10, NULL, NULL},
43  {11, NULL, NULL},
44  {12, NULL, NULL},
45  {13, NULL, NULL},
46  {14, NULL, NULL},
47  {15, NULL, NULL},
48  {16, NULL, NULL},
49 };
50 
51 
52 static int avr32_read_core_reg(struct target *target, int num);
53 static int avr32_write_core_reg(struct target *target, int num);
54 
56 {
57  int retval, i;
58  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
59 
60  retval = avr32_jtag_read_regs(&ap7k->jtag, ap7k->core_regs);
61  if (retval != ERROR_OK)
62  return retval;
63 
64  for (i = 0; i < AVR32NUMCOREREGS; i++) {
65  if (!ap7k->core_cache->reg_list[i].valid)
67  }
68 
69  return ERROR_OK;
70 }
71 
73 {
74  int i;
75 
76  /* get pointers to arch-specific information */
77  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
78 
79  for (i = 0; i < AVR32NUMCOREREGS; i++) {
80  if (ap7k->core_cache->reg_list[i].dirty)
82  }
83 
84  /* write core regs */
85  avr32_jtag_write_regs(&ap7k->jtag, ap7k->core_regs);
86 
87  return ERROR_OK;
88 }
89 
90 static int avr32_read_core_reg(struct target *target, int num)
91 {
92  uint32_t reg_value;
93 
94  /* get pointers to arch-specific information */
95  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
96 
97  if ((num < 0) || (num >= AVR32NUMCOREREGS))
99 
100  reg_value = ap7k->core_regs[num];
101  buf_set_u32(ap7k->core_cache->reg_list[num].value, 0, 32, reg_value);
102  ap7k->core_cache->reg_list[num].valid = true;
103  ap7k->core_cache->reg_list[num].dirty = false;
104 
105  return ERROR_OK;
106 }
107 
108 static int avr32_write_core_reg(struct target *target, int num)
109 {
110  uint32_t reg_value;
111 
112  /* get pointers to arch-specific information */
113  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
114 
115  if ((num < 0) || (num >= AVR32NUMCOREREGS))
117 
118  reg_value = buf_get_u32(ap7k->core_cache->reg_list[num].value, 0, 32);
119  ap7k->core_regs[num] = reg_value;
120  LOG_DEBUG("write core reg %i value 0x%" PRIx32, num, reg_value);
121  ap7k->core_cache->reg_list[num].valid = true;
122  ap7k->core_cache->reg_list[num].dirty = false;
123 
124  return ERROR_OK;
125 }
126 
127 static int avr32_get_core_reg(struct reg *reg)
128 {
129  struct avr32_core_reg *avr32_reg = reg->arch_info;
130  struct target *target = avr32_reg->target;
131 
132  if (target->state != TARGET_HALTED)
134 
135  return avr32_read_core_reg(target, avr32_reg->num);
136 }
137 
138 static int avr32_set_core_reg(struct reg *reg, uint8_t *buf)
139 {
140  struct avr32_core_reg *avr32_reg = reg->arch_info;
141  struct target *target = avr32_reg->target;
142  uint32_t value = buf_get_u32(buf, 0, 32);
143 
144  if (target->state != TARGET_HALTED)
146 
147  buf_set_u32(reg->value, 0, 32, value);
148  reg->dirty = true;
149  reg->valid = true;
150 
151  return ERROR_OK;
152 }
153 
154 static const struct reg_arch_type avr32_reg_type = {
156  .set = avr32_set_core_reg,
157 };
158 
160 {
162  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
163  struct reg_cache **cache_p = register_get_last_cache_p(&target->reg_cache);
164  struct reg_cache *cache = malloc(sizeof(struct reg_cache));
165  struct reg *reg_list = calloc(num_regs, sizeof(struct reg));
166  struct avr32_core_reg *arch_info =
167  malloc(sizeof(struct avr32_core_reg) * num_regs);
168  int i;
169 
170  /* Build the process context cache */
171  cache->name = "avr32 registers";
172  cache->next = NULL;
173  cache->reg_list = reg_list;
174  cache->num_regs = num_regs;
175  (*cache_p) = cache;
176  ap7k->core_cache = cache;
177 
178  for (i = 0; i < num_regs; i++) {
179  arch_info[i] = avr32_core_reg_list_arch_info[i];
180  arch_info[i].target = target;
181  arch_info[i].avr32_common = ap7k;
182  reg_list[i].name = avr32_core_reg_list[i];
183  reg_list[i].size = 32;
184  reg_list[i].value = calloc(1, 4);
185  reg_list[i].dirty = false;
186  reg_list[i].valid = false;
187  reg_list[i].type = &avr32_reg_type;
188  reg_list[i].arch_info = &arch_info[i];
189  }
190 
191  return cache;
192 }
193 
195 {
196 
197  uint32_t dpc, dinst;
198  int retval;
199  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
200 
201  retval = avr32_jtag_nexus_read(&ap7k->jtag, AVR32_OCDREG_DPC, &dpc);
202  if (retval != ERROR_OK)
203  return retval;
204 
205  retval = avr32_jtag_nexus_read(&ap7k->jtag, AVR32_OCDREG_DINST, &dinst);
206  if (retval != ERROR_OK)
207  return retval;
208 
209  ap7k->jtag.dpc = dpc;
210 
212 
213  return ERROR_OK;
214 }
215 
216 
217 static int avr32_ap7k_poll(struct target *target)
218 {
219  uint32_t ds;
220  int retval;
221  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
222 
223  retval = avr32_jtag_nexus_read(&ap7k->jtag, AVR32_OCDREG_DS, &ds);
224  if (retval != ERROR_OK)
225  return retval;
226 
227  /* check for processor halted */
228  if (ds & OCDREG_DS_DBA) {
229  if ((target->state == TARGET_RUNNING) || (target->state == TARGET_RESET)) {
231 
232  retval = avr32_ap7k_debug_entry(target);
233  if (retval != ERROR_OK)
234  return retval;
235 
237  } else if (target->state == TARGET_DEBUG_RUNNING) {
239 
240  retval = avr32_ap7k_debug_entry(target);
241  if (retval != ERROR_OK)
242  return retval;
243 
245  }
246  } else
248 
249 
250  return ERROR_OK;
251 }
252 
253 static int avr32_ap7k_halt(struct target *target)
254 {
255  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
256 
257  LOG_DEBUG("target->state: %s",
259 
260  if (target->state == TARGET_HALTED) {
261  LOG_DEBUG("target was already halted");
262  return ERROR_OK;
263  }
264 
265  if (target->state == TARGET_UNKNOWN)
266  LOG_WARNING("target was in unknown state when halt was requested");
267 
268  if (target->state == TARGET_RESET) {
270  LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
271  return ERROR_TARGET_FAILURE;
272  } else {
274 
275  return ERROR_OK;
276  }
277  }
278 
279 
282 
283  return ERROR_OK;
284 }
285 
287 {
288  LOG_ERROR("%s: implement me", __func__);
289 
290  return ERROR_OK;
291 }
292 
294 {
295  LOG_ERROR("%s: implement me", __func__);
296 
297  return ERROR_OK;
298 }
299 
300 static int avr32_ap7k_resume(struct target *target, bool current,
301  target_addr_t address, bool handle_breakpoints, bool debug_execution)
302 {
303  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
304  struct breakpoint *breakpoint = NULL;
305  uint32_t resume_pc;
306  int retval;
307 
308  if (target->state != TARGET_HALTED) {
309  LOG_TARGET_ERROR(target, "not halted");
311  }
312 
313  if (!debug_execution) {
315  /*
316  avr32_ap7k_enable_breakpoints(target);
317  avr32_ap7k_enable_watchpoints(target);
318  */
319  }
320 
321  /* current = true: continue on current pc, otherwise continue at <address> */
322  if (!current) {
323 #if 0
324  if (retval != ERROR_OK)
325  return retval;
326 #endif
327  }
328 
329  resume_pc = buf_get_u32(ap7k->core_cache->reg_list[AVR32_REG_PC].value, 0, 32);
331 
332  /* the front-end may request us not to handle breakpoints */
333  if (handle_breakpoints) {
334  /* Single step past breakpoint at current address */
335  breakpoint = breakpoint_find(target, resume_pc);
336  if (breakpoint) {
337  LOG_DEBUG("unset breakpoint at 0x%8.8" TARGET_PRIxADDR, breakpoint->address);
338 #if 0
339  avr32_ap7k_unset_breakpoint(target, breakpoint);
340  avr32_ap7k_single_step_core(target);
341  avr32_ap7k_set_breakpoint(target, breakpoint);
342 #endif
343  }
344  }
345 
346 #if 0
347  /* enable interrupts if we are running */
348  avr32_ap7k_enable_interrupts(target, !debug_execution);
349 
350  /* exit debug mode */
351  mips_ejtag_exit_debug(ejtag_info);
352 #endif
353 
354 
355  retval = avr32_ocd_clearbits(&ap7k->jtag, AVR32_OCDREG_DC,
356  OCDREG_DC_DBR);
357  if (retval != ERROR_OK)
358  return retval;
359 
360  retval = avr32_jtag_exec(&ap7k->jtag, RETD);
361  if (retval != ERROR_OK)
362  return retval;
363 
365 
366  /* registers are now invalid */
368 
369  if (!debug_execution) {
372  LOG_DEBUG("target resumed at 0x%" PRIx32, resume_pc);
373  } else {
376  LOG_DEBUG("target debug resumed at 0x%" PRIx32, resume_pc);
377  }
378 
379  return ERROR_OK;
380 }
381 
382 static int avr32_ap7k_step(struct target *target, bool current,
383  target_addr_t address, bool handle_breakpoints)
384 {
385  LOG_ERROR("%s: implement me", __func__);
386 
387  return ERROR_OK;
388 }
389 
391 {
392  LOG_ERROR("%s: implement me", __func__);
393 
394  return ERROR_OK;
395 }
396 
398  struct breakpoint *breakpoint)
399 {
400  LOG_ERROR("%s: implement me", __func__);
401 
402  return ERROR_OK;
403 }
404 
406 {
407  LOG_ERROR("%s: implement me", __func__);
408 
409  return ERROR_OK;
410 }
411 
413  struct watchpoint *watchpoint)
414 {
415  LOG_ERROR("%s: implement me", __func__);
416 
417  return ERROR_OK;
418 }
419 
421  uint32_t size, uint32_t count, uint8_t *buffer)
422 {
423  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
424 
425  LOG_DEBUG("address: 0x%8.8" TARGET_PRIxADDR ", size: 0x%8.8" PRIx32 ", count: 0x%8.8" PRIx32,
426  address,
427  size,
428  count);
429 
430  if (target->state != TARGET_HALTED) {
431  LOG_TARGET_ERROR(target, "not halted");
433  }
434 
435  /* sanitize arguments */
436  if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
438 
439  if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
441 
442  switch (size) {
443  case 4:
444  return avr32_jtag_read_memory32(&ap7k->jtag, address, count,
445  (uint32_t *)(void *)buffer);
446  break;
447  case 2:
448  return avr32_jtag_read_memory16(&ap7k->jtag, address, count,
449  (uint16_t *)(void *)buffer);
450  break;
451  case 1:
452  return avr32_jtag_read_memory8(&ap7k->jtag, address, count, buffer);
453  default:
454  break;
455  }
456 
457  return ERROR_OK;
458 }
459 
461  uint32_t size, uint32_t count, const uint8_t *buffer)
462 {
463  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
464 
465  LOG_DEBUG("address: 0x%8.8" TARGET_PRIxADDR ", size: 0x%8.8" PRIx32 ", count: 0x%8.8" PRIx32,
466  address,
467  size,
468  count);
469 
470  if (target->state != TARGET_HALTED) {
471  LOG_TARGET_ERROR(target, "not halted");
473  }
474 
475  /* sanitize arguments */
476  if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer))
478 
479  if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u)))
481 
482  switch (size) {
483  case 4:
485  (uint32_t *)(void *)buffer);
486  break;
487  case 2:
489  (uint16_t *)(void *)buffer);
490  break;
491  case 1:
493  default:
494  break;
495  }
496 
497  return ERROR_OK;
498 }
499 
500 static int avr32_ap7k_init_target(struct command_context *cmd_ctx,
501  struct target *target)
502 {
503  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
504 
505  ap7k->jtag.tap = target->tap;
507  return ERROR_OK;
508 }
509 
511 {
512  struct avr32_ap7k_common *ap7k = calloc(1, sizeof(struct
514 
516  target->arch_info = ap7k;
517 
518  return ERROR_OK;
519 }
520 
521 static int avr32_ap7k_examine(struct target *target)
522 {
523  uint32_t devid, ds;
524  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
525 
526  if (!target_was_examined(target)) {
528  LOG_INFO("device id: %08" PRIx32, devid);
531 
532  /* check for processor halted */
533  if (ds & OCDREG_DS_DBA) {
534  LOG_INFO("target is halted");
536  } else
538  }
539 
540  return ERROR_OK;
541 }
542 
544 {
545  struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
546 
547  LOG_USER("target halted due to %s, pc: 0x%8.8" PRIx32,
548  debug_reason_name(target), ap7k->jtag.dpc);
549 
550  return ERROR_OK;
551 }
552 
553 static int avr32_ap7k_get_gdb_reg_list(struct target *target, struct reg **reg_list[],
554  int *reg_list_size, enum target_register_class reg_class)
555 {
556 #if 0
557  /* get pointers to arch-specific information */
558  int i;
559 
560  /* include floating point registers */
561  *reg_list_size = AVR32NUMCOREREGS + AVR32NUMFPREGS;
562  *reg_list = malloc(sizeof(struct reg *) * (*reg_list_size));
563 
564  for (i = 0; i < AVR32NUMCOREREGS; i++)
565  (*reg_list)[i] = &mips32->core_cache->reg_list[i];
566 
567  /* add dummy floating points regs */
568  for (i = AVR32NUMCOREREGS; i < (AVR32NUMCOREREGS + AVR32NUMFPREGS); i++)
569  (*reg_list)[i] = &avr32_ap7k_gdb_dummy_fp_reg;
570 
571 #endif
572 
573  LOG_ERROR("%s: implement me", __func__);
574  return ERROR_FAIL;
575 }
576 
578  .name = "avr32_ap7k",
579 
580  .poll = avr32_ap7k_poll,
581  .arch_state = avr32_ap7k_arch_state,
582 
583  .halt = avr32_ap7k_halt,
584  .resume = avr32_ap7k_resume,
585  .step = avr32_ap7k_step,
586 
587  .assert_reset = avr32_ap7k_assert_reset,
588  .deassert_reset = avr32_ap7k_deassert_reset,
589 
590  .get_gdb_reg_list = avr32_ap7k_get_gdb_reg_list,
591 
592  .read_memory = avr32_ap7k_read_memory,
593  .write_memory = avr32_ap7k_write_memory,
594  /* .checksum_memory = avr32_ap7k_checksum_memory, */
595  /* .blank_check_memory = avr32_ap7k_blank_check_memory, */
596 
597  /* .run_algorithm = avr32_ap7k_run_algorithm, */
598 
599  .add_breakpoint = avr32_ap7k_add_breakpoint,
600  .remove_breakpoint = avr32_ap7k_remove_breakpoint,
601  .add_watchpoint = avr32_ap7k_add_watchpoint,
602  .remove_watchpoint = avr32_ap7k_remove_watchpoint,
603 
604  .target_create = avr32_ap7k_target_create,
605  .init_target = avr32_ap7k_init_target,
606  .examine = avr32_ap7k_examine,
607 };
static int avr32_ap7k_step(struct target *target, bool current, target_addr_t address, bool handle_breakpoints)
Definition: avr32_ap7k.c:382
struct target_type avr32_ap7k_target
Definition: avr32_ap7k.c:577
static int avr32_ap7k_deassert_reset(struct target *target)
Definition: avr32_ap7k.c:293
static int avr32_ap7k_debug_entry(struct target *target)
Definition: avr32_ap7k.c:194
static const struct avr32_core_reg avr32_core_reg_list_arch_info[AVR32NUMCOREREGS]
Definition: avr32_ap7k.c:31
static int avr32_ap7k_examine(struct target *target)
Definition: avr32_ap7k.c:521
static int avr32_ap7k_poll(struct target *target)
Definition: avr32_ap7k.c:217
static int avr32_ap7k_save_context(struct target *target)
Definition: avr32_ap7k.c:55
static int avr32_ap7k_restore_context(struct target *target)
Definition: avr32_ap7k.c:72
static int avr32_ap7k_arch_state(struct target *target)
Definition: avr32_ap7k.c:543
static struct reg_cache * avr32_build_reg_cache(struct target *target)
Definition: avr32_ap7k.c:159
static int avr32_ap7k_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
Definition: avr32_ap7k.c:420
static int avr32_ap7k_assert_reset(struct target *target)
Definition: avr32_ap7k.c:286
static const struct reg_arch_type avr32_reg_type
Definition: avr32_ap7k.c:154
static int avr32_ap7k_halt(struct target *target)
Definition: avr32_ap7k.c:253
static int avr32_read_core_reg(struct target *target, int num)
Definition: avr32_ap7k.c:90
static int avr32_ap7k_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
Definition: avr32_ap7k.c:390
static int avr32_ap7k_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
Definition: avr32_ap7k.c:397
static int avr32_ap7k_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
Definition: avr32_ap7k.c:553
static const char *const avr32_core_reg_list[]
Definition: avr32_ap7k.c:25
static int avr32_ap7k_init_target(struct command_context *cmd_ctx, struct target *target)
Definition: avr32_ap7k.c:500
static int avr32_ap7k_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
Definition: avr32_ap7k.c:405
static int avr32_set_core_reg(struct reg *reg, uint8_t *buf)
Definition: avr32_ap7k.c:138
static int avr32_ap7k_resume(struct target *target, bool current, target_addr_t address, bool handle_breakpoints, bool debug_execution)
Definition: avr32_ap7k.c:300
static int avr32_ap7k_target_create(struct target *target)
Definition: avr32_ap7k.c:510
static int avr32_get_core_reg(struct reg *reg)
Definition: avr32_ap7k.c:127
static int avr32_ap7k_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
Definition: avr32_ap7k.c:412
static int avr32_write_core_reg(struct target *target, int num)
Definition: avr32_ap7k.c:108
static int avr32_ap7k_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Definition: avr32_ap7k.c:460
#define AP7K_COMMON_MAGIC
Definition: avr32_ap7k.h:12
static struct avr32_ap7k_common * target_to_ap7k(struct target *target)
Definition: avr32_ap7k.h:23
int avr32_jtag_exec(struct avr32_jtag *jtag_info, uint32_t inst)
Definition: avr32_jtag.c:310
int avr32_ocd_setbits(struct avr32_jtag *jtag, int reg, uint32_t bits)
Definition: avr32_jtag.c:328
int avr32_ocd_clearbits(struct avr32_jtag *jtag, int reg, uint32_t bits)
Definition: avr32_jtag.c:345
int avr32_jtag_nexus_read(struct avr32_jtag *jtag_info, uint32_t addr, uint32_t *value)
Definition: avr32_jtag.c:160
#define AVR32_OCDREG_DS
Definition: avr32_jtag.h:34
#define RETD
Definition: avr32_jtag.h:66
#define OCDREG_DC_DBE
Definition: avr32_jtag.h:30
#define AVR32_OCDREG_DID
Definition: avr32_jtag.h:26
#define AVR32_OCDREG_DINST
Definition: avr32_jtag.h:48
#define AVR32_OCDREG_DPC
Definition: avr32_jtag.h:49
#define OCDREG_DS_DBA
Definition: avr32_jtag.h:44
#define OCDREG_DC_DBR
Definition: avr32_jtag.h:29
#define AVR32_OCDREG_DC
Definition: avr32_jtag.h:27
#define AVR32NUMCOREREGS
Definition: avr32_jtag.h:10
int avr32_jtag_read_memory32(struct avr32_jtag *jtag_info, uint32_t addr, int count, uint32_t *buffer)
Definition: avr32_mem.c:16
int avr32_jtag_write_memory32(struct avr32_jtag *jtag_info, uint32_t addr, int count, const uint32_t *buffer)
Definition: avr32_mem.c:134
int avr32_jtag_read_memory16(struct avr32_jtag *jtag_info, uint32_t addr, int count, uint16_t *buffer)
Definition: avr32_mem.c:36
int avr32_jtag_write_memory16(struct avr32_jtag *jtag_info, uint32_t addr, int count, const uint16_t *buffer)
Definition: avr32_mem.c:154
int avr32_jtag_read_memory8(struct avr32_jtag *jtag_info, uint32_t addr, int count, uint8_t *buffer)
Definition: avr32_mem.c:88
int avr32_jtag_write_memory8(struct avr32_jtag *jtag_info, uint32_t addr, int count, const uint8_t *buffer)
Definition: avr32_mem.c:226
int avr32_jtag_read_regs(struct avr32_jtag *jtag_info, uint32_t *regs)
Definition: avr32_regs.c:62
int avr32_jtag_write_regs(struct avr32_jtag *jtag_info, uint32_t *regs)
Definition: avr32_regs.c:78
@ AVR32_REG_PC
Definition: avr32_regs.h:26
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
struct breakpoint * breakpoint_find(struct target *target, target_addr_t address)
Definition: breakpoints.c:472
#define ERROR_COMMAND_SYNTAX_ERROR
Definition: command.h:405
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 jtag_get_srst(void)
Definition: jtag/core.c:1755
enum reset_types jtag_get_reset_config(void)
Definition: jtag/core.c:1742
The JTAG interface can be implemented with a software or hardware fifo.
@ RESET_SRST_PULLS_TRST
Definition: jtag.h:220
#define LOG_USER(expr ...)
Definition: log.h:150
#define LOG_WARNING(expr ...)
Definition: log.h:144
#define ERROR_FAIL
Definition: log.h:188
#define LOG_TARGET_ERROR(target, fmt_str,...)
Definition: log.h:176
#define LOG_ERROR(expr ...)
Definition: log.h:147
#define LOG_INFO(expr ...)
Definition: log.h:141
#define LOG_DEBUG(expr ...)
Definition: log.h:124
#define ERROR_OK
Definition: log.h:182
int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info)
Definition: mips_ejtag.c:258
struct reg_cache ** register_get_last_cache_p(struct reg_cache **first)
Definition: register.c:72
void register_cache_invalidate(struct reg_cache *cache)
Marks the contents of the register cache as invalid (and clean).
Definition: register.c:94
struct target * target
Definition: rtt/rtt.c:26
struct reg_cache * core_cache
Definition: avr32_ap7k.h:18
uint32_t core_regs[AVR32NUMCOREREGS]
Definition: avr32_ap7k.h:19
unsigned int common_magic
Definition: avr32_ap7k.h:15
struct avr32_jtag jtag
Definition: avr32_ap7k.h:17
struct avr32_ap7k_common * avr32_common
Definition: avr32_ap7k.h:31
struct target * target
Definition: avr32_ap7k.h:30
uint32_t num
Definition: avr32_ap7k.h:29
uint32_t dpc
Definition: avr32_jtag.h:74
struct jtag_tap * tap
Definition: avr32_jtag.h:73
target_addr_t address
Definition: breakpoints.h:27
int(* get)(struct reg *reg)
Definition: register.h:152
const char * name
Definition: register.h:145
unsigned int num_regs
Definition: register.h:148
struct reg * reg_list
Definition: register.h:147
struct reg_cache * next
Definition: register.h:146
Definition: register.h:111
bool valid
Definition: register.h:126
uint32_t size
Definition: register.h:132
uint8_t * value
Definition: register.h:122
void * arch_info
Definition: register.h:140
bool dirty
Definition: register.h:124
const struct reg_arch_type * type
Definition: register.h:141
const char * name
Definition: register.h:113
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_debug_reason debug_reason
Definition: target.h:164
enum target_state state
Definition: target.h:167
struct reg_cache * reg_cache
Definition: target.h:168
void * arch_info
Definition: target.h:174
int target_call_event_callbacks(struct target *target, enum target_event event)
Definition: target.c:1794
void target_free_all_working_areas(struct target *target)
Definition: target.c:2180
const char * target_state_name(const struct target *t)
Return the name of this targets current state.
Definition: target.c:270
const char * debug_reason_name(const struct target *t)
Definition: target.c:257
@ DBG_REASON_NOTHALTED
Definition: target.h:77
@ DBG_REASON_DBGRQ
Definition: target.h:72
target_register_class
Definition: target.h:113
#define ERROR_TARGET_NOT_HALTED
Definition: target.h:817
static bool target_was_examined(const struct target *target)
Definition: target.h:443
#define ERROR_TARGET_UNALIGNED_ACCESS
Definition: target.h:819
@ TARGET_EVENT_DEBUG_RESUMED
Definition: target.h:285
@ TARGET_EVENT_HALTED
Definition: target.h:265
@ TARGET_EVENT_RESUMED
Definition: target.h:266
@ TARGET_EVENT_DEBUG_HALTED
Definition: target.h:284
@ TARGET_RESET
Definition: target.h:59
@ TARGET_DEBUG_RUNNING
Definition: target.h:60
@ TARGET_UNKNOWN
Definition: target.h:56
@ TARGET_HALTED
Definition: target.h:58
@ TARGET_RUNNING
Definition: target.h:57
#define ERROR_TARGET_FAILURE
Definition: target.h:818
uint64_t target_addr_t
Definition: types.h:279
#define TARGET_PRIxADDR
Definition: types.h:284
#define NULL
Definition: usb.h:16
uint8_t count[4]
Definition: vdebug.c:22