-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfa250dec.h
More file actions
252 lines (215 loc) · 4.31 KB
/
fa250dec.h
File metadata and controls
252 lines (215 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#ifndef __FA250DEC__
#define __FA250DEC__
#include <stdint.h>
/* 0: BLOCK HEADER */
typedef struct
{
uint32_t NSA:9;
uint32_t NSB:9;
uint32_t PL:11;
uint32_t undef:2;
uint32_t data_type_defining:1;
} fa250_block_header_2;
typedef union
{
uint32_t raw;
fa250_block_header_2 bf;
} fa250_block_header_2_t;
/* 2: EVENT HEADER */
typedef struct
{
uint32_t trigger_number:12;
uint32_t trigger_time:10;
uint32_t slot_number:5;
uint32_t data_type_tag:4;
uint32_t data_type_defining:1;
} fa250_event_header;
typedef union
{
uint32_t raw;
fa250_event_header bf;
} fa250_event_header_t;
/* 3: TRIGGER TIME */
typedef struct
{
uint32_t T_F:8;
uint32_t T_E:8;
uint32_t T_D:8;
uint32_t T_C:3;
uint32_t data_type_tag:4;
uint32_t data_type_defining:1;
} fa250_trigger_time_1;
typedef union
{
uint32_t raw;
fa250_trigger_time_1 bf;
} fa250_trigger_time_1_t;
typedef struct
{
uint32_t T_C:8;
uint32_t T_B:8;
uint32_t T_A:8;
uint32_t undef:3;
uint32_t data_type_tag:4;
uint32_t data_type_defining:1;
} fa250_trigger_time_2;
typedef union
{
uint32_t raw;
fa250_trigger_time_2 bf;
} fa250_trigger_time_2_t;
/* 4: WINDOW RAW DATA */
typedef struct
{
uint32_t PTW:9;
uint32_t undef:14;
uint32_t channel_number:4;
uint32_t data_type_tag:4;
uint32_t data_type_defining:1;
} fa250_window_raw_data_1;
typedef union
{
uint32_t raw;
fa250_window_raw_data_1 bf;
} fa250_window_raw_data_1_t;
typedef struct
{
uint32_t adc_sample_2:13;
uint32_t invalid_2:1;
uint32_t undef2:2;
uint32_t adc_sample_1:13;
uint32_t invalid_1:1;
uint32_t undef1:1;
uint32_t data_type_defining:1;
} fa250_window_raw_data_n;
typedef union
{
uint32_t raw;
fa250_window_raw_data_n bf;
} fa250_window_raw_data_n_t;
/* 5: PEPPo Channel Sums */
typedef struct
{
uint32_t hi_sum:16;
uint32_t _blank0:7;
uint32_t channel_number:4;
uint32_t data_type_tag:4;
uint32_t data_type_defining:1;
} fa250_peppo_hi_sum;
typedef union
{
uint32_t raw;
fa250_peppo_hi_sum bf;
} fa250_peppo_hi_sum_t;
typedef struct
{
uint32_t lo_sum:24;
uint32_t _blank0:7;
uint32_t data_type_defining:1;
} fa250_peppo_lo_sum;
typedef union
{
uint32_t raw;
fa250_peppo_lo_sum bf;
} fa250_peppo_lo_sum_t;
/* 7: PULSE INTEGRAL */
typedef struct
{
uint32_t integral:19;
uint32_t quality_factor:2;
uint32_t pulse_number:2;
uint32_t channel_number:4;
uint32_t data_type_tag:4;
uint32_t data_type_defining:1;
} fa250_pulse_integral;
typedef union
{
uint32_t raw;
fa250_pulse_integral bf;
} fa250_pulse_integral_t;
/* 8: PULSE TIME */
typedef struct
{
uint32_t time:16;
uint32_t blank:3;
uint32_t quality_factor:2;
uint32_t pulse_number:2;
uint32_t channel_number:4;
uint32_t data_type_tag:4;
uint32_t data_type_defining:1;
} fa250_pulse_time;
typedef union
{
uint32_t raw;
fa250_pulse_time bf;
} fa250_pulse_time_t;
/* 9: PULSE PARAMETERS */
typedef struct
{
uint32_t pedestal_sum:14;
uint32_t pedestal_quality:1;
uint32_t channel_number:4;
uint32_t event_number_within_block:8;
uint32_t data_type_tag:4;
uint32_t data_type_defining:1;
} fa250_pulse_parameters_1;
typedef union
{
uint32_t raw;
fa250_pulse_parameters_1 bf;
} fa250_pulse_parameters_1_t;
typedef struct
{
uint32_t pulse_samples_over_threshold:9;
uint32_t underflow:1;
uint32_t overflow:1;
uint32_t NSA_beyond_PTW:1;
uint32_t sample_sum:18;
uint32_t parameter_type_tag:1;
uint32_t data_type_defining:1;
} fa250_pulse_parameters_2;
typedef union
{
uint32_t raw;
fa250_pulse_parameters_2 bf;
} fa250_pulse_parameters_2_t;
typedef struct
{
uint32_t samples_over_threshold:1;
uint32_t vpeak_not_found:1;
uint32_t vpeak_beyond:1;
uint32_t pulse_peak:12;
uint32_t fine_time:6;
uint32_t coarse_time:9;
uint32_t parameter_type_tag:1;
uint32_t data_type_defining:1;
} fa250_pulse_parameters_3;
typedef union
{
uint32_t raw;
fa250_pulse_parameters_3 bf;
} fa250_pulse_parameters_3_t;
/* 12: SCALER */
typedef struct
{
uint32_t number_scaler_words:6;
uint32_t undef:21;
uint32_t data_type_tag:4;
uint32_t data_type_defining:1;
} fa250_scaler_1;
typedef union
{
uint32_t raw;
fa250_scaler_1 bf;
} fa250_scaler_1_t;
typedef struct
{
uint32_t data:32;
} fa250_scaler_2;
typedef union
{
uint32_t raw;
fa250_scaler_2 bf;
} fa250_scaler_2_t;
void fa250DataDecode(uint32_t data);
#endif /* __FA250DEC__ */