31 unsigned short (&eIsoRank)[4],
unsigned short (&eIsoCardId)[4],
32 unsigned short (&eIsoRegionId)[4],
unsigned short (&eNonIsoRank)[4],
33 unsigned short (&eNonIsoCardId)[4],
unsigned short (&eNonIsoRegionId)[4],
34 unsigned short (&MIPbits)[7][2],
unsigned short (&Qbits)[7][2],
35 unsigned short (&SFP)[2][4])
const {
40 for (
int i = 0;
i < 7;
i++) {
41 for (
int j = 0; j < 2; j++) {
42 SFP[0][0] = SFP[0][0] | ((MIPbits[
i][j] & 0x01) << ((2 *
i) + j));
43 SFP[1][0] = SFP[1][0] | ((Qbits[
i][j] & 0x01) << ((2 *
i) + j));
47 SFP[0][1] = (eIsoRank[0] & 0x3f) | ((eIsoRegionId[0] & 0x01) << 6) |
48 ((eIsoCardId[0] & 0x07) << 7) | ((eIsoRank[1] & 0x7) << 10);
49 SFP[1][1] = 0x8000 | (eIsoRank[2] & 0x3f) | ((eIsoRegionId[2] & 0x01) << 6) |
50 ((eIsoCardId[2] & 0x07) << 7) | ((eIsoRank[3] & 0x7) << 10);
51 SFP[0][2] = (eNonIsoRank[0] & 0x3f) | ((eNonIsoRegionId[0] & 0x01) << 6) |
52 ((eNonIsoCardId[0] & 0x07) << 7) | ((eIsoRank[1] & 0x38) << 7) |
53 ((eIsoRegionId[1] & 0x01) << 13);
54 SFP[1][2] = 0x8000 | (eNonIsoRank[2] & 0x3f) |
55 ((eNonIsoRegionId[2] & 0x01) << 6) |
56 ((eNonIsoCardId[2] & 0x07) << 7) | ((eIsoRank[3] & 0x38) << 7) |
57 ((eIsoRegionId[3] & 0x01) << 13);
58 SFP[0][3] = (eNonIsoRank[1] & 0x3f) | ((eNonIsoRegionId[1] & 0x01) << 6) |
59 ((eNonIsoCardId[1] & 0x07) << 7) | ((eIsoCardId[1] & 0x07) << 10);
60 SFP[1][3] = 0x8000 | (eNonIsoRank[3] & 0x3f) |
61 ((eNonIsoRegionId[3] & 0x01) << 6) |
62 ((eNonIsoCardId[3] & 0x07) << 7) | ((eIsoCardId[3] & 0x07) << 10);
71 unsigned short (&eIsoRank)[4],
unsigned short (&eIsoCardId)[4],
72 unsigned short (&eIsoRegionId)[4],
unsigned short (&eNonIsoRank)[4],
73 unsigned short (&eNonIsoCardId)[4],
unsigned short (&eNonIsoRegionId)[4],
74 unsigned short (&MIPbits)[7][2],
unsigned short (&Qbits)[7][2],
75 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 {
127 SFP[0][0] = (RC[5][0] & 0x3ff) | ((RCof[5][0] & 0
x1) << 10) |
128 ((RCtau[5][0] & 0x1) << 11) | ((HFQ[0][0] & 0x1) << 12) |
129 ((HFQ[1][0] & 0x01) << 13) | ((
HF[0][0] & 0x01) << 14);
130 SFP[1][0] = 0x8000 | (RC[5][1] & 0x3ff) | ((RCof[5][1] & 0x1) << 10) |
131 ((RCtau[5][1] & 0x1) << 11) | ((HFQ[2][0] & 0x1) << 12) |
132 ((HFQ[3][0] & 0x01) << 13) | ((
HF[2][0] & 0x01) << 14);
133 SFP[0][1] = (RC[6][0] & 0x3ff) | ((RCof[6][0] & 0x1) << 10) |
134 ((RCtau[6][0] & 0x1) << 11) | ((HFQ[0][1] & 0x1) << 12) |
135 ((HFQ[1][1] & 0x01) << 13) | ((
HF[0][1] & 0x01) << 14);
136 SFP[1][1] = 0x8000 | (RC[6][1] & 0x3ff) | ((RCof[6][1] & 0x1) << 10) |
137 ((RCtau[6][1] & 0x1) << 11) | ((HFQ[2][1] & 0x1) << 12) |
138 ((HFQ[3][1] & 0x01) << 13) | ((
HF[2][1] & 0x01) << 14);
139 SFP[0][2] = ((
HF[0][0] >> 1) & 0x7f) | ((
HF[1][0] & 0xff) << 7);
140 SFP[1][2] = 0x8000 | ((
HF[2][0] >> 1) & 0x7f) | ((
HF[3][0] & 0xff) << 7);
141 SFP[0][3] = ((
HF[0][1] >> 1) & 0x7f) | ((
HF[1][1] & 0xff) << 7);
142 SFP[1][3] = 0x8000 | ((
HF[2][1] >> 1) & 0x7f) | ((
HF[3][1] & 0xff) << 7);
151 unsigned short (&RCof)[7][2],
152 unsigned short (&RCtau)[7][2],
153 unsigned short (&
HF)[4][2],
154 unsigned short (&HFQ)[4][2],
155 unsigned short (&SFP)[2][4])
const {
157 RC[5][0] = SFP[0][0] & 0x3ff;
158 RC[5][1] = SFP[1][0] & 0x3ff;
159 RC[6][0] = SFP[0][1] & 0x3ff;
160 RC[6][1] = SFP[1][1] & 0x3ff;
162 RCof[5][0] = (SFP[0][0] >> 10) & 0
x1;
163 RCof[5][1] = (SFP[1][0] >> 10) & 0
x1;
164 RCof[6][0] = (SFP[0][1] >> 10) & 0
x1;
165 RCof[6][1] = (SFP[1][1] >> 10) & 0
x1;
167 RCtau[5][0] = (SFP[0][0] >> 11) & 0
x1;
168 RCtau[5][1] = (SFP[1][0] >> 11) & 0
x1;
169 RCtau[6][0] = (SFP[0][1] >> 11) & 0
x1;
170 RCtau[6][1] = (SFP[1][1] >> 11) & 0
x1;
172 HFQ[0][0] = (SFP[0][0] >> 12) & 0
x1;
173 HFQ[1][0] = (SFP[0][0] >> 13) & 0
x1;
174 HFQ[2][0] = (SFP[1][0] >> 12) & 0
x1;
175 HFQ[3][0] = (SFP[1][0] >> 13) & 0
x1;
177 HFQ[0][1] = (SFP[0][1] >> 12) & 0
x1;
178 HFQ[1][1] = (SFP[0][1] >> 13) & 0
x1;
179 HFQ[2][1] = (SFP[1][1] >> 12) & 0
x1;
180 HFQ[3][1] = (SFP[1][1] >> 13) & 0
x1;
182 HF[0][0] = ((SFP[0][2] & 0x7f) << 1) | ((SFP[0][0] >> 14) & 0x01);
183 HF[1][0] = (SFP[0][2] >> 7) & 0xff;
184 HF[2][0] = ((SFP[1][2] & 0x7f) << 1) | ((SFP[1][0] >> 14) & 0x01);
185 HF[3][0] = (SFP[1][2] >> 7) & 0xff;
187 HF[0][1] = ((SFP[0][3] & 0x7f) << 1) | ((SFP[0][1] >> 14) & 0x01);
188 HF[1][1] = (SFP[0][3] >> 7) & 0xff;
189 HF[2][1] = ((SFP[1][3] & 0x7f) << 1) | ((SFP[1][1] >> 14) & 0x01);
190 HF[3][1] = (SFP[1][3] >> 7) & 0xff;
198 unsigned short (&RCof)[7][2],
199 unsigned short (&RCtau)[7][2],
200 unsigned short (&SFP)[2][4])
const {
202 SFP[0][0] = (RC[0][0] & 0x3ff) | ((RCof[0][0] & 0
x1) << 10) |
203 ((RCtau[0][0] & 0x1) << 11) | ((RC[2][0] & 0x7) << 12);
204 SFP[1][0] = 0x8000 | (RC[0][1] & 0x3ff) | ((RCof[0][1] & 0x1) << 10) |
205 ((RCtau[0][1] & 0x1) << 11) | ((RC[2][1] & 0x7) << 12);
207 SFP[0][1] = (RC[1][0] & 0x3ff) | ((RCof[1][0] & 0x1) << 10) |
208 ((RCtau[1][0] & 0x1) << 11) | ((RC[2][0] & 0x38) << 9);
209 SFP[1][1] = 0x8000 | (RC[1][1] & 0x3ff) | ((RCof[1][1] & 0x1) << 10) |
210 ((RCtau[1][1] & 0x1) << 11) | ((RC[2][1] & 0x38) << 9);
212 SFP[0][2] = (RC[0][0] & 0x3ff) | ((RCof[0][0] & 0x1) << 10) |
213 ((RCtau[0][0] & 0x1) << 11);
214 SFP[1][2] = 0x8000 | (RC[0][1] & 0x3ff) | ((RCof[0][1] & 0x1) << 10) |
215 ((RCtau[0][1] & 0x1) << 11);
217 SFP[0][3] = (RC[1][0] & 0x3ff) | ((RCof[1][0] & 0x1) << 10) |
218 ((RCtau[1][0] & 0x1) << 11);
219 SFP[1][3] = 0x8000 | (RC[1][1] & 0x3ff) | ((RCof[1][1] & 0x1) << 10) |
220 ((RCtau[1][1] & 0x1) << 11);
228 unsigned short (&RCof)[7][2],
229 unsigned short (&RCtau)[7][2],
230 unsigned short (&SFP)[2][4])
const {
232 RC[0][0] = SFP[0][0] & 0x3ff;
233 RC[0][1] = SFP[1][0] & 0x3ff;
234 RC[1][0] = SFP[0][1] & 0x3ff;
235 RC[1][1] = SFP[1][1] & 0x3ff;
236 RC[2][0] = (RC[2][0] & 0x3c0) | ((SFP[0][0] & 0x7000) >> 12) |
237 ((SFP[0][1] & 0x7000) >> 9);
238 RC[2][1] = (RC[2][1] & 0x3c0) | ((SFP[1][0] & 0x7000) >> 12) |
239 ((SFP[1][1] & 0x7000) >> 9);
241 RCof[0][0] = (SFP[0][0] >> 10) & 0
x1;
242 RCof[0][1] = (SFP[1][0] >> 10) & 0
x1;
243 RCof[1][0] = (SFP[0][1] >> 10) & 0
x1;
244 RCof[1][1] = (SFP[1][1] >> 10) & 0
x1;
246 RCtau[0][0] = (SFP[0][0] >> 11) & 0
x1;
247 RCtau[0][1] = (SFP[1][0] >> 11) & 0
x1;
248 RCtau[1][0] = (SFP[0][1] >> 11) & 0
x1;
249 RCtau[1][1] = (SFP[1][1] >> 11) & 0
x1;
257 unsigned short (&RCof)[7][2],
258 unsigned short (&RCtau)[7][2],
259 unsigned short (&sisterRC)[7][2],
260 unsigned short (&sisterRCof)[7][2],
261 unsigned short (&sisterRCtau)[7][2],
262 unsigned short (&SFP)[2][4])
const {
264 SFP[0][0] = (RC[3][0] & 0x3ff) | ((RCof[3][0] & 0
x1) << 10) |
265 ((RCtau[3][0] & 0x1) << 11) | ((RC[2][0] & 0x1c0) << 6);
266 SFP[1][0] = 0x8000 | (RC[3][1] & 0x3ff) | ((RCof[3][1] & 0x1) << 10) |
267 ((RCtau[3][1] & 0x1) << 11) | ((RC[2][1] & 0x1c0) << 6);
269 SFP[0][1] = (RC[4][0] & 0x3ff) | ((RCof[4][0] & 0x1) << 10) |
270 ((RCtau[4][0] & 0x1) << 11) | ((RC[2][0] & 0x200) << 3) |
271 ((RCof[2][0] & 0x1) << 13) | ((RCtau[2][0] & 0x1) << 14);
272 SFP[1][1] = 0x8000 | (RC[4][1] & 0x3ff) | ((RCof[4][1] & 0x1) << 10) |
273 ((RCtau[4][1] & 0x1) << 11) | ((RC[2][1] & 0x200) << 3) |
274 ((RCof[2][1] & 0x1) << 13) | ((RCtau[2][1] & 0x1) << 14);
276 SFP[0][2] = (sisterRC[3][0] & 0x3ff) | ((sisterRCof[3][0] & 0x1) << 10) |
277 ((sisterRCtau[3][0] & 0x1) << 11) |
278 ((sisterRC[2][0] & 0x1c0) << 6);
280 0x8000 | (sisterRC[3][1] & 0x3ff) | ((sisterRCof[3][1] & 0x1) << 10) |
281 ((sisterRCtau[3][1] & 0x1) << 11) | ((sisterRC[2][1] & 0x1c0) << 6);
284 (sisterRC[4][0] & 0x3ff) | ((sisterRCof[4][0] & 0x1) << 10) |
285 ((sisterRCtau[4][0] & 0x1) << 11) | ((sisterRC[2][0] & 0x200) << 3) |
286 ((sisterRCof[2][0] & 0x1) << 13) | ((sisterRCtau[2][0] & 0x1) << 14);
288 0x8000 | (sisterRC[4][1] & 0x3ff) | ((sisterRCof[4][1] & 0x1) << 10) |
289 ((sisterRCtau[4][1] & 0x1) << 11) | ((sisterRC[2][1] & 0x200) << 3) |
290 ((sisterRCof[2][1] & 0x1) << 13) | ((sisterRCtau[2][1] & 0x1) << 14);
298 unsigned short (&RCof)[7][2],
299 unsigned short (&RCtau)[7][2],
300 unsigned short (&sisterRC)[7][2],
301 unsigned short (&sisterRCof)[7][2],
302 unsigned short (&sisterRCtau)[7][2],
303 unsigned short (&SFP)[2][4])
const {
305 RC[2][0] = (RC[2][0] & 0x3f) | ((SFP[0][0] & 0x7000) >> 6) |
306 ((SFP[0][1] & 0x1000) >> 3);
307 RC[3][0] = SFP[0][0] & 0x3ff;
308 RC[4][0] = SFP[0][1] & 0x3ff;
309 RC[2][1] = (RC[2][1] & 0x3f) | ((SFP[1][0] & 0x7000) >> 6) |
310 ((SFP[1][1] & 0x1000) >> 3);
311 RC[3][1] = SFP[1][0] & 0x3ff;
312 RC[4][1] = SFP[1][1] & 0x3ff;
314 RCof[2][0] = (SFP[0][1] >> 13) & 0
x1;
315 RCof[3][0] = (SFP[0][0] >> 10) & 0
x1;
316 RCof[4][0] = (SFP[0][1] >> 10) & 0
x1;
317 RCof[2][1] = (SFP[1][1] >> 13) & 0
x1;
318 RCof[3][1] = (SFP[1][0] >> 10) & 0
x1;
319 RCof[4][1] = (SFP[1][1] >> 10) & 0
x1;
321 RCtau[2][0] = (SFP[0][1] >> 14) & 0
x1;
322 RCtau[3][0] = (SFP[0][0] >> 11) & 0
x1;
323 RCtau[4][0] = (SFP[0][1] >> 11) & 0
x1;
324 RCtau[2][1] = (SFP[1][1] >> 14) & 0
x1;
325 RCtau[3][1] = (SFP[1][0] >> 11) & 0
x1;
326 RCtau[4][1] = (SFP[1][1] >> 11) & 0
x1;
328 sisterRC[2][0] = (sisterRC[2][0] & ~0x3C0) | ((SFP[0][2] & 0x7000) >> 6) |
329 ((SFP[0][3] & 0x1000) >> 3);
330 sisterRC[3][0] = SFP[0][2] & 0x3ff;
331 sisterRC[4][0] = SFP[0][3] & 0x3ff;
332 sisterRC[2][1] = (sisterRC[2][1] & ~0x3C0) | ((SFP[1][2] & 0x7000) >> 6) |
333 ((SFP[1][3] & 0x1000) >> 3);
334 sisterRC[3][1] = SFP[1][2] & 0x3ff;
335 sisterRC[4][1] = SFP[1][3] & 0x3ff;
337 sisterRCof[2][0] = (SFP[0][3] >> 13) & 0
x1;
338 sisterRCof[3][0] = (SFP[0][2] >> 10) & 0
x1;
339 sisterRCof[4][0] = (SFP[0][3] >> 10) & 0
x1;
340 sisterRCof[2][1] = (SFP[1][3] >> 13) & 0
x1;
341 sisterRCof[3][1] = (SFP[1][2] >> 10) & 0
x1;
342 sisterRCof[4][1] = (SFP[1][3] >> 10) & 0
x1;
344 sisterRCtau[2][0] = (SFP[0][3] >> 14) & 0
x1;
345 sisterRCtau[3][0] = (SFP[0][2] >> 11) & 0
x1;
346 sisterRCtau[4][0] = (SFP[0][3] >> 11) & 0
x1;
347 sisterRCtau[2][1] = (SFP[1][3] >> 14) & 0
x1;
348 sisterRCtau[3][1] = (SFP[1][2] >> 11) & 0
x1;
349 sisterRCtau[4][1] = (SFP[1][3] >> 11) & 0
x1;
358 unsigned long (&VHDCI)[2][2])
const {
360 unsigned short sfp_reverse[2][4] = {{0}};
362 for (
int i = 0;
i < 2;
i++) {
363 for (
int j = 0; j < 4; j++) {
364 for (
int k = 0;
k < 16;
k++) {
366 sfp_reverse[
i][j] | (((SFP[
i][j] >>
k) & 0x01) << (15 -
k));
372 switch (RoutingMode) {
374 VHDCI[0][0] = (SFP[0][1] & 0x3ff) | ((SFP[0][1] & 0x1c00) << 1) |
375 ((SFP[0][2] & 0x3c00) << 4) | ((SFP[0][3] & 0x1c00) << 8) |
376 ((SFP[0][0] & 0xff) << 22);
377 VHDCI[0][1] = (SFP[1][1] & 0x3ff) | ((SFP[1][1] & 0x1c00) << 1) |
378 ((SFP[1][2] & 0x3c00) << 4) | ((SFP[1][3] & 0x1c00) << 8) |
379 ((SFP[1][0] & 0xff) << 22);
380 VHDCI[1][0] = (SFP[0][2] & 0x3ff) | ((SFP[0][3] & 0x3ff) << 11) |
381 ((SFP[0][0] & 0x3f00) << 14);
382 VHDCI[1][1] = (SFP[1][2] & 0x3ff) | ((SFP[1][3] & 0x3ff) << 11) |
383 ((SFP[1][0] & 0x3f00) << 14);
386 VHDCI[0][0] = (SFP[0][0] & 0xfff) | ((SFP[0][1] & 0x7) << 12) |
387 ((SFP[0][2] & 0x80) << 10) | ((SFP[0][0] & 0x4000) << 4) |
388 ((sfp_reverse[0][1] & 0xc) << 17) |
389 ((sfp_reverse[0][0] & 0xc) << 19) |
390 ((sfp_reverse[0][1] & 0x1ff0) << 19);
391 VHDCI[0][1] = (SFP[1][0] & 0xfff) | ((SFP[1][1] & 0x7) << 12) |
392 ((SFP[1][2] & 0x80) << 10) | ((SFP[1][0] & 0x4000) << 4) |
393 ((sfp_reverse[1][1] & 0xc) << 17) |
394 ((sfp_reverse[1][0] & 0xc) << 19) |
395 ((sfp_reverse[1][1] & 0x1ff0) << 19);
397 VHDCI[1][0] = (SFP[0][1] & 0x4000) | ((SFP[0][3] & 0x80) << 24);
398 VHDCI[1][1] = (SFP[1][1] & 0x4000) | ((SFP[1][3] & 0x80) << 24);
400 for (
int i = 0;
i < 7;
i++) {
401 VHDCI[1][0] = VHDCI[1][0] | (((SFP[0][2] >>
i) & 0
x1) << (2 *
i)) |
402 (((SFP[0][2] >> (
i + 8)) & 0x1) << ((2 *
i) + 1)) |
403 (((sfp_reverse[0][3] >> (
i + 1)) & 0x1) << ((2 *
i) + 17)) |
404 (((sfp_reverse[0][3] >> (
i + 9)) & 0x1) << ((2 *
i) + 18));
405 VHDCI[1][1] = VHDCI[1][1] | (((SFP[1][2] >>
i) & 0
x1) << (2 *
i)) |
406 (((SFP[1][2] >> (
i + 8)) & 0x1) << ((2 *
i) + 1)) |
407 (((sfp_reverse[1][3] >> (
i + 1)) & 0x1) << ((2 *
i) + 17)) |
408 (((sfp_reverse[1][3] >> (
i + 9)) & 0x1) << ((2 *
i) + 18));
412 VHDCI[0][0] = (SFP[0][0] & 0xfff) | ((SFP[0][1] & 0x7) << 12) |
413 ((sfp_reverse[0][1] & 0xe) << 16) |
414 ((sfp_reverse[0][0] & 0xe) << 19) |
415 ((sfp_reverse[0][1] & 0x1ff0) << 19);
416 VHDCI[0][1] = (SFP[1][0] & 0xfff) | ((SFP[1][1] & 0x7) << 12) |
417 ((sfp_reverse[1][1] & 0xe) << 16) |
418 ((sfp_reverse[1][0] & 0xe) << 19) |
419 ((sfp_reverse[1][1] & 0x1ff0) << 19);
424 VHDCI[0][0] = ((SFP[0][0] >> 12) & 0x7) | ((SFP[0][1] >> 9) & 0x38) |
425 ((SFP[0][0] & 0x1ff) << 6) |
426 ((sfp_reverse[0][1] & 0xfff0) << 13) |
427 ((sfp_reverse[0][0] & 0x70) << 25);
428 VHDCI[0][1] = ((SFP[1][0] >> 12) & 0x7) | ((SFP[1][1] >> 9) & 0x38) |
429 ((SFP[1][0] & 0x1ff) << 6) |
430 ((sfp_reverse[1][1] & 0xfff0) << 13) |
431 ((sfp_reverse[1][0] & 0x70) << 25);
433 VHDCI[1][0] = ((SFP[0][2] >> 12) & 0x7) | ((SFP[0][3] >> 9) & 0x38) |
434 ((SFP[0][2] & 0x1ff) << 6) |
435 ((sfp_reverse[0][3] & 0xfff0) << 13) |
436 ((sfp_reverse[0][2] & 0x70) << 25);
437 VHDCI[1][1] = ((SFP[1][2] >> 12) & 0x7) | ((SFP[1][3] >> 9) & 0x38) |
438 ((SFP[1][2] & 0x1ff) << 6) |
439 ((sfp_reverse[1][3] & 0xfff0) << 13) |
440 ((sfp_reverse[1][2] & 0x70) << 25);
454 unsigned long (&VHDCI)[2][2])
const {
456 unsigned short VHDCI_reverse[2][4] = {{0}};
458 for (
int i = 0;
i < 2;
i++) {
459 for (
int j = 0; j < 2; j++) {
460 for (
int k = 0;
k < 32;
k++) {
461 VHDCI_reverse[
i][j] =
462 VHDCI_reverse[
i][j] | (((VHDCI[
i][j] >>
k) & 0x01) << (31 -
k));
467 switch (RoutingMode) {
469 SFP[0][0] = ((VHDCI[0][0] >> 22) & 0xff) | ((VHDCI[1][0] >> 14) & 0x3f00);
471 0x8000 | ((VHDCI[0][1] >> 22) & 0xff) | ((VHDCI[1][1] >> 14) & 0x3f00);
472 SFP[0][1] = (VHDCI[0][0] & 0x3ff) | ((VHDCI[0][0] >> 1) & 0x1c00);
473 SFP[1][1] = 0x8000 | (VHDCI[0][1] & 0x3ff) | ((VHDCI[0][1] >> 1) & 0x1c00);
474 SFP[0][2] = (VHDCI[1][0] & 0x3ff) | ((VHDCI[0][0] >> 4) & 0x3c00);
475 SFP[1][2] = 0x8000 | (VHDCI[1][1] & 0x3ff) | ((VHDCI[0][1] >> 4) & 0x3c00);
476 SFP[0][3] = ((VHDCI[1][0] >> 11) & 0x3ff) | ((VHDCI[0][0] >> 8) & 0x1c00);
478 0x8000 | ((VHDCI[1][1] >> 11) & 0x3ff) | ((VHDCI[0][1] >> 8) & 0x1c00);
481 SFP[0][0] = (VHDCI[0][0] & 0xfff) | ((VHDCI_reverse[0][0] & 0x600) << 3) |
482 ((VHDCI_reverse[0][0] & 0x2000) << 1);
483 SFP[1][0] = 0x8000 | (VHDCI[0][1] & 0xfff) |
484 ((VHDCI_reverse[0][1] & 0x600) << 3) |
485 ((VHDCI_reverse[0][1] & 0x2000) << 1);
486 SFP[0][1] = ((VHDCI[0][0] & 0x7000) >> 12) |
487 ((VHDCI_reverse[0][0] & 0x1ff) << 3) |
488 ((VHDCI_reverse[0][0] & 0x1800) << 1) | (VHDCI[1][0] & 0x4000);
489 SFP[1][1] = 0x8000 | ((VHDCI[0][1] & 0x7000) >> 12) |
490 ((VHDCI_reverse[0][1] & 0x1ff) << 3) |
491 ((VHDCI_reverse[0][1] & 0x1800) << 1) | (VHDCI[1][1] & 0x4000);
493 SFP[0][2] = ((VHDCI[0][0] & 0x20000) >> 10);
494 SFP[1][2] = 0x8000 | ((VHDCI[0][1] & 0x20000) >> 10);
495 SFP[0][3] = ((VHDCI[1][0] & 0x20000) >> 3);
496 SFP[1][3] = 0x8000 | ((VHDCI[1][1] & 0x20000) >> 3);
497 for (
int i = 0;
i < 7;
i++) {
498 SFP[0][2] = SFP[0][2] | (((VHDCI[1][0] >> (2 *
i)) & 0x1) <<
i) |
499 (((VHDCI[1][0] >> ((2 *
i) + 1)) & 0
x1) << (
i + 8));
500 SFP[1][2] = SFP[1][2] | (((VHDCI[1][1] >> (2 *
i)) & 0x1) <<
i) |
501 (((VHDCI[1][1] >> ((2 *
i) + 1)) & 0
x1) << (
i + 8));
502 SFP[0][3] = SFP[0][3] |
503 (((VHDCI_reverse[1][0] >> ((2 *
i) + 1)) & 0
x1) <<
i) |
504 (((VHDCI_reverse[1][0] >> (2 *
i)) & 0
x1) << (
i + 7));
505 SFP[1][3] = SFP[1][3] |
506 (((VHDCI_reverse[1][1] >> ((2 *
i) + 1)) & 0x1) <<
i) |
507 (((VHDCI_reverse[1][1] >> (2 *
i)) & 0x1) << (
i + 7));
511 SFP[0][0] = (VHDCI[0][0] & 0xfff) | ((VHDCI_reverse[0][0] & 0xe00) << 3);
513 0x8000 | (VHDCI[0][1] & 0xfff) | ((VHDCI_reverse[0][1] & 0xe00) << 3);
514 SFP[0][1] = ((VHDCI[0][0] & 0x7000) >> 12) |
515 ((VHDCI_reverse[0][0] & 0x1ff) << 3) |
516 (VHDCI_reverse[0][0] & 0x7000);
517 SFP[1][1] = 0x8000 | ((VHDCI[0][1] & 0x7000) >> 12) |
518 ((VHDCI_reverse[0][1] & 0x1ff) << 3) |
519 (VHDCI_reverse[0][1] & 0x7000);
520 SFP[0][2] = (VHDCI[0][0] & 0xfff);
521 SFP[1][2] = 0x8000 | (VHDCI[0][1] & 0xfff);
523 ((VHDCI[0][0] & 0x7000) >> 12) | ((VHDCI_reverse[0][0] & 0x1ff) << 3);
524 SFP[1][3] = 0x8000 | ((VHDCI[0][1] & 0x7000) >> 12) |
525 ((VHDCI_reverse[0][1] & 0x1ff) << 3);
528 SFP[0][0] = ((VHDCI[0][0] & 0x7fc0) >> 6) |
529 ((VHDCI_reverse[0][0] & 0x7) << 9) |
530 ((VHDCI[0][0] & 0x7) << 12);
531 SFP[1][0] = 0x8000 | ((VHDCI[0][1] & 0x7fc0) >> 6) |
532 ((VHDCI_reverse[0][1] & 0x7) << 9) |
533 ((VHDCI[0][1] & 0x7) << 12);
535 ((VHDCI_reverse[0][0] & 0x7ff8) >> 3) | ((VHDCI[0][0] & 0x38) << 9);
536 SFP[1][1] = 0x8000 | ((VHDCI_reverse[0][1] & 0x7ff8) >> 3) |
537 ((VHDCI[0][1] & 0x38) << 9);
538 SFP[0][2] = ((VHDCI[1][0] & 0x7fc0) >> 6) |
539 ((VHDCI_reverse[1][0] & 0x7) << 9) |
540 ((VHDCI[1][0] & 0x7) << 12);
541 SFP[1][2] = 0x8000 | ((VHDCI[1][1] & 0x7fc0) >> 6) |
542 ((VHDCI_reverse[1][1] & 0x7) << 9) |
543 ((VHDCI[1][1] & 0x7) << 12);
545 ((VHDCI_reverse[1][0] & 0x7ff8) >> 3) | ((VHDCI[1][0] & 0x38) << 9);
546 SFP[1][3] = 0x8000 | ((VHDCI_reverse[1][1] & 0x7ff8) >> 3) |
547 ((VHDCI[1][1] & 0x38) << 9);
568 unsigned short (&eIsoRank)[4],
unsigned short (&eIsoCardId)[4],
569 unsigned short (&eIsoRegionId)[4],
unsigned short (&eNonIsoRank)[4],
570 unsigned short (&eNonIsoCardId)[4],
unsigned short (&eNonIsoRegionId)[4],
571 unsigned short (&MIPbits)[7][2],
unsigned short (&Qbits)[7][2],
572 unsigned long (&VHDCI)[2][2])
const {
574 unsigned short SFP[2][4] = {{0}};
575 EMUtoSFP(eIsoRank, eIsoCardId, eIsoRegionId, eNonIsoRank, eNonIsoCardId,
576 eNonIsoRegionId, MIPbits, Qbits, SFP);
577 SFPtoVHDCI(0, SFP, VHDCI);
586 unsigned short (&eIsoRank)[4],
unsigned short (&eIsoCardId)[4],
587 unsigned short (&eIsoRegionId)[4],
unsigned short (&eNonIsoRank)[4],
588 unsigned short (&eNonIsoCardId)[4],
unsigned short (&eNonIsoRegionId)[4],
589 unsigned short (&MIPbits)[7][2],
unsigned short (&Qbits)[7][2],
590 unsigned long (&VHDCI)[2][2])
const {
592 unsigned short SFP[2][4] = {{0}};
593 VHDCItoSFP(0, SFP, VHDCI);
594 SFPtoEMU(eIsoRank, eIsoCardId, eIsoRegionId, eNonIsoRank, eNonIsoCardId,
595 eNonIsoRegionId, MIPbits, Qbits, SFP);
604 unsigned short (&RCof)[7][2],
605 unsigned short (&RCtau)[7][2],
606 unsigned short (&
HF)[4][2],
607 unsigned short (&HFQ)[4][2],
608 unsigned long (&VHDCI)[2][2])
const {
610 unsigned short SFP[2][4] = {{0}};
611 RC56HFtoSFP(RC, RCof, RCtau,
HF, HFQ, SFP);
612 SFPtoVHDCI(1, SFP, VHDCI);
621 unsigned short (&RCof)[7][2],
622 unsigned short (&RCtau)[7][2],
623 unsigned short (&
HF)[4][2],
624 unsigned short (&HFQ)[4][2],
625 unsigned long (&VHDCI)[2][2])
const {
627 unsigned short SFP[2][4] = {{0}};
628 VHDCItoSFP(1, SFP, VHDCI);
629 SFPtoRC56HF(RC, RCof, RCtau,
HF, HFQ, SFP);
637 unsigned short (&RCof)[7][2],
638 unsigned short (&RCtau)[7][2],
639 unsigned long (&VHDCI)[2][2])
const {
641 unsigned short SFP[2][4] = {{0}};
642 RC012toSFP(RC, RCof, RCtau, SFP);
643 SFPtoVHDCI(2, SFP, VHDCI);
651 unsigned short (&RCof)[7][2],
652 unsigned short (&RCtau)[7][2],
653 unsigned long (&VHDCI)[2][2])
const {
655 unsigned short SFP[2][4] = {{0}};
656 VHDCItoSFP(2, SFP, VHDCI);
657 SFPtoRC012(RC, RCof, RCtau, SFP);
665 unsigned short (&RCof)[7][2],
666 unsigned short (&RCtau)[7][2],
667 unsigned short (&sisterRC)[7][2],
668 unsigned short (&sisterRCof)[7][2],
669 unsigned short (&sisterRCtau)[7][2],
670 unsigned long (&VHDCI)[2][2])
const {
672 unsigned short SFP[2][4] = {{0}};
673 RC234toSFP(RC, RCof, RCtau, sisterRC, sisterRCof, sisterRCtau, SFP);
674 SFPtoVHDCI(3, SFP, VHDCI);
682 unsigned short (&RCof)[7][2],
683 unsigned short (&RCtau)[7][2],
684 unsigned short (&sisterRC)[7][2],
685 unsigned short (&sisterRCof)[7][2],
686 unsigned short (&sisterRCtau)[7][2],
687 unsigned long (&VHDCI)[2][2])
const {
689 unsigned short SFP[2][4] = {{0}};
690 VHDCItoSFP(3, SFP, VHDCI);
691 SFPtoRC234(RC, RCof, RCtau, sisterRC, sisterRCof, sisterRCtau, SFP);
700 unsigned short &logicalCardID,
unsigned short &eventNumber,
701 unsigned short (&eIsoRank)[4],
unsigned short (&eIsoCardId)[4],
702 unsigned short (&eIsoRegionId)[4],
unsigned short (&eNonIsoRank)[4],
703 unsigned short (&eNonIsoCardId)[4],
unsigned short (&eNonIsoRegionId)[4],
704 unsigned short (&MIPbits)[7][2],
unsigned short (&Qbits)[7][2],
707 unsigned long VHDCI[2][2] = {{0}};
708 EMUtoVHDCI(eIsoRank, eIsoCardId, eIsoRegionId, eNonIsoRank, eNonIsoCardId,
709 eNonIsoRegionId, MIPbits, Qbits, VHDCI);
710 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
718 unsigned short &logicalCardID,
unsigned short &eventNumber,
719 unsigned short (&RC)[7][2],
unsigned short (&RCof)[7][2],
720 unsigned short (&RCtau)[7][2],
unsigned short (&
HF)[4][2],
721 unsigned short (&HFQ)[4][2],
std::string &dataString)
const {
723 unsigned long VHDCI[2][2] = {{0}};
724 RC56HFtoVHDCI(RC, RCof, RCtau,
HF, HFQ, VHDCI);
725 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
732 unsigned short &eventNumber,
733 unsigned short (&RC)[7][2],
734 unsigned short (&RCof)[7][2],
735 unsigned short (&RCtau)[7][2],
738 unsigned long VHDCI[2][2] = {{0}};
739 RC012toVHDCI(RC, RCof, RCtau, VHDCI);
740 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
747 unsigned short &logicalCardID,
unsigned short &eventNumber,
748 unsigned short (&RC)[7][2],
unsigned short (&RCof)[7][2],
749 unsigned short (&RCtau)[7][2],
unsigned short (&sisterRC)[7][2],
750 unsigned short (&sisterRCof)[7][2],
unsigned short (&sisterRCtau)[7][2],
753 unsigned long VHDCI[2][2] = {{0}};
754 RC234toVHDCI(RC, RCof, RCtau, sisterRC, sisterRCof, sisterRCtau, VHDCI);
755 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
762 unsigned short &eventNumber,
764 unsigned short (&SFP)[2][4],
767 unsigned long VHDCI[2][2] = {{0}};
768 SFPtoVHDCI(RoutingMode, SFP, VHDCI);
769 VHDCItoSTRING(logicalCardID, eventNumber, dataString, VHDCI);
776 unsigned short &eventNumber,
778 unsigned long (&VHDCI)[2][2])
const {
782 if (!dataString.empty()) {
783 temp << dataString << std::endl;
784 temp >>
dec >> eventNumber;
785 temp >>
dec >> logicalCardID;
786 temp >> hex >> VHDCI[0][0];
787 temp >> hex >> VHDCI[0][1];
788 temp >> hex >> VHDCI[1][0];
789 temp >> hex >> VHDCI[1][1];
792 logicalCardID = 65535;
803 unsigned short &eventNumber,
805 unsigned long (&VHDCI)[2][2])
const {
809 temp <<
dec << eventNumber <<
'\t';
810 temp <<
dec << logicalCardID <<
'\t';
811 temp << hex << setw(8) << setfill(
'0') << VHDCI[0][0] <<
'\t';
812 temp << hex << setw(8) << setfill(
'0') << VHDCI[0][1] <<
'\t';
813 temp << hex << setw(8) << setfill(
'0') << VHDCI[1][0] <<
'\t';
814 temp << hex << setw(8) << setfill(
'0') << VHDCI[1][1] << std::endl;
815 dataString = temp.str();
822 unsigned short &logicalCardID,
int &RoutingMode,
823 int &RCTCrateNumber)
const {
825 RCTCrateNumber = (logicalCardID >> 3);
826 if ((logicalCardID & 0x4) != 0)
828 RoutingMode = (logicalCardID & 0x3);
834 unsigned short &logicalCardID,
int &RoutingMode,
835 int &RCTCrateNumber)
const {
837 logicalCardID = ((RCTCrateNumber % 9) << 3) |
838 (RCTCrateNumber > 8 ? 0x4 : 0x0) | (RoutingMode & 0x3);
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 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 SFPtoRC012(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned short(&SFP)[2][4]) 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 SFPtoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, int RoutingMode, unsigned short(&SFP)[2][4], std::string &dataString) 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 VHDCItoRC012(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[7][2], unsigned long(&VHDCI)[2][2]) 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 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 RoutingModetoLogicalCardID(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) 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 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 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 VHDCItoSTRING(unsigned short &logicalCardID, unsigned short &eventNumber, std::string &dataString, unsigned long(&VHDCI)[2][2]) 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 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 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 SFPtoVHDCI(int RoutingMode, unsigned short(&SFP)[2][4], unsigned long(&VHDCI)[2][2]) 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 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 VHDCItoSFP(int RoutingMode, unsigned short(&SFP)[2][4], unsigned long(&VHDCI)[2][2]) const
void STRINGtoVHDCI(unsigned short &logicalCardID, unsigned short &eventNumber, std::string &dataString, unsigned long(&VHDCI)[2][2]) 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 RC012toVHDCI(unsigned short(&RC)[7][2], unsigned short(&RCof)[7][2], unsigned short(&RCtau)[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
void LogicalCardIDtoRoutingMode(unsigned short &logicalCardID, int &RoutingMode, int &RCTCrateNumber) 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