OpenOCD
arm_dap.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2016 by Matthias Welwarsky *
5  * *
6  ***************************************************************************/
7 
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11 
12 #include <stdlib.h>
13 #include <stdint.h>
14 #include "target/arm_adi_v5.h"
15 #include "target/arm.h"
16 #include "helper/list.h"
17 #include "helper/command.h"
18 #include "transport/transport.h"
19 #include "jtag/interface.h"
20 
21 static OOCD_LIST_HEAD(all_dap);
22 
23 extern struct adapter_driver *adapter_driver;
24 
25 /* DAP command support */
27  struct list_head lh;
28  struct adiv5_dap dap;
29  char *name;
30  const struct swd_driver *swd;
31 };
32 
33 static void dap_instance_init(struct adiv5_dap *dap)
34 {
35  int i;
36  /* Set up with safe defaults */
37  for (i = 0; i <= DP_APSEL_MAX; i++) {
38  dap->ap[i].dap = dap;
39  dap->ap[i].ap_num = DP_APSEL_INVALID;
40  /* memaccess_tck max is 255 */
41  dap->ap[i].memaccess_tck = 255;
42  /* Number of bits for tar autoincrement, impl. dep. at least 10 */
43  dap->ap[i].tar_autoincr_block = (1<<10);
44  /* default CSW value */
45  dap->ap[i].csw_default = CSW_AHB_DEFAULT;
46  dap->ap[i].cfg_reg = MEM_AP_REG_CFG_INVALID; /* mem_ap configuration reg (large physical addr, etc.) */
47  dap->ap[i].refcount = 0;
48  dap->ap[i].config_ap_never_release = false;
49  }
51  INIT_LIST_HEAD(&dap->cmd_pool);
52 }
53 
54 const char *adiv5_dap_name(struct adiv5_dap *self)
55 {
56  struct arm_dap_object *obj = container_of(self, struct arm_dap_object, dap);
57  return obj->name;
58 }
59 
60 const struct swd_driver *adiv5_dap_swd_driver(struct adiv5_dap *self)
61 {
62  struct arm_dap_object *obj = container_of(self, struct arm_dap_object, dap);
63  return obj->swd;
64 }
65 
67 {
68  return &obj->dap;
69 }
70 struct adiv5_dap *dap_instance_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
71 {
72  struct arm_dap_object *obj = NULL;
73  const char *name;
74  bool found = false;
75 
76  name = Jim_GetString(o, NULL);
77 
78  list_for_each_entry(obj, &all_dap, lh) {
79  if (!strcmp(name, obj->name)) {
80  found = true;
81  break;
82  }
83  }
84 
85  if (found)
86  return &obj->dap;
87  return NULL;
88 }
89 
90 static int dap_init_all(void)
91 {
92  struct arm_dap_object *obj;
93  int retval;
94  bool pre_connect = true;
95 
96  LOG_DEBUG("Initializing all DAPs ...");
97 
98  list_for_each_entry(obj, &all_dap, lh) {
99  struct adiv5_dap *dap = &obj->dap;
100 
101  /* with hla, dap is just a dummy */
102  if (transport_is_hla())
103  continue;
104 
105  /* skip taps that are disabled */
106  if (!dap->tap->enabled)
107  continue;
108 
109  if (transport_is_swd()) {
110  dap->ops = &swd_dap_ops;
111  obj->swd = adapter_driver->swd_ops;
112  } else if (transport_is_dapdirect_swd()) {
114  } else if (transport_is_dapdirect_jtag()) {
116  } else
117  dap->ops = &jtag_dp_ops;
118 
119  if (dap->adi_version == 0) {
120  LOG_DEBUG("DAP %s configured by default to use ADIv5 protocol", jtag_tap_name(dap->tap));
121  dap->adi_version = 5;
122  } else {
123  LOG_DEBUG("DAP %s configured to use %s protocol by user cfg file", jtag_tap_name(dap->tap),
124  is_adiv6(dap) ? "ADIv6" : "ADIv5");
125  }
126 
127  if (pre_connect && dap->ops->pre_connect_init) {
128  retval = dap->ops->pre_connect_init(dap);
129  if (retval != ERROR_OK)
130  return retval;
131 
132  pre_connect = false;
133  }
134 
135  retval = dap->ops->connect(dap);
136  if (retval != ERROR_OK)
137  return retval;
138 
139  /* see if address size of ROM Table is greater than 32-bits */
140  if (is_adiv6(dap)) {
141  uint32_t dpidr1;
142 
143  retval = dap->ops->queue_dp_read(dap, DP_DPIDR1, &dpidr1);
144  if (retval != ERROR_OK) {
145  LOG_ERROR("DAP read of DPIDR1 failed...");
146  return retval;
147  }
148  retval = dap_run(dap);
149  if (retval != ERROR_OK) {
150  LOG_ERROR("DAP read of DPIDR1 failed...");
151  return retval;
152  }
153  dap->asize = dpidr1 & DP_DPIDR1_ASIZE_MASK;
154  }
155  }
156 
157  return ERROR_OK;
158 }
159 
161 {
162  struct arm_dap_object *obj, *tmp;
163  struct adiv5_dap *dap;
164 
165  list_for_each_entry_safe(obj, tmp, &all_dap, lh) {
166  dap = &obj->dap;
167  for (unsigned int i = 0; i <= DP_APSEL_MAX; i++) {
168  if (dap->ap[i].refcount != 0)
169  LOG_ERROR("BUG: refcount AP#%u still %u at exit", i, dap->ap[i].refcount);
170  }
171  if (dap->ops && dap->ops->quit)
172  dap->ops->quit(dap);
173 
174  free(obj->name);
175  free(obj);
176  }
177 
178  return ERROR_OK;
179 }
180 
188 };
189 
190 static const struct jim_nvp nvp_config_opts[] = {
191  { .name = "-chain-position", .value = CFG_CHAIN_POSITION },
192  { .name = "-ignore-syspwrupack", .value = CFG_IGNORE_SYSPWRUPACK },
193  { .name = "-dp-id", .value = CFG_DP_ID },
194  { .name = "-instance-id", .value = CFG_INSTANCE_ID },
195  { .name = "-adiv6", .value = CFG_ADIV6 },
196  { .name = "-adiv5", .value = CFG_ADIV5 },
197  { .name = NULL, .value = -1 }
198 };
199 
200 static int dap_configure(struct jim_getopt_info *goi, struct arm_dap_object *dap)
201 {
202  struct jim_nvp *n;
203  int e;
204 
205  /* parse config ... */
206  while (goi->argc > 0) {
207  Jim_SetEmptyResult(goi->interp);
208 
209  e = jim_getopt_nvp(goi, nvp_config_opts, &n);
210  if (e != JIM_OK) {
212  return e;
213  }
214  switch (n->value) {
215  case CFG_CHAIN_POSITION: {
216  Jim_Obj *o_t;
217  e = jim_getopt_obj(goi, &o_t);
218  if (e != JIM_OK)
219  return e;
220 
221  struct jtag_tap *tap;
222  tap = jtag_tap_by_jim_obj(goi->interp, o_t);
223  if (!tap) {
224  Jim_SetResultString(goi->interp, "-chain-position is invalid", -1);
225  return JIM_ERR;
226  }
227  dap->dap.tap = tap;
228  /* loop for more */
229  break;
230  }
232  dap->dap.ignore_syspwrupack = true;
233  break;
234  case CFG_DP_ID: {
235  jim_wide w;
236  e = jim_getopt_wide(goi, &w);
237  if (e != JIM_OK) {
238  Jim_SetResultFormatted(goi->interp,
239  "create %s: bad parameter %s",
240  dap->name, n->name);
241  return JIM_ERR;
242  }
243  if (w < 0 || w > DP_TARGETSEL_DPID_MASK) {
244  Jim_SetResultFormatted(goi->interp,
245  "create %s: %s out of range",
246  dap->name, n->name);
247  return JIM_ERR;
248  }
249  dap->dap.multidrop_targetsel =
251  | (w & DP_TARGETSEL_DPID_MASK);
252  dap->dap.multidrop_dp_id_valid = true;
253  break;
254  }
255  case CFG_INSTANCE_ID: {
256  jim_wide w;
257  e = jim_getopt_wide(goi, &w);
258  if (e != JIM_OK) {
259  Jim_SetResultFormatted(goi->interp,
260  "create %s: bad parameter %s",
261  dap->name, n->name);
262  return JIM_ERR;
263  }
264  if (w < 0 || w > 15) {
265  Jim_SetResultFormatted(goi->interp,
266  "create %s: %s out of range",
267  dap->name, n->name);
268  return JIM_ERR;
269  }
270  dap->dap.multidrop_targetsel =
273  dap->dap.multidrop_instance_id_valid = true;
274  break;
275  }
276  case CFG_ADIV6:
277  dap->dap.adi_version = 6;
278  break;
279  case CFG_ADIV5:
280  dap->dap.adi_version = 5;
281  break;
282  default:
283  break;
284  }
285  }
286 
287  return JIM_OK;
288 }
289 
290 static int dap_check_config(struct adiv5_dap *dap)
291 {
293  return ERROR_OK;
294 
295  struct arm_dap_object *obj;
296  bool new_multidrop = dap_is_multidrop(dap);
297  bool had_multidrop = new_multidrop;
298  uint32_t targetsel = dap->multidrop_targetsel;
299  unsigned int non_multidrop_count = had_multidrop ? 0 : 1;
300 
301  list_for_each_entry(obj, &all_dap, lh) {
302  struct adiv5_dap *dap_it = &obj->dap;
303 
304  if (transport_is_swd()) {
305  if (dap_is_multidrop(dap_it)) {
306  had_multidrop = true;
307  if (new_multidrop && dap_it->multidrop_targetsel == targetsel) {
308  uint32_t dp_id = targetsel & DP_TARGETSEL_DPID_MASK;
309  uint32_t instance_id = targetsel >> DP_TARGETSEL_INSTANCEID_SHIFT;
310  LOG_ERROR("%s and %s have the same multidrop selectors -dp-id 0x%08"
311  PRIx32 " and -instance-id 0x%" PRIx32,
312  obj->name, adiv5_dap_name(dap),
313  dp_id, instance_id);
314  return ERROR_FAIL;
315  }
316  } else {
317  non_multidrop_count++;
318  }
319  } else if (transport_is_dapdirect_swd()) {
320  non_multidrop_count++;
321  }
322  }
323 
324  if (non_multidrop_count > 1) {
325  LOG_ERROR("Two or more SWD non multidrop DAPs are not supported");
326  return ERROR_FAIL;
327  }
328  if (had_multidrop && non_multidrop_count) {
329  LOG_ERROR("Mixing of SWD multidrop DAPs and non multidrop DAPs is not supported");
330  return ERROR_FAIL;
331  }
332 
333  return ERROR_OK;
334 }
335 
336 COMMAND_HANDLER(handle_dap_create)
337 {
338  if (CMD_ARGC < 3)
340 
341  int retval = ERROR_COMMAND_ARGUMENT_INVALID;
342 
343  /* check if the dap name clashes with an existing command name */
344  Jim_Cmd *jimcmd = Jim_GetCommand(CMD_CTX->interp, CMD_JIMTCL_ARGV[0], JIM_NONE);
345  if (jimcmd) {
346  command_print(CMD, "Command/dap: %s Exists", CMD_ARGV[0]);
347  return ERROR_FAIL;
348  }
349 
350  /* Create it */
351  struct arm_dap_object *dap = calloc(1, sizeof(struct arm_dap_object));
352  if (!dap) {
353  LOG_ERROR("Out of memory");
354  return ERROR_FAIL;
355  }
356 
357  dap_instance_init(&dap->dap);
358 
359  dap->name = strdup(CMD_ARGV[0]);
360  if (!dap->name) {
361  LOG_ERROR("Out of memory");
362  free(dap);
363  return ERROR_FAIL;
364  }
365 
366  struct jim_getopt_info goi;
367  jim_getopt_setup(&goi, CMD_CTX->interp, CMD_ARGC - 1, CMD_JIMTCL_ARGV + 1);
368  int e = dap_configure(&goi, dap);
369  if (e != JIM_OK) {
370  int reslen;
371  const char *result = Jim_GetString(Jim_GetResult(CMD_CTX->interp), &reslen);
372  if (reslen > 0)
373  command_print(CMD, "%s", result);
374  goto err;
375  }
376 
377  if (!dap->dap.tap) {
378  command_print(CMD, "-chain-position required when creating DAP");
379  goto err;
380  }
381 
382  retval = dap_check_config(&dap->dap);
383  if (retval != ERROR_OK)
384  goto err;
385 
386  struct command_registration dap_create_commands[] = {
387  {
388  .name = CMD_ARGV[0],
389  .mode = COMMAND_ANY,
390  .help = "dap instance command group",
391  .usage = "",
392  .chain = dap_instance_commands,
393  },
395  };
396 
397  /* don't expose the instance commands when using hla */
398  if (transport_is_hla())
399  dap_create_commands[0].chain = NULL;
400 
401  retval = register_commands_with_data(CMD_CTX, NULL, dap_create_commands, dap);
402  if (retval != ERROR_OK)
403  goto err;
404 
405  list_add_tail(&dap->lh, &all_dap);
406 
407  return ERROR_OK;
408 
409 err:
410  free(dap->name);
411  free(dap);
412  return retval;
413 }
414 
415 COMMAND_HANDLER(handle_dap_names)
416 {
417  if (CMD_ARGC != 0)
419 
420  struct arm_dap_object *obj;
421  list_for_each_entry(obj, &all_dap, lh)
422  command_print(CMD, "%s", obj->name);
423 
424  return ERROR_OK;
425 }
426 
427 COMMAND_HANDLER(handle_dap_init)
428 {
429  return dap_init_all();
430 }
431 
432 COMMAND_HANDLER(handle_dap_info_command)
433 {
435  struct arm *arm = target_to_arm(target);
436  struct adiv5_dap *dap = arm->dap;
437  uint64_t apsel;
438 
439  if (!dap) {
440  LOG_ERROR("DAP instance not available. Probably a HLA target...");
442  }
443 
444  switch (CMD_ARGC) {
445  case 0:
446  apsel = dap->apsel;
447  break;
448  case 1:
449  if (!strcmp(CMD_ARGV[0], "root")) {
450  if (!is_adiv6(dap)) {
451  command_print(CMD, "Option \"root\" not allowed with ADIv5 DAP");
453  }
454  int retval = adiv6_dap_read_baseptr(CMD, dap, &apsel);
455  if (retval != ERROR_OK) {
456  command_print(CMD, "Failed reading DAP baseptr");
457  return retval;
458  }
459  break;
460  }
462  if (!is_ap_num_valid(dap, apsel))
464  break;
465  default:
467  }
468 
469  struct adiv5_ap *ap = dap_get_ap(dap, apsel);
470  if (!ap) {
471  command_print(CMD, "Cannot get AP");
472  return ERROR_FAIL;
473  }
474  int retval = dap_info_command(CMD, ap);
475  dap_put_ap(ap);
476  return retval;
477 }
478 
479 static const struct command_registration dap_subcommand_handlers[] = {
480  {
481  .name = "create",
482  .mode = COMMAND_ANY,
483  .handler = handle_dap_create,
484  .usage = "name '-chain-position' name",
485  .help = "Creates a new DAP instance",
486  },
487  {
488  .name = "names",
489  .mode = COMMAND_ANY,
490  .handler = handle_dap_names,
491  .usage = "",
492  .help = "Lists all registered DAP instances by name",
493  },
494  {
495  .name = "init",
496  .mode = COMMAND_ANY,
497  .handler = handle_dap_init,
498  .usage = "",
499  .help = "Initialize all registered DAP instances"
500  },
501  {
502  .name = "info",
503  .handler = handle_dap_info_command,
504  .mode = COMMAND_EXEC,
505  .help = "display ROM table for specified MEM-AP (default MEM-AP of current target) "
506  "or the ADIv6 root ROM table of current target's DAP",
507  .usage = "[ap_num | 'root']",
508  },
510 };
511 
512 static const struct command_registration dap_commands[] = {
513  {
514  .name = "dap",
515  .mode = COMMAND_CONFIG,
516  .help = "DAP commands",
517  .chain = dap_subcommand_handlers,
518  .usage = "",
519  },
521 };
522 
524 {
525  return register_commands(cmd_ctx, NULL, dap_commands);
526 }
bool transport_is_dapdirect_swd(void)
Returns true if the current debug session is using SWD as its transport.
bool transport_is_dapdirect_jtag(void)
Returns true if the current debug session is using JTAG as its transport.
const struct dap_ops jtag_dp_ops
Definition: adi_v5_jtag.c:898
const struct dap_ops swd_dap_ops
Definition: adi_v5_swd.c:674
bool transport_is_swd(void)
Returns true if the current debug session is using SWD as its transport.
Definition: adi_v5_swd.c:773
Holds the interface to ARM cores.
static struct arm * target_to_arm(const struct target *target)
Convert target handle to generic ARM target state handle.
Definition: arm.h:261
int dap_info_command(struct command_invocation *cmd, struct adiv5_ap *ap)
Definition: arm_adi_v5.c:2233
bool is_ap_num_valid(struct adiv5_dap *dap, uint64_t ap_num)
Definition: arm_adi_v5.c:1078
int adiv6_dap_read_baseptr(struct command_invocation *cmd, struct adiv5_dap *dap, uint64_t *baseptr)
Definition: arm_adi_v5.c:1266
struct adiv5_ap * dap_get_ap(struct adiv5_dap *dap, uint64_t ap_num)
Definition: arm_adi_v5.c:1189
int dap_put_ap(struct adiv5_ap *ap)
Definition: arm_adi_v5.c:1209
const struct command_registration dap_instance_commands[]
Definition: arm_adi_v5.c:2905
This defines formats and data structures used to talk to ADIv5 entities.
#define CSW_AHB_DEFAULT
Definition: arm_adi_v5.h:193
#define DP_DPIDR1_ASIZE_MASK
Definition: arm_adi_v5.h:75
#define DP_DPIDR1
Definition: arm_adi_v5.h:47
#define DP_APSEL_INVALID
Definition: arm_adi_v5.h:110
#define DP_TARGETSEL_INSTANCEID_MASK
Definition: arm_adi_v5.h:114
#define DP_APSEL_MAX
Definition: arm_adi_v5.h:109
#define DP_TARGETSEL_INSTANCEID_SHIFT
Definition: arm_adi_v5.h:115
static bool is_adiv6(const struct adiv5_dap *dap)
Check if DAP is ADIv6.
Definition: arm_adi_v5.h:523
static int dap_run(struct adiv5_dap *dap)
Perform all queued DAP operations, and clear any errors posted in the CTRL_STAT register when they ar...
Definition: arm_adi_v5.h:648
static bool dap_is_multidrop(struct adiv5_dap *dap)
Check if SWD multidrop configuration is valid.
Definition: arm_adi_v5.h:756
#define DP_TARGETSEL_DPID_MASK
Definition: arm_adi_v5.h:113
#define MEM_AP_REG_CFG_INVALID
Definition: arm_adi_v5.h:209
static int dap_init_all(void)
Definition: arm_dap.c:90
int dap_cleanup_all(void)
Definition: arm_dap.c:160
static const struct jim_nvp nvp_config_opts[]
Definition: arm_dap.c:190
static const struct command_registration dap_subcommand_handlers[]
Definition: arm_dap.c:479
struct adiv5_dap * dap_instance_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
Definition: arm_dap.c:70
static int dap_configure(struct jim_getopt_info *goi, struct arm_dap_object *dap)
Definition: arm_dap.c:200
static const struct command_registration dap_commands[]
Definition: arm_dap.c:512
static OOCD_LIST_HEAD(all_dap)
const struct swd_driver * adiv5_dap_swd_driver(struct adiv5_dap *self)
Definition: arm_dap.c:60
static void dap_instance_init(struct adiv5_dap *dap)
Definition: arm_dap.c:33
int dap_register_commands(struct command_context *cmd_ctx)
Definition: arm_dap.c:523
dap_cfg_param
Definition: arm_dap.c:181
@ CFG_IGNORE_SYSPWRUPACK
Definition: arm_dap.c:183
@ CFG_INSTANCE_ID
Definition: arm_dap.c:185
@ CFG_CHAIN_POSITION
Definition: arm_dap.c:182
@ CFG_DP_ID
Definition: arm_dap.c:184
@ CFG_ADIV6
Definition: arm_dap.c:186
@ CFG_ADIV5
Definition: arm_dap.c:187
struct adiv5_dap * adiv5_get_dap(struct arm_dap_object *obj)
Definition: arm_dap.c:66
COMMAND_HANDLER(handle_dap_create)
Definition: arm_dap.c:336
static int dap_check_config(struct adiv5_dap *dap)
Definition: arm_dap.c:290
const char * adiv5_dap_name(struct adiv5_dap *self)
Definition: arm_dap.c:54
struct adapter_driver * adapter_driver
Definition: adapter.c:27
const char * name
Definition: armv4_5.c:76
void command_print(struct command_invocation *cmd, const char *format,...)
Definition: command.c:375
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
Definition: command.h:141
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
Definition: command.h:156
static int register_commands_with_data(struct command_context *cmd_ctx, const char *cmd_prefix, const struct command_registration *cmds, void *data)
Register one or more commands, as register_commands(), plus specify a pointer to command private data...
Definition: command.h:313
#define ERROR_COMMAND_SYNTAX_ERROR
Definition: command.h:400
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
Definition: command.h:151
#define CMD_JIMTCL_ARGV
Use this macro to access the jimtcl arguments for the command being handled, rather than accessing th...
Definition: command.h:161
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
Definition: command.h:440
#define CMD_CTX
Use this macro to access the context of the command being handled, rather than accessing the variable...
Definition: command.h:146
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:251
#define ERROR_COMMAND_ARGUMENT_INVALID
Definition: command.h:402
static int register_commands(struct command_context *cmd_ctx, const char *cmd_prefix, const struct command_registration *cmds)
Register one or more commands in the specified context, as children of parent (or top-level commends,...
Definition: command.h:272
@ COMMAND_CONFIG
Definition: command.h:41
@ COMMAND_ANY
Definition: command.h:42
@ COMMAND_EXEC
Definition: command.h:40
bool transport_is_hla(void)
int jim_getopt_wide(struct jim_getopt_info *goi, jim_wide *puthere)
Remove argv[0] as wide.
Definition: jim-nvp.c:222
int jim_getopt_setup(struct jim_getopt_info *p, Jim_Interp *interp, int argc, Jim_Obj *const *argv)
GetOpt - how to.
Definition: jim-nvp.c:149
int jim_getopt_nvp(struct jim_getopt_info *goi, const struct jim_nvp *nvp, struct jim_nvp **puthere)
Remove argv[0] as NVP.
Definition: jim-nvp.c:237
void jim_getopt_nvp_unknown(struct jim_getopt_info *goi, const struct jim_nvp *nvptable, int hadprefix)
Create an appropriate error message for an NVP.
Definition: jim-nvp.c:253
int jim_getopt_obj(struct jim_getopt_info *goi, Jim_Obj **puthere)
Remove argv[0] from the list.
Definition: jim-nvp.c:169
bool transport_is_jtag(void)
Returns true if the current debug session is using JTAG as its transport.
Definition: jtag/core.c:1840
const char * jtag_tap_name(const struct jtag_tap *tap)
Definition: jtag/core.c:282
struct jtag_tap * jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *obj)
Definition: jtag/tcl.c:53
static void list_add_tail(struct list_head *new, struct list_head *head)
Definition: list.h:203
#define list_for_each_entry_safe(p, n, h, field)
Definition: list.h:159
#define list_for_each_entry(p, h, field)
Definition: list.h:155
static void INIT_LIST_HEAD(struct list_head *list)
Definition: list.h:54
#define ERROR_FAIL
Definition: log.h:174
#define LOG_ERROR(expr ...)
Definition: log.h:133
#define LOG_DEBUG(expr ...)
Definition: log.h:110
#define ERROR_OK
Definition: log.h:168
static uint32_t lh(unsigned int rd, unsigned int base, uint16_t offset) __attribute__((unused))
Definition: opcodes.h:117
Represents a driver for a debugging interface.
Definition: interface.h:208
const struct swd_driver * swd_ops
Low-level SWD APIs.
Definition: interface.h:354
const struct dap_ops * dap_swd_ops
Definition: interface.h:360
const struct dap_ops * dap_jtag_ops
Definition: interface.h:357
This represents an ARM Debug Interface (v5) Access Port (AP).
Definition: arm_adi_v5.h:250
bool config_ap_never_release
Definition: arm_adi_v5.h:328
uint32_t tar_autoincr_block
Definition: arm_adi_v5.h:309
unsigned int refcount
Definition: arm_adi_v5.h:325
uint64_t ap_num
ADIv5: Number of this AP (0~255) ADIv6: Base address of this AP (4k aligned) TODO: to be more coheren...
Definition: arm_adi_v5.h:261
struct adiv5_dap * dap
DAP this AP belongs to.
Definition: arm_adi_v5.h:254
uint32_t memaccess_tck
Configures how many extra tck clocks are added after starting a MEM-AP access before we try to read i...
Definition: arm_adi_v5.h:306
uint32_t cfg_reg
Definition: arm_adi_v5.h:322
uint32_t csw_default
Default value for (MEM-AP) AP_REG_CSW register.
Definition: arm_adi_v5.h:266
This represents an ARM Debug Interface (v5) Debug Access Port (DAP).
Definition: arm_adi_v5.h:348
unsigned int adi_version
Indicates ADI version (5, 6 or 0 for unknown) being used.
Definition: arm_adi_v5.h:433
struct list_head cmd_journal
Definition: arm_adi_v5.h:352
struct adiv5_ap ap[DP_APSEL_MAX+1]
Definition: arm_adi_v5.h:364
bool multidrop_instance_id_valid
TINSTANCE field of multidrop_targetsel has been configured.
Definition: arm_adi_v5.h:425
const struct dap_ops * ops
Definition: arm_adi_v5.h:349
uint64_t apsel
Definition: arm_adi_v5.h:367
struct jtag_tap * tap
Definition: arm_adi_v5.h:360
uint32_t multidrop_targetsel
Value to select DP in SWD multidrop mode or DP_TARGETSEL_INVALID.
Definition: arm_adi_v5.h:421
bool multidrop_dp_id_valid
TPARTNO and TDESIGNER fields of multidrop_targetsel have been configured.
Definition: arm_adi_v5.h:423
struct list_head cmd_pool
Definition: arm_adi_v5.h:355
unsigned int asize
Definition: arm_adi_v5.h:436
bool ignore_syspwrupack
Flag saying whether to ignore the syspwrupack flag in DAP.
Definition: arm_adi_v5.h:418
const struct swd_driver * swd
Definition: arm_dap.c:30
struct adiv5_dap dap
Definition: arm_dap.c:28
struct list_head lh
Definition: arm_dap.c:27
char * name
Definition: arm_dap.c:29
Represents a generic ARM core, with standard application registers.
Definition: arm.h:175
struct adiv5_dap * dap
For targets conforming to ARM Debug Interface v5, this handle references the Debug Access Port (DAP) ...
Definition: arm.h:257
const char * name
Definition: command.h:234
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
const char * usage
a string listing the options and arguments, required or optional
Definition: command.h:239
int(* connect)(struct adiv5_dap *dap)
connect operation for SWD
Definition: arm_adi_v5.h:451
int(* queue_dp_read)(struct adiv5_dap *dap, unsigned int reg, uint32_t *data)
DP register read.
Definition: arm_adi_v5.h:457
void(* quit)(struct adiv5_dap *dap)
Optional; called at OpenOCD exit.
Definition: arm_adi_v5.h:481
int(* pre_connect_init)(struct adiv5_dap *dap)
Optional; called once on the first enabled dap before connecting.
Definition: arm_adi_v5.h:448
A TCL -ish GetOpt like code.
Definition: jim-nvp.h:136
Jim_Interp * interp
Definition: jim-nvp.h:137
Name Value Pairs, aka: NVP.
Definition: jim-nvp.h:60
const char * name
Definition: jim-nvp.h:61
int value
Definition: jim-nvp.h:62
Definition: jtag.h:101
bool enabled
Is this TAP currently enabled?
Definition: jtag.h:109
Definition: list.h:41
Definition: target.h:116
struct target * get_current_target(struct command_context *cmd_ctx)
Definition: target.c:466
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE
Definition: target.h:787
#define container_of(ptr, type, member)
Cast a member of a structure out to the containing structure.
Definition: types.h:68
#define NULL
Definition: usb.h:16