X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Flwr_mac_fsm.c;h=5cbe91c174fa519bdfac5f5b2c5521037a77956c;hb=3f340f5742e5c7c92b8541479ee7f2d670200cfb;hp=3345227f806e4d77e8fe56835013ad0773b9eba8;hpb=6b44407d464a5a4e060999255233a7cfe78bb0fa;p=o-du%2Fl2.git diff --git a/src/5gnrmac/lwr_mac_fsm.c b/src/5gnrmac/lwr_mac_fsm.c index 3345227f8..5cbe91c17 100644 --- a/src/5gnrmac/lwr_mac_fsm.c +++ b/src/5gnrmac/lwr_mac_fsm.c @@ -105,7 +105,7 @@ uint8_t lwr_mac_procInvalidEvt(void *msg) * @return void * * ****************************************************************/ -PUBLIC void fillMsgHeader(fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen) +void fillMsgHeader(fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen) { memset(hdr, 0, sizeof(fapi_msg_t)); hdr->msg_id = msgType; @@ -131,7 +131,7 @@ PUBLIC void fillMsgHeader(fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen) * @return void * * ****************************************************************/ -PUBLIC void fillTlvs(fapi_uint32_tlv_t *tlv, uint16_t tag, uint16_t length, +void fillTlvs(fapi_uint32_tlv_t *tlv, uint16_t tag, uint16_t length, uint16_t value, uint32_t *msgLen) { tlv->tl.tag = tag; @@ -156,7 +156,7 @@ PUBLIC void fillTlvs(fapi_uint32_tlv_t *tlv, uint16_t tag, uint16_t length, * @return void * ********************************************************************/ -PUBLIC void fillCyclicPrefix(uint8_t value, ClCellParam **cellPtr) +void fillCyclicPrefix(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_NORMAL_CYCLIC_PREFIX_MASK) == FAPI_NORMAL_CYCLIC_PREFIX_MASK) { @@ -190,7 +190,7 @@ PUBLIC void fillCyclicPrefix(uint8_t value, ClCellParam **cellPtr) * * ****************************************************************/ -PUBLIC void fillSubcarrierSpaceDl(uint8_t value, ClCellParam **cellPtr) +void fillSubcarrierSpaceDl(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_15KHZ_MASK) == FAPI_15KHZ_MASK) { @@ -232,7 +232,7 @@ PUBLIC void fillSubcarrierSpaceDl(uint8_t value, ClCellParam **cellPtr) * * ****************************************************************/ -PUBLIC void fillBandwidthDl(uint16_t value, ClCellParam **cellPtr) +void fillBandwidthDl(uint16_t value, ClCellParam **cellPtr) { if((value & FAPI_5MHZ_BW_MASK) == FAPI_5MHZ_BW_MASK) { @@ -310,7 +310,7 @@ PUBLIC void fillBandwidthDl(uint16_t value, ClCellParam **cellPtr) * * ****************************************************************/ -PUBLIC void fillSubcarrierSpaceUl(uint8_t value, ClCellParam **cellPtr) +void fillSubcarrierSpaceUl(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_15KHZ_MASK) == FAPI_15KHZ_MASK) { @@ -355,7 +355,7 @@ PUBLIC void fillSubcarrierSpaceUl(uint8_t value, ClCellParam **cellPtr) * * ****************************************************************/ -PUBLIC void fillBandwidthUl(uint16_t value, ClCellParam **cellPtr) +void fillBandwidthUl(uint16_t value, ClCellParam **cellPtr) { if((value & FAPI_5MHZ_BW_MASK) == FAPI_5MHZ_BW_MASK) { @@ -433,7 +433,7 @@ PUBLIC void fillBandwidthUl(uint16_t value, ClCellParam **cellPtr) * * ****************************************************************/ -PUBLIC void fillCCEmaping(uint8_t value, ClCellParam **cellPtr) +void fillCCEmaping(uint8_t value, ClCellParam **cellPtr) { if ((value & FAPI_CCE_MAPPING_INTERLEAVED_MASK) == FAPI_CCE_MAPPING_INTERLEAVED_MASK) { @@ -468,7 +468,7 @@ PUBLIC void fillCCEmaping(uint8_t value, ClCellParam **cellPtr) * * ****************************************************************/ -PUBLIC void fillPucchFormat(uint8_t value, ClCellParam **cellPtr) +void fillPucchFormat(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_FORMAT_0_MASK) == FAPI_FORMAT_0_MASK) { @@ -514,7 +514,7 @@ PUBLIC void fillPucchFormat(uint8_t value, ClCellParam **cellPtr) * * ****************************************************************/ -PUBLIC void fillPdschMappingType(uint8_t value, ClCellParam **cellPtr) +void fillPdschMappingType(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PDSCH_MAPPING_TYPE_A_MASK) == FAPI_PDSCH_MAPPING_TYPE_A_MASK) { @@ -548,7 +548,7 @@ PUBLIC void fillPdschMappingType(uint8_t value, ClCellParam **cellPtr) * * ****************************************************************/ -PUBLIC void fillPdschAllocationType(uint8_t value, ClCellParam **cellPtr) +void fillPdschAllocationType(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PDSCH_ALLOC_TYPE_0_MASK) == FAPI_PDSCH_ALLOC_TYPE_0_MASK) { @@ -581,7 +581,7 @@ PUBLIC void fillPdschAllocationType(uint8_t value, ClCellParam **cellPtr) * @return void * ******************************************************************/ -PUBLIC void fillPrbMappingType(uint8_t value, ClCellParam **cellPtr) +void fillPrbMappingType(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PDSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK) == FAPI_PDSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK) { @@ -615,7 +615,7 @@ PUBLIC void fillPrbMappingType(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPdschDmrsConfigType(uint8_t value, ClCellParam **cellPtr) +void fillPdschDmrsConfigType(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PDSCH_DMRS_CONFIG_TYPE_1_MASK) == FAPI_PDSCH_DMRS_CONFIG_TYPE_1_MASK) { @@ -648,7 +648,7 @@ PUBLIC void fillPdschDmrsConfigType(uint8_t value, ClCellParam **cellPtr) * @return void * ******************************************************************/ -PUBLIC void fillPdschDmrsLength(uint8_t value, ClCellParam **cellPtr) +void fillPdschDmrsLength(uint8_t value, ClCellParam **cellPtr) { if(value == FAPI_PDSCH_DMRS_MAX_LENGTH_1) { @@ -682,7 +682,7 @@ PUBLIC void fillPdschDmrsLength(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPdschDmrsAddPos(uint8_t value, ClCellParam **cellPtr) +void fillPdschDmrsAddPos(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_DMRS_ADDITIONAL_POS_0_MASK) == FAPI_DMRS_ADDITIONAL_POS_0_MASK) { @@ -723,7 +723,7 @@ PUBLIC void fillPdschDmrsAddPos(uint8_t value, ClCellParam **cellPtr) * @return void * ******************************************************************/ -PUBLIC void fillModulationOrderDl(uint8_t value, ClCellParam **cellPtr) +void fillModulationOrderDl(uint8_t value, ClCellParam **cellPtr) { if(value == 0 ) { @@ -765,7 +765,7 @@ PUBLIC void fillModulationOrderDl(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPuschDmrsConfig(uint8_t value, ClCellParam **cellPtr) +void fillPuschDmrsConfig(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PUSCH_DMRS_CONFIG_TYPE_1_MASK) == FAPI_PUSCH_DMRS_CONFIG_TYPE_1_MASK) { @@ -799,7 +799,7 @@ PUBLIC void fillPuschDmrsConfig(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPuschDmrsLength(uint8_t value, ClCellParam **cellPtr) +void fillPuschDmrsLength(uint8_t value, ClCellParam **cellPtr) { if(value == FAPI_PUSCH_DMRS_MAX_LENGTH_1) { @@ -833,7 +833,7 @@ PUBLIC void fillPuschDmrsLength(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPuschDmrsAddPos(uint8_t value, ClCellParam **cellPtr) +void fillPuschDmrsAddPos(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_DMRS_ADDITIONAL_POS_0_MASK) == FAPI_DMRS_ADDITIONAL_POS_0_MASK) { @@ -875,7 +875,7 @@ PUBLIC void fillPuschDmrsAddPos(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPuschMappingType(uint8_t value, ClCellParam **cellPtr) +void fillPuschMappingType(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PUSCH_MAPPING_TYPE_A_MASK) == FAPI_PUSCH_MAPPING_TYPE_A_MASK) { @@ -909,7 +909,7 @@ PUBLIC void fillPuschMappingType(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPuschAllocationType(uint8_t value, ClCellParam **cellPtr) +void fillPuschAllocationType(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PUSCH_ALLOC_TYPE_0_MASK) == FAPI_PUSCH_ALLOC_TYPE_0_MASK) { @@ -943,7 +943,7 @@ PUBLIC void fillPuschAllocationType(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPuschPrbMappingType(uint8_t value, ClCellParam **cellPtr) +void fillPuschPrbMappingType(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PUSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK) == FAPI_PUSCH_VRB_TO_PRB_MAP_NON_INTLV_MASK) { @@ -977,7 +977,7 @@ PUBLIC void fillPuschPrbMappingType(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillModulationOrderUl(uint8_t value, ClCellParam **cellPtr) +void fillModulationOrderUl(uint8_t value, ClCellParam **cellPtr) { if(value == 0) { @@ -1019,7 +1019,7 @@ PUBLIC void fillModulationOrderUl(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPuschAggregationFactor(uint8_t value, ClCellParam **cellPtr) +void fillPuschAggregationFactor(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_FORMAT_0_MASK) == FAPI_FORMAT_0_MASK) { @@ -1061,7 +1061,7 @@ PUBLIC void fillPuschAggregationFactor(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPrachLongFormat(uint8_t value, ClCellParam **cellPtr) +void fillPrachLongFormat(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PRACH_LF_FORMAT_0_MASK) == FAPI_PRACH_LF_FORMAT_0_MASK) { @@ -1103,7 +1103,7 @@ PUBLIC void fillPrachLongFormat(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillPrachShortFormat(uint8_t value, ClCellParam **cellPtr) +void fillPrachShortFormat(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_PRACH_SF_FORMAT_A1_MASK) == FAPI_PRACH_SF_FORMAT_A1_MASK) { @@ -1165,7 +1165,7 @@ PUBLIC void fillPrachShortFormat(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillFdOccasions(uint8_t value, ClCellParam **cellPtr) +void fillFdOccasions(uint8_t value, ClCellParam **cellPtr) { if(value == 0) { @@ -1207,7 +1207,7 @@ PUBLIC void fillFdOccasions(uint8_t value, ClCellParam **cellPtr) * ******************************************************************/ -PUBLIC void fillRssiMeas(uint8_t value, ClCellParam **cellPtr) +void fillRssiMeas(uint8_t value, ClCellParam **cellPtr) { if((value & FAPI_RSSI_REPORT_IN_DBM_MASK) == FAPI_RSSI_REPORT_IN_DBM_MASK) { @@ -2178,7 +2178,7 @@ uint8_t lwr_mac_procStopReqEvt(void *msg) * pointer to modified value ******************************************************************/ -PUBLIC void setMibPdu(uint8_t *mibPdu, uint32_t *val, uint16_t sfn) +void setMibPdu(uint8_t *mibPdu, uint32_t *val, uint16_t sfn) { *mibPdu |= (((uint8_t)(sfn >> 2)) & MIB_SFN_BITMASK); *val = (mibPdu[0] << 24 | mibPdu[1] << 16 | mibPdu[2] << 8); @@ -2300,7 +2300,7 @@ void fillSib1DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *sib1PdcchInfo) * RBLen = length of contiguously allocted RBs * Spec 38.214 Sec 5.1.2.2.2 */ - coreset0Size= sib1PdcchInfo->coreset0Cfg.coreSetSize; + coreset0Size= sib1PdcchInfo->coresetCfg.coreSetSize; rbStart = 0; /* For SIB1 */ //rbStart = sib1PdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.startPrb; rbLen = sib1PdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.numPrb; @@ -2439,7 +2439,7 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) */ /* TODO: Fill values of coreset0Size, rbStart and rbLen */ - coreset0Size= rarPdcchInfo->coreset0Cfg.coreSetSize; + coreset0Size= rarPdcchInfo->coresetCfg.coreSetSize; rbStart = 0; /* For SIB1 */ //rbStart = rarPdcchInfo->dci.pdschCfg->freqAlloc.rbStart; rbLen = rarPdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.numPrb; @@ -2508,22 +2508,22 @@ void fillRarDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *rarPdcchInfo) /******************************************************************* * - * @brief fills msg4 Dl DCI PDU required for DL TTI info in MAC + * @brief fills DL DCI PDU required for DL TTI info in MAC * * @details * - * Function : fillMsg4DlDciPdu + * Function : fillDlMsgDlDciPdu * * Functionality: - * -Fills the Msg4 Dl DCI PDU + * -Fills the Dl DCI PDU * * @params[in] Pointer to fapi_dl_dci_t * Pointer to PdcchCfg * @return ROK * ******************************************************************/ -void fillMsg4DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *msg4PdcchInfo,\ - Msg4Info *msg4Info) +void fillDlMsgDlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *pdcchInfo,\ + DlMsgInfo *dlMsgInfo) { if(dlDciPtr != NULLP) { @@ -2531,7 +2531,7 @@ void fillMsg4DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *msg4PdcchInfo,\ uint8_t bytePos; uint8_t bitPos; - uint16_t coreset0Size = 0; + uint16_t coresetSize = 0; uint16_t rbStart = 0; uint16_t rbLen = 0; uint8_t dciFormatId; @@ -2549,7 +2549,7 @@ void fillMsg4DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *msg4PdcchInfo,\ /* Size(in bits) of each field in DCI format 1_0 */ uint8_t dciFormatIdSize = 1; - uint8_t freqDomResAssignSize; + uint8_t freqDomResAssignSize = 0; uint8_t timeDomResAssignSize = 4; uint8_t VRB2PRBMapSize = 1; uint8_t modNCodSchemeSize = 5; @@ -2561,18 +2561,18 @@ void fillMsg4DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *msg4PdcchInfo,\ uint8_t pucchResoIndSize = 3; uint8_t harqFeedbackIndSize = 3; - dlDciPtr->rnti = msg4PdcchInfo->dci.rnti; - dlDciPtr->scramblingId = msg4PdcchInfo->dci.scramblingId; - dlDciPtr->scramblingRnti = msg4PdcchInfo->dci.scramblingRnti; - dlDciPtr->cceIndex = msg4PdcchInfo->dci.cceIndex; - dlDciPtr->aggregationLevel = msg4PdcchInfo->dci.aggregLevel; - dlDciPtr->pc_and_bform.numPrgs = msg4PdcchInfo->dci.beamPdcchInfo.numPrgs; - dlDciPtr->pc_and_bform.prgSize = msg4PdcchInfo->dci.beamPdcchInfo.prgSize; - dlDciPtr->pc_and_bform.digBfInterfaces = msg4PdcchInfo->dci.beamPdcchInfo.digBfInterfaces; - dlDciPtr->pc_and_bform.pmi_bfi[0].pmIdx = msg4PdcchInfo->dci.beamPdcchInfo.prg[0].pmIdx; - dlDciPtr->pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = msg4PdcchInfo->dci.beamPdcchInfo.prg[0].beamIdx[0]; - dlDciPtr->beta_pdcch_1_0 = msg4PdcchInfo->dci.txPdcchPower.powerValue; - dlDciPtr->powerControlOfssetSS = msg4PdcchInfo->dci.txPdcchPower.powerControlOffsetSS; + dlDciPtr->rnti = pdcchInfo->dci.rnti; + dlDciPtr->scramblingId = pdcchInfo->dci.scramblingId; + dlDciPtr->scramblingRnti = pdcchInfo->dci.scramblingRnti; + dlDciPtr->cceIndex = pdcchInfo->dci.cceIndex; + dlDciPtr->aggregationLevel = pdcchInfo->dci.aggregLevel; + dlDciPtr->pc_and_bform.numPrgs = pdcchInfo->dci.beamPdcchInfo.numPrgs; + dlDciPtr->pc_and_bform.prgSize = pdcchInfo->dci.beamPdcchInfo.prgSize; + dlDciPtr->pc_and_bform.digBfInterfaces = pdcchInfo->dci.beamPdcchInfo.digBfInterfaces; + dlDciPtr->pc_and_bform.pmi_bfi[0].pmIdx = pdcchInfo->dci.beamPdcchInfo.prg[0].pmIdx; + dlDciPtr->pc_and_bform.pmi_bfi[0].beamIdx[0].beamidx = pdcchInfo->dci.beamPdcchInfo.prg[0].beamIdx[0]; + dlDciPtr->beta_pdcch_1_0 = pdcchInfo->dci.txPdcchPower.powerValue; + dlDciPtr->powerControlOfssetSS = pdcchInfo->dci.txPdcchPower.powerControlOffsetSS; /* Calculating freq domain resource allocation field value and size * coreset0Size = Size of coreset 0 @@ -2580,35 +2580,33 @@ void fillMsg4DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *msg4PdcchInfo,\ * RBLen = length of contiguously allocted RBs * Spec 38.214 Sec 5.1.2.2.2 */ + coresetSize = pdcchInfo->coresetCfg.coreSetSize; + rbStart = pdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.startPrb; + rbLen = pdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.numPrb; - /* TODO: Fill values of coreset0Size, rbStart and rbLen */ - coreset0Size = msg4PdcchInfo->coreset0Cfg.coreSetSize; - //rbStart = msg4PdcchInfo->dci.pdschCfg->freqAlloc.rbStart; - rbLen = msg4PdcchInfo->dci.pdschCfg->pdschFreqAlloc.freqAlloc.numPrb; - - if((rbLen >=1) && (rbLen <= coreset0Size - rbStart)) + if((rbLen >=1) && (rbLen <= coresetSize - rbStart)) { - if((rbLen - 1) <= floor(coreset0Size / 2)) - freqDomResAssign = (coreset0Size * (rbLen-1)) + rbStart; - else - freqDomResAssign = (coreset0Size * (coreset0Size - rbLen + 1)) \ - + (coreset0Size - 1 - rbStart); + if((rbLen - 1) <= floor(coresetSize / 2)) + freqDomResAssign = (coresetSize * (rbLen-1)) + rbStart; + else + freqDomResAssign = (coresetSize * (coresetSize - rbLen + 1)) \ + + (coresetSize - 1 - rbStart); - freqDomResAssignSize = ceil(log2(coreset0Size * (coreset0Size + 1) / 2)); + freqDomResAssignSize = ceil(log2(coresetSize * (coresetSize + 1) / 2)); } /* Fetching DCI field values */ - dciFormatId = msg4Info->dciFormatId; /* DCI indentifier for DL */ - timeDomResAssign = msg4PdcchInfo->dci.pdschCfg->pdschTimeAlloc.rowIndex -1; - VRB2PRBMap = msg4PdcchInfo->dci.pdschCfg->pdschFreqAlloc.vrbPrbMapping; - modNCodScheme = msg4PdcchInfo->dci.pdschCfg->codeword[0].mcsIndex; - ndi = msg4Info->ndi; - redundancyVer = msg4PdcchInfo->dci.pdschCfg->codeword[0].rvIndex; - harqProcessNum = msg4Info->harqProcNum; - dlAssignmentIdx = msg4Info->dlAssignIdx; - pucchTpc = msg4Info->pucchTpc; - pucchResoInd = msg4Info->pucchResInd; - harqFeedbackInd = msg4Info->harqFeedbackInd; + dciFormatId = dlMsgInfo->dciFormatId;; /* Always set to 1 for DL */ + timeDomResAssign = pdcchInfo->dci.pdschCfg->pdschTimeAlloc.rowIndex -1; + VRB2PRBMap = pdcchInfo->dci.pdschCfg->pdschFreqAlloc.vrbPrbMapping; + modNCodScheme = pdcchInfo->dci.pdschCfg->codeword[0].mcsIndex; + ndi = dlMsgInfo->ndi; + redundancyVer = pdcchInfo->dci.pdschCfg->codeword[0].rvIndex; + harqProcessNum = dlMsgInfo->harqProcNum; + dlAssignmentIdx = dlMsgInfo->dlAssignIdx; + pucchTpc = dlMsgInfo->pucchTpc; + pucchResoInd = dlMsgInfo->pucchResInd; + harqFeedbackInd = dlMsgInfo->harqFeedbackInd; /* Reversing bits in each DCI field */ dciFormatId = reverseBits(dciFormatId, dciFormatIdSize); @@ -2627,56 +2625,56 @@ void fillMsg4DlDciPdu(fapi_dl_dci_t *dlDciPtr, PdcchCfg *msg4PdcchInfo,\ /* Calulating total number of bytes in buffer */ dlDciPtr->payloadSizeBits = (dciFormatIdSize + freqDomResAssignSize\ - + timeDomResAssignSize + VRB2PRBMapSize + modNCodSchemeSize\ - + ndiSize + redundancyVerSize + harqProcessNumSize + dlAssignmentIdxSize\ - + pucchTpcSize + pucchResoIndSize + harqFeedbackIndSize); + + timeDomResAssignSize + VRB2PRBMapSize + modNCodSchemeSize\ + + ndiSize + redundancyVerSize + harqProcessNumSize + dlAssignmentIdxSize\ + + pucchTpcSize + pucchResoIndSize + harqFeedbackIndSize); numBytes = dlDciPtr->payloadSizeBits / 8; if(dlDciPtr->payloadSizeBits % 8) - numBytes += 1; + numBytes += 1; if(numBytes > FAPI_DCI_PAYLOAD_BYTE_LEN) { - DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected"); - return; + DU_LOG("\nLWR_MAC : Total bytes for DCI is more than expected"); + return; } /* Initialize buffer */ for(bytePos = 0; bytePos < numBytes; bytePos++) - dlDciPtr->payload[bytePos] = 0; + dlDciPtr->payload[bytePos] = 0; bytePos = numBytes - 1; bitPos = 0; /* Packing DCI format fields */ fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - dciFormatId, dciFormatIdSize); + dciFormatId, dciFormatIdSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - freqDomResAssign, freqDomResAssignSize); + freqDomResAssign, freqDomResAssignSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - timeDomResAssign, timeDomResAssignSize); + timeDomResAssign, timeDomResAssignSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - VRB2PRBMap, VRB2PRBMapSize); + VRB2PRBMap, VRB2PRBMapSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - modNCodScheme, modNCodSchemeSize); + modNCodScheme, modNCodSchemeSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - ndi, ndiSize); + ndi, ndiSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - redundancyVer, redundancyVerSize); + redundancyVer, redundancyVerSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - redundancyVer, redundancyVerSize); + redundancyVer, redundancyVerSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - harqProcessNum, harqProcessNumSize); + harqProcessNum, harqProcessNumSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - dlAssignmentIdx, dlAssignmentIdxSize); + dlAssignmentIdx, dlAssignmentIdxSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - pucchTpc, pucchTpcSize); + pucchTpc, pucchTpcSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - pucchResoInd, pucchResoIndSize); + pucchResoInd, pucchResoIndSize); fillDlDciPayload(dlDciPtr->payload, &bytePos, &bitPos,\ - harqFeedbackInd, harqFeedbackIndSize); + harqFeedbackInd, harqFeedbackIndSize); } -} /* fillMsg4DlDciPdu */ +} /******************************************************************* * @@ -2716,12 +2714,12 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, \ bwp = &dlInfo->rarAlloc->bwp; fillRarDlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo); } - else if(rntiType == TC_RNTI_TYPE) + else if(rntiType == TC_RNTI_TYPE || rntiType == C_RNTI_TYPE) { - pdcchInfo = &dlInfo->msg4Alloc->msg4PdcchCfg; - bwp = &dlInfo->msg4Alloc->bwp; - fillMsg4DlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo,\ - &dlInfo->msg4Alloc->msg4Info); + pdcchInfo = &dlInfo->dlMsgAlloc->dlMsgPdcchCfg; + bwp = &dlInfo->dlMsgAlloc->bwp; + fillDlMsgDlDciPdu(dlTtiReqPdu->pdu.pdcch_pdu.dlDci, pdcchInfo,\ + &dlInfo->dlMsgAlloc->dlMsgInfo); } else { @@ -2733,15 +2731,15 @@ uint8_t fillPdcchPdu(fapi_dl_tti_req_pdu_t *dlTtiReqPdu, DlSchedInfo *dlInfo, \ dlTtiReqPdu->pdu.pdcch_pdu.bwpStart = bwp->freqAlloc.startPrb; dlTtiReqPdu->pdu.pdcch_pdu.subCarrierSpacing = bwp->subcarrierSpacing; dlTtiReqPdu->pdu.pdcch_pdu.cyclicPrefix = bwp->cyclicPrefix; - dlTtiReqPdu->pdu.pdcch_pdu.startSymbolIndex = pdcchInfo->coreset0Cfg.startSymbolIndex; - dlTtiReqPdu->pdu.pdcch_pdu.durationSymbols = pdcchInfo->coreset0Cfg.durationSymbols; - memcpy(dlTtiReqPdu->pdu.pdcch_pdu.freqDomainResource, pdcchInfo->coreset0Cfg.freqDomainResource, 6); - dlTtiReqPdu->pdu.pdcch_pdu.cceRegMappingType = pdcchInfo->coreset0Cfg.cceRegMappingType; - dlTtiReqPdu->pdu.pdcch_pdu.regBundleSize = pdcchInfo->coreset0Cfg.regBundleSize; - dlTtiReqPdu->pdu.pdcch_pdu.interleaverSize = pdcchInfo->coreset0Cfg.interleaverSize; - dlTtiReqPdu->pdu.pdcch_pdu.coreSetSize = pdcchInfo->coreset0Cfg.coreSetType; - dlTtiReqPdu->pdu.pdcch_pdu.shiftIndex = pdcchInfo->coreset0Cfg.shiftIndex; - dlTtiReqPdu->pdu.pdcch_pdu.precoderGranularity = pdcchInfo->coreset0Cfg.precoderGranularity; + dlTtiReqPdu->pdu.pdcch_pdu.startSymbolIndex = pdcchInfo->coresetCfg.startSymbolIndex; + dlTtiReqPdu->pdu.pdcch_pdu.durationSymbols = pdcchInfo->coresetCfg.durationSymbols; + memcpy(dlTtiReqPdu->pdu.pdcch_pdu.freqDomainResource, pdcchInfo->coresetCfg.freqDomainResource, 6); + dlTtiReqPdu->pdu.pdcch_pdu.cceRegMappingType = pdcchInfo->coresetCfg.cceRegMappingType; + dlTtiReqPdu->pdu.pdcch_pdu.regBundleSize = pdcchInfo->coresetCfg.regBundleSize; + dlTtiReqPdu->pdu.pdcch_pdu.interleaverSize = pdcchInfo->coresetCfg.interleaverSize; + dlTtiReqPdu->pdu.pdcch_pdu.coreSetSize = pdcchInfo->coresetCfg.coreSetType; + dlTtiReqPdu->pdu.pdcch_pdu.shiftIndex = pdcchInfo->coresetCfg.shiftIndex; + dlTtiReqPdu->pdu.pdcch_pdu.precoderGranularity = pdcchInfo->coresetCfg.precoderGranularity; dlTtiReqPdu->pdu.pdcch_pdu.numDlDci = pdcchInfo->numDlDci; dlTtiReqPdu->pdu.pdcch_pdu.coreSetType = coreSetType; @@ -2872,12 +2870,11 @@ uint8_t calcDlTtiReqPduCount(DlSchedInfo *dlInfo) /* PDCCH and PDSCH PDU is filled */ count += 2; } - if(dlInfo->msg4Alloc != NULLP) + if(dlInfo->dlMsgAlloc != NULLP) { /* PDCCH and PDSCH PDU is filled */ count += 2; } - return count; } @@ -2908,11 +2905,10 @@ uint8_t calcTxDataReqPduCount(DlSchedInfo *dlInfo) { count++; } - if(dlInfo->msg4Alloc != NULLP) + if(dlInfo->dlMsgAlloc != NULLP) { count++; } - return count; } /*********************************************************************** @@ -3023,27 +3019,27 @@ uint8_t fillRarTxDataReq(fapi_tx_pdu_desc_t *pduDesc, RarInfo *rarInfo, /*********************************************************************** * - * @brief fills the Msg4 TX-DATA request message + * @brief fills the DL dedicated Msg TX-DATA request message * * @details * - * Function : fillMsg4TxDataReq + * Function : fillDlMsgTxDataReq * * Functionality: - * - fills the Msg4 TX-DATA request message + * - fills the Dl Dedicated Msg TX-DATA request message * * @params[in] fapi_tx_pdu_desc_t *pduDesc - * @params[in] Msg4Info *msg4Info + * @params[in] DlMsgInfo *dlMsgInfo * @params[in] uint32_t *msgLen * @params[in] uint16_t pduIndex * @return ROK * * ********************************************************************/ -uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info, +uint8_t fillDlMsgTxDataReq(fapi_tx_pdu_desc_t *pduDesc, DlMsgInfo *dlMsgInfo, uint16_t pduIndex) { uint32_t pduLen = 0; - uint8_t *msg4TxDataValue = NULLP; + uint8_t *dedMsgTxDataValue = NULLP; pduDesc[pduIndex].pdu_index = pduIndex; pduDesc[pduIndex].num_tlvs = 1; @@ -3051,30 +3047,31 @@ uint8_t fillMsg4TxDataReq(fapi_tx_pdu_desc_t *pduDesc, Msg4Info *msg4Info, /* fill the TLV */ /* as of now, memory is allocated from SSI, later WLS memory needs to be taken */ pduDesc[pduIndex].tlvs[0].tl.tag = 1; /* pointer to be sent */ - pduDesc[pduIndex].tlvs[0].tl.length = msg4Info->msg4PduLen; - LWR_MAC_ALLOC(msg4TxDataValue, msg4Info->msg4PduLen); - if(msg4TxDataValue == NULLP) + pduDesc[pduIndex].tlvs[0].tl.length = dlMsgInfo->dlMsgPduLen; + LWR_MAC_ALLOC(dedMsgTxDataValue, dlMsgInfo->dlMsgPduLen); + if(dedMsgTxDataValue == NULLP) { return RFAILED; } - memcpy(msg4TxDataValue, msg4Info->msg4Pdu, msg4Info->msg4PduLen); - pduDesc[pduIndex].tlvs[0].value = msg4TxDataValue; + memcpy(dedMsgTxDataValue, dlMsgInfo->dlMsgPdu, dlMsgInfo->dlMsgPduLen); + pduDesc[pduIndex].tlvs[0].value = dedMsgTxDataValue; /* The total length of the PDU description and PDU data */ pduLen += 8; /* size of PDU length 2 bytes, PDU index 2 bytes, numTLV 4 bytes */ pduLen += sizeof(fapi_uint8_ptr_tlv_t); /* only 1 TLV is present */ - pduDesc[pduIndex].pdu_length = pduLen; + pduDesc[pduIndex].pdu_length = pduLen; /* TODO: The pointer value which was stored, needs to be free-ed at PHY * * But since we did not implement WLS, this has to be done here */ -#ifndef INTEL_WLS - MAC_FREE(msg4TxDataValue, msg4Info->msg4PduLen); +#ifndef INTEL_WLS + MAC_FREE(dedMsgTxDataValue, dlMsgInfo->dlMsgPduLen); #endif return ROK; } + #endif /* FAPI */ /******************************************************************* * @@ -3166,7 +3163,7 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo) numPduEncoded++; } printf("\033[1;34m"); - DU_LOG("\nLWR_MAC: SIB1 sent..."); + DU_LOG("\nLWR_MAC: SIB1 sent..."); printf("\033[0m"); } } @@ -3188,26 +3185,49 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo) DU_LOG("\nLWR_MAC: RAR sent..."); printf("\033[0m"); } - if(currDlSlot->dlInfo.msg4Alloc != NULLP) + if(currDlSlot->dlInfo.dlMsgAlloc != NULLP) { - /* Filling Msg4 param */ - rntiType = TC_RNTI_TYPE; - fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \ - &currDlSlot->dlInfo, rntiType, CORESET_TYPE0); - numPduEncoded++; - fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], - &currDlSlot->dlInfo.msg4Alloc->msg4PdschCfg, - currDlSlot->dlInfo.msg4Alloc->bwp, - pduIndex); - numPduEncoded++; - pduIndex++; + if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu != NULLP) + { + /* Filling Msg4 param */ + printf("\033[1;32m"); + if(currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.isMsg4Pdu) + { + rntiType = TC_RNTI_TYPE; + fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \ + &currDlSlot->dlInfo, rntiType, CORESET_TYPE0); + DU_LOG("\nLWR_MAC: MSG4 sent..."); + } + else + { + /* Filling other DL msg params */ + rntiType = C_RNTI_TYPE; + fillPdcchPdu(&dlTtiReq->pdus[numPduEncoded], \ + &currDlSlot->dlInfo, rntiType, CORESET_TYPE1); + DU_LOG("\nLWR_MAC: DL MSG sent..."); + } + printf("\033[0m"); - printf("\033[1;32m"); - DU_LOG("\nLWR_MAC: MSG4 sent..."); - printf("\033[0m"); + numPduEncoded++; + fillPdschPdu(&dlTtiReq->pdus[numPduEncoded], + &currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg, + currDlSlot->dlInfo.dlMsgAlloc->bwp, + pduIndex); + numPduEncoded++; + pduIndex++; + } + else + { + MAC_FREE(currDlSlot->dlInfo.dlMsgAlloc, sizeof(DlMsgAlloc)); + currDlSlot->dlInfo.dlMsgAlloc = NULLP; + } } + msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t); fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen); +#ifdef ODU_SLOT_IND_DEBUG_LOG + DU_LOG("\nLWR_MAC: Sending DL TTI Request"); +#endif LwrMacSendToPhy(dlTtiReq->header.msg_id, sizeof(fapi_dl_tti_req_t), \ (void *)dlTtiReq); @@ -3218,6 +3238,9 @@ uint16_t fillDlTtiReq(SlotIndInfo currTimingInfo) { msgLen = sizeof(fapi_dl_tti_req_t) - sizeof(fapi_msg_t); fillMsgHeader(&dlTtiReq->header, FAPI_DL_TTI_REQUEST, msgLen); +#ifdef ODU_SLOT_IND_DEBUG_LOG + DU_LOG("\nLWR_MAC: Sending DL TTI Request"); +#endif LwrMacSendToPhy(dlTtiReq->header.msg_id, sizeof(fapi_dl_tti_req_t), (void *)dlTtiReq); } memset(currDlSlot, 0, sizeof(MacDlSlot)); @@ -3280,9 +3303,9 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo) { txDataReqMsgSize += dlInfo->rarAlloc->rarInfo.rarPduLen; } - if(dlInfo->msg4Alloc != NULLP) + if(dlInfo->dlMsgAlloc != NULLP) { - txDataReqMsgSize += dlInfo->msg4Alloc->msg4Info.msg4PduLen; + txDataReqMsgSize += dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPduLen; } LWR_MAC_ALLOC(txDataReq, txDataReqMsgSize); @@ -3311,21 +3334,23 @@ uint16_t sendTxDataReq(SlotIndInfo currTimingInfo, DlSchedInfo *dlInfo) MAC_FREE(dlInfo->rarAlloc,sizeof(RarAlloc)); dlInfo->rarAlloc = NULLP; } - if(dlInfo->msg4Alloc != NULLP && dlInfo->msg4Alloc->msg4Info.msg4Pdu != NULLP) + if(dlInfo->dlMsgAlloc != NULLP) { - fillMsg4TxDataReq(txDataReq->pdu_desc, &dlInfo->msg4Alloc->\ - msg4Info, pduIndex); - pduIndex++; - txDataReq->num_pdus++; - - MAC_FREE(dlInfo->msg4Alloc->msg4Info.msg4Pdu,\ - dlInfo->msg4Alloc->msg4Info.msg4PduLen); - dlInfo->msg4Alloc->msg4Info.msg4Pdu = NULLP; - MAC_FREE(dlInfo->msg4Alloc,sizeof(Msg4Alloc)); - dlInfo->msg4Alloc = NULLP; + fillDlMsgTxDataReq(txDataReq->pdu_desc, \ + &dlInfo->dlMsgAlloc->dlMsgInfo, pduIndex); + pduIndex++; + txDataReq->num_pdus++; + + MAC_FREE(dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPdu,\ + dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPduLen); + dlInfo->dlMsgAlloc->dlMsgInfo.dlMsgPdu = NULLP; + MAC_FREE(dlInfo->dlMsgAlloc, sizeof(DlMsgAlloc)); + dlInfo->dlMsgAlloc = NULLP; } + msgLen = txDataReqMsgSize - sizeof(fapi_msg_t); fillMsgHeader(&txDataReq->header, FAPI_TX_DATA_REQUEST, msgLen); + DU_LOG("\nLWR_MAC: Sending TX DATA Request"); LwrMacSendToPhy(txDataReq->header.msg_id, txDataReqMsgSize, \ (void *)txDataReq); } @@ -3638,8 +3663,9 @@ uint16_t fillUlTtiReq(SlotIndInfo currTimingInfo) } msgLen = sizeof(fapi_ul_tti_req_t) - sizeof(fapi_msg_t); fillMsgHeader(&ulTtiReq->header, FAPI_UL_TTI_REQUEST, msgLen); - - DU_LOG("\nLWR_MAC: Sending UL TTI Request"); +#ifdef ODU_SLOT_IND_DEBUG_LOG + DU_LOG("\nLWR_MAC: Sending UL TTI Request"); +#endif LwrMacSendToPhy(ulTtiReq->header.msg_id, msgSize, (void *)ulTtiReq); memset(currUlSlot, 0, sizeof(MacUlSlot));