From 591f583edbb3c1543eb51599a52b4f66b55210e7 Mon Sep 17 00:00:00 2001 From: ismagom Date: Mon, 16 Nov 2015 00:31:46 +0100 Subject: [PATCH] Option for ue_sync period --- srslte/include/srslte/ue/ue_sync.h | 4 ++++ srslte/lib/ue/src/ue_sync.c | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/srslte/include/srslte/ue/ue_sync.h b/srslte/include/srslte/ue/ue_sync.h index e702e4bfb..4eea06d8e 100644 --- a/srslte/include/srslte/ue/ue_sync.h +++ b/srslte/include/srslte/ue/ue_sync.h @@ -72,6 +72,7 @@ typedef struct SRSLTE_API { srslte_agc_t agc; bool do_agc; + uint32_t agc_period; void *stream; int (*recv_callback)(void*, void*, uint32_t, srslte_timestamp_t*); @@ -136,6 +137,9 @@ SRSLTE_API uint32_t srslte_ue_sync_sf_len(srslte_ue_sync_t *q); SRSLTE_API int srslte_ue_sync_get_buffer(srslte_ue_sync_t *q, cf_t **sf_symbols); +SRSLTE_API void srslte_ue_sync_set_agc_period(srslte_ue_sync_t *q, + uint32_t period); + /* CAUTION: input_buffer MUST have space for 2 subframes */ SRSLTE_API int srslte_ue_sync_zerocopy(srslte_ue_sync_t *q, cf_t *input_buffer); diff --git a/srslte/lib/ue/src/ue_sync.c b/srslte/lib/ue/src/ue_sync.c index 14406ddd7..c3c13ec7a 100644 --- a/srslte/lib/ue/src/ue_sync.c +++ b/srslte/lib/ue/src/ue_sync.c @@ -122,6 +122,7 @@ int srslte_ue_sync_init(srslte_ue_sync_t *q, q->sf_len = SRSLTE_SF_LEN(q->fft_size); q->file_mode = false; q->correct_cfo = true; + q->agc_period = 0; if (cell.id == 1000) { @@ -268,6 +269,10 @@ void srslte_ue_sync_set_N_id_2(srslte_ue_sync_t *q, uint32_t N_id_2) { } } +void srslte_ue_sync_set_agc_period(srslte_ue_sync_t *q, uint32_t period) { + q->agc_period = period; +} + static int find_peak_ok(srslte_ue_sync_t *q, cf_t *input_buffer) { @@ -452,7 +457,9 @@ int srslte_ue_sync_zerocopy(srslte_ue_sync_t *q, cf_t *input_buffer) { /* Every SF idx 0 and 5, find peak around known position q->peak_idx */ if (q->sf_idx == 0 || q->sf_idx == 5) { - if (q->do_agc) { + if (q->do_agc && (q->agc_period == 0 || + (q->agc_period && (q->frame_total_cnt%q->agc_period) == 0))) + { srslte_agc_process(&q->agc, input_buffer, q->sf_len); }