Commit 7c9372d7 authored by Raymond Knopp's avatar Raymond Knopp

Merge branch 'NR_RRC_PRACH_procedures' of...

Merge branch 'NR_RRC_PRACH_procedures' of https://gitlab.eurecom.fr/oai/openairinterface5g into NR_RRC_PRACH_procedures

Conflicts:
	openair1/PHY/NR_TRANSPORT/nr_transport_proto.h
	openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
parents e8834e96 f8523b6c
...@@ -2154,7 +2154,6 @@ void init_NR_RU(char *rf_config_file) ...@@ -2154,7 +2154,6 @@ void init_NR_RU(char *rf_config_file)
PHY_VARS_gNB *gNB0= (PHY_VARS_gNB *)NULL; PHY_VARS_gNB *gNB0= (PHY_VARS_gNB *)NULL;
NR_DL_FRAME_PARMS *fp = (NR_DL_FRAME_PARMS *)NULL; NR_DL_FRAME_PARMS *fp = (NR_DL_FRAME_PARMS *)NULL;
int i; int i;
int CC_id;
// create status mask // create status mask
RC.ru_mask = 0; RC.ru_mask = 0;
pthread_mutex_init(&RC.ru_mutex,NULL); pthread_mutex_init(&RC.ru_mutex,NULL);
......
...@@ -778,7 +778,6 @@ int stop_L1L2(module_id_t gnb_id) { ...@@ -778,7 +778,6 @@ int stop_L1L2(module_id_t gnb_id) {
*/ */
int restart_L1L2(module_id_t gnb_id) { int restart_L1L2(module_id_t gnb_id) {
RU_t *ru = RC.ru[gnb_id]; RU_t *ru = RC.ru[gnb_id];
int cc_id;
MessageDef *msg_p = NULL; MessageDef *msg_p = NULL;
LOG_W(GNB_APP, "restarting nr-softmodem\n"); LOG_W(GNB_APP, "restarting nr-softmodem\n");
/* block threads */ /* block threads */
......
...@@ -1028,10 +1028,12 @@ typedef struct ...@@ -1028,10 +1028,12 @@ typedef struct
{ {
uint16_t phys_cell_id; uint16_t phys_cell_id;
uint8_t num_prach_ocas; uint8_t num_prach_ocas;
// SCF PRACH PDU format field does not consider A1/B1 etc. possibilities
// We added 9 = A1/B1 10 = A2/B2 11 A3/B3
uint8_t prach_format; uint8_t prach_format;
uint8_t num_ra; uint8_t num_ra;
uint8_t prach_start_symbol; uint8_t prach_start_symbol;
uint16_t num_cs;// uint16_t num_cs;
nfapi_nr_ul_beamforming_t beamforming; nfapi_nr_ul_beamforming_t beamforming;
} nfapi_nr_prach_pdu_t; } nfapi_nr_prach_pdu_t;
......
...@@ -90,7 +90,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch, ...@@ -90,7 +90,7 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr,uint16_t N_RB); void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch); void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
//#define DEBUG_DLSCH_FREE 1 //#define DEBUG_DLSCH_FREE 1
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr,uint16_t N_RB) void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB)
{ {
int i; int i;
int r; int r;
...@@ -132,7 +132,7 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr,uint16_t N_RB) ...@@ -132,7 +132,7 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr,uint16_t N_RB)
} }
free16(dlsch,sizeof(NR_gNB_DLSCH_t)); free16(dlsch,sizeof(NR_gNB_DLSCH_t));
dlsch = NULL; *dlschptr = NULL;
} }
} }
...@@ -273,7 +273,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, ...@@ -273,7 +273,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
LOG_D(PHY,"new_gNB_dlsch exit flag %d, size of %ld\n", LOG_D(PHY,"new_gNB_dlsch exit flag %d, size of %ld\n",
exit_flag, sizeof(NR_gNB_DLSCH_t)); exit_flag, sizeof(NR_gNB_DLSCH_t));
free_gNB_dlsch(dlsch,N_RB); free_gNB_dlsch(&dlsch, N_RB);
return(NULL); return(NULL);
......
...@@ -43,9 +43,6 @@ extern uint16_t NCS_restricted_TypeB_delta_f_RA_5[14]; ...@@ -43,9 +43,6 @@ extern uint16_t NCS_restricted_TypeB_delta_f_RA_5[14];
extern uint16_t NCS_unrestricted_delta_f_RA_15[16]; extern uint16_t NCS_unrestricted_delta_f_RA_15[16];
extern uint16_t prach_root_sequence_map_0_3[838]; extern uint16_t prach_root_sequence_map_0_3[838];
extern uint16_t prach_root_sequence_map_abc[138]; extern uint16_t prach_root_sequence_map_abc[138];
extern int64_t table_6_3_3_2_2_prachConfig_Index [256][9];
extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
extern int64_t table_6_3_3_2_4_prachConfig_Index [256][10];
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];
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -111,7 +111,7 @@ int is_nr_prach_subframe(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t ...@@ -111,7 +111,7 @@ int is_nr_prach_subframe(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t
uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
// For FR1 paired /* // For FR1 paired
if (frame_parms->frame_type == FDD && frame_parms->freq_range == nr_FR1){ if (frame_parms->frame_type == FDD && frame_parms->freq_range == nr_FR1){
if (((frame%table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][3]) && if (((frame%table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][3]) &&
((table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][4]&(1<<subframe)) == 1)) { ((table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][4]&(1<<subframe)) == 1)) {
...@@ -130,7 +130,7 @@ int is_nr_prach_subframe(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t ...@@ -130,7 +130,7 @@ int is_nr_prach_subframe(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t
return 0; return 0;
} }
} }
/*
// For FR2: FIXME // For FR2: FIXME
if ((((frame%table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][3]) || if ((((frame%table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][3]) ||
((frame%table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][4])) ((frame%table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][4]))
...@@ -157,9 +157,9 @@ int do_prach_rx(NR_DL_FRAME_PARMS *fp,int frame,int slot) { ...@@ -157,9 +157,9 @@ int do_prach_rx(NR_DL_FRAME_PARMS *fp,int frame,int slot) {
uint16_t get_nr_prach_fmt(int prach_ConfigIndex,lte_frame_type_t frame_type, nr_frequency_range_e fr) uint16_t get_nr_prach_fmt(int prach_ConfigIndex,lte_frame_type_t frame_type, nr_frequency_range_e fr)
{ {
if (frame_type==FDD) return (table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][0]); // if using table 6.3.3.2-2: Random access configurations for FR1 and paired spectrum/supplementary uplink /* if (frame_type==FDD) return (table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][0]); // if using table 6.3.3.2-2: Random access configurations for FR1 and paired spectrum/supplementary uplink
else if (fr==nr_FR1) return (table_6_3_3_2_3_prachConfig_Index[prach_ConfigIndex][0]); // if using table 6.3.3.2-3: Random access configurations for FR1 and unpaired spectrum else if (fr==nr_FR1) return (table_6_3_3_2_3_prachConfig_Index[prach_ConfigIndex][0]); // if using table 6.3.3.2-3: Random access configurations for FR1 and unpaired spectrum
else AssertFatal(1==0,"FR2 prach configuration not supported yet\n"); else AssertFatal(1==0,"FR2 prach configuration not supported yet\n");*/
// For FR2 not implemented. FIXME // For FR2 not implemented. FIXME
} }
...@@ -218,9 +218,9 @@ void compute_nr_prach_seq(uint16_t rootSequenceIndex, ...@@ -218,9 +218,9 @@ void compute_nr_prach_seq(uint16_t rootSequenceIndex,
AssertFatal(zeroCorrelationZoneConfig<=15, AssertFatal(zeroCorrelationZoneConfig<=15,
"FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", zeroCorrelationZoneConfig ); "FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", zeroCorrelationZoneConfig );
if (prach_fmt<3) NCS = NCS_unrestricted_delta_f_RA_125[zeroCorrelationZoneConfig]; /* if (prach_fmt<3) NCS = NCS_unrestricted_delta_f_RA_125[zeroCorrelationZoneConfig];
if (prach_fmt==3) NCS = NCS_unrestricted_delta_f_RA_5[zeroCorrelationZoneConfig]; if (prach_fmt==3) NCS = NCS_unrestricted_delta_f_RA_5[zeroCorrelationZoneConfig];
if (prach_fmt>3) NCS = NCS_unrestricted_delta_f_RA_15[zeroCorrelationZoneConfig]; if (prach_fmt>3) NCS = NCS_unrestricted_delta_f_RA_15[zeroCorrelationZoneConfig];*/
num_preambles = (NCS==0) ? 64 : ((64*NCS)/N_ZC); num_preambles = (NCS==0) ? 64 : ((64*NCS)/N_ZC);
...@@ -235,7 +235,7 @@ void compute_nr_prach_seq(uint16_t rootSequenceIndex, ...@@ -235,7 +235,7 @@ void compute_nr_prach_seq(uint16_t rootSequenceIndex,
AssertFatal(zeroCorrelationZoneConfig<=14, AssertFatal(zeroCorrelationZoneConfig<=14,
"FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", zeroCorrelationZoneConfig ); "FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", zeroCorrelationZoneConfig );
if (prach_fmt<3){ /* if (prach_fmt<3){
if (restricted_Type == 0) NCS = NCS_restricted_TypeA_delta_f_RA_125[zeroCorrelationZoneConfig]; // for TypeA, this is hardcoded. FIXME if (restricted_Type == 0) NCS = NCS_restricted_TypeA_delta_f_RA_125[zeroCorrelationZoneConfig]; // for TypeA, this is hardcoded. FIXME
if (restricted_Type == 1) NCS = NCS_restricted_TypeB_delta_f_RA_125[zeroCorrelationZoneConfig]; // for TypeB, this is hardcoded. FIXME if (restricted_Type == 1) NCS = NCS_restricted_TypeB_delta_f_RA_125[zeroCorrelationZoneConfig]; // for TypeB, this is hardcoded. FIXME
} }
...@@ -245,7 +245,7 @@ void compute_nr_prach_seq(uint16_t rootSequenceIndex, ...@@ -245,7 +245,7 @@ void compute_nr_prach_seq(uint16_t rootSequenceIndex,
} }
if (prach_fmt>3){ if (prach_fmt>3){
} }*/
nr_fill_du(prach_fmt); nr_fill_du(prach_fmt);
......
...@@ -221,3 +221,4 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -221,3 +221,4 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
uint16_t *max_preamble_energy, uint16_t *max_preamble_energy,
uint16_t *max_preamble_delay uint16_t *max_preamble_delay
); );
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/phy_extern.h" #include "PHY/phy_extern.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_TRANSPORT/nr_transport.h"
#include "nfapi_nr_interface_scf.h" #include "nfapi_nr_interface_scf.h"
#include "fapi_nr_l1.h" #include "fapi_nr_l1.h"
#include "nfapi_pnf.h" #include "nfapi_pnf.h"
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#include "intertask_interface.h" #include "intertask_interface.h"
extern uint32_t nfapi_mode; extern uint8_t nfapi_mode;
extern int oai_nfapi_nr_rach_ind(nfapi_rach_indication_t *rach_ind); extern int oai_nfapi_nr_rach_ind(nfapi_rach_indication_t *rach_ind);
......
...@@ -391,15 +391,15 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -391,15 +391,15 @@ 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) {
nfapi_nr_ul_tti_request_t *UL_tti_req = &gNB->UL_tti_req; nfapi_nr_ul_tti_request_t *UL_tti_req = &gNB->UL_tti_req;
int num_pusch_pdu = UL_tti_req->n_pdus; int num_pdus = UL_tti_req->n_pdus;
LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d, num_pusch_pdu %d\n",frame_rx,slot_rx,num_pusch_pdu); LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d, num_pdus %d\n",frame_rx,slot_rx,num_pdus);
gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus = 0; gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus = 0;
for (int i = 0; i < num_pusch_pdu; i++) { for (int i = 0; i < num_pdus; i++) {
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\n",frame_rx,slot_rx); LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE\n",frame_rx,slot_rx);
nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu; nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu;
...@@ -418,7 +418,13 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -418,7 +418,13 @@ 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;
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE\n",frame_rx,slot_rx);
break;
case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE:
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE\n",frame_rx,slot_rx);
break;
} }
} }
} }
...@@ -216,11 +216,9 @@ void nr_dump_dlsch_SI(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id, ...@@ -216,11 +216,9 @@ void nr_dump_dlsch_SI(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,
unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162}; unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,398,447,501,562,631,708,794,891,1000,1122,1258,1412,1585,1778,1995,2239,2512,2818,3162};
#endif #endif
unsigned int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL) int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){
{
int gain_dB = power_dBm - power_max_dBm; int gain_dB = power_dBm - power_max_dBm, amp_x_100 = -1;
int amp_x_100;
switch (N_RB_UL) { switch (N_RB_UL) {
case 6: case 6:
...@@ -242,17 +240,19 @@ unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,3 ...@@ -242,17 +240,19 @@ unsigned int gain_table[31] = {100,112,126,141,158,178,200,224,251,282,316,359,3
amp_x_100 = 408*AMP; // 408 = 100*sqrt(100/6) amp_x_100 = 408*AMP; // 408 = 100*sqrt(100/6)
break; break;
default: default:
LOG_E(PHY,"Unknown PRB size %d\n",N_RB_UL); LOG_E(PHY, "Unknown PRB size %d\n", N_RB_UL);
//mac_xface->macphy_exit(""); return (amp_x_100);
break; break;
} }
if (gain_dB < -30) { if (gain_dB < -30) {
return(amp_x_100/3162); return (amp_x_100/3162);
} else if (gain_dB>0) } else if (gain_dB > 0)
return(amp_x_100); return (amp_x_100);
else else
return(amp_x_100/gain_table[-gain_dB]); // 245 corresponds to the factor sqrt(25/6) return (amp_x_100/gain_table[-gain_dB]); // 245 corresponds to the factor sqrt(25/6)
}
return (amp_x_100);
}
#if 0 #if 0
...@@ -4489,7 +4489,7 @@ uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue, ...@@ -4489,7 +4489,7 @@ uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,
// - power control as per 38.213 ch 7.4 // - power control as per 38.213 ch 7.4
void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, runmode_t runmode) { void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, runmode_t runmode) {
int frame_tx = proc->frame_tx, nr_tti_tx = proc->nr_tti_tx, prach_power; int frame_tx = proc->frame_tx, nr_tti_tx = proc->nr_tti_tx, prach_power, tx_amp;
uint16_t preamble_tx = 50, pathloss; uint16_t preamble_tx = 50, pathloss;
uint8_t mod_id = ue->Mod_id; uint8_t mod_id = ue->Mod_id;
UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id); UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id);
...@@ -4541,9 +4541,9 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ...@@ -4541,9 +4541,9 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
//ue->tx_total_RE[nr_tti_tx] = 96; // todo //ue->tx_total_RE[nr_tti_tx] = 96; // todo
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706) #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
ue->prach_vars[gNB_id]->amp = get_tx_amp_prach(ue->tx_power_dBm[nr_tti_tx], tx_amp = get_tx_amp_prach(ue->tx_power_dBm[nr_tti_tx], ue->tx_power_max_dBm, ue->frame_parms.N_RB_UL);
ue->tx_power_max_dBm, if (tx_amp != -1)
ue->frame_parms.N_RB_UL); ue->prach_vars[gNB_id]->amp = tx_amp;
#else #else
ue->prach_vars[gNB_id]->amp = AMP; ue->prach_vars[gNB_id]->amp = AMP;
#endif #endif
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -42,6 +42,19 @@ uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, ui ...@@ -42,6 +42,19 @@ uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, ui
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols); int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
int get_nr_prach_info_from_index(uint8_t index,
int frame,
int slot,
uint32_t pointa,
uint8_t mu,
uint8_t unpaired,
uint16_t *format,
uint8_t *start_symbol,
uint8_t *N_t_slot,
uint8_t *N_dur);
uint16_t get_NCS(uint8_t index, uint16_t format, uint8_t restricted_set_config);
typedef enum { typedef enum {
NR_DL_DCI_FORMAT_1_0 = 0, NR_DL_DCI_FORMAT_1_0 = 0,
NR_DL_DCI_FORMAT_1_1, NR_DL_DCI_FORMAT_1_1,
......
...@@ -122,13 +122,23 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm ...@@ -122,13 +122,23 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
} }
} }
lte_frame_type_t frame_type;
uint16_t band;
int32_t offset;
get_band((cfg->carrier_config.dl_frequency.value)*1000,
&band,
&offset,
&frame_type);
RC.nrmac[Mod_idP]->common_channels[0].frame_type = frame_type;
// Cell configuration // Cell configuration
cfg->cell_config.phy_cell_id.value = *scc->physCellId; cfg->cell_config.phy_cell_id.value = *scc->physCellId;
cfg->cell_config.phy_cell_id.tl.tag = NFAPI_NR_CONFIG_PHY_CELL_ID_TAG; cfg->cell_config.phy_cell_id.tl.tag = NFAPI_NR_CONFIG_PHY_CELL_ID_TAG;
cfg->num_tlv++; cfg->num_tlv++;
cfg->cell_config.frame_duplex_type.value = 1; cfg->cell_config.frame_duplex_type.value = frame_type;
cfg->cell_config.frame_duplex_type.tl.tag = NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG; cfg->cell_config.frame_duplex_type.tl.tag = NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG;
cfg->num_tlv++; cfg->num_tlv++;
......
...@@ -263,18 +263,122 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram ...@@ -263,18 +263,122 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
} }
*/ */
/*
void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
// schedule PRACH for iniital BWP
if (is_initialBWP_prach_subframe(frameP,subframeP)<0) return; void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) {
// fill FAPI gNB_MAC_INST *gNB = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = gNB->common_channels;
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[module_idP]->UL_tti_req[0];
uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex;
uint8_t mu,N_dur,N_t_slot,start_symbol;
uint16_t format;
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing)
mu = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg1_SubcarrierSpacing;
else
mu = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
// prach is scheduled according to configuration index and tables 6.3.3.2.2 to 6.3.3.2.4
if ( get_nr_prach_info_from_index(config_index,
(int)frameP,
(int)slotP,
scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA,
mu,
cc->frame_type,
&format,
&start_symbol,
&N_t_slot,
&N_dur) ) {
int fdm = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FDM;
uint16_t format0 = format&0xff; // first column of format from table
uint16_t format1 = (format>>8)&0xff; // second column of format from table
UL_tti_req->SFN = frameP;
UL_tti_req->Slot = slotP;
for (int n=0; n<(1<<fdm); n++) { // one structure per frequency domain occasion
UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE;
UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_prach_pdu_t);
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[UL_tti_req->n_pdus].prach_pdu;
memset(prach_pdu,0,sizeof(nfapi_nr_prach_pdu_t));
UL_tti_req->n_pdus+=1;
// filling the prach fapi structure
prach_pdu->phys_cell_id = *scc->physCellId;
prach_pdu->num_prach_ocas = N_t_slot;
prach_pdu->prach_start_symbol = start_symbol;
prach_pdu->num_ra = n;
prach_pdu->num_cs = get_NCS(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig,
format0,
scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig);
// SCF PRACH PDU format field does not consider A1/B1 etc. possibilities
// We added 9 = A1/B1 10 = A2/B2 11 A3/B3
if (format1!=0xff) {
switch(format0) {
case 0xa1:
prach_pdu->prach_format = 9;
break;
case 0xa2:
prach_pdu->prach_format = 10;
break;
case 0xa3:
prach_pdu->prach_format = 10;
break;
default:
AssertFatal(1==0,"Only formats A1/B1 A2/B2 A3/B3 are valid for dual format");
}
}
else{
switch(format0) {
case 0xa1:
prach_pdu->prach_format = 0;
break;
case 0xa2:
prach_pdu->prach_format = 1;
break;
case 0xa3:
prach_pdu->prach_format = 2;
break;
case 0xb1:
prach_pdu->prach_format = 3;
break;
case 0xb2:
prach_pdu->prach_format = 4;
break;
case 0xb3:
prach_pdu->prach_format = 5;
break;
case 0xb4:
prach_pdu->prach_format = 6;
break;
case 0xc0:
prach_pdu->prach_format = 7;
break;
case 0xc2:
prach_pdu->prach_format = 8;
break;
case 0:
// long formats are handled @ PHY
break;
case 1:
// long formats are handled @ PHY
break;
case 2:
// long formats are handled @ PHY
break;
case 3:
// long formats are handled @ PHY
break;
default:
AssertFatal(1==0,"Invalid PRACH format");
}
}
}
}
} }
*/
/* /*
void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) void copy_nr_ulreq(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
...@@ -314,10 +418,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -314,10 +418,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
//printf("gNB_dlsch_ulsch_scheduler frameRX %d slotRX %d frameTX %d slotTX %d\n",frame_rxP,slot_rxP,frame_txP,slot_txP); //printf("gNB_dlsch_ulsch_scheduler frameRX %d slotRX %d frameTX %d slotTX %d\n",frame_rxP,slot_rxP,frame_txP,slot_txP);
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
int CC_id, i = -1, UE_id = 0; int CC_id, UE_id = 0; // i = -1
gNB_MAC_INST *gNB = RC.nrmac[module_idP]; gNB_MAC_INST *gNB = RC.nrmac[module_idP];
NR_UE_list_t *UE_list = &gNB->UE_list; NR_UE_list_t *UE_list = &gNB->UE_list;
rnti_t rnti; // rnti_t rnti;
UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; UE_sched_ctrl_t *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
NR_COMMON_channels_t *cc = gNB->common_channels; NR_COMMON_channels_t *cc = gNB->common_channels;
...@@ -382,7 +486,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -382,7 +486,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// Phytest scheduling // Phytest scheduling
if (phy_test && slot_txP==1){ if (phy_test && slot_txP==1){
nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP,NULL); nr_schedule_uss_dlsch_phytest(module_idP, frame_txP, slot_txP,NULL);
nr_schedule_RA(module_idP, frame_txP, slot_txP); //nr_schedule_RA(module_idP, frame_txP, slot_txP);
// resetting ta flag // resetting ta flag
gNB->ta_len = 0; gNB->ta_len = 0;
} }
...@@ -396,6 +500,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -396,6 +500,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
} //is_nr_DL_slot } //is_nr_DL_slot
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);
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);
} }
......
...@@ -716,11 +716,11 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP, ...@@ -716,11 +716,11 @@ void nr_schedule_uss_ulsch_phytest(int Mod_idP,
UL_tti_req->SFN = frameP; UL_tti_req->SFN = frameP;
UL_tti_req->Slot = slotP; UL_tti_req->Slot = slotP;
UL_tti_req->n_pdus = 1; UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE;
UL_tti_req->pdus_list[0].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE; UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
UL_tti_req->pdus_list[0].pdu_size = sizeof(nfapi_nr_pusch_pdu_t); nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[UL_tti_req->n_pdus].pusch_pdu;
nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu;
memset(pusch_pdu,0,sizeof(nfapi_nr_pusch_pdu_t)); memset(pusch_pdu,0,sizeof(nfapi_nr_pusch_pdu_t));
UL_tti_req->n_pdus+=1;
LOG_D(MAC, "Scheduling UE specific PUSCH\n"); LOG_D(MAC, "Scheduling UE specific PUSCH\n");
//UL_tti_req = &nr_mac->UL_tti_req[CC_id]; //UL_tti_req = &nr_mac->UL_tti_req[CC_id];
......
...@@ -141,6 +141,7 @@ typedef struct { ...@@ -141,6 +141,7 @@ typedef struct {
int p_gNB; int p_gNB;
int Ncp; int Ncp;
int nr_band; int nr_band;
lte_frame_type_t frame_type;
uint64_t dl_CarrierFreq; uint64_t dl_CarrierFreq;
NR_BCCH_BCH_Message_t *mib; NR_BCCH_BCH_Message_t *mib;
NR_ServingCellConfigCommon_t *ServingCellConfigCommon; NR_ServingCellConfigCommon_t *ServingCellConfigCommon;
......
...@@ -64,7 +64,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -64,7 +64,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
rrc_gNB_carrier_data_t *carrier; rrc_gNB_carrier_data_t *carrier;
NR_BCCH_BCH_Message_t *mib; NR_BCCH_BCH_Message_t *mib;
NR_SRB_INFO * srb_info; NR_SRB_INFO * srb_info;
char payload_size, payload_pP; char payload_size, *payload_pP;
rrc = RC.nrrrc[Mod_idP]; rrc = RC.nrrrc[Mod_idP];
carrier = &rrc->carrier; carrier = &rrc->carrier;
...@@ -96,7 +96,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -96,7 +96,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
//struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti); //struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti);
//if (ue_context_p == NULL) return(0); //if (ue_context_p == NULL) return(0);
//eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; //eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
LOG_D(RRC,"[gNB %d] Frame %d CCCH request (Srb_id %d)\n", Mod_idP, frameP, Srb_id); LOG_D(RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id);
// srb_info=&ue_p->Srb0; // srb_info=&ue_p->Srb0;
...@@ -107,7 +107,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, ...@@ -107,7 +107,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
payload_pP = srb_info->Tx_buffer.Payload; payload_pP = srb_info->Tx_buffer.Payload;
LOG_D(RRC,"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, buffer_pP, payload_pP); LOG_D(RRC,"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, buffer_pP, payload_pP);
// Fill buffer // Fill buffer
memcpy(buffer_pP, payload_pP, payload_size); memcpy((void *)buffer_pP, (void*)payload_pP, payload_size);
Sdu_size = payload_size; Sdu_size = payload_size;
srb_info->Tx_buffer.payload_size = 0; srb_info->Tx_buffer.payload_size = 0;
} }
......
...@@ -130,7 +130,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ...@@ -130,7 +130,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config));
memset((void*)CG_Config,0,sizeof(*CG_Config)); memset((void*)CG_Config,0,sizeof(*CG_Config));
int CG_Config_size = generate_CG_Config(rrc,CG_Config,ue_context_p->ue_context.reconfig,ue_context_p->ue_context.rb_config); //int CG_Config_size = generate_CG_Config(rrc,CG_Config,ue_context_p->ue_context.reconfig,ue_context_p->ue_context.rb_config);
//X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = CG_Config_size; //Need to verify correct value for the buffer_size //X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = CG_Config_size; //Need to verify correct value for the buffer_size
// Send to X2 entity to transport to MeNB // Send to X2 entity to transport to MeNB
......
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