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 {
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 */
69 
72 
73 
75 typedef enum {
82 
83 
85 typedef enum {
86  SCOND_LVTTL = 1,
88  SCOND_NIM = 2,
90  SCOND_MISC = 3,
91  SCOND_NONE = 4
93 
94 
96 typedef enum {
103 
104 
106 typedef enum {
107  SIM_FLAT,
110  SIM_NORMAL,
113  SIM_NONE
115 
116 
118 typedef enum {
123  LINK_INVALID
124 } TDC_LinkType;
125 
126 
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 
189 
190 
197 
198 
208 
209 
219 
220 
228 
229 
237 
238 
246 
247 
257  Bln32 * uplink );
258 
259 
267 
268 
281 
282 
291 
292 
300 
301 
309 
310 
320  double* freqOut );
321 
322 
335  double *freqOut,
336  Int32 *N,
337  Int32 *R,
338  Int32 *K);
339 
340 
353 
354 
362 
363 
372 
373 
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 
419 
420 
428 
429 
447  TDC_SignalCond conditioning,
448  Bln32 edge,
449  double threshold );
450 
451 
467  Bln32 * edge,
468  double * threshold );
469 
470 
481  Bln32 reconstruct );
482 
483 
493  Bln32 * reconstruct );
494 
495 
511  TDC_LinkType combine );
512 
513 
524  TDC_LinkType *combine );
525 
526 
534 
535 
551  TDC_FilterType type,
552  Int32 chMask );
553 
554 
564  TDC_FilterType * type,
565  Int32 * chMask );
566 
567 
576 
577 
587  Int32 * expTime );
588 
589 
602 
603 
611 TDC_API int TDC_CC TDC_getChannelDelay( Int32 channel, Int32 * delay );
612 
613 
625  Int32 period,
626  Int32 burstSize,
627  Int32 burstDist );
628 
644 
645 
656 
657 
665 
666 
681 
682 
695 
696 
717 TDC_API int TDC_CC TDC_getCoincCounters( Int32 * data, Int32 * updates );
718 
719 
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 
854  double * par,
855  Int32 count );
856 
857 #endif
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 double TDC_CC TDC_getVersion()
Get Library Version.
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 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:56
@ 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
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:61
TDC_FileFormat
Output file format.
Definition: tdcbase.h:75
@ FORMAT_RAW
Uncompressed binary without header (for compatiblity)
Definition: tdcbase.h:79
@ FORMAT_ASCII
ASCII format.
Definition: tdcbase.h:76
@ FORMAT_NONE
No format / invalid.
Definition: tdcbase.h:80
@ FORMAT_BINARY
Uncompressed binary format (40B header, 10B/time tag)
Definition: tdcbase.h:77
@ FORMAT_COMPRESSED
Compressed binary format (40B header, 5B/time tag)
Definition: tdcbase.h:78
TDC_SignalCond
Type of signal conditioning.
Definition: tdcbase.h:85
@ SCOND_MISC
Other signal type: Conditioning on, everything optional.
Definition: tdcbase.h:90
@ SCOND_NONE
No signal / invalid.
Definition: tdcbase.h:91
@ SCOND_LVTTL
For LVTTL signals: Trigger at 2V rising edge, termination optional.
Definition: tdcbase.h:86
@ SCOND_NIM
For NIM signals: Trigger at -0.6V falling edge, termination fixed on.
Definition: tdcbase.h:88
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:118
@ LINK_2
Link 2 channels (1+2, 4+3, 5+6, 8+7)
Definition: tdcbase.h:120
@ LINK_NONE
No links, every input individually.
Definition: tdcbase.h:119
@ LINK_4
Link 4 channels (1..4, 5..8)
Definition: tdcbase.h:121
@ LINK_8
Link 8 channels (1..8)
Definition: tdcbase.h:122
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.
TDC_API int TDC_CC TDC_getCalibrationState(Bln32 *active)
Inquire Calibration State.
Int32 TDC_FeatureFlags
A combination of feature Flags.
Definition: tdcbase.h:71
TDC_FilterType
Type of output filter.
Definition: tdcbase.h:96
@ FILTER_SYNC
Sync filter.
Definition: tdcbase.h:100
@ FILTER_MUTE
Mute filter.
Definition: tdcbase.h:98
@ FILTER_NONE
No filter.
Definition: tdcbase.h:97
@ FILTER_INVALID
invalid
Definition: tdcbase.h:101
@ FILTER_COINC
Coincidence filter.
Definition: tdcbase.h:99
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:106
@ SIM_FLAT
Time diffs and channel numbers uniformly distributed.
Definition: tdcbase.h:107
@ SIM_NONE
No type / invalid.
Definition: tdcbase.h:113
@ SIM_NORMAL
Time diffs normally distributed, channels uniformly.
Definition: tdcbase.h:110
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 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:57
__int32 Int32
32 bit integer for MSVC
Definition: tdcdecl.h:54
#define TDC_CC
Calling convention
Definition: tdcdecl.h:34
__int64 Int64
64 bit integer for MSVC
Definition: tdcdecl.h:55
unsigned __int8 Uint8
8-Bit unsigned int for MSVC
Definition: tdcdecl.h:56
#define TDC_API
External DLL interface.
Definition: tdcdecl.h:38