scTDCLibrary
Macros | Functions
scTDC.h File Reference

Go to the source code of this file.

Macros

#define ERRSTRLEN   256
 

Functions

SCTDCDLL_PUBLIC void sc_get_err_msg (int err_code, char *err_msg)
 Gives an error description in a text form. More...
 
SCTDCDLL_PUBLIC int sc_tdc_is_event (const enum sc_event_type_index type, const void *event, const unsigned event_len_bytes)
 Check type of event data. More...
 
SCTDCDLL_PUBLIC int sc_tdc_init_inifile (const char *ini_filename)
 Initializes the hardware and loads the initial settings reading it from ini file. More...
 
SCTDCDLL_PUBLIC int sc_tdc_init_with_config_lines (const struct sc_ConfigLine *confline_array)
 Initializes the hardware and loads the initial settings taken from array of sc_ConfigLine structures. More...
 
SCTDCDLL_PUBLIC int sc_tdc_deinit2 (const int dev_desc)
 Deinitialize the hardware. More...
 
SCTDCDLL_PUBLIC int sc_tdc_get_format2 (const int dev_desc, struct sc_tdc_format *format)
 Get data format of the tdc events. More...
 
SCTDCDLL_PUBLIC int sc_tdc_set_complete_callback2 (const int, void *owner, void(*cb)(void *, int))
 
SCTDCDLL_PUBLIC int sc_tdc_start_measure2 (const int dev_desc, const int ms)
 Start measure. More...
 
SCTDCDLL_PUBLIC int sc_tdc_interrupt2 (const int dev_desc)
 Stop measure. More...
 
SCTDCDLL_PUBLIC int sc_tdc_get_binsize2 (const int dev_desc, double *binsize_ns)
 Get binsize in nanoseconds. More...
 
SCTDCDLL_PUBLIC int sc_tdc_get_status2 (const int dev_desc, int *status)
 Get running status. More...
 
SCTDCDLL_PUBLIC int sc_twi_write2 (const int, const unsigned char address, const unsigned char *data, const size_t size, const int stop)
 
SCTDCDLL_PUBLIC int sc_twi_read2 (const int, const unsigned char address, unsigned char *data, const size_t size, const int stop)
 
SCTDCDLL_PUBLIC int sc_twi_set_epot2 (const int, unsigned int epot, unsigned int value_number, unsigned char value)
 
SCTDCDLL_PUBLIC int sc_pipe_open2 (const int dev_desc, const enum sc_pipe_type_t type, const void *params)
 Open data pipe. More...
 
SCTDCDLL_PUBLIC int sc_pipe_close2 (const int dev_desc, const int pipe_id)
 Close data pipe. More...
 
SCTDCDLL_PUBLIC int sc_pipe_read2 (const int dev_desc, const int pipe_id, void **buffer, unsigned int timeout)
 Read data from pipe. More...
 
SCTDCDLL_PUBLIC int sc_tdc_set_flim_scanner2 (const int dd, unsigned short pixel_interval, unsigned short pixel_count, unsigned short line_count, unsigned int line_delay_interval, unsigned int multiline_count, double *corr_table)
 
SCTDCDLL_PUBLIC int sc_tdc_set_flim_scanner2ex (const int dd, unsigned short pixel_interval, unsigned short pixel_count, unsigned short line_count, unsigned int line_delay_interval, unsigned int multiline_count, double *corr_table, unsigned int flags)
 
SCTDCDLL_PUBLIC int sc_tdc_is_event2 (const enum sc_event_type_index type, const void *event, const unsigned event_len_bytes)
 
SCTDCDLL_PUBLIC int sc_tdc_set_corrections2 (const int, const int, const int *, const unsigned char *)
 
SCTDCDLL_PUBLIC int sc_tdc_set_common_shift2 (const int, const int)
 
SCTDCDLL_PUBLIC int sc_tdc_set_modulo2 (const int, const unsigned int)
 
SCTDCDLL_PUBLIC int sc_tdc_get_modulo2 (const int, unsigned int *)
 
SCTDCDLL_PUBLIC int sc_tdc_pipe_open2 (const int dd, size_t internal_pipe_size, const struct sc_PipeCbf *pipe_warning, const struct sc_PipeCbf *pipe_alert)
 Open data pipe for tdc events. More...
 
SCTDCDLL_PUBLIC int sc_tdc_pipe_close2 (const int dd)
 Close data pipe for tdc events. More...
 
SCTDCDLL_PUBLIC ssize_t sc_tdc_pipe_read2 (const int dd, void *buffer, size_t buffer_size_bytes, unsigned timeout)
 Read tdc events from the pipe. More...
 
SCTDCDLL_PUBLIC int sc_tdc_config_get_key (const int dd, const char *key, char *buf, size_t buf_size, const char *def)
 Get configuration data. More...
 
SCTDCDLL_PUBLIC void sc_tdc_config_get_library_version (unsigned[3])
 Get scTDC version.
 
SCTDCDLL_PUBLIC int sc_tdc_get_device_properties (const int dd, int params_num, void *params)
 Get Device Properties. More...
 
SCTDCDLL_PUBLIC int sc_dld_set_hardware_binning (const int dd, const struct sc3du_t *binning)
 
SCTDCDLL_PUBLIC int sc_tdc_set_iteration_number2 (const int dd, int itnum)
 Set Iteration Number. More...
 
SCTDCDLL_PUBLIC int sc_tdc_set_cmos_and_smoothers_params (const int dd, const struct sc_CmosSmootherParameters *params)
 Set cmos and smoother parameters. More...
 
SCTDCDLL_PUBLIC int sc_tdc_set_blob_parameters (const int dd, const struct sc_BlobParameters *params)
 Set blob parameters. More...
 
SCTDCDLL_PUBLIC int sc_tdc_get_cmos_and_smoothers_params (const int dd, struct sc_CmosSmootherParameters *params)
 Get cmos and smoother parameters. More...
 
SCTDCDLL_PUBLIC int sc_tdc_get_blob_parameters (const int dd, struct sc_BlobParameters *params)
 Get blob parameters. More...
 
SCTDCDLL_PUBLIC int sc_tdc_set_blob (const int dd, const char *blob)
 Set blob algorithm. More...
 
SCTDCDLL_PUBLIC int sc_tdc_get_blob (const int dd, char *str, size_t str_len, size_t *str_len_ret)
 Get default blob algorithm. More...
 
SCTDCDLL_PUBLIC int sc_tdc_zero_master_reset_counter (const int dd)
 

Function Documentation

SCTDCDLL_PUBLIC void sc_get_err_msg ( int  err_code,
char *  err_msg 
)

Gives an error description in a text form.

Parameters
err_codeInteger error code
err_msgPointer to put a text description.
Note
The err_msg array must be not shorted then ERRSTRLEN constant.
SCTDCDLL_PUBLIC int sc_tdc_is_event ( const enum sc_event_type_index  type,
const void *  event,
const unsigned  event_len_bytes 
)

Check type of event data.

Parameters
typeEvent type for comparison.
eventEvent under testing.
event_len_bytesLength of event in bytes.
Returns
int Result of comparison.

Call this function to test whether event is special sign or not.

Returns non zero value if event is of requested type otherwise returns zero.

SCTDCDLL_PUBLIC int sc_tdc_init_inifile ( const char *  ini_filename)

Initializes the hardware and loads the initial settings reading it from ini file.

Parameters
ini_filenameName of the inifile used for initialization.
Returns
int device descriptor or error code if less then zero.

The function must be called before any other operation and associates an positive integer number (device descriptor) with the device. Device descriptor must be used to identify hardware for any other operation.

Hardware with the same serial number cannot be opened twice. Call sc_tdc_deinit2() to close and deinitialize hardware.

SCTDCDLL_PUBLIC int sc_tdc_init_with_config_lines ( const struct sc_ConfigLine confline_array)

Initializes the hardware and loads the initial settings taken from array of sc_ConfigLine structures.

Parameters
confline_arrayArray of sc_ConfigLine structures which contains configuration needed.
Returns
int device descriptor or error code if less then zero.

The function must be called before any other operation and associates an positive integer number (device destriptor) with the device. Device descriptor must be used to identify hardware for any other operation.

Hardware with the same serial number cannot be opened twice. Call sc_tdc_deinit2() to close and deinitialize hardware.

Last structure of the array must contain sc_ConfigLine::section equal NULL.

SCTDCDLL_PUBLIC int sc_tdc_deinit2 ( const int  dev_desc)

Deinitialize the hardware.

Parameters
dev_descDevice descriptor of the hardware to be deinitialized.
Returns
int 0 or error code.

Call this function to release device and resources allocated to operate. Hardware is deinitialized after the call.

SCTDCDLL_PUBLIC int sc_tdc_get_format2 ( const int  dev_desc,
struct sc_tdc_format format 
)

Get data format of the tdc events.

Parameters
dev_descDevice descriptor.
formatPointer on the structure where format should be placed.
Returns
int 0 or error code.

Call this function to get event format got from tdc pipe. See sc_tdc_pipe_open2() for details.

SCTDCDLL_PUBLIC int sc_tdc_start_measure2 ( const int  dev_desc,
const int  ms 
)

Start measure.

Parameters
dev_descDevice destriptor.
msExposure time in milliseconds.
Returns
int 0 or error code.

Start measurement.

SCTDCDLL_PUBLIC int sc_tdc_interrupt2 ( const int  dev_desc)

Stop measure.

Parameters
dev_descDevice descriptor.
Returns
int 0 or error code.

Stops started exposure.

SCTDCDLL_PUBLIC int sc_tdc_get_binsize2 ( const int  dev_desc,
double *  binsize_ns 
)

Get binsize in nanoseconds.

Parameters
dev_descDevice descriptor.
binsize_nsPointer where binsize should be stored.
Returns
int 0 or error code.
SCTDCDLL_PUBLIC int sc_tdc_get_status2 ( const int  dev_desc,
int *  status 
)

Get running status.

Parameters
dev_descDevice descriptor.
statusPointer where status info must be stored.
Returns
int 0 or error code.

The function could be used to get status of hardware. status 0 means idle state, 1 means that exposure is running.

SCTDCDLL_PUBLIC int sc_pipe_open2 ( const int  dev_desc,
const enum sc_pipe_type_t  type,
const void *  params 
)

Open data pipe.

Parameters
dev_descDevice descriptor
typePipe type.
paramsPipe parameters.
Returns
Positive integer number which is pipe id, or error code. Please note that this is NOT buffer size.
See also
enum sc_pipe_type_t
struct sc_pipe_dld_image_xy_params_t
struct sc_pipe_dld_image_xt_params_t
struct sc_pipe_dld_image_yt_params_t
struct sc_pipe_dld_image_3d_params_t
struct sc_pipe_dld_sum_histo_params_t
struct sc_pipe_tdc_histo_params_t
struct sc_pipe_statistics_params_t
struct sc_pipe_callback_params_t

User can get as many pipes as required. It is not error to get two or more pipes of the same type, but for example with different roi or binning setting.

Note
In case of internal memory allocation if data is not read from the pipe after every exposure memory consumption of the application will grow up. Please be sure that data is read.
SCTDCDLL_PUBLIC int sc_pipe_close2 ( const int  dev_desc,
const int  pipe_id 
)

Close data pipe.

Parameters
dev_descDevice descriptor.
pipe_idPipe id.
Returns
0 or error code.
SCTDCDLL_PUBLIC int sc_pipe_read2 ( const int  dev_desc,
const int  pipe_id,
void **  buffer,
unsigned int  timeout 
)

Read data from pipe.

Parameters
dev_descDevice descriptor.
pipe_idPipe id.
bufferPointe to pointer where data block must be stored.
timeoutTimeout in millisecond.

This function allocates memory with allocator callback from pipe parameters structure if callback function was installed or allocates memory internally. Then copies data from the last exposure and returns the memory block in buffer. If memory was allocated internally it will be deallocated when next call to the function will be performed or pipe will be closed. If memory allocation callback function was installed in the pipe parameters no any deallocation of the memory will be performed. User must manage memory by him-/her- self.

Function returns when: data is available or timeout or pipe is closed.

SCTDCDLL_PUBLIC int sc_tdc_pipe_open2 ( const int  dd,
size_t  internal_pipe_size,
const struct sc_PipeCbf pipe_warning,
const struct sc_PipeCbf pipe_alert 
)

Open data pipe for tdc events.

Parameters
ddDevice descriptor.
internal_pipe_sizeSize of internal data buffer for events in bytes.
pipe_warning90% pipe level callback function.
pipe_alert99% pipe level callback function.
Returns
int 0 or error code.
SCTDCDLL_PUBLIC int sc_tdc_pipe_close2 ( const int  dd)

Close data pipe for tdc events.

Parameters
ddDevice descriptor.
Returns
int 0 or error code.
SCTDCDLL_PUBLIC ssize_t sc_tdc_pipe_read2 ( const int  dd,
void *  buffer,
size_t  buffer_size_bytes,
unsigned  timeout 
)

Read tdc events from the pipe.

Parameters
ddDevice descriptor.
bufferSpace for events.
buffer_size_bytesSize of the buffer in bytes.
timeoutTimeout in milliseconds.
Returns
ssize_t Amount of bytes were copied to the buffer or error code.
See also
sc_tdc_get_format2(), sc_tdc_is_event2(), sc_tdc_is_event()
SCTDCDLL_PUBLIC int sc_tdc_config_get_key ( const int  dd,
const char *  key,
char *  buf,
size_t  buf_size,
const char *  def 
)

Get configuration data.

Parameters
ddDevice descriptor.
keyConfiguration key in form 'section:key'
bufSpace for configuration value as a string.
buf_sizeSize of buf in bytes.
defDefault value.
SCTDCDLL_PUBLIC int sc_tdc_get_device_properties ( const int  dd,
int  params_num,
void *  params 
)

Get Device Properties.

Parameters
ddDevice descriptor.
params_numNumber of properties structure.
paramsProperties structure casted to void pointer.

params_num 1 coresponds to sc_DeviceProperties1 structure. params_num 2 coresponds to sc_DeviceProperties2 structure.

SCTDCDLL_PUBLIC int sc_tdc_set_iteration_number2 ( const int  dd,
int  itnum 
)

Set Iteration Number.

Parameters
ddDevice descriptor.
itnumNumber of iteration per measure.
Returns
int 0 or error code.
SCTDCDLL_PUBLIC int sc_tdc_set_cmos_and_smoothers_params ( const int  dd,
const struct sc_CmosSmootherParameters params 
)

Set cmos and smoother parameters.

Parameters
ddDevice descriptor.
paramsCmos and smoother parameters structure.
Returns
int 0 or error code.
SCTDCDLL_PUBLIC int sc_tdc_set_blob_parameters ( const int  dd,
const struct sc_BlobParameters params 
)

Set blob parameters.

Parameters
ddDevice descriptor.
paramsBlob parameters.
Returns
int 0 or error code.
SCTDCDLL_PUBLIC int sc_tdc_get_cmos_and_smoothers_params ( const int  dd,
struct sc_CmosSmootherParameters params 
)

Get cmos and smoother parameters.

Parameters
ddDevice descriptor.
paramsCmos and smoother parameters structure.
Returns
int 0 or error code.

Function reads default configuration for cmos and smoother from the inifile. Setting parameters with sc_tdc_set_cmos_and_smoothers_params() does not change default parameters.

SCTDCDLL_PUBLIC int sc_tdc_get_blob_parameters ( const int  dd,
struct sc_BlobParameters params 
)

Get blob parameters.

Parameters
ddDevice descriptor.
paramsBlob parameters structure.
Returns
int 0 or error code.

Function read default configuration for blob algorithm from inifile. Setting parameters with sc_tdc_set_blob_parameters does not change default parameters.

SCTDCDLL_PUBLIC int sc_tdc_set_blob ( const int  dd,
const char *  blob 
)

Set blob algorithm.

Parameters
ddDevice descriptor.
blobLibrary name where blob algorithm implemented.
Returns
int 0 or error code.
SCTDCDLL_PUBLIC int sc_tdc_get_blob ( const int  dd,
char *  str,
size_t  str_len,
size_t *  str_len_ret 
)

Get default blob algorithm.

Parameters
ddDevice descriptor.
strBuffer for blob name string.
str_lenBuffer for blob name string length.
str_len_retUsed memory space for blob name string.
Returns
int 0 or error code.