Struct sc_pipe_callbacks

Struct Documentation

struct sc_pipe_callbacks

Set of callback functions provided by the application developer to be called from the scTDC library for a USER_CALLBACKS pipe. The callback functions handle various events and the reception of TDC or DLD data. They are called synchronously from the library thread that decodes the protocol stream from the hardware, thus preserving correct chronological order of data and events.

Any callback pointers may be set to zero if the application does not need information about one or another event or data. For example, the tdc_event callback can be set to zero for DLD applications. (version 1.3017.5 fixes crashes for the case where ‘start_of_measure’ is zero).

Callback functions must limit the amount of time they need to execute, since the internal decoding of the hardware protocol stream pauses until the callback function returns. For best performance, you may decide to put the data you are interested in into a memory buffer that can be processed by a different thread, afterwards.

Furthermore, it is generally not possible to start new measurements from within the ‘end_of_measure’ callback. To work around this limit, it is recommended to use some notification mechanism into your main thread to schedule the start of the next measurement.

Make sure, not to pass this struct directly into the sc_pipe_open2() function. The correct usage is to take the address of a sc_pipe_callbacks variable, set this address in the ‘callbacks’ field of a sc_pipe_callback_params_t variable and pass the address of this latter variable to sc_pipe_open2().

Public Members

void *priv

Private user pointer that is passed back into the callback functions

void (*start_of_measure)(void *priv)

Called when the start of a measurement appears in the hardware protocol stream.

void (*end_of_measure)(void *priv)

Called when the end of a measurement appears in the hardware protocol stream.

void (*millisecond_countup)(void *priv)

Called at points where the hardware recorded an ellapsed millisecond.

void (*statistics)(void *priv, const struct statistics_t *stat)

Called when statistics info appears in the hardware protocol stream, usually at the end of measurements.

void (*tdc_event)(void *priv, const struct sc_TdcEvent *const event_array, size_t event_array_len)

Called for transmission of TDC events (event_array_len = number of events)

void (*dld_event)(void *priv, const struct sc_DldEvent *const event_array, size_t event_array_len)

Called for transmission of DLD events (event_array_len = number of events)