* Contribute CGEN simulator build support code.
[binutils-gdb.git] / gdb / minimon.h
blob8840df4e2def64533c4fcaf04b9454e3e199e24a
1 /* Definitions and macros for support of AMD's remote debugger, MiniMON.
2 Copyright (C) 1990, 1991 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
22 * Some basic types. FIXME, this should be done by declaring bitfield
23 * sizes in the structs. We can't portably depend on a "long int" being
24 * 32 bits, etc.
26 typedef long int INT32; /* 32 bit integer */
27 typedef unsigned long int UINT32; /* 32 bit integer (unsigned) */
28 typedef unsigned long int ADDR32; /* 32 bit address */
29 typedef unsigned long int INST32; /* 32 bit instruction */
30 typedef long int BOOLEAN; /* Boolean value (32 bit) */
31 typedef unsigned char BYTE; /* byte (8 bit) */
32 typedef short int INT16; /* 16 bit integer */
33 typedef unsigned short int UINT16; /* 16 bit integer (unsigned) */
35 /****************************************************************************/
36 /************************* Message Information ******************************/
37 /****************************************************************************/
40 * Error codes
43 /* General errors */
44 #define EMUSAGE 1 /* Bad args / flags */
45 #define EMFAIL 2 /* Unrecoverable error */
46 #define EMBADADDR 3 /* Illegal address */
47 #define EMBADREG 4 /* Illegal register */
48 #define EMSYNTAX 5 /* Illegal command syntax */
49 #define EMACCESS 6 /* Could not access memory */
50 #define EMALLOC 7 /* Could not allocate memory */
51 #define EMTARGET 8 /* Unknown target type */
52 #define EMHINIT 9 /* Could not initialize host */
53 #define EMCOMM 10 /* Could not open communication channel */
55 /* Message errors */
56 #define EMBADMSG 11 /* Unknown message type */
57 #define EMMSG2BIG 12 /* Message to large for buffer */
58 #define EMNOSEND 13 /* Could not send message */
59 #define EMNORECV 14 /* Could not receive message */
61 #define EMRESET 15 /* Could not RESET target */
62 #define EMCONFIG 16 /* Could not get target CONFIG */
63 #define EMSTATUS 17 /* Could not get target STATUS */
64 #define EMREAD 18 /* Could not READ target memory */
65 #define EMWRITE 19 /* Could not WRITE target memory */
66 #define EMBKPTSET 20 /* Could not set breakpoint */
67 #define EMBKPTRM 21 /* Could not remove breakpoint */
68 #define EMBKPTSTAT 22 /* Could not get breakpoint status */
69 #define EMBKPTNONE 23 /* All breakpoints in use */
70 #define EMBKPTUSED 24 /* Breakpoints already in use */
71 #define EMCOPY 25 /* Could not COPY target memory */
72 #define EMFILL 26 /* Could not FILL target memory */
73 #define EMINIT 27 /* Could not initialize target memory */
74 #define EMGO 28 /* Could not start execution */
75 #define EMSTEP 29 /* Could not single step */
76 #define EMBREAK 30 /* Could not BREAK */
77 #define EMHIF 31 /* Could not perform HIF service */
78 #define EMCHANNEL0 32 /* Could not read CHANNEL0 */
79 #define EMCHANNEL1 33 /* Could not write CHANNEL1 */
81 /* COFF file loader errors */
82 #define EMOPEN 34 /* Could not open COFF file */
83 #define EMHDR 35 /* Could not read COFF header */
84 #define EMMAGIC 36 /* Bad magic number */
85 #define EMAOUT 37 /* Could not read COFF a.out header */
86 #define EMSCNHDR 38 /* Could not read COFF section header */
87 #define EMSCN 39 /* Could not read COFF section */
88 #define EMCLOSE 40 /* Could not close COFF file */
90 /* Log file errors */
91 #define EMLOGOPEN 41 /* Could not open log file */
92 #define EMLOGREAD 42 /* Could not read log file */
93 #define EMLOGWRITE 43 /* Could not write to log file */
94 #define EMLOGCLOSE 44 /* Could not close log file */
96 /* Command file errors */
97 #define EMCMDOPEN 45 /* Could not open command file */
98 #define EMCMDREAD 46 /* Could not read command file */
99 #define EMCMDWRITE 47 /* Could not write to command file */
100 #define EMCMDCLOSE 48 /* Could not close comand file */
102 #define EMTIMEOUT 49 /* Host timed out waiting for a message */
103 #define EMCOMMTYPE 50 /* A '-t' flag must be specified */
104 #define EMCOMMERR 51 /* Communication error */
105 #define EMBAUD 52 /* Invalid baud rate specified */
107 * Memory Spaces
109 #define LOCAL_REG 0 /* Local processor register */
110 #define GLOBAL_REG 1 /* Global processor register */
111 #define SPECIAL_REG 2 /* Special processor register */
112 #define TLB_REG 3 /* Translation Lookaside Buffer */
113 #define COPROC_REG 4 /* Coprocessor register */
114 #define I_MEM 5 /* Instruction Memory */
115 #define D_MEM 6 /* Data Memory */
116 #define I_ROM 7 /* Instruction ROM */
117 #define D_ROM 8 /* Data ROM */
118 #define I_O 9 /* Input/Output */
119 #define I_CACHE 10 /* Instruction Cache */
120 #define D_CACHE 11 /* Data Cache */
122 /* To supress warnings for zero length array definitions */
123 #define DUMMY 1
126 ** Host to target definitions
129 #define RESET 0
130 #define CONFIG_REQ 1
131 #define STATUS_REQ 2
132 #define READ_REQ 3
133 #define WRITE_REQ 4
134 #define BKPT_SET 5
135 #define BKPT_RM 6
136 #define BKPT_STAT 7
137 #define COPY 8
138 #define FILL 9
139 #define INIT 10
140 #define GO 11
141 #define STEP 12
142 #define BREAK 13
144 #define HIF_CALL_RTN 64
145 #define CHANNEL0 65
146 #define CHANNEL1_ACK 66
150 ** Target to host definitions
153 #define RESET_ACK 32
154 #define CONFIG 33
155 #define STATUS 34
156 #define READ_ACK 35
157 #define WRITE_ACK 36
158 #define BKPT_SET_ACK 37
159 #define BKPT_RM_ACK 38
160 #define BKPT_STAT_ACK 39
161 #define COPY_ACK 40
162 #define FILL_ACK 41
163 #define INIT_ACK 42
164 #define HALT 43
166 #define ERROR 63
168 #define HIF_CALL 96
169 #define CHANNEL0_ACK 97
170 #define CHANNEL1 98
173 /* A "generic" message */
174 struct generic_msg_t
176 INT32 code; /* generic */
177 INT32 length;
178 BYTE byte[DUMMY];
182 /* A "generic" message (with an INT32 array) */
183 struct generic_int32_msg_t
185 INT32 code; /* generic */
186 INT32 length;
187 INT32 int32[DUMMY];
192 ** Host to target messages
195 struct reset_msg_t
197 INT32 code; /* 0 */
198 INT32 length;
202 struct config_req_msg_t
204 INT32 code; /* 1 */
205 INT32 length;
209 struct status_req_msg_t
211 INT32 code; /* 2 */
212 INT32 length;
216 struct read_req_msg_t
218 INT32 code; /* 3 */
219 INT32 length;
220 INT32 memory_space;
221 ADDR32 address;
222 INT32 byte_count;
226 struct write_req_msg_t
228 INT32 code; /* 4 */
229 INT32 length;
230 INT32 memory_space;
231 ADDR32 address;
232 INT32 byte_count;
233 BYTE data[DUMMY];
237 struct write_r_msg_t
239 INT32 code; /* 4 */
240 INT32 length;
241 INT32 memory_space;
242 ADDR32 address;
243 INT32 byte_count;
244 INT32 data[DUMMY];
248 struct bkpt_set_msg_t
250 INT32 code; /* 5 */
251 INT32 length;
252 INT32 memory_space;
253 ADDR32 bkpt_addr;
254 INT32 pass_count;
255 INT32 bkpt_type;
259 struct bkpt_rm_msg_t
261 INT32 code; /* 6 */
262 INT32 length;
263 INT32 memory_space;
264 ADDR32 bkpt_addr;
268 struct bkpt_stat_msg_t
270 INT32 code; /* 7 */
271 INT32 length;
272 INT32 memory_space;
273 ADDR32 bkpt_addr;
277 struct copy_msg_t
279 INT32 code; /* 8 */
280 INT32 length;
281 INT32 source_space;
282 ADDR32 source_addr;
283 INT32 dest_space;
284 ADDR32 dest_addr;
285 INT32 byte_count;
289 struct fill_msg_t
291 INT32 code; /* 9 */
292 INT32 length;
293 INT32 memory_space;
294 ADDR32 start_addr;
295 INT32 fill_count;
296 INT32 byte_count;
297 BYTE fill_data[DUMMY];
301 struct init_msg_t
303 INT32 code; /* 10 */
304 INT32 length;
305 ADDR32 text_start;
306 ADDR32 text_end;
307 ADDR32 data_start;
308 ADDR32 data_end;
309 ADDR32 entry_point;
310 INT32 mem_stack_size;
311 INT32 reg_stack_size;
312 ADDR32 arg_start;
313 INT32 os_control;
317 struct go_msg_t
319 INT32 code; /* 11 */
320 INT32 length;
324 struct step_msg_t
326 INT32 code; /* 12 */
327 INT32 length;
328 INT32 count;
332 struct break_msg_t
334 INT32 code; /* 13 */
335 INT32 length;
339 struct hif_call_rtn_msg_t
341 INT32 code; /* 64 */
342 INT32 length;
343 INT32 service_number;
344 INT32 gr121;
345 INT32 gr96;
346 INT32 gr97;
350 struct channel0_msg_t
352 INT32 code; /* 65 */
353 INT32 length;
354 BYTE data;
358 struct channel1_ack_msg_t
360 INT32 code; /* 66 */
361 INT32 length;
366 ** Target to host messages
370 struct reset_ack_msg_t
372 INT32 code; /* 32 */
373 INT32 length;
377 struct config_msg_t
379 INT32 code; /* 33 */
380 INT32 length;
381 INT32 processor_id;
382 INT32 version;
383 ADDR32 I_mem_start;
384 INT32 I_mem_size;
385 ADDR32 D_mem_start;
386 INT32 D_mem_size;
387 ADDR32 ROM_start;
388 INT32 ROM_size;
389 INT32 max_msg_size;
390 INT32 max_bkpts;
391 INT32 coprocessor;
392 INT32 reserved;
396 struct status_msg_t
398 INT32 code; /* 34 */
399 INT32 length;
400 INT32 msgs_sent;
401 INT32 msgs_received;
402 INT32 errors;
403 INT32 bkpts_hit;
404 INT32 bkpts_free;
405 INT32 traps;
406 INT32 fills;
407 INT32 spills;
408 INT32 cycles;
409 INT32 reserved;
413 struct read_ack_msg_t
415 INT32 code; /* 35 */
416 INT32 length;
417 INT32 memory_space;
418 ADDR32 address;
419 INT32 byte_count;
420 BYTE data[DUMMY];
423 struct read_r_ack_msg_t
425 INT32 code; /* 35 */
426 INT32 length;
427 INT32 memory_space;
428 ADDR32 address;
429 INT32 byte_count;
430 INT32 data[DUMMY];
434 struct write_ack_msg_t
436 INT32 code; /* 36 */
437 INT32 length;
438 INT32 memory_space;
439 ADDR32 address;
440 INT32 byte_count;
444 struct bkpt_set_ack_msg_t
446 INT32 code; /* 37 */
447 INT32 length;
448 INT32 memory_space;
449 ADDR32 address;
450 INT32 pass_count;
451 INT32 bkpt_type;
455 struct bkpt_rm_ack_msg_t
457 INT32 code; /* 38 */
458 INT32 length;
459 INT32 memory_space;
460 ADDR32 address;
464 struct bkpt_stat_ack_msg_t
466 INT32 code; /* 39 */
467 INT32 length;
468 INT32 memory_space;
469 ADDR32 address;
470 INT32 pass_count;
471 INT32 bkpt_type;
475 struct copy_ack_msg_t
477 INT32 code; /* 40 */
478 INT32 length;
479 INT32 source_space;
480 ADDR32 source_addr;
481 INT32 dest_space;
482 ADDR32 dest_addr;
483 INT32 byte_count;
487 struct fill_ack_msg_t
489 INT32 code; /* 41 */
490 INT32 length;
491 INT32 memory_space;
492 ADDR32 start_addr;
493 INT32 fill_count;
494 INT32 byte_count;
498 struct init_ack_msg_t
500 INT32 code; /* 42 */
501 INT32 length;
505 struct halt_msg_t
507 INT32 code; /* 43 */
508 INT32 length;
509 INT32 memory_space;
510 ADDR32 pc0;
511 ADDR32 pc1;
512 INT32 trap_number;
516 struct error_msg_t
518 INT32 code; /* 63 */
519 INT32 length;
520 INT32 error_code;
521 INT32 memory_space;
522 ADDR32 address;
526 struct hif_call_msg_t
528 INT32 code; /* 96 */
529 INT32 length;
530 INT32 service_number;
531 INT32 lr2;
532 INT32 lr3;
533 INT32 lr4;
537 struct channel0_ack_msg_t
539 INT32 code; /* 97 */
540 INT32 length;
544 struct channel1_msg_t
546 INT32 code; /* 98 */
547 INT32 length;
548 BYTE data[DUMMY];
554 ** Union all of the message types together
557 union msg_t
559 struct generic_msg_t generic_msg;
560 struct generic_int32_msg_t generic_int32_msg;
562 struct reset_msg_t reset_msg;
563 struct config_req_msg_t config_req_msg;
564 struct status_req_msg_t status_req_msg;
565 struct read_req_msg_t read_req_msg;
566 struct write_req_msg_t write_req_msg;
567 struct write_r_msg_t write_r_msg;
568 struct bkpt_set_msg_t bkpt_set_msg;
569 struct bkpt_rm_msg_t bkpt_rm_msg;
570 struct bkpt_stat_msg_t bkpt_stat_msg;
571 struct copy_msg_t copy_msg;
572 struct fill_msg_t fill_msg;
573 struct init_msg_t init_msg;
574 struct go_msg_t go_msg;
575 struct step_msg_t step_msg;
576 struct break_msg_t break_msg;
578 struct hif_call_rtn_msg_t hif_call_rtn_msg;
579 struct channel0_msg_t channel0_msg;
580 struct channel1_ack_msg_t channel1_ack_msg;
582 struct reset_ack_msg_t reset_ack_msg;
583 struct config_msg_t config_msg;
584 struct status_msg_t status_msg;
585 struct read_ack_msg_t read_ack_msg;
586 struct read_r_ack_msg_t read_r_ack_msg;
587 struct write_ack_msg_t write_ack_msg;
588 struct bkpt_set_ack_msg_t bkpt_set_ack_msg;
589 struct bkpt_rm_ack_msg_t bkpt_rm_ack_msg;
590 struct bkpt_stat_ack_msg_t bkpt_stat_ack_msg;
591 struct copy_ack_msg_t copy_ack_msg;
592 struct fill_ack_msg_t fill_ack_msg;
593 struct init_ack_msg_t init_ack_msg;
594 struct halt_msg_t halt_msg;
596 struct error_msg_t error_msg;
598 struct hif_call_msg_t hif_call_msg;
599 struct channel0_ack_msg_t channel0_ack_msg;
600 struct channel1_msg_t channel1_msg;