Functions | |
int | rb_set_nonblocking () |
int | rb_create (int size, int max_event_size, int *handle) |
int | rb_delete (int handle) |
int | rb_get_wp (int handle, void **p, int millisec) |
int | rb_increment_wp (int handle, int size) |
int | rb_get_rp (int handle, void **p, int millisec) |
int | rb_increment_rp (int handle, int size) |
int | rb_get_buffer_level (int handle, int *n_bytes) |
int rb_create | ( | int | size, | |
int | max_event_size, | |||
int * | handle | |||
) |
Create a ring buffer with a given size
Provide an inter-thread buffer scheme for handling front-end events. This code allows concurrent data acquisition, calibration and network transfer on a multi-CPU machine. One thread reads out the data, passes it via the ring buffer functions to another thread running on the other CPU, which can then calibrate and/or send the data over the network.
size | Size of ring buffer, must be larger than 2*max_event_size | |
max_event_size | Maximum event size to be placed into | |
*handle | Handle to ring buffer |
int rb_delete | ( | int | handle | ) |
int rb_get_buffer_level | ( | int | handle, | |
int * | n_bytes | |||
) |
int rb_get_rp | ( | int | handle, | |
void ** | p, | |||
int | millisec | |||
) |
Obtain the current read pointer at which new data is available with optional timeout
handle | Ring buffer handle | |
millisec | Optional timeout in milliseconds if buffer is full. Zero to not wait at all (non-blocking) | |
**p | Address of pointer pointing to newly available data. If p == NULL, only return status. |
Definition at line 14232 of file midas.c.
Referenced by receive_trigger_event().
int rb_get_wp | ( | int | handle, | |
void ** | p, | |||
int | millisec | |||
) |
Retrieve write pointer where new data can be written
handle | Ring buffer handle | |
millisec | Optional timeout in milliseconds if buffer is full. Zero to not wait at all (non-blocking) | |
**p | Write pointer |
Definition at line 14094 of file midas.c.
Referenced by interrupt_routine(), and readout_thread().
int rb_increment_rp | ( | int | handle, | |
int | size | |||
) |
Increment current read pointer, freeing up space for the writing thread.
handle | Ring buffer handle | |
size | Number of bytes to free up at current read pointer |
Definition at line 14294 of file midas.c.
Referenced by receive_trigger_event().
int rb_increment_wp | ( | int | handle, | |
int | size | |||
) |
rb_increment_wp
Increment current write pointer, making the data at the write pointer available to the receiving thread
handle | Ring buffer handle | |
size | Number of bytes placed at the WP |
Definition at line 14170 of file midas.c.
Referenced by interrupt_routine(), and readout_thread().
int rb_set_nonblocking | ( | ) |