Commit e823f390 authored by Joanne Hugé's avatar Joanne Hugé

wip

parent 836f330e
......@@ -91,13 +91,34 @@ static volatile char * rbuf_read(ring_buffer_t * rbuf, size_t * size) {
return data;
}
static size_t rbuf_contiguous_copy_single(ring_buffer_t * rbuf,
size_t block_size, size_t max_blocks) {
size_t n_blocks;
if(!rbuf)
return 0;
n_blocks = (rbuf->len - rbuf->read_index) / block_size;
if (!n_blocks) {
if (n_blocks > max_blocks)
return max_blocks;
return n_blocks;
}
/* Returns maximum contiguous size on which rbuf_src can be copied to rbuf_dst */
static size_t rbuf_contiguous_copy(ring_buffer_t * rbuf_src,
ring_buffer_t * rbuf_dst, size_t n) {
size_t ret = n;
ring_buffer_t * rbuf_dst,
size_t block_size, size_t max_blocks) {
size_t n_blocks;
if(rbuf_src) {
n = rbuf_src->len - rbuf_src->read_index;
ret = n < ret ? n : ret;
max_size = rbuf_src->len - rbuf_src->read_index;
if(size > max_size) {
size = max_size;
}
else if (size < min_size) {
index = 0;
size =
}
size = max_size < size ? max_size : size;
}
if(rbuf_dst)
n = rbuf_dst->len - rbuf_dst->write_index;
......
......@@ -814,6 +814,7 @@ static void trx_ecpri_write(TRXState *s1, trx_timestamp_t timestamp, const void
log_debug("TRX_ECPRI_WRITE", "trx_ecpri_write, count = %ld", count / N_SAMPLES);
// Consistency check
if(prev_count && ((timestamp - prev_timestamp) != prev_count)) {
log_exit("TRX_ECPRI_WRITE",
"Gap between timestamps: prev_ts %li ts %li prev_count %li count %li diff_ts %li",
......@@ -821,6 +822,7 @@ static void trx_ecpri_write(TRXState *s1, trx_timestamp_t timestamp, const void
}
prev_timestamp = timestamp; prev_count = count;
// Drop samples if we don't have enough space in trx write buffer
if(count > (rbuf_write_amount(&trxw_rbuf[0]) / sizeof(Complex)) ) {
//log_exit("TRX_ECPRI_WRITE",
// "Not enough space to write in trxw_rbuf (count = %d)", count);
......@@ -859,7 +861,8 @@ static void trx_ecpri_write(TRXState *s1, trx_timestamp_t timestamp, const void
- ptimestamp: number of total read IQ samples
- __samples: IQ samples returned
*/
static int trx_ecpri_read(TRXState *s1, trx_timestamp_t *ptimestamp, void **__samples, int count, int rx_port_index, TRXReadMetadata *md)
static int trx_ecpri_read(TRXState *s1, trx_timestamp_t *ptimestamp, void **__samples,
int count, int rx_port_index, TRXReadMetadata *md)
{
int64_t nc, count_left, offset;
float ** _samples = (float **) __samples;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment