10 #include "dataVars.hh"
13 #define RING_BUFFER_SIZE 536870912
23 int try_push(
int chan, int16_t *
data,
int n);
26 void push(
int chan, int16_t *
data,
int n);
29 int try_pull(
int chan, int16_t *&
data);
33 int pull(
bool *timeout,
int chan, int16_t *&
data);
36 std::atomic<int64_t> write[CHNUM];
38 std::atomic<int64_t> read[CHNUM];
40 std::atomic<int64_t> occupancy[CHNUM];
43 int64_t current_tail[CHNUM];
45 int64_t next_tail[CHNUM];
47 int64_t current_head[CHNUM];
50 int64_t write_num[CHNUM];
51 int64_t read_num[CHNUM];
54 static const int64_t size = RING_BUFFER_SIZE;
57 int16_t* buffer[CHNUM];
60 int64_t increment(
int n,
int x){
61 return (n + x) % size;