Commit fdaf4ff9 authored by cig's avatar cig

Fixed warnings gNB compilation

parent 3341846d
...@@ -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 */
......
...@@ -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);
......
...@@ -211,12 +211,4 @@ uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx); ...@@ -211,12 +211,4 @@ uint8_t nr_get_Qm_dl(uint8_t Imcs, uint8_t table_idx);
uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx); uint32_t nr_get_code_rate_ul(uint8_t Imcs, uint8_t table_idx);
uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx); uint32_t nr_get_code_rate_dl(uint8_t Imcs, uint8_t table_idx);
\ No newline at end of file
void rx_nr_prach(PHY_VARS_gNB *gNB,
int frame,
int subframe,
uint16_t *max_preamble,
uint16_t *max_preamble_energy,
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);
......
...@@ -314,10 +314,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -314,10 +314,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;
......
...@@ -37,7 +37,9 @@ ...@@ -37,7 +37,9 @@
/* Utils */ /* Utils */
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "common/utils/nr/nr_common.h"
#include "UTIL/OPT/opt.h" #include "UTIL/OPT/opt.h"
#include "SIMULATION/TOOLS/sim.h" // for taus
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
...@@ -59,7 +61,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -59,7 +61,6 @@ void nr_initiate_ra_proc(module_id_t module_idP,
uint16_t preamble_index, uint16_t preamble_index,
int16_t timing_offset, int16_t timing_offset,
uint16_t ra_rnti){ uint16_t ra_rnti){
uint8_t i;
uint16_t msg2_frame = frameP, msg2_slot = slotP; uint16_t msg2_frame = frameP, msg2_slot = slotP;
int offset; int offset;
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
...@@ -140,7 +141,7 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ ...@@ -140,7 +141,7 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
//uint8_t i = 0; //uint8_t i = 0;
int CC_id = 0; int CC_id = 0;
gNB_MAC_INST *mac = RC.mac[module_idP]; gNB_MAC_INST *mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
NR_RA_t *ra = &cc->ra[0]; NR_RA_t *ra = &cc->ra[0];
...@@ -156,13 +157,139 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ ...@@ -156,13 +157,139 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
//generate_Msg4(module_idP, CC_id, frameP, slotP, ra); //generate_Msg4(module_idP, CC_id, frameP, slotP, ra);
break; break;
case WAIT_Msg4_ACK: case WAIT_Msg4_ACK:
check_Msg4_retransmission(module_idP, CC_id, frameP, slotP, ra); //check_Msg4_retransmission(module_idP, CC_id, frameP, slotP, ra);
break;
default:
break; break;
} }
//} //}
stop_meas(&mac->schedule_ra); stop_meas(&mac->schedule_ra);
} }
// WIP
// todo: fix
void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP){
gNB_MAC_INST *mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
NR_RA_t *ra = &cc->ra[0];
NR_UE_list_t *UE_list = &mac->UE_list;
nfapi_nr_ul_tti_request_t *ul_req = &mac->UL_tti_req[0];
nfapi_nr_ul_dci_request_t *UL_dci_req = &mac->UL_dci_req[0];
nfapi_nr_pusch_pdu_t *pusch_pdu = &ul_req->pdus_list[0].pusch_pdu;
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu = &UL_dci_req->ul_dci_pdu_list[UL_dci_req->numPdus];
int UE_id = 0, CCEIndex, dci_formats[2], rnti_types[2], bwp_id = 1, coreset_id = 0, aggregation = 4, search_space = 1;
AssertFatal(ra->state != RA_IDLE, "RA is not active for RA %X\n", ra->rnti);
// if(N_RB_UL == 25) {
// ra->msg3_first_rb = 1;
// } else {
// if (cc->tdd_Config && N_RB_UL == 100) {
// ra->msg3_first_rb = 3;
// } else {
// ra->msg3_first_rb = 2;
// }
// }
// ra->msg3_nb_rb = 1;
// /* UL Grant */
// ra->msg3_mcs = 10;
// ra->msg3_TPC = 3;
// ra->msg3_ULdelay = 0;
// ra->msg3_cqireq = 0;
// ra->msg3_round = 0;
LOG_D(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot);
ul_req->SFN = ra->Msg3_frame << 4 | ra->Msg3_slot;
ul_req->Slot = slotP;
ul_req->n_pdus = 1;
ul_req->pdus_list[0].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE;
ul_req->pdus_list[0].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t));
memset((void*)ul_dci_request_pdu,0,sizeof(nfapi_nr_ul_dci_request_pdus_t));
ul_dci_request_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15;
AssertFatal(UE_list->active[UE_id] >=0,"Cannot find UE_id %d is not active\n", UE_id);
NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id];
AssertFatal(secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
"downlinkBWP_ToAddModList has %d BWP!\n", secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
LOG_D(MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n",
frameP,
slotP,
ra->Msg3_frame,
ra->Msg3_slot,
ra->msg3_nb_rb,
ra->msg3_first_rb,
ra->msg3_round,
ra->rnti);
pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
pusch_pdu->rnti = ra->rnti;
pusch_pdu->handle = 0;
pusch_pdu->bwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
pusch_pdu->bwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
pusch_pdu->subcarrier_spacing = ubwp->bwp_Common->genericParameters.subcarrierSpacing;
pusch_pdu->cyclic_prefix = 0;
pusch_pdu->mcs_index = 9;
pusch_pdu->mcs_table = 0;
pusch_pdu->target_code_rate = nr_get_code_rate_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
pusch_pdu->qam_mod_order = nr_get_Qm_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
pusch_pdu->transform_precoding = 0;
pusch_pdu->data_scrambling_id = 0;
pusch_pdu->nrOfLayers = 1;
pusch_pdu->ul_dmrs_symb_pos = 1;
pusch_pdu->dmrs_config_type = 0;
pusch_pdu->ul_dmrs_scrambling_id = 0; //If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id.
pusch_pdu->scid = 0; //DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]. Should match what is sent in DCI 0_1, otherwise set to 0.
pusch_pdu->resource_alloc = 1; //type 1
//pusch_pdu->rb_bitmap;// for ressource alloc type 0
pusch_pdu->rb_start = ra->msg3_first_rb;
pusch_pdu->rb_size = ra->msg3_nb_rb;
pusch_pdu->vrb_to_prb_mapping = 0;
pusch_pdu->frequency_hopping = 0;
//pusch_pdu->tx_direct_current_location;//The uplink Tx Direct Current location for the carrier. Only values in the value range of this field between 0 and 3299, which indicate the subcarrier index within the carrier corresponding 1o the numerology of the corresponding uplink BWP and value 3300, which indicates "Outside the carrier" and value 3301, which indicates "Undetermined position within the carrier" are used. [TS38.331, UplinkTxDirectCurrentBWP IE]
pusch_pdu->uplink_frequency_shift_7p5khz = 0;
//Resource Allocation in time domain
pusch_pdu->start_symbol_index = 2;
pusch_pdu->nr_of_symbols = 12;
//Optional Data only included if indicated in pduBitmap
pusch_pdu->pusch_data.rv_index = 0;
pusch_pdu->pusch_data.harq_process_id = 0;
pusch_pdu->pusch_data.new_data_indicator = 0;
pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->mcs_index,
pusch_pdu->target_code_rate,
pusch_pdu->rb_size,
pusch_pdu->nr_of_symbols,
6, //nb_re_dmrs - not sure where this is coming from - its not in the FAPI
0, //nb_rb_oh
pusch_pdu->nrOfLayers = 1);
pusch_pdu->pusch_data.num_cb = 0;
CCEIndex = allocate_nr_CCEs(mac, bwp_id, coreset_id, aggregation, search_space, UE_id, 0);
AssertFatal(CCEIndex >= 0, "CCEIndex is negative\n");
pdcch_pdu_rel15->dci_pdu.CceIndex[pdcch_pdu_rel15->numDlDci] = CCEIndex;
LOG_D(PHY, "CCEIndex %d\n", pdcch_pdu_rel15->dci_pdu.CceIndex[pdcch_pdu_rel15->numDlDci]);
LOG_D(MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frameP,slotP);
nr_configure_pdcch(pdcch_pdu_rel15, 1, scc, bwp);
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
config_uldci(ubwp, pusch_pdu, pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types);
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[0] = nr_dci_size(dci_formats[0], rnti_types[0], pdcch_pdu_rel15->BWPSize);
fill_dci_pdu_rel15(pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types);
}
// WIP // WIP
// todo: // todo:
// - fix me // - fix me
...@@ -172,7 +299,7 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -172,7 +299,7 @@ void nr_generate_Msg2(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t slotP){ sub_frame_t slotP){
int first_rb, UE_id = 0, dci_formats[2], rnti_types[2], CCEIndex, dlBWP_carrier_bandwidth, mcsIndex = 9; int UE_id = 0, dci_formats[2], rnti_types[2], CCEIndex, dlBWP_carrier_bandwidth, mcsIndex = 9;
int startSymbolAndLength = 0, StartSymbolIndex = -1, NrOfSymbols = 14, StartSymbolIndex_tmp, NrOfSymbols_tmp, x_Overhead, time_domain_assignment = 2; int startSymbolAndLength = 0, StartSymbolIndex = -1, NrOfSymbols = 14, StartSymbolIndex_tmp, NrOfSymbols_tmp, x_Overhead, time_domain_assignment = 2;
int bwp_id = 1, coreset_id = 0, aggregation = 4, search_space = 0, N_RB_UL = 106; int bwp_id = 1, coreset_id = 0, aggregation = 4, search_space = 0, N_RB_UL = 106;
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
...@@ -188,14 +315,13 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -188,14 +315,13 @@ void nr_generate_Msg2(module_id_t module_idP,
// todo // todo
// Allocate 4 PRBS starting in RB 0 // Allocate 4 PRBS starting in RB 0
// first_rb = 0; // int first_rb = 0;
// vrb_map[first_rb] = 1; // vrb_map[first_rb] = 1;
// vrb_map[first_rb + 1] = 1; // vrb_map[first_rb + 1] = 1;
// vrb_map[first_rb + 2] = 1; // vrb_map[first_rb + 2] = 1;
// vrb_map[first_rb + 3] = 1; // vrb_map[first_rb + 3] = 1;
nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body; nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body;
nfapi_nr_dl_tti_request_pdu_t *dl_config_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
...@@ -358,8 +484,7 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -358,8 +484,7 @@ void nr_generate_Msg2(module_id_t module_idP,
} }
void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){
unsigned char i; NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[0];
NR_RA_t *ra = &RC.mac[module_idP]->common_channels[CC_id].ra[0];
LOG_D(MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra->rnti); LOG_D(MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra->rnti);
ra->state = IDLE; ra->state = IDLE;
ra->timing_offset = 0; ra->timing_offset = 0;
...@@ -402,128 +527,4 @@ void nr_fill_rar(NR_RA_t * ra, ...@@ -402,128 +527,4 @@ void nr_fill_rar(NR_RA_t * ra,
// rar->UL_GRANT_2 = (uint8_t) (buffer >> 16) & 0xFF; // rar->UL_GRANT_2 = (uint8_t) (buffer >> 16) & 0xFF;
// rar->UL_GRANT_3 = (uint8_t) (buffer >> 8) & 0xFF; // rar->UL_GRANT_3 = (uint8_t) (buffer >> 8) & 0xFF;
// rar->UL_GRANT_4 = (uint8_t) buffer & 0xff; // rar->UL_GRANT_4 = (uint8_t) buffer & 0xff;
}
// WIP
// todo: fix
void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP){
gNB_MAC_INST *mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
NR_RA_t *ra = &cc->ra[0];
NR_UE_list_t *UE_list = &mac->UE_list;
nfapi_nr_ul_tti_request_t *ul_req = &mac->UL_tti_req[0];
nfapi_nr_ul_dci_request_t *UL_dci_req = &mac->UL_dci_req[0];
nfapi_nr_pusch_pdu_t *pusch_pdu = &ul_req->pdus_list[0].pusch_pdu;
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu = &UL_dci_req->ul_dci_pdu_list[UL_dci_req->numPdus];
int UE_id = 0, CCEIndex, dci_formats[2], rnti_types[2], bwp_id = 1, coreset_id = 0, aggregation = 4, search_space = 1;
AssertFatal(ra->state != IDLE, "RA is not active for RA %X\n", ra->rnti);
// if(N_RB_UL == 25) {
// ra->msg3_first_rb = 1;
// } else {
// if (cc->tdd_Config && N_RB_UL == 100) {
// ra->msg3_first_rb = 3;
// } else {
// ra->msg3_first_rb = 2;
// }
// }
// ra->msg3_nb_rb = 1;
// /* UL Grant */
// ra->msg3_mcs = 10;
// ra->msg3_TPC = 3;
// ra->msg3_ULdelay = 0;
// ra->msg3_cqireq = 0;
// ra->msg3_round = 0;
LOG_D(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot);
ul_req->SFN = ra->Msg3_frame << 4 | ra->Msg3_slot;
ul_req->Slot = slotP;
ul_req->n_pdus = 1;
ul_req->pdus_list[0].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE;
ul_req->pdus_list[0].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t));
memset((void*)ul_dci_request_pdu,0,sizeof(nfapi_nr_ul_dci_request_pdus_t));
ul_dci_request_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15;
AssertFatal(UE_list->active[UE_id] >=0,"Cannot find UE_id %d is not active\n", UE_id);
NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id];
AssertFatal(secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
"downlinkBWP_ToAddModList has %d BWP!\n", secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
LOG_D(MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n",
frameP,
slotP,
ra->Msg3_frame,
ra->Msg3_slot,
ra->msg3_nb_rb,
ra->msg3_first_rb,
ra->msg3_round,
ra->rnti);
pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
pusch_pdu->rnti = ra->rnti;
pusch_pdu->handle = 0;
pusch_pdu->bwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
pusch_pdu->bwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
pusch_pdu->subcarrier_spacing = ubwp->bwp_Common->genericParameters.subcarrierSpacing;
pusch_pdu->cyclic_prefix = 0;
pusch_pdu->mcs_index = 9;
pusch_pdu->mcs_table = 0;
pusch_pdu->target_code_rate = nr_get_code_rate_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
pusch_pdu->qam_mod_order = nr_get_Qm_ul(pusch_pdu->mcs_index,pusch_pdu->mcs_table);
pusch_pdu->transform_precoding = 0;
pusch_pdu->data_scrambling_id = 0;
pusch_pdu->nrOfLayers = 1;
pusch_pdu->ul_dmrs_symb_pos = 1;
pusch_pdu->dmrs_config_type = 0;
pusch_pdu->ul_dmrs_scrambling_id = 0; //If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id.
pusch_pdu->scid = 0; //DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]. Should match what is sent in DCI 0_1, otherwise set to 0.
pusch_pdu->resource_alloc = 1; //type 1
//pusch_pdu->rb_bitmap;// for ressource alloc type 0
pusch_pdu->rb_start = ra->msg3_first_rb;
pusch_pdu->rb_size = ra->msg3_nb_rb;
pusch_pdu->vrb_to_prb_mapping = 0;
pusch_pdu->frequency_hopping = 0;
//pusch_pdu->tx_direct_current_location;//The uplink Tx Direct Current location for the carrier. Only values in the value range of this field between 0 and 3299, which indicate the subcarrier index within the carrier corresponding 1o the numerology of the corresponding uplink BWP and value 3300, which indicates "Outside the carrier" and value 3301, which indicates "Undetermined position within the carrier" are used. [TS38.331, UplinkTxDirectCurrentBWP IE]
pusch_pdu->uplink_frequency_shift_7p5khz = 0;
//Resource Allocation in time domain
pusch_pdu->start_symbol_index = 2;
pusch_pdu->nr_of_symbols = 12;
//Optional Data only included if indicated in pduBitmap
pusch_pdu->pusch_data.rv_index = 0;
pusch_pdu->pusch_data.harq_process_id = 0;
pusch_pdu->pusch_data.new_data_indicator = 0;
pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->mcs_index,
pusch_pdu->target_code_rate,
pusch_pdu->rb_size,
pusch_pdu->nr_of_symbols,
6, //nb_re_dmrs - not sure where this is coming from - its not in the FAPI
0, //nb_rb_oh
pusch_pdu->nrOfLayers = 1);
pusch_pdu->pusch_data.num_cb = 0;
CCEIndex = allocate_nr_CCEs(mac, bwp_id, coreset_id, aggregation, search_space, UE_id, 0);
AssertFatal(CCEIndex >= 0, "CCEIndex is negative\n");
pdcch_pdu_rel15->dci_pdu.CceIndex[pdcch_pdu_rel15->numDlDci] = CCEIndex;
LOG_D(PHY, "CCEIndex %d\n", pdcch_pdu_rel15->dci_pdu.CceIndex[pdcch_pdu_rel15->numDlDci]);
LOG_D(MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frameP,slotP);
nr_configure_pdcch(pdcch_pdu_rel15, 1, scc, bwp);
dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET];
config_uldci(ubwp, pusch_pdu, pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types);
pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[0] = nr_dci_size(dci_formats[0], rnti_types[0], pdcch_pdu_rel15->BWPSize);
fill_dci_pdu_rel15(pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types);
} }
\ No newline at end of file
...@@ -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