Merge remote-tracking branch 'origin/NR_UL_scheduling' into NR_RRC_PDCP
This commit is contained in:
@@ -1547,7 +1547,7 @@ set(PHY_SRC_UE
|
|||||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c
|
${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
|
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/filt16a_32.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
|
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
|
||||||
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_adjust_sync_gNB.c
|
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_measurements_gNB.c
|
||||||
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
|
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
|
||||||
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
|
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
|
||||||
#${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
|
#${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
|
||||||
|
|||||||
+35
-1
@@ -19,7 +19,7 @@
|
|||||||
* contact@openairinterface.org
|
* contact@openairinterface.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file PHY/NR_ESTIMATION/nr_adjust_sync_gNB.c
|
/*! \file PHY/NR_ESTIMATION/nr_measurements_gNB.c
|
||||||
* \brief TA estimation for TA updates
|
* \brief TA estimation for TA updates
|
||||||
* \author Ahmed Hussein
|
* \author Ahmed Hussein
|
||||||
* \date 2019
|
* \date 2019
|
||||||
@@ -69,3 +69,37 @@ int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id)
|
|||||||
return max_pos - sync_pos;
|
return max_pos - sync_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void gNB_I0_measurements(PHY_VARS_gNB *gNB) {
|
||||||
|
|
||||||
|
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||||
|
NR_gNB_COMMON *common_vars = &gNB->common_vars;
|
||||||
|
PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements;
|
||||||
|
uint32_t *rb_mask = gNB->rb_mask_ul;
|
||||||
|
int symbol = gNB->ulmask_symb;
|
||||||
|
int rb, offset, nb_rb;
|
||||||
|
uint32_t n0_power_tot, n0_subband_power_temp=0;
|
||||||
|
int32_t *ul_ch;
|
||||||
|
|
||||||
|
if (symbol>-1) {
|
||||||
|
n0_power_tot = 0;
|
||||||
|
for (int aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||||
|
nb_rb = 0;
|
||||||
|
for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
|
||||||
|
if ((rb_mask[rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe
|
||||||
|
nb_rb++;
|
||||||
|
offset = (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
|
||||||
|
offset += (symbol*frame_parms->ofdm_symbol_size);
|
||||||
|
ul_ch = &common_vars->rxdataF[aarx][offset];
|
||||||
|
//TODO what about DC?
|
||||||
|
n0_subband_power_temp += signal_energy_nodc(ul_ch,12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
measurements->n0_subband_power[aarx] = n0_subband_power_temp/nb_rb;
|
||||||
|
measurements->n0_subband_power_dB[aarx] = dB_fixed(measurements->n0_subband_power[aarx]);
|
||||||
|
n0_power_tot += measurements->n0_subband_power[aarx];
|
||||||
|
}
|
||||||
|
//measurements->n0_subband_power_tot_dB = dB_fixed(n0_power_tot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -47,6 +47,8 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
|||||||
unsigned short bwp_start_subcarrier,
|
unsigned short bwp_start_subcarrier,
|
||||||
nfapi_nr_pusch_pdu_t *pusch_pdu);
|
nfapi_nr_pusch_pdu_t *pusch_pdu);
|
||||||
|
|
||||||
|
void gNB_I0_measurements(PHY_VARS_gNB *gNB);
|
||||||
|
|
||||||
int nr_est_timing_advance_pusch(PHY_VARS_gNB* phy_vars_gNB, int UE_id);
|
int nr_est_timing_advance_pusch(PHY_VARS_gNB* phy_vars_gNB, int UE_id);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -348,6 +348,8 @@ int nr_dlsch_encoding(unsigned char *a,
|
|||||||
float Coderate = 0.0;
|
float Coderate = 0.0;
|
||||||
uint8_t Nl = 4;
|
uint8_t Nl = 4;
|
||||||
|
|
||||||
|
dlsch->harq_processes[harq_pid]->round = nr_rv_round_map[rel15->rvIndex[0]];
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
A = rel15->TBSize[0]<<3;
|
A = rel15->TBSize[0]<<3;
|
||||||
|
|||||||
@@ -359,6 +359,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING,1);
|
||||||
harq_process->TBS = pusch_pdu->pusch_data.tb_size;
|
harq_process->TBS = pusch_pdu->pusch_data.tb_size;
|
||||||
|
harq_process->round = nr_rv_round_map[pusch_pdu->pusch_data.rv_index];
|
||||||
|
|
||||||
A = (harq_process->TBS)<<3;
|
A = (harq_process->TBS)<<3;
|
||||||
ret = ulsch->max_ldpc_iterations + 1;
|
ret = ulsch->max_ldpc_iterations + 1;
|
||||||
@@ -570,7 +571,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
|
|
||||||
AssertFatal(kc!=255,"");
|
AssertFatal(kc!=255,"");
|
||||||
j+=(harq_process->F>>3);
|
j+=(harq_process->F>>3);
|
||||||
// for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++) {
|
|
||||||
for (i=Kr_bytes; i < ((kc*p_decParams->Z)>>3); i++, j++) {
|
for (i=Kr_bytes; i < ((kc*p_decParams->Z)>>3); i++, j++) {
|
||||||
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
|
pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
|
||||||
}
|
}
|
||||||
@@ -661,8 +661,8 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
harq_process->status = SCH_IDLE;
|
harq_process->status = SCH_IDLE;
|
||||||
harq_process->round = 0;
|
harq_process->round = 0;
|
||||||
harq_process->handled = 0;
|
harq_process->handled = 0;
|
||||||
}
|
|
||||||
ulsch->harq_mask &= ~(1 << harq_pid);
|
ulsch->harq_mask &= ~(1 << harq_pid);
|
||||||
|
}
|
||||||
|
|
||||||
// LOG_D(PHY,"[gNB %d] ULSCH: Setting NACK for nr_tti_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
|
// LOG_D(PHY,"[gNB %d] ULSCH: Setting NACK for nr_tti_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
|
||||||
// phy_vars_gNB->Mod_id,nr_tti_rx,harq_pid,harq_process->status,harq_process->round,ulsch->Mlimit,harq_process->TBS);
|
// phy_vars_gNB->Mod_id,nr_tti_rx,harq_pid,harq_process->status,harq_process->round,ulsch->Mlimit,harq_process->TBS);
|
||||||
@@ -672,15 +672,15 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//#ifdef gNB_DEBUG_TRACE
|
#ifdef gNB_DEBUG_TRACE
|
||||||
LOG_I(PHY,"[gNB %d] ULSCH: Setting ACK for nr_tti_rx %d TBS %d\n",
|
LOG_I(PHY,"[gNB %d] ULSCH: Setting ACK for nr_tti_rx %d TBS %d\n",
|
||||||
phy_vars_gNB->Mod_id,nr_tti_rx,harq_process->TBS);
|
phy_vars_gNB->Mod_id,nr_tti_rx,harq_process->TBS);
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
harq_process->status = SCH_IDLE;
|
harq_process->status = SCH_IDLE;
|
||||||
harq_process->round = 0;
|
harq_process->round = 0;
|
||||||
// harq_process->handled = 0;
|
// harq_process->handled = 0;
|
||||||
ulsch->harq_mask |= (1 << harq_pid);
|
ulsch->harq_mask &= ~(1 << harq_pid);
|
||||||
// harq_process->harq_ack.ack = 1;
|
// harq_process->harq_ack.ack = 1;
|
||||||
// harq_process->harq_ack.harq_id = harq_pid;
|
// harq_process->harq_ack.harq_id = harq_pid;
|
||||||
// harq_process->harq_ack.send_harq_status = 1;
|
// harq_process->harq_ack.send_harq_status = 1;
|
||||||
|
|||||||
@@ -1077,7 +1077,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
|||||||
//--------------------- Channel estimation ---------------------
|
//--------------------- Channel estimation ---------------------
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
start_meas(&gNB->ulsch_channel_estimation_stats);
|
start_meas(&gNB->ulsch_channel_estimation_stats);
|
||||||
if (dmrs_symbol_flag == 1)
|
if (dmrs_symbol_flag == 1) {
|
||||||
nr_pusch_channel_estimation(gNB,
|
nr_pusch_channel_estimation(gNB,
|
||||||
nr_tti_rx,
|
nr_tti_rx,
|
||||||
0, // p
|
0, // p
|
||||||
@@ -1085,6 +1085,14 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
|||||||
ulsch_id,
|
ulsch_id,
|
||||||
bwp_start_subcarrier,
|
bwp_start_subcarrier,
|
||||||
rel15_ul);
|
rel15_ul);
|
||||||
|
|
||||||
|
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
|
||||||
|
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size],
|
||||||
|
rel15_ul->rb_size*12);
|
||||||
|
if (gNB->pusch_vars[ulsch_id]->ulsch_power[aarx]==1) return (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
stop_meas(&gNB->ulsch_channel_estimation_stats);
|
stop_meas(&gNB->ulsch_channel_estimation_stats);
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
//--------------------- RBs extraction ---------------------
|
//--------------------- RBs extraction ---------------------
|
||||||
@@ -1145,11 +1153,6 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
|||||||
stop_meas(&gNB->ulsch_channel_compensation_stats);
|
stop_meas(&gNB->ulsch_channel_compensation_stats);
|
||||||
|
|
||||||
|
|
||||||
int rxsig = signal_energy(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][(symbol*rel15_ul->rb_size*12)],
|
|
||||||
rel15_ul->rb_size*12);
|
|
||||||
|
|
||||||
if (rxsig==1) return (rxsig);
|
|
||||||
|
|
||||||
#ifdef NR_SC_FDMA
|
#ifdef NR_SC_FDMA
|
||||||
nr_idft(&((uint32_t*)gNB->pusch_vars[ulsch_id]->rxdataF_ext[0])[symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], nb_re_pusch);
|
nr_idft(&((uint32_t*)gNB->pusch_vars[ulsch_id]->rxdataF_ext[0])[symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], nb_re_pusch);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
|||||||
harq_process->harq_ack.harq_id = harq_pid;
|
harq_process->harq_ack.harq_id = harq_pid;
|
||||||
harq_process->harq_ack.send_harq_status = 1;
|
harq_process->harq_ack.send_harq_status = 1;
|
||||||
harq_process->errors[harq_process->round]++;
|
harq_process->errors[harq_process->round]++;
|
||||||
// harq_process->round++; // [hna] uncomment this line when HARQ is implemented
|
harq_process->round++; // [hna] uncomment this line when HARQ is implemented
|
||||||
|
|
||||||
// printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
|
// printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
|
||||||
if (harq_process->round >= dlsch->Mlimit) {
|
if (harq_process->round >= dlsch->Mlimit) {
|
||||||
|
|||||||
@@ -1074,11 +1074,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
|
uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
|
||||||
uint8_t harq_pid,
|
|
||||||
uint8_t slot,
|
uint8_t slot,
|
||||||
uint8_t thread_id,
|
NR_DL_FRAME_PARMS *frame_parms,
|
||||||
uint8_t gNB_id,
|
uint8_t Nl);
|
||||||
NR_DL_FRAME_PARMS *frame_parms);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -259,6 +259,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
|
|||||||
Ilbrm = 0;
|
Ilbrm = 0;
|
||||||
Tbslbrm = 950984; //max tbs
|
Tbslbrm = 950984; //max tbs
|
||||||
Coderate = 0.0;
|
Coderate = 0.0;
|
||||||
|
harq_process->round = nr_rv_round_map_ue[harq_process->pusch_pdu.pusch_data.rv_index];
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -476,17 +476,14 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
|||||||
|
|
||||||
|
|
||||||
uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
|
uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
|
||||||
uint8_t harq_pid,
|
|
||||||
uint8_t slot,
|
uint8_t slot,
|
||||||
uint8_t thread_id,
|
NR_DL_FRAME_PARMS *frame_parms,
|
||||||
uint8_t gNB_id,
|
uint8_t Nl) {
|
||||||
NR_DL_FRAME_PARMS *frame_parms) {
|
|
||||||
|
|
||||||
int tx_offset, ap;
|
int tx_offset, ap;
|
||||||
int32_t **txdata;
|
int32_t **txdata;
|
||||||
int32_t **txdataF;
|
int32_t **txdataF;
|
||||||
int timing_advance;
|
int timing_advance;
|
||||||
uint8_t Nl = UE->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]->pusch_pdu.nrOfLayers; // cw 0
|
|
||||||
|
|
||||||
/////////////////////////IFFT///////////////////////
|
/////////////////////////IFFT///////////////////////
|
||||||
///////////
|
///////////
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
|
|||||||
// if frequency hopping is enabled n_hop = 1 for second hop. Not sure frequency hopping concerns format 0. FIXME!!!
|
// if frequency hopping is enabled n_hop = 1 for second hop. Not sure frequency hopping concerns format 0. FIXME!!!
|
||||||
// if ((PUCCH_Frequency_Hopping == 1)&&(l == (nrofSymbols-1))) n_hop = 1;
|
// if ((PUCCH_Frequency_Hopping == 1)&&(l == (nrofSymbols-1))) n_hop = 1;
|
||||||
nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,n_hop,nr_tti_tx,&u,&v); // calculating u and v value
|
nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,n_hop,nr_tti_tx,&u,&v); // calculating u and v value
|
||||||
alpha = nr_cyclic_shift_hopping(ue->pucch_config_common_nr->hoppingId,m0,mcs,l,startingSymbolIndex,nr_tti_tx);
|
alpha = nr_cyclic_shift_hopping(hoppingId,m0,mcs,l,startingSymbolIndex,nr_tti_tx);
|
||||||
#ifdef DEBUG_NR_PUCCH_TX
|
#ifdef DEBUG_NR_PUCCH_TX
|
||||||
printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \t(for symbol l=%d)\n",u,v,alpha,l);
|
printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \t(for symbol l=%d)\n",u,v,alpha,l);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -588,10 +588,10 @@ typedef struct {
|
|||||||
unsigned short n0_power_tot_dB;
|
unsigned short n0_power_tot_dB;
|
||||||
//! estimated avg noise power (dB)
|
//! estimated avg noise power (dB)
|
||||||
short n0_power_tot_dBm;
|
short n0_power_tot_dBm;
|
||||||
//! estimated avg noise power per RB per RX ant (lin)
|
//! estimated avg noise power per RX ant (lin)
|
||||||
unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB][275];
|
unsigned short n0_subband_power[MAX_NUM_RU_PER_gNB];
|
||||||
//! estimated avg noise power per RB per RX ant (dB)
|
//! estimated avg noise power per RX ant (dB)
|
||||||
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB][275];
|
unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_gNB];
|
||||||
//! estimated avg noise power per RB (dB)
|
//! estimated avg noise power per RB (dB)
|
||||||
short n0_subband_power_tot_dB[275];
|
short n0_subband_power_tot_dB[275];
|
||||||
//! estimated avg noise power per RB (dBm)
|
//! estimated avg noise power per RB (dBm)
|
||||||
@@ -715,6 +715,10 @@ typedef struct PHY_VARS_gNB_s {
|
|||||||
/// PUSCH DMRS
|
/// PUSCH DMRS
|
||||||
uint32_t ****nr_gold_pusch_dmrs;
|
uint32_t ****nr_gold_pusch_dmrs;
|
||||||
|
|
||||||
|
// Mask of occupied RBs
|
||||||
|
uint32_t rb_mask_ul[9];
|
||||||
|
int ulmask_symb;
|
||||||
|
|
||||||
/// Indicator set to 0 after first SR
|
/// Indicator set to 0 after first SR
|
||||||
uint8_t first_sr[NUMBER_OF_NR_SR_MAX];
|
uint8_t first_sr[NUMBER_OF_NR_SR_MAX];
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,9 @@
|
|||||||
#define MAX_NUM_NR_CHANNEL_BITS (14*273*12*8) // 14 symbols, 273 RB
|
#define MAX_NUM_NR_CHANNEL_BITS (14*273*12*8) // 14 symbols, 273 RB
|
||||||
#define MAX_NUM_NR_RE (14*273*12)
|
#define MAX_NUM_NR_RE (14*273*12)
|
||||||
|
|
||||||
|
extern const uint8_t nr_rv_round_map[4];
|
||||||
|
extern const uint8_t nr_rv_round_map_ue[4];
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NR_MU_0=0,
|
NR_MU_0=0,
|
||||||
NR_MU_1,
|
NR_MU_1,
|
||||||
|
|||||||
@@ -310,10 +310,12 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
|||||||
if (timing_advance_update < 0) timing_advance_update = 0;
|
if (timing_advance_update < 0) timing_advance_update = 0;
|
||||||
if (timing_advance_update > 63) timing_advance_update = 63;
|
if (timing_advance_update > 63) timing_advance_update = 63;
|
||||||
|
|
||||||
LOG_D(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update);
|
LOG_I(PHY, "Estimated timing advance PUSCH is = %d, timing_advance_update is %d \n", sync_pos,timing_advance_update);
|
||||||
|
|
||||||
// estimate UL_CQI for MAC (from antenna port 0 only)
|
// estimate UL_CQI for MAC (from antenna port 0 only)
|
||||||
int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - 300;//(10*gNB->measurements.n0_power_dB[0]);
|
int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[ULSCH_id]->ulsch_power[0]) - (10*gNB->measurements.n0_subband_power_dB[0]);
|
||||||
|
|
||||||
|
LOG_I(PHY, "Estimated SNR for PUSCH is = %d dB\n", SNRtimes10/10);
|
||||||
|
|
||||||
if (SNRtimes10 < -640) cqi=0;
|
if (SNRtimes10 < -640) cqi=0;
|
||||||
else if (SNRtimes10 > 635) cqi=255;
|
else if (SNRtimes10 > 635) cqi=255;
|
||||||
@@ -359,6 +361,71 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
|||||||
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to fill UL RB mask to be used for N0 measurements
|
||||||
|
void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||||
|
|
||||||
|
int rb2, rb, nb_rb;
|
||||||
|
for (int symbol=0;symbol<14;symbol++) {
|
||||||
|
|
||||||
|
nb_rb = 0;
|
||||||
|
for (int m=0;m<9;m++) gNB->rb_mask_ul[m] = 0;
|
||||||
|
gNB->ulmask_symb = -1;
|
||||||
|
|
||||||
|
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
||||||
|
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
||||||
|
if (pucch) {
|
||||||
|
if ((pucch->active == 1) &&
|
||||||
|
(pucch->frame == frame_rx) &&
|
||||||
|
(pucch->slot == slot_rx) ) {
|
||||||
|
|
||||||
|
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch[i].pucch_pdu;
|
||||||
|
if ((symbol>=pucch_pdu->start_symbol_index) &&
|
||||||
|
(symbol<(pucch_pdu->start_symbol_index + pucch_pdu->nr_of_symbols))){
|
||||||
|
for (rb=0; rb<pucch_pdu->prb_size; rb++) {
|
||||||
|
rb2 = rb+pucch_pdu->prb_start;
|
||||||
|
gNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
|
||||||
|
}
|
||||||
|
nb_rb+=pucch_pdu->prb_size;
|
||||||
|
gNB->ulmask_symb = symbol;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int ULSCH_id=0;ULSCH_id<NUMBER_OF_NR_ULSCH_MAX;ULSCH_id++) {
|
||||||
|
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
|
||||||
|
int harq_pid;
|
||||||
|
NR_UL_gNB_HARQ_t *ulsch_harq;
|
||||||
|
|
||||||
|
if ((ulsch) &&
|
||||||
|
(ulsch->rnti > 0)) {
|
||||||
|
for (harq_pid=0;harq_pid<NR_MAX_ULSCH_HARQ_PROCESSES;harq_pid++) {
|
||||||
|
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)){
|
||||||
|
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
|
||||||
|
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
|
||||||
|
if ((symbol>=symbol_start) &&
|
||||||
|
(symbol<symbol_end)){
|
||||||
|
for (rb=0; rb<ulsch_harq->ulsch_pdu.rb_size; rb++) {
|
||||||
|
rb2 = rb+ulsch_harq->ulsch_pdu.rb_start;
|
||||||
|
gNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
|
||||||
|
}
|
||||||
|
nb_rb+=ulsch_harq->ulsch_pdu.rb_size;
|
||||||
|
gNB->ulmask_symb = symbol;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//TODO Add check for PRACH as well?
|
||||||
|
}
|
||||||
|
if (nb_rb<gNB->frame_parms.N_RB_UL)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||||
|
|
||||||
uint8_t symbol;
|
uint8_t symbol;
|
||||||
@@ -385,6 +452,9 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
|||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,1);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,1);
|
||||||
LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx);
|
LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx);
|
||||||
|
|
||||||
|
fill_ul_rb_mask(gNB, frame_rx, slot_rx);
|
||||||
|
gNB_I0_measurements(gNB);
|
||||||
|
|
||||||
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
||||||
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
||||||
if (pucch) {
|
if (pucch) {
|
||||||
@@ -460,7 +530,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
|||||||
for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) {
|
for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) {
|
||||||
no_sig = nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid);
|
no_sig = nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid);
|
||||||
if (no_sig) {
|
if (no_sig) {
|
||||||
LOG_I(PHY, "ULSCH %d not received\n",ULSCH_id);
|
LOG_I(PHY, "PUSCH not detected in symbol %d\n",symbol);
|
||||||
|
nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ fifo_dump_emos_UE emos_dump_UE;
|
|||||||
|
|
||||||
char nr_mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
|
char nr_mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
|
||||||
|
|
||||||
|
const uint8_t nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||||
|
|
||||||
extern double cpuf;
|
extern double cpuf;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2250,20 +2252,18 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (get_softmodem_params()->usim_test==0) {
|
if (get_softmodem_params()->usim_test==0) {
|
||||||
LOG_D(PHY, "Sending PUCCH\n");
|
LOG_I(PHY, "Generating PUCCH\n");
|
||||||
pucch_procedures_ue_nr(ue,
|
pucch_procedures_ue_nr(ue,
|
||||||
gNB_id,
|
gNB_id,
|
||||||
proc,
|
proc,
|
||||||
TRUE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_D(PHY, "Sending data \n");
|
LOG_I(PHY, "Sending Uplink data \n");
|
||||||
nr_ue_pusch_common_procedures(ue,
|
nr_ue_pusch_common_procedures(ue,
|
||||||
harq_pid,
|
|
||||||
slot_tx,
|
slot_tx,
|
||||||
thread_id,
|
&ue->frame_parms,1);
|
||||||
gNB_id,
|
//ue->ulsch[thread_id][gNB_id][0]->harq_processes[harq_pid]->pusch_pdu.nrOfLayers);
|
||||||
&ue->frame_parms);
|
|
||||||
}
|
}
|
||||||
//LOG_M("txdata.m","txs",ue->common_vars.txdata[0],1228800,1,1);
|
//LOG_M("txdata.m","txs",ue->common_vars.txdata[0],1228800,1,1);
|
||||||
|
|
||||||
@@ -3371,6 +3371,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// exit dlsch procedures as there are no active dlsch
|
||||||
|
if (is_cw0_active != ACTIVE && is_cw1_active != ACTIVE)
|
||||||
|
return;
|
||||||
|
|
||||||
// start ldpc decode for CW 0
|
// start ldpc decode for CW 0
|
||||||
dlsch0->harq_processes[harq_pid]->G = nr_get_G(dlsch0->harq_processes[harq_pid]->nb_rb,
|
dlsch0->harq_processes[harq_pid]->G = nr_get_G(dlsch0->harq_processes[harq_pid]->nb_rb,
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
|||||||
double cpuf;
|
double cpuf;
|
||||||
uint8_t nfapi_mode = 0;
|
uint8_t nfapi_mode = 0;
|
||||||
uint16_t NB_UE_INST = 1;
|
uint16_t NB_UE_INST = 1;
|
||||||
|
uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3};
|
||||||
|
uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||||
|
|
||||||
// needed for some functions
|
// needed for some functions
|
||||||
PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}};
|
PHY_VARS_NR_UE * PHY_vars_UE_g[1][1]={{NULL}};
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ int rrc_init_nr_global_param(void){return(0);}
|
|||||||
// needed for some functions
|
// needed for some functions
|
||||||
uint16_t n_rnti = 0x1234;
|
uint16_t n_rnti = 0x1234;
|
||||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||||
uint8_t round_rv_map[4] = {1, 0, 2, 3};
|
//const uint8_t nr_rv_round_map[4] = {0, 2, 1, 3};
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -148,6 +148,10 @@ int main(int argc, char **argv)
|
|||||||
cpuf = get_cpu_freq_GHz();
|
cpuf = get_cpu_freq_GHz();
|
||||||
int msg3_flag = 0;
|
int msg3_flag = 0;
|
||||||
uint8_t rv_index = 0;
|
uint8_t rv_index = 0;
|
||||||
|
float roundStats[50];
|
||||||
|
float effRate;
|
||||||
|
float eff_tp_check = 0.7;
|
||||||
|
uint8_t snrRun;
|
||||||
|
|
||||||
UE_nr_rxtx_proc_t UE_proc;
|
UE_nr_rxtx_proc_t UE_proc;
|
||||||
FILE *scg_fd=NULL;
|
FILE *scg_fd=NULL;
|
||||||
@@ -276,6 +280,9 @@ int main(int argc, char **argv)
|
|||||||
printf("Setting SNR0 to %f\n", snr0);
|
printf("Setting SNR0 to %f\n", snr0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
eff_tp_check = (float)atoi(optarg)/100;
|
||||||
|
break;
|
||||||
/*
|
/*
|
||||||
case 'r':
|
case 'r':
|
||||||
ricean_factor = pow(10,-.1*atof(optarg));
|
ricean_factor = pow(10,-.1*atof(optarg));
|
||||||
@@ -374,6 +381,7 @@ int main(int argc, char **argv)
|
|||||||
printf("-N Nid_cell\n");
|
printf("-N Nid_cell\n");
|
||||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||||
printf("-R N_RB_DL\n");
|
printf("-R N_RB_DL\n");
|
||||||
|
printf("-t Acceptable effective throughput (in percentage)\n");
|
||||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||||
printf("-P Print ULSCH performances\n");
|
printf("-P Print ULSCH performances\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@@ -559,6 +567,7 @@ int main(int argc, char **argv)
|
|||||||
uint8_t mcs_table = 0;
|
uint8_t mcs_table = 0;
|
||||||
uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; // | PUSCH_PDU_BITMAP_PUSCH_PTRS;
|
uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; // | PUSCH_PDU_BITMAP_PUSCH_PTRS;
|
||||||
uint8_t max_rounds = 4;
|
uint8_t max_rounds = 4;
|
||||||
|
uint8_t crc_status = 0;
|
||||||
|
|
||||||
uint8_t length_dmrs = pusch_len1; // [hna] remove dmrs struct
|
uint8_t length_dmrs = pusch_len1; // [hna] remove dmrs struct
|
||||||
uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct
|
uint16_t l_prime_mask = get_l_prime(nb_symb_sch, typeB, pusch_dmrs_pos0, length_dmrs); // [hna] remove dmrs struct
|
||||||
@@ -578,17 +587,23 @@ int main(int argc, char **argv)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
//for (int i=0;i<16;i++) printf("%f\n",gaussdouble(0.0,1.0));
|
//for (int i=0;i<16;i++) printf("%f\n",gaussdouble(0.0,1.0));
|
||||||
|
snrRun = 0;
|
||||||
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
|
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
|
||||||
varArray_t *table_rx=initVarArray(1000,sizeof(double));
|
varArray_t *table_rx=initVarArray(1000,sizeof(double));
|
||||||
|
int error_flag = 0;
|
||||||
|
n_false_positive = 0;
|
||||||
|
effRate = 0;
|
||||||
|
n_errors = 0;
|
||||||
for (trial = 0; trial < n_trials; trial++) {
|
for (trial = 0; trial < n_trials; trial++) {
|
||||||
uint8_t round = 0;
|
uint8_t round = 0;
|
||||||
int error_flag;
|
|
||||||
gNB->ulsch[0][0]->harq_mask = 0;
|
|
||||||
|
|
||||||
while (round<max_rounds && !(gNB->ulsch[0][0]->harq_mask & 0x1)) {
|
crc_status = 1;
|
||||||
|
errors_scrambling = 0;
|
||||||
|
errors_decoding = 0;
|
||||||
|
while (round<max_rounds && crc_status) {
|
||||||
ulsch_ue[0]->harq_processes[harq_pid]->round = round;
|
ulsch_ue[0]->harq_processes[harq_pid]->round = round;
|
||||||
gNB->ulsch[0][0]->harq_processes[harq_pid]->round = round;
|
gNB->ulsch[0][0]->harq_processes[harq_pid]->round = round;
|
||||||
rv_index = round_rv_map[round];
|
rv_index = nr_rv_round_map[round];
|
||||||
reset_meas(&gNB->phy_proc_rx);
|
reset_meas(&gNB->phy_proc_rx);
|
||||||
reset_meas(&gNB->ulsch_decoding_stats);
|
reset_meas(&gNB->ulsch_decoding_stats);
|
||||||
reset_meas(&gNB->ulsch_deinterleaving_stats);
|
reset_meas(&gNB->ulsch_deinterleaving_stats);
|
||||||
@@ -732,7 +747,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (input_fd == NULL) {
|
if (input_fd == NULL) {
|
||||||
|
|
||||||
if (SNR==snr0) {
|
|
||||||
// set FAPI parameters for UE, put them in the scheduled response and call
|
// set FAPI parameters for UE, put them in the scheduled response and call
|
||||||
nr_ue_scheduled_response(&scheduled_response);
|
nr_ue_scheduled_response(&scheduled_response);
|
||||||
|
|
||||||
@@ -757,24 +771,14 @@ int main(int argc, char **argv)
|
|||||||
txlev_float = (double)txlev/scale; // output of signal_energy is fixed point representation
|
txlev_float = (double)txlev/scale; // output of signal_energy is fixed point representation
|
||||||
|
|
||||||
|
|
||||||
//AWGN
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else n_trials = 1;
|
else n_trials = 1;
|
||||||
|
|
||||||
|
|
||||||
sigma_dB = 10*log10(txlev_float)-SNR;
|
sigma_dB = 10*log10(txlev_float)-SNR;
|
||||||
sigma = pow(10,sigma_dB/10);
|
sigma = pow(10,sigma_dB/10);
|
||||||
printf("txlev_float %f, sigma_dB %f\n",10*log10(txlev_float),sigma_dB);
|
if(n_trials==1) printf("txlev_float %f, sigma_dB %f\n",10*log10(txlev_float),sigma_dB);
|
||||||
|
|
||||||
n_errors = 0;
|
|
||||||
n_false_positive = 0;
|
|
||||||
|
|
||||||
errors_scrambling = 0;
|
|
||||||
errors_decoding = 0;
|
|
||||||
|
|
||||||
|
|
||||||
error_flag = 0;
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
//------------------------ add noise -----------------------
|
//------------------------ add noise -----------------------
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
@@ -841,8 +845,11 @@ int main(int argc, char **argv)
|
|||||||
gNB->ulsch[0][0]->max_ldpc_iterations+1) {
|
gNB->ulsch[0][0]->max_ldpc_iterations+1) {
|
||||||
error_flag = 1;
|
error_flag = 1;
|
||||||
n_errors++;
|
n_errors++;
|
||||||
|
crc_status = 1;
|
||||||
|
} else {
|
||||||
|
crc_status = 0;
|
||||||
}
|
}
|
||||||
printf("end of round %d rv_index %d\n",round, rv_index);
|
if(n_trials==1) printf("end of round %d rv_index %d\n",round, rv_index);
|
||||||
round++;
|
round++;
|
||||||
} // round
|
} // round
|
||||||
|
|
||||||
@@ -892,12 +899,17 @@ int main(int argc, char **argv)
|
|||||||
if (n_trials==1)
|
if (n_trials==1)
|
||||||
printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in decoding = %u\n" "\x1B[0m", frame, trial, errors_decoding);
|
printf("\x1B[31m""[frame %d][trial %d]\tnumber of errors in decoding = %u\n" "\x1B[0m", frame, trial, errors_decoding);
|
||||||
}
|
}
|
||||||
|
roundStats[snrRun] += ((float)round);
|
||||||
|
if (!crc_status) effRate += ((float)TBS)/round;
|
||||||
} // trial loop
|
} // trial loop
|
||||||
|
|
||||||
|
roundStats[snrRun]/=((float)n_trials);
|
||||||
|
effRate /= n_trials;
|
||||||
|
|
||||||
printf("*****************************************\n");
|
printf("*****************************************\n");
|
||||||
printf("SNR %f: n_errors (negative CRC) = %d/%d, false_positive %d/%d, errors_scrambling %u/%u\n", SNR, n_errors, n_trials, n_false_positive, n_trials, errors_scrambling, available_bits*n_trials);
|
printf("SNR %f: n_errors (negative CRC) = %d/%d, false_positive %d/%d, errors_scrambling %u/%u\n", SNR, n_errors, n_trials, n_false_positive, n_trials, errors_scrambling, available_bits*n_trials);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("SNR %f: Channel BLER %e, Channel BER %e\n", SNR,(double)n_errors/n_trials,(double)errors_scrambling/available_bits/n_trials);
|
printf("SNR %f: Channel BLER %e, Channel BER %e Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot\n", SNR,(double)n_errors/n_trials,(double)errors_scrambling/available_bits/n_trials,roundStats[snrRun],effRate,effRate/TBS*100,TBS);
|
||||||
printf("*****************************************\n");
|
printf("*****************************************\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
@@ -925,6 +937,7 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snrRun++;
|
||||||
} // SNR loop
|
} // SNR loop
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
|||||||
@@ -405,6 +405,7 @@ typedef struct NRRrcConfigurationReq_s {
|
|||||||
NR_ServingCellConfigCommon_t *scc;
|
NR_ServingCellConfigCommon_t *scc;
|
||||||
int ssb_SubcarrierOffset;
|
int ssb_SubcarrierOffset;
|
||||||
int pdsch_AntennaPorts;
|
int pdsch_AntennaPorts;
|
||||||
|
int pusch_TargetSNRx10;
|
||||||
} gNB_RrcConfigurationReq;
|
} gNB_RrcConfigurationReq;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#define GNB_CONFIG_STRING_GNB_LIST "gNBs"
|
#define GNB_CONFIG_STRING_GNB_LIST "gNBs"
|
||||||
#define GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET "ssb_SubcarrierOffset"
|
#define GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET "ssb_SubcarrierOffset"
|
||||||
#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS "pdsch_AntennaPorts"
|
#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS "pdsch_AntennaPorts"
|
||||||
|
#define GNB_CONFIG_STRING_PUSCHTARGETPOWX10 "pusch_TargetSNRx10"
|
||||||
#define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON "servingCellConfigCommon"
|
#define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON "servingCellConfigCommon"
|
||||||
#define GNB_CONFIG_STRING_PHYSCELLID "physCellId"
|
#define GNB_CONFIG_STRING_PHYSCELLID "physCellId"
|
||||||
#define GNB_CONFIG_STRING_NTIMINGADVANCEOFFSET "n_TimingAdvanceOffset"
|
#define GNB_CONFIG_STRING_NTIMINGADVANCEOFFSET "n_TimingAdvanceOffset"
|
||||||
@@ -225,6 +226,7 @@
|
|||||||
|
|
||||||
#define SSBPARAMS_DESC {{GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET,NULL,0,iptr:&ssb_SubcarrierOffset,defintval:0,TYPE_INT,0}}
|
#define SSBPARAMS_DESC {{GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET,NULL,0,iptr:&ssb_SubcarrierOffset,defintval:0,TYPE_INT,0}}
|
||||||
#define PDSCHANTENNAPARAMS_DESC {{GNB_CONFIG_STRING_PDSCHANTENNAPORTS,NULL,0,iptr:&pdsch_AntennaPorts,defintval:1,TYPE_INT,0}}
|
#define PDSCHANTENNAPARAMS_DESC {{GNB_CONFIG_STRING_PDSCHANTENNAPORTS,NULL,0,iptr:&pdsch_AntennaPorts,defintval:1,TYPE_INT,0}}
|
||||||
|
#define TARGETPOWER_DESC {{GNB_CONFIG_STRING_PUSCHTARGETPOWX10,NULL,0,iptr:&pusch_TargetSNRx10,defintval:200,TYPE_INT,0}}
|
||||||
|
|
||||||
#define SCCPARAMS_DESC(scc) { \
|
#define SCCPARAMS_DESC(scc) { \
|
||||||
{GNB_CONFIG_STRING_PHYSCELLID,NULL,0,i64ptr:scc->physCellId,defint64val:0,TYPE_INT64,0/*0*/}, \
|
{GNB_CONFIG_STRING_PHYSCELLID,NULL,0,i64ptr:scc->physCellId,defint64val:0,TYPE_INT64,0/*0*/}, \
|
||||||
|
|||||||
@@ -522,6 +522,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
|||||||
NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(NR_ServingCellConfigCommon_t));
|
NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(NR_ServingCellConfigCommon_t));
|
||||||
int ssb_SubcarrierOffset = 31;
|
int ssb_SubcarrierOffset = 31;
|
||||||
int pdsch_AntennaPorts = 1;
|
int pdsch_AntennaPorts = 1;
|
||||||
|
int pusch_TargetSNRx10 = 200;
|
||||||
uint64_t ssb_bitmap=0xff;
|
uint64_t ssb_bitmap=0xff;
|
||||||
memset((void*)scc,0,sizeof(NR_ServingCellConfigCommon_t));
|
memset((void*)scc,0,sizeof(NR_ServingCellConfigCommon_t));
|
||||||
prepare_scc(scc);
|
prepare_scc(scc);
|
||||||
@@ -531,6 +532,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
|||||||
paramlist_def_t SSBsParamList = {GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0};
|
paramlist_def_t SSBsParamList = {GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0};
|
||||||
paramdef_t PDSCHANTENNAParams[] = PDSCHANTENNAPARAMS_DESC;
|
paramdef_t PDSCHANTENNAParams[] = PDSCHANTENNAPARAMS_DESC;
|
||||||
paramlist_def_t PDSCHANTENNAParamList = {GNB_CONFIG_STRING_PDSCHANTENNAPORTS, NULL, 0};
|
paramlist_def_t PDSCHANTENNAParamList = {GNB_CONFIG_STRING_PDSCHANTENNAPORTS, NULL, 0};
|
||||||
|
paramdef_t PUSCHTARGETPOWParams[] = TARGETPOWER_DESC;
|
||||||
|
paramlist_def_t PUSCHTARGETPOWParamList = {GNB_CONFIG_STRING_PDSCHANTENNAPORTS, NULL, 0};
|
||||||
////////// Physical parameters
|
////////// Physical parameters
|
||||||
|
|
||||||
|
|
||||||
@@ -585,6 +588,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
|||||||
config_getlist(&PDSCHANTENNAParamList, NULL, 0, aprefix);
|
config_getlist(&PDSCHANTENNAParamList, NULL, 0, aprefix);
|
||||||
if (PDSCHANTENNAParamList.numelt > 0) config_get(PDSCHANTENNAParams,sizeof(PDSCHANTENNAParams)/sizeof(paramdef_t),aprefix);
|
if (PDSCHANTENNAParamList.numelt > 0) config_get(PDSCHANTENNAParams,sizeof(PDSCHANTENNAParams)/sizeof(paramdef_t),aprefix);
|
||||||
|
|
||||||
|
config_getlist(&PUSCHTARGETPOWParamList, NULL, 0, aprefix);
|
||||||
|
if (PUSCHTARGETPOWParamList.numelt > 0) config_get(PUSCHTARGETPOWParams,sizeof(PUSCHTARGETPOWParams)/sizeof(paramdef_t),aprefix);
|
||||||
|
|
||||||
config_getlist(&SCCsParamList, NULL, 0, aprefix);
|
config_getlist(&SCCsParamList, NULL, 0, aprefix);
|
||||||
if (SCCsParamList.numelt > 0) {
|
if (SCCsParamList.numelt > 0) {
|
||||||
@@ -668,6 +673,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
|
|||||||
NRRRC_CONFIGURATION_REQ (msg_p).ssb_SubcarrierOffset = ssb_SubcarrierOffset;
|
NRRRC_CONFIGURATION_REQ (msg_p).ssb_SubcarrierOffset = ssb_SubcarrierOffset;
|
||||||
printf("pdsch_AntennaPorts %d\n",pdsch_AntennaPorts);
|
printf("pdsch_AntennaPorts %d\n",pdsch_AntennaPorts);
|
||||||
NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts = pdsch_AntennaPorts;
|
NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts = pdsch_AntennaPorts;
|
||||||
|
printf("pusch_TargetSNRx10 %d\n",pusch_TargetSNRx10);
|
||||||
|
NRRRC_CONFIGURATION_REQ (msg_p).pusch_TargetSNRx10 = pusch_TargetSNRx10;
|
||||||
NRRRC_CONFIGURATION_REQ (msg_p).scc = scc;
|
NRRRC_CONFIGURATION_REQ (msg_p).scc = scc;
|
||||||
|
|
||||||
}//
|
}//
|
||||||
|
|||||||
@@ -328,11 +328,11 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
|
|||||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||||
int ssb_SubcarrierOffset,
|
int ssb_SubcarrierOffset,
|
||||||
int pdsch_AntennaPorts,
|
int pdsch_AntennaPorts,
|
||||||
|
int pusch_tgt_snrx10,
|
||||||
NR_ServingCellConfigCommon_t *scc,
|
NR_ServingCellConfigCommon_t *scc,
|
||||||
int add_ue,
|
int add_ue,
|
||||||
uint32_t rnti,
|
uint32_t rnti,
|
||||||
NR_CellGroupConfig_t *secondaryCellGroup
|
NR_CellGroupConfig_t *secondaryCellGroup){
|
||||||
){
|
|
||||||
|
|
||||||
if (scc != NULL ) {
|
if (scc != NULL ) {
|
||||||
AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present);
|
AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present);
|
||||||
@@ -353,6 +353,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RC.nrmac[Mod_idP]->pusch_target_snrx10 = pusch_tgt_snrx10;
|
||||||
|
|
||||||
NR_PHY_Config_t phycfg;
|
NR_PHY_Config_t phycfg;
|
||||||
phycfg.Mod_id = Mod_idP;
|
phycfg.Mod_id = Mod_idP;
|
||||||
|
|||||||
@@ -53,7 +53,10 @@
|
|||||||
#include "NR_SearchSpace.h"
|
#include "NR_SearchSpace.h"
|
||||||
#include "NR_ControlResourceSet.h"
|
#include "NR_ControlResourceSet.h"
|
||||||
|
|
||||||
|
//#define UL_HARQ_PRINT
|
||||||
extern RAN_CONTEXT_t RC;
|
extern RAN_CONTEXT_t RC;
|
||||||
|
|
||||||
|
const uint8_t nr_rv_round_map[4] = {0, 2, 1, 3};
|
||||||
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
|
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
|
||||||
|
|
||||||
//uint8_t mac_pdu[MAX_NR_DLSCH_PAYLOAD_BYTES];
|
//uint8_t mac_pdu[MAX_NR_DLSCH_PAYLOAD_BYTES];
|
||||||
@@ -270,7 +273,6 @@ int configure_fapi_dl_pdu(int Mod_idP,
|
|||||||
int TBS;
|
int TBS;
|
||||||
int bwp_id=1;
|
int bwp_id=1;
|
||||||
int UE_id = 0;
|
int UE_id = 0;
|
||||||
uint8_t rv_round_map[4] = {0, 2, 3, 1};
|
|
||||||
|
|
||||||
NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list;
|
NR_UE_list_t *UE_list = &RC.nrmac[Mod_idP]->UE_list;
|
||||||
|
|
||||||
@@ -316,7 +318,7 @@ int configure_fapi_dl_pdu(int Mod_idP,
|
|||||||
pdsch_pdu_rel15->qamModOrder[0] = 2;
|
pdsch_pdu_rel15->qamModOrder[0] = 2;
|
||||||
pdsch_pdu_rel15->mcsIndex[0] = mcs;
|
pdsch_pdu_rel15->mcsIndex[0] = mcs;
|
||||||
pdsch_pdu_rel15->mcsTable[0] = 0;
|
pdsch_pdu_rel15->mcsTable[0] = 0;
|
||||||
pdsch_pdu_rel15->rvIndex[0] = (get_softmodem_params()->phy_test==1) ? 0 : rv_round_map[UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round];
|
pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[UE_list->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid].round];
|
||||||
pdsch_pdu_rel15->dataScramblingId = *scc->physCellId;
|
pdsch_pdu_rel15->dataScramblingId = *scc->physCellId;
|
||||||
pdsch_pdu_rel15->nrOfLayers = 1;
|
pdsch_pdu_rel15->nrOfLayers = 1;
|
||||||
pdsch_pdu_rel15->transmissionScheme = 0;
|
pdsch_pdu_rel15->transmissionScheme = 0;
|
||||||
@@ -476,7 +478,7 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,
|
|||||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||||
int *dci_formats, int *rnti_types,
|
int *dci_formats, int *rnti_types,
|
||||||
int time_domain_assignment,
|
int time_domain_assignment, uint8_t tpc,
|
||||||
int n_ubwp, int bwp_id) {
|
int n_ubwp, int bwp_id) {
|
||||||
|
|
||||||
switch(dci_formats[(pdcch_pdu_rel15->numDlDci)-1]) {
|
switch(dci_formats[(pdcch_pdu_rel15->numDlDci)-1]) {
|
||||||
@@ -518,7 +520,7 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,
|
|||||||
// mcs
|
// mcs
|
||||||
dci_pdu_rel15->mcs = pusch_pdu->mcs_index;
|
dci_pdu_rel15->mcs = pusch_pdu->mcs_index;
|
||||||
// tpc command for pusch
|
// tpc command for pusch
|
||||||
dci_pdu_rel15->tpc = 1; //TODO
|
dci_pdu_rel15->tpc = tpc;
|
||||||
// SRS resource indicator
|
// SRS resource indicator
|
||||||
if (ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig != NULL) {
|
if (ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig != NULL) {
|
||||||
if (*ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig == NR_PUSCH_Config__txConfig_codebook)
|
if (*ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig == NR_PUSCH_Config__txConfig_codebook)
|
||||||
@@ -767,6 +769,33 @@ void nr_schedule_uss_dlsch_phytest(module_id_t module_idP,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t select_ul_harq_pid(NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||||
|
|
||||||
|
uint8_t hrq_id;
|
||||||
|
uint8_t max_ul_harq_pids = 3; // temp: for testing
|
||||||
|
// schedule active harq processes
|
||||||
|
NR_UE_ul_harq_t cur_harq;
|
||||||
|
for (hrq_id=0; hrq_id < max_ul_harq_pids; hrq_id++) {
|
||||||
|
cur_harq = sched_ctrl->ul_harq_processes[hrq_id];
|
||||||
|
if (cur_harq.state==ACTIVE_NOT_SCHED) {
|
||||||
|
#ifdef UL_HARQ_PRINT
|
||||||
|
printf("[SCHED] Found ulharq id %d, scheduling it for retransmission\n",hrq_id);
|
||||||
|
#endif
|
||||||
|
return hrq_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// schedule new harq processes
|
||||||
|
for (hrq_id=0; hrq_id < max_ul_harq_pids; hrq_id++) {
|
||||||
|
cur_harq = sched_ctrl->ul_harq_processes[hrq_id];
|
||||||
|
if (cur_harq.state==INACTIVE) {
|
||||||
|
#ifdef UL_HARQ_PRINT
|
||||||
|
printf("[SCHED] Found new ulharq id %d, scheduling it\n",hrq_id);
|
||||||
|
#endif
|
||||||
|
return hrq_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void schedule_fapi_ul_pdu(int Mod_idP,
|
void schedule_fapi_ul_pdu(int Mod_idP,
|
||||||
frame_t frameP,
|
frame_t frameP,
|
||||||
@@ -970,10 +999,14 @@ void schedule_fapi_ul_pdu(int Mod_idP,
|
|||||||
|
|
||||||
//Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2]
|
//Pusch Allocation in frequency domain [TS38.214, sec 6.1.2.2]
|
||||||
//Optional Data only included if indicated in pduBitmap
|
//Optional Data only included if indicated in pduBitmap
|
||||||
// TODO from harq function as in pdsch
|
uint8_t harq_id = select_ul_harq_pid(&UE_list->UE_sched_ctrl[UE_id]);
|
||||||
pusch_pdu->pusch_data.rv_index = 0;
|
NR_UE_ul_harq_t *cur_harq = &UE_list->UE_sched_ctrl[UE_id].ul_harq_processes[harq_id];
|
||||||
pusch_pdu->pusch_data.harq_process_id = 0;
|
pusch_pdu->pusch_data.harq_process_id = harq_id;
|
||||||
pusch_pdu->pusch_data.new_data_indicator = 1;
|
pusch_pdu->pusch_data.new_data_indicator = cur_harq->ndi;
|
||||||
|
pusch_pdu->pusch_data.rv_index = nr_rv_round_map[cur_harq->round];
|
||||||
|
|
||||||
|
cur_harq->state = ACTIVE_SCHED;
|
||||||
|
cur_harq->last_tx_slot = pusch_sched->slot;
|
||||||
|
|
||||||
uint8_t num_dmrs_symb = 0;
|
uint8_t num_dmrs_symb = 0;
|
||||||
|
|
||||||
@@ -1060,7 +1093,7 @@ void schedule_fapi_ul_pdu(int Mod_idP,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dci_pdu_rel15_t *dci_pdu_rel15 = calloc(MAX_DCI_CORESET,sizeof(dci_pdu_rel15_t));
|
dci_pdu_rel15_t *dci_pdu_rel15 = calloc(MAX_DCI_CORESET,sizeof(dci_pdu_rel15_t));
|
||||||
config_uldci(ubwp,pusch_pdu,pdcch_pdu_rel15,&dci_pdu_rel15[0],dci_formats,rnti_types,time_domain_assignment,n_ubwp,bwp_id);
|
config_uldci(ubwp,pusch_pdu,pdcch_pdu_rel15,&dci_pdu_rel15[0],dci_formats,rnti_types,time_domain_assignment,UE_list->UE_sched_ctrl[UE_id].tpc0,n_ubwp,bwp_id);
|
||||||
fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pusch_pdu->bwp_size,bwp_id);
|
fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pusch_pdu->bwp_size,bwp_id);
|
||||||
free(dci_pdu_rel15);
|
free(dci_pdu_rel15);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1485,6 +1485,18 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP){
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) {
|
||||||
|
// al values passed to this function are x10
|
||||||
|
|
||||||
|
int snrx10 = (cqi*5) - 640;
|
||||||
|
if (snrx10 > target + incr) return 0; // decrease 1dB
|
||||||
|
if (snrx10 < target - incr) return 2; // increase 1dB
|
||||||
|
if (snrx10 < target - (3*incr)) return 3; // increase 3dB
|
||||||
|
return 1; // no change
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void get_pdsch_to_harq_feedback(int Mod_idP,
|
void get_pdsch_to_harq_feedback(int Mod_idP,
|
||||||
int UE_id,
|
int UE_id,
|
||||||
NR_SearchSpace__searchSpaceType_PR ss_type,
|
NR_SearchSpace__searchSpaceType_PR ss_type,
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti);
|
UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti);
|
||||||
gNB_mac = RC.nrmac[gnb_mod_idP];
|
gNB_mac = RC.nrmac[gnb_mod_idP];
|
||||||
UE_list = &gNB_mac->UE_list;
|
UE_list = &gNB_mac->UE_list;
|
||||||
|
int target_snrx10 = gNB_mac->pusch_target_snrx10;
|
||||||
|
|
||||||
if (UE_id != -1) {
|
if (UE_id != -1) {
|
||||||
UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]);
|
UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]);
|
||||||
@@ -310,7 +311,9 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sduP != NULL){
|
if (sduP != NULL){
|
||||||
|
UE_scheduling_control->tpc0 = nr_get_tpc(target_snrx10,ul_cqi,30);
|
||||||
UE_scheduling_control->ta_update = timing_advance;
|
UE_scheduling_control->ta_update = timing_advance;
|
||||||
|
LOG_I(MAC, "[UE %d] PUSCH TPC %d and TA %d\n",UE_id,UE_scheduling_control->tpc0,UE_scheduling_control->ta_update);
|
||||||
LOG_D(MAC, "Received PDU at MAC gNB \n");
|
LOG_D(MAC, "Received PDU at MAC gNB \n");
|
||||||
nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP);
|
nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ void config_common(int Mod_idP,
|
|||||||
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||||
int ssb_SubcarrierOffset,
|
int ssb_SubcarrierOffset,
|
||||||
int pdsch_AntennaPorts,
|
int pdsch_AntennaPorts,
|
||||||
|
int tgt_snrx10,
|
||||||
NR_ServingCellConfigCommon_t *scc,
|
NR_ServingCellConfigCommon_t *scc,
|
||||||
int nsa_flag,
|
int nsa_flag,
|
||||||
uint32_t rnti,
|
uint32_t rnti,
|
||||||
@@ -137,7 +138,7 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,
|
|||||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||||
int *dci_formats, int *rnti_types,
|
int *dci_formats, int *rnti_types,
|
||||||
int time_domain_assignment,
|
int time_domain_assignment, uint8_t tpc,
|
||||||
int n_ubwp, int bwp_id);
|
int n_ubwp, int bwp_id);
|
||||||
|
|
||||||
void configure_fapi_dl_Tx(module_id_t Mod_idP,
|
void configure_fapi_dl_Tx(module_id_t Mod_idP,
|
||||||
@@ -228,6 +229,8 @@ void find_aggregation_candidates(uint8_t *aggregation_level,
|
|||||||
uint8_t *nr_of_candidates,
|
uint8_t *nr_of_candidates,
|
||||||
NR_SearchSpace_t *ss);
|
NR_SearchSpace_t *ss);
|
||||||
|
|
||||||
|
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr);
|
||||||
|
|
||||||
int get_spf(nfapi_nr_config_request_scf_t *cfg);
|
int get_spf(nfapi_nr_config_request_scf_t *cfg);
|
||||||
|
|
||||||
int to_absslot(nfapi_nr_config_request_scf_t *cfg,int frame,int slot);
|
int to_absslot(nfapi_nr_config_request_scf_t *cfg,int frame,int slot);
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ void mac_top_init_gNB(void)
|
|||||||
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].round = 0;
|
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].round = 0;
|
||||||
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].ndi = 0;
|
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].ndi = 0;
|
||||||
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].is_waiting = 0;
|
UE_list->UE_sched_ctrl[list_el].harq_processes[list_harq].is_waiting = 0;
|
||||||
|
UE_list->UE_sched_ctrl[list_el].ul_harq_processes[list_harq].round = 0;
|
||||||
|
UE_list->UE_sched_ctrl[list_el].ul_harq_processes[list_harq].ndi = 0;
|
||||||
|
UE_list->UE_sched_ctrl[list_el].ul_harq_processes[list_harq].state = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -267,6 +267,19 @@ typedef struct NR_UE_harq {
|
|||||||
uint16_t feedback_slot;
|
uint16_t feedback_slot;
|
||||||
} NR_UE_harq_t;
|
} NR_UE_harq_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
INACTIVE = 0,
|
||||||
|
ACTIVE_NOT_SCHED,
|
||||||
|
ACTIVE_SCHED
|
||||||
|
} NR_UL_harq_states_t;
|
||||||
|
|
||||||
|
typedef struct NR_UE_ul_harq {
|
||||||
|
uint8_t ndi;
|
||||||
|
uint8_t round;
|
||||||
|
uint16_t last_tx_slot;
|
||||||
|
NR_UL_harq_states_t state;
|
||||||
|
} NR_UE_ul_harq_t;
|
||||||
|
|
||||||
/*! \brief scheduling control information set through an API */
|
/*! \brief scheduling control information set through an API */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t dlsch_in_slot_bitmap; // static bitmap signaling which slot in a tdd period contains dlsch
|
uint64_t dlsch_in_slot_bitmap; // static bitmap signaling which slot in a tdd period contains dlsch
|
||||||
@@ -275,8 +288,11 @@ typedef struct {
|
|||||||
NR_sched_pusch *sched_pusch;
|
NR_sched_pusch *sched_pusch;
|
||||||
uint16_t ta_timer;
|
uint16_t ta_timer;
|
||||||
int16_t ta_update;
|
int16_t ta_update;
|
||||||
|
uint8_t tpc0;
|
||||||
|
uint8_t tpc1;
|
||||||
uint8_t current_harq_pid;
|
uint8_t current_harq_pid;
|
||||||
NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES];
|
NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES];
|
||||||
|
NR_UE_ul_harq_t ul_harq_processes[NR_MAX_NB_HARQ_PROCESSES];
|
||||||
int dummy;
|
int dummy;
|
||||||
NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl;// MAC CE related information
|
NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl;// MAC CE related information
|
||||||
} NR_UE_sched_ctrl_t;
|
} NR_UE_sched_ctrl_t;
|
||||||
@@ -321,6 +337,8 @@ typedef struct gNB_MAC_INST_s {
|
|||||||
NR_TAG_t *tag;
|
NR_TAG_t *tag;
|
||||||
/// Pointer to IF module instance for PHY
|
/// Pointer to IF module instance for PHY
|
||||||
NR_IF_Module_t *if_inst;
|
NR_IF_Module_t *if_inst;
|
||||||
|
/// Pusch target SNR
|
||||||
|
int pusch_target_snrx10;
|
||||||
/// TA command
|
/// TA command
|
||||||
int ta_command;
|
int ta_command;
|
||||||
/// MAC CE flag indicating TA length
|
/// MAC CE flag indicating TA length
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
|
|
||||||
#define MAX_IF_MODULES 100
|
#define MAX_IF_MODULES 100
|
||||||
|
//#define UL_HARQ_PRINT
|
||||||
|
|
||||||
NR_IF_Module_t *if_inst[MAX_IF_MODULES];
|
NR_IF_Module_t *if_inst[MAX_IF_MODULES];
|
||||||
NR_Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs];
|
NR_Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs];
|
||||||
@@ -88,7 +89,7 @@ void handle_nr_uci(NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl) {
|
|||||||
case NFAPI_NR_UCI_PDCCH_PDU_TYPE: break;
|
case NFAPI_NR_UCI_PDCCH_PDU_TYPE: break;
|
||||||
|
|
||||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
|
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
|
||||||
if (get_softmodem_params()->phy_test == 0) {
|
//if (get_softmodem_params()->phy_test == 0) {
|
||||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &uci_list[i].pucch_pdu_format_0_1;
|
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &uci_list[i].pucch_pdu_format_0_1;
|
||||||
// handle harq
|
// handle harq
|
||||||
int harq_idx_s = 0;
|
int harq_idx_s = 0;
|
||||||
@@ -120,7 +121,7 @@ void handle_nr_uci(NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,8 +132,43 @@ void handle_nr_uci(NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl) {
|
|||||||
UL_info->uci_ind.num_ucis = 0;
|
UL_info->uci_ind.num_ucis = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handle_nr_ul_harq(uint16_t slot, NR_UE_sched_ctrl_t *sched_ctrl, uint8_t crc_status) {
|
||||||
|
|
||||||
void handle_nr_ulsch(NR_UL_IND_t *UL_info) {
|
int max_harq_rounds = 4; // TODO define macro
|
||||||
|
for (uint8_t hrq_id = 0; hrq_id < NR_MAX_NB_HARQ_PROCESSES; hrq_id++) {
|
||||||
|
NR_UE_ul_harq_t *cur_harq = &sched_ctrl->ul_harq_processes[hrq_id];
|
||||||
|
if ((cur_harq->last_tx_slot == slot-1) && cur_harq->state==ACTIVE_SCHED) {
|
||||||
|
if (!crc_status) {
|
||||||
|
cur_harq->ndi ^= 1;
|
||||||
|
cur_harq->round = 0;
|
||||||
|
cur_harq->state = INACTIVE; // passed -> make inactive. can be used by scheduder for next grant
|
||||||
|
#ifdef UL_HARQ_PRINT
|
||||||
|
printf("[HARQ HANDLER] Ulharq id %d crc passed, freeing it for scheduler\n",hrq_id);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
cur_harq->round++;
|
||||||
|
cur_harq->state = ACTIVE_NOT_SCHED;
|
||||||
|
#ifdef UL_HARQ_PRINT
|
||||||
|
printf("[HARQ HANDLER] Ulharq id %d crc failed, requesting retransmission\n",hrq_id);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(cur_harq->round<max_harq_rounds)) {
|
||||||
|
cur_harq->ndi ^= 1;
|
||||||
|
cur_harq->state = INACTIVE; // failed after 4 rounds -> make inactive
|
||||||
|
cur_harq->round = 0;
|
||||||
|
#ifdef UL_HARQ_PRINT
|
||||||
|
printf("[HARQ HANDLER] Ulharq id %d crc failed in all round, freeing it for scheduler\n",hrq_id);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void handle_nr_ulsch(NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||||
if(nfapi_mode == 1) {
|
if(nfapi_mode == 1) {
|
||||||
if (UL_info->crc_ind.number_crcs>0) {
|
if (UL_info->crc_ind.number_crcs>0) {
|
||||||
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
|
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
|
||||||
@@ -159,6 +195,8 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) {
|
|||||||
UL_info->rx_ind.pdu_list[i].rnti) {
|
UL_info->rx_ind.pdu_list[i].rnti) {
|
||||||
LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_list[j].tb_crc_status);
|
LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_list[j].tb_crc_status);
|
||||||
|
|
||||||
|
handle_nr_ul_harq(UL_info->slot, sched_ctrl, UL_info->crc_ind.crc_list[j].tb_crc_status);
|
||||||
|
|
||||||
if (UL_info->crc_ind.crc_list[j].tb_crc_status == 1) { // CRC error indication
|
if (UL_info->crc_ind.crc_list[j].tb_crc_status == 1) { // CRC error indication
|
||||||
LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->slot);
|
LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->slot);
|
||||||
|
|
||||||
@@ -233,7 +271,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
|
|||||||
handle_nr_uci(UL_info, &mac->UE_list.UE_sched_ctrl[0]);
|
handle_nr_uci(UL_info, &mac->UE_list.UE_sched_ctrl[0]);
|
||||||
// clear HI prior to handling ULSCH
|
// clear HI prior to handling ULSCH
|
||||||
mac->UL_dci_req[CC_id].numPdus = 0;
|
mac->UL_dci_req[CC_id].numPdus = 0;
|
||||||
handle_nr_ulsch(UL_info);
|
handle_nr_ulsch(UL_info, &mac->UE_list.UE_sched_ctrl[0]);
|
||||||
|
|
||||||
if (nfapi_mode != 1) {
|
if (nfapi_mode != 1) {
|
||||||
if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) {
|
if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) {
|
||||||
|
|||||||
@@ -379,6 +379,7 @@ typedef struct {
|
|||||||
NR_BCCH_BCH_Message_t mib;
|
NR_BCCH_BCH_Message_t mib;
|
||||||
int ssb_SubcarrierOffset;
|
int ssb_SubcarrierOffset;
|
||||||
int pdsch_AntennaPorts;
|
int pdsch_AntennaPorts;
|
||||||
|
int pusch_TargetSNRx10;
|
||||||
NR_BCCH_DL_SCH_Message_t *siblock1;
|
NR_BCCH_DL_SCH_Message_t *siblock1;
|
||||||
NR_ServingCellConfigCommon_t *servingcellconfigcommon;
|
NR_ServingCellConfigCommon_t *servingcellconfigcommon;
|
||||||
NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS];
|
NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS];
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc) {
|
|||||||
rrc_mac_config_req_gNB(rrc->module_id,
|
rrc_mac_config_req_gNB(rrc->module_id,
|
||||||
rrc->carrier.ssb_SubcarrierOffset,
|
rrc->carrier.ssb_SubcarrierOffset,
|
||||||
rrc->carrier.pdsch_AntennaPorts,
|
rrc->carrier.pdsch_AntennaPorts,
|
||||||
|
rrc->carrier.pusch_TargetSNRx10,
|
||||||
(NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon,
|
(NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon,
|
||||||
0,
|
0,
|
||||||
0, // WIP hardcoded rnti
|
0, // WIP hardcoded rnti
|
||||||
@@ -265,6 +266,7 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
|
|||||||
rrc->carrier.servingcellconfigcommon = configuration->scc;
|
rrc->carrier.servingcellconfigcommon = configuration->scc;
|
||||||
rrc->carrier.ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset;
|
rrc->carrier.ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset;
|
||||||
rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts;
|
rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts;
|
||||||
|
rrc->carrier.pusch_TargetSNRx10 = configuration->pusch_TargetSNRx10;
|
||||||
/// System Information INIT
|
/// System Information INIT
|
||||||
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Checking release \n",PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt));
|
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Checking release \n",PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt));
|
||||||
init_NR_SI(rrc);
|
init_NR_SI(rrc);
|
||||||
|
|||||||
@@ -261,6 +261,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
|
|||||||
rrc_mac_config_req_gNB(rrc->module_id,
|
rrc_mac_config_req_gNB(rrc->module_id,
|
||||||
rrc->carrier.ssb_SubcarrierOffset,
|
rrc->carrier.ssb_SubcarrierOffset,
|
||||||
rrc->carrier.pdsch_AntennaPorts,
|
rrc->carrier.pdsch_AntennaPorts,
|
||||||
|
rrc->carrier.pusch_TargetSNRx10,
|
||||||
NULL,
|
NULL,
|
||||||
1, // add_ue flag
|
1, // add_ue flag
|
||||||
ue_context_p->ue_id_rnti,
|
ue_context_p->ue_id_rnti,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ gNBs =
|
|||||||
|
|
||||||
ssb_SubcarrierOffset = 31; //0;
|
ssb_SubcarrierOffset = 31; //0;
|
||||||
pdsch_AntennaPorts = 1;
|
pdsch_AntennaPorts = 1;
|
||||||
|
pusch_TargetSNRx10 = 200;
|
||||||
|
|
||||||
servingCellConfigCommon = (
|
servingCellConfigCommon = (
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user