7 #include "../interface/SourceCardRouting.h" 31 unsigned short (&eIsoCardId)[4],
32 unsigned short (&eIsoRegionId)[4],
33 unsigned short (&eNonIsoRank)[4],
34 unsigned short (&eNonIsoCardId)[4],
35 unsigned short (&eNonIsoRegionId)[4],
36 unsigned short (&MIPbits)[7][2],
37 unsigned short (&Qbits)[7][2],
38 unsigned short (&SFP)[2][4])
const {
42 for (
int i = 0;
i < 7;
i++) {
43 for (
int j = 0;
j < 2;
j++) {
44 SFP[0][0] = SFP[0][0] | ((MIPbits[
i][
j] & 0x01) << ((2 *
i) +
j));
45 SFP[1][0] = SFP[1][0] | ((Qbits[
i][
j] & 0x01) << ((2 *
i) +
j));
49 SFP[0][1] = (eIsoRank[0] & 0x3f) | ((eIsoRegionId[0] & 0x01) << 6) | ((eIsoCardId[0] & 0x07) << 7) |
50 ((eIsoRank[1] & 0x7) << 10);
51 SFP[1][1] = 0x8000 | (eIsoRank[2] & 0x3f) | ((eIsoRegionId[2] & 0x01) << 6) | ((eIsoCardId[2] & 0x07) << 7) |
52 ((eIsoRank[3] & 0x7) << 10);
53 SFP[0][2] = (eNonIsoRank[0] & 0x3f) | ((eNonIsoRegionId[0] & 0x01) << 6) | ((eNonIsoCardId[0] & 0x07) << 7) |
54 ((eIsoRank[1] & 0x38) << 7) | ((eIsoRegionId[1] & 0x01) << 13);
55 SFP[1][2] = 0x8000 | (eNonIsoRank[2] & 0x3f) | ((eNonIsoRegionId[2] & 0x01) << 6) | ((eNonIsoCardId[2] & 0x07) << 7) |
56 ((eIsoRank[3] & 0x38) << 7) | ((eIsoRegionId[3] & 0x01) << 13);
57 SFP[0][3] = (eNonIsoRank[1] & 0x3f) | ((eNonIsoRegionId[1] & 0x01) << 6) | ((eNonIsoCardId[1] & 0x07) << 7) |
58 ((eIsoCardId[1] & 0x07) << 10);
59 SFP[1][3] = 0x8000 | (eNonIsoRank[3] & 0x3f) | ((eNonIsoRegionId[3] & 0x01) << 6) | ((eNonIsoCardId[3] & 0x07) << 7) |
60 ((eIsoCardId[3] & 0x07) << 10);
69 unsigned short (&eIsoCardId)[4],
70 unsigned short (&eIsoRegionId)[4],
71 unsigned short (&eNonIsoRank)[4],
72 unsigned short (&eNonIsoCardId)[4],
73 unsigned short (&eNonIsoRegionId)[4],
74 unsigned short (&MIPbits)[7][2],
75 unsigned short (&Qbits)[7][2],
76 unsigned short (&SFP)[2][4])
const {
77 for (
int i = 0;
i < 7;
i++) {
78 for (
int j = 0;
j < 2;
j++) {
79 MIPbits[
i][
j] = (SFP[0][0] >> ((2 *
i) +
j)) & 0
x1;
80 Qbits[
i][
j] = (SFP[1][0] >> ((2 *
i) +
j)) & 0
x1;
84 eIsoRank[0] = SFP[0][1] & 0x3f;
85 eIsoRank[1] = ((SFP[0][1] >> 10) & 0x7) | ((SFP[0][2] >> 7) & 0x38);
86 eIsoRank[2] = SFP[1][1] & 0x3f;
87 eIsoRank[3] = ((SFP[1][1] >> 10) & 0x7) | ((SFP[1][2] >> 7) & 0x38);
89 eNonIsoRank[0] = SFP[0][2] & 0x3f;
90 eNonIsoRank[1] = SFP[0][3] & 0x3f;
91 eNonIsoRank[2] = SFP[1][2] & 0x3f;
92 eNonIsoRank[3] = SFP[1][3] & 0x3f;
94 eIsoRegionId[0] = (SFP[0][1] >> 6) & 0
x1;
95 eIsoRegionId[1] = (SFP[0][2] >> 13) & 0
x1;
96 eIsoRegionId[2] = (SFP[1][1] >> 6) & 0
x1;
97 eIsoRegionId[3] = (SFP[1][2] >> 13) & 0
x1;
99 eNonIsoRegionId[0] = (SFP[0][2] >> 6) & 0
x1;
100 eNonIsoRegionId[1] = (SFP[0][3] >> 6) & 0
x1;
101 eNonIsoRegionId[2] = (SFP[1][2] >> 6) & 0
x1;
102 eNonIsoRegionId[3] = (SFP[1][3] >> 6) & 0
x1;
104 eIsoCardId[0] = (SFP[0][1] >> 7) & 0x7;
105 eIsoCardId[1] = (SFP[0][3] >> 10) & 0x7;
106 eIsoCardId[2] = (SFP[1][1] >> 7) & 0x7;
107 eIsoCardId[3] = (SFP[1][3] >> 10) & 0x7;
109 eNonIsoCardId[0] = (SFP[0][2] >> 7) & 0x7;
110 eNonIsoCardId[1] = (SFP[0][3] >> 7) & 0x7;
111 eNonIsoCardId[2] = (SFP[1][2] >> 7) & 0x7;
112 eNonIsoCardId[3] = (SFP[1][3] >> 7) & 0x7;
121 unsigned short (&RCof)[7][2],
122 unsigned short (&RCtau)[7][2],
123 unsigned short (&
HF)[4][2],
124 unsigned short (&HFQ)[4][2],
125 unsigned short (&SFP)[2][4])
const {
126 SFP[0][0] = (RC[5][0] & 0x3ff) | ((RCof[5][0] & 0
x1) << 10) | ((RCtau[5][0] & 0
x1) << 11) |
127 ((HFQ[0][0] & 0
x1) << 12) | ((HFQ[1][0] & 0x01) << 13) | ((
HF[0][0] & 0x01) << 14);
128 SFP[1][0] = 0x8000 | (RC[5][1] & 0x3ff) | ((RCof[5][1] & 0
x1) << 10) | ((RCtau[5][1] & 0
x1) << 11) |
129 ((HFQ[2][0] & 0
x1) << 12) | ((HFQ[3][0] & 0x01) << 13) | ((
HF[2][0] & 0x01) << 14);
130 SFP[0][1] = (RC[6][0] & 0x3ff) | ((RCof[6][0] & 0
x1) << 10) | ((RCtau[6][0] & 0
x1) << 11) |
131 ((HFQ[0][1] & 0
x1) << 12) | ((HFQ[1][1] & 0x01) << 13) | ((
HF[0][1] & 0x01) << 14);
132 SFP[1][1] = 0x8000 | (RC[6][1] & 0x3ff) | ((RCof[6][1] & 0
x1) << 10) | ((RCtau[6][1] & 0
x1) << 11) |
133 ((HFQ[2][1] & 0
x1) << 12) | ((HFQ[3][1] & 0x01) << 13) | ((
HF[2][1] & 0x01) << 14);
134 SFP[0][2] = ((
HF[0][0] >> 1) & 0x7f) | ((
HF[1][0] & 0xff) << 7);
135 SFP[1][2] = 0x8000 | ((
HF[2][0] >> 1) & 0x7f) | ((
HF[3][0] & 0xff) << 7);
136 SFP[0][3] = ((
HF[0][1] >> 1) & 0x7f) | ((
HF[1][1] & 0xff) << 7);
137 SFP[1][3] = 0x8000 | ((
HF[2][1] >> 1) & 0x7f) | ((
HF[3][1] & 0xff) << 7);
146 unsigned short (&RCof)[7][2],
147 unsigned short (&RCtau)[7][2],
148 unsigned short (&
HF)[4][2],
149 unsigned short (&HFQ)[4][2],
150 unsigned short (&SFP)[2][4])
const {
151 RC[5][0] = SFP[0][0] & 0x3ff;
152 RC[5][1] = SFP[1][0] & 0x3ff;
153 RC[6][0] = SFP[0][1] & 0x3ff;
154 RC[6][1] = SFP[1][1] & 0x3ff;
156 RCof[5][0] = (SFP[0][0] >> 10) & 0
x1;
157 RCof[5][1] = (SFP[1][0] >> 10) & 0
x1;
158 RCof[6][0] = (SFP[0][1] >> 10) & 0
x1;
159 RCof[6][1] = (SFP[1][1] >> 10) & 0
x1;
161 RCtau[5][0] = (SFP[0][0] >> 11) & 0
x1;
162 RCtau[5][1] = (SFP[1][0] >> 11) & 0
x1;
163 RCtau[6][0] = (SFP[0][1] >> 11) & 0
x1;
164 RCtau[6][1] = (SFP[1][1] >> 11) & 0
x1;
166 HFQ[0][0] = (SFP[0][0] >> 12) & 0
x1;
167 HFQ[1][0] = (SFP[0][0] >> 13) & 0
x1;
168 HFQ[2][0] = (SFP[1][0] >> 12) & 0
x1;
169 HFQ[3][0] = (SFP[1][0] >> 13) & 0
x1;
171 HFQ[0][1] = (SFP[0][1] >> 12) & 0
x1;
172 HFQ[1][1] = (SFP[0][1] >> 13) & 0
x1;
173 HFQ[2][1] = (SFP[1][1] >> 12) & 0
x1;
174 HFQ[3][1] = (SFP[1][1] >> 13) & 0
x1;
176 HF[0][0] = ((SFP[0][2] & 0x7f) << 1) | ((SFP[0][0] >> 14) & 0x01);
177 HF[1][0] = (SFP[0][2] >> 7) & 0xff;
178 HF[2][0] = ((SFP[1][2] & 0x7f) << 1) | ((SFP[1][0] >> 14) & 0x01);
179 HF[3][0] = (SFP[1][2] >> 7) & 0xff;
181 HF[0][1] = ((SFP[0][3] & 0x7f) << 1) | ((SFP[0][1] >> 14) & 0x01);
182 HF[1][1] = (SFP[0][3] >> 7) & 0xff;
183 HF[2][1] = ((SFP[1][3] & 0x7f) << 1) | ((SFP[1][1] >> 14) & 0x01);
184 HF[3][1] = (SFP[1][3] >> 7) & 0xff;
192 unsigned short (&RCof)[7][2],
193 unsigned short (&RCtau)[7][2],
194 unsigned short (&SFP)[2][4])
const {
195 SFP[0][0] = (RC[0][0] & 0x3ff) | ((RCof[0][0] & 0
x1) << 10) | ((RCtau[0][0] & 0
x1) << 11) | ((RC[2][0] & 0x7) << 12);
197 0x8000 | (RC[0][1] & 0x3ff) | ((RCof[0][1] & 0
x1) << 10) | ((RCtau[0][1] & 0
x1) << 11) | ((RC[2][1] & 0x7) << 12);
199 SFP[0][1] = (RC[1][0] & 0x3ff) | ((RCof[1][0] & 0
x1) << 10) | ((RCtau[1][0] & 0
x1) << 11) | ((RC[2][0] & 0x38) << 9);
201 0x8000 | (RC[1][1] & 0x3ff) | ((RCof[1][1] & 0
x1) << 10) | ((RCtau[1][1] & 0
x1) << 11) | ((RC[2][1] & 0x38) << 9);
203 SFP[0][2] = (RC[0][0] & 0x3ff) | ((RCof[0][0] & 0
x1) << 10) | ((RCtau[0][0] & 0
x1) << 11);
204 SFP[1][2] = 0x8000 | (RC[0][1] & 0x3ff) | ((RCof[0][1] & 0
x1) << 10) | ((RCtau[0][1] & 0
x1) << 11);
206 SFP[0][3] = (RC[1][0] & 0x3ff) | ((RCof[1][0] & 0
x1) << 10) | ((RCtau[1][0] & 0
x1) << 11);
207 SFP[1][3] = 0x8000 | (RC[1][1] & 0x3ff) | ((RCof[1][1] & 0
x1) << 10) | ((RCtau[1][1] & 0
x1) << 11);
215 unsigned short (&RCof)[7][2],
216 unsigned short (&RCtau)[7][2],
217 unsigned short (&SFP)[2][4])
const {
218 RC[0][0] = SFP[0][0] & 0x3ff;
219 RC[0][1] = SFP[1][0] & 0x3ff;
220 RC[1][0] = SFP[0][1] & 0x3ff;
221 RC[1][1] = SFP[1][1] & 0x3ff;
222 RC[2][0] = (RC[2][0] & 0x3c0) | ((SFP[0][0] & 0x7000) >> 12) | ((SFP[0][1] & 0x7000) >> 9);
223 RC[2][1] = (RC[2][1] & 0x3c0) | ((SFP[1][0] & 0x7000) >> 12) | ((SFP[1][1] & 0x7000) >> 9);
225 RCof[0][0] = (SFP[0][0] >> 10) & 0
x1;
226 RCof[0][1] = (SFP[1][0] >> 10) & 0
x1;
227 RCof[1][0] = (SFP[0][1] >> 10) & 0
x1;
228 RCof[1][1] = (SFP[1][1] >> 10) & 0
x1;
230 RCtau[0][0] = (SFP[0][0] >> 11) & 0
x1;
231 RCtau[0][1] = (SFP[1][0] >> 11) & 0
x1;
232 RCtau[1][0] = (SFP[0][1] >> 11) & 0
x1;
233 RCtau[1][1] = (SFP[1][1] >> 11) & 0
x1;
241 unsigned short (&RCof)[7][2],
242 unsigned short (&RCtau)[7][2],
243 unsigned short (&sisterRC)[7][2],
244 unsigned short (&sisterRCof)[7][2],
245 unsigned short (&sisterRCtau)[7][2],
246 unsigned short (&SFP)[2][4])
const {
247 SFP[0][0] = (RC[3][0] & 0x3ff) | ((RCof[3][0] & 0
x1) << 10) | ((RCtau[3][0] & 0
x1) << 11) | ((RC[2][0] & 0x1c0) << 6);
248 SFP[1][0] = 0x8000 | (RC[3][1] & 0x3ff) | ((RCof[3][1] & 0
x1) << 10) | ((RCtau[3][1] & 0
x1) << 11) |
249 ((RC[2][1] & 0x1c0) << 6);
251 SFP[0][1] = (RC[4][0] & 0x3ff) | ((RCof[4][0] & 0
x1) << 10) | ((RCtau[4][0] & 0
x1) << 11) |
252 ((RC[2][0] & 0x200) << 3) | ((RCof[2][0] & 0
x1) << 13) | ((RCtau[2][0] & 0
x1) << 14);
253 SFP[1][1] = 0x8000 | (RC[4][1] & 0x3ff) | ((RCof[4][1] & 0
x1) << 10) | ((RCtau[4][1] & 0
x1) << 11) |
254 ((RC[2][1] & 0x200) << 3) | ((RCof[2][1] & 0
x1) << 13) | ((RCtau[2][1] & 0
x1) << 14);
256 SFP[0][2] = (sisterRC[3][0] & 0x3ff) | ((sisterRCof[3][0] & 0
x1) << 10) | ((sisterRCtau[3][0] & 0
x1) << 11) |
257 ((sisterRC[2][0] & 0x1c0) << 6);
258 SFP[1][2] = 0x8000 | (sisterRC[3][1] & 0x3ff) | ((sisterRCof[3][1] & 0
x1) << 10) | ((sisterRCtau[3][1] & 0
x1) << 11) |
259 ((sisterRC[2][1] & 0x1c0) << 6);
261 SFP[0][3] = (sisterRC[4][0] & 0x3ff) | ((sisterRCof[4][0] & 0
x1) << 10) | ((sisterRCtau[4][0] & 0
x1) << 11) |
262 ((sisterRC[2][0] & 0x200) << 3) | ((sisterRCof[2][0] & 0
x1) << 13) | ((sisterRCtau[2][0] & 0
x1) << 14);
263 SFP[1][3] = 0x8000 | (sisterRC[4][1] & 0x3ff) | ((sisterRCof[4][1] & 0
x1) << 10) | ((sisterRCtau[4][1] & 0
x1) << 11) |
264 ((sisterRC[2][1] & 0x200) << 3) | ((sisterRCof[2][1] & 0
x1) << 13) | ((sisterRCtau[2][1] & 0
x1) << 14);
272 unsigned short (&RCof)[7][2],
273 unsigned short (&RCtau)[7][2],
274 unsigned short (&sisterRC)[7][2],
275 unsigned short (&sisterRCof)[7][2],
276 unsigned short (&sisterRCtau)[7][2],
277 unsigned short (&SFP)[2][4])
const {
278 RC[2][0] = (RC[2][0] & 0x3f) | ((SFP[0][0] & 0x7000) >> 6) | ((SFP[0][1] & 0x1000) >> 3);
279 RC[3][0] = SFP[0][0] & 0x3ff;
280 RC[4][0] = SFP[0][1] & 0x3ff;
281 RC[2][1] = (RC[2][1] & 0x3f) | ((SFP[1][0] & 0x7000) >> 6) | ((SFP[1][1] & 0x1000) >> 3);
282 RC[3][1] = SFP[1][0] & 0x3ff;
283 RC[4][1] = SFP[1][1] & 0x3ff;
285 RCof[2][0] = (SFP[0][1] >> 13) & 0
x1;
286 RCof[3][0] = (SFP[0][0] >> 10) & 0
x1;
287 RCof[4][0] = (SFP[0][1] >> 10) & 0
x1;
288 RCof[2][1] = (SFP[1][1] >> 13) & 0
x1;
289 RCof[3][1] = (SFP[1][0] >> 10) & 0
x1;
290 RCof[4][1] = (SFP[1][1] >> 10) & 0
x1;
292 RCtau[2][0] = (SFP[0][1] >> 14) & 0
x1;
293 RCtau[3][0] = (SFP[0][0] >> 11) & 0
x1;
294 RCtau[4][0] = (SFP[0][1] >> 11) & 0
x1;
295 RCtau[2][1] = (SFP[1][1] >> 14) & 0
x1;
296 RCtau[3][1] = (SFP[1][0] >> 11) & 0
x1;
297 RCtau[4][1] = (SFP[1][1] >> 11) & 0
x1;
299 sisterRC[2][0] = (sisterRC[2][0] & ~0x3C0) | ((SFP[0][2] & 0x7000) >> 6) | ((SFP[0][3] & 0x1000) >> 3);
300 sisterRC[3][0] = SFP[0][2] & 0x3ff;
301 sisterRC[4][0] = SFP[0][3] & 0x3ff;
302 sisterRC[2][1] = (sisterRC[2][1] & ~0x3C0) | ((SFP[1][2] & 0x7000) >> 6) | ((SFP[1][3] & 0x1000) >> 3);
303 sisterRC[3][1] = SFP[1][2] & 0x3ff;
304 sisterRC[4][1] = SFP[1][3] & 0x3ff;
306 sisterRCof[2][0] = (SFP[0][3] >> 13) & 0
x1;
307 sisterRCof[3][0] = (SFP[0][2] >> 10) & 0
x1;
308 sisterRCof[4][0] = (SFP[0][3] >> 10) & 0
x1;
309 sisterRCof[2][1] = (SFP[1][3] >> 13) & 0
x1;
310 sisterRCof[3][1] = (SFP[1][2] >> 10) & 0
x1;
311 sisterRCof[4][1] = (SFP[1][3] >> 10) & 0
x1;
313 sisterRCtau[2][0] = (SFP[0][3] >> 14) & 0
x1;
314 sisterRCtau[3][0] = (SFP[0][2] >> 11) & 0
x1;
315 sisterRCtau[4][0] = (SFP[0][3] >> 11) & 0
x1;
316 sisterRCtau[2][1] = (SFP[1][3] >> 14) & 0
x1;
317 sisterRCtau[3][1] = (SFP[1][2] >> 11) & 0
x1;
318 sisterRCtau[4][1] = (SFP[1][3] >> 11) & 0
x1;
327 unsigned short sfp_reverse[2][4] = {{0}};
329 for (
int i = 0;
i < 2;
i++) {
330 for (
int j = 0;
j < 4;
j++) {
331 for (
int k = 0;
k < 16;
k++) {
332 sfp_reverse[
i][
j] = sfp_reverse[
i][
j] | (((SFP[
i][
j] >>
k) & 0x01) << (15 -
k));
338 switch (RoutingMode) {
340 VHDCI[0][0] = (SFP[0][1] & 0x3ff) | ((SFP[0][1] & 0x1c00) << 1) | ((SFP[0][2] & 0x3c00) << 4) |
341 ((SFP[0][3] & 0x1c00) << 8) | ((SFP[0][0] & 0xff) << 22);
342 VHDCI[0][1] = (SFP[1][1] & 0x3ff) | ((SFP[1][1] & 0x1c00) << 1) | ((SFP[1][2] & 0x3c00) << 4) |
343 ((SFP[1][3] & 0x1c00) << 8) | ((SFP[1][0] & 0xff) << 22);
344 VHDCI[1][0] = (SFP[0][2] & 0x3ff) | ((SFP[0][3] & 0x3ff) << 11) | ((SFP[0][0] & 0x3f00) << 14);
345 VHDCI[1][1] = (SFP[1][2] & 0x3ff) | ((SFP[1][3] & 0x3ff) << 11) | ((SFP[1][0] & 0x3f00) << 14);
348 VHDCI[0][0] = (SFP[0][0] & 0xfff) | ((SFP[0][1] & 0x7) << 12) | ((SFP[0][2] & 0x80) << 10) |
349 ((SFP[0][0] & 0x4000) << 4) | ((sfp_reverse[0][1] & 0xc) << 17) |
350 ((sfp_reverse[0][0] & 0xc) << 19) | ((sfp_reverse[0][1] & 0x1ff0) << 19);
351 VHDCI[0][1] = (SFP[1][0] & 0xfff) | ((SFP[1][1] & 0x7) << 12) | ((SFP[1][2] & 0x80) << 10) |
352 ((SFP[1][0] & 0x4000) << 4) | ((sfp_reverse[1][1] & 0xc) << 17) |
353 ((sfp_reverse[1][0] & 0xc) << 19) | ((sfp_reverse[1][1] & 0x1ff0) << 19);
355 VHDCI[1][0] = (SFP[0][1] & 0x4000) | ((SFP[0][3] & 0x80) << 24);
356 VHDCI[1][1] = (SFP[1][1] & 0x4000) | ((SFP[1][3] & 0x80) << 24);
358 for (
int i = 0;
i < 7;
i++) {
359 VHDCI[1][0] = VHDCI[1][0] | (((SFP[0][2] >>
i) & 0
x1) << (2 *
i)) |
360 (((SFP[0][2] >> (
i + 8)) & 0x1) << ((2 *
i) + 1)) |
361 (((sfp_reverse[0][3] >> (
i + 1)) & 0x1) << ((2 *
i) + 17)) |
362 (((sfp_reverse[0][3] >> (
i + 9)) & 0x1) << ((2 *
i) + 18));
363 VHDCI[1][1] = VHDCI[1][1] | (((SFP[1][2] >>
i) & 0
x1) << (2 *
i)) |
364 (((SFP[1][2] >> (
i + 8)) & 0x1) << ((2 *
i) + 1)) |
365 (((sfp_reverse[1][3] >> (
i + 1)) & 0x1) << ((2 *
i) + 17)) |
366 (((sfp_reverse[1][3] >> (
i + 9)) & 0x1) << ((2 *
i) + 18));
370 VHDCI[0][0] = (SFP[0][0] & 0xfff) | ((SFP[0][1] & 0x7) << 12) | ((sfp_reverse[0][1] & 0xe) << 16) |
371 ((sfp_reverse[0][0] & 0xe) << 19) | ((sfp_reverse[0][1] & 0x1ff0) << 19);
372 VHDCI[0][1] = (SFP[1][0] & 0xfff) | ((SFP[1][1] & 0x7) << 12) | ((sfp_reverse[1][1] & 0xe) << 16) |
373 ((sfp_reverse[1][0] & 0xe) << 19) | ((sfp_reverse[1][1] & 0x1ff0) << 19);
378 VHDCI[0][0] = ((SFP[0][0] >> 12) & 0x7) | ((SFP[0][1] >> 9) & 0x38) | ((SFP[0][0] & 0x1ff) << 6) |
379 ((sfp_reverse[0][1] & 0xfff0) << 13) | ((sfp_reverse[0][0] & 0x70) << 25);
380 VHDCI[0][1] = ((SFP[1][0] >> 12) & 0x7) | ((SFP[1][1] >> 9) & 0x38) | ((SFP[1][0] & 0x1ff) << 6) |
381 ((sfp_reverse[1][1] & 0xfff0) << 13) | ((sfp_reverse[1][0] & 0x70) << 25);
383 VHDCI[1][0] = ((SFP[0][2] >> 12) & 0x7) | ((SFP[0][3] >> 9) & 0x38) | ((SFP[0][2] & 0x1ff) << 6) |
384 ((sfp_reverse[0][3] & 0xfff0) << 13) | ((sfp_reverse[0][2] & 0x70) << 25);
385 VHDCI[1][1] = ((SFP[1][2] >> 12) & 0x7) | ((SFP[1][3] >> 9) & 0x38) | ((SFP[1][2] & 0x1ff) << 6) |
386 ((sfp_reverse[1][3] & 0xfff0) << 13) | ((sfp_reverse[1][2] & 0x70) << 25);
400 unsigned short VHDCI_reverse[2][4] = {{0}};
402 for (
int i = 0;
i < 2;
i++) {
403 for (
int j = 0;
j < 2;
j++) {
404 for (
int k = 0;
k < 32;
k++) {
405 VHDCI_reverse[
i][
j] = VHDCI_reverse[
i][
j] | (((VHDCI[
i][
j] >>
k) & 0x01) << (31 -
k));
410 switch (RoutingMode) {
412 SFP[0][0] = ((VHDCI[0][0] >> 22) & 0xff) | ((VHDCI[1][0] >> 14) & 0x3f00);
413 SFP[1][0] = 0x8000 | ((VHDCI[0][1] >> 22) & 0xff) | ((VHDCI[1][1] >> 14) & 0x3f00);
414 SFP[0][1] = (VHDCI[0][0] & 0x3ff) | ((VHDCI[0][0] >> 1) & 0x1c00);
415 SFP[1][1] = 0x8000 | (VHDCI[0][1] & 0x3ff) | ((VHDCI[0][1] >> 1) & 0x1c00);
416 SFP[0][2] = (VHDCI[1][0] & 0x3ff) | ((VHDCI[0][0] >> 4) & 0x3c00);
417 SFP[1][2] = 0x8000 | (VHDCI[1][1] & 0x3ff) | ((VHDCI[0][1] >> 4) & 0x3c00);
418 SFP[0][3] = ((VHDCI[1][0] >> 11) & 0x3ff) | ((VHDCI[0][0] >> 8) & 0x1c00);
419 SFP[1][3] = 0x8000 | ((VHDCI[1][1] >> 11) & 0x3ff) | ((VHDCI[0][1] >> 8) & 0x1c00);
422 SFP[0][0] = (VHDCI[0][0] & 0xfff) | ((VHDCI_reverse[0][0] & 0x600) << 3) | ((VHDCI_reverse[0][0] & 0x2000) << 1);
424 0x8000 | (VHDCI[0][1] & 0xfff) | ((VHDCI_reverse[0][1] & 0x600) << 3) | ((VHDCI_reverse[0][1] & 0x2000) << 1);
425 SFP[0][1] = ((VHDCI[0][0] & 0x7000) >> 12) | ((VHDCI_reverse[0][0] & 0x1ff) << 3) |
426 ((VHDCI_reverse[0][0] & 0x1800) << 1) | (VHDCI[1][0] & 0x4000);
427 SFP[1][1] = 0x8000 | ((VHDCI[0][1] & 0x7000) >> 12) | ((VHDCI_reverse[0][1] & 0x1ff) << 3) |
428 ((VHDCI_reverse[0][1] & 0x1800) << 1) | (VHDCI[1][1] & 0x4000);
430 SFP[0][2] = ((VHDCI[0][0] & 0x20000) >> 10);
431 SFP[1][2] = 0x8000 | ((VHDCI[0][1] & 0x20000) >> 10);
432 SFP[0][3] = ((VHDCI[1][0] & 0x20000) >> 3);
433 SFP[1][3] = 0x8000 | ((VHDCI[1][1] & 0x20000) >> 3);
434 for (
int i = 0;
i < 7;
i++) {
436 SFP[0][2] | (((VHDCI[1][0] >> (2 *
i)) & 0x1) <<
i) | (((VHDCI[1][0] >> ((2 *
i) + 1)) & 0
x1) << (
i + 8));
438 SFP[1][2] | (((VHDCI[1][1] >> (2 *
i)) & 0x1) <<
i) | (((VHDCI[1][1] >> ((2 *
i) + 1)) & 0
x1) << (
i + 8));
439 SFP[0][3] = SFP[0][3] | (((VHDCI_reverse[1][0] >> ((2 *
i) + 1)) & 0
x1) <<
i) |
440 (((VHDCI_reverse[1][0] >> (2 *
i)) & 0
x1) << (
i + 7));
441 SFP[1][3] = SFP[1][3] | (((VHDCI_reverse[1][1] >> ((2 *
i) + 1)) & 0
x1) <<
i) |
442 (((VHDCI_reverse[1][1] >> (2 *
i)) & 0
x1) << (
i + 7));
446 SFP[0][0] = (VHDCI[0][0] & 0xfff) | ((VHDCI_reverse[0][0] & 0xe00) << 3);
447 SFP[1][0] = 0x8000 | (VHDCI[0][1] & 0xfff) | ((VHDCI_reverse[0][1] & 0xe00) << 3);
449 ((VHDCI[0][0] & 0x7000) >> 12) | ((VHDCI_reverse[0][0] & 0x1ff) << 3) | (VHDCI_reverse[0][0] & 0x7000);
450 SFP[1][1] = 0x8000 | ((VHDCI[0][1] & 0x7000) >> 12) | ((VHDCI_reverse[0][1] & 0x1ff) << 3) |
451 (VHDCI_reverse[0][1] & 0x7000);
452 SFP[0][2] = (VHDCI[0][0] & 0xfff);
453 SFP[1][2] = 0x8000 | (VHDCI[0][1] & 0xfff);
454 SFP[0][3] = ((VHDCI[0][0] & 0x7000) >> 12) | ((VHDCI_reverse[0][0] & 0x1ff) << 3);
455 SFP[1][3] = 0x8000 | ((VHDCI[0][1] & 0x7000) >> 12) | ((VHDCI_reverse[0][1] & 0x1ff) << 3);
458 SFP[0][0] = ((VHDCI[0][0] & 0x7fc0) >> 6) | ((VHDCI_reverse[0][0] & 0x7) << 9) | ((VHDCI[0][0] & 0x7) << 12);
460 0x8000 | ((VHDCI[0][1] & 0x7fc0) >> 6) | ((VHDCI_reverse[0][1] & 0x7) << 9) | ((VHDCI[0][1] & 0x7) << 12);
461 SFP[0][1] = ((VHDCI_reverse[0][0] & 0x7ff8) >> 3) | ((VHDCI[0][0] & 0x38) << 9);
462 SFP[1][1] = 0x8000 | ((VHDCI_reverse[0][1] & 0x7ff8) >> 3) | ((VHDCI[0][1] & 0x38) << 9);
463 SFP[0][2] = ((VHDCI[1][0] & 0x7fc0) >> 6) | ((VHDCI_reverse[1][0] & 0x7) << 9) | ((VHDCI[1][0] & 0x7) << 12);
465 0x8000 | ((VHDCI[1][1] & 0x7fc0) >> 6) | ((VHDCI_reverse[1][1] & 0x7) << 9) | ((VHDCI[1][1] & 0x7) << 12);
466 SFP[0][3] = ((VHDCI_reverse[1][0] & 0x7ff8) >> 3) | ((VHDCI[1][0] & 0x38) << 9);
467 SFP[1][3] = 0x8000 | ((VHDCI_reverse[1][1] & 0x7ff8) >> 3) | ((VHDCI[1][1] & 0x38) << 9);
488 unsigned short (&eIsoCardId)[4],
489 unsigned short (&eIsoRegionId)[4],
490 unsigned short (&eNonIsoRank)[4],
491 unsigned short (&eNonIsoCardId)[4],
492 unsigned short (&eNonIsoRegionId)[4],
493 unsigned short (&MIPbits)[7][2],
494 unsigned short (&Qbits)[7][2],
495 unsigned long (&VHDCI)[2][2])
const {
496 unsigned short SFP[2][4] = {{0}};
497 EMUtoSFP(eIsoRank, eIsoCardId, eIsoRegionId, eNonIsoRank, eNonIsoCardId, eNonIsoRegionId, MIPbits, Qbits, SFP);
498 SFPtoVHDCI(0, SFP, VHDCI);
507 unsigned short (&eIsoCardId)[4],
508 unsigned short (&eIsoRegionId)[4],
509 unsigned short (&eNonIsoRank)[4],
510 unsigned short (&eNonIsoCardId)[4],
511 unsigned short (&eNonIsoRegionId)[4],
512 unsigned short (&MIPbits)[7][2],
513 unsigned short (&Qbits)[7][2],
514 unsigned long (&VHDCI)[2][2])
const {
515 unsigned short SFP[2][4] = {{0}};
516 VHDCItoSFP(0, SFP, VHDCI);
517 SFPtoEMU(eIsoRank, eIsoCardId, eIsoRegionId, eNonIsoRank, eNonIsoCardId, eNonIsoRegionId, MIPbits, Qbits, SFP);
526 unsigned short (&RCof)[7][2],
527 unsigned short (&RCtau)[7][2],
528 unsigned short (&
HF)[4][2],
529 unsigned short (&HFQ)[4][2],
530 unsigned long (&VHDCI)[2][2])
const {
531 unsigned short SFP[2][4] = {{0}};
532 RC56HFtoSFP(RC, RCof, RCtau,
HF, HFQ, SFP);
533 SFPtoVHDCI(1, SFP, VHDCI);
542 unsigned short (&RCof)[7][2],
543 unsigned short (&RCtau)[7][2],
544 unsigned short (&
HF)[4][2],
545 unsigned short (&HFQ)[4][2],
546 unsigned long (&VHDCI)[2][2])
const {
547 unsigned short SFP[2][4] = {{0}};
548 VHDCItoSFP(1, SFP, VHDCI);
549 SFPtoRC56HF(RC, RCof, RCtau,
HF, HFQ, SFP);
557 unsigned short (&RCof)[7][2],
558 unsigned short (&RCtau)[7][2],
559 unsigned long (&VHDCI)[2][2])
const {
560 unsigned short SFP[2][4] = {{0}};
561 RC012toSFP(RC, RCof, RCtau, SFP);
562 SFPtoVHDCI(2, SFP, VHDCI);
570 unsigned short (&RCof)[7][2],
571 unsigned short (&RCtau)[7][2],
572 unsigned long (&VHDCI)[2][2])
const {
573 unsigned short SFP[2][4] = {{0}};
574 VHDCItoSFP(2, SFP, VHDCI);
575 SFPtoRC012(RC, RCof, RCtau, SFP);
583 unsigned short (&RCof)[7][2],
584 unsigned short (&RCtau)[7][2],
585 unsigned short (&sisterRC)[7][2],
586 unsigned short (&sisterRCof)[7][2],
587 unsigned short (&sisterRCtau)[7][2],
588 unsigned long (&VHDCI)[2][2])
const {
589 unsigned short SFP[2][4] = {{0}};
590 RC234toSFP(RC, RCof, RCtau, sisterRC, sisterRCof, sisterRCtau, SFP);
591 SFPtoVHDCI(3, SFP, VHDCI);
599 unsigned short (&RCof)[7][2],
600 unsigned short (&RCtau)[7][2],
601 unsigned short (&sisterRC)[7][2],
602 unsigned short (&sisterRCof)[7][2],
603 unsigned short (&sisterRCtau)[7][2],
604 unsigned long (&VHDCI)[2][2])
const {
605 unsigned short SFP[2][4] = {{0}};
606 VHDCItoSFP(3, SFP, VHDCI);
607 SFPtoRC234(RC, RCof, RCtau, sisterRC, sisterRCof, sisterRCtau, SFP);
616 unsigned short &eventNumber,
617 unsigned short (&eIsoRank)[4],
618 unsigned short (&eIsoCardId)[4],
619 unsigned short (&eIsoRegionId)[4],
620 unsigned short (&eNonIsoRank)[4],
621 unsigned short (&eNonIsoCardId)[4],
622 unsigned short (&eNonIsoRegionId)[4],
623 unsigned short (&MIPbits)[7][2],
624 unsigned short (&Qbits)[7][2],
626 unsigned long VHDCI[2][2] = {{0}};
627 EMUtoVHDCI(eIsoRank, eIsoCardId, eIsoRegionId, eNonIsoRank, eNonIsoCardId, eNonIsoRegionId, MIPbits, Qbits, VHDCI);
628 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
636 unsigned short &eventNumber,
637 unsigned short (&RC)[7][2],
638 unsigned short (&RCof)[7][2],
639 unsigned short (&RCtau)[7][2],
640 unsigned short (&
HF)[4][2],
641 unsigned short (&HFQ)[4][2],
643 unsigned long VHDCI[2][2] = {{0}};
644 RC56HFtoVHDCI(RC, RCof, RCtau,
HF, HFQ, VHDCI);
645 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
652 unsigned short &eventNumber,
653 unsigned short (&RC)[7][2],
654 unsigned short (&RCof)[7][2],
655 unsigned short (&RCtau)[7][2],
657 unsigned long VHDCI[2][2] = {{0}};
658 RC012toVHDCI(RC, RCof, RCtau, VHDCI);
659 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
666 unsigned short &eventNumber,
667 unsigned short (&RC)[7][2],
668 unsigned short (&RCof)[7][2],
669 unsigned short (&RCtau)[7][2],
670 unsigned short (&sisterRC)[7][2],
671 unsigned short (&sisterRCof)[7][2],
672 unsigned short (&sisterRCtau)[7][2],
674 unsigned long VHDCI[2][2] = {{0}};
675 RC234toVHDCI(RC, RCof, RCtau, sisterRC, sisterRCof, sisterRCtau, VHDCI);
676 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
683 unsigned short &eventNumber,
685 unsigned short (&SFP)[2][4],
687 unsigned long VHDCI[2][2] = {{0}};
688 SFPtoVHDCI(RoutingMode, SFP, VHDCI);
689 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
696 unsigned short &eventNumber,
698 unsigned long (&VHDCI)[2][2])
const {
701 if (!dataString.empty()) {
702 temp << dataString << std::endl;
705 temp >> hex >> VHDCI[0][0];
706 temp >> hex >> VHDCI[0][1];
707 temp >> hex >> VHDCI[1][0];
708 temp >> hex >> VHDCI[1][1];
711 logicalCardID = 65535;
722 unsigned short &eventNumber,
724 unsigned long (&VHDCI)[2][2])
const {
727 temp <<
dec << eventNumber <<
'\t';
728 temp <<
dec << logicalCardID <<
'\t';
729 temp << hex << setw(8) << setfill(
'0') << VHDCI[0][0] <<
'\t';
730 temp << hex << setw(8) << setfill(
'0') << VHDCI[0][1] <<
'\t';
731 temp << hex << setw(8) << setfill(
'0') << VHDCI[1][0] <<
'\t';
732 temp << hex << setw(8) << setfill(
'0') << VHDCI[1][1] << std::endl;
733 dataString =
temp.str();
741 int &RCTCrateNumber)
const {
742 RCTCrateNumber = (logicalCardID >> 3);
743 if ((logicalCardID & 0x4) != 0)
745 RoutingMode = (logicalCardID & 0x3);
752 int &RCTCrateNumber)
const {
753 logicalCardID = ((RCTCrateNumber % 9) << 3) | (RCTCrateNumber > 8 ? 0x4 : 0x0) | (RoutingMode & 0x3);
void SFPtoRC012(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&SFP)[2][4]) const
void RC012toSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], std::string &dataString) const
void VHDCItoRC234(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], unsigned long(&VHDCI)[2][2]) const
void LogicalCardIDtoRoutingMode(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const
void SFPtoRC234(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], unsigned short(&SFP)[2][4]) const
void RC012toSFP(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&SFP)[2][4]) const
void SFPtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, int RoutingMode, unsigned short(&SFP)[2][4], std::string &dataString) const
void RC56HFtoSFP(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], unsigned short(&SFP)[2][4]) const
void RC56HFtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], std::string &dataString) const
void VHDCItoRC56HF(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], unsigned long(&VHDCI)[2][2]) const
void VHDCItoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, std::string &dataString, unsigned long(&VHDCI)[2][2]) const
void SFPtoRC56HF(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], unsigned short(&SFP)[2][4]) const
void SFPtoEMU(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned short(&SFP)[2][4]) const
void EMUtoSFP(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned short(&SFP)[2][4]) const
void EMUtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], std::string &dataString) const
void VHDCItoRC012(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned long(&VHDCI)[2][2]) const
void VHDCItoSFP(int RoutingMode, unsigned short(&SFP)[2][4], unsigned long(&VHDCI)[2][2]) const
void RC56HFtoVHDCI(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&HF)[4][2], unsigned short(&HFQ)[4][2], unsigned long(&VHDCI)[2][2]) const
void STRINGtoVHDCI(unsigned short &logicalCardID, unsigned short &eventNumber, std::string &dataString, unsigned long(&VHDCI)[2][2]) const
void RC234toSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], std::string &dataString) const
void SFPtoVHDCI(int RoutingMode, unsigned short(&SFP)[2][4], unsigned long(&VHDCI)[2][2]) const
void VHDCItoEMU(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned long(&VHDCI)[2][2]) const
void RC234toSFP(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], unsigned short(&SFP)[2][4]) const
void RC012toVHDCI(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned long(&VHDCI)[2][2]) const
void RoutingModetoLogicalCardID(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) const
void EMUtoVHDCI(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned long(&VHDCI)[2][2]) const
void RC234toVHDCI(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&sisterRC)[7][2], unsigned short(&sisterRCof)[7][2], unsigned short(&sisterRCtau)[7][2], unsigned long(&VHDCI)[2][2]) const