Commit 0d664103 authored by francescomani's avatar francescomani

another round of review

parent 12ccca72
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# define NUMBER_OF_SRS_MAX 16 # define NUMBER_OF_SRS_MAX 16
# define NUMBER_OF_SCH_STATS_MAX 16 # define NUMBER_OF_SCH_STATS_MAX 16
# define NUMBER_FRAMES_PHY_UE_INACTIVE 10 #define NUMBER_FRAMES_PHY_UE_INACTIVE 10
#define MAX_MANAGED_ENB_PER_MOBILE 2 #define MAX_MANAGED_ENB_PER_MOBILE 2
#define MAX_MANAGED_GNB_PER_MOBILE 2 #define MAX_MANAGED_GNB_PER_MOBILE 2
......
...@@ -130,7 +130,6 @@ void tx_func(void *param) { ...@@ -130,7 +130,6 @@ void tx_func(void *param) {
void rx_func(void *param) void rx_func(void *param)
{ {
processingData_L1_t *info = (processingData_L1_t *) param; processingData_L1_t *info = (processingData_L1_t *) param;
PHY_VARS_gNB *gNB = info->gNB; PHY_VARS_gNB *gNB = info->gNB;
int frame_rx = info->frame_rx; int frame_rx = info->frame_rx;
...@@ -179,7 +178,7 @@ void rx_func(void *param) ...@@ -179,7 +178,7 @@ void rx_func(void *param)
reset_active_ulsch(gNB, frame_tx); reset_active_ulsch(gNB, frame_tx);
// RX processing // RX processing
int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); int rx_slot_type = nr_slot_select(cfg, frame_rx, slot_rx);
if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) { if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) {
// UE-specific RX processing for subframe n // UE-specific RX processing for subframe n
// TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT // TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT
......
...@@ -1220,8 +1220,10 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, ...@@ -1220,8 +1220,10 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
if (tx_data != NULL) { if (tx_data != NULL) {
uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct; uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct;
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols); //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols);
AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch,"Number of PDSCH PDUs %d exceeded the limit %d\n", AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch,
msgTx->num_pdsch_slot, gNB->max_nb_pdsch); "Number of PDSCH PDUs %d exceeded the limit %d\n",
msgTx->num_pdsch_slot,
gNB->max_nb_pdsch);
handle_nr_nfapi_pdsch_pdu(msgTx, pdsch_pdu, dlsch_sdu); handle_nr_nfapi_pdsch_pdu(msgTx, pdsch_pdu, dlsch_sdu);
} }
else { else {
......
This diff is collapsed.
...@@ -208,9 +208,12 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb ...@@ -208,9 +208,12 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
// //
// Todo: // Todo:
// - averaging IIR filter for RX power and noise // - averaging IIR filter for RX power and noise
void nr_gnb_measurements(PHY_VARS_gNB *gNB, NR_gNB_ULSCH_t *ulsch, NR_gNB_PUSCH *pusch_vars, unsigned char symbol, uint8_t nrOfLayers) void nr_gnb_measurements(PHY_VARS_gNB *gNB,
NR_gNB_ULSCH_t *ulsch,
NR_gNB_PUSCH *pusch_vars,
unsigned char symbol,
uint8_t nrOfLayers)
{ {
int rx_power_tot = 0; int rx_power_tot = 0;
unsigned short rx_power_avg_dB; unsigned short rx_power_avg_dB;
unsigned short rx_power_tot_dB; unsigned short rx_power_tot_dB;
...@@ -225,39 +228,40 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, NR_gNB_ULSCH_t *ulsch, NR_gNB_PUSCH ...@@ -225,39 +228,40 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, NR_gNB_ULSCH_t *ulsch, NR_gNB_PUSCH
int rx_power[fp->nb_antennas_rx]; int rx_power[fp->nb_antennas_rx];
for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){ for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){
rx_power[aarx] = 0; rx_power[aarx] = 0;
for (int aatx = 0; aatx < nrOfLayers; aatx++){ for (int aatx = 0; aatx < nrOfLayers; aatx++){
ulsch_measurements->rx_spatial_power[aatx][aarx] =
ulsch_measurements->rx_spatial_power[aatx][aarx] = (signal_energy_nodc(&pusch_vars->ul_ch_estimates[aatx*fp->nb_antennas_rx+aarx][ch_offset], N_RB_UL * NR_NB_SC_PER_RB)); (signal_energy_nodc(&pusch_vars->ul_ch_estimates[aatx * fp->nb_antennas_rx + aarx][ch_offset],
N_RB_UL * NR_NB_SC_PER_RB));
if (ulsch_measurements->rx_spatial_power[aatx][aarx] < 0) { if (ulsch_measurements->rx_spatial_power[aatx][aarx] < 0) {
ulsch_measurements->rx_spatial_power[aatx][aarx] = 0; ulsch_measurements->rx_spatial_power[aatx][aarx] = 0;
} }
ulsch_measurements->rx_spatial_power_dB[aatx][aarx] = (unsigned short) dB_fixed(ulsch_measurements->rx_spatial_power[aatx][aarx]); ulsch_measurements->rx_spatial_power_dB[aatx][aarx] =
(unsigned short)dB_fixed(ulsch_measurements->rx_spatial_power[aatx][aarx]);
rx_power[aarx] += ulsch_measurements->rx_spatial_power[aatx][aarx]; rx_power[aarx] += ulsch_measurements->rx_spatial_power[aatx][aarx];
} }
LOG_D(PHY, "[RNTI %04x] RX power in antenna %d = %d\n", ulsch->rnti, aarx, rx_power[aarx]); LOG_D(PHY, "[RNTI %04x] RX power in antenna %d = %d\n", ulsch->rnti, aarx, rx_power[aarx]);
rx_power_tot += rx_power[aarx]; rx_power_tot += rx_power[aarx];
} }
rx_power_tot_dB = (unsigned short) dB_fixed(rx_power_tot); rx_power_tot_dB = (unsigned short)dB_fixed(rx_power_tot);
rx_power_avg_dB = rx_power_tot_dB; rx_power_avg_dB = rx_power_tot_dB;
ulsch_measurements->wideband_cqi_tot = dB_fixed2(rx_power_tot, meas->n0_power_tot); ulsch_measurements->wideband_cqi_tot = dB_fixed2(rx_power_tot, meas->n0_power_tot);
ulsch_measurements->rx_rssi_dBm = rx_power_avg_dB + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size); ulsch_measurements->rx_rssi_dBm =
rx_power_avg_dB + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size);
LOG_D(PHY, "[RNTI %04x] RSSI %d dBm/RE, RSSI (digital) %d dB (N_RB_UL %d), WBand CQI tot %d dB, N0 Power tot %d, RX Power tot %d\n",
ulsch->rnti, LOG_D(PHY,
ulsch_measurements->rx_rssi_dBm, "[RNTI %04x] RSSI %d dBm/RE, RSSI (digital) %d dB (N_RB_UL %d), WBand CQI tot %d dB, N0 Power tot %d, RX Power tot %d\n",
rx_power_avg_dB, ulsch->rnti,
N_RB_UL, ulsch_measurements->rx_rssi_dBm,
ulsch_measurements->wideband_cqi_tot, rx_power_avg_dB,
meas->n0_power_tot, N_RB_UL,
rx_power_tot); ulsch_measurements->wideband_cqi_tot,
meas->n0_power_tot,
rx_power_tot);
} }
...@@ -130,7 +130,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -130,7 +130,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
debug_ch_est = fopen("debug_ch_est.txt","w"); debug_ch_est = fopen("debug_ch_est.txt","w");
#endif #endif
//uint16_t Nid_cell = (eNB_offset == 0) ? gNB->frame_parms.Nid_cell : gNB->measurements.adj_cell_id[eNB_offset-1]; //uint16_t Nid_cell = (eNB_offset == 0) ? gNB->frame_parms.Nid_cell : gNB->measurements.adj_cell_id[eNB_offset-1];
c16_t **ul_ch_estimates = (c16_t **) gNB->pusch_vars[ul_id]->ul_ch_estimates; NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ul_id];
c16_t **ul_ch_estimates = (c16_t **)pusch_vars->ul_ch_estimates;
const int symbolSize = gNB->frame_parms.ofdm_symbol_size; const int symbolSize = gNB->frame_parms.ofdm_symbol_size;
const int soffset = (Ns&3)*gNB->frame_parms.symbols_per_slot*symbolSize; const int soffset = (Ns&3)*gNB->frame_parms.symbols_per_slot*symbolSize;
const int nushift = (p>>1)&1; const int nushift = (p>>1)&1;
...@@ -187,8 +188,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -187,8 +188,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
c16_t ul_ls_est[symbolSize] __attribute__((aligned(32))); c16_t ul_ls_est[symbolSize] __attribute__((aligned(32)));
memset(ul_ls_est, 0, sizeof(c16_t) * symbolSize); memset(ul_ls_est, 0, sizeof(c16_t) * symbolSize);
NR_ULSCH_delay_t *delay = &gNB->ulsch[ul_id]->delay; NR_ULSCH_delay_t *delay = &gNB->ulsch[ul_id].delay;
memset(&delay, 0, sizeof(delay)); memset(delay, 0, sizeof(*delay));
for (int aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) { for (int aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) {
c16_t *rxdataF = (c16_t *)&gNB->common_vars.rxdataF[aarx][symbol_offset]; c16_t *rxdataF = (c16_t *)&gNB->common_vars.rxdataF[aarx][symbol_offset];
...@@ -229,11 +230,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -229,11 +230,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
pilot_cnt += 2; pilot_cnt += 2;
} }
freq2time(symbolSize, freq2time(symbolSize, (int16_t *)ul_ls_est, (int16_t *)pusch_vars->ul_ch_estimates_time[aarx]);
(int16_t *) ul_ls_est,
(int16_t *) gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx]);
nr_est_timing_advance_pusch(&gNB->frame_parms, gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx], delay); nr_est_timing_advance_pusch(&gNB->frame_parms, pusch_vars->ul_ch_estimates_time[aarx], delay);
int pusch_delay = delay->pusch_est_delay; int pusch_delay = delay->pusch_est_delay;
int delay_idx = get_delay_idx(pusch_delay); int delay_idx = get_delay_idx(pusch_delay);
c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx]; c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx];
...@@ -311,8 +310,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -311,8 +310,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
} }
// Delay compensation // Delay compensation
freq2time(symbolSize, (int16_t *)ul_ls_est, (int16_t *)gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx]); freq2time(symbolSize, (int16_t *)ul_ls_est, (int16_t *)pusch_vars->ul_ch_estimates_time[aarx]);
nr_est_timing_advance_pusch(&gNB->frame_parms, gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx], delay); nr_est_timing_advance_pusch(&gNB->frame_parms, pusch_vars->ul_ch_estimates_time[aarx], delay);
int pusch_delay = delay->pusch_est_delay; int pusch_delay = delay->pusch_est_delay;
int delay_idx = get_delay_idx(-pusch_delay); int delay_idx = get_delay_idx(-pusch_delay);
c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx]; c16_t *ul_delay_table = gNB->frame_parms.ul_delay_table[delay_idx];
...@@ -533,7 +532,9 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -533,7 +532,9 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
uint8_t ulsch_id, uint8_t ulsch_id,
uint8_t nr_tti_rx, uint8_t nr_tti_rx,
unsigned char symbol, unsigned char symbol,
uint32_t nb_re_pusch) { uint32_t nb_re_pusch)
{
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ulsch_id];
//#define DEBUG_UL_PTRS 1 //#define DEBUG_UL_PTRS 1
int32_t *ptrs_re_symbol = NULL; int32_t *ptrs_re_symbol = NULL;
int8_t ret = 0; int8_t ret = 0;
...@@ -543,16 +544,16 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -543,16 +544,16 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
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 = &gNB->pusch_vars[ulsch_id]->ptrs_symbols; uint16_t *ptrsSymbPos = &pusch_vars->ptrs_symbols;
uint8_t *ptrsSymbIdx = &gNB->pusch_vars[ulsch_id]->ptrs_symbol_index; uint8_t *ptrsSymbIdx = &pusch_vars->ptrs_symbol_index;
uint8_t *dmrsConfigType = &rel15_ul->dmrs_config_type; uint8_t *dmrsConfigType = &rel15_ul->dmrs_config_type;
uint16_t *nb_rb = &rel15_ul->rb_size; uint16_t *nb_rb = &rel15_ul->rb_size;
uint8_t *ptrsReOffset = &rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset; 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++) {
c16_t *phase_per_symbol = (c16_t*)gNB->pusch_vars[ulsch_id]->ptrs_phase_per_slot[aarx]; c16_t *phase_per_symbol = (c16_t *)pusch_vars->ptrs_phase_per_slot[aarx];
ptrs_re_symbol = &gNB->pusch_vars[ulsch_id]->ptrs_re_per_slot; ptrs_re_symbol = &pusch_vars->ptrs_re_per_slot;
*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 */
...@@ -585,13 +586,17 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -585,13 +586,17 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
/*------------------------------------------------------------------------------------------------------- */ /*------------------------------------------------------------------------------------------------------- */
/* 1) Estimate common phase error per PTRS symbol */ /* 1) Estimate common phase error per PTRS symbol */
/*------------------------------------------------------------------------------------------------------- */ /*------------------------------------------------------------------------------------------------------- */
nr_ptrs_cpe_estimation(*K_ptrs,*ptrsReOffset,*dmrsConfigType,*nb_rb, nr_ptrs_cpe_estimation(*K_ptrs,
*ptrsReOffset,
*dmrsConfigType,
*nb_rb,
rel15_ul->rnti, rel15_ul->rnti,
nr_tti_rx, nr_tti_rx,
symbol,frame_parms->ofdm_symbol_size, symbol,
(int16_t *)&gNB->pusch_vars[ulsch_id]->rxdataF_comp[aarx][(symbol * nb_re_pusch)], frame_parms->ofdm_symbol_size,
(int16_t *)&pusch_vars->rxdataF_comp[aarx][(symbol * nb_re_pusch)],
gNB->nr_gold_pusch_dmrs[rel15_ul->scid][nr_tti_rx][symbol], gNB->nr_gold_pusch_dmrs[rel15_ul->scid][nr_tti_rx][symbol],
(int16_t*)&phase_per_symbol[symbol], (int16_t *)&phase_per_symbol[symbol],
ptrs_re_symbol); ptrs_re_symbol);
} }
...@@ -609,7 +614,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -609,7 +614,7 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
} }
#ifdef DEBUG_UL_PTRS #ifdef DEBUG_UL_PTRS
LOG_M("ptrsEstUl.m","est",gNB->pusch_vars[ulsch_id]->ptrs_phase_per_slot[aarx],frame_parms->symbols_per_slot,1,1 ); LOG_M("ptrsEstUl.m", "est", pusch_vars->ptrs_phase_per_slot[aarx], frame_parms->symbols_per_slot, 1, 1);
LOG_M("rxdataF_bf_ptrs_comp_ul.m","bf_ptrs_cmp", LOG_M("rxdataF_bf_ptrs_comp_ul.m","bf_ptrs_cmp",
&gNB->pusch_vars[0]->rxdataF_comp[aarx][rel15_ul->start_symbol_index * NR_NB_SC_PER_RB * rel15_ul->rb_size], &gNB->pusch_vars[0]->rxdataF_comp[aarx][rel15_ul->start_symbol_index * NR_NB_SC_PER_RB * rel15_ul->rb_size],
rel15_ul->nr_of_symbols * NR_NB_SC_PER_RB * rel15_ul->rb_size,1,1); rel15_ul->nr_of_symbols * NR_NB_SC_PER_RB * rel15_ul->rb_size,1,1);
...@@ -625,10 +630,11 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -625,10 +630,11 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
#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((c16_t*)&gNB->pusch_vars[ulsch_id]->rxdataF_comp[aarx][(i * rel15_ul->rb_size * NR_NB_SC_PER_RB)], rotate_cpx_vector((c16_t *)&pusch_vars->rxdataF_comp[aarx][(i * rel15_ul->rb_size * NR_NB_SC_PER_RB)],
&phase_per_symbol[i], &phase_per_symbol[i],
(c16_t*)&gNB->pusch_vars[ulsch_id]->rxdataF_comp[aarx][(i * rel15_ul->rb_size * NR_NB_SC_PER_RB)], (c16_t *)&pusch_vars->rxdataF_comp[aarx][(i * rel15_ul->rb_size * NR_NB_SC_PER_RB)],
((*nb_rb) * NR_NB_SC_PER_RB), 15); ((*nb_rb) * NR_NB_SC_PER_RB),
15);
}// if not DMRS Symbol }// if not DMRS Symbol
}// symbol loop }// symbol loop
}// last symbol check }// last symbol check
......
...@@ -53,9 +53,15 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB); ...@@ -53,9 +53,15 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB);
void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot,int first_symb,int num_symb); void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot,int first_symb,int num_symb);
void nr_gnb_measurements(PHY_VARS_gNB *gNB, NR_gNB_ULSCH_t *ulsch, NR_gNB_PUSCH *pusch_vars, unsigned char symbol, uint8_t nrOfLayers); void nr_gnb_measurements(PHY_VARS_gNB *gNB,
NR_gNB_ULSCH_t *ulsch,
NR_gNB_PUSCH *pusch_vars,
unsigned char symbol,
uint8_t nrOfLayers);
void nr_est_timing_advance_pusch(const NR_DL_FRAME_PARMS *frame_parms, const int32_t *ul_ch_estimates_time, NR_ULSCH_delay_t *delay); void nr_est_timing_advance_pusch(const NR_DL_FRAME_PARMS *frame_parms,
const int32_t *ul_ch_estimates_time,
NR_ULSCH_delay_t *delay);
int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms, int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms,
const int32_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]); const int32_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]);
......
...@@ -75,7 +75,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -75,7 +75,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
time_stats_t *dlsch_segmentation_stats=&gNB->dlsch_segmentation_stats; time_stats_t *dlsch_segmentation_stats=&gNB->dlsch_segmentation_stats;
for (int dlsch_id=0; dlsch_id<msgTx->num_pdsch_slot; dlsch_id++) { for (int dlsch_id=0; dlsch_id<msgTx->num_pdsch_slot; dlsch_id++) {
dlsch = msgTx->dlsch[dlsch_id][0]; dlsch = &msgTx->dlsch[dlsch_id][0];
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
...@@ -567,12 +567,12 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -567,12 +567,12 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
} }
void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB) { void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) { for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i]; NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
if (stats->active && stats->frame != stats->dlsch_stats.dump_frame) { if (stats->active && stats->frame != stats->dlsch_stats.dump_frame) {
stats->dlsch_stats.dump_frame = stats->frame; stats->dlsch_stats.dump_frame = stats->frame;
fprintf(fd,"DLSCH RNTI %x: current_Qm %d, current_RI %d, total_bytes TX %d\n", fprintf(fd,
"DLSCH RNTI %x: current_Qm %d, current_RI %d, total_bytes TX %d\n",
stats->rnti, stats->rnti,
stats->dlsch_stats.current_Qm, stats->dlsch_stats.current_Qm,
stats->dlsch_stats.current_RI, stats->dlsch_stats.current_RI,
......
...@@ -48,13 +48,8 @@ ...@@ -48,13 +48,8 @@
//#define DEBUG_DLSCH_CODING //#define DEBUG_DLSCH_CODING
//#define DEBUG_DLSCH_FREE 1 //#define DEBUG_DLSCH_FREE 1
void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARMS *frame_parms)
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, {
uint16_t N_RB,
const NR_DL_FRAME_PARMS* frame_parms) {
NR_gNB_DLSCH_t *dlsch = *dlschptr;
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS; int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers;
...@@ -92,14 +87,10 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, ...@@ -92,14 +87,10 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr,
} }
free(dlsch->txdataF); free(dlsch->txdataF);
free(dlsch->ue_spec_bf_weights); free(dlsch->ue_spec_bf_weights);
free(dlsch);
*dlschptr = NULL;
} }
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
uint16_t N_RB) { {
int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS; int max_layers = (frame_parms->nb_antennas_tx<NR_MAX_NB_LAYERS) ? frame_parms->nb_antennas_tx : NR_MAX_NB_LAYERS;
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*max_layers; //number of segments to be allocated
...@@ -110,34 +101,32 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, ...@@ -110,34 +101,32 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
LOG_D(PHY,"Allocating %d segments (MAX %d, N_PRB %d)\n",a_segments,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER,N_RB); LOG_D(PHY,"Allocating %d segments (MAX %d, N_PRB %d)\n",a_segments,MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER,N_RB);
uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
NR_gNB_DLSCH_t *dlsch = malloc16(sizeof(NR_gNB_DLSCH_t)); NR_gNB_DLSCH_t dlsch;
AssertFatal(dlsch, "cannot allocate dlsch\n");
bzero(dlsch,sizeof(NR_gNB_DLSCH_t));
int txdataf_size = frame_parms->N_RB_DL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8; // max pdsch encoded length for each layer int txdataf_size = frame_parms->N_RB_DL*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8; // max pdsch encoded length for each layer
dlsch->txdataF = (int32_t **)malloc16(max_layers*sizeof(int32_t *)); dlsch.txdataF = (int32_t **)malloc16(max_layers * sizeof(int32_t *));
dlsch->ue_spec_bf_weights = (int32_t ***)malloc16(max_layers*sizeof(int32_t **)); dlsch.ue_spec_bf_weights = (int32_t ***)malloc16(max_layers * sizeof(int32_t **));
for (int layer=0; layer<max_layers; layer++) { for (int layer=0; layer<max_layers; layer++) {
dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64*sizeof(int32_t *)); dlsch.ue_spec_bf_weights[layer] = (int32_t **)malloc16(64 * sizeof(int32_t *));
for (int aa=0; aa<64; aa++) { for (int aa=0; aa<64; aa++) {
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); dlsch.ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES * sizeof(int32_t));
for (int re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { for (int re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff; dlsch.ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
} }
} }
dlsch->txdataF[layer] = (int32_t *)malloc16((txdataf_size)*sizeof(int32_t)); dlsch.txdataF[layer] = (int32_t *)malloc16((txdataf_size) * sizeof(int32_t));
} }
int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; int nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
dlsch->mod_symbs = (int32_t **)malloc16(nb_codewords*sizeof(int32_t *)); dlsch.mod_symbs = (int32_t **)malloc16(nb_codewords * sizeof(int32_t *));
for (int q=0; q<nb_codewords; q++) for (int q=0; q<nb_codewords; q++)
dlsch->mod_symbs[q] = (int32_t *)malloc16(txdataf_size*max_layers*sizeof(int32_t)); dlsch.mod_symbs[q] = (int32_t *)malloc16(txdataf_size * max_layers * sizeof(int32_t));
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; NR_DL_gNB_HARQ_t *harq = &dlsch.harq_process;
bzero(harq, sizeof(NR_DL_gNB_HARQ_t)); bzero(harq, sizeof(NR_DL_gNB_HARQ_t));
harq->b = malloc16(dlsch_bytes); harq->b = malloc16(dlsch_bytes);
AssertFatal(harq->b, "cannot allocate memory for harq->b\n"); AssertFatal(harq->b, "cannot allocate memory for harq->b\n");
...@@ -276,9 +265,13 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -276,9 +265,13 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
uint8_t slot, uint8_t slot,
NR_DL_gNB_HARQ_t *harq, NR_DL_gNB_HARQ_t *harq,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
unsigned char * output, unsigned char *output,
time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput, time_stats_t *tinput,
time_stats_t *dlsch_rate_matching_stats,time_stats_t *dlsch_interleaving_stats, time_stats_t *tprep,
time_stats_t *tparity,
time_stats_t *toutput,
time_stats_t *dlsch_rate_matching_stats,
time_stats_t *dlsch_interleaving_stats,
time_stats_t *dlsch_segmentation_stats) time_stats_t *dlsch_segmentation_stats)
{ {
encoder_implemparams_t impp; encoder_implemparams_t impp;
......
...@@ -44,17 +44,13 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) { ...@@ -44,17 +44,13 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) {
*(pdu+i) = (uint8_t)rand(); *(pdu+i) = (uint8_t)rand();
} }
void nr_fill_dlsch(processingData_L1tx_t *msgTx, void nr_fill_dlsch(processingData_L1tx_t *msgTx, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, uint8_t *sdu)
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu)
{ {
NR_gNB_DLSCH_t *dlsch = &msgTx->dlsch[msgTx->num_pdsch_slot][0];
NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[msgTx->num_pdsch_slot][0]; NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
/// DLSCH struct /// DLSCH struct
memcpy((void*)&harq->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu)); memcpy((void*)&harq->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu));
msgTx->num_pdsch_slot++; msgTx->num_pdsch_slot++;
AssertFatal(sdu != NULL,"sdu is null\n"); AssertFatal(sdu != NULL, "sdu is null\n");
harq->pdu = sdu; harq->pdu = sdu;
} }
...@@ -108,10 +108,9 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, ...@@ -108,10 +108,9 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu,
*/ */
void nr_init_pbch_interleaver(uint8_t *interleaver); void nr_init_pbch_interleaver(uint8_t *interleaver);
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB);
uint16_t N_RB);
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB, const NR_DL_FRAME_PARMS* frame_parms); void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARMS *frame_parms);
/** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs /** \brief This function is the top-level entry point to PUSCH demodulation, after frequency-domain transformation and channel estimation. It performs
- RB extraction (signal and channel estimates) - RB extraction (signal and channel estimates)
...@@ -308,17 +307,11 @@ void nr_fill_prach_ru(RU_t *ru, ...@@ -308,17 +307,11 @@ void nr_fill_prach_ru(RU_t *ru,
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, find_type_t type); int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, find_type_t type);
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type); int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type);
NR_gNB_PUCCH_t *new_gNB_pucch(void);
void free_gNB_pucch(NR_gNB_PUCCH_t *pucch);
void nr_fill_pucch(PHY_VARS_gNB *gNB, void nr_fill_pucch(PHY_VARS_gNB *gNB,
int frame, int frame,
int slot, int slot,
nfapi_nr_pucch_pdu_t *pucch_pdu); nfapi_nr_pucch_pdu_t *pucch_pdu);
NR_gNB_SRS_t *new_gNB_srs(void);
void free_gNB_srs(NR_gNB_SRS_t *srs);
void nr_fill_srs(PHY_VARS_gNB *gNB, void nr_fill_srs(PHY_VARS_gNB *gNB,
frame_t frame, frame_t frame,
slot_t slot, slot_t slot,
......
...@@ -36,36 +36,30 @@ ...@@ -36,36 +36,30 @@
NR_gNB_ULSCH_t *find_nr_ulsch(PHY_VARS_gNB *gNB, uint16_t rnti, int pid) NR_gNB_ULSCH_t *find_nr_ulsch(PHY_VARS_gNB *gNB, uint16_t rnti, int pid)
{ {
int16_t first_free_index = -1; int16_t first_free_index = -1;
AssertFatal(gNB != NULL,"gNB is null\n"); AssertFatal(gNB != NULL, "gNB is null\n");
NR_gNB_ULSCH_t *ulsch = NULL; NR_gNB_ULSCH_t *ulsch = NULL;
for (int i = 0; i < gNB->max_nb_pusch; i++) { for (int i = 0; i < gNB->max_nb_pusch; i++) {
ulsch = gNB->ulsch[i]; ulsch = &gNB->ulsch[i];
AssertFatal(ulsch != NULL, "gNB->ulsch[%d] is null\n", i); AssertFatal(ulsch != NULL, "gNB->ulsch[%d] is null\n", i);
if(!ulsch->active) { if (!ulsch->active) {
if (first_free_index == -1) if (first_free_index == -1)
first_free_index = i; first_free_index = i;
} } else {
else {
// if there is already an active ULSCH for this RNTI and HARQ_PID // if there is already an active ULSCH for this RNTI and HARQ_PID
if ((ulsch->harq_pid == pid) && (ulsch->rnti == rnti)) if ((ulsch->harq_pid == pid) && (ulsch->rnti == rnti))
return ulsch; return ulsch;
} }
} }
if (first_free_index != -1) if (first_free_index != -1)
ulsch = gNB->ulsch[first_free_index]; ulsch = &gNB->ulsch[first_free_index];
return ulsch; return ulsch;
} }
void nr_fill_ulsch(PHY_VARS_gNB *gNB, void nr_fill_ulsch(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_pusch_pdu_t *ulsch_pdu)
int frame,
int slot,
nfapi_nr_pusch_pdu_t *ulsch_pdu)
{ {
int harq_pid = ulsch_pdu->pusch_data.harq_process_id; int harq_pid = ulsch_pdu->pusch_data.harq_process_id;
NR_gNB_ULSCH_t *ulsch = find_nr_ulsch(gNB, ulsch_pdu->rnti, harq_pid); NR_gNB_ULSCH_t *ulsch = find_nr_ulsch(gNB, ulsch_pdu->rnti, harq_pid);
AssertFatal(ulsch, "No ulsch_id found for rnti %04x\n", ulsch_pdu->rnti); AssertFatal(ulsch, "No ulsch_id found for rnti %04x\n", ulsch_pdu->rnti);
...@@ -79,8 +73,13 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, ...@@ -79,8 +73,13 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
NR_UL_gNB_HARQ_t *harq = ulsch->harq_process; NR_UL_gNB_HARQ_t *harq = ulsch->harq_process;
harq->new_rx = ulsch_pdu->pusch_data.new_data_indicator; harq->new_rx = ulsch_pdu->pusch_data.new_data_indicator;
LOG_D(PHY,"%d.%d RNTI %x HARQ PID %d new data indicator %d\n", LOG_D(PHY,
frame, slot, ulsch_pdu->rnti, harq_pid, ulsch_pdu->pusch_data.new_data_indicator); "%d.%d RNTI %x HARQ PID %d new data indicator %d\n",
frame,
slot,
ulsch_pdu->rnti,
harq_pid,
ulsch_pdu->pusch_data.new_data_indicator);
if (harq->new_rx) if (harq->new_rx)
harq->round = 0; harq->round = 0;
else else
...@@ -88,16 +87,16 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, ...@@ -88,16 +87,16 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
memcpy(&ulsch->harq_process->ulsch_pdu, ulsch_pdu, sizeof(ulsch->harq_process->ulsch_pdu)); memcpy(&ulsch->harq_process->ulsch_pdu, ulsch_pdu, sizeof(ulsch->harq_process->ulsch_pdu));
LOG_D(PHY,"Initializing nFAPI for ULSCH, harq_pid %d\n", harq_pid); LOG_D(PHY, "Initializing nFAPI for ULSCH, harq_pid %d\n", harq_pid);
} }
void reset_active_ulsch(PHY_VARS_gNB *gNB, int frame) void reset_active_ulsch(PHY_VARS_gNB *gNB, int frame)
{ {
// disactivate ULSCH structure after a given number of frames // deactivate ULSCH structure after a given number of frames
// no activity on this structure for NUMBER_FRAMES_PHY_UE_INACTIVE // no activity on this structure for NUMBER_FRAMES_PHY_UE_INACTIVE
// assuming UE disconnected or some other error occurred // assuming UE disconnected or some other error occurred
for (int i = 0; i < gNB->max_nb_pusch; i++) { for (int i = 0; i < gNB->max_nb_pusch; i++) {
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[i]; NR_gNB_ULSCH_t *ulsch = &gNB->ulsch[i];
if (ulsch->active && (((frame - ulsch->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE)) if (ulsch->active && (((frame - ulsch->frame + 1024) % 1024) > NUMBER_FRAMES_PHY_UE_INACTIVE))
ulsch->active = false; ulsch->active = false;
} }
...@@ -108,11 +107,7 @@ void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n ...@@ -108,11 +107,7 @@ void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n
nr_codeword_unscrambling(llr, size, 0, Nid, n_RNTI); nr_codeword_unscrambling(llr, size, 0, Nid, n_RNTI);
} }
void nr_ulsch_layer_demapping(int16_t *llr_cw, void nr_ulsch_layer_demapping(int16_t *llr_cw, uint8_t Nl, uint8_t mod_order, uint32_t length, int16_t **llr_layers)
uint8_t Nl,
uint8_t mod_order,
uint32_t length,
int16_t **llr_layers)
{ {
switch (Nl) { switch (Nl) {
...@@ -137,31 +132,43 @@ void nr_ulsch_layer_demapping(int16_t *llr_cw, ...@@ -137,31 +132,43 @@ void nr_ulsch_layer_demapping(int16_t *llr_cw,
void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB) void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB)
{ {
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
for (int i = 0;i < MAX_MOBILES_PER_GNB; i++) {
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i]; NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
if (stats->active && stats->frame != stats->ulsch_stats.dump_frame) { if (stats->active && stats->frame != stats->ulsch_stats.dump_frame) {
stats->ulsch_stats.dump_frame = stats->frame; stats->ulsch_stats.dump_frame = stats->frame;
for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++)
if (aa==0) if (aa == 0)
fprintf(fd,"ULSCH RNTI %4x, %d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d, sync_pos %d\n", fprintf(fd,
stats->rnti, stats->frame, "ULSCH RNTI %4x, %d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d, sync_pos %d\n",
aa, stats->ulsch_stats.power[aa]/10, stats->ulsch_stats.power[aa]%10, stats->rnti,
aa, stats->ulsch_stats.noise_power[aa]/10, stats->ulsch_stats.noise_power[aa]%10, stats->frame,
aa,
stats->ulsch_stats.power[aa] / 10,
stats->ulsch_stats.power[aa] % 10,
aa,
stats->ulsch_stats.noise_power[aa] / 10,
stats->ulsch_stats.noise_power[aa] % 10,
stats->ulsch_stats.sync_pos); stats->ulsch_stats.sync_pos);
else else
fprintf(fd," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n", fprintf(fd,
aa, stats->ulsch_stats.power[aa]/10, stats->ulsch_stats.power[aa]%10, " ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n",
aa, stats->ulsch_stats.noise_power[aa]/10, stats->ulsch_stats.noise_power[aa]%10); aa,
stats->ulsch_stats.power[aa] / 10,
stats->ulsch_stats.power[aa] % 10,
aa,
stats->ulsch_stats.noise_power[aa] / 10,
stats->ulsch_stats.noise_power[aa] % 10);
int *rt = stats->ulsch_stats.round_trials; int *rt = stats->ulsch_stats.round_trials;
fprintf(fd," round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, DTX %d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d\n", fprintf(fd,
" round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, DTX %d, current_Qm %d, current_RI %d, total_bytes "
"RX/SCHED %d/%d\n",
rt[0], rt[0],
(double)rt[1]/rt[0], (double)rt[1] / rt[0],
rt[1], rt[1],
(double)rt[2]/rt[0], (double)rt[2] / rt[0],
rt[2], rt[2],
(double)rt[3]/rt[0], (double)rt[3] / rt[0],
rt[3], rt[3],
stats->ulsch_stats.DTX, stats->ulsch_stats.DTX,
stats->ulsch_stats.current_Qm, stats->ulsch_stats.current_Qm,
...@@ -171,5 +178,3 @@ void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB) ...@@ -171,5 +178,3 @@ void dump_pusch_stats(FILE *fd, PHY_VARS_gNB *gNB)
} }
} }
} }
...@@ -33,10 +33,9 @@ ...@@ -33,10 +33,9 @@
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "common/utils/threadPool/thread-pool.h" #include "common/utils/threadPool/thread-pool.h"
void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch, uint16_t N_RB_UL); void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch, uint16_t N_RB_UL);
NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL);
NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL);
/*! \brief Perform PUSCH decoding. TS 38.212 V15.4.0 subclause 6.2 /*! \brief Perform PUSCH decoding. TS 38.212 V15.4.0 subclause 6.2
@param phy_vars_gNB, Pointer to PHY data structure for gNB @param phy_vars_gNB, Pointer to PHY data structure for gNB
......
This diff is collapsed.
...@@ -44,33 +44,17 @@ ...@@ -44,33 +44,17 @@
//#define SRS_DEBUG //#define SRS_DEBUG
NR_gNB_SRS_t *new_gNB_srs(void){ void nr_fill_srs(PHY_VARS_gNB *gNB, frame_t frame, slot_t slot, nfapi_nr_srs_pdu_t *srs_pdu)
NR_gNB_SRS_t *srs;
srs = (NR_gNB_SRS_t *)malloc16(sizeof(NR_gNB_SRS_t));
srs->active = 0;
return (srs);
}
void free_gNB_srs(NR_gNB_SRS_t *srs)
{
free_and_zero(srs);
}
void nr_fill_srs(PHY_VARS_gNB *gNB,
frame_t frame,
slot_t slot,
nfapi_nr_srs_pdu_t *srs_pdu)
{ {
bool found = false; bool found = false;
for (int i = 0; i < gNB->max_nb_srs; i++) { for (int i = 0; i < gNB->max_nb_srs; i++) {
if (gNB->srs[i]->active == 0) { NR_gNB_SRS_t *srs = &gNB->srs[i];
if (srs->active == 0) {
found = true; found = true;
NR_gNB_SRS_t *srs = gNB->srs[i];
srs->frame = frame; srs->frame = frame;
srs->slot = slot; srs->slot = slot;
srs->active = 1; srs->active = 1;
memcpy((void*)&srs->srs_pdu, (void*)srs_pdu, sizeof(nfapi_nr_srs_pdu_t)); memcpy((void *)&srs->srs_pdu, (void *)srs_pdu, sizeof(nfapi_nr_srs_pdu_t));
break; break;
} }
} }
......
...@@ -222,7 +222,7 @@ typedef struct { ...@@ -222,7 +222,7 @@ typedef struct {
typedef struct { typedef struct {
//! estimated received spatial signal power (linear) //! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NB_ANTENNAS_TX][NB_ANTENNAS_RX]; unsigned int rx_spatial_power[NB_ANTENNAS_TX][NB_ANTENNAS_RX];
//! estimated received spatial signal power (dB) //! estimated received spatial signal power (dB)
unsigned int rx_spatial_power_dB[NB_ANTENNAS_TX][NB_ANTENNAS_RX]; unsigned int rx_spatial_power_dB[NB_ANTENNAS_TX][NB_ANTENNAS_RX];
//! estimated rssi (dBm) //! estimated rssi (dBm)
...@@ -613,10 +613,10 @@ typedef struct PHY_VARS_gNB_s { ...@@ -613,10 +613,10 @@ typedef struct PHY_VARS_gNB_s {
NR_gNB_COMMON common_vars; NR_gNB_COMMON common_vars;
NR_gNB_PRACH prach_vars; NR_gNB_PRACH prach_vars;
NR_gNB_PRS prs_vars; NR_gNB_PRS prs_vars;
NR_gNB_PUSCH **pusch_vars; NR_gNB_PUSCH *pusch_vars;
NR_gNB_PUCCH_t **pucch; NR_gNB_PUCCH_t *pucch;
NR_gNB_SRS_t **srs; NR_gNB_SRS_t *srs;
NR_gNB_ULSCH_t **ulsch; NR_gNB_ULSCH_t *ulsch;
NR_gNB_PHY_STATS_t phy_stats[MAX_MOBILES_PER_GNB]; NR_gNB_PHY_STATS_t phy_stats[MAX_MOBILES_PER_GNB];
t_nrPolar_params **polarParams; t_nrPolar_params **polarParams;
...@@ -811,7 +811,7 @@ typedef struct processingData_L1tx { ...@@ -811,7 +811,7 @@ typedef struct processingData_L1tx {
nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS]; nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS]; nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
NR_gNB_CSIRS_t csirs_pdu[NR_SYMBOLS_PER_SLOT]; NR_gNB_CSIRS_t csirs_pdu[NR_SYMBOLS_PER_SLOT];
NR_gNB_DLSCH_t ***dlsch; NR_gNB_DLSCH_t **dlsch;
NR_gNB_SSB_t ssb[64]; NR_gNB_SSB_t ssb[64];
uint16_t num_pdsch_slot; uint16_t num_pdsch_slot;
int num_dl_pdcch; int num_dl_pdcch;
......
...@@ -100,10 +100,7 @@ void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,int frame,int slot, ...@@ -100,10 +100,7 @@ void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,int frame,int slot,
}*/ }*/
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, int frame, int slot, nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu)
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
int frame,int slot,
nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu)
{ {
int found = 0; int found = 0;
...@@ -121,7 +118,6 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx, ...@@ -121,7 +118,6 @@ void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
LOG_E(MAC,"CSI-RS list is full\n"); LOG_E(MAC,"CSI-RS list is full\n");
} }
void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx, void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu) uint8_t *sdu)
...@@ -133,7 +129,6 @@ void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx, ...@@ -133,7 +129,6 @@ void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
{ {
// copy data from L2 interface into L1 structures // copy data from L2 interface into L1 structures
module_id_t Mod_id = Sched_INFO->module_id; module_id_t Mod_id = Sched_INFO->module_id;
nfapi_nr_dl_tti_request_t *DL_req = Sched_INFO->DL_req; nfapi_nr_dl_tti_request_t *DL_req = Sched_INFO->DL_req;
...@@ -202,8 +197,10 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO) ...@@ -202,8 +197,10 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n", AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
pduIndex,TX_req->pdu_list[pduIndex].num_TLV); pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct; uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch,"Number of PDSCH PDUs %d exceeded the limit %d\n", AssertFatal(msgTx->num_pdsch_slot < gNB->max_nb_pdsch,
msgTx->num_pdsch_slot, gNB->max_nb_pdsch); "Number of PDSCH PDUs %d exceeded the limit %d\n",
msgTx->num_pdsch_slot,
gNB->max_nb_pdsch);
handle_nr_nfapi_pdsch_pdu(msgTx,&dl_tti_pdu->pdsch_pdu, sdu); handle_nr_nfapi_pdsch_pdu(msgTx,&dl_tti_pdu->pdsch_pdu, sdu);
} }
} }
......
This diff is collapsed.
...@@ -422,8 +422,8 @@ int main(int argc, char **argv) ...@@ -422,8 +422,8 @@ int main(int argc, char **argv)
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe]; unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
processingData_L1tx_t msgDataTx; processingData_L1tx_t msgDataTx;
init_DLSCH_struct(gNB, &msgDataTx); init_DLSCH_struct(gNB, &msgDataTx);
NR_gNB_DLSCH_t *dlsch = msgDataTx.dlsch[0][0]; NR_gNB_DLSCH_t *dlsch = &msgDataTx.dlsch[0][0];
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
//time_stats_t *rm_stats, *te_stats, *i_stats; //time_stats_t *rm_stats, *te_stats, *i_stats;
unsigned int TBS = 8424; unsigned int TBS = 8424;
uint8_t nb_re_dmrs = 6; // No data in dmrs symbol uint8_t nb_re_dmrs = 6; // No data in dmrs symbol
......
...@@ -983,7 +983,7 @@ int main(int argc, char **argv) ...@@ -983,7 +983,7 @@ int main(int argc, char **argv)
int harq_pid = slot; int harq_pid = slot;
NR_DL_UE_HARQ_t *UE_harq_process = &UE->dl_harq_processes[0][harq_pid]; NR_DL_UE_HARQ_t *UE_harq_process = &UE->dl_harq_processes[0][harq_pid];
NR_gNB_DLSCH_t *gNB_dlsch = msgDataTx->dlsch[0][0]; NR_gNB_DLSCH_t *gNB_dlsch = &msgDataTx->dlsch[0][0];
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
UE_harq_process->ack = 0; UE_harq_process->ack = 0;
...@@ -1245,8 +1245,10 @@ int main(int argc, char **argv) ...@@ -1245,8 +1245,10 @@ int main(int argc, char **argv)
if (print_perf==1) { if (print_perf==1) {
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, block %d)\n", printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, block %d)\n",
1000>>*scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex, 1000 >> *scc->ssbSubcarrierSpacing,
msgDataTx->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3); g_rbSize,
g_mcsIndex,
msgDataTx->dlsch[0][0].harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0] << 3);
printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx"); printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx");
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time"); printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time"); printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time");
......
...@@ -623,7 +623,7 @@ int main(int argc, char **argv) ...@@ -623,7 +623,7 @@ int main(int argc, char **argv)
if(format==0){ if(format==0){
nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu; nfapi_nr_uci_pucch_pdu_format_0_1_t uci_pdu;
nfapi_nr_pucch_pdu_t pucch_pdu; nfapi_nr_pucch_pdu_t pucch_pdu;
gNB->phy_stats[0].rnti = 0x1234; gNB->phy_stats[0].rnti = 0x1234;
pucch_pdu.rnti = 0x1234; pucch_pdu.rnti = 0x1234;
pucch_pdu.subcarrier_spacing = 1; pucch_pdu.subcarrier_spacing = 1;
pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1; pucch_pdu.group_hop_flag = PUCCH_GroupHopping&1;
......
...@@ -455,7 +455,7 @@ int main(int argc, char **argv) ...@@ -455,7 +455,7 @@ int main(int argc, char **argv)
uint8_t rvidx = 0; uint8_t rvidx = 0;
uint8_t UE_id = 0; uint8_t UE_id = 0;
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id]; NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id];
NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_process; NR_UL_gNB_HARQ_t *harq_process_gNB = ulsch_gNB->harq_process;
nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu; nfapi_nr_pusch_pdu_t *rel15_ul = &harq_process_gNB->ulsch_pdu;
...@@ -614,7 +614,7 @@ int main(int argc, char **argv) ...@@ -614,7 +614,7 @@ int main(int argc, char **argv)
errors_bit = 0; errors_bit = 0;
for (i = 0; i < TBS; i++) { for (i = 0; i < TBS; i++) {
estimated_output_bit[i] = (ulsch_gNB->harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7); estimated_output_bit[i] = (ulsch_gNB->harq_process->b[i / 8] & (1 << (i & 7))) >> (i & 7);
test_input_bit[i] = (test_input[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments test_input_bit[i] = (test_input[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments
if (estimated_output_bit[i] != test_input_bit[i]) { if (estimated_output_bit[i] != test_input_bit[i]) {
......
This diff is collapsed.
...@@ -1981,7 +1981,6 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces ...@@ -1981,7 +1981,6 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces
void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia) void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia)
{ {
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
destroy_nr_list(&sched_ctrl->available_dl_harq); destroy_nr_list(&sched_ctrl->available_dl_harq);
destroy_nr_list(&sched_ctrl->feedback_dl_harq); destroy_nr_list(&sched_ctrl->feedback_dl_harq);
......
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