Apply const correctness and avoid pointers
Amidst all these unnecessary pointers, the pointer on pusch_vars->ptrs_symbols is necessary to reset the PTRS number of symbols. For clarity, remove this pointer and use pusch_vars->ptrs_symbols directly. Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
This commit is contained in:
@@ -34,7 +34,7 @@ typedef struct puschAntennaProc_s {
|
|||||||
int aarx;
|
int aarx;
|
||||||
int beam_nb;
|
int beam_nb;
|
||||||
int numAntennas;
|
int numAntennas;
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu;
|
const nfapi_nr_pusch_pdu_t *pusch_pdu;
|
||||||
int *max_ch;
|
int *max_ch;
|
||||||
c16_t *pilot;
|
c16_t *pilot;
|
||||||
int *nest_count;
|
int *nest_count;
|
||||||
@@ -82,7 +82,7 @@ static void nr_pusch_antenna_processing(void *arg)
|
|||||||
int aarx = rdata->aarx;
|
int aarx = rdata->aarx;
|
||||||
int numAntennas = rdata->numAntennas;
|
int numAntennas = rdata->numAntennas;
|
||||||
unsigned short bwp_start_subcarrier = rdata->bwp_start_subcarrier;
|
unsigned short bwp_start_subcarrier = rdata->bwp_start_subcarrier;
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu = rdata->pusch_pdu;
|
const nfapi_nr_pusch_pdu_t *pusch_pdu = rdata->pusch_pdu;
|
||||||
int *max_ch = rdata->max_ch;
|
int *max_ch = rdata->max_ch;
|
||||||
c16_t *pilot = rdata->pilot;
|
c16_t *pilot = rdata->pilot;
|
||||||
uint64_t noise_amp2 = *(rdata->noise_amp2);
|
uint64_t noise_amp2 = *(rdata->noise_amp2);
|
||||||
@@ -455,7 +455,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
|||||||
NR_gNB_PUSCH *pusch_vars,
|
NR_gNB_PUSCH *pusch_vars,
|
||||||
int beam_nb,
|
int beam_nb,
|
||||||
unsigned short bwp_start_subcarrier,
|
unsigned short bwp_start_subcarrier,
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
const nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||||
int *max_ch,
|
int *max_ch,
|
||||||
uint32_t *nvar,
|
uint32_t *nvar,
|
||||||
c16_t *pusch_dmrs_slot_mem,
|
c16_t *pusch_dmrs_slot_mem,
|
||||||
@@ -646,7 +646,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
|||||||
// #define DEBUG_UL_PTRS
|
// #define DEBUG_UL_PTRS
|
||||||
void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
||||||
NR_DL_FRAME_PARMS *frame_parms,
|
NR_DL_FRAME_PARMS *frame_parms,
|
||||||
nfapi_nr_pusch_pdu_t *rel15_ul,
|
const nfapi_nr_pusch_pdu_t *rel15_ul,
|
||||||
uint8_t ulsch_id,
|
uint8_t ulsch_id,
|
||||||
uint8_t nr_tti_rx,
|
uint8_t nr_tti_rx,
|
||||||
unsigned char symbol,
|
unsigned char symbol,
|
||||||
@@ -656,15 +656,13 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
|||||||
int32_t *ptrs_re_symbol = NULL;
|
int32_t *ptrs_re_symbol = NULL;
|
||||||
int8_t ret = 0;
|
int8_t ret = 0;
|
||||||
uint8_t symbInSlot = rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols;
|
uint8_t symbInSlot = rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols;
|
||||||
uint8_t *startSymbIndex = &rel15_ul->start_symbol_index;
|
uint8_t startSymbIndex = rel15_ul->start_symbol_index;
|
||||||
uint8_t *nbSymb = &rel15_ul->nr_of_symbols;
|
uint8_t nbSymb = rel15_ul->nr_of_symbols;
|
||||||
uint8_t *L_ptrs = &rel15_ul->pusch_ptrs.ptrs_time_density;
|
uint8_t L_ptrs = rel15_ul->pusch_ptrs.ptrs_time_density;
|
||||||
uint8_t *K_ptrs = &rel15_ul->pusch_ptrs.ptrs_freq_density;
|
uint8_t K_ptrs = rel15_ul->pusch_ptrs.ptrs_freq_density;
|
||||||
uint16_t *dmrsSymbPos = &rel15_ul->ul_dmrs_symb_pos;
|
uint16_t dmrsSymbPos = rel15_ul->ul_dmrs_symb_pos;
|
||||||
uint16_t *ptrsSymbPos = &pusch_vars->ptrs_symbols;
|
uint16_t nb_rb = rel15_ul->rb_size;
|
||||||
uint8_t *ptrsSymbIdx = &pusch_vars->ptrs_symbol_index;
|
uint8_t ptrsReOffset = rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset;
|
||||||
uint16_t *nb_rb = &rel15_ul->rb_size;
|
|
||||||
uint8_t *ptrsReOffset = &rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset;
|
|
||||||
|
|
||||||
/* loop over antennas */
|
/* loop over antennas */
|
||||||
for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
|
for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
|
||||||
@@ -673,7 +671,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
|||||||
*ptrs_re_symbol = 0;
|
*ptrs_re_symbol = 0;
|
||||||
phase_per_symbol[symbol].i = 0;
|
phase_per_symbol[symbol].i = 0;
|
||||||
/* set DMRS estimates to 0 angle with magnitude 1 */
|
/* set DMRS estimates to 0 angle with magnitude 1 */
|
||||||
if (is_dmrs_symbol(symbol, *dmrsSymbPos)) {
|
if (is_dmrs_symbol(symbol, dmrsSymbPos)) {
|
||||||
/* set DMRS real estimation to 32767 */
|
/* set DMRS real estimation to 32767 */
|
||||||
phase_per_symbol[symbol].r = INT16_MAX; // 32767
|
phase_per_symbol[symbol].r = INT16_MAX; // 32767
|
||||||
#ifdef DEBUG_UL_PTRS
|
#ifdef DEBUG_UL_PTRS
|
||||||
@@ -683,17 +681,13 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
|||||||
phase_per_symbol[symbol].r = 0;
|
phase_per_symbol[symbol].r = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbol == *startSymbIndex) {
|
if (symbol == startSymbIndex) {
|
||||||
*ptrsSymbPos = 0;
|
pusch_vars->ptrs_symbols = 0;
|
||||||
set_ptrs_symb_idx(ptrsSymbPos, *nbSymb, *startSymbIndex, 1 << *L_ptrs, *dmrsSymbPos);
|
set_ptrs_symb_idx(&pusch_vars->ptrs_symbols, nbSymb, startSymbIndex, 1 << L_ptrs, dmrsSymbPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if not PTRS symbol set current ptrs symbol index to zero*/
|
|
||||||
*ptrsSymbIdx = 0;
|
|
||||||
|
|
||||||
/* Check if current symbol contains PTRS */
|
/* Check if current symbol contains PTRS */
|
||||||
if (is_ptrs_symbol(symbol, *ptrsSymbPos)) {
|
if (is_ptrs_symbol(symbol, pusch_vars->ptrs_symbols)) {
|
||||||
*ptrsSymbIdx = symbol;
|
|
||||||
/*------------------------------------------------------------------------------------------------------- */
|
/*------------------------------------------------------------------------------------------------------- */
|
||||||
/* 1) Estimate common phase error per PTRS symbol */
|
/* 1) Estimate common phase error per PTRS symbol */
|
||||||
/*------------------------------------------------------------------------------------------------------- */
|
/*------------------------------------------------------------------------------------------------------- */
|
||||||
@@ -703,9 +697,9 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
|||||||
rel15_ul->scid,
|
rel15_ul->scid,
|
||||||
nr_tti_rx,
|
nr_tti_rx,
|
||||||
symbol);
|
symbol);
|
||||||
nr_ptrs_cpe_estimation(*K_ptrs,
|
nr_ptrs_cpe_estimation(K_ptrs,
|
||||||
*ptrsReOffset,
|
ptrsReOffset,
|
||||||
*nb_rb,
|
nb_rb,
|
||||||
rel15_ul->rnti,
|
rel15_ul->rnti,
|
||||||
frame_parms->ofdm_symbol_size,
|
frame_parms->ofdm_symbol_size,
|
||||||
&pusch_vars->rxdataF_comp[aarx][(symbol * nb_re_pusch)],
|
&pusch_vars->rxdataF_comp[aarx][(symbol * nb_re_pusch)],
|
||||||
@@ -720,8 +714,8 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
|||||||
/* 2) Interpolate PTRS estimated value in TD */
|
/* 2) Interpolate PTRS estimated value in TD */
|
||||||
/*------------------------------------------------------------------------------------------------------- */
|
/*------------------------------------------------------------------------------------------------------- */
|
||||||
/* If L-PTRS is > 0 then we need interpolation */
|
/* If L-PTRS is > 0 then we need interpolation */
|
||||||
if (*L_ptrs > 0) {
|
if (L_ptrs > 0) {
|
||||||
ret = nr_ptrs_process_slot(*dmrsSymbPos, *ptrsSymbPos, (int16_t *)phase_per_symbol, *startSymbIndex, *nbSymb);
|
ret = nr_ptrs_process_slot(dmrsSymbPos, pusch_vars->ptrs_symbols, (int16_t *)phase_per_symbol, startSymbIndex, nbSymb);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
LOG_W(PHY, "[PTRS] Compensation is skipped due to error in PTRS slot processing !!\n");
|
LOG_W(PHY, "[PTRS] Compensation is skipped due to error in PTRS slot processing !!\n");
|
||||||
}
|
}
|
||||||
@@ -730,17 +724,17 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
|||||||
/*------------------------------------------------------------------------------------------------------- */
|
/*------------------------------------------------------------------------------------------------------- */
|
||||||
/* 3) Compensated DMRS based estimated signal with PTRS estimation */
|
/* 3) Compensated DMRS based estimated signal with PTRS estimation */
|
||||||
/*--------------------------------------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------------------------------------*/
|
||||||
for (uint8_t i = *startSymbIndex; i < symbInSlot; i++) {
|
for (uint8_t i = startSymbIndex; i < symbInSlot; i++) {
|
||||||
/* DMRS Symbol has 0 phase so no need to rotate the respective symbol */
|
/* DMRS Symbol has 0 phase so no need to rotate the respective symbol */
|
||||||
/* Skip rotation if the slot processing is wrong */
|
/* Skip rotation if the slot processing is wrong */
|
||||||
if ((!is_dmrs_symbol(i, *dmrsSymbPos)) && (ret == 0)) {
|
if ((!is_dmrs_symbol(i, dmrsSymbPos)) && (ret == 0)) {
|
||||||
#ifdef DEBUG_UL_PTRS
|
#ifdef DEBUG_UL_PTRS
|
||||||
printf("[PHY][UL][PTRS]: Rotate Symbol %2d with %d + j* %d\n", i, phase_per_symbol[i].r, phase_per_symbol[i].i);
|
printf("[PHY][UL][PTRS]: Rotate Symbol %2d with %d + j* %d\n", i, phase_per_symbol[i].r, phase_per_symbol[i].i);
|
||||||
#endif
|
#endif
|
||||||
rotate_cpx_vector(&pusch_vars->rxdataF_comp[aarx][i * nb_re_pusch],
|
rotate_cpx_vector(&pusch_vars->rxdataF_comp[aarx][i * nb_re_pusch],
|
||||||
&phase_per_symbol[i],
|
&phase_per_symbol[i],
|
||||||
&pusch_vars->rxdataF_comp[aarx][i * nb_re_pusch],
|
&pusch_vars->rxdataF_comp[aarx][i * nb_re_pusch],
|
||||||
((*nb_rb) * NR_NB_SC_PER_RB),
|
(nb_rb * NR_NB_SC_PER_RB),
|
||||||
15);
|
15);
|
||||||
} // if not DMRS Symbol
|
} // if not DMRS Symbol
|
||||||
} // symbol loop
|
} // symbol loop
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
|||||||
NR_gNB_PUSCH *pusch_vars,
|
NR_gNB_PUSCH *pusch_vars,
|
||||||
int beam_nb,
|
int beam_nb,
|
||||||
unsigned short bwp_start_subcarrier,
|
unsigned short bwp_start_subcarrier,
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
const nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||||
int *max_ch,
|
int *max_ch,
|
||||||
uint32_t *nvar,
|
uint32_t *nvar,
|
||||||
c16_t *pusch_dmrs_slot_mem,
|
c16_t *pusch_dmrs_slot_mem,
|
||||||
@@ -52,7 +52,7 @@ void nr_est_srs_timing_advance_offset(uint16_t ofdm_symbol_size,
|
|||||||
|
|
||||||
void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
|
||||||
NR_DL_FRAME_PARMS *frame_parms,
|
NR_DL_FRAME_PARMS *frame_parms,
|
||||||
nfapi_nr_pusch_pdu_t *rel15_ul,
|
const nfapi_nr_pusch_pdu_t *rel15_ul,
|
||||||
uint8_t ulsch_id,
|
uint8_t ulsch_id,
|
||||||
uint8_t nr_tti_rx,
|
uint8_t nr_tti_rx,
|
||||||
unsigned char symbol,
|
unsigned char symbol,
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ static void nr_ulsch_extract_rbs(c16_t* const rxdataF,
|
|||||||
int rxoffset,
|
int rxoffset,
|
||||||
int choffset,
|
int choffset,
|
||||||
int is_dmrs_symbol,
|
int is_dmrs_symbol,
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
const nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||||
NR_DL_FRAME_PARMS *frame_parms)
|
NR_DL_FRAME_PARMS *frame_parms)
|
||||||
{
|
{
|
||||||
uint8_t delta = 0;
|
uint8_t delta = 0;
|
||||||
@@ -160,7 +160,7 @@ static void nr_ulsch_extract_rbs(c16_t* const rxdataF,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_nb_re_pusch (NR_DL_FRAME_PARMS *frame_parms, nfapi_nr_pusch_pdu_t *rel15_ul,int symbol)
|
static int get_nb_re_pusch (NR_DL_FRAME_PARMS *frame_parms, const nfapi_nr_pusch_pdu_t *rel15_ul, int symbol)
|
||||||
{
|
{
|
||||||
uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01;
|
uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01;
|
||||||
if (dmrs_symbol_flag == 1) {
|
if (dmrs_symbol_flag == 1) {
|
||||||
@@ -186,7 +186,7 @@ static void nr_ulsch_channel_compensation(uint32_t buffer_length,
|
|||||||
c16_t **rxComp,
|
c16_t **rxComp,
|
||||||
int nb_layers,
|
int nb_layers,
|
||||||
c16_t rho[][nb_layers][buffer_length],
|
c16_t rho[][nb_layers][buffer_length],
|
||||||
nfapi_nr_pusch_pdu_t *rel15_ul,
|
const nfapi_nr_pusch_pdu_t *rel15_ul,
|
||||||
uint32_t symbol,
|
uint32_t symbol,
|
||||||
uint32_t output_shift)
|
uint32_t output_shift)
|
||||||
{
|
{
|
||||||
@@ -861,7 +861,7 @@ static void inner_rx(PHY_VARS_gNB *gNB,
|
|||||||
int slot,
|
int slot,
|
||||||
NR_DL_FRAME_PARMS *frame_parms,
|
NR_DL_FRAME_PARMS *frame_parms,
|
||||||
NR_gNB_PUSCH *pusch_vars,
|
NR_gNB_PUSCH *pusch_vars,
|
||||||
nfapi_nr_pusch_pdu_t *rel15_ul,
|
const nfapi_nr_pusch_pdu_t *rel15_ul,
|
||||||
c16_t **rxF,
|
c16_t **rxF,
|
||||||
int16_t **llr,
|
int16_t **llr,
|
||||||
int soffset,
|
int soffset,
|
||||||
@@ -1003,7 +1003,7 @@ static void inner_rx(PHY_VARS_gNB *gNB,
|
|||||||
typedef struct puschSymbolProc_s {
|
typedef struct puschSymbolProc_s {
|
||||||
PHY_VARS_gNB *gNB;
|
PHY_VARS_gNB *gNB;
|
||||||
NR_DL_FRAME_PARMS *frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms;
|
||||||
nfapi_nr_pusch_pdu_t *rel15_ul;
|
const nfapi_nr_pusch_pdu_t *rel15_ul;
|
||||||
int ulsch_id;
|
int ulsch_id;
|
||||||
int slot;
|
int slot;
|
||||||
int startSymbol;
|
int startSymbol;
|
||||||
@@ -1023,7 +1023,7 @@ static void nr_pusch_symbol_processing(void *arg)
|
|||||||
|
|
||||||
PHY_VARS_gNB *gNB = rdata->gNB;
|
PHY_VARS_gNB *gNB = rdata->gNB;
|
||||||
NR_DL_FRAME_PARMS *frame_parms = rdata->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms = rdata->frame_parms;
|
||||||
nfapi_nr_pusch_pdu_t *rel15_ul = rdata->rel15_ul;
|
const nfapi_nr_pusch_pdu_t *rel15_ul = rdata->rel15_ul;
|
||||||
int ulsch_id = rdata->ulsch_id;
|
int ulsch_id = rdata->ulsch_id;
|
||||||
int slot = rdata->slot;
|
int slot = rdata->slot;
|
||||||
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ulsch_id];
|
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ulsch_id];
|
||||||
|
|||||||
Reference in New Issue
Block a user