]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* Definitions and macros for support of AMD's remote debugger, MiniMON. |
2 | Copyright (C) 1990, 1991 Free Software Foundation, Inc. | |
3 | ||
c5aa993b | 4 | This file is part of GDB. |
c906108c | 5 | |
c5aa993b JM |
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. | |
c906108c | 10 | |
c5aa993b JM |
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. | |
c906108c | 15 | |
c5aa993b JM |
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. */ | |
c906108c SS |
20 | |
21 | /* | |
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. | |
25 | */ | |
c5aa993b JM |
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) */ | |
c906108c SS |
34 | |
35 | /****************************************************************************/ | |
36 | /************************* Message Information ******************************/ | |
37 | /****************************************************************************/ | |
38 | ||
39 | /* | |
40 | * Error codes | |
41 | */ | |
42 | ||
43 | /* General errors */ | |
c5aa993b JM |
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 */ | |
c906108c SS |
54 | |
55 | /* Message errors */ | |
c5aa993b JM |
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 */ | |
60 | ||
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 */ | |
c906108c SS |
80 | |
81 | /* COFF file loader errors */ | |
c5aa993b JM |
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 */ | |
c906108c SS |
89 | |
90 | /* Log file errors */ | |
c5aa993b JM |
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 */ | |
c906108c SS |
95 | |
96 | /* Command file errors */ | |
c5aa993b JM |
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 */ | |
101 | ||
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 */ | |
c906108c SS |
106 | /* |
107 | * Memory Spaces | |
108 | */ | |
c5aa993b JM |
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 */ | |
c906108c SS |
121 | |
122 | /* To supress warnings for zero length array definitions */ | |
123 | #define DUMMY 1 | |
124 | ||
125 | /* | |
c5aa993b JM |
126 | ** Host to target definitions |
127 | */ | |
c906108c SS |
128 | |
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 | |
143 | ||
144 | #define HIF_CALL_RTN 64 | |
145 | #define CHANNEL0 65 | |
146 | #define CHANNEL1_ACK 66 | |
147 | ||
148 | ||
149 | /* | |
c5aa993b JM |
150 | ** Target to host definitions |
151 | */ | |
c906108c SS |
152 | |
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 | |
165 | ||
166 | #define ERROR 63 | |
167 | ||
168 | #define HIF_CALL 96 | |
169 | #define CHANNEL0_ACK 97 | |
170 | #define CHANNEL1 98 | |
171 | ||
172 | ||
173 | /* A "generic" message */ | |
c5aa993b JM |
174 | struct generic_msg_t |
175 | { | |
176 | INT32 code; /* generic */ | |
177 | INT32 length; | |
178 | BYTE byte[DUMMY]; | |
179 | }; | |
c906108c SS |
180 | |
181 | ||
182 | /* A "generic" message (with an INT32 array) */ | |
c5aa993b JM |
183 | struct generic_int32_msg_t |
184 | { | |
185 | INT32 code; /* generic */ | |
186 | INT32 length; | |
187 | INT32 int32[DUMMY]; | |
188 | }; | |
c906108c SS |
189 | |
190 | ||
191 | /* | |
c5aa993b JM |
192 | ** Host to target messages |
193 | */ | |
c906108c | 194 | |
c5aa993b JM |
195 | struct reset_msg_t |
196 | { | |
197 | INT32 code; /* 0 */ | |
198 | INT32 length; | |
199 | }; | |
200 | ||
201 | ||
202 | struct config_req_msg_t | |
203 | { | |
204 | INT32 code; /* 1 */ | |
205 | INT32 length; | |
206 | }; | |
207 | ||
208 | ||
209 | struct status_req_msg_t | |
210 | { | |
211 | INT32 code; /* 2 */ | |
212 | INT32 length; | |
213 | }; | |
214 | ||
215 | ||
216 | struct read_req_msg_t | |
217 | { | |
218 | INT32 code; /* 3 */ | |
219 | INT32 length; | |
220 | INT32 memory_space; | |
221 | ADDR32 address; | |
222 | INT32 byte_count; | |
223 | }; | |
224 | ||
225 | ||
226 | struct write_req_msg_t | |
227 | { | |
228 | INT32 code; /* 4 */ | |
229 | INT32 length; | |
230 | INT32 memory_space; | |
231 | ADDR32 address; | |
232 | INT32 byte_count; | |
233 | BYTE data[DUMMY]; | |
234 | }; | |
235 | ||
236 | ||
237 | struct write_r_msg_t | |
238 | { | |
239 | INT32 code; /* 4 */ | |
240 | INT32 length; | |
241 | INT32 memory_space; | |
242 | ADDR32 address; | |
243 | INT32 byte_count; | |
244 | INT32 data[DUMMY]; | |
245 | }; | |
246 | ||
247 | ||
248 | struct bkpt_set_msg_t | |
249 | { | |
250 | INT32 code; /* 5 */ | |
251 | INT32 length; | |
252 | INT32 memory_space; | |
253 | ADDR32 bkpt_addr; | |
254 | INT32 pass_count; | |
255 | INT32 bkpt_type; | |
256 | }; | |
257 | ||
258 | ||
259 | struct bkpt_rm_msg_t | |
260 | { | |
261 | INT32 code; /* 6 */ | |
262 | INT32 length; | |
263 | INT32 memory_space; | |
264 | ADDR32 bkpt_addr; | |
265 | }; | |
266 | ||
267 | ||
268 | struct bkpt_stat_msg_t | |
269 | { | |
270 | INT32 code; /* 7 */ | |
271 | INT32 length; | |
272 | INT32 memory_space; | |
273 | ADDR32 bkpt_addr; | |
274 | }; | |
275 | ||
276 | ||
277 | struct copy_msg_t | |
278 | { | |
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; | |
286 | }; | |
287 | ||
288 | ||
289 | struct fill_msg_t | |
290 | { | |
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]; | |
298 | }; | |
299 | ||
300 | ||
301 | struct init_msg_t | |
302 | { | |
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; | |
314 | }; | |
315 | ||
316 | ||
317 | struct go_msg_t | |
318 | { | |
319 | INT32 code; /* 11 */ | |
320 | INT32 length; | |
321 | }; | |
322 | ||
323 | ||
324 | struct step_msg_t | |
325 | { | |
326 | INT32 code; /* 12 */ | |
327 | INT32 length; | |
328 | INT32 count; | |
329 | }; | |
330 | ||
331 | ||
332 | struct break_msg_t | |
333 | { | |
334 | INT32 code; /* 13 */ | |
335 | INT32 length; | |
336 | }; | |
337 | ||
338 | ||
339 | struct hif_call_rtn_msg_t | |
340 | { | |
341 | INT32 code; /* 64 */ | |
342 | INT32 length; | |
343 | INT32 service_number; | |
344 | INT32 gr121; | |
345 | INT32 gr96; | |
346 | INT32 gr97; | |
347 | }; | |
348 | ||
349 | ||
350 | struct channel0_msg_t | |
351 | { | |
352 | INT32 code; /* 65 */ | |
353 | INT32 length; | |
354 | BYTE data; | |
355 | }; | |
356 | ||
357 | ||
358 | struct channel1_ack_msg_t | |
359 | { | |
360 | INT32 code; /* 66 */ | |
361 | INT32 length; | |
362 | }; | |
c906108c SS |
363 | |
364 | ||
365 | /* | |
c5aa993b JM |
366 | ** Target to host messages |
367 | */ | |
c906108c SS |
368 | |
369 | ||
c5aa993b JM |
370 | struct reset_ack_msg_t |
371 | { | |
372 | INT32 code; /* 32 */ | |
373 | INT32 length; | |
374 | }; | |
375 | ||
376 | ||
377 | struct config_msg_t | |
378 | { | |
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; | |
393 | }; | |
394 | ||
395 | ||
396 | struct status_msg_t | |
397 | { | |
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; | |
410 | }; | |
411 | ||
412 | ||
413 | struct read_ack_msg_t | |
414 | { | |
415 | INT32 code; /* 35 */ | |
416 | INT32 length; | |
417 | INT32 memory_space; | |
418 | ADDR32 address; | |
419 | INT32 byte_count; | |
420 | BYTE data[DUMMY]; | |
421 | }; | |
422 | ||
423 | struct read_r_ack_msg_t | |
424 | { | |
425 | INT32 code; /* 35 */ | |
426 | INT32 length; | |
427 | INT32 memory_space; | |
428 | ADDR32 address; | |
429 | INT32 byte_count; | |
430 | INT32 data[DUMMY]; | |
431 | }; | |
432 | ||
433 | ||
434 | struct write_ack_msg_t | |
435 | { | |
436 | INT32 code; /* 36 */ | |
437 | INT32 length; | |
438 | INT32 memory_space; | |
439 | ADDR32 address; | |
440 | INT32 byte_count; | |
441 | }; | |
442 | ||
443 | ||
444 | struct bkpt_set_ack_msg_t | |
445 | { | |
446 | INT32 code; /* 37 */ | |
447 | INT32 length; | |
448 | INT32 memory_space; | |
449 | ADDR32 address; | |
450 | INT32 pass_count; | |
451 | INT32 bkpt_type; | |
452 | }; | |
453 | ||
454 | ||
455 | struct bkpt_rm_ack_msg_t | |
456 | { | |
457 | INT32 code; /* 38 */ | |
458 | INT32 length; | |
459 | INT32 memory_space; | |
460 | ADDR32 address; | |
461 | }; | |
462 | ||
463 | ||
464 | struct bkpt_stat_ack_msg_t | |
465 | { | |
466 | INT32 code; /* 39 */ | |
467 | INT32 length; | |
468 | INT32 memory_space; | |
469 | ADDR32 address; | |
470 | INT32 pass_count; | |
471 | INT32 bkpt_type; | |
472 | }; | |
473 | ||
474 | ||
475 | struct copy_ack_msg_t | |
476 | { | |
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; | |
484 | }; | |
485 | ||
486 | ||
487 | struct fill_ack_msg_t | |
488 | { | |
489 | INT32 code; /* 41 */ | |
490 | INT32 length; | |
491 | INT32 memory_space; | |
492 | ADDR32 start_addr; | |
493 | INT32 fill_count; | |
494 | INT32 byte_count; | |
495 | }; | |
496 | ||
497 | ||
498 | struct init_ack_msg_t | |
499 | { | |
500 | INT32 code; /* 42 */ | |
501 | INT32 length; | |
502 | }; | |
503 | ||
504 | ||
505 | struct halt_msg_t | |
506 | { | |
507 | INT32 code; /* 43 */ | |
508 | INT32 length; | |
509 | INT32 memory_space; | |
510 | ADDR32 pc0; | |
511 | ADDR32 pc1; | |
512 | INT32 trap_number; | |
513 | }; | |
514 | ||
515 | ||
516 | struct error_msg_t | |
517 | { | |
518 | INT32 code; /* 63 */ | |
519 | INT32 length; | |
520 | INT32 error_code; | |
521 | INT32 memory_space; | |
522 | ADDR32 address; | |
523 | }; | |
524 | ||
525 | ||
526 | struct hif_call_msg_t | |
527 | { | |
528 | INT32 code; /* 96 */ | |
529 | INT32 length; | |
530 | INT32 service_number; | |
531 | INT32 lr2; | |
532 | INT32 lr3; | |
533 | INT32 lr4; | |
534 | }; | |
535 | ||
536 | ||
537 | struct channel0_ack_msg_t | |
538 | { | |
539 | INT32 code; /* 97 */ | |
540 | INT32 length; | |
541 | }; | |
542 | ||
543 | ||
544 | struct channel1_msg_t | |
545 | { | |
546 | INT32 code; /* 98 */ | |
547 | INT32 length; | |
548 | BYTE data[DUMMY]; | |
549 | }; | |
c906108c SS |
550 | |
551 | ||
552 | ||
553 | /* | |
c5aa993b JM |
554 | ** Union all of the message types together |
555 | */ | |
556 | ||
557 | union msg_t | |
558 | { | |
559 | struct generic_msg_t generic_msg; | |
560 | struct generic_int32_msg_t generic_int32_msg; | |
561 | ||
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; | |
577 | ||
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; | |
581 | ||
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; | |
595 | ||
596 | struct error_msg_t error_msg; | |
597 | ||
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; | |
601 | }; |