Option for ue_sync period

This commit is contained in:
ismagom 2015-11-16 00:31:46 +01:00
parent 83af2f9cd1
commit 591f583edb
2 changed files with 12 additions and 1 deletions

View File

@ -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);

View File

@ -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);
}