Commit 456d1f9d authored by Raymond Knopp's avatar Raymond Knopp

added scheduling of PRACH RX procedures in gNB and RU entities. Initialization...

added scheduling of PRACH RX procedures in gNB and RU entities. Initialization of prach sequences added to nr_init.c
parent a248c44d
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include "SCHED/sched_eNB.h" #include "SCHED/sched_eNB.h"
#include "SCHED_NR/sched_nr.h" #include "SCHED_NR/sched_nr.h"
#include "SCHED_NR/fapi_nr_l1.h" #include "SCHED_NR/fapi_nr_l1.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h" #include "PHY/NR_TRANSPORT/nr_transport.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
...@@ -205,6 +205,13 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t ...@@ -205,6 +205,13 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) { if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) {
// UE-specific RX processing for subframe n // UE-specific RX processing for subframe n
// TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT // TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT
// Do PRACH RU processing
int prach_id=find_nr_prach(gNB,frame_rx,slot_rx,0,SEARCH_EXIST);
if (prach_id>=0) {
L1_nr_prach_procedures(gNB,frame_rx,slot_rx,&gNB->prach_vars.list[prach_id].pdu);
gNB->prach_vars.list[prach_id].frame=-1;
}
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx); phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
} }
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include "PHY/defs_nr_common.h" #include "PHY/defs_nr_common.h"
#include "PHY/phy_extern.h" #include "PHY/phy_extern.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h" #include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "PHY/NR_TRANSPORT/nr_transport.h"
#include "PHY/INIT/phy_init.h" #include "PHY/INIT/phy_init.h"
#include "SCHED/sched_eNB.h" #include "SCHED/sched_eNB.h"
#include "SCHED_NR/sched_nr.h" #include "SCHED_NR/sched_nr.h"
...@@ -1529,6 +1530,13 @@ void *ru_thread( void *param ) { ...@@ -1529,6 +1530,13 @@ void *ru_thread( void *param ) {
for (aa=0;aa<ru->nb_rx;aa++) for (aa=0;aa<ru->nb_rx;aa++)
memcpy((void*)RC.gNB[0]->common_vars.rxdataF[aa], memcpy((void*)RC.gNB[0]->common_vars.rxdataF[aa],
(void*)ru->common.rxdataF[aa], fp->symbols_per_slot*fp->ofdm_symbol_size*sizeof(int32_t)); (void*)ru->common.rxdataF[aa], fp->symbols_per_slot*fp->ofdm_symbol_size*sizeof(int32_t));
// Do PRACH RU processing
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
if (prach_id>=0) {
rx_nr_prach_ru(ru,ru->prach_list[prach_id].fmt,proc->frame_rx,proc->tti_rx);
free_nr_ru_prach_entry(ru,prach_id);
}
} }
// At this point, all information for subframe has been received on FH interface // At this point, all information for subframe has been received on FH interface
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "PHY/INIT/phy_init.h" #include "PHY/INIT/phy_init.h"
#include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "PHY/CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/NR_TRANSPORT/nr_transport.h" #include "PHY/NR_TRANSPORT/nr_transport.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto_common.h"
/*#include "RadioResourceConfigCommonSIB.h" /*#include "RadioResourceConfigCommonSIB.h"
#include "RadioResourceConfigDedicated.h" #include "RadioResourceConfigDedicated.h"
#include "TDD-Config.h" #include "TDD-Config.h"
...@@ -164,6 +165,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -164,6 +165,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
gNB->pusch_config.pusch_TimeDomainResourceAllocation[i]->mappingType = typeB; gNB->pusch_config.pusch_TimeDomainResourceAllocation[i]->mappingType = typeB;
} }
//
/// Transport init necessary for NR synchro /// Transport init necessary for NR synchro
init_nr_transport(gNB); init_nr_transport(gNB);
...@@ -218,6 +220,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -218,6 +220,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
*/ */
prach_vars->prach_ifft = (int32_t *)malloc16_clear(1024*2*sizeof(int32_t)); prach_vars->prach_ifft = (int32_t *)malloc16_clear(1024*2*sizeof(int32_t));
init_prach_list(gNB);
int N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value; int N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value;
printf("Before ULSCH init : %p\n",gNB->dlsch[0][0]->harq_processes[0]); printf("Before ULSCH init : %p\n",gNB->dlsch[0][0]->harq_processes[0]);
...@@ -458,6 +462,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -458,6 +462,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
return; return;
} }
compute_nr_prach_seq(gNB_config,0,RC.gNB[Mod_id]->X_u);
RC.gNB[Mod_id]->configured = 1; RC.gNB[Mod_id]->configured = 1;
LOG_I(PHY,"gNB %d configured\n",Mod_id); LOG_I(PHY,"gNB %d configured\n",Mod_id);
} }
......
...@@ -50,6 +50,9 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -50,6 +50,9 @@ int nr_phy_init_RU(RU_t *ru) {
cfg = &RC.gNB[n]->gNB_config; cfg = &RC.gNB[n]->gNB_config;
if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas) ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value; if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas) ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value;
} }
// copy configuration from gNB[0] in to RU, assume that all gNB instances sharing RU use the same configuration (at least the parts that are needed by the RU, numerology and PRACH)
memcpy((void*)&ru->config,(void*)&RC.gNB[0]->gNB_config,sizeof(ru->config));
AssertFatal(ru->nb_log_antennas > 0 && ru->nb_log_antennas < 13, "ru->nb_log_antennas %d ! \n",ru->nb_log_antennas); AssertFatal(ru->nb_log_antennas > 0 && ru->nb_log_antennas < 13, "ru->nb_log_antennas %d ! \n",ru->nb_log_antennas);
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals
// Time-domain signals // Time-domain signals
...@@ -148,6 +151,8 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -148,6 +151,8 @@ int nr_phy_init_RU(RU_t *ru) {
ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_subframe_wCP ); ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_subframe_wCP );
init_prach_ru_list(ru);
return(0); return(0);
} }
......
...@@ -39,6 +39,12 @@ extern uint16_t prach_root_sequence_map_abc[138]; ...@@ -39,6 +39,12 @@ extern uint16_t prach_root_sequence_map_abc[138];
extern uint16_t nr_du[838]; extern uint16_t nr_du[838];
extern int16_t nr_ru[2*839]; extern int16_t nr_ru[2*839];
void init_prach_list(PHY_VARS_gNB *gNB) {
AssertFatal(gNB!=NULL,"gNB is null\n");
for (int i=0; i<NUMBER_OF_NR_PRACH_MAX; i++) gNB->prach_vars.list[i].frame=-1;
}
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, int numRA, find_type_t type) { int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, int numRA, find_type_t type) {
uint16_t i; uint16_t i;
...@@ -63,9 +69,9 @@ void nr_fill_prach(PHY_VARS_gNB *gNB, ...@@ -63,9 +69,9 @@ void nr_fill_prach(PHY_VARS_gNB *gNB,
int Slot, int Slot,
nfapi_nr_prach_pdu_t *prach_pdu) { nfapi_nr_prach_pdu_t *prach_pdu) {
int prach_id = find_nr_prach(gNB,SFN,Slot,prach_pdu->num_ra,SEARCH_EXIST); int prach_id = find_nr_prach(gNB,SFN,Slot,prach_pdu->num_ra,SEARCH_EXIST_OR_FREE);
AssertFatal( (prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX), AssertFatal( (prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX),
"illegal or no prach_id found!!! numRA %d dlsch_id %d\n",prach_pdu->num_ra,prach_id); "illegal or no prach_id found!!! numRA %d prach_id %d\n",prach_pdu->num_ra,prach_id);
gNB->prach_vars.list[prach_id].frame=SFN; gNB->prach_vars.list[prach_id].frame=SFN;
gNB->prach_vars.list[prach_id].slot=Slot; gNB->prach_vars.list[prach_id].slot=Slot;
...@@ -73,20 +79,76 @@ void nr_fill_prach(PHY_VARS_gNB *gNB, ...@@ -73,20 +79,76 @@ void nr_fill_prach(PHY_VARS_gNB *gNB,
} }
void init_prach_ru_list(RU_t *ru) {
AssertFatal(ru!=NULL,"ruis null\n");
for (int i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) ru->prach_list[i].frame=-1;
pthread_mutex_init(&ru->prach_list_mutex,NULL);
}
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type) {
uint16_t i;
int16_t first_free_index=-1;
AssertFatal(ru!=NULL,"ru is null\n");
pthread_mutex_lock(&ru->prach_list_mutex);
for (i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) {
LOG_D(PHY,"searching for PRACH in %d.%d : prach_index %d=> %d.%d\n", frame,slot,i,
ru->prach_list[i].frame,ru->prach_list[i].slot);
if ((ru->prach_list[i].frame == frame) &&
(ru->prach_list[i].slot == slot)) {
pthread_mutex_unlock(&ru->prach_list_mutex);
return i;
}
else if ((ru->prach_list[i].frame == -1) && (first_free_index==-1)) first_free_index=i;
}
pthread_mutex_unlock(&ru->prach_list_mutex);
if (type == SEARCH_EXIST) return -1;
return first_free_index;
}
void nr_fill_prach_ru(RU_t *ru,
int SFN,
int Slot,
nfapi_nr_prach_pdu_t *prach_pdu) {
int prach_id = find_nr_prach_ru(ru,SFN,Slot,SEARCH_EXIST_OR_FREE);
AssertFatal( (prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX),
"illegal or no prach_id found!!! prach_id %d\n",prach_id);
pthread_mutex_lock(&ru->prach_list_mutex);
ru->prach_list[prach_id].frame = SFN;
ru->prach_list[prach_id].slot = Slot;
ru->prach_list[prach_id].fmt = prach_pdu->prach_format;
pthread_mutex_unlock(&ru->prach_list_mutex);
}
void free_nr_ru_prach_entry(RU_t *ru,
int prach_id) {
pthread_mutex_lock(&ru->prach_list_mutex);
ru->prach_list[prach_id].frame=-1;
pthread_mutex_unlock(&ru->prach_list_mutex);
}
const char *prachfmt[]={"A1","A2","A3","B1","B2","B3","B4","C0","C2"};
void rx_nr_prach_ru(RU_t *ru, void rx_nr_prach_ru(RU_t *ru,
nfapi_nr_prach_pdu_t *prach_pdu, int prach_fmt,
int frame, int frame,
int slot) { int slot) {
AssertFatal(ru!=NULL,"ru is null\n"); AssertFatal(ru!=NULL,"ru is null\n");
int16_t **rxsigF=NULL; int16_t **rxsigF=NULL;
NR_DL_FRAME_PARMS *fp=&ru->frame_parms; NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
int frame_type = ru->config.cell_config.frame_duplex_type.value;
int16_t *prach[ru->nb_rx]; int16_t *prach[ru->nb_rx];
uint8_t prach_fmt = prach_pdu->prach_format;
int prach_sequence_length = ru->config.prach_config.prach_sequence_length.value; int prach_sequence_length = ru->config.prach_config.prach_sequence_length.value;
int msg1_frequencystart = ru->config.prach_config.num_prach_fd_occasions_list[0].k1.value; int msg1_frequencystart = ru->config.prach_config.num_prach_fd_occasions_list[0].k1.value;
...@@ -104,6 +166,9 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -104,6 +166,9 @@ void rx_nr_prach_ru(RU_t *ru,
int16_t *prach2; int16_t *prach2;
if (prach_sequence_length == 0) { if (prach_sequence_length == 0) {
LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %d, msg1_frequencyStart %d\n",
ru->idx,frame,slot,prach_fmt,msg1_frequencystart);
AssertFatal(prach_fmt<4,"Illegal prach format %d for length 839\n",prach_fmt);
switch (prach_fmt) { switch (prach_fmt) {
case 0: case 0:
Ncp = 3168; Ncp = 3168;
...@@ -124,7 +189,11 @@ void rx_nr_prach_ru(RU_t *ru, ...@@ -124,7 +189,11 @@ void rx_nr_prach_ru(RU_t *ru,
} }
} }
else { else {
LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %s, msg1_frequencyStart %d\n",
ru->idx,frame,slot,prachfmt[prach_fmt],msg1_frequencystart);
switch (prach_fmt) { switch (prach_fmt) {
AssertFatal(prach_fmt<4,"Illegal prach format %d for length 139 (combined formats not supported yet)\n",prach_fmt);
case 0: //A1 case 0: //A1
Ncp = 288/(1<<mu); Ncp = 288/(1<<mu);
break; break;
...@@ -416,7 +485,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -416,7 +485,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
nfapi_nr_prach_config_t *cfg=&gNB->gNB_config.prach_config; nfapi_nr_prach_config_t *cfg=&gNB->gNB_config.prach_config;
NR_DL_FRAME_PARMS *fp; NR_DL_FRAME_PARMS *fp;
lte_frame_type_t frame_type;
uint16_t rootSequenceIndex; uint16_t rootSequenceIndex;
int numrootSequenceIndex; int numrootSequenceIndex;
uint8_t restricted_set; uint8_t restricted_set;
...@@ -455,10 +523,9 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -455,10 +523,9 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
nb_rx = gNB->gNB_config.carrier_config.num_rx_ant.value; nb_rx = gNB->gNB_config.carrier_config.num_rx_ant.value;
frame_type = gNB->gNB_config.cell_config.frame_duplex_type.value;
rootSequenceIndex = cfg->num_prach_fd_occasions_list[0].prach_root_sequence_index.value; rootSequenceIndex = cfg->num_prach_fd_occasions_list[0].prach_root_sequence_index.value;
numrootSequenceIndex = cfg->num_prach_fd_occasions_list[0].num_root_sequences.value; numrootSequenceIndex = cfg->num_prach_fd_occasions_list[0].num_root_sequences.value;
NCS = cfg->num_prach_fd_occasions_list[0].prach_zero_corr_conf.value; NCS = prach_pdu->num_cs;//cfg->num_prach_fd_occasions_list[0].prach_zero_corr_conf.value;
int prach_sequence_length = cfg->prach_sequence_length.value; int prach_sequence_length = cfg->prach_sequence_length.value;
int msg1_frequencystart = cfg->num_prach_fd_occasions_list[0].k1.value; int msg1_frequencystart = cfg->num_prach_fd_occasions_list[0].k1.value;
...@@ -473,7 +540,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -473,7 +540,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
uint8_t prach_fmt = prach_pdu->prach_format; uint8_t prach_fmt = prach_pdu->prach_format;
uint16_t N_ZC = (prach_sequence_length==0)?839:139; uint16_t N_ZC = (prach_sequence_length==0)?839:139;
LOG_D(PHY,"L1 PRACH RX: rooSequenceIndex %d, numRootSeqeuences %d, NCS %d, N_ZC %d \n", rootSequenceIndex,numrootSequenceIndex,NCS,N_ZC);
prach_ifft = gNB->prach_vars.prach_ifft; prach_ifft = gNB->prach_vars.prach_ifft;
prachF = gNB->prach_vars.prachF; prachF = gNB->prach_vars.prachF;
...@@ -501,6 +568,9 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -501,6 +568,9 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
*max_preamble_energy=0; *max_preamble_energy=0;
*max_preamble_delay=0;
*max_preamble=0;
for (preamble_index=0 ; preamble_index<64 ; preamble_index++) { for (preamble_index=0 ; preamble_index<64 ; preamble_index++) {
if (LOG_DEBUGFLAG(PRACH)){ if (LOG_DEBUGFLAG(PRACH)){
...@@ -540,13 +610,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -540,13 +610,6 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
// current root depending on rootSequenceIndex // current root depending on rootSequenceIndex
int index = (rootSequenceIndex + preamble_offset) % N_ZC; int index = (rootSequenceIndex + preamble_offset) % N_ZC;
if (prach_fmt<4) {
// prach_root_sequence_map points to prach_root_sequence_map0_3
DevAssert( index < sizeof(prach_root_sequence_map_0_3) / sizeof(prach_root_sequence_map_0_3[0]) );
} else {
// prach_root_sequence_map points to prach_root_sequence_map4
DevAssert( index < sizeof(prach_root_sequence_map_abc) / sizeof(prach_root_sequence_map_abc[0]) );
}
u = prach_root_sequence_map[index]; u = prach_root_sequence_map[index];
uint16_t n_group_ra = 0; uint16_t n_group_ra = 0;
...@@ -595,10 +658,17 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -595,10 +658,17 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
frame,subframe,preamble_index,NCS,N_ZC/NCS,preamble_offset,preamble_shift,en); frame,subframe,preamble_index,NCS,N_ZC/NCS,preamble_offset,preamble_shift,en);
} }
LOG_D(PHY,"PRACH RX preamble_index %d, preamble_offset %d\n",preamble_index,preamble_offset);
if (new_dft == 1) { if (new_dft == 1) {
new_dft = 0; new_dft = 0;
Xu=(int16_t*)gNB->X_u[preamble_offset-first_nonzero_root_idx]; Xu=(int16_t*)gNB->X_u[preamble_offset-first_nonzero_root_idx];
LOG_D(PHY,"PRACH RX new dft preamble_offset-first_nonzero_root_idx %d\n",preamble_index,preamble_offset-first_nonzero_root_idx);
memset(prach_ifft,0,((N_ZC==839) ? 2048 : 256)*sizeof(int32_t)); memset(prach_ifft,0,((N_ZC==839) ? 2048 : 256)*sizeof(int32_t));
......
...@@ -100,7 +100,7 @@ void nr_fill_du(uint16_t N_ZC,uint16_t *prach_root_sequence_map) ...@@ -100,7 +100,7 @@ void nr_fill_du(uint16_t N_ZC,uint16_t *prach_root_sequence_map)
void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config, void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config,
uint8_t fd_occasion, uint8_t fd_occasion,
uint32_t **X_u) uint32_t X_u[64][839])
{ {
// Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC) // Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC)
nfapi_nr_prach_config_t prach_config = config->prach_config; nfapi_nr_prach_config_t prach_config = config->prach_config;
...@@ -115,9 +115,9 @@ void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config, ...@@ -115,9 +115,9 @@ void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_IN);
#ifdef NR_PRACH_DEBUG
LOG_I(PHY,"compute_prach_seq: NCS_config %d, prach short sequence? %x\n",zeroCorrelationZoneConfig, prach_c); LOG_D(PHY,"compute_prach_seq: NCS_config %d, prach short sequence %x, num_Seqeuences %d, rootSequenceIndex %d\n",prach_config.num_prach_fd_occasions_list[fd_occasion].prach_zero_corr_conf.value, short_sequence, num_sequences, rootSequenceIndex);
#endif
N_ZC = (short_sequence) ? 139 : 839; N_ZC = (short_sequence) ? 139 : 839;
...@@ -133,9 +133,9 @@ void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config, ...@@ -133,9 +133,9 @@ void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config,
} }
#ifdef PRACH_DEBUG
LOG_I( PHY, "compute_prach_seq: done init prach_tables\n" ); LOG_D( PHY, "compute_prach_seq: done init prach_tables\n" );
#endif
for (i=0; i<num_sequences; i++) { for (i=0; i<num_sequences; i++) {
int index = (rootSequenceIndex+i) % (N_ZC-1); int index = (rootSequenceIndex+i) % (N_ZC-1);
......
...@@ -121,8 +121,21 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -121,8 +121,21 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
); );
void rx_nr_prach_ru(RU_t *ru, void rx_nr_prach_ru(RU_t *ru,
nfapi_nr_prach_pdu_t *prach_pdu, int prach_fmt,
int frame, int frame,
int subframe); int subframe);
void nr_fill_prach_ru(RU_t *ru,
int SFN,
int Slot,
nfapi_nr_prach_pdu_t *prach_pdu);
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, int numRA, find_type_t type);
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type);
void init_prach_list(PHY_VARS_gNB *gNB);
void init_prach_ru_list(RU_t *ru);
void free_nr_ru_prach_entry(RU_t *ru,
int prach_id);
#endif /*__NR_TRANSPORT__H__*/ #endif /*__NR_TRANSPORT__H__*/
...@@ -1672,8 +1672,8 @@ void compute_prach_seq(uint16_t rootSequenceIndex, ...@@ -1672,8 +1672,8 @@ void compute_prach_seq(uint16_t rootSequenceIndex,
uint32_t X_u[64][839]); uint32_t X_u[64][839]);
void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config, void compute_nr_prach_seq(nfapi_nr_config_request_scf_t *config,
uint8_t highSpeedFlag, uint8_t fd_occasion,
uint32_t **X_u); uint32_t X_u[64][839]);
void init_prach_tables(int N_ZC); void init_prach_tables(int N_ZC);
......
...@@ -72,6 +72,10 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, ...@@ -72,6 +72,10 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
ulsch->harq_mask |= 1<<harq_pid; ulsch->harq_mask |= 1<<harq_pid;
ulsch->harq_process_id[slot] = harq_pid; ulsch->harq_process_id[slot] = harq_pid;
ulsch->harq_processes[harq_pid]->frame=frame;
ulsch->harq_processes[harq_pid]->slot=slot;
ulsch->harq_processes[harq_pid]->handled= 0;
ulsch->harq_processes[harq_pid]->status= NR_ACTIVE;
nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch->harq_processes[harq_pid]->ulsch_pdu; nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch->harq_processes[harq_pid]->ulsch_pdu;
LOG_D(PHY,"Initializing nFAPI for ULSCH, UE %d, harq_pid %d\n",ulsch_id,harq_pid); LOG_D(PHY,"Initializing nFAPI for ULSCH, UE %d, harq_pid %d\n",ulsch_id,harq_pid);
......
...@@ -220,13 +220,13 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch) ...@@ -220,13 +220,13 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch)
/// Nfapi ULSCH PDU /// Nfapi ULSCH PDU
//nfapi_nr_ul_config_ulsch_pdu ulsch_pdu; //nfapi_nr_ul_config_ulsch_pdu ulsch_pdu;
ulsch->harq_processes[i]->frame=0; ulsch->harq_processes[i]->frame=0;
ulsch->harq_processes[i]->subframe=0; ulsch->harq_processes[i]->slot=0;
ulsch->harq_processes[i]->round=0; ulsch->harq_processes[i]->round=0;
ulsch->harq_processes[i]->TPC=0; ulsch->harq_processes[i]->TPC=0;
ulsch->harq_processes[i]->mimo_mode=0; ulsch->harq_processes[i]->mimo_mode=0;
ulsch->harq_processes[i]->dci_alloc=0; ulsch->harq_processes[i]->dci_alloc=0;
ulsch->harq_processes[i]->rar_alloc=0; ulsch->harq_processes[i]->rar_alloc=0;
ulsch->harq_processes[i]->status=0; ulsch->harq_processes[i]->status=NR_SCH_IDLE;
ulsch->harq_processes[i]->subframe_scheduling_flag=0; ulsch->harq_processes[i]->subframe_scheduling_flag=0;
ulsch->harq_processes[i]->subframe_cba_scheduling_flag=0; ulsch->harq_processes[i]->subframe_cba_scheduling_flag=0;
ulsch->harq_processes[i]->phich_active=0; ulsch->harq_processes[i]->phich_active=0;
......
...@@ -189,6 +189,14 @@ typedef struct RU_feptx_t_s{ ...@@ -189,6 +189,14 @@ typedef struct RU_feptx_t_s{
int index; int index;
}RU_feptx_t; }RU_feptx_t;
typedef struct {
int frame;
int slot;
int fmt;
} RU_PRACH_list_t;
#define NUMBER_OF_NR_RU_PRACH_MAX 8
typedef struct RU_proc_t_s { typedef struct RU_proc_t_s {
/// Pointer to associated RU descriptor /// Pointer to associated RU descriptor
struct RU_t_s *ru; struct RU_t_s *ru;
...@@ -582,6 +590,10 @@ typedef struct RU_t_s { ...@@ -582,6 +590,10 @@ typedef struct RU_t_s {
int32_t *bw_list[NUMBER_OF_eNB_MAX+1]; int32_t *bw_list[NUMBER_OF_eNB_MAX+1];
/// beamforming weight vectors /// beamforming weight vectors
int32_t **beam_weights[NUMBER_OF_eNB_MAX+1][15]; int32_t **beam_weights[NUMBER_OF_eNB_MAX+1][15];
/// prach commands
RU_PRACH_list_t prach_list[NUMBER_OF_NR_RU_PRACH_MAX];
/// mutex for prach_list access
pthread_mutex_t prach_list_mutex;
/// received frequency-domain signal for PRACH (IF4p5 RRU) /// received frequency-domain signal for PRACH (IF4p5 RRU)
int16_t **prach_rxsigF; int16_t **prach_rxsigF;
/// received frequency-domain signal for PRACH BR (IF4p5 RRU) /// received frequency-domain signal for PRACH BR (IF4p5 RRU)
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#define MAX_NUM_RU_PER_gNB MAX_NUM_RU_PER_eNB #define MAX_NUM_RU_PER_gNB MAX_NUM_RU_PER_eNB
typedef struct { typedef struct {
uint32_t pbch_a; uint32_t pbch_a;
uint32_t pbch_a_interleaved; uint32_t pbch_a_interleaved;
...@@ -176,8 +177,8 @@ typedef struct { ...@@ -176,8 +177,8 @@ typedef struct {
nfapi_nr_ul_config_ulsch_pdu ulsch_pdu; nfapi_nr_ul_config_ulsch_pdu ulsch_pdu;
/// Frame where current HARQ round was sent /// Frame where current HARQ round was sent
uint32_t frame; uint32_t frame;
/// Subframe where current HARQ round was sent /// Slot where current HARQ round was sent
uint32_t subframe; uint32_t slot;
/// Index of current HARQ round for this DLSCH /// Index of current HARQ round for this DLSCH
uint8_t round; uint8_t round;
/// Last TPC command /// Last TPC command
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
#include "fapi_nr_l1.h" #include "fapi_nr_l1.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/NR_TRANSPORT/nr_transport.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h" #include "PHY/NR_TRANSPORT/nr_dlsch.h"
#include "PHY/NR_TRANSPORT/nr_dci.h" #include "PHY/NR_TRANSPORT/nr_dci.h"
...@@ -148,10 +149,11 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -148,10 +149,11 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
uint8_t number_ul_dci_pdu = (UL_dci_req==NULL) ? 0 : UL_dci_req->numPdus; 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; uint8_t number_ul_tti_pdu = (UL_tti_req==NULL) ? 0 : UL_tti_req->n_pdus;
LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SLOT:%04d%d DL_req:SFN/SLO:%04d%d:dl_pdu:%d tx_req:SFN/SLOT:%04d%d:pdus:%d;\n", LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SLOT:%04d%d DL_req:SFN/SLO:%04d%d:dl_pdu:%d tx_req:SFN/SLOT:%04d%d:pdus:%d;ul_dci %d ul_tti %d\n",
frame,slot, frame,slot,
DL_req->SFN,DL_req->Slot,number_dl_pdu, DL_req->SFN,DL_req->Slot,number_dl_pdu,
TX_req->SFN,TX_req->Slot,TX_req->Number_of_PDUs); TX_req->SFN,TX_req->Slot,TX_req->Number_of_PDUs,
number_ul_dci_pdu,number_ul_tti_pdu);
int pdcch_received=0; int pdcch_received=0;
gNB->num_pdsch_rnti=0; gNB->num_pdsch_rnti=0;
...@@ -204,7 +206,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -204,7 +206,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
switch (UL_tti_req->pdus_list[i].pdu_type) { switch (UL_tti_req->pdus_list[i].pdu_type) {
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE for %d.%d\n",frame,slot,UL_tti_req->SFN,UL_tti_req->Slot); LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE for %d.%d\n",frame,slot,UL_tti_req->SFN,UL_tti_req->Slot);
nr_fill_ulsch(gNB,frame,slot,&UL_tti_req->pdus_list[i].pusch_pdu); nr_fill_ulsch(gNB,UL_tti_req->SFN,UL_tti_req->Slot,&UL_tti_req->pdus_list[i].pusch_pdu);
break; break;
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE for %d.%d\n",frame,slot,UL_tti_req->SFN,UL_tti_req->Slot); LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE for %d.%d\n",frame,slot,UL_tti_req->SFN,UL_tti_req->Slot);
...@@ -214,6 +216,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -214,6 +216,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE for %d.%d\n",frame,slot,UL_tti_req->SFN,UL_tti_req->Slot); LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE for %d.%d\n",frame,slot,UL_tti_req->SFN,UL_tti_req->Slot);
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu; nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu;
nr_fill_prach(gNB,UL_tti_req->SFN,UL_tti_req->Slot,prach_pdu); nr_fill_prach(gNB,UL_tti_req->SFN,UL_tti_req->Slot,prach_pdu);
nr_fill_prach_ru(gNB->RU_list[0],UL_tti_req->SFN,UL_tti_req->Slot,prach_pdu);
break; break;
} }
} }
......
...@@ -373,6 +373,7 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -373,6 +373,7 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
for(symbol = 0; symbol < NR_SYMBOLS_PER_SLOT; symbol++) { for(symbol = 0; symbol < NR_SYMBOLS_PER_SLOT; symbol++) {
// nr_slot_fep_ul(gNB, symbol, proc->slot_rx, 0, 0); // nr_slot_fep_ul(gNB, symbol, proc->slot_rx, 0, 0);
for (aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) { for (aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
nr_slot_fep_ul(&gNB->frame_parms, nr_slot_fep_ul(&gNB->frame_parms,
gNB->common_vars.rxdata[aa], gNB->common_vars.rxdata[aa],
...@@ -391,12 +392,24 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -391,12 +392,24 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
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);
for (int ULSCH_id=0;ULSCH_id<NUMBER_OF_NR_ULSCH_MAX;ULSCH_id++) { for (int ULSCH_id=0;ULSCH_id<NUMBER_OF_NR_ULSCH_MAX;ULSCH_id++) {
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id]; NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0];
int harq_pid;
NR_UL_gNB_HARQ_t *ulsch_harq;
if ((ulsch) &&
(ulsch->rnti > 0)) {
// for for an active HARQ process
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)){
if (ulsch->rnti > 0) { uint8_t symbol_start = ulsch_harq->ulsch_pdu.ulsch_pdu_rel15.start_symbol;
uint8_t harq_pid = ulsch->harq_process_id[slot_rx]; uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.ulsch_pdu_rel15.number_symbols;
uint8_t symbol_start = ulsch->harq_processes[harq_pid]->ulsch_pdu.ulsch_pdu_rel15.start_symbol;
uint8_t symbol_end = symbol_start + ulsch->harq_processes[harq_pid]->ulsch_pdu.ulsch_pdu_rel15.number_symbols;
for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) { for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) {
nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid); nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid);
...@@ -406,6 +419,9 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -406,6 +419,9 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid); nr_ulsch_procedures(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid);
nr_fill_rx_indication(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid); // indicate SDU to MAC nr_fill_rx_indication(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid); // indicate SDU to MAC
nr_fill_crc_indication(gNB, frame_rx, slot_rx, ULSCH_id, 0); nr_fill_crc_indication(gNB, frame_rx, slot_rx, ULSCH_id, 0);
break;
}
}
} }
} }
} }
...@@ -39,6 +39,7 @@ void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME ...@@ -39,6 +39,7 @@ void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, int frame_tx, int slot_tx, int do_meas); void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, 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); void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx);
void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx); void 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,nfapi_nr_prach_pdu_t *prach_pdu);
void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot); void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot);
void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx); void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx);
void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx); void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx);
......
...@@ -158,7 +158,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm ...@@ -158,7 +158,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL)
nb_preambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; nb_preambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles;
cfg->prach_config.prach_sequence_length.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present; cfg->prach_config.prach_sequence_length.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present-1;
cfg->prach_config.prach_sequence_length.tl.tag = NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG; cfg->prach_config.prach_sequence_length.tl.tag = NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG;
cfg->num_tlv++; cfg->num_tlv++;
......
...@@ -501,7 +501,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -501,7 +501,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
if (is_nr_UL_slot(cc->ServingCellConfigCommon,slot_rxP)) { if (is_nr_UL_slot(cc->ServingCellConfigCommon,slot_rxP)) {
schedule_nr_prach(module_idP, frame_rxP, slot_rxP); schedule_nr_prach(module_idP, (frame_rxP+1)&1023, slot_rxP);
if (phy_test && slot_rxP==8){ if (phy_test && slot_rxP==8){
nr_schedule_uss_ulsch_phytest(module_idP, frame_rxP, slot_rxP); nr_schedule_uss_ulsch_phytest(module_idP, frame_rxP, slot_rxP);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment