+
+uint8_t fillOtherPucchFormatCfg(uint8_t pucchFormat, PucchFormatCfg *macFormatCfg, SchPucchCfg *schPucchCfg)
+{
+
+ switch(pucchFormat)
+ {
+ case PUCCH_FORMAT_1:
+ {
+ if(macFormatCfg)
+ {
+ MAC_ALLOC(schPucchCfg->format1, sizeof(SchPucchFormatCfg));
+ if(schPucchCfg->format1 == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for Format 1 in fillOtherPucchFormatCfg()");
+ return RFAILED;
+ }
+ fillPucchFormatCfg(macFormatCfg, schPucchCfg->format1);
+ }
+ break;
+ }
+ case PUCCH_FORMAT_2:
+ {
+ if(macFormatCfg)
+ {
+ MAC_ALLOC(schPucchCfg->format2, sizeof(SchPucchFormatCfg));
+ if(schPucchCfg->format2 == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for Format 2 in fillOtherPucchFormatCfg()");
+ return RFAILED;
+ }
+ fillPucchFormatCfg(macFormatCfg, schPucchCfg->format2);
+ }
+ break;
+ }
+ case PUCCH_FORMAT_3:
+ {
+ if(macFormatCfg)
+ {
+ MAC_ALLOC(schPucchCfg->format3, sizeof(SchPucchFormatCfg));
+ if(schPucchCfg->format3 == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for Format 3 in fillOtherPucchFormatCfg()");
+ return RFAILED;
+ }
+ fillPucchFormatCfg(macFormatCfg, schPucchCfg->format3);
+ }
+ break;
+ }
+ case PUCCH_FORMAT_4:
+ {
+ if(macFormatCfg)
+ {
+ MAC_ALLOC(schPucchCfg->format4, sizeof(SchPucchFormatCfg));
+ if(schPucchCfg->format4 == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for Format 4 in fillOtherPucchFormatCfg()");
+ return RFAILED;
+ }
+ fillPucchFormatCfg(macFormatCfg, schPucchCfg->format4);
+ }
+ break;
+ }
+ default:
+ DU_LOG("\nERROR --> MAC : Invalid Format Cfg %d in fillInitialUlBwpPucchCfg()", pucchFormat);
+ return RFAILED;
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PUCCH config in initial UL BWP config for SCH UE Cfg
+ *
+ * @details
+ *
+ * Function : fillInitalUlBwpPucchCfg
+ *
+ * Functionality:
+ * Fills PUCCH cofig in initial UL BWP config for SCH UE Cfg
+ *
+ * @params[in] macPucchCfg : Initial UL-BWP PUCCH cfg at MAC
+ * schPucchCfg : Initial UL-BWP PUCCH cfg to be filled
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitialUlBwpPucchCfg(PucchCfg *macPucchCfg, SchPucchCfg *schPucchCfg)
+{
+ if(macPucchCfg->resrcSet)
+ {
+ MAC_ALLOC(schPucchCfg->resrcSet, sizeof(SchPucchResrcSetCfg));
+ if(schPucchCfg->resrcSet == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for Resrc set List in fillInitialUlBwpPucchCfg()");
+ return RFAILED;
+ }
+ memset(schPucchCfg->resrcSet, 0, sizeof(SchPucchResrcSetCfg));
+ fillResrcSetList(macPucchCfg->resrcSet, schPucchCfg->resrcSet);
+ }
+
+ if(macPucchCfg->resrc)
+ {
+ MAC_ALLOC(schPucchCfg->resrc, sizeof(SchPucchResrcCfg));
+ if(schPucchCfg->resrc == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for Resrc List in fillInitialUlBwpPucchCfg()");
+ return RFAILED;
+ }
+ memset(schPucchCfg->resrc, 0, sizeof(SchPucchResrcCfg));
+ if((fillResrcList(macPucchCfg->resrc, schPucchCfg->resrc)) != ROK)
+ {
+ DU_LOG("\nERROR --> MAC : Failed in fillResrcList() at fillInitialUlBwpPucchCfg()");
+ return RFAILED;
+ }
+ }
+
+ /* valid for format 1, 2, 3, 4 */
+ fillOtherPucchFormatCfg(PUCCH_FORMAT_1, macPucchCfg->format1, schPucchCfg);
+ fillOtherPucchFormatCfg(PUCCH_FORMAT_2, macPucchCfg->format2, schPucchCfg);
+ fillOtherPucchFormatCfg(PUCCH_FORMAT_3, macPucchCfg->format3, schPucchCfg);
+ fillOtherPucchFormatCfg(PUCCH_FORMAT_4, macPucchCfg->format4, schPucchCfg);
+
+ if(macPucchCfg->schedReq)
+ {
+ MAC_ALLOC(schPucchCfg->schedReq, sizeof(SchPucchSchedReqCfg));
+ if(schPucchCfg->schedReq == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for PucchSchedReqCfg in fillInitialUlBwpPucchCfg()");
+ return RFAILED;
+ }
+ memset(schPucchCfg->schedReq, 0, sizeof(SchPucchSchedReqCfg));
+ fillPucchSchedReqCfg(macPucchCfg->schedReq, schPucchCfg->schedReq);
+ }
+
+ if(macPucchCfg->multiCsiCfg)
+ {
+ MAC_ALLOC(schPucchCfg->multiCsiCfg, sizeof(SchPucchMultiCsiCfg));
+ if(schPucchCfg->multiCsiCfg == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for multiCsiCfg in fillInitialUlBwpPucchCfg()");
+ return RFAILED;
+ }
+ memset(schPucchCfg->multiCsiCfg, 0, sizeof(SchPucchMultiCsiCfg));
+ fillMultiCsiCfg(macPucchCfg->multiCsiCfg, schPucchCfg->multiCsiCfg);
+ }
+
+ //TODO: To add the support for spatial Config
+ schPucchCfg->spatialInfo = NULLP;
+
+ if(macPucchCfg->dlDataToUlAck)
+ {
+ MAC_ALLOC(schPucchCfg->dlDataToUlAck, sizeof(SchPucchDlDataToUlAck));
+ if(schPucchCfg->dlDataToUlAck == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for dlDataToUlAck in fillInitialUlBwpPucchCfg()");
+ return RFAILED;
+ }
+ memset(schPucchCfg->dlDataToUlAck, 0, sizeof(SchPucchDlDataToUlAck));
+ fillDlToUlAck(macPucchCfg->dlDataToUlAck, schPucchCfg->dlDataToUlAck);
+
+ }
+
+ if(macPucchCfg->powerControl)
+ {
+ MAC_ALLOC(schPucchCfg->powerControl, sizeof(SchPucchPowerControl));
+ if(schPucchCfg->powerControl == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to allocate Mem for powerControl in fillInitialUlBwpPucchCfg()");
+ return RFAILED;
+ }
+ memset(schPucchCfg->powerControl, 0, sizeof(SchPucchPowerControl));
+ fillPucchPowerControl(macPucchCfg->powerControl, schPucchCfg->powerControl);
+ }
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief function to free Pucch Format
+ *
+ * @details
+ *
+ * Function : freeSchPucchFormat
+ *
+ * Functionality:
+ * function to free Pucch Format
+ *
+ * @params[in] pucchFormat, SchPucchResrcInfo Pointer,
+ * SchPucchResrcInfo pointer
+ * @return void
+ * ****************************************************************/
+
+void freeSchPucchFormat(uint8_t pucchFormat, SchPucchResrcInfo *resrcInfo, SchPucchFormatCfg *formatCfg)
+{
+ switch(pucchFormat)
+ {
+ case PUCCH_FORMAT_0 :
+ if(resrcInfo->SchPucchFormat.format0)
+ {
+ MAC_FREE(resrcInfo->SchPucchFormat.format0, sizeof(SchPucchFormat0));
+ resrcInfo->SchPucchFormat.format0 = NULLP;
+ }
+ break;
+
+ case PUCCH_FORMAT_1 :
+ if(resrcInfo->SchPucchFormat.format1)
+ {
+ MAC_FREE(resrcInfo->SchPucchFormat.format1, sizeof(SchPucchFormat1));
+ resrcInfo->SchPucchFormat.format1 = NULLP;
+ }
+ if(formatCfg)
+ {
+ memset(formatCfg, 0, sizeof(SchPucchFormatCfg));
+ MAC_FREE(formatCfg, sizeof(SchPucchFormatCfg));
+ }
+ break;
+
+ case PUCCH_FORMAT_2 :
+ if(resrcInfo->SchPucchFormat.format2)
+ {
+ MAC_FREE(resrcInfo->SchPucchFormat.format2, sizeof(SchPucchFormat2_3));
+ resrcInfo->SchPucchFormat.format2 = NULLP;
+ }
+ if(formatCfg)
+ {
+ memset(formatCfg, 0, sizeof(SchPucchFormatCfg));
+ MAC_FREE(formatCfg, sizeof(SchPucchFormatCfg));
+ }
+ break;
+
+ case PUCCH_FORMAT_3 :
+ if(resrcInfo->SchPucchFormat.format3)
+ {
+ MAC_FREE(resrcInfo->SchPucchFormat.format3, sizeof(SchPucchFormat2_3));
+ resrcInfo->SchPucchFormat.format3 = NULLP;
+ }
+ if(formatCfg)
+ {
+ memset(formatCfg, 0, sizeof(SchPucchFormatCfg));
+ MAC_FREE(formatCfg, sizeof(SchPucchFormatCfg));
+ }
+ break;
+
+ case PUCCH_FORMAT_4 :
+ if(resrcInfo->SchPucchFormat.format4)
+ {
+ MAC_FREE(resrcInfo->SchPucchFormat.format4, sizeof(SchPucchFormat4));
+ resrcInfo->SchPucchFormat.format4 = NULLP;
+ }
+ if(formatCfg)
+ {
+ memset(formatCfg, 0, sizeof(SchPucchFormatCfg));
+ MAC_FREE(formatCfg, sizeof(SchPucchFormatCfg));
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief function to free Pucch Resrc Cfg
+ *
+ * @details
+ *
+ * Function : freePucchResrcCfg
+ *
+ * Functionality:
+ * function to free Pucch Resrc Cfg
+ *
+ * @params[in] SchPucchResrcCfg pointer,
+ * @return void
+ * ****************************************************************/
+
+void freePucchResrcCfg(SchPucchResrcCfg *schRsrcList)
+{
+ uint8_t resrcIdx;
+
+ /* free Resrc To AddMod List */
+ for(resrcIdx = 0; resrcIdx < schRsrcList->resrcToAddModListCount; resrcIdx++)
+ {
+ freeSchPucchFormat(schRsrcList->resrcToAddModList[resrcIdx].pucchFormat,
+ &schRsrcList->resrcToAddModList[resrcIdx], NULLP);
+ memset(&schRsrcList->resrcToAddModList[resrcIdx], 0, sizeof(SchPucchResrcInfo));
+ }
+ memset(schRsrcList, 0, sizeof(SchPucchResrcCfg));
+ MAC_FREE(schRsrcList, sizeof(SchPucchResrcCfg));
+}
+
+/*******************************************************************
+ *
+ * @brief function to free Pucch Sched Req Cfg
+ *
+ * @details
+ *
+ * Function : freePucchSchedReqCfg
+ *
+ * Functionality:
+ * function to free Pucch Sched Req Cfg
+ *
+ * @params[in] SchPucchSchedReqCfg pointer,
+ * @return void
+ * ****************************************************************/
+
+void freePucchSchedReqCfg(SchPucchSchedReqCfg *schedReqCfg)
+{
+ uint8_t schedReqIdx;
+
+ for(schedReqIdx = 0; schedReqIdx < schedReqCfg->schedAddModListCount; schedReqIdx++)
+ {
+ memset(&schedReqCfg->schedAddModList[schedReqIdx], 0, sizeof(SchSchedReqResrcInfo));
+ }
+ memset(schedReqCfg, 0, sizeof(SchPucchSchedReqCfg));
+ MAC_FREE(schedReqCfg, sizeof(SchPucchSchedReqCfg));
+}
+
+/*******************************************************************
+ *
+ * @brief function to free Ul Bwp Pucch Cfg
+ *
+ * @details
+ *
+ * Function : freeUlBwpPucchCfg
+ *
+ * Functionality:
+ * function to free Ul Bwp Pucch Cfg
+ *
+ * @params[in] SchPucchCfg pointer,
+ * @return void
+ * ****************************************************************/
+
+void freeUlBwpPucchCfg(SchPucchCfg *schPucchCfg)
+{
+ if(schPucchCfg->resrcSet)
+ {
+ memset(schPucchCfg->resrcSet, 0, sizeof(SchPucchResrcSetCfg));
+ MAC_FREE(schPucchCfg->resrcSet, sizeof(SchPucchResrcSetCfg));
+ }
+ if(schPucchCfg->resrc)
+ {
+ freePucchResrcCfg(schPucchCfg->resrc);
+ }
+ if(schPucchCfg->format1)
+ {
+ freeSchPucchFormat(PUCCH_FORMAT_1, NULLP, schPucchCfg->format1);
+ }
+ if(schPucchCfg->format2)
+ {
+ freeSchPucchFormat(PUCCH_FORMAT_2, NULLP, schPucchCfg->format2);
+ }
+ if(schPucchCfg->format3)
+ {
+ freeSchPucchFormat(PUCCH_FORMAT_3, NULLP, schPucchCfg->format3);
+ }
+ if(schPucchCfg->format4)
+ {
+ freeSchPucchFormat(PUCCH_FORMAT_4, NULLP, schPucchCfg->format4);
+ }
+ if(schPucchCfg->schedReq)
+ {
+ freePucchSchedReqCfg(schPucchCfg->schedReq);
+ }
+ if(schPucchCfg->spatialInfo)
+ {
+ memset(schPucchCfg->spatialInfo, 0, sizeof(SchPucchSpatialCfg));
+ MAC_FREE(schPucchCfg->spatialInfo, sizeof(SchPucchSpatialCfg));
+ }
+ if(schPucchCfg->multiCsiCfg)
+ {
+ memset(schPucchCfg->multiCsiCfg, 0, sizeof(SchPucchMultiCsiCfg));
+ MAC_FREE(schPucchCfg->multiCsiCfg, sizeof(SchPucchMultiCsiCfg));
+ }
+ if(schPucchCfg->dlDataToUlAck)
+ {
+ memset(schPucchCfg->dlDataToUlAck, 0, sizeof(SchPucchDlDataToUlAck));
+ MAC_FREE(schPucchCfg->dlDataToUlAck, sizeof(SchPucchDlDataToUlAck));
+ }
+ if(schPucchCfg->powerControl)
+ {
+ memset(schPucchCfg->powerControl, 0, sizeof(SchPucchPowerControl));
+ MAC_FREE(schPucchCfg->powerControl, sizeof(SchPucchPowerControl));
+ }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills initail UL BWP config to send to scheduler
+ *
+ * @details
+ *
+ * Function : fillInitialUlBwp
+ *
+ * Functionality: Fills initail UL BWP config to send to sch
+ *
+ * @params[in] macInitUlBwp : Initial UL BWP cfg at MAC
+ * schInitUlBwp : Initial UL BWP cfg to be filled
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitialUlBwp(InitialUlBwp macInitUlBwp, SchInitialUlBwp *schInitUlBwp)
+{
+ schInitUlBwp->pucchCfgPres = macInitUlBwp.pucchPresent;
+ if(schInitUlBwp->pucchCfgPres)
+ {
+ memset(&schInitUlBwp->pucchCfg, 0, sizeof(SchPucchCfg));
+ if(fillInitialUlBwpPucchCfg(&macInitUlBwp.pucchCfg, &schInitUlBwp->pucchCfg) != ROK)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to fill Pucch Cfg in fillInitialUlBwpPucchCfg()");
+ freeUlBwpPucchCfg(&schInitUlBwp->pucchCfg);
+ return RFAILED;
+ }
+ }
+ schInitUlBwp->puschCfgPres = macInitUlBwp.puschPresent;
+ if(schInitUlBwp->puschCfgPres)
+ {
+ memset(&schInitUlBwp->puschCfg, 0, sizeof(SchPuschCfg));
+ if(fillInitalUlBwpPuschCfg(macInitUlBwp.puschCfg, &schInitUlBwp->puschCfg) != ROK)
+ {
+ DU_LOG("\nERROR --> MAC : Failed to fill Pusch Cfg in fillInitalUlBwpPuschCfg()");
+ return RFAILED;
+ }
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fill PDCCH cfg in Initial DL BWP for UE Cfg in Scheduler
+ *
+ * @details
+ *
+ * Function : fillInitDlBwpPdcchCfg
+ *
+ * Functionality:
+ * Fill PDCCH cfg in Initial DL BWP for UE Cfg in Scheduler
+ *
+ * @params[in] macPdcchCfg : Inital DL BWP PDCCH cfg in MAC
+ * schPdcchCfg : Inital DL BWP PDCCH cfg to be filled
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitDlBwpPdcchCfg(PdcchConfig macPdcchCfg, SchPdcchConfig *schPdcchCfg)
+{
+ uint8_t idx;
+
+ /* Fill CORESET info */
+ schPdcchCfg->numCRsetToAddMod = macPdcchCfg.numCRsetToAddMod;
+ if(schPdcchCfg->numCRsetToAddMod > MAX_NUM_CRSET)
+ {
+ DU_LOG("\nERROR --> MAC : Number of CORESET to ADD/MOD [%d] exceeds max limit [%d]",\
+ schPdcchCfg->numCRsetToAddMod, MAX_NUM_CRSET);
+ return RFAILED;
+ }
+
+ for(idx = 0; idx < schPdcchCfg->numCRsetToAddMod; idx++)
+ {
+ schPdcchCfg->cRSetToAddModList[idx].cRSetId = \
+ macPdcchCfg.cRSetToAddModList[idx].cRSetId;
+ memcpy(&schPdcchCfg->cRSetToAddModList[idx].freqDomainRsrc,\
+ &macPdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, FREQ_DOM_RSRC_SIZE);
+ schPdcchCfg->cRSetToAddModList[idx].duration = \
+ macPdcchCfg.cRSetToAddModList[idx].duration;
+ schPdcchCfg->cRSetToAddModList[idx].cceRegMappingType = \
+ macPdcchCfg.cRSetToAddModList[idx].cceRegMappingType;
+ schPdcchCfg->cRSetToAddModList[idx].precoderGranularity = \
+ macPdcchCfg.cRSetToAddModList[idx].precoderGranularity;
+ schPdcchCfg->cRSetToAddModList[idx].dmrsScramblingId = \
+ macPdcchCfg.cRSetToAddModList[idx].dmrsScramblingId;
+ }
+
+ schPdcchCfg->numCRsetToRel = macPdcchCfg.numCRsetToRel;
+ if(schPdcchCfg->numCRsetToAddMod > MAX_NUM_CRSET)
+ {
+ DU_LOG("\nERROR --> MAC : Number of CORESET to release [%d] exceeds max limit [%d]",\
+ schPdcchCfg->numCRsetToRel, MAX_NUM_CRSET);
+ return RFAILED;
+ }
+
+ for(idx = 0; idx < schPdcchCfg->numCRsetToRel; idx++)
+ {
+ /* TODO */
+ }
+
+ /* Fill Search space info */
+ schPdcchCfg->numSearchSpcToAddMod = macPdcchCfg.numSearchSpcToAddMod;
+ if(schPdcchCfg->numSearchSpcToAddMod > MAX_NUM_SEARCH_SPC)
+ {
+ DU_LOG("\nERROR --> MAC : Number of search space to ADD/MOD [%d] exceeds max [%d]", \
+ schPdcchCfg->numSearchSpcToAddMod, MAX_NUM_SEARCH_SPC);
+ return RFAILED;
+ }
+ for(idx = 0; idx < schPdcchCfg->numSearchSpcToAddMod; idx++)
+ {
+ schPdcchCfg->searchSpcToAddModList[idx].searchSpaceId = \
+ macPdcchCfg.searchSpcToAddModList[idx].searchSpaceId;
+ schPdcchCfg->searchSpcToAddModList[idx].cRSetId = \
+ macPdcchCfg.searchSpcToAddModList[idx].cRSetId;
+ schPdcchCfg->searchSpcToAddModList[idx].mSlotPeriodicityAndOffset.mSlotPeriodicity = \
+ macPdcchCfg.searchSpcToAddModList[idx].mSlotPeriodicityAndOffset.mSlotPeriodicity;
+ schPdcchCfg->searchSpcToAddModList[idx].mSlotPeriodicityAndOffset.mSlotOffset =
+ macPdcchCfg.searchSpcToAddModList[idx].mSlotPeriodicityAndOffset.mSlotOffset;
+ memcpy(&schPdcchCfg->searchSpcToAddModList[idx].mSymbolsWithinSlot,
+ &macPdcchCfg.searchSpcToAddModList[idx].mSymbolsWithinSlot, \
+ MONITORING_SYMB_WITHIN_SLOT_SIZE);
+ schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel1 = \
+ macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel1;
+ schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel2 = \
+ macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel2;
+ schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel4 = \
+ macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel4;
+ schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel8 = \
+ macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel8;
+ schPdcchCfg->searchSpcToAddModList[idx].numCandidatesAggLevel16 = \
+ macPdcchCfg.searchSpcToAddModList[idx].numCandidatesAggLevel16;
+ schPdcchCfg->searchSpcToAddModList[idx].searchSpaceType = \
+ macPdcchCfg.searchSpcToAddModList[idx].searchSpaceType;
+ schPdcchCfg->searchSpcToAddModList[idx].ueSpecificDciFormat = \
+ macPdcchCfg.searchSpcToAddModList[idx].ueSpecificDciFormat;
+ }
+
+ schPdcchCfg->numSearchSpcToRel = macPdcchCfg.numSearchSpcToRel;
+ if(schPdcchCfg->numSearchSpcToRel > MAX_NUM_SEARCH_SPC)
+ {
+ DU_LOG("\nERROR --> MAC : Number of search space to release [%d] exceeds max [%d]", \
+ schPdcchCfg->numSearchSpcToRel, MAX_NUM_SEARCH_SPC);
+ return RFAILED;
+ }
+ for(idx = 0; idx < schPdcchCfg->numSearchSpcToRel; idx++)
+ {
+ /* TODO */
+ }
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fill PDSCH cfg in Initial DL BWP for UE Cfg in Scheduler
+ *
+ * @details
+ *
+ * Function : fillInitDlBwpPdschCfg
+ *
+ * Functionality:
+ * Fill PDSCH cfg in Initial DL BWP for UE Cfg in Scheduler
+ *
+ * @params[in] macPdschCfg : Inital DL BWP PDSCH cfg at MAC
+ * schPdschCfg : Inital DL BWP PDSCH cfg to be filled
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitDlBwpPdschCfg(PdschConfig macPdschCfg, SchPdschConfig *schPdschCfg)
+{
+ uint8_t idx;
+
+ schPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
+ macPdschCfg.dmrsDlCfgForPdschMapTypeA.addPos;
+ schPdschCfg->resourceAllocType = macPdschCfg.resourceAllocType;
+ schPdschCfg->numTimeDomRsrcAlloc = macPdschCfg.numTimeDomRsrcAlloc;
+ if(schPdschCfg->numTimeDomRsrcAlloc > MAX_NUM_DL_ALLOC)
+ {
+ DU_LOG("\nERROR --> MAC : Number of time domain resource allocation [%d], exceeds\
+ max limit [%d]", schPdschCfg->numTimeDomRsrcAlloc, MAX_NUM_DL_ALLOC);
+ return RFAILED;
+ }
+
+ for(idx = 0; idx < schPdschCfg->numTimeDomRsrcAlloc; idx++)
+ {
+ if(macPdschCfg.timeDomRsrcAllociList[idx].k0)
+ {
+ MAC_ALLOC(schPdschCfg->timeDomRsrcAllociList[idx].k0, sizeof(uint8_t));
+ if(!schPdschCfg->timeDomRsrcAllociList[idx].k0)
+ {
+ DU_LOG("\nERROR --> MAC : Memory allocation failed for K0 in fillInitDlBwpPdschCfg()");
+ return RFAILED;
+ }
+ *(schPdschCfg->timeDomRsrcAllociList[idx].k0) = *(macPdschCfg.timeDomRsrcAllociList[idx].k0);
+ }
+ schPdschCfg->timeDomRsrcAllociList[idx].mappingType = \
+ macPdschCfg.timeDomRsrcAllociList[idx].mappingType;
+ schPdschCfg->timeDomRsrcAllociList[idx].startSymbol = \
+ macPdschCfg.timeDomRsrcAllociList[idx].startSymbol;
+ schPdschCfg->timeDomRsrcAllociList[idx].symbolLength = \
+ macPdschCfg.timeDomRsrcAllociList[idx].symbolLength;
+ }
+
+ schPdschCfg->rbgSize = macPdschCfg.rbgSize;
+ schPdschCfg->numCodeWordsSchByDci = macPdschCfg.numCodeWordsSchByDci;
+ schPdschCfg->bundlingType = macPdschCfg.bundlingType;
+ if(schPdschCfg->bundlingType == STATIC_BUNDLING_TYPE)
+ {
+ schPdschCfg->bundlingInfo.SchStaticBundling.size = macPdschCfg.bundlingInfo.StaticBundling.size;
+ }
+ else if(schPdschCfg->bundlingType == DYNAMIC_BUNDLING_TYPE)
+ {
+ schPdschCfg->bundlingInfo.SchDynamicBundling.sizeSet1 = macPdschCfg.bundlingInfo.DynamicBundling.sizeSet1;
+ schPdschCfg->bundlingInfo.SchDynamicBundling.sizeSet2 = macPdschCfg.bundlingInfo.DynamicBundling.sizeSet2;
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fill Initial DL BWP for SCH UE config
+ *
+ * @details
+ *
+ * Function : fillInitialDlBwp
+ *
+ * Functionality: Fill Initial DL BWP for SCH UE config
+ *
+ * @params[in] macInitDlBwp : Inital DL BWP cfg at MAC
+ * schInitDlBwp : Inital DL BWP cfg to be filled
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillInitialDlBwp(InitialDlBwp macInitDlBwp, SchInitalDlBwp *schInitDlBwp)
+{
+ schInitDlBwp->pdcchCfgPres = macInitDlBwp.pdcchPresent;
+ if(schInitDlBwp->pdcchCfgPres)
+ {
+ if(fillInitDlBwpPdcchCfg(macInitDlBwp.pdcchCfg, &schInitDlBwp->pdcchCfg) != ROK)
+ {
+ DU_LOG("\nERROR --> MAC : fillInitDlBwpPdcchCfg() failed");
+ return RFAILED;
+ }
+ }
+
+ schInitDlBwp->pdschCfgPres = macInitDlBwp.pdschPresent;
+ if(schInitDlBwp->pdschCfgPres)
+ {
+ if(fillInitDlBwpPdschCfg(macInitDlBwp.pdschCfg,&schInitDlBwp->pdschCfg) != ROK)
+ {
+ DU_LOG("\nERROR --> MAC : fillInitDlBwpPdschCfg() failed");
+ return RFAILED;
+ }
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Sp Cell config to be sent to scheduler
+ *
+ * @details
+ *
+ * Function : fillSpCellCfg
+ *
+ * Functionality: Fills Sp Cell config to be sent to scheduler
+ *
+ * @params[in] macSpCellCfg : SP cell cfg at MAC
+ * schSpCellCfg : SP cell cfg to be filled
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t fillSpCellCfg(SpCellCfg macSpCellCfg, SchSpCellCfg *schSpCellCfg)