JLab f1TDC-V2,V3 Library  V2:0x0e,V3:0x15
 All Data Structures Files Functions Variables Typedefs Macros Groups
f1tdcLib.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3  * f1tdcLib.h - Driver library for JLAB config and readout of JLAB F1
4  * TDC v2/v3 using a VxWorks 5.4 or later, or Linux
5  * based Single Board computer.
6  *
7  * Authors: David Abbott
8  * Jefferson Lab Data Acquisition Group
9  * August 2003
10  *
11  * Bryan Moffit
12  * Jefferson Lab Data Acquisition Group
13  * July 2013
14  *
15  */
16 
17 #ifndef __F1TDCLIB__
18 #define __F1TDCLIB__
19 
20 #define F1_BOARD_ID 0xf10000
21 #define F1_MAX_BOARDS 20
22 #define F1_MAX_TDC_CHANNELS 64
23 #define F1_MAX_HITS_PER_CHANNEL 8
24 #define F1_MAX_TDC_CHIPS 8
25 #define F1_MAX_A32_MEM 0x800000 /* 8 Meg */
26 #define F1_MAX_A32MB_SIZE 0x1000000 /* 16 MB */
27 #define F1_VME_INT_LEVEL 2
28 #define F1_VME_INT_VEC 0xEE
29 
30 #define F1_SUPPORTED_V2_FIRMWARE 0x0e
31 #define F1_SUPPORTED_V3_FIRMWARE 0x15
32 #define F1_SUPPORTED_FIRMWARE(x) ((x==2)? F1_SUPPORTED_V2_FIRMWARE : F1_SUPPORTED_V3_FIRMWARE)
33 
34 /* Define structure for access to F1 config and control registers */
35 struct f1tdc_struct
36 {
37  /* 0x0000 */ volatile unsigned int version;
38  /* 0x0004 */ volatile unsigned int csr;
39  /* 0x0008 */ volatile unsigned int ctrl;
40  /* 0x000C */ volatile unsigned int ev_count;
41  /* 0x0010 */ volatile unsigned int blocklevel;
42  /* 0x0014 */ volatile unsigned int intr;
43  /* 0x0018 */ volatile unsigned int adr32;
44  /* 0x001C */ volatile unsigned int adr_mb;
45  /* 0x0020 */ volatile unsigned short stat[8];
46  /* 0x0030 */ volatile unsigned int scaler1;
47  /* 0x0034 */ volatile unsigned int scaler2;
48  /* 0x0038 */ unsigned int blank0;
49  /* 0x003C */ volatile unsigned int config;
50  /* 0x0040 */ volatile unsigned int ctrl2;
51  /* 0x0044 */ volatile unsigned int config_csr;
52  /* 0x0048 */ volatile unsigned int config_data;
53  /* 0x004C */ volatile unsigned int serial_eprom;
54  /* 0x0050 */ volatile unsigned int trig2_scaler;
55  /* 0x0054 */ volatile unsigned int sync_scaler;
56  /* 0x0058 */ volatile unsigned int test_scaler;
57  /* 0x005C */ volatile unsigned int token_test;
58  /* 0x0060 */ volatile unsigned int token_test_scaler;
59  /* 0x0064 */ volatile unsigned int pulser_delay; /* V3 only */
60  /* 0x0068 */ volatile unsigned int pulser_dac; /* V3 only */
61  /* 0x006C */ volatile unsigned int pulser_control; /* V3 only */
62  /* 0x0070 */ volatile unsigned int block_count;
63  /* 0x0074 */ volatile unsigned int block_fifo_count;
64  /* 0x0078 */ volatile unsigned int block_word_count_fifo;
65  /* 0x007C */ volatile unsigned int status_spare;
66  /* 0x0080 */ volatile unsigned int test_config;
67  /* 0x0084 */ volatile unsigned int clock_scaler;
68  /* 0x0088 */ volatile unsigned int p0_sync_scaler;
69  /* 0x008C */ volatile unsigned int p0_trig1_scaler;
70  /* 0x0090 */ volatile unsigned int p0_trig2_scaler;
71  /* 0x0094 */ volatile unsigned int test_spare[3];
72 };
73 
74 /* Define version bits */
75 #define F1_VERSION_FIRMWARE_MASK 0xFF
76 #define F1_VERSION_BOARDREV_MASK 0xFF00
77 #define F1_VERSION_BOARDTYPE_MASK 0xFFFF0000
78 
79 /* Define iFlag bits in f1Init(..) */
80 #define F1_SRSRC_SOFT (0<<0)
81 #define F1_SRSRC_EXT (1<<0)
82 #define F1_SRSRC_FP F1_SRSRC_EXT
83 #define F1_SRSRC_VXS F1_SRSRC_EXT
84 #define F1_SRSRC_MASK 0x1
85 #define F1_TRIGSRC_SOFT (0<<1)
86 #define F1_TRIGSRC_FP (1<<1)
87 #define F1_TRIGSRC_VXS (2<<1)
88 #define F1_TRIGSRC_MASK 0x6
89 #define F1_CLKSRC_INT (0<<4)
90 #define F1_CLKSRC_FP (1<<4)
91 #define F1_CLKSRC_VXS (2<<4)
92 #define F1_CLKSRC_MASK 0x30
93 #define F1_IFLAG_NOINIT (1<<16)
94 #define F1_IFLAG_USELIST (1<<17)
95 #define F1_IFLAG_NOFWCHECK (1<<18)
96 
97 /* Define CSR bits */
98 #define F1_CSR_MASK 0x7ffff
99 /* #define F1_CSR_ENABLE_INPUTS 0x1 */
100 /* #define F1_CSR_CONFIG_ERROR 0x2 */
101 #define F1_CSR_REFCLK_PLL_LOCKED (1<<0)
102 #define F1_CSR_BOARDCLK_PLL_LOCKED (1<<1)
103 #define F1_CSR_CONFIG_ERROR (1<<2)
104 /* #define F1_CSR_CONFIG_ACTIVE 0x4 */
105 #define F1_CSR_BLOCK_ACCEPTED (1<<3)
106 #define F1_CSR_BLOCK_READY (1<<4)
107 #define F1_CSR_BERR_STATUS (1<<5)
108 #define F1_CSR_TOKEN_STATUS (1<<6)
109 #define F1_CSR_MODULE_EMPTY (1<<7)
110 #define F1_CSR_ERROR_MASK 0xFF00
111 #define F1_CSR_ERROR_TDC0 (1<<8)
112 #define F1_CSR_ERROR_TDC1 (1<<9)
113 #define F1_CSR_ERROR_TDC2 (1<<10)
114 #define F1_CSR_ERROR_TDC3 (1<<11)
115 #define F1_CSR_ERROR_TDC4 (1<<12)
116 #define F1_CSR_ERROR_TDC5 (1<<13)
117 #define F1_CSR_ERROR_TDC6 (1<<14)
118 #define F1_CSR_ERROR_TDC7 (1<<15)
119 /* #define F1_CSR_NEXT_BUF_NO 0x10000 */
120 #define F1_CSR_BUF0_EMPTY (1<<17)
121 #define F1_CSR_BUF1_EMPTY (1<<18)
122 /* #define F1_CSR_EOB_FLAG 0x80000 */
123 #define F1_CSR_TOKEN_RETURN (1<<24)
124 /* #define F1_CSR_FILLER_FLAG 0x100000 */
125 /* #define F1_CSR_EXTFIFO_EMPTY 0x200000 */
126 /* #define F1_CSR_PULSE_SPARE_OUT 0x10000000 */
127 #define F1_CSR_START (1<<27)
128 #define F1_CSR_SYNC_RESET (1<<28)
129 #define F1_CSR_TRIGGER (1<<29)
130 #define F1_CSR_SOFT_RESET (1<<30)
131 #define F1_CSR_HARD_RESET (1<<31)
132 
133 /* Define Control Register bits */
134 #define F1_CONTROL_MASK 0xffffffff
135 #define F1_CTRL_SIGNALS_MASK 0x000003ff
136 /* #define F1_FB_SEL (1<<0) */
137 /* #define F1_REF_CLK_PCB (1<<1) */
138 /* #define F1_REF_CLK_SEL (1<<2) */
139 #define F1_REFCLK_SRC_MASK 0x7
140 #define F1_REFCLK_SRC_INTERNALFP (1<<0)
141 #define F1_REFCLK_INTERNAL_ENABLE (1<<1)
142 #define F1_REFCLK_SRC_FP (1<<2)
143 #define F1_SYNC_RESET_SRC_MASK 0x18
144 #define F1_SYNC_RESET_SRC_FP (1<<3)
145 #define F1_SYNC_RESET_SRC_P0 (2<<3)
146 #define F1_SYNC_RESET_SRC_SOFT (3<<3)
147 #define F1_TRIGGER_SRC_MASK 0x60
148 #define F1_TRIGGER_SRC_FP (1<<5)
149 #define F1_TRIGGER_SRC_P0 (2<<5)
150 #define F1_TRIGGER_SRC_SOFT (3<<5)
151 #define F1_START_SRC_MASK 0x180
152 #define F1_START_SRC_FP (1<<7)
153 #define F1_START_SRC_P0 (2<<7)
154 #define F1_START_SRC_SOFT (3<<7)
155 /* #define F1_EVENT_LEVEL_INT 0x8 */
156 /* #define F1_ERROR_INT 0x10 */
157 #define F1_ENABLE_SOFT_CONTROL (1<<9)
158 #define F1_INT_ENABLE (1<<24)
159 #define F1_ENABLE_BERR (1<<25)
160 #define F1_ENABLE_MULTIBLOCK (1<<26)
161 #define F1_FIRST_BOARD (1<<27)
162 #define F1_LAST_BOARD (1<<28)
163 #define F1_MB_TOKEN_P0 (1<<29)
164 #define F1_MB_TOKEN_P2 (1<<30)
165 #define F1_MB_CONFIG_MASK 0x7c000000
166 /* #define F1_ENABLE_HEADERS 0x400 */
167 /* #define F1_ENABLE_FP_BUSY 0x800 */
168 /* #define F1_ENABLE_SPARE_OUT 0x1000 */
169 /* #define F1_ENABLE_DATA_TDC0 0x10000 */
170 /* #define F1_ENABLE_DATA_TDC1 0x20000 */
171 /* #define F1_ENABLE_DATA_TDC2 0x40000 */
172 /* #define F1_ENABLE_DATA_TDC3 0x80000 */
173 /* #define F1_ENABLE_DATA_TDC4 0x100000 */
174 /* #define F1_ENABLE_DATA_TDC5 0x200000 */
175 /* #define F1_ENABLE_DATA_TDC6 0x400000 */
176 /* #define F1_ENABLE_DATA_TDC7 0x800000 */
177 
178 /* Define ev_count bits */
179 #define F1_EVENT_COUNT_MASK 0x00FFFFFF
180 
181 /* Define blocklevel bits */
182 #define F1_BLOCKLEVEL_MASK 0xFFFF
183 
184 /* Define intr bits */
185 #define F1_INT_VEC_MASK 0xff
186 #define F1_INT_LEVEL_MASK 0x700
187 #define F1_SLOT_ID_MASK 0x1f0000
188 
189 /* Define adr32 bits */
190 #define F1_A32_ENABLE (1<<0)
191 #define F1_A32_ADDR_MASK 0xffc0
192 
193 /* define adr_mb bits */
194 #define F1_AMB_ENABLE (1<<0)
195 #define F1_AMB_MIN_MASK 0xffc0
196 #define F1_AMB_MAX_MASK 0xffc00000
197 
198 
199 /* Define Chip status register Bits */
200 #define F1_CHIP_RES_LOCKED (1<<0)
201 #define F1_CHIP_HITFIFO_OVERFLOW (1<<1)
202 #define F1_CHIP_TRIGFIFO_OVERFLOW (1<<2)
203 #define F1_CHIP_OUTFIFO_OVERFLOW (1<<3)
204 #define F1_CHIP_EXTFIFO_FULL (1<<4)
205 #define F1_CHIP_EXTFIFO_ALMOST_FULL (1<<5)
206 #define F1_CHIP_EXTFIFO_EMPTY (1<<6)
207 #define F1_CHIP_INITIALIZED (1<<7)
208 #define F1_CHIP_LOSS_OF_LOCK_OCCURRED (1<<8)
209 #define F1_CHIP_CLEAR_STATUS (1<<15)
210 #define F1_CHIP_ERROR_COND 0x1f1e
211 #define F1_CHIP_STAT_MASK 0x007e
212 #define F1_CHIP_LATCH_STAT_MASK 0x1f00
213 
214 /* Define CONFIG REGISTER Bits */
215 #define F1_HIREZ_MODE 0x8000
216 
217 #define F1_CONFIG_CHIP_MASK 0x00E00000
218 #define F1_CONFIG_COMMON (1<<20)
219 #define F1_CONFIG_REG_MASK 0x000F0000
220 #define F1_CONFIG_DATA_MASK 0x0000FFFF
221 
222 /* Define ctrl2 bits */
223 #define F1_GO_DATA (1<<0)
224 #define F1_FORCE_BUSY (1<<15)
225 #define F1_SYSTEM_TEST_MODE (1<<16)
226 #define F1_SINGLE_BOARD_TEST_MODE (1<<17)
227 #define F1_TRIGGER_LED_ENABLE (1<<18)
228 #define F1_STATUS_LED_ENABLE (1<<19)
229 
230 /* Define config_csr bits */
231 #define F1_CONFIG_CSR_WRITE_EN (1<<31)
232 #define F1_CONFIG_CSR_BULK_ERASE (1<<30)
233 #define F1_CONFIG_CSR_SECTOR_ERASE (1<<29)
234 #define F1_CONFIG_CSR_SECTOR_BUSY (1<<8)
235 #define F1_CONFIG_CSR_LAST_DATA_MASK 0xFF
236 
237 /* Define config_data bits */
238 #define F1_CONFIG_DATA_ADDR_MASK 0xFFFFFF00
239 #define F1_CONFIG_DATA_DATA_MASK 0x000000FF
240 
241 /* Define Bit Masks */
242 #ifdef NOTSURE
243 /* #define F1_VERSION_MASK 0x00ff */
244 /* #define F1_BOARD_MASK 0xff00 */
245 /* #define F1_CSR_ERROR_MASK 0x0000ff00 */
246 #define F1_CONTROL_SEL_MASK 0x7
247 #define F1_EVENT_LEVEL_MASK 0xffff
248 #define F1_INT_ENABLE_MASK 0x18
249 #define F1_MODULE_EMPTY_MASK (F1_CSR_ZERO_EVENTS_FLAG | F1_CSR_BUF0_EMPTY | F1_CSR_BUF1_EMPTY | F1_CSR_EXTFIFO_EMPTY)
250 #endif/* NOTSURE */
251 
252 /* #define F1_SDC_MASK 0xfff0 */
253 /* #define F1_BDC_MASK 0x0008 */
254 
255 #define F1_ALL_CHIPS 0xff
256 #define F1_OFFSET_MASK 0x3f3f
257 #define F1_ENABLE_EDGES 0x4040 /* Rising edges only - default */
258 #define F1_ENABLE_DUAL_EDGES 0xc0c0 /* Both rising and falling edges */
259 #define F1_DISABLE_EDGES_ODD 0xff3f
260 #define F1_DISABLE_EDGES_EVEN 0x3fff
261 #define F1_DISABLE_EDGES 0x3f3f
262 
263 /* Define pulser register bits and masks - V3 only */
264 #define F1_PULSER_DELAY_MASK 0x00000fff
265 #define F1_PULSER_DAC_RESET 0x002f0000
266 #define F1_PULSER_DAC_INT_REF 0x003f0001
267 #define F1_PULSER_DAC_MASK 0x0000fff0
268 #define F1_PULSER_DAC_A_VALUE 0x00000000
269 #define F1_PULSER_DAC_B_VALUE 0x00010000
270 #define F1_PULSER_DAC_BOTH_VALUE 0x00070000
271 #define F1_PULSER_PULSE_OUT (1<<0)
272 #define F1_PULSER_TRIGGER_OUT (1<<1)
273 
274 /* define test_config register bits */
275 #define F1_TEST_TRIG_OUT (1<<0)
276 #define F1_TEST_BUSY_OUT (1<<1)
277 #define F1_TEST_SDLINK_OUT (1<<2)
278 #define F1_TEST_TOKEN_OUT (1<<3)
279 #define F1_TEST_STATBITB_IN (1<<8)
280 #define F1_TEST_TOKEN_IN (1<<9)
281 #define F1_TEST_CLOCK_COUNTER_STATUS (1<<15)
282 
283 /* define scaler register bits */
284 #define F1_CLOCK_SCALER_RESET 0
285 #define F1_CLOCK_SCALER_START 0
286 #define F1_SYNC_SCALER_RESET 0
287 #define F1_TRIG1_SCALER_RESET 0
288 #define F1_TRIG2_SCALER_RESET 0
289 
290 #define F1_DATA_TYPE_DEFINE 0x80000000
291 #define F1_DATA_TYPE_MASK 0x78000000
292 #define F1_DATA_SLOT_MASK 0x07c00000
293 
294 #define F1_DATA_BLOCK_HEADER 0x00000000
295 #define F1_DATA_BLOCK_TRAILER 0x08000000
296 #define F1_DATA_EVENT_HEADER 0x10000000
297 #define F1_DATA_TRIGGER_TIME 0x18000000
298 #define F1_DATA_WINDOW_RAW 0x20000000
299 #define F1_DATA_WINDOW_SUM 0x28000000
300 #define F1_DATA_PULSE_RAW 0x30000000
301 #define F1_DATA_PULSE_INTEGRAL 0x38000000
302 #define F1_DATA_PULSE_TIME 0x40000000
303 #define F1_DATA_STREAM 0x48000000
304 #define F1_DATA_INVALID 0x70000000
305 #define F1_DATA_FILLER 0x78000000
306 
307 #define F1_DATA_BLKNUM_MASK 0x0000003f
308 #define F1_DATA_WRDCNT_MASK 0x003fffff
309 #define F1_DATA_TRIGNUM_MASK 0x07ffffff
310 
311 
312 #define F1_DATA_TDC_MASK 0x00ffffff
313 #define F1_DATA_FLAG_MASK 0x07000000
314 /* #define F1_DATA_SLOT_MASK 0xf8000000 */
315 /* #define F1_DATA_INVALID 0xf0000000 */
316 
317 /* #define F1_DATA_TYPE_MASK 0x00800000 */
318 #define F1_DATA_CHIP_MASK 0x00380000
319 #define F1_DATA_CHAN_MASK 0x00070000
320 #define F1_DATA_TIME_MASK 0x0000ffff
321 
322 #define F1_HEAD_DATA 0x00000000
323 #define F1_TAIL_DATA 0x00000007
324 #define F1_DUMMY_DATA 0xf800ffff /* Filler word (Type 15) */
325 
326 #define F1_HT_DATA_MASK 0x00800007
327 #define F1_HT_CHAN_MASK 0x00000007
328 #define F1_HT_CHIP_MASK 0x00000038
329 #define F1_HT_XOR_MASK 0x00000040
330 #define F1_HT_TRIG_MASK 0x0000ff80
331 #define F1_HT_EVENT_MASK 0x003f0000
332 #define F1_HT_TRIG_OVF_MASK 0x00400000
333 
334 
335 /* Define some macros */
336 
337 
338 /* Define Prototypes */
339 int f1Init (unsigned int addr, unsigned int addr_inc, int ntdc, int iFlag);
340 int f1Slot(unsigned int i);
341 int f1ConfigWrite(int id, int *config_data, int chipMask);
342 int f1GConfigWrite(int *config_data, int chipMask);
343 int f1SetConfig(int id, int iflag, int chipMask);
344 int f1ConfigRead(int id, unsigned int *config_data, int chipID);
345 int f1ConfigReadFile(char *filename);
346 void f1ConfigShow(int id, int chipMask);
347 int f1GetSerialNumber(int id, char **rval);
348 int f1GetFirmwareVersion(int id, int pflag);
349 void f1Status(int id, int sflag);
350 void f1GStatus(int sFlag);
351 void f1ChipStatus(int id, int pflag);
352 int f1ReadBlock(int id, volatile unsigned int *data, int nwrds, int rflag);
353 int f1PrintEvent(int id, int rflag);
354 int f1FlushEvent(int id);
355 int f1GPrintEvent(int rflag);
356 void f1Clear(int id);
357 void f1GClear();
358 void f1ClearStatus(int id, unsigned int chipMask);
359 void f1GClearStatus(unsigned int chipMask);
360 unsigned int f1ErrorStatus(int id, int sflag);
361 unsigned int f1GErrorStatus(int sflag);
362 int f1CheckLock(int id);
363 int f1GCheckLock(int pflag);
364 void f1Reset(int id, int iFlag);
365 void f1SyncReset(int id);
366 void f1GSyncReset();
367 void f1Trig(int id);
368 void f1GTrig();
369 void f1Start(int id);
370 void f1GStart();
371 int f1Dready(int id);
372 unsigned int f1GBready();
373 int f1DataScan(int pflag);
374 unsigned int f1ScanMask();
375 int f1GetRez(int id);
376 int f1SetWindow(int id, int window, int latency, int chipMask);
377 void f1GSetWindow(int window, int latency, int chipMask);
378 unsigned int f1ReadCSR(int id);
379 int f1WriteControl(int id, unsigned int val);
380 void f1GWriteControl(unsigned int val);
381 int f1Enable(int id);
382 int f1GEnable();
383 int f1Disable(int id);
384 int f1GDisable();
385 int f1Enabled(int id);
386 int f1EnableData(int id, int chipMask);
387 void f1GEnableData(int chipMask);
388 int f1DisableData(int id);
389 int f1DisableChannel(int id, int input);
390 int f1EnableChannel(int id, int input);
391 void f1DisableChannelMask(int id, unsigned long long int mask);
392 void f1EnableChannelMask(int id, unsigned long long int mask);
393 void f1EnableClk(int id, int cflag);
394 void f1DisableClk(int id);
395 unsigned int f1EnableLetra(int id, int chipMask);
396 unsigned int f1DisableLetra(int id, int chipMask);
397 void f1EnableSoftTrig(int id);
398 void f1GEnableSoftTrig();
399 void f1DisableSoftTrig(int id);
400 void f1EnableBusError(int id);
401 void f1GEnableBusError();
402 void f1DisableBusError(int id);
403 int f1SetBlockLevel(int id, int level);
404 void f1GSetBlockLevel(int level);
405 void f1EnableMultiBlock(int tflag);
406 void f1DisableMultiBlock();
407 void f1ResetToken(int id);
408 int f1ResetPulser(int id);
409 int f1SetPulserTriggerDelay(int id, int delay);
410 int f1SetPulserDAC(int id, int output, int dac);
411 int f1SoftPulser(int id, int output);
412 
413 void f1TestSetSystemTestMode(int id, int mode);
414 void f1TestSetTrigOut(int id, int mode);
415 void f1TestSetBusyOut(int id, int mode);
416 void f1TestSetSdLink(int id, int mode);
417 void f1TestSetTokenOut(int id, int mode);
418 int f1TestGetStatBitB(int id);
419 int f1TestGetTokenIn(int id);
420 int f1TestGetClockCounterStatus(int id);
421 unsigned int f1TestGetClockCounter(int id);
422 unsigned int f1TestGetSyncCounter(int id);
423 unsigned int f1TestGetTrig1Counter(int id);
424 unsigned int f1TestGetTrig2Counter(int id);
425 void f1TestResetClockCounter(int id);
426 void f1TestResetSyncCounter(int id);
427 void f1TestResetTrig1Counter(int id);
428 void f1TestResetTrig2Counter(int id);
429 
430 void f1DataDecode(int id, unsigned int data);
431 
432 /* Firmware tools prototypes */
433 int f1FirmwareReadFile(char *filename);
434 int f1FirmwareEraseEPROM(int id);
436 int f1FirmwareDownloadConfigData(int id, int print_header);
438 int f1FirmwareVerifyDownload(int id, int print_header);
440 
441 #endif
void f1TestResetTrig1Counter(int id)
Reset the counter of the trig1 scaler.
Definition: f1tdcLib.c:4900
unsigned int f1DisableLetra(int id, int chipMask)
Disable lead and trailing edges for the f1TDC chips indicated by the chipMask for the module...
Definition: f1tdcLib.c:3877
void f1EnableSoftTrig(int id)
Enable software triggers on the module.
Definition: f1tdcLib.c:3906
int f1GetRez(int id)
Return the mask of f1TDCs chips on the module that are set in high resolution mode.
Definition: f1tdcLib.c:2855
int f1Slot(unsigned int i)
Convert an index into a slot number, where the index is the element of an array of F1TDCs in the orde...
Definition: f1tdcLib.c:621
void f1GStatus(int sFlag)
Print Status of all initialized f1TDCs to standard out.
Definition: f1tdcLib.c:1536
volatile unsigned int p0_trig2_scaler
Definition: f1tdcLib.h:70
int f1Init(unsigned int addr, unsigned int addr_inc, int ntdc, int iFlag)
volatile unsigned int test_config
Definition: f1tdcLib.h:66
void f1EnableClk(int id, int cflag)
Enable the specified clock source on the module.
Definition: f1tdcLib.c:3765
volatile unsigned int adr_mb
Definition: f1tdcLib.h:44
void f1GSetWindow(int window, int latency, int chipMask)
Set the window parameters for specified f1TDC chips in chipMask for all initialized modules...
Definition: f1tdcLib.c:2996
unsigned int f1EnableLetra(int id, int chipMask)
Enable lead and trailing edges for the f1TDC chips indicated by the chipMask for the module...
Definition: f1tdcLib.c:3846
int f1DisableData(int id)
Disable data on all f1TDC chips for the module.
Definition: f1tdcLib.c:3328
volatile unsigned short stat[8]
Definition: f1tdcLib.h:45
void f1GSyncReset()
Perform a software Sync Reset for all initialized modules.
Definition: f1tdcLib.c:2539
void f1Clear(int id)
Perform a soft reset on the f1TDC module.
Definition: f1tdcLib.c:2157
int f1ConfigReadFile(char *filename)
Read in user defined (4) f1TDC chip registers from specified file.
Definition: f1tdcLib.c:1033
void f1TestSetTrigOut(int id, int mode)
Set the level of Trig Out to the SD.
Definition: f1tdcLib.c:4471
void f1SyncReset(int id)
Perform a software Sync Reset on the module.
Definition: f1tdcLib.c:2506
volatile unsigned int block_word_count_fifo
Definition: f1tdcLib.h:64
int f1TestGetStatBitB(int id)
Get the level of the StatBitB to the SD.
Definition: f1tdcLib.c:4620
int f1SetConfig(int id, int iflag, int chipMask)
Set which preset/user configuration to use for specified slot id for indicated chips in chipmask...
Definition: f1tdcLib.c:914
void f1GClearStatus(unsigned int chipMask)
Clear the latched error status of specified f1TDC chips in the chipMask in all initialized f1TDCs...
Definition: f1tdcLib.c:2241
int f1FirmwareGDownloadConfigData()
void f1Start(int id)
Issue a software Start signal to the module.
Definition: f1tdcLib.c:2647
volatile unsigned int pulser_control
Definition: f1tdcLib.h:61
int f1EnableChannel(int id, int input)
Enable an individual channel input.
Definition: f1tdcLib.c:3516
unsigned int f1ScanMask()
Return the mask of all initialized modules.
Definition: f1tdcLib.c:2832
volatile unsigned int test_scaler
Definition: f1tdcLib.h:56
volatile unsigned int block_fifo_count
Definition: f1tdcLib.h:63
unsigned int f1TestGetSyncCounter(int id)
Return the value of the SyncReset scaler.
Definition: f1tdcLib.c:4748
int f1FirmwareVerifyDownload(int id, int print_header)
volatile unsigned int block_count
Definition: f1tdcLib.h:62
int f1WriteControl(int id, unsigned int val)
Write provided value to the CTRL register of the module.
Definition: f1tdcLib.c:3049
void f1TestResetTrig2Counter(int id)
Reset the counter of the trig2 scaler.
Definition: f1tdcLib.c:4927
volatile unsigned int status_spare
Definition: f1tdcLib.h:65
volatile unsigned int trig2_scaler
Definition: f1tdcLib.h:54
void f1GEnableData(int chipMask)
Enable data on f1TDC chips specified in chipMask for all initialized modules.
Definition: f1tdcLib.c:3306
unsigned int f1TestGetTrig1Counter(int id)
Return the value of the trig1 scaler.
Definition: f1tdcLib.c:4780
int f1Disable(int id)
Disable f1TDC FPGA data fifo on the module.
Definition: f1tdcLib.c:3145
void f1TestResetSyncCounter(int id)
Reset the counter of the SyncReset scaler.
Definition: f1tdcLib.c:4872
int f1ReadBlock(int id, volatile unsigned int *data, int nwrds, int rflag)
volatile unsigned int ctrl2
Definition: f1tdcLib.h:50
volatile unsigned int p0_sync_scaler
Definition: f1tdcLib.h:68
void f1TestSetSystemTestMode(int id, int mode)
Enable/Disable System test mode.
Definition: f1tdcLib.c:4427
int f1SetPulserDAC(int id, int output, int dac)
Set the DAC level for the outgoing pulse.
Definition: f1tdcLib.c:4302
int f1FirmwareEraseEPROM(int id)
int f1SetWindow(int id, int window, int latency, int chipMask)
Set the window parameters for specified f1TDC chips in chipMask on the module.
Definition: f1tdcLib.c:2895
void f1ConfigShow(int id, int chipMask)
Print to standard out the configuration of the f1TDC chips specified by the chipmask and module in sl...
Definition: f1tdcLib.c:1081
int f1SoftPulser(int id, int output)
Trigger the pulser.
Definition: f1tdcLib.c:4369
volatile unsigned int scaler2
Definition: f1tdcLib.h:47
int f1ConfigWrite(int id, int *config_data, int chipMask)
Write the specified configuration to provided chips of the module in slot id indicated by the chipmas...
Definition: f1tdcLib.c:649
volatile unsigned int token_test
Definition: f1tdcLib.h:57
volatile unsigned int p0_trig1_scaler
Definition: f1tdcLib.h:69
volatile unsigned int intr
Definition: f1tdcLib.h:42
volatile unsigned int serial_eprom
Definition: f1tdcLib.h:53
void f1DisableClk(int id)
Disable the current clock source on the module.
Definition: f1tdcLib.c:3815
unsigned int f1GBready()
Return the mask of all initialized modules with blocks available for readout.
Definition: f1tdcLib.c:2777
int f1Enabled(int id)
Return enabled/disabled status of FPGA data fifo.
Definition: f1tdcLib.c:3192
int f1GetSerialNumber(int id, char **rval)
Fills 'rval' with a character array containing the fa250 serial number.
Definition: f1tdcLib.c:1198
void f1GSetBlockLevel(int level)
Set the block level (number of events per block) on all initialized modules.
Definition: f1tdcLib.c:4090
void f1TestResetClockCounter(int id)
Reset the counter of the 250MHz Clock scaler.
Definition: f1tdcLib.c:4843
void f1Reset(int id, int iFlag)
Perform a hard reset of the module.
Definition: f1tdcLib.c:2459
volatile unsigned int sync_scaler
Definition: f1tdcLib.h:55
volatile unsigned int config_csr
Definition: f1tdcLib.h:51
void f1DisableMultiBlock()
Disable multiblock readout for all initialized modules.
Definition: f1tdcLib.c:4158
int f1TestGetTokenIn(int id)
Get the level of the Token In from the SD.
Definition: f1tdcLib.c:4652
void f1EnableChannelMask(int id, unsigned long long int mask)
Enable inputs indicated in channel mask for the module.
Definition: f1tdcLib.c:3656
unsigned int f1TestGetTrig2Counter(int id)
Return the value of the trig2 scaler.
Definition: f1tdcLib.c:4812
int f1FirmwareReadFile(char *filename)
int f1EnableData(int id, int chipMask)
Enable data on f1TDC chips specified in chipMask for the module.
Definition: f1tdcLib.c:3223
int f1GetFirmwareVersion(int id, int pflag)
Get the firmware version of the FPGA.
Definition: f1tdcLib.c:1253
void f1TestSetSdLink(int id, int mode)
Set the level of the SD Link.
Definition: f1tdcLib.c:4546
void f1DisableSoftTrig(int id)
Disable software triggers on the module.
Definition: f1tdcLib.c:3953
int f1TestGetClockCounterStatus(int id)
Return the status of the 250Mhz Clock Counter.
Definition: f1tdcLib.c:4684
volatile unsigned int test_spare[3]
Definition: f1tdcLib.h:71
void f1EnableBusError(int id)
Enable bus error block termination on the module.
Definition: f1tdcLib.c:3980
volatile unsigned int token_test_scaler
Definition: f1tdcLib.h:58
unsigned int f1TestGetClockCounter(int id)
Return the value of the 250Mhz Clock scaler.
Definition: f1tdcLib.c:4716
void f1GEnableBusError()
Enable bus error block termination for all initialized modules.
Definition: f1tdcLib.c:4005
void f1ChipStatus(int id, int pflag)
Print Status of f1TDC chips to standard out.
Definition: f1tdcLib.c:1558
int f1SetBlockLevel(int id, int level)
Set the block level (number of events per block) on the module.
Definition: f1tdcLib.c:4058
void f1DisableBusError(int id)
Disable bus error block termination on the module.
Definition: f1tdcLib.c:4027
int f1Enable(int id)
Enable f1TDC FPGA data fifo on the module.
Definition: f1tdcLib.c:3099
int f1GDisable()
Disable f1TDC FPGA data fifo on all initialized modules.
Definition: f1tdcLib.c:3169
void f1TestSetTokenOut(int id, int mode)
Set the level of Token Out to the SD.
Definition: f1tdcLib.c:4584
int f1PrintEvent(int id, int rflag)
Readout and print event to standard out.
Definition: f1tdcLib.c:1881
int f1FirmwareGVerifyDownload()
volatile unsigned int config
Definition: f1tdcLib.h:49
volatile unsigned int ctrl
Definition: f1tdcLib.h:39
unsigned int blank0
Definition: f1tdcLib.h:48
int f1FlushEvent(int id)
Routine to flush a partial event from the FIFO. Read until a valid trailer is found.
Definition: f1tdcLib.c:2021
Definition: f1tdcLib.h:35
int f1DisableChannel(int id, int input)
Disable an individual channel input.
Definition: f1tdcLib.c:3499
int f1FirmwareGEraseEPROM()
void f1TestSetBusyOut(int id, int mode)
Set the level of Busy Out to the SD.
Definition: f1tdcLib.c:4509
void f1GClear()
Perform a soft reset on all initialized f1TDC modules.
Definition: f1tdcLib.c:2180
void f1DataDecode(int id, unsigned int data)
Decode a data word from an fADC250 and print to standard out.
Definition: f1tdcLib.c:5106
int f1Dready(int id)
Determine if an event is ready for readout on the module.
Definition: f1tdcLib.c:2722
int f1GCheckLock(int pflag)
Get Resolution lock status for all chips on all initialized f1TDCs.
Definition: f1tdcLib.c:2413
volatile unsigned int pulser_delay
Definition: f1tdcLib.h:59
void f1Trig(int id)
Issue a software trigger to the module.
Definition: f1tdcLib.c:2575
volatile unsigned int blocklevel
Definition: f1tdcLib.h:41
volatile unsigned int config_data
Definition: f1tdcLib.h:52
int f1CheckLock(int id)
Get Resolution lock status for all chips on the board.
Definition: f1tdcLib.c:2369
int f1SetPulserTriggerDelay(int id, int delay)
Set the delay between the output pulse and f1TDC trigger.
Definition: f1tdcLib.c:4251
int f1FirmwareDownloadConfigData(int id, int print_header)
void f1GWriteControl(unsigned int val)
Write provided value to the CTRL register to all initialized modules.
Definition: f1tdcLib.c:3079
volatile unsigned int clock_scaler
Definition: f1tdcLib.h:67
unsigned int f1GErrorStatus(int sflag)
Return the Error status for all the f1TDC chips on all initialized modules.
Definition: f1tdcLib.c:2318
void f1ResetToken(int id)
Reset the token for the module.
Definition: f1tdcLib.c:4188
void f1GTrig()
Issue a software trigger to all initialized modules.
Definition: f1tdcLib.c:2611
void f1GEnableSoftTrig()
Enable software triggers for all initialized modules.
Definition: f1tdcLib.c:3931
volatile unsigned int pulser_dac
Definition: f1tdcLib.h:60
volatile unsigned int adr32
Definition: f1tdcLib.h:43
volatile unsigned int version
Definition: f1tdcLib.h:37
int f1ResetPulser(int id)
Reset (initialize) pulser.
Definition: f1tdcLib.c:4213
int f1DataScan(int pflag)
Return the mask of all initialized modules with events available for readout.
Definition: f1tdcLib.c:2805
void f1GStart()
Issue a software Start signal to all initialized modules.
Definition: f1tdcLib.c:2683
void f1DisableChannelMask(int id, unsigned long long int mask)
Disable inputs indicated in channel mask for the module.
Definition: f1tdcLib.c:3640
void f1EnableMultiBlock(int tflag)
Enable multiblock readout for all initialized modules.
Definition: f1tdcLib.c:4111
int f1ConfigRead(int id, unsigned int *config_data, int chipID)
Read the f1TDC Chip Registers into user specified config_data array.
Definition: f1tdcLib.c:992
volatile unsigned int scaler1
Definition: f1tdcLib.h:46
void f1ClearStatus(int id, unsigned int chipMask)
Clear the latched error status of specified f1TDC chips in the chipMask.
Definition: f1tdcLib.c:2203
unsigned int f1ErrorStatus(int id, int sflag)
Return the Error status for all the f1TDC chips on the module.
Definition: f1tdcLib.c:2265
unsigned int f1ReadCSR(int id)
Return the value of the CSR register of the module.
Definition: f1tdcLib.c:3018
volatile unsigned int ev_count
Definition: f1tdcLib.h:40
volatile unsigned int csr
Definition: f1tdcLib.h:38
int f1GPrintEvent(int rflag)
Readout and print event from all initialized f1TDCs to standard out.
Definition: f1tdcLib.c:2114
void f1Status(int id, int sflag)
Print Status of f1TDC to standard out.
Definition: f1tdcLib.c:1291
int f1GEnable()
Enable f1TDC FPGA data fifo on all initialized modules.
Definition: f1tdcLib.c:3123
int f1GConfigWrite(int *config_data, int chipMask)
Write the specified configuration to provided chips of all initialized f1TDCs indicated by the chipma...
Definition: f1tdcLib.c:776