- prepare OpenOCD for branching, created ./trunk/
[fw/openocd] / src / target / etm.h
1 /***************************************************************************\r
2  *   Copyright (C) 2005 by Dominic Rath                                    *\r
3  *   Dominic.Rath@gmx.de                                                   *\r
4  *                                                                         *\r
5  *   This program is free software; you can redistribute it and/or modify  *\r
6  *   it under the terms of the GNU General Public License as published by  *\r
7  *   the Free Software Foundation; either version 2 of the License, or     *\r
8  *   (at your option) any later version.                                   *\r
9  *                                                                         *\r
10  *   This program is distributed in the hope that it will be useful,       *\r
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *\r
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *\r
13  *   GNU General Public License for more details.                          *\r
14  *                                                                         *\r
15  *   You should have received a copy of the GNU General Public License     *\r
16  *   along with this program; if not, write to the                         *\r
17  *   Free Software Foundation, Inc.,                                       *\r
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *\r
19  ***************************************************************************/\r
20 #ifndef ETM_H\r
21 #define ETM_H\r
22 \r
23 #include "target.h"\r
24 #include "register.h"\r
25 #include "arm_jtag.h"\r
26 \r
27 // ETM registers (V1.2 protocol)\r
28 enum\r
29 {\r
30         ETM_CTRL = 0x00,\r
31         ETM_CONFIG = 0x01,\r
32         ETM_TRIG_EVENT = 0x02,\r
33         ETM_MMD_CTRL = 0x03,\r
34         ETM_STATUS = 0x04,\r
35         ETM_SYS_CONFIG = 0x05,\r
36         ETM_TRACE_RESOURCE_CTRL = 0x06,\r
37         ETM_TRACE_EN_CTRL2 = 0x07,\r
38         ETM_TRACE_EN_EVENT = 0x08,\r
39         ETM_TRACE_EN_CTRL1 = 0x09,\r
40         ETM_FIFOFULL_REGION = 0x0a,\r
41         ETM_FIFOFULL_LEVEL = 0x0b,\r
42         ETM_VIEWDATA_EVENT = 0x0c,\r
43         ETM_VIEWDATA_CTRL1 = 0x0d,\r
44         ETM_VIEWDATA_CTRL2 = 0x0e,\r
45         ETM_VIEWDATA_CTRL3 = 0x0f,\r
46         ETM_ADDR_COMPARATOR_VALUE = 0x10,\r
47         ETM_ADDR_ACCESS_TYPE = 0x20,\r
48         ETM_DATA_COMPARATOR_VALUE = 0x30,\r
49         ETM_DATA_COMPARATOR_MASK = 0x40,\r
50         ETM_COUNTER_INITAL_VALUE = 0x50,\r
51         ETM_COUNTER_ENABLE = 0x54,\r
52         ETM_COUNTER_RELOAD_VALUE = 0x58,\r
53         ETM_COUNTER_VALUE = 0x5c,\r
54         ETM_SEQUENCER_CTRL = 0x60,\r
55         ETM_SEQUENCER_STATE = 0x67,\r
56         ETM_EXTERNAL_OUTPUT = 0x68,\r
57         ETM_CONTEXTID_COMPARATOR_VALUE = 0x6c,\r
58         ETM_CONTEXTID_COMPARATOR_MASK = 0x6f,   \r
59 };\r
60 \r
61 \r
62 typedef struct etm_reg_s\r
63 {\r
64         int addr;\r
65         arm_jtag_t *jtag_info;\r
66 } etm_reg_t;\r
67 \r
68 extern reg_cache_t* etm_build_reg_cache(target_t *target, arm_jtag_t *jtag_info, int extra_reg);\r
69 extern int etm_read_reg(reg_t *reg);\r
70 extern int etm_write_reg(reg_t *reg, u32 value);\r
71 extern int etm_read_reg_w_check(reg_t *reg, u8* check_value, u8* check_mask);\r
72 extern int etm_store_reg(reg_t *reg);\r
73 extern int etm_set_reg(reg_t *reg, u32 value);\r
74 extern int etm_set_reg_w_exec(reg_t *reg, u32 value);\r
75 \r
76 #endif /* ETM_H */\r