StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ddl_struct.h
1 #ifndef _DDL_STRUCT_H_
2 #define _DDL_STRUCT_H_
3 
4 
5 #include <sys/types.h>
6 
7 /*
8  DDL events are little endian.
9 
10  Every DDL event starts with a type describing the event type of
11  the hex form:
12 
13 
14  0xvVRssrST
15 
16  where:
17  v is the general version, 0 for this document
18  V is the version
19  R is reserved
20  ss is the sector (from 1)
21  r is the RDO (from 1)
22  S is the subtype
23  T is the type corresponding to the string
24 
25  The second word is the event counter which starts at the
26  beginning of the RDO's lifetime (reconfiguration).
27 
28  The event ends with a word count of _all_ words
29  (including the header and trailer) is it is known or
30  0 if unknown. This word also includes flags such as
31  error etc:
32 
33  0xFLLLLLLL
34 
35  where:
36  F is the flags, 4th bit signifies some error
37  LLLLLLL is the length in words
38 
39 
40 
41  The last word is the exact copy of the second word
42  of the header namely version.
43 
44  Thus:
45 
46  0xvVRssrST
47  event_count
48  ...
49  0xFLLLLLLL
50  0xvVRssrST
51 */
52 
53 #define DDL_STRUCT_VERSION 15 // test version...
54 
55 #define DDL_TYPE_LOG 0 // log aka ascii data
56 #define DDL_TYPE_LOG_V 0
57 
58 #define DDL_TYPE_DTA 1 // triggered data with altros
59 #define DDL_TYPE_DTA_V 0
60 
61 #define DDL_TYPE_RC 2 // Start/Stop run events
62 #define DDL_TYPE_RC_V 0
63 
64 #define DDL_TYPE_MSC 3 // anything, look at subtype
65 #define DDL_TYPE_MSC_V 0
66 
67 #define DDL_HEADER(t,s) ((DDL_STRUCT_VERSION<<28)|(t<<0)|(s<<4))
68 
69 struct ddl_header {
70  u_int type ; // 0xvRRVVSST
71  u_int ev_cou ; // event counter
72 } ;
73 
74 struct ddl_trailer {
75  u_int fl_wc ; // 0xFLLLLLLL: F: 8 event in error; LLLLLL wc, can be 0 if not know...
76  u_int type ; // 0xvRRVVSST same as in the ddl_header
77 } ;
78 
80  char ctype[4] ; // LOG,DTA,RuC,MSC
81  u_int wc ; // word count of all data, including this header
82  u_int res[4] ;
83 } ;
84 
85 
86 
87 // data structures and types; some are just descriptive
88 #define DDL_DTA_NORMAL 0 // used for the ALTRO readout or for Trigger-only events
89 #define DDL_DTA_CFG 1
90 #define DDL_DTA_EMUL 2 // emulated data...
91 
92 #define DDL_MSC_ANY 0
93 #define DDL_MSC_CONFIG 1
94 #define DDL_MSC_HEARTBEAT 2
95 
96 /*
97 struct altro_ch_v0 {
98  u_int d[] ; // of the form 0x000ddddd
99  u_int last[2] ; //
100 }
101 
102 struct altro_data {
103  altro_ch_v0 d[] ;
104 } ;
105 */
106 
107 // TRG subdata
108 struct trg_data {
109  u_int rhic_counter ;
110  u_int csr ; // if 0xFFFF0000 it is the prompt trigger
111  u_int data ; // 0xFFFTDttt
112 } ;
113 
114 // structures used in the configuration event
115 struct fee_cfg {
116  u_int fl_id ; // 0xF0ii00II: F flags, ii old TPC ID, II new FEE ID
117  u_int b_x_s ; // 0x00000BXS: B bus [0..2], X RDO Xilinx [0..2], Side [0..1]
118 
119 } ;
120 
121 /*
122 struct cfg_data {
123  u_int sec_rdo ; // 0x0000SSRR ;
124  u_int time_code ;
125  fee_cfg fee[] ;
126  u_int fee_cou ;
127 } ;
128 
129 struct data_event {
130  ddl_header h ;
131  union {
132  cfg_data c ;
133  altro_data a;
134  } d ;
135  u_int fee_mask[2] ;
136  trg_data trg[] ;
137  u_int trg_cou ;
138  ddl_trailer t ;
139 } ;
140 
141 */
142 
143 #endif