]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/rdi-share/adp.h
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / gdb / rdi-share / adp.h
1 /*
2 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
3 *
4 * This software may be freely used, copied, modified, and distributed
5 * provided that the above copyright notice is preserved in all copies of the
6 * software.
7 */
8
9 /* -*-C-*-
10 *
11 * $Revision$
12 * $Date$
13 *
14 *
15 *
16 * INTRODUCTION
17 * ------------
18 * The early RDP message definitions were held in an ARM Ltd "armdbg"
19 * source file. Since the relevant header files were not exported
20 * publicly as part of an ARM Ltd core tools release, it was a problem
21 * for developers manipulating the target side of the protocol.
22 *
23 * For Angel, this new (ANSI 'C' clean) header file defines the ADP
24 * protocol. The header should be useable by both host and target
25 * systems, thus avoiding problems that can arise from duplicate
26 * definitions. Care has been taken in the construction of this header
27 * file to avoid any host/target differences.
28 *
29 * MESSAGE FORMAT
30 * --------------
31 * Format of the "data" section of debug and boot agent messages. This is
32 * the standard ADP (Angel Debug Protocol) message format:
33 *
34 * unsigned32 reason - Main debug reason code.
35 * unsigned32 debugID - Information describing host debug world;
36 * - private to host and used in any target initiated
37 * messages.
38 * unsigned32 OSinfo1 \ Target OS information to identify process/thread
39 * unsigned32 OSinfo2 / memory/world, etc. These two fields are target
40 * defined.
41 * byte args[n] - Data for message "reason" code.
42 *
43 * NOTE: The message format is the same for single threaded debugging,
44 * except that the "OSinfo" fields should be -1 (0xFFFFFFFF). Even
45 * single-threaded debugging *MAY* have different host specified
46 * debugID values, so the Angel debug system will preserve the "debugID"
47 * information for replies, and the relevant asynchronous target-to-host
48 * messages. The "debugID" is defined by the host-end of the
49 * protocol, and is used by the host to ensure that messages are
50 * routed to the correct handler program/veneer.
51 *
52 * The reason there are two target specified "OSinfo" words is because
53 * thread identifiers may not be unique when processes/tasks have
54 * private virtual address spaces. It allows more flexibility when
55 * supporting multi-threaded or O/S aware debugging.
56 *
57 * NOTE: The reason that there is no "size" information, is that the
58 * message IDs themselves encode the format of any arguments. Also it
59 * would be a duplication of information used by the physical
60 * transport layer (which is distinct from this logical message
61 * layer). Any routing of messages through programs, hosts,
62 * etc. should be performed at the physical layer, or the boundaries
63 * between physical layers. i.e. packet received on socket in host,
64 * and transferred to serial packet for passing on down the line.
65 *
66 * NOTE: Pointers aren't passed in messages because they are dangerous in
67 * a multi-threaded environment.
68 *
69 * ADP REASON CODE
70 * ---------------
71 * The message reason codes contain some information that ties them to
72 * the channel and direction that the message will be used with. This
73 * will ensure that even if the message "#define name" is not
74 * completely descriptive, the message reason code is.
75 *
76 * b31 = direction. 0=Host-to-Target; 1=Target-to-Host;
77 * b30-28 = debug agent multi-threaded control (see below)
78 * b27-24 = reserved. should be zero.
79 * b23-16 = channelid. The fixed Angel channel number
80 * (see "channels.h").
81 * b15-0 = message reason code.
82 *
83 * It is unfortunate that to aid the error-checking capabilities of
84 * the Angel communications we have changed the message numbers from
85 * the original ARM Ltd RDP. However this also has benefits, in that
86 * the Angel work is meant to be a clean break.
87 *
88 * However, it isn't so bad since even though the numbers are
89 * different, the majority of the reason codes have exactly the same
90 * functionality as the original RDP messages.
91 *
92 * NOTES
93 * -----
94 * It would be ideal to use "rpcgen" (or some equivalent) to
95 * automatically maintain compatibility between the target and host
96 * ends of the protocol. However, ARM Ltd expressed that the message
97 * handling should be hand-coded, to avoid dependance on external
98 * tools.
99 *
100 * All other channels have undefined data formats and are purely
101 * application defined. The C library "_sys_" support will provide a
102 * veneer to perform message block operations as required.
103 *
104 * It is IMPLIED that all of the ADP messages will fit within the
105 * buffer DATASIZE. This has a minimum value, calculated from
106 * BUFFERMINSIZE.
107 *
108 * All messages are passed and received to the channel system in little
109 * endian order (ie. use little endian order when writing a word as
110 * a sequence of bytes within a message).
111 *
112 * A reply / acknowledgement to an ADP message is always sent and has the
113 * same reason code as the original except that the TtoH / HtoT bit is
114 * reversed. This makes it simple to check that the reply really
115 * is a reply to the message which was just sent! [Boot Channel messages
116 * also require that this protocol is used].
117 */
118
119 #ifndef angel_adp_h
120 #define angel_adp_h
121
122 #include "chandefs.h"
123
124
125 /*
126 * Buffer minimum sizes
127 */
128
129 /* the minimum target internal size */
130 #define ADP_BUFFER_MIN_SIZE (256)
131
132 /* a word is always reserved for internal use in the target */
133 #define ADP_BUFFER_MAX_INTERNAL (sizeof(word))
134
135 /* the minimum available data portion */
136 #define ADP_BUFFER_MIN_DATASIZE \
137 (ADP_BUFFER_MIN_SIZE - ADP_BUFFER_MAX_INTERNAL - CHAN_HEADER_SIZE)
138
139 /*
140 * the space taken up by the standard ADP header
141 * (reason, debugID, OSinfo1, OSinfo2)
142 */
143 #define ADP_DEFAULT_HEADER_SIZE (4*sizeof(word))
144
145
146 /* 8bit ADP version identification */
147 #define ADPVSN (0x03)
148 /* This value can be used to identify the protocol version supported
149 * by target or host systems. This version number should only be
150 * changed if the protocol undergoes a non-backward compatible
151 * change. It should *NOT* be used to reflect extensions to the
152 * protocol. Such extensions can be added to the existing protocol
153 * version by allocating new reason codes, and by extending the
154 * ADP_Info message to identify new features.
155 */
156
157 /* The following value is used in the OSinfo fields for
158 * single-threaded messages, or where the host wants to alter the
159 * global CPU state. NOTE: The "debugID" field should always be
160 * defined by the host, and returned in target initiated messages. The
161 * only exception to this rule is the ADP_Booted message at the
162 * start-of-day.
163 */
164 #define ADP_HandleUnknown (-1)
165
166 /******************************************************************
167 *
168 * ADP reason code subfields
169 *
170 */
171
172 /* The following bits are used to describe the basic direction of
173 * messages. This allows some extra checking of message validity to be
174 * performed, as well as providing a description of the message that
175 * may not be available in the "cpp" macro:
176 */
177 #define HtoT ((unsigned)0 << 31) /* Host-to-Target message */
178 #define TtoH ((unsigned)1 << 31) /* Target-to-Host message */
179
180 /* The following bits are used to control how the target system
181 * executes whilst processing messages. This allows for O/S specific
182 * host-based debug programs to interrogate system structures whilst
183 * ensuring that the access is atomic within the constraints imposed
184 * by the target O/S.
185 *
186 * NOTE: That only the channel is inserted into the reason code
187 * automatically. Thus both direction and multi thread control bits
188 * must be added by the host / target.
189 */
190 /* Disable FIQ whilst processing message */
191 #define DisableFIQ (1 << 30)
192 /* Disable IRQ whilst processing message */
193 #define DisableIRQ (1 << 29)
194 /* Disable O/S pre-emption whilst processing message */
195 #define DisablePreemption (1 << 28)
196
197 /* The channel identification number is held in the reason code as a
198 * check:
199 */
200 #define ADPCHANNEL(b) (((b) & 0xFF) << 16)
201
202 /* The following macro constructs the reason code number, from the
203 * various fields - note that the direction is NOT inlcuded since
204 * this depends on whether the Host or Target system is including
205 * this file!
206 */
207 #define ADPREASON(c,r) (ADPCHANNEL(c) | ((r) & 0xFFFF))
208
209 /* This macros is used when constructing manifests for sub-reason
210 * codes. At the moment it is identical to the main reason macro. If
211 * desired we could add a new bit that explicitly identifies the value
212 * as a sub-reason code, where the corresponding bit in the main
213 * message ID would be zero.
214 */
215 #define ADPSUBREASON(c,r) (ADPCHANNEL(c) | ((r) & 0xFFFF))
216
217 /* All other undefined bits are reserved, and should be zero. */
218
219
220
221 /*****************************************************************
222 *
223 * channel_BOOT messages
224 *
225 */
226
227 /* The BOOT agent only supports a few messages. They are used purely
228 * to control the "start-of-day" connection to a host program. All
229 * Angel systems with host communications *MUST* provide the BOOT
230 * agent, even if they don't have support for either the single- or
231 * multi-threaded debug agents.
232 *
233 * The way the BOOT channel will be used on startup will be as follows:
234 *
235 * a) Target board is powered up before host debugger is invoked
236 *
237 * After switching on the target and initialisation is completed the
238 * target will send an ADP_Booted or ADP_Reset message. The debugger
239 * has not been started yet so this message will not be received. In
240 * a serial world this makes it important that any buffers on the host
241 * side are flushed during initialisation of the debugger, and in an
242 * Ethernet world it makes it important that the target can cope with the
243 * message not being received.
244 *
245 * Eventually the Debugger will be started up and will send an
246 * ADP_Reboot or ADP_Reset request. The target will respond to this with
247 * an ADP_Reboot or ADP_Reset acknowldege and will then reboot, finally
248 * sending an ADP_Rebooted when it has done all it needs to do (very little
249 * in the case of ADP_Reset, but completely rebooting in the case of
250 * ADP_Reboot). Note that it is important that an ADP_Rebooted message is
251 * sent so that the Debugger does not attempt to send any data after it has
252 * made a request to ADP_Reboot and before it receives an ADP_Rebooted, as
253 * data can be lost be the target during this time.
254 *
255 * The target and host are now ready to start a debug session.
256 *
257 * b) Target board is powered up after host debugger is invoked
258 *
259 * The debugger will send an ADP_Reboot or ADP_Reset request, but will
260 * receive no reply until the target is powered up.
261 / *
262 * When the target is powered up then it will send an ADP_Rebooted
263 * message to the debugger. The debugger should accept this message
264 * even though it has received no ADP_Reboot or ADP_Reset acknowldege message
265 * from the target.
266 *
267 * The target and host are now ready to start a debug session.
268 *
269 *
270 * If at any point during the bootup sequence and ADP messages are
271 * sent down the S_DBG channel then they should be responded to with a
272 * RDI_NotInitialised error. [This should never happen however].
273 *
274 * An ADP_Boot or ADP Rebooted message should be accepted at
275 * any point, since it is possible for a catastrophe to occur (such as
276 * disconnecteing the host and target during a debug message) which
277 * requires that one or other end be reset.
278 *
279 */
280
281 /*
282 * A list of parameter types - for now just baud rate
283 */
284 typedef enum ADP_Parameter {
285 AP_PARAMS_START = 0xC000,
286 AP_BAUD_RATE = AP_PARAMS_START,
287 /* extra parameters go in here */
288 #ifdef TEST_PARAMS
289 AP_CAFE_MENU, /* extra just for testing */
290 #endif
291 AP_PARAMS_END
292 } ADP_Parameter;
293
294 #define AP_NUM_PARAMS (AP_PARAMS_END - AP_PARAMS_START)
295
296 /*
297 * Parameter types should have associated semantics which can be represented
298 * within one word per parameter, or an associated enum for choices.
299 *
300 * AP_BAUD_RATE: the word contains the exact baud rate, eg. 9600, 38400.
301 */
302
303 /* this is not strictly necessary, but it's an example */
304 typedef enum ADP_BaudRate {
305 AB_9600 = 9600,
306 AB_19200 = 19200,
307 AB_38400 = 38400,
308 AB_57600 = 57600,
309 AB_115200 = 115200
310 } ADP_BaudRate;
311
312 #define AB_NUM_BAUD_RATES 5 /* this is more useful, for sizing arrays */
313
314 /* This must be set to the max number of options per parameter type */
315 #define AP_MAX_OPTIONS (AB_NUM_BAUD_RATES)
316
317
318 #define ADP_Booted ADPREASON(CI_TBOOT,0)
319 /* This message is sent by the target after the Angel system has been
320 * initialised. This message also contains information describing the
321 * Angel world. The information can then be used to check that the
322 * target debug agent and source debugger are compatible.
323 *
324 * Message arguments:
325 * word Angel message default buffer size.
326 * word Angel message large buffer size (may be same as default)
327 * word Angel version ; inc. type (e.g. boot ROM) See (1)
328 * word ADP version. See (2)
329 * word ARM Architecture info See (3)
330 * word ARM CPU information ; including target endianness. See (4)
331 * word Target hardware status. See (5)
332 * word Number of bytes in banner message
333 * bytes Startup banner message (single-threaded readable
334 * descriptive text - NOT NULL terminated).
335 *
336 * Reply:
337 * word status
338 *
339 * 'status' returns RDIError_NoError for success, and otherwise
340 * indicates an error.
341 */
342
343 /* Angel version word [Reference(1)] : */
344 /* Angel version number is a 16bit BCD value */
345 #define ADP_ANGELVSN_MASK (0x0000FFFF)
346 #define ADP_ANGELVSN_SHIFT (0)
347
348 /* Type of Angel system */
349 #define ADP_ANGELVSN_TYPE_MASK (0x00FF0000)
350 #define ADP_ANGELVSN_TYPE_SHIFT (16)
351
352 typedef enum {
353 ADP_AngelType_bootROM, /* Simple ROM system providing download capability */
354 ADP_AngelType_appROM, /* ROM based application */
355 ADP_AngelType_appDLOAD,/* Downloaded Angel based application */
356 ADP_AngelType_Last /* Unknown type. This typedef can be extended */
357 /* but if the host and target vsns differ */
358 /* Then one will spot that it dies not understand */
359 } ADP_Angel_Types ; /* this field and can whinge appropriately */
360
361 /* First unknown ADP_AngelType */
362 #define ADP_ANGELVSN_UNKTYPE_MASK (0xFF000000)
363 #define ADP_ANGELVSN_UNKYPE_SHIFT (24)
364
365 /* Currently only 8 bits are used in the word: */
366 /* ADP protocol supported by target [Reference (2)] */
367 #define ADP_ANGELVSN_ADP_MASK (0x000000FF)
368 #define ADP_ANGELVSN_ADP_SHIFT (0)
369
370 /* ARM Architecture info: [Reference (3)] */
371 /* ARM Architecture Verson of target CPU */
372 #define ADP_ARM_ARCH_VSN_MASK (0x000000FF)
373 #define ADP_ARM_ARCH_VSN_SHIFT (0)
374 /* Does the processor support the Thumb Instruction Set */
375 #define ADP_ARM_ARCH_THUMB (0x80000000)
376 /* Does the processor support Long Multiplies */
377 #define ADP_ARM_ARCH_LONGMUL (0x40000000)
378 /* All other flags are current undefined, and should be zero. */
379
380 /* The following flags describe the feature set of the processor: */
381 /* Set if cpu supports little-endian model [Reference (4)] */
382 #define ADP_CPU_LE (1 << 0)
383 /* Set if cpu supports big-endian model */
384 #define ADP_CPU_BE (1 << 1)
385 /* Set if processor has a cache */
386 #define ADP_CPU_CACHE (1 << 2)
387 /* Set if processor has a MMU */
388 #define ADP_CPU_MMU (1 << 3)
389 /* All other flags are current undefined, and should be zero. */
390
391 /* The following flags reflect current Target hardware status: */
392 /* [Reference (5)] */
393 /* 0 = no MMU or MMU off; 1 = MMU on */
394 #define ADP_CPU_MMUOn (1 << 29)
395 /* 0 = no cache or cache off; 1 = cache on */
396 #define ADP_CPU_CacheOn (1 << 30)
397 /* 0 = little-endian; 1 = big-endian */
398 #define ADP_CPU_BigEndian (1U << 31)
399 /* All other flags are current undefined, and should be zero. */
400
401
402 #ifdef LINK_RECOVERY
403
404 #define ADP_TargetResetIndication ADPREASON(CI_TBOOT, 1)
405 /*
406 * If parameter negotiation is enabled at the target, it configures itself
407 * to various likely parameter settings and sends this message at each
408 * configuration. The message describes the default settings, and after
409 * sending at each configuration the target sets itself to the defaults
410 * it has just broadcast, to await either an ack on TBOOT or a request
411 * or reset indication on HBOOT.
412 *
413 * If the host receives this message successfully, it should reset to the
414 * indicated parameters and send a reply.
415 *
416 * Message arguments:
417 * word status (always 0, makes body same as
418 * ADP_ParamNegotiate response)
419 * word n-parameters
420 * n-parameters * {
421 * word ADP_Parameter
422 * word parameter-value
423 * }
424 *
425 * Reply:
426 * - empty acknowledgement
427 */
428
429 #endif /* def LINK_RECOVERY */
430
431 typedef enum ADP_Boot_Ack {
432 AB_NORMAL_ACK, /* will comply, immediate booted message */
433 AB_LATE_ACK, /* will comply, late startup */
434 AB_ERROR /* cannot comply */
435 } ADP_Boot_Ack;
436
437 /* If the host sets neither of these in the word sent on a Reset / Reboot
438 * then it doesn;t care about the endianess of the target
439 */
440 #define ADP_BootHostFeature_LittleEnd 0x80000000
441 #define ADP_BootHostFeature_BigEnd 0x40000000
442
443 #define ADP_Reboot ADPREASON(CI_HBOOT,2)
444 /* This message is sent when the host wants the target system to be
445 * completely reset, back to the boot monitor Angel. This is the
446 * method of the host forcing a cold-reboot.
447 * Note that an acknowledgement message will be sent immediately and
448 * that this must be sent before the target can reset.
449 *
450 * The parameter to this function is a bitset of host supported
451 * features. (in fact the same as ADP_Reset below. This can be used by
452 * the target system to avoid using debug channel bandwidth raising
453 * messages that will be ignored by the host.
454 *
455 * Parameters:
456 * word host supported features (see above)
457 *
458 * Reply:
459 * word status, one of enum ADP_Boot_Ack above.
460 *
461 * Currently there are no such features defined, so the word indicating
462 * host supported features should be set to 0.
463 */
464
465
466
467 #define ADP_Reset ADPREASON(CI_HBOOT,3)
468 /* This message is a request from the host, which should eventually
469 * result in the "ADP_Booted" message being sent by the target.
470 * Note that an acknowledgement message will be sent immediately and
471 * that this must be sent before the target can reset.
472 * This reset message is *ALWAYS* treated as a warm boot, with the target
473 * preserving as much state as possible.
474 *
475 * The parameter to this function is a bitset of host supported
476 * features. This can be used by the target system to avoid using
477 * debug channel bandwitdth raising messages that will be ignored by
478 * the host.
479 *
480 * Parameters:
481 * word host supported features (see above)
482 *
483 * Reply:
484 * word status, one of enum ADP_Boot_Ack above.
485 *
486 * Currently there are no such features defined, so the word indicating
487 * host supported features should be set to 0.
488 */
489
490
491 #ifdef LINK_RECOVERY
492
493 #define ADP_HostResetIndication ADPREASON(CI_HBOOT, 4)
494 /*
495 * This is as for ADP_TargetResetIndication, but is sent by the host when
496 * it first starts up in case the target is listening at a non-default
497 * setting. Having sent at various configurations, the host then listens
498 * at the defaults it has just broadcast, to await either an ack on HBOOT
499 * or a reset indication on TBOOT.
500 *
501 * For arguments and reply, see ADP_TargetResetIndication.
502 */
503
504 #endif /* def LINK_RECOVERY */
505
506
507 #define ADP_ParamNegotiate ADPREASON(CI_HBOOT, 5)
508 /*
509 * The host sends this messages to negotiate new parameters with the target.
510 * For each parameter the host specifies a range of possibilities, starting
511 * with the most favoured. All possible combinations of parameters
512 * must be valid.
513 *
514 * If the target can operate at a combination of the offered parameters,
515 * it will reply with the parameters it is willing to use. AFTER sending
516 * the reply, the target switches to this combination. On receiving the
517 * reply, the host will switch to the new combination and send a LinkCheck
518 * message (see below).
519 *
520 * If the target cannot operate at any combination of the offered parameters,
521 * it will reply with an error status.
522 *
523 * Message arguments:
524 * word n-parameter-blocks
525 * n-parameter-blocks * {
526 * word ADP_Parameter
527 * word n-options
528 * n-options * { word parameter-value }
529 * }
530 *
531 * Reply:
532 * word status
533 * if (status == RDIError_NoError) {
534 * word n-parameters
535 * n-parameters * {
536 * word ADP_Parameter
537 * word chosen-value
538 * }
539 * }
540 */
541
542 #define ADP_LinkCheck ADPREASON(CI_HBOOT, 6)
543 /*
544 * This should be the first message that the host sends after a successful
545 * parameter negotiation. It is really just a 'ping'.
546 *
547 * Message arguments:
548 * - empty message
549 *
550 * Reply:
551 * - empty acknowledgement
552 */
553
554
555 /********************************************************************
556 *
557 * CI_HADP messages
558 *
559 */
560
561 #define ADP_HADPUnrecognised ADPREASON(CI_HADP,0)
562 /* This message is unusual in that it is normally sent in reply to
563 * another message which is not understood. This is an exception
564 * to the normal protocol which says that a reply must have the
565 * same base reason code as the original. There is a single reply
566 * parameter which is the reason code which was not understood.
567 *
568 * As well as being a reply this message can also be sent and will
569 * return as if this message were unrecognised!
570 *
571 * Parameters:
572 * none
573 *
574 * Reply:
575 * word reason code which was not recognised
576 */
577
578
579 #define ADP_Info ADPREASON(CI_HADP,1)
580 /* This is the new ADP information message. It is used to interrogate
581 * the target debug agent. It provides information on the processor,
582 * as well as the state of the debug world. This allows the host to
583 * configure itself to the capabilities of the target.
584 *
585 * We try not to use feature bitsets, since we could quickly run out
586 * of known bits. Thus when the feature set is extended, this can be
587 * done in a couple of supported ways:
588 *
589 * If an undivided reason code is to be added (no reason subcodes)
590 * then add a new ADP_Info code which responds with a flag indicating
591 * whether that feature is supported by the target. If this has not
592 * even been implemented then the reply will be ADP_HADPUnrecognised
593 *
594 * If a reason code which is subdivided into reason subcodes is
595 * added then reason subcode 0 should be set aside to indicate
596 * whether the functionality of that reason code is supported
597 * by the target. If it is not even implemented then the reply will
598 * be ADP_Unrecognised.
599 *
600 * The first parameter to ADP_Info is a reason subcode, and subsequent
601 * parameters are defined by that subcode
602 *
603 * Parameters:
604 * word reason subcode
605 * other arguments as reason subcode determines.
606 *
607 * Reply:
608 * word reason subcode
609 * other argument as reason subcode determines
610 */
611
612 /* ADP_Info reason subcodes: */
613
614
615
616 #define ADP_Info_NOP ADPSUBREASON(CI_HADP,0)
617 /* ADP_Info_NOP
618 * ------------
619 * Summary: This message is used to check for ADP_Info being supported.
620 *
621 * Arguments:
622 * Send: ()
623 * Return: (word status)
624 *
625 * 'status' returns RDIError_NoError for success, non-zero indicates an error.
626 * If an error is returned then there is no handler for the ADP_Info
627 * message. The normal action will be to return an OK status.
628 */
629
630
631 #define ADP_Info_Target ADPSUBREASON(CI_HADP,1)
632 /* ADP_Info_Target
633 * ---------------
634 * Summary:
635 * This reason code is used to interrogate target system details.
636 *
637 * Arguments:
638 * Send: ()
639 * Return: (word status, word bitset, word model)
640 *
641 * 'status' is RDIError_NoError to indicate OK, or non-zero to indicate
642 * some sort of error.
643 * 'bitset' is described in more detail below, and is mostly compatible
644 * with the old RDI/RDP system to avoid gratuitous changes to the debugger
645 * toolbox.
646 * 'model' is the target hardware ID word, as returned by the ADP_Booted
647 * message.
648 *
649 * NOTE: The minimum and maximum protocol levels are no longer supported.
650 * It is the Angel view that debugging complexity should be shifted to the
651 * host if at all possible. This means that the host debugger should
652 * always try to configure itself to the features available in the target
653 * debug agent. This can be done by checking individual messages, rather
654 * than by a blanket version number dictating the feature set.
655 */
656
657 /* 'bitset':- */
658 /* Target speed in instructions per second = 10**(bits0..3). */
659 #define ADP_Info_Target_LogSpeedMask (0xF)
660
661 /* Target is running on [0 = emulator / 1 = hardware] */
662 #define ADP_Info_Target_HW (1 << 4)
663
664 /* Bits 5..10 are currently undefined and should be zero. */
665 /* Other bis are kept the same as the RDP in order to */
666 /* eliminate the need to change the position of some bits */
667
668 /* If set then the debug agent can be reloaded. */
669 #define ADP_Info_Target_CanReloadAgent (1 << 11)
670
671 /* Can request AngelBufferSize information. */
672 #define ADP_Info_Target_CanInquireBufferSize (1 << 12)
673
674 /* Bit 13 is no longer required as it inquired whether
675 * a special RDP Interrupt code was supported
676 */
677
678 /* Debug agent can perform profiling. */
679 #define ADP_Info_Target_Profiling (1 << 14)
680
681 /* Debug agent can support Thumb code. */
682 #define ADP_Info_Target_Thumb (1 << 15)
683
684 /* Bit 16 was the communications channel check.
685 * This is always available on Angel systems.
686 */
687
688 #define ADP_Info_Points ADPSUBREASON(CI_HADP,2)
689 /* ADP_Info_Points
690 * ---------------
691 * Summary: Returns a 32bit wide bitset of break- and watch-point
692 * features supported by the target debug agent.
693 *
694 * Arguments:
695 * Send: ()
696 * Return: (word status, word breakinfo)
697 *
698 * 'status' returns RDIError_NoError on success or non-zero to indicate
699 * some sort of error.
700 * 'breakinfo' is a 32bit wide bitset described in detail below. Note
701 * that only bits 1..12 are used.
702 */
703
704 /* 'breakinfo':- */
705 /* Can trap on address equality. */
706 #define ADP_Info_Points_Comparison (1 << 0)
707
708 /* Can trap on address range. */
709 #define ADP_Info_Points_Range (1 << 1)
710
711 /* Can trap on 8bit memory reads. */
712 #define ADP_Info_Points_ReadByteWatch (1 << 2)
713
714 /* Can trap on 16bit memory reads. */
715 #define ADP_Info_Points_ReadHalfWatch (1 << 3)
716
717 /* Can trap on 32bit memory reads. */
718 #define ADP_Info_Points_ReadWordWatch (1 << 4)
719
720 /* Can trap on 8bit write accesses. */
721 #define ADP_Info_Points_WriteByteWatch (1 << 5)
722
723 /* Can trap on 16bit write accesses. */
724 #define ADP_Info_Points_WriteHalfWatch (1 << 6)
725
726 /* Can trap on 32bit write accesses. */
727 #define ADP_Info_Points_WriteWordWatch (1 << 7)
728
729 /* Like range, but based on address bitmask<. */
730 #define ADP_Info_Points_Mask (1 << 8)
731
732 /* Multi-threaded support only - thread specific breakpoints. */
733 #define ADP_Info_Points_ThreadBreak (1 << 9)
734
735 /* Multi-threaded support only - thread specific watchpoints. */
736 #define ADP_Info_Points_ThreadWatch (1 << 10)
737
738 /* Allows conditional breakpoints. */
739 #define ADP_Info_Points_Conditionals (1 << 11)
740
741 /* Break- and watch-points can be interrogated */
742 #define ADP_Info_Points_Status (1 << 12)
743
744
745 #define ADP_Info_Step ADPSUBREASON(CI_HADP,3)
746 /* ADP_Info_Step
747 * -------------
748 * Summary: Returns a 32bit wide bitmask of the single-stepping
749 * capabilities of the target debug agent.
750 *
751 * Arguments:
752 * Send: ()
753 * Return: (word status, word stepinfo)
754 *
755 * 'status' returns RDIError_NoError on success, or non-zero to indicate
756 * some kind of error.
757 * 'stepinfo' is a 32bit wide bitmask described in detail below. Note that
758 * only 3 bits are used.
759 */
760
761 /* 'stepinfo':- */
762 /* Single-stepping of more than one instruction is possible. */
763 #define ADP_Info_Step_Multiple (1 << 0)
764
765 /* Single-stepping until next direct PC change is possible. */
766 #define ADP_Info_Step_PCChange (1 << 1)
767
768 /* Single-stepping of a single instruction is possible. */
769 #define ADP_Info_Step_Single (1 << 2)
770
771
772 #define ADP_Info_MMU ADPSUBREASON(CI_HADP,4)
773 /* ADP_Info_MMU
774 * ------------
775 * Summary: Returns information about the memory management system (if
776 * any).
777 *
778 * Arguments:
779 * Send: ()
780 * Return: (word status, word meminfo)
781 *
782 * 'status' returns RDIError_NoError to indicate success or non-zero to
783 * indicate some kind of error.
784 * 'meminfo' should be a 32bit unique ID, or zero if there is no MMU
785 * support on the target.
786 */
787
788
789 #define ADP_Info_SemiHosting ADPSUBREASON(CI_HADP,5)
790 /* ADP_Info_SemiHosting
791 * --------------------
792 * Summary: This message is used to check whether semi-hosting info calls
793 * are available on the target.
794 *
795 * Arguments:
796 * Send: ()
797 * Return: (word status)
798 *
799 * 'status' returns RDIError_NoError if semi-hosting info calls are available,
800 * non-zero otherwise.
801 */
802
803
804 #define ADP_Info_CoPro ADPSUBREASON(CI_HADP,6)
805 /* ADP_Info_CoPro
806 * --------------
807 * Summary: This message checks whether CoProcessor info calls are
808 * supported.
809 *
810 * Arguments:
811 * Send: ()
812 * Return: (word status)
813 *
814 * 'status' returns RDIError_NoError to indicate these facilities
815 * are supported, non-zero otherwise.
816 */
817
818
819 #define ADP_Info_Cycles ADPSUBREASON(CI_HADP,7)
820 /* ADP_Info_Cycles
821 * ---------------
822 * Summary: Returns the number of instructions and cycles executed since
823 * the target was initialised.
824 *
825 * Arguments:
826 * Send: ()
827 * Return: (word status, word ninstr, word Scycles, word Ncycles,
828 * word Icycles, word Ccycles, word Fcycles)
829 *
830 * 'status' is RDIError_NoError to indicate success, or non-zero if there
831 * is no target support for gathering cycle count information.
832 * 'ninstr' is the number of instructions executed.
833 * 'Scycles' is the number of S-cycles executed.
834 * 'Ncycles' is the number of N-cycles executed.
835 * 'Icycles' is the number of I-cycles executed.
836 * 'Ccycles' is the number of C-cycles executed.
837 * 'Fcycles' is the number of F-cycles executed.
838 */
839
840
841 #define ADP_Info_DescribeCoPro ADPSUBREASON(CI_HADP,8)
842 /* ADP_Info_DescribeCoPro
843 * ----------------------
844 * Summary: Describe the registers of a coprocessor. Use only if
845 * ADP_Info_CoPro return RDIError_NoError.
846 *
847 * Arguments:
848 * Send: Arguments of the form:
849 * (byte cpno, byte rmin, byte rmax, byte nbytes, byte access,
850 * byte cprt_r_b0, byte cprt_r_b1, byte cprt_w_b0, byte cprt_w_b1)
851 * And a terminating byte = 0xff. Must be within maximum buffer size.
852 * Return: (word status)
853 *
854 * 'cpno' is the number of the coprocessor to be described.
855 * 'rmin' is the bottom of a range of registers with the same description.
856 * 'rmax' is the top of a range of registers with the same description.
857 * 'nbytes' is the size of the register.
858 * 'access' describes access to the register and is described in more detail
859 * below.
860 *
861 * If bit 2 of access is set:-
862 * 'cprt_r0' provides bits 0 to 7, and
863 * 'cprt_r1' provides bits 16 to 23 of a CPRT instruction to read the
864 * register.
865 * 'cprt_w0' provides bits 0 to 7, and
866 * 'cprt_w1' provides bits 16 to 23 of a CPRT instruction to write the
867 * register.
868 *
869 * Otherwise, 'cprt_r0' provides bits 12 to 15, and 'cprt_r1' bit 22 of CPDT
870 * instructions to read and write the register ('cprt_w0' and 'cprt_w1' are
871 * junk).
872 */
873
874 /* 'access':- */
875 /* Readable. */
876 #define ADP_Info_DescribeCoPro_Readable (1 << 0)
877
878 /* Writeable. */
879 #define ADP_Info_DescribeCoPro_Writeable (1 << 1)
880
881 /* Registers read or written via CPDT instructions (else CPRT) with this
882 bit set. */
883 #define ADP_Info_DescribeCoPro_CPDT (1 << 2)
884
885 #define ADP_Info_RequestCoProDesc ADPSUBREASON(CI_HADP,9)
886 /* ADP_Info_RequestCoProDesc
887 * -------------------------
888 * Summary: Requests a description of the registers of a coprocessor. Use
889 * only if ADP_Info_CoPro return RDIError_NoError.
890 *
891 * Arguments:
892 * Send: (byte cpno)
893 * Return: Arguments of the form:-
894 * (word status, byte rmin, byte rmax, byte nbytes, byte access)
895 * Followed by a terminating byte = 0xFF. Must be within maximum
896 * buffer size.
897 * 'cpno' is the number of the coprocessor to describe.
898 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
899 * 'rmin' is the bottom of a range of registers with the same description.
900 * 'rmax' is the top of a range of registers with the same description.
901 * 'nbytes' is the size in bytes of the register(s).
902 * 'access' is as above in ADP_Info_DescribeCoPro.
903 */
904
905
906 #define ADP_Info_AngelBufferSize ADPSUBREASON(CI_HADP,10)
907 /* ADP_Info_AngelBufferSize
908 * ------------------------
909 * Summary: Returns the Angel buffer sizes.
910 *
911 * Arguments:
912 * Send: ()
913 * Return: (word status, word defaultsize, word maxsize)
914 *
915 * 'status' returns RDIError_NoError to indicate success or non-zero to
916 * indicate some kind of error.
917 * 'defaultsize' is the default Angel ADP buffer size in bytes. This is
918 * at least 256 bytes.
919 * 'maxsize' is the largest Angel ADP buffer size in bytes. This will be
920 * greater than or equal to defaultsize. The target will accept ADP messages
921 * of up to this length for download, etc.
922 *
923 * Was DownLoadSize in RDP/RDI world. This is the amount that the target
924 * should transmit in a single operation. This should now be the Angel
925 * buffer size. This information is also given in the ADP_Booted message.
926 *
927 * NOTE: The value returned should be the DATASIZE and *NOT* BUFFERDEFSIZE.
928 * This is needed to ensure that the transport protocol information
929 * can be wrapped around the data.
930 */
931
932 #define ADP_Info_ChangeableSHSWI ADPSUBREASON(CI_HADP,11)
933 /* ADP_Info_ChangeableSHSWI
934 * ------------------------
935 * Summary: This message is used to check whether it is possible to change
936 * which SWI's are used for semihosting.
937 *
938 * Arguments:
939 * Send: ()
940 * Return: (word status)
941 *
942 * 'status' returns RDIError_NoError if semi-hosting info calls are available,
943 * non-zero otherwise.
944 */
945
946 #define ADP_Info_CanTargetExecute ADPSUBREASON(CI_HADP,12)
947 /* ADP_Info_CanTargetExecute
948 * -------------------------
949 * Summary: This message is used to see if the target is currently in
950 * an executable state. Typically this is called after the debugger
951 * initialises. If a non-error statis is returned then the user is
952 * allowed to 'go' immediately.
953 *
954 * Arguments:
955 * Send: ()
956 * Return: (word status)
957 *
958 * 'status' returns RDIError_NoError if target is ready to execute.
959 * other values indicate why it cannot execute.
960 */
961
962 #define ADP_Info_AgentEndianess ADPSUBREASON(CI_HADP,13)
963 /* ADP_Info_AgentEndianess
964 * -------------------------
965 * Summary: This message is used to determine the endianess of the
966 * debug agent
967 * Arguments:
968 * Send: ()
969 * Return: (word status)
970 *
971 * status should be RDIError_LittleEndian or RDIError_BigEndian
972 * any other value indicates the target does not support this
973 * request, so the debugger will have to make a best guess, which
974 * probably means only allow little endian loadagenting.
975 */
976
977
978 #define ADP_Control ADPREASON(CI_HADP,2)
979 /* This message allows for the state of the debug agent to be
980 * manipulated by the host.
981 */
982
983 /* The following are sub reason codes to ADP control, the first parameter
984 * is the sub reason code which defines the format of subsequent parameters.
985 *
986 * word sub reason code
987 */
988
989 #define ADP_Ctrl_NOP ADPSUBREASON(CI_HADP,0)
990 /* ADP_Ctrl_NOP
991 * ------------
992 * Summary: This message is used to check that ADP_Ctrl messages are
993 * supported.
994 *
995 * Arguments:
996 * Send: ()
997 * Return: (word status)
998 *
999 * 'status' is RDIError_NoError to indicate ADP_Ctrl messages are
1000 * supported, non-zero otherwise.
1001 */
1002
1003 #define ADP_Ctrl_VectorCatch ADPSUBREASON(CI_HADP,1)
1004 /* ADP_Ctrl_VectorCatch
1005 * --------------------
1006 * Summary: Specifies which hardware exceptions should be reported to the
1007 * debugger.
1008 *
1009 * Arguments:
1010 * Send: (word bitmap)
1011 * Return: (word status)
1012 *
1013 * 'bitmap' is a bit-mask of exceptions to be reported, described in more
1014 * detail below. A set bit indicates that the exception should be
1015 * reported to the debugger, a clear bit indicates that the corresponding
1016 * exception vector should be taken.
1017 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1018 */
1019
1020 /* 'bitmap':- */
1021 /* Reset(branch through zero). */
1022 #define ADP_Ctrl_VectorCatch_BranchThroughZero (1 << 0)
1023
1024 /* Undefined Instruction. */
1025 #define ADP_Ctrl_VectorCatch_UndefinedInstr (1 << 1)
1026
1027 /* Software Interrupt. */
1028 #define ADP_Ctrl_VectorCatch_SWI (1 << 2)
1029
1030 /* Prefetch Abort. */
1031 #define ADP_Ctrl_VectorCatch_PrefetchAbort (1 << 3)
1032
1033 /* Data Abort. */
1034 #define ADP_Ctrl_VectorCatch_DataAbort (1 << 4)
1035
1036 /* Address Exception. */
1037 #define ADP_Ctrl_VectorCatch_AddressException (1 << 5)
1038
1039 /* Interrupt Request. */
1040 #define ADP_Ctrl_VectorCatch_IRQ (1 << 6)
1041
1042 /* Fast Interrupt Request. */
1043 #define ADP_Ctrl_VectorCatch_FIQ (1 << 7)
1044
1045 /* Error. */
1046 #define ADP_Ctrl_VectorCatch_Error (1 << 8)
1047
1048
1049 #define ADP_Ctrl_PointStatus_Watch ADPSUBREASON(CI_HADP,2)
1050 /* ADP_Ctrl_PointStatus_Watch
1051 * --------------------------
1052 * Summary: Returns the hardware resource number and the type of that
1053 * resource when given a watchpoint handle. Should only be called if
1054 * the value returned by ADP_Info_Points had ADP_Info_Points_Status set.
1055 *
1056 * Arguments:
1057 * Send: (word handle)
1058 * Return: (word status, word hwresource, word type)
1059 *
1060 * 'handle' is a handle to a watchpoint.
1061 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1062 * 'hwresource' is the hardware resource number. !!!!!
1063 * 'type' is the type of the resource.
1064 */
1065
1066
1067 #define ADP_Ctrl_PointStatus_Break ADPSUBREASON(CI_HADP,3)
1068 /* ADP_Ctrl_PointStatus_Break
1069 * --------------------------
1070 * Summary: Returns the hardware resource number and the type of that
1071 * resource when given a breakpoint handle. Should only be called if
1072 * the value returned by ADP_Info_Points had ADP_Info_Points_Status set.
1073 *
1074 * Arguments:
1075 * Send: (word handle)
1076 * Return: (word status, word hwresource, word type)
1077 *
1078 * 'handle' is a handle to a breakpoint.
1079 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1080 * 'hwresource' is the hardware resource number.
1081 * 'type' is the type of the resource.
1082 */
1083
1084 #define ADP_Ctrl_SemiHosting_SetState ADPSUBREASON(CI_HADP,4)
1085 /* ADP_Ctrl_SemiHosting_SetState
1086 * -----------------------------
1087 * Summary: Sets whether or not semi-hosting is enabled.
1088 *
1089 * Arguments:
1090 * Send: (word semihostingstate)
1091 * Return: (word status)
1092 *
1093 * 'semihostingstate' sets semi-hosting to enabled if zero, otherwise
1094 * it disables semi-hosting.
1095 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1096 *
1097 * NOTE: This should only be called if ADP_Info_SemiHosting didn't return
1098 * an error.
1099 */
1100
1101
1102 #define ADP_Ctrl_SemiHosting_GetState ADPSUBREASON(CI_HADP,5)
1103 /* ADP_Ctrl_SemiHosting_GetState
1104 * -----------------------------
1105 * Summary: Reads whether or not semi-hosting is enabled.
1106 *
1107 * Arguments:
1108 * Send: ()
1109 * Return: (word status, word semihostingstate)
1110 *
1111 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1112 * 'semihostingstate' is zero if semi-hosting is enabled, non-zero otherwise.
1113 *
1114 * NOTE: This should only be called if ADP_Info_SemiHosting didn't return
1115 * an error.
1116 */
1117
1118
1119 #define ADP_Ctrl_SemiHosting_SetVector ADPSUBREASON(CI_HADP,6)
1120 /* ADP_Ctrl_SemiHosting_SetVector
1121 * ------------------------------
1122 * Summary: Sets the semi-hosting vector.
1123 *
1124 * Arguments:
1125 * Send: (word semihostingvector)
1126 * Return: (word status)
1127 *
1128 * 'semihostingvector' holds the value the vector is to be set to.
1129 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1130 *
1131 * NOTE: This should only be called if ADP_Info_SemiHosting didn't return
1132 * an error.
1133 */
1134
1135
1136 #define ADP_Ctrl_SemiHosting_GetVector ADPSUBREASON(CI_HADP,7)
1137 /* ADP_Ctrl_SemiHosting_GetVector
1138 * ------------------------------
1139 * Summary: Gets the value of the semi-hosting vector.
1140 *
1141 * Arguments:
1142 * Send: ()
1143 * Return: (word status, word semihostingvector)
1144 *
1145 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1146 * 'semihostingvector' holds the value of the vector.
1147 *
1148 * NOTE: This should only be called if ADP_Info_SemiHosting didn't return
1149 * an error.
1150 */
1151
1152
1153 #define ADP_Ctrl_Log ADPSUBREASON(CI_HADP,8)
1154 /* ADP_Ctrl_Log
1155 * ------------
1156 * Summary: Returns the logging state.
1157 *
1158 * Arguments:
1159 * Send: ()
1160 * Return: (word status, word logsetting)
1161 *
1162 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1163 * 'logsetting' is a bitmap specifying the level of logging desired,
1164 * described in more detail below. The bits can be ORed together
1165 */
1166
1167 /* 'logsetting':- */
1168
1169 /* No logging. */
1170 #define ADP_Ctrl_Log_NoLogging (0)
1171 /* RDI level logging. */
1172 #define ADP_Ctrl_Log_RDI (1 << 0)
1173 /* ADP byte level logging. */
1174 #define ADP_Ctrl_Log_ADP (1 << 1)
1175
1176
1177 #define ADP_Ctrl_SetLog ADPSUBREASON(CI_HADP,9)
1178 /* ADP_Ctrl_SetLog
1179 * ---------------
1180 * Summary: Sets the logging state.
1181 *
1182 * Arguments:
1183 * Send: (word logsetting)
1184 * Return: (word status)
1185 *
1186 * 'logsetting' is the same as in ADP_Ctrl_Log above.
1187 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1188 */
1189
1190 #define ADP_Ctrl_SemiHosting_SetARMSWI ADPSUBREASON(CI_HADP,10)
1191 /* ADP_Ctrl_SemiHosting_SetARMSWI
1192 * ------------------------------
1193 * Summary: Sets the number of the ARM SWI used for semihosting
1194 *
1195 * Arguments:
1196 * Send: (word ARM_SWI_number)
1197 * Return: (word status)
1198 *
1199 * The debug agent will interpret ARM SWI's with the SWI number specified
1200 * as semihosting SWI's.
1201 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1202 *
1203 * NOTE: This should only be called if ADP_Info_ChangeableSHSWI didn't return
1204 * an error.
1205 */
1206
1207
1208 #define ADP_Ctrl_SemiHosting_GetARMSWI ADPSUBREASON(CI_HADP,11)
1209 /* ADP_Ctrl_SemiHosting_GetARMSWI
1210 * ------------------------------
1211 * Summary: Reads the number of the ARM SWI used for semihosting
1212 *
1213 * Arguments:
1214 * Send: ()
1215 * Return: (word status, word ARM_SWI_number)
1216 *
1217 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1218 * ARM_SWI_number is the SWI number which is used for semihosting.
1219 *
1220 * NOTE: This should only be called if ADP_Info_SemiHosting didn't return
1221 * an error.
1222 */
1223
1224 #define ADP_Ctrl_SemiHosting_SetThumbSWI ADPSUBREASON(CI_HADP,12)
1225 /* ADP_Ctrl_SemiHosting_SetThumbSWI
1226 * --------------------------------
1227 * Summary: Sets the number of the Thumb SWI used for semihosting
1228 *
1229 * Arguments:
1230 * Send: (word Thumb_SWI_number)
1231 * Return: (word status)
1232 *
1233 * The debug agent will interpret Thumb SWI's with the SWI number specified
1234 * as semihosting SWI's.
1235 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1236 *
1237 * NOTE: This should only be called if ADP_Info_ChangeableSHSWI didn't return
1238 * an error.
1239 */
1240
1241
1242 #define ADP_Ctrl_SemiHosting_GetThumbSWI ADPSUBREASON(CI_HADP,13)
1243 /* ADP_Ctrl_SemiHosting_GetThumbSWI
1244 * --------------------------------
1245 * Summary: Reads the number of the Thumb SWI used for semihosting
1246 *
1247 * Arguments:
1248 * Send: ()
1249 * Return: (word status, word ARM_Thumb_number)
1250 *
1251 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1252 * Thumb_SWI_number is the SWI number which is used for semihosting.
1253 *
1254 * NOTE: This should only be called if ADP_Info_SemiHosting didn't return
1255 * an error.
1256 */
1257
1258
1259 #define ADP_Ctrl_Download_Supported ADPSUBREASON(CI_HADP,14)
1260 /* ADP_Ctrl_Download_Supported
1261 * ---------------------------
1262 * Summary: Can configuration be downloaded?
1263 *
1264 * Arguments:
1265 * Send: ()
1266 * Return: (word status)
1267 *
1268 * 'status' is RDIError_NoError if the configuration can be downloaded,
1269 * non-zero otherwise.
1270 *
1271 * NOTE: Equivalent to RDIInfo_DownLoad.
1272 */
1273
1274
1275 #define ADP_Ctrl_Download_Data ADPSUBREASON(CI_HADP,15)
1276 /* ADP_Ctrl_Download_Data
1277 * ----------------------
1278 * Summary: Loads configuration data.
1279 *
1280 * Arguments:
1281 * Send: (word nbytes, words data)
1282 * Return: (word status)
1283 *
1284 * 'nbytes' is the number of *bytes* being sent.
1285 * 'data' is the configuration data. NOTE: data must not cause the buffer
1286 * size to exceed the maximum allowed buffer size.
1287 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1288 *
1289 * NOTE: Equivalent to RDP_LoadConfigData. Should only be used if
1290 * ADP_ICEM_AddConfig didn't return an error.
1291 */
1292
1293
1294 #define ADP_Ctrl_Download_Agent ADPSUBREASON(CI_HADP,16)
1295 /* ADP_Ctrl_Download_Agent
1296 * -----------------------
1297 * Summary: Prepares Debug Agent to receive configuration data which it
1298 * should interpret as a new version of the Debug Agent code.
1299 *
1300 * Arguments:
1301 * Send: (word loadaddress, word size)
1302 * Return: (word status)
1303 *
1304 * 'loadaddress' is the address where the new Debug Agent code should be
1305 * loaded.
1306 * 'size' is the number of bytes of Debug Agent code to be loaded.
1307 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1308 *
1309 * NOTE: Equivalent to RDP_LoadAgent. The data will be downloaded using
1310 * ADP_Ctrl_Download_Data. The new agent is started with ADP_Ctrl_Start_Agent
1311 */
1312
1313
1314 #define ADP_Ctrl_Start_Agent ADPSUBREASON(CI_HADP,17)
1315 /* ADP_Ctrl_Start_Agent
1316 * -----------------------
1317 * Summary: Instruct Debug Agent to begin execution of new agent,
1318 * which has been downloaded by ADP_Ctrl_Download_Agent.
1319 *
1320 * Arguments:
1321 * Send: (word startaddress)
1322 * Return: (word status)
1323 *
1324 * 'startaddress' is the address where the new Debug Agent code should be
1325 * entered, and must satisfy:
1326 * (loadaddress <= startaddress <= (loadaddress + size))
1327 * where 'loadaddress' and 'size' were specified in the
1328 * ADP_Ctrl_Download_Agent message.
1329 *
1330 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1331 */
1332
1333
1334 #define ADP_Ctrl_SetTopMem ADPSUBREASON(CI_HADP,18)
1335 /* ADP_Ctrl_SetTopMem
1336 * ------------------
1337 * Summary: Sets the top of memory for ICEman2 systems, so that the C Library
1338 * can allocate the stack in the correct place on startup.
1339 *
1340 * Arguments:
1341 * Send: (word mem_top)
1342 * Return: (word status)
1343 *
1344 * This request should only be supported by ICEman2. Standard Angel systems
1345 * should return an error (unrecognised is fine).
1346 */
1347
1348
1349 #define ADP_Read ADPREASON(CI_HADP,3)
1350 #define ADP_ReadHeaderSize (ADP_DEFAULT_HEADER_SIZE + 2*sizeof(word))
1351
1352 /* ADP_Read
1353 * --------
1354 * Summary: Request for a transer of memory contents from the target to the
1355 * debugger.
1356 *
1357 * Arguments:
1358 * Send: (word address, word nbytes)
1359 * Return: (word status, word rnbytes [, bytes data])
1360 *
1361 * 'address' is the address from which memory transer should start.
1362 * 'nbytes' is the number of bytes to transfer.
1363 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1364 * 'rnbytes' holds the number of requested bytes NOT read (i.e. zero
1365 * indicates success, non-zero indicates an error).
1366 * 'data' is the number of bytes requested minus 'rnbytes'.
1367 */
1368
1369
1370
1371 #define ADP_Write ADPREASON(CI_HADP,4)
1372 #define ADP_WriteHeaderSize (ADP_DEFAULT_HEADER_SIZE + 2*sizeof(word))
1373
1374 /* ADP_Write
1375 * ---------
1376 * Summary: Request for a transfer of memory contents from the debugger to
1377 * the target.
1378 *
1379 * Arguments:
1380 * Send: (word address, word nbytes, bytes data)
1381 * Return: (word status [, word rnbytes])
1382 *
1383 * 'address' is the address from which memory transer should start.
1384 * 'nbytes' is the number of bytes to transfer.
1385 * 'data' holds the bytes to be transferred.
1386 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1387 * 'rnbytes' holds the number of requested bytes NOT written (i.e. zero
1388 * indicates success, non-zero indicates an error) if status indicated an
1389 * error.
1390 */
1391
1392
1393
1394 #define ADP_CPUread ADPREASON(CI_HADP,5)
1395 /* ADP_CPUread
1396 * -----------
1397 * Summary: This is a request to read values in the CPU.
1398 *
1399 * Arguments:
1400 * Send: (byte mode, word mask)
1401 * Return: (word status, words data)
1402 *
1403 * 'mode' defines the processor mode from which the transfer should be made.
1404 * It is described in more detail below.
1405 * 'mask' indicates which registers should be transferred. Setting a bit to
1406 * one will cause the designated register to be transferred. The details
1407 * of mask are specified below.
1408 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1409 * 'data' holds the values of the registers on successful completion,
1410 * otherwise it just holds rubbish. The lowest numbered register is
1411 * transferred first. NOTE: data must not cause the buffer size to exceed
1412 * the maximum allowed buffer size.
1413 */
1414
1415 /* 'mode':- */
1416 /* The mode number is the same as the mode number used by an ARM; a value of
1417 255 indicates the current mode. */
1418 #define ADP_CPUmode_Current (255)
1419
1420 /* 26bit user mode. */
1421 #define ADP_CPUread_26bitUser (0x0)
1422
1423 /* 26bit FIQ mode. */
1424 #define ADP_CPUread_26bitFIQ (0x1)
1425
1426 /* 26bit IRQ mode. */
1427 #define ADP_CPUread_26bitIRQ (0x2)
1428
1429 /* 26bit Supervisor mode. */
1430 #define ADP_CPUread_26bitSVC (0x3)
1431
1432 /* 32bit user mode. */
1433 #define ADP_CPUread_32bitUser (0x10)
1434
1435 /* 32bit FIQ mode. */
1436 #define ADP_CPUread_32bitFIQ (0x11)
1437
1438 /* 32bit IRQ mode. */
1439 #define ADP_CPUread_32bitIRQ (0x12)
1440
1441 /* 32bit Supervisor mode. */
1442 #define ADP_CPUread_32bitSVC (0x13)
1443
1444 /* 32bit Abort mode. */
1445 #define ADP_CPUread_32bitAbort (0x17)
1446
1447 /* 32bit Undefined mode. */
1448 #define ADP_CPUread_32bitUndef (0x1B)
1449
1450 /* #32bit System mode - Added in Architecture 4 ARMs e.g.ARM7TDMI */
1451 #define ADP_CPUread_32bitSystem (0x1F)
1452
1453 /* 'mask':- */
1454 /* Request registers RO-R14. */
1455 #define ADP_CPUread_RegsMask (0x7FFF)
1456
1457 /* Request Program Counter (including mode and flag bits in 26-bit modes. */
1458 #define ADP_CPUread_PCmode (1 << 15)
1459
1460 /* Request Program Counter (without mode and flag bits in 26-bit modes. */
1461 #define ADP_CPUread_PCnomode (1 << 16)
1462
1463 /* Requests the transfer of the CPSR */
1464 #define ADP_CPUread_CPSR (1 << 17)
1465
1466 /* In processor modes with an SPSR(non-user modes), bit 19 requests its
1467 transfer */
1468 #define ADP_CPUread_SPSR (1 << 18)
1469
1470
1471
1472 #define ADP_CPUwrite ADPREASON(CI_HADP,6)
1473 /* ADP_CPUwrite
1474 * ------------
1475 * Summary: This is a request to write values to the CPU.
1476 *
1477 * Arguments:
1478 * Send: (byte mode, word mask, words data)
1479 * Return: (word status)
1480 *
1481 * 'mode' defines the processor mode to which the transfer should be made.
1482 * The mode number is the same as the mode number used by ARM; a value of
1483 * 255 indicates the current mode. See ADP_CPUread above for more detail.
1484 * 'mask' indicates which registers should be transferred. Setting a bit to
1485 * one will cause the designated register to be transferred. The details
1486 * of mask are specified above in ADP_CPUread.
1487 * 'data' holds the values of the registers to be transferred. The first
1488 * value is written to the lowest numbered register. NOTE: data must not
1489 * cause the buffer size to exceed the maximum allowed buffer size.
1490 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1491 */
1492
1493
1494
1495 #define ADP_CPread ADPREASON(CI_HADP,7)
1496 /* ADP_CPread
1497 * ----------
1498 * Summary: This message requests a co-processors internal state.
1499 *
1500 * Arguments:
1501 * Send: (byte CPnum, word mask)
1502 * Return: (word status, words data)
1503 *
1504 * 'CPnum' is the number of the co-processor to transfer values from.
1505 * 'mask' specifies which registers to transfer and is co-processor
1506 * specific.
1507 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1508 * 'data' holds the registers specified in 'mask' if successful, otherwise
1509 * just rubbish. The lowest numbered register is transferred first.
1510 * NOTE: data must not cause the buffer size to exceed the maximum allowed
1511 * buffer size.
1512 */
1513
1514
1515
1516 #define ADP_CPwrite ADPREASON(CI_HADP,8)
1517 /* ADP_CPwrite
1518 * -----------
1519 * Summary: This message requests a write to a co-processors internal state.
1520 *
1521 * Arguments:
1522 * Send: (byte CPnum, word mask, words data)
1523 * Return: (word status)
1524 *
1525 * 'CPnum' is the number of the co-processor to transfer values to.
1526 * 'mask' specifies which registers to transfer and is co-processor
1527 * specific.
1528 * 'data' holds the values to transfer to the registers specified in 'mask'.
1529 * The first value is written to the lowest numbered register.
1530 * NOTE: data must not cause the buffer size to exceed the maximum allowed
1531 * buffer size.
1532 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1533 */
1534
1535
1536
1537 #define ADP_SetBreak ADPREASON(CI_HADP,9)
1538 /* ADP_SetBreak
1539 * ------------
1540 * Summary: Sets a breakpoint.
1541 *
1542 * Arguments:
1543 * Send: (word address, byte type [, word bound])
1544 * Return: (word status, word pointhandle, word raddress, word rbound)
1545 *
1546 * 'address' is the address of the instruction to set the breakpoint on.
1547 * 'type' specifies the sort of breakpoint and is described in more detail
1548 * below.
1549 * 'bound' is included if the least significant 4 bits of type are set to
1550 * 5 or above (see below for more detail).
1551 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1552 * 'pointhandle' returns a handle to the breakpoint, it will be valid if bit
1553 * 7 of 'type' is set. See below for more detail.
1554 * 'raddress' is valid depending on 'type', see below for more detail.
1555 * 'rbound' is valid depending on 'type', see below for more detail.
1556 */
1557
1558 /* 'type':- */
1559 /* The least significant 4 bits define the sort of breakpoint to set:- */
1560 /* Halt if the pc is equal to 'address'. */
1561 #define ADP_SetBreak_EqualsAddress (0)
1562
1563 /* Halt if the pc is greater than 'address'. */
1564 #define ADP_SetBreak_GreaterAddress (1)
1565
1566 /* Halt if the pc is greater than or equal to 'address'. */
1567 #define ADP_SetBreak_GEqualsAddress (2)
1568
1569 /* Halt if the pc is less than 'address'. */
1570 #define ADP_SetBreak_LessAddress (3)
1571
1572 /* Halt if the pc is less than or equal to 'address'. */
1573 #define ADP_SetBreak_LEqualsAddress (4)
1574
1575 /* Halt if the pc is in the range from 'address' to 'bound' inclusive. */
1576 #define ADP_SetBreak_Range (5)
1577
1578 /* Halt if the pc is not in the range from 'address' to 'bound' inclusive. */
1579 #define ADP_SetBreak_NotRange (6)
1580
1581 /* Halt if (pc & 'bound') = 'address'. */
1582 #define ADP_SetBreak_AndBound (7)
1583
1584 /* Bits 5,6 and 7 are used as follows :- */
1585 /* If set this indicates that the breakpoint is on a 16bit (Thumb)
1586 instruction rather than a 32bit (ARM) instruction. */
1587 #define ADP_SetBreak_Thumb (1 << 4)
1588
1589 /* This requests that the breakpoint should be conditional (execution halts
1590 only if the breakpointed instruction is executed, not if it is
1591 conditionally skipped). If bit 5 is not set, execution halts whenever
1592 the breakpointed instruction is reached (whether executed or skipped). */
1593 #define ADP_SetBreak_Cond (1 << 5)
1594
1595 /* This requests a dry run: the breakpoint is not set and the 'raddress', and
1596 if appropriate the 'rbound', that would be used, are returned (for
1597 comparison and range breakpoints the address and bound used need not be
1598 exactly as requested). A RDIError_NoError 'status' byte indicates that
1599 resources are currently available to set the breakpoint, non-zero
1600 indicates an error. RDIError_NoMorePoints indicates that the required
1601 breakpoint resources are not currently available. */
1602 #define ADP_SetBreak_DryRun (1 << 6)
1603
1604 /* If the request is successful, but there are no more breakpoint registers
1605 (of the requested type), then the value RDIError_NoMorePoints is
1606 returned. */
1607
1608 /* If a breakpoint is set on a location which already has a breakpoint, the
1609 first breakpoint will be removed before the new breakpoint is set. */
1610
1611
1612
1613 #define ADP_ClearBreak ADPREASON(CI_HADP,10)
1614 /* ADP_ClearBreak
1615 * --------------
1616 * Summary: Clears a breakpoint.
1617 *
1618 * Arguments:
1619 * Send: (word pointhandle)
1620 * Return: (word status)
1621 *
1622 * 'pointhandle' is a handle returned by a previous ADP_SetBreak.
1623 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1624 */
1625
1626
1627 #define ADP_SetWatch ADPREASON(CI_HADP,11)
1628 /* ADP_SetWatch
1629 * ------------
1630 * Summary: Sets a watchpoint.
1631 *
1632 * Arguments:
1633 * Send: (word address, byte type, byte datatype [,word bound])
1634 * Return: (word status, word pointhandle, word raddress, word rbound)
1635 *
1636 * 'address' is the address at which to set the watchpoint.
1637 * 'type' is the type of watchpoint to set and is described in detail below.
1638 * 'datatype' defines the sort of data access to watch for and is described
1639 * in more detail below.
1640 * 'bound' is included depending on the value of type (see description of
1641 * type below).
1642 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1643 * 'pointhandle' is valid depending on the value of type (see description
1644 * of type below).
1645 * 'raddress' is valid depending on the value of type (see description
1646 * of type below).
1647 * 'rbound' is valid depending on the value of type (see description
1648 * of type below).
1649 */
1650
1651 /* 'type':- */
1652 /* The least significant 4 bits of 'type' define the sort of watchpoint to
1653 set:- */
1654 /* Halt on a data access to the address equal to 'address'. */
1655 #define ADP_SetWatch_EqualsAddress (0)
1656
1657 /* Halt on a data access to an address greater than 'address'. */
1658 #define ADP_SetWatch_GreaterAddress (1)
1659
1660 /* Halt on a data access to an address greater than or equal to 'address'. */
1661 #define ADP_SetWatch_GEqualsAddress (2)
1662
1663 /* Halt on a data access to an address less than 'address'. */
1664 #define ADP_SetWatch_LessAddress (3)
1665
1666 /* Halt on a data access to an address less than or equal to 'address'. */
1667 #define ADP_SetWatch_LEqualsAddress (4)
1668
1669 /* Halt on a data access to an address in the range from 'address' to
1670 'bound' inclusive. */
1671 #define ADP_SetWatch_Range (5)
1672
1673 /* Halt on a data access to an address not in the range from 'address' to
1674 'bound' inclusive. */
1675 #define ADP_SetWatch_NotRange (6)
1676
1677 /* Halt if (data-access-address & 'bound')='address'. */
1678 #define ADP_SetWatch_AndBound (7)
1679
1680 /* Bits 6 and 7 of 'type' also have further significance:-
1681 NOTE: they must not be simulataneously set. */
1682
1683 /* Bit 6 of 'type' set: Requests a dry run: the watchpoint is not set and
1684 the 'address' and, if appropriate, the 'bound', that would be used are
1685 returned (for range and comparison watchpoints, the 'address' and 'bound'
1686 used need not be exactly as requested). A RDIError_NoError status byte
1687 indicates that resources are currently available to set the watchpoint;
1688 RDIError_NoMorePoints indicates that the required watchpoint resources
1689 are not currently available. */
1690
1691 /* Bit 7 of 'type' set: Requests that a handle should be returned for the
1692 watchpoint by which it will be identified subsequently. If bit 7 is
1693 set, a handle will be returned ('pointhandle'), whether or not the
1694 request succeeds or fails (but, obviously, it will only be meaningful
1695 if the request succeesd). */
1696
1697 /* 'datatype':- */
1698 /* The 'datatype' argument defines the sort of data access to watch for,
1699 values can be summed or ORed together to halt on any set of sorts of
1700 memory access. */
1701
1702 /* Watch for byte reads. */
1703 #define ADP_SetWatch_ByteReads (1)
1704
1705 /* Watch for half-word reads. */
1706 #define ADP_SetWatch_HalfWordReads (2)
1707
1708 /* Watch for word reads. */
1709 #define ADP_SetWatch_WordReads (4)
1710
1711 /* Watch for half-word reads. */
1712 #define ADP_SetWatch_ByteWrites (8)
1713
1714 /* Watch for half-word reads. */
1715 #define ADP_SetWatch_HalfWordWrites (16)
1716
1717 /* Watch for half-word reads. */
1718 #define ADP_SetWatch_WordWrites (32)
1719
1720 /* On successful completion a RDIError_NoError 'status' byte is returned. On
1721 unsuccessful completion, a non-zero error code byte is returned. If the
1722 request is successful, but there are now no more watchpoint registers
1723 (of the requested type), then the value RDIError_NoMorePoints is
1724 returned. */
1725
1726 /* If a watchpoint is set on a location which already has a watchpoint, the
1727 first watchpoint will be removed before the new watchpoint is set. */
1728
1729
1730 #define ADP_ClearWatch ADPREASON(CI_HADP,12)
1731 /* ADP_ClearWatch
1732 * --------------
1733 * Summary: Clears a watchpoint.
1734 *
1735 * Arguments:
1736 * Send: (word pointhandle)
1737 * Return: (word status)
1738 *
1739 * 'pointhandle' is a handle to a watchpoint returned by a previous
1740 * ADP_SetWatch.
1741 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1742 */
1743
1744
1745
1746 #define ADP_Execute ADPREASON(CI_HADP,13)
1747 /* ADP_Execute
1748 * -----------
1749 * Summary: This message requests that the target starts executing from
1750 * the stored CPU state.
1751 *
1752 * Arguments:
1753 * Send: ()
1754 * Return: (word status)
1755 *
1756 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1757 * The message will *ALWAYS* respond immediately with an ACK (unlike the
1758 * old RDI definition, which allowed asynchronous message replies).
1759 *
1760 * Execution will stop when allowed system events occur. The host will
1761 * be notified via a ADP_Stopped message (described below).
1762 */
1763
1764
1765
1766 #define ADP_Step ADPREASON(CI_HADP,14)
1767 /* ADP_Step
1768 * --------
1769 * Summary: Execute 'ninstr' instructions.
1770 *
1771 * Arguments:
1772 * Send: (word ninstr)
1773 * Return: (word status)
1774 *
1775 * 'ninstr' is the number of instructions to execute, starting at the
1776 * address currently loaded into the CPU program counter. If it is zero,
1777 * the target should execute instructions upto the next instruction that
1778 * explicitly alters the Program Counter. i.e. a branch or ALU operation
1779 * with the PC as the destination.
1780 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1781 *
1782 * The ADP_Step function (unlike the earlier RDI system) will *ALWAYS*
1783 * return an ACK immediately. A subsequent ADP_Stopped message will be
1784 * delivered from the target to the host when the ADP_Step operation
1785 * has completed.
1786 */
1787
1788
1789
1790 #define ADP_InterruptRequest ADPREASON(CI_HADP,15)
1791 /* ADP_InterruptRequest
1792 * --------------------
1793 * Summary: Interrupt execution.
1794 *
1795 * Arguments:
1796 * Send: ()
1797 * Return: (word status)
1798 *
1799 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1800 * On receiving this message the target should attempt to stop execution.
1801 */
1802
1803
1804
1805 #define ADP_HW_Emulation ADPREASON(CI_HADP,16)
1806 /* ADP_HW_Emulation
1807 * ----------------
1808 * The first parameter to ADP_HW_Emulation is a Reason Subcode, and
1809 * subsequent parameters are defined by that subcode
1810 *
1811 * word reason subcode
1812 * other arguments as reason subcode determines
1813 *
1814 */
1815
1816 /* ADP__HW_Emulation sub-reason codes: */
1817
1818 #define ADP_HW_Emul_Supported ADPSUBREASON(CI_HADP,0)
1819 /* ADP_HW_Emul_Supported
1820 * ---------------------
1821 * Summary: Enquires whether calls to the next 4 messages are available
1822 * (MemoryAccess, MemoryMap, Set_CPUspeed, ReadClock).
1823 *
1824 * Arguments:
1825 * Send: ()
1826 * Return: (word status)
1827 *
1828 * 'status' is RDIError_NoError to indicate the messages are available,
1829 * non-zero otherwise.
1830 *
1831 * NOTE: Equivalent to RDI_Info_Memory_Stats.
1832 */
1833
1834
1835 #define ADP_HW_Emul_MemoryAccess ADPSUBREASON(CI_HADP,1)
1836 /* ADP_HW_Emul_MemoryAccess
1837 * ------------------------
1838 * Summary: Get memory access information for memory block with specified
1839 * handle.
1840 *
1841 * Arguments:
1842 * Send: (word handle)
1843 * Return: (word status, word nreads, word nwrites, word sreads,
1844 * word swrites, word ns, word s)
1845 *
1846 * 'handle' is a handle to a memory block.
1847 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1848 * 'nreads' is the number of non-sequential reads.
1849 * 'nwrites' is the number of non-sequential writes.
1850 * 'sreads' is the number of sequential reads.
1851 * 'swrites' is the number of sequential writes.
1852 * 'ns' is time in nano seconds.
1853 * 's' is time in seconds.
1854 *
1855 * NOTE: Equivalent to RDIMemory_Access.
1856 */
1857
1858
1859 #define ADP_HW_Emul_MemoryMap ADPSUBREASON(CI_HADP,2)
1860 /* ADP_HW_Emul_MemoryMap
1861 * ---------------------
1862 * Summary: Sets memory characteristics.
1863 *
1864 * Arguments:
1865 * Send: (word n,
1866 Then 'n' sets of arguments of the form:-
1867 word handle, word start, word limit, byte width,
1868 byte access, word Nread_ns, word Nwrite_ns, word Sread_ns,
1869 word Swrite_ns)
1870 * Return: (word status)
1871 *
1872 * 'n' is the number of sets of arguments.
1873 * 'handle' is a handle to the region.
1874 * 'start' is the start of this region.
1875 * 'limit' is the limit of this region.
1876 * 'width' is the memory width, described in detail below.
1877 * 'access' is described in detail below.
1878 * 'Nread_ns' is the access time for N read cycles in nano seconds.
1879 * 'Nwrite_ns' is the access time for N write cycles in nano seconds.
1880 * 'Sread_ns' is the access time for S read cycles in nano seconds.
1881 * 'Swrite_ns' is the access time for S write cycles in nano seconds.
1882 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1883 * NOTE: Equivalent to RDIMemory_Map.
1884 */
1885
1886 /* 'width':- */
1887 /* 8 bit memory width. */
1888 #define ADP_HW_Emul_MemoryMap_Width8 (0)
1889
1890 /* 16 bit memory width. */
1891 #define ADP_HW_Emul_MemoryMap_Width16 (1)
1892
1893 /* 32 bit memory width. */
1894 #define ADP_HW_Emul_MemoryMap_Width32 (2)
1895
1896 /* 'access':- */
1897 /* Bit 0 - read access. */
1898 #define ADP_HW_Emul_MemoryMap_Access_Read (1 << 0)
1899
1900 /* Bit 1 - write access. */
1901 #define ADP_HW_Emul_MemoryMap_Access_Write (1 << 1)
1902
1903 /* Bit 2 - latched 32 bit memory. */
1904 #define ADP_HW_Emul_MemoryMap_Access_Latched (1 << 2)
1905
1906
1907 #define ADP_HW_Emul_SetCPUSpeed ADPSUBREASON(CI_HADP,3)
1908 /* ADP_HW_Emul_SetCPUSpeed
1909 * -----------------------
1910 * Summary: Sets the speed of the CPU.
1911 *
1912 * Arguments:
1913 * Send: (word speed)
1914 * Return: (word status)
1915 *
1916 * 'speed' is the CPU speed in nano seconds.
1917 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1918 *
1919 * NOTE: Equivalent to RDISet_CPUSpeed.
1920 */
1921
1922
1923 #define ADP_HW_Emul_ReadClock ADPSUBREASON(CI_HADP,4)
1924 /* ADP_HW_Emul_ReadClock
1925 * ---------------------
1926 * Summary: Reads simulated time.
1927 *
1928 * Arguments:
1929 * Send: ()
1930 * Return: (word status, word ns, word s)
1931 *
1932 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1933 * 'ns' is time in nano seconds.
1934 * 's' is time in seconds.
1935 *
1936 * NOTE: Equivalent to RDIRead_Clock.
1937 */
1938
1939
1940 #define ADP_ICEbreakerHADP ADPREASON(CI_HADP,17)
1941
1942 /* The first parameter to ADP_ICEbreaker is a Reason Subcode, and
1943 * subsequent parameters are defined by that subcode
1944 *
1945 * word reason subcode
1946 * other arguments as reason subcode determines
1947 *
1948 */
1949
1950 /* ADP_ICEbreaker sub-reason codes: */
1951
1952 #define ADP_ICEB_Exists ADPSUBREASON(CI_HADP,0)
1953 /* ADP_ICEB_Exists
1954 * ---------------
1955 * Summary: Is there an ICEbreaker in the system?
1956 *
1957 * Arguments:
1958 * Send: ()
1959 * Return: (word status)
1960 *
1961 * 'status' is RDIError_NoError to indicate there is an ICEbreaker,
1962 * non-zero otherwise.
1963 */
1964
1965
1966 #define ADP_ICEB_GetLocks ADPSUBREASON(CI_HADP,1)
1967 /* ADP_ICEB_GetLocks
1968 * -----------------
1969 * Summary: Returns which ICEbreaker registers are locked.
1970 *
1971 * Arguments:
1972 * Send: ()
1973 * Return: (word status, word lockedstate)
1974 *
1975 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1976 * 'lockedstate' is a bitmap if the ICEbreaker registers locked against use
1977 * by IceMan (because explicitly written by the user). Bit n represents
1978 * hardware breakpoint n, and if set the register is locked.
1979 *
1980 * NOTE: Equivalent to RDIIcebreaker_GetLocks. Should only be used if
1981 * ADP_ICEB_Exists didn't return an error.
1982 */
1983
1984
1985 #define ADP_ICEB_SetLocks ADPSUBREASON(CI_HADP,2)
1986 /* ADP_ICEB_SetLocks
1987 * -----------------
1988 * Summary: Sets which ICEbreaker registers are locked.
1989 *
1990 * Arguments:
1991 * Send: (word lockedstate)
1992 * Return: (word status)
1993 *
1994 * 'lockedstate' is the same as in ADP_ICEB_GetLocks above.
1995 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
1996 *
1997 * NOTE: Equivalent to RDIIcebreaker_SetLocks. Should only be used if
1998 * ADP_ICEB_Exists didn't return an error.
1999 */
2000
2001
2002 #define ADP_ICEB_CC_Exists ADPSUBREASON(CI_HADP,3)
2003 /* ADP_ICEB_CC_Exists
2004 * ------------------
2005 * Summary: Is there an ICEbreaker Comms Channel?
2006 *
2007 * Arguments:
2008 * Send: ()
2009 * Return: (word status)
2010 *
2011 * 'status' is RDIError_NoError to indicate there is a Comms Channel,
2012 * non-zero otherwise.
2013 *
2014 * NOTE: Should only be used if ADP_ICEB_Exists didn't return an error.
2015 */
2016
2017
2018 #define ADP_ICEB_CC_Connect_ToHost ADPSUBREASON(CI_HADP,4)
2019 /* ADP_ICEB_CC_Connect_ToHost
2020 * --------------------------
2021 * Summary: Connect Comms Channel in ToHost direction.
2022 *
2023 * Arguments:
2024 * Send: (byte connect)
2025 * Return: (word status)
2026 *
2027 * 'connect' !!!!!
2028 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2029 *
2030 * NOTE: Equivalent to RDICommsChannel_ToHost. Should only be used if
2031 * ADP_ICEB_CC_Exists didn't return an error.
2032 */
2033
2034
2035 #define ADP_ICEB_CC_Connect_FromHost ADPSUBREASON(CI_HADP,5)
2036 /* ADP_ICEB_CC_Connect_FromHost
2037 * ----------------------------
2038 * Summary: Connect Comms Channel in FromHost direction.
2039 *
2040 * Arguments:
2041 * Send: (byte connect)
2042 * Return: (word status)
2043 *
2044 * 'connect' is the same as in ADP_ICEB_CC_Connect_ToHost above.
2045 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2046 *
2047 * NOTE: Equivalent to RDICommsChannel_FromHost. Should only be used if
2048 * ADP_ICEB_CC_Exists didn't return an error.
2049 */
2050
2051
2052 #define ADP_ICEman ADPREASON(CI_HADP,18)
2053
2054 /* The first parameter to ADP_ICEman is a Reason Subcode, and
2055 * subsequent parameters are defined by that subcode
2056 *
2057 * word reason subcode
2058 * other arguments as reason subcode determines
2059 *
2060 */
2061
2062 /* ADP_ICEman sub-reason codes: */
2063
2064
2065 #define ADP_ICEM_AddConfig ADPSUBREASON(CI_HADP,0)
2066 /* ADP_ICEM_AddConfig
2067 * ------------------
2068 * Summary: Prepares target to receive configuration data block.
2069 *
2070 * Arguments:
2071 * Send: (word nbytes)
2072 * Return: (word status)
2073 *
2074 * 'nbytes' is the number of bytes in the configuration block.
2075 * 'status' is RDIError_NoError to indicate success, non-zero if a
2076 * configuration block of this size can't be accepted.
2077 *
2078 * NOTE: Equivalent to RDP_AddConfig.
2079 */
2080
2081
2082 #define ADP_ICEM_SelectConfig ADPSUBREASON(CI_HADP,1)
2083 /* ADP_ICEM_SelectConfig
2084 * ---------------------
2085 * Summary: Selects one of the sets of configuration data blocks and
2086 * reinitialises to use the new configuration.
2087 *
2088 * Arguments:
2089 * Send: (byte aspect, byte namelen, byte matchtype, word vsn_req,
2090 bytes name)
2091 * Return: (word status, word vsn_sel)
2092 *
2093 * 'aspect' is one of two values defined below.
2094 * 'namelen' is the number of bytes in 'name'.
2095 * 'matchtype' specifies how the selected version must match that specified,
2096 * and takes one of the values defined below.
2097 * 'vsn_req' is the requested version of the named configuration.
2098 * 'name' is the name of the configuration.
2099 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2100 * 'vsn_sel' is the version number of the configuration selected on success.
2101 *
2102 * NOTE: Equivalent to RDP_SelectConfig.
2103 */
2104
2105 /* 'aspect':- */
2106 #define ADP_ICEM_SelectConfig_ConfigCPU (0)
2107 #define ADP_ICEM_SelectConfig_ConfigSystem (1)
2108
2109 /* 'matchtype':- */
2110 #define ADP_ICEM_SelectConfig_MatchAny (0)
2111 #define ADP_ICEM_SelectConfig_MatchExactly (1)
2112 #define ADP_ICEM_SelectConfig_MatchNoEarlier (2)
2113
2114
2115 #define ADP_ICEM_ConfigCount ADPSUBREASON(CI_HADP,2)
2116 /* ADP_ICEM_ConfigCount
2117 * --------------------
2118 * Summary: Return number of configurations.
2119 *
2120 * Arguments:
2121 * Send: ()
2122 * Return: (word status [, word count])
2123 *
2124 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2125 * 'count' returns the number of configurations if status is zero.
2126 *
2127 * NOTE: Equivalent to RDIConfig_Count.
2128 */
2129
2130
2131 #define ADP_ICEM_ConfigNth ADPSUBREASON(CI_HADP,3)
2132 /* ADP_ICEM_ConfigNth
2133 * ------------------
2134 * Summary: Gets the nth configuration details.
2135 *
2136 * Arguments:
2137 * Send: (word confign)
2138 * Return: (word status, word version, byte namelen, bytes name)
2139 *
2140 * 'confign' is the number of the configuration.
2141 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2142 * 'version' is the configuration version number.
2143 * 'namelen' is the number of bytes in 'name'.
2144 * 'name' is the name of the configuration.
2145 *
2146 * NOTE: Equivalent to RDIConfig_Nth.
2147 */
2148
2149
2150
2151 #define ADP_Profile ADPREASON(CI_HADP,19)
2152
2153 /* The first parameter to ADP_Profile is a Reason Subcode, and
2154 * subsequent parameters are defined by that subcode
2155 *
2156 * word reason subcode
2157 * other arguments as reason subcode determines
2158 *
2159 */
2160
2161 /* ADP_Profile sub-reason codes: */
2162
2163
2164 #define ADP_Profile_Supported ADPSUBREASON(CI_HADP,0)
2165 /* ADP_Profile_Supported
2166 * ---------------------
2167 * Summary: Checks whether profiling is supported.
2168 *
2169 * Arguments:
2170 * Send: ()
2171 * Return: (word status)
2172 *
2173 * 'status' is RDIError_NoError if profiling is supported, non-zero otherwise.
2174 *
2175 * NOTE: Can also be determined using Info_Target.
2176 */
2177
2178
2179 #define ADP_Profile_Stop ADPSUBREASON(CI_HADP,1)
2180 /* ADP_Profile_Stop
2181 * ----------------
2182 * Summary: Stops profiling.
2183 *
2184 * Arguments:
2185 * Send: ()
2186 * Return: (word status)
2187 *
2188 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2189 *
2190 * NOTE: Equivalent to RDIProfile_Stop.
2191 */
2192
2193
2194 #define ADP_Profile_Start ADPSUBREASON(CI_HADP,2)
2195 /* ADP_Profile_Start
2196 * -----------------
2197 * Summary: Starts profiling (PC sampling).
2198 *
2199 * Arguments:
2200 * Send: (word interval)
2201 * Return: (word status)
2202 *
2203 * 'interval' is the period of PC sampling in micro seconds.
2204 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2205 *
2206 * NOTE: Equivalent to RDIProfile_Start.
2207 */
2208
2209
2210 #define ADP_Profile_WriteMap ADPSUBREASON(CI_HADP,3)
2211 #define ADP_ProfileWriteHeaderSize (ADP_DEFAULT_HEADER_SIZE + 4*sizeof(word))
2212
2213 /* ADP_Profile_WriteMap
2214 * --------------------
2215 * Summary: Downloads a map array, which describes the PC ranges for profiling.
2216 *
2217 * Arguments: A number of messages each of form:-
2218 * Send: (word len, word size, word offset, words map_data)
2219 * Return: (word status)
2220 *
2221 * 'len' is the number of elements in the entire map array being downloaded.
2222 * 'size' is the number of words being downloaded in this message, i.e. the
2223 * length of 'map_data'.
2224 * 'offset' is the offset into the entire map array which this message starts
2225 * from, in words.
2226 * 'map_data' consists of 'size' words of map data.
2227 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2228 *
2229 * NOTE: Equivalent to RDIProfile_WriteMap.
2230 */
2231
2232
2233 #define ADP_Profile_ReadMap ADPSUBREASON(CI_HADP,4)
2234 #define ADP_ProfileReadHeaderSize (ADP_DEFAULT_HEADER_SIZE + 2*sizeof(word))
2235
2236 /* ADP_Profile_ReadMap
2237 * -------------------
2238 * Summary: Uploads a set of profile counts which correspond to the current
2239 * profile map.
2240 *
2241 * Arguments: A number of messages, each of the form:
2242 * Send: (word offset, word size)
2243 * Return: (word status, words counts)
2244 *
2245 * 'offset' is the offset in the entire array of counts that this message
2246 * starts from, in words.
2247 * 'size' is the number of words uploaded in this message (in counts).
2248 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2249 * 'counts' is 'size' words of profile counts.
2250 *
2251 * NOTE: Equivalent to RDIProfile_ReadMap.
2252 */
2253
2254
2255 #define ADP_Profile_ClearCounts ADPSUBREASON(CI_HADP,5)
2256 /* ADP_Profile_ClearCounts
2257 * -----------------------
2258 * Summary: Requests that PC sample counts be set to zero.
2259 *
2260 * Arguments:
2261 * Send: ()
2262 * Return: (word status)
2263 *
2264 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2265 *
2266 * NOTE: Equivalent to RDIProfile_ClearCounts.
2267 */
2268
2269 #define ADP_InitialiseApplication ADPREASON(CI_HADP,20)
2270 /* ADP_InitialiseApplication
2271 * -------------------------
2272 * Summary: Requests that OS setup up the thread/task so that it can be
2273 * executed.
2274 *
2275 * Arguments:
2276 * Send: ()
2277 * Return: (word status)
2278 *
2279 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2280 */
2281
2282 #define ADP_End ADPREASON(CI_HADP,21)
2283 /* ADP_End
2284 * -------
2285 * Summary: Sent by the host debugger to tell angel this debugging session
2286 * is is finished
2287 * Arguments:
2288 * Send: ()
2289 * Return: (word status)
2290 * status' is RDIError_NoError to indicate success, non-zero otherwise.
2291 */
2292
2293 /******************************************************************
2294 *
2295 * CI_TADP messages
2296 *
2297 */
2298
2299 #define ADP_TADPUnrecognised ADPREASON(CI_TADP,0)
2300 /* This message is unusual in that it is normally sent in reply to
2301 * another message which is not understood. This is an exception
2302 * to the normal protocol which says that a reply must have the
2303 * same base reason code as the original. There is a single reply
2304 * parameter which is the reason code which was not understood.
2305 *
2306 * As well as being a reply this message can also be sent and will
2307 * return as if this message were unrecognised!
2308 *
2309 * Parameters:
2310 * none
2311 *
2312 * Reply:
2313 * word reason code which was not recognised
2314 */
2315
2316 /*-------------------------------------------------------------------------*/
2317
2318 #define ADP_Stopped ADPREASON(CI_TADP,1)
2319 /* ADP_Stopped
2320 * -----------
2321 * Summary: This message is sent to the host when the application stops,
2322 * either naturally or due to an exception.
2323 *
2324 * Parameters:
2325 * word reason subcode
2326 * other arguments as reason subcode determines.
2327 * Unless stated otherwise (below) there will be none.
2328 *
2329 * Reply:
2330 * word status unless reason subcode says otherwise
2331 *
2332 * This message is sent to the host when execution has stopped. This
2333 * can be when the end of the application has been reached, or as the
2334 * result of an exception. It can also be the return from an ADP_Step
2335 * process, when the requested number of instructions have been
2336 * executed., or a breakpoint or watchpoint has been hit etc.
2337 */
2338
2339 /* The first set of Stopped subreason codes are for the ARM hardware
2340 * vectors. These events will be raised if the
2341 * ADP_Control_Vector_Catch allows, or if the target application has
2342 * not provided its own handlers.
2343 */
2344 #define ADP_Stopped_BranchThroughZero ADPSUBREASON(CI_TADP,0)
2345 #define ADP_Stopped_UndefinedInstr ADPSUBREASON(CI_TADP,1)
2346 #define ADP_Stopped_SoftwareInterrupt ADPSUBREASON(CI_TADP,2)
2347 #define ADP_Stopped_PrefetchAbort ADPSUBREASON(CI_TADP,3)
2348 #define ADP_Stopped_DataAbort ADPSUBREASON(CI_TADP,4)
2349 #define ADP_Stopped_AddressException ADPSUBREASON(CI_TADP,5)
2350 #define ADP_Stopped_IRQ ADPSUBREASON(CI_TADP,6)
2351 #define ADP_Stopped_FIQ ADPSUBREASON(CI_TADP,7)
2352
2353 /* We leave the rest of what would be the bits in the VectorCatch
2354 * bitmask free for future expansion.
2355 */
2356
2357 /* The following are software reasons for execution stopping: */
2358 #define ADP_Stopped_BreakPoint ADPSUBREASON(CI_TADP,32)
2359 /* Breakpoint was reached
2360 * extra send parameter: word handle - indicates which breakpoint
2361 */
2362
2363 #define ADP_Stopped_WatchPoint ADPSUBREASON(CI_TADP,33)
2364 /* Watchpoint was triggered
2365 * extra send parameter: word handle - indicates which watchpoint
2366 */
2367
2368 #define ADP_Stopped_StepComplete ADPSUBREASON(CI_TADP,34)
2369 /* End of ADP_Step request */
2370
2371 #define ADP_Stopped_RunTimeErrorUnknown ADPSUBREASON(CI_TADP,35)
2372 /*
2373 * non-specific fatal runtime support error
2374 */
2375
2376 #define ADP_Stopped_InternalError ADPSUBREASON(CI_TADP,36)
2377 /* extra send parameter: word error - indicates the nature of the error
2378 *
2379 * An Angel internal error has happened. The error number should be
2380 * displayed for the user to report to his software supplier. Once
2381 * this error has been received the internal state of Angel can no longer
2382 * be trusted.
2383 */
2384
2385 #define ADP_Stopped_UserInterruption ADPSUBREASON(CI_TADP,37)
2386 /* Host requested interruption */
2387
2388 #define ADP_Stopped_ApplicationExit ADPSUBREASON(CI_TADP,38)
2389 /* extra send parameter: word exitcode
2390 * This indicates that the application has exited via exit(), an exitcode
2391 * of zero indiactes successful termination.
2392 */
2393
2394 #define ADP_Stopped_StackOverflow ADPSUBREASON(CI_TADP, 39)
2395 /*
2396 * Software stack overflow has occurred
2397 */
2398
2399 #define ADP_Stopped_DivisionByZero ADPSUBREASON(CI_TADP, 40)
2400 /*
2401 * Division by zero has occurred
2402 */
2403
2404 #define ADP_Stopped_OSSpecific ADPSUBREASON(CI_TADP, 41)
2405 /*
2406 * The OS has requested that execution stops. The OS will know
2407 * why this has happened.
2408 */
2409
2410
2411
2412 /******************************************************************
2413 *
2414 * CI_TTDCC messages (Target-initiated debug comms channel)
2415 *
2416 */
2417
2418 #define ADP_TDCC_ToHost ADPREASON(CI_TTDCC,0)
2419 /* ADP_TDCC_ToHost
2420 * ------------------
2421 * Summary: Send Data down Comms Channel in ToHost direction.
2422 *
2423 * Arguments:
2424 * Send: (word nbytes, words data)
2425 * Return: (word status)
2426 *
2427 * 'nbytes' is number of BYTES to be transferred from the target to the
2428 * host via the Debug Comms channel.
2429 * 'data' is (nbytes/sizeof(word)) WORDS of data to be transferred from
2430 * the target to the host via the Debug Comms channel.
2431 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2432 *
2433 * NOTE: Equivalent to RDP_CCToHost and RDP_CCToHostReply (just set the
2434 * direction bit).
2435 * NOTE II: Current implementations only support single word transfers
2436 * (nbytes = 4).
2437 */
2438
2439
2440 #define ADP_TDCC_FromHost ADPREASON(CI_TTDCC,1)
2441 /* ADP_TDCC_FromHost
2442 * --------------------
2443 * Summary: Send Data down Comms Channel in FromHost direction.
2444 *
2445 * Arguments:
2446 * Send: ()
2447 * Return: (word status, word nbytes, words data)
2448 *
2449 * 'status' is RDIError_NoError to indicate success, non-zero otherwise.
2450 * 'nbytes' is number of BYTES to be transferred from the host to the
2451 * target via the Debug Comms channel, or zero if the host has no data
2452 * to transfer.
2453 * 'data' is (nbytes/sizeof(word)) WORDS of transferred data.
2454 *
2455 * NOTE: Equivalent to RDP_CCFromHost and RDP_CCFromHostReply (just set the
2456 * direction bit).
2457 * NOTE II: Current implementations only support single word transfers
2458 * (nbytes = 4).
2459 */
2460
2461
2462 /*******************************************************************
2463 *
2464 * Error Codes
2465 *
2466 */
2467
2468 #define RDIError_NoError 0
2469
2470 #define RDIError_Reset 1
2471 #define RDIError_UndefinedInstruction 2
2472 #define RDIError_SoftwareInterrupt 3
2473 #define RDIError_PrefetchAbort 4
2474 #define RDIError_DataAbort 5
2475 #define RDIError_AddressException 6
2476 #define RDIError_IRQ 7
2477 #define RDIError_FIQ 8
2478 #define RDIError_Error 9
2479 #define RDIError_BranchThrough0 10
2480
2481 #define RDIError_NotInitialised 128
2482 #define RDIError_UnableToInitialise 129
2483 #define RDIError_WrongByteSex 130
2484 #define RDIError_UnableToTerminate 131
2485 #define RDIError_BadInstruction 132
2486 #define RDIError_IllegalInstruction 133
2487 #define RDIError_BadCPUStateSetting 134
2488 #define RDIError_UnknownCoPro 135
2489 #define RDIError_UnknownCoProState 136
2490 #define RDIError_BadCoProState 137
2491 #define RDIError_BadPointType 138
2492 #define RDIError_UnimplementedType 139
2493 #define RDIError_BadPointSize 140
2494 #define RDIError_UnimplementedSize 141
2495 #define RDIError_NoMorePoints 142
2496 #define RDIError_BreakpointReached 143
2497 #define RDIError_WatchpointAccessed 144
2498 #define RDIError_NoSuchPoint 145
2499 #define RDIError_ProgramFinishedInStep 146
2500 #define RDIError_UserInterrupt 147
2501 #define RDIError_CantSetPoint 148
2502 #define RDIError_IncompatibleRDILevels 149
2503
2504 #define RDIError_CantLoadConfig 150
2505 #define RDIError_BadConfigData 151
2506 #define RDIError_NoSuchConfig 152
2507 #define RDIError_BufferFull 153
2508 #define RDIError_OutOfStore 154
2509 #define RDIError_NotInDownload 155
2510 #define RDIError_PointInUse 156
2511 #define RDIError_BadImageFormat 157
2512 #define RDIError_TargetRunning 158
2513 #define RDIError_DeviceWouldNotOpen 159
2514 #define RDIError_NoSuchHandle 160
2515 #define RDIError_ConflictingPoint 161
2516
2517 #define RDIError_LittleEndian 240
2518 #define RDIError_BigEndian 241
2519 #define RDIError_SoftInitialiseError 242
2520
2521 #define RDIError_InsufficientPrivilege 253
2522 #define RDIError_UnimplementedMessage 254
2523 #define RDIError_UndefinedMessage 255
2524
2525
2526 #endif
2527
2528 /* EOF adp_h */