Commit 5300c57f authored by francescomani's avatar francescomani

common BWP structure and further improvements

parent e55e880b
......@@ -38,6 +38,8 @@
#include "PHY/defs_common.h"
#define MAX_BWP_SIZE 275
#define NR_MAX_NUM_BWP 4
#define NR_MAX_HARQ_PROCESSES 16
typedef struct nr_bandentry_s {
int16_t band;
......
......@@ -22,6 +22,7 @@
#include "platform_types.h"
#include "fapi_nr_ue_constants.h"
#include "PHY/impl_defs_nr.h"
#include "common/utils/nr/nr_common.h"
#define NFAPI_UE_MAX_NUM_CB 8
#define NFAPI_MAX_NUM_UL_PDU 255
......@@ -91,6 +92,7 @@ typedef struct {
int n_CCE;
// N_CCE is L, or number of CCEs for DCI
int N_CCE;
int cset_start;
uint8_t payloadSize;
uint8_t payloadBits[16] __attribute__((aligned(16))); // will be cast as uint64
} fapi_nr_dci_indication_pdu_t;
......
......@@ -936,6 +936,9 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
dci_ind->dci_list[dci_ind->number_of_dcis].N_CCE = L;
dci_ind->dci_list[dci_ind->number_of_dcis].dci_format = rel15->dci_format_options[k];
dci_ind->dci_list[dci_ind->number_of_dcis].ss_type = rel15->dci_type_options[k];
int n_rb, rb_offset;
get_coreset_rballoc(rel15->coreset.frequency_domain_resource, &n_rb, &rb_offset);
dci_ind->dci_list[dci_ind->number_of_dcis].cset_start = rel15->BWPStart + rb_offset;
dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length;
memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8);
dci_ind->number_of_dcis++;
......
......@@ -80,8 +80,6 @@
#define NR_MAX_DCI_SIZE 1728 //16(L)*2(QPSK)*9(12 RE per REG - 3(DMRS))*6(REG per CCE)
#define NR_MAX_DCI_SIZE_DWORD 54 // ceil(NR_MAX_DCI_SIZE/32)
#define NR_MAX_NUM_BWP 4
#define NR_MAX_PDCCH_AGG_LEVEL 16 // 3GPP TS 38.211 V15.8 Section 7.3.2 Table 7.3.2.1-1: Supported PDCCH aggregation levels
#define NR_MAX_CSET_DURATION 3
......@@ -158,11 +156,6 @@ 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;
......
......@@ -364,11 +364,6 @@ typedef enum {
pusch_dmrs_type2 = 1
} pusch_dmrs_type_t;
typedef enum {
pusch_len1 = 1,
pusch_len2 = 2
} pusch_maxLength_t;
typedef enum {
txConfig_codebook = 1,
txConfig_nonCodebook = 2
......
......@@ -107,6 +107,7 @@
* @}
*/
#include <common/utils/nr/nr_common.h>
#include <common/utils/utils.h>
#include "defs_eNB.h"
#include "types.h"
......@@ -277,8 +278,6 @@
#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 NR_MAX_HARQ_PROCESSES (16)
#define NR_MAX_ULSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 6.1 UE procedure for receiving the physical uplink shared channel */
#define NR_MAX_DLSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 5.1 UE procedure for receiving the physical downlink shared channel */
#endif
......
......@@ -35,15 +35,6 @@
/************** DEFINE ********************************************/
#if 0
/* these define are in file PHY/impl_defs_top.h" because of compilation problems due to multiple header files inclusions */
#define NR_MAX_HARQ_PROCESSES (16)
#define NR_MAX_ULSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* TS 38.214 6.1 UE procedure for receiving the physical uplink shared channel */
#define NR_MAX_DLSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* TS 38.214 5.1 UE procedure for receiving the physical downlink shared channel */
#endif
#define NR_DEFAULT_DLSCH_HARQ_PROCESSES (8) /* TS 38.214 5.1 */
#define DL_ACKNACK_NO_SET (2)
......
......@@ -37,10 +37,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "NR_SubcarrierSpacing.h"
#include "NR_CSI-ReportConfig.h"
#include "openair1/SCHED_NR_UE/harq_nr.h"
#include "common/utils/nr/nr_common.h"
#include "NR_CellGroupConfig.h"
#define NR_SHORT_BSR_TABLE_SIZE 32
#define NR_LONG_BSR_TABLE_SIZE 256
......@@ -567,5 +565,43 @@ typedef struct nr_srs_feedback {
uint8_t tpmi;
} nr_srs_feedback_t;
typedef struct NR_UE_DL_BWP {
NR_BWP_Id_t bwp_id;
int n_dl_bwp;
int scs;
long *cyclicprefix;
uint16_t BWPSize;
uint16_t BWPStart;
uint16_t initial_BWPSize;
uint16_t initial_BWPStart;
NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList;
NR_PDSCH_Config_t *pdsch_Config;
NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig;
uint8_t mcsTableIdx;
nr_dci_format_t dci_format;
} NR_UE_DL_BWP_t;
typedef struct NR_UE_UL_BWP {
NR_BWP_Id_t bwp_id;
int n_ul_bwp;
int scs;
long *cyclicprefix;
uint16_t BWPSize;
uint16_t BWPStart;
uint16_t initial_BWPSize;
uint16_t initial_BWPStart;
NR_PUSCH_ServingCellConfig_t *pusch_servingcellconfig;
NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList;
NR_PUSCH_Config_t *pusch_Config;
NR_PUCCH_Config_t *pucch_Config;
NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon;
NR_CSI_MeasConfig_t *csi_MeasConfig;
NR_SRS_Config_t *srs_Config;
uint8_t transform_precoding;
uint8_t mcs_table;
nr_dci_format_t dci_format;
int max_fb_time;
} NR_UE_UL_BWP_t;
#endif /*__LAYER2_MAC_H__ */
......@@ -3157,13 +3157,16 @@ uint16_t get_rb_bwp_dci(nr_dci_format_t format,
uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP,
const NR_BWP_UplinkCommon_t *initialUplinkBWP,
const NR_UE_DL_BWP_t *DL_BWP,
const NR_UE_UL_BWP_t *UL_BWP,
const NR_CellGroupConfig_t *cg,
dci_pdu_rel15_t *dci_pdu,
nr_dci_format_t format,
nr_rnti_type_t rnti_type,
int controlResourceSetId,
int bwp_id,
uint16_t N_RB,
int ss_type,
uint16_t cset0_bwp_size,
uint16_t alt_size)
{
......@@ -3210,6 +3213,16 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP,
srs_config = (ubwpd && ubwpd->srs_Config) ? ubwpd->srs_Config->choice.setup: NULL;
}
uint16_t N_RB = cset0_bwp_size;
if (DL_BWP)
N_RB = get_rb_bwp_dci(format,
ss_type,
cset0_bwp_size,
UL_BWP->BWPSize,
DL_BWP->BWPSize,
UL_BWP->initial_BWPSize,
DL_BWP->initial_BWPSize);
int n_ul_bwp = 1,n_dl_bwp = 1;
switch(format) {
case NR_UL_DCI_FORMAT_0_0:
......@@ -3219,7 +3232,7 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP,
size += dci_pdu->frequency_domain_assignment.nbits;
if(alt_size >= size)
size += alt_size - size; // Padding to match 1_0 size
else {
else if (ss_type == NR_SearchSpace__searchSpaceType_PR_common) {
dci_pdu->frequency_domain_assignment.nbits -= (size - alt_size);
size = alt_size;
}
......@@ -3255,9 +3268,7 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP,
rbg_size_config = 1;
else
rbg_size_config = 0;
numRBG = getNRBG(NRRIV2BW(ubwpc->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
NRRIV2PRBOFFSET(ubwpc->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
rbg_size_config);
numRBG = getNRBG(UL_BWP->BWPSize, UL_BWP->BWPStart, rbg_size_config);
if (pusch_Config->resourceAllocation == 0)
dci_pdu->frequency_domain_assignment.nbits = numRBG;
else if (pusch_Config->resourceAllocation == 1)
......@@ -3383,9 +3394,10 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP,
// Size of DCI format 1_0 is given by the size of CORESET 0 if CORESET 0 is configured for the cell and the size
// of initial DL bandwidth part if CORESET 0 is not configured for the cell
size = 28;
size += (uint8_t)ceil(log2((N_RB * (N_RB + 1)) >> 1)); // Freq domain assignment
dci_pdu->frequency_domain_assignment.nbits = (int)ceil(log2((N_RB * (N_RB + 1)) >> 1));
dci_pdu->frequency_domain_assignment.nbits = (uint8_t)ceil(log2((N_RB * (N_RB + 1)) >> 1)); // Freq domain assignment
size += dci_pdu->frequency_domain_assignment.nbits;
if(ss_type == NR_SearchSpace__searchSpaceType_PR_ue_Specific && alt_size >= size)
size += alt_size - size; // Padding to match 0_0 size
dci_pdu->time_domain_assignment.nbits = 4;
dci_pdu->vrb_to_prb_mapping.nbits = 1;
break;
......@@ -3414,9 +3426,7 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP,
if (pdsch_Config) rbg_size_config = pdsch_Config->rbg_Size;
else rbg_size_config = 0;
numRBG = getNRBG(NRRIV2BW(bwpc->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
NRRIV2PRBOFFSET(bwpc->genericParameters.locationAndBandwidth, MAX_BWP_SIZE),
rbg_size_config);
numRBG = getNRBG(DL_BWP->BWPSize, DL_BWP->BWPStart, rbg_size_config);
if (pdsch_Config && pdsch_Config->resourceAllocation == 0)
dci_pdu->frequency_domain_assignment.nbits = numRBG;
else if (pdsch_Config == NULL || pdsch_Config->resourceAllocation == 1)
......
......@@ -43,6 +43,11 @@ typedef enum {
pusch_dmrs_pos3 = 3,
} pusch_dmrs_AdditionalPosition_t;
typedef enum {
pusch_len1 = 1,
pusch_len2 = 2
} pusch_maxLength_t;
typedef enum {
typeA = 0,
typeB = 1
......@@ -77,13 +82,16 @@ uint8_t compute_precoding_information(NR_PUSCH_Config_t *pusch_Config,
uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDownlinkBWP,
const NR_BWP_UplinkCommon_t *initialUplinkBWP,
const NR_UE_DL_BWP_t *DL_BWP,
const NR_UE_UL_BWP_t *UL_BWP,
const NR_CellGroupConfig_t *cg,
dci_pdu_rel15_t *dci_pdu,
nr_dci_format_t format,
nr_rnti_type_t rnti_type,
int controlResourceSetId,
int bwp_id,
uint16_t N_RB,
int ss_type,
uint16_t cset0_bwp_size,
uint16_t alt_size);
uint16_t get_rb_bwp_dci(nr_dci_format_t format,
......
......@@ -543,17 +543,19 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
NR_ServingCellConfigCommonSIB_t *scc,
NR_CellGroupConfig_t *cell_group_config)
{
NR_DL_BWP_t *DL_BWP = &mac->current_DL_BWP;
NR_UL_BWP_t *UL_BWP = &mac->current_UL_BWP;
NR_UE_DL_BWP_t *DL_BWP = &mac->current_DL_BWP;
NR_UE_UL_BWP_t *UL_BWP = &mac->current_UL_BWP;
NR_BWP_t dl_genericParameters = {0};
NR_BWP_t ul_genericParameters = {0};
if(scc) {
DL_BWP->bwp_id = 0;
UL_BWP->bwp_id = 0;
DL_BWP->genericParameters = scc->downlinkConfigCommon.initialDownlinkBWP.genericParameters;
dl_genericParameters = scc->downlinkConfigCommon.initialDownlinkBWP.genericParameters;
if(scc->uplinkConfigCommon)
UL_BWP->genericParameters = scc->uplinkConfigCommon->initialUplinkBWP.genericParameters;
ul_genericParameters = scc->uplinkConfigCommon->initialUplinkBWP.genericParameters;
else
UL_BWP->genericParameters = scc->downlinkConfigCommon.initialDownlinkBWP.genericParameters;
ul_genericParameters = scc->downlinkConfigCommon.initialDownlinkBWP.genericParameters;
}
if(cell_group_config) {
if (cell_group_config->spCellConfig &&
......@@ -573,14 +575,14 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
break;
}
AssertFatal(bwp_downlink != NULL,"Couldn't find DLBWP corresponding to BWP ID %ld\n", DL_BWP->bwp_id);
DL_BWP->genericParameters = bwp_downlink->bwp_Common->genericParameters;
dl_genericParameters = bwp_downlink->bwp_Common->genericParameters;
}
else {
if(mac->scc) {
DL_BWP->genericParameters = mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
dl_genericParameters = mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
}
if(mac->scc_SIB) {
DL_BWP->genericParameters = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters;
dl_genericParameters = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters;
}
}
NR_BWP_Uplink_t *bwp_uplink = NULL;
......@@ -592,14 +594,14 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
break;
}
AssertFatal(bwp_uplink != NULL,"Couldn't find ULBWP corresponding to BWP ID %ld\n",UL_BWP->bwp_id);
UL_BWP->genericParameters = bwp_uplink->bwp_Common->genericParameters;
ul_genericParameters = bwp_uplink->bwp_Common->genericParameters;
}
else {
if(mac->scc) {
UL_BWP->genericParameters = mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
ul_genericParameters = mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
}
if(mac->scc_SIB) {
UL_BWP->genericParameters = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters;
ul_genericParameters = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters;
}
}
}
......@@ -607,14 +609,14 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
AssertFatal(1==0,"We shouldn't end here in configuring BWP\n");
}
DL_BWP->scs = DL_BWP->genericParameters.subcarrierSpacing;
DL_BWP->cyclicprefix = DL_BWP->genericParameters.cyclicPrefix;
DL_BWP->BWPSize = NRRIV2BW(DL_BWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
DL_BWP->BWPStart = NRRIV2PRBOFFSET(DL_BWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
UL_BWP->scs = UL_BWP->genericParameters.subcarrierSpacing;
UL_BWP->cyclicprefix = UL_BWP->genericParameters.cyclicPrefix;
UL_BWP->BWPSize = NRRIV2BW(UL_BWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
UL_BWP->BWPStart = NRRIV2PRBOFFSET(UL_BWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
DL_BWP->scs = dl_genericParameters.subcarrierSpacing;
DL_BWP->cyclicprefix = dl_genericParameters.cyclicPrefix;
DL_BWP->BWPSize = NRRIV2BW(dl_genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
DL_BWP->BWPStart = NRRIV2PRBOFFSET(dl_genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
UL_BWP->scs = ul_genericParameters.subcarrierSpacing;
UL_BWP->cyclicprefix = ul_genericParameters.cyclicPrefix;
UL_BWP->BWPSize = NRRIV2BW(ul_genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
UL_BWP->BWPStart = NRRIV2PRBOFFSET(ul_genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
DL_BWP->initial_BWPSize = mac->scc ? NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) :
NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
......
......@@ -164,6 +164,11 @@ typedef enum {
UE_PHY_HO_PRACH
} NR_UE_L2_STATE_t;
typedef enum {
RA_2STEP = 0,
RA_4STEP
} nr_ra_type_e;
// LTE structure, might need to be adapted for NR
typedef struct {
/// buffer status for each lcgid
......@@ -372,28 +377,6 @@ typedef struct {
} NR_PHY_meas_t;
typedef struct NR_DL_BWP {
NR_BWP_Id_t bwp_id;
NR_BWP_t genericParameters;
int scs;
long *cyclicprefix;
uint16_t initial_BWPSize;
uint16_t initial_BWPStart;
uint16_t BWPSize;
uint16_t BWPStart;
} NR_DL_BWP_t;
typedef struct NR_UL_BWP {
NR_BWP_Id_t bwp_id;
NR_BWP_t genericParameters;
int scs;
long *cyclicprefix;
uint16_t initial_BWPSize;
uint16_t initial_BWPStart;
uint16_t BWPSize;
uint16_t BWPStart;
} NR_UL_BWP_t;
/*!\brief Top level UE MAC structure */
typedef struct {
......@@ -414,8 +397,8 @@ typedef struct {
NR_RNTI_Value_t *cs_RNTI;
NR_MIB_t *mib;
NR_DL_BWP_t current_DL_BWP;
NR_UL_BWP_t current_UL_BWP;
NR_UE_DL_BWP_t current_DL_BWP;
NR_UE_UL_BWP_t current_UL_BWP;
NR_BWP_Downlink_t *DLbwp[MAX_NUM_BWP_UE];
NR_BWP_Uplink_t *ULbwp[MAX_NUM_BWP_UE];
......
......@@ -815,7 +815,7 @@ uint8_t nr_ue_get_rach(module_id_t mod_id,
} else if (get_softmodem_params()->nsa) {
uint8_t mac_sdus[MAX_NUM_NR_ULSCH_SEGMENTS_PER_LAYER*1056];
uint8_t mac_sdus[34*1056];
uint16_t sdu_lengths[NB_RB_MAX] = {0};
int TBS_bytes = 848;
int mac_ce_len = 0;
......
......@@ -95,9 +95,9 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
AssertFatal(mac->scc == NULL || mac->scc_SIB == NULL, "both scc and scc_SIB cannot be non-null\n");
NR_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t dl_bwp_id = current_DL_BWP->bwp_id;
NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t dl_bwp_id = current_DL_BWP ? current_DL_BWP->bwp_id : 0;
NR_ServingCellConfigCommon_t *scc = mac->scc;
NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB;
NR_BWP_DownlinkCommon_t *initialDownlinkBWP=NULL;
......@@ -164,50 +164,37 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
rel15->coreset.scrambling_rnti = 0;
}
// loop over RNTI type and configure resource allocation for DCI
int N_RB;
for (int i = 0; i < rel15->num_dci_options; i++) {
rel15->dci_type_options[i] = ss->searchSpaceType->present;
const int dci_format = rel15->dci_format_options[i];
uint16_t alt_size = 0;
if(current_DL_BWP) {
N_RB = get_rb_bwp_dci(dci_format,
ss->searchSpaceType->present,
mac->type0_PDCCH_CSS_config.num_rbs,
current_UL_BWP->BWPSize,
current_DL_BWP->BWPSize,
current_UL_BWP->initial_BWPSize,
current_DL_BWP->initial_BWPSize);
// computing alternative size for padding
uint16_t alt_rb;
dci_pdu_rel15_t temp_pdu;
if(dci_format == NR_DL_DCI_FORMAT_1_0) {
alt_rb = get_rb_bwp_dci(NR_UL_DCI_FORMAT_0_0,
ss->searchSpaceType->present,
mac->type0_PDCCH_CSS_config.num_rbs,
current_UL_BWP->BWPSize,
current_DL_BWP->BWPSize,
current_UL_BWP->initial_BWPSize,
current_DL_BWP->initial_BWPSize);
alt_size = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &temp_pdu,
NR_UL_DCI_FORMAT_0_0, rnti_type, coreset_id, dl_bwp_id, alt_rb, 0);
}
if(dci_format == NR_UL_DCI_FORMAT_0_0) {
alt_rb = get_rb_bwp_dci(NR_DL_DCI_FORMAT_1_0,
ss->searchSpaceType->present,
mac->type0_PDCCH_CSS_config.num_rbs,
current_UL_BWP->BWPSize,
current_DL_BWP->BWPSize,
current_UL_BWP->initial_BWPSize,
current_DL_BWP->initial_BWPSize);
alt_size = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg, &temp_pdu,
NR_DL_DCI_FORMAT_1_0, rnti_type, coreset_id, dl_bwp_id, alt_rb, 0);
if(dci_format == NR_DL_DCI_FORMAT_1_0)
alt_size = nr_dci_size(initialDownlinkBWP,initialUplinkBWP,
current_DL_BWP, current_UL_BWP,
mac->cg, &temp_pdu,
NR_UL_DCI_FORMAT_0_0, rnti_type, coreset_id, dl_bwp_id,
ss->searchSpaceType->present, mac->type0_PDCCH_CSS_config.num_rbs, 0);
if(dci_format == NR_UL_DCI_FORMAT_0_0)
alt_size = nr_dci_size(initialDownlinkBWP,initialUplinkBWP,
current_DL_BWP, current_UL_BWP,
mac->cg, &temp_pdu,
NR_DL_DCI_FORMAT_1_0, rnti_type, coreset_id, dl_bwp_id,
ss->searchSpaceType->present, mac->type0_PDCCH_CSS_config.num_rbs, 0);
}
}
else
N_RB = mac->type0_PDCCH_CSS_config.num_rbs;
rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP,
current_DL_BWP, current_UL_BWP,
mac->cg, &mac->def_dci_pdu_rel15[dci_format],
dci_format, NR_RNTI_TC, coreset_id, dl_bwp_id,
ss->searchSpaceType->present, mac->type0_PDCCH_CSS_config.num_rbs, alt_size);
rel15->BWPStart = coreset_id == 0 ? mac->type0_PDCCH_CSS_config.cset_start_rb : current_DL_BWP->BWPStart;
rel15->BWPSize = coreset_id == 0 ? mac->type0_PDCCH_CSS_config.num_rbs : current_DL_BWP->BWPSize;
switch(rnti_type) {
case NR_RNTI_C:
// we use DL BWP dedicated
......@@ -215,29 +202,14 @@ 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 = current_DL_BWP->BWPSize;
rel15->BWPStart = current_DL_BWP->BWPStart;
rel15->SubcarrierSpacing = current_DL_BWP->scs;
rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg,
&mac->def_dci_pdu_rel15[dci_format],
dci_format, NR_RNTI_C, coreset_id, dl_bwp_id, N_RB, alt_size);
break;
case NR_RNTI_RA:
// we use the initial DL BWP
sps = current_DL_BWP->cyclicprefix == NULL ? 14 : 12;
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = mac->ra.ra_rnti;
if (get_softmodem_params()->sa) {
rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
} else { // NSA mode is not using the Initial BWP
rel15->BWPSize = current_DL_BWP->initial_BWPSize;
rel15->BWPStart = current_DL_BWP->BWPStart;
}
rel15->SubcarrierSpacing = current_DL_BWP->scs;
rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg,
&mac->def_dci_pdu_rel15[dci_format],
dci_format, NR_RNTI_RA, coreset_id, dl_bwp_id, N_RB, alt_size);
break;
case NR_RNTI_P:
break;
......@@ -248,12 +220,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
sps = current_DL_BWP->cyclicprefix == NULL ? 14 : 12;
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = mac->ra.t_crnti;
rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
rel15->SubcarrierSpacing = current_DL_BWP->scs;
rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP,
mac->cg, &mac->def_dci_pdu_rel15[dci_format],
dci_format, NR_RNTI_TC, coreset_id, dl_bwp_id, N_RB, alt_size);
break;
case NR_RNTI_SP_CSI:
break;
......@@ -263,17 +230,11 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values
rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
if(mac->frequency_range == FR1)
rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
else
rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2;
rel15->dci_length_options[i] = nr_dci_size(initialDownlinkBWP,initialUplinkBWP, mac->cg,
&mac->def_dci_pdu_rel15[dci_format],
dci_format, NR_RNTI_SI, coreset_id, 0, mac->type0_PDCCH_CSS_config.num_rbs, alt_size);
break;
case NR_RNTI_SFI:
break;
......
......@@ -50,6 +50,7 @@
/* PHY */
#include "executables/softmodem-common.h"
#include "openair1/PHY/defs_nr_UE.h"
/* utils */
#include "assertions.h"
......@@ -642,8 +643,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
RA_config_t *ra = &mac->ra;
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
uint8_t is_Msg3 = 0;
NR_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t dl_bwp_id = current_DL_BWP->bwp_id;
NR_BWP_Id_t ul_bwp_id = current_UL_BWP->bwp_id;
int default_abc = 1;
......@@ -816,15 +817,22 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
NR_PDSCH_Config_t *pdsch_config= (dl_bwp_id>0 && mac->DLbwp[dl_bwp_id-1]) ? mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup : NULL;
int is_common=0;
if (dci_ind->ss_type == NR_SearchSpace__searchSpaceType_PR_common) {
dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs ? mac->type0_PDCCH_CSS_config.num_rbs : current_DL_BWP->initial_BWPSize;
dlsch_config_pdu_1_0->BWPStart = dci_ind->cset_start;
}
else {
dlsch_config_pdu_1_0->BWPSize = current_DL_BWP->BWPSize;
dlsch_config_pdu_1_0->BWPStart = current_DL_BWP->BWPStart;
}
if(rnti == SI_RNTI) {
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config = mac->type0_PDCCH_CSS_config;
default_abc = type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH;
dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
if (pdsch_config) pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2'
} else {
dlsch_config_pdu_1_0->SubcarrierSpacing = current_DL_BWP->scs;
if (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti){
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH;
} else {
......@@ -832,35 +840,16 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
}
if( (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti) || (rnti == ra->t_crnti) ) {
if (mac->scc == NULL) { // use coreset0
dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
is_common=1;
}
else {
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
}
if (!get_softmodem_params()->sa) { // NSA mode is not using the Initial BWP
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
pdsch_config = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup;
}
} else if (dl_bwp_id>0 && mac->DLbwp[dl_bwp_id-1]) {
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[dl_bwp_id-1]->bwp_Common->genericParameters.subcarrierSpacing;
pdsch_config = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup;
} else if (mac->scc) {
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing;
pdsch_config = NULL;
} else if (mac->scc_SIB) {
dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing;
} else if (mac->scc)
pdsch_config = NULL;
}
}
/* IDENTIFIER_DCI_FORMATS */
/* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */
......@@ -1504,7 +1493,7 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
int O_CRC = 0; //FIXME
uint16_t O_uci = O_CSI + O_ACK;
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t bwp_id = current_UL_BWP->bwp_id;
NR_PUCCH_FormatConfig_t *pucchfmt;
long *pusch_id = NULL;
......@@ -1564,7 +1553,7 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
mac->cg->physicalCellGroupConfig &&
(mac->cg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL ||
mac->cg->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook != 1)) {
LOG_E(MAC,"PUCCH Unsupported cell group configuration : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
LOG_E(MAC,"PUCCH Unsupported cell group configuration\n");
return;
}
else if (mac->cg &&
......@@ -1573,7 +1562,7 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig &&
mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup &&
mac->cg->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup->codeBlockGroupTransmission != NULL) {
LOG_E(MAC,"PUCCH Unsupported code block group for serving cell config : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
LOG_E(MAC,"PUCCH Unsupported code block group for serving cell config\n");
return;
}
NR_PUCCH_Config_t *pucch_Config;
......@@ -1611,7 +1600,7 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
pucch_pdu->prb_size = 1; // format 0 or 1
if ((O_SR+O_CSI+O_SR) > (sizeof(uint64_t)*8)) {
LOG_E(MAC,"PUCCH number of UCI bits exceeds payload size : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
LOG_E(MAC,"PUCCH number of UCI bits exceeds payload size\n");
return;
}
pucch_pdu->payload = (pucch->csi_part1_payload << (O_ACK + O_SR)) | (pucch->sr_payload << O_ACK) | pucch->ack_payload;
......@@ -1783,7 +1772,7 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
int16_t G_b_f_c = 0;
if (pucch_Config->spatialRelationInfoToAddModList != NULL) { /* FFS TODO NR */
LOG_D(MAC,"PUCCH Spatial relation infos are not yet implemented : at line %d in function %s of file %s \n", LINE_FILE , __func__, __FILE__);
LOG_D(MAC,"PUCCH Spatial relation infos are not yet implemented\n");
return (PUCCH_POWER_DEFAULT);
}
......@@ -1793,7 +1782,7 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
}
else {
G_b_f_c = pucch->delta_pucch;
LOG_D(MAC,"PUCCH Transmit power control command not yet implemented for NR : at line %d in function %s of file %s \n", LINE_FILE , __func__, __FILE__);
LOG_E(MAC,"PUCCH Transmit power control command not yet implemented for NR\n");
return (PUCCH_POWER_DEFAULT);
}
......@@ -1854,13 +1843,13 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
break;
default:
{
LOG_E(MAC,"PUCCH unknown pucch format : at line %d in function %s of file %s \n", LINE_FILE , __func__, __FILE__);
LOG_E(MAC,"PUCCH unknown pucch format %d\n", format_type);
return (0);
}
}
if (*power_config->twoPUCCH_PC_AdjustmentStates > 1) {
LOG_E(MAC,"PUCCH power control adjustment states with 2 states not yet implemented : at line %d in function %s of file %s \n", LINE_FILE , __func__, __FILE__);
LOG_E(MAC,"PUCCH power control adjustment states with 2 states not yet implemented\n");
return (PUCCH_POWER_DEFAULT);
}
......@@ -1869,7 +1858,7 @@ int16_t get_pucch_tx_power_ue(NR_UE_MAC_INST_t *mac,
int16_t pucch_power = P_O_PUCCH + M_pucch_component + pathloss + delta_F_PUCCH + DELTA_TF + G_b_f_c;
NR_TST_PHY_PRINTF("PUCCH ( Tx power : %d dBm ) ( 10Log(...) : %d ) ( from Path Loss : %d ) ( delta_F_PUCCH : %d ) ( DELTA_TF : %d ) ( G_b_f_c : %d ) \n",
LOG_D(MAC, "PUCCH ( Tx power : %d dBm ) ( 10Log(...) : %d ) ( from Path Loss : %d ) ( delta_F_PUCCH : %d ) ( DELTA_TF : %d ) ( G_b_f_c : %d ) \n",
pucch_power, M_pucch_component, pathloss, delta_F_PUCCH, DELTA_TF, G_b_f_c);
return (pucch_power);
......@@ -2017,7 +2006,7 @@ void select_pucch_resource(NR_UE_MAC_INST_t *mac,
int n_CCE_0 = pucch->n_CCE;
int N_CCE_0 = pucch->N_CCE;
if (N_CCE_0 == 0) {
AssertFatal(1==0,"PUCCH No compatible pucch format found : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
AssertFatal(1==0,"PUCCH No compatible pucch format found\n");
}
int r_PUCCH = ((2 * n_CCE_0)/N_CCE_0) + (2 * delta_PRI);
pucch->initial_pucch_id = r_PUCCH;
......@@ -2114,8 +2103,8 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
int sched_frame,sched_slot;
int slots_per_frame;
NR_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t dl_bwp_id = current_DL_BWP->bwp_id;
NR_BWP_Id_t ul_bwp_id = current_UL_BWP->bwp_id;
NR_BWP_DownlinkDedicated_t *bwpd=NULL;
......@@ -2164,7 +2153,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
}
if (current_harq->dai > NR_DL_MAX_DAI) {
LOG_E(MAC,"PUCCH Downlink DAI has an invalid value : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
LOG_E(MAC,"PUCCH Downlink DAI has an invalid value of %d\n", current_harq->dai);
}
else {
......@@ -2175,7 +2164,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
dai_current = current_harq->dai+1; // DCI DAI to counter DAI conversion
if (dai_current == 0) {
LOG_E(MAC,"PUCCH Downlink dai is invalid : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
LOG_E(MAC,"PUCCH Downlink dai is invalid\n");
return(0);
} else if (dai_current > dai_max) {
dai_max = dai_current;
......@@ -2209,7 +2198,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
return(0);
}
else if (number_harq_feedback > (sizeof(uint32_t)*8)) {
LOG_E(MAC,"PUCCH number of ack bits exceeds payload size : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
LOG_E(MAC,"PUCCH number of ack bits exceeds payload size\n");
return(0);
}
......@@ -2223,7 +2212,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
mac->cg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL) {
int N_TB_max_DL = bwpd->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0];
pucch->n_HARQ_ACK = (((V_DAI_m_DL - U_DAI_c)%4) * N_TB_max_DL) + N_m_c_rx + N_SPS_c;
NR_TST_PHY_PRINTF("PUCCH power n(%d) = ( V(%d) - U(%d) )mod4 * N_TB(%d) + N(%d) \n", pucch->n_HARQ_ACK, V_DAI_m_DL, U_DAI_c, N_TB_max_DL, N_m_c_rx);
LOG_D(MAC, "PUCCH power n(%d) = ( V(%d) - U(%d) )mod4 * N_TB(%d) + N(%d) \n", pucch->n_HARQ_ACK, V_DAI_m_DL, U_DAI_c, N_TB_max_DL, N_m_c_rx);
}
/*
......@@ -2295,7 +2284,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
}
if (number_harq_feedback != O_ACK) {
LOG_E(MAC,"PUCCH Error for number of bits for acknowledgment : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
LOG_E(MAC,"PUCCH Error for number of bits for acknowledgment\n");
return (0);
}
......@@ -2313,7 +2302,7 @@ bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac,
frame_t frame,
int slot) {
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t bwp_id = current_UL_BWP->bwp_id;
NR_PUCCH_Config_t *pucch_Config = NULL;
......@@ -2426,7 +2415,7 @@ uint8_t nr_get_csi_measurements(NR_UE_MAC_INST_t *mac,
int slot,
PUCCH_sched_t *pucch) {
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t bwp_id = current_UL_BWP->bwp_id;
NR_PUCCH_Config_t *pucch_Config = NULL;
int csi_bits = 0;
......@@ -2805,8 +2794,8 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
int pos = 0;
int fsize = 0;
int rnti_type = get_rnti_type(mac, rnti);
NR_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
int N_RB;
if(current_DL_BWP)
N_RB = get_rb_bwp_dci(dci_format,
......
......@@ -540,7 +540,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
dci_pdu_rel15_t *dci,
RAR_grant_t *rar_grant,
uint16_t rnti,
uint8_t *dci_format){
uint8_t *dci_format)
{
int f_alloc;
int mask;
......@@ -553,7 +554,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
int N_PRB_oh = 0;
int rnti_type = get_rnti_type(mac, rnti);
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t ul_bwp_id = current_UL_BWP->bwp_id;
// Common configuration
......@@ -935,7 +936,7 @@ bool nr_ue_periodic_srs_scheduling(module_id_t mod_id, frame_t frame, slot_t slo
bool srs_scheduled = false;
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t ul_bwp_id = current_UL_BWP->bwp_id;
NR_SRS_Config_t *srs_config = NULL;
......@@ -1567,7 +1568,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac,
uint8_t tda_id){
int delta = 0;
NR_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP;
NR_BWP_Id_t ul_bwp_id = current_UL_BWP->bwp_id;
// Get the numerology to calculate the Tx frame and slot
......@@ -2405,7 +2406,7 @@ void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot) {
NR_CSI_IM_Resource_t *imcsi;
int period, offset;
NR_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
int mu = current_DL_BWP->scs;
uint16_t bwp_size = current_DL_BWP->BWPSize;
uint16_t bwp_start = current_DL_BWP->BWPStart;
......@@ -2462,7 +2463,7 @@ void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot) {
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
NR_NZP_CSI_RS_Resource_t *nzpcsi;
int period, offset;
NR_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP;
NR_BWP_Id_t dl_bwp_id = current_DL_BWP->bwp_id;
int mu = current_DL_BWP->scs;
......
......@@ -1151,7 +1151,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
long BWPStart = 0;
long BWPSize = 0;
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = NULL;
if(*ss->controlResourceSetId!=0) {
if(*ss->controlResourceSetId != 0) {
BWPStart = dl_bwp->BWPStart;
BWPSize = dl_bwp->initial_BWPSize;
} else {
......
......@@ -1412,39 +1412,30 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
current_DL_BWP->initial_BWPSize);
// computing alternative size for padding
uint16_t alt_rb;
dci_pdu_rel15_t temp_pdu;
if(dci_format == NR_DL_DCI_FORMAT_1_0) {
alt_rb = get_rb_bwp_dci(NR_UL_DCI_FORMAT_0_0,
ss->searchSpaceType->present,
cset0_bwp_size,
current_UL_BWP->BWPSize,
current_DL_BWP->BWPSize,
current_UL_BWP->initial_BWPSize,
current_DL_BWP->initial_BWPSize);
if(dci_format == NR_DL_DCI_FORMAT_1_0)
alt_size = nr_dci_size(scc->downlinkConfigCommon->initialDownlinkBWP,
scc->uplinkConfigCommon->initialUplinkBWP,
CellGroup, &temp_pdu, NR_UL_DCI_FORMAT_0_0, rnti_type, controlResourceSetId, bwp_id, alt_rb, 0);
current_DL_BWP, current_UL_BWP,
CellGroup, &temp_pdu, NR_UL_DCI_FORMAT_0_0, rnti_type,
controlResourceSetId, bwp_id, ss->searchSpaceType->present, cset0_bwp_size, 0);
}
if(dci_format == NR_UL_DCI_FORMAT_0_0) {
alt_rb = get_rb_bwp_dci(NR_DL_DCI_FORMAT_1_0,
ss->searchSpaceType->present,
cset0_bwp_size,
current_UL_BWP->BWPSize,
current_DL_BWP->BWPSize,
current_UL_BWP->initial_BWPSize,
current_DL_BWP->initial_BWPSize);
if(dci_format == NR_UL_DCI_FORMAT_0_0)
alt_size = nr_dci_size(scc->downlinkConfigCommon->initialDownlinkBWP,
scc->uplinkConfigCommon->initialUplinkBWP,
CellGroup, &temp_pdu, NR_DL_DCI_FORMAT_1_0, rnti_type, controlResourceSetId, bwp_id, alt_rb, 0);
}
current_DL_BWP, current_UL_BWP,
CellGroup, &temp_pdu, NR_DL_DCI_FORMAT_1_0, rnti_type,
controlResourceSetId, bwp_id, ss->searchSpaceType->present, cset0_bwp_size, 0);
}
else
N_RB = cset0_bwp_size;
int dci_size = nr_dci_size(scc->downlinkConfigCommon->initialDownlinkBWP,
scc->uplinkConfigCommon->initialUplinkBWP,
CellGroup, dci_pdu_rel15, dci_format, rnti_type, controlResourceSetId, bwp_id, N_RB, alt_size);
current_DL_BWP, current_UL_BWP,
CellGroup, dci_pdu_rel15, dci_format, rnti_type, controlResourceSetId,
bwp_id, ss->searchSpaceType->present, cset0_bwp_size, alt_size);
pdcch_dci_pdu->PayloadSizeBits = dci_size;
AssertFatal(dci_size <= 64, "DCI sizes above 64 bits not yet supported");
if (dci_format == NR_DL_DCI_FORMAT_1_1 || dci_format == NR_UL_DCI_FORMAT_0_1)
......
......@@ -92,44 +92,6 @@ typedef struct {
int len;
} NR_list_t;
typedef struct NR_UE_DL_BWP {
NR_BWP_Id_t bwp_id;
int n_dl_bwp;
int scs;
long *cyclicprefix;
uint16_t BWPSize;
uint16_t BWPStart;
uint16_t initial_BWPSize;
uint16_t initial_BWPStart;
NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList;
NR_PDSCH_Config_t *pdsch_Config;
NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig;
uint8_t mcsTableIdx;
nr_dci_format_t dci_format;
} NR_UE_DL_BWP_t;
typedef struct NR_UE_UL_BWP {
NR_BWP_Id_t bwp_id;
int n_ul_bwp;
int scs;
long *cyclicprefix;
uint16_t BWPSize;
uint16_t BWPStart;
uint16_t initial_BWPSize;
uint16_t initial_BWPStart;
NR_PUSCH_ServingCellConfig_t *pusch_servingcellconfig;
NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList;
NR_PUSCH_Config_t *pusch_Config;
NR_PUCCH_Config_t *pucch_Config;
NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon;
NR_CSI_MeasConfig_t *csi_MeasConfig;
NR_SRS_Config_t *srs_Config;
uint8_t transform_precoding;
uint8_t mcs_table;
nr_dci_format_t dci_format;
int max_fb_time;
} NR_UE_UL_BWP_t;
typedef enum {
RA_IDLE = 0,
Msg2 = 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment