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