1
2
3
10
11
12
13
14
15
16
17
18
19
20
25
26
27
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
407
414
415
416
417
418
419
420
421
422
423
425
427
429
430
431
432
435
436
442
443
446
447
453
454
460
461
465
466
467
468
469
470
471
472
473
474
475
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
525
526
531
532
533
537
541
545
546
547
548
549
553
554
555
556
557
558
562
563
564
565
566
567
568
569
576
577
582
583
588
589
593
594
598
599
600
601
602
603
604
/* ... */
#ifndef OPENOCD_TARGET_XTENSA_DEBUG_MODULE_H
#define OPENOCD_TARGET_XTENSA_DEBUG_MODULE_H
#include <jtag/jtag.h>
#include <target/arm_adi_v5.h>
#include <helper/bits.h>
#include <target/target.h>
enum xtensa_dm_pwr_reg {
XDMREG_PWRCTL = 0x00,
XDMREG_PWRSTAT,
XDMREG_PWRNUM
...};
struct xtensa_dm_pwr_reg_offsets {
uint16_t apb;
...};
#define XTENSA_DM_PWR_REG_OFFSETS { \
\
{ .apb = 0x3020 }, \
{ .apb = 0x3024 }, \
...}...
/* ... */
#define PWRCTL_JTAGDEBUGUSE(x) (((x)->dbg_mod.dap) ? (0) : BIT(7))
#define PWRCTL_DEBUGRESET(x) (((x)->dbg_mod.dap) ? BIT(28) : BIT(6))
#define PWRCTL_CORERESET(x) (((x)->dbg_mod.dap) ? BIT(16) : BIT(4))
#define PWRCTL_DEBUGWAKEUP(x) (((x)->dbg_mod.dap) ? BIT(12) : BIT(2))
#define PWRCTL_MEMWAKEUP(x) (((x)->dbg_mod.dap) ? BIT(8) : BIT(1))
#define PWRCTL_COREWAKEUP(x) (((x)->dbg_mod.dap) ? BIT(0) : BIT(0))
#define PWRSTAT_DEBUGWASRESET_DM(d) (((d)->dap) ? BIT(28) : BIT(6))
#define PWRSTAT_COREWASRESET_DM(d) (((d)->dap) ? BIT(16) : BIT(4))
#define PWRSTAT_DEBUGWASRESET(x) (PWRSTAT_DEBUGWASRESET_DM(&((x)->dbg_mod)))
#define PWRSTAT_COREWASRESET(x) (PWRSTAT_COREWASRESET_DM(&((x)->dbg_mod)))
#define PWRSTAT_CORESTILLNEEDED(x) (((x)->dbg_mod.dap) ? BIT(4) : BIT(3))
#define PWRSTAT_DEBUGDOMAINON(x) (((x)->dbg_mod.dap) ? BIT(12) : BIT(2))
#define PWRSTAT_MEMDOMAINON(x) (((x)->dbg_mod.dap) ? BIT(8) : BIT(1))
#define PWRSTAT_COREDOMAINON(x) (((x)->dbg_mod.dap) ? BIT(0) : BIT(0))
15 defines
enum xtensa_dm_reg {
XDMREG_TRAXID = 0x00,
XDMREG_TRAXCTRL,
XDMREG_TRAXSTAT,
XDMREG_TRAXDATA,
XDMREG_TRAXADDR,
XDMREG_TRIGGERPC,
XDMREG_PCMATCHCTRL,
XDMREG_DELAYCNT,
XDMREG_MEMADDRSTART,
XDMREG_MEMADDREND,
XDMREG_DEBUGPC,
XDMREG_EXTTIMELO,
XDMREG_EXTTIMEHI,
XDMREG_TRAXRSVD48,
XDMREG_TRAXRSVD4C,
XDMREG_TRAXRSVD50,
XDMREG_TRAXRSVD54,
XDMREG_TRAXRSVD58,
XDMREG_TRAXRSVD5C,
XDMREG_TRAXRSVD60,
XDMREG_TRAXRSVD64,
XDMREG_TRAXRSVD68,
XDMREG_TRAXRSVD6C,
XDMREG_TRAXRSVD70,
XDMREG_TRAXRSVD74,
XDMREG_CONFIGID0,
XDMREG_CONFIGID1,
XDMREG_PMG,
XDMREG_INTPC,
XDMREG_PM0,
XDMREG_PM1,
XDMREG_PM2,
XDMREG_PM3,
XDMREG_PM4,
XDMREG_PM5,
XDMREG_PM6,
XDMREG_PM7,
XDMREG_PMCTRL0,
XDMREG_PMCTRL1,
XDMREG_PMCTRL2,
XDMREG_PMCTRL3,
XDMREG_PMCTRL4,
XDMREG_PMCTRL5,
XDMREG_PMCTRL6,
XDMREG_PMCTRL7,
XDMREG_PMSTAT0,
XDMREG_PMSTAT1,
XDMREG_PMSTAT2,
XDMREG_PMSTAT3,
XDMREG_PMSTAT4,
XDMREG_PMSTAT5,
XDMREG_PMSTAT6,
XDMREG_PMSTAT7,
XDMREG_OCDID,
XDMREG_DCRCLR,
XDMREG_DCRSET,
XDMREG_DSR,
XDMREG_DDR,
XDMREG_DDREXEC,
XDMREG_DIR0EXEC,
XDMREG_DIR0,
XDMREG_DIR1,
XDMREG_DIR2,
XDMREG_DIR3,
XDMREG_DIR4,
XDMREG_DIR5,
XDMREG_DIR6,
XDMREG_DIR7,
XDMREG_ERISTAT,
XDMREG_ITCTRL,
XDMREG_CLAIMSET,
XDMREG_CLAIMCLR,
XDMREG_LOCKACCESS,
XDMREG_LOCKSTATUS,
XDMREG_AUTHSTATUS,
XDMREG_DEVID,
XDMREG_DEVTYPE,
XDMREG_PERID4,
XDMREG_PERID5,
XDMREG_PERID6,
XDMREG_PERID7,
XDMREG_PERID0,
XDMREG_PERID1,
XDMREG_PERID2,
XDMREG_PERID3,
XDMREG_COMPID0,
XDMREG_COMPID1,
XDMREG_COMPID2,
XDMREG_COMPID3,
XDMREG_NUM
...};
struct xtensa_dm_reg_offsets {
uint8_t nar;
uint16_t apb;
...};
#define XTENSA_DM_REG_OFFSETS { \
\
{ .nar = 0x00, .apb = 0x0000 }, \
{ .nar = 0x01, .apb = 0x0004 }, \
{ .nar = 0x02, .apb = 0x0008 }, \
{ .nar = 0x03, .apb = 0x000c }, \
{ .nar = 0x04, .apb = 0x0010 }, \
{ .nar = 0x05, .apb = 0x0014 }, \
{ .nar = 0x06, .apb = 0x0018 }, \
{ .nar = 0x07, .apb = 0x001c }, \
{ .nar = 0x08, .apb = 0x0020 }, \
{ .nar = 0x09, .apb = 0x0024 }, \
{ .nar = 0x0f, .apb = 0x003c }, \
{ .nar = 0x10, .apb = 0x0040 }, \
{ .nar = 0x11, .apb = 0x0044 }, \
{ .nar = 0x12, .apb = 0x0048 }, \
{ .nar = 0x13, .apb = 0x004c }, \
{ .nar = 0x14, .apb = 0x0050 }, \
{ .nar = 0x15, .apb = 0x0054 }, \
{ .nar = 0x16, .apb = 0x0058 }, \
{ .nar = 0x17, .apb = 0x005c }, \
{ .nar = 0x18, .apb = 0x0060 }, \
{ .nar = 0x19, .apb = 0x0064 }, \
{ .nar = 0x1a, .apb = 0x0068 }, \
{ .nar = 0x1b, .apb = 0x006c }, \
{ .nar = 0x1c, .apb = 0x0070 }, \
{ .nar = 0x1d, .apb = 0x0074 }, \
{ .nar = 0x1e, .apb = 0x0078 }, \
{ .nar = 0x1f, .apb = 0x007c }, \
\
\
{ .nar = 0x20, .apb = 0x1000 }, \
{ .nar = 0x24, .apb = 0x1010 }, \
{ .nar = 0x28, .apb = 0x1080 }, \
{ .nar = 0x29, .apb = 0x1084 }, \
{ .nar = 0x2a, .apb = 0x1088 }, \
{ .nar = 0x2b, .apb = 0x108c }, \
{ .nar = 0x2c, .apb = 0x1090 }, \
{ .nar = 0x2d, .apb = 0x1094 }, \
{ .nar = 0x2e, .apb = 0x1098 }, \
{ .nar = 0x2f, .apb = 0x109c }, \
{ .nar = 0x30, .apb = 0x1100 }, \
{ .nar = 0x31, .apb = 0x1104 }, \
{ .nar = 0x32, .apb = 0x1108 }, \
{ .nar = 0x33, .apb = 0x110c }, \
{ .nar = 0x34, .apb = 0x1110 }, \
{ .nar = 0x35, .apb = 0x1114 }, \
{ .nar = 0x36, .apb = 0x1118 }, \
{ .nar = 0x37, .apb = 0x111c }, \
{ .nar = 0x38, .apb = 0x1180 }, \
{ .nar = 0x39, .apb = 0x1184 }, \
{ .nar = 0x3a, .apb = 0x1188 }, \
{ .nar = 0x3b, .apb = 0x118c }, \
{ .nar = 0x3c, .apb = 0x1190 }, \
{ .nar = 0x3d, .apb = 0x1194 }, \
{ .nar = 0x3e, .apb = 0x1198 }, \
{ .nar = 0x3f, .apb = 0x119c }, \
\
\
{ .nar = 0x40, .apb = 0x2000 }, \
{ .nar = 0x42, .apb = 0x2008 }, \
{ .nar = 0x43, .apb = 0x200c }, \
{ .nar = 0x44, .apb = 0x2010 }, \
{ .nar = 0x45, .apb = 0x2014 }, \
{ .nar = 0x46, .apb = 0x2018 }, \
{ .nar = 0x47, .apb = 0x201c }, \
{ .nar = 0x48, .apb = 0x2020 }, \
{ .nar = 0x49, .apb = 0x2024 }, \
{ .nar = 0x4a, .apb = 0x2028 }, \
{ .nar = 0x4b, .apb = 0x202c }, \
{ .nar = 0x4c, .apb = 0x2030 }, \
{ .nar = 0x4d, .apb = 0x2034 }, \
{ .nar = 0x4e, .apb = 0x2038 }, \
{ .nar = 0x4f, .apb = 0x203c }, \
\
\
{ .nar = 0x5a, .apb = 0x3028 }, \
\
\
{ .nar = 0x60, .apb = 0x3f00 }, \
{ .nar = 0x68, .apb = 0x3fa0 }, \
{ .nar = 0x69, .apb = 0x3fa4 }, \
{ .nar = 0x6c, .apb = 0x3fb0 }, \
{ .nar = 0x6d, .apb = 0x3fb4 }, \
{ .nar = 0x6e, .apb = 0x3fb8 }, \
{ .nar = 0x72, .apb = 0x3fc8 }, \
{ .nar = 0x73, .apb = 0x3fcc }, \
{ .nar = 0x74, .apb = 0x3fd0 }, \
{ .nar = 0x75, .apb = 0x3fd4 }, \
{ .nar = 0x76, .apb = 0x3fd8 }, \
{ .nar = 0x77, .apb = 0x3fdc }, \
{ .nar = 0x78, .apb = 0x3fe0 }, \
{ .nar = 0x79, .apb = 0x3fe4 }, \
{ .nar = 0x7a, .apb = 0x3fe8 }, \
{ .nar = 0x7b, .apb = 0x3fec }, \
{ .nar = 0x7c, .apb = 0x3ff0 }, \
{ .nar = 0x7d, .apb = 0x3ff4 }, \
{ .nar = 0x7e, .apb = 0x3ff8 }, \
{ .nar = 0x7f, .apb = 0x3ffc }, \
...}...
#define XTENSA_DM_APB_ALIGN 0x4000
#define OCDDCR_ENABLEOCD BIT(0)
#define OCDDCR_DEBUGINTERRUPT BIT(1)
#define OCDDCR_INTERRUPTALLCONDS BIT(2)
#define OCDDCR_STEPREQUEST BIT(3)
#define OCDDCR_BREAKINEN BIT(16)
#define OCDDCR_BREAKOUTEN BIT(17)
#define OCDDCR_DEBUGSWACTIVE BIT(20)
#define OCDDCR_RUNSTALLINEN BIT(21)
#define OCDDCR_DEBUGMODEOUTEN BIT(22)
#define OCDDCR_BREAKOUTITO BIT(24)
#define OCDDCR_BREAKACKITO BIT(25)
#define OCDDSR_EXECDONE BIT(0)
#define OCDDSR_EXECEXCEPTION BIT(1)
#define OCDDSR_EXECBUSY BIT(2)
#define OCDDSR_EXECOVERRUN BIT(3)
#define OCDDSR_STOPPED BIT(4)
#define OCDDSR_STOPCAUSE (0xF << 5)
#define OCDDSR_STOPCAUSE_SHIFT (5)
#define OCDDSR_COREWROTEDDR BIT(10)
#define OCDDSR_COREREADDDR BIT(11)
#define OCDDSR_HOSTWROTEDDR BIT(14)
#define OCDDSR_HOSTREADDDR BIT(15)
#define OCDDSR_DEBUGPENDBREAK BIT(16)
#define OCDDSR_DEBUGPENDHOST BIT(17)
#define OCDDSR_DEBUGPENDTRAX BIT(18)
#define OCDDSR_DEBUGINTBREAK BIT(20)
#define OCDDSR_DEBUGINTHOST BIT(21)
#define OCDDSR_DEBUGINTTRAX BIT(22)
#define OCDDSR_RUNSTALLTOGGLE BIT(23)
#define OCDDSR_RUNSTALLSAMPLE BIT(24)
#define OCDDSR_BREACKOUTACKITI BIT(25)
#define OCDDSR_BREAKINITI BIT(26)
#define OCDDSR_DBGMODPOWERON BIT(31)
#define OCDDSR_STOPCAUSE_DI (0)
#define OCDDSR_STOPCAUSE_SS (1)
#define OCDDSR_STOPCAUSE_IB (2)
#define OCDDSR_STOPCAUSE_B1 (4)
#define OCDDSR_STOPCAUSE_BN (5)
#define OCDDSR_STOPCAUSE_B (6)
#define OCDDSR_STOPCAUSE_DB0 (8)
#define OCDDSR_STOPCAUSE_DB1 (9)
#define DEBUGCAUSE_IC BIT(0)
#define DEBUGCAUSE_IB BIT(1)
#define DEBUGCAUSE_DB BIT(2)
#define DEBUGCAUSE_BI BIT(3)
#define DEBUGCAUSE_BN BIT(4)
#define DEBUGCAUSE_DI BIT(5)
#define DEBUGCAUSE_VALID BIT(31)
#define TRAXID_PRODNO_TRAX 0
#define TRAXID_PRODNO_SHIFT 28
#define TRAXID_PRODNO_MASK 0xf
#define TRAXCTRL_TREN BIT(0)
#define TRAXCTRL_TRSTP BIT(1)
#define TRAXCTRL_PCMEN BIT(2)
#define TRAXCTRL_PTIEN BIT(4)
#define TRAXCTRL_CTIEN BIT(5)
#define TRAXCTRL_TMEN BIT(7)
#define TRAXCTRL_CNTU BIT(9)
/* ... */
#define TRAXCTRL_TSEN BIT(11)
#define TRAXCTRL_SMPER_SHIFT 12
#define TRAXCTRL_SMPER_MASK 0x07
#define TRAXCTRL_PTOWT BIT(16)
#define TRAXCTRL_PTOWS BIT(17)
#define TRAXCTRL_CTOWT BIT(20)
#define TRAXCTRL_CTOWS BIT(21)
#define TRAXCTRL_ITCTO BIT(22)
#define TRAXCTRL_ITCTIA BIT(23)
#define TRAXCTRL_ITATV BIT(24)
#define TRAXCTRL_ATID_MASK 0x7F
#define TRAXCTRL_ATID_SHIFT 24
#define TRAXCTRL_ATEN BIT(31)
#define TRAXSTAT_TRACT BIT(0)
#define TRAXSTAT_TRIG BIT(1)
#define TRAXSTAT_PCMTG BIT(2)
#define TRAXSTAT_PJTR BIT(3)
#define TRAXSTAT_PTITG BIT(4)
#define TRAXSTAT_CTITG BIT(5)
#define TRAXSTAT_MEMSZ_SHIFT 8
#define TRAXSTAT_MEMSZ_MASK 0x1F
#define TRAXSTAT_PTO BIT(16)
#define TRAXSTAT_CTO BIT(17)
#define TRAXSTAT_ITCTOA BIT(22)
#define TRAXSTAT_ITCTI BIT(23)
#define TRAXSTAT_ITATR BIT(24)
#define TRAXADDR_TADDR_SHIFT 0
#define TRAXADDR_TADDR_MASK 0x1FFFFF
#define TRAXADDR_TWRAP_SHIFT 21
#define TRAXADDR_TWRAP_MASK 0x3FF
#define TRAXADDR_TWSAT BIT(31)
#define PCMATCHCTRL_PCML_SHIFT 0
#define PCMATCHCTRL_PCML_MASK 0x1F
#define PCMATCHCTRL_PCMS BIT(31)
/* ... */
#define XTENSA_MAX_PERF_COUNTERS 2
#define XTENSA_MAX_PERF_SELECT 32
#define XTENSA_MAX_PERF_MASK 0xffff
#define XTENSA_STOPMASK_DISABLED UINT32_MAX
98 defines
struct xtensa_debug_module;
struct xtensa_debug_ops {
int (*queue_enable)(struct xtensa_debug_module *dm);
int (*queue_reg_read)(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint8_t *data);
int (*queue_reg_write)(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint32_t data);
...};
/* ... */
struct xtensa_power_ops {
int (*queue_reg_read)(struct xtensa_debug_module *dm, enum xtensa_dm_pwr_reg reg, uint8_t *data,
uint32_t clear);
int (*queue_reg_write)(struct xtensa_debug_module *dm, enum xtensa_dm_pwr_reg reg, uint32_t data);
...};
typedef uint32_t xtensa_pwrstat_t;
typedef uint32_t xtensa_ocdid_t;
typedef uint32_t xtensa_dsr_t;
typedef uint32_t xtensa_traxstat_t;
struct xtensa_power_status {
xtensa_pwrstat_t stat;
xtensa_pwrstat_t stath;
/* ... */
/* ... */
/* ... */
xtensa_pwrstat_t prev_stat;
...};
struct xtensa_core_status {
xtensa_dsr_t dsr;
...};
struct xtensa_trace_config {
uint32_t ctrl;
uint32_t memaddr_start;
uint32_t memaddr_end;
uint32_t addr;
...};
struct xtensa_trace_status {
xtensa_traxstat_t stat;
...};
struct xtensa_trace_start_config {
uint32_t stoppc;
bool after_is_words;
uint32_t after;
uint32_t stopmask;
...};
struct xtensa_perfmon_config {
int select;
uint32_t mask;
int kernelcnt;
int tracelevel;
...};
struct xtensa_perfmon_result {
uint64_t value;
bool overflow;
...};
struct xtensa_debug_module_config {
const struct xtensa_power_ops *pwr_ops;
const struct xtensa_debug_ops *dbg_ops;
struct jtag_tap *tap;
void (*queue_tdi_idle)(struct target *target);
void *queue_tdi_idle_arg;
/* ... */
struct adiv5_dap *dap;
struct adiv5_ap *debug_ap;
int debug_apsel;
uint32_t ap_offset;
...};
struct xtensa_debug_module {
const struct xtensa_power_ops *pwr_ops;
const struct xtensa_debug_ops *dbg_ops;
struct jtag_tap *tap;
void (*queue_tdi_idle)(struct target *target);
void *queue_tdi_idle_arg;
struct adiv5_dap *dap;
struct adiv5_ap *debug_ap;
int debug_apsel;
struct xtensa_power_status power_status;
struct xtensa_core_status core_status;
xtensa_ocdid_t device_id;
uint32_t ap_offset;
...};
int xtensa_dm_init(struct xtensa_debug_module *dm, const struct xtensa_debug_module_config *cfg);
void xtensa_dm_deinit(struct xtensa_debug_module *dm);
int xtensa_dm_poll(struct xtensa_debug_module *dm);
int xtensa_dm_examine(struct xtensa_debug_module *dm);
int xtensa_dm_queue_enable(struct xtensa_debug_module *dm);
int xtensa_dm_queue_reg_read(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint8_t *value);
int xtensa_dm_queue_reg_write(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint32_t value);
int xtensa_dm_queue_pwr_reg_read(struct xtensa_debug_module *dm,
enum xtensa_dm_pwr_reg reg,
uint8_t *data,
uint32_t clear);
int xtensa_dm_queue_pwr_reg_write(struct xtensa_debug_module *dm,
enum xtensa_dm_pwr_reg reg,
uint32_t data);
static inline int xtensa_dm_queue_execute(struct xtensa_debug_module *dm)
{
return dm->dap ? dap_run(dm->dap) : jtag_execute_queue();
}{ ... }
static inline void xtensa_dm_queue_tdi_idle(struct xtensa_debug_module *dm)
{
if (dm->queue_tdi_idle)
dm->queue_tdi_idle(dm->queue_tdi_idle_arg);
}{ ... }
int xtensa_dm_power_status_read(struct xtensa_debug_module *dm, uint32_t clear);
static inline void xtensa_dm_power_status_cache_reset(struct xtensa_debug_module *dm)
{
dm->power_status.prev_stat = 0;
}{ ... }
static inline void xtensa_dm_power_status_cache(struct xtensa_debug_module *dm)
{
dm->power_status.prev_stat = dm->power_status.stath;
}{ ... }
static inline xtensa_pwrstat_t xtensa_dm_power_status_get(struct xtensa_debug_module *dm)
{
return dm->power_status.stat;
}{ ... }
int xtensa_dm_core_status_read(struct xtensa_debug_module *dm);
int xtensa_dm_core_status_clear(struct xtensa_debug_module *dm, xtensa_dsr_t bits);
int xtensa_dm_core_status_check(struct xtensa_debug_module *dm);
static inline xtensa_dsr_t xtensa_dm_core_status_get(struct xtensa_debug_module *dm)
{
return dm->core_status.dsr;
}{ ... }
int xtensa_dm_read(struct xtensa_debug_module *dm, uint32_t addr, uint32_t *val);
int xtensa_dm_write(struct xtensa_debug_module *dm, uint32_t addr, uint32_t val);
int xtensa_dm_device_id_read(struct xtensa_debug_module *dm);
static inline xtensa_ocdid_t xtensa_dm_device_id_get(struct xtensa_debug_module *dm)
{
return dm->device_id;
}{ ... }
int xtensa_dm_trace_start(struct xtensa_debug_module *dm, struct xtensa_trace_start_config *cfg);
int xtensa_dm_trace_stop(struct xtensa_debug_module *dm, bool pto_enable);
int xtensa_dm_trace_config_read(struct xtensa_debug_module *dm, struct xtensa_trace_config *config);
int xtensa_dm_trace_status_read(struct xtensa_debug_module *dm, struct xtensa_trace_status *status);
int xtensa_dm_trace_data_read(struct xtensa_debug_module *dm, uint8_t *dest, uint32_t size);
static inline bool xtensa_dm_is_online(struct xtensa_debug_module *dm)
{
int res = xtensa_dm_device_id_read(dm);
if (res != ERROR_OK)
return false;
return dm->device_id != 0xffffffff && dm->device_id != 0;
}{ ... }
static inline bool xtensa_dm_tap_was_reset(struct xtensa_debug_module *dm)
{
return !(dm->power_status.prev_stat & PWRSTAT_DEBUGWASRESET_DM(dm)) &&
dm->power_status.stat & PWRSTAT_DEBUGWASRESET_DM(dm);
}{ ... }
static inline bool xtensa_dm_core_was_reset(struct xtensa_debug_module *dm)
{
return !(dm->power_status.prev_stat & PWRSTAT_COREWASRESET_DM(dm)) &&
dm->power_status.stat & PWRSTAT_COREWASRESET_DM(dm);
}{ ... }
static inline bool xtensa_dm_core_is_stalled(struct xtensa_debug_module *dm)
{
return dm->core_status.dsr & OCDDSR_RUNSTALLSAMPLE;
}{ ... }
static inline bool xtensa_dm_is_powered(struct xtensa_debug_module *dm)
{
return dm->core_status.dsr & OCDDSR_DBGMODPOWERON;
}{ ... }
int xtensa_dm_perfmon_enable(struct xtensa_debug_module *dm, int counter_id,
const struct xtensa_perfmon_config *config);
int xtensa_dm_perfmon_dump(struct xtensa_debug_module *dm, int counter_id,
struct xtensa_perfmon_result *out_result);
/* ... */
#endif