Phy: added ue_ul normalization mode parameter

master
Xavier Arteaga 6 years ago committed by Ismael Gomez
parent 20823e191d
commit aa6652155c

@ -73,13 +73,18 @@ typedef struct SRSLTE_API {
srslte_refsignal_srs_cfg_t srs; srslte_refsignal_srs_cfg_t srs;
} srslte_ul_cfg_t; } srslte_ul_cfg_t;
typedef enum {
SRSLTE_UE_UL_NORMALIZE_MODE_AUTO = 0,
SRSLTE_UE_UL_NORMALIZE_MODE_FORCE_AMPLITUDE
} srslte_ue_ul_normalize_mode_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
srslte_ul_cfg_t ul_cfg; srslte_ul_cfg_t ul_cfg;
bool grant_available; bool grant_available;
uint32_t cc_idx; uint32_t cc_idx;
bool normalize_en; srslte_ue_ul_normalize_mode_t normalize_mode;
float force_peak_amplitude; float force_peak_amplitude;
bool cfo_en; bool cfo_en;
float cfo_tol; float cfo_tol;

@ -249,13 +249,20 @@ static void apply_cfo(srslte_ue_ul_t* q, srslte_ue_ul_cfg_t* cfg)
static void apply_norm(srslte_ue_ul_t* q, srslte_ue_ul_cfg_t* cfg, float norm_factor) static void apply_norm(srslte_ue_ul_t* q, srslte_ue_ul_cfg_t* cfg, float norm_factor)
{ {
uint32_t sf_len = SRSLTE_SF_LEN_PRB(q->cell.nof_prb); uint32_t sf_len = SRSLTE_SF_LEN_PRB(q->cell.nof_prb);
float* buf = NULL;
float force_peak_amplitude = cfg->force_peak_amplitude > 0 ? cfg->force_peak_amplitude : 1.0f;
if (cfg->normalize_en) { switch (cfg->normalize_mode) {
case SRSLTE_UE_UL_NORMALIZE_MODE_AUTO:
default:
// Automatic normalization (default)
norm_factor = limit_norm_factor(q, norm_factor, q->out_buffer); norm_factor = limit_norm_factor(q, norm_factor, q->out_buffer);
srslte_vec_sc_prod_cfc(q->out_buffer, norm_factor, q->out_buffer, sf_len); srslte_vec_sc_prod_cfc(q->out_buffer, norm_factor, q->out_buffer, sf_len);
} else if (cfg->force_peak_amplitude > 0.0f) { break;
case SRSLTE_UE_UL_NORMALIZE_MODE_FORCE_AMPLITUDE:
// Force amplitude
// Typecast buffer // Typecast buffer
float* buf = (float*)q->out_buffer; buf = (float*)q->out_buffer;
// Get index of maximum absolute sample // Get index of maximum absolute sample
uint32_t idx = srslte_vec_max_abs_fi(buf, sf_len * 2); uint32_t idx = srslte_vec_max_abs_fi(buf, sf_len * 2);
@ -266,8 +273,9 @@ static void apply_norm(srslte_ue_ul_t* q, srslte_ue_ul_cfg_t* cfg, float norm_fa
// Avoid zero division // Avoid zero division
if (scale != 0.0f && scale != INFINITY) { if (scale != 0.0f && scale != INFINITY) {
// Apply maximum peak amplitude // Apply maximum peak amplitude
srslte_vec_sc_prod_cfc(q->out_buffer, cfg->force_peak_amplitude / scale, q->out_buffer, sf_len); srslte_vec_sc_prod_cfc(q->out_buffer, force_peak_amplitude / scale, q->out_buffer, sf_len);
} }
break;
} }
} }

@ -180,9 +180,9 @@ void phy_common::set_ue_ul_cfg(srslte_ue_ul_cfg_t* ue_ul_cfg)
ue_ul_cfg->cfo_en = true; ue_ul_cfg->cfo_en = true;
if (args->force_ul_amplitude > 0.0f) { if (args->force_ul_amplitude > 0.0f) {
ue_ul_cfg->force_peak_amplitude = args->force_ul_amplitude; ue_ul_cfg->force_peak_amplitude = args->force_ul_amplitude;
ue_ul_cfg->normalize_en = false; ue_ul_cfg->normalize_mode = SRSLTE_UE_UL_NORMALIZE_MODE_FORCE_AMPLITUDE;
} else { } else {
ue_ul_cfg->normalize_en = true; ue_ul_cfg->normalize_mode = SRSLTE_UE_UL_NORMALIZE_MODE_AUTO;
} }
ue_ul_cfg->ul_cfg.pucch.ack_nack_feedback_mode = SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_NORMAL; ue_ul_cfg->ul_cfg.pucch.ack_nack_feedback_mode = SRSLTE_PUCCH_ACK_NACK_FEEDBACK_MODE_NORMAL;
} }

Loading…
Cancel
Save