Commit a898811b authored by lfq's avatar lfq

add cal_amp

parent a086d943
......@@ -81,7 +81,7 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue,
\param Ns Slot number (0..19)
\param sample_offset offset within rxdata (points to beginning of subframe)
*/
uint cal_amp(int16_t *dataIn, int len);
int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
int32_t *rxdata,
int32_t *rxdataF,
......
......@@ -33,6 +33,21 @@
#undef LOG_I
#define LOG_I(A,B...) printf(A)
#endif*/
uint g_ul_time_amp[14] = {0};
uint g_ul_freq_amp[14] = {0};
uint cal_amp(int16_t *dataIn, int len)
{
int i;
uint sumA = 0;
for(i=0;i<len;i++)
{
sumA += abs(dataIn[i]);
}
sumA = sumA/len;
return sumA;
}
dft_size_idx_t get_dft_size_idx(uint16_t ofdm_symbol_size)
{
......@@ -334,7 +349,10 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
rxdata_ptr,
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size],
1);
#if 0
g_ul_time_amp[symbol] = cal_amp(rxdata_ptr, 512);
g_ul_freq_amp[symbol] = cal_amp((int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 512);
#endif
return 0;
}
......
......@@ -1164,7 +1164,8 @@ void nr_ulsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
_m_empty();
#endif
}
extern uint g_ul_time_amp[14];
extern uint g_ul_freq_amp[14];
int nr_rx_pusch(PHY_VARS_gNB *gNB,
uint8_t ulsch_id,
uint32_t frame,
......@@ -1380,6 +1381,19 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
rel15_ul->qam_mod_order);
stop_meas(&gNB->ulsch_llr_stats);
rxdataF_ext_offset += gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol];
uint pusch_amp;
if (symbol == (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols - 1)) {
static int cnt = 0;
if (cnt < 10)
{
pusch_amp = cal_amp(&gNB->pusch_vars[ulsch_id]->rxdataF_ext[0][symbol * nb_re_pusch], nb_re_pusch);
//LOG_I(PHY, "UL AMP frame %d %d, symbol %d, rbs %d, res %d, time %d, freq %d \n", frame, slot, symbol, nb_re_pusch/12, nb_re_pusch, g_ul_time_amp[symbol], g_ul_freq_amp[symbol], pusch_amp);
LOG_I(PHY, "UL AMP frame %d %d, symbol %d, rbs %d, res %d, pusch amp %d \n", frame, slot, symbol, nb_re_pusch/12, nb_re_pusch, pusch_amp);
cnt++;
}
}
}
} // symbol loop
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment