Merge remote-tracking branch 'origin/NR_RRCConfiguration_FR2' into integration_2020_wk45_2
This commit is contained in:
@@ -233,6 +233,20 @@ uint32_t get_samples_per_slot(int slot, NR_DL_FRAME_PARMS* fp)
|
||||
return samp_count;
|
||||
}
|
||||
|
||||
|
||||
uint32_t get_slot_from_timestamp(openair0_timestamp timestamp_rx, NR_DL_FRAME_PARMS* fp)
|
||||
{
|
||||
uint32_t slot_idx = 0;
|
||||
int samples_till_the_slot = 0;
|
||||
timestamp_rx = timestamp_rx%fp->samples_per_frame;
|
||||
|
||||
while (timestamp_rx > samples_till_the_slot) {
|
||||
samples_till_the_slot += fp->get_samples_per_slot(slot_idx,fp);
|
||||
slot_idx++;
|
||||
}
|
||||
return slot_idx;
|
||||
}
|
||||
|
||||
uint32_t get_samples_slot_timestamp(int slot, NR_DL_FRAME_PARMS* fp, uint8_t sl_ahead)
|
||||
{
|
||||
uint32_t samp_count = 0;
|
||||
@@ -289,6 +303,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
|
||||
(fp->nb_prefix_samples + fp->ofdm_symbol_size) * (fp->symbols_per_slot * fp->slots_per_subframe - 2);
|
||||
fp->get_samples_per_slot = &get_samples_per_slot;
|
||||
fp->get_samples_slot_timestamp = &get_samples_slot_timestamp;
|
||||
fp->get_slot_from_timestamp = &get_slot_from_timestamp;
|
||||
fp->samples_per_frame = 10 * fp->samples_per_subframe;
|
||||
fp->freq_range = (fp->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
|
||||
|
||||
|
||||
@@ -506,10 +506,10 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp,uint64_t CarrierFreq) {
|
||||
|
||||
const int nsymb = fp->symbols_per_slot * fp->slots_per_frame/10;
|
||||
const double Tc=(1/480e3/4096);
|
||||
const double Nu=2048*64*.5;
|
||||
const double Nu=2048*64*(1/(float)(1<<fp->numerology_index));
|
||||
const double f0= (double)CarrierFreq;
|
||||
const double Ncp0=16*64 + (144*64*.5);
|
||||
const double Ncp1=(144*64*.5);
|
||||
const double Ncp0=16*64 + (144*64*(1/(float)(1<<fp->numerology_index)));
|
||||
const double Ncp1=(144*64*(1/(float)(1<<fp->numerology_index)));
|
||||
double tl=0,poff,exp_re,exp_im;
|
||||
double Ncp,Ncpm1=Ncp0;
|
||||
|
||||
|
||||
@@ -483,9 +483,15 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
|
||||
dft(dftsize,(int16_t *)&tmp_dft_in,
|
||||
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
|
||||
}
|
||||
else
|
||||
dft(dftsize,(int16_t *)&rxdata[rxdata_offset-sample_offset],
|
||||
else {
|
||||
//dft(dftsize,(int16_t *)&rxdata[rxdata_offset-sample_offset],
|
||||
// (int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
|
||||
memcpy((void *)tmp_dft_in,
|
||||
(void *) &rxdata[rxdata_offset-sample_offset],
|
||||
(frame_parms->ofdm_symbol_size)*sizeof(int));
|
||||
dft(dftsize,(int16_t *)&tmp_dft_in,
|
||||
(int16_t *)&rxdataF[symbol * frame_parms->ofdm_symbol_size], 1);
|
||||
}
|
||||
|
||||
// clear DC carrier from OFDM symbols
|
||||
rxdataF[symbol * frame_parms->ofdm_symbol_size] = 0;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
|
||||
//#define DEBUG_PBCH 1
|
||||
//#define DEBUG_PBCH
|
||||
//#define DEBUG_PBCH_ENCODING
|
||||
|
||||
#ifdef OPENAIR2
|
||||
@@ -61,7 +61,8 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
int nushiftmod4 = frame_parms->nushift;
|
||||
unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier; //and
|
||||
|
||||
if (rx_offset>= frame_parms->ofdm_symbol_size) rx_offset-=frame_parms->ofdm_symbol_size;
|
||||
// if (rx_offset>= frame_parms->ofdm_symbol_size) rx_offset-=frame_parms->ofdm_symbol_size;
|
||||
rx_offset=(rx_offset)%(frame_parms->ofdm_symbol_size);
|
||||
|
||||
AssertFatal(symbol>=1 && symbol<5,
|
||||
"symbol %d illegal for PBCH extraction\n",
|
||||
@@ -103,8 +104,8 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
j++;
|
||||
}
|
||||
|
||||
//rx_offset=(rx_offset+1)&(frame_parms->ofdm_symbol_size-1);
|
||||
rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
|
||||
rx_offset=(rx_offset+1)%(frame_parms->ofdm_symbol_size);
|
||||
//rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
|
||||
}
|
||||
|
||||
rxF_ext+=9;
|
||||
@@ -126,12 +127,14 @@ uint16_t nr_pbch_extract(int **rxdataF,
|
||||
j++;
|
||||
}
|
||||
|
||||
//rx_offset=(rx_offset+1)&(frame_parms->ofdm_symbol_size-1);
|
||||
rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
|
||||
rx_offset=(rx_offset+1)%(frame_parms->ofdm_symbol_size);
|
||||
//rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 1) : (rx_offset+1);
|
||||
}
|
||||
|
||||
rxF_ext+=9;
|
||||
} else rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 12) : (rx_offset+12);//rx_offset = (rx_offset+12)&(frame_parms->ofdm_symbol_size-1);
|
||||
} else{ //rx_offset = (rx_offset >= frame_parms->ofdm_symbol_size) ? (rx_offset - frame_parms->ofdm_symbol_size + 12) : (rx_offset+12);
|
||||
rx_offset = (rx_offset+12)%(frame_parms->ofdm_symbol_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -236,6 +236,7 @@ typedef struct {
|
||||
typedef struct NR_DL_FRAME_PARMS NR_DL_FRAME_PARMS;
|
||||
|
||||
typedef uint32_t (*get_samples_per_slot_t)(int slot, NR_DL_FRAME_PARMS* fp);
|
||||
typedef uint32_t (*get_slot_from_timestamp_t)(openair0_timestamp timestamp_rx, NR_DL_FRAME_PARMS* fp);
|
||||
|
||||
typedef uint32_t (*get_samples_slot_timestamp_t)(int slot, NR_DL_FRAME_PARMS* fp, uint8_t sl_ahead);
|
||||
|
||||
@@ -292,6 +293,8 @@ struct NR_DL_FRAME_PARMS {
|
||||
uint32_t samples_per_subframe;
|
||||
/// Number of samples in current slot
|
||||
get_samples_per_slot_t get_samples_per_slot;
|
||||
/// slot calculation from timestamp
|
||||
get_slot_from_timestamp_t get_slot_from_timestamp;
|
||||
/// Number of samples before slot
|
||||
get_samples_slot_timestamp_t get_samples_slot_timestamp;
|
||||
/// Number of samples in 0th and center slot of a subframe
|
||||
|
||||
@@ -380,7 +380,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
||||
case 245: timing_advance_update /= 32; break;
|
||||
case 273: timing_advance_update /= 32; break;
|
||||
case 66: timing_advance_update /= 12; break;
|
||||
default: abort();
|
||||
case 32: timing_advance_update /= 12; break;
|
||||
default: AssertFatal(0==1,"No case defined for PRB %d to calculate timing_advance_update\n",gNB->frame_parms.N_RB_DL);
|
||||
}
|
||||
|
||||
// put timing advance command in 0..63 range
|
||||
|
||||
@@ -388,6 +388,7 @@ void set_tx_harq_id(NR_UE_ULSCH_t *ulsch, int harq_pid, int slot_tx);
|
||||
int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
|
||||
|
||||
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
||||
int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
@@ -356,6 +356,16 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
|
||||
} else {
|
||||
LOG_E(PHY,"[UE %d] frame %d, nr_tti_rx %d, Error decoding PBCH!\n",
|
||||
ue->Mod_id,frame_rx, nr_tti_rx);
|
||||
/*FILE *fd;
|
||||
if ((fd = fopen("rxsig_frame0.dat","w")) != NULL) {
|
||||
fwrite((void *)&ue->common_vars.rxdata[0][0],
|
||||
sizeof(int32_t),
|
||||
ue->frame_parms.samples_per_frame,
|
||||
fd);
|
||||
LOG_I(PHY,"Dummping Frame ... bye bye \n");
|
||||
fclose(fd);
|
||||
exit(0);
|
||||
}*/
|
||||
|
||||
/*
|
||||
write_output("rxsig0.m","rxs0", ue->common_vars.rxdata[0],ue->frame_parms.samples_per_subframe,1,1);
|
||||
@@ -1614,6 +1624,59 @@ void *UE_thread_slot1_dl_processing(void *arg) {
|
||||
}
|
||||
#endif
|
||||
|
||||
int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp)
|
||||
{
|
||||
int mu = fp->numerology_index;
|
||||
//uint8_t half_frame_index = fp->half_frame_bit;
|
||||
//uint8_t i_ssb = fp->ssb_index;
|
||||
uint8_t Lmax = fp->Lmax;
|
||||
|
||||
if (!(frame%(1<<(config->ssb_table.ssb_period-1)))){
|
||||
|
||||
if(Lmax <= 8) {
|
||||
if(slot <=3 && (((config->ssb_table.ssb_mask_list[0].ssb_mask << 2*slot)&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[0].ssb_mask << (2*slot +1))&0x80000000) == 0x80000000))
|
||||
return 1;
|
||||
else return 0;
|
||||
|
||||
}
|
||||
else if(Lmax == 64) {
|
||||
if (mu == NR_MU_3){
|
||||
|
||||
if (slot>=0 && slot <= 7){
|
||||
if(((config->ssb_table.ssb_mask_list[0].ssb_mask << 2*slot)&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[0].ssb_mask << (2*slot +1))&0x80000000) == 0x80000000)
|
||||
return 1;
|
||||
else return 0;
|
||||
}
|
||||
else if (slot>=10 && slot <=17){
|
||||
if(((config->ssb_table.ssb_mask_list[0].ssb_mask << 2*(slot-2))&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[0].ssb_mask << (2*(slot-2) +1))&0x80000000) == 0x80000000)
|
||||
return 1;
|
||||
else return 0;
|
||||
}
|
||||
else if (slot>=20 && slot <=27){
|
||||
if(((config->ssb_table.ssb_mask_list[1].ssb_mask << 2*(slot-20))&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[1].ssb_mask << (2*(slot-20) +1))&0x80000000) == 0x80000000)
|
||||
return 1;
|
||||
else return 0;
|
||||
}
|
||||
else if (slot>=30 && slot <=37){
|
||||
if(((config->ssb_table.ssb_mask_list[1].ssb_mask << 2*(slot-22))&0x80000000) == 0x80000000 || ((config->ssb_table.ssb_mask_list[1].ssb_mask << (2*(slot-22) +1))&0x80000000) == 0x80000000)
|
||||
return 1;
|
||||
else return 0;
|
||||
}
|
||||
else return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
else if (mu == NR_MU_4) {
|
||||
AssertFatal(0==1, "not implemented for mu = %d yet\n", mu);
|
||||
}
|
||||
else AssertFatal(0==1, "Invalid numerology index %d for the synchronization block\n", mu);
|
||||
}
|
||||
else AssertFatal(0==1, "Invalid Lmax %u for the synchronization block\n", Lmax);
|
||||
}
|
||||
else return 0;
|
||||
|
||||
}
|
||||
|
||||
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp) {
|
||||
|
||||
@@ -1644,6 +1707,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
int frame_rx = proc->frame_rx;
|
||||
int nr_tti_rx = proc->nr_tti_rx;
|
||||
int slot_pbch;
|
||||
//int slot_ssb;
|
||||
NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0];
|
||||
fapi_nr_config_request_t *cfg = &ue->nrUE_config;
|
||||
|
||||
@@ -1669,6 +1733,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
get_coreset_rballoc(pdcch_vars->pdcch_config[0].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb);
|
||||
|
||||
slot_pbch = is_pbch_in_slot(cfg, frame_rx, nr_tti_rx, fp);
|
||||
//slot_ssb = is_ssb_in_slot(cfg, frame_rx, nr_tti_rx, fp);
|
||||
|
||||
// looking for pbch only in slot where it is supposed to be
|
||||
if ((ue->decode_MIB == 1) && slot_pbch)
|
||||
|
||||
Reference in New Issue
Block a user