JLab fADC250-V2 Library  0x42
fadcLib.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * fadcLib.h - Driver library header file for readout of the JLAB 250MHz FLASH
4 * ADC using a VxWorks 5.5 or later based single board
5 * computer.
6 *
7 * Author: David Abbott
8 * Jefferson Lab Data Acquisition Group
9 * June 2007
10 *
11 * Revision 1.0 - Initial Revision
12 * - Supports up to 20 FADC boards in a Crate
13 * - Programmed I/O and Block reads
14 *
15 * Revision 1.1 - Updated for new firmware (0x0111 or later)
16 * Supports FADC Signal Distribution Module
17 *
18 * Revision 1.2 - Updated to support Internal (HITSUM) triggering
19 * and Moller firmware revisions of the FADC
20 *
21 * Revision 2.0 - Updated to support FADC V2.
22 *
23 */
24 
25 #ifndef __FADCLIB__
26 #define __FADCLIB__
27 
28 #define FA_BOARD_ID 0xfadc0000
29 #define FA_MAX_BOARDS 20
30 #define FA_MAX_ADC_CHANNELS 16
31 #define FA_MAX_DATA_PER_CHANNEL 251
32 #define FA_MAX_A32_MEM 0x800000 /* 8 Meg */
33 #define FA_MAX_A32MB_SIZE 0x800000 /* 8 MB */
34 #define FA_VME_INT_LEVEL 3
35 #define FA_VME_INT_VEC 0xFA
36 
37 #define FA_SUPPORTED_CTRL_FIRMWARE 0x42,0x82
38 #define FA_SUPPORTED_CTRL_FIRMWARE_NUMBER 2
39 #define FA_SUPPORTED_PROC_FIRMWARE 0xC0D
40 #define FA_SUPPORTED_PROC_FIRMWARE_NUMBER 1
41 
43 {
44  /* 0x0000 */ volatile unsigned int level;
45  /* 0x0004 */ volatile unsigned int csr;
46  /* 0x0008 */ volatile unsigned int value;
47  /* 0x000C */ unsigned int spare;
48  /* 0x0010 */ volatile unsigned int berr_drive_count;
49  /* 0x0014 */ volatile unsigned int retry_drive_count;
50 };
51 
52 struct fadc_struct
53 {
54  /* 0x0000 */ volatile unsigned int version;
55  /* 0x0004 */ volatile unsigned int csr;
56  /* 0x0008 */ volatile unsigned int ctrl1;
57  /* 0x000C */ volatile unsigned int ctrl2;
58  /* 0x0010 */ volatile unsigned int blk_level;
59  /* 0x0014 */ volatile unsigned int intr;
60  /* 0x0018 */ volatile unsigned int adr32;
61  /* 0x001C */ volatile unsigned int adr_mb;
62  /* 0x0020 */ volatile unsigned int s_adr;
63  /* 0x0024 */ volatile unsigned int delay;
64  /* 0x0028 */ volatile unsigned int itrig_cfg;
65  /* 0x002C */ volatile unsigned int reset;
66  /* 0x0030 */ volatile unsigned int trig_scal;
67  /* 0x0034 */ volatile unsigned int ev_count;
68  /* 0x0038 */ volatile unsigned int blk_count;
69  /* 0x003C */ volatile unsigned int blk_fifo_count;
70  /* 0x0040 */ volatile unsigned int blk_wrdcnt_fifo;
71  /* 0x0044 */ volatile unsigned int internal_trig_scal;
72  /* 0x0048 */ volatile unsigned int ram_word_count;
73  /* 0x004C */ volatile unsigned int dataflow_status;
74  /* 0x0050 */ volatile unsigned short dac[16];
75  /* 0x0070 */ volatile unsigned int status[4];
76  /* 0x0080 */ volatile unsigned int aux;
77  /* 0x0084 */ volatile unsigned int trigger_control;
78  /* 0x0088 */ volatile unsigned int trig21_delay;
79  /* 0x008C */ volatile unsigned int mem_adr;
80  /* 0x0090 */ volatile unsigned int mem1_data;
81  /* 0x0094 */ volatile unsigned int mem2_data;
82  /* 0x0098 */ volatile unsigned int prom_reg1;
83  /* 0x009C */ volatile unsigned int prom_reg2;
84  /* 0x00A0 */ volatile unsigned int berr_module_scal;
85  /* 0x00A4 */ volatile unsigned int berr_crate_scal;
86  /* 0x00A8 */ volatile unsigned int proc_words_scal;
87  /* 0x00AC */ volatile unsigned int lost_trig_scal;
88  /* 0x00B0 */ volatile unsigned int header_scal;
89  /* 0x00B4 */ volatile unsigned int trig2_scal;
90  /* 0x00B8 */ volatile unsigned int trailer_scal;
91  /* 0x00BC */ volatile unsigned int syncreset_scal;
92  /* 0x00C0 */ volatile unsigned int busy_level;
93  /* 0x00C4 */ volatile unsigned int gen_evt_header;
94  /* 0x00C8 */ volatile unsigned int gen_evt_data;
95  /* 0x00CC */ volatile unsigned int gen_evt_trailer;
96  /* 0x00D0 */ volatile unsigned int mgt_status;
97  /* 0x00D4 */ volatile unsigned int mgt_ctrl;
98  /* 0x00D8 */ volatile unsigned int reserved_ctrl[2];
99  /* 0x00E0 */ volatile unsigned int scaler_ctrl;
100  /* 0x00E4 */ volatile unsigned int serial_number[3];
101  /* 0x00F0 */ volatile unsigned int scaler_interval;
102  /* 0x00F4 */ volatile unsigned int sum_threshold;
103  /* 0x00F8 */ volatile unsigned int sum_data;
104  /* 0x00FC */ volatile unsigned int system_monitor;
105 
106  /* 0x0100 */ volatile unsigned int adc_status[3];
107  /* 0x010C */ volatile unsigned int adc_config[4];
108  /* 0x011C */ volatile unsigned int adc_ptw;
109  /* 0x0120 */ volatile unsigned int adc_pl;
110  /* 0x0124 */ volatile unsigned int adc_nsb;
111  /* 0x0128 */ volatile unsigned int adc_nsa;
112  /* 0x012C */ volatile unsigned short adc_thres[16];
113  /* 0x014C */ volatile unsigned int config6;
114  /* 0x0150 */ volatile unsigned int config7;
115  /* 0x0154 */ volatile unsigned int adc_test_data;
116  /* 0x0158 */ volatile unsigned int adc_pedestal[16];
117  /* 0x0198 */ volatile unsigned int config3;
118  /* 0x019C */ volatile unsigned int status3;
119  /* 0x01A0 */ unsigned int spare_adc[(0x200-0x1A0)>>2];
120 
121  /* 0x0200 */ volatile unsigned int hitsum_status;
122  /* 0x0204 */ volatile unsigned int hitsum_cfg;
123  /* 0x0208 */ volatile unsigned int hitsum_hit_info;
124  /* 0x020C */ volatile unsigned int hitsum_reserved;
125  /* 0x0210 */ volatile unsigned int hitsum_trig_width;
126  /* 0x0214 */ volatile unsigned int hitsum_window_bits;
127  /* 0x0218 */ volatile unsigned int hitsum_window_width;
128  /* 0x021C */ volatile unsigned int hitsum_coin_bits;
129  /* 0x0220 */ volatile unsigned int hitsum_pattern;
130  /* 0x0224 */ volatile unsigned int hitsum_fifo;
131  /* 0x0228 */ volatile unsigned int hitsum_sum_thresh;
132  /* 0x022C */ unsigned int spare_hitsum[(0x0300-0x022C)>>2];
133 
134  /* 0x0300 */ volatile unsigned int scaler[16];
135  /* 0x0340 */ volatile unsigned int time_count;
136  /* 0x0344 */ unsigned int spare_scaler[(0x400-0x344)>>2];
137 
138  /* 0x0400 */ volatile unsigned int testBit;
139  /* 0x0404 */ volatile unsigned int clock250count;
140  /* 0x0408 */ volatile unsigned int syncp0count;
141  /* 0x040C */ volatile unsigned int trig1p0count;
142  /* 0x0410 */ volatile unsigned int trig2p0count;
143  /* 0x0414 */ unsigned int blank[(0x500-0x414)>>2];
144 
145  /* 0x0500 */ struct FA250_STATE_REGS state;
146 };
147 
148 struct
150 {
151  unsigned int new_type;
152  unsigned int type;
153  unsigned int slot_id_hd;
154  unsigned int slot_id_tr;
155  unsigned int slot_id_evh;
156  unsigned int n_evts;
157  unsigned int blk_num;
158  unsigned int modID;
159  unsigned int PL;
160  unsigned int NSB;
161  unsigned int NSA;
162  unsigned int n_words;
163  unsigned int evt_num_1;
164  unsigned int evt_num_2;
165  unsigned int evt_of_blk;
166  unsigned int time_now;
167  unsigned int time_low_10;
168  unsigned int time_1;
169  unsigned int time_2;
170  unsigned int time_3;
171  unsigned int time_4;
172  unsigned int chan;
173  unsigned int width;
174  unsigned int valid_1;
175  unsigned int adc_1;
176  unsigned int valid_2;
177  unsigned int adc_2;
178  unsigned int over;
179  unsigned int under;
180  unsigned int nsa_ext;
181  unsigned int samp_ov_thres;
182  unsigned int adc_sum;
183  unsigned int ped_sum;
184  unsigned int pulse_num;
185  unsigned int thres_bin;
186  unsigned int quality;
187  unsigned int quality2;
188  unsigned int integral;
189  unsigned int time;
190  unsigned int chan_a;
191  unsigned int source_a;
192  unsigned int chan_b;
193  unsigned int source_b;
194  unsigned int group;
195  unsigned int time_coarse;
196  unsigned int time_fine;
197  unsigned int vmin;
198  unsigned int vpeak;
199  unsigned int trig_type_int; /* next 4 for internal trigger data */
200  unsigned int trig_state_int; /* e.g. helicity */
201  unsigned int evt_num_int;
202  unsigned int err_status_int;
203  unsigned int scaler_data_words;
204 };
205 
206 
207 struct
209 {
210  volatile unsigned short csr;
211  volatile unsigned short ctrl;
212  volatile unsigned short busy_enable;
213  volatile unsigned short busy_status;
214 };
215 
216 
217 /* FADC Special Board IDs */
218 
219 /* Define CSR Bits */
220 #define FA_CSR_EVENT_AVAILABLE 0x1
221 #define FA_CSR_BLOCK_LEVEL_FLAG 0x2
222 #define FA_CSR_BLOCK_READY 0x4
223 #define FA_CSR_BERR_STATUS 0x8
224 #define FA_CSR_TOKEN_STATUS 0x10
225 #define FA_CSR_FIFO1_EMPTY 0x800
226 #define FA_CSR_FIFO1_ALMOST_EMPTY 0x1000
227 #define FA_CSR_FIFO1_HALF_FULL 0x2000
228 #define FA_CSR_FIFO1_ALMOST_FULL 0x4000
229 #define FA_CSR_FIFO1_FULL 0x8000
230 #define FA_CSR_PROC_FPGA_HIGH_TEMP 0x10000
231 #define FA_CSR_CTRL_FPGA_HIGH_TEMP 0x20000
232 #define FA_CSR_SOFT_PULSE_TRIG2 0x100000
233 #define FA_CSR_SOFT_CLEAR 0x200000
234 #define FA_CSR_DATA_STREAM_SCALERS 0x400000
235 #define FA_CSR_FORCE_EOB_INSERT 0x800000
236 #define FA_CSR_FORCE_EOB_SUCCESS 0x1000000
237 #define FA_CSR_FORCE_EOB_FAILED 0x2000000
238 #define FA_CSR_ERROR_MASK 0x0e030000
239 #define FA_CSR_ERROR_CLEAR 0x08000000
240 #define FA_CSR_SYNC 0x10000000
241 #define FA_CSR_TRIGGER 0x20000000
242 #define FA_CSR_SOFT_RESET 0x40000000
243 #define FA_CSR_HARD_RESET 0x80000000
244 
245 /* Define Init Flag bits for Clock Source */
246 #define FA_SOURCE_INT 0x00
247 #define FA_SOURCE_SDC 0x10
248 #define FA_SOURCE_VXS 0x20
249 #define FA_SOURCE_MASK 0x30
250 
251 /* Define Control2 Bits */
252 #define FA_CTRL_GO 0x1
253 #define FA_CTRL_ENABLE_TRIG 0x2
254 #define FA_CTRL_ENABLE_SRESET 0x4
255 #define FA_CTRL_ENABLE_INT_TRIG 0x8
256 #define FA_CTRL_ENABLE_MASK 0x7
257 #define FA_CTRL_ENABLED 0x7
258 
259 /* Define CTRL1 Bits */
260 #define FA_REF_CLK_INTERNAL 0x0
261 #define FA_REF_CLK_FP 0x1
262 #define FA_REF_CLK_P0 0x2
263 #define FA_REF_CLK_MASK 0x3
264 #define FA_ENABLE_INTERNAL_CLK 0x8
265 #define FA_CTRL1_SUPPRESS_TT (1<<16)
266 #define FA_CTRL1_SUPPRESS_TT2 (1<<17)
267 #define FA_CTRL1_DATAFORMAT_MASK 0x0C000000
268 #define FA_CTRL1_DATAFORMAT_STD 0
269 #define FA_CTRL1_DATAFORMAT_INTERM_SUPPRESS 1
270 #define FA_CTRL1_DATAFORMAT_FULL_SUPPRESS 2
271 
272 #define FA_TRIG_FP 0x00
273 #define FA_TRIG_FP_ISYNC 0x10
274 #define FA_TRIG_P0 0x20
275 #define FA_TRIG_P0_ISYNC 0x30
276 #define FA_TRIG_VME_PLAYBACK 0x50
277 #define FA_TRIG_VME 0x60
278 #define FA_TRIG_INTERNAL 0x70
279 #define FA_TRIG_MASK 0x70
280 #define FA_ENABLE_SOFT_TRIG 0x80
281 
282 #define FA_SRESET_FP 0x000
283 #define FA_SRESET_FP_ISYNC 0x100
284 #define FA_SRESET_P0 0x200
285 #define FA_SRESET_P0_ISYNC 0x300
286 #define FA_SRESET_VME 0x600
287 #define FA_SRESET_NONE 0x700
288 #define FA_SRESET_MASK 0x700
289 #define FA_ENABLE_SOFT_SRESET 0x800
290 
291 #define FA_ENABLE_LIVE_TRIG_OUT 0x1000
292 #define FA_ENABLE_TRIG_OUT_FP 0x2000
293 #define FA_ENABLE_TRIG_OUT_P0 0x4000
294 #define FA_TRIGOUT_MASK 0x7000
295 
296 #define FA_ENABLE_BLKLVL_INT 0x40000
297 #define FA_ENABLE_BERR 0x100000
298 #define FA_ENABLE_MULTIBLOCK 0x200000
299 #define FA_FIRST_BOARD 0x400000
300 #define FA_LAST_BOARD 0x800000
301 #define FA_ENABLE_DEBUG 0x2000000
302 #define FA_MB_TOKEN_VIA_P0 0x10000000
303 #define FA_MB_TOKEN_VIA_P2 0x20000000
304 
305 #define FA_ENABLE_ADC_PARAMETERS_DATA 0x8000
306 #define FA_SUPPRESS_TRIGGER_TIME_DATA 0x10000
307 #define FA_SUPPRESS_TRIGGER_TIME_WORD2_DATA 0x20000
308 
309 /* Define Control 2 Bits */
310 #define FA_GO 0x1
311 #define FA_ENABLE_EXT_TRIGGER 0x2
312 #define FA_ENABLE_EXT_SRESET 0x4
313 #define FA_ENABLE_INT_TRIGGER 0x8
314 #define FA_ENABLE_STREAM_MODE 0x10
315 
316 #define FA_DEBUG_XFER_INFIFO_BFIFO 0x1000
317 #define FA_DEBUG_XFER_BFIFO_OFIFO 0x2000
318 
319 /* Define Reset Bits */
320 #define FA_RESET_CNTL_FPGA 0x1
321 #define FA_RESET_ADC_FPGA1 0x2
322 #define FA_RESET_ADC_FIFO1 0x100
323 #define FA_RESET_DAC 0x800
324 #define FA_RESET_EXT_RAM_PT 0x1000
325 #define FA_RESET_TOKEN 0x10000
326 #define FA_RESET_ALL 0xFFFF
327 
328 /* Define trig_scal bits */
329 #define FA_TRIG_SCAL_RESET (1<<31)
330 
331 /* Define trigger_control bits */
332 #define FA_TRIGCTL_TRIGSTOP_EN (1<<31)
333 #define FA_TRIGCTL_MAX2_MASK 0x00FF0000
334 #define FA_TRIGCTL_BUSY_EN (1<<15)
335 #define FA_TRIGCTL_MAX1_MASK 0x000000FF
336 
337 /* Define trig21 delay bits */
338 #define FA_TRIG21_DELAY_MASK 0x00000FFF
339 
340 /* Define MGT Control bits */
341 #define FA_RELEASE_MGT_RESET 0x0
342 #define FA_MGT_RESET 0x1
343 #define FA_MGT_FRONT_END_TO_CTP 0x2
344 #define FA_MGT_ENABLE_DATA_ALIGNMENT 0x4
345 #define FA_MGT_HITBITS_TO_CTP 0x8
346 
347 #define FA_INT_ACTIVE 0x1000000
348 #define FA_INT_IACKSTAT_WAIT 0x2000000
349 #define FA_INT_IACKSTAT_ONBT 0x4000000
350 
351 
352 /* Define RAM Bits */
353 #define FA_RAM_DATA_MASK 0x000fffff
354 #define FA_RAM_FULL 0x00100000
355 #define FA_RAM_EMPTY 0x00200000
356 #define FA_RAM_ADR_INCREMENT 0x00100000
357 
358 /* Define Bit Masks */
359 #define FA_VERSION_MASK 0x000000ff
360 #define FA_BOARD_MASK 0xffff0000
361 #define FA_CSR_MASK 0x0fffffff
362 #define FA_CONTROL_MASK 0xffffffff
363 #define FA_CONTROL2_MASK 0xc000303f
364 #define FA_EVENT_COUNT_MASK 0xffffff
365 #define FA_BLOCK_COUNT_MASK 0xfffff
366 #define FA_BLOCK_LEVEL_MASK 0xffff
367 #define FA_INT_ENABLE_MASK 0xc0000
368 #define FA_INT_VEC_MASK 0xff
369 #define FA_INT_LEVEL_MASK 0x700
370 #define FA_SLOT_ID_MASK 0x1f0000
371 #define FA_DAC_VALUE_MASK 0x0fff
372 #define FA_DAC_WRITE_TIMEOUT_ERROR (1<<15)
373 
374 #define FA_REF_CLK_SEL_MASK 0x7
375 #define FA_TRIG_SEL_MASK 0x70
376 #define FA_SRESET_SEL_MASK 0x700
377 
378 #define FA_BUSY_LEVEL_MASK 0xfffff
379 #define FA_FORCE_BUSY 0x80000000
380 
381 #define FA_A32_ENABLE 0x1
382 #define FA_AMB_ENABLE 0x1
383 #define FA_A32_ADDR_MASK 0xff80 /* 8 MB chunks */
384 #define FA_AMB_MIN_MASK 0xff80
385 #define FA_AMB_MAX_MASK 0xff800000
386 
387 #define FA_SADR_AUTO_INCREMENT 0x10000
388 #define FA_PPG_WRITE_VALUE 0x8000
389 #define FA_PPG_SAMPLE_MASK 0x1fff
390 #define FA_PPG_MAX_SAMPLES 512
391 #define FA_PPG_ENABLE 0x80
392 
393 /* Define system_monitor Bits/Masks */
394 #define FA_SYSMON_CTRL_TEMP_MASK 0x3FF
395 #define FA_SYSMON_FPGA_CORE_V_MASK 0x001FF800
396 #define FA_SYSMON_FPGA_AUX_V_MASK 0xFFC00000
397 
398 /* Define MGT Status Bits/Masks */
399 #define FA_MGT_GTX1_LANE1_UP 0x1
400 #define FA_MGT_GTX1_LANE2_UP 0x2
401 #define FA_MGT_GTX1_CHANNEL_UP 0x4
402 #define FA_MGT_GTX1_HARD_ERROR 0x8
403 #define FA_MGT_GTX1_SOFT_ERROR 0x10
404 #define FA_MGT_GTX2_LANE1_UP 0x20
405 #define FA_MGT_GTX2_LANE2_UP 0x40
406 #define FA_MGT_GTX2_CHANNEL_UP 0x80
407 #define FA_MGT_GTX2_HARD_ERROR 0x100
408 #define FA_MGT_GTX2_SOFT_ERROR 0x200
409 #define FA_MGT_SUM_DATA_VALID 0x400
410 #define FA_MGT_RESET_ASSERTED 0x800
411 
412 #define FA_STATUS3_PROC_TEMP_MASK 0xFFFF
413 
414 /* Define default ADC Processing parameters
415  values are in clock cycles 4ns/cycle */
416 
417 #define FA_ADC_NS_PER_CLK 4
418 
419 #define FA_MAX_PROC_MODE 10
420 #define FA_ADC_PROC_MASK (1<<8)
421 #define FA_ADC_PROC_ENABLE 0x8
422 #define FA_ADC_PROC_MODE_RAW_WINDOW 1
423 #define FA_ADC_PROC_MODE_PULSE_RAW 2
424 #define FA_ADC_PROC_MODE_PULSE_INTEGRAL 3
425 #define FA_ADC_PROC_MODE_HIGH_REZ_TIME 4
426 #define FA_ADC_PROC_MODE_HIGH_REZ_TIME_INTEGRAL 7
427 #define FA_ADC_PROC_MODE_DEBUG_HI_REZ_TIME 8
428 #define FA_ADC_PROC_MODE_PULSE_PARAM 9
429 #define FA_ADC_PROC_MODE_RAW_PULSE_PARAM 10
430 #define FA_SUPPORTED_MODES 9,10
431 #define FA_SUPPORTED_NMODES 2
432 
433 extern const char *fa_mode_names[FA_MAX_PROC_MODE+1];
434 
435 #define FA_ADC_CONFIG0_CHAN_MASK 0x0F00
436 #define FA_ADC_CONFIG0_CHAN_READ_ENABLE (1<<12)
437 
438 #define FA_ADC_STATUS1_TRIG_RCV_DONE (1<<15)
439 #define FA_ADC_STATUS1_TRIGNUM_MASK 0x0FFF
440 
441 #define FA_ADC_STATUS2_CHAN_DATA_MASK 0x0FFF
442 
443 #define FA_ADC_CONFIG1_NSAT_MASK 0x0C00
444 #define FA_ADC_CONFIG1_TNSAT_MASK 0x3000
445 
446 #define FA_ADC_CONFIG3_TPT_MASK 0x0FFF
447 
448 #define FA_ADC_CONFIG6_MNPED_MASK 0x00003C00
449 #define FA_ADC_CONFIG6_PMAXPED_MASK 0x000003FF
450 
451 #define FA_ADC_CONFIG7_NPED_MASK 0x00003C00
452 #define FA_ADC_CONFIG7_MAXPED_MASK 0x000003FF
453 
454 #define FA_ADC_VERSION_MASK 0x7fff
455 #define FA_ADC_PLAYBACK_MODE 0x0080
456 
457 #define FA_ADC_PEAK_MASK 0x0070
458 #define FA_ADC_CHAN_MASK 0xffff
459 
460 #define FA_ADC_DEFAULT_PL 50
461 #define FA_ADC_DEFAULT_PTW 50
462 #define FA_ADC_DEFAULT_NSB 5
463 #define FA_ADC_DEFAULT_NSA 10
464 #define FA_ADC_DEFAULT_NP 1
465 #define FA_ADC_DEFAULT_THRESH 0
466 #define FA_ADC_DEFAULT_NPED 4
467 #define FA_ADC_DEFAULT_MAXPED 1
468 #define FA_ADC_DEFAULT_NSAT 1
469 #define FA_ADC_DEFAULT_MNPED 4
470 #define FA_ADC_DEFAULT_TNSA 10
471 #define FA_ADC_DEFAULT_TNSAT 1
472 #define FA_ADC_DEFAULT_TPT 0
473 
474 #define FA_ADC_MAX_PL 1024
475 #define FA_ADC_MAX_PTW 512
476 #define FA_ADC_MAX_NSB 7
477 #define FA_ADC_MAX_NSA 511
478 #define FA_ADC_MAX_NP 4
479 #define FA_ADC_MAX_THRESH 0xfff
480 #define FA_ADC_MAX_NPED 15
481 #define FA_ADC_MAX_MAXPED 1023
482 #define FA_ADC_MAX_NSAT 4
483 #define FA_ADC_MAX_MNPED 15
484 #define FA_ADC_MAX_TNSA 63
485 #define FA_ADC_MAX_TNSAT 4
486 #define FA_ADC_MAX_TPT 4095
487 
488 #define FA_ADC_MIN_PL 0
489 #define FA_ADC_MIN_PTW 6
490 #define FA_ADC_MIN_NSB -3
491 #define FA_ADC_MIN_NSA 2
492 #define FA_ADC_MIN_NP 1
493 #define FA_ADC_MIN_THRESH 0
494 #define FA_ADC_MIN_NPED 4
495 #define FA_ADC_MIN_MAXPED 0
496 #define FA_ADC_MIN_NSAT 1
497 #define FA_ADC_MIN_MNPED 4
498 #define FA_ADC_MIN_TNSA 2
499 #define FA_ADC_MIN_TNSAT 2
500 #define FA_ADC_MIN_TPT 0
501 
502 #define FA_ADC_NSB_READBACK_MASK 0x0000000F
503 #define FA_ADC_NSB_NEGATIVE (1<<3)
504 
505 #define FA_ADC_NSA_READBACK_MASK 0x000001FF
506 #define FA_ADC_TNSA_MASK 0x00007E00
507 
508 #define FA_ADC_TPT_MASK 0xFFF
509 
510 #define FA_ADC_PEDESTAL_MASK 0xffff
511 
512 /* Define parameters for HITSUM (Trigger) FPGA */
513 #define FA_ITRIG_VERSION_MASK 0x1fff
514 #define FA_ITRIG_CONFIG_MASK 0x001F
515 #define FA_ITRIG_ENABLE_MASK 0x0010
516 #define FA_ITRIG_P2OUT_MASK 0x0008
517 #define FA_ITRIG_MODE_MASK 0x0007
518 
519 #define FA_ITRIG_TABLE_MODE 0
520 #define FA_ITRIG_COIN_MODE 1
521 #define FA_ITRIG_WINDOW_MODE 2
522 #define FA_ITRIG_UNDEF_MODE 3
523 #define FA_ITRIG_SUM_MODE 4
524 
525 /* #define FA_ITRIG_TABLE_MODE 1 */
526 /* #define FA_ITRIG_WINDOW_MODE 2 */
527 /* #define FA_ITRIG_COIN_MODE 3 */
528 /* #define FA_ITRIG_SUM_MODE 4 */
529 
530 #define FA_ITRIG_DISABLED 0x0010
531 #define FA_ITRIG_HB_P2OUT 0x0008
532 #define FA_ITRIG_OUT_MASK 0x0000f000 /* Bits from ctrl1 register */
533 #define FA_ITRIG_OUT_FP 0x00003000
534 
535 #define FA_ITRIG_MIN_WIDTH 0x01 /* 4 nsec */
536 #define FA_ITRIG_MAX_WIDTH 0x100 /* 1.024 microsec */
537 #define FA_ITRIG_MAX_DELAY 0xf00 /* 15.360 microsec */
538 
539 #define FA_ITRIG_WINDOW_MAX_WIDTH 0x200 /* 2.048 microsec */
540 
541 #define FA_ITRIG_MAX_HB_WIDTH 0xff /* 1020 ns */
542 #define FA_ITRIG_MAX_HB_DELAY 0xf /* 60 ns */
543 
544 #define FA_ITRIG_HB_INFO_MASK 0xffff
545 #define FA_ITRIG_HB_WIDTH_MASK 0x00ff
546 #define FA_ITRIG_HB_DELAY_MASK 0x1f00
547 
548 /* Define State registers bits and masks */
549 #define FA_STATE_LEVEL_CAPTURE_MASK 0x000000FF
550 
551 #define FA_STATE_CSR_ARM_BUFFER (1<<31)
552 #define FA_STATE_CSR_BUFFER_FULL (1<<27)
553 #define FA_STATE_CSR_BUFFER_EMPTY (1<<26)
554 #define FA_STATE_CSR_BUFFER_WORDS_MASK 0x000000FF
555 
556 #define FA_STATE_VALUE_MASK 0x0000FFFF
557 
558 /* Define ADC Data Types and Masks */
559 
560 #define FA_DATA_TYPE_DEFINE 0x80000000
561 #define FA_DATA_TYPE_MASK 0x78000000
562 #define FA_DATA_SLOT_MASK 0x07c00000
563 
564 #define FA_DATA_BLOCK_HEADER 0x00000000
565 #define FA_DATA_BLOCK_TRAILER 0x08000000
566 #define FA_DATA_EVENT_HEADER 0x10000000
567 #define FA_DATA_TRIGGER_TIME 0x18000000
568 #define FA_DATA_WINDOW_RAW 0x20000000
569 #define FA_DATA_WINDOW_SUM 0x28000000
570 #define FA_DATA_PULSE_RAW 0x30000000
571 #define FA_DATA_PULSE_INTEGRAL 0x38000000
572 #define FA_DATA_PULSE_TIME 0x40000000
573 #define FA_DATA_STREAM 0x48000000
574 #define FA_DATA_INVALID 0x70000000
575 #define FA_DATA_FILLER 0x78000000
576 #define FA_DUMMY_DATA 0xf800fafa
577 
578 #define FA_DATA_BLKNUM_MASK 0x0000003f
579 #define FA_DATA_WRDCNT_MASK 0x003fffff
580 #define FA_DATA_TRIGNUM_MASK 0x07ffffff
581 
582 /* Define Firmware registers Data types and Masks */
583 #define FA_PROMREG1_SRAM_TO_PROM1 0x0
584 #define FA_PROMREG1_SRAM_TO_PROM2 0x1
585 #define FA_PROMREG1_PROM1_TO_SRAM 0x3
586 #define FA_PROMREG1_PROM2_TO_SRAM 0x4
587 #define FA_PROMREG1_GET_ID1 0x6
588 #define FA_PROMREG1_GET_ID2 0x7
589 #define FA_PROMREG1_ERASE_PROM1 0x9
590 #define FA_PROMREG1_ERASE_PROM2 0xA
591 #define FA_PROMREG1_REBOOT_FPGA1 0xC
592 #define FA_PROMREG1_REBOOT_FPGA2 0xD
593 #define FA_PROMREG1_READY (1<<31)
594 
595 #define FA_MEM_ADR_INCR_MEM1 (1<<31)
596 #define FA_MEM_ADR_INCR_MEM2 (1<<30)
597 
598 /* Define Scaler Control bits */
599 #define FA_SCALER_CTRL_ENABLE (1<<0)
600 #define FA_SCALER_CTRL_LATCH (1<<1)
601 #define FA_SCALER_CTRL_RESET (1<<2)
602 #define FA_SCALER_CTRL_MASK (0x7)
603 
604 /* Define Scaler Interval Mask */
605 #define FA_SCALER_INTERVAL_MASK 0x0000FFFF
606 
607 /* Define Sum Threshold bits and masks */
608 #define FA_SUM_THRESHOLD_DREADY (1<<31)
609 #define FA_SUM_THRESHOLD_MASK 0x0000FFFF
610 
611 /* Define Sum Data bits and masks */
612 #define FA_SUM_DATA_ARM_HISTORY_BUFFER (1<<31)
613 #define FA_SUM_DATA_SAMPLE_MASK 0x0000FFFF
614 
615 /* Define Serial Number bits and masks */
616 #define FA_SERIAL_NUMBER_ACDI 0x41434449
617 #define FA_SERIAL_NUMBER_ADV_ASSEM_MASK 0xFF000000
618 #define FA_SERIAL_NUMBER_ADV_ASSEM 0x42000000
619 #define FA_SERIAL_NUMBER_ACDI_BOARDID_MASK 0x0000FFFF
620 #define FA_SERIAL_NUMBER_ADV_MNFID1 0x42323135
621 #define FA_SERIAL_NUMBER_ADV_MNFID2_MASK 0xFFFF0000
622 #define FA_SERIAL_NUMBER_ADV_MNFID2 0x39350000
623 #define FA_SERIAL_NUMBER_ADV_BOARDID2_MASK 0x000000FF
624 
625 
626 /* Define FADC Signal Distribution card bits */
627 
628 #define FA_SDC_BOARD_ID 0x0200
629 #define FA_SDC_BOARD_MASK 0xfffe
630 #define FA_SDC_ADR_MASK 0xffc0
631 
632 #define FASDC_BUSY_MASK 0x00ff
633 
634 #define FASDC_CSR_BUSY 0x1
635 #define FASDC_CSR_TRIG 0x20
636 #define FASDC_CSR_SRESET 0x40
637 #define FASDC_CSR_INIT 0x80
638 #define FASDC_CSR_MASK 0x00e1
639 
640 #define FASDC_CTRL_CLK_EXT 0x1
641 #define FASDC_CTRL_NOSYNC_TRIG 0x10
642 #define FASDC_CTRL_ENABLE_SOFT_TRIG 0x20
643 #define FASDC_CTRL_NOSYNC_SRESET 0x100
644 #define FASDC_CTRL_ENABLE_SOFT_SRESET 0x200
645 #define FASDC_CTRL_ASSERT_SOFT_BUSY 0x8000
646 #define FASDC_CTRL_MASK 0x8331
647 
648 /* Definitions for FADC Firmware Tools */
649 #define FADC_FIRMWARE_LX110 0
650 #define FADC_FIRMWARE_FX70T 1
651 
652 #define FA_CTRL1_SYSTEM_TEST_MODE (1<<31)
653 
654 #define FA_TESTBIT_TRIGOUT (1<<0)
655 #define FA_TESTBIT_BUSYOUT (1<<1)
656 #define FA_TESTBIT_SDLINKOUT (1<<2)
657 #define FA_TESTBIT_TOKENOUT (1<<3)
658 #define FA_TESTBIT_STATBITB (1<<8)
659 #define FA_TESTBIT_TOKENIN (1<<9)
660 #define FA_TESTBIT_CLOCK250_STATUS (1<<15)
661 
662 #define FA_CLOCK250COUNT_RESET (0<<0)
663 #define FA_CLOCK250COUNT_START (1<<0)
664 #define FA_SYNCP0COUNT_RESET (0<<0)
665 #define FA_TRIG1P0COUNT_RESET (0<<0)
666 #define FA_TRIG2P0COUNT_RESET (0<<0)
667 
668 /* faInit initialization flag bits */
669 #define FA_INIT_SOFT_SYNCRESET (0<<0)
670 #define FA_INIT_EXT_SYNCRESET (1<<0)
671 #define FA_INIT_SOFT_TRIG (0<<1)
672 #define FA_INIT_FP_TRIG (1<<1)
673 #define FA_INIT_VXS_TRIG (2<<1)
674 #define FA_INIT_INT_TRIG (4<<1)
675 #define FA_INIT_INT_CLKSRC (0<<4)
676 #define FA_INIT_FP_CLKSRC (1<<4)
677 #define FA_INIT_VXS_CLKSRC (2<<4)
678 #define FA_INIT_P2_CLKSRC ((1<<4) | (2<<4))
679 #define FA_INIT_SKIP (1<<16)
680 #define FA_INIT_USE_ADDRLIST (1<<17)
681 #define FA_INIT_SKIP_FIRMWARE_CHECK (1<<18)
682 
683 /* fadcBlockError values */
684 #define FA_BLOCKERROR_NO_ERROR 0
685 #define FA_BLOCKERROR_TERM_ON_WORDCOUNT 1
686 #define FA_BLOCKERROR_UNKNOWN_BUS_ERROR 2
687 #define FA_BLOCKERROR_ZERO_WORD_COUNT 3
688 #define FA_BLOCKERROR_DMADONE_ERROR 4
689 #define FA_BLOCKERROR_NTYPES 5
690 
691 /* Function Prototypes */
692 STATUS faInit (UINT32 addr, UINT32 addr_inc, int nadc, int iFlag);
693 int faCheckAddresses(int id);
694 int faSlot(unsigned int i);
695 int faSetClockSource(int id, int clkSrc);
696 int faGSetClockSource(int clkSrc);
697 void faStatus(int id, int sflag);
698 void faGStatus(int sflag);
699 unsigned int faGetFirmwareVersions(int id, int pflag);
700 
701 int faSetProcMode(int id, int pmode, unsigned int PL, unsigned int PTW,
702  int NSB, unsigned int NSA, unsigned int NP,
703  unsigned int NPED, unsigned int MAXPED, unsigned int NSAT);
704 void faGSetProcMode(int pmode, unsigned int PL, unsigned int PTW,
705  int NSB, unsigned int NSA, unsigned int NP,
706  unsigned int NPED, unsigned int MAXPED, unsigned int NSAT);
707 int faCalcMaxUnAckTriggers(int mode, int ptw, int nsa, int nsb, int np);
708 int faSetTriggerStopCondition(int id, int trigger_max);
709 int faSetTriggerBusyCondition(int id, int trigger_max);
710 int faSetTriggerPathSamples(int id, unsigned int TNSA, unsigned int TNSAT);
711 void faGSetTriggerPathSamples(unsigned int TNSA, unsigned int TNSAT);
712 int faSetTriggerPathThreshold(int id, unsigned int TPT);
713 void faGSetTriggerPathThreshold(unsigned int TPT);
714 void faSetNormalMode(int id, int opt);
715 void faSetInvertedMode(int id);
716 int faSetPPG(int id, int pmode, unsigned short *sdata, int nsamples);
717 void faPPGEnable(int id);
718 void faPPGDisable(int id);
719 int faReadBlock(int id, volatile UINT32 *data, int nwrds, int rflag);
720 int faSuppressTriggerTime(int id, int suppress);
721 int faGSuppressTriggerTime(int suppress);
722 int faGetBlockError(int pflag);
723 int faPrintBlock(int id, int rflag);
724 void faClear(int id);
725 void faClearError(int id);
726 unsigned int faReadCSR(int id);
727 void faReset(int id, int iFlag);
728 void faGReset(int iFlag);
729 void faSoftReset(int id, int cflag);
730 void faDACReset(int id);
731 void faGDACReset();
732 void faResetToken(int id);
733 int faTokenStatus(int id);
734 int faGTokenStatus();
735 unsigned int faGetTokenStatus(int pflag);
736 void faSetCalib(int id, unsigned short sdelay, unsigned short tdelay);
737 int faSetChannelDisable(int id, int channel);
738 void faChanDisable(int id, unsigned short cmask);
739 int faSetChannelDisableMask(int id, unsigned short cmask);
740 int faSetChannelEnable(int id, int channel);
741 int faSetChannelEnableMask(int id, unsigned short enMask);
742 int faGetChannelMask(int id, int type);
743 void faEnableSyncSrc(int id);
744 void faGEnableSyncSrc();
745 void faEnable(int id, int eflag, int bank);
746 void faGEnable(int eflag, int bank);
747 void faDisable(int id, int eflag);
748 void faGDisable(int eflag);
749 void faTrig(int id);
750 void faGTrig();
751 void faTrig2(int id);
752 void faGTrig2();
753 int faSetTrig21Delay(int id, int delay);
754 int faGetTrig21Delay(int id);
756 void faSync(int id);
757 int faDready(int id,int dflag);
758 int faBready(int id);
759 unsigned int faGBready();
760 unsigned int faGBlockReady(unsigned int slotmask, int nloop);
761 unsigned int faScanMask();
762 int faBusyLevel(int id, unsigned int val, int bflag);
763 int faBusy(int id);
764 void faEnableSoftTrig(int id);
765 void faDisableSoftTrig(int id);
766 void faEnableSoftSync(int id);
767 void faDisableSoftSync(int id);
768 void faEnableClk(int id);
769 void faDisableClk(int id);
770 void faEnableTriggerOut(int id, int output);
771 void faEnableBusError(int id);
772 void faDisableBusError(int id);
773 void faEnableMultiBlock(int tflag);
774 void faDisableMultiBlock();
775 int faSetBlockLevel(int id, int level);
776 int faSetClkSource(int id, int source);
777 int faSetTrigSource(int id, int source);
778 int faSetSyncSource(int id, int source);
779 void faEnableFP(int id);
780 int faSetTrigOut(int id, int trigout);
781 int faResetTriggerCount(int id);
782 int faCheckThreshold(int id);
783 int faSetThreshold(int id, unsigned short tvalue, unsigned short chmask);
784 int faPrintThreshold(int id);
785 
786 int faProcPedConfig(int id, int nsamples, int maxvalue);
787 int faGProcPedConfig(int nsamples, int maxvalue);
788 int faSampleConfig(int id, int nsamples, int maxvalue);
789 int faGSampleConfig(int nsamples, int maxvalue);
790 int faReadAllChannelSamples(int id, volatile unsigned int *data);
791 int faSetDAC(int id, unsigned short dvalue, unsigned short chmask);
792 int faSetDACandCheck(int id, unsigned short dvalue, unsigned short chmask);
793 void faPrintDAC(int id);
794 int faGetDAC(int id, unsigned short *indata);
795 int faGetChannelDAC(int id, int channel);
796 int faSetChannelPedestal(int id, unsigned int chan, unsigned int ped);
797 int faGetChannelPedestal(int id, unsigned int chan);
798 void faDataDecode(unsigned int data);
799 
800 int faSetMGTTestMode(int id, unsigned int mode);
801 
802 int faSetHitbitsMode(int id, int enable);
803 void faGSetHitbitsMode(int enable);
804 int faGetHitbitsMode(int id);
805 
806 /* FADC scaler routine prototypes */
807 int faReadScalers(int id, volatile unsigned int *data, unsigned int chmask, int rflag);
808 int faPrintScalers(int id, int rflag);
809 int faClearScalers(int id);
810 int faLatchScalers(int id);
811 int faEnableScalers(int id);
812 int faDisableScalers(int id);
813 
814 unsigned int faGetA32(int id);
815 unsigned int faGetA32M();
816 unsigned int faGetMinA32MB(int id);
817 unsigned int faGetMaxA32MB(int id);
818 
819 /* Data format routines */
820 int faDataInsertAdcParameters(int id, int enable);
821 void faGDataInsertAdcParameters(int enable);
822 int faDataSuppressTriggerTime(int id, int suppress);
823 void faGDataSuppressTriggerTime(int suppress);
824 int faSetDataFormat(int id, int format);
825 void faGSetDataFormat(int format);
826 
827 /* Temperature and Voltage monitoring prototypes */
828 unsigned int faGetCtrlFPGAData(int id);
829 unsigned int faGetProcFPGAData(int id);
830 float faGetCtrlFPGATemp(int id, int pflag);
831 float faGetCtrlFPGAVoltage(int id, int vtype, int pflag);
832 float faGetProcFPGATemp(int id, int pflag);
833 
834 
835 /* FADC Firmware Tools Prototypes */
836 int fadcFirmwareLoad(int id, int chip, int pFlag);
837 int fadcFirmwareGLoad(int chip, int pFlag);
838 void fadcFirmwareDownloadConfigData(int id);
839 int fadcFirmwareVerifyDownload (int id);
840 int fadcFirmwareTestReady(int id, int n_try, int pFlag);
841 int fadcFirmwareZeroSRAM (int id);
842 int fadcFirmwareCheckSRAM (int id);
843 void fadcFirmwareSetFilename(char *filename, int chip);
844 int fadcFirmwareReadFile(char *filename);
845 int fadcFirmwareGetFpgaID(int pflag);
846 int fadcFirmwareChipFromFpgaID(int pflag);
847 int fadcFirmwareRevFromFpgaID(int pflag);
848 int fadcFirmwareReadMcsFile(char *filename);
850  {
856  };
857 
859 {
860  int step; /* 0: show id, 1: show progress, 2: show complete */
861  int id; /* slot id */
862  char title[80];
864 int fadcFirmwareAttachUpdateWatcher(VOIDFUNCPTR routine, faUpdateWatcherArgs_t arg);
866 
867 void faTestSetSystemTestMode(int id, int mode);
868 void faTestSetTrigOut(int id, int mode);
869 void faTestSetBusyOut(int id, int mode);
870 void faTestSetSdLink(int id, int mode);
871 void faTestSetTokenOut(int id, int mode);
872 int faTestGetStatBitB(int id);
873 int faTestGetTokenIn(int id);
875 unsigned int faTestGetClock250Counter(int id);
876 unsigned int faTestGetSyncCounter(int id);
877 unsigned int faTestGetTrig1Counter(int id);
878 unsigned int faTestGetTrig2Counter(int id);
879 void faTestResetClock250Counter(int id);
880 void faTestResetSyncCounter(int id);
881 void faTestResetTrig1Counter(int id);
882 void faTestResetTrig2Counter(int id);
883 unsigned int faTestGetTestBitReg(int id);
884 int faGetSerialNumber(int id, char **rval, int snfix);
885 int faSetScalerBlockInterval(int id, unsigned int nblock);
886 int faGetScalerBlockInterval(int id);
887 int faForceEndOfBlock(int id, int scalers);
888 void faGForceEndOfBlock(int scalers);
889 
890 int faSetHistoryBufferThreshold(int id, int thres);
891 void faGSetHistoryBufferThreshold(int thres);
892 int faGetHistoryBufferThreshold(int id);
893 int faArmHistoryBuffer(int id);
894 void faGArmHistoryBuffer();
895 int faHistoryBufferDReady(int id);
896 int faReadHistoryBuffer(int id, volatile unsigned int *data, int nwrds);
897 
898 int faStateArmBuffer(int id, int enable);
899 int faStateReadBuffer(int id, volatile unsigned int *data, int nwords);
900 int faStateMap(unsigned int state_value);
901 int faStatePrintBuffer(int id);
902 
903 /* FLASH SDC prototypes */
904 int faSDC_Config(unsigned short cFlag, unsigned short bMask);
905 void faSDC_Status(int sFlag);
906 void faSDC_Enable(int nsync);
907 void faSDC_Disable();
908 void faSDC_Sync();
909 void faSDC_Trig();
910 int faSDC_Busy();
911 
912 /* FADC Internal Trigger Routine Prototypes */
913 int faItrigSetMode(int id, int tmode, unsigned int wWidth, unsigned int wMask,
914  unsigned int cMask, unsigned int sumThresh, unsigned int *tTable);
915 int faItrigInitTable(int id, unsigned int *table);
916 int faItrigSetHBwidth(int id, unsigned short hbWidth, unsigned short hbMask);
917 unsigned int faItrigGetHBwidth(int id, unsigned int chan);
918 int faItrigSetHBdelay(int id, unsigned short hbDelay, unsigned short hbMask);
919 unsigned int faItrigGetHBdelay(int id, unsigned int chan);
920 void faItrigPrintHBinfo(int id);
921 unsigned int faItrigSetOutWidth(int id, unsigned short itrigWidth);
922 void faItrigEnable(int id, int eflag);
923 void faItrigDisable(int id, int dflag);
924 int faItrigGetTableVal(int id, unsigned short pMask);
925 void faItrigSetTableVal(int id, unsigned short tval, unsigned short pMask);
926 
927 #endif /* __FADCLIB__ */
int faStatePrintBuffer(int id)
Print the contents of the State Machine buffer to standard out.
Definition: fadcLib.c:8207
int faSetTriggerStopCondition(int id, int trigger_max)
Set the maximum number of unacknowledged triggers before module stops accepting incoming triggers...
Definition: fadcLib.c:1989
unsigned int faGetA32(int id)
Return the base address of the A32 for specified module.
Definition: fadcLib.c:5993
void faReset(int id, int iFlag)
Perform a hard reset.
Definition: fadcLib.c:3208
volatile unsigned int adc_nsb
Definition: fadcLib.h:110
void faItrigPrintHBinfo(int id)
unsigned int faGBlockReady(unsigned int slotmask, int nloop)
Return a Block Ready status mask for fADCs indicated in supplied slotmask.
Definition: fadcLib.c:4164
int faBready(int id)
Return a Block Ready status.
Definition: fadcLib.c:4108
void faTestSetTokenOut(int id, int mode)
Set the level of Token Out to the SD.
Definition: fadcLib.c:7016
volatile unsigned int hitsum_trig_width
Definition: fadcLib.h:125
void faTestSetSdLink(int id, int mode)
Set the level of the SD Link.
Definition: fadcLib.c:6980
void fadcFirmwareSetFilename(char *filename, int chip)
volatile unsigned int clock250count
Definition: fadcLib.h:139
int faGetHitbitsMode(int id)
Get the enabled/disabled status of hitbits mode for the module.
Definition: fadcLib.c:5729
volatile unsigned int trig_scal
Definition: fadcLib.h:66
int faHistoryBufferDReady(int id)
Return whether or not the history buffer has been triggered.
Definition: fadcLib.c:7835
int faDready(int id, int dflag)
Return Event/Block count.
Definition: fadcLib.c:4078
void faDisableClk(int id)
Disable the internal clock.
Definition: fadcLib.c:4451
int faSampleConfig(int id, int nsamples, int maxvalue)
Configure output of sample data from .
Definition: fadcLib.c:5162
int faPrintScalers(int id, int rflag)
Scaler Print Out routine.
Definition: fadcLib.c:5828
int fadcFirmwareCheckSRAM(int id)
volatile unsigned int hitsum_cfg
Definition: fadcLib.h:122
int fadcFirmwareGLoad(int chip, int pFlag)
void faDataDecode(unsigned int data)
Decode a data word from an fADC250 and print to standard out.
Definition: fadcLib.c:6573
Definition: fadcLib.h:851
volatile unsigned int syncreset_scal
Definition: fadcLib.h:91
unsigned int thres_bin
Definition: fadcLib.h:185
int faSetDACandCheck(int id, unsigned short dvalue, unsigned short chmask)
Set the DAC value of the specified channel mask and readback and check that it was written properly...
Definition: fadcLib.c:5364
volatile unsigned int testBit
Definition: fadcLib.h:138
volatile unsigned int csr
Definition: fadcLib.h:55
volatile unsigned int scaler_ctrl
Definition: fadcLib.h:99
int faSetSyncSource(int id, int source)
Set the SyncReset source for the module.
Definition: fadcLib.c:4810
int faSetPPG(int id, int pmode, unsigned short *sdata, int nsamples)
Setup FADC Progammable Pulse Generator.
Definition: fadcLib.c:2370
int faSetChannelEnable(int id, int channel)
Enable the specified channel.
Definition: fadcLib.c:3572
int faBusyLevel(int id, unsigned int val, int bflag)
Set/Readback Busy Level.
Definition: fadcLib.c:4237
Definition: fadcLib.h:855
void faEnableSoftTrig(int id)
Enable software triggers.
Definition: fadcLib.c:4308
const char * fa_mode_names[FA_MAX_PROC_MODE+1]
Definition: fadcLib.c:8241
unsigned int pulse_num
Definition: fadcLib.h:184
int faSetChannelPedestal(int id, unsigned int chan, unsigned int ped)
Set the pedestal value of specified channel.
Definition: fadcLib.c:5520
volatile unsigned int blk_wrdcnt_fifo
Definition: fadcLib.h:70
unsigned int samp_ov_thres
Definition: fadcLib.h:181
volatile unsigned int blk_count
Definition: fadcLib.h:68
void faTestResetClock250Counter(int id)
Reset the counter of the 250MHz Clock scaler.
Definition: fadcLib.c:7266
void faGForceEndOfBlock(int scalers)
Allows for the insertion of a block trailer into the data stream for all initialized fADC250s...
Definition: fadcLib.c:7700
void faGTrig()
Pulse a software trigger to all initialized fADC250s.
Definition: fadcLib.c:3913
unsigned int faGetCtrlFPGAData(int id)
Return raw register data from the Control FPGA containing the temperature, core voltage, and auxiliary voltage.
Definition: fadcLib.c:6278
void faEnableMultiBlock(int tflag)
Enable and setup multiblock transfers for all initialized fADC250s.
Definition: fadcLib.c:4595
int faTokenStatus(int id)
Return the status of the token.
Definition: fadcLib.c:3389
unsigned int faScanMask()
Return the vme slot mask of all initialized fADC250s.
Definition: fadcLib.c:4210
unsigned int faTestGetTrig1Counter(int id)
Return the value of the trig1 scaler.
Definition: fadcLib.c:7205
unsigned int slot_id_hd
Definition: fadcLib.h:153
unsigned int integral
Definition: fadcLib.h:188
void faGEnable(int eflag, int bank)
Enable data acquisition, trigger, and SyncReset on all initialized fADC250s.
Definition: fadcLib.c:3802
int faSetChannelDisableMask(int id, unsigned short cmask)
Disable all channels in the specified mask.
Definition: fadcLib.c:3543
volatile unsigned short ctrl
Definition: fadcLib.h:211
int fadcFirmwareRevFromFpgaID(int pflag)
volatile unsigned int adc_pl
Definition: fadcLib.h:109
int faGetBlockError(int pflag)
Return the type of error that occurred while attempting a block read from faReadBlock.
Definition: fadcLib.c:2850
unsigned int NSA
Definition: fadcLib.h:161
volatile unsigned int mgt_ctrl
Definition: fadcLib.h:97
unsigned int slot_id_evh
Definition: fadcLib.h:155
int faSetTrigOut(int id, int trigout)
Set trigger output options.
Definition: fadcLib.c:4878
int faSlot(unsigned int i)
Convert an index into a slot number, where the index is the element of an array of FADCs in the order...
Definition: fadcLib.c:820
void faGDisable(int eflag)
Disable data acquisition, triggers, and SyncReset on all initialized fADC250s.
Definition: fadcLib.c:3871
#define FA_MAX_PROC_MODE
Definition: fadcLib.h:419
void faStatus(int id, int sflag)
Print Status of fADC250 to standard out.
Definition: fadcLib.c:986
volatile unsigned int dataflow_status
Definition: fadcLib.h:73
void faItrigDisable(int id, int dflag)
unsigned int faItrigSetOutWidth(int id, unsigned short itrigWidth)
int faTestGetClock250CounterStatus(int id)
Return the status of the 250Mhz Clock Counter.
Definition: fadcLib.c:7112
volatile unsigned int berr_module_scal
Definition: fadcLib.h:84
volatile unsigned int scaler_interval
Definition: fadcLib.h:101
int fadcFirmwareVerifyDownload(int id)
unsigned int n_evts
Definition: fadcLib.h:156
volatile unsigned int hitsum_sum_thresh
Definition: fadcLib.h:131
unsigned int group
Definition: fadcLib.h:194
int faSetHistoryBufferThreshold(int id, int thres)
Set the threshold to trigger for the history buffer to be saved for readout.
Definition: fadcLib.c:7721
void faClear(int id)
Perform a soft reset.
Definition: fadcLib.c:3106
unsigned int valid_2
Definition: fadcLib.h:176
volatile unsigned int hitsum_window_width
Definition: fadcLib.h:127
int faCalcMaxUnAckTriggers(int mode, int ptw, int nsa, int nsb, int np)
Return the maximum number of unacknowledged triggers a specific mode can handle.
Definition: fadcLib.c:1942
volatile unsigned int reset
Definition: fadcLib.h:65
unsigned int faItrigGetHBwidth(int id, unsigned int chan)
void faChanDisable(int id, unsigned short cmask)
Disable all channels in the specified mask.
Definition: fadcLib.c:3530
void faDisableSoftSync(int id)
Disable Software SyncReset.
Definition: fadcLib.c:4403
unsigned int trig_type_int
Definition: fadcLib.h:199
int faDataSuppressTriggerTime(int id, int suppress)
Enable/Disable suppression of one or both of the trigger time words in the data stream.
Definition: fadcLib.c:6150
volatile unsigned int trig2p0count
Definition: fadcLib.h:142
void faSetNormalMode(int id, int opt)
Configure the ADC Processing in "Normal Mode".
Definition: fadcLib.c:2248
int faEnableScalers(int id)
Enable the scalers to count.
Definition: fadcLib.c:5941
int faItrigInitTable(int id, unsigned int *table)
unsigned int ped_sum
Definition: fadcLib.h:183
void faGTrig2()
Pulse a software playback trigger to all initialized fADC250s.
Definition: fadcLib.c:3949
int faGetChannelDAC(int id, int channel)
Readback the DAC for a specific channel by the module in the specified slot.
Definition: fadcLib.c:5481
int faReadHistoryBuffer(int id, volatile unsigned int *data, int nwrds)
Read out history buffer from the module.
Definition: fadcLib.c:7863
volatile unsigned int hitsum_reserved
Definition: fadcLib.h:124
int faSetClkSource(int id, int source)
Set the Clock Source for the module.
Definition: fadcLib.c:4723
int faSetTriggerBusyCondition(int id, int trigger_max)
Set the maximum number of unacknowledged triggers before module asserts BUSY.
Definition: fadcLib.c:2035
unsigned int time_coarse
Definition: fadcLib.h:195
volatile unsigned int mem_adr
Definition: fadcLib.h:79
unsigned int over
Definition: fadcLib.h:178
int faDataInsertAdcParameters(int id, int enable)
Insert ADC parameter word into datastream. The data word appears as a block header continuation word...
Definition: fadcLib.c:6097
void faTestSetTrigOut(int id, int mode)
Set the level of Trig Out to the SD.
Definition: fadcLib.c:6908
unsigned int evt_num_int
Definition: fadcLib.h:201
void faEnableBusError(int id)
Enable bus errors to terminate a block transfer.
Definition: fadcLib.c:4526
int faSDC_Config(unsigned short cFlag, unsigned short bMask)
Configure the Signal Distribution Card (SDC)
Definition: fadcLib.c:8272
volatile unsigned int hitsum_window_bits
Definition: fadcLib.h:126
volatile unsigned int hitsum_fifo
Definition: fadcLib.h:130
Definition: fadcLib.h:42
int faReadBlock(int id, volatile UINT32 *data, int nwrds, int rflag)
General Data readout routine.
Definition: fadcLib.c:2582
void faResetToken(int id)
Reset the token.
Definition: fadcLib.c:3366
void faEnableSoftSync(int id)
Enable Software SyncReset.
Definition: fadcLib.c:4376
unsigned int faTestGetTrig2Counter(int id)
Return the value of the trig2 scaler.
Definition: fadcLib.c:7236
void faSDC_Sync()
Perform a SyncReset from the SDC.
Definition: fadcLib.c:8431
unsigned int time_fine
Definition: fadcLib.h:196
volatile unsigned int sum_data
Definition: fadcLib.h:103
volatile unsigned int system_monitor
Definition: fadcLib.h:104
volatile unsigned int aux
Definition: fadcLib.h:76
int faSetDAC(int id, unsigned short dvalue, unsigned short chmask)
Set the DAC value of the specified channel mask.
Definition: fadcLib.c:5272
unsigned int under
Definition: fadcLib.h:179
volatile unsigned int hitsum_pattern
Definition: fadcLib.h:129
int faSetChannelDisable(int id, int channel)
Disable the specified channel.
Definition: fadcLib.c:3496
volatile unsigned int berr_crate_scal
Definition: fadcLib.h:85
int faGetChannelMask(int id, int type)
Get the Enabled/Disabled Channel Mask.
Definition: fadcLib.c:3637
unsigned int slot_id_tr
Definition: fadcLib.h:154
Definition: fadcLib.h:52
volatile unsigned int busy_level
Definition: fadcLib.h:92
void faEnable(int id, int eflag, int bank)
Enable data acquisition, trigger, and SyncReset on the module.
Definition: fadcLib.c:3729
void faItrigEnable(int id, int eflag)
void faSDC_Status(int sFlag)
Print status of SDC to standard out.
Definition: fadcLib.c:8314
int faSetBlockLevel(int id, int level)
Set the block level for the module.
Definition: fadcLib.c:4670
Definition: fadcLib.h:854
unsigned int faGetTokenStatus(int pflag)
Return slot mask of modules with token.
Definition: fadcLib.c:3435
int faEnableInternalPlaybackTrigger(int id)
Enable the software playback trigger and trigger.
Definition: fadcLib.c:4023
void faEnableFP(int id)
Enable Front Panel Inputs.
Definition: fadcLib.c:4844
unsigned int chan_b
Definition: fadcLib.h:192
volatile unsigned int trigger_control
Definition: fadcLib.h:77
int id
Definition: fadcLib.h:861
int faTestGetTokenIn(int id)
Get the level of the Token In from the SD.
Definition: fadcLib.c:7081
int faItrigSetHBwidth(int id, unsigned short hbWidth, unsigned short hbMask)
volatile unsigned int s_adr
Definition: fadcLib.h:62
unsigned int quality2
Definition: fadcLib.h:187
void faGDataSuppressTriggerTime(int suppress)
Enable/Disable suppression of one or both of the trigger time words in the data stream for all initia...
Definition: fadcLib.c:6204
unsigned int trig_state_int
Definition: fadcLib.h:200
unsigned int faGetMaxA32MB(int id)
Get the maximum address used for multiblock.
Definition: fadcLib.c:6067
volatile unsigned int time_count
Definition: fadcLib.h:135
void faPrintDAC(int id)
Print DAC values for each channel to standard out.
Definition: fadcLib.c:5408
void faDACReset(int id)
Perform a reset of the DAC chip.
Definition: fadcLib.c:3321
unsigned int scaler_data_words
Definition: fadcLib.h:203
void faEnableClk(int id)
Enable the internal clock.
Definition: fadcLib.c:4427
volatile unsigned int ctrl2
Definition: fadcLib.h:57
unsigned int time_1
Definition: fadcLib.h:168
volatile unsigned int blk_level
Definition: fadcLib.h:58
int faLatchScalers(int id)
Latch the current scaler count.
Definition: fadcLib.c:5915
void faTestResetSyncCounter(int id)
Reset the counter of the SyncReset scaler.
Definition: fadcLib.c:7294
struct faUpdateWatcherArgs_struct faUpdateWatcherArgs_t
int faCheckThreshold(int id)
Check and make sure readout threshold for each channel is non zero.
Definition: fadcLib.c:4934
void faGSetProcMode(int pmode, unsigned int PL, unsigned int PTW, int NSB, unsigned int NSA, unsigned int NP, unsigned int NPED, unsigned int MAXPED, unsigned int NSAT)
Configure the processing type/mode for all initialized fADC250s.
Definition: fadcLib.c:1912
int faCheckAddresses(int id)
Definition: fadcLib.c:759
unsigned int chan_a
Definition: fadcLib.h:190
int faSetHitbitsMode(int id, int enable)
Enable/Disable Hitbits mode on the module.
Definition: fadcLib.c:5678
volatile unsigned int trig1p0count
Definition: fadcLib.h:141
unsigned int err_status_int
Definition: fadcLib.h:202
unsigned int blk_num
Definition: fadcLib.h:157
int faGetTrig21Delay(int id)
Return the value of the delay between the software playback trigger and trigger.
Definition: fadcLib.c:3997
void faTrig(int id)
Pulse a software trigger to the module.
Definition: fadcLib.c:3889
int faSetChannelEnableMask(int id, unsigned short enMask)
Enable all channels in the specified mask.
Definition: fadcLib.c:3607
unsigned int vpeak
Definition: fadcLib.h:198
int fadcFirmwareReadMcsFile(char *filename)
unsigned int adc_2
Definition: fadcLib.h:177
float faGetCtrlFPGAVoltage(int id, int vtype, int pflag)
Return the value of specified Control FPGA voltage.
Definition: fadcLib.c:6371
volatile unsigned int prom_reg2
Definition: fadcLib.h:83
int faReadScalers(int id, volatile unsigned int *data, unsigned int chmask, int rflag)
Scaler Data readout routine.
Definition: fadcLib.c:5765
unsigned int quality
Definition: fadcLib.h:186
void faGArmHistoryBuffer()
Enable the history buffer for data acquisition for all initialized fADC250s.
Definition: fadcLib.c:7818
unsigned int new_type
Definition: fadcLib.h:151
volatile unsigned int adc_test_data
Definition: fadcLib.h:115
void faTestResetTrig2Counter(int id)
Reset the counter of the trig2 scaler.
Definition: fadcLib.c:7348
volatile unsigned int internal_trig_scal
Definition: fadcLib.h:71
Definition: fadcLib.h:148
unsigned int faTestGetTestBitReg(int id)
Return the current value of the testBit register.
Definition: fadcLib.c:7376
int faTestGetStatBitB(int id)
Get the level of the StatBitB to the SD.
Definition: fadcLib.c:7050
void faGSetTriggerPathSamples(unsigned int TNSA, unsigned int TNSAT)
Set the number of samples that are included before and after threshold crossing that are sent through...
Definition: fadcLib.c:2138
unsigned int faReadCSR(int id)
Get the value of the Control/Status Register.
Definition: fadcLib.c:3080
volatile unsigned int intr
Definition: fadcLib.h:59
volatile unsigned int header_scal
Definition: fadcLib.h:88
int step
Definition: fadcLib.h:860
int fadcFirmwareZeroSRAM(int id)
void faEnableTriggerOut(int id, int output)
Enable trigger out for front panel or p0.
Definition: fadcLib.c:4479
volatile unsigned int version
Definition: fadcLib.h:54
unsigned int faGetMinA32MB(int id)
Get the minimum address used for multiblock.
Definition: fadcLib.c:6041
volatile unsigned int proc_words_scal
Definition: fadcLib.h:86
volatile unsigned int mgt_status
Definition: fadcLib.h:96
unsigned int time_4
Definition: fadcLib.h:171
unsigned int faGBready()
Return a Block Ready status mask for all initialized fADC250s.
Definition: fadcLib.c:4136
volatile unsigned int mem2_data
Definition: fadcLib.h:81
unsigned int vmin
Definition: fadcLib.h:197
void faDisableSoftTrig(int id)
Disable Software Triggers.
Definition: fadcLib.c:4352
unsigned int source_b
Definition: fadcLib.h:193
int faResetTriggerCount(int id)
Reset the trigger count for the module.
Definition: fadcLib.c:4910
int faSetScalerBlockInterval(int id, unsigned int nblock)
Set the block interval of scaler data insertion.
Definition: fadcLib.c:7559
int fadcFirmwareGetFpgaID(int pflag)
int faSetTriggerPathThreshold(int id, unsigned int TPT)
Set the threshold used to determine what samples are sent through the trigger path.
Definition: fadcLib.c:2158
void faSDC_Enable(int nsync)
Enable Triggers and/or SyncReset on the SDC.
Definition: fadcLib.c:8388
unsigned int chan
Definition: fadcLib.h:172
volatile unsigned int syncp0count
Definition: fadcLib.h:140
int faGTokenStatus()
Return the slotmask of those modules that have the token.
Definition: fadcLib.c:3414
void faSetInvertedMode(int id)
Configure the ADC Processing in "Inverted (positive polarity) Mode".
Definition: fadcLib.c:2327
void faTrig2(int id)
Pulse a software playback trigger to the module.
Definition: fadcLib.c:3927
int faGSuppressTriggerTime(int suppress)
Suppress all, or just the MSB, of the trigger time words from the datastream.
Definition: fadcLib.c:2540
unsigned int nsa_ext
Definition: fadcLib.h:180
volatile unsigned int berr_drive_count
Definition: fadcLib.h:48
unsigned int n_words
Definition: fadcLib.h:162
void faItrigSetTableVal(int id, unsigned short tval, unsigned short pMask)
unsigned int valid_1
Definition: fadcLib.h:174
Definition: fadcLib.h:858
void faGSetHistoryBufferThreshold(int thres)
Set the threshold to trigger for the history buffer to be saved for readout for all initialized fADC2...
Definition: fadcLib.c:7753
volatile unsigned int adr32
Definition: fadcLib.h:60
unsigned int adc_sum
Definition: fadcLib.h:182
int faGetScalerBlockInterval(int id)
Definition: fadcLib.c:7591
void faSDC_Disable()
Disable Triggers and SyncReset on the SDC.
Definition: fadcLib.c:8410
unsigned int faTestGetClock250Counter(int id)
Return the value of the 250Mhz Clock scaler.
Definition: fadcLib.c:7143
int fadcFirmwareReadFile(char *filename)
int faStateMap(unsigned int state_value)
Convert state value to mapped identifier.
Definition: fadcLib.c:7984
int faSuppressTriggerTime(int id, int suppress)
Suppress all, or just the MSB, of the trigger time words from the datastream.
Definition: fadcLib.c:2485
void faGEnableSyncSrc()
Enable the SyncReset Source of all initialized fADC250s.
Definition: fadcLib.c:3713
void fadcFirmwareDownloadConfigData(int id)
int faSetTriggerPathSamples(int id, unsigned int TNSA, unsigned int TNSAT)
Set the number of samples that are included before and after threshold crossing that are sent through...
Definition: fadcLib.c:2080
unsigned int evt_num_2
Definition: fadcLib.h:164
volatile unsigned int sum_threshold
Definition: fadcLib.h:102
int faSetTrig21Delay(int id, int delay)
Configure the delay between the software playback trigger and trigger.
Definition: fadcLib.c:3966
void faClearError(int id)
Clear latched errors.
Definition: fadcLib.c:3154
void faGSetDataFormat(int format)
Set the readout data form for all initialized modules.
Definition: fadcLib.c:6262
void faGReset(int iFlag)
Perform a hard reset on all initialized fADC250s.
Definition: fadcLib.c:3247
int faGetDAC(int id, unsigned short *indata)
Readback the DAC values currently used by the module in the specified slot.
Definition: fadcLib.c:5446
volatile unsigned int config7
Definition: fadcLib.h:114
volatile unsigned int prom_reg1
Definition: fadcLib.h:82
unsigned int faTestGetSyncCounter(int id)
Return the value of the SyncReset scaler.
Definition: fadcLib.c:7174
unsigned int evt_of_blk
Definition: fadcLib.h:165
Definition: fadcLib.h:207
int faClearScalers(int id)
Clear the scalers (and enable, if disabled)
Definition: fadcLib.c:5889
int faBusy(int id)
Get the busy status.
Definition: fadcLib.c:4278
volatile unsigned int ev_count
Definition: fadcLib.h:67
int faReadAllChannelSamples(int id, volatile unsigned int *data)
Read the current sample data from the specified channel and module.
Definition: fadcLib.c:5224
volatile unsigned int ram_word_count
Definition: fadcLib.h:72
volatile unsigned int delay
Definition: fadcLib.h:63
volatile unsigned short csr
Definition: fadcLib.h:210
int faArmHistoryBuffer(int id)
Enable the history buffer for data acquisition for the module.
Definition: fadcLib.c:7796
unsigned int time_3
Definition: fadcLib.h:170
unsigned int modID
Definition: fadcLib.h:158
volatile unsigned int hitsum_hit_info
Definition: fadcLib.h:123
volatile unsigned int hitsum_status
Definition: fadcLib.h:121
unsigned int NSB
Definition: fadcLib.h:160
void faPPGDisable(int id)
Disable the programmable pulse generator.
Definition: fadcLib.c:2452
Definition: fadcLib.h:853
unsigned int faItrigGetHBdelay(int id, unsigned int chan)
int faGProcPedConfig(int nsamples, int maxvalue)
Configure pedestal parameters to be used by processing algorythm for all initialized modules...
Definition: fadcLib.c:5141
unsigned int width
Definition: fadcLib.h:173
unsigned int type
Definition: fadcLib.h:152
int faGSetClockSource(int clkSrc)
Set the clock source for all initialized modules.
Definition: fadcLib.c:930
volatile unsigned short busy_status
Definition: fadcLib.h:213
volatile unsigned int itrig_cfg
Definition: fadcLib.h:64
STATUS faInit(UINT32 addr, UINT32 addr_inc, int nadc, int iFlag)
Initialize JLAB FADC Library.
Definition: fadcLib.c:188
unsigned int evt_num_1
Definition: fadcLib.h:163
volatile unsigned int gen_evt_header
Definition: fadcLib.h:93
int faItrigSetHBdelay(int id, unsigned short hbDelay, unsigned short hbMask)
void faDisable(int id, int eflag)
Disable data acquisition, triggers, and SyncReset on the module.
Definition: fadcLib.c:3822
void faGStatus(int sflag)
Print a summary of all initialized fADC250s.
Definition: fadcLib.c:1357
int faGetChannelPedestal(int id, unsigned int chan)
Get the pedestal value of specified channel.
Definition: fadcLib.c:5559
int faStateReadBuffer(int id, volatile unsigned int *data, int nwords)
Read state machine buffer.
Definition: fadcLib.c:7935
unsigned int faGetProcFPGAData(int id)
Return raw register data from the Processing FPGA containing the temperature.
Definition: fadcLib.c:6304
int fadcFirmwareTestReady(int id, int n_try, int pFlag)
void faSetCalib(int id, unsigned short sdelay, unsigned short tdelay)
Set the SyncReset and Trigger Delay.
Definition: fadcLib.c:3472
volatile unsigned int status3
Definition: fadcLib.h:118
unsigned int faGetFirmwareVersions(int id, int pflag)
Get the firmware versions of each FPGA.
Definition: fadcLib.c:1676
int faPrintThreshold(int id)
Print the thresholds of all channels to standard out.
Definition: fadcLib.c:5053
int faGetHistoryBufferThreshold(int id)
Get the history buffer threshold.
Definition: fadcLib.c:7770
void fadcFirmwareUpdateWatcher(faUpdateWatcherArgs_t arg)
void faTestSetBusyOut(int id, int mode)
Set the level of Busy Out to the SD.
Definition: fadcLib.c:6944
int faSetTrigSource(int id, int source)
Set the trigger source for the module.
Definition: fadcLib.c:4764
unsigned int time_2
Definition: fadcLib.h:169
unsigned int time_low_10
Definition: fadcLib.h:167
void faGDACReset()
Perform a reset of the DAC chip for all initialized modules.
Definition: fadcLib.c:3342
int faForceEndOfBlock(int id, int scalers)
Allows for the insertion of a block trailer into the data stream.
Definition: fadcLib.c:7626
void faSDC_Trig()
Perform a trigger pulse from the SDC.
Definition: fadcLib.c:8450
float faGetCtrlFPGATemp(int id, int pflag)
Return the value of the Control FPGA temperature (in degrees Celsius)
Definition: fadcLib.c:6332
int faStateArmBuffer(int id, int enable)
Enable/Disable Buffer to store state machine diagnostics.
Definition: fadcLib.c:7905
unsigned int time
Definition: fadcLib.h:189
void faGDataInsertAdcParameters(int enable)
Insert ADC parameter word into datastream. For all initialized modules. The data word appears as a bl...
Definition: fadcLib.c:6129
volatile unsigned int hitsum_coin_bits
Definition: fadcLib.h:128
volatile unsigned int ctrl1
Definition: fadcLib.h:56
int faGetSerialNumber(int id, char **rval, int snfix)
Fills &#39;rval&#39; with a character array containing the fa250 serial number.
Definition: fadcLib.c:7415
volatile unsigned int adc_nsa
Definition: fadcLib.h:111
int faSDC_Busy()
Return Busy status of the SDC.
Definition: fadcLib.c:8469
int faGSampleConfig(int nsamples, int maxvalue)
Configure output of sample data from for all initialized modules.
Definition: fadcLib.c:5204
volatile unsigned int trig2_scal
Definition: fadcLib.h:89
unsigned int adc_1
Definition: fadcLib.h:175
volatile unsigned int blk_fifo_count
Definition: fadcLib.h:69
volatile unsigned int value
Definition: fadcLib.h:46
volatile unsigned int adr_mb
Definition: fadcLib.h:61
int fadcFirmwareChipFromFpgaID(int pflag)
void faTestResetTrig1Counter(int id)
Reset the counter of the trig1 scaler.
Definition: fadcLib.c:7321
void faDisableMultiBlock()
Disable multiblock transfer for all initialized fADC250s.
Definition: fadcLib.c:4644
void faTestSetSystemTestMode(int id, int mode)
Enable/Disable System test mode.
Definition: fadcLib.c:6868
void faSoftReset(int id, int cflag)
Perform either a soft clear or soft reset.
Definition: fadcLib.c:3296
int faSetThreshold(int id, unsigned short tvalue, unsigned short chmask)
Set the readout threshold value for specified channel mask.
Definition: fadcLib.c:4990
unsigned int time_now
Definition: fadcLib.h:166
volatile unsigned int level
Definition: fadcLib.h:44
volatile unsigned int trig21_delay
Definition: fadcLib.h:78
volatile unsigned int retry_drive_count
Definition: fadcLib.h:49
volatile unsigned int config6
Definition: fadcLib.h:113
volatile unsigned int lost_trig_scal
Definition: fadcLib.h:87
int fadcFirmwareLoad(int id, int chip, int pFlag)
int faSetClockSource(int id, int clkSrc)
Set the clock source.
Definition: fadcLib.c:855
unsigned int source_a
Definition: fadcLib.h:191
void faSync(int id)
Pulse a software SyncReset.
Definition: fadcLib.c:4047
int faSetDataFormat(int id, int format)
Set the readout data form which allows for suppression of repetitious data words. ...
Definition: fadcLib.c:6225
Definition: fadcLib.h:852
int faSetProcMode(int id, int pmode, unsigned int PL, unsigned int PTW, int NSB, unsigned int NSA, unsigned int NP, unsigned int NPED, unsigned int MAXPED, unsigned int NSAT)
Configure the processing type/mode.
Definition: fadcLib.c:1733
unsigned int spare
Definition: fadcLib.h:47
volatile unsigned int gen_evt_trailer
Definition: fadcLib.h:95
volatile unsigned int trailer_scal
Definition: fadcLib.h:90
faArgs_enum
Definition: fadcLib.h:849
volatile unsigned int adc_ptw
Definition: fadcLib.h:108
unsigned int PL
Definition: fadcLib.h:159
void faPPGEnable(int id)
Enable the programmable pulse generator.
Definition: fadcLib.c:2431
int faItrigGetTableVal(int id, unsigned short pMask)
volatile unsigned short busy_enable
Definition: fadcLib.h:212
volatile unsigned int gen_evt_data
Definition: fadcLib.h:94
unsigned int faGetA32M()
Return the base address of the A32 Multiblock.
Definition: fadcLib.c:6017
void faDisableBusError(int id)
Disable bus errors.
Definition: fadcLib.c:4569
void faGSetTriggerPathThreshold(unsigned int TPT)
Set the threshold used to determine what samples are sent through the trigger path for all initialize...
Definition: fadcLib.c:2198
int faItrigSetMode(int id, int tmode, unsigned int wWidth, unsigned int wMask, unsigned int cMask, unsigned int sumThresh, unsigned int *tTable)
int faDisableScalers(int id)
Disable counting in the scalers.
Definition: fadcLib.c:5966
volatile unsigned int config3
Definition: fadcLib.h:117
int faProcPedConfig(int id, int nsamples, int maxvalue)
Configure pedestal parameters to be used by processing algorythm.
Definition: fadcLib.c:5099
volatile unsigned int csr
Definition: fadcLib.h:45
int faSetMGTTestMode(int id, unsigned int mode)
Set the fa250 operation when Sync Reset is received.
Definition: fadcLib.c:5599
void faGSetHitbitsMode(int enable)
Enable/Disable Hitbits mode for all initialized fADC250s.
Definition: fadcLib.c:5713
volatile unsigned int mem1_data
Definition: fadcLib.h:80
int faPrintBlock(int id, int rflag)
Print the current available block to standard out.
Definition: fadcLib.c:2977
float faGetProcFPGATemp(int id, int pflag)
Return the value of the Processing FPGA temperature (in degrees Celsius)
Definition: fadcLib.c:6426
void faEnableSyncSrc(int id)
Enabled the SyncReset source.
Definition: fadcLib.c:3666
int fadcFirmwareAttachUpdateWatcher(VOIDFUNCPTR routine, faUpdateWatcherArgs_t arg)