fixed ue_sync API compatibility with single antenna

master
Ismael Gomez 8 years ago
parent f581cd0592
commit 0d32284695

@ -75,6 +75,7 @@ typedef struct SRSLTE_API {
uint32_t agc_period; uint32_t agc_period;
void *stream; void *stream;
void *stream_single;
int (*recv_callback)(void*, cf_t*[SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t*); 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*); int (*recv_callback_single)(void*, void*, uint32_t, srslte_timestamp_t*);
srslte_timestamp_t last_timestamp; srslte_timestamp_t last_timestamp;

@ -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); 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, int rf_uhd_recv_with_time_multi(void *h,
void **data, void **data,
uint32_t nsamples, uint32_t nsamples,

@ -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) 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; 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, 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*), int (recv_callback)(void*, void*, uint32_t,srslte_timestamp_t*),
void *stream_handler) 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; 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, 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 */ /* Get N subframes from the USRP getting more samples and keeping the previous samples, if any */
cf_t *ptr[SRSLTE_MAX_PORTS]; cf_t *ptr[SRSLTE_MAX_PORTS];
for (int i=0;i<SRSLTE_MAX_PORTS;i++) { for (int i=0;i<q->nof_rx_antennas;i++) {
ptr[i] = &input_buffer[i][q->next_rf_sample_offset]; 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) { if (q->recv_callback(q->stream, ptr, q->frame_len - q->next_rf_sample_offset, &q->last_timestamp) < 0) {
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
/* reset time offset */ /* reset time offset */
q->next_rf_sample_offset = 0; q->next_rf_sample_offset = 0;

Loading…
Cancel
Save