OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [utils/] [amd-udi/] [include/] [messages.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* @(#)messages.h       5.19 93/08/10 17:49:09, Srini, AMD */
2
/******************************************************************************
3
 * Copyright 1991 Advanced Micro Devices, Inc.
4
 *
5
 * This software is the property of Advanced Micro Devices, Inc  (AMD)  which
6
 * specifically  grants the user the right to modify, use and distribute this
7
 * software provided this notice is not removed or altered.  All other rights
8
 * are reserved by AMD.
9
 *
10
 * AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
11
 * SOFTWARE.  IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
12
 * DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
13
 * USE OF THIS SOFTWARE.
14
 *
15
 * So that all may benefit from your experience, please report  any  problems
16
 * or  suggestions about this software to the 29K Technical Support Center at
17
 * 800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131  in  the  UK,  or
18
 * 0031-11-1129 in Japan, toll free.  The direct dial number is 512-462-4118.
19
 *
20
 * Advanced Micro Devices, Inc.
21
 * 29K Support Products
22
 * Mail Stop 573
23
 * 5900 E. Ben White Blvd.
24
 * Austin, TX 78741
25
 * 800-292-9263
26
 *****************************************************************************
27
 *      Engineer: Srini Subramanian.
28
 *****************************************************************************
29
 **       This header file describes the messages which are passed
30
 **       between the target and the host.  This file basically defines
31
 **       a variant record of type msg_t.
32
 **
33
 **       Note that the messages use the types defined in the "types.h"
34
 **       header file.
35
 *****************************************************************************
36
 */
37
 
38
#ifndef _MESSAGES_H_INCLUDED_
39
#define _MESSAGES_H_INCLUDED_
40
 
41
#include        "types.h"
42
#include        "mtip.h"
43
 
44
/*
45
** Host to target definitions
46
*/
47
 
48
#define RESET          0
49
#define CONFIG_REQ     1
50
#define STATUS_REQ     2
51
#define READ_REQ       3
52
#define WRITE_REQ      4
53
#define BKPT_SET       5
54
#define BKPT_RM        6
55
#define BKPT_STAT      7
56
#define COPY           8
57
#define FILL           9
58
#define INIT          10
59
#define GO            11
60
#define STEP          12
61
#define BREAK         13
62
 
63
#define HIF_CALL_RTN  64
64
#define CHANNEL0      65
65
#define CHANNEL1_ACK  66
66
#define CHANNEL2_ACK  67
67
#define STDIN_NEEDED_ACK        68
68
#define STDIN_MODE_ACK          69
69
 
70
 
71
/*
72
** Target to host definitions
73
*/
74
 
75
#define RESET_ACK     32
76
#define CONFIG        33
77
#define STATUS        34
78
#define READ_ACK      35
79
#define WRITE_ACK     36
80
#define BKPT_SET_ACK  37
81
#define BKPT_RM_ACK   38
82
#define BKPT_STAT_ACK 39
83
#define COPY_ACK      40
84
#define FILL_ACK      41
85
#define INIT_ACK      42
86
#define HALT          43
87
 
88
#define ERROR         63
89
 
90
#define HIF_CALL      96
91
#define CHANNEL0_ACK  97
92
#define CHANNEL1      98
93
#define CHANNEL2      99
94
#define STDIN_NEEDED_REQ        100
95
#define STDIN_MODE_REQ          101
96
 
97
/*
98
** Endian conversion definitions
99
*/
100
 
101
#define INCOMING_MSG  0
102
#define OUTGOING_MSG  1
103
 
104
 
105
#ifdef  MSDOS
106
#define PARAMS(x)       x
107
#else
108
#define PARAMS(x)       ()
109
#endif
110
 
111
/* A "generic" message */
112
struct generic_msg_t {
113
          INT32    code;  /* generic */
114
          INT32    length;
115
          BYTE     byte;
116
          };
117
 
118
 
119
/* A "generic" message (with an INT32 array) */
120
struct generic_int32_msg_t {
121
          INT32    code;  /* generic */
122
          INT32    length;
123
          INT32    int32;
124
          };
125
 
126
 
127
/*
128
** Host to target messages and routines that build them
129
*/
130
 
131
struct reset_msg_t {
132
          INT32    code;  /* 0 */
133
          INT32    length;
134
          };
135
 
136
struct config_req_msg_t {
137
          INT32    code;  /* 1 */
138
          INT32    length;
139
          };
140
 
141
struct status_req_msg_t {
142
          INT32    code;  /* 2 */
143
          INT32    length;
144
          };
145
 
146
struct read_req_msg_t {
147
          INT32    code;  /* 3 */
148
          INT32    length;
149
          INT32    memory_space;
150
          ADDR32   address;
151
          INT32    count;
152
          INT32    size;
153
          };
154
 
155
struct write_req_msg_t {
156
          INT32    code;  /* 4 */
157
          INT32    length;
158
          INT32    memory_space;
159
          ADDR32   address;
160
          INT32    count;
161
          INT32    size;
162
          BYTE     data;
163
          };
164
 
165
struct write_r_msg_t {
166
          INT32    code;  /* 4 */
167
          INT32    length;
168
          INT32    memory_space;
169
          ADDR32   address;
170
          INT32    byte_count;
171
          INT32    data;
172
          };
173
 
174
 
175
struct bkpt_set_msg_t {
176
          INT32    code;  /* 5 */
177
          INT32    length;
178
          INT32    memory_space;
179
          ADDR32   bkpt_addr;
180
          INT32    pass_count;
181
          INT32    bkpt_type;
182
          };
183
 
184
struct bkpt_rm_msg_t {
185
          INT32    code;  /* 6 */
186
          INT32    length;
187
          INT32    memory_space;
188
          ADDR32   bkpt_addr;
189
          };
190
 
191
struct bkpt_stat_msg_t {
192
          INT32    code;  /* 7 */
193
          INT32    length;
194
          INT32    memory_space;
195
          ADDR32   bkpt_addr;
196
          };
197
 
198
struct copy_msg_t {
199
          INT32    code;  /* 8 */
200
          INT32    length;
201
          INT32    source_space;
202
          ADDR32   source_addr;
203
          INT32    dest_space;
204
          ADDR32   dest_addr;
205
          INT32    count;
206
          INT32    size;
207
          };
208
 
209
struct fill_msg_t {
210
          INT32    code;  /* 9 */
211
          INT32    length;
212
          INT32    memory_space;
213
          ADDR32   start_addr;
214
          INT32    fill_count;
215
          INT32    byte_count;
216
          BYTE     fill_data;
217
          };
218
 
219
struct init_msg_t {
220
          INT32    code;  /* 10 */
221
          INT32    length;
222
          ADDR32   text_start;
223
          ADDR32   text_end;
224
          ADDR32   data_start;
225
          ADDR32   data_end;
226
          ADDR32   entry_point;
227
          INT32    mem_stack_size;
228
          INT32    reg_stack_size;
229
          ADDR32   arg_start;
230
          INT32    os_control;
231
          ADDR32   highmem;
232
          };
233
 
234
struct go_msg_t {
235
          INT32    code;  /* 11 */
236
          INT32    length;
237
          };
238
 
239
struct step_msg_t {
240
          INT32    code;  /* 12 */
241
          INT32    length;
242
          INT32    count;
243
          };
244
 
245
struct break_msg_t {
246
          INT32    code;  /* 13 */
247
          INT32    length;
248
          };
249
 
250
struct hif_call_rtn_msg_t {
251
          INT32    code;  /* 64 */
252
          INT32    length;
253
          INT32    service_number;
254
          INT32    gr121;
255
          INT32    gr96;
256
          INT32    gr97;
257
          };
258
 
259
struct channel0_msg_t {
260
          INT32    code;  /* 65 */
261
          INT32    length;
262
          BYTE     data;
263
          };
264
 
265
struct channel1_ack_msg_t {
266
          INT32    code;  /* 66 */
267
          INT32    length;
268
          INT32    gr96;
269
          };
270
 
271
struct channel2_ack_msg_t {
272
          INT32    code;  /* 67 */
273
          INT32    length;
274
          INT32    gr96;
275
          };
276
 
277
struct stdin_needed_ack_msg_t {
278
          INT32    code;  /* 68 */
279
          INT32    length;
280
          BYTE     data;
281
          };
282
 
283
struct stdin_mode_ack_msg_t {
284
          INT32    code;  /* 69 */
285
          INT32    length;
286
          INT32    mode;
287
          };
288
 
289
/*
290
** Target to host messages
291
*/
292
 
293
 
294
struct reset_ack_msg_t {
295
          INT32    code;  /* 32 */
296
          INT32    length;
297
          };
298
 
299
 
300
struct config_msg_t {
301
          INT32    code;  /* 33 */
302
          INT32    length;
303
          INT32    processor_id;
304
          INT32    version;
305
          ADDR32   I_mem_start;
306
          INT32    I_mem_size;
307
          ADDR32   D_mem_start;
308
          INT32    D_mem_size;
309
          ADDR32   ROM_start;
310
          INT32    ROM_size;
311
          INT32    max_msg_size;
312
          INT32    max_bkpts;
313
          INT32    coprocessor;
314
          INT32    os_version;
315
          };
316
 
317
 
318
struct status_msg_t {
319
          INT32    code;  /* 34 */
320
          INT32    length;
321
          INT32    msgs_sent;
322
          INT32    msgs_received;
323
          INT32    errors;
324
          INT32    bkpts_hit;
325
          INT32    bkpts_free;
326
          INT32    traps;
327
          INT32    fills;
328
          INT32    spills;
329
          INT32    cycles;
330
          INT32    reserved;
331
          };
332
 
333
 
334
struct read_ack_msg_t {
335
          INT32    code;  /* 35 */
336
          INT32    length;
337
          INT32    memory_space;
338
          ADDR32   address;
339
          INT32    byte_count;
340
          BYTE     data;
341
          };
342
 
343
struct read_r_ack_msg_t {
344
          INT32    code;  /* 35 */
345
          INT32    length;
346
          INT32    memory_space;
347
          ADDR32   address;
348
          INT32    byte_count;
349
          INT32    data;
350
          };
351
 
352
 
353
struct write_ack_msg_t {
354
          INT32    code;  /* 36 */
355
          INT32    length;
356
          INT32    memory_space;
357
          ADDR32   address;
358
          INT32    byte_count;
359
          };
360
 
361
 
362
struct bkpt_set_ack_msg_t {
363
          INT32    code;  /* 37 */
364
          INT32    length;
365
          INT32    memory_space;
366
          ADDR32   address;
367
          INT32    pass_count;
368
          INT32    bkpt_type;
369
          };
370
 
371
 
372
struct bkpt_rm_ack_msg_t {
373
          INT32    code;  /* 38 */
374
          INT32    length;
375
          INT32    memory_space;
376
          ADDR32   address;
377
          };
378
 
379
 
380
struct bkpt_stat_ack_msg_t {
381
          INT32    code;  /* 39 */
382
          INT32    length;
383
          INT32    memory_space;
384
          ADDR32   address;
385
          INT32    pass_count;
386
          INT32    bkpt_type;
387
          };
388
 
389
 
390
struct copy_ack_msg_t {
391
          INT32    code;  /* 40 */
392
          INT32    length;
393
          INT32    source_space;
394
          ADDR32   source_addr;
395
          INT32    dest_space;
396
          ADDR32   dest_addr;
397
          INT32    byte_count;
398
          };
399
 
400
 
401
struct fill_ack_msg_t {
402
          INT32    code;  /* 41 */
403
          INT32    length;
404
          INT32    memory_space;
405
          ADDR32   start_addr;
406
          INT32    fill_count;
407
          INT32    byte_count;
408
          };
409
 
410
 
411
struct init_ack_msg_t {
412
          INT32    code;  /* 42 */
413
          INT32    length;
414
          };
415
 
416
 
417
struct halt_msg_t {
418
          INT32    code;  /* 43 */
419
          INT32    length;
420
          INT32    memory_space;
421
          ADDR32   pc0;
422
          ADDR32   pc1;
423
          INT32    trap_number;
424
          };
425
 
426
 
427
struct error_msg_t {
428
          INT32    code;  /* 63 */
429
          INT32    length;
430
          INT32    error_code;
431
          INT32    memory_space;
432
          ADDR32   address;
433
          };
434
 
435
 
436
struct hif_call_msg_t {
437
          INT32    code;  /* 96 */
438
          INT32    length;
439
          INT32    service_number;
440
          INT32    lr2;
441
          INT32    lr3;
442
          INT32    lr4;
443
          };
444
 
445
 
446
struct channel0_ack_msg_t {
447
          INT32    code;  /* 97 */
448
          INT32    length;
449
          };
450
 
451
 
452
struct channel1_msg_t {
453
          INT32    code;  /* 98 */
454
          INT32    length;
455
          BYTE     data;
456
          };
457
 
458
struct channel2_msg_t {
459
          INT32    code;  /* 99 */
460
          INT32    length;
461
          BYTE     data;
462
          };
463
 
464
struct stdin_needed_msg_t {
465
          INT32    code;  /* 100 */
466
          INT32    length;
467
          INT32    nbytes;
468
          };
469
 
470
 
471
struct stdin_mode_msg_t {
472
          INT32    code;  /* 101 */
473
          INT32    length;
474
          INT32    mode;
475
          };
476
 
477
 
478
/*
479
** Union all of the message types together
480
*/
481
 
482
union msg_t {
483
         struct generic_msg_t        generic_msg;
484
         struct generic_int32_msg_t  generic_int32_msg;
485
 
486
         struct reset_msg_t          reset_msg;
487
         struct config_req_msg_t     config_req_msg;
488
         struct status_req_msg_t     status_req_msg;
489
         struct read_req_msg_t       read_req_msg;
490
         struct write_req_msg_t      write_req_msg;
491
         struct write_r_msg_t        write_r_msg;
492
         struct bkpt_set_msg_t       bkpt_set_msg;
493
         struct bkpt_rm_msg_t        bkpt_rm_msg;
494
         struct bkpt_stat_msg_t      bkpt_stat_msg;
495
         struct copy_msg_t           copy_msg;
496
         struct fill_msg_t           fill_msg;
497
         struct init_msg_t           init_msg;
498
         struct go_msg_t             go_msg;
499
         struct step_msg_t           step_msg;
500
         struct break_msg_t          break_msg;
501
 
502
         struct hif_call_rtn_msg_t   hif_call_rtn_msg;
503
         struct channel0_msg_t       channel0_msg;
504
         struct channel1_ack_msg_t   channel1_ack_msg;
505
         struct channel2_ack_msg_t   channel2_ack_msg;
506
         struct stdin_needed_ack_msg_t  stdin_needed_ack_msg;
507
         struct stdin_mode_ack_msg_t    stdin_mode_ack_msg;
508
 
509
         struct reset_ack_msg_t      reset_ack_msg;
510
         struct config_msg_t         config_msg;
511
         struct status_msg_t         status_msg;
512
         struct read_ack_msg_t       read_ack_msg;
513
         struct read_r_ack_msg_t     read_r_ack_msg;
514
         struct write_ack_msg_t      write_ack_msg;
515
         struct bkpt_set_ack_msg_t   bkpt_set_ack_msg;
516
         struct bkpt_rm_ack_msg_t    bkpt_rm_ack_msg;
517
         struct bkpt_stat_ack_msg_t  bkpt_stat_ack_msg;
518
         struct copy_ack_msg_t       copy_ack_msg;
519
         struct fill_ack_msg_t       fill_ack_msg;
520
         struct init_ack_msg_t       init_ack_msg;
521
         struct halt_msg_t           halt_msg;
522
 
523
         struct error_msg_t          error_msg;
524
 
525
         struct hif_call_msg_t       hif_call_msg;
526
         struct channel0_ack_msg_t   channel0_ack_msg;
527
         struct channel1_msg_t       channel1_msg;
528
         struct channel2_msg_t       channel2_msg;
529
         struct stdin_needed_msg_t   stdin_needed_msg;
530
         struct stdin_mode_msg_t     stdin_mode_msg;
531
         };
532
 
533
/*
534
** This macro is used to get the size of a message data
535
** structure.  The divide then multiply by the sizeof(INT32)
536
** gets rid of alignment problems which would cause sizeof()
537
** to return an incorect result.
538
*/
539
 
540
#define MSG_LENGTH(x)  (((sizeof(x) / sizeof(INT32)) *\
541
                       sizeof(INT32)) - (2 * sizeof(INT32)))
542
 
543
/* Functions to initialize, send, and receive messages */
544
 
545
INT32   msg_length PARAMS((INT32 code));
546
 
547
INT32   Mini_msg_init PARAMS((char *targname));
548
 
549
int     Mini_alloc_msgbuf PARAMS((int size));
550
 
551
void    Mini_msg_exit PARAMS((void));
552
 
553
INT32   Mini_msg_send PARAMS((void));
554
 
555
INT32   Mini_msg_recv PARAMS((INT32 RecvMode));
556
 
557
INT32   Mini_init_comm PARAMS((void));
558
 
559
INT32   Mini_reset_comm PARAMS((void));
560
 
561
INT32   Mini_exit_comm PARAMS((void));
562
 
563
void    Mini_go_target PARAMS((void));
564
 
565
INT32   Mini_write_memory PARAMS((INT32 m_space,
566
                                  ADDR32 address,
567
                                  INT32 byte_count,
568
                                  BYTE *buffer));
569
 
570
INT32   Mini_read_memory PARAMS((INT32 m_space,
571
                                  ADDR32 address,
572
                                  INT32 byte_count,
573
                                  BYTE *buffer));
574
 
575
/* Function to build specific Minimon messages in "buffer" */
576
 
577
void    Mini_build_reset_msg PARAMS((void));
578
 
579
void    Mini_build_config_req_msg PARAMS((void));
580
 
581
void    Mini_build_status_req_msg PARAMS((void));
582
 
583
void    Mini_build_read_req_msg PARAMS((INT32 memory_space,
584
                                        ADDR32 address,
585
                                        INT32 count,
586
                                        INT32 size));
587
 
588
void    Mini_build_write_req_msg PARAMS((INT32 memory_space,
589
                                         ADDR32 address,
590
                                         INT32 count,
591
                                         INT32 size,
592
                                         BYTE  *data));
593
 
594
void    Mini_build_bkpt_set_msg PARAMS((INT32 memory_space,
595
                                        ADDR32 bkpt_addr,
596
                                        INT32 pass_count,
597
                                        INT32 bkpt_type));
598
 
599
void    Mini_build_bkpt_rm_msg PARAMS((INT32 memory_space,
600
                                       ADDR32 bkpt_addr));
601
 
602
void    Mini_build_bkpt_stat_msg PARAMS((INT32 memory_space,
603
                                         ADDR32 bkpt_addr));
604
 
605
void    Mini_build_copy_msg PARAMS((INT32 source_space,
606
                                    ADDR32 source_addr,
607
                                    INT32 dest_space,
608
                                    ADDR32 dest_addr,
609
                                    INT32 count,
610
                                    INT32 size));
611
 
612
void    Mini_build_fill_msg PARAMS((INT32 memory_space,
613
                                    ADDR32 start_addr,
614
                                    INT32 fill_count,
615
                                    INT32 byte_count,
616
                                    BYTE *fill_data));
617
 
618
void    Mini_build_init_msg PARAMS((ADDR32 text_start,
619
                                    ADDR32 text_end,
620
                                    ADDR32 data_start,
621
                                    ADDR32 data_end,
622
                                    ADDR32 entry_point,
623
                                    INT32 m_stack,
624
                                    INT32 r_stack,
625
                                    ADDR32 highmem,
626
                                    ADDR32 arg_start,
627
                                    INT32 os_control));
628
 
629
void    Mini_build_go_msg PARAMS((void));
630
 
631
void    Mini_build_step_msg PARAMS((INT32 count));
632
 
633
void    Mini_build_break_msg PARAMS((void));
634
 
635
void    Mini_build_hif_rtn_msg PARAMS((INT32 serv_num,
636
                                            INT32 gr121,
637
                                            INT32 gr96,
638
                                            INT32 gr97));
639
 
640
void    Mini_build_channel0_msg PARAMS((BYTE *data, INT32 count));
641
 
642
void    Mini_build_channel1_ack_msg PARAMS((INT32 gr96));
643
 
644
void    Mini_build_channel2_ack_msg PARAMS((INT32 gr96));
645
 
646
void    Mini_build_stdin_needed_ack_msg PARAMS((UINT32 count,BYTE *data));
647
 
648
void    Mini_build_stdin_mode_ack_msg PARAMS((INT32 mode));
649
 
650
/* Functions to unpack/decipher the target to host messages */
651
 
652
void    Mini_unpack_reset_ack_msg PARAMS((void));
653
 
654
void    Mini_unpack_config_msg PARAMS((TIP_TARGET_CONFIG *target_config));
655
 
656
void    Mini_unpack_status_msg PARAMS((TIP_TARGET_STATUS *target_status));
657
 
658
void    Mini_unpack_read_ack_msg PARAMS((INT32 *mspace,
659
                                         ADDR32 *address,
660
                                         INT32  *byte_count,
661
                                         BYTE *buffer));
662
 
663
void    Mini_unpack_write_ack_msg PARAMS((INT32 *mspace,
664
                                          ADDR32  *address,
665
                                          INT32   *byte_count));
666
 
667
void    Mini_unpack_bkpt_set_ack_msg PARAMS((INT32  *mspace,
668
                                             ADDR32  *address,
669
                                             INT32  *pass_count,
670
                                             INT32  *bkpt_type));
671
 
672
void    Mini_unpack_bkpt_rm_ack_msg PARAMS((INT32  *memory_space,
673
                                        ADDR32 *address));
674
 
675
void    Mini_unpack_bkpt_stat_ack_msg PARAMS((INT32  *mspace,
676
                                              ADDR32 *address,
677
                                              INT32 *pass_count,
678
                                              INT32 *bkpt_type));
679
 
680
void    Mini_unpack_copy_ack_msg PARAMS((INT32  *srcspace,
681
                                         ADDR32  *srcaddr,
682
                                         INT32   *dstspace,
683
                                         ADDR32  *dstaddr,
684
                                         INT32   *byte_count));
685
 
686
void    Mini_unpack_fill_ack_msg PARAMS((INT32  *mspace,
687
                                         ADDR32 *startaddr,
688
                                         INT32  *fillcount,
689
                                         INT32  *bytecount));
690
 
691
void    Mini_unpack_init_ack_msg PARAMS((void));
692
 
693
void    Mini_unpack_halt_msg PARAMS((INT32  *mspace,
694
                                     ADDR32 *pc0,
695
                                     ADDR32 *pc1,
696
                                     INT32  *trap_number));
697
 
698
void    Mini_unpack_error_msg PARAMS((INT32  *errcode,
699
                                      INT32  *mspace,
700
                                      ADDR32 *address));
701
 
702
void    Mini_unpack_ch0_ack_msg PARAMS((void));
703
 
704
void    Mini_unpack_channel1_msg PARAMS((BYTE *data,
705
                                         INT32 *len));
706
 
707
void    Mini_unpack_channel2_msg PARAMS((BYTE *data,
708
                                         INT32 *len));
709
 
710
void    Mini_unpack_hif_msg PARAMS((INT32 *gr121,
711
                                        INT32 *lr2,
712
                                        INT32 *lr3,
713
                                        INT32 *lr4));
714
 
715
void    Mini_unpack_stdin_needed_msg PARAMS((INT32 *nbytes));
716
 
717
void    Mini_unpack_stdin_mode_msg PARAMS((INT32 *mode));
718
 
719
void    CopyMsgFromTarg PARAMS(( union msg_t    *dest));
720
void    CopyMsgToTarg PARAMS(( union msg_t      *source));
721
 
722
#define BUFFER_SIZE     2048
723
 
724
#define BLOCK           1
725
#define NONBLOCK        0
726
 
727
#define MSGRETRY        (INT32) -8
728
 
729
#endif  /* _MESSAGES_H_INCLUDED_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.