Commit a5af0163 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge remote-tracking branch 'origin/develop-nr_cppcheck' into integration_develop-nr_2019w42

parents f26373c5 954e6c64
......@@ -20,15 +20,14 @@
*/
#ifndef __MAC_RRC_PRIMITIVES_H__
# define __MAC_RRC_PRIMITIVES_H__
#define __MAC_RRC_PRIMITIVES_H__
#ifndef OPENAIR2_IN
#include "LAYER2/RLC/rlc.h"
#endif
#include "COMMON/platform_types.h"
#include "COMMON/platform_constants.h"
#include "openair2/RRC/LTE/rrc_defs.h"
#include "LTE_RadioResourceConfigCommonSIB.h"
#include "LTE_RadioResourceConfigDedicated.h"
......@@ -398,5 +397,3 @@ typedef struct {
#define REMOVE_LC 1
#endif
......@@ -429,9 +429,9 @@ typedef struct NRRrcConfigurationReq_s {
long DL_absoluteFrequencyPointA[MAX_NUM_CCs];
//NR DL SCS-SpecificCarrier
uint32_t DL_offsetToCarrier[MAX_NUM_CCs];
long DL_offsetToCarrier[MAX_NUM_CCs];
long DL_SCS_SubcarrierSpacing[MAX_NUM_CCs];
uint32_t DL_carrierBandwidth[MAX_NUM_CCs];
long DL_carrierBandwidth[MAX_NUM_CCs];
//NR BWP-DownlinkCommon
uint32_t DL_locationAndBandwidth[MAX_NUM_CCs];
......
......@@ -200,6 +200,7 @@ schedule_SIB1_MBMS(module_id_t module_idP,
// Note: definition of k above and rvidx from 36.321 section 5.3.1
rvidx = (((3 * k) >> 1) + (k & 1)) & 3;
i = cc->SIB1_BR_cnt & (m - 1);
if(Sj)
n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB];
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case
AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19,
......@@ -429,6 +430,7 @@ schedule_SIB1_BR(module_id_t module_idP,
// Note: definition of k above and rvidx from 36.321 section 5.3.1
rvidx = (((3 * k) >> 1) + (k & 1)) & 3;
i = cc->SIB1_BR_cnt & (m - 1);
if(Sj)
n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB];
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 0xFFFF, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case
AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19,
......@@ -595,7 +597,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
long si_Narrowband_r13 = schedulingInfoList_BR_r13->list.array[i]->si_Narrowband_r13;
long si_TBS_r13 = si_TBS_r13tab[schedulingInfoList_BR_r13->list.array[i]->si_TBS_r13];
// check if the SI is to be scheduled now
int period_in_sf;
int period_in_sf = 0;
if ((si_Periodicity >= 0) && (si_Periodicity < 25)) {
// 2^i * 80 subframes, note: si_Periodicity is 2^i * 80ms
......
......@@ -25,7 +25,7 @@
* \date 2011, 2018
* \version 1.0
* \company Eurecom, NTUST
* \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr, kroempa@gmail.com
* \email: {raymond.knopp, navid.nikaein}@eurecom.fr and kroempa@gmail.com
*/
#include <stdio.h>
......@@ -216,7 +216,6 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier,
uint32_t subCarrierSpacingCommon,
uint32_t dmrs_TypeA_Position)
{
asn_enc_rval_t enc_rval;
NR_BCCH_BCH_Message_t *mib = &carrier->mib;
......@@ -260,9 +259,10 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier,
break;
default:
AssertFatal(1==0,"Unknown subCarrierSpacingCommon %d\n",subCarrierSpacingCommon);
AssertFatal(1==0, "Unknown subCarrierSpacingCommon %u\n", subCarrierSpacingCommon);
}
mib->message.choice.mib->subCarrierSpacingCommon = 1;
mib->message.choice.mib->subCarrierSpacingCommon = 1;
switch (dmrs_TypeA_Position) {
case 2:
mib->message.choice.mib->dmrs_TypeA_Position = NR_MIB__dmrs_TypeA_Position_pos2;
......@@ -273,8 +273,7 @@ mib->message.choice.mib->subCarrierSpacingCommon = 1;
break;
default:
AssertFatal(1==0,"Unknown dmrs_TypeA_Position %d\n",dmrs_TypeA_Position);
AssertFatal(1==0, "Unknown dmrs_TypeA_Position %u\n", dmrs_TypeA_Position);
}
// assign_enum
......@@ -282,8 +281,6 @@ mib->message.choice.mib->subCarrierSpacingCommon = 1;
// assign_enum
mib->message.choice.mib->intraFreqReselection = NR_MIB__intraFreqReselection_notAllowed;
//encode MIB to data
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message,
NULL,
......@@ -293,7 +290,6 @@ mib->message.choice.mib->subCarrierSpacingCommon = 1;
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
if (enc_rval.encoded==-1) {
return(-1);
}
......@@ -301,6 +297,7 @@ mib->message.choice.mib->subCarrierSpacingCommon = 1;
return((enc_rval.encoded+7)/8);
}
void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
int CC_id,
#if defined(ENABLE_ITTI)
......@@ -311,18 +308,29 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
{
NR_ServingCellConfigCommon_t **servingcellconfigcommon = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon;
NR_FreqBandIndicatorNR_t *dl_frequencyBandList;
struct NR_SCS_SpecificCarrier *dl_scs_SpecificCarrierList;
NR_SCS_SpecificCarrier_t *dl_scs_SpecificCarrierList;
NR_TCI_StateId_t *TCI_StateId;
struct NR_ControlResourceSet *bwp_dl_controlresourceset;
NR_ControlResourceSet_t *bwp_dl_controlresourceset;
NR_SearchSpace_t *bwp_dl_searchspace;
struct NR_PDSCH_TimeDomainResourceAllocation *bwp_dl_timedomainresourceallocation;
NR_PDSCH_TimeDomainResourceAllocation_t *bwp_dl_timedomainresourceallocation;
NR_FreqBandIndicatorNR_t *ul_frequencyBandList;
struct NR_SCS_SpecificCarrier *ul_scs_SpecificCarrierList;
struct NR_PUSCH_TimeDomainResourceAllocation *pusch_configcommontimedomainresourceallocation;
struct NR_RateMatchPattern *ratematchpattern;
NR_SCS_SpecificCarrier_t *ul_scs_SpecificCarrierList;
NR_PUSCH_TimeDomainResourceAllocation_t *pusch_configcommontimedomainresourceallocation;
NR_RateMatchPattern_t *ratematchpattern;
NR_RateMatchPatternId_t *ratematchpatternid;
if(initial_flag == 1){
dl_frequencyBandList = CALLOC(1,sizeof(NR_FreqBandIndicatorNR_t));
ul_frequencyBandList = CALLOC(1,sizeof(NR_FreqBandIndicatorNR_t));
dl_scs_SpecificCarrierList = CALLOC(1,sizeof(NR_SCS_SpecificCarrier_t));
ul_scs_SpecificCarrierList = CALLOC(1,sizeof(NR_SCS_SpecificCarrier_t));
TCI_StateId = CALLOC(1,sizeof(NR_TCI_StateId_t));
bwp_dl_searchspace = CALLOC(1,sizeof(NR_SearchSpace_t));
bwp_dl_timedomainresourceallocation = CALLOC(1,sizeof(NR_PDSCH_TimeDomainResourceAllocation_t));
pusch_configcommontimedomainresourceallocation = CALLOC(1,sizeof(NR_PUSCH_TimeDomainResourceAllocation_t));
ratematchpattern = CALLOC(1,sizeof(NR_RateMatchPattern_t));
ratematchpatternid = CALLOC(1,sizeof(NR_RateMatchPatternId_t));
if(initial_flag == 1) {
(*servingcellconfigcommon) = CALLOC(1,sizeof(NR_ServingCellConfigCommon_t));
(*servingcellconfigcommon)->physCellId = CALLOC(1,sizeof(NR_PhysCellId_t));
(*servingcellconfigcommon)->downlinkConfigCommon = CALLOC(1,sizeof(struct NR_DownlinkConfigCommon));
......@@ -343,15 +351,13 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
(*servingcellconfigcommon)->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB = CALLOC(1,sizeof(NR_ARFCN_ValueNR_t));
dl_frequencyBandList = CALLOC(1,sizeof(NR_FreqBandIndicatorNR_t));
dl_scs_SpecificCarrierList = CALLOC(1,sizeof(struct NR_SCS_SpecificCarrier));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix = CALLOC(1,sizeof(long));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon = CALLOC(1,sizeof(struct NR_SetupRelease_PDCCH_ConfigCommon));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero = CALLOC(1,sizeof(long));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero = CALLOC(1,sizeof(long));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = CALLOC(1,sizeof(struct NR_ControlResourceSet));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = CALLOC(1,sizeof(NR_ControlResourceSet_t));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = CALLOC(1,sizeof(NR_SearchSpaceId_t));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation = CALLOC(1,sizeof(NR_SearchSpaceId_t));
......@@ -361,7 +367,7 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PDSCH_ConfigCommon));
(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList = CALLOC(1,sizeof(struct NR_PDSCH_TimeDomainResourceAllocationList));
(*servingcellconfigcommon)->uplinkConfigCommon->frequencyInfoUL->frequencyBandList = CALLOC(1,sizeof(struct NR_MultiFrequencyBandListNR));
(*servingcellconfigcommon)->uplinkConfigCommon->frequencyInfoUL->frequencyBandList = CALLOC(1,sizeof(NR_MultiFrequencyBandListNR_t));
(*servingcellconfigcommon)->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA = CALLOC(1,sizeof(NR_ARFCN_ValueNR_t));
(*servingcellconfigcommon)->uplinkConfigCommon->frequencyInfoUL->additionalSpectrumEmission = CALLOC(1,sizeof(NR_AdditionalSpectrumEmission_t));
(*servingcellconfigcommon)->uplinkConfigCommon->frequencyInfoUL->p_Max = CALLOC(1,sizeof(NR_P_Max_t));
......@@ -381,7 +387,7 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
(*servingcellconfigcommon)->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PUSCH_ConfigCommon));
(*servingcellconfigcommon)->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = CALLOC(1,sizeof(long));
(*servingcellconfigcommon)->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocationList));
(*servingcellconfigcommon)->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList = CALLOC(1,sizeof(NR_PUSCH_TimeDomainResourceAllocationList_t));
(*servingcellconfigcommon)->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble = CALLOC(1,sizeof(long));
(*servingcellconfigcommon)->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->p0_NominalWithGrant = CALLOC(1,sizeof(long));
......@@ -402,8 +408,7 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
bwp_dl_controlresourceset->tci_StatesPDCCH_ToAddList = CALLOC(1,sizeof(struct NR_ControlResourceSet__tci_StatesPDCCH_ToAddList));
bwp_dl_controlresourceset->tci_PresentInDCI = CALLOC(1,sizeof(long));
bwp_dl_controlresourceset->pdcch_DMRS_ScramblingID = CALLOC(1,sizeof(long));
TCI_StateId = CALLOC(1,sizeof(NR_TCI_StateId_t));
bwp_dl_searchspace = CALLOC(1,sizeof(NR_SearchSpace_t));
bwp_dl_searchspace->controlResourceSetId = CALLOC(1,sizeof(NR_ControlResourceSetId_t));
bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset = CALLOC(1,sizeof(struct NR_SearchSpace__monitoringSlotPeriodicityAndOffset));
bwp_dl_searchspace->duration = CALLOC(1,sizeof(long));
......@@ -414,16 +419,10 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
bwp_dl_searchspace->searchSpaceType->choice.common = CALLOC(1,sizeof(struct NR_SearchSpace__searchSpaceType__common));
bwp_dl_searchspace->searchSpaceType->choice.ue_Specific = CALLOC(1,sizeof(struct NR_SearchSpace__searchSpaceType__ue_Specific));
bwp_dl_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PDSCH_TimeDomainResourceAllocation));
bwp_dl_timedomainresourceallocation->k0 = CALLOC(1,sizeof(long));
ul_frequencyBandList = CALLOC(1,sizeof(NR_FreqBandIndicatorNR_t));
ul_scs_SpecificCarrierList = CALLOC(1,sizeof(struct NR_SCS_SpecificCarrier));
pusch_configcommontimedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
pusch_configcommontimedomainresourceallocation->k2 = CALLOC(1,sizeof(long));
ratematchpattern = CALLOC(1,sizeof(struct NR_RateMatchPattern));
ratematchpattern->patternType.choice.bitmaps = CALLOC(1,sizeof(struct NR_RateMatchPattern__patternType__bitmaps));
ratematchpattern->patternType.choice.bitmaps->resourceBlocks.buf = MALLOC(35);
ratematchpattern->patternType.choice.bitmaps->symbolsInResourceBlock.choice.oneSlot.buf = MALLOC(2);
......@@ -437,8 +436,7 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
ratematchpattern->patternType.choice.bitmaps->periodicityAndPattern->choice.n20.buf = MALLOC(3);
ratematchpattern->patternType.choice.bitmaps->periodicityAndPattern->choice.n40.buf = MALLOC(5);
ratematchpattern->subcarrierSpacing = CALLOC(1,sizeof(NR_SubcarrierSpacing_t));
ratematchpatternid = CALLOC(1,sizeof(NR_RateMatchPatternId_t));
}else{
} else {
bwp_dl_controlresourceset =(*servingcellconfigcommon)->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet;
}
......@@ -551,10 +549,10 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
*(bwp_dl_searchspace->duration) = configuration->SearchSpace_duration[CC_id];
bwp_dl_searchspace->monitoringSymbolsWithinSlot->size=2;
bwp_dl_searchspace->monitoringSymbolsWithinSlot->bits_unused=2;
bwp_dl_searchspace->monitoringSymbolsWithinSlot->buf[0]=0x3f;
bwp_dl_searchspace->monitoringSymbolsWithinSlot->buf[1]=0xff;
bwp_dl_searchspace->monitoringSymbolsWithinSlot->size = 2;
bwp_dl_searchspace->monitoringSymbolsWithinSlot->bits_unused = 2;
bwp_dl_searchspace->monitoringSymbolsWithinSlot->buf[0] = 0x3f;
bwp_dl_searchspace->monitoringSymbolsWithinSlot->buf[1] = 0xff;
bwp_dl_searchspace->nrofCandidates->aggregationLevel1 = configuration->SearchSpace_nrofCandidates_aggregationLevel1[CC_id];
bwp_dl_searchspace->nrofCandidates->aggregationLevel2 = configuration->SearchSpace_nrofCandidates_aggregationLevel2[CC_id];
......@@ -846,11 +844,12 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
}
void do_RLC_BEARER(uint8_t Mod_id,
int CC_id,
struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_BearerToAddModList,
rlc_bearer_config_t *rlc_config){
rlc_bearer_config_t *rlc_config)
{
struct NR_RLC_BearerConfig *rlc_bearer;
rlc_bearer = CALLOC(1,sizeof(struct NR_RLC_BearerConfig));
......@@ -945,11 +944,12 @@ void do_RLC_BEARER(uint8_t Mod_id,
ASN_SEQUENCE_ADD(&(rlc_BearerToAddModList->list),&rlc_bearer);
}
void do_MAC_CELLGROUP(uint8_t Mod_id,
int CC_id,
struct NR_MAC_CellGroupConfig *mac_CellGroupConfig,
mac_cellgroup_t *mac_cellgroup_config){
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
mac_cellgroup_t *mac_cellgroup_config)
{
mac_CellGroupConfig->drx_Config = CALLOC(1,sizeof(struct NR_SetupRelease_DRX_Config));
mac_CellGroupConfig->schedulingRequestConfig = CALLOC(1,sizeof(struct NR_SchedulingRequestConfig));
mac_CellGroupConfig->bsr_Config = CALLOC(1,sizeof(struct NR_BSR_Config));
......@@ -1059,11 +1059,12 @@ void do_MAC_CELLGROUP(uint8_t Mod_id,
}
void do_PHYSICALCELLGROUP(uint8_t Mod_id,
int CC_id,
struct NR_PhysicalCellGroupConfig *physicalCellGroupConfig,
physicalcellgroup_t *physicalcellgroup_config){
NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig,
physicalcellgroup_t *physicalcellgroup_config)
{
physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH = CALLOC(1,sizeof(long));
physicalCellGroupConfig->harq_ACK_SpatialBundlingPUSCH = CALLOC(1,sizeof(long));
physicalCellGroupConfig->p_NR_FR1 = CALLOC(1,sizeof(NR_P_Max_t));
......@@ -1090,10 +1091,11 @@ void do_PHYSICALCELLGROUP(uint8_t Mod_id,
}
void do_SpCellConfig(uint8_t Mod_id,
int CC_id,
struct NR_SpCellConfig *spconfig){
NR_SpCellConfig_t *spconfig)
{
//spconfig->servCellIndex = CALLOC(1,sizeof(NR_ServCellIndex_t));
//*(spconfig->servCellIndex)=
......
......@@ -98,14 +98,14 @@ void do_RLC_BEARER(uint8_t Mod_id,
void do_MAC_CELLGROUP(uint8_t Mod_id,
int CC_id,
struct NR_MAC_CellGroupConfig *mac_CellGroupConfig,
NR_MAC_CellGroupConfig_t *mac_CellGroupConfig,
mac_cellgroup_t *mac_cellgroup_config);
void do_PHYSICALCELLGROUP(uint8_t Mod_id,
int CC_id,
struct NR_PhysicalCellGroupConfig *physicalCellGroupConfig,
NR_PhysicalCellGroupConfig_t *physicalCellGroupConfig,
physicalcellgroup_t *physicalcellgroup_config);
void do_SpCellConfig(uint8_t Mod_id,
int CC_id,
struct NR_SpCellConfig *spconfig);
NR_SpCellConfig_t *spconfig);
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