TDCBase

tdcbase.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Project: quTAG MC and HR Control Library
4 *
5 * Filename: tdcbase.h
6 *
7 * Purpose: Control and data acquisition functions for quTAG
8 *
9 * Author: NHands GmbH & Co KG
10 */
11 /*****************************************************************************/
35 /*****************************************************************************/
36 /* $Id: tdcbase.h,v 1.8 2022/02/03 14:44:55 trurl Exp $ */
37
38 #ifndef __TDCBASE_H
39 #define __TDCBASE_H
40
41 #include "tdcdecl.h"
42
46 #define TDC_QUTAG_CHANNELS 32
47 #define TDC_COINC_CHANNELS 59
52 typedef enum {
53 DEVTYPE_QUTAG_MC,
54 DEVTYPE_QUTAG_HR,
55 DEVTYPE_QUTAG_QTI,
56 DEVTYPE_NONE
57 } TDC_DevType;
58
59
61 typedef enum {
62 FEATURE_HBT = 0x0001, /*< Cross correlation (HBT) software functions */
63 FEATURE_LIFETIME = 0x0002, /*< Lifetime software functions */
64 FEATURE_MARKERS = 0x0020, /*< Marker input */
65 FEATURE_FILTERS = 0x0040, /*< Event filters for timestamp stream */
66 FEATURE_EXTCLK = 0x0080, /*< External clock enabled */
67 FEATURE_DEVSYNC = 0x0100 /*< Synchronisation of multiple devices */
68 } TDC_FeatureFlag;
69
71 typedef Int32 TDC_FeatureFlags;
72
73
75 typedef enum {
76 FORMAT_ASCII,
77 FORMAT_BINARY,
78 FORMAT_COMPRESSED,
79 FORMAT_RAW,
80 FORMAT_NONE
81 } TDC_FileFormat;
82
83
85 typedef enum {
86 SCOND_LVTTL = 1,
88 SCOND_NIM = 2,
90 SCOND_MISC = 3,
91 SCOND_NONE = 4
92 } TDC_SignalCond;
93
94
96 typedef enum {
97 FILTER_NONE,
98 FILTER_MUTE,
99 FILTER_COINC,
100 FILTER_SYNC,
101 FILTER_INVALID
102 } TDC_FilterType;
103
104
106 typedef enum {
107 SIM_FLAT,
110 SIM_NORMAL,
113 SIM_NONE
114 } TDC_SimType;
115
116
118 typedef enum {
119 LINK_NONE,
120 LINK_2,
121 LINK_4,
122 LINK_8,
123 LINK_INVALID
124 } TDC_LinkType;
125
126
134 TDC_API double TDC_CC TDC_getVersion();
135
136
143 TDC_API const char * TDC_CC TDC_perror( int rc );
144
145
157 TDC_API int TDC_CC TDC_getTimebase( double * timebase );
158
159
180 TDC_API int TDC_CC TDC_init( int deviceId );
181
182
188 TDC_API int TDC_CC TDC_deInit();
189
190
196 TDC_API TDC_DevType TDC_CC TDC_getDevType();
197
198
207 TDC_API Bln32 TDC_CC TDC_checkFeatureHbt();
208
209
218 TDC_API Bln32 TDC_CC TDC_checkFeatureLifeTime();
219
220
227 TDC_API TDC_FeatureFlags TDC_CC TDC_checkFeatures();
228
229
236 TDC_API Int32 TDC_CC TDC_getModuleCount();
237
238
245 TDC_API Int32 TDC_CC TDC_getChannelCount();
246
247
256 TDC_API int TDC_CC TDC_getClockState( Bln32 * locked,
257 Bln32 * uplink );
258
259
266 TDC_API int TDC_CC TDC_enableExternalClock( Bln32 enable );
267
268
280 TDC_API int TDC_CC TDC_disableClockReset( Bln32 disable );
281
282
290 TDC_API int TDC_CC TDC_getClockResetDisabled( Bln32 * disabled );
291
292
299 TDC_API int TDC_CC TDC_getClockOutState( Bln32 * out );
300
301
308 TDC_API int TDC_CC TDC_enableClockOutput( Bln32 enable );
309
310
319 TDC_API int TDC_CC TDC_setUserClockFrequency( double freqIn,
320 double* freqOut );
321
322
334 TDC_API int TDC_CC TDC_getUserClockSettings( double *freqIn,
335 double *freqOut,
336 Int32 *N,
337 Int32 *R,
338 Int32 *K);
339
340
352 TDC_API int TDC_CC TDC_preselectSingleStop( Bln32 single );
353
354
361 TDC_API int TDC_CC TDC_getSingleStopPreselection( Bln32 * single );
362
363
371 TDC_API int TDC_CC TDC_startCalibration();
372
373
380 TDC_API int TDC_CC TDC_getCalibrationState( Bln32 * active );
381
382
392 TDC_API int TDC_CC TDC_enableChannels( Bln32 enStart, Int32 channelMask );
393
394
402 TDC_API int TDC_CC TDC_getChannelsEnabled( Bln32 * enStart, Int32 * channelMask );
403
404
418 TDC_API int TDC_CC TDC_enableMarkers( Int32 markerMask );
419
420
427 TDC_API int TDC_CC TDC_getMarkersEnabled( Int32 * markerMask );
428
429
446 TDC_API int TDC_CC TDC_configureSignalConditioning( Int32 channel,
447 TDC_SignalCond conditioning,
448 Bln32 edge,
449 double threshold );
450
451
466 TDC_API int TDC_CC TDC_getSignalConditioning( Int32 channel,
467 Bln32 * edge,
468 double * threshold );
469
470
480 TDC_API int TDC_CC TDC_configureSyncDivider( Int32 divider,
481 Bln32 reconstruct );
482
483
492 TDC_API int TDC_CC TDC_getSyncDivider( Int32 * divider,
493 Bln32 * reconstruct );
494
495
510 TDC_API int TDC_CC TDC_configureInputLink( Int32 module,
511 TDC_LinkType combine );
512
513
523 TDC_API int TDC_CC TDC_getInputLink( Int32 module,
524 TDC_LinkType *combine );
525
526
533 TDC_API int TDC_CC TDC_setCoincidenceWindow( Int32 coincWin );
534
535
550 TDC_API int TDC_CC TDC_configureFilter( Int32 channel,
551 TDC_FilterType type,
552 Int32 chMask );
553
554
563 TDC_API int TDC_CC TDC_getFilter( Int32 channel,
564 TDC_FilterType * type,
565 Int32 * chMask );
566
567
575 TDC_API int TDC_CC TDC_setExposureTime( Int32 expTime );
576
577
586 TDC_API int TDC_CC TDC_getDeviceParams( Int32 * coincWin,
587 Int32 * expTime );
588
589
601 TDC_API int TDC_CC TDC_setChannelDelay( Int32 channel, Int32 delay );
602
603
611 TDC_API int TDC_CC TDC_getChannelDelay( Int32 channel, Int32 * delay );
612
613
624 TDC_API int TDC_CC TDC_configureSelftest( Int32 channelMask,
625 Int32 period,
626 Int32 burstSize,
627 Int32 burstDist );
628
643 TDC_API int TDC_CC TDC_getDataLost( Bln32 * lost );
644
645
655 TDC_API int TDC_CC TDC_setTimestampBufferSize( Int32 size );
656
657
664 TDC_API int TDC_CC TDC_getTimestampBufferSize( Int32 * size );
665
666
680 TDC_API int TDC_CC TDC_enableTdcInput( Bln32 enable );
681
682
694 TDC_API int TDC_CC TDC_freezeBuffers( Bln32 freeze );
695
696
717 TDC_API int TDC_CC TDC_getCoincCounters( Int32 * data, Int32 * updates );
718
719
740 TDC_API int TDC_CC TDC_getLastTimestamps( Bln32 reset,
741 Int64 * timestamps,
742 Uint8 * channels,
743 Int32 * valid );
744
745
793 TDC_API int TDC_CC TDC_writeTimestamps( const char * filename,
794 TDC_FileFormat format );
795
796
810 TDC_API int TDC_CC TDC_inputTimestamps( const Int64 * timestamps,
811 const Uint8 * channels,
812 Int32 count );
813
814
834 TDC_API int TDC_CC TDC_readTimestamps( const char * filename,
835 TDC_FileFormat format );
836
837
853 TDC_API int TDC_CC TDC_generateTimestamps( TDC_SimType type,
854 double * par,
855 Int32 count );
856
857 #endif
TDC_getChannelCount
TDC_API Int32 TDC_CC TDC_getChannelCount()
Get number of channels.
TDC_setUserClockFrequency
TDC_API int TDC_CC TDC_setUserClockFrequency(double freqIn, double *freqOut)
Sets the desired frequency for the user clock feature.
TDC_getClockResetDisabled
TDC_API int TDC_CC TDC_getClockResetDisabled(Bln32 *disabled)
Read back Clock Reset Mode.
TDC_getSyncDivider
TDC_API int TDC_CC TDC_getSyncDivider(Int32 *divider, Bln32 *reconstruct)
Read back Start Input Divider.
TDC_init
TDC_API int TDC_CC TDC_init(int deviceId)
Initialize and Start.
TDC_enableMarkers
TDC_API int TDC_CC TDC_enableMarkers(Int32 markerMask)
Enable Markers.
TDC_getDevType
TDC_API TDC_DevType TDC_CC TDC_getDevType()
Get type of connected device.
TDC_checkFeatures
TDC_API TDC_FeatureFlags TDC_CC TDC_checkFeatures()
Check for device features.
TDC_getCoincCounters
TDC_API int TDC_CC TDC_getCoincCounters(Int32 *data, Int32 *updates)
Retrieve Coincidence Counters.
TDC_getSignalConditioning
TDC_API int TDC_CC TDC_getSignalConditioning(Int32 channel, Bln32 *edge, double *threshold)
Read back Signal Conditioning Parameters.
TDC_readTimestamps
TDC_API int TDC_CC TDC_readTimestamps(const char *filename, TDC_FileFormat format)
Read Timestamps.
TDC_deInit
TDC_API int TDC_CC TDC_deInit()
Disconnect and uninitialize.
TDC_getVersion
TDC_API double TDC_CC TDC_getVersion()
Get Library Version.
TDC_perror
TDC_API const char *TDC_CC TDC_perror(int rc)
Get Error Message.
TDC_getMarkersEnabled
TDC_API int TDC_CC TDC_getMarkersEnabled(Int32 *markerMask)
Retrieve active markers.
TDC_getClockOutState
TDC_API int TDC_CC TDC_getClockOutState(Bln32 *out)
Inquire Clock Out State.
TDC_enableExternalClock
TDC_API int TDC_CC TDC_enableExternalClock(Bln32 enable)
Configure external clock.
TDC_getChannelDelay
TDC_API int TDC_CC TDC_getChannelDelay(Int32 channel, Int32 *delay)
Read back Channel Delay Time.
TDC_getModuleCount
TDC_API Int32 TDC_CC TDC_getModuleCount()
Get number of modules.
TDC_writeTimestamps
TDC_API int TDC_CC TDC_writeTimestamps(const char *filename, TDC_FileFormat format)
Write Timestamp Values to File.
TDC_setExposureTime
TDC_API int TDC_CC TDC_setExposureTime(Int32 expTime)
Set Exposure Time.
TDC_freezeBuffers
TDC_API int TDC_CC TDC_freezeBuffers(Bln32 freeze)
Freeze internal Buffers.
TDC_enableTdcInput
TDC_API int TDC_CC TDC_enableTdcInput(Bln32 enable)
Enable Physical Input.
TDC_checkFeatureLifeTime
TDC_API Bln32 TDC_CC TDC_checkFeatureLifeTime()
Check for lifetime feature.
TDC_getSingleStopPreselection
TDC_API int TDC_CC TDC_getSingleStopPreselection(Bln32 *single)
Preselection mode.
TDC_startCalibration
TDC_API int TDC_CC TDC_startCalibration()
Internal Calibration.
TDC_generateTimestamps
TDC_API int TDC_CC TDC_generateTimestamps(TDC_SimType type, double *par, Int32 count)
Generate Timestamps.
TDC_setTimestampBufferSize
TDC_API int TDC_CC TDC_setTimestampBufferSize(Int32 size)
Set Timestamp Buffer Size.
TDC_DevType
TDC_DevType
Type of the TDC device.
Definition: tdcbase.h:52
DEVTYPE_NONE
@ DEVTYPE_NONE
No device / simulated device.
Definition: tdcbase.h:56
DEVTYPE_QUTAG_MC
@ DEVTYPE_QUTAG_MC
quTAG MC device
Definition: tdcbase.h:53
DEVTYPE_QUTAG_QTI
@ DEVTYPE_QUTAG_QTI
quTAG QTI device
Definition: tdcbase.h:55
DEVTYPE_QUTAG_HR
@ DEVTYPE_QUTAG_HR
quTAG HR device
Definition: tdcbase.h:54
TDC_getDeviceParams
TDC_API int TDC_CC TDC_getDeviceParams(Int32 *coincWin, Int32 *expTime)
Read Back Device Parameters.
TDC_getChannelsEnabled
TDC_API int TDC_CC TDC_getChannelsEnabled(Bln32 *enStart, Int32 *channelMask)
Retrieve active channels.
TDC_FeatureFlag
TDC_FeatureFlag
Bitmasks for feature inquiry.
Definition: tdcbase.h:61
TDC_FileFormat
TDC_FileFormat
Output file format.
Definition: tdcbase.h:75
FORMAT_RAW
@ FORMAT_RAW
Uncompressed binary without header (for compatiblity)
Definition: tdcbase.h:79
FORMAT_ASCII
@ FORMAT_ASCII
ASCII format.
Definition: tdcbase.h:76
FORMAT_NONE
@ FORMAT_NONE
No format / invalid.
Definition: tdcbase.h:80
FORMAT_BINARY
@ FORMAT_BINARY
Uncompressed binary format (40B header, 10B/time tag)
Definition: tdcbase.h:77
FORMAT_COMPRESSED
@ FORMAT_COMPRESSED
Compressed binary format (40B header, 5B/time tag)
Definition: tdcbase.h:78
TDC_SignalCond
TDC_SignalCond
Type of signal conditioning.
Definition: tdcbase.h:85
SCOND_MISC
@ SCOND_MISC
Other signal type: Conditioning on, everything optional.
Definition: tdcbase.h:90
SCOND_NONE
@ SCOND_NONE
No signal / invalid.
Definition: tdcbase.h:91
SCOND_LVTTL
@ SCOND_LVTTL
For LVTTL signals: Trigger at 2V rising edge, termination optional.
Definition: tdcbase.h:86
SCOND_NIM
@ SCOND_NIM
For NIM signals: Trigger at -0.6V falling edge, termination fixed on.
Definition: tdcbase.h:88
TDC_configureSyncDivider
TDC_API int TDC_CC TDC_configureSyncDivider(Int32 divider, Bln32 reconstruct)
Configure Start Input Divider.
TDC_LinkType
TDC_LinkType
Combination type for channel link (.
Definition: tdcbase.h:118
LINK_2
@ LINK_2
Link 2 channels (1+2, 4+3, 5+6, 8+7)
Definition: tdcbase.h:120
LINK_NONE
@ LINK_NONE
No links, every input individually.
Definition: tdcbase.h:119
LINK_4
@ LINK_4
Link 4 channels (1..4, 5..8)
Definition: tdcbase.h:121
LINK_8
@ LINK_8
Link 8 channels (1..8)
Definition: tdcbase.h:122
TDC_enableClockOutput
TDC_API int TDC_CC TDC_enableClockOutput(Bln32 enable)
Sets the clock output state.
TDC_configureSignalConditioning
TDC_API int TDC_CC TDC_configureSignalConditioning(Int32 channel, TDC_SignalCond conditioning, Bln32 edge, double threshold)
Configure Signal Conditioning.
TDC_configureFilter
TDC_API int TDC_CC TDC_configureFilter(Int32 channel, TDC_FilterType type, Int32 chMask)
Configure Output Filter.
TDC_getDataLost
TDC_API int TDC_CC TDC_getDataLost(Bln32 *lost)
Check for data loss.
TDC_getCalibrationState
TDC_API int TDC_CC TDC_getCalibrationState(Bln32 *active)
Inquire Calibration State.
TDC_FeatureFlags
Int32 TDC_FeatureFlags
A combination of feature Flags.
Definition: tdcbase.h:71
TDC_FilterType
TDC_FilterType
Type of output filter.
Definition: tdcbase.h:96
FILTER_SYNC
@ FILTER_SYNC
Sync filter.
Definition: tdcbase.h:100
FILTER_MUTE
@ FILTER_MUTE
Mute filter.
Definition: tdcbase.h:98
FILTER_NONE
@ FILTER_NONE
No filter.
Definition: tdcbase.h:97
FILTER_INVALID
@ FILTER_INVALID
invalid
Definition: tdcbase.h:101
FILTER_COINC
@ FILTER_COINC
Coincidence filter.
Definition: tdcbase.h:99
TDC_checkFeatureHbt
TDC_API Bln32 TDC_CC TDC_checkFeatureHbt()
Check for HBT feature.
TDC_configureInputLink
TDC_API int TDC_CC TDC_configureInputLink(Int32 module, TDC_LinkType combine)
Configure Channel Combinations.
TDC_setCoincidenceWindow
TDC_API int TDC_CC TDC_setCoincidenceWindow(Int32 coincWin)
Set Coincidence Window.
TDC_SimType
TDC_SimType
Type of generated timestamps.
Definition: tdcbase.h:106
SIM_FLAT
@ SIM_FLAT
Time diffs and channel numbers uniformly distributed.
Definition: tdcbase.h:107
SIM_NONE
@ SIM_NONE
No type / invalid.
Definition: tdcbase.h:113
SIM_NORMAL
@ SIM_NORMAL
Time diffs normally distributed, channels uniformly.
Definition: tdcbase.h:110
TDC_getInputLink
TDC_API int TDC_CC TDC_getInputLink(Int32 module, TDC_LinkType *combine)
Read back Channel Combinations.
TDC_getUserClockSettings
TDC_API int TDC_CC TDC_getUserClockSettings(double *freqIn, double *freqOut, Int32 *N, Int32 *R, Int32 *K)
Reads the user clock settings.
TDC_getTimebase
TDC_API int TDC_CC TDC_getTimebase(double *timebase)
Get Time Base.
TDC_inputTimestamps
TDC_API int TDC_CC TDC_inputTimestamps(const Int64 *timestamps, const Uint8 *channels, Int32 count)
Input Synthetic Timestamps.
TDC_disableClockReset
TDC_API int TDC_CC TDC_disableClockReset(Bln32 disable)
Disable Start Input Clock Reset.
TDC_getTimestampBufferSize
TDC_API int TDC_CC TDC_getTimestampBufferSize(Int32 *size)
Read back Timestamp Buffer Size.
TDC_getLastTimestamps
TDC_API int TDC_CC TDC_getLastTimestamps(Bln32 reset, Int64 *timestamps, Uint8 *channels, Int32 *valid)
Retrieve Last Timestamp Values.
TDC_configureSelftest
TDC_API int TDC_CC TDC_configureSelftest(Int32 channelMask, Int32 period, Int32 burstSize, Int32 burstDist)
Configure Selftest.
TDC_getClockState
TDC_API int TDC_CC TDC_getClockState(Bln32 *locked, Bln32 *uplink)
Inquire Clock Sync State.
TDC_preselectSingleStop
TDC_API int TDC_CC TDC_preselectSingleStop(Bln32 single)
Preselect histogram mode.
TDC_getFilter
TDC_API int TDC_CC TDC_getFilter(Int32 channel, TDC_FilterType *type, Int32 *chMask)
Read back Output Filters.
TDC_setChannelDelay
TDC_API int TDC_CC TDC_setChannelDelay(Int32 channel, Int32 delay)
Set Channel Delay Time.
TDC_enableChannels
TDC_API int TDC_CC TDC_enableChannels(Bln32 enStart, Int32 channelMask)
Enable TDC Channels.
tdcdecl.h
Technical declarations for the DLL interface and basic type defs.
Bln32
__int32 Bln32
integer used as boolean
Definition: tdcdecl.h:57
Int32
__int32 Int32
32 bit integer for MSVC
Definition: tdcdecl.h:54
TDC_CC
#define TDC_CC
Calling convention
Definition: tdcdecl.h:34
Int64
__int64 Int64
64 bit integer for MSVC
Definition: tdcdecl.h:55
Uint8
unsigned __int8 Uint8
8-Bit unsigned int for MSVC
Definition: tdcdecl.h:56
TDC_API
#define TDC_API
External DLL interface.
Definition: tdcdecl.h:38