ARM11: implement provider for new DPM interface
[fw/openocd] / src / target / arm11_dbgtap.h
1 #ifndef ARM11_DBGTAP_H
2 #define ARM11_DBGTAP_H
3
4 #include "arm11.h"
5
6 /* ARM11 internals */
7
8 void arm11_setup_field(struct arm11_common *arm11, int num_bits,
9                 void *in_data, void *out_data, struct scan_field *field);
10 void arm11_add_IR(struct arm11_common *arm11,
11                 uint8_t instr, tap_state_t state);
12 int arm11_add_debug_SCAN_N(struct arm11_common *arm11,
13                 uint8_t chain, tap_state_t state);
14 int arm11_read_DSCR(struct arm11_common *arm11, uint32_t *dscr);
15 int arm11_write_DSCR(struct arm11_common *arm11, uint32_t dscr);
16
17 enum target_debug_reason arm11_get_DSCR_debug_reason(uint32_t dscr);
18
19 int arm11_run_instr_data_prepare(struct arm11_common *arm11);
20 int arm11_run_instr_data_finish(struct arm11_common *arm11);
21 int arm11_run_instr_no_data1(struct arm11_common *arm11, uint32_t opcode);
22 int arm11_run_instr_data_to_core(struct arm11_common *arm11,
23                 uint32_t opcode, uint32_t *data, size_t count);
24 int arm11_run_instr_data_to_core_noack(struct arm11_common *arm11,
25                 uint32_t opcode, uint32_t *data, size_t count);
26 int arm11_run_instr_data_to_core1(struct arm11_common *arm11,
27                 uint32_t opcode, uint32_t data);
28 int arm11_run_instr_data_from_core(struct arm11_common *arm11,
29                 uint32_t opcode, uint32_t *data, size_t count);
30 int arm11_run_instr_data_from_core_via_r0(struct arm11_common *arm11,
31                 uint32_t opcode, uint32_t *data);
32 int arm11_run_instr_data_to_core_via_r0(struct arm11_common *arm11,
33                 uint32_t opcode, uint32_t data);
34
35 int arm11_add_dr_scan_vc(int num_fields, struct scan_field *fields,
36                 tap_state_t state);
37
38 /**
39  * Used with arm11_sc7_run to make a list of read/write commands for
40  * scan chain 7
41  */
42 struct arm11_sc7_action
43 {
44         bool write; /**< Access mode: true for write, false for read. */
45         uint8_t address; /**< Register address mode. Use enum #arm11_sc7 */
46         /**
47          * If write then set this to value to be written.  In read mode
48          * this receives the read value when the function returns.
49          */
50         uint32_t value;
51 };
52
53 int arm11_sc7_run(struct arm11_common *arm11,
54                 struct arm11_sc7_action *actions, size_t count);
55
56 /* Mid-level helper functions */
57 void arm11_sc7_clear_vbw(struct arm11_common *arm11);
58 void arm11_sc7_set_vcr(struct arm11_common *arm11, uint32_t value);
59
60 int arm11_read_memory_word(struct arm11_common *arm11,
61                 uint32_t address, uint32_t *result);
62
63 /* Set up high-level debug module utilities */
64 void arm11_dpm_init(struct arm11_common *arm11, uint32_t didr);
65
66 #endif // ARM11_DBGTAP_H