diff --git a/srslte/include/srslte/ue/ue_sync.h b/srslte/include/srslte/ue/ue_sync.h index 04efe3c18..3764e4331 100644 --- a/srslte/include/srslte/ue/ue_sync.h +++ b/srslte/include/srslte/ue/ue_sync.h @@ -75,6 +75,7 @@ typedef struct SRSLTE_API { uint32_t agc_period; void *stream; + void *stream_single; int (*recv_callback)(void*, cf_t*[SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*); int (*recv_callback_single)(void*, void*, uint32_t, srslte_timestamp_t*); srslte_timestamp_t last_timestamp; diff --git a/srslte/lib/rf/rf_uhd_imp.c b/srslte/lib/rf/rf_uhd_imp.c index f4e8671f8..8a260a7e4 100644 --- a/srslte/lib/rf/rf_uhd_imp.c +++ b/srslte/lib/rf/rf_uhd_imp.c @@ -519,9 +519,6 @@ int rf_uhd_recv_with_time(void *h, return rf_uhd_recv_with_time_multi(h, &data, nsamples, blocking, secs, frac_secs); } -cf_t data1[1024*100]; -cf_t data2[1024*100]; - int rf_uhd_recv_with_time_multi(void *h, void **data, uint32_t nsamples, diff --git a/srslte/lib/ue/ue_sync.c b/srslte/lib/ue/ue_sync.c index 4cf61bbb3..42aab49e2 100644 --- a/srslte/lib/ue/ue_sync.c +++ b/srslte/lib/ue/ue_sync.c @@ -109,7 +109,7 @@ int srslte_ue_sync_start_agc(srslte_ue_sync_t *q, double (set_gain_callback)(voi int recv_callback_multi_to_single(void *h, cf_t *x[SRSLTE_MAX_PORTS], uint32_t nsamples, srslte_timestamp_t*t) { srslte_ue_sync_t *q = (srslte_ue_sync_t*) h; - return q->recv_callback_single(q->stream, (void*) x[0], nsamples, t); + return q->recv_callback_single(q->stream_single, (void*) x[0], nsamples, t); } int srslte_ue_sync_init(srslte_ue_sync_t *q, @@ -117,8 +117,10 @@ int srslte_ue_sync_init(srslte_ue_sync_t *q, int (recv_callback)(void*, void*, uint32_t,srslte_timestamp_t*), void *stream_handler) { + int ret = srslte_ue_sync_init_multi(q, cell, recv_callback_multi_to_single, 1, (void*) q); q->recv_callback_single = recv_callback; - return srslte_ue_sync_init_multi(q, cell, recv_callback_multi_to_single, 1, q); + q->stream_single = stream_handler; + return ret; } int srslte_ue_sync_init_multi(srslte_ue_sync_t *q, @@ -459,13 +461,12 @@ static int receive_samples(srslte_ue_sync_t *q, cf_t *input_buffer[SRSLTE_MAX_PO /* Get N subframes from the USRP getting more samples and keeping the previous samples, if any */ cf_t *ptr[SRSLTE_MAX_PORTS]; - for (int i=0;inof_rx_antennas;i++) { ptr[i] = &input_buffer[i][q->next_rf_sample_offset]; } if (q->recv_callback(q->stream, ptr, q->frame_len - q->next_rf_sample_offset, &q->last_timestamp) < 0) { return SRSLTE_ERROR; } - /* reset time offset */ q->next_rf_sample_offset = 0;