flash: fix at91sam3/4 driver typos
[fw/openocd] / src / target / arm11_dbgtap.h
1 /***************************************************************************
2  *   Copyright (C) 2008 digenius technology GmbH.                          *
3  *   Michael Bruck                                                         *
4  *                                                                         *
5  *   Copyright (C) 2008,2009 Oyvind Harboe oyvind.harboe@zylin.com         *
6  *                                                                         *
7  *   This program is free software; you can redistribute it and/or modify  *
8  *   it under the terms of the GNU General Public License as published by  *
9  *   the Free Software Foundation; either version 2 of the License, or     *
10  *   (at your option) any later version.                                   *
11  *                                                                         *
12  *   This program is distributed in the hope that it will be useful,       *
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15  *   GNU General Public License for more details.                          *
16  *                                                                         *
17  *   You should have received a copy of the GNU General Public License     *
18  *   along with this program; if not, write to the                         *
19  *   Free Software Foundation, Inc.,                                       *
20  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
21  ***************************************************************************/
22
23 #ifndef ARM11_DBGTAP_H
24 #define ARM11_DBGTAP_H
25
26 #include "arm11.h"
27
28 /* ARM11 internals */
29
30 void arm11_setup_field(struct arm11_common *arm11, int num_bits,
31                 void *in_data, void *out_data, struct scan_field *field);
32 void arm11_add_IR(struct arm11_common *arm11,
33                 uint8_t instr, tap_state_t state);
34 int arm11_add_debug_SCAN_N(struct arm11_common *arm11,
35                 uint8_t chain, tap_state_t state);
36 int arm11_read_DSCR(struct arm11_common *arm11);
37 int arm11_write_DSCR(struct arm11_common *arm11, uint32_t dscr);
38
39 int arm11_run_instr_data_prepare(struct arm11_common *arm11);
40 int arm11_run_instr_data_finish(struct arm11_common *arm11);
41 int arm11_run_instr_no_data1(struct arm11_common *arm11, uint32_t opcode);
42 int arm11_run_instr_data_to_core(struct arm11_common *arm11,
43                 uint32_t opcode, uint32_t *data, size_t count);
44 int arm11_run_instr_data_to_core_noack(struct arm11_common *arm11,
45                 uint32_t opcode, uint32_t *data, size_t count);
46 int arm11_run_instr_data_to_core1(struct arm11_common *arm11,
47                 uint32_t opcode, uint32_t data);
48 int arm11_run_instr_data_from_core(struct arm11_common *arm11,
49                 uint32_t opcode, uint32_t *data, size_t count);
50 int arm11_run_instr_data_from_core_via_r0(struct arm11_common *arm11,
51                 uint32_t opcode, uint32_t *data);
52 int arm11_run_instr_data_to_core_via_r0(struct arm11_common *arm11,
53                 uint32_t opcode, uint32_t data);
54
55 void arm11_add_dr_scan_vc(struct jtag_tap *tap, int num_fields, struct scan_field *fields,
56                 tap_state_t state);
57
58 /**
59  * Used with arm11_sc7_run to make a list of read/write commands for
60  * scan chain 7
61  */
62 struct arm11_sc7_action {
63         bool write;     /**< Access mode: true for write, false for read. */
64         uint8_t address;/**< Register address mode. Use enum #arm11_sc7 */
65         /**
66          * If write then set this to value to be written.  In read mode
67          * this receives the read value when the function returns.
68          */
69         uint32_t value;
70 };
71
72 int arm11_sc7_run(struct arm11_common *arm11,
73                 struct arm11_sc7_action *actions, size_t count);
74
75 /* Mid-level helper functions */
76 int arm11_sc7_clear_vbw(struct arm11_common *arm11);
77 int arm11_sc7_set_vcr(struct arm11_common *arm11, uint32_t value);
78
79 int arm11_read_memory_word(struct arm11_common *arm11,
80                 uint32_t address, uint32_t *result);
81
82 int arm11_dpm_init(struct arm11_common *arm11, uint32_t didr);
83 int arm11_bpwp_flush(struct arm11_common *arm11);
84
85 #endif  /* ARM11_DBGTAP_H */