Embedded ICE version is now dumped with debug_level 1
[dnglaze.git] / src / target / xscale.h
bloba5d83ee675c7a4aafe3385ac3ff1d08d1497e8d9
1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
5 * Copyright (C) 2007,2008 Øyvind Harboe *
6 * oyvind.harboe@zylin.com *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 ***************************************************************************/
23 #ifndef XSCALE_H
24 #define XSCALE_H
26 #include "armv4_5.h"
27 #include "armv4_5_mmu.h"
28 #include "trace.h"
30 #define XSCALE_COMMON_MAGIC 0x58534341
32 /* These four JTAG instructions are architecturally defined.
33 * Lengths are core-specific; originally 5 bits, later 7.
35 #define XSCALE_DBGRX 0x02
36 #define XSCALE_DBGTX 0x10
37 #define XSCALE_LDIC 0x07
38 #define XSCALE_SELDCSR 0x09
40 enum xscale_debug_reason
42 XSCALE_DBG_REASON_GENERIC,
43 XSCALE_DBG_REASON_RESET,
44 XSCALE_DBG_REASON_TB_FULL,
47 enum xscale_trace_entry_type
49 XSCALE_TRACE_MESSAGE = 0x0,
50 XSCALE_TRACE_ADDRESS = 0x1,
53 typedef struct xscale_trace_entry_s
55 uint8_t data;
56 enum xscale_trace_entry_type type;
57 } xscale_trace_entry_t;
59 typedef struct xscale_trace_data_s
61 xscale_trace_entry_t *entries;
62 int depth;
63 uint32_t chkpt0;
64 uint32_t chkpt1;
65 uint32_t last_instruction;
66 struct xscale_trace_data_s *next;
67 } xscale_trace_data_t;
69 typedef struct xscale_trace_s
71 trace_status_t capture_status; /* current state of capture run */
72 struct image_s *image; /* source for target opcodes */
73 xscale_trace_data_t *data; /* linked list of collected trace data */
74 int buffer_enabled; /* whether trace buffer is enabled */
75 int buffer_fill; /* maximum number of trace runs to read (-1 for wrap-around) */
76 int pc_ok;
77 uint32_t current_pc;
78 armv4_5_state_t core_state; /* current core state (ARM, Thumb, Jazelle) */
79 } xscale_trace_t;
81 typedef struct xscale_common_s
83 int common_magic;
85 /* XScale registers (CP15, DBG) */
86 reg_cache_t *reg_cache;
88 /* current state of the debug handler */
89 int handler_installed;
90 int handler_running;
91 uint32_t handler_address;
93 /* target-endian buffers with exception vectors */
94 uint32_t low_vectors[8];
95 uint32_t high_vectors[8];
97 /* static low vectors */
98 uint8_t static_low_vectors_set; /* bit field with static vectors set by the user */
99 uint8_t static_high_vectors_set; /* bit field with static vectors set by the user */
100 uint32_t static_low_vectors[8];
101 uint32_t static_high_vectors[8];
103 /* DCache cleaning */
104 uint32_t cache_clean_address;
106 /* whether hold_rst and ext_dbg_break should be set */
107 int hold_rst;
108 int external_debug_break;
110 /* breakpoint / watchpoint handling */
111 int dbr_available;
112 int dbr0_used;
113 int dbr1_used;
114 int ibcr_available;
115 int ibcr0_used;
116 int ibcr1_used;
117 uint32_t arm_bkpt;
118 uint16_t thumb_bkpt;
120 uint8_t vector_catch;
122 xscale_trace_t trace;
124 int arch_debug_reason;
126 /* armv4/5 common stuff */
127 armv4_5_common_t armv4_5_common;
129 /* MMU/Caches */
130 armv4_5_mmu_common_t armv4_5_mmu;
131 uint32_t cp15_control_reg;
133 /* possible future enhancements that go beyond XScale common stuff */
134 void *arch_info;
136 int fast_memory_access;
137 } xscale_common_t;
139 typedef struct xscale_reg_s
141 int dbg_handler_number;
142 target_t *target;
143 } xscale_reg_t;
145 enum
147 XSCALE_MAINID, /* 0 */
148 XSCALE_CACHETYPE,
149 XSCALE_CTRL,
150 XSCALE_AUXCTRL,
151 XSCALE_TTB,
152 XSCALE_DAC,
153 XSCALE_FSR,
154 XSCALE_FAR,
155 XSCALE_PID,
156 XSCALE_CPACCESS,
157 XSCALE_IBCR0, /* 10 */
158 XSCALE_IBCR1,
159 XSCALE_DBR0,
160 XSCALE_DBR1,
161 XSCALE_DBCON,
162 XSCALE_TBREG,
163 XSCALE_CHKPT0,
164 XSCALE_CHKPT1,
165 XSCALE_DCSR,
166 XSCALE_TX,
167 XSCALE_RX, /* 20 */
168 XSCALE_TXRXCTRL,
171 #define ERROR_XSCALE_NO_TRACE_DATA (-1500)
173 #endif /* XSCALE_H */