scTDCLibrary
scTDC_types.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #ifndef ssize_t
8 #ifdef __linux__
9  #include <sys/types.h>
10 #elif _WIN32
11  #ifdef _MSC_VER
12  #include <BaseTsd.h>
13  typedef SSIZE_T ssize_t;
14  #elif __MINGW32__
15  #include <sys/types.h>
16  #endif
17 #endif
18 #endif
19 
25 #define SEPARATORS_TO_FLOW 0x01
26 
32 #define STATISTICS_TO_FLOW 0x02
33 
39 #define MILLISECONDS_TO_FLOW 0x04
40 
47 #define FLIM_BOTH_WAY_SCAN 0x01
48 
54 #define FLIM_XY_SWAP 0x02
55 
56 
61 struct sc3d_t
62 {
63  int x;
64  int y;
65  long long time;
66 };
67 
72 struct sc3du_t
73 {
74  unsigned int x;
75  unsigned int y;
76  unsigned long long time;
77 };
78 
85 struct roi_t
86 {
87  struct sc3d_t offset;
88  struct sc3du_t size;
89 };
90 
97 {
99  unsigned int counts_read[4][16];
101  unsigned int counts_received[4][16];
103  unsigned int events_found[4];
105  unsigned int events_in_roi[4];
107  unsigned int events_received[4];
108  unsigned int counters[4][16];
109  unsigned int reserved[52];
110 };
111 
113 {
114  unsigned long long counts_read;
115  unsigned long long counts_received;
116  unsigned long long counter;
117  unsigned long long reserved[5];
118 };
119 
121 {
122  unsigned long long events_found;
123  unsigned long long events_in_roi;
124  unsigned long long events_received;
125  unsigned long long reserved[5];
126 };
127 
132 {
133  BS8 = 0,
134  BS16 = 1,
135  BS32 = 2,
136  BS64= 3,
137  F32 = 4,
138  F64 = 5
139 };
140 
147 {
148  unsigned char total_bits_length;
150  unsigned char channel_offset;
152  unsigned char channel_length;
155  unsigned char time_data_offset;
157  unsigned char time_data_length;
160  unsigned char time_tag_offset;
161  unsigned char time_tag_length;
162  unsigned char start_counter_offset;
163  unsigned char start_counter_length;
168  unsigned char dif1_offset;
169  unsigned char dif1_length;
171  unsigned char dif2_offset;
172  unsigned char dif2_length;
174  unsigned char sum_offset;
176  unsigned char sum_length;
178  unsigned char sign_counter_offset;
179  unsigned char sign_counter_length;
180  unsigned char reserved[14];
181  unsigned char flow_control_flags;
182 };
183 
188 {
189  TDC_HISTO = 0,
196  TMSTAMP_TDC_HISTO = 7,
197  TDC_STATISTICS = 8,
198  DLD_STATISTICS = 9,
199  USER_CALLBACKS = 10,
200  DLD_IMAGE_XY_EXT = 11
201 };
202 
209 {
211  int channel;
212  unsigned long long modulo;
213  struct sc3du_t binning;
214  struct roi_t roi;
215  unsigned int accumulation_ms;
221  int (*allocator_cb)(void *, void **);
222 };
223 
230 {
232  int channel;
233  unsigned long long modulo;
234  struct sc3du_t binning;
235  struct roi_t roi;
236  unsigned int accumulation_ms;
237  void *allocator_owner;
242  int (*allocator_cb)(void *, void **);
243 };
244 
251 {
252  enum bitsize_t depth;
253  int channel;
254  unsigned long long modulo;
255  struct sc3du_t binning;
256  struct roi_t roi;
257  unsigned int accumulation_ms;
258  void *allocator_owner;
263  int (*allocator_cb)(void *, void **);
264 };
265 
275 {
276  enum bitsize_t depth;
277  int channel;
278  unsigned long long modulo;
279  struct sc3du_t binning;
280  struct roi_t roi;
281  unsigned int accumulation_ms;
282  void *allocator_owner;
287  int (*allocator_cb)(void *, void **);
288 };
289 
296 {
298  int channel;
299  unsigned long long modulo;
300  struct sc3du_t binning;
301  struct roi_t roi;
302  unsigned int accumulation_ms;
308  int (*allocator_cb)(void *, void **);
309 };
310 
317 {
319  unsigned int channel;
320  unsigned long long modulo;
321  unsigned int binning;
322  unsigned long long offset;
323  unsigned int size;
324  unsigned int accumulation_ms;
325  void *allocator_owner;
330  int (*allocator_cb)(void *, void **);
331 };
332 
339 {
340  void *allocator_owner;
345  int (*allocator_cb)(void *, void **);
346 };
347 
349 {
350  void *allocator_owner;
351  int (*allocator_cb) (void *, void **);
352  int channel_number;
353 };
354 
356 {
357  void *allocator_owner;
358  int (*allocator_cb) (void *, void **);
359  int device_number;
360 };
361 
362 enum sc_pipe_param_extension_type
363 {
364  SC_PIPE_PARAM_EXTENSION_TYPE_IMAGE_SOURCE
365 };
366 
368 {
369  enum sc_pipe_param_extension_type type;
370  void *extension;
371  enum sc_ImageSource {
372  EVENTS,
373  RAMDATA,
374  BOTH
375  } source;
376 };
377 
379 {
380  struct sc_pipe_dld_image_xy_params_t base;
381  void *extension;
382 };
383 
388 {
389  unsigned subdevice;
390  unsigned channel;
391  unsigned long long start_counter;
392  unsigned long long time_tag;
393  unsigned long long time_data;
394  unsigned long long sign_counter;
395 };
396 
401 {
402  unsigned long long start_counter;
403  unsigned long long time_tag;
404  unsigned subdevice;
405  unsigned channel;
406  unsigned long long sum;
407  unsigned short dif1;
408  unsigned short dif2;
409  unsigned master_rst_counter;
410  unsigned short adc;
411  unsigned short signal1bit;
412 };
413 
426 {
428  void *priv;
430  void (*start_of_measure) (void *priv);
432  void (*end_of_measure) (void *priv);
434  void (*millisecond_countup) (void *priv);
436  void (*statistics) (void *priv, const struct statistics_t *stat);
438  void (*tdc_event)
439  (void *priv, const struct sc_TdcEvent *const event_array, size_t event_array_len);
441  void (*dld_event)
442  (void *priv, const struct sc_DldEvent *const event_array, size_t event_array_len);
443 };
444 
449 {
450  struct sc_pipe_callbacks *callbacks;
451 };
452 
453 
459 const unsigned long long sc_mask64[] = {
460  0x0000000000000000ULL,
461  0x0000000000000001ULL,
462  0x0000000000000003ULL,
463  0x0000000000000007ULL,
464  0x000000000000000FULL,
465  0x000000000000001FULL,
466  0x000000000000003FULL,
467  0x000000000000007FULL,
468  0x00000000000000FFULL,
469  0x00000000000001FFULL,
470  0x00000000000003FFULL,
471  0x00000000000007FFULL,
472  0x0000000000000FFFULL,
473  0x0000000000001FFFULL,
474  0x0000000000003FFFULL,
475  0x0000000000007FFFULL,
476  0x000000000000FFFFULL,
477  0x000000000001FFFFULL,
478  0x000000000003FFFFULL,
479  0x000000000007FFFFULL,
480  0x00000000000FFFFFULL,
481  0x00000000001FFFFFULL,
482  0x00000000003FFFFFULL,
483  0x00000000007FFFFFULL,
484  0x0000000000FFFFFFULL,
485  0x0000000001FFFFFFULL,
486  0x0000000003FFFFFFULL,
487  0x0000000007FFFFFFULL,
488  0x000000000FFFFFFFULL,
489  0x000000001FFFFFFFULL,
490  0x000000003FFFFFFFULL,
491  0x000000007FFFFFFFULL,
492  0x00000000FFFFFFFFULL,
493  0x00000001FFFFFFFFULL,
494  0x00000003FFFFFFFFULL,
495  0x00000007FFFFFFFFULL,
496  0x0000000FFFFFFFFFULL,
497  0x0000001FFFFFFFFFULL,
498  0x0000003FFFFFFFFFULL,
499  0x0000007FFFFFFFFFULL,
500  0x000000FFFFFFFFFFULL,
501  0x000001FFFFFFFFFFULL,
502  0x000003FFFFFFFFFFULL,
503  0x000007FFFFFFFFFFULL,
504  0x00000FFFFFFFFFFFULL,
505  0x00001FFFFFFFFFFFULL,
506  0x00003FFFFFFFFFFFULL,
507  0x00007FFFFFFFFFFFULL,
508  0x0000FFFFFFFFFFFFULL,
509  0x0001FFFFFFFFFFFFULL,
510  0x0003FFFFFFFFFFFFULL,
511  0x0007FFFFFFFFFFFFULL,
512  0x000FFFFFFFFFFFFFULL,
513  0x001FFFFFFFFFFFFFULL,
514  0x003FFFFFFFFFFFFFULL,
515  0x007FFFFFFFFFFFFFULL,
516  0x00FFFFFFFFFFFFFFULL,
517  0x01FFFFFFFFFFFFFFULL,
518  0x03FFFFFFFFFFFFFFULL,
519  0x07FFFFFFFFFFFFFFULL,
520  0x0FFFFFFFFFFFFFFFULL,
521  0x1FFFFFFFFFFFFFFFULL,
522  0x3FFFFFFFFFFFFFFFULL,
523  0x7FFFFFFFFFFFFFFFULL,
524  0xFFFFFFFFFFFFFFFFULL,
525 };
526 
532 const unsigned int sc_mask32[] = {
533  0x00000000,
534  0x00000001,
535  0x00000003,
536  0x00000007,
537  0x0000000F,
538  0x0000001F,
539  0x0000003F,
540  0x0000007F,
541  0x000000FF,
542  0x000001FF,
543  0x000003FF,
544  0x000007FF,
545  0x00000FFF,
546  0x00001FFF,
547  0x00003FFF,
548  0x00007FFF,
549  0x0000FFFF,
550  0x0001FFFF,
551  0x0003FFFF,
552  0x0007FFFF,
553  0x000FFFFF,
554  0x001FFFFF,
555  0x003FFFFF,
556  0x007FFFFF,
557  0x00FFFFFF,
558  0x01FFFFFF,
559  0x03FFFFFF,
560  0x07FFFFFF,
561  0x0FFFFFFF,
562  0x1FFFFFFF,
563  0x3FFFFFFF,
564  0x7FFFFFFF,
565  0xFFFFFFFF,
566 };
567 
568 
577 };
578 
584 enum sc_LoggerFacility {UNUSED}; //TODO: Remove
585 
592 struct sc_Logger
593 {
594  void *private_data;
601  void (*do_log)(void *pd, const char *sender, const char *msg);
602 };
603 
605 {
606  void (*cb)(void *);
607  void *private_data;
608 };
609 
611 {
612  const char *section;
613  const char *key;
614  const char *value;
615 };
616 
623 {
626  double pixel_size_x;
627  double pixel_size_y;
628  double pixel_size_t;
629 };
630 
635 {
637 };
638 
643 {
644  size_t dld_event_size;
645  size_t tdc_event_size;
647 };
648 
654 {
655  enum sc_ShutterMode {
656  FULLY_EXTERNAL,
657  IMMEDIATE_START_INTERNAL_TIMER,
658  IMMEDIATE_START_INTERNAL_TIMER_MULTIPLE_SLOPES,
659  EXTERNAL_START_INTERNAL_TIMER,
660  EXTERNAL_START_INTERNAL_TIMER_MULTIPLE_SLOPES,
661  IMMEDIATE_START_EXTERNAL_FINISH
662  } shutter_mode;
663  unsigned int single_slope_us;
664  unsigned int dual_slope_us;
665  unsigned int triple_slope_us;
666  unsigned int frame_count;
667  unsigned int analog_gain;
668  double digital_gain;
669  unsigned int black_offset;
670  int black_cal_offset;
671  unsigned int smoother_shift1;
672  unsigned char smoother_pixel_mask1 [8][8];
673  unsigned int smoother_shift2;
674  unsigned char smoother_pixel_mask2 [8][8];
675 };
676 
682 {
683  unsigned int unbinning;
684  unsigned int dif_min_top;
685  unsigned int dif_min_bottom;
686  double z_scale_factor;
687 };
Definition: scTDC_types.h:134
sc_pipe_type_t
Pipe type.
Definition: scTDC_types.h:187
Parameters for DLD_IMAGE_YT pipe type.
Definition: scTDC_types.h:250
int(* allocator_cb)(void *, void **)
Definition: scTDC_types.h:308
unsigned long long time
Definition: scTDC_types.h:76
unsigned long long modulo
Definition: scTDC_types.h:320
struct sc3du_t detector_size
Definition: scTDC_types.h:624
Definition: scTDC_types.h:195
unsigned char dif2_offset
Definition: scTDC_types.h:171
Description of region of interest to be used.
Definition: scTDC_types.h:85
unsigned long long offset
Definition: scTDC_types.h:322
Definition: scTDC_types.h:192
enum bitsize_t depth
Definition: scTDC_types.h:210
int y
Definition: scTDC_types.h:64
unsigned short dif2
Definition: scTDC_types.h:408
unsigned int binning
Definition: scTDC_types.h:321
unsigned int events_received[4]
Definition: scTDC_types.h:107
int(* allocator_cb)(void *, void **)
Definition: scTDC_types.h:330
struct roi_t roi
Definition: scTDC_types.h:301
unsigned long long time_tag
Definition: scTDC_types.h:392
unsigned subdevice
Definition: scTDC_types.h:389
Device Properties 1.
Definition: scTDC_types.h:622
const unsigned int sc_mask32[]
Used to help user to extract data fields from the event.
Definition: scTDC_types.h:532
Definition: scTDC_types.h:112
struct roi_t roi
Definition: scTDC_types.h:214
Parameters for DLD_IMAGE_3D pipe type.
Definition: scTDC_types.h:274
Dld data received from device.
Definition: scTDC_types.h:400
Parameters for STATISTICS pipe type.
Definition: scTDC_types.h:338
unsigned int accumulation_ms
Definition: scTDC_types.h:215
int channel
Definition: scTDC_types.h:298
Definition: scTDC_types.h:138
Definition: scTDC_types.h:193
void(* tdc_event)(void *priv, const struct sc_TdcEvent *const event_array, size_t event_array_len)
Definition: scTDC_types.h:439
unsigned long long start_counter
Definition: scTDC_types.h:402
unsigned char start_counter_length
Definition: scTDC_types.h:163
Tdc data received from device.
Definition: scTDC_types.h:387
size_t tdc_event_size
Definition: scTDC_types.h:645
const unsigned long long sc_mask64[]
Used to help user to extract data fields from the event.
Definition: scTDC_types.h:459
double pixel_size_t
Definition: scTDC_types.h:628
void(* end_of_measure)(void *priv)
Definition: scTDC_types.h:432
Definition: scTDC_types.h:576
Definition: scTDC_types.h:189
unsigned char flow_control_flags
Definition: scTDC_types.h:181
Definition: scTDC_types.h:574
Device Properties 3.
Definition: scTDC_types.h:642
unsigned char dif1_offset
Definition: scTDC_types.h:168
Definition: scTDC_types.h:355
int x
Definition: scTDC_types.h:63
Definition: scTDC_types.h:348
unsigned int y
Definition: scTDC_types.h:75
Definition: scTDC_types.h:135
unsigned channel
Definition: scTDC_types.h:390
void(* dld_event)(void *priv, const struct sc_DldEvent *const event_array, size_t event_array_len)
Definition: scTDC_types.h:442
unsigned long long sum
Definition: scTDC_types.h:406
struct sc3du_t binning
Definition: scTDC_types.h:300
Parameters for DLD_IMAGE_XY pipe type.
Definition: scTDC_types.h:208
long long time
Definition: scTDC_types.h:65
unsigned char sum_offset
Definition: scTDC_types.h:174
unsigned char reserved[14]
Definition: scTDC_types.h:180
void(* statistics)(void *priv, const struct statistics_t *stat)
Definition: scTDC_types.h:436
void * priv
Definition: scTDC_types.h:428
Definition: scTDC_types.h:367
unsigned int events_found[4]
Definition: scTDC_types.h:103
Definition: scTDC_types.h:136
Definition: scTDC_types.h:194
unsigned int channel
Definition: scTDC_types.h:319
Definition: scTDC_types.h:190
int channel
Definition: scTDC_types.h:211
Definition: scTDC_types.h:191
int(* allocator_cb)(void *, void **)
Definition: scTDC_types.h:263
Parameters for DLD_SUM_HISTO pipe type.
Definition: scTDC_types.h:295
unsigned int counts_read[4][16]
Definition: scTDC_types.h:99
unsigned int events_in_roi[4]
Definition: scTDC_types.h:105
unsigned int accumulation_ms
Definition: scTDC_types.h:302
Parameters for DLD_IMAGE_XT pipe type.
Definition: scTDC_types.h:229
unsigned int counts_received[4][16]
Definition: scTDC_types.h:101
int(* allocator_cb)(void *, void **)
Definition: scTDC_types.h:287
unsigned char time_data_offset
Definition: scTDC_types.h:155
Definition: scTDC_types.h:378
unsigned int x
Definition: scTDC_types.h:74
sc_event_type_index
Used to find out type of event.
Definition: scTDC_types.h:573
void(* do_log)(void *pd, const char *sender, const char *msg)
Logger callback function.
Definition: scTDC_types.h:601
double pixel_size_y
Definition: scTDC_types.h:627
unsigned char channel_length
Definition: scTDC_types.h:152
Parameters for TDC_HISTO pipe type.
Definition: scTDC_types.h:316
unsigned long long time_tag
Definition: scTDC_types.h:403
size_t user_callback_size
Definition: scTDC_types.h:646
Parameters for USER_CALLBACKS pipe type.
Definition: scTDC_types.h:448
void(* start_of_measure)(void *priv)
Definition: scTDC_types.h:430
unsigned char time_data_length
Definition: scTDC_types.h:157
unsigned long long start_counter
Definition: scTDC_types.h:391
Definition: scTDC_types.h:604
unsigned char start_counter_offset
Definition: scTDC_types.h:162
struct sc3du_t size
Definition: scTDC_types.h:88
unsigned char sum_length
Definition: scTDC_types.h:176
enum bitsize_t depth
Definition: scTDC_types.h:297
Logger descriptor used for debug.
Definition: scTDC_types.h:592
bitsize_t
Size of the pixel for images or one histogram element in time histograms.
Definition: scTDC_types.h:131
unsigned long long modulo
Definition: scTDC_types.h:212
sc_LoggerFacility
Logging level.
Definition: scTDC_types.h:584
Definition: scTDC_types.h:120
unsigned long long time_data
Definition: scTDC_types.h:393
Blob parameters structure.
Definition: scTDC_types.h:681
int(* allocator_cb)(void *, void **)
Definition: scTDC_types.h:345
Definition: scTDC_types.h:137
unsigned char dif2_length
Definition: scTDC_types.h:172
size_t dld_event_size
Definition: scTDC_types.h:644
enum bitsize_t depth
Definition: scTDC_types.h:318
int tdc_channel_number
Definition: scTDC_types.h:636
struct sc3du_t binning
Definition: scTDC_types.h:213
unsigned int size
Definition: scTDC_types.h:323
int(* allocator_cb)(void *, void **)
Definition: scTDC_types.h:221
void * allocator_owner
Definition: scTDC_types.h:216
void(* millisecond_countup)(void *priv)
Definition: scTDC_types.h:434
unsigned char total_bits_length
Definition: scTDC_types.h:148
Definition: scTDC_types.h:575
Unsigned 3d point.
Definition: scTDC_types.h:72
Measure statistics. First array index corresponds to device number in a component device...
Definition: scTDC_types.h:96
double pixel_size_x
Definition: scTDC_types.h:626
unsigned short dif1
Definition: scTDC_types.h:407
void * allocator_owner
Definition: scTDC_types.h:303
Signed 3d point.
Definition: scTDC_types.h:61
Cmos and Smoother parameters structure.
Definition: scTDC_types.h:653
Definition: scTDC_types.h:610
Set of callback functions provided by user to be later called when different events, tdc or dld data received.
Definition: scTDC_types.h:425
unsigned int accumulation_ms
Definition: scTDC_types.h:324
Definition: scTDC_types.h:133
int(* allocator_cb)(void *, void **)
Definition: scTDC_types.h:242
unsigned long long modulo
Definition: scTDC_types.h:299
Device Properties 2.
Definition: scTDC_types.h:634
void * private_data
Definition: scTDC_types.h:594
unsigned subdevice
Definition: scTDC_types.h:404
enum bitsize_t depth
Definition: scTDC_types.h:231
struct sc3d_t offset
Definition: scTDC_types.h:87
Contains sizes and offsets of data bitfields.
Definition: scTDC_types.h:146
unsigned char channel_offset
Definition: scTDC_types.h:150
unsigned char dif1_length
Definition: scTDC_types.h:169