70
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
2 |
<html>
|
|
3 |
<head>
|
|
4 |
<title>Target Communication Framework Services - Registers</title>
|
|
5 |
</head>
|
|
6 |
|
|
7 |
<body lang='EN-US'>
|
|
8 |
|
|
9 |
<h1>Target Communication Framework Services - Registers</h1>
|
|
10 |
|
|
11 |
<ul>
|
|
12 |
<li><a href='#VersionHistory'>Version History</a>
|
|
13 |
<li><a href='#Overview'>Overview</a>
|
|
14 |
<li><a href='#Cmds'>Commands</a>
|
|
15 |
<ul>
|
|
16 |
<li><a href='#CmdGetContext'>Get Context</a>
|
|
17 |
<li><a href='#CmdGetChildren'>Get Children</a>
|
|
18 |
<li><a href='#CmdSetRegister'>Set Register</a>
|
|
19 |
<li><a href='#CmdGetRegister'>Get Register</a>
|
|
20 |
<li><a href='#CmdSetMultiple'>Set Multiple Registers</a>
|
|
21 |
<li><a href='#CmdGetMultiple'>Get Multiple Registers</a>
|
|
22 |
<li><a href='#CmdSearch'>Search for Registers</a>
|
|
23 |
</ul>
|
|
24 |
<li><a href='#Events'>Events</a>
|
|
25 |
<li><a href='#API'>API</a>
|
|
26 |
</ul>
|
|
27 |
|
|
28 |
<h1>Registers Service</h1>
|
|
29 |
|
|
30 |
<h2><a name='VersionHistory'>Version History</a></h2>
|
|
31 |
|
|
32 |
<table border=1 cellpadding=8>
|
|
33 |
<tr>
|
|
34 |
<th>Version
|
|
35 |
<th>Date
|
|
36 |
<th>Change
|
|
37 |
<tr>
|
|
38 |
<td>0.1
|
|
39 |
<td>2008-01-10
|
|
40 |
<td>Initial contribution
|
|
41 |
<tr>
|
|
42 |
<td>0.2
|
|
43 |
<td>2008-04-23
|
|
44 |
<td>Added get/set multiple
|
|
45 |
<tr>
|
|
46 |
<td>1.0
|
|
47 |
<td>2008-05-06
|
|
48 |
<td>Approved
|
|
49 |
<tr>
|
|
50 |
<td>1.1
|
|
51 |
<td>2009-03-16
|
|
52 |
<td>Added search command and several context properties
|
|
53 |
</table>
|
|
54 |
|
|
55 |
<h2><a name='Overview'>Overview</a></h2>
|
|
56 |
|
|
57 |
<p>The service provides basic operations to read/write CPU and hardware registers. Command
|
|
58 |
and event parameters are encoded as zero terminated <a href='TCF Specification.html#JSON'>JSON</a> strings.</p>
|
|
59 |
|
|
60 |
<p>The service uses standard format for error reports,
|
|
61 |
see <a href='TCF Services.html#ErrorFormat'>Error Report Format</a>.</p>
|
|
62 |
|
|
63 |
In addition to commands that can set/get individual register context values, the service defines commands to set/get values at
|
|
64 |
multiple locations. This allows:
|
|
65 |
<ol>
|
|
66 |
<li> to get/set multiple register contexts in one command
|
|
67 |
<li> to specify offset and size for get/set on large register groups
|
|
68 |
<li> to get/set truncated register values, e.g. only the low 32 bits of a 64-bit register
|
|
69 |
</ol>
|
|
70 |
|
|
71 |
<h2><a name='Cmds'>Commands</a></h2>
|
|
72 |
|
|
73 |
<h3><a name='CmdGetContext'>Get Context</a></h3>
|
|
74 |
|
|
75 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
76 |
C • <i><token></i> • Registers • getContext • <i><string: context ID></i> •
|
|
77 |
</font></b></pre>
|
|
78 |
|
|
79 |
<p>The command retrieves context info for given context ID. A context corresponds to an
|
|
80 |
register, register group, register bit field, etc. Exact meaning of a context depends on the target.
|
|
81 |
Target agent should define contexts hierarchy that is:</p>
|
|
82 |
|
|
83 |
<ul type='disc'>
|
|
84 |
<li>Adequately reflects target hardware registers layout;
|
|
85 |
<li>Consistent with the lingo/terminology of the processor manuals;
|
|
86 |
<li>Intuitive to a user.
|
|
87 |
</ul>
|
|
88 |
|
|
89 |
<p>Reply:</p>
|
|
90 |
|
|
91 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
92 |
R • <i><token></i> • <i><error report></i> • <i><context data></i> •
|
|
93 |
|
|
94 |
<i><context data></i>
|
|
95 |
⇒ null
|
|
96 |
⇒ <i><object></i>
|
|
97 |
</font></b></pre>
|
|
98 |
|
|
99 |
<p>Context data object should, at least, contain member
|
|
100 |
<b><font face="Courier New" size=2 color=#333399>"ID" : <i><string>.</i></font></b>
|
|
101 |
Context data is expected to be cached by clients.
|
|
102 |
Service sends contextChanged event to notify changes in context data.</p>
|
|
103 |
|
|
104 |
<p>Predefined register context properties are:</p>
|
|
105 |
<ul>
|
|
106 |
<li><code><b><font face="Courier New" size=2 color=#333399>"ID" : <i><string></i></font></b></code>
|
|
107 |
- ID of the context, same as getContext command argument.
|
|
108 |
|
|
109 |
<li><code><b><font face="Courier New" size=2 color=#333399>"ParentID" : <i><string></i></font></b></code>
|
|
110 |
- ID of a parent context.
|
|
111 |
|
|
112 |
<li><code><b><font face="Courier New" size=2 color=#333399>"ProcessID" : <i><string></i></font></b></code>
|
|
113 |
- process ID.
|
|
114 |
|
|
115 |
<li><code><b><font face="Courier New" size=2 color=#333399>"Name" : <i><string></i></font></b></code>
|
|
116 |
- context name.
|
|
117 |
|
|
118 |
<li><code><b><font face="Courier New" size=2 color=#333399>"Description" : <i><string></i></font></b></code>
|
|
119 |
- context description.
|
|
120 |
|
|
121 |
<li><code><b><font face="Courier New" size=2 color=#333399>"Size" : <i><int></i></font></b></code>
|
|
122 |
- context size in bytes. Byte arrays in get/set commands should be same size.
|
|
123 |
Hardware register can be smaller then this size, for example in case
|
|
124 |
when register size is not an even number of bytes. In such case implementation
|
|
125 |
should add/remove padding that consists of necessary number of zero bits.
|
|
126 |
|
|
127 |
<li><code><b><font face="Courier New" size=2 color=#333399>"Readable" : <i><boolean></i></font></b></code>
|
|
128 |
- true if context value can be read.
|
|
129 |
|
|
130 |
<li><code><b><font face="Courier New" size=2 color=#333399>"ReadOnce" : <i><boolean></i></font></b></code>
|
|
131 |
- true if reading the context (register) destroys its current value - it can be read only once.
|
|
132 |
|
|
133 |
<li><code><b><font face="Courier New" size=2 color=#333399>"Writeable" : <i><boolean></i></font></b></code>
|
|
134 |
- true if context value can be written.
|
|
135 |
|
|
136 |
<li><code><b><font face="Courier New" size=2 color=#333399>"WriteOnce" : <i><boolean></i></font></b></code>
|
|
137 |
- true if register value can not be overwritten - every write counts.
|
|
138 |
|
|
139 |
<li><code><b><font face="Courier New" size=2 color=#333399>"SideEffects" : <i><boolean></i></font></b></code>
|
|
140 |
- true if writing the context can change values of other registers.
|
|
141 |
|
|
142 |
<li><code><b><font face="Courier New" size=2 color=#333399>"Volatile" : <i><boolean></i></font></b></code>
|
|
143 |
- true if the register value can change even when target is stopped.
|
|
144 |
|
|
145 |
<li><code><b><font face="Courier New" size=2 color=#333399>"Float" : <i><boolean></i></font></b></code>
|
|
146 |
- true if the register value is a floating-point value.
|
|
147 |
|
|
148 |
<li><code><b><font face="Courier New" size=2 color=#333399>"BigEndian" : <i><boolean></i></font></b></code>
|
|
149 |
- true if big endian, which means decreasing numeric significance with increasing bit number.
|
|
150 |
If absent default if false, which implies little endianess. The endianess is used to encode and decode values of get, getm, set and setm commands.
|
|
151 |
|
|
152 |
<li><code><b><font face="Courier New" size=2 color=#333399>"LeftToRight" : <i><boolean></i></font></b></code>
|
|
153 |
- true if the lowest numbered bit (i.e. bit #0 or bit #1, depending on "FirstBit" value) should be shown to user as the left-most bit.
|
|
154 |
|
|
155 |
<li><code><b><font face="Courier New" size=2 color=#333399>"FirstBit" : <i><int></i></font></b></code>
|
|
156 |
- 0 or 1. If the context has bit field children, bit positions of the fields can be zero-based or 1-based.
|
|
157 |
|
|
158 |
<li><code><b><font face="Courier New" size=2 color=#333399>"Bits" : <i><array of int></i></font></b></code>
|
|
159 |
- if context is a bit field, contains the field bit numbers in the parent context.
|
|
160 |
|
|
161 |
<li><code><b><font face="Courier New" size=2 color=#333399>"Values" : <i><array of named values></i></font></b></code>
|
|
162 |
- predefined names (mnemonics) for some of context values.
|
|
163 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
164 |
<i><array of named values></i>
|
|
165 |
⇒ null
|
|
166 |
⇒ [ ]
|
|
167 |
⇒ [ <i><named values list></i> ]
|
|
168 |
|
|
169 |
<i><named values list></i>
|
|
170 |
⇒ <i><object: named value properties></i>
|
|
171 |
⇒ <i><named values list></i> , <i><object: named value properties></i>
|
|
172 |
</font></b></pre>
|
|
173 |
Named value properties are:
|
|
174 |
<ul>
|
|
175 |
<li><code><b><font face="Courier New" size="2" color="#333399">"Name"</font></b></code>
|
|
176 |
- Name (menemonic) of the value.
|
|
177 |
<li><code><b><font face="Courier New" size="2" color="#333399">"Value"</font></b></code>
|
|
178 |
- BASE64 encoded binary bits of the value.
|
|
179 |
<li><code><b><font face="Courier New" size="2" color="#333399">"Description"</font></b></code>
|
|
180 |
- Short, human readable description of the value.
|
|
181 |
</ul>
|
|
182 |
<p>
|
|
183 |
|
|
184 |
<li><code><b><font face="Courier New" size="2" color="#333399">"MemoryAddress" : <i><int></i></font></b></code>
|
|
185 |
- The address of a memory mapped register. If MemoryContext is provided, the address is referring into that context.
|
|
186 |
|
|
187 |
<li><code><b><font face="Courier New" size="2" color="#333399">"MemoryContext" : <i><string></i></font></b></code>
|
|
188 |
- The context ID of a memory context in which a memory mapped register is located. Used together with MemoryAddress to inform where in memory memory mapped registers are located.
|
|
189 |
If absent and MemoryAddress is defined, the context ID of this context is used as default.
|
|
190 |
|
|
191 |
<li><code><b><font face="Courier New" size="2" color="#333399">"CanSearch" : <i><array of strings></i></font></b></code>
|
|
192 |
- A list of attribute names which can be searched for starting on this context.
|
|
193 |
If absent the context does not support search.
|
|
194 |
|
|
195 |
<li><code><b><font face="Courier New" size="2" color="#333399">"Role" : <i><string></i></font></b></code>
|
|
196 |
- The role the register plays in a program execution.
|
|
197 |
|
|
198 |
<p>Predefined register role strings are:</p>
|
|
199 |
<ul>
|
|
200 |
<li><code><b><font face="Courier New" size="2" color="#333399">"PC"</font></b></code>
|
|
201 |
- Program counter. Defines instruction to execute next.
|
|
202 |
|
|
203 |
<li><code><b><font face="Courier New" size="2" color="#333399">"SP"</font></b></code>
|
|
204 |
- Register defining the current stack pointer location.
|
|
205 |
|
|
206 |
<li><code><b><font face="Courier New" size="2" color="#333399">"FP"</font></b></code>
|
|
207 |
- Register defining the current frame pointer location.
|
|
208 |
|
|
209 |
<li><code><b><font face="Courier New" size="2" color="#333399">"RET"</font></b></code>
|
|
210 |
- Register used to store the return address for calls.
|
|
211 |
|
|
212 |
<li><code><b><font face="Courier New" size="2" color="#333399">"CORE"</font></b></code>
|
|
213 |
- Indicates register or register groups which belong to the core state.
|
|
214 |
Commonly set for general purpose registers,
|
|
215 |
condition code and other registers which are of special
|
|
216 |
interest for determining the state.
|
|
217 |
</ul>
|
|
218 |
</ul>
|
|
219 |
|
|
220 |
<h3><a name='CmdGetChildren'>Get Children</a></h3>
|
|
221 |
|
|
222 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
223 |
C • <i><token></i> • Registers • getChildren • <i><string: parent context ID></i> •
|
|
224 |
</font></b></pre>
|
|
225 |
|
|
226 |
<p>The command requests a list of contexts available for registers access commands.</p>
|
|
227 |
|
|
228 |
<p>Parent context ID is usually a thread ID retrieved through Run Control Service or one
|
|
229 |
of context IDs retrieved by previous getChildren commands.
|
|
230 |
Contexts hierarchy can be simple plain list of registers, or it can form a tree of register groups, registers and bit fields.
|
|
231 |
It is up to target agent developers to choose layout that is most descriptive for a given target.</p>
|
|
232 |
|
|
233 |
<p>Reply:</p>
|
|
234 |
|
|
235 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
236 |
R • <i><token></i> • <i><error report></i> • <i><array of context IDs></i> •<i></i>
|
|
237 |
|
|
238 |
<i><array of context IDs></i>
|
|
239 |
⇒ null
|
|
240 |
⇒ [ ]
|
|
241 |
⇒ [ <i><context ID list></i> ]
|
|
242 |
|
|
243 |
<i><context ID list></i>
|
|
244 |
⇒ <i><string: context ID></i>
|
|
245 |
⇒ <i><context ID list></i> , <i><string: context ID></i>
|
|
246 |
|
|
247 |
</font></b></pre>
|
|
248 |
|
|
249 |
<h3><a name='CmdSetRegister'>Set Register</a></h3>
|
|
250 |
|
|
251 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
252 |
C • <token> • Registers • set • <i><string: context ID></i> • <i><string: value></i> •
|
|
253 |
</font></b></pre>
|
|
254 |
|
|
255 |
<p>Writes value into given register context. Context ID must be one returned by getContexts.
|
|
256 |
Value is BASE64 encoded byte array of binary data. Array size should match the size of the register.</p>
|
|
257 |
|
|
258 |
<p>Result message:</p>
|
|
259 |
|
|
260 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
261 |
R • <i><token></i> • <i><error report></i> •
|
|
262 |
</font></b></pre>
|
|
263 |
|
|
264 |
<p>Error report provides integer error code and a short, human readable explanation
|
|
265 |
of error.</p>
|
|
266 |
|
|
267 |
<h3><a name='CmdGetRegister'>Get Register</a></h3>
|
|
268 |
|
|
269 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
270 |
C • <token> • Registers • get • <i><string: context ID></i> •
|
|
271 |
</font></b></pre>
|
|
272 |
|
|
273 |
<p>Reads register value from given register context. Context ID must be one returned by getContexts.
|
|
274 |
</p>
|
|
275 |
|
|
276 |
<p>Result message:</p>
|
|
277 |
|
|
278 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
279 |
R • <i><token></i> • <i><error report></i> • <i><string: value></i> •
|
|
280 |
</font></b></pre>
|
|
281 |
|
|
282 |
<p>Error report provides integer error code and a short, human readable explanation
|
|
283 |
of error. Value is BASE64 encoded byte array of binary data. Array size should match the size of the register.</p>
|
|
284 |
|
|
285 |
<h3><a name='CmdSetMultiple'>Set Multiple Registers</a></h3>
|
|
286 |
|
|
287 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
288 |
C • <token> • Registers • setm • <i><array of locations></i> • <i><string: value></i> •
|
|
289 |
|
|
290 |
<i><array of locations></i>
|
|
291 |
⇒ [ <i><location list></i> ]
|
|
292 |
|
|
293 |
<i><location list></i>
|
|
294 |
⇒ <i><location></i>
|
|
295 |
⇒ <i><location list></i> , <i><location></i>
|
|
296 |
|
|
297 |
<i><location></i>
|
|
298 |
⇒ [ <i><string: register context ID></i> , <i><int: offset in bytes></i> , <i><int: size in bytes></i> ]
|
|
299 |
</font></b></pre>
|
|
300 |
|
|
301 |
<p>Writes value into given list of locations in registers. Each location is represented by 3-element array that consists of
|
|
302 |
context ID, offset in the context in bytes and value size in bytes.
|
|
303 |
Value is BASE64 encoded byte array of binary data. Byte array size should match the sum of location sizes.</p>
|
|
304 |
|
|
305 |
<p>Result message:</p>
|
|
306 |
|
|
307 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
308 |
R • <i><token></i> • <i><error report></i> •
|
|
309 |
</font></b></pre>
|
|
310 |
|
|
311 |
<p>Error report provides integer error code and a short, human readable explanation
|
|
312 |
of error.</p>
|
|
313 |
|
|
314 |
<h3><a name='CmdGetMultiple'>Get Multiple Registers</a></h3>
|
|
315 |
|
|
316 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
317 |
C • <token> • Registers • getm • <i><array of locations></i> •
|
|
318 |
|
|
319 |
<i><array of locations></i>
|
|
320 |
⇒ [ <i><location list></i> ]
|
|
321 |
|
|
322 |
<i><location list></i>
|
|
323 |
⇒ <i><location></i>
|
|
324 |
⇒ <i><location list></i> , <i><location></i>
|
|
325 |
|
|
326 |
<i><location></i>
|
|
327 |
⇒ [ <i><string: register context ID></i> , <i><int: offset in bytes></i> , <i><int: size in bytes></i> ]
|
|
328 |
</font></b></pre>
|
|
329 |
|
|
330 |
<p>Reads register values from given list of locations in registers. Each location is represented by 3-element array that consists of
|
|
331 |
context ID, offset in the context in bytes and value size in bytes.
|
|
332 |
</p>
|
|
333 |
|
|
334 |
<p>Result message:</p>
|
|
335 |
|
|
336 |
<pre><b><font face="Courier New" size=2 color=#333399>
|
|
337 |
R • <i><token></i> • <i><error report></i> • <i><string: value></i> •
|
|
338 |
</font></b></pre>
|
|
339 |
|
|
340 |
<p>Error report provides integer error code and a short, human readable explanation
|
|
341 |
of error. Value is BASE64 encoded byte array of binary data. Byte array size should match the sum of location sizes.</p>
|
|
342 |
|
|
343 |
<h3><a name='CmdSearch'>Search for Registers</a></h3>
|
|
344 |
|
|
345 |
<pre><b><font face="Courier New" size="2" color="#333399">
|
|
346 |
C • <token> • Registers • search • <i><string: start context ID> • <object:filter properties></i> •
|
|
347 |
</font></b></pre>
|
|
348 |
|
|
349 |
<p>Search returns a path to each context with properties matching the filter. A path consists of a list of
|
|
350 |
context ids starting with a direct child of the start context up to the found context.
|
|
351 |
Search is only supported for properties listed in the CanSearch property.
|
|
352 |
|
|
353 |
<p>Predefined filter object properties are:</p>
|
|
354 |
<ul>
|
|
355 |
<li><code><b><font face="Courier New" size="2" color="#333399">"Name" : <i><string></i></font></b></code>
|
|
356 |
- The name of the property this filter applies to. Must be one of the names listed in the CanSearch property.
|
|
357 |
</li>
|
|
358 |
<li><code><b><font face="Courier New" size="2" color="#333399">"EqualValue" : <i><string></i></font></b></code>
|
|
359 |
- The value which is searched for.
|
|
360 |
</li>
|
|
361 |
</ul>
|
|
362 |
</p>
|
|
363 |
|
|
364 |
<p>Result message:</p>
|
|
365 |
|
|
366 |
<pre><b><font face="Courier New" size="2" color="#333399">
|
|
367 |
R • <i><token></i> • <i><error report></i> • <i><array of context Paths></i> •
|
|
368 |
|
|
369 |
<i><array of context Paths></i>
|
|
370 |
⇒ null
|
|
371 |
⇒ [ ]
|
|
372 |
⇒ [ <i><context Path list></i> ]
|
|
373 |
|
|
374 |
<i><context Path list></i>
|
|
375 |
⇒ <i><array of context IDs></i>
|
|
376 |
⇒ <i><context Path list></i> , <i><array of context IDs></i>
|
|
377 |
|
|
378 |
</font></b></pre>
|
|
379 |
|
|
380 |
<p>Error report provides integer error code and a short, human readable explanation of error.
|
|
381 |
In the result, each matching context is provided with the path of parents starting with the direct
|
|
382 |
children of the starting node up to the matching node.
|
|
383 |
Multiple found entries are returned as an array of those paths.
|
|
384 |
</p>
|
|
385 |
Example Assume the following context hierarchy:
|
|
386 |
|
|
387 |
<pre><b><font face="Courier New" size="2">
|
|
388 |
{"Name" : "Core", "ID":"ID_C"}
|
|
389 |
{"Name" : "Group0", "ID":"ID_G0", "Role":"CORE"}
|
|
390 |
{"Name" : "PC", "ID":"ID_PC", "Role":"PC"}
|
|
391 |
{"Name" : "SP", "ID":"ID_SP", "Role":"SP"}
|
|
392 |
{"Name" : "Group1", "ID":"ID_G1"}
|
|
393 |
{"Name" : "R0", "ID":"ID_R0"}
|
|
394 |
</font></b></pre>
|
|
395 |
|
|
396 |
With this setup, the following commands and responses could take place:
|
|
397 |
|
|
398 |
<pre><b><font face="Courier New" size="2">
|
|
399 |
C • "1234" • Registers • search • "ID_C" • {"Name":"Name", "EqualValue":"PC"} •
|
|
400 |
R • "1234" • [["ID_G0", "ID_PC"]] •
|
|
401 |
|
|
402 |
C • "1235" • Registers • search • "ID_C" • {"Name":"Role", "EqualValue":"CORE"} •
|
|
403 |
R • "1235" • [["ID_G0"]] •
|
|
404 |
</font></b></pre>
|
|
405 |
|
|
406 |
<h2><a name='Events'>Events</a></h2>
|
|
407 |
|
|
408 |
<p>Registers service broadcasts notification events when registers contexts are changed, and when
|
|
409 |
a register content is altered by "set" commands.</p>
|
|
410 |
|
|
411 |
<pre><b><font face="Courier New" size="2" color="#333399">
|
|
412 |
E • Registers • contextChanged •
|
|
413 |
E • Registers • registerChanged • <i><string: context ID></i> •
|
|
414 |
</font></b></pre>
|
|
415 |
|
|
416 |
<h2><a name='API'>API</a></h2>
|
|
417 |
|
|
418 |
<pre>
|
|
419 |
<font color=#3F5FBF>/**
|
|
420 |
* IRegisters service provides access to target CPU register values and properties.
|
|
421 |
*/</font>
|
|
422 |
<font color=#7F0055>public interface</font> IRegisters <font color=#7F0055>extends</font> IService {
|
|
423 |
|
|
424 |
<font color=#7F0055>static final</font> String NAME = "Registers";
|
|
425 |
|
|
426 |
<font color=#3F5FBF>/**
|
|
427 |
* Context property names.
|
|
428 |
*/</font>
|
|
429 |
<font color=#7F0055>static final</font> String
|
|
430 |
PROP_ID = "ID", <font color=#3F5FBF>/** String, ID of the context */</font>
|
|
431 |
PROP_PARENT_ID = "ParentID", <font color=#3F5FBF>/** String, ID of a parent context */</font>
|
|
432 |
PROP_PROCESS_ID = "ProcessID", <font color=#3F5FBF>/** String, process ID */</font>
|
|
433 |
PROP_NAME = "Name", <font color=#3F5FBF>/** String, context name */</font>
|
|
434 |
PROP_DESCRIPTION = "Description", <font color=#3F5FBF>/** String, context description */</font>
|
|
435 |
PROP_SIZE = "Size", <font color=#3F5FBF>/** Number, context size in bytes. Byte arrays in get/set commands should be same size */</font>
|
|
436 |
PROP_READBLE = "Readable", <font color=#3F5FBF>/** Boolean, true if context value can be read */</font>
|
|
437 |
PROP_READ_ONCE = "ReadOnce", <font color=#3F5FBF>/** Boolean, true if reading the context (register) destroys its current value */</font>
|
|
438 |
PROP_WRITEABLE = "Writeable", <font color=#3F5FBF>/** Boolean, true if context value can be written */</font>
|
|
439 |
PROP_WRITE_ONCE = "WriteOnce", <font color=#3F5FBF>/** Boolean, true if register value can not be overwritten - every write counts */</font>
|
|
440 |
PROP_SIDE_EFFECTS = "SideEffects", <font color=#3F5FBF>/** Boolean, true if writing the context can change values of other registers */</font>
|
|
441 |
PROP_VOLATILE = "Volatile", <font color=#3F5FBF>/** Boolean, true if the register value can change even when target is stopped */</font>
|
|
442 |
PROP_FLOAT = "Float", <font color=#3F5FBF>/** Boolean, true if the register value is a floating-point value */</font>
|
|
443 |
PROP_BIG_ENDIAN = "BigEndian", <font color=#3F5FBF>/** Boolean, true if big endian */</font>
|
|
444 |
PROP_LEFT_TO_RIGHT = "LeftToRight", <font color=#3F5FBF>/** Boolean, true if the lowest numbered bit should be shown to user as the left-most bit */</font>
|
|
445 |
PROP_FIST_BIT = "FirstBit", <font color=#3F5FBF>/** Number, bit numbering base (0 or 1) to use when showing bits to user */</font>
|
|
446 |
PROP_BITS = "Bits", <font color=#3F5FBF>/** Number, if context is a bit field, contains the field bit numbers in the parent context */</font>
|
|
447 |
PROP_VALUES = "Values", <font color=#3F5FBF>/** Array of Map, predefined names (mnemonics) for some of context values */</font>
|
|
448 |
PROP_MEMORY_ADDRESS = "MemoryAddress", <font color=#3F5FBF>/** Number, the address of a memory mapped register */</font>
|
|
449 |
PROP_MEMORY_CONTEXT = "MemoryContext", <font color=#3F5FBF>/** String, the context ID of a memory context in which a memory mapped register is located */</font>
|
|
450 |
PROP_CAN_SEARCH = "CanSearch", <font color=#3F5FBF>/** Array of String, a list of attribute names which can be searched for starting on this context */</font>
|
|
451 |
PROP_ROLE = "Role"; <font color=#3F5FBF>/** String, the role the register plays in a program execution */</font>
|
|
452 |
|
|
453 |
<font color=#3F5FBF>/**
|
|
454 |
* Role property names.
|
|
455 |
*/</font>
|
|
456 |
<font color=#7F0055>static final</font> String
|
|
457 |
ROLE_PC = "PC", <font color=#3F5FBF>/** Program counter. Defines instruction to execute next */</font>
|
|
458 |
ROLE_SP = "SP", <font color=#3F5FBF>/** Register defining the current stack pointer location */</font>
|
|
459 |
ROLE_FP = "FP", <font color=#3F5FBF>/** Register defining the current frame pointer location */</font>
|
|
460 |
ROLE_RET = "RET", <font color=#3F5FBF>/** Register used to store the return address for calls */</font>
|
|
461 |
ROLE_CORE = "CORE"; <font color=#3F5FBF>/** Indicates register or register groups which belong to the core state */</font>
|
|
462 |
|
|
463 |
<font color=#3F5FBF>/**
|
|
464 |
* Filter property names.
|
|
465 |
*/</font>
|
|
466 |
<font color=#7F0055>static final</font> String
|
|
467 |
SEARCH_NAME = "Name", <font color=#3F5FBF>/** The name of the property this filter applies too */</font>
|
|
468 |
SEARCH_EQUAL_VALUE = "EqualValue"; <font color=#3F5FBF>/** The value which is searched for */</font>
|
|
469 |
|
|
470 |
|
|
471 |
<font color=#3F5FBF>/**
|
|
472 |
* Retrieve context info for given context ID.
|
|
473 |
*
|
|
474 |
* <font color=#7F9FBF>@param</font> id – context ID.
|
|
475 |
* <font color=#7F9FBF>@param</font> done - call back interface called when operation is completed.
|
|
476 |
*/</font>
|
|
477 |
IToken getContext(String id, DoneGetContext done);
|
|
478 |
|
|
479 |
<font color=#3F5FBF>/**
|
|
480 |
* Client call back interface for getContext().
|
|
481 |
*/</font>
|
|
482 |
<font color=#7F0055>interface</font> DoneGetContext {
|
|
483 |
<font color=#3F5FBF>/**
|
|
484 |
* Called when contexts data retrieval is done.
|
|
485 |
* <font color=#7F9FBF>@param</font> error – error description if operation failed, null if succeeded.
|
|
486 |
* <font color=#7F9FBF>@param</font> context – context data.
|
|
487 |
*/</font>
|
|
488 |
<font color=#7F0055>void</font> doneGetContext(IToken token, Exception error, RegistersContext context);
|
|
489 |
}
|
|
490 |
|
|
491 |
<font color=#3F5FBF>/**
|
|
492 |
* Retrieve contexts available for registers commands.
|
|
493 |
* A context corresponds to an execution thread, stack frame, registers group, etc.
|
|
494 |
* A context can belong to a parent context. Contexts hierarchy can be simple
|
|
495 |
* plain list or it can form a tree. It is up to target agent developers to choose
|
|
496 |
* layout that is most descriptive for a given target. Context IDs are valid across
|
|
497 |
* all services. In other words, all services access same hierarchy of contexts,
|
|
498 |
* with same IDs, however, each service accesses its own subset of context's
|
|
499 |
* attributes and functionality, which is relevant to that service.
|
|
500 |
*
|
|
501 |
* <font color=#7F9FBF>@param</font> parent_context_id – parent context ID. Can be null –
|
|
502 |
* to retrieve top level of the hierarchy, or one of context IDs retrieved
|
|
503 |
* by previous getChildren commands.
|
|
504 |
* <font color=#7F9FBF>@param</font> done - call back interface called when operation is completed.
|
|
505 |
*/</font>
|
|
506 |
IToken getChildren(String parent_context_id, DoneGetChildren done);
|
|
507 |
|
|
508 |
<font color=#3F5FBF>/**
|
|
509 |
* Client call back interface for getChildren().
|
|
510 |
*/</font>
|
|
511 |
<font color=#7F0055>interface</font> DoneGetChildren {
|
|
512 |
<font color=#3F5FBF>/**
|
|
513 |
* Called when contexts data retrieval is done.
|
|
514 |
* <font color=#7F9FBF>@param</font> error – error description if operation failed, null if succeeded.
|
|
515 |
* <font color=#7F9FBF>@param</font> context_ids – array of available context IDs.
|
|
516 |
*/</font>
|
|
517 |
<font color=#7F0055>void</font> doneGetChildren(IToken token, Exception error, String[] context_ids);
|
|
518 |
}
|
|
519 |
|
|
520 |
<font color=#3F5FBF>/**
|
|
521 |
* RegistersContext objects represent register groups, registers and bit fields.
|
|
522 |
*/</font>
|
|
523 |
<font color=#7F0055>interface</font> RegistersContext {
|
|
524 |
<font color=#3F5FBF>/**
|
|
525 |
* Get Context ID.
|
|
526 |
* <font color=#7F9FBF>@return</font> context ID.
|
|
527 |
*/</font>
|
|
528 |
String getID();
|
|
529 |
|
|
530 |
<font color=#3F5FBF>/**
|
|
531 |
* Get parent context ID.
|
|
532 |
* <font color=#7F9FBF>@return</font> parent context ID.
|
|
533 |
*/</font>
|
|
534 |
String getParentID();
|
|
535 |
|
|
536 |
<font color=#3F5FBF>/**
|
|
537 |
* Get context (register, register group, bit field) name.
|
|
538 |
* <font color=#7F9FBF>@return</font> context name.
|
|
539 |
*/</font>
|
|
540 |
String getName();
|
|
541 |
|
|
542 |
<font color=#3F5FBF>/**
|
|
543 |
* Get context description.
|
|
544 |
* <font color=#7F9FBF>@return</font> context description.
|
|
545 |
*/</font>
|
|
546 |
String getDescription();
|
|
547 |
|
|
548 |
<font color=#3F5FBF>/**
|
|
549 |
* Get context size in bytes.
|
|
550 |
* Byte arrays in get()/set() methods should be same size.
|
|
551 |
* Hardware register can be smaller then this size, for example in case
|
|
552 |
* when register size is not an even number of bytes. In such case implementation
|
|
553 |
* should add/remove padding that consists of necessary number of zero bits.
|
|
554 |
* @return context size in bytes.
|
|
555 |
*/</font>
|
|
556 |
<font color=#7F0055>int</font> getSize();
|
|
557 |
|
|
558 |
<font color=#3F5FBF>/**
|
|
559 |
* Check if context value can be read.
|
|
560 |
* <font color=#7F9FBF>@return</font> true if can read value of the context.
|
|
561 |
*/</font>
|
|
562 |
<font color=#7F0055>boolean</font> isReadable();
|
|
563 |
|
|
564 |
<font color=#3F5FBF>/**
|
|
565 |
* Check if reading the context (register) destroys its current value -
|
|
566 |
* it can be read only once.
|
|
567 |
* <font color=#7F9FBF>@return</font> true if read-once register.
|
|
568 |
*/</font>
|
|
569 |
<font color=#7F0055>boolean</font> isReadOnce();
|
|
570 |
|
|
571 |
<font color=#3F5FBF>/**
|
|
572 |
* Check if context value can be written.
|
|
573 |
* <font color=#7F9FBF>@return</font> true if can write value of the context.
|
|
574 |
*/</font>
|
|
575 |
<font color=#7F0055>boolean</font> isWriteable();
|
|
576 |
|
|
577 |
<font color=#3F5FBF>/**
|
|
578 |
* Check if register value can not be overwritten - every write counts.
|
|
579 |
* <font color=#7F9FBF>@return</font> true if write-once register.
|
|
580 |
*/</font>
|
|
581 |
<font color=#7F0055>boolean</font> isWriteOnce();
|
|
582 |
|
|
583 |
<font color=#3F5FBF>/**
|
|
584 |
* Check if writing the context can change values of other registers.
|
|
585 |
* <font color=#7F9FBF>@return</font> true if has side effects.
|
|
586 |
*/</font>
|
|
587 |
<font color=#7F0055>boolean</font> hasSideEffects();
|
|
588 |
|
|
589 |
<font color=#3F5FBF>/**
|
|
590 |
* Check if the register value can change even when target is stopped.
|
|
591 |
* <font color=#7F9FBF>@return</font> true if the register value can change at any time.
|
|
592 |
*/</font>
|
|
593 |
<font color=#7F0055>boolean</font> isVolatile();
|
|
594 |
|
|
595 |
<font color=#3F5FBF>/**
|
|
596 |
* Check if the register value is a floating-point value.
|
|
597 |
* <font color=#7F9FBF>@return</font> true if a floating-point register.
|
|
598 |
*/</font>
|
|
599 |
<font color=#7F0055>boolean</font> isFloat();
|
|
600 |
|
|
601 |
<font color=#3F5FBF>/**
|
|
602 |
* Check endianess of the context.
|
|
603 |
* Big endian means decreasing numeric significance with increasing bit number.
|
|
604 |
* <font color=#7F9FBF>@return</font> true if big endian.
|
|
605 |
*/</font>
|
|
606 |
<font color=#7F0055>boolean</font> isBigEndian();
|
|
607 |
|
|
608 |
<font color=#3F5FBF>/**
|
|
609 |
* Check if the lowest numbered bit (i.e. bit #0 or bit #1 depending on
|
|
610 |
* getFirstBitNumber() value) should be shown to user as the left-most bit or
|
|
611 |
* the right-most bit.
|
|
612 |
* <font color=#7F9FBF>@return</font> true if the first bit is left-most bit.
|
|
613 |
*/</font>
|
|
614 |
<font color=#7F0055>boolean</font> isLeftToRight();
|
|
615 |
|
|
616 |
<font color=#3F5FBF>/**
|
|
617 |
* If the context has bit field children, bit positions of the fields
|
|
618 |
* can be zero-based or 1-based.
|
|
619 |
* <font color=#7F9FBF>@return</font> first bit position - 0 or 1.
|
|
620 |
*/</font>
|
|
621 |
<font color=#7F0055>int</font> getFirstBitNumber();
|
|
622 |
|
|
623 |
<font color=#3F5FBF>/**
|
|
624 |
* If context is a bit field, get the field bit numbers in parent context.
|
|
625 |
* <font color=#7F9FBF>@return</font> array of bit numbers.
|
|
626 |
*/</font>
|
|
627 |
<font color=#7F0055>int</font>[] getBitNumbers();
|
|
628 |
|
|
629 |
<font color=#3F5FBF>/**
|
|
630 |
* A context can have predefined names (mnemonics) for some its values.
|
|
631 |
* This method returns a list of such named values.
|
|
632 |
* <font color=#7F9FBF>@return</font> array of named values or null.
|
|
633 |
*/</font>
|
|
634 |
NamedValue[] getNamedValues();
|
|
635 |
|
|
636 |
<font color=#3F5FBF>/**
|
|
637 |
* Get the address of a memory mapped register.
|
|
638 |
* <font color=#7F9FBF>@return</font> address.
|
|
639 |
*/</font>
|
|
640 |
Number getMemoryAddress();
|
|
641 |
|
|
642 |
<font color=#3F5FBF>/**
|
|
643 |
* Get the context ID of a memory context in which a memory mapped register is located.
|
|
644 |
* <font color=#7F9FBF>@return</font> memory context ID.
|
|
645 |
*/</font>
|
|
646 |
String getMemoryContext();
|
|
647 |
|
|
648 |
<font color=#3F5FBF>/**
|
|
649 |
* Get a list of property names which can be searched for starting on this context
|
|
650 |
* <font color=#7F9FBF>@return</font> collection of property names.
|
|
651 |
*/</font>
|
|
652 |
Collection<String> canSearch();
|
|
653 |
|
|
654 |
<font color=#3F5FBF>/**
|
|
655 |
* Get the role the register plays in a program execution.
|
|
656 |
* <font color=#7F9FBF>@return</font> role name.
|
|
657 |
*/</font>
|
|
658 |
String getRole();
|
|
659 |
|
|
660 |
<font color=#3F5FBF>/**
|
|
661 |
* Get complete map of context properties.
|
|
662 |
* <font color=#7F9FBF>@return</font> map of all available context properties.
|
|
663 |
*/</font>
|
|
664 |
Map<String,Object> getProperties();
|
|
665 |
|
|
666 |
<font color=#3F5FBF>/**
|
|
667 |
* Read value of the context.
|
|
668 |
* <font color=#7F9FBF>@param</font> done - call back object.
|
|
669 |
* <font color=#7F9FBF>@return</font> - pending command handle.
|
|
670 |
*/</font>
|
|
671 |
IToken get(DoneGet done);
|
|
672 |
|
|
673 |
<font color=#3F5FBF>/**
|
|
674 |
* Set value of the context.
|
|
675 |
* <font color=#7F9FBF>@param</font> value - value to write into the context.
|
|
676 |
* <font color=#7F9FBF>@param</font> done - call back object.
|
|
677 |
* <font color=#7F9FBF>@return</font> - pending command handle.
|
|
678 |
*/</font>
|
|
679 |
IToken set(byte[] value, DoneSet done);
|
|
680 |
|
|
681 |
<font color=#3F5FBF>/**
|
|
682 |
* Search register contexts that passes given search filter.
|
|
683 |
* Search is only supported for properties listed in the "CanSearch" property.
|
|
684 |
* <font color=#7F9FBF>@param</font> filter - properties bag that defines search filter.
|
|
685 |
* <font color=#7F9FBF>@param</font> done - call back object.
|
|
686 |
* <font color=#7F9FBF>@return</font> - pending command handle.
|
|
687 |
*/</font>
|
|
688 |
IToken search(Map<String,Object> filter, DoneSearch done);
|
|
689 |
}
|
|
690 |
|
|
691 |
<font color=#3F5FBF>/**
|
|
692 |
* A register context can have predefined names (mnemonics) for some its values.
|
|
693 |
* NamedValue objects represent such values.
|
|
694 |
*/</font>
|
|
695 |
<font color=#7F0055>interface</font> NamedValue {
|
|
696 |
<font color=#3F5FBF>/**
|
|
697 |
* Get value associated with the name.
|
|
698 |
* <font color=#7F9FBF>@return</font> the value as an array of bytes.
|
|
699 |
*/</font>
|
|
700 |
byte[] getValue();
|
|
701 |
|
|
702 |
<font color=#3F5FBF>/**
|
|
703 |
* Get name (mnemonic) of the value.
|
|
704 |
* <font color=#7F9FBF>@return</font> value name.
|
|
705 |
*/</font>
|
|
706 |
String getName();
|
|
707 |
|
|
708 |
<font color=#3F5FBF>/**
|
|
709 |
* Get human readable description of the value.
|
|
710 |
* <font color=#7F9FBF>@return</font> value description.
|
|
711 |
*/</font>
|
|
712 |
String getDescription();
|
|
713 |
}
|
|
714 |
|
|
715 |
<font color=#3F5FBF>/**
|
|
716 |
* Read values of multiple locations in registers.
|
|
717 |
* <font color=#7F9FBF>@param</font> locs - array of data locations.
|
|
718 |
* <font color=#7F9FBF>@param</font> done - call back object.
|
|
719 |
* <font color=#7F9FBF>@return</font> - pending command handle.
|
|
720 |
*/</font>
|
|
721 |
IToken getm(Location[] locs, DoneGet done);
|
|
722 |
|
|
723 |
<font color=#3F5FBF>/**
|
|
724 |
* Set values of multiple locations in registers.
|
|
725 |
* <font color=#7F9FBF>@param</font> locs - array of data locations.
|
|
726 |
* <font color=#7F9FBF>@param</font> value - value to write into the context.
|
|
727 |
* <font color=#7F9FBF>@param</font> done - call back object.
|
|
728 |
* <font color=#7F9FBF>@return</font> - pending command handle.
|
|
729 |
*/</font>
|
|
730 |
IToken setm(Location[] locs, byte[] value, DoneSet done);
|
|
731 |
|
|
732 |
<font color=#3F5FBF>/**
|
|
733 |
* Class Location represents value location in register context
|
|
734 |
*/</font>
|
|
735 |
<font color=#7F0055>final class</font> Location {
|
|
736 |
<font color=#3F5FBF>/** Register context ID */</font>
|
|
737 |
<font color=#7F0055>public final</font> String id;
|
|
738 |
|
|
739 |
<font color=#3F5FBF>/** offset in the context, in bytes */</font>
|
|
740 |
<font color=#7F0055>public final int</font> offs;
|
|
741 |
|
|
742 |
<font color=#3F5FBF>/** value size in bytes */</font>
|
|
743 |
<font color=#7F0055>public final int</font> size;
|
|
744 |
|
|
745 |
<font color=#7F0055>public</font> Location(String id, <font color=#7F0055>int</font> offs, <font color=#7F0055>int</font> size) {
|
|
746 |
<font color=#7F0055>this</font>.id = id;
|
|
747 |
<font color=#7F0055>this</font>.offs = offs;
|
|
748 |
<font color=#7F0055>this</font>.size = size;
|
|
749 |
}
|
|
750 |
}
|
|
751 |
|
|
752 |
<font color=#3F5FBF>/**
|
|
753 |
* 'get' command call back interface.
|
|
754 |
*/</font>
|
|
755 |
<font color=#7F0055>interface</font> DoneGet {
|
|
756 |
<font color=#3F5FBF>/**
|
|
757 |
* Called when value retrieval is done.
|
|
758 |
* <font color=#7F9FBF>@param</font> token - command handle
|
|
759 |
* <font color=#7F9FBF>@param</font> error - error description if operation failed, null if succeeded.
|
|
760 |
* <font color=#7F9FBF>@param</font> value - context value as array of bytes.
|
|
761 |
*/</font>
|
|
762 |
<font color=#7F0055>void</font> doneGet(IToken token, Exception error, byte[] value);
|
|
763 |
}
|
|
764 |
|
|
765 |
<font color=#3F5FBF>/**
|
|
766 |
* 'set' command call back interface.
|
|
767 |
*/</font>
|
|
768 |
<font color=#7F0055>interface</font> DoneSet {
|
|
769 |
<font color=#3F5FBF>/**
|
|
770 |
* Called when value setting is done.
|
|
771 |
* <font color=#7F9FBF>@param</font> token - command handle.
|
|
772 |
* <font color=#7F9FBF>@param</font> error - error description if operation failed, null if succeeded.
|
|
773 |
*/</font>
|
|
774 |
<font color=#7F0055>void</font> doneSet(IToken token, Exception error);
|
|
775 |
}
|
|
776 |
|
|
777 |
<font color=#3F5FBF>/**
|
|
778 |
* 'search' command call back interface.
|
|
779 |
*/</font>
|
|
780 |
<font color=#7F0055>interface</font> DoneSearch {
|
|
781 |
<font color=#3F5FBF>/**
|
|
782 |
* Called when context search is done.
|
|
783 |
* <font color=#7F9FBF>@param</font> token - command handle.
|
|
784 |
* <font color=#7F9FBF>@param</font> error - error description if operation failed, null if succeeded.
|
|
785 |
* <font color=#7F9FBF>@param</font> paths - array of paths to each context with properties matching the filter
|
|
786 |
*/</font>
|
|
787 |
<font color=#7F0055>void</font> doneSearch(IToken token, String[][] paths);
|
|
788 |
}
|
|
789 |
|
|
790 |
<font color=#3F5FBF>/**
|
|
791 |
* Add registers service event listener.
|
|
792 |
* <font color=#7F9FBF>@param</font> listener - event listener implementation.
|
|
793 |
*/</font>
|
|
794 |
<font color=#7F0055>void</font> addListener(RegistersListener listener);
|
|
795 |
|
|
796 |
<font color=#3F5FBF>/**
|
|
797 |
* Remove registers service event listener.
|
|
798 |
* <font color=#7F9FBF>@param</font> listener - event listener implementation.
|
|
799 |
*/</font>
|
|
800 |
<font color=#7F0055>void</font> removeListener(RegistersListener listener);
|
|
801 |
|
|
802 |
<font color=#3F5FBF>/**
|
|
803 |
* Registers event listener is notified when registers context hierarchy
|
|
804 |
* changes, and when a register is modified by the service commands.
|
|
805 |
*/</font>
|
|
806 |
<font color=#7F0055>interface</font> RegistersListener {
|
|
807 |
|
|
808 |
<font color=#3F5FBF>/**
|
|
809 |
* Called when register context properties changed.
|
|
810 |
* Most targets have static set of registers and register properties.
|
|
811 |
* Such targets never generate this event. However, some targets,
|
|
812 |
* for example, JTAG probes, allow user to modify register definitions.
|
|
813 |
* Clients should flush all cached register context data.
|
|
814 |
*/</font>
|
|
815 |
<font color=#7F0055>void</font> contextChanged();
|
|
816 |
|
|
817 |
<font color=#3F5FBF>/**
|
|
818 |
* Called when register content was changed and clients
|
|
819 |
* need to update themselves. Clients, at least, should invalidate
|
|
820 |
* corresponding cached registers data.
|
|
821 |
* Not every change is notified - it is not possible,
|
|
822 |
* only those, which are not caused by normal execution of the debuggee.
|
|
823 |
* At least, changes caused by "set" command should be notified.
|
|
824 |
* <font color=#7F9FBF>@param</font> id - register context ID.
|
|
825 |
*/</font>
|
|
826 |
<font color=#7F0055>void</font> registerChanged(String context_id);
|
|
827 |
}
|
|
828 |
}
|
|
829 |
</pre>
|
|
830 |
|
|
831 |
</body>
|
|
832 |
</html>
|