OSDN Git Service

Initial revision
[pf3gnuchains/pf3gnuchains3x.git] / gdb / minimon.h
1 /* Definitions and macros for support of AMD's remote debugger, MiniMON.
2    Copyright (C) 1990, 1991 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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, Boston, MA 02111-1307, USA.  */
19
20 /*
21  * Some basic types.  FIXME, this should be done by declaring bitfield
22  * sizes in the structs.  We can't portably depend on a "long int" being
23  * 32 bits, etc.
24  */
25 typedef long int INT32;            /* 32 bit integer */
26 typedef unsigned long int UINT32;  /* 32 bit integer (unsigned) */
27 typedef unsigned long int ADDR32;  /* 32 bit address */
28 typedef unsigned long int INST32;  /* 32 bit instruction */
29 typedef long int BOOLEAN;          /* Boolean value (32 bit) */
30 typedef unsigned char BYTE;        /* byte (8 bit) */
31 typedef short int INT16;           /* 16 bit integer */
32 typedef unsigned short int UINT16; /* 16 bit integer (unsigned) */
33
34 /****************************************************************************/
35 /************************* Message Information ******************************/
36 /****************************************************************************/
37
38 /*
39  * Error codes 
40  */
41
42 /* General errors */
43 #define EMUSAGE     1  /* Bad args / flags               */
44 #define EMFAIL      2  /* Unrecoverable error            */
45 #define EMBADADDR   3  /* Illegal address                */
46 #define EMBADREG    4  /* Illegal register               */
47 #define EMSYNTAX    5  /* Illegal command syntax         */
48 #define EMACCESS    6  /* Could not access memory        */
49 #define EMALLOC     7  /* Could not allocate memory      */
50 #define EMTARGET    8  /* Unknown target type            */
51 #define EMHINIT     9  /* Could not initialize host      */
52 #define EMCOMM     10  /* Could not open communication channel */
53
54 /* Message errors */
55 #define EMBADMSG   11  /* Unknown message type           */
56 #define EMMSG2BIG  12  /* Message to large for buffer    */
57 #define EMNOSEND   13  /* Could not send message         */
58 #define EMNORECV   14  /* Could not receive message      */
59
60 #define EMRESET    15  /* Could not RESET target         */
61 #define EMCONFIG   16  /* Could not get target CONFIG    */
62 #define EMSTATUS   17  /* Could not get target STATUS    */
63 #define EMREAD     18  /* Could not READ target memory   */
64 #define EMWRITE    19  /* Could not WRITE target memory  */
65 #define EMBKPTSET  20  /* Could not set breakpoint       */
66 #define EMBKPTRM   21  /* Could not remove breakpoint    */
67 #define EMBKPTSTAT 22  /* Could not get breakpoint status */
68 #define EMBKPTNONE 23  /* All breakpoints in use         */
69 #define EMBKPTUSED 24  /* Breakpoints already in use     */
70 #define EMCOPY     25  /* Could not COPY target memory   */
71 #define EMFILL     26  /* Could not FILL target memory   */
72 #define EMINIT     27  /* Could not initialize target memory */
73 #define EMGO       28  /* Could not start execution      */
74 #define EMSTEP     29  /* Could not single step          */
75 #define EMBREAK    30  /* Could not BREAK                */
76 #define EMHIF      31  /* Could not perform HIF service  */
77 #define EMCHANNEL0 32  /* Could not read CHANNEL0        */
78 #define EMCHANNEL1 33  /* Could not write CHANNEL1       */
79
80 /* COFF file loader errors */
81 #define EMOPEN     34  /* Could not open COFF file       */
82 #define EMHDR      35  /* Could not read COFF header     */
83 #define EMMAGIC    36  /* Bad magic number               */
84 #define EMAOUT     37  /* Could not read COFF a.out header */
85 #define EMSCNHDR   38  /* Could not read COFF section header */
86 #define EMSCN      39  /* Could not read COFF section    */
87 #define EMCLOSE    40  /* Could not close COFF file      */
88
89 /* Log file errors */
90 #define EMLOGOPEN  41  /* Could not open log file        */
91 #define EMLOGREAD  42  /* Could not read log file        */
92 #define EMLOGWRITE 43  /* Could not write to log file    */
93 #define EMLOGCLOSE 44  /* Could not close log file       */
94
95 /* Command file errors */
96 #define EMCMDOPEN  45  /* Could not open command file    */
97 #define EMCMDREAD  46  /* Could not read command file    */
98 #define EMCMDWRITE 47  /* Could not write to command file */
99 #define EMCMDCLOSE 48  /* Could not close comand file    */
100
101 #define EMTIMEOUT  49  /* Host timed out waiting for a message */
102 #define EMCOMMTYPE 50  /* A '-t' flag must be specified  */
103 #define EMCOMMERR  51  /* Communication error            */
104 #define EMBAUD     52  /* Invalid baud rate specified    */
105 /*
106  * Memory Spaces
107  */
108 #define LOCAL_REG    0  /* Local processor register     */
109 #define GLOBAL_REG   1  /* Global processor register    */
110 #define SPECIAL_REG  2  /* Special processor register   */
111 #define TLB_REG      3  /* Translation Lookaside Buffer */
112 #define COPROC_REG   4  /* Coprocessor register         */
113 #define I_MEM        5  /* Instruction Memory           */
114 #define D_MEM        6  /* Data Memory                  */
115 #define I_ROM        7  /* Instruction ROM              */
116 #define D_ROM        8  /* Data ROM                     */
117 #define I_O          9  /* Input/Output                 */
118 #define I_CACHE     10  /* Instruction Cache            */
119 #define D_CACHE     11  /* Data Cache                   */
120
121 /* To supress warnings for zero length array definitions */
122 #define DUMMY 1
123
124 /*
125 ** Host to target definitions
126 */
127
128 #define RESET          0
129 #define CONFIG_REQ     1
130 #define STATUS_REQ     2
131 #define READ_REQ       3
132 #define WRITE_REQ      4
133 #define BKPT_SET       5
134 #define BKPT_RM        6
135 #define BKPT_STAT      7
136 #define COPY           8
137 #define FILL           9
138 #define INIT          10
139 #define GO            11
140 #define STEP          12
141 #define BREAK         13
142
143 #define HIF_CALL_RTN  64
144 #define CHANNEL0      65
145 #define CHANNEL1_ACK  66
146
147
148 /*
149 ** Target to host definitions
150 */
151
152 #define RESET_ACK     32
153 #define CONFIG        33
154 #define STATUS        34
155 #define READ_ACK      35
156 #define WRITE_ACK     36
157 #define BKPT_SET_ACK  37
158 #define BKPT_RM_ACK   38
159 #define BKPT_STAT_ACK 39
160 #define COPY_ACK      40
161 #define FILL_ACK      41
162 #define INIT_ACK      42
163 #define HALT          43
164
165 #define ERROR         63
166
167 #define HIF_CALL      96
168 #define CHANNEL0_ACK  97
169 #define CHANNEL1      98
170
171
172 /* A "generic" message */
173 struct generic_msg_t {
174           INT32    code;  /* generic */
175           INT32    length;
176           BYTE     byte[DUMMY];
177 };
178
179
180 /* A "generic" message (with an INT32 array) */
181 struct generic_int32_msg_t {
182           INT32    code;  /* generic */
183           INT32    length;
184           INT32    int32[DUMMY];
185 };
186
187
188 /*
189 ** Host to target messages
190 */
191
192 struct reset_msg_t {
193           INT32    code;  /* 0 */
194           INT32    length;
195 };
196
197
198 struct config_req_msg_t {
199           INT32    code;  /* 1 */
200           INT32    length;
201 };
202
203
204 struct status_req_msg_t {
205           INT32    code;  /* 2 */
206           INT32    length;
207 };
208
209
210 struct read_req_msg_t {
211           INT32    code;  /* 3 */
212           INT32    length;
213           INT32    memory_space;
214           ADDR32   address;
215           INT32    byte_count;
216 };
217
218
219 struct write_req_msg_t {
220           INT32    code;  /* 4 */
221           INT32    length;
222           INT32    memory_space;
223           ADDR32   address;
224           INT32    byte_count;
225           BYTE     data[DUMMY];
226 };
227
228
229 struct write_r_msg_t {
230           INT32    code;  /* 4 */
231           INT32    length;
232           INT32    memory_space;
233           ADDR32   address;
234           INT32    byte_count;
235           INT32    data[DUMMY];
236 };
237
238
239 struct bkpt_set_msg_t {
240           INT32    code;  /* 5 */
241           INT32    length;
242           INT32    memory_space;
243           ADDR32   bkpt_addr;
244           INT32    pass_count;
245           INT32    bkpt_type;
246 };
247
248
249 struct bkpt_rm_msg_t {
250           INT32    code;  /* 6 */
251           INT32    length;
252           INT32    memory_space;
253           ADDR32   bkpt_addr;
254 };
255
256
257 struct bkpt_stat_msg_t {
258           INT32    code;  /* 7 */
259           INT32    length;
260           INT32    memory_space;
261           ADDR32   bkpt_addr;
262 };
263
264
265 struct copy_msg_t {
266           INT32    code;  /* 8 */
267           INT32    length;
268           INT32    source_space;
269           ADDR32   source_addr;
270           INT32    dest_space;
271           ADDR32   dest_addr;
272           INT32    byte_count;
273 };
274
275
276 struct fill_msg_t {
277           INT32    code;  /* 9 */
278           INT32    length;
279           INT32    memory_space;
280           ADDR32   start_addr;
281           INT32    fill_count;
282           INT32    byte_count;
283           BYTE     fill_data[DUMMY];
284 };
285
286
287 struct init_msg_t {
288           INT32    code;  /* 10 */
289           INT32    length;
290           ADDR32   text_start;
291           ADDR32   text_end;
292           ADDR32   data_start;
293           ADDR32   data_end;
294           ADDR32   entry_point;
295           INT32    mem_stack_size;
296           INT32    reg_stack_size;
297           ADDR32   arg_start;
298           INT32    os_control;
299 };
300
301
302 struct go_msg_t {
303           INT32    code;  /* 11 */
304           INT32    length;
305 };
306
307
308 struct step_msg_t {
309           INT32    code;  /* 12 */
310           INT32    length;
311           INT32    count;
312 };
313
314
315 struct break_msg_t {
316           INT32    code;  /* 13 */
317           INT32    length;
318 };
319
320
321 struct hif_call_rtn_msg_t {
322           INT32    code;  /* 64 */
323           INT32    length;
324           INT32    service_number;
325           INT32    gr121;
326           INT32    gr96;
327           INT32    gr97;
328 };
329
330
331 struct channel0_msg_t {
332           INT32    code;  /* 65 */
333           INT32    length;
334           BYTE     data;
335 };
336
337
338 struct channel1_ack_msg_t {
339           INT32    code;  /* 66 */
340           INT32    length;
341 };
342
343
344 /*
345 ** Target to host messages
346 */
347
348
349 struct reset_ack_msg_t {
350           INT32    code;  /* 32 */
351           INT32    length;
352 };
353
354
355 struct config_msg_t {
356           INT32    code;  /* 33 */
357           INT32    length;
358           INT32    processor_id;
359           INT32    version;
360           ADDR32   I_mem_start;
361           INT32    I_mem_size;
362           ADDR32   D_mem_start;
363           INT32    D_mem_size;
364           ADDR32   ROM_start;
365           INT32    ROM_size;
366           INT32    max_msg_size;
367           INT32    max_bkpts;
368           INT32    coprocessor;
369           INT32    reserved;
370 };
371
372
373 struct status_msg_t {
374           INT32    code;  /* 34 */
375           INT32    length;
376           INT32    msgs_sent;
377           INT32    msgs_received;
378           INT32    errors;
379           INT32    bkpts_hit;
380           INT32    bkpts_free;
381           INT32    traps;
382           INT32    fills;
383           INT32    spills;
384           INT32    cycles;
385           INT32    reserved;
386 };
387
388
389 struct read_ack_msg_t {
390           INT32    code;  /* 35 */
391           INT32    length;
392           INT32    memory_space;
393           ADDR32   address;
394           INT32    byte_count;
395           BYTE     data[DUMMY];
396 };
397
398 struct read_r_ack_msg_t {
399           INT32    code;  /* 35 */
400           INT32    length;
401           INT32    memory_space;
402           ADDR32   address;
403           INT32    byte_count;
404           INT32    data[DUMMY];
405 };
406
407
408 struct write_ack_msg_t {
409           INT32    code;  /* 36 */
410           INT32    length;
411           INT32    memory_space;
412           ADDR32   address;
413           INT32    byte_count;
414 };
415
416
417 struct bkpt_set_ack_msg_t {
418           INT32    code;  /* 37 */
419           INT32    length;
420           INT32    memory_space;
421           ADDR32   address;
422           INT32    pass_count;
423           INT32    bkpt_type;
424 };
425
426
427 struct bkpt_rm_ack_msg_t {
428           INT32    code;  /* 38 */
429           INT32    length;
430           INT32    memory_space;
431           ADDR32   address;
432 };
433
434
435 struct bkpt_stat_ack_msg_t {
436           INT32    code;  /* 39 */
437           INT32    length; 
438           INT32    memory_space;
439           ADDR32   address;
440           INT32    pass_count;
441           INT32    bkpt_type;
442 };
443
444
445 struct copy_ack_msg_t {
446           INT32    code;  /* 40 */
447           INT32    length;
448           INT32    source_space;
449           ADDR32   source_addr;
450           INT32    dest_space;
451           ADDR32   dest_addr;
452           INT32    byte_count;
453 };
454
455
456 struct fill_ack_msg_t {
457           INT32    code;  /* 41 */
458           INT32    length;
459           INT32    memory_space;
460           ADDR32   start_addr;
461           INT32    fill_count;
462           INT32    byte_count;
463 };
464
465
466 struct init_ack_msg_t {
467           INT32    code;  /* 42 */
468           INT32    length;
469 };
470
471
472 struct halt_msg_t {
473           INT32    code;  /* 43 */
474           INT32    length;
475           INT32    memory_space;
476           ADDR32   pc0;
477           ADDR32   pc1;
478           INT32    trap_number;
479 };
480
481
482 struct error_msg_t {
483           INT32    code;  /* 63 */
484           INT32    length;
485           INT32    error_code;
486           INT32    memory_space;
487           ADDR32   address;
488 };
489
490
491 struct hif_call_msg_t {
492           INT32    code;  /* 96 */
493           INT32    length;
494           INT32    service_number;
495           INT32    lr2;
496           INT32    lr3;
497           INT32    lr4;
498 };
499
500
501 struct channel0_ack_msg_t {
502           INT32    code;  /* 97 */
503           INT32    length;
504 };
505
506
507 struct channel1_msg_t {
508           INT32    code;  /* 98 */
509           INT32    length;
510           BYTE     data[DUMMY];
511 };
512
513
514
515 /*
516 ** Union all of the message types together
517 */
518
519 union msg_t {
520          struct generic_msg_t        generic_msg;
521          struct generic_int32_msg_t  generic_int32_msg;
522
523          struct reset_msg_t          reset_msg;
524          struct config_req_msg_t     config_req_msg;
525          struct status_req_msg_t     status_req_msg;
526          struct read_req_msg_t       read_req_msg;
527          struct write_req_msg_t      write_req_msg;
528          struct write_r_msg_t        write_r_msg;
529          struct bkpt_set_msg_t       bkpt_set_msg;
530          struct bkpt_rm_msg_t        bkpt_rm_msg;
531          struct bkpt_stat_msg_t      bkpt_stat_msg;
532          struct copy_msg_t           copy_msg;
533          struct fill_msg_t           fill_msg;
534          struct init_msg_t           init_msg;
535          struct go_msg_t             go_msg;
536          struct step_msg_t           step_msg;
537          struct break_msg_t          break_msg;
538
539          struct hif_call_rtn_msg_t   hif_call_rtn_msg;
540          struct channel0_msg_t       channel0_msg;
541          struct channel1_ack_msg_t   channel1_ack_msg;
542
543          struct reset_ack_msg_t      reset_ack_msg;
544          struct config_msg_t         config_msg;
545          struct status_msg_t         status_msg;
546          struct read_ack_msg_t       read_ack_msg;
547          struct read_r_ack_msg_t     read_r_ack_msg;
548          struct write_ack_msg_t      write_ack_msg;
549          struct bkpt_set_ack_msg_t   bkpt_set_ack_msg;
550          struct bkpt_rm_ack_msg_t    bkpt_rm_ack_msg;
551          struct bkpt_stat_ack_msg_t  bkpt_stat_ack_msg;
552          struct copy_ack_msg_t       copy_ack_msg;
553          struct fill_ack_msg_t       fill_ack_msg;
554          struct init_ack_msg_t       init_ack_msg;
555          struct halt_msg_t           halt_msg;
556
557          struct error_msg_t          error_msg;
558
559          struct hif_call_msg_t       hif_call_msg;
560          struct channel0_ack_msg_t   channel0_ack_msg;
561          struct channel1_msg_t       channel1_msg;
562 };