Merge remote-tracking branch 'origin/integration_2021_wk41' into integration_2021_wk41_bwt-abs
# Conflicts: # ci-scripts/xml_files/fr1_sa_quectel.xml # openair1/SCHED_NR/fapi_nr_l1.c # openair1/SCHED_NR/phy_procedures_nr_gNB.c # openair2/GNB_APP/gnb_paramdef.h
This commit is contained in:
+18
-25
@@ -519,45 +519,38 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
|
||||
LOG_I(PHY,"gNB %d configured\n",Mod_id);
|
||||
}
|
||||
|
||||
|
||||
void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
int i;
|
||||
int j;
|
||||
void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) {
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
||||
LOG_I(PHY, "Initialise nr transport\n");
|
||||
uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value;
|
||||
msg->num_pdsch_slot = 0;
|
||||
|
||||
for (int i=0; i<gNB->number_of_nr_dlsch_max; i++) {
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max);
|
||||
for (int j=0; j<2; j++) {
|
||||
msg->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size);
|
||||
AssertFatal(msg->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
LOG_I(PHY, "Initialise nr transport\n");
|
||||
|
||||
memset(gNB->num_pdsch_rnti, 0, sizeof(uint16_t)*80);
|
||||
|
||||
for (i=0; i <NUMBER_OF_NR_PDCCH_MAX; i++) {
|
||||
LOG_I(PHY,"Initializing PDCCH list for PDCCH %d/%d\n",i,NUMBER_OF_NR_PDCCH_MAX);
|
||||
gNB->pdcch_pdu[i].frame=-1;
|
||||
LOG_I(PHY,"Initializing UL PDCCH list for UL PDCCH %d/%d\n",i,NUMBER_OF_NR_PDCCH_MAX);
|
||||
gNB->ul_pdcch_pdu[i].frame=-1;
|
||||
}
|
||||
|
||||
for (i=0; i<NUMBER_OF_NR_PUCCH_MAX; i++) {
|
||||
for (int i=0; i<NUMBER_OF_NR_PUCCH_MAX; i++) {
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n",i,NUMBER_OF_NR_PUCCH_MAX);
|
||||
gNB->pucch[i] = new_gNB_pucch();
|
||||
AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i);
|
||||
}
|
||||
|
||||
for (i=0; i<gNB->number_of_nr_dlsch_max; i++) {
|
||||
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max);
|
||||
|
||||
for (j=0; j<2; j++) {
|
||||
gNB->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size);
|
||||
AssertFatal(gNB->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<gNB->number_of_nr_ulsch_max; i++) {
|
||||
for (int i=0; i<gNB->number_of_nr_ulsch_max; i++) {
|
||||
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max);
|
||||
|
||||
for (j=0; j<2; j++) {
|
||||
for (int j=0; j<2; j++) {
|
||||
// ULSCH for data
|
||||
gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL, 0);
|
||||
|
||||
|
||||
@@ -409,6 +409,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB);
|
||||
void init_dfts(void);
|
||||
|
||||
void fill_subframe_mask(PHY_VARS_eNB *eNB);
|
||||
void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg);
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -73,8 +73,9 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) {
|
||||
|
||||
int min_I0=1000,max_I0=0;
|
||||
int amin=0,amax=0;
|
||||
fprintf(fd,"Blacklisted PRBs %d/%d\n",gNB->num_ulprbbl,gNB->frame_parms.N_RB_UL);
|
||||
for (int i=0; i<gNB->frame_parms.N_RB_UL; i++) {
|
||||
if (i==(gNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
|
||||
if (gNB->ulprbbl[i] > 0) continue;
|
||||
|
||||
if (gNB->measurements.n0_subband_power_tot_dB[i]<min_I0) {min_I0 = gNB->measurements.n0_subband_power_tot_dB[i]; amin=i;}
|
||||
|
||||
@@ -82,7 +83,8 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) {
|
||||
}
|
||||
|
||||
for (int i=0; i<gNB->frame_parms.N_RB_UL; i++) {
|
||||
fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB);
|
||||
if (gNB->ulprbbl[i] ==0) fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB);
|
||||
else fprintf(fd," X.");
|
||||
if (i%25 == 24) fprintf(fd,"\n");
|
||||
}
|
||||
fprintf(fd,"\n");
|
||||
|
||||
@@ -134,8 +134,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
dci_pdu->AggregationLevel,
|
||||
0,NULL);
|
||||
polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI,1,currentPtr);
|
||||
#ifdef DEBUG_CHANNEL_CODING
|
||||
printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]);
|
||||
#if DEBUG_CHANNEL_CODING
|
||||
printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,dci_pdu->AggregationLevel);
|
||||
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
|
||||
((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]);
|
||||
printf("Encoded Payload (length:%d dwords):\n", encoded_length>>5);
|
||||
|
||||
@@ -202,107 +202,3 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r
|
||||
ret |= ((field>>i)&1)<<(size-i-1);
|
||||
return ret;
|
||||
}*/
|
||||
int16_t find_nr_pdcch(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type) {
|
||||
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
||||
for (i=0; i<NUMBER_OF_NR_PDCCH_MAX; i++) {
|
||||
LOG_D(PHY,"searching for frame.slot %d.%d : pdcch_index %d frame.slot %d.%d, first_free_index %d\n", frame,slot,i,gNB->pdcch_pdu[i].frame,gNB->pdcch_pdu[i].slot,first_free_index);
|
||||
if ((gNB->pdcch_pdu[i].frame == frame) &&
|
||||
(gNB->pdcch_pdu[i].slot==slot)) return i;
|
||||
else if ( gNB->pdcch_pdu[i].frame==-1 && first_free_index==-1) first_free_index=i;
|
||||
}
|
||||
if (type == SEARCH_EXIST) return -1;
|
||||
|
||||
return first_free_index;
|
||||
}
|
||||
|
||||
|
||||
void nr_fill_dci(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu) {
|
||||
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &pdcch_pdu->pdcch_pdu_rel15;
|
||||
NR_gNB_DLSCH_t *dlsch;
|
||||
|
||||
int pdcch_id = find_nr_pdcch(frame,slot,gNB,SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(pdcch_id>=0 && pdcch_id<NUMBER_OF_NR_PDCCH_MAX,"Cannot find space for PDCCH, exiting\n");
|
||||
memcpy((void*)&gNB->pdcch_pdu[pdcch_id].pdcch_pdu,(void*)pdcch_pdu,sizeof(*pdcch_pdu));
|
||||
gNB->pdcch_pdu[pdcch_id].frame = frame;
|
||||
gNB->pdcch_pdu[pdcch_id].slot = slot;
|
||||
|
||||
for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) {
|
||||
|
||||
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu[i].Payload;
|
||||
|
||||
int dlsch_id = find_nr_dlsch(pdcch_pdu_rel15->dci_pdu[i].RNTI,gNB,SEARCH_EXIST_OR_FREE);
|
||||
if( (dlsch_id<0) || (dlsch_id>=gNB->number_of_nr_dlsch_max) ){
|
||||
LOG_E(PHY,"illegal dlsch_id found!!! rnti %04x dlsch_id %d\n",(unsigned int)pdcch_pdu_rel15->dci_pdu[i].RNTI,dlsch_id);
|
||||
return;
|
||||
}
|
||||
|
||||
dlsch = gNB->dlsch[dlsch_id][0];
|
||||
int harq_pid = 0;
|
||||
|
||||
dlsch->slot_tx[slot] = 1;
|
||||
dlsch->harq_ids[frame % 2][slot] = 0;
|
||||
AssertFatal(harq_pid < 8 && harq_pid >= 0,
|
||||
"illegal harq_pid %d\n",harq_pid);
|
||||
|
||||
dlsch->harq_mask |= (1<<harq_pid);
|
||||
dlsch->rnti = pdcch_pdu_rel15->dci_pdu[i].RNTI;
|
||||
|
||||
// nr_fill_cce_list(gNB,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int16_t find_nr_ul_dci(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type) {
|
||||
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
||||
for (i=0; i<NUMBER_OF_NR_PDCCH_MAX; i++) {
|
||||
LOG_D(PHY,"searching for frame.slot %d.%d : ul_pdcch_index %d frame.slot %d.%d, first_free_index %d\n", frame,slot,i,gNB->ul_pdcch_pdu[i].frame,gNB->ul_pdcch_pdu[i].slot,first_free_index);
|
||||
if ((gNB->ul_pdcch_pdu[i].frame == frame) &&
|
||||
(gNB->ul_pdcch_pdu[i].slot==slot)) return i;
|
||||
else if (gNB->ul_pdcch_pdu[i].frame==-1 && first_free_index==-1) first_free_index=i;
|
||||
}
|
||||
if (type == SEARCH_EXIST) return -1;
|
||||
|
||||
return first_free_index;
|
||||
}
|
||||
|
||||
|
||||
void nr_fill_ul_dci(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_ul_dci_request_pdus_t *pdcch_pdu) {
|
||||
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
|
||||
int pdcch_id = find_nr_ul_dci(frame,slot,gNB,SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(pdcch_id>=0 && pdcch_id<NUMBER_OF_NR_PDCCH_MAX,"Cannot find space for UL PDCCH, exiting\n");
|
||||
memcpy((void*)&gNB->ul_pdcch_pdu[pdcch_id].pdcch_pdu,(void*)pdcch_pdu,sizeof(*pdcch_pdu));
|
||||
gNB->ul_pdcch_pdu[pdcch_id].frame = frame;
|
||||
gNB->ul_pdcch_pdu[pdcch_id].slot = slot;
|
||||
|
||||
for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) {
|
||||
|
||||
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu[i].Payload;
|
||||
|
||||
// if there's no DL DCI then generate CCE list
|
||||
// nr_fill_cce_list(gNB,0);
|
||||
/*
|
||||
LOG_D(PHY, "DCI PDU: [0]->0x%lx \t [1]->0x%lx \n",dci_pdu[0], dci_pdu[1]);
|
||||
LOG_D(PHY, "DCI type %d payload (size %d) generated on candidate %d\n", dci_alloc->pdcch_params.dci_format, dci_alloc->size, cand_idx);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -111,10 +111,11 @@ void nr_pdsch_codeword_scrambling_optim(uint8_t *in,
|
||||
}
|
||||
|
||||
|
||||
uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
uint8_t nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
int frame,
|
||||
int slot) {
|
||||
|
||||
PHY_VARS_gNB *gNB = msgTx->gNB;
|
||||
NR_gNB_DLSCH_t *dlsch;
|
||||
uint32_t ***pdsch_dmrs = gNB->nr_gold_pdsch_dmrs[slot];
|
||||
int32_t** txdataF = gNB->common_vars.txdataF;
|
||||
@@ -132,9 +133,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
time_stats_t *dlsch_interleaving_stats=&gNB->dlsch_interleaving_stats;
|
||||
time_stats_t *dlsch_segmentation_stats=&gNB->dlsch_segmentation_stats;
|
||||
|
||||
for (int dlsch_id=0;dlsch_id<gNB->number_of_nr_dlsch_max;dlsch_id++) {
|
||||
dlsch = gNB->dlsch[dlsch_id][0];
|
||||
if (dlsch->slot_tx[slot] == 0) continue;
|
||||
for (int dlsch_id=0; dlsch_id<msgTx->num_pdsch_slot; dlsch_id++) {
|
||||
dlsch = msgTx->dlsch[dlsch_id][0];
|
||||
|
||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
||||
|
||||
@@ -63,13 +63,11 @@ void nr_pdsch_codeword_scrambling(uint8_t *in,
|
||||
uint32_t n_RNTI,
|
||||
uint32_t* out);
|
||||
|
||||
void nr_fill_dlsch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
void nr_fill_dlsch(processingData_L1tx_t *msgTx,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
unsigned char *sdu);
|
||||
|
||||
uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
uint8_t nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
int frame,
|
||||
int slot);
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
|
||||
|
||||
@@ -254,48 +254,16 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) {
|
||||
*(pdu+i) = (uint8_t)rand();
|
||||
}
|
||||
|
||||
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
|
||||
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
||||
for (i=0; i<gNB->number_of_nr_dlsch_max; i++) {
|
||||
AssertFatal(gNB->dlsch[i]!=NULL,"gNB->dlsch[%d] is null\n",i);
|
||||
AssertFatal(gNB->dlsch[i][0]!=NULL,"gNB->dlsch[%d][0] is null\n",i);
|
||||
LOG_D(PHY,"searching for rnti %x : dlsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,
|
||||
gNB->dlsch[i][0]->harq_mask,gNB->dlsch[i][0]->rnti,first_free_index);
|
||||
if ((gNB->dlsch[i][0]->harq_mask >0) &&
|
||||
(gNB->dlsch[i][0]->rnti==rnti)) return i;
|
||||
else if ((gNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
|
||||
}
|
||||
if (type == SEARCH_EXIST) return -1;
|
||||
if (first_free_index != -1)
|
||||
gNB->dlsch[first_free_index][0]->rnti = 0;
|
||||
return first_free_index;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void nr_fill_dlsch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
void nr_fill_dlsch(processingData_L1tx_t *msgTx,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
uint8_t *sdu) {
|
||||
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &pdsch_pdu->pdsch_pdu_rel15;
|
||||
|
||||
int dlsch_id = find_nr_dlsch(rel15->rnti,gNB,SEARCH_EXIST);
|
||||
AssertFatal( (dlsch_id>=0) && (dlsch_id<gNB->number_of_nr_dlsch_max),
|
||||
"illegal or no dlsch_id found!!! rnti %04x dlsch_id %d\n",rel15->rnti,dlsch_id);
|
||||
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[dlsch_id][0];
|
||||
NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[msgTx->num_pdsch_slot][0];
|
||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||
/// DLSCH struct
|
||||
memcpy((void*)&harq->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu));
|
||||
gNB->num_pdsch_rnti[slot]++;
|
||||
msgTx->num_pdsch_slot++;
|
||||
AssertFatal(sdu!=NULL,"sdu is null\n");
|
||||
harq->pdu = sdu;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -306,8 +306,8 @@ void nr_processULSegment(void* arg) {
|
||||
int max_ldpc_iterations = p_decoderParms->numMaxIter;
|
||||
int8_t llrProcBuf[OAI_UL_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
|
||||
|
||||
int16_t z [68*384];
|
||||
int8_t l [68*384];
|
||||
int16_t z [68*384 + 16] __attribute__ ((aligned(16)));
|
||||
int8_t l [68*384 + 16] __attribute__ ((aligned(16)));
|
||||
|
||||
__m128i *pv = (__m128i*)&z;
|
||||
__m128i *pl = (__m128i*)&l;
|
||||
|
||||
@@ -762,6 +762,7 @@ typedef struct RRU_config_s {
|
||||
typedef struct processingData_RU {
|
||||
int frame_tx;
|
||||
int slot_tx;
|
||||
int next_slot;
|
||||
openair0_timestamp timestamp_tx;
|
||||
RU_t *ru;
|
||||
} processingData_RU_t;
|
||||
|
||||
+24
-5
@@ -122,8 +122,6 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint8_t active;
|
||||
int frame;
|
||||
int slot;
|
||||
nfapi_nr_dl_tti_csi_rs_pdu csirs_pdu;
|
||||
} NR_gNB_CSIRS_t;
|
||||
|
||||
@@ -766,7 +764,6 @@ typedef struct PHY_VARS_gNB_s {
|
||||
// nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu;
|
||||
// nfapi_nr_ul_dci_request_pdus_t *ul_dci_pdu;
|
||||
uint16_t num_pdsch_rnti[80];
|
||||
NR_gNB_SSB_t ssb[64];
|
||||
NR_gNB_PBCH pbch;
|
||||
nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL];
|
||||
NR_gNB_COMMON common_vars;
|
||||
@@ -774,7 +771,6 @@ typedef struct PHY_VARS_gNB_s {
|
||||
NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX];
|
||||
NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX];
|
||||
NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
|
||||
NR_gNB_CSIRS_t csirs_pdu[NUMBER_OF_NR_CSIRS_MAX];
|
||||
NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
|
||||
NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams
|
||||
NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX][2]; // [Nusers times][2 codewords]
|
||||
@@ -857,10 +853,13 @@ typedef struct PHY_VARS_gNB_s {
|
||||
int pusch_thres;
|
||||
int prach_thres;
|
||||
uint64_t bad_pucch;
|
||||
int num_ulprbbl;
|
||||
int ulprbbl[275];
|
||||
/*
|
||||
time_stats_t phy_proc;
|
||||
*/
|
||||
time_stats_t phy_proc_tx;
|
||||
time_stats_t *phy_proc_tx_0;
|
||||
time_stats_t *phy_proc_tx_1;
|
||||
time_stats_t phy_proc_rx;
|
||||
time_stats_t rx_prach;
|
||||
/*
|
||||
@@ -952,4 +951,24 @@ typedef struct processingData_L1 {
|
||||
PHY_VARS_gNB *gNB;
|
||||
} processingData_L1_t;
|
||||
|
||||
typedef enum {
|
||||
FILLED,
|
||||
FILLING,
|
||||
NOT_FILLED
|
||||
} msgStatus_t;
|
||||
|
||||
typedef struct processingData_L1tx {
|
||||
int frame;
|
||||
int slot;
|
||||
openair0_timestamp timestamp_tx;
|
||||
PHY_VARS_gNB *gNB;
|
||||
nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu;
|
||||
nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu;
|
||||
NR_gNB_CSIRS_t csirs_pdu[NUMBER_OF_NR_CSIRS_MAX];
|
||||
NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2];
|
||||
NR_gNB_SSB_t ssb[64];
|
||||
uint16_t num_pdsch_slot;
|
||||
time_stats_t phy_proc_tx;
|
||||
} processingData_L1tx_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,11 +13,11 @@ void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){}
|
||||
|
||||
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;}
|
||||
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
uint8_t *sdu){
|
||||
}
|
||||
void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
|
||||
int frame, int slot,
|
||||
nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu){
|
||||
}
|
||||
@@ -51,4 +51,5 @@ void nr_phy_config_request(NR_PHY_Config_t *gNB){}
|
||||
|
||||
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst){}
|
||||
|
||||
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp){}
|
||||
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp){}
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){}
|
||||
|
||||
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;}
|
||||
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
uint8_t *sdu){
|
||||
}
|
||||
void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
|
||||
int frame, int slot,
|
||||
nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu){
|
||||
}
|
||||
@@ -53,4 +53,3 @@ void install_nr_schedule_handlers(NR_IF_Module_t *if_inst){}
|
||||
|
||||
//void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp){}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ extern int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
|
||||
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,int frame,int slot,
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu)
|
||||
{
|
||||
|
||||
@@ -53,11 +53,11 @@ void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
uint8_t i_ssb = dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex;
|
||||
|
||||
LOG_D(PHY,"%d.%d : ssb index %d pbch_pdu: %x\n",frame,slot,i_ssb,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload);
|
||||
if (gNB->ssb[i_ssb].active)
|
||||
if (msgTx->ssb[i_ssb].active)
|
||||
AssertFatal(1==0,"SSB PDU with index %d already active\n",i_ssb);
|
||||
else {
|
||||
gNB->ssb[i_ssb].active = true;
|
||||
memcpy((void*)&gNB->ssb[i_ssb].ssb_pdu,&dl_tti_pdu->ssb_pdu,sizeof(dl_tti_pdu->ssb_pdu));
|
||||
msgTx->ssb[i_ssb].active = true;
|
||||
memcpy((void*)&msgTx->ssb[i_ssb].ssb_pdu,&dl_tti_pdu->ssb_pdu,sizeof(dl_tti_pdu->ssb_pdu));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,46 +100,16 @@ void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
}*/
|
||||
|
||||
|
||||
void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu) {
|
||||
|
||||
LOG_D(PHY,"Frame %d, Slot %d: DCI processing - proc:slot_tx:%d pdcch_pdu_rel15->numDlDci:%d\n",frame,slot, slot, pdcch_pdu->pdcch_pdu_rel15.numDlDci);
|
||||
|
||||
// copy dci configuration into gNB structure
|
||||
// gNB->pdcch_pdu = pdcch_pdu;
|
||||
|
||||
nr_fill_dci(gNB,frame,slot,pdcch_pdu);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu) {
|
||||
|
||||
LOG_D(PHY,"Frame %d, Slot %d: UL DCI processing - proc:slot_tx:%d pdcch_pdu_rel15->numDlDci:%d\n",frame,slot, slot, ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15.numDlDci);
|
||||
|
||||
// copy dci configuration into gNB structure
|
||||
// gNB->ul_dci_pdu = ul_dci_request_pdu;
|
||||
|
||||
nr_fill_ul_dci(gNB,frame,slot,ul_dci_request_pdu);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
|
||||
int frame,int slot,
|
||||
nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu) {
|
||||
|
||||
int found = 0;
|
||||
|
||||
for (int id=0; id<NUMBER_OF_NR_CSIRS_MAX; id++) {
|
||||
NR_gNB_CSIRS_t *csirs = &gNB->csirs_pdu[id];
|
||||
NR_gNB_CSIRS_t *csirs = &msgTx->csirs_pdu[id];
|
||||
if (csirs->active == 0) {
|
||||
LOG_D(PHY,"Frame %d Slot %d CSI_RS with ID %d is now active\n",frame,slot,id);
|
||||
csirs->frame = frame;
|
||||
csirs->slot = slot;
|
||||
csirs->active = 1;
|
||||
memcpy((void*)&csirs->csirs_pdu, (void*)csirs_pdu, sizeof(nfapi_nr_dl_tti_csi_rs_pdu));
|
||||
found = 1;
|
||||
@@ -151,13 +121,13 @@ void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
|
||||
|
||||
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
uint8_t *sdu)
|
||||
{
|
||||
|
||||
|
||||
nr_fill_dlsch(gNB,frame,slot,pdsch_pdu,sdu);
|
||||
nr_fill_dlsch(msgTx,pdsch_pdu,sdu);
|
||||
|
||||
}
|
||||
|
||||
@@ -178,6 +148,10 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
|
||||
gNB = RC.gNB[Mod_id];
|
||||
|
||||
notifiedFIFO_elt_t *res;
|
||||
res = pullTpool(gNB->resp_L1_tx, gNB->threadPool);
|
||||
processingData_L1tx_t *msgTx = (processingData_L1tx_t *)NotifiedFifoData(res);
|
||||
|
||||
uint8_t number_dl_pdu = (DL_req==NULL) ? 0 : DL_req->dl_tti_request_body.nPDUs;
|
||||
uint8_t number_ul_dci_pdu = (UL_dci_req==NULL) ? 0 : UL_dci_req->numPdus;
|
||||
uint8_t number_ul_tti_pdu = (UL_tti_req==NULL) ? 0 : UL_tti_req->n_pdus;
|
||||
@@ -192,33 +166,31 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
number_ul_dci_pdu,number_ul_tti_pdu);
|
||||
|
||||
int pdcch_received=0;
|
||||
gNB->num_pdsch_rnti[slot]=0;
|
||||
for (int i=0; i<gNB->number_of_nr_dlsch_max; i++) {
|
||||
gNB->dlsch[i][0]->rnti=0;
|
||||
gNB->dlsch[i][0]->harq_mask=0;
|
||||
}
|
||||
msgTx->num_pdsch_slot=0;
|
||||
msgTx->pdcch_pdu.pdcch_pdu_rel15.numDlDci = 0;
|
||||
msgTx->ul_pdcch_pdu.pdcch_pdu.pdcch_pdu_rel15.numDlDci = 0;
|
||||
msgTx->slot = slot;
|
||||
msgTx->frame = frame;
|
||||
|
||||
for (int i=0;i<number_dl_pdu;i++) {
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu = &DL_req->dl_tti_request_body.dl_tti_pdu_list[i];
|
||||
LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_tti_pdu->PDUType);
|
||||
switch (dl_tti_pdu->PDUType) {
|
||||
case NFAPI_NR_DL_TTI_SSB_PDU_TYPE:
|
||||
handle_nr_nfapi_ssb_pdu(gNB,frame,slot,
|
||||
handle_nr_nfapi_ssb_pdu(msgTx,frame,slot,
|
||||
dl_tti_pdu);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
|
||||
AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n");
|
||||
handle_nfapi_nr_pdcch_pdu(gNB,
|
||||
frame, slot,
|
||||
&dl_tti_pdu->pdcch_pdu);
|
||||
msgTx->pdcch_pdu = dl_tti_pdu->pdcch_pdu;
|
||||
|
||||
pdcch_received = 1;
|
||||
break;
|
||||
|
||||
case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE:
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
|
||||
handle_nfapi_nr_csirs_pdu(gNB,
|
||||
frame, slot,
|
||||
handle_nfapi_nr_csirs_pdu(msgTx,frame,slot,
|
||||
&dl_tti_pdu->csi_rs_pdu);
|
||||
break;
|
||||
|
||||
@@ -229,15 +201,16 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
|
||||
pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
|
||||
uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
|
||||
handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu);
|
||||
break;
|
||||
AssertFatal(msgTx->num_pdsch_slot < gNB->number_of_nr_dlsch_max,"Number of PDSCH PDUs %d exceeded the limit %d\n",
|
||||
msgTx->num_pdsch_slot,gNB->number_of_nr_dlsch_max);
|
||||
handle_nr_nfapi_pdsch_pdu(msgTx,&dl_tti_pdu->pdsch_pdu, sdu);
|
||||
}
|
||||
}
|
||||
|
||||
if (number_ul_dci_pdu > 0)
|
||||
msgTx->ul_pdcch_pdu = UL_dci_req->ul_dci_pdu_list[number_ul_dci_pdu-1]; // copy the last pdu
|
||||
|
||||
for (int i=0;i<number_ul_dci_pdu;i++) {
|
||||
handle_nfapi_nr_ul_dci_pdu(gNB, frame, slot, &UL_dci_req->ul_dci_pdu_list[i]);
|
||||
}
|
||||
pushNotifiedFIFO(gNB->resp_L1_tx,res);
|
||||
|
||||
for (int i = 0; i < number_ul_tti_pdu; i++) {
|
||||
switch (UL_tti_req->pdus_list[i].pdu_type) {
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
|
||||
// added
|
||||
void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,
|
||||
void handle_nr_nfapi_ssb_pdu(processingData_L1tx_t *msgTx,
|
||||
int frame,int slot,
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu);
|
||||
|
||||
void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO);
|
||||
|
||||
void handle_nfapi_nr_csirs_pdu(PHY_VARS_gNB *gNB,
|
||||
void handle_nfapi_nr_csirs_pdu(processingData_L1tx_t *msgTx,
|
||||
int frame, int slot,
|
||||
nfapi_nr_dl_tti_csi_rs_pdu *csirs_pdu);
|
||||
|
||||
@@ -51,7 +51,7 @@ void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int subframe,
|
||||
nfapi_nr_dl_tti_pdcch_pdu *dcl_dl_pdu);
|
||||
|
||||
void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
|
||||
void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
uint8_t *sdu);
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
************************************************************************/
|
||||
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||
|
||||
@@ -308,6 +309,21 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) {
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
int get_next_downlink_slot(PHY_VARS_gNB *gNB, nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot) {
|
||||
|
||||
int slot = nr_slot;
|
||||
int frame = nr_frame;
|
||||
int slots_per_frame = gNB->frame_parms.slots_per_frame;
|
||||
while (true) {
|
||||
slot++;
|
||||
if (slot/slots_per_frame) frame++;
|
||||
slot %= slots_per_frame;
|
||||
int slot_type = nr_slot_select(cfg, frame, slot);
|
||||
if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) return slot;
|
||||
AssertFatal(frame < (nr_frame+2), "Something went worng. This shouldn't happen\n");
|
||||
}
|
||||
}
|
||||
|
||||
int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot) {
|
||||
/* for FFD all slot can be considered as an uplink */
|
||||
int mu = cfg->ssb_config.scs_common.value,check_slot=0;
|
||||
|
||||
@@ -92,5 +92,7 @@ void free_tdd_configuration_nr(NR_DL_FRAME_PARMS *frame_parms);
|
||||
|
||||
void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms);
|
||||
|
||||
int get_next_downlink_slot(PHY_VARS_gNB *gNB, nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot);
|
||||
|
||||
#endif /* PHY_FRAME_CONFIG_NR_H */
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME
|
||||
|
||||
fp->ssb_start_subcarrier = (12 * cfg->ssb_table.ssb_offset_point_a.value + sco);
|
||||
LOG_D(PHY, "SSB first subcarrier %d (%d,%d)\n", fp->ssb_start_subcarrier,cfg->ssb_table.ssb_offset_point_a.value,sco);
|
||||
}
|
||||
}
|
||||
|
||||
void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu) {
|
||||
|
||||
@@ -124,10 +124,12 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_
|
||||
}
|
||||
|
||||
|
||||
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
int frame,int slot,
|
||||
void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
||||
int frame,
|
||||
int slot,
|
||||
int do_meas) {
|
||||
int aa;
|
||||
PHY_VARS_gNB *gNB = msgTx->gNB;
|
||||
NR_DL_FRAME_PARMS *fp=&gNB->frame_parms;
|
||||
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
||||
int offset = gNB->CC_id;
|
||||
@@ -138,7 +140,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,1);
|
||||
|
||||
if (do_meas==1) start_meas(&gNB->phy_proc_tx);
|
||||
if (do_meas==1) start_meas(&msgTx->phy_proc_tx);
|
||||
|
||||
// clear the transmit data array and beam index for the current slot
|
||||
for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) {
|
||||
@@ -147,58 +149,44 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
|
||||
|
||||
for (int i=0; i<fp->Lmax; i++) {
|
||||
if (gNB->ssb[i].active) {
|
||||
nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[i].ssb_pdu);
|
||||
gNB->ssb[i].active = false;
|
||||
if (msgTx->ssb[i].active) {
|
||||
nr_common_signal_procedures(gNB,frame,slot,msgTx->ssb[i].ssb_pdu);
|
||||
msgTx->ssb[i].active = false;
|
||||
}
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,0);
|
||||
|
||||
int pdcch_pdu_id=find_nr_pdcch(frame,slot,gNB,SEARCH_EXIST);
|
||||
int ul_pdcch_pdu_id=find_nr_ul_dci(frame,slot,gNB,SEARCH_EXIST);
|
||||
int num_dl_dci = msgTx->pdcch_pdu.pdcch_pdu_rel15.numDlDci;
|
||||
int num_ul_dci = msgTx->ul_pdcch_pdu.pdcch_pdu.pdcch_pdu_rel15.numDlDci;
|
||||
|
||||
LOG_D(PHY,"[gNB %d] Frame %d slot %d, pdcch_pdu_id %d, ul_pdcch_pdu_id %d\n",
|
||||
gNB->Mod_id,frame,slot,pdcch_pdu_id,ul_pdcch_pdu_id);
|
||||
|
||||
if (pdcch_pdu_id >= 0 || ul_pdcch_pdu_id >= 0) {
|
||||
if (num_dl_dci > 0 || num_ul_dci > 0) {
|
||||
LOG_D(PHY, "[gNB %d] Frame %d slot %d Calling nr_generate_dci_top (number of UL/DL DCI %d/%d)\n",
|
||||
gNB->Mod_id, frame, slot,
|
||||
gNB->ul_pdcch_pdu[ul_pdcch_pdu_id].pdcch_pdu.pdcch_pdu.pdcch_pdu_rel15.numDlDci,
|
||||
gNB->pdcch_pdu[pdcch_pdu_id].pdcch_pdu.pdcch_pdu_rel15.numDlDci);
|
||||
gNB->Mod_id, frame, slot, num_ul_dci, num_dl_dci);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,1);
|
||||
|
||||
nr_generate_dci_top(gNB,
|
||||
pdcch_pdu_id>=0 ? &gNB->pdcch_pdu[pdcch_pdu_id].pdcch_pdu : NULL,
|
||||
ul_pdcch_pdu_id>=0 ? &gNB->ul_pdcch_pdu[ul_pdcch_pdu_id].pdcch_pdu.pdcch_pdu : NULL,
|
||||
num_dl_dci > 0 ? &msgTx->pdcch_pdu : NULL,
|
||||
num_ul_dci > 0 ? &msgTx->ul_pdcch_pdu.pdcch_pdu : NULL,
|
||||
gNB->nr_gold_pdcch_dmrs[slot],
|
||||
&gNB->common_vars.txdataF[0][txdataF_offset],
|
||||
AMP, fp);
|
||||
|
||||
// free up entry in pdcch tables
|
||||
if (pdcch_pdu_id>=0) gNB->pdcch_pdu[pdcch_pdu_id].frame = -1;
|
||||
if (ul_pdcch_pdu_id>=0) gNB->ul_pdcch_pdu[ul_pdcch_pdu_id].frame = -1;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,0);
|
||||
if (pdcch_pdu_id >= 0) gNB->pdcch_pdu[pdcch_pdu_id].frame = -1;
|
||||
if (ul_pdcch_pdu_id >= 0) gNB->ul_pdcch_pdu[ul_pdcch_pdu_id].frame = -1;
|
||||
}
|
||||
|
||||
for (int i=0; i<gNB->num_pdsch_rnti[slot]; i++) {
|
||||
if (msgTx->num_pdsch_slot > 0) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
|
||||
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", gNB->num_pdsch_rnti[slot],frame,slot);
|
||||
nr_generate_pdsch(gNB,frame, slot);
|
||||
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", msgTx->num_pdsch_slot,frame,slot);
|
||||
nr_generate_pdsch(msgTx, frame, slot);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
|
||||
}
|
||||
|
||||
for (int i=0;i<NUMBER_OF_NR_CSIRS_MAX;i++){
|
||||
NR_gNB_CSIRS_t *csirs = &gNB->csirs_pdu[i];
|
||||
if ((csirs->active == 1) &&
|
||||
(csirs->frame == frame) &&
|
||||
(csirs->slot == slot) ) {
|
||||
NR_gNB_CSIRS_t *csirs = &msgTx->csirs_pdu[i];
|
||||
if ((csirs->active == 1)) {
|
||||
LOG_D(PHY, "CSI-RS generation started in frame %d.%d\n",frame,slot);
|
||||
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params = csirs->csirs_pdu.csi_rs_pdu_rel15;
|
||||
nr_generate_csi_rs(gNB, AMP, csi_params, gNB->gNB_config.cell_config.phy_cell_id.value, slot);
|
||||
@@ -206,7 +194,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
}
|
||||
|
||||
if (do_meas==1) stop_meas(&gNB->phy_proc_tx);
|
||||
if (do_meas==1) stop_meas(&msgTx->phy_proc_tx);
|
||||
|
||||
// if ((frame&127) == 0) dump_pdsch_stats(gNB);
|
||||
|
||||
@@ -262,7 +250,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
|
||||
}
|
||||
|
||||
//int dumpsig=0;
|
||||
// if all segments are done
|
||||
// if all segments are done
|
||||
if (rdata->nbSegments == ulsch_harq->processedSegments) {
|
||||
if (decodeSuccess) {
|
||||
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",
|
||||
@@ -275,9 +263,15 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
|
||||
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0,0);
|
||||
//dumpsig=1;
|
||||
} else {
|
||||
LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, ndi %d, status %d, round %d, RV %d, TBS %d) r %d\n",
|
||||
LOG_I(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,
|
||||
rdata->harq_pid,pusch_pdu->pusch_data.new_data_indicator,ulsch_harq->status, ulsch_harq->round, ulsch_harq->ulsch_pdu.pusch_data.rv_index,ulsch_harq->TBS,r);
|
||||
rdata->harq_pid, pusch_pdu->pusch_data.new_data_indicator, ulsch_harq->status,
|
||||
ulsch_harq->round,
|
||||
ulsch_harq->ulsch_pdu.pusch_data.rv_index,
|
||||
ulsch_harq->ulsch_pdu.rb_start,
|
||||
ulsch_harq->ulsch_pdu.rb_size,
|
||||
ulsch_harq->TBS,
|
||||
r);
|
||||
ulsch_harq->round++;
|
||||
if (ulsch_harq->round >= ulsch->Mlimit) {
|
||||
ulsch_harq->status = SCH_IDLE;
|
||||
@@ -290,7 +284,7 @@ void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
|
||||
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);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
if (ulsch_harq->ulsch_pdu.mcs_index == 9 && dumpsig==1) {
|
||||
#ifdef __AVX2__
|
||||
int off = ((ulsch_harq->ulsch_pdu.rb_size&1) == 1)? 4:0;
|
||||
@@ -492,8 +486,8 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
||||
}
|
||||
exit(-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// crc indication
|
||||
uint16_t num_crc = gNB->UL_INFO.crc_ind.number_crcs;
|
||||
gNB->UL_INFO.crc_ind.crc_list = &gNB->crc_pdu_list[0];
|
||||
@@ -538,11 +532,20 @@ void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id,
|
||||
// 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 rb = 0;
|
||||
int rb2 = 0;
|
||||
|
||||
for (int symbol=0;symbol<14;symbol++)
|
||||
for (int m=0;m<9;m++) gNB->rb_mask_ul[symbol][m] = 0;
|
||||
int rb2, rb, nb_rb;
|
||||
int prbpos;
|
||||
for (int symbol=0;symbol<14;symbol++) {
|
||||
if (gNB->gNB_config.tdd_table.max_tdd_periodicity_list[slot_rx].max_num_of_symbol_per_slot_list[symbol].slot_config.value==1){
|
||||
nb_rb = 0;
|
||||
for (int m=0;m<9;m++) {
|
||||
gNB->rb_mask_ul[m] = 0;
|
||||
for (int i=0;i<32;i++) {
|
||||
prbpos = (m*32)+i;
|
||||
if (prbpos>gNB->frame_parms.N_RB_UL) break;
|
||||
gNB->rb_mask_ul[m] |= (gNB->ulprbbl[prbpos]>0 ? 1 : 0)<<i;
|
||||
}
|
||||
}
|
||||
gNB->ulmask_symb = -1;
|
||||
|
||||
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
|
||||
NR_gNB_PUCCH_t *pucch = gNB->pucch[i];
|
||||
@@ -679,7 +682,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
|
||||
LOG_D(PHY,"frame %d, slot %d: PUCCH signal energy %d\n",frame_rx,slot_rx,power_rxF);
|
||||
|
||||
nr_decode_pucch0(gNB,
|
||||
frame_rx,
|
||||
frame_rx,
|
||||
slot_rx,
|
||||
uci_pdu_format0,
|
||||
pucch_pdu);
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx);
|
||||
void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME_PARMS *fp);
|
||||
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, int frame_tx, int slot_tx, int do_meas);
|
||||
void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, int frame_tx, int slot_tx, int do_meas);
|
||||
void phy_procedures_gNB_common_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);
|
||||
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot);
|
||||
|
||||
@@ -426,7 +426,9 @@ int main(int argc, char **argv)
|
||||
UE->dlsch_SI[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
|
||||
UE->dlsch_ra[0] = new_nr_ue_dlsch(1, 1, Nsoft, 5, N_RB_DL, 0);
|
||||
unsigned char harq_pid = 0; //dlsch->harq_ids[subframe];
|
||||
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[0][0];
|
||||
processingData_L1tx_t msgDataTx;
|
||||
init_DLSCH_struct(gNB, &msgDataTx);
|
||||
NR_gNB_DLSCH_t *dlsch = msgDataTx.dlsch[0][0];
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
|
||||
//time_stats_t *rm_stats, *te_stats, *i_stats;
|
||||
uint8_t is_crnti = 0, llr8_flag = 0;
|
||||
@@ -634,7 +636,7 @@ int main(int argc, char **argv)
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
printf("gNB %d\n", i);
|
||||
free_gNB_dlsch(&(gNB->dlsch[0][i]),N_RB_DL);
|
||||
free_gNB_dlsch(&(msgDataTx.dlsch[0][i]),N_RB_DL);
|
||||
printf("UE %d\n", i);
|
||||
free_nr_ue_dlsch(&(UE->dlsch[0][0][i]),N_RB_DL);
|
||||
}
|
||||
|
||||
@@ -933,8 +933,6 @@ int main(int argc, char **argv)
|
||||
// generate signal
|
||||
AssertFatal(input_fd==NULL,"Not ready for input signal file\n");
|
||||
gNB->pbch_configured = 1;
|
||||
gNB->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234;
|
||||
gNB->ssb[0].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0;
|
||||
|
||||
//Configure UE
|
||||
rrc.carrier.MIB = (uint8_t*) malloc(4);
|
||||
@@ -964,11 +962,25 @@ int main(int argc, char **argv)
|
||||
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
|
||||
snrRun = 0;
|
||||
|
||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||
char tp_param[] = "n";
|
||||
initTpool(tp_param, gNB->threadPool, true);
|
||||
gNB->resp_L1_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||
initNotifiedFIFO(gNB->resp_L1_tx);
|
||||
// we create 2 threads for L1 tx processing
|
||||
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->resp_L1_tx,processSlotTX);
|
||||
processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
|
||||
init_DLSCH_struct(gNB, msgDataTx);
|
||||
msgDataTx->slot = slot;
|
||||
msgDataTx->frame = frame;
|
||||
memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t));
|
||||
reset_meas(&msgDataTx->phy_proc_tx);
|
||||
gNB->phy_proc_tx_0 = &msgDataTx->phy_proc_tx;
|
||||
pushTpool(gNB->threadPool,msgL1Tx);
|
||||
|
||||
for (SNR = snr0; SNR < snr1; SNR += .2) {
|
||||
|
||||
varArray_t *table_tx=initVarArray(1000,sizeof(double));
|
||||
reset_meas(&gNB->phy_proc_tx); // total gNB tx
|
||||
reset_meas(&gNB->dlsch_scrambling_stats);
|
||||
reset_meas(&gNB->dlsch_interleaving_stats);
|
||||
reset_meas(&gNB->dlsch_rate_matching_stats);
|
||||
@@ -1009,7 +1021,7 @@ int main(int argc, char **argv)
|
||||
int harq_pid = slot;
|
||||
NR_DL_UE_HARQ_t *UE_harq_process = dlsch0->harq_processes[harq_pid];
|
||||
|
||||
NR_gNB_DLSCH_t *gNB_dlsch = gNB->dlsch[0][0];
|
||||
NR_gNB_DLSCH_t *gNB_dlsch = msgDataTx->dlsch[0][0];
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &gNB_dlsch->harq_process.pdsch_pdu.pdsch_pdu_rel15;
|
||||
|
||||
UE_harq_process->ack = 0;
|
||||
@@ -1060,10 +1072,14 @@ int main(int argc, char **argv)
|
||||
ptrsRePerSymb = ((rel15->rbSize + rel15->PTRSFreqDensity - 1)/rel15->PTRSFreqDensity);
|
||||
printf("[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb );
|
||||
}
|
||||
|
||||
msgDataTx->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234;
|
||||
msgDataTx->ssb[0].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0;
|
||||
msgDataTx->gNB = gNB;
|
||||
if (run_initial_sync)
|
||||
nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[0].ssb_pdu);
|
||||
nr_common_signal_procedures(gNB,frame,slot,msgDataTx->ssb[0].ssb_pdu);
|
||||
else
|
||||
phy_procedures_gNB_TX(gNB,frame,slot,1);
|
||||
phy_procedures_gNB_TX(msgDataTx,frame,slot,1);
|
||||
|
||||
int txdataF_offset = (slot%2) * frame_parms->samples_per_slot_wCP;
|
||||
|
||||
@@ -1272,10 +1288,10 @@ int main(int argc, char **argv)
|
||||
if (print_perf==1) {
|
||||
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, Kr %d (Zc %d))\n",
|
||||
1000>>*scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex,
|
||||
gNB->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3,
|
||||
gNB->dlsch[0][0]->harq_process.K,
|
||||
gNB->dlsch[0][0]->harq_process.K/((gNB->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3)>3824?22:10));
|
||||
printDistribution(&gNB->phy_proc_tx,table_tx,"PHY proc tx");
|
||||
msgDataTx->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3,
|
||||
msgDataTx->dlsch[0][0]->harq_process.K,
|
||||
msgDataTx->dlsch[0][0]->harq_process.K/((msgDataTx->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3)>3824?22:10));
|
||||
printDistribution(gNB->phy_proc_tx_0,table_tx,"PHY proc tx");
|
||||
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
|
||||
printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time");
|
||||
printStatIndent3(&gNB->tinput,"DLSCH LDPC input processing time");
|
||||
|
||||
@@ -565,14 +565,15 @@ int main(int argc, char **argv)
|
||||
|
||||
nr_gold_pbch(UE);
|
||||
|
||||
processingData_L1tx_t msgDataTx;
|
||||
// generate signal
|
||||
if (input_fd==NULL) {
|
||||
|
||||
for (i=0; i<frame_parms->Lmax; i++) {
|
||||
if((SSB_positions >> i) & 0x01) {
|
||||
|
||||
gNB->ssb[i].ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33;
|
||||
gNB->ssb[i].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = i;
|
||||
msgDataTx.ssb[i].ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33;
|
||||
msgDataTx.ssb[i].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = i;
|
||||
|
||||
start_symbol = nr_get_ssb_start_symbol(frame_parms,i);
|
||||
int slot = start_symbol/14;
|
||||
@@ -580,7 +581,7 @@ int main(int argc, char **argv)
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++)
|
||||
memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t));
|
||||
|
||||
nr_common_signal_procedures (gNB,frame,slot,gNB->ssb[i].ssb_pdu);
|
||||
nr_common_signal_procedures (gNB,frame,slot,msgDataTx.ssb[i].ssb_pdu);
|
||||
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (cyclic_prefix_type == 1) {
|
||||
@@ -750,7 +751,7 @@ int main(int argc, char **argv)
|
||||
|
||||
payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte);
|
||||
for (i=0;i<3;i++){
|
||||
payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((gNB->ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff));
|
||||
payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((msgDataTx.ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff));
|
||||
}
|
||||
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte);
|
||||
//printf("ret %d\n", payload_ret);
|
||||
|
||||
@@ -665,6 +665,13 @@ int main(int argc, char **argv)
|
||||
char tp_param[] = "n";
|
||||
initTpool(tp_param, gNB->threadPool, false);
|
||||
initNotifiedFIFO(gNB->respDecode);
|
||||
gNB->resp_L1_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||
initNotifiedFIFO(gNB->resp_L1_tx);
|
||||
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->resp_L1_tx,NULL);
|
||||
processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
|
||||
msgDataTx->slot = -1;
|
||||
gNB->phy_proc_tx_0 = &msgDataTx->phy_proc_tx;
|
||||
pushNotifiedFIFO(gNB->resp_L1_tx,msgL1Tx); // to unblock the process in the beginning
|
||||
//gNB_config = &gNB->gNB_config;
|
||||
|
||||
//memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO));
|
||||
|
||||
Reference in New Issue
Block a user