Commit 2c108cf8 authored by Francesco Mani's avatar Francesco Mani

Merge branch 'NR_RRCConfiguration' of...

Merge branch 'NR_RRCConfiguration' of https://gitlab.eurecom.fr/oai/openairinterface5g into NR_RRCConfiguration
parents 1fb76326 911319fa
......@@ -352,32 +352,30 @@ static void UE_synch(void *arg) {
}
}
void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
nr_dcireq_t dcireq;
nr_scheduled_response_t scheduled_response;
void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
uint32_t nb_rb, start_rb;
uint8_t nb_symb_sch, start_symbol, mcs, precod_nbr_layers, harq_pid, rvidx;
uint16_t n_rnti;
// Process Rx data for one sub-frame
if (nr_slot_select(&UE->frame_parms, proc->frame_tx, proc->nr_tti_tx) & NR_DOWNLINK_SLOT) {
//TODO: all of this has to be moved to the MAC!!!
nr_dcireq_t dcireq;
nr_scheduled_response_t scheduled_response;
// program PUSCH. this should actually be done by the MAC upon reception of an UL DCI
if (proc->nr_tti_tx == NR_UPLINK_SLOT || UE->frame_parms.frame_type == FDD){
dcireq.module_id = UE->Mod_id;
dcireq.gNB_index = 0;
dcireq.cc_id = 0;
dcireq.frame = proc->frame_rx;
dcireq.slot = proc->nr_tti_rx;
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
scheduled_response.dl_config = &dcireq.dl_config_req;
scheduled_response.dl_config = NULL;
scheduled_response.ul_config = &dcireq.ul_config_req;
scheduled_response.tx_request = NULL;
scheduled_response.module_id = UE->Mod_id;
scheduled_response.CC_id = 0;
scheduled_response.frame = proc->frame_rx;
scheduled_response.slot = proc->nr_tti_rx;
//--------------------------Temporary configuration-----------------------------//
n_rnti = 0x1234;
nb_rb = 50;
......@@ -388,7 +386,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
mcs = 9;
harq_pid = 0;
rvidx = 0;
//------------------------------------------------------------------------------//
//------------------------------------------------------------------------------//
scheduled_response.ul_config->sfn_slot = NR_UPLINK_SLOT;
scheduled_response.ul_config->number_pdus = 1;
......@@ -403,8 +401,45 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.rv = rvidx;
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.n_layers = precod_nbr_layers;
scheduled_response.ul_config->ul_config_list[0].ulsch_config_pdu.ulsch_pdu_rel15.harq_process_nbr = harq_pid;
nr_ue_scheduled_response(&scheduled_response);
if (UE->mode != loop_through_memory) {
uint8_t thread_id = PHY_vars_UE_g[UE->Mod_id][0]->current_thread_id[proc->nr_tti_tx];
phy_procedures_nrUE_TX(UE,proc,0,thread_id);
}
}
}
void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
nr_dcireq_t dcireq;
nr_scheduled_response_t scheduled_response;
//program DCI for slot 1
//TODO: all of this has to be moved to the MAC!!!
if (proc->nr_tti_tx == NR_DOWNLINK_SLOT || UE->frame_parms.frame_type == FDD){
dcireq.module_id = UE->Mod_id;
dcireq.gNB_index = 0;
dcireq.cc_id = 0;
dcireq.frame = proc->frame_rx;
dcireq.slot = proc->nr_tti_rx;
nr_ue_dcireq(&dcireq); //to be replaced with function pointer later
// we should have received a DL DCI here, so configure DL accordingly
scheduled_response.dl_config = &dcireq.dl_config_req;
scheduled_response.ul_config = NULL;
scheduled_response.tx_request = NULL;
scheduled_response.module_id = UE->Mod_id;
scheduled_response.CC_id = 0;
scheduled_response.frame = proc->frame_rx;
scheduled_response.slot = proc->nr_tti_rx;
nr_ue_scheduled_response(&scheduled_response);
}
// Process Rx data for one sub-frame
if ( proc->nr_tti_rx >=0 && proc->nr_tti_rx <= 1 ) {
#ifdef UE_SLOT_PARALLELISATION
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
#else
......@@ -413,15 +448,15 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_tti_rx, (rdtsc()-a)/3500);
//printf(">>> nr_ue_pdcch_procedures ended\n");
#endif
if(IS_SOFTMODEM_NOS1){ //&& proc->nr_tti_rx==1
//Hardcoded rnti value
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO,
0x1234, proc->frame_rx,
proc->nr_tti_rx, 0);
pdcp_run(&ctxt);
pdcp_fifo_flush_sdus(&ctxt);
}
if(IS_SOFTMODEM_NOS1){ //&& proc->nr_tti_rx==1
//Hardcoded rnti value
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO,
0x1234, proc->frame_rx,
proc->nr_tti_rx, 0);
pdcp_run(&ctxt);
pdcp_fifo_flush_sdus(&ctxt);
}
}
......@@ -456,45 +491,14 @@ typedef struct processingData_s {
} processingData_t;
void UE_processing(void *arg) {
uint8_t thread_id;
processingData_t *rxtxD=(processingData_t *) arg;
UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
PHY_VARS_NR_UE *UE = rxtxD->UE;
processSlotRX(UE, proc);
//printf(">>> mac ended\n");
// Prepare the future Tx data
/*
#ifndef NO_RAT_NR
if (slot_select_nr(&UE->frame_parms, proc->frame_tx, proc->nr_tti_tx) & NR_UPLINK_SLOT)
#else
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) )
#endif
*/
if (proc->nr_tti_tx == NR_UPLINK_SLOT || UE->frame_parms.frame_type == FDD){
thread_id = PHY_vars_UE_g[UE->Mod_id][0]->current_thread_id[proc->nr_tti_tx];
if (UE->mode != loop_through_memory)
phy_procedures_nrUE_TX(UE,proc,0,thread_id);
}
//phy_procedures_UE_TX(UE,proc,0,0,UE->mode,no_relay);
#if 0
processSlotRX(UE, proc);
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) &&
(UE->frame_parms.frame_type == TDD))
if (UE->mode != loop_through_memory)
//phy_procedures_UE_S_TX(UE,0,0,no_relay);
updateTimes(current, &t3, 10000, timing_proc_name);
processSlotTX(UE, proc);
#endif
}
void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
......@@ -812,12 +816,12 @@ if (slot_nr==18)
void init_NR_UE(int nb_inst, char* rrc_config_path) {
int inst;
NR_UE_MAC_INST_t *mac_inst;
NR_UE_RRC_INST_t* rrc_inst;
for (inst=0; inst < nb_inst; inst++) {
nr_l3_init_ue(rrc_config_path);
nr_l2_init_ue();
mac_inst = get_mac_inst(inst);
AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initial IF module\n");
AssertFatal((rrc_inst = nr_l3_init_ue(rrc_config_path)) != NULL, "can not initialize RRC module\n");
AssertFatal((mac_inst = nr_l2_init_ue(rrc_inst)) != NULL, "can not initialize L2 module\n");
AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initialize IF module\n");
}
}
......@@ -838,6 +842,4 @@ void init_NR_UE_threads(int nb_inst) {
#endif
}
printf("UE threads created by %ld\n", gettid());
}
......@@ -766,11 +766,14 @@ int main( int argc, char **argv ) {
#else
PHY_vars_UE_g[0][CC_id]->hw_timing_advance = 160;
#endif
}
init_NR_UE_threads(1);
printf("UE threads created by %ld\n", gettid());
// wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n");
init_NR_UE_threads(1);
while(true)
sleep(3600);
......
......@@ -268,27 +268,24 @@ int nr_rrc_mac_config_req_ue(
int cc_idP,
uint8_t gNB_index,
NR_MIB_t *mibP,
NR_ServingCellConfigCommon_t *sccP,
// NR_ServingCellConfigCommon_t *sccP,
// NR_MAC_CellGroupConfig_t *mac_cell_group_configP,
// NR_PhysicalCellGroupConfig_t *phy_cell_group_configP,
NR_SpCellConfig_t *spCell_ConfigP ){
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
// NR_ServingCellConfig_t *serving_cell_config = spcell_configP->spCellConfigDedicated;
// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
// NR_ServingCellConfig_t *serving_cell_config = spcell_configP->spCellConfigDedicated;
// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
NR_ServingCellConfigCommon_t *scc;
if(mibP != NULL){
mac->mib = mibP; // update by every reception
}
if(spCell_ConfigP != NULL ){
mac->servCellIndex = spCell_ConfigP->servCellIndex;
mac->servCellIndex = *spCell_ConfigP->servCellIndex;
if (spCell_ConfigP->reconfigurationWithSync) {
mac->scc = spCell_ConfigP->reconfigurationWithSync->spCellConfigCommon;
config_common_ue(mac);
......
......@@ -35,7 +35,9 @@
#include "mac_defs.h"
#include "mac.h"
#include <openair1/PHY/defs_nr_UE.h>
#include "PHY/defs_nr_UE.h"
#include "RRC/NR_UE/rrc_defs.h"
/**\brief decode mib pdu in NR_UE, from if_module ul_ind with P7 tx_ind message
\param module_id module id
......@@ -70,11 +72,11 @@ int nr_rrc_mac_config_req_ue(
int cc_idP,
uint8_t gNB_index,
NR_MIB_t *mibP,
NR_ServingCellConfigCommon_t *sccP,
//NR_ServingCellConfigCommon_t *sccP,
NR_SpCellConfig_t *spCell_ConfigP);
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
int nr_l2_init_ue(void);
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst);
/**\brief fetch MAC instance by module_id, within 0 - (NB_NR_UE_MAC_INST-1)
\param module_id index of MAC instance(s)*/
......
......@@ -36,8 +36,7 @@
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
int
nr_l2_init_ue(void)
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
{
//LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
......@@ -45,6 +44,8 @@ nr_l2_init_ue(void)
//init mac here
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)malloc(sizeof(NR_UE_MAC_INST_t)*NB_NR_UE_MAC_INST);
nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config->spCellConfig);
if (IS_SOFTMODEM_NOS1){
if (rlc_module_init(0) != 0) {
......@@ -55,7 +56,7 @@ nr_l2_init_ue(void)
}
return (1);
return (nr_ue_mac_inst);
}
NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id){
......
......@@ -1826,7 +1826,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
if(dlsch_config_pdu != NULL){
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL;
if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList)
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList;
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup;
else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList)
pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
if (pdsch_TimeDomainAllocationList) {
......@@ -1866,7 +1866,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
if(ulsch_config_pdu != NULL){
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
if (mac->ULbwp[0]->bwp_Dedicated->pusch_Config)
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList;
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup;
if (pusch_TimeDomainAllocationList) {
AssertFatal(pusch_TimeDomainAllocationList->list.count > time_domain_ind,
......
......@@ -33,11 +33,9 @@
#include "defs.h"
#include "rrc_proto.h"
int nr_l3_init_ue(char* rrc_config_path){
NR_UE_RRC_INST_t* nr_l3_init_ue(char* rrc_config_path){
//LOG_I(RRC, "[MAIN] NR UE MAC initialization...\n");
openair_rrc_top_init_ue_nr(rrc_config_path);
return 0;
return openair_rrc_top_init_ue_nr(rrc_config_path);
}
......@@ -80,7 +80,7 @@ int8_t nr_rrc_ue_decode_secondary_cellgroup_config(
SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)cell_group_config, 0);
}
//nr_rrc_mac_config_req_ue( module_id_t module_id, int CC_id, uint8_t gNB_index, NR_MIB_t *mibP, NR_MAC_CellGroupConfig_t *mac_cell_group_configP, NR_PhysicalCellGroupConfig_t *phy_cell_group_configP, NR_SpCellConfig_t *spcell_configP );
//nr_rrc_mac_config_req_ue( 0,0,0,NULL, cell_group_config->mac_CellGroupConfig, cell_group_config->physicalCellGroupConfig, cell_group_config->spCellConfig );
return 0;
}
......@@ -124,8 +124,9 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(NR_RRCReconfiguration_t *rrcReconfig
nr_rrc_ue_process_scg_config(cellGroupConfig);
}else{
// after first time, update it and free the memory after.
SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)NR_UE_rrc_inst->cell_group_config, 0);
NR_UE_rrc_inst->cell_group_config = cellGroupConfig;
nr_rrc_ue_process_scg_config(cellGroupConfig);
SEQUENCE_free(&asn_DEF_NR_CellGroupConfig, (void *)cellGroupConfig, 0);
}
}
......@@ -168,8 +169,7 @@ int8_t nr_rrc_ue_process_meas_config(NR_MeasConfig_t *meas_config){
int8_t nr_rrc_ue_process_scg_config(NR_CellGroupConfig_t *cell_group_config){
int i;
if(NR_UE_rrc_inst->cell_group_config==NULL){
// initial list
// initial list
if(cell_group_config->spCellConfig != NULL){
if(cell_group_config->spCellConfig->spCellConfigDedicated != NULL){
if(cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList != NULL){
......@@ -179,8 +179,6 @@ int8_t nr_rrc_ue_process_scg_config(NR_CellGroupConfig_t *cell_group_config){
}
}
}
}else{
// maintain list
if(cell_group_config->spCellConfig != NULL){
......@@ -259,7 +257,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type,
}
int8_t openair_rrc_top_init_ue_nr(char* rrc_config_path){
NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){
if(NB_NR_UE_INST > 0){
NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)malloc(NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t));
......@@ -347,7 +345,7 @@ int8_t openair_rrc_top_init_ue_nr(char* rrc_config_path){
NR_UE_rrc_inst = NULL;
}
return 0;
return NR_UE_rrc_inst;
}
......@@ -418,7 +416,7 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(
// (void *)&bcch_message->message.choice.mib,
// sizeof(NR_MIB_t) );
nr_rrc_mac_config_req_ue( 0, 0, 0, mib, NULL, NULL);
nr_rrc_mac_config_req_ue( 0, 0, 0, mib, NULL);
}
return 0;
......
......@@ -67,7 +67,7 @@ typedef struct NR_UE_RRC_INST_s {
NR_MeasConfig_t *meas_config;
NR_CellGroupConfig_t *cell_group_config;
NR_RadioBearerConfig_t *radio_bearer_config;
NR_MIB_t *mib;
// lists
......
......@@ -43,14 +43,14 @@
// main_rrc.c
//
/**\brief Layer 3 initialization*/
int nr_l3_init_ue(char*);
NR_UE_RRC_INST_t* nr_l3_init_ue(char*);
//
// UE_rrc.c
//
/**\brief Initial the top level RRC structure instance*/
int8_t openair_rrc_top_init_ue_nr(char*);
NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char*);
......
......@@ -33,7 +33,7 @@ gNBs =
# downlinkConfigCommon
#frequencyInfoDL
# this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP)
absoluteFrequencySSB = 642016;
absoluteFrequencySSB = 642364;
dl_frequencyBand = 78;
# this is 3600 MHz
dl_absoluteFrequencyPointA = 640000;
......@@ -152,7 +152,7 @@ gNBs =
# ssb_periodicityServingCell
# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
ssb_periodicityServingCell = 2;
ssb_periodicityServingCell = 1;
# dmrs_TypeA_position
# 0 = pos2, 1 = pos3
......
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