Merge remote-tracking branch 'origin/NR_RA_cleanup' into integration_2021_wk05
This commit is contained in:
@@ -2109,10 +2109,10 @@ set (MAC_NR_SRC_UE
|
||||
${NR_UE_MAC_DIR}/mac_vars.c
|
||||
${NR_UE_MAC_DIR}/main_ue_nr.c
|
||||
${NR_UE_MAC_DIR}/nr_ue_procedures.c
|
||||
${NR_UE_MAC_DIR}/nr_ue_scheduler.c
|
||||
${NR_UE_MAC_DIR}/nr_ue_dci_configuration.c
|
||||
${NR_UE_MAC_DIR}/nr_l1_helpers.c
|
||||
${NR_UE_MAC_DIR}/nr_ra_procedures.c
|
||||
${NR_UE_MAC_DIR}/rar_tools_nrUE.c
|
||||
)
|
||||
|
||||
set (ENB_APP_SRC
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
|
||||
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
|
||||
#define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n"
|
||||
#define CONFIG_HLP_MAC "Disable the MAC procedures at UE side (default is enabled)\n"
|
||||
#define CONFIG_HLP_VCD "Enable VCD (generated file will is named openair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n"
|
||||
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
|
||||
#define CONFIG_HLP_TPORT "tracer port\n"
|
||||
|
||||
+9
-72
@@ -18,49 +18,16 @@
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
#include "executables/thread-common.h"
|
||||
|
||||
#include "executables/nr-uesoftmodem.h"
|
||||
|
||||
#include "NR_MAC_UE/mac.h"
|
||||
//#include "RRC/LTE/rrc_extern.h"
|
||||
#include "PHY_INTERFACE/phy_interface_extern.h"
|
||||
|
||||
#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
|
||||
|
||||
#include "fapi_nr_ue_l1.h"
|
||||
#include "PHY/phy_extern_nr_ue.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "PHY/MODULATION/modulation_UE.h"
|
||||
#include "NR_MAC_UE/mac_proto.h"
|
||||
#include "RRC/NR_UE/rrc_proto.h"
|
||||
|
||||
#include "SCHED_NR_UE/phy_frame_config_nr.h"
|
||||
#include "SCHED_NR_UE/defs.h"
|
||||
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/system.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
|
||||
#include "T.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/nr_phy_scope.h"
|
||||
|
||||
extern char do_forms;
|
||||
#endif
|
||||
|
||||
// Missing stuff?
|
||||
int next_ra_frame = 0;
|
||||
module_id_t next_Mod_id = 0;
|
||||
|
||||
extern double cpuf;
|
||||
//static nfapi_nr_config_request_t config_t;
|
||||
//static nfapi_nr_config_request_t* config =&config_t;
|
||||
|
||||
/*
|
||||
* NR SLOT PROCESSING SEQUENCE
|
||||
*
|
||||
@@ -124,16 +91,12 @@ extern double cpuf;
|
||||
#define DURATION_RX_TO_TX (6) /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */
|
||||
#endif
|
||||
|
||||
#define FRAME_PERIOD 100000000ULL
|
||||
#define DAQ_PERIOD 66667ULL
|
||||
|
||||
typedef enum {
|
||||
pss=0,
|
||||
pbch=1,
|
||||
si=2
|
||||
pss = 0,
|
||||
pbch = 1,
|
||||
si = 2
|
||||
} sync_mode_t;
|
||||
|
||||
|
||||
void init_nr_ue_vars(PHY_VARS_NR_UE *ue,
|
||||
uint8_t UE_id,
|
||||
uint8_t abstraction_flag)
|
||||
@@ -258,7 +221,7 @@ static void UE_synch(void *arg) {
|
||||
double rx_gain_off = 0;
|
||||
nr_get_carrier_frequencies(&UE->frame_parms, &dl_carrier, &ul_carrier);
|
||||
|
||||
if (nr_initial_sync( &syncD->proc, UE, UE->mode,2) == 0) {
|
||||
if (nr_initial_sync(&syncD->proc, UE, 2) == 0) {
|
||||
freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync
|
||||
hw_slot_offset = ((UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe * UE->frame_parms.slots_per_subframe) +
|
||||
round((float)((UE->rx_offset<<1) % UE->frame_parms.samples_per_subframe)/UE->frame_parms.samples_per_slot0);
|
||||
@@ -394,26 +357,17 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
|
||||
|
||||
if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) {
|
||||
nr_downlink_indication_t dl_indication;
|
||||
memset((void*)&dl_indication, 0, sizeof(dl_indication));
|
||||
|
||||
dl_indication.module_id = UE->Mod_id;
|
||||
dl_indication.gNB_index = gNB_id;
|
||||
dl_indication.cc_id = UE->CC_id;
|
||||
dl_indication.frame = proc->frame_rx;
|
||||
dl_indication.slot = proc->nr_slot_rx;
|
||||
dl_indication.thread_id = proc->thread_id;
|
||||
|
||||
nr_fill_dl_indication(&dl_indication, NULL, NULL, proc, UE, gNB_id);
|
||||
UE->if_inst->dl_indication(&dl_indication, NULL);
|
||||
}
|
||||
|
||||
// Process Rx data for one sub-frame
|
||||
#ifdef UE_SLOT_PARALLELISATION
|
||||
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
|
||||
phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, no_relay, NULL );
|
||||
#else
|
||||
uint64_t a=rdtsc();
|
||||
phy_procedures_nrUE_RX( UE, proc, 0, UE->mode,get_nrUE_params()->nr_dlsch_parallel);
|
||||
LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_slot_rx, (rdtsc()-a)/3500);
|
||||
//printf(">>> nr_ue_pdcch_procedures ended\n");
|
||||
phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel);
|
||||
LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500);
|
||||
#endif
|
||||
|
||||
if(IS_SOFTMODEM_NOS1){
|
||||
@@ -424,23 +378,6 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
|
||||
}
|
||||
}
|
||||
|
||||
// no UL for now
|
||||
/*
|
||||
if (UE->mac_enabled==1) {
|
||||
// trigger L2 to run ue_scheduler thru IF module
|
||||
// [TODO] mapping right after NR initial sync
|
||||
if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL) {
|
||||
UE->ul_indication.module_id = 0;
|
||||
UE->ul_indication.gNB_index = 0;
|
||||
UE->ul_indication.cc_id = 0;
|
||||
UE->ul_indication.frame = proc->frame_rx;
|
||||
UE->ul_indication.slot = proc->nr_slot_rx;
|
||||
UE->ul_indication.thread_id = proc->thread_id;
|
||||
UE->if_inst->ul_indication(&UE->ul_indication);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -284,7 +284,6 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
|
||||
tx_gain[0][CC_id] = tx_gain[0][0];
|
||||
|
||||
// Set UE variables
|
||||
|
||||
UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off;
|
||||
UE->tx_total_gain_dB = (int)tx_gain[CC_id][0];
|
||||
UE->tx_power_max_dBm = tx_max_power[CC_id];
|
||||
|
||||
@@ -50,15 +50,15 @@
|
||||
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
||||
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \
|
||||
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \
|
||||
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \
|
||||
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \
|
||||
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \
|
||||
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \
|
||||
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \
|
||||
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&(UE->UE_fo_compensation), defintval:0, TYPE_INT, 0}, \
|
||||
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
|
||||
{"r" , CONFIG_HLP_PRB, 0, iptr:&(fp->N_RB_DL), defintval:25, TYPE_UINT, 0}, \
|
||||
{"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \
|
||||
{"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \
|
||||
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, u8ptr:&(fp->threequarter_fs), defintval:0, TYPE_UINT8, 0}, \
|
||||
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
||||
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
|
||||
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
NR_gNB_COMMON *const common_vars = &gNB->common_vars;
|
||||
NR_gNB_PRACH *const prach_vars = &gNB->prach_vars;
|
||||
NR_gNB_PUSCH **const pusch_vars = gNB->pusch_vars;
|
||||
/*LTE_eNB_SRS *const srs_vars = gNB->srs_vars;
|
||||
LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/
|
||||
|
||||
int i;
|
||||
int Ptx=cfg->carrier_config.num_tx_ant.value;
|
||||
@@ -98,19 +96,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
while(gNB->configured == 0) usleep(10000);
|
||||
|
||||
load_dftslib();
|
||||
/*
|
||||
LOG_I(PHY,"[gNB %"PRIu8"] Initializing DL_FRAME_PARMS : N_RB_DL %"PRIu8", PHICH Resource %d, PHICH Duration %d nb_antennas_tx:%u nb_antennas_rx:%u PRACH[rootSequenceIndex:%u prach_Config_enabled:%u configIndex:%u highSpeed:%u zeroCorrelationZoneConfig:%u freqOffset:%u]\n",
|
||||
gNB->Mod_id,
|
||||
fp->N_RB_DL,fp->phich_config_common.phich_resource,
|
||||
fp->phich_config_common.phich_duration,
|
||||
fp->nb_antennas_tx, fp->nb_antennas_rx,
|
||||
fp->prach_config_common.rootSequenceIndex,
|
||||
fp->prach_config_common.prach_Config_enabled,
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
||||
fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset
|
||||
);*/
|
||||
|
||||
LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id);
|
||||
crcTableInit();
|
||||
init_scrambling_luts();
|
||||
|
||||
+78
-388
@@ -41,327 +41,17 @@
|
||||
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
|
||||
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||
|
||||
//uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
|
||||
|
||||
/*void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
TDD_Config_t *tdd_Config,
|
||||
uint8_t SIwindowsize,
|
||||
uint16_t SIperiod)
|
||||
{
|
||||
|
||||
NR_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
|
||||
|
||||
if (tdd_Config) {
|
||||
fp->tdd_config = tdd_Config->subframeAssignment;
|
||||
fp->tdd_config_S = tdd_Config->specialSubframePatterns;
|
||||
}
|
||||
|
||||
fp->SIwindowsize = SIwindowsize;
|
||||
fp->SIPeriod = SIperiod;
|
||||
}
|
||||
|
||||
void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
|
||||
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
|
||||
{
|
||||
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||
int i;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_IN);
|
||||
|
||||
LOG_I(PHY,"[UE%d] Applying radioResourceConfigCommon from eNB%d\n",Mod_id,eNB_id);
|
||||
|
||||
ue->prach_vars[eNB_id]->prach_pdu.root_seq_id =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
|
||||
|
||||
ue->prach_vars[eNB_id]->prach_Config_enabled=1;
|
||||
//ue->prach_vars[eNB_id]->prach_pdu.prach_ConfigIndex =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
|
||||
ue->prach_vars[eNB_id]->prach_pdu.restricted_set =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.highSpeedFlag;
|
||||
ue->prach_vars[eNB_id]->prach_pdu.num_cs =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig;
|
||||
//ue->prach_vars[eNB_id]->prach_pdu.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset;
|
||||
|
||||
//compute_prach_seq(fp->prach_config_common.rootSequenceIndex,
|
||||
// fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
// fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
||||
// fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
||||
// fp->frame_type,ue->X_u);
|
||||
|
||||
|
||||
|
||||
fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon.deltaPUCCH_Shift;
|
||||
fp->pucch_config_common.nRB_CQI = radioResourceConfigCommon->pucch_ConfigCommon.nRB_CQI;
|
||||
fp->pucch_config_common.nCS_AN = radioResourceConfigCommon->pucch_ConfigCommon.nCS_AN;
|
||||
fp->pucch_config_common.n1PUCCH_AN = radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN;
|
||||
|
||||
|
||||
|
||||
fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon.referenceSignalPower;
|
||||
fp->pdsch_config_common.p_b = radioResourceConfigCommon->pdsch_ConfigCommon.p_b;
|
||||
|
||||
|
||||
fp->pusch_config_common.n_SB = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
|
||||
fp->pusch_config_common.hoppingMode = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
|
||||
fp->pusch_config_common.pusch_HoppingOffset = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
|
||||
fp->pusch_config_common.enable64QAM = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = dmrs1_tab_ue[radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift];
|
||||
|
||||
|
||||
init_ul_hopping(fp);
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 0;
|
||||
|
||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.present==SoundingRS_UL_ConfigCommon_PR_setup) {
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 1;
|
||||
fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig;
|
||||
fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig;
|
||||
fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission;
|
||||
|
||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts)
|
||||
fp->soundingrs_ul_config_common.srs_MaxUpPts = 1;
|
||||
else
|
||||
fp->soundingrs_ul_config_common.srs_MaxUpPts = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
fp->ul_power_control_config_common.p0_NominalPUSCH = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUSCH;
|
||||
fp->ul_power_control_config_common.alpha = radioResourceConfigCommon->uplinkPowerControlCommon.alpha;
|
||||
fp->ul_power_control_config_common.p0_NominalPUCCH = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUCCH;
|
||||
fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon.deltaPreambleMsg3;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format1 = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format1b = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2 = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2a = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2b = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b;
|
||||
|
||||
fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx;
|
||||
|
||||
// Now configure some of the Physical Channels
|
||||
|
||||
// PUCCH
|
||||
init_ncs_cell(fp,ue->ncs_cell);
|
||||
|
||||
init_ul_hopping(fp);
|
||||
|
||||
// PCH
|
||||
init_ue_paging_info(ue,radioResourceConfigCommon->pcch_Config.defaultPagingCycle,radioResourceConfigCommon->pcch_Config.nB);
|
||||
|
||||
// MBSFN
|
||||
|
||||
if (mbsfn_SubframeConfigList != NULL) {
|
||||
fp->num_MBSFN_config = mbsfn_SubframeConfigList->list.count;
|
||||
|
||||
for (i=0; i<mbsfn_SubframeConfigList->list.count; i++) {
|
||||
fp->MBSFN_config[i].radioframeAllocationPeriod = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod;
|
||||
fp->MBSFN_config[i].radioframeAllocationOffset = mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset;
|
||||
|
||||
if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame) {
|
||||
fp->MBSFN_config[i].fourFrames_flag = 0;
|
||||
fp->MBSFN_config[i].mbsfn_SubframeConfig = mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]; // 6-bit subframe configuration
|
||||
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
|
||||
fp->MBSFN_config[i].mbsfn_SubframeConfig);
|
||||
} else if (mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.present == MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames) { // 24-bit subframe configuration
|
||||
fp->MBSFN_config[i].fourFrames_flag = 1;
|
||||
fp->MBSFN_config[i].mbsfn_SubframeConfig =
|
||||
mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]|
|
||||
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
|
||||
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]<<16);
|
||||
|
||||
LOG_I(PHY, "[CONFIG] MBSFN_SubframeConfig[%d] pattern is %d\n", i,
|
||||
fp->MBSFN_config[i].mbsfn_SubframeConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_OUT);
|
||||
|
||||
}
|
||||
|
||||
void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_idx,
|
||||
long mbsfn_AreaId_r9)
|
||||
{
|
||||
|
||||
NR_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
|
||||
|
||||
|
||||
LOG_I(PHY,"[UE%d] Applying MBSFN_Area_id %ld for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx);
|
||||
|
||||
if (mbsfn_Area_idx == 0) {
|
||||
fp->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
|
||||
LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
|
||||
}
|
||||
|
||||
lte_gold_mbsfn(fp,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_mbsfn_table,fp->Nid_cell_mbsfn);
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
/*
|
||||
* Configures UE MAC and PHY with radioResourceCommon received in mobilityControlInfo IE during Handover
|
||||
*/
|
||||
/*void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
|
||||
{
|
||||
|
||||
if(mobilityControlInfo!=NULL) {
|
||||
RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon;
|
||||
LOG_I(PHY,"radioResourceConfigCommon %p\n", radioResourceConfigCommon);
|
||||
memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho,
|
||||
(void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,
|
||||
sizeof(NR_DL_FRAME_PARMS));
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->ho_triggered = 1;
|
||||
//PHY_vars_UE_g[UE_id]->UE_mode[0] = PRACH;
|
||||
|
||||
NR_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
|
||||
// int N_ZC;
|
||||
// uint8_t prach_fmt;
|
||||
// int u;
|
||||
|
||||
LOG_I(PHY,"[UE%d] Handover triggered: Applying radioResourceConfigCommon from eNB %d\n",
|
||||
Mod_id,eNB_id);
|
||||
|
||||
ue->prach_vars[eNB_id]->prach_pdu.root_seq_id =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
|
||||
ue->prach_vars[eNB_id]->prach_Config_enabled=1;
|
||||
//ue->prach_vars[eNB_id]->prach_pdu.prach_ConfigIndex =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex;
|
||||
ue->prach_vars[eNB_id]->prach_pdu.restricted_set =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->highSpeedFlag;
|
||||
ue->prach_vars[eNB_id]->prach_pdu.num_cs =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->zeroCorrelationZoneConfig;
|
||||
//ue->prach_vars[eNB_id]->prach_pdu.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_FreqOffset;
|
||||
|
||||
// prach_fmt = get_prach_fmt(radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex,fp->frame_type);
|
||||
// N_ZC = (prach_fmt <4)?839:139;
|
||||
// u = (prach_fmt < 4) ? prach_root_sequence_map0_3[fp->prach_config_common.rootSequenceIndex] :
|
||||
// prach_root_sequence_map4[fp->prach_config_common.rootSequenceIndex];
|
||||
|
||||
//compute_prach_seq(u,N_ZC, PHY_vars_UE_g[Mod_id]->X_u);
|
||||
//compute_prach_seq(PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.rootSequenceIndex,
|
||||
// PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
// PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
||||
// PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
||||
// fp->frame_type,
|
||||
// PHY_vars_UE_g[Mod_id][CC_id]->X_u);
|
||||
|
||||
|
||||
fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon->deltaPUCCH_Shift;
|
||||
fp->pucch_config_common.nRB_CQI = radioResourceConfigCommon->pucch_ConfigCommon->nRB_CQI;
|
||||
fp->pucch_config_common.nCS_AN = radioResourceConfigCommon->pucch_ConfigCommon->nCS_AN;
|
||||
fp->pucch_config_common.n1PUCCH_AN = radioResourceConfigCommon->pucch_ConfigCommon->n1PUCCH_AN;
|
||||
fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon->referenceSignalPower;
|
||||
fp->pdsch_config_common.p_b = radioResourceConfigCommon->pdsch_ConfigCommon->p_b;
|
||||
|
||||
|
||||
fp->pusch_config_common.n_SB = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
|
||||
fp->pusch_config_common.hoppingMode = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
|
||||
fp->pusch_config_common.pusch_HoppingOffset = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
|
||||
fp->pusch_config_common.enable64QAM = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift;
|
||||
|
||||
init_ul_hopping(fp);
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 0;
|
||||
|
||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->present==SoundingRS_UL_ConfigCommon_PR_setup) {
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 1;
|
||||
fp->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_BandwidthConfig;
|
||||
fp->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_SubframeConfig;
|
||||
fp->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.ackNackSRS_SimultaneousTransmission;
|
||||
|
||||
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_MaxUpPts)
|
||||
fp->soundingrs_ul_config_common.srs_MaxUpPts = 1;
|
||||
else
|
||||
fp->soundingrs_ul_config_common.srs_MaxUpPts = 0;
|
||||
}
|
||||
|
||||
fp->ul_power_control_config_common.p0_NominalPUSCH = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUSCH;
|
||||
fp->ul_power_control_config_common.alpha = radioResourceConfigCommon->uplinkPowerControlCommon->alpha;
|
||||
fp->ul_power_control_config_common.p0_NominalPUCCH = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUCCH;
|
||||
fp->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaPreambleMsg3;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format1 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format1b = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1b;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2a = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2a;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2b = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2b;
|
||||
|
||||
fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon->maxHARQ_Msg3Tx;
|
||||
|
||||
// Now configure some of the Physical Channels
|
||||
if (radioResourceConfigCommon->antennaInfoCommon)
|
||||
fp->nb_antennas_tx = (1<<radioResourceConfigCommon->antennaInfoCommon->antennaPortsCount);
|
||||
else
|
||||
fp->nb_antennas_tx = 1;
|
||||
|
||||
//PHICH
|
||||
if (radioResourceConfigCommon->antennaInfoCommon) {
|
||||
fp->phich_config_common.phich_resource = radioResourceConfigCommon->phich_Config->phich_Resource;
|
||||
fp->phich_config_common.phich_duration = radioResourceConfigCommon->phich_Config->phich_Duration;
|
||||
}
|
||||
|
||||
//Target CellId
|
||||
fp->Nid_cell = mobilityControlInfo->targetPhysCellId;
|
||||
fp->nushift = fp->Nid_cell%6;
|
||||
|
||||
// PUCCH
|
||||
init_ncs_cell(fp,PHY_vars_UE_g[Mod_id][CC_id]->ncs_cell);
|
||||
|
||||
init_ul_hopping(fp);
|
||||
|
||||
// RNTI
|
||||
|
||||
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
|
||||
|
||||
LOG_I(PHY,"SET C-RNTI %x %x\n",PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti,
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti);
|
||||
}
|
||||
|
||||
if(ho_failed) {
|
||||
LOG_D(PHY,"[UE%d] Handover failed, triggering RACH procedure\n",Mod_id);
|
||||
memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,(void *)&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms_before_ho, sizeof(NR_DL_FRAME_PARMS));
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_id] = PRACH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void phy_config_meas_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id)
|
||||
{
|
||||
|
||||
PHY_NR_MEASUREMENTS *phy_meas = &PHY_vars_UE_g[Mod_id][CC_id]->measurements;
|
||||
int i;
|
||||
|
||||
LOG_I(PHY,"Configuring inter-cell measurements for %d cells, ids: \n",n_adj_cells);
|
||||
|
||||
for (i=0; i<n_adj_cells; i++) {
|
||||
LOG_I(PHY,"%d\n",adj_cell_id[i]);
|
||||
lte_gold(&PHY_vars_UE_g[Mod_id][CC_id]->frame_parms,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_table[i+1],adj_cell_id[i]);
|
||||
}
|
||||
|
||||
phy_meas->n_adj_cells = n_adj_cells;
|
||||
memcpy((void*)phy_meas->adj_cell_id,(void *)adj_cell_id,n_adj_cells*sizeof(unsigned int));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#if 0
|
||||
void phy_config_harq_ue(module_id_t Mod_id,
|
||||
int CC_id,
|
||||
uint8_t eNB_id,
|
||||
uint8_t gNB_id,
|
||||
uint16_t max_harq_tx) {
|
||||
int num_of_threads,num_of_code_words;
|
||||
PHY_VARS_NR_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
|
||||
for (num_of_threads=0; num_of_threads<RX_NB_TH_MAX; num_of_threads++)
|
||||
for (num_of_code_words=0; num_of_code_words<NR_MAX_NB_CODEWORDS; num_of_code_words++)
|
||||
phy_vars_ue->ulsch[num_of_threads][eNB_id][num_of_code_words]->Mlimit = max_harq_tx;
|
||||
phy_vars_ue->ulsch[num_of_threads][gNB_id][num_of_code_words]->Mlimit = max_harq_tx;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -435,7 +125,7 @@ void phy_init_nr_ue_PUSCH(NR_UE_PUSCH *const pusch,
|
||||
}
|
||||
|
||||
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
int nb_connected_eNB,
|
||||
int nb_connected_gNB,
|
||||
uint8_t abstraction_flag) {
|
||||
// create shortcuts
|
||||
NR_DL_FRAME_PARMS *const fp = &ue->frame_parms;
|
||||
@@ -443,7 +133,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
NR_UE_PBCH **const pbch_vars = ue->pbch_vars;
|
||||
NR_UE_PRACH **const prach_vars = ue->prach_vars;
|
||||
int i,j,k,l,slot,symb,q;
|
||||
int eNB_id;
|
||||
int gNB_id;
|
||||
int th_id;
|
||||
uint32_t ****pusch_dmrs;
|
||||
uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig
|
||||
@@ -457,8 +147,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
|
||||
phy_init_nr_top(ue);
|
||||
// many memory allocation sizes are hard coded
|
||||
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
|
||||
AssertFatal( nb_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" );
|
||||
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" );
|
||||
AssertFatal(nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" );
|
||||
// init phy_vars_ue
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
@@ -467,17 +157,17 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
ue->rx_gain_byp[i] = 120;
|
||||
}
|
||||
|
||||
ue->n_connected_eNB = nb_connected_eNB;
|
||||
ue->n_connected_gNB = nb_connected_gNB;
|
||||
|
||||
for(eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) {
|
||||
ue->total_TBS[eNB_id] = 0;
|
||||
ue->total_TBS_last[eNB_id] = 0;
|
||||
ue->bitrate[eNB_id] = 0;
|
||||
ue->total_received_bits[eNB_id] = 0;
|
||||
for(gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
ue->total_TBS[gNB_id] = 0;
|
||||
ue->total_TBS_last[gNB_id] = 0;
|
||||
ue->bitrate[gNB_id] = 0;
|
||||
ue->total_received_bits[gNB_id] = 0;
|
||||
|
||||
ue->ul_time_alignment[eNB_id].apply_ta = 0;
|
||||
ue->ul_time_alignment[eNB_id].ta_frame = -1;
|
||||
ue->ul_time_alignment[eNB_id].ta_slot = -1;
|
||||
ue->ul_time_alignment[gNB_id].apply_ta = 0;
|
||||
ue->ul_time_alignment[gNB_id].ta_frame = -1;
|
||||
ue->ul_time_alignment[gNB_id].ta_slot = -1;
|
||||
}
|
||||
// init NR modulation lookup tables
|
||||
nr_generate_modulation_table();
|
||||
@@ -485,9 +175,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
/////////////////////////PUSCH init/////////////////////////
|
||||
///////////
|
||||
for (th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
|
||||
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++) {
|
||||
ue->pusch_vars[th_id][eNB_id] = (NR_UE_PUSCH *)malloc16(sizeof(NR_UE_PUSCH));
|
||||
phy_init_nr_ue_PUSCH( ue->pusch_vars[th_id][eNB_id], fp );
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
ue->pusch_vars[th_id][gNB_id] = (NR_UE_PUSCH *)malloc16(sizeof(NR_UE_PUSCH));
|
||||
phy_init_nr_ue_PUSCH( ue->pusch_vars[th_id][gNB_id], fp );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,40 +311,40 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
|
||||
// DLSCH
|
||||
for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++) {
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][eNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
|
||||
ue->pdsch_vars[th_id][gNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
|
||||
}
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdcch_vars[th_id][eNB_id] = (NR_UE_PDCCH *)malloc16_clear(sizeof(NR_UE_PDCCH));
|
||||
ue->pdcch_vars[th_id][gNB_id] = (NR_UE_PDCCH *)malloc16_clear(sizeof(NR_UE_PDCCH));
|
||||
}
|
||||
|
||||
prach_vars[eNB_id] = (NR_UE_PRACH *)malloc16_clear(sizeof(NR_UE_PRACH));
|
||||
pbch_vars[eNB_id] = (NR_UE_PBCH *)malloc16_clear(sizeof(NR_UE_PBCH));
|
||||
prach_vars[gNB_id] = (NR_UE_PRACH *)malloc16_clear(sizeof(NR_UE_PRACH));
|
||||
pbch_vars[gNB_id] = (NR_UE_PBCH *)malloc16_clear(sizeof(NR_UE_PBCH));
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
phy_init_nr_ue__PDSCH( ue->pdsch_vars[th_id][eNB_id], fp );
|
||||
phy_init_nr_ue__PDSCH( ue->pdsch_vars[th_id][gNB_id], fp );
|
||||
}
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][eNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
|
||||
ue->pdsch_vars[th_id][eNB_id]->llr_shifts_p = ue->pdsch_vars[0][eNB_id]->llr_shifts;
|
||||
ue->pdsch_vars[th_id][eNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts;
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
|
||||
ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear(sizeof(int16_t *));
|
||||
ue->pdsch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16_clear(fp->nb_antennas_rx*sizeof(int32_t *));
|
||||
}
|
||||
|
||||
for (int i=0; i<fp->nb_antennas_rx; i++) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][eNB_id]->rho[i] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
}
|
||||
}
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
}
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++)
|
||||
@@ -663,7 +353,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
const size_t num = 7*2*fp->N_RB_DL*12+4;
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -671,10 +361,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
for (k=0; k<8; k++) { //harq_pid
|
||||
for (l=0; l<8; l++) { //round
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][eNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
}
|
||||
|
||||
for (int i=0; i<fp->nb_antennas_rx; i++)
|
||||
@@ -682,10 +372,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
const int idx = (j<<1)+i;
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -693,72 +383,72 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
|
||||
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdcch_vars[th_id][eNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
ue->pdcch_vars[th_id][eNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
ue->pdcch_vars[th_id][eNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
ue->pdcch_vars[th_id][eNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 );
|
||||
ue->pdcch_vars[th_id][eNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][eNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][eNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t));
|
||||
ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t));
|
||||
ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t));
|
||||
ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear(4*2*100*12 );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *));
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
// Channel estimates
|
||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
ue->pdcch_vars[th_id][eNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4) );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4));
|
||||
|
||||
for (j=0; j<4; j++) {
|
||||
int idx = (j<<1) + i;
|
||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
|
||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH));
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->ofdm_symbol_size*2);
|
||||
// size_t num = 7*2*fp->N_RB_DL*12;
|
||||
size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB
|
||||
ue->pdcch_vars[th_id][eNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
ue->pdcch_vars[th_id][eNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
ue->pdcch_vars[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PBCH
|
||||
pbch_vars[eNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[eNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pbch_vars[eNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); //
|
||||
prach_vars[eNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
prach_vars[eNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *));
|
||||
pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear(1920); //
|
||||
prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)));
|
||||
prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)));
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
pbch_vars[eNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
|
||||
for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
|
||||
int idx = (j<<1)+i;
|
||||
pbch_vars[eNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 );
|
||||
pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4);
|
||||
pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size));
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size));
|
||||
pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pbch_vars[eNB_id]->decoded_output = (uint8_t *)malloc16_clear( 64 );
|
||||
pbch_vars[gNB_id]->decoded_output = (uint8_t *)malloc16_clear(64);
|
||||
}
|
||||
|
||||
// initialization for the last instance of pdsch_vars (used for MU-MIMO)
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
ue->pdsch_vars[th_id][eNB_id] = (NR_UE_PDSCH *)malloc16_clear( sizeof(NR_UE_PDSCH) );
|
||||
ue->pdsch_vars[th_id][gNB_id] = (NR_UE_PDSCH *)malloc16_clear(sizeof(NR_UE_PDSCH));
|
||||
}
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
//phy_init_lte_ue__PDSCH( ue->pdsch_vars[th_id][eNB_id], fp );
|
||||
ue->pdsch_vars[th_id][eNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
||||
ue->pdsch_vars[th_id][eNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) );
|
||||
//phy_init_lte_ue__PDSCH( ue->pdsch_vars[th_id][gNB_id], fp );
|
||||
ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
|
||||
ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t));
|
||||
}
|
||||
} else { //abstraction == 1
|
||||
ue->sinr_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
|
||||
@@ -787,7 +477,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
|
||||
|
||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,
|
||||
int abstraction_flag) {
|
||||
for (int i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
|
||||
for (int i = 0; i < NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
||||
for (int j=0; j<2; j++) {
|
||||
for (int k=0; k<RX_NB_TH_MAX; k++) {
|
||||
AssertFatal((ue->dlsch[k][i][j] = new_nr_ue_dlsch(1,NR_MAX_DLSCH_HARQ_PROCESSES,NSOFT,MAX_LDPC_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
|
||||
|
||||
@@ -239,7 +239,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
} // reg_in_cce_idx
|
||||
} // cce_count
|
||||
|
||||
LOG_I(PHY, "DCI: payloadSize = %d | payload = %llx\n",
|
||||
LOG_D(PHY, "DCI: payloadSize = %d | payload = %llx\n",
|
||||
*pdcch_pdu_rel15->dci_pdu.PayloadSizeBits,*(unsigned long long*)pdcch_pdu_rel15->dci_pdu.Payload);
|
||||
|
||||
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||
#include "PHY/impl_defs_top.h"
|
||||
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#define DEBUG_PHY
|
||||
@@ -104,15 +105,14 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
{
|
||||
first_time = 0;
|
||||
ue->time_sync_cell = 1;
|
||||
if (ue->mac_enabled==1) {
|
||||
if (get_softmodem_params()->do_ra) {
|
||||
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id);
|
||||
//mac_resynch();
|
||||
//dl_phy_sync_success(ue->Mod_id,frame,0,1);//ue->common_vars.eNb_id);
|
||||
ue->UE_mode[0] = PRACH;
|
||||
ue->prach_resources[gNB_id]->sync_frame = frame;
|
||||
ue->prach_resources[gNB_id]->init_msg1 = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ue->UE_mode[0] = PUSCH;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||
uint8_t slot);
|
||||
|
||||
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
uint8_t gNB_index,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t slot,
|
||||
uint8_t abstraction_flag);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "nr-softmodem-common.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "PHY/phy_extern_nr_ue.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
@@ -45,25 +45,41 @@
|
||||
//#define DEBUG_MEAS_UE
|
||||
//#define DEBUG_RANK_EST
|
||||
|
||||
// Returns the pathloss in dBm for the active UL BWP on the selected carrier based on the DL RS associated with the PRACH transmission
|
||||
// computation according to clause 7.4 (Physical random access channel) of 3GPP TS 38.213 version 16.3.0 Release 16
|
||||
// Assumptions:
|
||||
// - PRACH transmission from a UE is not in response to a detection of a PDCCH order by the UE
|
||||
// Measurement units:
|
||||
// - referenceSignalPower: dBm/RE (average EPRE of the resources elements that carry secondary synchronization signals in dBm)
|
||||
int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){
|
||||
|
||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
int16_t pathloss;
|
||||
|
||||
/*
|
||||
if (ue->frame_parms.mode1_flag == 1)
|
||||
RSoffset = 6;
|
||||
else
|
||||
RSoffset = 3;
|
||||
*/
|
||||
if (get_softmodem_params()->do_ra){
|
||||
|
||||
/* LOG_D(PHY,"get_nr_PL : rsrp %f dBm/RE (%f), eNB power %d dBm/RE\n",
|
||||
(1.0*dB_fixed_times10(ue->measurements.rsrp[eNB_index])-(10.0*ue->rx_total_gain_dB))/10.0,
|
||||
10*log10((double)ue->measurements.rsrp[eNB_index]),
|
||||
ue->frame_parms.pdsch_config_common.referenceSignalPower);*/
|
||||
long referenceSignalPower = ue->nrUE_config.ssb_config.ss_pbch_power;
|
||||
double rsrp_dBm = 10*log10(ue->measurements.rsrp[gNB_index]) + 30 - ue->rx_total_gain_dB;
|
||||
|
||||
pathloss = (int16_t)(10*log10(pow(10, (double)(referenceSignalPower)/10) - pow(10, (double)(rsrp_dBm)/10)));
|
||||
|
||||
LOG_D(MAC, "In %s: pathloss %d dBm, UE RX total gain %d dB, referenceSignalPower %ld dBm (%f mW), RSRP %f dBm (%f mW)\n",
|
||||
__FUNCTION__,
|
||||
pathloss,
|
||||
ue->rx_total_gain_dB,
|
||||
referenceSignalPower,
|
||||
pow(10, referenceSignalPower/10),
|
||||
rsrp_dBm,
|
||||
pow(10, rsrp_dBm/10));
|
||||
|
||||
} else {
|
||||
|
||||
pathloss = ((int16_t)(((10*ue->rx_total_gain_dB) - dB_fixed_times10(ue->measurements.rsrp[gNB_index]))/10));
|
||||
|
||||
}
|
||||
|
||||
return pathloss;
|
||||
|
||||
return((int16_t)(((10*ue->rx_total_gain_dB) - dB_fixed_times10(ue->measurements.rsrp[gNB_index]))/10));
|
||||
// dB_fixed_times10(RSoffset*12*ue_g[Mod_id][CC_id]->frame_parms.N_RB_DL) +
|
||||
//(ue->frame_parms.pdsch_config_common.referenceSignalPower*10))/10));
|
||||
}
|
||||
|
||||
uint32_t get_nr_rx_total_gain_dB (module_id_t Mod_id,uint8_t CC_id)
|
||||
@@ -108,7 +124,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||
ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
|
||||
|
||||
// signal measurements
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++){
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++){
|
||||
|
||||
ue->measurements.rx_power_tot[gNB_id] = 0;
|
||||
|
||||
@@ -140,7 +156,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||
// filter to remove jitter
|
||||
if (ue->init_averaging == 0) {
|
||||
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++)
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++)
|
||||
ue->measurements.rx_power_avg[gNB_id] = (int)(((k1*((long long int)(ue->measurements.rx_power_avg[gNB_id]))) + (k2*((long long int)(ue->measurements.rx_power_tot[gNB_id])))) >> 10);
|
||||
|
||||
ue->measurements.n0_power_avg = (int)(((k1*((long long int) (ue->measurements.n0_power_avg))) + (k2*((long long int) (ue->measurements.n0_power_tot))))>>10);
|
||||
@@ -149,7 +165,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||
|
||||
} else {
|
||||
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++)
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++)
|
||||
ue->measurements.rx_power_avg[gNB_id] = ue->measurements.rx_power_tot[gNB_id];
|
||||
|
||||
ue->measurements.n0_power_avg = ue->measurements.n0_power_tot;
|
||||
@@ -157,7 +173,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||
|
||||
}
|
||||
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_eNB; gNB_id++) {
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
|
||||
ue->measurements.rx_power_avg_dB[gNB_id] = dB_fixed( ue->measurements.rx_power_avg[gNB_id]);
|
||||
ue->measurements.wideband_cqi_tot[gNB_id] = dB_fixed2(ue->measurements.rx_power_tot[gNB_id], ue->measurements.n0_power_tot);
|
||||
@@ -180,74 +196,74 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
|
||||
#endif
|
||||
}
|
||||
|
||||
// This function implements:
|
||||
// - SS reference signal received power (SS-RSRP) as per clause 5.1.1 of 3GPP TS 38.215 version 16.3.0 Release 16
|
||||
// - no Layer 3 filtering implemented (no filterCoefficient provided from RRC)
|
||||
// Todo:
|
||||
// - Layer 3 filtering according to clause 5.5.3.2 of 3GPP TS 38.331 version 16.2.0 Release 16
|
||||
// Measurement units:
|
||||
// - RSRP: W (dBW)
|
||||
// - RX Gain dB
|
||||
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t slot,
|
||||
uint8_t abstraction_flag)
|
||||
uint8_t gNB_id,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t slot,
|
||||
uint8_t abstraction_flag)
|
||||
{
|
||||
int aarx,rb, symbol_offset;
|
||||
int16_t *rxF;
|
||||
int aarx;
|
||||
int nb_re;
|
||||
int k_start = 55;
|
||||
int k_end = 183;
|
||||
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
||||
uint8_t l_sss = ue->symbol_offset + 2;
|
||||
|
||||
uint16_t Nid_cell = ue->frame_parms.Nid_cell;
|
||||
uint8_t eNB_offset=0,l,nushift;
|
||||
uint16_t off,nb_rb;
|
||||
// NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
|
||||
if (ssb_offset>= ue->frame_parms.ofdm_symbol_size){
|
||||
|
||||
nushift = ue->frame_parms.Nid_cell%4;
|
||||
ue->frame_parms.nushift = nushift;
|
||||
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
|
||||
if (ssb_offset>= ue->frame_parms.ofdm_symbol_size) ssb_offset-=ue->frame_parms.ofdm_symbol_size;
|
||||
|
||||
symbol_offset = ue->frame_parms.ofdm_symbol_size*((ue->symbol_offset+1)%(ue->frame_parms.symbols_per_slot));
|
||||
ssb_offset -= ue->frame_parms.ofdm_symbol_size;
|
||||
|
||||
ue->measurements.rsrp[eNB_offset] = 0;
|
||||
}
|
||||
|
||||
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
|
||||
nb_rb = 20;
|
||||
//} else{
|
||||
// LOG_E(PHY,"report quantity not supported \n");
|
||||
//}
|
||||
ue->measurements.rsrp[gNB_id] = 0;
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
if (abstraction_flag == 0) {
|
||||
|
||||
for (l=0; l<1; l++) {
|
||||
LOG_D(PHY, "In %s: [UE %d] slot %d l_sss %d ssb_offset %d\n", __FUNCTION__, ue->Mod_id, slot, l_sss, ssb_offset);
|
||||
|
||||
LOG_D(PHY,"[UE %d] slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, l %d)\n",ue->Mod_id,slot,Nid_cell,nushift,
|
||||
eNB_offset,l);
|
||||
nb_re = 0;
|
||||
|
||||
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+ssb_offset+nushift)];
|
||||
off = 0;
|
||||
for (aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) {
|
||||
|
||||
if (l==0) {
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
int16_t *rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aarx][(l_sss*ue->frame_parms.ofdm_symbol_size) + ssb_offset];
|
||||
|
||||
ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));
|
||||
//printf("rb %d, off %d : %d\n",rb,off,((((int32_t)rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1])));
|
||||
for(int k = k_start; k < k_end; k++){
|
||||
|
||||
#ifdef DEBUG_MEAS_UE
|
||||
LOG_I(PHY, "In %s rxF_sss %d %d\n", __FUNCTION__, rxF_sss[k*2], rxF_sss[k*2 + 1]);
|
||||
#endif
|
||||
|
||||
ue->measurements.rsrp[gNB_id] += (((int32_t)rxF_sss[k*2]*rxF_sss[k*2]) + ((int32_t)rxF_sss[k*2 + 1]*rxF_sss[k*2 + 1]));
|
||||
|
||||
nb_re++;
|
||||
|
||||
off = (off+4) % ue->frame_parms.ofdm_symbol_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ue->measurements.rsrp[eNB_offset]/=nb_rb;
|
||||
|
||||
} else {
|
||||
|
||||
ue->measurements.rsrp[eNB_offset] = -93 ;
|
||||
}
|
||||
|
||||
ue->measurements.rsrp[gNB_id] /= nb_re;
|
||||
|
||||
if (eNB_offset == 0)
|
||||
} else {
|
||||
|
||||
LOG_D(PHY,"[UE %d] slot %d RSRP Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d)\n",
|
||||
ue->Mod_id,
|
||||
slot,eNB_offset,
|
||||
(eNB_offset>0) ? ue->measurements.adj_cell_id[eNB_offset-1] : ue->frame_parms.Nid_cell,
|
||||
10*log10(ue->measurements.rsrp[eNB_offset])-ue->rx_total_gain_dB,
|
||||
ue->measurements.rsrp[eNB_offset]);
|
||||
ue->measurements.rsrp[gNB_id] = -93;
|
||||
|
||||
}
|
||||
|
||||
ue->measurements.rsrp_filtered[gNB_id] = ue->measurements.rsrp[gNB_id];
|
||||
|
||||
LOG_D(PHY, "In %s: [UE %d] slot %d SS-RSRP: %3.1f dBm/RE (%d W)\n",
|
||||
__FUNCTION__,
|
||||
ue->Mod_id,
|
||||
slot,
|
||||
10*log10(ue->measurements.rsrp[gNB_id]) + 30 - ue->rx_total_gain_dB,
|
||||
ue->measurements.rsrp[gNB_id]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -919,7 +919,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
|
||||
n_rnti = rel15->rnti;
|
||||
|
||||
if (crc == n_rnti) {
|
||||
LOG_I(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
|
||||
LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
|
||||
proc->frame_rx, proc->nr_slot_rx,n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation);
|
||||
dci_ind->SFN = proc->frame_rx;
|
||||
dci_ind->slot = proc->nr_slot_rx;
|
||||
|
||||
@@ -361,7 +361,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
else
|
||||
Coderate = (float) (harq_process->R) /(float) 2048;
|
||||
|
||||
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||
if ((A <=292) || ((A <= NR_MAX_PDSCH_TBS) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||
{
|
||||
p_decParams->BG = 2;
|
||||
kc = 52;
|
||||
@@ -391,8 +391,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
|
||||
|
||||
if (harq_process->round == 0) {
|
||||
// This is a new packet, so compute quantities regarding segmentation
|
||||
if (A > 3824)
|
||||
// This is a new packet, so compute quantities regarding segmentation
|
||||
if (A > NR_MAX_PDSCH_TBS)
|
||||
harq_process->B = A+24;
|
||||
else
|
||||
harq_process->B = A+16;
|
||||
@@ -531,7 +531,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
|
||||
|
||||
if (harq_process->C == 1){
|
||||
if (A > 3824)
|
||||
if (A > NR_MAX_PDSCH_TBS)
|
||||
crc_type = CRC24_A;
|
||||
else
|
||||
crc_type = CRC16;
|
||||
@@ -838,7 +838,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
else
|
||||
Coderate = (float) (harq_process->R) /(float) 2048;
|
||||
|
||||
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||
if ((A <= 292) || ((A <= NR_MAX_PDSCH_TBS) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||
{
|
||||
p_decParams->BG = 2;
|
||||
kc = 52;
|
||||
@@ -868,7 +868,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
|
||||
if (harq_process->round == 0) {
|
||||
// This is a new packet, so compute quantities regarding segmentation
|
||||
if (A > 3824)
|
||||
if (A > NR_MAX_PDSCH_TBS)
|
||||
harq_process->B = A+24;
|
||||
else
|
||||
harq_process->B = A+16;
|
||||
@@ -1055,7 +1055,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
memset(harq_process->c[r],0,Kr_bytes);
|
||||
|
||||
if (harq_process->C == 1){
|
||||
if (A > 3824)
|
||||
if (A > NR_MAX_PDSCH_TBS)
|
||||
crc_type = CRC24_A;
|
||||
else
|
||||
crc_type = CRC16;
|
||||
@@ -1358,7 +1358,7 @@ void nr_dlsch_decoding_process(void *arg)
|
||||
else
|
||||
Coderate = (float) (harq_process->R) /(float) 2048;
|
||||
|
||||
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||
if ((A <= 292) || ((A <= NR_MAX_PDSCH_TBS) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||
{
|
||||
p_decParams->BG = 2;
|
||||
kc = 52;
|
||||
@@ -1389,7 +1389,7 @@ void nr_dlsch_decoding_process(void *arg)
|
||||
harq_process->round =0;
|
||||
// if (harq_process->round == 0) {
|
||||
// This is a new packet, so compute quantities regarding segmentation
|
||||
if (A > 3824)
|
||||
if (A > NR_MAX_PDSCH_TBS)
|
||||
harq_process->B = A+24;
|
||||
else
|
||||
harq_process->B = A+16;
|
||||
@@ -1513,7 +1513,7 @@ void nr_dlsch_decoding_process(void *arg)
|
||||
memset(harq_process->c[r],0,Kr_bytes);
|
||||
|
||||
if (harq_process->C == 1){
|
||||
if (A > 3824)
|
||||
if (A > NR_MAX_PDSCH_TBS)
|
||||
crc_type = CRC24_A;
|
||||
else
|
||||
crc_type = CRC16;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -103,7 +103,7 @@ void free_list(NR_UE_SSB *node) {
|
||||
}
|
||||
|
||||
|
||||
int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_initial_symbol, runmode_t mode)
|
||||
int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_initial_symbol)
|
||||
{
|
||||
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
||||
int ret =-1;
|
||||
@@ -202,7 +202,7 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
|
||||
char duplex_string[2][4] = {"FDD","TDD"};
|
||||
char prefix_string[2][9] = {"NORMAL","EXTENDED"};
|
||||
|
||||
int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode, int n_frames)
|
||||
int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames)
|
||||
{
|
||||
|
||||
int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2,
|
||||
@@ -299,7 +299,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, runmode_t mode,
|
||||
rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp);
|
||||
|
||||
nr_gold_pbch(ue);
|
||||
ret = nr_pbch_detection(proc, ue,1,mode); // start pbch detection at first symbol after pss
|
||||
ret = nr_pbch_detection(proc, ue, 1); // start pbch detection at first symbol after pss
|
||||
|
||||
if (ret == 0) {
|
||||
// sync at symbol ue->symbol_offset
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "PHY/sse_intrin.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "PHY/INIT/phy_init.h"
|
||||
#include "openair1/SCHED_NR_UE/defs.h"
|
||||
|
||||
//#define DEBUG_PBCH
|
||||
//#define DEBUG_PBCH_ENCODING
|
||||
@@ -608,23 +609,10 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
|
||||
nr_downlink_indication_t dl_indication;
|
||||
fapi_nr_rx_indication_t rx_ind;
|
||||
|
||||
dl_indication.module_id = ue->Mod_id;
|
||||
dl_indication.gNB_index = gNB_id;
|
||||
dl_indication.cc_id = proc->CC_id;
|
||||
dl_indication.frame = proc->frame_rx;
|
||||
dl_indication.slot = proc->nr_slot_rx;
|
||||
dl_indication.thread_id = proc->thread_id;
|
||||
dl_indication.rx_ind = &rx_ind; // hang on rx_ind instance
|
||||
dl_indication.dci_ind = NULL;
|
||||
uint16_t number_pdus = 1;
|
||||
|
||||
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_MIB;
|
||||
rx_ind.rx_indication_body[0].mib_pdu.pdu = &decoded_output[0]; //not good as it is pointing to a memory that can change
|
||||
rx_ind.rx_indication_body[0].mib_pdu.additional_bits = nr_ue_pbch_vars->xtra_byte;
|
||||
rx_ind.rx_indication_body[0].mib_pdu.ssb_index = i_ssb; // confirm with TCL
|
||||
rx_ind.rx_indication_body[0].mib_pdu.ssb_length = Lmax; // confirm with TCL
|
||||
rx_ind.rx_indication_body[0].mib_pdu.cell_id = frame_parms->Nid_cell; // confirm with TCL
|
||||
rx_ind.number_pdus = 1; //rx_ind.number_pdus++;
|
||||
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, gNB_id);
|
||||
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_MIB, gNB_id, ue, NULL, number_pdus);
|
||||
|
||||
if (ue->if_inst && ue->if_inst->dl_indication)
|
||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||
|
||||
@@ -1172,8 +1172,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
|
||||
int nr_pbch_detection(UE_nr_rxtx_proc_t *proc,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
int pbch_initial_symbol,
|
||||
runmode_t mode);
|
||||
int pbch_initial_symbol);
|
||||
|
||||
uint16_t rx_pbch_emul(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
uint8_t eNB_id,
|
||||
@@ -1453,7 +1452,6 @@ void generate_RIV_tables(void);
|
||||
*/
|
||||
int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
||||
PHY_VARS_NR_UE *phy_vars_ue,
|
||||
runmode_t mode,
|
||||
int n_frames);
|
||||
|
||||
/*!
|
||||
|
||||
+91
-231
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/*! \file PHY/defs_nr_UE.h
|
||||
\brief Top-level defines and structure definitions for nr ue
|
||||
\brief Top-level constants and data structures definitions for NR UE
|
||||
\author Guy De Souza, H. WANG, A. Mico Pereperez
|
||||
\date 2018
|
||||
\version 0.1
|
||||
@@ -46,9 +46,8 @@
|
||||
#include "common_lib.h"
|
||||
#include "msc.h"
|
||||
#include "fapi_nr_ue_interface.h"
|
||||
|
||||
//#include <complex.h>
|
||||
#include "assertions.h"
|
||||
|
||||
#ifdef MEX
|
||||
#define msg mexPrintf
|
||||
#else
|
||||
@@ -79,9 +78,6 @@
|
||||
#define openair_free(y,x) free((y))
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
//#define RX_NB_TH_MAX 3
|
||||
//#define RX_NB_TH 3
|
||||
|
||||
#ifdef NR_UNIT_TEST
|
||||
#define FILE_NAME " "
|
||||
#define LINE_FILE (0)
|
||||
@@ -92,53 +88,19 @@
|
||||
#define NR_TST_PHY_PRINTF(...)
|
||||
#endif
|
||||
|
||||
//#ifdef SHRLIBDEV
|
||||
//extern int rxrescale;
|
||||
//#define RX_IQRESCALELEN rxrescale
|
||||
//#else
|
||||
//#define RX_IQRESCALELEN 15
|
||||
//#endif
|
||||
|
||||
//! \brief Allocate \c size bytes of memory on the heap with alignment 16 and zero it afterwards.
|
||||
//! If no more memory is available, this function will terminate the program with an assertion error.
|
||||
/*static inline void* malloc16_clear( size_t size )
|
||||
{
|
||||
#ifdef __AVX2__
|
||||
void* ptr = memalign(32, size);
|
||||
#else
|
||||
void* ptr = memalign(16, size);
|
||||
#endif
|
||||
DevAssert(ptr);
|
||||
memset( ptr, 0, size );
|
||||
return ptr;
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
#define PAGE_MASK 0xfffff000
|
||||
#define virt_to_phys(x) (x)
|
||||
|
||||
#define openair_sched_exit() exit(-1)
|
||||
|
||||
|
||||
//#define max(a,b) ((a)>(b) ? (a) : (b))
|
||||
//#define min(a,b) ((a)<(b) ? (a) : (b))
|
||||
|
||||
|
||||
#define bzero(s,n) (memset((s),0,(n)))
|
||||
|
||||
#define cmax(a,b) ((a>b) ? (a) : (b))
|
||||
#define cmin(a,b) ((a<b) ? (a) : (b))
|
||||
|
||||
#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
|
||||
|
||||
/// suppress compiler warning for unused arguments
|
||||
#define UNUSED(x) (void)x;
|
||||
|
||||
|
||||
#include "impl_defs_top.h"
|
||||
#include "impl_defs_nr.h"
|
||||
|
||||
#include "PHY/TOOLS/time_meas.h"
|
||||
#include "PHY/CODING/coding_defs.h"
|
||||
#include "PHY/TOOLS/tools_defs.h"
|
||||
@@ -146,20 +108,14 @@
|
||||
#include "NR_UE_TRANSPORT/nr_transport_ue.h"
|
||||
|
||||
#if defined(UPGRADE_RAT_NR)
|
||||
|
||||
#include "PHY/NR_REFSIG/ss_pbch_nr.h"
|
||||
|
||||
#endif
|
||||
|
||||
#include "PHY/NR_UE_TRANSPORT/dci_nr.h"
|
||||
//#include "PHY/LTE_TRANSPORT/defs.h"
|
||||
//#include "PHY/NR_UE_TRANSPORT/defs_nr.h"
|
||||
#include <pthread.h>
|
||||
|
||||
#include "targets/ARCH/COMMON/common_lib.h"
|
||||
|
||||
|
||||
/// Context data structure for eNB subframe processing
|
||||
/// Context data structure for gNB subframe processing
|
||||
typedef struct {
|
||||
/// Component Carrier index
|
||||
uint8_t CC_id;
|
||||
@@ -177,9 +133,6 @@ typedef enum {
|
||||
#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
|
||||
|
||||
typedef struct {
|
||||
//unsigned int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (linear)
|
||||
//unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX]; //! estimated received signal power (dB)
|
||||
//unsigned short rx_avg_power_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //! estimated avg received signal power (dB)
|
||||
|
||||
// RRC measurements
|
||||
uint32_t rssi;
|
||||
@@ -207,59 +160,59 @@ typedef struct {
|
||||
|
||||
// UE measurements
|
||||
//! estimated received spatial signal power (linear)
|
||||
int rx_spatial_power[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
|
||||
int rx_spatial_power[NUMBER_OF_CONNECTED_gNB_MAX][2][2];
|
||||
//! estimated received spatial signal power (dB)
|
||||
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][2][2];
|
||||
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_gNB_MAX][2][2];
|
||||
|
||||
/// estimated received signal power (sum over all TX antennas)
|
||||
int rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
||||
int rx_power[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
|
||||
/// estimated received signal power (sum over all TX antennas)
|
||||
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
||||
unsigned short rx_power_dB[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
|
||||
|
||||
/// estimated received signal power (sum over all TX/RX antennas)
|
||||
int rx_power_tot[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
|
||||
int rx_power_tot[NUMBER_OF_CONNECTED_gNB_MAX]; //NEW
|
||||
/// estimated received signal power (sum over all TX/RX antennas)
|
||||
unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX]; //NEW
|
||||
unsigned short rx_power_tot_dB[NUMBER_OF_CONNECTED_gNB_MAX]; //NEW
|
||||
|
||||
//! estimated received signal power (sum of all TX/RX antennas, time average)
|
||||
int rx_power_avg[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int rx_power_avg[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
//! estimated received signal power (sum of all TX/RX antennas, time average, in dB)
|
||||
unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
unsigned short rx_power_avg_dB[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
/// SINR (sum of all TX/RX antennas, in dB)
|
||||
int wideband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int wideband_cqi_tot[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
/// SINR (sum of all TX/RX antennas, time average, in dB)
|
||||
int wideband_cqi_avg[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int wideband_cqi_avg[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
//! estimated rssi (dBm)
|
||||
short rx_rssi_dBm[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
short rx_rssi_dBm[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
|
||||
int rx_correlation[NUMBER_OF_CONNECTED_eNB_MAX][2];
|
||||
int rx_correlation[NUMBER_OF_CONNECTED_gNB_MAX][2];
|
||||
//! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
|
||||
int rx_correlation_dB[NUMBER_OF_CONNECTED_eNB_MAX][2];
|
||||
int rx_correlation_dB[NUMBER_OF_CONNECTED_gNB_MAX][2];
|
||||
|
||||
/// Wideband CQI (sum of all RX antennas, in dB, for precoded transmission modes (3,4,5,6), up to 4 spatial streams)
|
||||
int precoded_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX+1][4];
|
||||
int precoded_cqi_dB[NUMBER_OF_CONNECTED_gNB_MAX+1][4];
|
||||
/// Subband CQI per RX antenna (= SINR)
|
||||
int subband_cqi[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
|
||||
int subband_cqi[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
|
||||
/// Total Subband CQI (= SINR)
|
||||
int subband_cqi_tot[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
||||
int subband_cqi_tot[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
||||
/// Subband CQI in dB (= SINR dB)
|
||||
int subband_cqi_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
|
||||
int subband_cqi_dB[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX][NUMBER_OF_SUBBANDS_MAX];
|
||||
/// Total Subband CQI
|
||||
int subband_cqi_tot_dB[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
||||
int subband_cqi_tot_dB[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
||||
/// Wideband PMI for each RX antenna
|
||||
int wideband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
||||
int wideband_pmi_re[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
|
||||
/// Wideband PMI for each RX antenna
|
||||
int wideband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];
|
||||
int wideband_pmi_im[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
|
||||
///Subband PMI for each RX antenna
|
||||
int subband_pmi_re[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
|
||||
int subband_pmi_re[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
|
||||
///Subband PMI for each RX antenna
|
||||
int subband_pmi_im[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
|
||||
int subband_pmi_im[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX][NB_ANTENNAS_RX];
|
||||
/// chosen RX antennas (1=Rx antenna 1, 2=Rx antenna 2, 3=both Rx antennas)
|
||||
unsigned char selected_rx_antennas[NUMBER_OF_CONNECTED_eNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
||||
unsigned char selected_rx_antennas[NUMBER_OF_CONNECTED_gNB_MAX][NUMBER_OF_SUBBANDS_MAX];
|
||||
/// Wideband Rank indication
|
||||
unsigned char rank[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
unsigned char rank[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
/// Number of RX Antennas
|
||||
unsigned char nb_antennas_rx;
|
||||
/// DLSCH error counter
|
||||
@@ -379,7 +332,7 @@ typedef struct {
|
||||
int32_t **dl_ch_magb1[8][8];
|
||||
/// \brief Magnitude of Downlink Channel, first layer (256QAM level).
|
||||
int32_t **dl_ch_magr0;
|
||||
/// \brief Cross-correlation of two eNB signals.
|
||||
/// \brief Cross-correlation of two gNB signals.
|
||||
/// - first index: rx antenna [0..nb_antennas_rx[
|
||||
/// - second index: symbol [0..]
|
||||
int32_t **rho;
|
||||
@@ -647,11 +600,11 @@ typedef struct {
|
||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||
/// - second index: ? [0..168*N_RB_DL[
|
||||
int32_t **dl_ch_estimates_ext;
|
||||
/// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
|
||||
/// \brief Pointers to channel cross-correlation vectors for multi-gNB detection.
|
||||
/// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
|
||||
/// - second index: ? [0..168*N_RB_DL[
|
||||
int32_t **dl_ch_rho_ext;
|
||||
/// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
|
||||
/// \brief Pointers to channel cross-correlation vectors for multi-gNB detection.
|
||||
/// - first index: rx antenna [0..nb_antennas_rx[
|
||||
/// - second index: ? [0..]
|
||||
int32_t **rho;
|
||||
@@ -748,7 +701,6 @@ typedef struct {
|
||||
int16_t *prachF;
|
||||
int16_t *prach;
|
||||
fapi_nr_ul_config_prach_pdu prach_pdu;
|
||||
uint8_t prach_Config_enabled;
|
||||
} NR_UE_PRACH;
|
||||
|
||||
// structure used for multiple SSB detection
|
||||
@@ -785,7 +737,7 @@ typedef struct NR_UL_TIME_ALIGNMENT {
|
||||
int16_t ta_frame;
|
||||
char ta_slot;
|
||||
/// TA command and TAGID received from the gNB
|
||||
uint8_t ta_command;
|
||||
uint16_t ta_command;
|
||||
uint8_t tag_id;
|
||||
} NR_UL_TIME_ALIGNMENT_t;
|
||||
|
||||
@@ -832,8 +784,8 @@ typedef struct {
|
||||
int tx_total_RE[NR_MAX_SLOTS_PER_FRAME];
|
||||
/// \brief Maximum transmit power
|
||||
int8_t tx_power_max_dBm;
|
||||
/// \brief Number of eNB seen by UE
|
||||
uint8_t n_connected_eNB;
|
||||
/// \brief Number of gNB seen by UE
|
||||
uint8_t n_connected_gNB;
|
||||
/// \brief indicator that Handover procedure has been initiated
|
||||
uint8_t ho_initiated;
|
||||
/// \brief indicator that Handover procedure has been triggered
|
||||
@@ -849,33 +801,18 @@ typedef struct {
|
||||
|
||||
fapi_nr_config_request_t nrUE_config;
|
||||
|
||||
// the following structures are not part of PHY_vars_UE anymore as it is not thread safe. They are now on the stack of the functions that actually need them
|
||||
|
||||
//nr_downlink_indication_t dl_indication;
|
||||
//nr_uplink_indication_t ul_indication;
|
||||
/// UE FAPI DCI request
|
||||
//nr_dcireq_t dcireq;
|
||||
|
||||
// pointers to the next 2 strcutres are also included in dl_indictation
|
||||
/// UE FAPI indication for DLSCH reception
|
||||
//fapi_nr_rx_indication_t rx_ind;
|
||||
/// UE FAPI indication for DCI reception
|
||||
//fapi_nr_dci_indication_t dci_ind;
|
||||
|
||||
t_nrPolar_params *polarList;
|
||||
NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX+1]; // two RxTx Threads
|
||||
NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
NR_UE_PUSCH *pusch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX][NR_MAX_NB_CODEWORDS]; // two RxTx Threads
|
||||
NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_eNB_MAX][NR_MAX_NB_CODEWORDS]; // two code words
|
||||
NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
// This is for SIC in the UE, to store the reencoded data
|
||||
LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
NR_UE_PDSCH *pdsch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX+1]; // two RxTx Threads
|
||||
NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_PDCCH *pdcch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_PUSCH *pusch_vars[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two RxTx Threads
|
||||
NR_UE_ULSCH_t *ulsch[RX_NB_TH_MAX][NUMBER_OF_CONNECTED_gNB_MAX][NR_MAX_NB_CODEWORDS]; // two code words
|
||||
NR_UE_DLSCH_t *dlsch_SI[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch_ra[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch_p[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
//Paging parameters
|
||||
uint32_t IMSImod1024;
|
||||
@@ -916,52 +853,47 @@ typedef struct {
|
||||
uint32_t high_speed_flag;
|
||||
uint32_t perfect_ce;
|
||||
int16_t ch_est_alpha;
|
||||
int generate_ul_signal[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int generate_ul_signal[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
UE_NR_SCAN_INFO_t scan_info[NB_BANDS_MAX];
|
||||
|
||||
char ulsch_no_allocation_counter[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
|
||||
unsigned char ulsch_Msg3_active[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
char ulsch_no_allocation_counter[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
NR_PRACH_RESOURCES_t *prach_resources[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int turbo_iterations, turbo_cntl_iterations;
|
||||
/// \brief ?.
|
||||
/// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
|
||||
uint32_t total_TBS[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
/// - first index: gNB [0..NUMBER_OF_CONNECTED_gNB_MAX[ (hard coded)
|
||||
uint32_t total_TBS[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
/// \brief ?.
|
||||
/// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
|
||||
uint32_t total_TBS_last[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
/// - first index: gNB [0..NUMBER_OF_CONNECTED_gNB_MAX[ (hard coded)
|
||||
uint32_t total_TBS_last[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
/// \brief ?.
|
||||
/// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
|
||||
uint32_t bitrate[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
/// - first index: gNB [0..NUMBER_OF_CONNECTED_gNB_MAX[ (hard coded)
|
||||
uint32_t bitrate[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
/// \brief ?.
|
||||
/// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
|
||||
uint32_t total_received_bits[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_errors[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_errors_last[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_received_last[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_fer[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_SI_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_SI_errors[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_ra_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_ra_errors[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_p_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_p_errors[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_mch_received_sf[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_mch_received[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_mcch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_mtch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_mcch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_mtch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_mcch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int dlsch_mtch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
int current_dlsch_cqi[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
uint8_t prach_cnt;
|
||||
uint8_t prach_PreambleIndex;
|
||||
// uint8_t prach_timer;
|
||||
/// - first index: gNB [0..NUMBER_OF_CONNECTED_gNB_MAX[ (hard coded)
|
||||
uint32_t total_received_bits[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_errors[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_errors_last[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_received_last[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_fer[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_SI_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_SI_errors[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_ra_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_ra_errors[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_p_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_p_errors[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_mch_received_sf[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_mch_received[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_mcch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_mtch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_mcch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_mtch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_mcch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int dlsch_mtch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
int current_dlsch_cqi[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
uint8_t decode_SIB;
|
||||
uint8_t decode_MIB;
|
||||
uint8_t init_sync_frame;
|
||||
@@ -980,9 +912,9 @@ typedef struct {
|
||||
|
||||
/// Flag to tell if UE is secondary user (cognitive mode)
|
||||
unsigned char is_secondary_ue;
|
||||
/// Flag to tell if secondary eNB has channel estimates to create NULL-beams from.
|
||||
/// Flag to tell if secondary gNB has channel estimates to create NULL-beams from.
|
||||
unsigned char has_valid_precoder;
|
||||
/// hold the precoder for NULL beam to the primary eNB
|
||||
/// hold the precoder for NULL beam to the primary gNB
|
||||
int **ul_precoder_S_UE;
|
||||
/// holds the maximum channel/precoder coefficient
|
||||
char log2_maxp;
|
||||
@@ -1008,17 +940,17 @@ typedef struct {
|
||||
double N0;
|
||||
|
||||
/// PDSCH Varaibles
|
||||
PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
/// PUSCH Varaibles
|
||||
PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
/// PUSCH contention-based access vars
|
||||
PUSCH_CA_CONFIG_DEDICATED pusch_ca_config_dedicated[NUMBER_OF_eNB_MAX]; // lola
|
||||
|
||||
/// PUCCH variables
|
||||
|
||||
PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
//#if defined(UPGRADE_RAT_NR)
|
||||
#if 1
|
||||
@@ -1029,8 +961,8 @@ typedef struct {
|
||||
PDSCH_ServingCellConfig_t PDSCH_ServingCellConfig;
|
||||
PDSCH_Config_t PDSCH_Config;
|
||||
|
||||
PUCCH_ConfigCommon_nr_t pucch_config_common_nr[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
PUCCH_Config_t pucch_config_dedicated_nr[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
PUCCH_ConfigCommon_nr_t pucch_config_common_nr[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
PUCCH_Config_t pucch_config_dedicated_nr[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
PUSCH_Config_t pusch_config;
|
||||
SRS_NR srs;
|
||||
@@ -1046,29 +978,29 @@ typedef struct {
|
||||
uint8_t ncs_cell[20][7];
|
||||
|
||||
/// UL-POWER-Control
|
||||
UL_POWER_CONTROL_DEDICATED ul_power_control_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
UL_POWER_CONTROL_DEDICATED ul_power_control_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
/// TPC
|
||||
TPC_PDCCH_CONFIG tpc_pdcch_config_pucch[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
TPC_PDCCH_CONFIG tpc_pdcch_config_pusch[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
TPC_PDCCH_CONFIG tpc_pdcch_config_pucch[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
TPC_PDCCH_CONFIG tpc_pdcch_config_pusch[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
/// CQI reporting
|
||||
CQI_REPORT_CONFIG cqi_report_config[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
CQI_REPORT_CONFIG cqi_report_config[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
/// SRS Variables
|
||||
SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
/// Scheduling Request Config
|
||||
SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
//#if defined(UPGRADE_RAT_NR)
|
||||
#if 1
|
||||
scheduling_request_config_t scheduling_request_config_nr[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
scheduling_request_config_t scheduling_request_config_nr[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
#endif
|
||||
|
||||
/// Transmission mode per eNB
|
||||
uint8_t transmission_mode[NUMBER_OF_CONNECTED_eNB_MAX];
|
||||
/// Transmission mode per gNB
|
||||
uint8_t transmission_mode[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
time_stats_t phy_proc[RX_NB_TH];
|
||||
time_stats_t phy_proc_tx;
|
||||
@@ -1137,7 +1069,6 @@ typedef struct {
|
||||
|
||||
} PHY_VARS_NR_UE;
|
||||
|
||||
|
||||
/* this structure is used to pass both UE phy vars and
|
||||
* proc to the function UE_thread_rxn_txnp4
|
||||
*/
|
||||
@@ -1146,76 +1077,5 @@ typedef struct nr_rxtx_thread_data_s {
|
||||
PHY_VARS_NR_UE *UE;
|
||||
} nr_rxtx_thread_data_t;
|
||||
|
||||
/*static inline int wait_on_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) {
|
||||
|
||||
if (pthread_mutex_lock(mutex) != 0) {
|
||||
LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
|
||||
exit_fun("nothing to add");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
while (*instance_cnt < 0) {
|
||||
// most of the time the thread is waiting here
|
||||
// proc->instance_cnt_rxtx is -1
|
||||
pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
|
||||
}
|
||||
|
||||
if (pthread_mutex_unlock(mutex) != 0) {
|
||||
LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name);
|
||||
exit_fun("nothing to add");
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static inline int wait_on_busy_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) {
|
||||
|
||||
if (pthread_mutex_lock(mutex) != 0) {
|
||||
LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
|
||||
exit_fun("nothing to add");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
while (*instance_cnt == 0) {
|
||||
// most of the time the thread will skip this
|
||||
// waits only if proc->instance_cnt_rxtx is 0
|
||||
pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
|
||||
}
|
||||
|
||||
if (pthread_mutex_unlock(mutex) != 0) {
|
||||
LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name);
|
||||
exit_fun("nothing to add");
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *name) {
|
||||
|
||||
if (pthread_mutex_lock(mutex) != 0) {
|
||||
LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
|
||||
exit_fun("nothing to add");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
*instance_cnt=*instance_cnt-1;
|
||||
|
||||
if (pthread_mutex_unlock(mutex) != 0) {
|
||||
LOG_E( PHY, "[SCHED][eNB] error unlocking mutex for %s\n",name);
|
||||
exit_fun("nothing to add");
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
#include "PHY/INIT/defs.h"
|
||||
#include "PHY/LTE_REFSIG/defs.h"
|
||||
#include "PHY/MODULATION/defs.h"
|
||||
#include "PHY/LTE_TRANSPORT/proto.h"
|
||||
#include "PHY/LTE_ESTIMATION/defs.h"
|
||||
*/
|
||||
#include "SIMULATION/ETH_TRANSPORT/defs.h"
|
||||
#endif
|
||||
|
||||
@@ -150,6 +150,11 @@ typedef enum {
|
||||
MOD_QAM256
|
||||
}nr_mod_t;
|
||||
|
||||
typedef enum {
|
||||
RA_2STEP = 0,
|
||||
RA_4STEP
|
||||
} nr_ra_type_e;
|
||||
|
||||
typedef struct {
|
||||
/// Size of first RBG
|
||||
uint8_t start_size;
|
||||
@@ -205,8 +210,12 @@ typedef struct {
|
||||
uint16_t prach_format;
|
||||
/// Preamble index for PRACH (0-63)
|
||||
uint8_t ra_PreambleIndex;
|
||||
/// RACH MaskIndex
|
||||
uint8_t ra_RACH_MaskIndex;
|
||||
/// Preamble Tx Counter
|
||||
uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER;
|
||||
/// Preamble Power Ramping Counter
|
||||
uint8_t RA_PREAMBLE_POWER_RAMPING_COUNTER;
|
||||
/// 2-step RA power offset
|
||||
int POWER_OFFSET_2STEP_RA;
|
||||
/// Target received power at gNB. Baseline is range -202..-60 dBm. Depends on delta preamble, power ramping counter and step.
|
||||
int ra_PREAMBLE_RECEIVED_TARGET_POWER;
|
||||
/// PRACH index for TDD (0 ... 6) depending on TDD configuration and prachConfigIndex
|
||||
@@ -217,8 +226,10 @@ typedef struct {
|
||||
uint8_t RA_PREAMBLE_BACKOFF;
|
||||
///
|
||||
uint8_t RA_SCALING_FACTOR_BI;
|
||||
///
|
||||
uint8_t RA_PCMAX;
|
||||
/// Indicating whether it is 2-step or 4-step RA
|
||||
nr_ra_type_e RA_TYPE;
|
||||
/// UE configured maximum output power
|
||||
int RA_PCMAX;
|
||||
/// Corresponding RA-RNTI for UL-grant
|
||||
uint16_t ra_RNTI;
|
||||
/// Pointer to Msg3 payload for UL-grant
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
//#include "common/ran_context.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/nr_phy_scope.h"
|
||||
extern char do_forms;
|
||||
#endif
|
||||
|
||||
extern char* namepointer_chMag ;
|
||||
extern char* namepointer_log2;
|
||||
extern char fmageren_name2[512];
|
||||
@@ -109,5 +114,8 @@ extern unsigned short Nb_81_110[8][4];
|
||||
extern uint16_t hundred_times_log10_NPRB[100];
|
||||
extern uint8_t alpha_lut[8];
|
||||
extern uint8_t max_turbo_iterations;
|
||||
|
||||
extern double cpuf;
|
||||
|
||||
#endif /*__PHY_EXTERN_H__ */
|
||||
|
||||
|
||||
+31
-13
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
\brief NR UE PHY functions prototypes
|
||||
\author R. Knopp, F. Kaltenberger
|
||||
\company EURECOM
|
||||
\email knopp@eurecom.fr
|
||||
@@ -113,16 +114,14 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
|
||||
@param ue Pointer to UE variables on which to act
|
||||
@param proc Pointer to proc information
|
||||
@param gNB_id Local id of eNB on which to act
|
||||
@param mode calibration/debug mode
|
||||
@param dlsch_parallel use multithreaded dlsch processing
|
||||
*/
|
||||
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t gNB_id,
|
||||
runmode_t mode,
|
||||
uint8_t dlsch_parallel);
|
||||
|
||||
int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type);
|
||||
int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id, uint8_t abstraction_flag, uint8_t do_pdcch_flag, relaying_type_t r_type);
|
||||
|
||||
|
||||
#ifdef UE_SLOT_PARALLELISATION
|
||||
@@ -223,7 +222,7 @@ void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
|
||||
@param
|
||||
@param
|
||||
*/
|
||||
void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, runmode_t mode);
|
||||
void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id);
|
||||
|
||||
int is_nr_prach_subframe(NR_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t subframe);
|
||||
|
||||
@@ -305,15 +304,6 @@ int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
|
||||
*/
|
||||
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx);
|
||||
|
||||
/*! \brief Compute the timing adjustment at UE side from the old TA offset and the new received TA command
|
||||
@param Mod_id Local UE index on which to act
|
||||
@param CC_id Component Carrier Index
|
||||
@param ta_command TA command received from the network
|
||||
@param mu numerology index (0,1,2..)
|
||||
*/
|
||||
void nr_process_timing_advance(module_id_t Mod_id,uint8_t CC_id,uint8_t ta_command, uint8_t mu, uint16_t bwp_ul_NB_RB);
|
||||
void nr_process_timing_advance_rar(PHY_VARS_NR_UE *ue, int frame_rx, int nr_slot_rx, uint16_t ta_command);
|
||||
|
||||
unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb);
|
||||
|
||||
void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
|
||||
@@ -347,6 +337,8 @@ uint16_t nr_get_n1_pucch(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
*/
|
||||
UE_MODE_t get_nrUE_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t gNB_index);
|
||||
|
||||
uint8_t get_ra_PreambleIndex(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_id);
|
||||
|
||||
/*! \brief This function implements the power control mechanism for PUCCH from 36.213.
|
||||
@param phy_vars_ue PHY variables
|
||||
@param proc Pointer to proc descriptor
|
||||
@@ -396,8 +388,34 @@ int get_tx_harq_id(NR_UE_ULSCH_t *ulsch, int slot_tx);
|
||||
int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
||||
int is_ssb_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL_FRAME_PARMS *fp);
|
||||
|
||||
/*! \brief This function prepares the dl indication to pass to the MAC
|
||||
@param
|
||||
@param
|
||||
@param
|
||||
@param
|
||||
*/
|
||||
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
|
||||
fapi_nr_dci_indication_t *dci_ind,
|
||||
fapi_nr_rx_indication_t *rx_ind,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
uint8_t gNB_id);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*! \brief This function prepares the dl rx indication
|
||||
@param
|
||||
@param
|
||||
@param
|
||||
@param
|
||||
*/
|
||||
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||
uint8_t pdu_type,
|
||||
uint8_t gNB_id,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
NR_UE_DLSCH_t *dlsch0,
|
||||
uint16_t n_pdus);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
|
||||
extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
|
||||
|
||||
const char *dl_pdu_type[]={"DCI", "DLSCH", "RA_DLSCH"};
|
||||
const char *ul_pdu_type[]={"PRACH", "PUCCH", "PUSCH", "SRS"};
|
||||
|
||||
int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||
|
||||
if(scheduled_response != NULL){
|
||||
@@ -61,14 +64,14 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||
if(scheduled_response->dl_config != NULL){
|
||||
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
|
||||
|
||||
LOG_D(PHY,"Received %d DL pdus:\n",dl_config->number_pdus);
|
||||
pdcch_vars->nb_search_space = 0;
|
||||
|
||||
for (i = 0; i < dl_config->number_pdus; ++i){
|
||||
|
||||
LOG_D(PHY, "In %s: received 1 DL %s PDU of %d total DL PDUs:\n", __FUNCTION__, dl_pdu_type[dl_config->dl_config_list[i].pdu_type - 1], dl_config->number_pdus);
|
||||
|
||||
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DCI) {
|
||||
|
||||
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_DCI\n");
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
|
||||
memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config));
|
||||
pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1;
|
||||
@@ -77,11 +80,9 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||
} else {
|
||||
|
||||
if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_DLSCH){
|
||||
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_DLSCH\n");
|
||||
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch[thread_id][0][0];
|
||||
}
|
||||
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){
|
||||
LOG_D(PHY,"FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH\n");
|
||||
dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0];
|
||||
}
|
||||
else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){
|
||||
@@ -146,6 +147,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||
|
||||
for (i = 0; i < ul_config->number_pdus; ++i){
|
||||
|
||||
LOG_D(PHY, "In %s: processing %s PDU of %d total UL PDUs (ul_config %p) \n", __FUNCTION__, ul_pdu_type[ul_config->ul_config_list[i].pdu_type - 1], ul_config->number_pdus, ul_config);
|
||||
|
||||
uint8_t pdu_type = ul_config->ul_config_list[i].pdu_type, pucch_resource_id, current_harq_pid, format, gNB_id = 0;
|
||||
/* PRACH */
|
||||
//NR_PRACH_RESOURCES_t *prach_resources;
|
||||
@@ -241,14 +244,15 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||
// prach config pdu
|
||||
prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu;
|
||||
memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), (void*)prach_config_pdu, sizeof(fapi_nr_ul_config_prach_pdu));
|
||||
PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_Config_enabled = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ul_config->number_pdus = 0;
|
||||
|
||||
memset(ul_config, 0, sizeof(fapi_nr_ul_config_request_t));
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -77,23 +77,83 @@ fifo_dump_emos_UE emos_dump_UE;
|
||||
#include "intertask_interface.h"
|
||||
#include "T.h"
|
||||
|
||||
#define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs)
|
||||
#define DLSCH_RB_ALLOC_12 0x0aaa // skip DC RB (total 23/25 RBs)
|
||||
|
||||
#define NS_PER_SLOT 500000
|
||||
|
||||
char nr_mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
|
||||
|
||||
const uint8_t nr_rv_round_map_ue[4] = {0, 2, 1, 3};
|
||||
|
||||
extern double cpuf;
|
||||
|
||||
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
|
||||
extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
#endif
|
||||
|
||||
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};
|
||||
|
||||
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
|
||||
fapi_nr_dci_indication_t *dci_ind,
|
||||
fapi_nr_rx_indication_t *rx_ind,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
uint8_t gNB_id){
|
||||
|
||||
memset((void*)dl_ind, 0, sizeof(nr_downlink_indication_t));
|
||||
|
||||
dl_ind->gNB_index = gNB_id;
|
||||
dl_ind->module_id = ue->Mod_id;
|
||||
dl_ind->cc_id = ue->CC_id;
|
||||
dl_ind->frame = proc->frame_rx;
|
||||
dl_ind->slot = proc->nr_slot_rx;
|
||||
dl_ind->thread_id = proc->thread_id;
|
||||
|
||||
if (dci_ind) {
|
||||
|
||||
dl_ind->rx_ind = NULL; //no data, only dci for now
|
||||
dl_ind->dci_ind = dci_ind;
|
||||
|
||||
} else if (rx_ind) {
|
||||
|
||||
dl_ind->rx_ind = rx_ind; // hang on rx_ind instance
|
||||
dl_ind->dci_ind = NULL;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||
uint8_t pdu_type,
|
||||
uint8_t gNB_id,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
NR_UE_DLSCH_t *dlsch0,
|
||||
uint16_t n_pdus){
|
||||
|
||||
int harq_pid;
|
||||
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
|
||||
if (n_pdus > 1){
|
||||
LOG_E(PHY, "In %s: multiple number of DL PDUs not supported yet...\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
switch (pdu_type){
|
||||
case FAPI_NR_RX_PDU_TYPE_DLSCH:
|
||||
case FAPI_NR_RX_PDU_TYPE_RAR:
|
||||
harq_pid = dlsch0->current_harq_pid;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS / 8;
|
||||
break;
|
||||
case FAPI_NR_RX_PDU_TYPE_MIB:
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.pdu = ue->pbch_vars[gNB_id]->decoded_output;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.additional_bits = ue->pbch_vars[gNB_id]->xtra_byte;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_index = frame_parms->ssb_index;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_length = frame_parms->Lmax;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.cell_id = frame_parms->Nid_cell;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
rx_ind->rx_indication_body[n_pdus -1].pdu_type = pdu_type;
|
||||
rx_ind->number_pdus = n_pdus;
|
||||
|
||||
}
|
||||
|
||||
int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){
|
||||
|
||||
int gain_dB = power_dBm - power_max_dBm, amp_x_100 = -1;
|
||||
@@ -136,6 +196,13 @@ UE_MODE_t get_nrUE_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t gNB_id){
|
||||
return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[gNB_id]);
|
||||
}
|
||||
|
||||
uint8_t get_ra_PreambleIndex(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_id){
|
||||
|
||||
return PHY_vars_UE_g[Mod_id][CC_id]->prach_resources[gNB_id]->ra_PreambleIndex;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// scale the 16 factor in N_TA calculation in 38.213 section 4.2 according to the used FFT size
|
||||
uint16_t get_bw_scaling(uint16_t nb_rb){
|
||||
uint16_t bw_scaling;
|
||||
@@ -151,9 +218,12 @@ uint16_t get_bw_scaling(uint16_t nb_rb){
|
||||
return bw_scaling;
|
||||
}
|
||||
|
||||
/* UL time alignment
|
||||
// If the current tx frame and slot match the TA configuration in ul_time_alignment
|
||||
// then timing advance is processed and set to be applied in the next UL transmission */
|
||||
// UL time alignment procedures:
|
||||
// - If the current tx frame and slot match the TA configuration in ul_time_alignment
|
||||
// then timing advance is processed and set to be applied in the next UL transmission
|
||||
// - Application of timing adjustment according to TS 38.213 p4.2
|
||||
// todo:
|
||||
// - handle RAR TA application as per ch 4.2 TS 38.213
|
||||
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
||||
|
||||
if (ue->mac_enabled == 1) {
|
||||
@@ -165,10 +235,36 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
||||
|
||||
uint8_t numerology = ue->frame_parms.numerology_index;
|
||||
uint16_t bwp_ul_NB_RB = ue->frame_parms.N_RB_UL;
|
||||
int factor_mu = 1 << numerology;
|
||||
uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB);
|
||||
|
||||
LOG_D(PHY, "In %s: applying timing advance -- frame %d -- slot %d\n", __FUNCTION__, frame_tx, slot_tx);
|
||||
LOG_D(PHY, "In %s: applying timing advance -- frame %d -- slot %d -- UE_mode %d\n", __FUNCTION__, frame_tx, slot_tx, ue->UE_mode[gNB_id]);
|
||||
|
||||
nr_process_timing_advance(ue->Mod_id, ue->CC_id, ul_time_alignment->ta_command, numerology, bwp_ul_NB_RB);
|
||||
if (ue->UE_mode[gNB_id] == RA_RESPONSE){
|
||||
|
||||
ue->timing_advance = ul_time_alignment->ta_command * bw_scaling / factor_mu;
|
||||
|
||||
LOG_D(PHY, "In %s: [UE %d] [%d.%d] Received (RAR) timing advance command %d new value is %u \n",
|
||||
__FUNCTION__,
|
||||
ue->Mod_id,
|
||||
frame_tx,
|
||||
slot_tx,
|
||||
ul_time_alignment->ta_command,
|
||||
ue->timing_advance);
|
||||
|
||||
} else if (ue->UE_mode[gNB_id] == PUSCH){
|
||||
|
||||
ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling / factor_mu;
|
||||
|
||||
LOG_D(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n",
|
||||
__FUNCTION__,
|
||||
ue->Mod_id,
|
||||
frame_tx,
|
||||
slot_tx,
|
||||
ul_time_alignment->ta_command,
|
||||
ue->timing_advance);
|
||||
|
||||
}
|
||||
|
||||
ul_time_alignment->ta_frame = -1;
|
||||
ul_time_alignment->ta_slot = -1;
|
||||
@@ -177,38 +273,14 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
|
||||
}
|
||||
}
|
||||
|
||||
void nr_process_timing_advance(module_id_t Mod_id, uint8_t CC_id, uint8_t ta_command, uint8_t mu, uint16_t bwp_ul_NB_RB){
|
||||
|
||||
// 3GPP TS 38.213 p4.2
|
||||
// scale by the scs numerology
|
||||
int factor_mu = 1 << mu;
|
||||
uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB);
|
||||
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->timing_advance += (ta_command - 31) * bw_scaling / factor_mu;
|
||||
|
||||
LOG_D(PHY, "[UE %d] Got timing advance command %u from MAC, new value is %d\n", Mod_id, ta_command, PHY_vars_UE_g[Mod_id][CC_id]->timing_advance);
|
||||
}
|
||||
|
||||
// WIP
|
||||
// - todo: handle TA application as per ch 4.2 TS 38.213
|
||||
void nr_process_timing_advance_rar(PHY_VARS_NR_UE *ue, int frame_rx, int nr_slot_rx, uint16_t ta_command) {
|
||||
|
||||
int factor_mu = 1 << ue->frame_parms.numerology_index;
|
||||
uint16_t bwp_ul_NB_RB = ue->frame_parms.N_RB_UL;
|
||||
uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB);
|
||||
|
||||
// Transmission timing adjustment (TS 38.213 p4.2)
|
||||
ue->timing_advance = bw_scaling / factor_mu;
|
||||
|
||||
LOG_D(PHY, "[UE %d] Frame %d Slot %d, Received (RAR) timing advance command %d new value is %u \n", ue->Mod_id, frame_rx, nr_slot_rx, ta_command, ue->timing_advance);
|
||||
}
|
||||
|
||||
void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t gNB_id) {
|
||||
|
||||
int slot_tx = proc->nr_slot_tx;
|
||||
int frame_tx = proc->frame_tx;
|
||||
runmode_t mode = normal_txrx;
|
||||
|
||||
AssertFatal(ue->CC_id == 0, "Transmission on secondary CCs is not supported yet\n");
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
|
||||
|
||||
@@ -239,15 +311,11 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
nr_ue_pusch_common_procedures(ue,
|
||||
slot_tx,
|
||||
&ue->frame_parms,1);
|
||||
//ue->ulsch[proc->thread_id][gNB_id][0]->harq_processes[harq_pid]->pusch_pdu.nrOfLayers);
|
||||
}
|
||||
//LOG_M("txdata.m","txs",ue->common_vars.txdata[0],1228800,1,1);
|
||||
|
||||
/* RACH */
|
||||
if (get_softmodem_params()->do_ra==1) {
|
||||
if ((ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) {
|
||||
nr_ue_prach_procedures(ue, proc, gNB_id, mode);
|
||||
}
|
||||
}
|
||||
|
||||
if (ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) {
|
||||
nr_ue_prach_procedures(ue, proc, gNB_id);
|
||||
}
|
||||
LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx);
|
||||
|
||||
@@ -262,8 +330,7 @@ void nr_ue_measurement_procedures(uint16_t l,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t eNB_id,
|
||||
uint16_t slot,
|
||||
runmode_t mode){
|
||||
uint16_t slot){
|
||||
|
||||
NR_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
|
||||
int frame_rx = proc->frame_rx;
|
||||
@@ -316,11 +383,7 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t abstraction_flag)
|
||||
{
|
||||
// int i;
|
||||
//int pbch_tx_ant=0;
|
||||
int ret = 0;
|
||||
//static uint8_t first_run = 1;
|
||||
//uint8_t pbch_trials = 0;
|
||||
|
||||
DevAssert(ue);
|
||||
|
||||
@@ -345,9 +408,13 @@ void nr_ue_pbch_procedures(uint8_t gNB_id,
|
||||
|
||||
// Switch to PRACH state if it is first PBCH after initial synch and no timing correction is performed
|
||||
if (ue->UE_mode[gNB_id] == NOT_SYNCHED && ue->no_timing_correction == 1){
|
||||
ue->UE_mode[gNB_id] = PRACH;
|
||||
ue->prach_resources[gNB_id]->sync_frame = frame_rx;
|
||||
ue->prach_resources[gNB_id]->init_msg1 = 0;
|
||||
if (get_softmodem_params()->do_ra) {
|
||||
ue->UE_mode[gNB_id] = PRACH;
|
||||
ue->prach_resources[gNB_id]->sync_frame = frame_rx;
|
||||
ue->prach_resources[gNB_id]->init_msg1 = 0;
|
||||
} else {
|
||||
ue->UE_mode[gNB_id] = PUSCH;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
@@ -439,6 +506,8 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
||||
int frame_rx = proc->frame_rx;
|
||||
int nr_slot_rx = proc->nr_slot_rx;
|
||||
unsigned int dci_cnt=0;
|
||||
fapi_nr_dci_indication_t dci_ind = {0};
|
||||
nr_downlink_indication_t dl_indication;
|
||||
|
||||
/*
|
||||
// unsigned int dci_cnt=0, i; //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active
|
||||
@@ -635,8 +704,6 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
||||
pdcch_vars->nb_search_space);
|
||||
#endif
|
||||
|
||||
fapi_nr_dci_indication_t dci_ind={0};
|
||||
nr_downlink_indication_t dl_indication={0};
|
||||
dci_cnt = nr_dci_decoding_procedure(ue, proc, &dci_ind);
|
||||
|
||||
#ifdef NR_PDCCH_SCHED_DEBUG
|
||||
@@ -694,15 +761,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
|
||||
*/
|
||||
|
||||
// fill dl_indication message
|
||||
dl_indication.module_id = ue->Mod_id;
|
||||
dl_indication.cc_id = ue->CC_id;
|
||||
dl_indication.gNB_index = gNB_id;
|
||||
dl_indication.frame = frame_rx;
|
||||
dl_indication.slot = nr_slot_rx;
|
||||
dl_indication.thread_id = proc->thread_id;
|
||||
dl_indication.rx_ind = NULL; //no data, only dci for now
|
||||
dl_indication.dci_ind = &dci_ind;
|
||||
|
||||
nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, gNB_id);
|
||||
// send to mac
|
||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||
|
||||
@@ -851,85 +910,6 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_
|
||||
return 0;
|
||||
}
|
||||
|
||||
// WIP fix:
|
||||
// - time domain indication hardcoded to 0 for k2 offset
|
||||
// - extend TS 38.213 ch 8.3 Msg3 PUSCH
|
||||
// - b buffer
|
||||
// - ulsch power offset
|
||||
// - UE_mode == PUSCH case (should be handled by TA updates)
|
||||
// - harq
|
||||
// - optimize: mu_pusch, j and table_6_1_2_1_1_2_time_dom_res_alloc_A are already defined in nr_ue_procedures
|
||||
void nr_process_rar(nr_downlink_indication_t *dl_info) {
|
||||
|
||||
module_id_t module_id = dl_info->module_id;
|
||||
int cc_id = dl_info->cc_id, frame_rx = dl_info->frame, nr_slot_rx = dl_info->slot, ta_command;
|
||||
uint8_t gNB_index = dl_info->gNB_index; // *rar;
|
||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[module_id][cc_id];
|
||||
NR_UE_DLSCH_t *dlsch0 = ue->dlsch_ra[gNB_index];
|
||||
UE_MODE_t UE_mode = ue->UE_mode[gNB_index];
|
||||
NR_PRACH_RESOURCES_t *prach_resources = ue->prach_resources[gNB_index];
|
||||
|
||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d slot %d Received RAR mode %d\n", module_id, frame_rx, nr_slot_rx, UE_mode);
|
||||
|
||||
if (ue->mac_enabled == 1) {
|
||||
if ((UE_mode != PUSCH) && (prach_resources->Msg3 != NULL)) {
|
||||
|
||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d slot %d Invoking MAC for RAR (current preamble %d)\n", module_id, frame_rx, nr_slot_rx, prach_resources->ra_PreambleIndex);
|
||||
|
||||
ta_command = nr_ue_process_rar(ue->Mod_id,
|
||||
cc_id,
|
||||
frame_rx,
|
||||
nr_slot_rx,
|
||||
dlsch0->harq_processes[0]->b,
|
||||
&ue->pdcch_vars[dl_info->thread_id][gNB_index]->pdcch_config[0].rnti,
|
||||
prach_resources->ra_PreambleIndex,
|
||||
dlsch0->harq_processes[0]->b); // alter the 'b' buffer so it contains only the selected RAR header and RAR payload
|
||||
|
||||
if (ta_command != 0xffff) {
|
||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d slot %d Got Temporary C-RNTI %x and timing advance %d from RAR\n",
|
||||
ue->Mod_id,
|
||||
frame_rx,
|
||||
nr_slot_rx,
|
||||
ue->pdcch_vars[dl_info->thread_id][gNB_index]->pdcch_config[0].rnti,
|
||||
ta_command);
|
||||
|
||||
nr_process_timing_advance_rar(ue, frame_rx, nr_slot_rx, ta_command);
|
||||
|
||||
if (ue->mode != debug_prach)
|
||||
ue->UE_mode[gNB_index] = RA_RESPONSE;
|
||||
|
||||
} else {
|
||||
LOG_W(PHY,"[UE %d][RAPROC] Received RAR preamble (%d) doesn't match !!!\n", ue->Mod_id, prach_resources->ra_PreambleIndex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// rar = dlsch0->harq_processes[0]->b+1;
|
||||
// ta_command = ((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
|
||||
// nr_process_timing_advance_rar(ue, frame_rx, nr_slot_rx, ta_command);
|
||||
}
|
||||
}
|
||||
|
||||
// if contention resolution fails, go back to UE mode PRACH
|
||||
void nr_ra_failed(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index) {
|
||||
|
||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
ue->UE_mode[gNB_index] = PRACH;
|
||||
|
||||
for (int i=0; i <RX_NB_TH_MAX; i++ ) {
|
||||
ue->pdcch_vars[i][gNB_index]->pdcch_config[0].rnti = 0;
|
||||
}
|
||||
LOG_E(PHY,"[UE %d] [RAPROC] Random-access procedure fails, going back to PRACH\n", Mod_id);
|
||||
}
|
||||
|
||||
void nr_ra_succeeded(uint8_t Mod_id,
|
||||
uint8_t CC_id,
|
||||
uint8_t gNB_index){
|
||||
LOG_I(PHY,"[UE %d][RAPROC] RA procedure succeeded. UE set to PUSCH mode\n", Mod_id);
|
||||
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
ue->ulsch_Msg3_active[gNB_index] = 0;
|
||||
ue->UE_mode[gNB_index] = PUSCH;
|
||||
}
|
||||
|
||||
void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int eNB_id,
|
||||
@@ -937,7 +917,6 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
NR_UE_DLSCH_t *dlsch0,
|
||||
NR_UE_DLSCH_t *dlsch1,
|
||||
int *dlsch_errors,
|
||||
runmode_t mode,
|
||||
uint8_t dlsch_parallel) {
|
||||
|
||||
if (dlsch0==NULL)
|
||||
@@ -955,6 +934,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
uint16_t nb_symb_sch = 9;
|
||||
nr_downlink_indication_t dl_indication;
|
||||
fapi_nr_rx_indication_t rx_ind;
|
||||
uint16_t number_pdus = 1;
|
||||
// params for UL time alignment procedure
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &ue->ul_time_alignment[eNB_id];
|
||||
uint16_t slots_per_frame = ue->frame_parms.slots_per_frame;
|
||||
@@ -1213,42 +1193,33 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
|
||||
LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ \n", frame_rx, nr_slot_rx);
|
||||
LOG_D(PHY, "harq_pid: %d, TBS expected dlsch0: %d \n",harq_pid, dlsch0->harq_processes[harq_pid]->TBS);
|
||||
|
||||
|
||||
if(ret<dlsch0->max_ldpc_iterations+1){
|
||||
|
||||
// fill dl_indication message
|
||||
dl_indication.module_id = ue->Mod_id;
|
||||
dl_indication.cc_id = ue->CC_id;
|
||||
dl_indication.gNB_index = eNB_id;
|
||||
dl_indication.frame = frame_rx;
|
||||
dl_indication.slot = nr_slot_rx;
|
||||
dl_indication.thread_id = proc->thread_id;
|
||||
dl_indication.rx_ind = &rx_ind; // hang on rx_ind instance
|
||||
dl_indication.dci_ind = NULL;
|
||||
|
||||
//dl_indication.rx_ind->number_pdus
|
||||
switch (pdsch) {
|
||||
case RA_PDSCH:
|
||||
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR;
|
||||
break;
|
||||
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, eNB_id);
|
||||
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, eNB_id, ue, dlsch0, number_pdus);
|
||||
|
||||
ue->UE_mode[eNB_id] = RA_RESPONSE;
|
||||
break;
|
||||
case PDSCH:
|
||||
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
|
||||
break;
|
||||
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, eNB_id);
|
||||
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, eNB_id, ue, dlsch0, number_pdus);
|
||||
break;
|
||||
case SI_PDSCH:
|
||||
rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_SIB;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
rx_ind.rx_indication_body[0].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b;
|
||||
rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS>>3;
|
||||
LOG_D(PHY, "PDU length in bits: %d, in bytes: %d \n", dlsch0->harq_processes[harq_pid]->TBS, rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length);
|
||||
rx_ind.number_pdus = 1;
|
||||
LOG_D(PHY, "In %s DL PDU length in bits: %d, in bytes: %d \n", __FUNCTION__, dlsch0->harq_processes[harq_pid]->TBS, dlsch0->harq_processes[harq_pid]->TBS / 8);
|
||||
|
||||
// send to mac
|
||||
if (ue->if_inst && ue->if_inst->dl_indication)
|
||||
ue->if_inst->dl_indication(&dl_indication, ul_time_alignment);
|
||||
if (ue->if_inst && ue->if_inst->dl_indication) {
|
||||
ue->if_inst->dl_indication(&dl_indication, ul_time_alignment);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO CRC check for CW0
|
||||
@@ -1607,7 +1578,7 @@ void *UE_thread_slot1_dl_processing(void *arg) {
|
||||
abstraction_flag);
|
||||
}
|
||||
// do procedures for RA-RNTI
|
||||
if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) {
|
||||
if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1) && (UE_mode != PUSCH)) {
|
||||
ue_pdsch_procedures(ue,
|
||||
proc,
|
||||
eNB_id,
|
||||
@@ -1725,7 +1696,6 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL
|
||||
int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
uint8_t gNB_id,
|
||||
runmode_t mode,
|
||||
uint8_t dlsch_parallel
|
||||
)
|
||||
{
|
||||
@@ -1779,9 +1749,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
#endif
|
||||
}
|
||||
|
||||
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
|
||||
nr_ue_rsrp_measurements(ue,proc,nr_slot_rx,0);
|
||||
//}
|
||||
nr_ue_rsrp_measurements(ue, gNB_id, proc, nr_slot_rx, 0);
|
||||
|
||||
if ((ue->decode_MIB == 1) && slot_pbch) {
|
||||
|
||||
@@ -1909,7 +1877,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
ue->dlsch[proc->thread_id][gNB_id][0],
|
||||
NULL);
|
||||
|
||||
nr_ue_measurement_procedures(2, ue, proc, gNB_id, nr_slot_rx, mode);
|
||||
nr_ue_measurement_procedures(2, ue, proc, gNB_id, nr_slot_rx);
|
||||
}
|
||||
|
||||
// do procedures for SI-RNTI
|
||||
@@ -1929,7 +1897,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
ue->dlsch_SI[gNB_id],
|
||||
NULL,
|
||||
&ue->dlsch_SI_errors[gNB_id],
|
||||
mode,
|
||||
dlsch_parallel);
|
||||
|
||||
// deactivate dlsch once dlsch proc is done
|
||||
@@ -1955,7 +1922,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
ue->dlsch_p[gNB_id],
|
||||
NULL,
|
||||
&ue->dlsch_p_errors[gNB_id],
|
||||
mode,
|
||||
dlsch_parallel);
|
||||
|
||||
// deactivate dlsch once dlsch proc is done
|
||||
@@ -1965,7 +1931,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
|
||||
// do procedures for RA-RNTI
|
||||
if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1)) {
|
||||
if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1) && (ue->UE_mode[gNB_id] != PUSCH)) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN);
|
||||
nr_ue_pdsch_procedures(ue,
|
||||
proc,
|
||||
@@ -1981,7 +1947,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
ue->dlsch_ra[gNB_id],
|
||||
NULL,
|
||||
&ue->dlsch_ra_errors[gNB_id],
|
||||
mode,
|
||||
dlsch_parallel);
|
||||
|
||||
// deactivate dlsch once dlsch proc is done
|
||||
@@ -2008,7 +1973,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
||||
ue->dlsch[proc->thread_id][gNB_id][0],
|
||||
ue->dlsch[proc->thread_id][gNB_id][1],
|
||||
&ue->dlsch_errors[gNB_id],
|
||||
mode,
|
||||
dlsch_parallel);
|
||||
|
||||
|
||||
@@ -2169,66 +2133,51 @@ uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,
|
||||
return(0);
|
||||
}
|
||||
|
||||
// WIP
|
||||
// todo:
|
||||
// - set tx_total_RE
|
||||
// - 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) {
|
||||
|
||||
int frame_tx = proc->frame_tx, nr_slot_tx = proc->nr_slot_tx, prach_power; // tx_amp
|
||||
uint16_t /*preamble_tx = 50,*/ pathloss;
|
||||
uint8_t mod_id = ue->Mod_id;
|
||||
UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id);
|
||||
NR_PRACH_RESOURCES_t * prach_resources = ue->prach_resources[gNB_id];
|
||||
AssertFatal(prach_resources != NULL, "ue->prach_resources[%u] == NULL\n", gNB_id);
|
||||
uint8_t nr_prach = 0;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN);
|
||||
|
||||
if (!prach_resources->init_msg1 && ((MAX_FRAME_NUMBER+frame_tx-ue->prach_resources[gNB_id]->sync_frame)% MAX_FRAME_NUMBER)>150){
|
||||
ue->prach_cnt = 0;
|
||||
prach_resources->init_msg1 = 1;
|
||||
}
|
||||
|
||||
if (ue->mac_enabled == 0){
|
||||
// prach_resources->ra_PreambleIndex = preamble_tx;
|
||||
|
||||
prach_resources->ra_TDD_map_index = 0;
|
||||
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = 10;
|
||||
prach_resources->ra_RNTI = 0x1234;
|
||||
nr_prach = 1;
|
||||
prach_resources->init_msg1 = 1;
|
||||
|
||||
} else {
|
||||
// ask L2 for RACH transport
|
||||
if ((runmode != rx_calib_ue) && (runmode != rx_calib_ue_med) && (runmode != rx_calib_ue_byp) && (runmode != no_L2_connect) ) {
|
||||
LOG_D(PHY, "Getting PRACH resources. Frame %d Slot %d \n", frame_tx, nr_slot_tx);
|
||||
// flush Msg3 Buffer
|
||||
if (prach_resources->Msg3 == NULL){
|
||||
for(int i = 0; i<NUMBER_OF_CONNECTED_gNB_MAX; i++) {
|
||||
ue->ulsch_Msg3_active[i] = 0;
|
||||
}
|
||||
}
|
||||
nr_prach = nr_ue_get_rach(ue->prach_resources[gNB_id], &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_slot_tx);
|
||||
}
|
||||
|
||||
LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources\n", __FUNCTION__, frame_tx, nr_slot_tx);
|
||||
nr_prach = nr_ue_get_rach(prach_resources, &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, frame_tx, gNB_id, nr_slot_tx);
|
||||
|
||||
}
|
||||
|
||||
if (ue->prach_resources[gNB_id] != NULL && nr_prach == 1 && prach_resources->init_msg1) {
|
||||
if (nr_prach == 1) {
|
||||
|
||||
pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
|
||||
LOG_D(PHY,"runmode %d\n",runmode);
|
||||
if (ue->mac_enabled == 1) {
|
||||
int16_t pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
|
||||
int16_t ra_preamble_rx_power = (int16_t)(10*log10(pow(10, (double)(prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER)/10) + pow(10, (double)(pathloss)/10)));
|
||||
ue->tx_power_dBm[nr_slot_tx] = min(nr_get_Pcmax(mod_id), ra_preamble_rx_power);
|
||||
|
||||
if ((ue->mac_enabled == 1) && (runmode != calib_prach_tx)) {
|
||||
ue->tx_power_dBm[nr_slot_tx] = prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER + pathloss;
|
||||
LOG_I(PHY,"[UE %d][RAPROC][%d.%d]: Generating PRACH Msg1 (preamble %d, PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x)\n",
|
||||
mod_id,
|
||||
frame_tx,
|
||||
nr_slot_tx,
|
||||
prach_resources->ra_PreambleIndex,
|
||||
pathloss,
|
||||
ue->tx_power_dBm[nr_slot_tx],
|
||||
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER,
|
||||
prach_resources->ra_RNTI);
|
||||
}
|
||||
|
||||
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, nr_slot_tx %d : Generating PRACH, preamble %d, PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x\n",
|
||||
ue->Mod_id,
|
||||
frame_tx,
|
||||
nr_slot_tx,
|
||||
prach_resources->ra_PreambleIndex,
|
||||
pathloss,
|
||||
ue->tx_power_dBm[nr_slot_tx],
|
||||
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER,
|
||||
prach_resources->ra_RNTI);
|
||||
|
||||
//ue->tx_total_RE[nr_slot_tx] = 96; // todo
|
||||
ue->prach_vars[gNB_id]->amp = AMP;
|
||||
|
||||
/* #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
|
||||
@@ -2239,51 +2188,38 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
|
||||
ue->prach_vars[gNB_id]->amp = AMP;
|
||||
#endif */
|
||||
|
||||
if ((runmode == calib_prach_tx) && (((proc->frame_tx&0xfffe)%100)==0))
|
||||
LOG_D(PHY,"[UE %d][RAPROC] Frame %d, nr_slot_tx %d : PRACH TX power %d dBm, amp %d\n", ue->Mod_id,
|
||||
proc->frame_rx,
|
||||
proc->nr_slot_tx,
|
||||
ue->tx_power_dBm[nr_slot_tx],
|
||||
ue->prach_vars[gNB_id]->amp);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN);
|
||||
|
||||
prach_power = generate_nr_prach(ue, gNB_id, nr_slot_tx);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_OUT);
|
||||
|
||||
LOG_D(PHY,"[UE %d][RAPROC] PRACH PL %d dB, power %d dBm, digital power %d dB (amp %d)\n",
|
||||
ue->Mod_id,
|
||||
pathloss,
|
||||
LOG_D(PHY, "In %s: [UE %d][RAPROC][%d.%d]: Generated PRACH Msg1 (TX power PRACH %d dBm, digital power %d dBW (amp %d)\n",
|
||||
__FUNCTION__,
|
||||
mod_id,
|
||||
frame_tx,
|
||||
nr_slot_tx,
|
||||
ue->tx_power_dBm[nr_slot_tx],
|
||||
dB_fixed(prach_power),
|
||||
ue->prach_vars[gNB_id]->amp);
|
||||
|
||||
if (ue->mac_enabled == 1)
|
||||
nr_Msg1_transmitted(ue->Mod_id, ue->CC_id, frame_tx, gNB_id);
|
||||
nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id);
|
||||
|
||||
LOG_I(PHY,"[UE %d][RAPROC] Frame %d, nr_slot_tx %d: Generated PRACH Msg1 (gNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB) \n",
|
||||
ue->Mod_id,
|
||||
frame_tx,
|
||||
nr_slot_tx,
|
||||
gNB_id,
|
||||
prach_resources->ra_PreambleIndex,
|
||||
ue->tx_power_dBm[nr_slot_tx],
|
||||
pathloss);
|
||||
|
||||
LOG_D(PHY,"[UE %d] frame %d nr_slot_tx %d : prach_cnt %d\n", ue->Mod_id, frame_tx, nr_slot_tx, ue->prach_cnt);
|
||||
|
||||
ue->prach_cnt++;
|
||||
|
||||
if (ue->prach_cnt == 3)
|
||||
ue->prach_cnt = 0;
|
||||
} else if (nr_prach == 2) {
|
||||
nr_ra_succeeded(mod_id, ue->CC_id, gNB_id);
|
||||
|
||||
LOG_D(PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id);
|
||||
|
||||
ue->UE_mode[gNB_id] = PUSCH;
|
||||
|
||||
} else if(nr_prach == 3){
|
||||
|
||||
LOG_D(PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, mod_id);
|
||||
|
||||
ue->UE_mode[gNB_id] = PRACH;
|
||||
|
||||
}
|
||||
|
||||
// if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue
|
||||
if (runmode == calib_prach_tx)
|
||||
ue->prach_resources[gNB_id] = NULL;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT);
|
||||
|
||||
}
|
||||
|
||||
@@ -202,8 +202,6 @@ void nr_generate_pucch3_4(int32_t **txdataF,
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
static int bwp_id = 1;
|
||||
|
||||
bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t *proc, bool reset_harq)
|
||||
{
|
||||
uint8_t sr_payload = 0;
|
||||
@@ -234,6 +232,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
NR_PUCCH_Resource_t *pucch_resource;
|
||||
uint16_t crnti = mac->crnti;
|
||||
NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;
|
||||
|
||||
/* update current context */
|
||||
|
||||
@@ -762,7 +761,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
||||
number_of_code_word = 1;
|
||||
}
|
||||
|
||||
if (ue->n_connected_eNB > 1) {
|
||||
if (ue->n_connected_gNB > 1) {
|
||||
LOG_E(PHY,"PUCCH ACK feedback is not implemented for mutiple gNB cells : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return (0);
|
||||
}
|
||||
@@ -939,6 +938,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
|
||||
pucch_format_nr_t format_pucch;
|
||||
int ready_pucch_resource_id = FALSE; /* in the case that it is already given */
|
||||
NR_PUCCH_Resource_t *pucch_resource;
|
||||
NR_BWP_Id_t bwp_id = mac->UL_BWP_Id;
|
||||
|
||||
/* ini values to unset */
|
||||
*initial_pucch_id = NB_INITIAL_PUCCH_RESOURCE;
|
||||
@@ -1111,6 +1111,8 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
|
||||
int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size)
|
||||
{
|
||||
int pucch_resource_set_id = 0;
|
||||
NR_BWP_Id_t bwp_id = mac->DL_BWP_Id;
|
||||
|
||||
//long *pucch_max_pl_bits = NULL;
|
||||
|
||||
/* from TS 38.331 field maxPayloadMinus1
|
||||
|
||||
@@ -1021,7 +1021,6 @@ int main(int argc, char **argv)
|
||||
phy_procedures_nrUE_RX(UE,
|
||||
&UE_proc,
|
||||
0,
|
||||
normal_txrx,
|
||||
dlsch_threads);
|
||||
|
||||
//printf("dlsim round %d ends\n",round);
|
||||
|
||||
@@ -7,3 +7,15 @@ int32_t get_uldl_offset(int nr_bandP) { re
|
||||
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
|
||||
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
|
||||
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
|
||||
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
|
||||
fapi_nr_dci_indication_t *dci_ind,
|
||||
fapi_nr_rx_indication_t *rx_ind,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
uint8_t gNB_id) {}
|
||||
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||
uint8_t pdu_type,
|
||||
uint8_t gNB_id,
|
||||
PHY_VARS_NR_UE *ue,
|
||||
NR_UE_DLSCH_t *dlsch0,
|
||||
uint16_t n_pdus) {}
|
||||
|
||||
@@ -83,7 +83,6 @@ void nr_get_prach_resources(module_id_t mod_id,
|
||||
int CC_id,
|
||||
uint8_t gNB_id,
|
||||
uint8_t t_id,
|
||||
uint8_t first_Msg3,
|
||||
NR_PRACH_RESOURCES_t *prach_resources,
|
||||
NR_RACH_ConfigDedicated_t * rach_ConfigDedicated){
|
||||
|
||||
@@ -206,9 +205,6 @@ void nr_get_prach_resources(module_id_t mod_id,
|
||||
AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB);
|
||||
}
|
||||
|
||||
// todo Msg3-DeltaPreamble should be provided from higher layers, otherwise is 0
|
||||
mac->deltaPreamble_Msg3 = 0;
|
||||
deltaPreamble_Msg3 = mac->deltaPreamble_Msg3;
|
||||
}
|
||||
|
||||
PLThreshold = prach_resources->RA_PCMAX - nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB;
|
||||
|
||||
@@ -675,7 +675,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
if (UE->is_synchronized == 0) {
|
||||
UE_nr_rxtx_proc_t proc={0};
|
||||
ret = nr_initial_sync(&proc, UE, normal_txrx,1);
|
||||
ret = nr_initial_sync(&proc, UE, 1);
|
||||
printf("nr_initial_sync1 returns %d\n",ret);
|
||||
if (ret<0) n_errors++;
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ int main(int argc, char **argv){
|
||||
UE_nr_rxtx_proc_t proc={0};
|
||||
proc.frame_tx = frame;
|
||||
proc.nr_slot_tx = slot;
|
||||
nr_ue_prach_procedures(UE,&proc,0,0);
|
||||
nr_ue_prach_procedures(UE, &proc, 0);
|
||||
|
||||
/* tx_lev_dB not used later, no need to set */
|
||||
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
|
||||
@@ -232,7 +232,7 @@ int test_pucch_basic_error(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pr
|
||||
v_return = -1;
|
||||
}
|
||||
|
||||
ue->n_connected_eNB = 2;
|
||||
ue->n_connected_gNB = 2;
|
||||
|
||||
printf("\n => Test : Error due to PUCCH format with multiple cells not already implemented \n");
|
||||
|
||||
@@ -240,7 +240,7 @@ int test_pucch_basic_error(PHY_VARS_NR_UE *ue, int gNB_id, UE_nr_rxtx_proc_t *pr
|
||||
v_return = -1;
|
||||
}
|
||||
|
||||
ue->n_connected_eNB = 1;
|
||||
ue->n_connected_gNB = 1;
|
||||
|
||||
return (v_return);
|
||||
}
|
||||
|
||||
@@ -82,8 +82,11 @@ uint32_t nr_compute_tbs(uint16_t Qm,
|
||||
}
|
||||
}
|
||||
}
|
||||
//printf("Ninfo %d nbp_re %d nb_re %d Qm %d, R %d, tbs %d\n", Ninfo, nbp_re, nb_re, Qm, R, nr_tbs);
|
||||
|
||||
LOG_D(PHY, "In %s: Ninfo %d nbp_re %d nb_re %d Qm %d, R %d, tbs %d\n", __FUNCTION__, Ninfo, nbp_re, nb_re, Qm, R, nr_tbs);
|
||||
|
||||
return nr_tbs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/* \file nr_mac.h
|
||||
* \brief common MAC data structures, constant, and function prototype
|
||||
* \brief common MAC data structures and constants
|
||||
* \author R. Knopp, K.H. HSU, G. Casati
|
||||
* \date 2019
|
||||
* \version 0.1
|
||||
@@ -37,13 +37,30 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TABLE_38213_13_1_NUM_INDEXES 15
|
||||
#define TABLE_38213_13_2_NUM_INDEXES 14
|
||||
#define TABLE_38213_13_3_NUM_INDEXES 9
|
||||
#define TABLE_38213_13_4_NUM_INDEXES 16
|
||||
#define TABLE_38213_13_5_NUM_INDEXES 9
|
||||
#define TABLE_38213_13_6_NUM_INDEXES 10
|
||||
#define TABLE_38213_13_7_NUM_INDEXES 12
|
||||
#define TABLE_38213_13_8_NUM_INDEXES 8
|
||||
#define TABLE_38213_13_9_NUM_INDEXES 4
|
||||
#define TABLE_38213_13_10_NUM_INDEXES 8
|
||||
#define TABLE_38213_13_11_NUM_INDEXES 16
|
||||
#define TABLE_38213_13_12_NUM_INDEXES 14
|
||||
|
||||
// Definitions for MAC control and data
|
||||
#define NR_BCCH_DL_SCH 3 // SI
|
||||
|
||||
#define NR_BCCH_BCH 5 // MIB
|
||||
|
||||
#define CCCH_PAYLOAD_SIZE_MAX 128
|
||||
|
||||
#define RAR_PAYLOAD_SIZE_MAX 128
|
||||
#define MAX_BWP_SIZE 275
|
||||
|
||||
typedef enum frequency_range_e {
|
||||
FR1 = 0,
|
||||
FR2
|
||||
} frequency_range_t;
|
||||
|
||||
// For both DL/UL-SCH
|
||||
// Except:
|
||||
@@ -339,6 +356,113 @@ typedef struct {
|
||||
#define NR_MAX_NUM_LCGID 8
|
||||
#define MAX_RLC_SDU_SUBHEADER_SIZE 3
|
||||
|
||||
//===========
|
||||
// PRACH defs
|
||||
//===========
|
||||
|
||||
// ===============================================
|
||||
// SSB to RO mapping public defines and structures
|
||||
// ===============================================
|
||||
#define MAX_SSB_PER_RO (16) // Maximum number of SSBs that can be mapped to a single RO
|
||||
#define MAX_TDM (7) // Maximum nb of PRACH occasions TDMed in a slot
|
||||
#define MAX_FDM (8) // Maximum nb of PRACH occasions FDMed in a slot
|
||||
|
||||
// PRACH occasion details
|
||||
typedef struct prach_occasion_info {
|
||||
uint8_t start_symbol; // 0 - 13 (14 symbols in a slot)
|
||||
uint8_t fdm; // 0-7 (possible values of msg1-FDM: 1, 2, 4 or 8)
|
||||
uint8_t slot; // 0 - 159 (maximum number of slots in a 10ms frame - @ 240kHz)
|
||||
uint8_t frame; // 0 - 15 (maximum number of frames in a 160ms association pattern)
|
||||
uint8_t mapped_ssb_idx[MAX_SSB_PER_RO]; // List of mapped SSBs
|
||||
uint8_t nb_mapped_ssb;
|
||||
uint16_t format; // RO preamble format
|
||||
} prach_occasion_info_t;
|
||||
|
||||
// PRACH occasion slot details
|
||||
// A PRACH occasion slot is a series of PRACH occasions in time (symbols) and frequency
|
||||
typedef struct prach_occasion_slot {
|
||||
prach_occasion_info_t prach_occasion[MAX_TDM][MAX_FDM]; // Starting symbol of each PRACH occasions in a slot
|
||||
uint8_t nb_of_prach_occasion_in_time;
|
||||
uint8_t nb_of_prach_occasion_in_freq;
|
||||
} prach_occasion_slot_t;
|
||||
|
||||
//=========
|
||||
// DCI defs
|
||||
//=========
|
||||
|
||||
typedef enum {
|
||||
NR_DL_DCI_FORMAT_1_0 = 0,
|
||||
NR_DL_DCI_FORMAT_1_1,
|
||||
NR_DL_DCI_FORMAT_2_0,
|
||||
NR_DL_DCI_FORMAT_2_1,
|
||||
NR_DL_DCI_FORMAT_2_2,
|
||||
NR_DL_DCI_FORMAT_2_3,
|
||||
NR_UL_DCI_FORMAT_0_0,
|
||||
NR_UL_DCI_FORMAT_0_1
|
||||
} nr_dci_format_t;
|
||||
|
||||
typedef enum {
|
||||
NR_RNTI_new = 0,
|
||||
NR_RNTI_C,
|
||||
NR_RNTI_RA,
|
||||
NR_RNTI_P,
|
||||
NR_RNTI_CS,
|
||||
NR_RNTI_TC,
|
||||
NR_RNTI_SP_CSI,
|
||||
NR_RNTI_SI,
|
||||
NR_RNTI_SFI,
|
||||
NR_RNTI_INT,
|
||||
NR_RNTI_TPC_PUSCH,
|
||||
NR_RNTI_TPC_PUCCH,
|
||||
NR_RNTI_TPC_SRS,
|
||||
NR_RNTI_MCS_C,
|
||||
} nr_rnti_type_t;
|
||||
|
||||
typedef enum subcarrier_spacing_e {
|
||||
scs_15kHz = 0x1,
|
||||
scs_30kHz = 0x2,
|
||||
scs_60kHz = 0x4,
|
||||
scs_120kHz = 0x8,
|
||||
scs_240kHz = 0x16
|
||||
} subcarrier_spacing_t;
|
||||
|
||||
typedef enum channel_bandwidth_e {
|
||||
bw_5MHz = 0x1,
|
||||
bw_10MHz = 0x2,
|
||||
bw_20MHz = 0x4,
|
||||
bw_40MHz = 0x8,
|
||||
bw_80MHz = 0x16,
|
||||
bw_100MHz = 0x32
|
||||
} channel_bandwidth_t;
|
||||
|
||||
typedef enum nr_ssb_and_cset_mux_pattern_type_e {
|
||||
NR_SSB_AND_CSET_MUX_PATTERN_TYPE1=1,
|
||||
NR_SSB_AND_CSET_MUX_PATTERN_TYPE2,
|
||||
NR_SSB_AND_CSET_MUX_PATTERN_TYPE3
|
||||
} nr_ssb_and_cset_mux_pattern_type_t;
|
||||
|
||||
typedef enum {
|
||||
SFN_C_MOD_2_EQ_0,
|
||||
SFN_C_MOD_2_EQ_1,
|
||||
SFN_C_IMPOSSIBLE
|
||||
} SFN_C_TYPE;
|
||||
|
||||
typedef struct Type0_PDCCH_CSS_config_s {
|
||||
int32_t num_rbs;
|
||||
int32_t num_symbols;
|
||||
int32_t rb_offset; // Offset from SSB RB0
|
||||
uint32_t type0_pdcch_ss_mux_pattern;
|
||||
uint16_t frame;
|
||||
SFN_C_TYPE sfn_c;
|
||||
uint32_t n_c;
|
||||
uint32_t n_0;
|
||||
uint32_t number_of_search_space_per_slot;
|
||||
uint32_t first_symbol_index;
|
||||
uint32_t search_space_duration;
|
||||
uint32_t ssb_length;
|
||||
uint32_t ssb_index;
|
||||
uint32_t cset_start_rb;
|
||||
} NR_Type0_PDCCH_CSS_config_t;
|
||||
|
||||
#endif /*__LAYER2_MAC_H__ */
|
||||
|
||||
|
||||
@@ -2380,6 +2380,42 @@ uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
// Set the transform precoding status according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16:
|
||||
// - "UE procedure for applying transform precoding on PUSCH"
|
||||
uint8_t get_transformPrecoding(NR_ServingCellConfigCommon_t *scc,
|
||||
NR_PUSCH_Config_t *pusch_config,
|
||||
NR_BWP_Uplink_t *ubwp,
|
||||
uint8_t *dci_format,
|
||||
int rnti_type,
|
||||
uint8_t configuredGrant){
|
||||
|
||||
if (configuredGrant) {
|
||||
if (ubwp->bwp_Dedicated->configuredGrantConfig) {
|
||||
if (ubwp->bwp_Dedicated->configuredGrantConfig->choice.setup->transformPrecoder) {
|
||||
return *ubwp->bwp_Dedicated->configuredGrantConfig->choice.setup->transformPrecoder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rnti_type != NR_RNTI_RA) {
|
||||
if (*dci_format != NR_UL_DCI_FORMAT_0_0) {
|
||||
if (pusch_config->transformPrecoder != NULL) {
|
||||
return *pusch_config->transformPrecoder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) {
|
||||
return 1; // Transformprecoding disabled
|
||||
} else {
|
||||
LOG_D(PHY, "MAC_COMMON: Transform Precodig enabled through msg3_transformPrecoder\n");
|
||||
return 0; // Enabled
|
||||
}
|
||||
|
||||
LOG_E(MAC, "In %s: could not fetch transform precoder status...\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc,
|
||||
NR_CellGroupConfig_t *secondaryCellGroup,
|
||||
dci_pdu_rel15_t *dci_pdu,
|
||||
@@ -2442,8 +2478,8 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc,
|
||||
rbg_size_config = 1;
|
||||
else
|
||||
rbg_size_config = 0;
|
||||
numRBG = getNRBG(NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275),
|
||||
NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275),
|
||||
numRBG = getNRBG(NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
|
||||
NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
|
||||
rbg_size_config);
|
||||
if (pusch_Config->resourceAllocation == 0)
|
||||
dci_pdu->frequency_domain_assignment.nbits = numRBG;
|
||||
@@ -2517,16 +2553,8 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc,
|
||||
}
|
||||
}
|
||||
// Precoding info and number of layers
|
||||
long transformPrecoder;
|
||||
if (pusch_Config->transformPrecoder == NULL){
|
||||
// if transform precoder is null, apply the values from msg3
|
||||
if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL)
|
||||
transformPrecoder = 1;
|
||||
else
|
||||
transformPrecoder = 0;
|
||||
}
|
||||
else
|
||||
transformPrecoder = *pusch_Config->transformPrecoder;
|
||||
long transformPrecoder = get_transformPrecoding(scc, pusch_Config, ubwp, (uint8_t*)&format, rnti_type, 0);
|
||||
|
||||
if (pusch_Config->txConfig != NULL){
|
||||
if (*pusch_Config->txConfig == NR_PUSCH_Config__txConfig_codebook){
|
||||
if (pusch_antenna_ports > 1) {
|
||||
@@ -2637,8 +2665,8 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc,
|
||||
size += dci_pdu->bwp_indicator.nbits;
|
||||
// Freq domain assignment
|
||||
rbg_size_config = secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size;
|
||||
numRBG = getNRBG(NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275),
|
||||
NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275),
|
||||
numRBG = getNRBG(NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
|
||||
NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
|
||||
rbg_size_config);
|
||||
if (pdsch_config->resourceAllocation == 0)
|
||||
dci_pdu->frequency_domain_assignment.nbits = numRBG;
|
||||
|
||||
@@ -20,13 +20,12 @@
|
||||
*/
|
||||
|
||||
/*! \file mac.h
|
||||
* \brief MAC data structures, constant, and function prototype
|
||||
* \brief common MAC function prototypes
|
||||
* \author Navid Nikaein and Raymond Knopp, WIE-TAI CHEN
|
||||
* \date Dec. 2019
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email raymond.knopp@eurecom.fr
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __LAYER2_NR_MAC_COMMON_H__
|
||||
@@ -38,128 +37,6 @@
|
||||
#include "nr_mac.h"
|
||||
#include "openair1/PHY/impl_defs_nr.h"
|
||||
|
||||
#define TABLE_38213_13_1_NUM_INDEXES 15
|
||||
#define TABLE_38213_13_2_NUM_INDEXES 14
|
||||
#define TABLE_38213_13_3_NUM_INDEXES 9
|
||||
#define TABLE_38213_13_4_NUM_INDEXES 16
|
||||
#define TABLE_38213_13_5_NUM_INDEXES 9
|
||||
#define TABLE_38213_13_6_NUM_INDEXES 10
|
||||
#define TABLE_38213_13_7_NUM_INDEXES 12
|
||||
#define TABLE_38213_13_8_NUM_INDEXES 8
|
||||
#define TABLE_38213_13_9_NUM_INDEXES 4
|
||||
#define TABLE_38213_13_10_NUM_INDEXES 8
|
||||
#define TABLE_38213_13_11_NUM_INDEXES 16
|
||||
#define TABLE_38213_13_12_NUM_INDEXES 14
|
||||
|
||||
|
||||
// ===============================================
|
||||
// SSB to RO mapping public defines and structures
|
||||
// ===============================================
|
||||
#define MAX_SSB_PER_RO (16) // Maximum number of SSBs that can be mapped to a single RO
|
||||
#define MAX_TDM (7) // Maximum nb of PRACH occasions TDMed in a slot
|
||||
#define MAX_FDM (8) // Maximum nb of PRACH occasions FDMed in a slot
|
||||
|
||||
typedef enum frequency_range_e {
|
||||
FR1 = 0,
|
||||
FR2
|
||||
} frequency_range_t;
|
||||
|
||||
// PRACH occasion details
|
||||
typedef struct prach_occasion_info {
|
||||
uint8_t start_symbol; // 0 - 13 (14 symbols in a slot)
|
||||
uint8_t fdm; // 0-7 (possible values of msg1-FDM: 1, 2, 4 or 8)
|
||||
uint8_t slot; // 0 - 159 (maximum number of slots in a 10ms frame - @ 240kHz)
|
||||
uint8_t frame; // 0 - 15 (maximum number of frames in a 160ms association pattern)
|
||||
uint8_t mapped_ssb_idx[MAX_SSB_PER_RO]; // List of mapped SSBs
|
||||
uint8_t nb_mapped_ssb;
|
||||
uint16_t format; // RO preamble format
|
||||
} prach_occasion_info_t;
|
||||
|
||||
// PRACH occasion slot details
|
||||
// A PRACH occasion slot is a series of PRACH occasions in time (symbols) and frequency
|
||||
typedef struct prach_occasion_slot {
|
||||
prach_occasion_info_t prach_occasion[MAX_TDM][MAX_FDM]; // Starting symbol of each PRACH occasions in a slot
|
||||
uint8_t nb_of_prach_occasion_in_time;
|
||||
uint8_t nb_of_prach_occasion_in_freq;
|
||||
} prach_occasion_slot_t;
|
||||
|
||||
// ========================================
|
||||
|
||||
|
||||
typedef enum {
|
||||
NR_DL_DCI_FORMAT_1_0 = 0,
|
||||
NR_DL_DCI_FORMAT_1_1,
|
||||
NR_DL_DCI_FORMAT_2_0,
|
||||
NR_DL_DCI_FORMAT_2_1,
|
||||
NR_DL_DCI_FORMAT_2_2,
|
||||
NR_DL_DCI_FORMAT_2_3,
|
||||
NR_UL_DCI_FORMAT_0_0,
|
||||
NR_UL_DCI_FORMAT_0_1
|
||||
} nr_dci_format_t;
|
||||
|
||||
typedef enum {
|
||||
NR_RNTI_new = 0,
|
||||
NR_RNTI_C,
|
||||
NR_RNTI_RA,
|
||||
NR_RNTI_P,
|
||||
NR_RNTI_CS,
|
||||
NR_RNTI_TC,
|
||||
NR_RNTI_SP_CSI,
|
||||
NR_RNTI_SI,
|
||||
NR_RNTI_SFI,
|
||||
NR_RNTI_INT,
|
||||
NR_RNTI_TPC_PUSCH,
|
||||
NR_RNTI_TPC_PUCCH,
|
||||
NR_RNTI_TPC_SRS,
|
||||
NR_RNTI_MCS_C,
|
||||
} nr_rnti_type_t;
|
||||
|
||||
typedef enum subcarrier_spacing_e {
|
||||
scs_15kHz = 0x1,
|
||||
scs_30kHz = 0x2,
|
||||
scs_60kHz = 0x4,
|
||||
scs_120kHz = 0x8,
|
||||
scs_240kHz = 0x16
|
||||
} subcarrier_spacing_t;
|
||||
|
||||
typedef enum channel_bandwidth_e {
|
||||
bw_5MHz = 0x1,
|
||||
bw_10MHz = 0x2,
|
||||
bw_20MHz = 0x4,
|
||||
bw_40MHz = 0x8,
|
||||
bw_80MHz = 0x16,
|
||||
bw_100MHz = 0x32
|
||||
} channel_bandwidth_t;
|
||||
|
||||
typedef enum nr_ssb_and_cset_mux_pattern_type_e {
|
||||
NR_SSB_AND_CSET_MUX_PATTERN_TYPE1=1,
|
||||
NR_SSB_AND_CSET_MUX_PATTERN_TYPE2,
|
||||
NR_SSB_AND_CSET_MUX_PATTERN_TYPE3
|
||||
} nr_ssb_and_cset_mux_pattern_type_t;
|
||||
|
||||
typedef enum {
|
||||
SFN_C_MOD_2_EQ_0,
|
||||
SFN_C_MOD_2_EQ_1,
|
||||
SFN_C_IMPOSSIBLE
|
||||
} SFN_C_TYPE;
|
||||
|
||||
typedef struct Type0_PDCCH_CSS_config_s {
|
||||
int32_t num_rbs;
|
||||
int32_t num_symbols;
|
||||
int32_t rb_offset; // Offset from SSB RB0
|
||||
uint32_t type0_pdcch_ss_mux_pattern;
|
||||
uint16_t frame;
|
||||
SFN_C_TYPE sfn_c;
|
||||
uint32_t n_c;
|
||||
uint32_t n_0;
|
||||
uint32_t number_of_search_space_per_slot;
|
||||
uint32_t first_symbol_index;
|
||||
uint32_t search_space_duration;
|
||||
uint32_t ssb_length;
|
||||
uint32_t ssb_index;
|
||||
uint32_t cset_start_rb;
|
||||
} NR_Type0_PDCCH_CSS_config_t;
|
||||
|
||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
|
||||
|
||||
void get_frame_type(uint16_t nr_bandP, uint8_t scs_index, lte_frame_type_t *current_type);
|
||||
@@ -266,4 +143,18 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
|
||||
|
||||
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
|
||||
|
||||
/* \brief Set the transform precoding according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16
|
||||
@param *pusch_config, pointer to pusch config
|
||||
@param *ubwp pointer to uplink bwp
|
||||
@param *dci_format pointer to dci format
|
||||
@param rnti_type rnti type
|
||||
@param configuredGrant indicates whether a configured grant was received or not
|
||||
@returns transformPrecoding value */
|
||||
uint8_t get_transformPrecoding(NR_ServingCellConfigCommon_t *scc,
|
||||
NR_PUSCH_Config_t *pusch_config,
|
||||
NR_BWP_Uplink_t *ubwp,
|
||||
uint8_t *dci_format,
|
||||
int rnti_type,
|
||||
uint8_t configuredGrant);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -152,8 +152,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
|
||||
// carrier config
|
||||
|
||||
LOG_I(MAC, "Entering UE Config Common\n");
|
||||
LOG_D(MAC, "Entering UE Config Common\n");
|
||||
|
||||
cfg->carrier_config.dl_bandwidth = config_bandwidth(scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
||||
scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,
|
||||
@@ -321,6 +320,47 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
}
|
||||
|
||||
/** \brief This function performs some configuration routines according to clause 12 "Bandwidth part operation" 3GPP TS 38.213 version 16.3.0 Release 16
|
||||
@param NR_UE_MAC_INST_t mac: pointer to local MAC instance
|
||||
@returns void
|
||||
*/
|
||||
void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format){
|
||||
|
||||
NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
|
||||
if (bwp_ind && dci_format){
|
||||
|
||||
switch(*dci_format){
|
||||
case NR_UL_DCI_FORMAT_0_1:
|
||||
mac->UL_BWP_Id = *bwp_ind;
|
||||
break;
|
||||
case NR_DL_DCI_FORMAT_1_1:
|
||||
mac->DL_BWP_Id = *bwp_ind;
|
||||
break;
|
||||
default:
|
||||
LOG_E(MAC, "In %s: failed to configure BWP Id from DCI with format %d \n", __FUNCTION__, *dci_format);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (scd->firstActiveDownlinkBWP_Id)
|
||||
mac->DL_BWP_Id = *scd->firstActiveDownlinkBWP_Id;
|
||||
else if (scd->defaultDownlinkBWP_Id)
|
||||
mac->DL_BWP_Id = *scd->defaultDownlinkBWP_Id;
|
||||
else
|
||||
mac->DL_BWP_Id = 1;
|
||||
|
||||
if (scd->uplinkConfig && scd->uplinkConfig->firstActiveUplinkBWP_Id)
|
||||
mac->UL_BWP_Id = *scd->uplinkConfig->firstActiveUplinkBWP_Id;
|
||||
else
|
||||
mac->UL_BWP_Id = 1;
|
||||
|
||||
}
|
||||
|
||||
LOG_D(MAC, "In %s setting DL_BWP_Id %ld UL_BWP_Id %ld \n", __FUNCTION__, mac->DL_BWP_Id, mac->UL_BWP_Id);
|
||||
|
||||
}
|
||||
|
||||
/** \brief This function is relavant for the UE procedures for control. It loads the search spaces, the BWPs and the CORESETs into the MAC instance and
|
||||
\brief performs assert checks on the relevant RRC configuration.
|
||||
@param NR_UE_MAC_INST_t mac: pointer to local MAC instance
|
||||
@@ -328,15 +368,20 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
*/
|
||||
void config_control_ue(NR_UE_MAC_INST_t *mac){
|
||||
|
||||
uint8_t bwp_id = 1, coreset_id = 1, ss_id;
|
||||
uint8_t coreset_id = 1, ss_id;
|
||||
|
||||
NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
AssertFatal(scd->downlinkBWP_ToAddModList != NULL, "downlinkBWP_ToAddModList is null\n");
|
||||
AssertFatal(scd->downlinkBWP_ToAddModList->list.count == 1, "downlinkBWP_ToAddModList->list->count is %d\n", scd->downlinkBWP_ToAddModList->list.count);
|
||||
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = scd->downlinkBWP_ToAddModList->list.array[bwp_id - 1]->bwp_Common;
|
||||
config_bwp_ue(mac, NULL, NULL);
|
||||
NR_BWP_Id_t dl_bwp_id = mac->DL_BWP_Id;
|
||||
AssertFatal(dl_bwp_id != 0, "DL_BWP_Id is 0!");
|
||||
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = scd->downlinkBWP_ToAddModList->list.array[dl_bwp_id - 1]->bwp_Common;
|
||||
AssertFatal(bwp_Common != NULL, "bwp_Common is null\n");
|
||||
|
||||
NR_BWP_DownlinkDedicated_t *dl_bwp_Dedicated = scd->downlinkBWP_ToAddModList->list.array[bwp_id - 1]->bwp_Dedicated;
|
||||
NR_BWP_DownlinkDedicated_t *dl_bwp_Dedicated = scd->downlinkBWP_ToAddModList->list.array[dl_bwp_id - 1]->bwp_Dedicated;
|
||||
AssertFatal(dl_bwp_Dedicated != NULL, "dl_bwp_Dedicated is null\n");
|
||||
|
||||
NR_SetupRelease_PDCCH_Config_t *pdcch_Config = dl_bwp_Dedicated->pdcch_Config;
|
||||
@@ -365,8 +410,8 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
|
||||
AssertFatal(uplinkBWP_ToAddModList->list.count == 1, "uplinkBWP_ToAddModList->list->count is %d\n", uplinkBWP_ToAddModList->list.count);
|
||||
|
||||
// check pdcch_Config, pdcch_ConfigCommon and DL BWP
|
||||
mac->DLbwp[0] = scd->downlinkBWP_ToAddModList->list.array[bwp_id - 1];
|
||||
mac->coreset[bwp_id - 1][coreset_id - 1] = controlResourceSetToAddModList->list.array[0];
|
||||
mac->DLbwp[0] = scd->downlinkBWP_ToAddModList->list.array[dl_bwp_id - 1];
|
||||
mac->coreset[dl_bwp_id - 1][coreset_id - 1] = controlResourceSetToAddModList->list.array[0];
|
||||
|
||||
// Check dedicated UL BWP and pass to MAC
|
||||
mac->ULbwp[0] = uplinkBWP_ToAddModList->list.array[0];
|
||||
@@ -378,7 +423,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
|
||||
NR_SearchSpace_t *ss = searchSpacesToAddModList->list.array[ss_id];
|
||||
AssertFatal(ss->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n");
|
||||
AssertFatal(ss->searchSpaceType != NULL, "ss->searchSpaceType is null\n");
|
||||
AssertFatal(*ss->controlResourceSetId == mac->coreset[bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
|
||||
AssertFatal(*ss->controlResourceSetId == mac->coreset[dl_bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
|
||||
AssertFatal(ss->monitoringSymbolsWithinSlot != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot is null\n");
|
||||
AssertFatal(ss->monitoringSymbolsWithinSlot->buf != NULL, "NR_SearchSpace->monitoringSymbolsWithinSlot->buf is null\n");
|
||||
mac->SSpace[0][0][ss_id] = ss;
|
||||
@@ -389,7 +434,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){
|
||||
for (int css_id = 0; css_id < commonSearchSpaceList->list.count; css_id++) {
|
||||
NR_SearchSpace_t *css = commonSearchSpaceList->list.array[css_id];
|
||||
AssertFatal(css->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n");
|
||||
AssertFatal(*css->controlResourceSetId == mac->coreset[bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
|
||||
AssertFatal(*css->controlResourceSetId == mac->coreset[dl_bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n");
|
||||
AssertFatal(css->searchSpaceType != NULL, "css->searchSpaceType is null\n");
|
||||
AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n");
|
||||
AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n");
|
||||
@@ -470,6 +515,7 @@ int nr_rrc_mac_config_req_ue(
|
||||
NR_CellGroupConfig_t *cell_group_config ){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
RA_config_t *ra = &mac->ra;
|
||||
|
||||
// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc.
|
||||
|
||||
@@ -481,10 +527,8 @@ int nr_rrc_mac_config_req_ue(
|
||||
mac->scg = cell_group_config;
|
||||
mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex;
|
||||
config_control_ue(mac);
|
||||
mac->msg3_frame = -1; // initialize to an invalid value
|
||||
mac->msg3_slot = -1;
|
||||
if (cell_group_config->spCellConfig->reconfigurationWithSync) {
|
||||
mac->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
||||
ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
|
||||
mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
|
||||
config_common_ue(mac,module_id,cc_idP);
|
||||
mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/* \file mac.h
|
||||
* \brief MAC data structures, constant, and function prototype
|
||||
* \author R. Knopp, K.H. HSU
|
||||
* \date 2018
|
||||
* \version 0.1
|
||||
* \company Eurecom / NTUST
|
||||
* \email: knopp@eurecom.fr, kai-hsiang.hsu@eurecom.fr
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#ifndef __LAYER2_NR_UE_MAC_DEFS_H__
|
||||
#define __LAYER2_NR_UE_MAC_DEFS_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/*!\brief UE layer 2 status */
|
||||
typedef enum {
|
||||
UE_CONNECTION_OK = 0,
|
||||
UE_CONNECTION_LOST,
|
||||
UE_PHY_RESYNCH,
|
||||
UE_PHY_HO_PRACH
|
||||
} NR_UE_L2_STATE_t;
|
||||
|
||||
#endif /*__LAYER2_NR_UE_MAC_DEFS_H__ */
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/* \file mac_defs.h
|
||||
* \brief MAC data structures, constant, and function prototype
|
||||
* \brief MAC data structures and constants
|
||||
* \author R. Knopp, K.H. HSU
|
||||
* \date 2018
|
||||
* \version 0.1
|
||||
@@ -69,13 +69,107 @@
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
|
||||
|
||||
#define NB_NR_UE_MAC_INST 1
|
||||
/*!\brief Maximum number of logical channl group IDs */
|
||||
// ==========
|
||||
// NR UE defs
|
||||
// ==========
|
||||
|
||||
#define NB_NR_UE_MAC_INST 1
|
||||
#define MAX_NUM_BWP 2
|
||||
#define NUM_SLOT_FRAME 10
|
||||
|
||||
/*!\brief value for indicating BSR Timer is not running */
|
||||
#define NR_MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
|
||||
|
||||
// ================================================
|
||||
// SSB to RO mapping private defines and structures
|
||||
// ================================================
|
||||
|
||||
#define MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PERIOD (16) // Maximum association period is 16
|
||||
#define MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD (16) // Max association pattern period is 160ms and minimum PRACH configuration period is 10ms
|
||||
#define MAX_NB_ASSOCIATION_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD (16) // Max nb of association periods in an association pattern period of 160ms
|
||||
#define MAX_NB_FRAME_IN_PRACH_CONF_PERIOD (16) // Max PRACH configuration period is 160ms and frame is 10ms
|
||||
#define MAX_NB_SLOT_IN_FRAME (160) // Max number of slots in a frame (@ SCS 240kHz = 160)
|
||||
#define MAX_NB_FRAME_IN_ASSOCIATION_PATTERN_PERIOD (16) // Maximum number of frames in the maximum association pattern period
|
||||
#define MAX_NB_SSB (64) // Maximum number of possible SSB indexes
|
||||
#define MAX_RO_PER_SSB (8) // Maximum number of consecutive ROs that can be mapped to an SSB according to the ssb_per_RACH config
|
||||
|
||||
// Maximum number of ROs that can be mapped to an SSB in an association pattern
|
||||
// This is to reserve enough elements in the SSBs list for each mapped ROs for a single SSB
|
||||
// An arbitrary maximum number is chosen to be safe: maximum number of slots in an association pattern * maximum number of ROs in a slot
|
||||
#define MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN (MAX_TDM*MAX_FDM*MAX_NB_SLOT_IN_FRAME*MAX_NB_FRAME_IN_ASSOCIATION_PATTERN_PERIOD)
|
||||
|
||||
// ===============
|
||||
// DCI fields defs
|
||||
// ===============
|
||||
|
||||
#define NBR_NR_FORMATS 8 // The number of formats is 8 (0_0, 0_1, 1_0, 1_1, 2_0, 2_1, 2_2, 2_3)
|
||||
#define NBR_NR_DCI_FIELDS 56 // The number of different dci fields defined in TS 38.212 subclause 7.3.1
|
||||
|
||||
#define IDENTIFIER_DCI_FORMATS 0
|
||||
#define CARRIER_IND 1
|
||||
#define SUL_IND_0_1 2
|
||||
#define SLOT_FORMAT_IND 3
|
||||
#define PRE_EMPTION_IND 4
|
||||
#define BLOCK_NUMBER 5
|
||||
#define CLOSE_LOOP_IND 6
|
||||
#define BANDWIDTH_PART_IND 7
|
||||
#define SHORT_MESSAGE_IND 8
|
||||
#define SHORT_MESSAGES 9
|
||||
#define FREQ_DOM_RESOURCE_ASSIGNMENT_UL 10
|
||||
#define FREQ_DOM_RESOURCE_ASSIGNMENT_DL 11
|
||||
#define TIME_DOM_RESOURCE_ASSIGNMENT 12
|
||||
#define VRB_TO_PRB_MAPPING 13
|
||||
#define PRB_BUNDLING_SIZE_IND 14
|
||||
#define RATE_MATCHING_IND 15
|
||||
#define ZP_CSI_RS_TRIGGER 16
|
||||
#define FREQ_HOPPING_FLAG 17
|
||||
#define TB1_MCS 18
|
||||
#define TB1_NDI 19
|
||||
#define TB1_RV 20
|
||||
#define TB2_MCS 21
|
||||
#define TB2_NDI 22
|
||||
#define TB2_RV 23
|
||||
#define MCS 24
|
||||
#define NDI 25
|
||||
#define RV 26
|
||||
#define HARQ_PROCESS_NUMBER 27
|
||||
#define DAI_ 28
|
||||
#define FIRST_DAI 29
|
||||
#define SECOND_DAI 30
|
||||
#define TB_SCALING 31
|
||||
#define TPC_PUSCH 32
|
||||
#define TPC_PUCCH 33
|
||||
#define PUCCH_RESOURCE_IND 34
|
||||
#define PDSCH_TO_HARQ_FEEDBACK_TIME_IND 35
|
||||
#define SRS_RESOURCE_IND 36
|
||||
#define PRECOD_NBR_LAYERS 37
|
||||
#define ANTENNA_PORTS 38
|
||||
#define TCI 39
|
||||
#define SRS_REQUEST 40
|
||||
#define TPC_CMD 41
|
||||
#define CSI_REQUEST 42
|
||||
#define CBGTI 43
|
||||
#define CBGFI 44
|
||||
#define PTRS_DMRS 45
|
||||
#define BETA_OFFSET_IND 46
|
||||
#define DMRS_SEQ_INI 47
|
||||
#define UL_SCH_IND 48
|
||||
#define PADDING_NR_DCI 49
|
||||
#define SUL_IND_0_0 50
|
||||
#define RA_PREAMBLE_INDEX 51
|
||||
#define SUL_IND_1_0 52
|
||||
#define SS_PBCH_INDEX 53
|
||||
#define PRACH_MASK_INDEX 54
|
||||
#define RESERVED_NR_DCI 55
|
||||
|
||||
/*!\brief UE layer 2 status */
|
||||
typedef enum {
|
||||
UE_CONNECTION_OK = 0,
|
||||
UE_CONNECTION_LOST,
|
||||
UE_PHY_RESYNCH,
|
||||
UE_PHY_HO_PRACH
|
||||
} NR_UE_L2_STATE_t;
|
||||
|
||||
// LTE structure, might need to be adapted for NR
|
||||
typedef struct {
|
||||
/// buffer status for each lcgid
|
||||
@@ -138,9 +232,6 @@ typedef struct {
|
||||
int16_t bucket_size[NR_MAX_NUM_LCID];
|
||||
} NR_UE_SCHEDULING_INFO;
|
||||
|
||||
|
||||
#define MAX_NUM_BWP 2
|
||||
|
||||
typedef enum {
|
||||
RA_UE_IDLE = 0,
|
||||
WAIT_RAR = 1,
|
||||
@@ -148,12 +239,76 @@ typedef enum {
|
||||
RA_SUCCEEDED = 3
|
||||
} RA_state_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
// pointer to RACH config dedicated
|
||||
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated;
|
||||
/// state of RA procedure
|
||||
RA_state_t ra_state;
|
||||
/// RA contention type
|
||||
uint8_t cfra;
|
||||
/// RA rx frame offset: compensate RA rx offset introduced by OAI gNB.
|
||||
uint8_t RA_offset;
|
||||
/// RA-rnti
|
||||
uint16_t ra_rnti;
|
||||
/// Temporary CRNTI
|
||||
uint16_t t_crnti;
|
||||
/// number of attempt for rach
|
||||
uint8_t RA_attempt_number;
|
||||
/// Random-access procedure flag
|
||||
uint8_t RA_active;
|
||||
/// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot
|
||||
uint8_t generate_nr_prach;
|
||||
|
||||
/// Random-access window counter
|
||||
int16_t RA_window_cnt;
|
||||
/// Flag to monitor if matching RAPID was received in RAR
|
||||
uint8_t RA_RAPID_found;
|
||||
/// Flag to monitor if BI was received in RAR
|
||||
uint8_t RA_BI_found;
|
||||
/// Random-access backoff counter
|
||||
int16_t RA_backoff_indicator;
|
||||
/// Flag to indicate whether preambles Group A was used
|
||||
uint8_t RA_usedGroupA;
|
||||
/// RA backoff counter
|
||||
int16_t RA_backoff_cnt;
|
||||
/// RA max number of preamble transmissions
|
||||
int preambleTransMax;
|
||||
/// Nb of preambles per SSB
|
||||
long cb_preambles_per_ssb;
|
||||
int starting_preamble_nb;
|
||||
|
||||
/// Received TPC command (in dB) from RAR
|
||||
int8_t Msg3_TPC;
|
||||
/// Flag to indicate whether it is the first Msg3 to be transmitted
|
||||
uint8_t first_Msg3;
|
||||
/// RA Msg3 size in bytes
|
||||
uint8_t Msg3_size;
|
||||
|
||||
/// Random-access Contention Resolution Timer active flag
|
||||
uint8_t RA_contention_resolution_timer_active;
|
||||
/// Random-access Contention Resolution Timer count value
|
||||
uint8_t RA_contention_resolution_cnt;
|
||||
|
||||
/// BeamfailurerecoveryConfig
|
||||
NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig;
|
||||
|
||||
} RA_config_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
uint8_t freq_hopping;
|
||||
uint8_t mcs;
|
||||
uint8_t Msg3_t_alloc;
|
||||
uint16_t Msg3_f_alloc;
|
||||
|
||||
} RAR_grant_t;
|
||||
|
||||
/*!\brief Top level UE MAC structure */
|
||||
typedef struct {
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc;
|
||||
NR_CellGroupConfig_t *scg;
|
||||
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated;
|
||||
int servCellIndex;
|
||||
NR_CSI_ReportConfig_t *csirc;
|
||||
//// MAC config
|
||||
@@ -170,6 +325,12 @@ typedef struct {
|
||||
NR_ControlResourceSet_t *coreset[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP];
|
||||
NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP][FAPI_NR_MAX_SS_PER_CORESET];
|
||||
|
||||
/*BWP*/
|
||||
// dedicated active DL BWP
|
||||
NR_BWP_Id_t DL_BWP_Id;
|
||||
// dedicated active UL BWP
|
||||
NR_BWP_Id_t UL_BWP_Id;
|
||||
|
||||
/// Type0-PDCCH seach space
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t type0_pdcch_dci_config;
|
||||
uint32_t type0_pdcch_ss_mux_pattern;
|
||||
@@ -182,67 +343,11 @@ typedef struct {
|
||||
CCCH_PDU CCCH_pdu;
|
||||
ULSCH_PDU ulsch_pdu;
|
||||
|
||||
/* Random Access parameters */
|
||||
/// state of RA procedure
|
||||
RA_state_t ra_state;
|
||||
/// RA rx frame offset: compensate RA rx offset introduced by OAI gNB.
|
||||
uint8_t RA_offset;
|
||||
/// RA-rnti
|
||||
uint16_t ra_rnti;
|
||||
/// Temporary CRNTI
|
||||
uint16_t t_crnti;
|
||||
/* Random Access */
|
||||
/// CRNTI
|
||||
uint16_t crnti;
|
||||
/// number of attempt for rach
|
||||
uint8_t RA_attempt_number;
|
||||
/// Random-access procedure flag
|
||||
uint8_t RA_active;
|
||||
/// Random-access window counter
|
||||
int16_t RA_window_cnt;
|
||||
/// Random-access Msg3 size in bytes
|
||||
uint8_t RA_Msg3_size;
|
||||
/// Random-access prachMaskIndex
|
||||
uint8_t RA_prachMaskIndex;
|
||||
/// Flag indicating Preamble set (A,B) used for first Msg3 transmission
|
||||
uint8_t RA_usedGroupA;
|
||||
/// BeamfailurerecoveryConfig
|
||||
NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig;
|
||||
/// Preamble Tx Counter
|
||||
uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER;
|
||||
/// Preamble Power Ramping Counter
|
||||
uint8_t RA_PREAMBLE_POWER_RAMPING_COUNTER;
|
||||
/// Random-access backoff counter
|
||||
int16_t RA_backoff_indicator;
|
||||
/// Random-access backoff counter
|
||||
int16_t RA_backoff_cnt;
|
||||
/// Random-access variable for window calculation (frame of last change in window counter)
|
||||
uint32_t RA_tx_frame;
|
||||
/// Random-access variable for window calculation (subframe of last change in window counter)
|
||||
uint8_t RA_tx_subframe;
|
||||
/// Scheduled TX frame for RA Msg3
|
||||
int16_t msg3_frame;
|
||||
/// Scheduled TX slot for RA Msg3
|
||||
int16_t msg3_slot;
|
||||
/// Random-access variable for backoff (frame of last change in backoff counter)
|
||||
uint32_t RA_backoff_frame;
|
||||
/// Random-access variable for backoff (subframe of last change in backoff counter)
|
||||
uint8_t RA_backoff_subframe;
|
||||
/// Random-access Group B maximum path-loss
|
||||
uint16_t RA_maxPL;
|
||||
/// Random-access Contention Resolution Timer active flag
|
||||
uint8_t RA_contention_resolution_timer_active;
|
||||
/// Random-access Contention Resolution Timer count value
|
||||
uint8_t RA_contention_resolution_cnt;
|
||||
/// Msg3 Delta Preamble
|
||||
int8_t deltaPreamble_Msg3;
|
||||
/// Received TPC command (in dB) from RAR
|
||||
int8_t Msg3_TPC;
|
||||
/// Flag to monitor if matching RAPID was received in RAR
|
||||
uint8_t RA_RAPID_found;
|
||||
/// Flag to monitor if BI was received in RAR
|
||||
uint8_t RA_BI_found;
|
||||
/// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot
|
||||
uint8_t generate_nr_prach;
|
||||
/// RA configuration
|
||||
RA_config_t ra;
|
||||
/// SSB index from MIB decoding
|
||||
uint8_t mib_ssb;
|
||||
|
||||
@@ -347,67 +452,42 @@ typedef struct {
|
||||
uint8_t reserved_nr_dci ; // 55 RESERVED_NR_DCI
|
||||
} nr_dci_pdu_rel15_t;
|
||||
|
||||
#define NUM_SLOT_FRAME 10
|
||||
// The PRACH Config period is a series of selected slots in one or multiple frames
|
||||
typedef struct prach_conf_period {
|
||||
prach_occasion_slot_t prach_occasion_slot_map[MAX_NB_FRAME_IN_PRACH_CONF_PERIOD][MAX_NB_SLOT_IN_FRAME];
|
||||
uint16_t nb_of_prach_occasion; // Total number of PRACH occasions in the PRACH Config period
|
||||
uint8_t nb_of_frame; // Size of the PRACH Config period in number of 10ms frames
|
||||
uint8_t nb_of_slot; // Nb of slots in each frame
|
||||
} prach_conf_period_t;
|
||||
|
||||
#define NBR_NR_FORMATS 8 // The number of formats is 8 (0_0, 0_1, 1_0, 1_1, 2_0, 2_1, 2_2, 2_3)
|
||||
#define NBR_NR_DCI_FIELDS 56 // The number of different dci fields defined in TS 38.212 subclause 7.3.1
|
||||
// The association period is a series of PRACH Config periods
|
||||
typedef struct prach_association_period {
|
||||
prach_conf_period_t *prach_conf_period_list[MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PERIOD];
|
||||
uint8_t nb_of_prach_conf_period; // Nb of PRACH configuration periods within the association period
|
||||
uint8_t nb_of_frame; // Total number of frames included in the association period
|
||||
} prach_association_period_t;
|
||||
|
||||
#define IDENTIFIER_DCI_FORMATS 0
|
||||
#define CARRIER_IND 1
|
||||
#define SUL_IND_0_1 2
|
||||
#define SLOT_FORMAT_IND 3
|
||||
#define PRE_EMPTION_IND 4
|
||||
#define BLOCK_NUMBER 5
|
||||
#define CLOSE_LOOP_IND 6
|
||||
#define BANDWIDTH_PART_IND 7
|
||||
#define SHORT_MESSAGE_IND 8
|
||||
#define SHORT_MESSAGES 9
|
||||
#define FREQ_DOM_RESOURCE_ASSIGNMENT_UL 10
|
||||
#define FREQ_DOM_RESOURCE_ASSIGNMENT_DL 11
|
||||
#define TIME_DOM_RESOURCE_ASSIGNMENT 12
|
||||
#define VRB_TO_PRB_MAPPING 13
|
||||
#define PRB_BUNDLING_SIZE_IND 14
|
||||
#define RATE_MATCHING_IND 15
|
||||
#define ZP_CSI_RS_TRIGGER 16
|
||||
#define FREQ_HOPPING_FLAG 17
|
||||
#define TB1_MCS 18
|
||||
#define TB1_NDI 19
|
||||
#define TB1_RV 20
|
||||
#define TB2_MCS 21
|
||||
#define TB2_NDI 22
|
||||
#define TB2_RV 23
|
||||
#define MCS 24
|
||||
#define NDI 25
|
||||
#define RV 26
|
||||
#define HARQ_PROCESS_NUMBER 27
|
||||
#define DAI_ 28
|
||||
#define FIRST_DAI 29
|
||||
#define SECOND_DAI 30
|
||||
#define TB_SCALING 31
|
||||
#define TPC_PUSCH 32
|
||||
#define TPC_PUCCH 33
|
||||
#define PUCCH_RESOURCE_IND 34
|
||||
#define PDSCH_TO_HARQ_FEEDBACK_TIME_IND 35
|
||||
#define SRS_RESOURCE_IND 36
|
||||
#define PRECOD_NBR_LAYERS 37
|
||||
#define ANTENNA_PORTS 38
|
||||
#define TCI 39
|
||||
#define SRS_REQUEST 40
|
||||
#define TPC_CMD 41
|
||||
#define CSI_REQUEST 42
|
||||
#define CBGTI 43
|
||||
#define CBGFI 44
|
||||
#define PTRS_DMRS 45
|
||||
#define BETA_OFFSET_IND 46
|
||||
#define DMRS_SEQ_INI 47
|
||||
#define UL_SCH_IND 48
|
||||
#define PADDING_NR_DCI 49
|
||||
#define SUL_IND_0_0 50
|
||||
#define RA_PREAMBLE_INDEX 51
|
||||
#define SUL_IND_1_0 52
|
||||
#define SS_PBCH_INDEX 53
|
||||
#define PRACH_MASK_INDEX 54
|
||||
#define RESERVED_NR_DCI 55
|
||||
// The association pattern is a series of Association periods
|
||||
typedef struct prach_association_pattern {
|
||||
prach_association_period_t prach_association_period_list[MAX_NB_ASSOCIATION_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD];
|
||||
prach_conf_period_t prach_conf_period_list[MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD];
|
||||
uint8_t nb_of_assoc_period; // Nb of association periods within the association pattern
|
||||
uint8_t nb_of_prach_conf_period_in_max_period; // Nb of PRACH configuration periods within the maximum association pattern period (according to the size of the configured PRACH
|
||||
uint8_t nb_of_frame; // Total number of frames included in the association pattern period (after mapping the SSBs and determining the real association pattern length)
|
||||
} prach_association_pattern_t;
|
||||
|
||||
// SSB details
|
||||
typedef struct ssb_info {
|
||||
boolean_t transmitted; // True if the SSB index is transmitted according to the SSB positions map configuration
|
||||
prach_occasion_info_t *mapped_ro[MAX_NB_RO_PER_SSB_IN_ASSOCIATION_PATTERN]; // List of mapped RACH Occasions to this SSB index
|
||||
uint16_t nb_mapped_ro; // Total number of mapped ROs to this SSB index
|
||||
} ssb_info_t;
|
||||
|
||||
// List of all the possible SSBs and their details
|
||||
typedef struct ssb_list_info {
|
||||
ssb_info_t tx_ssb[MAX_NB_SSB];
|
||||
uint8_t nb_tx_ssb;
|
||||
} ssb_list_info_t;
|
||||
|
||||
/*@}*/
|
||||
#endif /*__LAYER2_MAC_DEFS_H__ */
|
||||
|
||||
@@ -40,4 +40,47 @@ extern uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3];
|
||||
// for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
||||
extern uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A[16][3];
|
||||
|
||||
extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
|
||||
|
||||
// DCI
|
||||
extern const uint8_t table_7_3_1_1_2_2_3_4_5[64][20];
|
||||
extern const uint8_t table_7_3_1_1_2_12[14][3];
|
||||
extern const uint8_t table_7_3_1_1_2_13[10][4];
|
||||
extern const uint8_t table_7_3_1_1_2_14[3][5];
|
||||
extern const uint8_t table_7_3_1_1_2_15[4][6];
|
||||
extern const uint8_t table_7_3_1_1_2_16[12][2];
|
||||
extern const uint8_t table_7_3_1_1_2_17[7][3];
|
||||
extern const uint8_t table_7_3_1_1_2_18[3][4];
|
||||
extern const uint8_t table_7_3_1_1_2_19[2][5];
|
||||
extern const uint8_t table_7_3_1_1_2_20[28][3];
|
||||
extern const uint8_t table_7_3_1_1_2_21[19][4];
|
||||
extern const uint8_t table_7_3_1_1_2_22[6][5];
|
||||
extern const uint8_t table_7_3_1_1_2_23[5][6];
|
||||
extern const uint8_t table_7_3_2_3_3_1[12][5];
|
||||
extern const uint8_t table_7_3_2_3_3_2_oneCodeword[31][6];
|
||||
extern const uint8_t table_7_3_2_3_3_2_twoCodeword[4][10];
|
||||
extern const uint8_t table_7_3_2_3_3_3_oneCodeword[24][5];
|
||||
extern const uint8_t table_7_3_2_3_3_3_twoCodeword[2][7];
|
||||
extern const uint8_t table_7_3_2_3_3_4_oneCodeword[58][6];
|
||||
extern const uint8_t table_7_3_2_3_3_4_twoCodeword[6][10];
|
||||
|
||||
extern const uint16_t table_7_2_1[16];
|
||||
|
||||
extern dci_pdu_rel15_t *def_dci_pdu_rel15;
|
||||
|
||||
extern dci_pdu_rel15_t *def_dci_pdu_rel15;
|
||||
|
||||
extern void mac_rlc_data_ind(const module_id_t module_idP,
|
||||
const rnti_t rntiP,
|
||||
const eNB_index_t eNB_index,
|
||||
const frame_t frameP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const MBMS_flag_t MBMS_flagP,
|
||||
const logical_chan_id_t channel_idP,
|
||||
char *buffer_pP,
|
||||
const tb_size_t tb_sizeP,
|
||||
num_tb_t num_tbP,
|
||||
crc_t *crcs_pP);
|
||||
|
||||
extern const char *rnti_types[];
|
||||
extern const char *dci_formats[];
|
||||
|
||||
@@ -34,11 +34,9 @@
|
||||
#define __LAYER2_MAC_UE_PROTO_H__
|
||||
|
||||
#include "mac_defs.h"
|
||||
#include "mac.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
|
||||
\param cc_id component carrier id
|
||||
@@ -134,7 +132,7 @@ uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
|
||||
int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
||||
|
||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, uint16_t rnti, uint32_t dci_format);
|
||||
int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, uint16_t rnti, uint8_t dci_format);
|
||||
int nr_ue_process_dci_indication_pdu(module_id_t module_id, int cc_id, int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci);
|
||||
|
||||
uint32_t get_ssb_frame(uint32_t test);
|
||||
@@ -142,33 +140,18 @@ uint32_t get_ssb_frame(uint32_t test);
|
||||
uint32_t mr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
|
||||
|
||||
/* \brief Get payload (MAC PDU) from UE PHY
|
||||
@param module_idP Instance id of UE in machine
|
||||
@param CC_id Component Carrier index
|
||||
@param frameP Current Rx frame
|
||||
@param slotP Current Rx slot
|
||||
@param pdu Pointer to the MAC PDU
|
||||
@param pdu_len Length of the MAC PDU
|
||||
@param gNB_id Index of gNB that UE is attached to
|
||||
@param ul_time_alignment of struct handling the timing advance parameters
|
||||
@param dl_info pointer to dl indication
|
||||
@param ul_time_alignment pointer to timing advance parameters
|
||||
@param pdu_id index of DL PDU
|
||||
@returns void
|
||||
*/
|
||||
void nr_ue_send_sdu(module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
int slotP,
|
||||
uint8_t * pdu,
|
||||
uint16_t pdu_len,
|
||||
uint8_t gNB_index,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
|
||||
void nr_ue_process_mac_pdu(module_id_t module_idP,
|
||||
uint8_t CC_id,
|
||||
frame_t frameP,
|
||||
uint8_t *pduP,
|
||||
uint16_t mac_pdu_len,
|
||||
uint8_t gNB_index,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
void nr_ue_send_sdu(nr_downlink_indication_t *dl_info,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment,
|
||||
int pdu_id);
|
||||
|
||||
void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment,
|
||||
int pdu_id);
|
||||
|
||||
uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
|
||||
uint8_t *pdu,
|
||||
@@ -183,17 +166,19 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload,
|
||||
unsigned short post_padding,
|
||||
uint16_t buflen);
|
||||
|
||||
int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len);
|
||||
|
||||
void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot);
|
||||
|
||||
int nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
int dci_format,
|
||||
uint8_t dci_length,
|
||||
uint16_t rnti,
|
||||
uint64_t *dci_pdu,
|
||||
dci_pdu_rel15_t *nr_pdci_info_extracted);
|
||||
uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
uint8_t dci_format,
|
||||
uint8_t dci_length,
|
||||
uint16_t rnti,
|
||||
uint64_t *dci_pdu,
|
||||
dci_pdu_rel15_t *nr_pdci_info_extracted);
|
||||
|
||||
int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
|
||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
|
||||
uint8_t time_domain_ind);
|
||||
|
||||
uint8_t
|
||||
nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
@@ -217,6 +202,11 @@ int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t m
|
||||
*/
|
||||
int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_format);
|
||||
|
||||
/** \brief Function to compute configured maximum output power according to clause 6.2.4 of 3GPP TS 38.101-1 version 16.5.0 Release 16
|
||||
@param Mod_id Module id of UE
|
||||
*/
|
||||
long nr_get_Pcmax(module_id_t mod_id);
|
||||
|
||||
/* Random Access */
|
||||
|
||||
/* \brief This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211 tables 6.3.3.2.x
|
||||
@@ -252,22 +242,15 @@ random-access procedure
|
||||
@param selected_rar_buffer the output buffer for storing the selected RAR header and RAR payload
|
||||
@returns timing advance or 0xffff if preamble doesn't match
|
||||
*/
|
||||
uint16_t nr_ue_process_rar(module_id_t mod_id,
|
||||
int CC_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP,
|
||||
uint8_t * dlsch_buffer,
|
||||
rnti_t * t_crnti,
|
||||
uint8_t preamble_index,
|
||||
uint8_t * selected_rar_buffer);
|
||||
int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id);
|
||||
|
||||
void nr_process_rar(nr_downlink_indication_t *dl_info);
|
||||
|
||||
void ue_contention_resolution(module_id_t module_id, uint8_t gNB_index, int cc_id, frame_t tx_frame);
|
||||
void nr_ue_contention_resolution(module_id_t module_id, int cc_id, frame_t frame, int slot, NR_PRACH_RESOURCES_t *prach_resources);
|
||||
|
||||
void nr_ra_failed(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index);
|
||||
void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_resources, frame_t frame, int slot);
|
||||
|
||||
void nr_ra_succeeded(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index);
|
||||
void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot);
|
||||
|
||||
/* \brief Function called by PHY to retrieve information to be transmitted using the RA procedure.
|
||||
If the UE is not in PUSCH mode for a particular eNB index, this is assumed to be an Msg3 and MAC
|
||||
@@ -284,7 +267,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
fapi_nr_ul_config_prach_pdu *prach_pdu,
|
||||
module_id_t mod_id,
|
||||
int CC_id,
|
||||
UE_MODE_t UE_mode,
|
||||
frame_t frame,
|
||||
uint8_t gNB_id,
|
||||
int nr_slot_tx);
|
||||
@@ -298,7 +280,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
|
||||
void nr_get_prach_resources(module_id_t mod_id,
|
||||
int CC_id,
|
||||
uint8_t gNB_id,
|
||||
uint8_t first_Msg3,
|
||||
NR_PRACH_RESOURCES_t *prach_resources,
|
||||
fapi_nr_ul_config_prach_pdu *prach_pdu,
|
||||
NR_RACH_ConfigDedicated_t * rach_ConfigDedicated);
|
||||
@@ -321,6 +302,35 @@ void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu,
|
||||
|
||||
void build_ssb_to_ro_map(NR_ServingCellConfigCommon_t *scc, uint8_t unpaired);
|
||||
|
||||
void config_bwp_ue(NR_UE_MAC_INST_t *mac, uint16_t *bwp_ind, uint8_t *dci_format);
|
||||
|
||||
fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot);
|
||||
|
||||
void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, int slot_tx, uint8_t pdu_type);
|
||||
|
||||
// PUSCH scheduler:
|
||||
// - Calculate the slot in which ULSCH should be scheduled. This is current slot + K2,
|
||||
// - where K2 is the offset between the slot in which UL DCI is received and the slot
|
||||
// - in which ULSCH should be scheduled. K2 is configured in RRC configuration.
|
||||
// PUSCH Msg3 scheduler:
|
||||
// - scheduled by RAR UL grant according to 8.3 of TS 38.213
|
||||
int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t current_frame, int current_slot, frame_t *frame_tx, int *slot_tx, uint8_t tda_id);
|
||||
|
||||
int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti);
|
||||
|
||||
// Configuration of Msg3 PDU according to clauses:
|
||||
// - 8.3 of 3GPP TS 38.213 version 16.3.0 Release 16
|
||||
// - 6.1.2.2 of TS 38.214
|
||||
// - 6.1.3 of TS 38.214
|
||||
// - 6.2.2 of TS 38.214
|
||||
// - 6.1.4.2 of TS 38.214
|
||||
// - 6.4.1.1.1 of TS 38.211
|
||||
// - 6.3.1.7 of 38.211
|
||||
int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
|
||||
dci_pdu_rel15_t *dci,
|
||||
RAR_grant_t *rar_grant,
|
||||
uint16_t rnti,
|
||||
uint8_t *dci_format);
|
||||
#endif
|
||||
/** @}*/
|
||||
|
||||
@@ -30,48 +30,404 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "mac_defs.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
#define mu_pusch 1
|
||||
// definition table j Table 6.1.2.1.1-4
|
||||
#define j ((mu_pusch==3)?3:(mu_pusch==2)?2:1)
|
||||
uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1
|
||||
{j, 0,14}, // row index 1
|
||||
{j, 0,12}, // row index 2
|
||||
{j, 0,10}, // row index 3
|
||||
{j, 2,10}, // row index 4
|
||||
{j, 4,10}, // row index 5
|
||||
{j, 4,8}, // row index 6
|
||||
{j, 4,6}, // row index 7
|
||||
{j+1,0,14}, // row index 8
|
||||
{j+1,0,12}, // row index 9
|
||||
{j+1,0,10}, // row index 10
|
||||
{j+2,0,14}, // row index 11
|
||||
{j+2,0,12}, // row index 12
|
||||
{j+2,0,10}, // row index 13
|
||||
{j, 8,6}, // row index 14
|
||||
{j+3,0,14}, // row index 15
|
||||
{j+3,0,10} // row index 16
|
||||
};
|
||||
const char *rnti_types[]={"RNTI_new", "RNTI_C", "RNTI_RA", "NR_RNTI_P", "NR_RNTI_CS", "NR_RNTI_TC"};
|
||||
const char *dci_formats[]={"1_0", "1_1", "2_0", "2_1", "2_2", "2_3", "0_0", "0_1"};
|
||||
|
||||
#define dmrs_typeA_pos 2
|
||||
uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?12:11}, // row index 1
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?10:9}, // row index 2
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?9:8}, // row index 3
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?7:6}, // row index 4
|
||||
{0,(dmrs_typeA_pos == 2)?2:3, (dmrs_typeA_pos == 2)?5:4}, // row index 5
|
||||
{0,(dmrs_typeA_pos == 2)?9:10,(dmrs_typeA_pos == 2)?4:4}, // row index 6
|
||||
{0,(dmrs_typeA_pos == 2)?4:6, (dmrs_typeA_pos == 2)?4:4}, // row index 7
|
||||
{0,5,7}, // row index 8
|
||||
{0,5,2}, // row index 9
|
||||
{0,9,2}, // row index 10
|
||||
{0,12,2}, // row index 11
|
||||
{0,1,13}, // row index 12
|
||||
{0,1,6}, // row index 13
|
||||
{0,2,4}, // row index 14
|
||||
{0,4,7}, // row index 15
|
||||
{0,8,4} // row index 16
|
||||
};
|
||||
*/
|
||||
// table_7_3_1_1_2_2_3_4_5 contains values for number of layers and precoding information for tables 7.3.1.1.2-2/3/4/5 from TS 38.212 subclause 7.3.1.1.2
|
||||
// the first 6 columns contain table 7.3.1.1.2-2: Precoding information and number of layers, for 4 antenna ports, if transformPrecoder=disabled and maxRank = 2 or 3 or 4
|
||||
// next six columns contain table 7.3.1.1.2-3: Precoding information and number of layers for 4 antenna ports, if transformPrecoder= enabled, or if transformPrecoder=disabled and maxRank = 1
|
||||
// next four columns contain table 7.3.1.1.2-4: Precoding information and number of layers, for 2 antenna ports, if transformPrecoder=disabled and maxRank = 2
|
||||
// next four columns contain table 7.3.1.1.2-5: Precoding information and number of layers, for 2 antenna ports, if transformPrecoder= enabled, or if transformPrecoder= disabled and maxRank = 1
|
||||
const uint8_t table_7_3_1_1_2_2_3_4_5[64][20] = {
|
||||
{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||
{1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 0, 2, 0, 1, 2, 0, 0},
|
||||
{1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 2, 0, 0, 1, 3, 0, 0},
|
||||
{2, 0, 2, 0, 2, 0, 1, 4, 1, 4, 0, 0, 1, 3, 0, 0, 1, 4, 0, 0},
|
||||
{2, 1, 2, 1, 2, 1, 1, 5, 1, 5, 0, 0, 1, 4, 0, 0, 1, 5, 0, 0},
|
||||
{2, 2, 2, 2, 2, 2, 1, 6, 1, 6, 0, 0, 1, 5, 0, 0, 0, 0, 0, 0},
|
||||
{2, 3, 2, 3, 2, 3, 1, 7, 1, 7, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0},
|
||||
{2, 4, 2, 4, 2, 4, 1, 8, 1, 8, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0},
|
||||
{2, 5, 2, 5, 2, 5, 1, 9, 1, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{3, 0, 3, 0, 3, 0, 1, 10, 1, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{4, 0, 4, 0, 4, 0, 1, 11, 1, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 4, 1, 4, 0, 0, 1, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 5, 1, 5, 0, 0, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 6, 1, 6, 0, 0, 1, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 7, 1, 7, 0, 0, 1, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 8, 1, 8, 0, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 9, 1, 9, 0, 0, 1, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 10, 1, 10, 0, 0, 1, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 11, 1, 11, 0, 0, 1, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 6, 2, 6, 0, 0, 1, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 7, 2, 7, 0, 0, 1, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 8, 2, 8, 0, 0, 1, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 9, 2, 9, 0, 0, 1, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 10, 2, 10, 0, 0, 1, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 11, 2, 11, 0, 0, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 12, 2, 12, 0, 0, 1, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 13, 2, 13, 0, 0, 1, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{3, 1, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{3, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{4, 1, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{4, 2, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{1, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{2, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{3, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{3, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_12[14][3] = {
|
||||
{1,0,1},
|
||||
{1,1,1},
|
||||
{2,0,1},
|
||||
{2,1,1},
|
||||
{2,2,1},
|
||||
{2,3,1},
|
||||
{2,0,2},
|
||||
{2,1,2},
|
||||
{2,2,2},
|
||||
{2,3,2},
|
||||
{2,4,2},
|
||||
{2,5,2},
|
||||
{2,6,2},
|
||||
{2,7,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_13[10][4] = {
|
||||
{1,0,1,1},
|
||||
{2,0,1,1},
|
||||
{2,2,3,1},
|
||||
{2,0,2,1},
|
||||
{2,0,1,2},
|
||||
{2,2,3,2},
|
||||
{2,4,5,2},
|
||||
{2,6,7,2},
|
||||
{2,0,4,2},
|
||||
{2,2,6,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_14[3][5] = {
|
||||
{2,0,1,2,1},
|
||||
{2,0,1,4,2},
|
||||
{2,2,3,6,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_15[4][6] = {
|
||||
{2,0,1,2,3,1},
|
||||
{2,0,1,4,5,2},
|
||||
{2,2,3,6,7,2},
|
||||
{2,0,2,4,6,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_16[12][2] = {
|
||||
{1,0},
|
||||
{1,1},
|
||||
{2,0},
|
||||
{2,1},
|
||||
{2,2},
|
||||
{2,3},
|
||||
{3,0},
|
||||
{3,1},
|
||||
{3,2},
|
||||
{3,3},
|
||||
{3,4},
|
||||
{3,5}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_17[7][3] = {
|
||||
{1,0,1},
|
||||
{2,0,1},
|
||||
{2,2,3},
|
||||
{3,0,1},
|
||||
{3,2,3},
|
||||
{3,4,5},
|
||||
{2,0,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_18[3][4] = {
|
||||
{2,0,1,2},
|
||||
{3,0,1,2},
|
||||
{3,3,4,5}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_19[2][5] = {
|
||||
{2,0,1,2,3},
|
||||
{3,0,1,2,3}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_20[28][3] = {
|
||||
{1,0,1},
|
||||
{1,1,1},
|
||||
{2,0,1},
|
||||
{2,1,1},
|
||||
{2,2,1},
|
||||
{2,3,1},
|
||||
{3,0,1},
|
||||
{3,1,1},
|
||||
{3,2,1},
|
||||
{3,3,1},
|
||||
{3,4,1},
|
||||
{3,5,1},
|
||||
{3,0,2},
|
||||
{3,1,2},
|
||||
{3,2,2},
|
||||
{3,3,2},
|
||||
{3,4,2},
|
||||
{3,5,2},
|
||||
{3,6,2},
|
||||
{3,7,2},
|
||||
{3,8,2},
|
||||
{3,9,2},
|
||||
{3,10,2},
|
||||
{3,11,2},
|
||||
{1,0,2},
|
||||
{1,1,2},
|
||||
{1,6,2},
|
||||
{1,7,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_21[19][4] = {
|
||||
{1,0,1,1},
|
||||
{2,0,1,1},
|
||||
{2,2,3,1},
|
||||
{3,0,1,1},
|
||||
{3,2,3,1},
|
||||
{3,4,5,1},
|
||||
{2,0,2,1},
|
||||
{3,0,1,2},
|
||||
{3,2,3,2},
|
||||
{3,4,5,2},
|
||||
{3,6,7,2},
|
||||
{3,8,9,2},
|
||||
{3,10,11,2},
|
||||
{1,0,1,2},
|
||||
{1,6,7,2},
|
||||
{2,0,1,2},
|
||||
{2,2,3,2},
|
||||
{2,6,7,2},
|
||||
{2,8,9,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_22[6][5] = {
|
||||
{2,0,1,2,1},
|
||||
{3,0,1,2,1},
|
||||
{3,3,4,5,1},
|
||||
{3,0,1,6,2},
|
||||
{3,2,3,8,2},
|
||||
{3,4,5,10,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_1_1_2_23[5][6] = {
|
||||
{2,0,1,2,3,1},
|
||||
{3,0,1,2,3,1},
|
||||
{3,0,1,6,7,2},
|
||||
{3,2,3,8,9,2},
|
||||
{3,4,5,10,11,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_1[12][5] = {
|
||||
{1,0,0,0,0},
|
||||
{1,1,0,0,0},
|
||||
{1,0,1,0,0},
|
||||
{2,0,0,0,0},
|
||||
{2,1,0,0,0},
|
||||
{2,2,0,0,0},
|
||||
{2,3,0,0,0},
|
||||
{2,0,1,0,0},
|
||||
{2,2,3,0,0},
|
||||
{2,0,1,2,0},
|
||||
{2,0,1,2,3},
|
||||
{2,0,2,0,0}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_2_oneCodeword[31][6] = {
|
||||
{1,0,0,0,0,1},
|
||||
{1,1,0,0,0,1},
|
||||
{1,0,1,0,0,1},
|
||||
{2,0,0,0,0,1},
|
||||
{2,1,0,0,0,1},
|
||||
{2,2,0,0,0,1},
|
||||
{2,3,0,0,0,1},
|
||||
{2,0,1,0,0,1},
|
||||
{2,2,3,0,0,1},
|
||||
{2,0,1,2,0,1},
|
||||
{2,0,1,2,3,1},
|
||||
{2,0,2,0,0,1},
|
||||
{2,0,0,0,0,2},
|
||||
{2,1,0,0,0,2},
|
||||
{2,2,0,0,0,2},
|
||||
{2,3,0,0,0,2},
|
||||
{2,4,0,0,0,2},
|
||||
{2,5,0,0,0,2},
|
||||
{2,6,0,0,0,2},
|
||||
{2,7,0,0,0,2},
|
||||
{2,0,1,0,0,2},
|
||||
{2,2,3,0,0,2},
|
||||
{2,4,5,0,0,2},
|
||||
{2,6,7,0,0,2},
|
||||
{2,0,4,0,0,2},
|
||||
{2,2,6,0,0,2},
|
||||
{2,0,1,4,0,2},
|
||||
{2,2,3,6,0,2},
|
||||
{2,0,1,4,5,2},
|
||||
{2,2,3,6,7,2},
|
||||
{2,0,2,4,6,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_2_twoCodeword[4][10] = {
|
||||
{2,0,1,2,3,4,0,0,0,2},
|
||||
{2,0,1,2,3,4,6,0,0,2},
|
||||
{2,0,1,2,3,4,5,6,0,2},
|
||||
{2,0,1,2,3,4,5,6,7,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_3_oneCodeword[24][5] = {
|
||||
{1,0,0,0,0},
|
||||
{1,1,0,0,0},
|
||||
{1,0,1,0,0},
|
||||
{2,0,0,0,0},
|
||||
{2,1,0,0,0},
|
||||
{2,2,0,0,0},
|
||||
{2,3,0,0,0},
|
||||
{2,0,1,0,0},
|
||||
{2,2,3,0,0},
|
||||
{2,0,1,2,0},
|
||||
{2,0,1,2,3},
|
||||
{3,0,0,0,0},
|
||||
{3,1,0,0,0},
|
||||
{3,2,0,0,0},
|
||||
{3,3,0,0,0},
|
||||
{3,4,0,0,0},
|
||||
{3,5,0,0,0},
|
||||
{3,0,1,0,0},
|
||||
{3,2,3,0,0},
|
||||
{3,4,5,0,0},
|
||||
{3,0,1,2,0},
|
||||
{3,3,4,5,0},
|
||||
{3,0,1,2,3},
|
||||
{2,0,2,0,0}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_3_twoCodeword[2][7] = {
|
||||
{3,0,1,2,3,4,0},
|
||||
{3,0,1,2,3,4,5}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_4_oneCodeword[58][6] = {
|
||||
{1,0,0,0,0,1},
|
||||
{1,1,0,0,0,1},
|
||||
{1,0,1,0,0,1},
|
||||
{2,0,0,0,0,1},
|
||||
{2,1,0,0,0,1},
|
||||
{2,2,0,0,0,1},
|
||||
{2,3,0,0,0,1},
|
||||
{2,0,1,0,0,1},
|
||||
{2,2,3,0,0,1},
|
||||
{2,0,1,2,0,1},
|
||||
{2,0,1,2,3,1},
|
||||
{3,0,0,0,0,1},
|
||||
{3,1,0,0,0,1},
|
||||
{3,2,0,0,0,1},
|
||||
{3,3,0,0,0,1},
|
||||
{3,4,0,0,0,1},
|
||||
{3,5,0,0,0,1},
|
||||
{3,0,1,0,0,1},
|
||||
{3,2,3,0,0,1},
|
||||
{3,4,5,0,0,1},
|
||||
{3,0,1,2,0,1},
|
||||
{3,3,4,5,0,1},
|
||||
{3,0,1,2,3,1},
|
||||
{2,0,2,0,0,1},
|
||||
{3,0,0,0,0,2},
|
||||
{3,1,0,0,0,2},
|
||||
{3,2,0,0,0,2},
|
||||
{3,3,0,0,0,2},
|
||||
{3,4,0,0,0,2},
|
||||
{3,5,0,0,0,2},
|
||||
{3,6,0,0,0,2},
|
||||
{3,7,0,0,0,2},
|
||||
{3,8,0,0,0,2},
|
||||
{3,9,0,0,0,2},
|
||||
{3,10,0,0,0,2},
|
||||
{3,11,0,0,0,2},
|
||||
{3,0,1,0,0,2},
|
||||
{3,2,3,0,0,2},
|
||||
{3,4,5,0,0,2},
|
||||
{3,6,7,0,0,2},
|
||||
{3,8,9,0,0,2},
|
||||
{3,10,11,0,0,2},
|
||||
{3,0,1,6,0,2},
|
||||
{3,2,3,8,0,2},
|
||||
{3,4,5,10,0,2},
|
||||
{3,0,1,6,7,2},
|
||||
{3,2,3,8,9,2},
|
||||
{3,4,5,10,11,2},
|
||||
{1,0,0,0,0,2},
|
||||
{1,1,0,0,0,2},
|
||||
{1,6,0,0,0,2},
|
||||
{1,7,0,0,0,2},
|
||||
{1,0,1,0,0,2},
|
||||
{1,6,7,0,0,2},
|
||||
{2,0,1,0,0,2},
|
||||
{2,2,3,0,0,2},
|
||||
{2,6,7,0,0,2},
|
||||
{2,8,9,0,0,2}
|
||||
};
|
||||
|
||||
const uint8_t table_7_3_2_3_3_4_twoCodeword[6][10] = {
|
||||
{3,0,1,2,3,4,0,0,0,1},
|
||||
{3,0,1,2,3,4,5,0,0,1},
|
||||
{2,0,1,2,3,6,0,0,0,2},
|
||||
{2,0,1,2,3,6,8,0,0,2},
|
||||
{2,0,1,2,3,6,7,8,0,2},
|
||||
{2,0,1,2,3,6,7,8,9,2}
|
||||
};
|
||||
|
||||
// table 7.2-1 TS 38.321
|
||||
const uint16_t table_7_2_1[16] = {
|
||||
5, // row index 0
|
||||
10, // row index 1
|
||||
20, // row index 2
|
||||
30, // row index 3
|
||||
40, // row index 4
|
||||
60, // row index 5
|
||||
80, // row index 6
|
||||
120, // row index 7
|
||||
160, // row index 8
|
||||
240, // row index 9
|
||||
320, // row index 10
|
||||
480, // row index 11
|
||||
960, // row index 12
|
||||
1920, // row index 13
|
||||
};
|
||||
|
||||
@@ -30,10 +30,12 @@
|
||||
*/
|
||||
|
||||
#include "PHY/defs_nr_common.h"
|
||||
//#include "PHY/impl_defs_top.h"
|
||||
|
||||
#include "mac_defs.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "NR_P-Max.h"
|
||||
|
||||
/* TS 38.321 subclause 7.3 - return DELTA_PREAMBLE values in dB */
|
||||
int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_format){
|
||||
@@ -133,21 +135,33 @@ int8_t nr_get_DELTA_PREAMBLE(module_id_t mod_id, int CC_id, uint16_t prach_forma
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* TS 38.321 subclause 5.1.3 - RA preamble transmission - ra_PREAMBLE_RECEIVED_TARGET_POWER configuration */
|
||||
// TS 38.321 subclause 5.1.3 - RA preamble transmission - ra_PREAMBLE_RECEIVED_TARGET_POWER configuration
|
||||
// Measurement units:
|
||||
// - preambleReceivedTargetPower dBm (-202..-60, 2 dBm granularity)
|
||||
// - delta_preamble dB
|
||||
// - RA_PREAMBLE_POWER_RAMPING_STEP dB
|
||||
// - POWER_OFFSET_2STEP_RA dB
|
||||
// returns receivedTargerPower in dBm
|
||||
int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t mod_id, uint8_t CC_id){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
int8_t receivedTargerPower, delta_preamble;
|
||||
long preambleReceivedTargetPower;
|
||||
long preambleReceivedTargetPower = 0;
|
||||
|
||||
AssertFatal(nr_rach_ConfigCommon != NULL, "[UE %d] CCid %d FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id, CC_id);
|
||||
if (prach_resources->RA_TYPE == RA_4STEP){
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower;
|
||||
} else if (prach_resources->RA_TYPE == RA_2STEP){
|
||||
// msgA-PreambleReceivedTargetPower
|
||||
LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__);
|
||||
}
|
||||
|
||||
preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower;
|
||||
delta_preamble = nr_get_DELTA_PREAMBLE(mod_id, CC_id, prach_resources->prach_format);
|
||||
|
||||
receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (mac->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP;
|
||||
receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP + prach_resources->POWER_OFFSET_2STEP_RA;
|
||||
|
||||
LOG_D(MAC, "In %s: receivedTargerPower is %d dBm \n", __FUNCTION__, receivedTargerPower);
|
||||
|
||||
return receivedTargerPower;
|
||||
}
|
||||
@@ -171,3 +185,81 @@ void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu,
|
||||
*nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data;
|
||||
|
||||
}
|
||||
|
||||
// Implementation of 6.2.4 Configured ransmitted power
|
||||
// 3GPP TS 38.101-1 version 16.5.0 Release 16
|
||||
// -
|
||||
// The UE is allowed to set its configured maximum output power PCMAX,f,c for carrier f of serving cell c in each slot.
|
||||
// The configured maximum output power PCMAX,f,c is set within the following bounds: PCMAX_L,f,c <= PCMAX,f,c <= PCMAX_H,f,c
|
||||
// -
|
||||
// Measurement units:
|
||||
// - p_max: dBm
|
||||
// - delta_TC_c: dB
|
||||
// - P_powerclass: dBm
|
||||
// - delta_P_powerclass: dB
|
||||
// - MPR_c: dB
|
||||
// - delta_MPR_c: dB
|
||||
// - delta_T_IB_c dB
|
||||
// - delta_rx_SRS dB
|
||||
// note:
|
||||
// - Assuming:
|
||||
// -- Powerclass 3 capable UE (which is default power class unless otherwise stated)
|
||||
// -- Maximum power reduction (MPR_c) for power class 3, QPSK, inner RB allocations
|
||||
// -- no additional MPR (A_MPR_c)
|
||||
// todo:
|
||||
// - in current implementation delta_P_powerclass is not handling power classes different from 3
|
||||
long nr_get_Pcmax(module_id_t mod_id){
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
uint32_t band = *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
NR_P_Max_t p_max = 0;
|
||||
uint8_t P_powerclass = 23;
|
||||
uint8_t delta_P_powerclass = 0;
|
||||
uint8_t MPR_c = 1.5;
|
||||
uint8_t delta_MPR_c = 0;
|
||||
uint8_t A_MPR_c = 0;
|
||||
uint8_t delta_T_IB_c = 0;
|
||||
uint8_t delta_TC_c = 0;
|
||||
uint8_t delta_rx_SRS = 0;
|
||||
uint8_t P_MPR_c = 0;
|
||||
long P_cmax_l = 0;
|
||||
long P_cmax_h = 0;
|
||||
long P_cmax = 0;
|
||||
|
||||
if (band == 28 && mac->phy_config.config_req.carrier_config.uplink_bandwidth == 30){
|
||||
delta_MPR_c = 0.5;
|
||||
}
|
||||
|
||||
if (mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1){
|
||||
if (*mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->ext1->powerBoostPi2BPSK == 1){
|
||||
// TbD: assuming power class 3 capable UE operating in TDD bands n40, n41, n77, n78, and n79 with Pi/2 BPSK modulation
|
||||
delta_P_powerclass = -3;
|
||||
p_max += 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (mac->scc->uplinkConfigCommon->frequencyInfoUL->p_Max){
|
||||
|
||||
p_max += *mac->scc->uplinkConfigCommon->frequencyInfoUL->p_Max;
|
||||
|
||||
LOG_D(MAC, "In %s maximum UL transmission power p_max is %ld dBm \n", __FUNCTION__, p_max);
|
||||
|
||||
P_cmax_l = min(p_max - delta_TC_c, (P_powerclass - delta_P_powerclass) - max(max(MPR_c + delta_MPR_c, A_MPR_c) + delta_T_IB_c + delta_TC_c + delta_rx_SRS, P_MPR_c));
|
||||
|
||||
P_cmax_h = min(p_max, P_powerclass - delta_P_powerclass);
|
||||
|
||||
} else {
|
||||
|
||||
P_cmax_l = (P_powerclass - delta_P_powerclass) - max(max(MPR_c + delta_MPR_c, A_MPR_c) + delta_T_IB_c + delta_TC_c + delta_rx_SRS, P_MPR_c);
|
||||
|
||||
P_cmax_h = P_powerclass - delta_P_powerclass;
|
||||
|
||||
}
|
||||
|
||||
P_cmax = (P_cmax_h + P_cmax_l) / 2;
|
||||
|
||||
LOG_D(MAC, "In %s configured maximum output power: %ld dBm <= PCMAX %ld dBm <= %ld dBm \n", __FUNCTION__, P_cmax_l, P_cmax, P_cmax_h);
|
||||
|
||||
return P_cmax;
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -68,11 +68,13 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd
|
||||
|
||||
void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id){
|
||||
|
||||
RA_config_t *ra = &mac->ra;
|
||||
uint16_t monitoringSymbolsWithinSlot = 0;
|
||||
uint8_t bwp_id = 1, coreset_id = 1;
|
||||
uint8_t coreset_id = 1;
|
||||
int sps = 0;
|
||||
def_dci_pdu_rel15 = calloc(1,2*sizeof(dci_pdu_rel15_t));
|
||||
AssertFatal(mac->scc != NULL, "scc is null\n");
|
||||
NR_BWP_Id_t bwp_id = mac->DL_BWP_Id;
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common;
|
||||
NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP;
|
||||
@@ -111,7 +113,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
// Scrambling RNTI
|
||||
if (coreset->pdcch_DMRS_ScramblingID) {
|
||||
rel15->coreset.pdcch_dmrs_scrambling_id = *coreset->pdcch_DMRS_ScramblingID;
|
||||
rel15->coreset.scrambling_rnti = mac->t_crnti;
|
||||
rel15->coreset.scrambling_rnti = mac->crnti;
|
||||
} else {
|
||||
rel15->coreset.pdcch_dmrs_scrambling_id = *scc->physCellId;
|
||||
rel15->coreset.scrambling_rnti = 0;
|
||||
@@ -129,8 +131,8 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
// for SPS=14 8 MSBs in positions 13 down to 6
|
||||
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||
rel15->rnti = mac->crnti;
|
||||
rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
|
||||
for (int i = 0; i < rel15->num_dci_options; i++) {
|
||||
rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15+i, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id);
|
||||
@@ -140,9 +142,9 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
// we use the initial DL BWP
|
||||
sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||
rel15->rnti = mac->ra_rnti;
|
||||
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); //NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
|
||||
rel15->rnti = ra->ra_rnti;
|
||||
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); //NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
|
||||
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id);
|
||||
break;
|
||||
@@ -207,13 +209,14 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
|
||||
void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot) {
|
||||
|
||||
RA_config_t *ra = &mac->ra;
|
||||
int ss_id;
|
||||
uint8_t bwp_id = 1, coreset_id = 1;
|
||||
//NR_ServingCellConfig_t *scd = mac->scg->spCellConfig->spCellConfigDedicated;
|
||||
NR_BWP_Downlink_t *bwp = mac->DLbwp[bwp_id - 1];
|
||||
|
||||
#ifdef DEBUG_DCI
|
||||
LOG_D(MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &mac->ra_rnti, mac->ra_rnti, &mac->crnti, mac->crnti, &mac->t_crnti, mac->t_crnti);
|
||||
LOG_D(MAC, "[DCI_CONFIG] ra_rnti %p (%x) crnti %p (%x) t_crnti %p (%x)\n", &ra->ra_rnti, ra->ra_rnti, &mac->crnti, mac->crnti, &ra->t_crnti, ra->t_crnti);
|
||||
#endif
|
||||
|
||||
// loop over all available SS for BWP ID 1, CORESET ID 1
|
||||
@@ -240,7 +243,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
// check available SS IDs
|
||||
if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
switch(mac->ra_state){
|
||||
switch(ra->ra_state){
|
||||
case WAIT_RAR:
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n");
|
||||
rel15->num_dci_options = 1;
|
||||
@@ -249,7 +252,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
break;
|
||||
case WAIT_CONTENTION_RESOLUTION:
|
||||
rel15->rnti = mac->t_crnti;
|
||||
LOG_E(MAC, "In %s: CB-RA not implemented yet. Should not have fallen in this case.\n", __FUNCTION__);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -314,7 +317,7 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
if (ss->searchSpaceType->choice.ue_Specific){
|
||||
if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){
|
||||
// Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
|
||||
if ((mac->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) && mac->crnti > 0) {
|
||||
if ((ra->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) && mac->crnti > 0) {
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n");
|
||||
rel15->num_dci_options = 2;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_1;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,359 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file rar_tools_nrUE.c
|
||||
* \brief RA tools for NR UE
|
||||
* \author Guido Casati
|
||||
* \date 2019
|
||||
* \version 1.0
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
/* Sim */
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
|
||||
/* Utils */
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "OCG.h"
|
||||
#include "OCG_extern.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
|
||||
/* Common */
|
||||
#include "common/ran_context.h"
|
||||
|
||||
/* MAC */
|
||||
#include "NR_MAC_UE/mac.h"
|
||||
#include "NR_MAC_UE/mac_proto.h"
|
||||
#include "NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include <common/utils/nr/nr_common.h>
|
||||
|
||||
// #define DEBUG_RAR
|
||||
// #define DEBUG_MSG3
|
||||
|
||||
// table 7.2-1 TS 38.321
|
||||
uint16_t table_7_2_1[16] = {
|
||||
5, // row index 0
|
||||
10, // row index 1
|
||||
20, // row index 2
|
||||
30, // row index 3
|
||||
40, // row index 4
|
||||
60, // row index 5
|
||||
80, // row index 6
|
||||
120, // row index 7
|
||||
160, // row index 8
|
||||
240, // row index 9
|
||||
320, // row index 10
|
||||
480, // row index 11
|
||||
960, // row index 12
|
||||
1920, // row index 13
|
||||
};
|
||||
|
||||
void nr_config_Msg3_pdu(NR_UE_MAC_INST_t *mac,
|
||||
int Msg3_f_alloc,
|
||||
uint8_t Msg3_t_alloc,
|
||||
uint8_t mcs,
|
||||
uint8_t freq_hopping){
|
||||
|
||||
int f_alloc, mask, StartSymbolIndex, NrOfSymbols;
|
||||
uint8_t nb_dmrs_re_per_rb;
|
||||
uint16_t number_dmrs_symbols = 0;
|
||||
int N_PRB_oh;
|
||||
fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request[0];
|
||||
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
|
||||
NR_ServingCellConfigCommon_t *scc = mac->scc;
|
||||
NR_BWP_Uplink_t *ubwp = mac->ULbwp[0];
|
||||
NR_BWP_UplinkDedicated_t *ibwp = mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP;
|
||||
NR_PUSCH_Config_t *pusch_Config = ibwp->pusch_Config->choice.setup;
|
||||
int startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[Msg3_t_alloc]->startSymbolAndLength;
|
||||
|
||||
#ifdef DEBUG_MSG3
|
||||
printf("[DEBUG_MSG3] Configuring 1 Msg3 PDU of %d UL pdus \n", ul_config->number_pdus);
|
||||
#endif
|
||||
|
||||
// Num PRB Overhead from PUSCH-ServingCellConfig
|
||||
if (mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead == NULL)
|
||||
N_PRB_oh = 0;
|
||||
else
|
||||
N_PRB_oh = *mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead;
|
||||
|
||||
// active BWP start
|
||||
int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
int abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
|
||||
// initial BWP start
|
||||
int ibwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, 275);
|
||||
int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, 275);
|
||||
|
||||
// BWP start selection according to 8.3 of TS 38.213
|
||||
pusch_config_pdu->bwp_size = ibwp_size;
|
||||
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size))
|
||||
pusch_config_pdu->bwp_start = abwp_start;
|
||||
else
|
||||
pusch_config_pdu->bwp_start = ibwp_start;
|
||||
|
||||
//// Resource assignment from RAR
|
||||
// Frequency domain allocation according to 8.3 of TS 38.213
|
||||
if (ibwp_size < 180)
|
||||
mask = (1 << ((int) ceil(log2((ibwp_size*(ibwp_size+1))>>1)))) - 1;
|
||||
else
|
||||
mask = (1 << (28 - (int)(ceil(log2((ibwp_size*(ibwp_size+1))>>1))))) - 1;
|
||||
|
||||
f_alloc = Msg3_f_alloc & mask;
|
||||
nr_ue_process_dci_freq_dom_resource_assignment(pusch_config_pdu, NULL, ibwp_size, 0, f_alloc);
|
||||
|
||||
// virtual resource block to physical resource mapping for Msg3 PUSCH (6.3.1.7 in 38.211)
|
||||
pusch_config_pdu->rb_start += ibwp_start - abwp_start;
|
||||
|
||||
// Time domain allocation
|
||||
SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols);
|
||||
pusch_config_pdu->ul_dmrs_symb_pos = 1<<StartSymbolIndex;
|
||||
pusch_config_pdu->start_symbol_index = StartSymbolIndex;
|
||||
pusch_config_pdu->nr_of_symbols = NrOfSymbols;
|
||||
|
||||
#ifdef DEBUG_MSG3
|
||||
printf("[DEBUG_MSG3] Freq assignment (RB start %d size %d) BWP (start %d, size %d), Time assignment (sliv_S %d sliv_L %d) \n",
|
||||
pusch_config_pdu->rb_start,
|
||||
pusch_config_pdu->rb_size,
|
||||
pusch_config_pdu->bwp_start,
|
||||
pusch_config_pdu->bwp_size,
|
||||
StartSymbolIndex,
|
||||
NrOfSymbols);
|
||||
#endif
|
||||
|
||||
// MCS
|
||||
pusch_config_pdu->mcs_index = mcs;
|
||||
// Frequency hopping
|
||||
pusch_config_pdu->frequency_hopping = freq_hopping;
|
||||
// TC-RNTI
|
||||
pusch_config_pdu->rnti = mac->t_crnti;
|
||||
|
||||
// DM-RS configuration according to 6.2.2 UE DM-RS transmission procedure in 38.214
|
||||
pusch_config_pdu->dmrs_config_type = pusch_dmrs_type1;
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
|
||||
pusch_config_pdu->dmrs_ports = 1;
|
||||
get_num_re_dmrs(pusch_config_pdu,
|
||||
&nb_dmrs_re_per_rb,
|
||||
&number_dmrs_symbols);
|
||||
|
||||
// DMRS sequence initialization [TS 38.211, sec 6.4.1.1.1].
|
||||
// Should match what is sent in DCI 0_1, otherwise set to 0.
|
||||
pusch_config_pdu->scid = 0;
|
||||
|
||||
// Transform precoding according to 6.1.3 UE procedure for applying transform precoding on PUSCH in 38.214
|
||||
if (scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL)
|
||||
pusch_config_pdu->transform_precoding = 1;
|
||||
else
|
||||
pusch_config_pdu->transform_precoding = 0;
|
||||
|
||||
// Resource allocation in frequency domain according to 6.1.2.2 in TS 38.214
|
||||
pusch_config_pdu->resource_alloc = pusch_Config->resourceAllocation;
|
||||
|
||||
//// Completing PUSCH PDU
|
||||
pusch_config_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
|
||||
pusch_config_pdu->mcs_table = 0;
|
||||
pusch_config_pdu->nrOfLayers = 1;
|
||||
pusch_config_pdu->cyclic_prefix = 0;
|
||||
pusch_config_pdu->target_code_rate = nr_get_code_rate_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table);
|
||||
pusch_config_pdu->qam_mod_order = nr_get_Qm_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table);
|
||||
pusch_config_pdu->data_scrambling_id = *scc->physCellId;
|
||||
pusch_config_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
pusch_config_pdu->subcarrier_spacing = ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pusch_config_pdu->vrb_to_prb_mapping = 0;
|
||||
pusch_config_pdu->uplink_frequency_shift_7p5khz = 0;
|
||||
//Optional Data only included if indicated in pduBitmap
|
||||
pusch_config_pdu->pusch_data.rv_index = 0; // 8.3 in 38.213
|
||||
pusch_config_pdu->pusch_data.harq_process_id = 0;
|
||||
pusch_config_pdu->pusch_data.new_data_indicator = 1; // new data
|
||||
pusch_config_pdu->pusch_data.num_cb = 0;
|
||||
|
||||
// Compute TBS
|
||||
pusch_config_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_config_pdu->qam_mod_order,
|
||||
pusch_config_pdu->target_code_rate,
|
||||
pusch_config_pdu->rb_size,
|
||||
pusch_config_pdu->nr_of_symbols,
|
||||
nb_dmrs_re_per_rb*number_dmrs_symbols,
|
||||
N_PRB_oh,
|
||||
0, // TBR to verify tb scaling
|
||||
pusch_config_pdu->nrOfLayers)/8;
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// Random Access Response PDU //
|
||||
// TS 38.213 ch 8.2 //
|
||||
// TS 38.321 ch 6.2.3 //
|
||||
/////////////////////////////////////
|
||||
//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise
|
||||
//| E | T | R A P I D |//
|
||||
//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |//
|
||||
//| R | T A |//
|
||||
//| T A | UL grant |//
|
||||
//| UL grant |//
|
||||
//| UL grant |//
|
||||
//| UL grant |//
|
||||
//| T C - R N T I |//
|
||||
//| T C - R N T I |//
|
||||
/////////////////////////////////////
|
||||
// UL grant (27 bits) //
|
||||
/////////////////////////////////////
|
||||
//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise
|
||||
//|-------------------|FHF|F_alloc|//
|
||||
//| Freq allocation |//
|
||||
//| F_alloc |Time allocation|//
|
||||
//| MCS | TPC |CSI|//
|
||||
/////////////////////////////////////
|
||||
// TbD WIP Msg3 development ongoing
|
||||
// - apply UL grant freq alloc & time alloc as per 8.2 TS 38.213
|
||||
// - apply tpc command
|
||||
uint16_t nr_ue_process_rar(module_id_t mod_id,
|
||||
int CC_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot,
|
||||
uint8_t * dlsch_buffer,
|
||||
rnti_t * t_crnti,
|
||||
uint8_t preamble_index,
|
||||
uint8_t * selected_rar_buffer){
|
||||
|
||||
NR_UE_MAC_INST_t *ue_mac = get_mac_inst(mod_id);
|
||||
NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; // RAR subheader pointer
|
||||
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer
|
||||
uint8_t n_subPDUs = 0; // number of RAR payloads
|
||||
uint8_t n_subheaders = 0; // number of MAC RAR subheaders
|
||||
uint16_t ta_command = 0;
|
||||
|
||||
AssertFatal(CC_id == 0, "RAR reception on secondary CCs is not supported yet\n");
|
||||
|
||||
while (1) {
|
||||
n_subheaders++;
|
||||
if (rarh->T == 1) {
|
||||
n_subPDUs++;
|
||||
LOG_D(MAC, "[UE %d][RAPROC] Got RAPID RAR subPDU\n", mod_id);
|
||||
} else {
|
||||
n_subPDUs++;
|
||||
ue_mac->RA_backoff_indicator = table_7_2_1[((NR_RA_HEADER_BI *)rarh)->BI];
|
||||
ue_mac->RA_BI_found = 1;
|
||||
LOG_D(MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d\n", mod_id, ue_mac->RA_backoff_indicator);
|
||||
}
|
||||
if (rarh->RAPID == preamble_index) {
|
||||
LOG_I(PHY, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID);
|
||||
rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR));
|
||||
ue_mac->RA_RAPID_found = 1;
|
||||
break;
|
||||
}
|
||||
if (rarh->E == 0) {
|
||||
LOG_I(PHY, "No RAR found with the intended RAPID. \n");
|
||||
break;
|
||||
} else {
|
||||
rarh += sizeof(NR_MAC_RAR) + 1;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef DEBUG_RAR
|
||||
LOG_D(MAC, "[DEBUG_RAR] (%d,%d) number of RAR subheader %d; number of RAR pyloads %d\n", frame, slot, n_subheaders, n_subPDUs);
|
||||
LOG_D(MAC, "[DEBUG_RAR] Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n", *(uint8_t *) rarh, rar[0], rar[1], rar[2], rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
|
||||
#endif
|
||||
|
||||
if (ue_mac->RA_RAPID_found) {
|
||||
|
||||
uint8_t freq_hopping, mcs, Msg3_t_alloc;
|
||||
uint16_t Msg3_f_alloc;
|
||||
unsigned char tpc_command;
|
||||
#ifdef DEBUG_RAR
|
||||
unsigned char csi_req;
|
||||
#endif
|
||||
|
||||
// TC-RNTI
|
||||
*t_crnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8);
|
||||
ue_mac->t_crnti = *t_crnti;
|
||||
// TA command
|
||||
ta_command = rar->TA2 + (rar->TA1 << 5);
|
||||
|
||||
#ifdef DEBUG_RAR
|
||||
// CSI
|
||||
csi_req = (unsigned char) (rar->UL_GRANT_4 & 0x01);
|
||||
#endif
|
||||
|
||||
// TPC
|
||||
tpc_command = (unsigned char) ((rar->UL_GRANT_4 >> 1) & 0x07);
|
||||
switch (tpc_command){
|
||||
case 0:
|
||||
ue_mac->Msg3_TPC = -6;
|
||||
break;
|
||||
case 1:
|
||||
ue_mac->Msg3_TPC = -4;
|
||||
break;
|
||||
case 2:
|
||||
ue_mac->Msg3_TPC = -2;
|
||||
break;
|
||||
case 3:
|
||||
ue_mac->Msg3_TPC = 0;
|
||||
break;
|
||||
case 4:
|
||||
ue_mac->Msg3_TPC = 2;
|
||||
break;
|
||||
case 5:
|
||||
ue_mac->Msg3_TPC = 4;
|
||||
break;
|
||||
case 6:
|
||||
ue_mac->Msg3_TPC = 6;
|
||||
break;
|
||||
case 7:
|
||||
ue_mac->Msg3_TPC = 8;
|
||||
break;
|
||||
}
|
||||
// MCS
|
||||
mcs = (unsigned char) (rar->UL_GRANT_4 >> 4);
|
||||
// time alloc
|
||||
Msg3_t_alloc = (unsigned char) (rar->UL_GRANT_3 & 0x07);
|
||||
// frequency alloc
|
||||
Msg3_f_alloc = (uint16_t) ((rar->UL_GRANT_3 >> 4) | (rar->UL_GRANT_2 << 4) | ((rar->UL_GRANT_1 & 0x03) << 12));
|
||||
// frequency hopping
|
||||
freq_hopping = (unsigned char) (rar->UL_GRANT_1 >> 2);
|
||||
|
||||
#ifdef DEBUG_RAR
|
||||
LOG_D(MAC, "[DEBUG_RAR] Received RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n",
|
||||
Msg3_t_alloc,
|
||||
Msg3_f_alloc,
|
||||
ta_command,
|
||||
mcs,
|
||||
freq_hopping,
|
||||
tpc_command,
|
||||
csi_req,
|
||||
ue_mac->t_crnti);
|
||||
#endif
|
||||
|
||||
// Config Msg3 PDU
|
||||
nr_config_Msg3_pdu(ue_mac, Msg3_f_alloc, Msg3_t_alloc, mcs, freq_hopping);
|
||||
// Schedule Msg3
|
||||
nr_ue_msg3_scheduler(ue_mac, frame, slot, Msg3_t_alloc);
|
||||
|
||||
} else {
|
||||
ue_mac->t_crnti = 0;
|
||||
ta_command = (0xffff);
|
||||
}
|
||||
|
||||
// move the selected RAR to the front of the RA_PDSCH buffer
|
||||
memcpy((void *) (selected_rar_buffer + 0), (void *) rarh, 1);
|
||||
memcpy((void *) (selected_rar_buffer + 1), (void *) rar, sizeof(NR_MAC_RAR));
|
||||
|
||||
return ta_command;
|
||||
}
|
||||
@@ -612,8 +612,8 @@ void nr_get_Msg3alloc(module_id_t module_id,
|
||||
|
||||
LOG_I(MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u start symbol index %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id, StartSymbolIndex);
|
||||
uint16_t *vrb_map_UL =
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * 275];
|
||||
const uint16_t bwpSize = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * MAX_BWP_SIZE];
|
||||
const uint16_t bwpSize = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
/* search 18 free RBs */
|
||||
int rbSize = 0;
|
||||
int rbStart = 0;
|
||||
@@ -694,10 +694,10 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA;
|
||||
pusch_pdu->rnti = ra->rnti;
|
||||
pusch_pdu->handle = 0;
|
||||
int abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
int ibwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
int abwp_size = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int ibwp_start = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size))
|
||||
pusch_pdu->bwp_start = abwp_start;
|
||||
else
|
||||
@@ -787,7 +787,7 @@ void nr_generate_Msg2(module_id_t module_idP,
|
||||
}
|
||||
else { // on configured BWP or initial LDBWP, bandwidth parameters in DCI correspond size of initialBWP
|
||||
locationAndBandwidth = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth;
|
||||
dci10_bw = NRRIV2BW(locationAndBandwidth,275);
|
||||
dci10_bw = NRRIV2BW(locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
|
||||
if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) {
|
||||
@@ -840,8 +840,8 @@ void nr_generate_Msg2(module_id_t module_idP,
|
||||
pdsch_pdu_rel15->pduIndex = 0;
|
||||
|
||||
|
||||
pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pdsch_pdu_rel15->CyclicPrefix = 0;
|
||||
pdsch_pdu_rel15->NrOfCodewords = 1;
|
||||
@@ -1025,7 +1025,7 @@ void nr_fill_rar(uint8_t Mod_idP,
|
||||
uint8_t * dlsch_buffer,
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu){
|
||||
|
||||
LOG_I(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u\n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index);
|
||||
LOG_I(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset);
|
||||
NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer;
|
||||
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1);
|
||||
unsigned char csi_req = 0, tpc_command;
|
||||
|
||||
@@ -457,8 +457,8 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id,
|
||||
const int current_harq_pid = slot % num_slots_per_tdd;
|
||||
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
|
||||
NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid];
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
if (harq->round != 0) { /* retransmission */
|
||||
sched_ctrl->time_domain_allocation = retInfo->time_domain_allocation;
|
||||
|
||||
@@ -80,7 +80,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
|
||||
NR_ServingCellConfigCommon_t *scc=cc->ServingCellConfigCommon;
|
||||
|
||||
int dlBWP_carrier_bandwidth = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
int dlBWP_carrier_bandwidth = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
|
||||
/*
|
||||
@@ -94,7 +94,7 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
LOG_D(MAC, "Scheduling common search space DCI type 1 dlBWP BW.firstRB %d.%d\n",
|
||||
dlBWP_carrier_bandwidth,
|
||||
NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,275));
|
||||
NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE));
|
||||
|
||||
|
||||
dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body;
|
||||
@@ -117,8 +117,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
pdsch_pdu_rel15->pduIndex = 0;
|
||||
|
||||
// BWP
|
||||
pdsch_pdu_rel15->BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,275);
|
||||
pdsch_pdu_rel15->BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu_rel15->SubcarrierSpacing = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing;
|
||||
pdsch_pdu_rel15->CyclicPrefix = 0;
|
||||
pdsch_pdu_rel15->NrOfCodewords = 1;
|
||||
@@ -267,7 +267,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
UE_id);
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
/* find largest unallocated chunk */
|
||||
const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int rbStart = 0;
|
||||
int tStart = 0;
|
||||
int rbSize = 0;
|
||||
@@ -402,7 +402,7 @@ void nr_ul_preprocessor_phytest(module_id_t module_id,
|
||||
rbSize = bw;
|
||||
|
||||
uint16_t *vrb_map_UL =
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * 275];
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE];
|
||||
for (int i = rbStart; i < rbStart + rbSize; ++i) {
|
||||
if (vrb_map_UL[i]) {
|
||||
LOG_E(MAC,
|
||||
|
||||
@@ -555,8 +555,8 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
||||
pdsch_pdu_rel15->pduIndex = nr_mac->pdu_index[0]++;
|
||||
|
||||
// BWP
|
||||
pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
if (bwp->bwp_Common->genericParameters.cyclicPrefix)
|
||||
pdsch_pdu_rel15->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
||||
@@ -623,7 +623,7 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
||||
pdsch_pdu_rel15->rbSize,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,
|
||||
275));
|
||||
MAX_BWP_SIZE));
|
||||
else
|
||||
AssertFatal(1==0,"Only frequency resource allocation type 1 is currently supported\n");
|
||||
// time domain assignment: row index used instead of SLIV
|
||||
@@ -653,7 +653,7 @@ void nr_fill_nfapi_dl_pdu(int Mod_idP,
|
||||
dci_pdu_rel15[0].frequency_domain_assignment.val,
|
||||
pdsch_pdu_rel15->rbStart,
|
||||
pdsch_pdu_rel15->rbSize,
|
||||
NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, 275),
|
||||
NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
|
||||
dci_pdu_rel15[0].time_domain_assignment.val,
|
||||
dci_pdu_rel15[0].vrb_to_prb_mapping.val,
|
||||
dci_pdu_rel15[0].mcs,
|
||||
@@ -716,7 +716,7 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,
|
||||
int *dci_formats,
|
||||
int time_domain_assignment, uint8_t tpc,
|
||||
int n_ubwp, int bwp_id) {
|
||||
const int bw = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
|
||||
const int bw = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
switch (dci_formats[(pdcch_pdu_rel15->numDlDci) - 1]) {
|
||||
case NR_UL_DCI_FORMAT_0_0:
|
||||
dci_pdu_rel15->frequency_domain_assignment.val =
|
||||
@@ -794,8 +794,8 @@ void nr_configure_pdcch(gNB_MAC_INST *nr_mac,
|
||||
uint8_t aggregation_level,
|
||||
int CCEIndex) {
|
||||
if (bwp) { // This is not the InitialBWP
|
||||
pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdcch_pdu->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pdcch_pdu->CyclicPrefix = (bwp->bwp_Common->genericParameters.cyclicPrefix==NULL) ? 0 : *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
||||
|
||||
@@ -936,8 +936,8 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
else
|
||||
pucch_pdu->hopping_id = *scc->physCellId;
|
||||
|
||||
pucch_pdu->bwp_size = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pucch_pdu->bwp_start = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pucch_pdu->bwp_size = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pucch_pdu->bwp_start = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pucch_pdu->subcarrier_spacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pucch_pdu->cyclic_prefix = (bwp->bwp_Common->genericParameters.cyclicPrefix==NULL) ? 0 : *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id,
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * 275];
|
||||
uint16_t rbStart = 0;
|
||||
while (vrb_map_UL[rbStart]) rbStart++;
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
uint16_t rbSize = 1;
|
||||
while (rbStart + rbSize < bwpSize && !vrb_map_UL[rbStart+rbSize])
|
||||
rbSize++;
|
||||
@@ -677,8 +677,8 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
pusch_pdu->handle = 0; //not yet used
|
||||
|
||||
/* FAPI: BWP */
|
||||
pusch_pdu->bwp_size = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pusch_pdu->bwp_start = NRRIV2PRBOFFSET(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
|
||||
pusch_pdu->bwp_size = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->bwp_start = NRRIV2PRBOFFSET(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->subcarrier_spacing = sched_ctrl->active_ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pusch_pdu->cyclic_prefix = 0;
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
#define MAX_IF_MODULES 100
|
||||
|
||||
const char *dl_indication_type[] = {"MIB", "SIB", "DLSCH", "DCI", "RAR"};
|
||||
|
||||
static nr_ue_if_module_t *nr_ue_if_module_inst[MAX_IF_MODULES];
|
||||
|
||||
// L2 Abstraction Layer
|
||||
@@ -66,37 +68,16 @@ int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index,
|
||||
// L2 Abstraction Layer
|
||||
int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci){
|
||||
|
||||
//printf("handle_dci: rnti %x,dci_type %d\n",rnti,dci_type);
|
||||
return nr_ue_process_dci_indication_pdu(module_id, cc_id, gNB_index, frame, slot, dci);
|
||||
|
||||
}
|
||||
// L2 Abstraction Layer
|
||||
int8_t handle_dlsch (module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, uint8_t *pduP, uint32_t pdu_len, frame_t frame, int slot, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment){
|
||||
|
||||
LOG_D(MAC, "handle_dlsch at MAC layer \n");
|
||||
//if (IS_SOFTMODEM_NOS1 || IS_SOFTMODEM_RFSIM)
|
||||
// sdu should be processed even when is S1 mode because data and timing advance updates are transmitted by the UE
|
||||
nr_ue_send_sdu(module_id, cc_id, frame, slot,
|
||||
pduP,
|
||||
pdu_len,
|
||||
gNB_index,
|
||||
ul_time_alignment);
|
||||
// L2 Abstraction Layer
|
||||
// Note: sdu should always be processed because data and timing advance updates are transmitted by the UE
|
||||
int8_t handle_dlsch (nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){
|
||||
|
||||
return 0;
|
||||
/*
|
||||
return nr_ue_process_dlsch(module_id,
|
||||
cc_id,
|
||||
gNB_index,
|
||||
dci_ind,
|
||||
pduP,
|
||||
pdu_len);
|
||||
*/
|
||||
}
|
||||
nr_ue_send_sdu(dl_info, ul_time_alignment, pdu_id);
|
||||
|
||||
int8_t handle_rar (nr_downlink_indication_t *dl_info){
|
||||
|
||||
LOG_D(MAC, "handling RAR at MAC layer \n");
|
||||
nr_process_rar (dl_info);
|
||||
return 0;
|
||||
|
||||
}
|
||||
@@ -165,13 +146,17 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
||||
|
||||
if(dl_info->rx_ind != NULL){
|
||||
|
||||
LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], Number of PDUs: %d \n", dl_info->rx_ind->number_pdus);
|
||||
|
||||
for(i=0; i<dl_info->rx_ind->number_pdus; ++i){
|
||||
|
||||
LOG_D(MAC, "In %s sending DL indication to MAC. 1 PDU type %s of %d total number of PDUs \n",
|
||||
__FUNCTION__,
|
||||
dl_indication_type[dl_info->rx_ind->rx_indication_body[i].pdu_type - 1],
|
||||
dl_info->rx_ind->number_pdus);
|
||||
|
||||
switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){
|
||||
|
||||
case FAPI_NR_RX_PDU_TYPE_MIB:
|
||||
|
||||
ret_mask |= (handle_bcch_bch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.additional_bits,
|
||||
@@ -179,8 +164,6 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_length,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_MIB;
|
||||
|
||||
LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], MIB case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus);
|
||||
|
||||
break;
|
||||
|
||||
case FAPI_NR_RX_PDU_TYPE_SIB:
|
||||
@@ -195,26 +178,18 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
||||
|
||||
case FAPI_NR_RX_PDU_TYPE_DLSCH:
|
||||
|
||||
ret_mask |= (handle_dlsch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
|
||||
dl_info->dci_ind,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->pdsch_pdu.pdu_length,
|
||||
dl_info->frame,
|
||||
dl_info->slot,
|
||||
ul_time_alignment)) << FAPI_NR_RX_PDU_TYPE_DLSCH;
|
||||
|
||||
LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], DLSCH case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus);
|
||||
ret_mask |= (handle_dlsch(dl_info, ul_time_alignment, i)) << FAPI_NR_RX_PDU_TYPE_DLSCH;
|
||||
|
||||
break;
|
||||
|
||||
case FAPI_NR_RX_PDU_TYPE_RAR:
|
||||
|
||||
ret_mask |= (handle_rar(dl_info)) << FAPI_NR_RX_PDU_TYPE_RAR;
|
||||
ret_mask |= (handle_dlsch(dl_info, ul_time_alignment, i)) << FAPI_NR_RX_PDU_TYPE_RAR;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
#include "platform_types.h"
|
||||
|
||||
#include "NR_MAC_UE/mac.h"
|
||||
#include "NR_MAC_COMMON/nr_mac.h"
|
||||
#include "rrc_list.h"
|
||||
#include "NR_asn_constant.h"
|
||||
|
||||
@@ -787,10 +787,10 @@ static void *UE_thread_rxn_txnp4(void *arg)
|
||||
if ( (proc->sub_frame_start+1)%RX_NB_TH == 0 && threads.one != -1 )
|
||||
CPU_SET(threads.one, &cpuset);
|
||||
|
||||
if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.two != -1 )
|
||||
if ( RX_NB_TH > 1 && (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.two != -1 )
|
||||
CPU_SET(threads.two, &cpuset);
|
||||
|
||||
if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.three != -1 )
|
||||
if ( RX_NB_TH > 2 && (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.three != -1 )
|
||||
CPU_SET(threads.three, &cpuset);
|
||||
|
||||
//CPU_SET(threads.three, &cpuset);
|
||||
|
||||
Reference in New Issue
Block a user