removing call from MAC to PHY to clear structures (now automatic clearing)
This commit is contained in:
@@ -15,6 +15,8 @@
|
|||||||
# define NUMBER_OF_SCH_STATS_MAX 16
|
# define NUMBER_OF_SCH_STATS_MAX 16
|
||||||
# define NUMBER_OF_NR_SCH_STATS_MAX MAX_MOBILES_PER_GNB
|
# define NUMBER_OF_NR_SCH_STATS_MAX MAX_MOBILES_PER_GNB
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|||||||
+9
-38
@@ -128,7 +128,9 @@ 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;
|
||||||
@@ -173,46 +175,15 @@ void rx_func(void *param) {
|
|||||||
|
|
||||||
T(T_GNB_PHY_DL_TICK, T_INT(gNB->Mod_id), T_INT(frame_tx), T_INT(slot_tx));
|
T(T_GNB_PHY_DL_TICK, T_INT(gNB->Mod_id), T_INT(frame_tx), T_INT(slot_tx));
|
||||||
|
|
||||||
/* hack to remove UEs */
|
// disactivate PHY stats if UE is inactive for more than 10 frames
|
||||||
extern int rnti_to_remove[10];
|
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
||||||
extern volatile int rnti_to_remove_count;
|
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
|
||||||
extern pthread_mutex_t rnti_to_remove_mutex;
|
if(stats->active && (frame_rx > (stats->frame + NUMBER_FRAMES_PHY_UE_INACTIVE) % 1024))
|
||||||
if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1);
|
stats->active = false;
|
||||||
int up_removed = 0;
|
|
||||||
int down_removed = 0;
|
|
||||||
int pucch_removed = 0;
|
|
||||||
for (int i = 0; i < rnti_to_remove_count; i++) {
|
|
||||||
LOG_W(NR_PHY, "to remove rnti 0x%04x\n", rnti_to_remove[i]);
|
|
||||||
void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch);
|
|
||||||
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
|
|
||||||
int j;
|
|
||||||
for (j = 0; j < NUMBER_OF_NR_ULSCH_MAX; j++)
|
|
||||||
if (gNB->ulsch[j]->rnti == rnti_to_remove[i]) {
|
|
||||||
gNB->ulsch[j]->rnti = 0;
|
|
||||||
gNB->ulsch[j]->harq_mask = 0;
|
|
||||||
int h;
|
|
||||||
for (h = 0; h < NR_MAX_ULSCH_HARQ_PROCESSES; h++) {
|
|
||||||
gNB->ulsch[j]->harq_processes[h]->status = NR_SCH_IDLE;
|
|
||||||
gNB->ulsch[j]->harq_processes[h]->round = 0;
|
|
||||||
gNB->ulsch[j]->harq_processes[h]->handled = 0;
|
|
||||||
}
|
|
||||||
up_removed++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j = 0; j < gNB->max_nb_pucch; j++)
|
|
||||||
if (gNB->pucch[j]->active > 0 &&
|
|
||||||
gNB->pucch[j]->pucch_pdu.rnti == rnti_to_remove[i]) {
|
|
||||||
gNB->pucch[j]->active = 0;
|
|
||||||
gNB->pucch[j]->pucch_pdu.rnti = 0;
|
|
||||||
pucch_removed++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (rnti_to_remove_count) LOG_W(NR_PHY, "to remove rnti_to_remove_count=%d, up_removed=%d down_removed=%d pucch_removed=%d\n", rnti_to_remove_count, up_removed, down_removed, pucch_removed);
|
|
||||||
rnti_to_remove_count = 0;
|
|
||||||
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
|
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
@@ -77,6 +77,28 @@ void init_ul_delay_table(NR_DL_FRAME_PARMS *fp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NR_gNB_PHY_STATS_t *get_phy_stats(PHY_VARS_gNB *gNB, uint16_t rnti)
|
||||||
|
{
|
||||||
|
NR_gNB_PHY_STATS_t *stats;
|
||||||
|
int first_free = -1;
|
||||||
|
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
||||||
|
stats = &gNB->phy_stats[i];
|
||||||
|
if (stats->active && stats->rnti == rnti)
|
||||||
|
return stats;
|
||||||
|
else if (!stats->active && first_free == -1)
|
||||||
|
first_free = i;
|
||||||
|
}
|
||||||
|
// new stats
|
||||||
|
AssertFatal(first_free >= 0, "PHY statistics list is full\n");
|
||||||
|
stats = &gNB->phy_stats[first_free];
|
||||||
|
stats->active = true;
|
||||||
|
stats->rnti = rnti;
|
||||||
|
memset((void*)&stats->dlsch_stats, 0, sizeof(stats->dlsch_stats));
|
||||||
|
memset((void*)&stats->ulsch_stats, 0, sizeof(stats->ulsch_stats));
|
||||||
|
memset((void*)&stats->uci_stats, 0, sizeof(stats->uci_stats));
|
||||||
|
return(stats);
|
||||||
|
}
|
||||||
|
|
||||||
int init_codebook_gNB(PHY_VARS_gNB *gNB) {
|
int init_codebook_gNB(PHY_VARS_gNB *gNB) {
|
||||||
|
|
||||||
if(gNB->frame_parms.nb_antennas_tx>1){
|
if(gNB->frame_parms.nb_antennas_tx>1){
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
|
|
||||||
void nr_est_timing_advance_pusch(const NR_DL_FRAME_PARMS *frame_parms, const int32_t *ul_ch_estimates_time, struct delay_s *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 max_pos = delay->pusch_delay_max_pos;
|
int max_pos = delay->pusch_delay_max_pos;
|
||||||
int max_val = delay->pusch_delay_max_val;
|
int max_val = delay->pusch_delay_max_val;
|
||||||
@@ -208,19 +208,20 @@ 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, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol, uint8_t nrOfLayers){
|
void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol, uint8_t nrOfLayers)
|
||||||
|
{
|
||||||
|
|
||||||
int rx_power_tot[NUMBER_OF_NR_ULSCH_MAX];
|
int rx_power_tot[NUMBER_OF_NR_ULSCH_MAX];
|
||||||
int rx_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_RX];
|
int rx_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_RX];
|
||||||
unsigned short rx_power_avg_dB[NUMBER_OF_NR_ULSCH_MAX];
|
unsigned short rx_power_avg_dB[NUMBER_OF_NR_ULSCH_MAX];
|
||||||
unsigned short rx_power_tot_dB[NUMBER_OF_NR_ULSCH_MAX];
|
unsigned short rx_power_tot_dB[NUMBER_OF_NR_ULSCH_MAX];
|
||||||
|
|
||||||
double rx_gain = openair0_cfg[0].rx_gain[0];
|
double rx_gain = openair0_cfg[0].rx_gain[0];
|
||||||
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
|
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
|
||||||
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
|
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
|
||||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||||
int ch_offset = fp->ofdm_symbol_size * symbol;
|
int ch_offset = fp->ofdm_symbol_size * symbol;
|
||||||
int N_RB_UL = gNB->ulsch[ulsch_id]->harq_processes[harq_pid]->ulsch_pdu.rb_size;
|
int N_RB_UL = gNB->ulsch[ulsch_id]->harq_process->ulsch_pdu.rb_size;
|
||||||
|
|
||||||
rx_power_tot[ulsch_id] = 0;
|
rx_power_tot[ulsch_id] = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,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);
|
||||||
memset(&gNB->measurements.delay[ul_id], 0, sizeof(gNB->measurements.delay[ul_id]));
|
NR_ULSCH_delay_t *delay = &gNB->ulsch[ul_id]->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];
|
||||||
@@ -232,13 +233,13 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
|||||||
(int16_t *) ul_ls_est,
|
(int16_t *) ul_ls_est,
|
||||||
(int16_t *) gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx]);
|
(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], &gNB->measurements.delay[ul_id]);
|
nr_est_timing_advance_pusch(&gNB->frame_parms, gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx], delay);
|
||||||
int delay = gNB->measurements.delay[ul_id].pusch_est_delay;
|
int pusch_delay = delay->pusch_est_delay;
|
||||||
int delay_idx = get_delay_idx(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];
|
||||||
|
|
||||||
#ifdef DEBUG_PUSCH
|
#ifdef DEBUG_PUSCH
|
||||||
printf("Estimated delay = %i\n", delay >> 1);
|
printf("Estimated delay = %i\n", pusch_delay >> 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pilot_cnt = 0;
|
pilot_cnt = 0;
|
||||||
@@ -277,7 +278,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
|||||||
// Revert delay
|
// Revert delay
|
||||||
pilot_cnt = 0;
|
pilot_cnt = 0;
|
||||||
ul_ch = &ul_ch_estimates[p * gNB->frame_parms.nb_antennas_rx + aarx][ch_offset];
|
ul_ch = &ul_ch_estimates[p * gNB->frame_parms.nb_antennas_rx + aarx][ch_offset];
|
||||||
int inv_delay_idx = get_delay_idx(-delay);
|
int inv_delay_idx = get_delay_idx(-pusch_delay);
|
||||||
c16_t *ul_inv_delay_table = gNB->frame_parms.ul_delay_table[inv_delay_idx];
|
c16_t *ul_inv_delay_table = gNB->frame_parms.ul_delay_table[inv_delay_idx];
|
||||||
for (int n = 0; n < 3 * nb_rb_pusch; n++) {
|
for (int n = 0; n < 3 * nb_rb_pusch; n++) {
|
||||||
for (int k_line = 0; k_line <= 1; k_line++) {
|
for (int k_line = 0; k_line <= 1; k_line++) {
|
||||||
@@ -311,9 +312,9 @@ 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 *)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], &gNB->measurements.delay[ul_id]);
|
nr_est_timing_advance_pusch(&gNB->frame_parms, gNB->pusch_vars[ul_id]->ul_ch_estimates_time[aarx], delay);
|
||||||
int delay = gNB->measurements.delay[ul_id].pusch_est_delay;
|
int pusch_delay = delay->pusch_est_delay;
|
||||||
int delay_idx = get_delay_idx(-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];
|
||||||
for (int n = 0; n < nb_rb_pusch * NR_NB_SC_PER_RB; n++) {
|
for (int n = 0; n < nb_rb_pusch * NR_NB_SC_PER_RB; n++) {
|
||||||
ul_ch[n] = c16mulShift(ul_ls_est[n], ul_delay_table[n % 6], 8);
|
ul_ch[n] = c16mulShift(ul_ls_est[n], ul_delay_table[n % 6], 8);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot,int first_symb,int num_symb)
|
|||||||
|
|
||||||
void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol, uint8_t nrOfLayers);
|
void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, 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, struct delay_s *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]);
|
||||||
|
|||||||
@@ -568,20 +568,21 @@ 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<NUMBER_OF_NR_SCH_STATS_MAX;i++)
|
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
||||||
if (gNB->dlsch_stats[i].rnti > 0 && gNB->dlsch_stats[i].frame != gNB->dlsch_stats[i].dump_frame) {
|
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
|
||||||
gNB->dlsch_stats[i].dump_frame = gNB->dlsch_stats[i].frame;
|
if (stats->active && stats->frame != stats->dlsch_stats.dump_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",
|
||||||
gNB->dlsch_stats[i].rnti,
|
stats->rnti,
|
||||||
gNB->dlsch_stats[i].current_Qm,
|
stats->dlsch_stats.current_Qm,
|
||||||
gNB->dlsch_stats[i].current_RI,
|
stats->dlsch_stats.current_RI,
|
||||||
gNB->dlsch_stats[i].total_bytes_tx);
|
stats->dlsch_stats.total_bytes_tx);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_pdsch_stats(PHY_VARS_gNB *gNB) {
|
void clear_pdsch_stats(PHY_VARS_gNB *gNB)
|
||||||
|
{
|
||||||
for (int i = 0;i < NUMBER_OF_NR_SCH_STATS_MAX; i++)
|
for (int i = 0; i < MAX_MOBILES_PER_GNB;i++)
|
||||||
memset((void*)&gNB->dlsch_stats[i],0,sizeof(gNB->dlsch_stats[i]));
|
memset((void*)&gNB->phy_stats[i].dlsch_stats,0,sizeof(gNB->phy_stats[i].dlsch_stats));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
|||||||
|
|
||||||
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
|
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
|
||||||
|
|
||||||
void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch);
|
|
||||||
|
|
||||||
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
|
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
|
||||||
|
|
||||||
NR_gNB_SCH_STATS_t *find_nr_dlsch_stats(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
|
NR_gNB_SCH_STATS_t *find_nr_dlsch_stats(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
|
|
||||||
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) {
|
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) {
|
||||||
AssertFatal(dlsch!=NULL,"dlsch is null\n");
|
AssertFatal(dlsch!=NULL,"dlsch is null\n");
|
||||||
dlsch->rnti = 0;
|
|
||||||
dlsch->active = 0;
|
dlsch->active = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +279,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
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 *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_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;
|
||||||
impp.output=output;
|
impp.output=output;
|
||||||
unsigned int crc=1;
|
unsigned int crc=1;
|
||||||
@@ -289,29 +289,18 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||||
uint32_t A = rel15->TBSize[0]<<3;
|
uint32_t A = rel15->TBSize[0]<<3;
|
||||||
unsigned char *a=harq->pdu;
|
unsigned char *a=harq->pdu;
|
||||||
if ( rel15->rnti != SI_RNTI)
|
if (rel15->rnti != SI_RNTI)
|
||||||
trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], WS_C_RNTI, rel15->rnti, frame, slot,0, 0);
|
trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], WS_C_RNTI, rel15->rnti, frame, slot,0, 0);
|
||||||
|
|
||||||
NR_gNB_SCH_STATS_t *stats=NULL;
|
NR_gNB_PHY_STATS_t *phy_stats = NULL;
|
||||||
int first_free=-1;
|
if (rel15->rnti != 0xFFFF)
|
||||||
|
phy_stats = get_phy_stats(gNB, rel15->rnti);
|
||||||
|
|
||||||
for (int i=0; i<NUMBER_OF_NR_SCH_STATS_MAX; i++) {
|
if (phy_stats) {
|
||||||
if (gNB->dlsch_stats[i].rnti == 0 && first_free == -1) {
|
phy_stats->frame = frame;
|
||||||
first_free = i;
|
phy_stats->dlsch_stats.total_bytes_tx += rel15->TBSize[0];
|
||||||
stats=&gNB->dlsch_stats[i];
|
phy_stats->dlsch_stats.current_RI = rel15->nrOfLayers;
|
||||||
}
|
phy_stats->dlsch_stats.current_Qm = rel15->qamModOrder[0];
|
||||||
|
|
||||||
if (gNB->dlsch_stats[i].rnti == rel15->rnti) {
|
|
||||||
stats=&gNB->dlsch_stats[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stats) {
|
|
||||||
stats->rnti = rel15->rnti;
|
|
||||||
stats->total_bytes_tx += rel15->TBSize[0];
|
|
||||||
stats->current_RI = rel15->nrOfLayers;
|
|
||||||
stats->current_Qm = rel15->qamModOrder[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int max_bytes = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers*1056;
|
int max_bytes = MAX_NUM_NR_DLSCH_SEGMENTS_PER_LAYER*rel15->nrOfLayers*1056;
|
||||||
|
|||||||
@@ -46,14 +46,15 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) {
|
|||||||
|
|
||||||
void nr_fill_dlsch(processingData_L1tx_t *msgTx,
|
void nr_fill_dlsch(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)
|
||||||
|
{
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
#include "PHY/defs_nr_common.h"
|
#include "PHY/defs_nr_common.h"
|
||||||
|
|
||||||
|
|
||||||
void nr_group_sequence_hopping(pucch_GroupHopping_t PUCCH_GroupHopping,
|
void nr_group_sequence_hopping(pucch_GroupHopping_t PUCCH_GroupHopping,
|
||||||
uint32_t n_id,
|
uint32_t n_id,
|
||||||
uint8_t n_hop,
|
uint8_t n_hop,
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#define NR_PBCH_PDU_BITS 24
|
#define NR_PBCH_PDU_BITS 24
|
||||||
|
|
||||||
|
NR_gNB_PHY_STATS_t *get_phy_stats(PHY_VARS_gNB *gNB, uint16_t rnti);
|
||||||
|
|
||||||
int nr_generate_prs(uint32_t **nr_gold_prs,
|
int nr_generate_prs(uint32_t **nr_gold_prs,
|
||||||
c16_t *txdataF,
|
c16_t *txdataF,
|
||||||
@@ -312,19 +313,9 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
|||||||
int slot,
|
int slot,
|
||||||
nfapi_nr_pucch_pdu_t *pucch_pdu);
|
nfapi_nr_pucch_pdu_t *pucch_pdu);
|
||||||
|
|
||||||
int nr_find_pucch(uint16_t rnti,
|
|
||||||
int frame,
|
|
||||||
int slot,
|
|
||||||
PHY_VARS_gNB *gNB);
|
|
||||||
|
|
||||||
NR_gNB_SRS_t *new_gNB_srs(void);
|
NR_gNB_SRS_t *new_gNB_srs(void);
|
||||||
void free_gNB_srs(NR_gNB_SRS_t *srs);
|
void free_gNB_srs(NR_gNB_SRS_t *srs);
|
||||||
|
|
||||||
int nr_find_srs(rnti_t rnti,
|
|
||||||
frame_t frame,
|
|
||||||
slot_t slot,
|
|
||||||
PHY_VARS_gNB *gNB);
|
|
||||||
|
|
||||||
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,
|
||||||
|
|||||||
@@ -34,57 +34,63 @@
|
|||||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||||
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
|
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
|
||||||
|
|
||||||
int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
|
int16_t find_nr_ulsch(PHY_VARS_gNB *gNB, uint16_t rnti, int pid, int frame)
|
||||||
|
{
|
||||||
|
|
||||||
uint16_t i;
|
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");
|
for (int i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) {
|
||||||
for (i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) {
|
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[i];
|
||||||
AssertFatal(gNB->ulsch[i]!=NULL,"gNB->ulsch[%d] is null\n",i);
|
AssertFatal(ulsch != NULL, "gNB->ulsch[%d] is null\n", i);
|
||||||
LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i]->harq_mask,gNB->ulsch[i]->rnti,first_free_index);
|
if(!ulsch->active) {
|
||||||
if ((gNB->ulsch[i]->harq_mask >0) &&
|
if (first_free_index == -1)
|
||||||
(gNB->ulsch[i]->rnti==rnti)) return i;
|
first_free_index = i;
|
||||||
else if ((gNB->ulsch[i]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
|
}
|
||||||
|
else {
|
||||||
|
// if there is already an active ULSCH for this RNTI and HARQ_PID
|
||||||
|
if ((ulsch->harq_pid == pid) && (ulsch->rnti == rnti))
|
||||||
|
return i;
|
||||||
|
// remove inactive ULSCH (from disconnected UEs)
|
||||||
|
else if ((frame > (ulsch->harq_process->frame + NUMBER_FRAMES_PHY_UE_INACTIVE) % 1024))
|
||||||
|
ulsch->active = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (type == SEARCH_EXIST) return -1;
|
|
||||||
if (first_free_index != -1)
|
|
||||||
gNB->ulsch[first_free_index]->rnti = 0;
|
|
||||||
return first_free_index;
|
return first_free_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_fill_ulsch(PHY_VARS_gNB *gNB,
|
void nr_fill_ulsch(PHY_VARS_gNB *gNB,
|
||||||
int frame,
|
int frame,
|
||||||
int slot,
|
int slot,
|
||||||
nfapi_nr_pusch_pdu_t *ulsch_pdu) {
|
nfapi_nr_pusch_pdu_t *ulsch_pdu)
|
||||||
|
{
|
||||||
|
|
||||||
int ulsch_id = find_nr_ulsch(ulsch_pdu->rnti,gNB,SEARCH_EXIST_OR_FREE);
|
int harq_pid = ulsch_pdu->pusch_data.harq_process_id;
|
||||||
|
int ulsch_id = find_nr_ulsch(gNB, ulsch_pdu->rnti, harq_pid, frame);
|
||||||
AssertFatal((ulsch_id >= 0) && (ulsch_id < NUMBER_OF_NR_ULSCH_MAX),
|
AssertFatal((ulsch_id >= 0) && (ulsch_id < NUMBER_OF_NR_ULSCH_MAX),
|
||||||
"illegal or no ulsch_id found!!! rnti %04x ulsch_id %d\n",ulsch_pdu->rnti,ulsch_id);
|
"illegal or no ulsch_id found!!! rnti %04x ulsch_id %d\n",ulsch_pdu->rnti,ulsch_id);
|
||||||
|
|
||||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id];
|
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id];
|
||||||
int harq_pid = ulsch_pdu->pusch_data.harq_process_id;
|
|
||||||
ulsch->rnti = ulsch_pdu->rnti;
|
|
||||||
//ulsch->rnti_type;
|
|
||||||
ulsch->harq_mask |= 1<<harq_pid;
|
|
||||||
|
|
||||||
NR_UL_gNB_HARQ_t *harq = ulsch->harq_processes[harq_pid];
|
ulsch->rnti = ulsch_pdu->rnti;
|
||||||
harq->frame=frame;
|
ulsch->harq_pid = harq_pid;
|
||||||
harq->slot=slot;
|
ulsch->handled = 0;
|
||||||
harq->handled = 0;
|
ulsch->active = true;
|
||||||
harq->status= NR_ACTIVE;
|
|
||||||
|
NR_UL_gNB_HARQ_t *harq = ulsch->harq_process;
|
||||||
|
harq->frame = frame;
|
||||||
|
harq->slot = slot;
|
||||||
harq->new_rx = ulsch_pdu->pusch_data.new_data_indicator;
|
harq->new_rx = ulsch_pdu->pusch_data.new_data_indicator;
|
||||||
LOG_D(PHY,"ULSCH ID %d RNTI %x HARQ PID %d new data indicator %d\n",ulsch_id, ulsch_pdu->rnti, harq_pid, ulsch_pdu->pusch_data.new_data_indicator);
|
LOG_D(PHY,"%d.%d ULSCH ID %d RNTI %x HARQ PID %d new data indicator %d\n",
|
||||||
|
frame, slot, ulsch_id, 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
|
||||||
harq->round++;
|
harq->round++;
|
||||||
|
|
||||||
memcpy((void*)&ulsch->harq_processes[harq_pid]->ulsch_pdu, (void*)ulsch_pdu, sizeof(nfapi_nr_pusch_pdu_t));
|
memcpy((void*)&ulsch->harq_process->ulsch_pdu, (void*)ulsch_pdu, sizeof(nfapi_nr_pusch_pdu_t));
|
||||||
|
|
||||||
LOG_D(PHY,"Initializing nFAPI for ULSCH, UE %d, harq_pid %d\n",ulsch_id,harq_pid);
|
|
||||||
|
|
||||||
|
LOG_D(PHY,"Initializing nFAPI for ULSCH, UE %d, harq_pid %d\n", ulsch_id, harq_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n_RNTI)
|
void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n_RNTI)
|
||||||
@@ -93,10 +99,10 @@ void nr_ulsch_unscrambling(int16_t* llr, uint32_t size, uint32_t Nid, uint32_t n
|
|||||||
}
|
}
|
||||||
|
|
||||||
void nr_ulsch_layer_demapping(int16_t *llr_cw,
|
void nr_ulsch_layer_demapping(int16_t *llr_cw,
|
||||||
uint8_t Nl,
|
uint8_t Nl,
|
||||||
uint8_t mod_order,
|
uint8_t mod_order,
|
||||||
uint32_t length,
|
uint32_t length,
|
||||||
int16_t **llr_layers)
|
int16_t **llr_layers)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (Nl) {
|
switch (Nl) {
|
||||||
@@ -115,63 +121,51 @@ void nr_ulsch_layer_demapping(int16_t *llr_cw,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
AssertFatal(0, "Not supported number of layers %d\n", Nl);
|
AssertFatal(0, "Not supported number of layers %d\n", Nl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 < NUMBER_OF_NR_SCH_STATS_MAX;i++) {
|
for (int i = 0;i < MAX_MOBILES_PER_GNB; i++) {
|
||||||
|
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
|
||||||
if (gNB->ulsch_stats[i].rnti>0 && gNB->ulsch_stats[i].frame != gNB->ulsch_stats[i].dump_frame) {
|
if (stats->active && stats->frame != stats->ulsch_stats.dump_frame) {
|
||||||
gNB->ulsch_stats[i].dump_frame = gNB->ulsch_stats[i].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) fprintf(fd,"ULSCH RNTI %4x, %d.%d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d, sync_pos %d\n",
|
if (aa==0)
|
||||||
gNB->ulsch_stats[i].rnti,gNB->ulsch_stats[i].frame,gNB->ulsch_stats[i].dump_frame,
|
fprintf(fd,"ULSCH RNTI %4x, %d: ulsch_power[%d] %d,%d ulsch_noise_power[%d] %d.%d, sync_pos %d\n",
|
||||||
aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10,
|
stats->rnti, stats->frame,
|
||||||
aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10,
|
aa, stats->ulsch_stats.power[aa]/10, stats->ulsch_stats.power[aa]%10,
|
||||||
gNB->ulsch_stats[i].sync_pos);
|
aa, stats->ulsch_stats.noise_power[aa]/10, stats->ulsch_stats.noise_power[aa]%10,
|
||||||
else fprintf(fd," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n",
|
stats->ulsch_stats.sync_pos);
|
||||||
aa,gNB->ulsch_stats[i].power[aa]/10,gNB->ulsch_stats[i].power[aa]%10,
|
else
|
||||||
aa,gNB->ulsch_stats[i].noise_power[aa]/10,gNB->ulsch_stats[i].noise_power[aa]%10);
|
fprintf(fd," ulsch_power[%d] %d.%d, ulsch_noise_power[%d] %d.%d\n",
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
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",
|
||||||
gNB->ulsch_stats[i].round_trials[0],
|
stats->ulsch_stats.round_trials[0],
|
||||||
(double)gNB->ulsch_stats[i].round_trials[1]/gNB->ulsch_stats[i].round_trials[0],
|
(double)stats->ulsch_stats.round_trials[1]/stats->ulsch_stats.round_trials[0],
|
||||||
gNB->ulsch_stats[i].round_trials[1],
|
stats->ulsch_stats.round_trials[1],
|
||||||
(double)gNB->ulsch_stats[i].round_trials[2]/gNB->ulsch_stats[i].round_trials[0],
|
(double)stats->ulsch_stats.round_trials[2]/stats->ulsch_stats.round_trials[0],
|
||||||
gNB->ulsch_stats[i].round_trials[2],
|
stats->ulsch_stats.round_trials[2],
|
||||||
(double)gNB->ulsch_stats[i].round_trials[3]/gNB->ulsch_stats[i].round_trials[0],
|
(double)stats->ulsch_stats.round_trials[3]/stats->ulsch_stats.round_trials[0],
|
||||||
gNB->ulsch_stats[i].round_trials[3],
|
stats->ulsch_stats.round_trials[3],
|
||||||
gNB->ulsch_stats[i].DTX,
|
stats->ulsch_stats.DTX,
|
||||||
gNB->ulsch_stats[i].current_Qm,
|
stats->ulsch_stats.current_Qm,
|
||||||
gNB->ulsch_stats[i].current_RI,
|
stats->ulsch_stats.current_RI,
|
||||||
gNB->ulsch_stats[i].total_bytes_rx,
|
stats->ulsch_stats.total_bytes_rx,
|
||||||
gNB->ulsch_stats[i].total_bytes_tx);
|
stats->ulsch_stats.total_bytes_tx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_pusch_stats(PHY_VARS_gNB *gNB) {
|
void clear_pusch_stats(PHY_VARS_gNB *gNB)
|
||||||
|
{
|
||||||
for (int i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++)
|
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++)
|
||||||
memset((void*)&gNB->ulsch_stats[i],0,sizeof(gNB->ulsch_stats[i]));
|
memset((void*)&gNB->phy_stats[i].ulsch_stats,0,sizeof(gNB->phy_stats[i].ulsch_stats));
|
||||||
}
|
}
|
||||||
|
|
||||||
NR_gNB_SCH_STATS_t *get_ulsch_stats(PHY_VARS_gNB *gNB,NR_gNB_ULSCH_t *ulsch) {
|
|
||||||
NR_gNB_SCH_STATS_t *stats=NULL;
|
|
||||||
int first_free=-1;
|
|
||||||
for (int i = 0; i < NUMBER_OF_NR_ULSCH_MAX; i++) {
|
|
||||||
if (gNB->ulsch_stats[i].rnti == 0 && first_free == -1) {
|
|
||||||
first_free = i;
|
|
||||||
stats=&gNB->ulsch_stats[i];
|
|
||||||
}
|
|
||||||
if (gNB->ulsch_stats[i].rnti == ulsch->rnti) {
|
|
||||||
stats=&gNB->ulsch_stats[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(stats);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB,
|
|||||||
int slot_rx,
|
int slot_rx,
|
||||||
int UE_id,
|
int UE_id,
|
||||||
uint8_t harq_pid);
|
uint8_t harq_pid);
|
||||||
int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
|
|
||||||
|
int16_t find_nr_ulsch(PHY_VARS_gNB *gNB, uint16_t rnti, int pid, int frame);
|
||||||
|
|
||||||
void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB);
|
void dump_pusch_stats(FILE *fd,PHY_VARS_gNB *gNB);
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "PHY/CODING/lte_interleaver_inline.h"
|
#include "PHY/CODING/lte_interleaver_inline.h"
|
||||||
#include "PHY/CODING/nrLDPC_extern.h"
|
#include "PHY/CODING/nrLDPC_extern.h"
|
||||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||||
|
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||||
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
|
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
|
||||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||||
#include "SCHED_NR/sched_nr.h"
|
#include "SCHED_NR/sched_nr.h"
|
||||||
@@ -65,21 +66,19 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL)
|
|||||||
a_segments = a_segments/273 +1;
|
a_segments = a_segments/273 +1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
|
if (ulsch->harq_process) {
|
||||||
if (ulsch->harq_processes[i]) {
|
if (ulsch->harq_process->b) {
|
||||||
if (ulsch->harq_processes[i]->b) {
|
free_and_zero(ulsch->harq_process->b);
|
||||||
free_and_zero(ulsch->harq_processes[i]->b);
|
ulsch->harq_process->b = NULL;
|
||||||
ulsch->harq_processes[i]->b = NULL;
|
|
||||||
}
|
|
||||||
for (int r=0; r<a_segments; r++) {
|
|
||||||
free_and_zero(ulsch->harq_processes[i]->c[r]);
|
|
||||||
free_and_zero(ulsch->harq_processes[i]->d[r]);
|
|
||||||
}
|
|
||||||
free_and_zero(ulsch->harq_processes[i]->c);
|
|
||||||
free_and_zero(ulsch->harq_processes[i]->d);
|
|
||||||
free_and_zero(ulsch->harq_processes[i]);
|
|
||||||
ulsch->harq_processes[i] = NULL;
|
|
||||||
}
|
}
|
||||||
|
for (int r = 0; r < a_segments; r++) {
|
||||||
|
free_and_zero(ulsch->harq_process->c[r]);
|
||||||
|
free_and_zero(ulsch->harq_process->d[r]);
|
||||||
|
}
|
||||||
|
free_and_zero(ulsch->harq_process->c);
|
||||||
|
free_and_zero(ulsch->harq_process->d);
|
||||||
|
free_and_zero(ulsch->harq_process);
|
||||||
|
ulsch->harq_process = NULL;
|
||||||
}
|
}
|
||||||
free_and_zero(*ulschptr);
|
free_and_zero(*ulschptr);
|
||||||
}
|
}
|
||||||
@@ -88,8 +87,6 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, 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)
|
||||||
{
|
{
|
||||||
|
|
||||||
NR_gNB_ULSCH_t *ulsch;
|
|
||||||
uint8_t i,r;
|
|
||||||
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated
|
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*NR_MAX_NB_LAYERS; //number of segments to be allocated
|
||||||
|
|
||||||
if (N_RB_UL != 273) {
|
if (N_RB_UL != 273) {
|
||||||
@@ -97,70 +94,31 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
|
|||||||
a_segments = a_segments/273 +1;
|
a_segments = a_segments/273 +1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment
|
uint32_t ulsch_bytes = a_segments * 1056; // allocated bytes per segment
|
||||||
ulsch = (NR_gNB_ULSCH_t *)malloc16_clear(sizeof(NR_gNB_ULSCH_t));
|
NR_gNB_ULSCH_t *ulsch = (NR_gNB_ULSCH_t *)malloc16_clear(sizeof(NR_gNB_ULSCH_t));
|
||||||
|
|
||||||
ulsch->max_ldpc_iterations = max_ldpc_iterations;
|
ulsch->max_ldpc_iterations = max_ldpc_iterations;
|
||||||
|
ulsch->harq_pid = -1;
|
||||||
|
ulsch->active = false;
|
||||||
|
|
||||||
for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
|
ulsch->harq_process = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t));
|
||||||
ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t));
|
ulsch->harq_process->b = (uint8_t*)malloc16_clear(ulsch_bytes);
|
||||||
ulsch->harq_processes[i]->b = (uint8_t*)malloc16_clear(ulsch_bytes);
|
ulsch->harq_process->c = (uint8_t**)malloc16_clear(a_segments*sizeof(uint8_t *));
|
||||||
ulsch->harq_processes[i]->c = (uint8_t**)malloc16_clear(a_segments*sizeof(uint8_t *));
|
ulsch->harq_process->d = (int16_t**)malloc16_clear(a_segments*sizeof(int16_t *));
|
||||||
ulsch->harq_processes[i]->d = (int16_t**)malloc16_clear(a_segments*sizeof(int16_t *));
|
for (int r = 0; r < a_segments; r++) {
|
||||||
for (r=0; r<a_segments; r++) {
|
ulsch->harq_process->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
|
||||||
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
|
ulsch->harq_process->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t));
|
||||||
ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(ulsch);
|
return(ulsch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
if (ulsch) {
|
|
||||||
ulsch->harq_mask = 0;
|
|
||||||
ulsch->rnti = 0;
|
|
||||||
ulsch->rnti_type = 0;
|
|
||||||
ulsch->max_ldpc_iterations = 0;
|
|
||||||
ulsch->last_iteration_cnt = 0;
|
|
||||||
|
|
||||||
for (int i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
|
|
||||||
if (ulsch->harq_processes[i]){
|
|
||||||
/// Nfapi ULSCH PDU
|
|
||||||
//nfapi_nr_ul_config_ulsch_pdu ulsch_pdu;
|
|
||||||
ulsch->harq_processes[i]->frame=0;
|
|
||||||
ulsch->harq_processes[i]->slot=0;
|
|
||||||
ulsch->harq_processes[i]->round=0;
|
|
||||||
ulsch->harq_processes[i]->status=NR_SCH_IDLE;
|
|
||||||
ulsch->harq_processes[i]->handled=0;
|
|
||||||
ulsch->harq_processes[i]->TBS=0;
|
|
||||||
/// Pointer to the payload (38.212 V15.4.0 section 5.1)
|
|
||||||
//uint8_t *b;
|
|
||||||
ulsch->harq_processes[i]->B=0;
|
|
||||||
/// Pointers to code blocks after code block segmentation and CRC attachment (38.212 V15.4.0 section 5.2.2)
|
|
||||||
//uint8_t *c[MAX_NUM_NR_ULSCH_SEGMENTS];
|
|
||||||
ulsch->harq_processes[i]->K=0;
|
|
||||||
ulsch->harq_processes[i]->F=0;
|
|
||||||
ulsch->harq_processes[i]->C=0;
|
|
||||||
/// Pointers to code blocks after LDPC coding (38.212 V15.4.0 section 5.3.2)
|
|
||||||
//int16_t *d[MAX_NUM_NR_ULSCH_SEGMENTS];
|
|
||||||
ulsch->harq_processes[i]->Z=0;
|
|
||||||
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
|
|
||||||
//int16_t e[MAX_NUM_NR_ULSCH_SEGMENTS][3*8448];
|
|
||||||
ulsch->harq_processes[i]->E=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PRINT_CRC_CHECK
|
#ifdef PRINT_CRC_CHECK
|
||||||
static uint32_t prnt_crc_cnt = 0;
|
static uint32_t prnt_crc_cnt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void nr_processULSegment(void* arg) {
|
void nr_processULSegment(void* arg)
|
||||||
|
{
|
||||||
|
|
||||||
ldpcDecode_t *rdata = (ldpcDecode_t*) arg;
|
ldpcDecode_t *rdata = (ldpcDecode_t*) arg;
|
||||||
PHY_VARS_gNB *phy_vars_gNB = rdata->gNB;
|
PHY_VARS_gNB *phy_vars_gNB = rdata->gNB;
|
||||||
NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
|
NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
|
||||||
@@ -325,14 +283,14 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
uint8_t harq_pid,
|
uint8_t harq_pid,
|
||||||
uint32_t G)
|
uint32_t G)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef PRINT_CRC_CHECK
|
#ifdef PRINT_CRC_CHECK
|
||||||
prnt_crc_cnt++;
|
prnt_crc_cnt++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id];
|
NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[ULSCH_id];
|
||||||
NR_gNB_PUSCH *pusch = phy_vars_gNB->pusch_vars[ULSCH_id];
|
NR_gNB_PUSCH *pusch = phy_vars_gNB->pusch_vars[ULSCH_id];
|
||||||
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
|
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process;
|
||||||
|
|
||||||
if (!harq_process) {
|
if (!harq_process) {
|
||||||
LOG_E(PHY,"ulsch_decoding.c: NULL harq_process pointer\n");
|
LOG_E(PHY,"ulsch_decoding.c: NULL harq_process pointer\n");
|
||||||
@@ -379,30 +337,18 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
kc = 68;
|
kc = 68;
|
||||||
}
|
}
|
||||||
|
|
||||||
NR_gNB_SCH_STATS_t *stats=NULL;
|
NR_gNB_PHY_STATS_t *stats = get_phy_stats(phy_vars_gNB, ulsch->rnti);
|
||||||
int first_free=-1;
|
|
||||||
for (int i=0;i<NUMBER_OF_NR_SCH_STATS_MAX;i++) {
|
|
||||||
if (phy_vars_gNB->ulsch_stats[i].rnti == 0 && first_free == -1) {
|
|
||||||
first_free = i;
|
|
||||||
stats=&phy_vars_gNB->ulsch_stats[i];
|
|
||||||
}
|
|
||||||
if (phy_vars_gNB->ulsch_stats[i].rnti == ulsch->rnti) {
|
|
||||||
stats=&phy_vars_gNB->ulsch_stats[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (stats) {
|
if (stats) {
|
||||||
stats->frame = frame;
|
stats->frame = frame;
|
||||||
stats->rnti = ulsch->rnti;
|
stats->ulsch_stats.round_trials[harq_process->round]++;
|
||||||
stats->round_trials[harq_process->round]++;
|
for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
|
||||||
for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) {
|
stats->ulsch_stats.power[aarx] = dB_fixed_x10(pusch->ulsch_power[aarx]);
|
||||||
stats->power[aarx] = dB_fixed_x10(pusch->ulsch_power[aarx]);
|
stats->ulsch_stats.noise_power[aarx] = dB_fixed_x10(pusch->ulsch_noise_power[aarx]);
|
||||||
stats->noise_power[aarx] = dB_fixed_x10(pusch->ulsch_noise_power[aarx]);
|
|
||||||
}
|
}
|
||||||
if (harq_process->new_rx == 0) {
|
if (harq_process->new_rx == 0) {
|
||||||
stats->current_Qm = Qm;
|
stats->ulsch_stats.current_Qm = Qm;
|
||||||
stats->current_RI = n_layers;
|
stats->ulsch_stats.current_RI = n_layers;
|
||||||
stats->total_bytes_tx += harq_process->TBS;
|
stats->ulsch_stats.total_bytes_tx += harq_process->TBS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (A > 3824)
|
if (A > 3824)
|
||||||
@@ -594,9 +540,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
|
|
||||||
if (harq_process->processedSegments == (harq_process->C)) {
|
if (harq_process->processedSegments == (harq_process->C)) {
|
||||||
LOG_D(PHY, "[gNB %d] ULSCH: Setting ACK for slot %d TBS %d\n", phy_vars_gNB->Mod_id, harq_process->slot, harq_process->TBS);
|
LOG_D(PHY, "[gNB %d] ULSCH: Setting ACK for slot %d TBS %d\n", phy_vars_gNB->Mod_id, harq_process->slot, harq_process->TBS);
|
||||||
harq_process->status = NR_SCH_IDLE;
|
ulsch->active = false;
|
||||||
harq_process->round = 0;
|
harq_process->round = 0;
|
||||||
ulsch->harq_mask &= ~(1 << harq_pid);
|
|
||||||
|
|
||||||
LOG_D(PHY, "ULSCH received ok \n");
|
LOG_D(PHY, "ULSCH received ok \n");
|
||||||
nr_fill_indication(phy_vars_gNB, harq_process->frame, harq_process->slot, ULSCH_id, harq_pid, 0, 0);
|
nr_fill_indication(phy_vars_gNB, harq_process->frame, harq_process->slot, ULSCH_id, harq_pid, 0, 0);
|
||||||
@@ -608,10 +553,10 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
harq_process->frame,
|
harq_process->frame,
|
||||||
harq_process->slot,
|
harq_process->slot,
|
||||||
harq_pid,
|
harq_pid,
|
||||||
harq_process->status,
|
ulsch->active,
|
||||||
harq_process->round,
|
harq_process->round,
|
||||||
harq_process->TBS);
|
harq_process->TBS);
|
||||||
harq_process->handled = 1;
|
ulsch->handled = 1;
|
||||||
no_iteration_ldpc = ulsch->max_ldpc_iterations + 1;
|
no_iteration_ldpc = ulsch->max_ldpc_iterations + 1;
|
||||||
LOG_D(PHY, "ULSCH %d in error\n", ULSCH_id);
|
LOG_D(PHY, "ULSCH %d in error\n", ULSCH_id);
|
||||||
nr_fill_indication(phy_vars_gNB, harq_process->frame, harq_process->slot, ULSCH_id, harq_pid, 1, 0);
|
nr_fill_indication(phy_vars_gNB, harq_process->frame, harq_process->slot, ULSCH_id, harq_pid, 1, 0);
|
||||||
|
|||||||
@@ -1847,7 +1847,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
|
|||||||
int avgs = 0;
|
int avgs = 0;
|
||||||
|
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||||
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id]->harq_processes[harq_pid]->ulsch_pdu;
|
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id]->harq_process->ulsch_pdu;
|
||||||
int avg[frame_parms->nb_antennas_rx*rel15_ul->nrOfLayers];
|
int avg[frame_parms->nb_antennas_rx*rel15_ul->nrOfLayers];
|
||||||
|
|
||||||
gNB->pusch_vars[ulsch_id]->dmrs_symbol = INVALID_VALUE;
|
gNB->pusch_vars[ulsch_id]->dmrs_symbol = INVALID_VALUE;
|
||||||
|
|||||||
@@ -44,22 +44,23 @@
|
|||||||
#include "PHY/NR_UE_TRANSPORT/pucch_nr.h"
|
#include "PHY/NR_UE_TRANSPORT/pucch_nr.h"
|
||||||
#include <openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h>
|
#include <openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h>
|
||||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||||
|
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||||
#include "PHY/NR_REFSIG/nr_refsig.h"
|
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||||
#include "nfapi/oai_integration/vendor_ext.h"
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
|
|
||||||
#include "nfapi/oai_integration/vendor_ext.h"
|
#include "nfapi/oai_integration/vendor_ext.h"
|
||||||
|
|
||||||
#include "T.h"
|
#include "T.h"
|
||||||
|
|
||||||
//#define DEBUG_NR_PUCCH_RX 1
|
//#define DEBUG_NR_PUCCH_RX 1
|
||||||
|
|
||||||
NR_gNB_PUCCH_t *new_gNB_pucch(void){
|
NR_gNB_PUCCH_t *new_gNB_pucch(void)
|
||||||
NR_gNB_PUCCH_t *pucch;
|
{
|
||||||
pucch = (NR_gNB_PUCCH_t *)malloc16(sizeof(NR_gNB_PUCCH_t));
|
NR_gNB_PUCCH_t *pucch;
|
||||||
pucch->active = 0;
|
pucch = (NR_gNB_PUCCH_t *)malloc16(sizeof(NR_gNB_PUCCH_t));
|
||||||
return (pucch);
|
pucch->active = 0;
|
||||||
|
return (pucch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_gNB_pucch(NR_gNB_PUCCH_t *pucch)
|
void free_gNB_pucch(NR_gNB_PUCCH_t *pucch)
|
||||||
@@ -67,32 +68,6 @@ void free_gNB_pucch(NR_gNB_PUCCH_t *pucch)
|
|||||||
free_and_zero(pucch);
|
free_and_zero(pucch);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nr_find_pucch(uint16_t rnti,
|
|
||||||
int frame,
|
|
||||||
int slot,
|
|
||||||
PHY_VARS_gNB *gNB)
|
|
||||||
{
|
|
||||||
|
|
||||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
|
||||||
int index = -1;
|
|
||||||
|
|
||||||
for (int i = 0; i < gNB->max_nb_pucch; i++) {
|
|
||||||
AssertFatal(gNB->pucch[i] != NULL,"gNB->pucch[%d] is null\n",i);
|
|
||||||
if ((gNB->pucch[i]->active > 0) &&
|
|
||||||
(gNB->pucch[i]->pucch_pdu.rnti == rnti) &&
|
|
||||||
(gNB->pucch[i]->frame == frame) &&
|
|
||||||
(gNB->pucch[i]->slot == slot))
|
|
||||||
return i;
|
|
||||||
else if ((gNB->pucch[i]->active == 0) && (index == -1))
|
|
||||||
index = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (index==-1)
|
|
||||||
LOG_E(MAC,"PUCCH list is full\n");
|
|
||||||
|
|
||||||
return(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
||||||
int frame,
|
int frame,
|
||||||
int slot,
|
int slot,
|
||||||
@@ -101,18 +76,22 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
|||||||
|
|
||||||
if (NFAPI_MODE == NFAPI_MODE_PNF)
|
if (NFAPI_MODE == NFAPI_MODE_PNF)
|
||||||
gNB->pucch[0]->active = 0; //check if ture in monolithic mode
|
gNB->pucch[0]->active = 0; //check if ture in monolithic mode
|
||||||
int id = nr_find_pucch(pucch_pdu->rnti,frame,slot,gNB);
|
|
||||||
AssertFatal((id >= 0) && (id < gNB->max_nb_pucch),
|
|
||||||
"invalid id found for pucch !!! rnti %04x id %d\n",pucch_pdu->rnti,id);
|
|
||||||
|
|
||||||
NR_gNB_PUCCH_t *pucch = gNB->pucch[id];
|
bool found = false;
|
||||||
pucch->frame = frame;
|
for (int i = 0; i < gNB->max_nb_pucch; i++) {
|
||||||
pucch->slot = slot;
|
if (gNB->pucch[i]->active == 0) {
|
||||||
pucch->active = 1;
|
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
||||||
if (pucch->pucch_pdu.format_type > 0)
|
pucch->frame = frame;
|
||||||
LOG_D(PHY,"Programming PUCCH[%d] for %d.%d, format %d, nb_harq %d, nb_sr %d, nb_csi %d\n",id,
|
pucch->slot = slot;
|
||||||
pucch->frame,pucch->slot,pucch->pucch_pdu.format_type,pucch->pucch_pdu.bit_len_harq,pucch->pucch_pdu.sr_flag,pucch->pucch_pdu.bit_len_csi_part1);
|
pucch->active = 1;
|
||||||
memcpy((void*)&pucch->pucch_pdu, (void*)pucch_pdu, sizeof(nfapi_nr_pucch_pdu_t));
|
memcpy((void*)&pucch->pucch_pdu, (void*)pucch_pdu, sizeof(nfapi_nr_pucch_pdu_t));
|
||||||
|
LOG_D(PHY,"Programming PUCCH[%d] for %d.%d, format %d, nb_harq %d, nb_sr %d, nb_csi %d\n",
|
||||||
|
i, pucch->frame, pucch->slot, pucch->pucch_pdu.format_type, pucch->pucch_pdu.bit_len_harq, pucch->pucch_pdu.sr_flag, pucch->pucch_pdu.bit_len_csi_part1);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AssertFatal(found, "PUCCH list is full\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -176,38 +155,28 @@ int16_t idft12_im[12][12] = {
|
|||||||
{0,-11585,-20066,-23170,-20066,-11585,0,11585,20066,23170,20066,11585}
|
{0,-11585,-20066,-23170,-20066,-11585,0,11585,20066,23170,20066,11585}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||||
int frame,
|
int frame,
|
||||||
int slot,
|
int slot,
|
||||||
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)
|
||||||
|
{
|
||||||
|
|
||||||
c16_t **rxdataF = gNB->common_vars.rxdataF;
|
c16_t **rxdataF = gNB->common_vars.rxdataF;
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||||
int soffset=(slot&3)*frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size;
|
int soffset = (slot & 3) * frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size;
|
||||||
int nr_sequences;
|
|
||||||
const uint8_t *mcs;
|
|
||||||
|
|
||||||
pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1);
|
|
||||||
|
|
||||||
AssertFatal(pucch_pdu->bit_len_harq > 0 || pucch_pdu->sr_flag > 0,
|
AssertFatal(pucch_pdu->bit_len_harq > 0 || pucch_pdu->sr_flag > 0,
|
||||||
"Either bit_len_harq (%d) or sr_flag (%d) must be > 0\n",
|
"Either bit_len_harq (%d) or sr_flag (%d) must be > 0\n",
|
||||||
pucch_pdu->bit_len_harq,pucch_pdu->sr_flag);
|
pucch_pdu->bit_len_harq,pucch_pdu->sr_flag);
|
||||||
|
|
||||||
NR_gNB_UCI_STATS_t *uci_stats=NULL;
|
NR_gNB_PHY_STATS_t *phy_stats = get_phy_stats(gNB, pucch_pdu->rnti);
|
||||||
NR_gNB_UCI_STATS_t *first_uci_stats = gNB->uci_stats;
|
AssertFatal(phy_stats != NULL,"No stat index found\n");
|
||||||
for (int i=0;i<NUMBER_OF_NR_UCI_STATS_MAX;i++)
|
phy_stats->frame = frame;
|
||||||
if (gNB->uci_stats[i].rnti == pucch_pdu->rnti) {
|
NR_gNB_UCI_STATS_t *uci_stats = &phy_stats->uci_stats;
|
||||||
uci_stats = &gNB->uci_stats[i];
|
|
||||||
break;
|
|
||||||
} else if (first_uci_stats == NULL && gNB->uci_stats[i].rnti == 0) first_uci_stats = &gNB->uci_stats[i];
|
|
||||||
|
|
||||||
if (uci_stats == NULL) { uci_stats=first_uci_stats; uci_stats->rnti = pucch_pdu->rnti;}
|
|
||||||
|
|
||||||
AssertFatal(uci_stats!=NULL,"No stat index found\n");
|
|
||||||
uci_stats->frame = frame;
|
|
||||||
|
|
||||||
|
int nr_sequences;
|
||||||
|
const uint8_t *mcs;
|
||||||
if(pucch_pdu->bit_len_harq==0){
|
if(pucch_pdu->bit_len_harq==0){
|
||||||
mcs=table1_mcs;
|
mcs=table1_mcs;
|
||||||
nr_sequences=1;
|
nr_sequences=1;
|
||||||
@@ -258,20 +227,18 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|||||||
int n,i;
|
int n,i;
|
||||||
int prb_offset[2] = {pucch_pdu->bwp_start+pucch_pdu->prb_start, pucch_pdu->bwp_start+pucch_pdu->prb_start};
|
int prb_offset[2] = {pucch_pdu->bwp_start+pucch_pdu->prb_start, pucch_pdu->bwp_start+pucch_pdu->prb_start};
|
||||||
|
|
||||||
nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,0,slot,&u[0],&v[0]); // calculating u and v value first hop
|
pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag << 1);
|
||||||
|
nr_group_sequence_hopping(pucch_GroupHopping, pucch_pdu->hopping_id, 0, slot, &u[0], &v[0]); // calculating u and v value first hop
|
||||||
LOG_D(PHY,"pucch0: u %d, v %d\n",u[0],v[0]);
|
LOG_D(PHY,"pucch0: u %d, v %d\n",u[0],v[0]);
|
||||||
|
|
||||||
|
|
||||||
if (pucch_pdu->freq_hop_flag == 1) {
|
if (pucch_pdu->freq_hop_flag == 1) {
|
||||||
nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,1,slot,&u[1],&v[1]); // calculating u and v value second hop
|
nr_group_sequence_hopping(pucch_GroupHopping, pucch_pdu->hopping_id, 1, slot, &u[1], &v[1]); // calculating u and v value second hop
|
||||||
LOG_D(PHY,"pucch0 second hop: u %d, v %d\n",u[1],v[1]);
|
LOG_D(PHY,"pucch0 second hop: u %d, v %d\n",u[1],v[1]);
|
||||||
prb_offset[1] = pucch_pdu->bwp_start+pucch_pdu->second_hop_prb;
|
prb_offset[1] = pucch_pdu->bwp_start + pucch_pdu->second_hop_prb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AssertFatal(pucch_pdu->nr_of_symbols < 3,"nr_of_symbols %d not allowed\n",pucch_pdu->nr_of_symbols);
|
AssertFatal(pucch_pdu->nr_of_symbols < 3,"nr_of_symbols %d not allowed\n",pucch_pdu->nr_of_symbols);
|
||||||
uint32_t re_offset[2]={0};
|
uint32_t re_offset[2] = {0};
|
||||||
uint8_t l2;
|
|
||||||
|
|
||||||
const int16_t *x_re[2],*x_im[2];
|
const int16_t *x_re[2],*x_im[2];
|
||||||
x_re[0] = table_5_2_2_2_2_Re[u[0]];
|
x_re[0] = table_5_2_2_2_2_Re[u[0]];
|
||||||
@@ -288,7 +255,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|||||||
int32_t rp[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][nb_re_pucch],*tmp_rp;
|
int32_t rp[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][nb_re_pucch],*tmp_rp;
|
||||||
|
|
||||||
for (int l=0; l<pucch_pdu->nr_of_symbols; l++) {
|
for (int l=0; l<pucch_pdu->nr_of_symbols; l++) {
|
||||||
l2 = l+pucch_pdu->start_symbol_index;
|
uint8_t l2 = l+pucch_pdu->start_symbol_index;
|
||||||
|
|
||||||
re_offset[l] = (12*prb_offset[l]) + frame_parms->first_carrier_offset;
|
re_offset[l] = (12*prb_offset[l]) + frame_parms->first_carrier_offset;
|
||||||
if (re_offset[l]>= frame_parms->ofdm_symbol_size)
|
if (re_offset[l]>= frame_parms->ofdm_symbol_size)
|
||||||
@@ -454,10 +421,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|||||||
uci_pdu->harq->harq_confidence_level = no_conf;
|
uci_pdu->harq->harq_confidence_level = no_conf;
|
||||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(sizeof *uci_pdu->harq->harq_list);
|
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(sizeof *uci_pdu->harq->harq_list);
|
||||||
uci_pdu->harq->harq_list[0].harq_value = !(index&0x01);
|
uci_pdu->harq->harq_list[0].harq_value = !(index&0x01);
|
||||||
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n",
|
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f\n",
|
||||||
frame,slot,uci_pdu->harq->harq_list[0].harq_value==0?"ACK":"NACK",
|
frame,slot,uci_pdu->harq->harq_list[0].harq_value==0?"ACK":"NACK",
|
||||||
uci_pdu->harq->harq_confidence_level==0?"good":"bad",
|
uci_pdu->harq->harq_confidence_level==0?"good":"bad",
|
||||||
xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos);
|
xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy));
|
||||||
|
|
||||||
if (pucch_pdu->sr_flag == 1) {
|
if (pucch_pdu->sr_flag == 1) {
|
||||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||||
@@ -478,14 +445,13 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|||||||
|
|
||||||
uci_pdu->harq->harq_list[1].harq_value = !(index&0x01);
|
uci_pdu->harq->harq_list[1].harq_value = !(index&0x01);
|
||||||
uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01);
|
uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01);
|
||||||
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n",
|
LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d\n",
|
||||||
frame,slot,
|
frame,slot,
|
||||||
uci_pdu->harq->harq_list[1].harq_value == 0 ? "ACK" : "NACK",
|
uci_pdu->harq->harq_list[1].harq_value == 0 ? "ACK" : "NACK",
|
||||||
uci_pdu->harq->harq_list[0].harq_value == 0 ? "ACK" : "NACK",
|
uci_pdu->harq->harq_list[0].harq_value == 0 ? "ACK" : "NACK",
|
||||||
uci_pdu->harq->harq_confidence_level == 0 ? "good" : "bad",
|
uci_pdu->harq->harq_confidence_level == 0 ? "good" : "bad",
|
||||||
xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,
|
xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,
|
||||||
uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,
|
uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10);
|
||||||
SNRtimes10,gNB->ulsch_stats[0].sync_pos);
|
|
||||||
if (pucch_pdu->sr_flag == 1) {
|
if (pucch_pdu->sr_flag == 1) {
|
||||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||||
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
|
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
|
||||||
@@ -1209,8 +1175,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_D(PHY,"Decoding pucch2 for %d symbols, %d PRB, nb_harq %d, nb_sr %d, nb_csi %d/%d\n",
|
LOG_D(PHY,"%d.%d Decoding pucch2 for %d symbols, %d PRB, nb_harq %d, nb_sr %d, nb_csi %d/%d\n",
|
||||||
pucch_pdu->nr_of_symbols,pucch_pdu->prb_size,
|
frame, slot, pucch_pdu->nr_of_symbols,pucch_pdu->prb_size,
|
||||||
pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,pucch_pdu->bit_len_csi_part1,pucch_pdu->bit_len_csi_part2);
|
pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,pucch_pdu->bit_len_csi_part1,pucch_pdu->bit_len_csi_part2);
|
||||||
|
|
||||||
int nc_group_size=1; // 2 PRB
|
int nc_group_size=1; // 2 PRB
|
||||||
@@ -1790,30 +1756,31 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
|
|||||||
|
|
||||||
void nr_dump_uci_stats(FILE *fd,PHY_VARS_gNB *gNB,int frame) {
|
void nr_dump_uci_stats(FILE *fd,PHY_VARS_gNB *gNB,int frame) {
|
||||||
|
|
||||||
int strpos=0;
|
int strpos=0;
|
||||||
char output[16384];
|
char output[16384];
|
||||||
|
|
||||||
for (int i=0;i<NUMBER_OF_NR_UCI_STATS_MAX;i++){
|
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
|
||||||
if (gNB->uci_stats[i].rnti>0) {
|
NR_gNB_PHY_STATS_t *stats = &gNB->phy_stats[i];
|
||||||
NR_gNB_UCI_STATS_t *uci_stats = &gNB->uci_stats[i];
|
if (stats->active) {
|
||||||
if (uci_stats->pucch0_sr_trials > 0)
|
NR_gNB_UCI_STATS_t *uci_stats = &stats->uci_stats;
|
||||||
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch0_sr_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_sr_thres %d dB, current pucch1_stat0 %d dB, current pucch1_stat1 %d dB, positive SR count %d\n",
|
if (uci_stats->pucch0_sr_trials > 0)
|
||||||
i,uci_stats->rnti,uci_stats->pucch0_sr_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_sr_thres,dB_fixed(uci_stats->current_pucch0_sr_stat0),dB_fixed(uci_stats->current_pucch0_sr_stat1),uci_stats->pucch0_positive_SR);
|
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch0_sr_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_sr_thres %d dB, current pucch1_stat0 %d dB, current pucch1_stat1 %d dB, positive SR count %d\n",
|
||||||
if (uci_stats->pucch01_trials > 0)
|
i,stats->rnti,uci_stats->pucch0_sr_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_sr_thres,dB_fixed(uci_stats->current_pucch0_sr_stat0),dB_fixed(uci_stats->current_pucch0_sr_stat1),uci_stats->pucch0_positive_SR);
|
||||||
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch1_stat1 %d dB, pucch01_DTX %d\n",
|
if (uci_stats->pucch01_trials > 0)
|
||||||
i,uci_stats->rnti,uci_stats->pucch01_trials,uci_stats->pucch0_n01,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch01_DTX);
|
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch1_stat1 %d dB, pucch01_DTX %d\n",
|
||||||
|
i,stats->rnti,uci_stats->pucch01_trials,uci_stats->pucch0_n01,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch01_DTX);
|
||||||
|
|
||||||
if (uci_stats->pucch02_trials > 0)
|
if (uci_stats->pucch02_trials > 0)
|
||||||
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch0_stat1 %d dB, pucch01_DTX %d\n",
|
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch01_trials %d, pucch0_n00 %d dB, pucch0_n01 %d dB, pucch0_thres %d dB, current pucch0_stat0 %d dB, current pucch0_stat1 %d dB, pucch01_DTX %d\n",
|
||||||
i,uci_stats->rnti,uci_stats->pucch02_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch02_DTX);
|
i,stats->rnti,uci_stats->pucch02_trials,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,dB_fixed(uci_stats->current_pucch0_stat0),dB_fixed(uci_stats->current_pucch0_stat1),uci_stats->pucch02_DTX);
|
||||||
|
|
||||||
if (uci_stats->pucch2_trials > 0)
|
if (uci_stats->pucch2_trials > 0)
|
||||||
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch2_trials %d, pucch2_DTX %d\n",
|
strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch2_trials %d, pucch2_DTX %d\n",
|
||||||
i,uci_stats->rnti,
|
i,stats->rnti,
|
||||||
uci_stats->pucch2_trials,
|
uci_stats->pucch2_trials,
|
||||||
uci_stats->pucch2_DTX);
|
uci_stats->pucch2_DTX);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (fd) fprintf(fd,"%s",output);
|
}
|
||||||
else printf("%s",output);
|
if (fd) fprintf(fd,"%s",output);
|
||||||
|
else printf("%s",output);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,43 +56,25 @@ void free_gNB_srs(NR_gNB_SRS_t *srs)
|
|||||||
free_and_zero(srs);
|
free_and_zero(srs);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nr_find_srs(rnti_t rnti,
|
|
||||||
frame_t frame,
|
|
||||||
slot_t slot,
|
|
||||||
PHY_VARS_gNB *gNB) {
|
|
||||||
|
|
||||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
|
||||||
int index = -1;
|
|
||||||
|
|
||||||
for (int i = 0; i < gNB->max_nb_srs; i++) {
|
|
||||||
AssertFatal(gNB->srs[i]!=NULL,"gNB->srs[%d] is null\n",i);
|
|
||||||
if ((gNB->srs[i]->active>0) &&
|
|
||||||
(gNB->srs[i]->srs_pdu.rnti==rnti) &&
|
|
||||||
(gNB->srs[i]->frame==frame) &&
|
|
||||||
(gNB->srs[i]->slot==slot)) return(i);
|
|
||||||
else if ((gNB->srs[i]->active == 0) && (index==-1)) index=i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (index==-1)
|
|
||||||
LOG_E(PHY,"SRS list is full\n");
|
|
||||||
|
|
||||||
return(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
||||||
nfapi_nr_srs_pdu_t *srs_pdu) {
|
nfapi_nr_srs_pdu_t *srs_pdu)
|
||||||
|
{
|
||||||
|
|
||||||
int id = nr_find_srs(srs_pdu->rnti,frame,slot,gNB);
|
bool found = false;
|
||||||
AssertFatal((id >= 0) && (id < gNB->max_nb_srs),
|
for (int i = 0; i < gNB->max_nb_srs; i++) {
|
||||||
"invalid id found for srs !!! rnti %04x id %d\n",srs_pdu->rnti,id);
|
if (gNB->srs[i]->active == 0) {
|
||||||
|
found = true;
|
||||||
NR_gNB_SRS_t *srs = gNB->srs[id];
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AssertFatal(found, "SRS list is full\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int nr_get_srs_signal(PHY_VARS_gNB *gNB,
|
int nr_get_srs_signal(PHY_VARS_gNB *gNB,
|
||||||
|
|||||||
+30
-32
@@ -97,9 +97,7 @@ typedef struct {
|
|||||||
} NR_gNB_CSIRS_t;
|
} NR_gNB_CSIRS_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int frame;
|
|
||||||
int dump_frame;
|
int dump_frame;
|
||||||
uint16_t rnti;
|
|
||||||
int round_trials[8];
|
int round_trials[8];
|
||||||
int total_bytes_tx;
|
int total_bytes_tx;
|
||||||
int total_bytes_rx;
|
int total_bytes_rx;
|
||||||
@@ -112,8 +110,6 @@ typedef struct {
|
|||||||
} NR_gNB_SCH_STATS_t;
|
} NR_gNB_SCH_STATS_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int frame;
|
|
||||||
uint16_t rnti;
|
|
||||||
int pucch0_sr_trials;
|
int pucch0_sr_trials;
|
||||||
int pucch0_sr_thres;
|
int pucch0_sr_thres;
|
||||||
int current_pucch0_sr_stat0;
|
int current_pucch0_sr_stat0;
|
||||||
@@ -132,6 +128,17 @@ typedef struct {
|
|||||||
int pucch2_DTX;
|
int pucch2_DTX;
|
||||||
} NR_gNB_UCI_STATS_t;
|
} NR_gNB_UCI_STATS_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int frame;
|
||||||
|
uint16_t rnti;
|
||||||
|
bool active;
|
||||||
|
/// statistics for DLSCH measurement collection
|
||||||
|
NR_gNB_SCH_STATS_t dlsch_stats;
|
||||||
|
/// statistics for ULSCH measurement collection
|
||||||
|
NR_gNB_SCH_STATS_t ulsch_stats;
|
||||||
|
NR_gNB_UCI_STATS_t uci_stats;
|
||||||
|
} NR_gNB_PHY_STATS_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// Pointers to variables related to DLSCH harq process
|
/// Pointers to variables related to DLSCH harq process
|
||||||
NR_DL_gNB_HARQ_t harq_process;
|
NR_DL_gNB_HARQ_t harq_process;
|
||||||
@@ -141,12 +148,8 @@ typedef struct {
|
|||||||
int32_t **mod_symbs;
|
int32_t **mod_symbs;
|
||||||
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
|
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
|
||||||
int32_t ***ue_spec_bf_weights;
|
int32_t ***ue_spec_bf_weights;
|
||||||
/// Allocated RNTI (0 means DLSCH_t is not currently used)
|
|
||||||
uint16_t rnti;
|
|
||||||
/// Active flag for baseband transmitter processing
|
/// Active flag for baseband transmitter processing
|
||||||
uint8_t active;
|
uint8_t active;
|
||||||
/// HARQ process mask, indicates which processes are currently active
|
|
||||||
uint16_t harq_mask;
|
|
||||||
/// Number of soft channel bits
|
/// Number of soft channel bits
|
||||||
uint32_t G;
|
uint32_t G;
|
||||||
} NR_gNB_DLSCH_t;
|
} NR_gNB_DLSCH_t;
|
||||||
@@ -192,11 +195,7 @@ typedef struct {
|
|||||||
/// Index of current HARQ round for this DLSCH
|
/// Index of current HARQ round for this DLSCH
|
||||||
uint8_t round;
|
uint8_t round;
|
||||||
bool new_rx;
|
bool new_rx;
|
||||||
/// Status Flag indicating for this ULSCH (idle,active,disabled)
|
/////////////////////// ulsch decoding ///////////////////////
|
||||||
NR_SCH_status_t status;
|
|
||||||
/// Flag to indicate that the UL configuration has been handled. Used to remove a stale ULSCH when frame wraps around
|
|
||||||
uint8_t handled;
|
|
||||||
/////////////////////// ulsch decoding ///////////////////////
|
|
||||||
/// Transport block size (This is A from 38.212 V15.4.0 section 5.1)
|
/// Transport block size (This is A from 38.212 V15.4.0 section 5.1)
|
||||||
uint32_t TBS;
|
uint32_t TBS;
|
||||||
/// Pointer to the payload (38.212 V15.4.0 section 5.1)
|
/// Pointer to the payload (38.212 V15.4.0 section 5.1)
|
||||||
@@ -226,19 +225,31 @@ typedef struct {
|
|||||||
} NR_UL_gNB_HARQ_t;
|
} NR_UL_gNB_HARQ_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/// Time shift in number of samples estimated based on DMRS-PUSCH
|
||||||
|
int pusch_est_delay;
|
||||||
|
/// Max position in OFDM symbol related to time shift estimation based on DMRS-PUSCH
|
||||||
|
int pusch_delay_max_pos;
|
||||||
|
/// Max value related to time shift estimation based on DMRS-PUSCH
|
||||||
|
int pusch_delay_max_val;
|
||||||
|
} NR_ULSCH_delay_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/// Pointers to 16 HARQ processes for the ULSCH
|
/// Pointers to 16 HARQ processes for the ULSCH
|
||||||
NR_UL_gNB_HARQ_t *harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES];
|
NR_UL_gNB_HARQ_t *harq_process;
|
||||||
/// HARQ process mask, indicates which processes are currently active
|
/// HARQ process mask, indicates which processes are currently active
|
||||||
uint16_t harq_mask;
|
int harq_pid;
|
||||||
/// Allocated RNTI for this ULSCH
|
/// Allocated RNTI for this ULSCH
|
||||||
uint16_t rnti;
|
uint16_t rnti;
|
||||||
/// RNTI type
|
|
||||||
uint8_t rnti_type;
|
|
||||||
/// Maximum number of LDPC iterations
|
/// Maximum number of LDPC iterations
|
||||||
uint8_t max_ldpc_iterations;
|
uint8_t max_ldpc_iterations;
|
||||||
/// number of iterations used in last LDPC decoding
|
/// number of iterations used in last LDPC decoding
|
||||||
uint8_t last_iteration_cnt;
|
uint8_t last_iteration_cnt;
|
||||||
|
/// Status Flag indicating for this ULSCH
|
||||||
|
bool active;
|
||||||
|
/// Flag to indicate that the UL configuration has been handled. Used to remove a stale ULSCH when frame wraps around
|
||||||
|
uint8_t handled;
|
||||||
|
NR_ULSCH_delay_t delay;
|
||||||
} NR_gNB_ULSCH_t;
|
} NR_gNB_ULSCH_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -546,15 +557,6 @@ typedef struct {
|
|||||||
/// PRACH background noise level
|
/// PRACH background noise level
|
||||||
int prach_I0;
|
int prach_I0;
|
||||||
|
|
||||||
struct delay_s {
|
|
||||||
/// Time shift in number of samples estimated based on DMRS-PUSCH
|
|
||||||
int pusch_est_delay;
|
|
||||||
/// Max position in OFDM symbol related to time shift estimation based on DMRS-PUSCH
|
|
||||||
int pusch_delay_max_pos;
|
|
||||||
/// Max value related to time shift estimation based on DMRS-PUSCH
|
|
||||||
int pusch_delay_max_val;
|
|
||||||
} delay[NUMBER_OF_NR_ULSCH_MAX];
|
|
||||||
|
|
||||||
} PHY_MEASUREMENTS_gNB;
|
} PHY_MEASUREMENTS_gNB;
|
||||||
|
|
||||||
|
|
||||||
@@ -615,11 +617,7 @@ typedef struct PHY_VARS_gNB_s {
|
|||||||
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[NUMBER_OF_NR_ULSCH_MAX]; // [Nusers times]
|
NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX]; // [Nusers times]
|
||||||
/// statistics for DLSCH measurement collection
|
NR_gNB_PHY_STATS_t phy_stats[MAX_MOBILES_PER_GNB];
|
||||||
NR_gNB_SCH_STATS_t dlsch_stats[NUMBER_OF_NR_SCH_STATS_MAX];
|
|
||||||
/// statistics for ULSCH measurement collection
|
|
||||||
NR_gNB_SCH_STATS_t ulsch_stats[NUMBER_OF_NR_SCH_STATS_MAX];
|
|
||||||
NR_gNB_UCI_STATS_t uci_stats[NUMBER_OF_NR_UCI_STATS_MAX];
|
|
||||||
t_nrPolar_params **polarParams;
|
t_nrPolar_params **polarParams;
|
||||||
|
|
||||||
/// SRS variables
|
/// SRS variables
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,int frame,int slot,
|
|||||||
|
|
||||||
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
|
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
|
||||||
int frame,int slot,
|
int frame,int slot,
|
||||||
nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu) {
|
nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu)
|
||||||
|
{
|
||||||
|
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
@@ -127,12 +128,12 @@ void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
|
|||||||
uint8_t *sdu)
|
uint8_t *sdu)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nr_fill_dlsch(msgTx,pdsch_pdu,sdu);
|
nr_fill_dlsch(msgTx,pdsch_pdu,sdu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
|
||||||
|
{
|
||||||
|
|
||||||
PHY_VARS_gNB *gNB;
|
PHY_VARS_gNB *gNB;
|
||||||
// copy data from L2 interface into L1 structures
|
// copy data from L2 interface into L1 structures
|
||||||
@@ -170,9 +171,9 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
|||||||
const time_stats_t ts = exec_time_stats_NotifiedFIFO(res);
|
const time_stats_t ts = exec_time_stats_NotifiedFIFO(res);
|
||||||
merge_meas(&gNB->phy_proc_tx, &ts);
|
merge_meas(&gNB->phy_proc_tx, &ts);
|
||||||
|
|
||||||
msgTx->num_pdsch_slot=0;
|
msgTx->num_pdsch_slot = 0;
|
||||||
msgTx->num_dl_pdcch=0;
|
msgTx->num_dl_pdcch = 0;
|
||||||
msgTx->num_ul_pdcch=number_ul_dci_pdu;
|
msgTx->num_ul_pdcch = number_ul_dci_pdu;
|
||||||
msgTx->slot = slot;
|
msgTx->slot = slot;
|
||||||
msgTx->frame = frame;
|
msgTx->frame = frame;
|
||||||
|
|
||||||
|
|||||||
@@ -207,12 +207,14 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
|||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,0);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
|
void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req)
|
||||||
|
{
|
||||||
|
|
||||||
ldpcDecode_t *rdata = (ldpcDecode_t*) NotifiedFifoData(req);
|
ldpcDecode_t *rdata = (ldpcDecode_t*) NotifiedFifoData(req);
|
||||||
NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
|
NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
|
||||||
NR_gNB_ULSCH_t *ulsch = rdata->ulsch;
|
NR_gNB_ULSCH_t *ulsch = rdata->ulsch;
|
||||||
int r = rdata->segment_r;
|
int r = rdata->segment_r;
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[rdata->ulsch_id]->harq_processes[rdata->harq_pid]->ulsch_pdu;
|
nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[rdata->ulsch_id]->harq_process->ulsch_pdu;
|
||||||
bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter);
|
bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter);
|
||||||
ulsch_harq->processedSegments++;
|
ulsch_harq->processedSegments++;
|
||||||
LOG_D(PHY, "processing result of segment: %d, processed %d/%d\n",
|
LOG_D(PHY, "processing result of segment: %d, processed %d/%d\n",
|
||||||
@@ -241,27 +243,25 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
|
|||||||
// if all segments are done
|
// if all segments are done
|
||||||
if (rdata->nbSegments == ulsch_harq->processedSegments) {
|
if (rdata->nbSegments == ulsch_harq->processedSegments) {
|
||||||
if (decodeSuccess && !gNB->pusch_vars[rdata->ulsch_id]->DTX) {
|
if (decodeSuccess && !gNB->pusch_vars[rdata->ulsch_id]->DTX) {
|
||||||
LOG_D(PHY,"[gNB %d] ULSCH: Setting ACK for SFN/SF %d.%d (pid %d, ndi %d, status %d, round %d, TBS %d, Max interation (all seg) %d)\n",
|
LOG_D(PHY,"[gNB %d] ULSCH: Setting ACK for SFN/SF %d.%d (rnti %x, pid %d, ndi %d, status %d, round %d, TBS %d, Max interation (all seg) %d)\n",
|
||||||
gNB->Mod_id,ulsch_harq->frame,ulsch_harq->slot,rdata->harq_pid,pusch_pdu->pusch_data.new_data_indicator,ulsch_harq->status,ulsch_harq->round,ulsch_harq->TBS,rdata->decodeIterations);
|
gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot, ulsch->rnti, rdata->harq_pid, pusch_pdu->pusch_data.new_data_indicator,
|
||||||
ulsch_harq->status = NR_SCH_IDLE;
|
ulsch->active, ulsch_harq->round, ulsch_harq->TBS, rdata->decodeIterations);
|
||||||
ulsch_harq->round = 0;
|
ulsch->active = false;
|
||||||
ulsch->harq_mask &= ~(1 << rdata->harq_pid);
|
ulsch_harq->round = 0;
|
||||||
|
|
||||||
LOG_D(PHY, "ULSCH received ok \n");
|
LOG_D(PHY, "ULSCH received ok \n");
|
||||||
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0,0);
|
nr_fill_indication(gNB, ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0,0);
|
||||||
//dumpsig=1;
|
//dumpsig=1;
|
||||||
} else {
|
} else {
|
||||||
LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, ndi %d, status %d, round %d, RV %d, prb_start %d, prb_size %d, TBS %d) r %d\n",
|
LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, ndi %d, status %d, round %d, RV %d, prb_start %d, prb_size %d, TBS %d) r %d\n",
|
||||||
gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot,
|
gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot,
|
||||||
rdata->harq_pid, pusch_pdu->pusch_data.new_data_indicator, ulsch_harq->status,
|
rdata->harq_pid, pusch_pdu->pusch_data.new_data_indicator, ulsch->active,
|
||||||
ulsch_harq->round,
|
ulsch_harq->round,
|
||||||
ulsch_harq->ulsch_pdu.pusch_data.rv_index,
|
ulsch_harq->ulsch_pdu.pusch_data.rv_index,
|
||||||
ulsch_harq->ulsch_pdu.rb_start,
|
ulsch_harq->ulsch_pdu.rb_start,
|
||||||
ulsch_harq->ulsch_pdu.rb_size,
|
ulsch_harq->ulsch_pdu.rb_size,
|
||||||
ulsch_harq->TBS,
|
ulsch_harq->TBS,
|
||||||
r);
|
r);
|
||||||
ulsch_harq->handled = 1;
|
ulsch->handled = 1;
|
||||||
|
|
||||||
LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id);
|
LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id);
|
||||||
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 1,0);
|
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 1,0);
|
||||||
// dumpsig=1;
|
// dumpsig=1;
|
||||||
@@ -306,17 +306,17 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
|
|||||||
|
|
||||||
void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH_id, uint8_t harq_pid)
|
void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH_id, uint8_t harq_pid)
|
||||||
{
|
{
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->ulsch_pdu;
|
|
||||||
|
|
||||||
uint8_t l, number_dmrs_symbols = 0;
|
|
||||||
uint32_t G;
|
|
||||||
uint16_t start_symbol, number_symbols, nb_re_dmrs;
|
|
||||||
uint8_t enable_ldpc_offload = gNB->ldpc_offload_flag;
|
|
||||||
start_symbol = pusch_pdu->start_symbol_index;
|
|
||||||
number_symbols = pusch_pdu->nr_of_symbols;
|
|
||||||
|
|
||||||
for (l = start_symbol; l < start_symbol + number_symbols; l++)
|
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||||
|
nfapi_nr_pusch_pdu_t *pusch_pdu = &gNB->ulsch[ULSCH_id]->harq_process->ulsch_pdu;
|
||||||
|
|
||||||
|
uint16_t nb_re_dmrs;
|
||||||
|
uint8_t enable_ldpc_offload = gNB->ldpc_offload_flag;
|
||||||
|
uint16_t start_symbol = pusch_pdu->start_symbol_index;
|
||||||
|
uint16_t number_symbols = pusch_pdu->nr_of_symbols;
|
||||||
|
|
||||||
|
uint8_t number_dmrs_symbols = 0;
|
||||||
|
for (int l = start_symbol; l < start_symbol + number_symbols; l++)
|
||||||
number_dmrs_symbols += ((pusch_pdu->ul_dmrs_symb_pos)>>l)&0x01;
|
number_dmrs_symbols += ((pusch_pdu->ul_dmrs_symb_pos)>>l)&0x01;
|
||||||
|
|
||||||
if (pusch_pdu->dmrs_config_type==pusch_dmrs_type1)
|
if (pusch_pdu->dmrs_config_type==pusch_dmrs_type1)
|
||||||
@@ -324,12 +324,12 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
|||||||
else
|
else
|
||||||
nb_re_dmrs = 4*pusch_pdu->num_dmrs_cdm_grps_no_data;
|
nb_re_dmrs = 4*pusch_pdu->num_dmrs_cdm_grps_no_data;
|
||||||
|
|
||||||
G = nr_get_G(pusch_pdu->rb_size,
|
uint32_t G = nr_get_G(pusch_pdu->rb_size,
|
||||||
number_symbols,
|
number_symbols,
|
||||||
nb_re_dmrs,
|
nb_re_dmrs,
|
||||||
number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs
|
number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs
|
||||||
pusch_pdu->qam_mod_order,
|
pusch_pdu->qam_mod_order,
|
||||||
pusch_pdu->nrOfLayers);
|
pusch_pdu->nrOfLayers);
|
||||||
|
|
||||||
AssertFatal(G>0,"G is 0 : rb_size %u, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %u, nrOfLayer %u\n",
|
AssertFatal(G>0,"G is 0 : rb_size %u, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %u, nrOfLayer %u\n",
|
||||||
pusch_pdu->rb_size,
|
pusch_pdu->rb_size,
|
||||||
@@ -377,7 +377,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
|||||||
slot_rx,
|
slot_rx,
|
||||||
harq_pid,
|
harq_pid,
|
||||||
G);
|
G);
|
||||||
if (enable_ldpc_offload ==0) {
|
if (enable_ldpc_offload == 0) {
|
||||||
while (gNB->nbDecode > 0) {
|
while (gNB->nbDecode > 0) {
|
||||||
notifiedFIFO_elt_t *req = pullTpool(&gNB->respDecode, &gNB->threadPool);
|
notifiedFIFO_elt_t *req = pullTpool(&gNB->respDecode, &gNB->threadPool);
|
||||||
if (req == NULL)
|
if (req == NULL)
|
||||||
@@ -390,18 +390,19 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag, int dtx_flag) {
|
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag, int dtx_flag)
|
||||||
|
{
|
||||||
|
|
||||||
pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
||||||
|
|
||||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id];
|
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id];
|
||||||
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
|
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process;
|
||||||
NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch);
|
NR_gNB_PHY_STATS_t *stats = get_phy_stats(gNB, ulsch->rnti);
|
||||||
|
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu = &harq_process->ulsch_pdu;
|
nfapi_nr_pusch_pdu_t *pusch_pdu = &harq_process->ulsch_pdu;
|
||||||
|
|
||||||
// Get estimated timing advance for MAC
|
// Get estimated timing advance for MAC
|
||||||
int sync_pos = gNB->measurements.delay[ULSCH_id].pusch_est_delay;
|
int sync_pos = ulsch->delay.pusch_est_delay;
|
||||||
|
|
||||||
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
||||||
uint16_t bw_scaling = 16 * gNB->frame_parms.ofdm_symbol_size / 2048;
|
uint16_t bw_scaling = 16 * gNB->frame_parms.ofdm_symbol_size / 2048;
|
||||||
@@ -412,7 +413,7 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
|||||||
sync_pos_rounded = sync_pos + (bw_scaling / 2) - 1;
|
sync_pos_rounded = sync_pos + (bw_scaling / 2) - 1;
|
||||||
else
|
else
|
||||||
sync_pos_rounded = sync_pos - (bw_scaling / 2) + 1;
|
sync_pos_rounded = sync_pos - (bw_scaling / 2) + 1;
|
||||||
if (stats) stats->sync_pos = sync_pos;
|
if (stats) stats->ulsch_stats.sync_pos = sync_pos;
|
||||||
|
|
||||||
int timing_advance_update = sync_pos_rounded / bw_scaling;
|
int timing_advance_update = sync_pos_rounded / bw_scaling;
|
||||||
|
|
||||||
@@ -554,27 +555,21 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
|||||||
for (int ULSCH_id = 0; ULSCH_id < NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) {
|
for (int ULSCH_id = 0; ULSCH_id < NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) {
|
||||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id];
|
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id];
|
||||||
int harq_pid;
|
int harq_pid;
|
||||||
NR_UL_gNB_HARQ_t *ulsch_harq;
|
NR_UL_gNB_HARQ_t *ulsch_harq = ulsch_harq = ulsch->harq_process;
|
||||||
if ((ulsch) &&
|
AssertFatal(ulsch_harq != NULL,"harq_pid %d is not allocated\n",harq_pid);
|
||||||
(ulsch->rnti > 0)) {
|
if ((ulsch->active == true) &&
|
||||||
for (harq_pid=0;harq_pid<NR_MAX_ULSCH_HARQ_PROCESSES;harq_pid++) {
|
(ulsch_harq->frame == frame_rx) &&
|
||||||
ulsch_harq = ulsch->harq_processes[harq_pid];
|
(ulsch_harq->slot == slot_rx) &&
|
||||||
AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid);
|
(ulsch->handled == 0)) {
|
||||||
if ((ulsch_harq->status == NR_ACTIVE) &&
|
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
|
||||||
(ulsch_harq->frame == frame_rx) &&
|
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
|
||||||
(ulsch_harq->slot == slot_rx) &&
|
for (int symbol = symbol_start ; symbol < symbol_end ; symbol++) {
|
||||||
(ulsch_harq->handled == 0)){
|
if(gNB->frame_parms.frame_type == FDD ||
|
||||||
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
|
(gNB->frame_parms.frame_type == TDD && gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx].max_num_of_symbol_per_slot_list[symbol].slot_config.value==1)) {
|
||||||
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
|
LOG_D(PHY,"symbol %d Filling rb_mask_ul rb_size %d\n",symbol,ulsch_harq->ulsch_pdu.rb_size);
|
||||||
for (int symbol=symbol_start ; symbol<symbol_end ; symbol++) {
|
for (rb=0; rb<ulsch_harq->ulsch_pdu.rb_size; rb++) {
|
||||||
if(gNB->frame_parms.frame_type == FDD ||
|
rb2 = rb+ulsch_harq->ulsch_pdu.rb_start+ulsch_harq->ulsch_pdu.bwp_start;
|
||||||
(gNB->frame_parms.frame_type == TDD && gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx].max_num_of_symbol_per_slot_list[symbol].slot_config.value==1)) {
|
gNB->rb_mask_ul[symbol][rb2 >> 5] |= 1U << (rb2 & 31);
|
||||||
LOG_D(PHY,"symbol %d Filling rb_mask_ul rb_size %d\n",symbol,ulsch_harq->ulsch_pdu.rb_size);
|
|
||||||
for (rb=0; rb<ulsch_harq->ulsch_pdu.rb_size; rb++) {
|
|
||||||
rb2 = rb+ulsch_harq->ulsch_pdu.rb_start+ulsch_harq->ulsch_pdu.bwp_start;
|
|
||||||
gNB->rb_mask_ul[symbol][rb2 >> 5] |= 1U << (rb2 & 31);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -683,7 +678,9 @@ int check_srs_pdu(const nfapi_nr_srs_pdu_t *srs_pdu, nfapi_nr_srs_pdu_t *saved_s
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||||
|
{
|
||||||
|
|
||||||
/* those variables to log T_GNB_PHY_PUCCH_PUSCH_IQ only when we try to decode */
|
/* those variables to log T_GNB_PHY_PUCCH_PUSCH_IQ only when we try to decode */
|
||||||
int pucch_decode_done = 0;
|
int pucch_decode_done = 0;
|
||||||
int pusch_decode_done = 0;
|
int pusch_decode_done = 0;
|
||||||
@@ -702,17 +699,18 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
|||||||
num_symb++;
|
num_symb++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else num_symb=NR_NUMBER_OF_SYMBOLS_PER_SLOT;
|
else
|
||||||
|
num_symb=NR_NUMBER_OF_SYMBOLS_PER_SLOT;
|
||||||
gNB_I0_measurements(gNB,slot_rx,first_symb,num_symb);
|
gNB_I0_measurements(gNB,slot_rx,first_symb,num_symb);
|
||||||
|
|
||||||
const int soffset = (slot_rx&3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size;
|
const int soffset = (slot_rx & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size;
|
||||||
int offset = 10*gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset;
|
int offset = 10 * gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset;
|
||||||
int power_rxF = signal_energy_nodc((int32_t *)&gNB->common_vars.rxdataF[0][soffset+offset+(47*12)],12*18);
|
int power_rxF = signal_energy_nodc((int32_t *)&gNB->common_vars.rxdataF[0][soffset + offset + (47 * 12)], 12 * 18);
|
||||||
LOG_D(PHY,"frame %d, slot %d: UL signal energy %d\n",frame_rx,slot_rx,power_rxF);
|
LOG_D(PHY,"frame %d, slot %d: UL signal energy %d\n",frame_rx,slot_rx,power_rxF);
|
||||||
|
|
||||||
start_meas(&gNB->phy_proc_rx);
|
start_meas(&gNB->phy_proc_rx);
|
||||||
|
|
||||||
for (int i = 0; i < gNB->max_nb_pucch; i++){
|
for (int i = 0; i < gNB->max_nb_pucch; i++) {
|
||||||
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
||||||
if (pucch) {
|
if (pucch) {
|
||||||
if (NFAPI_MODE == NFAPI_MODE_PNF)
|
if (NFAPI_MODE == NFAPI_MODE_PNF)
|
||||||
@@ -736,8 +734,8 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
|||||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1;
|
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1;
|
||||||
|
|
||||||
offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12);
|
offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12);
|
||||||
power_rxF = signal_energy_nodc((int32_t *)&gNB->common_vars.rxdataF[0][soffset+offset],12);
|
power_rxF = signal_energy_nodc((int32_t *)&gNB->common_vars.rxdataF[0][soffset+offset], 12);
|
||||||
LOG_D(PHY,"frame %d, slot %d: PUCCH signal energy %d\n",frame_rx,slot_rx,power_rxF);
|
LOG_D(PHY,"frame %d, slot %d: PUCCH signal energy %d\n", frame_rx, slot_rx, power_rxF);
|
||||||
|
|
||||||
nr_decode_pucch0(gNB,
|
nr_decode_pucch0(gNB,
|
||||||
frame_rx,
|
frame_rx,
|
||||||
@@ -747,7 +745,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
|||||||
|
|
||||||
gNB->UL_INFO.uci_ind.num_ucis += 1;
|
gNB->UL_INFO.uci_ind.num_ucis += 1;
|
||||||
pucch->active = 0;
|
pucch->active = 0;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
num_ucis = gNB->UL_INFO.uci_ind.num_ucis;
|
num_ucis = gNB->UL_INFO.uci_ind.num_ucis;
|
||||||
gNB->UL_INFO.uci_ind.uci_list = &gNB->uci_pdu_list[0];
|
gNB->UL_INFO.uci_ind.uci_list = &gNB->uci_pdu_list[0];
|
||||||
@@ -757,7 +755,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
|||||||
gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t);
|
gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t);
|
||||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4;
|
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4;
|
||||||
|
|
||||||
LOG_D(PHY,"%d.%d Calling nr_decode_pucch2\n",frame_rx,slot_rx);
|
LOG_D(PHY,"%d.%d Calling nr_decode_pucch2\n", frame_rx, slot_rx);
|
||||||
nr_decode_pucch2(gNB,
|
nr_decode_pucch2(gNB,
|
||||||
frame_rx,
|
frame_rx,
|
||||||
slot_rx,
|
slot_rx,
|
||||||
@@ -768,104 +766,97 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
|||||||
pucch->active = 0;
|
pucch->active = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
AssertFatal(1==0,"Only PUCCH formats 0 and 2 are currently supported\n");
|
AssertFatal(1==0,"Only PUCCH formats 0 and 2 are currently supported\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int ULSCH_id = 0; ULSCH_id < NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) {
|
for (int ULSCH_id = 0; ULSCH_id < NUMBER_OF_NR_ULSCH_MAX; ULSCH_id++) {
|
||||||
|
|
||||||
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id];
|
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id];
|
||||||
NR_UL_gNB_HARQ_t *ulsch_harq;
|
NR_UL_gNB_HARQ_t *ulsch_harq = ulsch->harq_process;
|
||||||
|
AssertFatal(ulsch_harq != NULL, "harq_pid %d is not allocated\n", ulsch->harq_pid);
|
||||||
|
|
||||||
if ((ulsch) &&
|
if ((ulsch->active == true) &&
|
||||||
(ulsch->rnti > 0)) {
|
(ulsch_harq->frame == frame_rx) &&
|
||||||
// for for an active HARQ process
|
(ulsch_harq->slot == slot_rx) &&
|
||||||
for (int harq_pid=0;harq_pid<NR_MAX_ULSCH_HARQ_PROCESSES;harq_pid++) {
|
(ulsch->handled == 0)) {
|
||||||
ulsch_harq = ulsch->harq_processes[harq_pid];
|
|
||||||
AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid);
|
|
||||||
if ((ulsch_harq->status == NR_ACTIVE) &&
|
|
||||||
(ulsch_harq->frame == frame_rx) &&
|
|
||||||
(ulsch_harq->slot == slot_rx) &&
|
|
||||||
(ulsch_harq->handled == 0)){
|
|
||||||
|
|
||||||
LOG_D(PHY, "PUSCH detection started in frame %d slot %d\n",
|
LOG_D(PHY, "PUSCH ID %d with RNTI %x detection started in frame %d slot %d\n",
|
||||||
frame_rx,slot_rx);
|
ULSCH_id, ulsch->rnti, frame_rx, slot_rx);
|
||||||
int num_dmrs=0;
|
int num_dmrs = 0;
|
||||||
for (int s=0;s<NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++)
|
for (int s = 0; s < NR_NUMBER_OF_SYMBOLS_PER_SLOT; s++)
|
||||||
num_dmrs+=(ulsch_harq->ulsch_pdu.ul_dmrs_symb_pos>>s)&1;
|
num_dmrs += (ulsch_harq->ulsch_pdu.ul_dmrs_symb_pos >> s) & 1;
|
||||||
|
|
||||||
#ifdef DEBUG_RXDATA
|
#ifdef DEBUG_RXDATA
|
||||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||||
RU_t *ru = gNB->RU_list[0];
|
RU_t *ru = gNB->RU_list[0];
|
||||||
int slot_offset = frame_parms->get_samples_slot_timestamp(slot_rx,frame_parms,0);
|
int slot_offset = frame_parms->get_samples_slot_timestamp(slot_rx,frame_parms,0);
|
||||||
slot_offset -= ru->N_TA_offset;
|
slot_offset -= ru->N_TA_offset;
|
||||||
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[0]=(int16_t)ulsch->rnti;
|
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[0]=(int16_t)ulsch->rnti;
|
||||||
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[1]=(int16_t)ulsch_harq->ulsch_pdu.rb_size;
|
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[1]=(int16_t)ulsch_harq->ulsch_pdu.rb_size;
|
||||||
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[2]=(int16_t)ulsch_harq->ulsch_pdu.rb_start;
|
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[2]=(int16_t)ulsch_harq->ulsch_pdu.rb_start;
|
||||||
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[3]=(int16_t)ulsch_harq->ulsch_pdu.nr_of_symbols;
|
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[3]=(int16_t)ulsch_harq->ulsch_pdu.nr_of_symbols;
|
||||||
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[4]=(int16_t)ulsch_harq->ulsch_pdu.start_symbol_index;
|
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[4]=(int16_t)ulsch_harq->ulsch_pdu.start_symbol_index;
|
||||||
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[5]=(int16_t)ulsch_harq->ulsch_pdu.mcs_index;
|
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[5]=(int16_t)ulsch_harq->ulsch_pdu.mcs_index;
|
||||||
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[6]=(int16_t)ulsch_harq->ulsch_pdu.pusch_data.rv_index;
|
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[6]=(int16_t)ulsch_harq->ulsch_pdu.pusch_data.rv_index;
|
||||||
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[7]=(int16_t)harq_pid;
|
((int16_t*)&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset])[7]=(int16_t)ulsch->harq_pid;
|
||||||
memcpy(&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset+4],&ru->common.rxdata[0][slot_offset],frame_parms->get_samples_per_slot(slot_rx,frame_parms)*sizeof(int32_t));
|
memcpy(&gNB->common_vars.debugBuff[gNB->common_vars.debugBuff_sample_offset+4],&ru->common.rxdata[0][slot_offset],frame_parms->get_samples_per_slot(slot_rx,frame_parms)*sizeof(int32_t));
|
||||||
gNB->common_vars.debugBuff_sample_offset+=(frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+4);
|
gNB->common_vars.debugBuff_sample_offset+=(frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+4);
|
||||||
if(gNB->common_vars.debugBuff_sample_offset>((frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+2)*20)) {
|
if(gNB->common_vars.debugBuff_sample_offset>((frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+2)*20)) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
f = fopen("rxdata_buff.raw", "w"); if (f == NULL) exit(1);
|
f = fopen("rxdata_buff.raw", "w"); if (f == NULL) exit(1);
|
||||||
fwrite((int16_t*)gNB->common_vars.debugBuff,2,(frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+4)*20*2, f);
|
fwrite((int16_t*)gNB->common_vars.debugBuff,2,(frame_parms->get_samples_per_slot(slot_rx,frame_parms)+1000+4)*20*2, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pusch_decode_done = 1;
|
pusch_decode_done = 1;
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,1);
|
||||||
start_meas(&gNB->rx_pusch_stats);
|
start_meas(&gNB->rx_pusch_stats);
|
||||||
nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, harq_pid);
|
nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid);
|
||||||
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot=0;
|
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot = 0;
|
||||||
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot=0;
|
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot = 0;
|
||||||
for (int aarx=0;aarx<gNB->frame_parms.nb_antennas_rx;aarx++) {
|
for (int aarx=0;aarx<gNB->frame_parms.nb_antennas_rx;aarx++) {
|
||||||
gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx]/=num_dmrs;
|
gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx] /= num_dmrs;
|
||||||
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx];
|
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_power[aarx];
|
||||||
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx]/=num_dmrs;
|
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx] /= num_dmrs;
|
||||||
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx];
|
gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot += gNB->pusch_vars[ULSCH_id]->ulsch_noise_power[aarx];
|
||||||
}
|
|
||||||
if (dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) <
|
|
||||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot) + gNB->pusch_thres) {
|
|
||||||
NR_gNB_SCH_STATS_t *stats=get_ulsch_stats(gNB,ulsch);
|
|
||||||
|
|
||||||
LOG_D(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx,
|
|
||||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot),
|
|
||||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres);
|
|
||||||
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot = gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot;
|
|
||||||
gNB->pusch_vars[ULSCH_id]->DTX=1;
|
|
||||||
if (stats) stats->DTX++;
|
|
||||||
if (!get_softmodem_params()->phy_test) {
|
|
||||||
/* in case of phy_test mode, we still want to decode to measure execution time.
|
|
||||||
Therefore, we don't yet call nr_fill_indication, it will be called later */
|
|
||||||
nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1,1);
|
|
||||||
pusch_DTX++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG_D(PHY, "PUSCH detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx,
|
|
||||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot),
|
|
||||||
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres);
|
|
||||||
|
|
||||||
gNB->pusch_vars[ULSCH_id]->DTX=0;
|
|
||||||
}
|
|
||||||
stop_meas(&gNB->rx_pusch_stats);
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,0);
|
|
||||||
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1);
|
|
||||||
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1);
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX,1);
|
|
||||||
nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid);
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX,0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot) <
|
||||||
|
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot) + gNB->pusch_thres) {
|
||||||
|
NR_gNB_PHY_STATS_t *stats = get_phy_stats(gNB, ulsch->rnti);
|
||||||
|
|
||||||
|
LOG_D(PHY, "PUSCH not detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx,
|
||||||
|
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot),
|
||||||
|
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres);
|
||||||
|
gNB->pusch_vars[ULSCH_id]->ulsch_power_tot = gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot;
|
||||||
|
gNB->pusch_vars[ULSCH_id]->DTX = 1;
|
||||||
|
if (stats) stats->ulsch_stats.DTX++;
|
||||||
|
if (!get_softmodem_params()->phy_test) {
|
||||||
|
/* in case of phy_test mode, we still want to decode to measure execution time.
|
||||||
|
Therefore, we don't yet call nr_fill_indication, it will be called later */
|
||||||
|
nr_fill_indication(gNB, frame_rx, slot_rx, ULSCH_id, ulsch->harq_pid, 1, 1);
|
||||||
|
pusch_DTX++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG_D(PHY, "PUSCH detected in %d.%d (%d,%d,%d)\n",frame_rx,slot_rx,
|
||||||
|
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_power_tot),
|
||||||
|
dB_fixed_x10(gNB->pusch_vars[ULSCH_id]->ulsch_noise_power_tot),gNB->pusch_thres);
|
||||||
|
|
||||||
|
gNB->pusch_vars[ULSCH_id]->DTX=0;
|
||||||
|
}
|
||||||
|
stop_meas(&gNB->rx_pusch_stats);
|
||||||
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,0);
|
||||||
|
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1);
|
||||||
|
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1);
|
||||||
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX,1);
|
||||||
|
nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, ulsch->harq_pid);
|
||||||
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_ULSCH_PROCEDURES_RX,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1979,13 +1979,9 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hack data to remove UE in the phy */
|
|
||||||
int rnti_to_remove[10];
|
|
||||||
volatile int rnti_to_remove_count;
|
|
||||||
pthread_mutex_t rnti_to_remove_mutex = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
|
|
||||||
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);
|
||||||
@@ -1997,16 +1993,6 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca
|
|||||||
LOG_I(NR_MAC, "Remove NR rnti 0x%04x\n", UE->rnti);
|
LOG_I(NR_MAC, "Remove NR rnti 0x%04x\n", UE->rnti);
|
||||||
const rnti_t rnti = UE->rnti;
|
const rnti_t rnti = UE->rnti;
|
||||||
free(UE);
|
free(UE);
|
||||||
/* hack to remove UE in the phy */
|
|
||||||
if (pthread_mutex_lock(&rnti_to_remove_mutex))
|
|
||||||
exit(1);
|
|
||||||
if (rnti_to_remove_count == 10)
|
|
||||||
exit(1);
|
|
||||||
rnti_to_remove[rnti_to_remove_count] = rnti;
|
|
||||||
LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti);
|
|
||||||
rnti_to_remove_count++;
|
|
||||||
if (pthread_mutex_unlock(&rnti_to_remove_mutex))
|
|
||||||
exit(1);
|
|
||||||
|
|
||||||
/* clear RA process(es?) associated to the UE */
|
/* clear RA process(es?) associated to the UE */
|
||||||
for (int cc_id = 0; cc_id < NFAPI_CC_MAX; cc_id++) {
|
for (int cc_id = 0; cc_id < NFAPI_CC_MAX; cc_id++) {
|
||||||
@@ -2015,8 +2001,8 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca
|
|||||||
if (cc->ra[i].rnti == rnti) {
|
if (cc->ra[i].rnti == rnti) {
|
||||||
LOG_D(NR_MAC, "free RA process %d for rnti %04x\n", i, rnti);
|
LOG_D(NR_MAC, "free RA process %d for rnti %04x\n", i, rnti);
|
||||||
/* is it enough? */
|
/* is it enough? */
|
||||||
cc->ra[i].cfra = false;
|
cc->ra[i].cfra = false;
|
||||||
cc->ra[i].rnti = 0;
|
cc->ra[i].rnti = 0;
|
||||||
cc->ra[i].crnti = 0;
|
cc->ra[i].crnti = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2524,16 +2510,6 @@ void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti)
|
|||||||
delete_nr_ue_data(UE, nr_mac->common_channels, &UE_info->uid_allocator);
|
delete_nr_ue_data(UE, nr_mac->common_channels, &UE_info->uid_allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti) {
|
|
||||||
// Hack to remove UE in the phy (following the same procedure as in function mac_remove_nr_ue)
|
|
||||||
if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1);
|
|
||||||
if (rnti_to_remove_count == 10) exit(1);
|
|
||||||
rnti_to_remove[rnti_to_remove_count] = rnti;
|
|
||||||
LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti);
|
|
||||||
rnti_to_remove_count++;
|
|
||||||
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) {
|
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) {
|
||||||
// al values passed to this function are x10
|
// al values passed to this function are x10
|
||||||
int snrx10 = (cqi*5) - 640;
|
int snrx10 = (cqi*5) - 640;
|
||||||
|
|||||||
@@ -680,7 +680,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
|
|
||||||
if(no_sig) {
|
if(no_sig) {
|
||||||
LOG_D(NR_MAC, "Random Access %i failed at state %i (no signal)\n", i, ra->state);
|
LOG_D(NR_MAC, "Random Access %i failed at state %i (no signal)\n", i, ra->state);
|
||||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
|
||||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -693,7 +692,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
|
|
||||||
if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) {
|
if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) {
|
||||||
LOG_D(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x)\n", i, ra->state,ra->rnti,current_rnti);
|
LOG_D(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x)\n", i, ra->state,ra->rnti,current_rnti);
|
||||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
|
||||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,7 +701,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
NR_UE_info_t *UE = add_new_nr_ue(gNB_mac, ra->rnti, ra->CellGroup);
|
NR_UE_info_t *UE = add_new_nr_ue(gNB_mac, ra->rnti, ra->CellGroup);
|
||||||
if (!UE) {
|
if (!UE) {
|
||||||
LOG_W(NR_MAC, "Random Access %i discarded at state %i (TC_RNTI %04x RNTI %04x): max number of users achieved!\n", i, ra->state,ra->rnti,current_rnti);
|
LOG_W(NR_MAC, "Random Access %i discarded at state %i (TC_RNTI %04x RNTI %04x): max number of users achieved!\n", i, ra->state,ra->rnti,current_rnti);
|
||||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
|
||||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -737,7 +734,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
|
|
||||||
LOG_A(NR_MAC, "(rnti 0x%04x) CFRA procedure succeeded!\n", ra->rnti);
|
LOG_A(NR_MAC, "(rnti 0x%04x) CFRA procedure succeeded!\n", ra->rnti);
|
||||||
UE->ra_timer = 0;
|
UE->ra_timer = 0;
|
||||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
|
||||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
process_CellGroup(ra->CellGroup, UE_scheduling_control);
|
process_CellGroup(ra->CellGroup, UE_scheduling_control);
|
||||||
|
|
||||||
@@ -785,7 +781,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
|
||||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -804,14 +799,12 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
// for CFRA (NSA) do not schedule retransmission of msg3
|
// for CFRA (NSA) do not schedule retransmission of msg3
|
||||||
if (ra->cfra) {
|
if (ra->cfra) {
|
||||||
LOG_D(NR_MAC, "Random Access %i failed at state %i (NSA msg3 reception failed)\n", i, ra->state);
|
LOG_D(NR_MAC, "Random Access %i failed at state %i (NSA msg3 reception failed)\n", i, ra->state);
|
||||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
|
||||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ra->msg3_round >= gNB_mac->ul_bler.harq_round_max - 1) {
|
if (ra->msg3_round >= gNB_mac->ul_bler.harq_round_max - 1) {
|
||||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (Reached msg3 max harq rounds)\n", i, ra->state);
|
LOG_W(NR_MAC, "Random Access %i failed at state %i (Reached msg3 max harq rounds)\n", i, ra->state);
|
||||||
nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti);
|
|
||||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user