StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rtsSystems.h
1 
2 #ifndef _RTS_SYSTEMS_H_
3 #define _RTS_SYSTEMS_H_
4 
5 #include <stdio.h>
6 #include <sys/types.h>
7 #include <string.h>
8 
9 /*
10  HISTORY:
11  * 11/06/2000, Tonko, completelly revamped from daqSystems.h
12 
13 */
14 
15 
16 
17 /*
18  Tonko, 7/13/00, added the Trigger's detector Bitmask (as found in EventDescriptor)
19  THIS SHOULD BE MAINTAINED BY TRIGGER!!!!!
20 
21  Tonko, 5/8/01, added FPD and moved EMC to 6 and added SMD at old EMCs place
22  John, 8/7/01, replaced RICH with SSD and moved down ETOW, ESMD and PMD into
23  region 0-13 which is the region of valid LIVE
24  John, 10/23/02 Updated TRG_xxx_INSTANCE and TRG_xxx_NODEID (Jeff consulted)
25  Tonko, 10/07/03 Untangled BTOW, BSMD, ETOW & ESMD and retired EMC names...
26 */
27 
28 /* This is _obsolete_ */
29 #define TRG_TPC_BIT 0
30 
31 #define TRG_SVT_BIT 1
32 
33 #define TRG_BSMD_BIT 2
34 
35 #define TRG_FTPC_BIT 3
36 
37 #define TRG_TOF_BIT 4
38 
39 #define TRG_SSD_BIT 5 // used to be RICH
40 
41 #define TRG_BTOW_BIT 6
42 #define TRG_EMC_BIT TRG_BTOW_BIT // use "BTOW"
43 
44 #define TRG_FPD_BIT 7
45 
46 #define TRG_ETOW_BIT 8
47 #define TRG_EEC_BIT TRG_ETOW_BIT // use "ETOW"
48 
49 #define TRG_ESMD_BIT 9
50 
51 #define TRG_PMD_BIT 10
52 
53 //#define TRG_MWC_BIT 11
54 
55 #define TRG_CTB_BIT 14 // does not have a LIVE bit
56 
57 #define TRG_BBC_BIT 15 // does not have a LIVE bit
58 
59 
60 
61 /* TCD IDs - slot positions in the TCD crate */
62 /*
63  SCRATCH that! The ID has nothing to do with the slot
64  anymore but is kept for historical reasons.
65 
66  The TCD_xxx MUST code the board VME address in this form:
67 
68  TCD_ID 6 --> VME 0x10000000
69  TCD_ID 7 --> VME 0x11000000
70  ...
71  TCD_ID 21 -> VME 0x1F000000
72 */
73 #define TCD_ESMD 6 //0x10,
74 #define TCD_BBC 7 //0x11, trigger-only; unused
75 #define TCD_ETOW 8 //0x12,
76 #define TCD_STGC 9 //0x13, was trigger-only; unused
77 #define TCD_FST 10 //0x14, was RHICF; Sep 16: was IST, Jun 2013: was FGT before; Aug 26, 2009: was FPD's before
78 #define TCD_TOF 11 //0x15,
79 #define TCD_PP 12 //0x16
80 #define TCD_MTD 13 //0x17
81 #define TCD_TPX 14 //0x18
82 #define TCD_BSMD 15 //0x19
83 #define TCD_CTB 16 //0x1A, trigger-only; unused
84 #define TCD_BTOW 17 //0x1B
85 #define TCD_ETOF 18 //0x1C; Sep 16: was SST; was FTPC; gone in Sep '11
86 #define TCD_FCS 19 //0x1D; Sep 16: was PXL; was PMD; gone in Sep '11
87 #define TCD_GMT 20 //0x1E; WAS: empty, Nov, 2008
88 #define TCD_VPD 21 //0x1F trigger-only; unused
89 
90 
91 
92 // FY17 Group definitions
93 #define ETOF_GRP 0
94 #define PP_GRP 1
95 #define ETOW_GRP 2
96 #define BTOW_GRP 3
97 #define BSMD_GRP 4
98 #define TOF_GRP 5
99 #define ESMD_GRP 6
100 #define TPX_GRP 7
101 #define FCS_GRP 8
102 #define FST_GRP 9 // was RHICF; still not used in FY19
103 #define STGC_GRP 10 // was unused
104 //#define xxx_GRP 11 // but still unused
105 //#define xxx_GRP 12 // unused
106 //#define xxx_GRP 13 // unused
107 #define GMT_GRP 14
108 #define MTD_GRP 15
109 
110 
111 //FY15, new "evp group" concept; Tonko Feb 2015
112 #define EVP_GRP_FMS 0 //FMS,FPS: FMS_xxx triggers
113 #define EVP_GRP_RP 1 //RomanPots RP_xxx triggers
114 #define EVP_GRP_ZEROBIAS 2 // and similar;
115 
116 
117 
118 /* RTS Node Id, Tonko, 11/06/2000
119 
120 The RTS Node Id is a 16 bit identifier which is used to uniquelly determine
121 a particular node in the STAR RTS tree. At the same time it is used by the
122 myrinet libraries.
123 
124 To make life sane these 16 bits are partitioned into 4 subfields according
125 to the bits:
126 
127 SYSTEM <= 10 or SYSTEM=15 (regular)
128 
129 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
130 
131 SYSTEM---> ROUTE SUBSYS INSTANCE-------------->
132 
133 10 < SYSTEM < 20 (EXT)
134 
135 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
136 
137 EXT-------> x x System------------> INSTANCE->
138 
139 20 <= SYSTEM < 32 (EXT2)
140 
141 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
142 
143 EXT2------> SYSTEM----------> INSTANCE----------->
144 
145 
146 SYSTEM is 4 bits, ROUTE is 2 bits, SUBSYSTEM is 2 bits and the particular
147 INSTANCE is 8 bits. The INSTANCE itself can be any number from (0-255) and
148 thus can additionally be sub-partitioned if this makes sense and adds to
149 human readability.
150 
151 SYSTEM is either DAQ, TRG, SC or L3 as well as all the detectors. Generally
152 it should correspond to the bit in DAQ EVB's DATAP bank under "detectors
153 presence bits" word.
154 
155 ROUTE is a Myrinet concept and should be 0 for all the systems where Myrinet
156 makes no sense. SUBSYS depends on the SYSTEM and can be used if it makes
157 sense. INSTANCE is just the count of nodes. This should generally _not_
158 start with 0 i.e. node called TPC01 should have a '1' as the INSTANCE.
159 
160 There are 2 reserved NodeIds:
161  0x0000
162  0xFFFF
163 
164 0x0000 is used to mean "self" in various subroutines and 0xFFFF is used to
165 mean ERROR or UNKNOWN in other misc. parts of code.
166 
167 */
168 
169 
170 /* special nodes */
171 #define LOCALHOST_NODE 0
172 #define MY_NODE 0
173 #define ERROR_NODE 0xFFFF /* -1 */
174 
175 
176 /*
177 Known RTS systems. For historical reasons, the detectors used to use XXX_ID
178 so we keep it here for source compatibility
179 */
180 
181 #define TPC_SYSTEM 0
182 #define TPC_ID TPC_SYSTEM /* retired */
183 
184 #define SVT_SYSTEM 1
185 #define SVT_ID SVT_SYSTEM /* retired */
186 
187 #define TOF_SYSTEM 2
188 #define TOF_ID TOF_SYSTEM
189 
190 /* this is just the Barrel Tower EMC! */
191 #define BTOW_SYSTEM 3
192 #define BTOW_ID BTOW_SYSTEM
193 
194 
195 /* Frozen as of 8/2002, Tonko */
196 #define FPD_SYSTEM 4
197 #define FPD_ID FPD_SYSTEM
198 
199 #define FTP_SYSTEM 5
200 #define FTP_ID FTP_SYSTEM
201 
202 /* extendes the post-April 2002 systems */
203 #define EXT_SYSTEM 6
204 #define EXT_ID EXT_SYSTEM
205 
206 /* Frozen as of 8/2002, Tonko */
207 #define RIC_SYSTEM 7
208 #define RIC_ID RIC_SYSTEM
209 
210 #define TRG_SYSTEM 8
211 #define TRG_ID TRG_SYSTEM
212 
213 #define L3_SYSTEM 9
214 #define L3_ID L3_SYSTEM
215 
216 #define SC_SYSTEM 10 /* slow controls */
217 #define SC_ID SC_SYSTEM
218 
219 /* Reserver for super-future extensions */
220 #define EXT2_SYSTEM 11
221 #define EXT2_ID EXT2_SYSTEM
222 
223 #define PMD_SYSTEM 12
224 #define PMD_ID PMD_SYSTEM
225 
226 #define SSD_SYSTEM 13
227 #define SSD_ID SSD_SYSTEM /* retired */
228 
229 /* Endcap Tower!*/
230 #define ETOW_SYSTEM 14
231 #define ETOW_ID ETOW_SYSTEM
232 
233 #define DAQ_SYSTEM 15
234 #define DAQ_ID DAQ_SYSTEM
235 #define RTS_SYSTEM DAQ_SYSTEM /* global */
236 
237 // the "new" (2002-03) FPD; Tonko: FP2 was NEVER used -- changing it to FGT in Feb 09!
238 #define FGT_SYSTEM 16
239 #define FGT_ID FGT_SYSTEM
240 
241 #define PP_SYSTEM 17 /* pp2pp */
242 #define PP_ID PP_SYSTEM
243 
244 #define BSMD_SYSTEM 18
245 #define BSMD_ID BSMD_SYSTEM
246 
247 #define ESMD_SYSTEM 19
248 #define ESMD_ID ESMD_SYSTEM
249 
250 #define TPX_SYSTEM 20
251 #define TPX_ID TPX_SYSTEM /* DAQ1000 detector */
252 
253 #define PXL_SYSTEM 21
254 #define PXL_ID PXL_SYSTEM /* HFT's Pixel; Used to be HFT_ID */
255 
256 #define MTD_SYSTEM 22
257 #define MTD_ID MTD_SYSTEM /* Muon Tracking Detector */
258 
259 #define IST_SYSTEM 23
260 #define IST_ID IST_SYSTEM /* HFT's Inner Silicon Tracker */
261 
262 #define SST_SYSTEM 24
263 #define SST_ID SST_SYSTEM /* HFT's SSD */
264 
265 //Removed RPII as 25 -- was never used
266 #define ETOF_SYSTEM 25
267 #define ETOF_ID ETOF_SYSTEM
268 
269 #define GMT_SYSTEM 26
270 #define GMT_ID GMT_SYSTEM /* GEM Monitor for TPC */
271 
272 #define L4_SYSTEM 27
273 #define L4_ID L4_SYSTEM
274 
275 #define FPS_SYSTEM 28
276 #define FPS_ID FPS_SYSTEM
277 
278 //Removed STRXXX as 29-- was never used!
279 #define RHICF_SYSTEM 29
280 #define RHICF_ID RHICF_SYSTEM
281 
282 //reserved for DEP tests in Jan 2017
283 #define FCS_SYSTEM 30
284 #define FCS_ID FCS_SYSTEM
285 
286 #define ITPC_SYSTEM 31
287 #define ITPC_ID ITPC_SYSTEM
288 
289 #define STGC_SYSTEM 32
290 #define STGC_ID STGC_SYSTEM
291 
292 // forward silicon
293 #define FST_SYSTEM 33
294 #define FST_ID FST_SYSTEM
295 
296 #define RTS_NUM_SYSTEMS 34 /* current maximum. NOTE: above 32 from 2018/19! */
297 
298 #define PP_SEQE_INSTANCE 1
299 #define PP_SEQW_INSTANCE 2
300 #define PP_TRG_INSTANCE 3
301 #define PP_TEST_INSTANCE 4
302 
303 // Trigger Detector Bit Mask
304 #define TRGDET_ZDC 0
305 #define TRGDET_BBC 1
306 #define TRGDET_VPD 2
307 #define TRGDET_TOF 3
308 #define TRGDET_EPD 4
309 #define TRGDET_MTD 5
310 #define TRGDET_BEMC 6
311 #define TRGDET_EEMC 7
312 #define TRGDET_PP2PP 8
313 #define TRGDET_FMS 9
314 #define TRGDET_FPS 10
315 #define TRGDET_FCAL 11
316 
317 extern inline int getTrgDetBit(char *str) {
318  if(strcmp(str, "zdc")==0) return TRGDET_ZDC;
319  if(strcmp(str, "bbc")==0) return TRGDET_BBC;
320  if(strcmp(str, "vpd")==0) return TRGDET_VPD;
321  if(strcmp(str, "tof")==0) return TRGDET_TOF;
322  if(strcmp(str, "epd")==0) return TRGDET_EPD;
323  if(strcmp(str, "mtd")==0) return TRGDET_MTD;
324  if(strcmp(str, "bemc")==0) return TRGDET_BEMC;
325  if(strcmp(str, "eemc")==0) return TRGDET_EEMC;
326  if(strcmp(str, "pp2pp")==0) return TRGDET_PP2PP;
327  if(strcmp(str, "fms")==0) return TRGDET_FMS;
328  if(strcmp(str, "fps")==0) return TRGDET_FPS;
329  if(strcmp(str, "fcal")==0) return TRGDET_FCAL;
330  return -1;
331 }
332 
333 extern inline const char *getTrgDetBitName(int x) {
334  switch(x) {
335  case TRGDET_ZDC: return "zdc";
336  case TRGDET_BBC: return "bbc";
337  case TRGDET_VPD: return "vpd";
338  case TRGDET_TOF: return "tof";
339  case TRGDET_EPD: return "epd";
340  case TRGDET_MTD: return "mtd";
341  case TRGDET_BEMC: return "bemc";
342  case TRGDET_EEMC: return "eemc";
343  case TRGDET_PP2PP: return "pp2pp";
344  case TRGDET_FMS: return "fms";
345  case TRGDET_FPS: return "fps";
346  case TRGDET_FCAL: return "fcal";
347  }
348  return NULL;
349 }
350 
351 /*
352  Subsystems (These are overloaded for each system)
353 */
354 
355 #define TRG_L1_SUBSYS 1
356 #define TRG_L2_SUBSYS 2
357 
358 #define GL3_SUBSYS 1
359 #define SL3_SUBSYS 2
360 
361 #define EVB_SUBSYS 1
362 #define GB_SUBSYS 2
363 #define EVBL_SUBSYS 3
364 
365 /*
366  Instances (overloaded for each system)
367 */
368 
369 #ifndef RTS_PROJECT_PP
370 #define DAQMAN_INSTANCE 1
371 #endif
372 
373 #define BB_INSTANCE 2
374 
375 #ifndef RTS_PROJECT_PP
376 #define EVP_INSTANCE 3
377 #endif
378 
379 //#define GB_INSTANCE 4
380 #define BDB_INSTANCE 4 // we'll keep the BDB controller's node_id the same...
381 
382 #define TOKEN_MANAGER_INSTANCE 5
383 
384 #define TCD_LX_INSTANCE 6
385 
386 #define CONTROLS_INSTANCE 7
387 
388 #define TPC_GG_INSTANCE 8
389 
390 //#define BB2_INSTANCE 5
391 //#define TM_INSTANCE GB_INSTANCE
392 //#define EVB_INSTANCE BB_INSTANCE
393 //#define EVB02_INSTANCE BB2_INSTANCE
394 
395 #define RC_CLIENT_INSTANCE 14
396 #define CLIENT_INSTANCE 15
397 
398 
399 #ifdef RTS_PROJECT_PP
400 #define DAQMAN_INSTANCE BB_INSTANCE
401 #define EVP_INSTANCE BB_INSTANCE
402 #endif
403 
404 #define TRG_INSTANCE 1
405 #define TRG_L1_INSTANCE 2
406 #define TRG_L2_INSTANCE 3
407 #define TRG_TCD_INSTANCE 4
408 #define TRG_RCC_INSTANCE 5
409 #define TRG_CTB_INSTANCE 6
410 #define TRG_MIX_INSTANCE 6
411 // #define TRG_EEC_INSTANCE 7 jml Aug 21,03
412 #define TRG_SCALER48_INSTANCE 7
413 //#define TRG_MIX_INSTANCE 8 jml Nov 20, 2008
414 #define TRG_BC1_INSTANCE 9
415 #define TRG_BCE_INSTANCE 10
416 #define TRG_BCW_INSTANCE 11
417 #define TRG_SCALER_INSTANCE 12
418 #define TRG_BBC_INSTANCE 13
419 //#define TRG_FPE_INSTANCE 14
420 #define TRG_FMS_INSTANCE 15
421 #define TRG_L0_INSTANCE 16 // Tonko. Feb25,03
422 #define TRG_QT1_INSTANCE 17
423 #define TRG_QT2_INSTANCE 18
424 #define TRG_QT3_INSTANCE 19
425 #define TRG_QT4_INSTANCE 20
426 #define TRG_BBQ_INSTANCE 21
427 #define TRG_MXQ_INSTANCE 22
428 // #define TRG_FEQ_INSTANCE 23 // JML via JN. 8/29/16
429 #define TRG_EQ3_INSTANCE 23 // Rename EPQ EQ3. JMN 8/15/17
430 #define TRG_TCD_NEW_INSTANCE 24
431 #define TRG_EQ1_INSTANCE 25 // Rename FQ1 EQ1. JMN 8/15/17
432 #define TRG_EQ2_INSTANCE 26 // Rename FQ2 EQ2. JMN 8/15/17
433 
434 // DSM2/QTD node instances 8/25/21
435 #define TRG_STP2_INSTANCE 27
436 #define TRG_L1_DSM2_INSTANCE 28
437 #define TRG_BBC_DSM2_INSTANCE 29
438 #define TRG_BBQ_QTD_INSTANCE 30
439 #define TRG_MIX_DSM2_INSTANCE 31
440 #define TRG_MXQ_QTD_INSTANCE 32
441 #define TRG_BCE_DSM2_INSTANCE 33
442 #define TRG_BCW_DSM2_INSTANCE 34
443 #define TRG_BC1_DSM2_INSTANCE 35
444 #define TRG_EQ1_QTD_INSTANCE 36
445 #define TRG_EQ2_QTD_INSTANCE 37
446 #define TRG_EQ3_QTD_INSTANCE 38
447 #define TRG_EQ4_QTD_INSTANCE 39
448 
449 #define TRG_EQ4_INSTANCE 40
450 
451 
452 #define L3EVP_INSTANCE 1
453 #define L3DISP_INSTANCE 2
454 
455 /******************** RC/DAQ nodes ****************/
456 /* Tonko, Jun 6, 2003 - EVB & GB extensions */
457 /*
458  Tonko Comments:
459 
460  EVB) the Linux based EVBs will be EVB_NODES(1)... and
461  we keep the old names...
462  GB) the new Linux GB will be GB_NODES(1) and the old MVME
463  in the main crate will continue to be called
464  BDB_NODE
465 */
466 //#define EVB_NODES(x) ((DAQ_SYSTEM<<12) | (EVB_SUBSYS<<8) | (x))
467 #define EVBL_NODES(x) ((DAQ_SYSTEM<<12) | (EVBL_SUBSYS<<8) | (x))
468 #define EVBX_NODES(x) ((DAQ_SYSTEM<<12) | (EVB_SUBSYS<<8) | (x))
469 #define EVBX_NODE_COUNT 24 // was 14 before FY23; was 6 before FY13; in a run epoch, used by monitoring and RICH scalers!
470 
471 #define MAX_EVB_NODES 24
472 
473 #define GB_NODES(x) ((DAQ_SYSTEM<<12) | (GB_SUBSYS<<8 ) | (x))
474 #define GB_NODE GB_NODES(1)
475 
476 
477 #define BB_NODE ((DAQ_SYSTEM<<12) | BB_INSTANCE)
478 
479 #ifdef RTS_PROJECT_PP
480 
481 #define DAQMAN_NODE BB_NODE
482 #define EVP_NODE BB_NODE
483 #define BB2_NODE BB_NODE
484 
485 #else
486 
487 #define DAQMAN_NODE ((DAQ_SYSTEM<<12) | DAQMAN_INSTANCE)
488 #define EVP_NODE ((DAQ_SYSTEM<<12) | EVP_INSTANCE)
489 #define BB2_NODE ((DAQ_SYSTEM<<12) | BB2_INSTANCE)
490 
491 
492 #endif
493 
494 /* aliases and shortcuts */
495 #define RC_NODE DAQMAN_NODE /* for the time being...*/
496 #define LOG_NODE DAQMAN_NODE
497 #define MON_NODE DAQMAN_NODE
498 
499 
500 #define RC_CLIENT_NODE ((DAQ_SYSTEM<<12) | RC_CLIENT_INSTANCE)
501 #define CLIENT_NODE ((DAQ_SYSTEM<<12) | CLIENT_INSTANCE)
502 
503 // Tonko: changed this, Nov 4, 2003
504 //#define EVB01_NODE BB_NODE
505 //#define EVB02_NODE BB2_NODE
506 //#define EVB_NODE EVB01_NODE
507 // this will also go away!
508 //#define EVB_NODE EVB_NODES(1)
509 
510 
511 #define BDB_NODE ((DAQ_SYSTEM<<12) | BDB_INSTANCE) // old GB...
512 
513 #define TOKEN_MANAGER_NODE ((DAQ_SYSTEM<<12) | TOKEN_MANAGER_INSTANCE)
514 
515 #define TCD_LX_NODE ((DAQ_SYSTEM<<12) | TCD_LX_INSTANCE)
516 
517 #define TPC_GG_NODE ((DAQ_SYSTEM<<12) | TPC_GG_INSTANCE)
518 
519 #define CONTROLS_NODE ((DAQ_SYSTEM<<12) | CONTROLS_INSTANCE)
520 
521 /* singular detectors */
522 #define RIC01_NODE ((RIC_SYSTEM<<12) | 1)
523 #define RIC02_NODE ((RIC_SYSTEM<<12) | 2)
524 #define RIC_NODE RIC01_NODE
525 
526 #define TOF01_NODE ((TOF_SYSTEM<<12) | 1) // DAQ end
527 #define TOF02_NODE ((TOF_SYSTEM<<12) | 2) // Platform
528 #define TOF03_NODE ((TOF_SYSTEM<<12) | 3) // new, test node
529 #define TOF_NODE TOF01_NODE
530 #define TOF_NODES ((TOF_SYSTEM<<12) | (x)) // shorthand
531 
532 #define FPD01_NODE ((FPD_SYSTEM<<12) | 1)
533 #define FPD02_NODE ((FPD_SYSTEM<<12) | 2)
534 #define FPD_NODE FPD01_NODE
535 /* added IP steering */
536 #define FPD_DEST_HOST "gb.daq.bnl.local"
537 #define FPD_PORT 5211
538 
539 /* multi-node detectors */
540 #define TPC_NODES(x) ((TPC_SYSTEM<<12) | (x))
541 
542 #define FTP_NODES(x) ((FTP_SYSTEM<<12) | (x))
543 
544 #define SVT_NODES(x) ((SVT_SYSTEM<<12) | (x))
545 
546 /* separated the Endcap (EEC) from the Barrel (EMC), Tonko, 4/4/2002 */
547 /* Barrel */
548 
549 #define BTOW_NODE ((BTOW_SYSTEM<<12) | 1)
550 
551 #define BSMD_NODE ((EXT_SYSTEM<<12)|(BSMD_SYSTEM<<4)|1)
552 #define BSMD_NODES(x) ((EXT_SYSTEM<<12)|(BSMD_SYSTEM<<4) | (x)) /* Tonko, split into 3 crates */
553 
554 #define BPRE_NODE ((BTOW_SYSTEM<<12) | 2) /* NOT really known yet! */
555 
556 /* Extended (post April 2002) Detectors */
557 #define PMD01_NODE ((EXT_SYSTEM<<12)|(PMD_SYSTEM<<4) | 1)
558 #define PMD02_NODE ((EXT_SYSTEM<<12)|(PMD_SYSTEM<<4) | 2)
559 #define PMD03_NODE ((EXT_SYSTEM<<12)|(PMD_SYSTEM<<4) | 3)
560 #define PMD_NODES(x) ((EXT_SYSTEM<<12)|(PMD_SYSTEM<<4) | (x))
561 /* the main node is PMD03 */
562 #define PMD_NODE PMD03_NODE
563 /* Added TCP/IP steering */
564 #define PMD_DEST_HOST "gb.daq.bnl.local"
565 #define PMD_PORT_1 5201
566 #define PMD_PORT_2 5202 // becomes 5202 soon!
567 
568 #define SSD01_NODE ((EXT_SYSTEM<<12)|(SSD_SYSTEM<<4) | 1)
569 #define SSD_NODE SSD01_NODE
570 
571 
572 #define FGT01_NODE ((EXT_SYSTEM<<12)|(FGT_SYSTEM<<4) | 1)
573 #define FGT_NODE FGT01_NODE
574 
575 
576 /* Endcap */
577 
578 #define ETOW_NODE ((EXT_SYSTEM<<12)|(ETOW_SYSTEM<<4)|1)
579 #define ESMD_NODE ((EXT_SYSTEM<<12)|(ESMD_SYSTEM<<4)|1)
580 
581 
582 /* Level III */
583 #define L3_NODES(x) ((L3_SYSTEM<<12) | (SL3_SUBSYS<<8) | (x))
584 #define SL3_NODES(x) ((L3_SYSTEM<<12) | (SL3_SUBSYS<<8) | (x))
585 #define GL3_NODES(x) ((L3_SYSTEM<<12) | (GL3_SUBSYS<<8) | (x))
586 #define GL3_NODE GL3_NODES(1)
587 #define GL3_NODE_COUNT 10 // maximum count of nodes per run epoch
588 
589 #define L3EVP_NODE ((L3_SYSTEM<<12) | 1)
590 #define L3DISP_NODE ((L3_SYSTEM<<12) | 2)
591 
592 #define L4_NODES(x) ((EXT2_SYSTEM<<12) | (L4_SYSTEM<<7) | (x))
593 #define L4_CAL_INSTANCE 120
594 #define L4_EVP_INSTANCE 121
595 #define L4_CAL_NODE ((EXT2_SYSTEM<<12) | (L4_SYSTEM<<7) | L4_CAL_INSTANCE)
596 #define L4_EVP ((EXT2_SYSTEM<<12) | (L4_SYSTEM<<7) | L4_EVP_INSTANCE)
597 #define L4_EVP_NODE L4_EVP
598 #define L4_EVB(x) ((EXT2_SYSTEM<<12) | (L4_SYSTEM<<7) | (L4_EVP_INSTANCE + 1 + x))
599 
600 /* Trigger */
601 #define TRG_NODE ((TRG_SYSTEM<<12) | TRG_INSTANCE)
602 #define TRG_L1_NODE ((TRG_SYSTEM<<12) | TRG_L1_INSTANCE)
603 //#define TRG_L2_NODE ((TRG_SYSTEM<<12) | TRG_L2_INSTANCE)
604 #define TRG_L2_NODE ((TRG_SYSTEM<<12) | (TRG_L2_SUBSYS<<8) | (1))
605 #define TRG_TCD_NODE ((TRG_SYSTEM<<12) | TRG_TCD_INSTANCE)
606 #define TRG_RCC_NODE ((TRG_SYSTEM<<12) | TRG_RCC_INSTANCE)
607 #define TRG_CTB_NODE ((TRG_SYSTEM<<12) | TRG_CTB_INSTANCE)
608 #define TRG_MIX_NODE ((TRG_SYSTEM<<12) | TRG_MIX_INSTANCE)
609 #define TRG_L1_NODES(x) ((TRG_SYSTEM<<12) | (TRG_L1_SUBSYS<<8) | (x))
610 #define TRG_L2_NODES(x) ((TRG_SYSTEM<<12) | (TRG_L2_SUBSYS<<8) | (x))
611 // #define TRG_MIX_NODE ((TRG_SYSTEM<<12) | TRG_MIX_INSTANCE) jml
612 #define TRG_BC1_NODE ((TRG_SYSTEM<<12) | TRG_BC1_INSTANCE)
613 #define TRG_BCE_NODE ((TRG_SYSTEM<<12) | TRG_BCE_INSTANCE)
614 #define TRG_BCW_NODE ((TRG_SYSTEM<<12) | TRG_BCW_INSTANCE)
615 #define TRG_SCALER_NODE ((TRG_SYSTEM<<12) | TRG_SCALER_INSTANCE)
616 #define TRG_BBC_NODE ((TRG_SYSTEM<<12) | TRG_BBC_INSTANCE)
617 //#define TRG_FPE_NODE ((TRG_SYSTEM<<12) | TRG_FPE_INSTANCE)
618 #define TRG_FMS_NODE ((TRG_SYSTEM<<12) | TRG_FMS_INSTANCE)
619 #define TRG_L0_NODE ((TRG_SYSTEM<<12) | TRG_L0_INSTANCE) // Tonko, Feb25,03
620 #define TRG_QT1_NODE ((TRG_SYSTEM<<12) | TRG_QT1_INSTANCE)
621 #define TRG_QT2_NODE ((TRG_SYSTEM<<12) | TRG_QT2_INSTANCE)
622 #define TRG_QT3_NODE ((TRG_SYSTEM<<12) | TRG_QT3_INSTANCE)
623 #define TRG_QT4_NODE ((TRG_SYSTEM<<12) | TRG_QT4_INSTANCE)
624 #define TRG_BBQ_NODE ((TRG_SYSTEM<<12) | TRG_BBQ_INSTANCE)
625 #define TRG_MXQ_NODE ((TRG_SYSTEM<<12) | TRG_MXQ_INSTANCE)
626 //#define TRG_FEQ_NODE ((TRG_SYSTEM<<12) | TRG_FEQ_INSTANCE)
627 //#define TRG_FEQ_NODE ((TRG_SYSTEM<<12) | TRG_EPQ_INSTANCE) // Comment FEQ. JMN 8/15/17
628 #define TRG_EQ3_NODE ((TRG_SYSTEM<<12) | TRG_EQ3_INSTANCE) // Rename EPQ > EQ3. JMN 8/15/17
629 #define TRG_EQ1_NODE ((TRG_SYSTEM<<12) | TRG_EQ1_INSTANCE) // Rename FQ1 > EQ1. JMN
630 #define TRG_EQ2_NODE ((TRG_SYSTEM<<12) | TRG_EQ2_INSTANCE) // Rename FQ2 > EQ2. JMN
631 #define TRG_EQ4_NODE ((TRG_SYSTEM<<12) | TRG_EQ4_INSTANCE)
632 
633 #define TRG_STP2_NODE ((TRG_SYSTEM<<12) | TRG_STP2_INSTANCE)
634 #define TRG_L1_DSM2_NODE ((TRG_SYSTEM<<12) | TRG_L1_DSM2_INSTANCE)
635 #define TRG_BBC_DSM2_NODE ((TRG_SYSTEM<<12) | TRG_BBC_DSM2_INSTANCE)
636 #define TRG_BBQ_QTD_NODE ((TRG_SYSTEM<<12) | TRG_BBQ_QTD_INSTANCE)
637 #define TRG_MIX_DSM2_NODE ((TRG_SYSTEM<<12) | TRG_MIX_DSM2_INSTANCE)
638 #define TRG_MXQ_QTD_NODE ((TRG_SYSTEM<<12) | TRG_MXQ_QTD_INSTANCE)
639 #define TRG_BCE_DSM2_NODE ((TRG_SYSTEM<<12) | TRG_BCE_DSM2_INSTANCE)
640 #define TRG_BCW_DSM2_NODE ((TRG_SYSTEM<<12) | TRG_BCW_DSM2_INSTANCE)
641 #define TRG_BC1_DSM2_NODE ((TRG_SYSTEM<<12) | TRG_BC1_DSM2_INSTANCE)
642 #define TRG_EQ1_QTD_NODE ((TRG_SYSTEM<<12) | TRG_EQ1_QTD_INSTANCE)
643 #define TRG_EQ2_QTD_NODE ((TRG_SYSTEM<<12) | TRG_EQ2_QTD_INSTANCE)
644 #define TRG_EQ3_QTD_NODE ((TRG_SYSTEM<<12) | TRG_EQ3_QTD_INSTANCE)
645 #define TRG_EQ4_QTD_NODE ((TRG_SYSTEM<<12) | TRG_EQ4_QTD_INSTANCE)
646 
647 #define TRG_SCALER48_NODE ((TRG_SYSTEM<<12) | TRG_SCALER48_INSTANCE)
648 
649 /* Temporary... for zoran...*/
650 /* #define TDI_NODE ((TRG_SYSTEM<<12) | TRG_TDI_INSTANCE) */
651 
652 #define TRG_TCD_NEW_NODE ((TRG_SYSTEM<<12) | TRG_TCD_NEW_INSTANCE)
653 
654 #define L201_NODE TRG_L2_NODES(1)
655 
656 /* Slow Controls */
657 #define SC_NODE ((SC_SYSTEM<<12) | 1)
658 
659 /* PP2PP */ /* IGNORED for STAR 2007+ runs! */
660 #define PP_SEQE_NODE ((EXT_SYSTEM<<12) | ((PP_SYSTEM)<<4) | PP_SEQE_INSTANCE)
661 
662 /* this is known as Sector1 aka ppdaq2 aka Yellow */
663 #define PP_SEQ1_NODE PP_SEQE_NODE
664 
665 #define PP_SEQW_NODE ((EXT_SYSTEM<<12) | ((PP_SYSTEM)<<4) | PP_SEQW_INSTANCE)
666 /* this is known as Sector2 aka ppdaq5 aka Blue */
667 #define PP_SEQ2_NODE PP_SEQW_NODE
668 
669 #define PP_TRG_NODE ((EXT_SYSTEM<<12) | ((PP_SYSTEM)<<4) | PP_TRG_INSTANCE)
670 #define PP_TEST_NODE ((EXT_SYSTEM<<12) | ((PP_SYSTEM)<<4) | PP_TEST_INSTANCE)
671 
672 /* Tonko, Aug 2007, ready for 2007 */
673 #define PP_NODES(x) ((EXT_SYSTEM<<12) | ((PP_SYSTEM)<<4) | (x))
674 
675 #define TPX_NODES(x) ((EXT2_SYSTEM<<12) | (TPX_SYSTEM<<7) | (x))
676 #define MTD_NODES(x) ((EXT2_SYSTEM<<12) | (MTD_SYSTEM<<7) | (x))
677 
678 #define PXL_NODES(x) ((EXT2_SYSTEM<<12) | (PXL_SYSTEM<<7) | (x))
679 #define IST_NODES(x) ((EXT2_SYSTEM<<12) | (IST_SYSTEM<<7) | (x))
680 #define SST_NODES(x) ((EXT2_SYSTEM<<12) | (SST_SYSTEM<<7) | (x))
681 //#define RPII_NODES(x) ((EXT2_SYSTEM<<12) | (RPII_SYSTEM<<7) | (x))
682 
683 #define GMT_NODES(x) ((EXT2_SYSTEM<<12) | (GMT_SYSTEM<<7) | (x))
684 
685 #define FPS_NODES(x) ((EXT2_SYSTEM<<12) | (FPS_SYSTEM<<7) | (x))
686 
687 #define ETOF_NODES(x) ((EXT2_SYSTEM<<12) | (ETOF_SYSTEM<<7) | (x))
688 
689 #define RHICF_NODES(x) ((EXT2_SYSTEM<<12) | (RHICF_SYSTEM<<7) | (x))
690 
691 #define FCS_NODES(x) ((EXT2_SYSTEM<<12) | (FCS_SYSTEM<<7) | (x))
692 
693 #define ITPC_NODES(x) ((EXT2_SYSTEM<<12) | (ITPC_SYSTEM<<7) | (x))
694 
695 // NOTE: new scheme for detectors above 32!
696 #define STGC_NODES(x) ((FPD_SYSTEM<<12) | (STGC_SYSTEM<<6) | (x))
697 
698 #define FST_NODES(x) ((FPD_SYSTEM<<12) | (FST_SYSTEM<<6) | (x))
699 
700 extern inline const char *rts2name(int rts_id)
701 {
702  switch(rts_id) {
703  case TPC_SYSTEM :
704  return "TPC" ;
705  case SVT_SYSTEM :
706  return "SVT" ;
707  case TOF_SYSTEM :
708  return "TOF" ;
709  case BTOW_SYSTEM :
710  return "BTOW" ;
711  case FPD_SYSTEM :
712  return "FPD" ;
713  case FTP_SYSTEM :
714  return "FTP" ;
715  case PMD_SYSTEM :
716  return "PMD" ;
717  case SSD_SYSTEM :
718  return "SSD" ;
719  case ETOW_SYSTEM :
720  return "ETOW" ;
721  case FGT_SYSTEM : // watch it!
722  return "FGT" ;
723  case BSMD_SYSTEM :
724  return "BSMD" ;
725  case ESMD_SYSTEM :
726  return "ESMD" ;
727  case DAQ_SYSTEM :
728  return "DAQ" ;
729  case TRG_SYSTEM :
730  return "TRG" ;
731  case L3_SYSTEM :
732  return "L3" ;
733  case SC_SYSTEM :
734  return "SC" ;
735  case TPX_SYSTEM :
736  return "TPX" ;
737  case PXL_SYSTEM :
738  return "PXL" ;
739  case PP_SYSTEM :
740  return "PP2PP" ;
741  case RIC_SYSTEM :
742  return "RICH" ;
743  case MTD_SYSTEM :
744  return "MTD" ;
745  case IST_SYSTEM :
746  return "IST" ;
747  case SST_SYSTEM :
748  return "SST" ;
749  case GMT_SYSTEM :
750  return "GMT" ;
751  case L4_SYSTEM :
752  return "L4" ;
753  case FPS_SYSTEM :
754  return "FPS" ;
755  case ETOF_SYSTEM :
756  return "ETOF" ;
757  case FCS_SYSTEM :
758  return "FCS" ;
759  case ITPC_SYSTEM :
760  return "ITPC" ;
761  case RHICF_SYSTEM :
762  return "RHICF" ;
763  case STGC_SYSTEM :
764  return "STGC" ;
765  case FST_SYSTEM :
766  return "FST" ;
767  default :
768  return (const char *)NULL ; // unknown!
769  }
770 } ;
771 
772 extern inline const char *rts2sfs_name(int rts_id)
773 {
774  switch(rts_id) {
775  case TPC_SYSTEM :
776  return "tpc" ;
777  case SVT_SYSTEM :
778  return "SVT" ;
779  case TOF_SYSTEM :
780  return "tof" ;
781  case BTOW_SYSTEM :
782  return "btow" ;
783  case FPD_SYSTEM :
784  return "FPD" ;
785  case FTP_SYSTEM :
786  return "FTP" ;
787  case PMD_SYSTEM :
788  return "PMD" ;
789  case SSD_SYSTEM :
790  return "SSD" ;
791  case ETOW_SYSTEM :
792  return "etow" ;
793  case FGT_SYSTEM :
794  return "fgt" ;
795  case BSMD_SYSTEM :
796  return "bsmd" ;
797  case ESMD_SYSTEM :
798  return "esmd" ;
799  case DAQ_SYSTEM :
800  return "DAQ" ;
801  case TRG_SYSTEM :
802  return "trg" ;
803  case L3_SYSTEM :
804  return "l3" ;
805  case SC_SYSTEM :
806  return "sc" ;
807  case TPX_SYSTEM :
808  return "tpx" ;
809  case PXL_SYSTEM :
810  return "pxl" ;
811  case PP_SYSTEM :
812  return "pp2" ;
813  case RIC_SYSTEM :
814  return "RICH" ;
815  case MTD_SYSTEM :
816  return "mtd" ;
817  case IST_SYSTEM :
818  return "ist" ;
819  case SST_SYSTEM :
820  return "sst" ;
821  case GMT_SYSTEM :
822  return "gmt" ;
823  case L4_SYSTEM :
824  return "l4" ;
825  case FPS_SYSTEM :
826  return "fps" ;
827  case ETOF_SYSTEM :
828  return "etof";
829  case RHICF_SYSTEM :
830  return "rhicf";
831  case FCS_SYSTEM :
832  return "fcs";
833  case ITPC_SYSTEM :
834  return "itpc";
835  case STGC_SYSTEM :
836  return "stgc" ;
837  case FST_SYSTEM :
838  return "fst" ;
839  default :
840  return (const char *)NULL ; // unknown!
841  }
842 } ;
843 
844 #ifndef __vxworks
845 extern inline int name2rts(const char *name)
846 {
847  for(int rts_id=0;rts_id<48;rts_id++) { // increased from 32 to 48!
848  const char *r_name = rts2name(rts_id) ;
849  if(r_name && name && (strncasecmp(name,r_name,strlen(r_name))==0)) return rts_id ;
850  }
851 
852  return -1 ;
853 }
854 #endif
855 
856 #if 0
857 /* return >= 0 only in case of real detectors */
858 /* Why do we need this?? Tonko. */
859 extern inline int rts2det(int ix)
860 {
861  switch(ix) {
862  case RIC_ID :
863  case TPC_ID :
864  case SVT_ID :
865  case TOF_ID :
866  case BTOW_ID :
867  case FPD_ID :
868  case FTP_ID :
869  case PMD_ID :
870  case SSD_ID :
871  case ETOW_ID :
872  case BSMD_ID :
873  case ESMD_ID :
874  case TPX_ID :
875  case PXL_ID :
876  case PP_ID :
877  case FGT_ID :
878  case MTD_ID :
879  case IST_ID :
880  case SST_ID :
881  case GMT_ID :
882  case FPS_ID:
883  case ETOF_ID:
884  case RHICF_ID:
885  case FCS_ID:
886  case ITPC_ID:
887  case STGC_ID :
888  case FST_ID :
889  return ix ;
890  default :
891  return -1 ;
892  }
893 
894 }
895 #endif
896 
897 // NEW for FY19: returns a pseudo-rts less than 32 for local use
898 // within transient code which can change yearly e.g. TCD or Monitoring
899 extern inline int rts2_32(int rts)
900 {
901  switch(rts) {
902  case FST_ID :
903  case STGC_ID :
904  return FPD_ID ;
905  default :
906  return rts ;
907  }
908 
909 }
910 
911 extern inline int rts2tcd(int rts)
912 {
913  //new
914  switch(rts) {
915  case TOF_ID :
916  return TCD_TOF ;
917  case BTOW_ID :
918  return TCD_BTOW ;
919  case ETOW_ID :
920  return TCD_ETOW ;
921  case PP_ID :
922  return TCD_PP ;
923  case BSMD_ID :
924  return TCD_BSMD ;
925  case ESMD_ID :
926  return TCD_ESMD ;
927  case TPX_ID :
928  case ITPC_ID :
929  return TCD_TPX ;
930  case MTD_ID :
931  return TCD_MTD ;
932  case ETOF_ID :
933  return TCD_ETOF ;
934  case GMT_ID :
935  return TCD_GMT ;
936  case FST_ID :
937  return TCD_FST ;
938  case FCS_ID :
939  return TCD_FCS ;
940  case STGC_ID : // for FY19
941  return TCD_STGC ;
942  default :
943  return -1 ;
944  }
945 
946 }
947 
948 // This is actually bad. I really want grp2rts!!! Should remove it...
949 extern inline int tcd2rts(int tcd)
950 {
951  switch(tcd) {
952  case TCD_TOF :
953  return TOF_ID ;
954  case TCD_BTOW :
955  return BTOW_ID ;
956  case TCD_ETOW :
957  return ETOW_ID ;
958  case TCD_PP :
959  return PP_ID ;
960  case TCD_BSMD :
961  return BSMD_ID ;
962  case TCD_ESMD :
963  return ESMD_ID ;
964  case TCD_TPX :
965  return TPX_ID ;
966  case TCD_MTD :
967  return MTD_ID ;
968  case TCD_ETOF :
969  return ETOF_ID ;
970  case TCD_GMT :
971  return GMT_ID ;
972  case TCD_FST :
973  return FST_ID ;
974  case TCD_FCS :
975  return FCS_ID ;
976  case TCD_STGC :
977  return STGC_ID ;
978  default :
979  return -1 ;
980  }
981 } ;
982 
983 
984 // BTOW, ETOW now part of trigger: jan 2008
985 #define LEGACY_DETS (1<<FTP_ID)
986 
987 // NOTE that this is now 64 bits!!! Also note that there are a bunch (but not all) of unused systems here...
988 #define DAQ1000_DETS ((1<<TPX_ID) | (1<<TOF_ID) | (1<<PMD_ID) | (1<<ESMD_ID) | (1<<PP_ID) | (1<<FGT_ID) | \
989  (1<<L3_ID) | (1 << BSMD_ID) | (1 << MTD_ID) | (1<<ETOF_ID) | (1<<GMT_ID) | (1<<BTOW_ID) | (1<<ETOW_ID)) | (1<<FPS_ID) |\
990  (1<<FCS_ID) | (1<<ITPC_ID) | (1<<RHICF_ID) | (1LL<<STGC_ID) | (1LL<<FST_ID)
991 
992 // 2009... unused dets: SSD/SVT/TPC/PMD/HFT ---> FTPGROUP
993 // 2018/19 NOTE return of a 64 bit quantity!!!
994 extern inline unsigned long long grp2rts_mask(int grp)
995 {
996  unsigned long long ret ;
997 
998  ret = 0 ;
999 
1000  if(grp & (1ll<<ETOF_GRP)) {
1001  ret |= (1ll<<ETOF_SYSTEM) ;
1002  }
1003  if(grp & (1ll << PP_GRP)) {
1004  ret |= (1ll << PP_SYSTEM);
1005  }
1006  if(grp & (1ll << ETOW_GRP)) {
1007  ret |= (1ll << ETOW_SYSTEM) ;
1008  }
1009  if(grp & (1ll << BTOW_GRP)) {
1010  ret |= (1ll << BTOW_SYSTEM) ;
1011  }
1012  if(grp & (1ll << BSMD_GRP)) {
1013  ret |= (1ll << BSMD_SYSTEM) ;
1014  }
1015  if(grp & (1ll << TOF_GRP)) {
1016  ret |= (1ll << TOF_SYSTEM) ;
1017  }
1018  if(grp & (1ll << ESMD_GRP)) {
1019  ret |= (1ll << ESMD_SYSTEM) ;
1020  }
1021  if(grp & (1ll << TPX_GRP)) {
1022  ret |= (1ll << TPX_SYSTEM);
1023  ret |= (1ll << ITPC_SYSTEM);
1024  }
1025  if(grp & (1ll << STGC_GRP)) {
1026  ret |= (1LL << STGC_SYSTEM); // NOTE 1LL!
1027  }
1028  if(grp & (1ll << FCS_GRP)) {
1029  ret |= (1ll << FCS_SYSTEM);
1030 // ret |= (1ll << STGC_SYSTEM); // for FY19
1031  }
1032  if(grp & (1ll << MTD_GRP)) {
1033  ret |= (1ll << MTD_SYSTEM);
1034  }
1035  if(grp & (1ll << FST_GRP)) {
1036  ret |= (1ll << FST_SYSTEM);
1037  }
1038  if(grp & (1ll << GMT_GRP)) {
1039  ret |= (1ll << GMT_SYSTEM);
1040  }
1041 
1042  return ret ;
1043 }
1044 
1045 // goes from the RTS_SYSTEM id to the GRP id
1046 extern inline int rts2grp(int rts)
1047 {
1048  switch(rts)
1049  {
1050  // Instance doesn't matter...
1051  case PP_ID:
1052  return PP_GRP;
1053  case ETOW_ID:
1054  return ETOW_GRP;
1055  case ESMD_ID:
1056  return ESMD_GRP;
1057  case BTOW_ID:
1058  return BTOW_GRP;
1059  case BSMD_ID:
1060  return BSMD_GRP;
1061  case TOF_ID:
1062  return TOF_GRP;
1063  case TPX_ID:
1064  return TPX_GRP;
1065  case MTD_ID:
1066  return MTD_GRP;
1067  case GMT_ID :
1068  return GMT_GRP;
1069  case ETOF_ID :
1070  return ETOF_GRP;
1071  case STGC_ID :
1072  return STGC_GRP;
1073  case FST_ID :
1074  return FST_GRP ;
1075  case FCS_ID :
1076  return FCS_GRP ;
1077  case TPC_ID: // Shares the TPC TCD...
1078  case ITPC_ID: // Shares the TPC TCD...
1079  return TPX_GRP;
1080  default:
1081  return 31 ; // this is an ERROR since groups < 16
1082  }
1083 }
1084 
1085 
1086 
1087 extern inline int GET_NODE(int sys, int subsys, int inst)
1088 {
1089  int node ;
1090 
1091  if((sys <= 10) || (sys==15)) {
1092  node = (sys<<12) | (subsys<<8) | (inst);
1093  }
1094  else if (sys < 20) {
1095  node = (EXT_SYSTEM << 12) | (sys<<4) | (inst);
1096  }
1097  else if(sys < 32) {
1098  node = (EXT2_SYSTEM << 12) | (sys<<7) | (inst);
1099  }
1100  else { // NEW for id's >=32
1101  node = (FPD_SYSTEM<<12) | (sys<<6) | (inst) ;
1102  }
1103 
1104  return node ;
1105 } ;
1106 
1107 extern inline int GET_SYSTEM(unsigned short node)
1108 {
1109  int id = (node & 0xf000) >> 12;
1110 
1111  if(id == EXT_SYSTEM) return (node & 0x03f0) >> 4;
1112  if(id == EXT2_SYSTEM) return (node & 0x0f80) >> 7;
1113  if(id == FPD_SYSTEM) { // new FY19 extension
1114  u_int sys = node & 0x0FC0 ;
1115  sys >>= 6 ;
1116  if(sys) return sys ; // non-zero "system"
1117  else return FPD_SYSTEM ; // if 0, must be our old FPD
1118  }
1119 
1120  return id;
1121 }
1122 
1123 extern inline int GET_INSTANCE(unsigned short node)
1124 {
1125  int id;
1126 
1127  id = (node & 0xf000) >> 12;
1128  if(id == EXT_SYSTEM) return node & 0xf;
1129  if(id == EXT2_SYSTEM) return node & 0x7f;
1130  if(id == FPD_SYSTEM) return node & 0x3F ;
1131 
1132  return node & 0xff;
1133 }
1134 
1135 extern inline int GET_SUBSYSTEM(unsigned short node)
1136 {
1137  int id = (node & 0xf000) >> 12;
1138 
1139  if(id == EXT_SYSTEM) return 0;
1140  if(id == EXT2_SYSTEM) return 0;
1141  if(id == FPD_SYSTEM) return 0 ;
1142 
1143  return (node & 0x0300) >> 8;
1144 }
1145 
1146 /* Tonko: I don't think anyone needs this??? */
1147 #define GET_NODE_PRE_APR2002(sys,subsys,inst) ((sys<<12) | (subsys<<8) | (inst))
1148 #define GET_SYSTEM_PRE_APR2002(x) (((x) >> 12) & 0xf)
1149 #define GET_INSTANCE_PRE_APR2002(x) ((x) & 0xff)
1150 #define GET_SUBSYSTEM_PRE_APR2002(x) (((x) >> 8) & 0x3)
1151 
1152 #define GET_ROUTE(x) (((x) >> 10) & 0x3)
1153 
1154 #endif /* _RTS_SYSTEMS_H_ */
1155 
1156 
1157