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 {
59 
60 
62 typedef enum {
63  FEATURE_HBT = 0x0001, /*< Cross correlation (HBT) software functions */
64  FEATURE_LIFETIME = 0x0002, /*< Lifetime software functions */
65  FEATURE_MARKERS = 0x0020, /*< Marker input */
66  FEATURE_FILTERS = 0x0040, /*< Event filters for timestamp stream */
67  FEATURE_EXTCLK = 0x0080, /*< External clock enabled */
68  FEATURE_DEVSYNC = 0x0100 /*< Synchronisation of multiple devices */
70 
73 
74 
76 typedef enum {
83 
84 
86 typedef enum {
87  SCOND_LVTTL = 1,
89  SCOND_NIM = 2,
91  SCOND_MISC = 3,
92  SCOND_NONE = 4
94 
95 
97 typedef enum {
104 
105 
107 typedef enum {
108  SIM_FLAT,
111  SIM_NORMAL,
114  SIM_NONE
116 
117 
119 typedef enum {
124  LINK_INVALID
125 } TDC_LinkType;
126 
127 
141 
142 
150 
151 
159 
160 
167 TDC_API const char * TDC_CC TDC_perror( int rc );
168 
169 
181 TDC_API int TDC_CC TDC_getTimebase( double * timebase );
182 
183 
204 TDC_API int TDC_CC TDC_init( int deviceId );
205 
206 
213 
214 
221 
222 
232 
233 
243 
244 
252 
253 
261 
262 
270 
271 
281  Bln32 * uplink );
282 
283 
291 
292 
305 
306 
315 
316 
324 
325 
333 
334 
344  double* freqOut );
345 
346 
359  double *freqOut,
360  Int32 *N,
361  Int32 *R,
362  Int32 *K);
363 
364 
377 
378 
386 
387 
396 
397 
408 TDC_API TDC_DEPRECATED_MSG("Use TDC_getCalibrationActive instead.")
409 int TDC_CC TDC_getCalibrationState( Bln32 * active );
410 
411 
419 
420 
428 
429 
439 TDC_API int TDC_CC TDC_enableChannels( Bln32 enStart, Int32 channelMask );
440 
441 
449 TDC_API int TDC_CC TDC_getChannelsEnabled( Bln32 * enStart, Int32 * channelMask );
450 
451 
466 
467 
475 
476 
494  TDC_SignalCond conditioning,
495  Bln32 edge,
496  double threshold );
497 
498 
514  Bln32 * edge,
515  double * threshold );
516 
517 
528  Bln32 reconstruct );
529 
530 
540  Bln32 * reconstruct );
541 
542 
558  TDC_LinkType combine );
559 
560 
571  TDC_LinkType *combine );
572 
573 
581 
582 
598  TDC_FilterType type,
599  Int32 chMask );
600 
601 
611  TDC_FilterType * type,
612  Int32 * chMask );
613 
614 
623 
624 
634  Int32 * expTime );
635 
636 
649 
650 
658 TDC_API int TDC_CC TDC_getChannelDelay( Int32 channel, Int32 * delay );
659 
660 
672  Int32 period,
673  Int32 burstSize,
674  Int32 burstDist );
675 
691 
692 
703 
704 
712 
713 
728 
729 
742 
743 
764 TDC_API int TDC_CC TDC_getCoincCounters( Int32 * data, Int32 * updates );
765 
766 
788  Int64 * timestamps,
789  Uint8 * channels,
790  Int32 * valid );
791 
792 
840 TDC_API int TDC_CC TDC_writeTimestamps( const char * filename,
841  TDC_FileFormat format );
842 
843 
857 TDC_API int TDC_CC TDC_inputTimestamps( const Int64 * timestamps,
858  const Uint8 * channels,
859  Int32 count );
860 
861 
881 TDC_API int TDC_CC TDC_readTimestamps( const char * filename,
882  TDC_FileFormat format );
883 
884 
901  double * par,
902  Int32 count );
903 
904 #endif
TDC_API int TDC_CC TDC_getVersionMinor()
Get Library Minor Version Number.
TDC_API Int32 TDC_CC TDC_getChannelCount()
Get number of channels.
TDC_API int TDC_CC TDC_setUserClockFrequency(double freqIn, double *freqOut)
Sets the desired frequency for the user clock feature.
TDC_API int TDC_CC TDC_getClockResetDisabled(Bln32 *disabled)
Read back Clock Reset Mode.
TDC_API int TDC_CC TDC_getSyncDivider(Int32 *divider, Bln32 *reconstruct)
Read back Start Input Divider.
TDC_API int TDC_CC TDC_init(int deviceId)
Initialize and Start.
TDC_API int TDC_CC TDC_enableMarkers(Int32 markerMask)
Enable Markers.
TDC_API TDC_DevType TDC_CC TDC_getDevType()
Get type of connected device.
TDC_API TDC_FeatureFlags TDC_CC TDC_checkFeatures()
Check for device features.
TDC_API int TDC_CC TDC_getCoincCounters(Int32 *data, Int32 *updates)
Retrieve Coincidence Counters.
TDC_API int TDC_CC TDC_getSignalConditioning(Int32 channel, Bln32 *edge, double *threshold)
Read back Signal Conditioning Parameters.
TDC_API int TDC_CC TDC_readTimestamps(const char *filename, TDC_FileFormat format)
Read Timestamps.
TDC_API int TDC_CC TDC_deInit()
Disconnect and uninitialize.
TDC_API const char *TDC_CC TDC_perror(int rc)
Get Error Message.
TDC_API int TDC_CC TDC_getMarkersEnabled(Int32 *markerMask)
Retrieve active markers.
TDC_API int TDC_CC TDC_getClockOutState(Bln32 *out)
Inquire Clock Out State.
TDC_API int TDC_CC TDC_enableExternalClock(Bln32 enable)
Configure external clock.
TDC_API int TDC_CC TDC_getChannelDelay(Int32 channel, Int32 *delay)
Read back Channel Delay Time.
TDC_API Int32 TDC_CC TDC_getModuleCount()
Get number of modules.
TDC_API int TDC_CC TDC_writeTimestamps(const char *filename, TDC_FileFormat format)
Write Timestamp Values to File.
TDC_API int TDC_CC TDC_setExposureTime(Int32 expTime)
Set Exposure Time.
TDC_API int TDC_CC TDC_freezeBuffers(Bln32 freeze)
Freeze internal Buffers.
TDC_API int TDC_CC TDC_enableTdcInput(Bln32 enable)
Enable Physical Input.
TDC_API int TDC_CC TDC_getVersionMajor()
Get Library Major Version Number.
TDC_API const char *TDC_CC TDC_getVersion()
Get Library Version String.
TDC_API Bln32 TDC_CC TDC_checkFeatureLifeTime()
Check for lifetime feature.
TDC_API int TDC_CC TDC_getSingleStopPreselection(Bln32 *single)
Preselection mode.
TDC_API int TDC_CC TDC_startCalibration()
Internal Calibration.
TDC_API int TDC_CC TDC_generateTimestamps(TDC_SimType type, double *par, Int32 count)
Generate Timestamps.
TDC_API int TDC_CC TDC_setTimestampBufferSize(Int32 size)
Set Timestamp Buffer Size.
TDC_DevType
Type of the TDC device.
Definition: tdcbase.h:52
@ DEVTYPE_NONE
No device / simulated device.
Definition: tdcbase.h:57
@ DEVTYPE_QUTAG_MC
quTAG MC device
Definition: tdcbase.h:53
@ DEVTYPE_QUTAG_QTI
quTAG QTI device
Definition: tdcbase.h:55
@ DEVTYPE_QUTAG_HR
quTAG HR device
Definition: tdcbase.h:54
@ DEVTYPE_QUTAG_LC
quTAG LC device
Definition: tdcbase.h:56
TDC_API int TDC_CC TDC_getDeviceParams(Int32 *coincWin, Int32 *expTime)
Read Back Device Parameters.
TDC_API int TDC_CC TDC_getChannelsEnabled(Bln32 *enStart, Int32 *channelMask)
Retrieve active channels.
TDC_FeatureFlag
Bitmasks for feature inquiry.
Definition: tdcbase.h:62
TDC_API int TDC_CC TDC_getCalibrationSuccess(Bln32 *success)
Inquire if Calibration was successful.
TDC_FileFormat
Output file format.
Definition: tdcbase.h:76
@ FORMAT_RAW
Uncompressed binary without header (for compatiblity)
Definition: tdcbase.h:80
@ FORMAT_ASCII
ASCII format.
Definition: tdcbase.h:77
@ FORMAT_NONE
No format / invalid.
Definition: tdcbase.h:81
@ FORMAT_BINARY
Uncompressed binary format (40B header, 10B/time tag)
Definition: tdcbase.h:78
@ FORMAT_COMPRESSED
Compressed binary format (40B header, 5B/time tag)
Definition: tdcbase.h:79
TDC_SignalCond
Type of signal conditioning.
Definition: tdcbase.h:86
@ SCOND_MISC
Other signal type: Conditioning on, everything optional.
Definition: tdcbase.h:91
@ SCOND_NONE
No signal / invalid.
Definition: tdcbase.h:92
@ SCOND_LVTTL
For LVTTL signals: Trigger at 2V rising edge, termination optional.
Definition: tdcbase.h:87
@ SCOND_NIM
For NIM signals: Trigger at -0.6V falling edge, termination fixed on.
Definition: tdcbase.h:89
TDC_API int TDC_CC TDC_getCalibrationActive(Bln32 *active)
Inquire if Calibration is active.
TDC_API int TDC_CC TDC_configureSyncDivider(Int32 divider, Bln32 reconstruct)
Configure Start Input Divider.
TDC_LinkType
Combination type for channel link (.
Definition: tdcbase.h:119
@ LINK_2
Link 2 channels (1+2, 4+3, 5+6, 8+7)
Definition: tdcbase.h:121
@ LINK_NONE
No links, every input individually.
Definition: tdcbase.h:120
@ LINK_4
Link 4 channels (1..4, 5..8)
Definition: tdcbase.h:122
@ LINK_8
Link 8 channels (1..8)
Definition: tdcbase.h:123
TDC_API int TDC_CC TDC_enableClockOutput(Bln32 enable)
Sets the clock output state.
TDC_API int TDC_CC TDC_configureSignalConditioning(Int32 channel, TDC_SignalCond conditioning, Bln32 edge, double threshold)
Configure Signal Conditioning.
TDC_API int TDC_CC TDC_configureFilter(Int32 channel, TDC_FilterType type, Int32 chMask)
Configure Output Filter.
TDC_API int TDC_CC TDC_getDataLost(Bln32 *lost)
Check for data loss.
Int32 TDC_FeatureFlags
A combination of feature Flags.
Definition: tdcbase.h:72
TDC_FilterType
Type of output filter.
Definition: tdcbase.h:97
@ FILTER_SYNC
Sync filter.
Definition: tdcbase.h:101
@ FILTER_MUTE
Mute filter.
Definition: tdcbase.h:99
@ FILTER_NONE
No filter.
Definition: tdcbase.h:98
@ FILTER_INVALID
invalid
Definition: tdcbase.h:102
@ FILTER_COINC
Coincidence filter.
Definition: tdcbase.h:100
TDC_API Bln32 TDC_CC TDC_checkFeatureHbt()
Check for HBT feature.
TDC_API int TDC_CC TDC_configureInputLink(Int32 module, TDC_LinkType combine)
Configure Channel Combinations.
TDC_API int TDC_CC TDC_setCoincidenceWindow(Int32 coincWin)
Set Coincidence Window.
TDC_SimType
Type of generated timestamps.
Definition: tdcbase.h:107
@ SIM_FLAT
Time diffs and channel numbers uniformly distributed.
Definition: tdcbase.h:108
@ SIM_NONE
No type / invalid.
Definition: tdcbase.h:114
@ SIM_NORMAL
Time diffs normally distributed, channels uniformly.
Definition: tdcbase.h:111
TDC_API int TDC_CC TDC_getInputLink(Int32 module, TDC_LinkType *combine)
Read back Channel Combinations.
TDC_API int TDC_CC TDC_getUserClockSettings(double *freqIn, double *freqOut, Int32 *N, Int32 *R, Int32 *K)
Reads the user clock settings.
TDC_API int TDC_CC TDC_getTimebase(double *timebase)
Get Time Base.
TDC_API int TDC_CC TDC_inputTimestamps(const Int64 *timestamps, const Uint8 *channels, Int32 count)
Input Synthetic Timestamps.
TDC_API int TDC_CC TDC_disableClockReset(Bln32 disable)
Disable Start Input Clock Reset.
TDC_API int TDC_CC TDC_getTimestampBufferSize(Int32 *size)
Read back Timestamp Buffer Size.
TDC_API int TDC_CC TDC_getLastTimestamps(Bln32 reset, Int64 *timestamps, Uint8 *channels, Int32 *valid)
Retrieve Last Timestamp Values.
TDC_API int TDC_CC TDC_configureSelftest(Int32 channelMask, Int32 period, Int32 burstSize, Int32 burstDist)
Configure Selftest.
TDC_API int TDC_CC TDC_getClockState(Bln32 *locked, Bln32 *uplink)
Inquire Clock Sync State.
TDC_API int TDC_CC TDC_preselectSingleStop(Bln32 single)
Preselect histogram mode.
TDC_API int TDC_CC TDC_getFilter(Int32 channel, TDC_FilterType *type, Int32 *chMask)
Read back Output Filters.
TDC_API int TDC_CC TDC_setChannelDelay(Int32 channel, Int32 delay)
Set Channel Delay Time.
TDC_API TDC_DEPRECATED_MSG("Use TDC_getCalibrationActive instead.") int TDC_CC TDC_getCalibrationState(Bln32 *active)
Inquire Calibration State.
TDC_API int TDC_CC TDC_enableChannels(Bln32 enStart, Int32 channelMask)
Enable TDC Channels.
Technical declarations for the DLL interface and basic type defs.
__int32 Bln32
integer used as boolean
Definition: tdcdecl.h:61
__int32 Int32
32 bit integer for MSVC
Definition: tdcdecl.h:58
#define TDC_CC
Calling convention
Definition: tdcdecl.h:34
__int64 Int64
64 bit integer for MSVC
Definition: tdcdecl.h:59
unsigned __int8 Uint8
8-Bit unsigned int for MSVC
Definition: tdcdecl.h:60
#define TDC_API
External DLL interface.
Definition: tdcdecl.h:38