JLab fADC125 Library  1.2.1
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups
fa125Lib.h
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*
2  * Copyright (c) 2010 Southeastern Universities Research Association, *
3  * Thomas Jefferson National Accelerator Facility *
4  * *
5  * This software was developed under a United States Government license *
6  * described in the NOTICE file included as part of this distribution. *
7  * *
8  * Authors: Bryan Moffit *
9  * moffit@jlab.org Jefferson Lab, MS-12B3 *
10  * Phone: (757) 269-5660 12000 Jefferson Ave. *
11  * Fax: (757) 269-5800 Newport News, VA 23606 *
12  *
13  * Gerard Visser
14  * gvisser@indiana.edu
15  * Indiana University
16  * *
17  *----------------------------------------------------------------------------*
18  *
19  * Description:
20  * Driver library header for readout of the 125MSPS ADC using vxWorks 5.5
21  * (or later) or Intel based single board computer
22  *
23  *----------------------------------------------------------------------------*/
24 
25 #ifndef __FA125LIB__
26 #define __FA125LIB__
27 
28 #define FA125_MAX_BOARDS 20
29 #define FA125_MAX_A32_MEM 0x800000 /* 8 Meg */
30 #define FA125_MAX_A32MB_SIZE 0x800000 /* 8 MB */
31 
32 #define FA125_MAX_ADC_CHANNELS 72
33 #define FA125_MAX_DATA_PER_CHANNEL 8
34 
36 {
37  /* 0x0000 */ volatile UINT32 id;
38  /* 0x0004 */ volatile UINT32 swapctl;
39  /* 0x0008 */ volatile UINT32 version;
40  /* 0x000C */ volatile UINT32 clock;
41  /* 0x0010 */ volatile UINT32 pwrctl;
42  /* 0x0014 */ volatile UINT32 dacctl;
43  /* 0x0018 */ UINT32 blank0[(0x20-0x18)/4];
44  /* 0x0020 */ volatile UINT32 serial[4];
45  /* 0x0030 */ volatile UINT32 temperature[2];
46  /* 0x0038 */ volatile UINT32 slot_ga;
47  /* 0x003C */ volatile UINT32 a32_ba;
48  /* 0x0040 */ volatile UINT32 blockCSR;
49  /* 0x0044 */ volatile UINT32 ctrl1;
50  /* 0x0048 */ volatile UINT32 adr32;
51  /* 0x004C */ volatile UINT32 adr_mb;
52  /* 0x0050 */ volatile UINT32 busy_level;
53  /* 0x0054 */ volatile UINT32 block_count;
54  /* 0x0058 */ volatile UINT32 configCSR;
55  /* 0x005C */ volatile UINT32 configAdrData;
56  /* 0x0060 */ UINT32 blank1[(0x1000-0x60)/4];
57 };
58 
59 struct fa125_a24_fe
60 {
61  /* 0xN000 */ volatile UINT32 version;
62  /* 0xN004 */ volatile UINT32 test;
63  /* 0xN008 */ UINT32 blank0[(0x20-0x08)/4];
64  /* 0xN020 */ volatile UINT32 adc_async[6];
65  /* 0xN038 */ UINT32 blank1[(0x40-0x38)/4];
66  /* 0xN040 */ volatile UINT32 acqfifo[6];
67  /* 0xN058 */ volatile UINT32 ptw;
68  /* 0xN05C */ volatile UINT32 pl;
69  /* 0xN060 */ volatile UINT32 ptw_last_adr;
70  /* 0xN064 */ volatile UINT32 ptw_max_buf;
71  /* 0xN068 */ volatile UINT32 nsb;
72  /* 0xN06C */ volatile UINT32 nsa;
73  /* 0xN070 */ volatile UINT32 threshold[6];
74  /* 0xN088 */ volatile UINT32 config1;
75  /* 0xN08C */ volatile UINT32 trig_count;
76  /* 0xN090 */ volatile UINT32 config2;
77  /* 0xN094 */ volatile UINT32 test_waveform;
78  /* 0xN098 */ UINT32 blank2[(0x1000-0x98)/4];
79 };
80 
82 {
83  /* 0xD000 */ volatile UINT32 version;
84  /* 0xD004 */ volatile UINT32 csr;
85  /* 0xD008 */ volatile UINT32 trigsrc;
86  /* 0xD00C */ volatile UINT32 ctrl2;
87  /* 0xD010 */ volatile UINT32 softtrig;
88  /* 0xD014 */ volatile UINT32 blocklevel;
89  /* 0xD018 */ volatile UINT32 trig_count;
90  /* 0xD01C */ volatile UINT32 ev_count;
91  /* 0xD020 */ volatile UINT32 clock125_count;
92  /* 0xD024 */ volatile UINT32 sync_count;
93  /* 0xD028 */ volatile UINT32 trig2_count;
94  /* 0xD02C */ volatile UINT32 pulser_control;
95  /* 0xD030 */ volatile UINT32 pulser_trig_delay;
96 };
97 
98 struct fa125_a24
99 {
100  /* 0x0000 */ struct fa125_a24_main main;
101  /* 0x1000 */ struct fa125_a24_fe fe[12];
102  /* 0xD000 */ struct fa125_a24_proc proc;
103 };
104 
105 
106 struct fa125_a32
107 {
108  /* 0x0000 */ volatile UINT32 data;
109 };
110 
111 #define FA125_ID 0xADC12500
112 
113 #define FA125_MAIN_SUPPORTED_FIRMWARE 0x00010201
114 #define FA125_PROC_SUPPORTED_FIRMWARE 0x00010201
115 #define FA125_FE_SUPPORTED_FIRMWARE 0x00010201
116 
117 /* 0x10 pwrctl register definitions */
118 #define FA125_PWRCTL_KEY_ON 0x3000ABCD
119 
120 /* 0x14 dacctl register definitions */
121 #define FA125_DACCTL_DACCS_MASK (1<<0)
122 #define FA125_DACCTL_DACSCLK_MASK (1<<1)
123 #define FA125_DACCTL_ADACSI_MASK (1<<2)
124 #define FA125_DACCTL_BDACSI_MASK (1<<3)
125 
126 #ifdef DOESNOTEXIST
127 /* main CSR register definitions */
128 #define FA125_MAIN_CSR_TEST_TRIGGER (1<<2)
129 #endif
130 
131 /* 0x0c clock register definitions */
132 #define FA125_CLOCK_P2 (0)
133 #define FA125_CLOCK_P0 (1)
134 #define FA125_CLOCK_INTERNAL_ENABLE (2)
135 #define FA125_CLOCK_INTERNAL (3)
136 #define FA125_CLOCK_MASK 0xF
137 
138 /* 0x38 slot_ga register definitions */
139 #define FA125_SLOT_GA_MASK 0x0000001F
140 
141 /* 0x40 blockCSR register definitions */
142 #define FA125_BLOCKCSR_BLOCK_READY (1<<2)
143 #define FA125_BLOCKCSR_BERR_ASSERTED (1<<3)
144 #define FA125_BLOCKCSR_HAS_TOKEN (1<<4)
145 #define FA125_BLOCKCSR_TAKE_TOKEN (1<<5)
146 #define FA125_BLOCKCSR_PULSE_SYNC_RESET (1<<6)
147 #define FA125_BLOCKCSR_PULSE_TRIGGER (1<<7)
148 #define FA125_BLOCKCSR_PULSE_SOFT_RESET (1<<8)
149 #define FA125_BLOCKCSR_PULSE_HARD_RESET (1<<9)
150 
151 
152 /* 0x44 ctrl1 register definitions */
153 #define FA125_CTRL1_ENABLE_BERR (1<<2)
154 #define FA125_CTRL1_ENABLE_MULTIBLOCK (1<<3)
155 #define FA125_CTRL1_FIRST_BOARD (1<<4)
156 #define FA125_CTRL1_LAST_BOARD (1<<5)
157 
158 /* 0x48 adr32 register definitions */
159 #define FA125_ADR32_BASE_MASK 0x0000FF80
160 #define FA125_ADR32_ENABLE (1<<0)
161 
162 /* 0x4c adr_mb register definitions */
163 #define FA125_ADRMB_ENABLE (1<<0)
164 #define FA125_ADRMB_MIN_MASK 0x0000FF80
165 #define FA125_ADRMB_MAX_MASK 0xFF800000
166 
167 /* 0x50 busy_level register definitions */
168 #define FA125_BUSYLEVEL_MASK 0x000FFFFF
169 #define FA125_BUSYLEVEL_FORCE_BUSY (1<<31)
170 
171 /* 0x54 block_count register definitions */
172 #define FA125_BLOCKCOUNT_MASK 0x000FFFFF
173 
174 /* 0x58 configCSR register definitions */
175 #define FA125_CONFIGCSR_DATAREAD_MASK 0x000000FF
176 #define FA125_CONFIGCSR_BUSY (1<<8)
177 #define FA125_CONFIGCSR_OPCODE_MASK 0x07000000
178 #define FA125_CONFIGCSR_PROG_ENABLE (1<<31)
179 
180 /* 0x5C configAdrData register definitions */
181 #define FA125_CONFIGADRDATA_DATA_MASK 0x000000FF
182 #define FA125_CONFIGADRDATA_BYTEADR_MASK 0x0003FF00
183 #define FA125_CONFIGADRDATA_PAGEADR_MASK 0x7FFC0000
184 #define FA125_CONFIGADRDATA_EXEC (1<<31)
185 
186 /* 0x1004 FE test definitions */
187 #define FA125_FE_TEST_COLLECT_ON (1<<1)
188 #define FA125_FE_TEST_SYNCRESET_ENABLE (1<<2)
189 
190 /* 0x1058 FE ptw register defintions */
191 #define FA125_FE_PTW_MASK 0x000000FF
192 
193 /* 0x105C FE pl register defintions */
194 #define FA125_FE_PL_MASK 0x0000FFFF
195 
196 /* 0x1060 FE ptw_last_adr register defintions */
197 #define FA125_FE_PTW_LAST_ADR_MASK 0x00000FFF
198 
199 /* 0x1064 FE ptw_max_buf register defintions */
200 #define FA125_FE_PTW_MAX_BUF_MASK 0x000000FF
201 
202 /* 0x1068 FE NSB register defintions */
203 #define FA125_FE_NSB_MASK 0x00001FFF
204 
205 /* 0x106C FE NSA register defintions */
206 #define FA125_FE_NSA_MASK 0x00003FFF
207 
208 /* 0xN070 - 0xN084 threshold register defintions */
209 #define FA125_FE_THRESHOLD_MASK 0x00000FFF
210 
211 /* 0x1088 FE config1 defintions */
212 #define FA125_FE_CONFIG1_MASK 0x000000FF
213 #define FA125_FE_CONFIG1_MODE_MASK 0x00000007
214 #define FA125_FE_CONFIG1_ENABLE (1<<3)
215 #define FA125_FE_CONFIG1_NPULSES_MASK 0x00000060
216 #define FA125_FE_CONFIG1_PLAYBACK_ENABLE (1<<7)
217 
218 /* 0xN08C FE trig_count definitions */
219 #define FA125_FE_TRIG_COUNT_MASK 0x0000FFFF
220 
221 /* 0xN090 FE config2 definitions */
222 #define FA125_FE_CONFIG2_CH_MASK 0x0000003F
223 
224 /* 0xN094 FE test_waveform definitions */
225 #define FA125_FE_TEST_WAVEFORM_PPG_DATA_MASK 0x00000FFF
226 #define FA125_FE_TEST_WAVEFORM_OVERFLOW (1<<12)
227 #define FA125_FE_TEST_WAVEFORM_WRITE_PPG_DATA (1<<15)
228 #define FA125_PPG_MAX_SAMPLES 32*6
229 
230 /* 0xD004 proc CSR register definitions */
231 #define FA125_PROC_CSR_BUSY (1<<0)
232 #define FA125_PROC_CSR_CLEAR (1<<1)
233 #define FA125_PROC_CSR_RESET (1<<2)
234 
235 /* 0xD008 proc trigsrc register definitions */
236 #define FA125_TRIGSRC_TRIGGER_MASK 0x00000003
237 #define FA125_TRIGSRC_TRIGGER_P0 (0<<0)
238 #define FA125_TRIGSRC_TRIGGER_SOFTWARE (1<<0)
239 #define FA125_TRIGSRC_TRIGGER_INTERNAL_SUM (1<<1)
240 #define FA125_TRIGSRC_TRIGGER_P2 ((1<<1)|(1<<0))
241 
242 /* 0xD00C proc ctrl2 register definitions */
243 #define FA125_PROC_CTRL2_TRIGGER_ENABLE (1<<0)
244 #define FA125_PROC_CTRL2_SYNCRESET_SOURCE_MASK 0xC
245 #define FA125_PROC_CTRL2_SYNCRESET_P0 (0<<2)
246 #define FA125_PROC_CTRL2_SYNCRESET_VME (2<<2)
247 
248 /* 0xD014 proc blocklevel register definitions */
249 #define FA125_PROC_BLOCKLEVEL_MASK 0x0000FFFF
250 
251 /* 0xD018 proc trig_count register definitions */
252 #define FA125_PROC_TRIGCOUNT_MASK 0x7FFFFFFF
253 #define FA125_PROC_TRIGCOUNT_RESET (1<<31)
254 
255 /* 0xD01C proc ev_count register definitions */
256 #define FA125_PROC_EVCOUNT_MASK 0x00FFFFFF
257 
258 /* 0xD020 proc clock125_count register definitions */
259 #define FA125_PROC_CLOCK125COUNT_MASK 0xFFFFFFFF
260 #define FA125_PROC_CLOCK125COUNT_RESET 0
261 
262 /* 0xD024 proc sync_count register definitions */
263 #define FA125_PROC_SYNCCOUNT_MASK 0xFFFFFFFF
264 #define FA125_PROC_SYNCCOUNT_RESET 0
265 
266 /* 0xD028 proc trig2_count register definitions */
267 #define FA125_PROC_TRIG2COUNT_MASK 0xFFFFFFFF
268 #define FA125_PROC_TRIG2COUNT_RESET 0
269 
270 /* 0xD02C pulser_control register definitions */
271 #define FA125_PROC_PULSER_CONTROL_PULSE (1<<0)
272 #define FA125_PROC_PULSER_CONTROL_DELAYED_TRIGGER (1<<1)
273 
274 /* 0xD030 pulser_trig_delay register definitions */
275 #define FA125_PROC_PULSER_TRIG_DELAY_MASK 0x00000FFF
276 #define FA125_PROC_PULSER_WIDTH_MASK 0x00FFF000
277 
278 /* Define data types and masks */
279 #define FA125_DATA_FORMAT0 (0<<13)
280 #define FA125_DATA_FORMAT1 (1<<13)
281 #define FA125_DATA_FORMAT5 (5<<13)
282 
283 #define FA125_DATA_END 0xFE00
284 #define FA125_PAD_WORD 0xF1EA
285 
286 #define FA125_EVNUM_MASK 0x07F0
287 #define FA125_DATA_CHANNEL_MASK 0xFC00
288 #define FA125_DATA_FORMAT_MASK 0xE000
289 #define FA125_DATA_RAW_MASK 0x3FFFF
290 #define FA125_DATA_OVERFLOW_MASK 0x8000
291 
292 #define FA125_DUMMY_DATA 0xf800fafa
293 #define FA125_DATA_TYPE_DEFINE 0x80000000
294 #define FA125_DATA_TYPE_MASK 0x78000000
295 
296 #define FA125_DATA_BLOCK_HEADER 0x00000000
297 #define FA125_DATA_BLOCK_TRAILER 0x08000000
298 #define FA125_DATA_BLKNUM_MASK 0x0000003f
299 
300 /* Define Firmware updating OPCODEs */
301 #define FA125_OPCODE_BUFFER_WRITE 0
302 #define FA125_OPCODE_MAIN_READ 1
303 #define FA125_OPCODE_BUFFER_READ 2
304 #define FA125_OPCODE_BUFFER_PUSH 3
305 #define FA125_OPCODE_ERASE 4
306 
307 /* Define other firmware updating macros */
308 #define FA125_FIRMWARE_MAX_PAGES 8*1024
309 #define FA125_FIRMWARE_MAX_BYTE_PER_PAGE 528
310 
311 /* Define Firmware DEBUG types */
312 typedef enum
313  {
319 #ifndef VXWORKSPPC
321 #endif
323 
324 /* fa125Init initialization flag bits */
325 #define FA125_INIT_VXS_TRIG (0<<1)
326 #define FA125_INIT_INT_TIMER_TRIG (1<<1)
327 #define FA125_INIT_INT_SUM_TRIG (1<<2)
328 #define FA125_INIT_P2_TRIG ((1<<1) | (1<<2))
329 #define FA125_INIT_P2_CLKSRC (0<<4)
330 #define FA125_INIT_VXS_CLKSRC (1<<4)
331 #define FA125_INIT_INT_CLKSRC (1<<5)
332 #define FA125_INIT_SKIP (1<<16)
333 #define FA125_INIT_USE_ADDRLIST (1<<17)
334 #define FA125_INIT_SKIP_FIRMWARE_CHECK (1<<18)
335 
336 /* fa125Status flags */
337 #define FA125_STATUS_SHOWREGS (1<<0)
338 
339 typedef enum
340  {
348 
349 /* Default, maximum and minimum ADC Processing parameters */
350 #define FA125_DEFAULT_PL 50
351 #define FA125_DEFAULT_PTW 50
352 #define FA125_DEFAULT_NSB 5
353 #define FA125_DEFAULT_NSA 10
354 #define FA125_DEFAULT_NP 3
355 
356 #define FA125_MAX_PL 1000
357 #define FA125_MAX_PTW 512
358 #define FA125_MAX_NSB 500
359 #define FA125_MAX_NSA 500
360 #define FA125_MAX_NP 3
361 
362 /* Processing Modes */
363 #define FA125_PROC_MODE_RAWWINDOW 1
364 #define FA125_SUPPORTED_MODES FA125_PROC_MODE_RAWWINDOW
365 #define FA125_SUPPORTED_NMODES 1
366 
367 extern const char *fa125_mode_names[FA125_SUPPORTED_NMODES];
368 
369 /* fadcBlockError values */
370 typedef enum
371  {
379 
381 
382 int fa125Init(UINT32 addr, UINT32 addr_inc, int nadc, int iFlag);
383 int fa125Status(int id, int pflag);
384 void fa125GStatus(int pflag);
385 int fa125SetProcMode(int id, int pmode, unsigned int PL, unsigned int PTW,
386  unsigned int NSB, unsigned int NSA, unsigned int NP);
387 int fa125Slot(unsigned int i);
388 int fa125SetByteSwap(int id, int enable);
389 int fa125PowerOff(int id);
390 int fa125PowerOn(int id);
391 int fa125SetOffset(int id, int chan, int dacData);
392 int fa125SetOffsetFromFile(int id, char *filename);
393 unsigned short fa125ReadOffset(int id, int chan);
394 int fa125ReadOffsetToFile(int id, char *filename);
395 int fa125SetThreshold(int id, unsigned short tvalue, unsigned short chan);
396 int fa125SetChannelDisable(int id, int channel);
397 int fa125SetChannelDisableMask(int id, unsigned int cmask0, unsigned int cmask1, unsigned int cmask2);
398 int fa125SetChannelEnable(int id, int channel);
399 int fa125SetChannelEnableMask(int id, unsigned int cmask0, unsigned int cmask1, unsigned int cmask2);
400 int fa125SetCommonThreshold(int id, unsigned short tvalue);
401 void fa125GSetCommonThreshold(unsigned short tvalue);
402 int fa125PrintThreshold(int id);
403 int fa125SetPulserAmplitude(int id, int chan, int dacData);
404 int fa125SetMulThreshold(int id, int dacData);
405 int fa125PrintTemps(int id);
406 int fa125SetClockSource(int id, int clksrc);
407 int fa125SetTriggerSource(int id, int trigsrc);
408 int fa125GetTriggerSource(int id);
409 int fa125SetSyncResetSource(int id, int srsrc);
410 int fa125Poll(int id);
411 unsigned int fa125GetBerrCount();
412 int fa125Clear(int id);
413 int fa125Enable(int id);
414 int fa125Disable(int id);
415 int fa125Reset(int id, int reset);
416 int fa125ResetCounters(int id);
417 int fa125ResetToken(int id);
418 int fa125GetTokenMask();
419 int fa125SetBlocklevel(int id, int blocklevel);
420 int fa125SoftTrigger(int id);
421 int fa125SetPulserTriggerDelay(int id, int delay);
422 int fa125SetPulserWidth(int id, int width);
423 int fa125SoftPulser(int id, int output);
424 int fa125SetPPG(int id, int fe_chip, unsigned short *sdata, int nsamples);
425 int fa125PPGEnable(int id);
426 int fa125PPGDisable(int id);
427 int fa125ReadEvent(int id, volatile UINT32 *data, int nwrds, unsigned int rflag);
428 int fa125Bready(int id);
429 unsigned int fa125GBready();
430 unsigned int fa125ScanMask();
431 int fa125ReadBlockStatus(int pflag);
432 int fa125ReadBlock(int id, volatile UINT32 *data, int nwrds, int rflag);
433 void fa125DecodeData(unsigned int data);
434 
435 /* Firmware Updating Routine Prototypes */
436 void fa125FirmwareSetDebug(unsigned int debug);
438 int fa125FirmwareReadMcsFile(char *filename);
440 void fa125FirmwarePrintPage(int page);
441 int fa125FirmwareEraseFull(int id);
443 int fa125FirmwareWriteFull(int id);
447 #endif /* __FA125LIB__ */
Definition: fa125Lib.h:343
FA125_FIRMWARE_DEBUG_FLAGS
Definition: fa125Lib.h:312
int fa125SetByteSwap(int id, int enable)
Enable/Disable onboard byteswapping.
Definition: fa125Lib.c:1111
int fa125Status(int id, int pflag)
Print Status of fADC125 to standard out.
Definition: fa125Lib.c:556
volatile UINT32 temperature[2]
Definition: fa125Lib.h:45
int fa125SetChannelEnable(int id, int channel)
Enable a specific fADC125 Channel.
Definition: fa125Lib.c:1590
volatile UINT32 nsa
Definition: fa125Lib.h:72
volatile UINT32 test_waveform
Definition: fa125Lib.h:77
int fa125ReadBlockStatus(int pflag)
Return the block error flag and optionally print out the description to standard out.
Definition: fa125Lib.c:2824
volatile UINT32 csr
Definition: fa125Lib.h:84
volatile UINT32 version
Definition: fa125Lib.h:61
volatile UINT32 ptw_max_buf
Definition: fa125Lib.h:70
volatile UINT32 clock125_count
Definition: fa125Lib.h:91
volatile UINT32 pl
Definition: fa125Lib.h:68
int fa125PrintThreshold(int id)
Print to standarad out the set readout threshold for all fADC125 Channels in the specified module...
Definition: fa125Lib.c:1725
const char * fa125_blockerror_names[FA125_BLOCKERROR_NTYPES]
Definition: fa125Lib.c:2807
int fa125Reset(int id, int reset)
Perform the selected Reset to a specific fADC125.
Definition: fa125Lib.c:2221
Definition: fa125Lib.h:345
int fa125PPGEnable(int id)
Enable the programmable pulse generator.
Definition: fa125Lib.c:2577
Definition: fa125Lib.h:59
int fa125ReadEvent(int id, volatile UINT32 *data, int nwrds, unsigned int rflag)
General Data readout routine. Deprecated. Replaced with fa125ReadBlock.
Definition: fa125Lib.c:2639
int fa125SetProcMode(int id, int pmode, unsigned int PL, unsigned int PTW, unsigned int NSB, unsigned int NSA, unsigned int NP)
Configure the processing type/mode.
Definition: fa125Lib.c:1026
Definition: fa125Lib.h:98
volatile UINT32 ctrl2
Definition: fa125Lib.h:86
UINT32 blank0[(0x20-0x08)/4]
Definition: fa125Lib.h:63
int fa125SetClockSource(int id, int clksrc)
Set the clock source for the specified fADC125.
Definition: fa125Lib.c:1863
#define FA125_SUPPORTED_NMODES
Definition: fa125Lib.h:365
Definition: fa125Lib.h:81
volatile UINT32 clock
Definition: fa125Lib.h:40
volatile UINT32 ptw
Definition: fa125Lib.h:67
volatile UINT32 id
Definition: fa125Lib.h:37
volatile UINT32 adc_async[6]
Definition: fa125Lib.h:64
unsigned short fa125ReadOffset(int id, int chan)
Readback the DAC offset set for a specific fADC125 Channel.
Definition: fa125Lib.c:1377
int fa125SetPPG(int id, int fe_chip, unsigned short *sdata, int nsamples)
Setup fADC125 Progammable Pulse Generator.
Definition: fa125Lib.c:2511
Definition: fa125Lib.h:341
int fa125GetTriggerSource(int id)
Returns the trigger source for the specified fADC125.
Definition: fa125Lib.c:1972
struct fa125_a24_main main
Definition: fa125Lib.h:100
volatile UINT32 slot_ga
Definition: fa125Lib.h:46
int fa125FirmwareReadMcsFile(char *filename)
Read in the firmware from selected MCS file.
Definition: fa125Lib.c:4116
int fa125SetChannelEnableMask(int id, unsigned int cmask0, unsigned int cmask1, unsigned int cmask2)
Enable specific fADC125 Channels using three separate channel masks.
Definition: fa125Lib.c:1633
unsigned int fa125GetBerrCount()
Return the Bus Error count that occurred while checking the busy status.
Definition: fa125Lib.c:2118
Definition: fa125Lib.h:342
Definition: fa125Lib.h:317
volatile UINT32 blockCSR
Definition: fa125Lib.h:48
void fa125FirmwareSetDebug(unsigned int debug)
Set the debugging flags for diagnosing firmware updating problems.
Definition: fa125Lib.c:3534
volatile UINT32 ptw_last_adr
Definition: fa125Lib.h:69
Definition: fa125Lib.h:35
volatile UINT32 threshold[6]
Definition: fa125Lib.h:73
int fa125FirmwareEraseFull(int id)
Erase the entire contents of the configuration ROM of the selected fADC125.
Definition: fa125Lib.c:4346
int fa125FirmwareWriteFull(int id)
Write the contents of the read in MCS file to the selected fADC125 Configuration ROM.
Definition: fa125Lib.c:4628
volatile UINT32 adr32
Definition: fa125Lib.h:50
Definition: fa125Lib.h:106
int fa125SetOffsetFromFile(int id, char *filename)
Set the DAC offset for a specific fADC125 Channel from a specified file.
Definition: fa125Lib.c:1328
volatile UINT32 ctrl1
Definition: fa125Lib.h:49
Definition: fa125Lib.h:375
volatile UINT32 version
Definition: fa125Lib.h:39
volatile UINT32 config1
Definition: fa125Lib.h:74
int fa125Clear(int id)
Clear used with serial acquisition buffers. Deprecated as this is no longer the way to readout data f...
Definition: fa125Lib.c:2130
Definition: fa125Lib.h:377
int fa125Enable(int id)
Enable buffers and FIFOs for data acquisition.
Definition: fa125Lib.c:2155
UINT32 blank2[(0x1000-0x98)/4]
Definition: fa125Lib.h:78
int fa125SetChannelDisableMask(int id, unsigned int cmask0, unsigned int cmask1, unsigned int cmask2)
Disable specific fADC125 Channels using three separate channel masks.
Definition: fa125Lib.c:1538
struct fa125_a24_proc proc
Definition: fa125Lib.h:102
unsigned int fa125GBready()
Return a Block Ready status mask for all initialized fADC125s.
Definition: fa125Lib.c:2767
int fa125SoftTrigger(int id)
Initiate a software trigger for a specific fADC125 module.
Definition: fa125Lib.c:2358
volatile UINT32 busy_level
Definition: fa125Lib.h:52
volatile UINT32 acqfifo[6]
Definition: fa125Lib.h:66
volatile UINT32 ev_count
Definition: fa125Lib.h:90
void fa125FirmwarePrintPage(int page)
Prints the selected firmware page to standard out.
Definition: fa125Lib.c:4316
UINT32 blank1[(0x40-0x38)/4]
Definition: fa125Lib.h:65
int fa125PrintTemps(int id)
Print the temperature of the main board and mezzanine to standard out.
Definition: fa125Lib.c:1828
int fa125PPGDisable(int id)
Disable the programmable pulse generator.
Definition: fa125Lib.c:2603
volatile UINT32 trig_count
Definition: fa125Lib.h:89
UINT32 blank1[(0x1000-0x60)/4]
Definition: fa125Lib.h:56
int fa125SoftPulser(int id, int output)
Trigger the pulser.
Definition: fa125Lib.c:2457
volatile UINT32 configCSR
Definition: fa125Lib.h:54
FA125_FIRMWARE_ERROR_FLAGS
Definition: fa125Lib.h:339
volatile UINT32 block_count
Definition: fa125Lib.h:53
int fa125Poll(int id)
Poll the specified fADC125's busy status.
Definition: fa125Lib.c:2055
int fa125Bready(int id)
Return a Block Ready status.
Definition: fa125Lib.c:2743
int fa125PowerOn(int id)
Power On the fADC125.
Definition: fa125Lib.c:1178
volatile UINT32 pulser_control
Definition: fa125Lib.h:94
int fa125SetPulserWidth(int id, int width)
Set the width of the output pulse.
Definition: fa125Lib.c:2418
Definition: fa125Lib.h:320
int fa125FirmwareGVerifyFull()
Verify that the firmware has been written correctly to all initialized fADC125s.
Definition: fa125Lib.c:3997
volatile UINT32 serial[4]
Definition: fa125Lib.h:44
int fa125FirmwareGEraseFull()
Erase the entire contents of the configuration ROM for all initialized fADC125s.
Definition: fa125Lib.c:4455
Definition: fa125Lib.h:316
Definition: fa125Lib.h:346
int fa125ReadOffsetToFile(int id, char *filename)
Readback the DAC offset set for a specific fADC125 Channel into a specified file. ...
Definition: fa125Lib.c:1406
int fa125SetPulserAmplitude(int id, int chan, int dacData)
Set the output Pulser Amplitude for the specified connector.
Definition: fa125Lib.c:1771
int fa125FirmwareGCheckErrors()
Print to standard out the results of the firmware update for each initialized fADC125.
Definition: fa125Lib.c:4967
int fa125SetThreshold(int id, unsigned short tvalue, unsigned short chan)
Set the readout threshold for a specific fADC125 Channel.
Definition: fa125Lib.c:1456
volatile UINT32 swapctl
Definition: fa125Lib.h:38
const char * fa125_mode_names[FA125_SUPPORTED_NMODES]
Definition: fa125Lib.c:5026
int fa125FirmwareGWriteFull()
Write the contents of the read in MCS file to the Configuration ROM of all initialized fADC125s...
Definition: fa125Lib.c:4744
volatile UINT32 dacctl
Definition: fa125Lib.h:42
int fa125Slot(unsigned int i)
Convert an index into a slot number, where the index is the element of an array of fA125s in the orde...
Definition: fa125Lib.c:535
int fa125ReadBlock(int id, volatile UINT32 *data, int nwrds, int rflag)
General Data readout routine.
Definition: fa125Lib.c:2857
volatile UINT32 pwrctl
Definition: fa125Lib.h:41
volatile UINT32 sync_count
Definition: fa125Lib.h:92
int fa125SetMulThreshold(int id, int dacData)
Set the multiplicity sum for an internal trigger.
Definition: fa125Lib.c:1803
int fa125SetPulserTriggerDelay(int id, int delay)
Set the delay between the output pulse and f1TDC trigger.
Definition: fa125Lib.c:2384
volatile UINT32 trig2_count
Definition: fa125Lib.h:93
volatile UINT32 data
Definition: fa125Lib.h:108
int fa125SetCommonThreshold(int id, unsigned short tvalue)
Set a common readout threshold for all fADC125 Channels.
Definition: fa125Lib.c:1689
int fa125SetBlocklevel(int id, int blocklevel)
Set the number of events in the block.
Definition: fa125Lib.c:2334
Definition: fa125Lib.h:373
volatile UINT32 version
Definition: fa125Lib.h:83
int fa125SetSyncResetSource(int id, int srsrc)
Set the Sync Reset source for the specified fADC125.
Definition: fa125Lib.c:2000
volatile UINT32 trig_count
Definition: fa125Lib.h:75
Definition: fa125Lib.h:344
Definition: fa125Lib.h:314
void fa125GSetCommonThreshold(unsigned short tvalue)
Set a common readout threshold for all fADC125 Channels for all initialized modules.
Definition: fa125Lib.c:1708
void fa125DecodeData(unsigned int data)
Decode a data word from an fADC125 and print to standard out.
Definition: fa125Lib.c:3142
volatile UINT32 trigsrc
Definition: fa125Lib.h:85
FA125_BLOCKERROR_FLAGS
Definition: fa125Lib.h:370
volatile UINT32 test
Definition: fa125Lib.h:62
int fa125Init(UINT32 addr, UINT32 addr_inc, int nadc, int iFlag)
Initialize the fa125 Library.
Definition: fa125Lib.c:128
int fa125GetTokenMask()
Return the slot mask of modules with the token.
Definition: fa125Lib.c:2311
void fa125FirmwarePrintFPGAStats()
Prints to standard out, the memory size and location of each FPGA firmware.
Definition: fa125Lib.c:4297
Definition: fa125Lib.h:376
Definition: fa125Lib.h:374
volatile UINT32 softtrig
Definition: fa125Lib.h:87
int fa125Disable(int id)
Disable buffers and FIFOs for data acquisition.
Definition: fa125Lib.c:2187
volatile UINT32 pulser_trig_delay
Definition: fa125Lib.h:95
volatile UINT32 adr_mb
Definition: fa125Lib.h:51
volatile UINT32 config2
Definition: fa125Lib.h:76
volatile UINT32 a32_ba
Definition: fa125Lib.h:47
Definition: fa125Lib.h:318
int fa125ResetCounters(int id)
Reset all counters (trigger count, clock count, sync reset count, trig2 count)
Definition: fa125Lib.c:2260
volatile UINT32 nsb
Definition: fa125Lib.h:71
volatile UINT32 blocklevel
Definition: fa125Lib.h:88
struct fa125_a24_fe fe[12]
Definition: fa125Lib.h:101
int fa125SetOffset(int id, int chan, int dacData)
Set the DAC offset for a specific fADC125 Channel.
Definition: fa125Lib.c:1285
int fa125PowerOff(int id)
Power Off the fADC125.
Definition: fa125Lib.c:1139
int fa125SetTriggerSource(int id, int trigsrc)
Set the trigger source for the specified fADC125.
Definition: fa125Lib.c:1915
Definition: fa125Lib.h:372
UINT32 blank0[(0x20-0x18)/4]
Definition: fa125Lib.h:43
int fa125SetChannelDisable(int id, int channel)
Disable a specific fADC125 Channel.
Definition: fa125Lib.c:1496
Definition: fa125Lib.h:315
volatile UINT32 configAdrData
Definition: fa125Lib.h:55
void fa125GStatus(int pflag)
Print a summary of all initialized fADC1250s.
Definition: fa125Lib.c:785
int fa125ResetToken(int id)
Returns the token to the first module This routine only has an effect on the first module of the Mult...
Definition: fa125Lib.c:2287
unsigned int fa125ScanMask()
Return the vme slot mask of all initialized fADC125s.
Definition: fa125Lib.c:2794
void fa125FirmwarePrintTimes()
Print the time it took for each firmware update step to standard out. debug = FA125_FIRMWARE_DEBUG_ME...
Definition: fa125Lib.c:4913