StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
msgStruct.h
1 #ifndef MSG_STRUCT_H_
2 #define MSG_STRUCT_H_
3 
4 #include <vxWorks.h>
5 
6 #include <iccp.h>
7 
8 // incoming doorbells to the MZ
9 #define DBEL_ANNCE_SL3_RES1 31 //W1->M
10 #define DBEL_ANNCE_SL3_RES2 30 //W2->M
11 #define DBEL_SND_SL3 29 //SB->M
12 #define DBEL_ANNCE_FMT_DTA1 28 //W1->M
13 #define DBEL_ANNCE_FMT_DTA2 27 //W2->M
14 #define DBEL_FMT_DTA 26 //SB->M, M->W
15 #define DBEL_SND_DTA 25 //SB->M
16 #define DBEL_CNFRM_RLS1 24 //W1->M, data in MBOX4
17 #define DBEL_CNFRM_RLS2 23 //W2->M, data in MBOX5
18 
19 #define DBEL_DMA_DONE 22
20 
21 #define DBEL_MZ_EMUL 11
22 #define DBEL_COMMAND 10 /* any slow command */
23 #define DBEL_REPORT 9 /* print report */
24 #define DBEL_CONS_DTA 0
25 
26 
27 // incoming mailboxes on the MZ PLX
28 #define MBOX_MZ_DMA_DONE1 0 //W1->M
29 #define MBOX_MZ_DMA_DONE2 1 //W2->M
30 #define MBOX_MZ_RLS_TOKEN 2 //SB->M, M->W
31 
32 // incoming but non-IRQ MBOXes on the MZ
33 #define MBOX_MZ_CNFRM_RLS1 4
34 #define MBOX_MZ_CNFRM_RLS2 5
35 
36 // outgoing doorbells - from the MZ to SB
37 #define DBEL_SB_MON_DTA 31
38 #define DBEL_SB_LOG_DTA 30
39 #define DBEL_SB_COMMAND 29
40 #define DBEL_SB_DEATH 28 /* no parameters - announces immediate death of MZ */
41 #define DBEL_SB_CONS_DTA 0
42 
43 // alternative outgoing doorbells on the Monarch PLX
44 #define DBEL_SB_ANNCE_SL3_RES 1
45 #define DBEL_SB_ANNCE_FMT_DTA 2
46 #define DBEL_SB_CNFRM_RLS_TKN 3
47 #define DBEL_SB_CNFRM_SEND 4 // used to inform the SB
48 
49 
50 // outgoing mailboxes on the Universe - from Monarch to SB
51 #define MBOX_SB_ANNCE_SL3_RES 0
52 #define MBOX_SB_ANNCE_FMT_DTA 1
53 #define MBOX_SB_CNFRM_RLS_TKN 2
54 #define MBOX_SB_CNFRM_SEND 3 // used to inform the SB
55 
56 // reasons for dying
57 #define MBOX_MZ_OUT_DEATH 0
58 
59 #define DEATH_DELAY_QUE_FULL 1
60 #define DEATH_BERR 2
61 #define DEATH_OUT_OF_MEM 3
62 #define DEATH_OUT_OF_RSRC 4
63 #define DEATH_RSRC_MISSING 5
64 #define DEATH_BAD_STATE 6
65 
66 
67 
68 //#pragma align 1
69 #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 && I960 == 1
70 #pragma pack 2
71 #endif
72 
73 
74 typedef struct {
75  UINT32 token : 12 ;
76  UINT32 status : 4 ;
77  UINT32 src : 4 ;
78  UINT32 dst : 4 ;
79  UINT32 cmd : 8 ;
80 } msg_0 ;
81 
82 typedef struct {
83  UINT32 token : 12 ;
84  UINT32 status : 4 ;
85  UINT32 src : 4 ;
86  UINT32 dst : 4 ;
87  UINT32 cmd : 8 ;
88 
89  UINT32 d[1] ;
90 
91 } msg_1 ;
92 
93 typedef struct {
94  UINT32 token : 12 ;
95  UINT32 status : 4 ;
96  UINT32 src : 4 ;
97  UINT32 dst : 4 ;
98  UINT32 cmd : 8 ;
99 
100  UINT32 d[2] ;
101 
102 } msg_2 ;
103 
104 typedef struct {
105  UINT32 token : 12 ;
106  UINT32 status : 4 ;
107  UINT32 src : 4 ;
108  UINT32 dst : 4 ;
109  UINT32 cmd : 8 ;
110 
111  UINT32 d[13] ;
112 } msg_A ;
113 
114 
115 //#pragma align 0
116 
117 #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 && I960 == 1
118 #pragma pack 0
119 #endif
120 
121 //#pragma align 4
122 
123 
124 struct mon_dta {
125  UINT32 len ;
126  UINT32 d[256] ;
127 } ;
128 
129 struct console_dta { ;
130  UINT32 len ;
131  UINT8 d[256] ;
132 } ;
133 
134 struct log_dta {
135  UINT32 len ;
136  UINT8 d[256] ;
137 } ;
138 
139 
140 #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 && I960 == 1
141 #pragma pack 4
142 #endif
143 
144 /* resides in the Mezzanine's memory */
145 struct mzMsgStruct {
146  msg_1 annce_sl3_res[2] ; /* from the Workers */
147  msg_1 annce_fmt_dta[2] ; /* from the Workers */
148 
149  msg_1 snd_sl3 ; /* from the SB */
150  msg_1 fmt_dta ; /* from the SB , MSb '1' ->requires checksum */
151  msg_1 snd_dta ; /* from SB */
152 
153  msg_A cmd ; /* any other slow command - from SB */
154 
155  struct console_dta console_dta; /* from SB */
156  struct mon_dta mon_dta ; /* from SB */
157 } ;
158 
159 
160 
161 /* resides in SB's memory */
162 struct rbMsgStruct {
163  /* fast commands via mailboxes on the Universe */
164 
165  msg_1 annce_sl3_res ; /* from the Monarch - use MBOX0 */
166  msg_1 annce_fmt_dta ; /* from the Monarch - use MBOX1 */
167  msg_0 cnfrm_rel_tkn ; /* from the Monarch - use MBOX2 */
168  msg_0 sb_dma ; /* from Monarch - use MBOX3 */
169 
170  /* various slow commands via doorbells */
171 
172 
173  struct mon_dta mon_dta[3] ; /* from MZ */
174  struct log_dta log_dta[3] ; /* from MZ */
175  struct console_dta console_dta[3] ; /* from Mz */
176  msg_A cmd[3] ;
177 } ;
178 
179 
180 //#pragma align 0
181 
182 #if __GNUC__ == 2 && __GNUC_MINOR__ < 96 && I960 == 1
183 #pragma pack 0
184 #endif
185 
186 #if (CPU == I960HX)
187 
188 // src/dest
189 #define MZ_DST_SB 3
190 #define MZ_DST_PROC 4
191 #define MZ_DST_FMT 5
192 #define MZ_DST_DMAER 6
193 
194 extern volatile struct rbMsgStruct *rbMsgStruct ;
195 extern volatile struct mzMsgStruct *mzMsgStruct[3], *mzMyMsgStruct ;
196 
197 extern int sendMsg(msg_A *m, void (*func)(UINT32), UINT32 param) ;
198 extern int msg(int dst, msg_A *mp) ;
199 
200 
201 #endif
202 
203 
204 #ifdef DBG_MSG_STRUCT
205 #include <stdio.h>
206 
207 #ifdef __cplusplus
208 extern "C" {
209 #endif
210 
211 extern void sizer(void) ;
212 
213 #ifdef __cplusplus
214 }
215 #endif
216 
217 
218 void sizer(void)
219 {
220 
221  printf("msg_0 %d\n",sizeof(msg_0));
222  printf("msg_1 %d\n",sizeof(msg_1));
223  printf("msg_2 %d\n",sizeof(msg_2));
224 
225  printf("msg_A %d\n",sizeof(msg_A)) ;
226  printf("mon_dta %d\n",sizeof(struct mon_dta));
227  printf("console_dta %d\n",sizeof(struct console_dta)) ;
228  printf("log_dta %d\n",sizeof(struct log_dta)) ;
229 
230 
231 
232  printf("mzMsgStruct %d\n",sizeof(struct mzMsgStruct)) ;
233  printf("rbMsgStruct %d\n",sizeof(struct rbMsgStruct)) ;
234 
235 
236 
237  printf("msg_0 %d\n",__alignof__(msg_0));
238  printf("msg_1 %d\n",__alignof__(msg_1));
239  printf("msg_2 %d\n",__alignof__(msg_2));
240  printf("msg_A %d\n",__alignof__(msg_A)) ;
241 
242  printf("mon_dta %d\n",__alignof__(struct mon_dta));
243  printf("console_dta %d\n",__alignof__(struct console_dta)) ;
244 
245  printf("log_dta %d\n",__alignof__(struct log_dta)) ;
246 
247 
248  printf("mzMsgStruct %d\n",__alignof__(struct mzMsgStruct)) ;
249  printf("rbMsgStruct %d\n",__alignof__(struct rbMsgStruct)) ;
250 
251  return ;
252 }
253 
254 #endif
255 
256 
257 #endif /* _MSG_STRUCT_H_ */