+ if(rsrcCfgDb == NULLP)
+ {
+ rsrc->pucch_ResourceId = 1;
+ rsrc->startingPRB = 0;
+ rsrc->format.present = PUCCH_Resource__format_PR_format1;
+ DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
+ if(rsrc->format.choice.format1 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+ return RFAILED;
+ }
+ rsrc->format.choice.format1->initialCyclicShift = 0;
+ rsrc->format.choice.format1->nrofSymbols = 4;
+ rsrc->format.choice.format1->startingSymbolIndex = 0;
+ rsrc->format.choice.format1->timeDomainOCC = 0;
+ }
+ else
+ {
+ rsrc->pucch_ResourceId = rsrcCfgDb->resrcToAddModList[rsrcIdx].resrcId;
+ rsrc->startingPRB = rsrcCfgDb->resrcToAddModList[rsrcIdx].startPrb;
+ if(rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop)
+ {
+ DU_ALLOC(rsrc->intraSlotFrequencyHopping, sizeof(long));
+ if(rsrc->intraSlotFrequencyHopping == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+ return RFAILED;
+ }
+ *(rsrc->intraSlotFrequencyHopping) = rsrcCfgDb->resrcToAddModList[rsrcIdx].intraFreqHop;
+ }
+ else
+ rsrc->intraSlotFrequencyHopping = NULLP;
+
+ if(rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop)
+ {
+ DU_ALLOC(rsrc->secondHopPRB, sizeof(PRB_Id_t));
+ if(rsrc->secondHopPRB == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+ return RFAILED;
+ }
+ *(rsrc->secondHopPRB) = rsrcCfgDb->resrcToAddModList[rsrcIdx].secondPrbHop;
+ }
+ else
+ rsrc->secondHopPRB = NULLP;
+ rsrc->format.present = covertPucchFormatIntEnumToRrcEnum(rsrcCfgDb->resrcToAddModList[rsrcIdx].pucchFormat);
+
+ switch(rsrc->format.present)
+ {
+ case PUCCH_Resource__format_PR_NOTHING:
+ break;
+ case PUCCH_Resource__format_PR_format0:
+ {
+ DU_ALLOC(rsrc->format.choice.format0, sizeof(PUCCH_format0_t));
+ if(rsrc->format.choice.format0 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+ return RFAILED;
+ }
+ rsrc->format.choice.format0->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->initialCyclicShift;
+ rsrc->format.choice.format0->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->numSymbols;
+ rsrc->format.choice.format0->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format0->startSymbolIdx;
+ break;
+ }
+
+ case PUCCH_Resource__format_PR_format1:
+ {
+ DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
+ if(rsrc->format.choice.format1 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+ return RFAILED;
+ }
+ rsrc->format.choice.format1->initialCyclicShift = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->initialCyclicShift;
+ rsrc->format.choice.format1->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->numSymbols;
+ rsrc->format.choice.format1->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->startSymbolIdx;
+ rsrc->format.choice.format1->timeDomainOCC = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format1->timeDomOCC;
+ break;
+ }
+
+ case PUCCH_Resource__format_PR_format2:
+ {
+ DU_ALLOC(rsrc->format.choice.format2, sizeof(PUCCH_format2_t));
+ if(rsrc->format.choice.format2 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+ return RFAILED;
+ }
+ rsrc->format.choice.format2->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numPrbs;
+ rsrc->format.choice.format2->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->numSymbols;
+ rsrc->format.choice.format2->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format2->startSymbolIdx;
+ break;
+ }
+
+ case PUCCH_Resource__format_PR_format3:
+ {
+ DU_ALLOC(rsrc->format.choice.format3, sizeof(PUCCH_format3_t));
+ if(rsrc->format.choice.format3 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+ return RFAILED;
+ }
+ rsrc->format.choice.format3->nrofPRBs = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numPrbs;
+ rsrc->format.choice.format3->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->numSymbols;
+ rsrc->format.choice.format3->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format3->startSymbolIdx;
+ break;
+ }
+
+ case PUCCH_Resource__format_PR_format4:
+ {
+ DU_ALLOC(rsrc->format.choice.format4, sizeof(PUCCH_format4_t));
+ if(rsrc->format.choice.format4 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchRsrcAddModList");
+ return RFAILED;
+ }
+ rsrc->format.choice.format4->nrofSymbols = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->numSymbols;
+ rsrc->format.choice.format4->occ_Length = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occLen;
+ rsrc->format.choice.format4->occ_Index = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->occIdx;
+ rsrc->format.choice.format4->startingSymbolIndex = rsrcCfgDb->resrcToAddModList[rsrcIdx].PucchFormat.format4->startSymbolIdx;
+ break;
+ }
+ }
+ }
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds PUCCH format config
+ *
+ * @details
+ *
+ * Function : BuildPucchFormat
+ *
+ * Functionality: Builds PUCCH format config
+ *
+ * @params[in] : PucchFormatCfg *formatDb
+ * PUCCH_FormatConfig_t *format
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPucchFormat(PucchFormatCfg *formatDb, PUCCH_FormatConfig_t *format)
+{
+ /* Inter Slot Fequency hopping */
+ format->interslotFrequencyHopping = NULLP;
+ if((formatDb != NULLP) && (formatDb->interSlotFreqHop == true))
+ {
+ DU_ALLOC(format->interslotFrequencyHopping, sizeof(long));
+ if(format->interslotFrequencyHopping)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
+ return RFAILED;
+ }
+ *(format->interslotFrequencyHopping) = PUCCH_FormatConfig__interslotFrequencyHopping_enabled;
+ }
+
+ /* Additional DMRS */
+ format->additionalDMRS = NULLP;
+ if((formatDb != NULLP) && (formatDb->addDmrs == true))
+ {
+ DU_ALLOC(format->additionalDMRS, sizeof(long));
+ if(format->additionalDMRS)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
+ return RFAILED;
+ }
+ *(format->additionalDMRS) = PUCCH_FormatConfig__additionalDMRS_true;
+ }
+
+ /* Maximum code rate */
+ format->maxCodeRate = NULLP;
+ if((formatDb != NULLP) && (formatDb->maxCodeRate != 0))
+ {
+ DU_ALLOC(format->maxCodeRate, sizeof(long));
+ if(format->maxCodeRate)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
+ return RFAILED;
+ }
+ *(format->maxCodeRate) = formatDb->maxCodeRate;
+ }
+
+ /* Number of slots */
+ format->nrofSlots = NULLP;
+ if((formatDb == NULLP) || ((formatDb != NULLP) && (formatDb->numSlots != 0)))
+ {
+ DU_ALLOC(format->nrofSlots, sizeof(long));
+ if(format->nrofSlots == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
+ return RFAILED;
+ }
+ if(formatDb == NULLP)
+ *(format->nrofSlots) = PUCCH_FormatConfig__nrofSlots_n4;
+ else
+ *(format->nrofSlots) = formatDb->numSlots;
+ }
+
+ /* Pi2BPSK*/
+ format->pi2BPSK = NULLP;
+ if((formatDb != NULLP) && (formatDb->pi2BPSK == true))
+ {
+ DU_ALLOC(format->pi2BPSK, sizeof(long));
+ if(format->pi2BPSK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
+ return RFAILED;
+ }
+ *(format->pi2BPSK) = PUCCH_FormatConfig__pi2BPSK_enabled;
+ }
+
+ /* Simultaneous HARQ ACK and CSI */
+ format->simultaneousHARQ_ACK_CSI = NULLP;
+ if((formatDb != NULLP) && (formatDb->harqAckCSI == true))
+ {
+ DU_ALLOC(format->simultaneousHARQ_ACK_CSI, sizeof(long));
+ if(format->simultaneousHARQ_ACK_CSI)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPucchFormat");
+ return RFAILED;
+ }
+ *(format->simultaneousHARQ_ACK_CSI) = PUCCH_FormatConfig__simultaneousHARQ_ACK_CSI_true;
+ }
+
+ return ROK;
+}
+
+
+/*******************************************************************
+ *
+ * @brief Builds PUCCH scheduling request list
+ *
+ * @details
+ *
+ * Function : BuildPucchSchReqAddModList
+ *
+ * Functionality:
+ * Builds PUCCH scheduling request list
+ *
+ * @params[in] : PucchSchedReqCfg *schReqDb
+ * struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPucchSchReqAddModList(PucchSchedReqCfg *schReqDb, \
+ struct PUCCH_Config__schedulingRequestResourceToAddModList *schReqRsrcToAddModList)
+{
+ uint8_t elementCnt = 0, schReqIdx = 0;
+ SchedulingRequestResourceConfig_t *schReqRsrc;
+
+ elementCnt = schReqDb->schedAddModListCount;
+ schReqRsrcToAddModList->list.count = elementCnt;
+ schReqRsrcToAddModList->list.size = elementCnt *sizeof(struct SchedulingRequestResourceConfig *);
+
+ schReqRsrcToAddModList->list.array = NULLP;
+ DU_ALLOC(schReqRsrcToAddModList->list.array, schReqRsrcToAddModList->list.size);
+ if(schReqRsrcToAddModList->list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
+ return RFAILED;
+ }
+
+ for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
+ {
+ DU_ALLOC(schReqRsrcToAddModList->list.array[schReqIdx], schReqRsrcToAddModList->list.size);
+ if(schReqRsrcToAddModList->list.array[schReqIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
+ return RFAILED;
+ }
+ }
+
+ for(schReqIdx = 0; schReqIdx < schReqRsrcToAddModList->list.count; schReqIdx++)
+ {
+ schReqRsrc = schReqRsrcToAddModList->list.array[schReqIdx];
+ schReqRsrc->schedulingRequestResourceId = schReqDb->schedAddModList[schReqIdx].resrcId;
+ schReqRsrc->schedulingRequestID = schReqDb->schedAddModList[schReqIdx].requestId;
+
+ if(schReqDb->schedAddModList[schReqIdx].periodicity)
+ {
+ schReqRsrc->periodicityAndOffset = NULLP;
+ DU_ALLOC(schReqRsrc->periodicityAndOffset, sizeof(struct SchedulingRequestResourceConfig__periodicityAndOffset));
+ if(schReqRsrc->periodicityAndOffset == NULLP)
+ {
+ DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
+ return RFAILED;
+ }
+
+ schReqRsrc->periodicityAndOffset->present = schReqDb->schedAddModList[schReqIdx].periodicity;
+ switch(schReqRsrc->periodicityAndOffset->present)
+ {
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_NOTHING:
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym2:
+ schReqRsrc->periodicityAndOffset->choice.sym2 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sym6or7:
+ schReqRsrc->periodicityAndOffset->choice.sym6or7 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1:
+ schReqRsrc->periodicityAndOffset->choice.sl1 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2:
+ schReqRsrc->periodicityAndOffset->choice.sl2 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4:
+ schReqRsrc->periodicityAndOffset->choice.sl4 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5:
+ schReqRsrc->periodicityAndOffset->choice.sl5 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8:
+ schReqRsrc->periodicityAndOffset->choice.sl8 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10:
+ schReqRsrc->periodicityAndOffset->choice.sl10 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16:
+ schReqRsrc->periodicityAndOffset->choice.sl16 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20:
+ schReqRsrc->periodicityAndOffset->choice.sl20 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40:
+ schReqRsrc->periodicityAndOffset->choice.sl40 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80:
+ schReqRsrc->periodicityAndOffset->choice.sl80 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160:
+ schReqRsrc->periodicityAndOffset->choice.sl160 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320:
+ schReqRsrc->periodicityAndOffset->choice.sl320 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ case SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640:
+ schReqRsrc->periodicityAndOffset->choice.sl640 = schReqDb->schedAddModList[schReqIdx].offset;
+ break;
+ }
+ }
+
+ if(schReqDb->schedAddModList[schReqIdx].resrc)
+ {
+ schReqRsrc->resource = NULLP;
+ DU_ALLOC(schReqRsrc->resource, sizeof(PUCCH_ResourceId_t));
+ if(schReqRsrc->resource == NULLP)
+ {
+ DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchSchReqAddModList");
+ return RFAILED;
+ }
+ *(schReqRsrc->resource) = schReqDb->schedAddModList[schReqIdx].resrc;
+
+ }
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds PUCCH multi csi resource list
+ *
+ * @details
+ *
+ * Function : BuildPucchMultiCsiRsrcList
+ *
+ * Functionality:
+ * Builds PUCCH multi csi resource list
+ *
+ * @params[in] : PucchMultiCsiCfg *multiCsiDb
+ * struct PUCCH_Config__multi_CSI_PUCCH_ResourceList *multiCsiRsrcList
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPucchMultiCsiRsrcList(PucchMultiCsiCfg *multiCsiDb, struct PUCCH_Config__multi_CSI_PUCCH_ResourceList *multiCsiRsrcList)
+{
+ uint8_t elementCnt = 0, rsrcIdx = 0;
+
+ elementCnt = multiCsiDb->multiCsiResrcListCount;
+ multiCsiRsrcList->list.count = elementCnt;
+ multiCsiRsrcList->list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
+ multiCsiRsrcList->list.array = NULLP;
+ DU_ALLOC(multiCsiRsrcList->list.array, multiCsiRsrcList->list.size);
+ if(multiCsiRsrcList->list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
+ return RFAILED;
+ }
+
+ for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
+ {
+ DU_ALLOC(multiCsiRsrcList->list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
+ if(multiCsiRsrcList->list.array[rsrcIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> DU APP: Memory allocation failed in BuildPucchMultiCsiRsrcList");
+ return RFAILED;
+ }
+ }
+
+ for(rsrcIdx = 0; rsrcIdx<multiCsiRsrcList->list.count; rsrcIdx++)
+ {
+ *(multiCsiRsrcList->list.array[rsrcIdx]) = multiCsiDb->multiCsiResrcList[rsrcIdx];
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds DL data -to- Ul Ack list
+ *
+ * @details
+ *
+ * Function : BuildDlDataToUlAckList
+ *
+ * Functionality: Builds DL data -to- Ul Ack list
+ *
+ * @params[in] : PucchDlDataToUlAck *dlDataToUlAckDb
+ * struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildDlDataToUlAckList(PucchDlDataToUlAck *dlDataToUlAckDb, struct PUCCH_Config__dl_DataToUL_ACK * dlDataToUlACKList)
+{
+ uint8_t elementCnt = 0, arrIdx = 0;
+
+ if(dlDataToUlAckDb == NULLP)
+ elementCnt = 2;
+ else
+ elementCnt = dlDataToUlAckDb->dlDataToUlAckListCount;
+
+ dlDataToUlACKList->list.count = elementCnt;
+ dlDataToUlACKList->list.size = elementCnt * sizeof(long *);
+ DU_ALLOC(dlDataToUlACKList->list.array, dlDataToUlACKList->list.size);
+ if(dlDataToUlACKList->list.array == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDlDataToUlAckList");
+ return RFAILED;
+ }
+
+ for(arrIdx = 0; arrIdx < dlDataToUlACKList->list.count; arrIdx++)
+ {
+ DU_ALLOC(dlDataToUlACKList->list.array[arrIdx], sizeof(long));
+ if(dlDataToUlACKList->list.array[arrIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildDlDataToUlAckList");
+ return RFAILED;
+ }
+ }
+
+ if(dlDataToUlAckDb == NULLP)
+ {
+ arrIdx = 0;
+ *(dlDataToUlACKList->list.array[arrIdx++]) = 1;
+ *(dlDataToUlACKList->list.array[arrIdx]) = 2;
+ }
+ else
+ {
+ for(arrIdx = 0; arrIdx < dlDataToUlACKList->list.count; arrIdx++)
+ {
+ *(dlDataToUlACKList->list.array[arrIdx]) = dlDataToUlAckDb->dlDataToUlAckList[arrIdx];
+ }
+ }
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds BWP UL dedicated PUCCH Config
+ *
+ * @details
+ *
+ * Function : BuildBWPUlDedPucchCfg
+ *
+ * Functionality:
+ * Builds BWP UL dedicated PUCCH Config
+ *
+ * @params[in] : PUCCH_Config_t *pucchCfg
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildBWPUlDedPucchCfg(PucchCfg *pucchCfgDb, PUCCH_Config_t *pucchCfg)
+{
+ PucchResrcSetCfg *rsrcSetCfgDb = NULLP;
+ PucchResrcCfg *rsrcCfgDb = NULLP;
+ PucchFormatCfg *format1Db = NULLP;
+ PucchFormatCfg *format2Db = NULLP;
+ PucchFormatCfg *format3Db = NULLP;
+ PucchFormatCfg *format4Db = NULLP;
+ PucchSchedReqCfg *schReqDb = NULLP;
+ PucchMultiCsiCfg *multiCsiDb = NULLP;
+ PucchDlDataToUlAck *dlDataToUlAckDb = NULLP;
+
+ if(pucchCfgDb)
+ {
+ rsrcSetCfgDb = pucchCfgDb->resrcSet;
+ rsrcCfgDb = pucchCfgDb->resrc;
+ format1Db = pucchCfgDb->format1;
+ format2Db = pucchCfgDb->format2;
+ format3Db = pucchCfgDb->format3;
+ format4Db = pucchCfgDb->format4;
+ schReqDb = pucchCfgDb->schedReq;
+ multiCsiDb = pucchCfgDb->multiCsiCfg;
+ dlDataToUlAckDb = pucchCfgDb->dlDataToUlAck;
+ }
+
+ /* RESOURCE SET */
+ DU_ALLOC(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
+ if(pucchCfg->resourceSetToAddModList == NULL)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ if(BuildPucchRsrcSetAddModList(rsrcSetCfgDb, pucchCfg->resourceSetToAddModList) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ /* PUCCH RESOURCE */
+ DU_ALLOC(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
+ if(pucchCfg->resourceToAddModList == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ if(BuildPucchRsrcAddModList(rsrcCfgDb, pucchCfg->resourceToAddModList) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ /* PUCCH Format 1 */
+ DU_ALLOC(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
+ if(pucchCfg->format1 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ pucchCfg->format1->present = PUCCH_Config__format1_PR_setup;
+ DU_ALLOC(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
+ if(pucchCfg->format1->choice.setup == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ if(BuildPucchFormat(format1Db, pucchCfg->format1->choice.setup) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ /* PUCCH Format 2 */
+ if(format2Db)
+ {
+ DU_ALLOC(pucchCfg->format2, sizeof(struct PUCCH_Config__format2));
+ if(pucchCfg->format2 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ pucchCfg->format2->present = PUCCH_Config__format2_PR_setup;
+ DU_ALLOC(pucchCfg->format2->choice.setup, sizeof(PUCCH_FormatConfig_t));
+ if(pucchCfg->format2->choice.setup == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ if(BuildPucchFormat(format2Db, pucchCfg->format2->choice.setup) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+ }
+
+ /* PUCCH Format 3 */
+ if(format3Db)
+ {
+ DU_ALLOC(pucchCfg->format3, sizeof(struct PUCCH_Config__format3));
+ if(pucchCfg->format3 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ pucchCfg->format3->present = PUCCH_Config__format3_PR_setup;
+ DU_ALLOC(pucchCfg->format3->choice.setup, sizeof(PUCCH_FormatConfig_t));
+ if(pucchCfg->format3->choice.setup == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ if(BuildPucchFormat(format3Db, pucchCfg->format3->choice.setup) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+ }
+
+ /* PUCCH Format 4 */
+ if(format4Db)
+ {
+ DU_ALLOC(pucchCfg->format4, sizeof(struct PUCCH_Config__format4));
+ if(pucchCfg->format4 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ pucchCfg->format4->present = PUCCH_Config__format4_PR_setup;
+ DU_ALLOC(pucchCfg->format4->choice.setup, sizeof(PUCCH_FormatConfig_t));
+ if(pucchCfg->format4->choice.setup == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ if(BuildPucchFormat(format4Db, pucchCfg->format4->choice.setup) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+ }
+
+ /* Scheduling Request */
+ if(schReqDb && (schReqDb->schedAddModListCount != 0))
+ {
+ pucchCfg->schedulingRequestResourceToAddModList = NULLP;
+ DU_ALLOC(pucchCfg->schedulingRequestResourceToAddModList, sizeof(struct PUCCH_Config__schedulingRequestResourceToAddModList));
+ if(pucchCfg->schedulingRequestResourceToAddModList == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ if(BuildPucchSchReqAddModList(schReqDb, pucchCfg->schedulingRequestResourceToAddModList) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+ }
+
+ /* Multi CSI */
+ if(multiCsiDb && (multiCsiDb->multiCsiResrcListCount != 0))
+ {
+ pucchCfg->multi_CSI_PUCCH_ResourceList = NULLP;
+ DU_ALLOC(pucchCfg->multi_CSI_PUCCH_ResourceList, sizeof(struct PUCCH_Config__multi_CSI_PUCCH_ResourceList));
+ if(pucchCfg->multi_CSI_PUCCH_ResourceList == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ if(BuildPucchMultiCsiRsrcList(multiCsiDb, pucchCfg->multi_CSI_PUCCH_ResourceList) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+ }
+
+ /* DL DATA TO UL ACK */
+ DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
+ if(pucchCfg->dl_DataToUL_ACK == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ if(BuildDlDataToUlAckList(dlDataToUlAckDb, pucchCfg->dl_DataToUL_ACK) != ROK)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+ return RFAILED;
+ }
+
+ /* TODO : spatial relation info add/mod list and power control*/
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills SRS resource to add/modify list
+ *
+ * @details
+ *
+ * Function : BuildSrsRsrcAddModList
+ *
+ * Functionality: Fills SRS resource to add/modify list
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSrsRsrcAddModList(struct SRS_Config__srs_ResourceToAddModList *resourceList)
+{
+ uint8_t elementCnt;
+ uint8_t rsrcIdx;
+
+ elementCnt = 1;
+ resourceList->list.count = elementCnt;
+ resourceList->list.size = elementCnt * sizeof(SRS_Resource_t *);
+ resourceList->list.array = NULLP;
+ DU_ALLOC(resourceList->list.array, resourceList->list.size);
+ if(!resourceList->list.array)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
+ return RFAILED;
+ }
+
+ for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
+ {
+ DU_ALLOC(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
+ if(!resourceList->list.array[rsrcIdx])
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
+ return RFAILED;
+ }
+ }
+
+ rsrcIdx = 0;
+ resourceList->list.array[rsrcIdx]->srs_ResourceId = SRS_RSRC_ID;
+ resourceList->list.array[rsrcIdx]->nrofSRS_Ports = SRS_Resource__nrofSRS_Ports_port1;
+ resourceList->list.array[rsrcIdx]->transmissionComb.present = SRS_Resource__transmissionComb_PR_n2;
+
+ resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2 = NULLP;
+ DU_ALLOC(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2, \
+ sizeof(struct SRS_Resource__transmissionComb__n2));
+ if(!resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
+ return RFAILED;
+ }
+ resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->combOffset_n2\
+ = SRS_COMB_OFFSET_N2;
+ resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->cyclicShift_n2\
+ = SRS_CYCLIC_SHIFT_N2;
+
+ resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = \
+ PUSCH_START_SYMBOL;
+ resourceList->list.array[rsrcIdx]->resourceMapping.nrofSymbols = \
+ SRS_Resource__resourceMapping__nrofSymbols_n1;
+ resourceList->list.array[rsrcIdx]->resourceMapping.repetitionFactor = \
+ SRS_Resource__resourceMapping__repetitionFactor_n1;
+
+ resourceList->list.array[rsrcIdx]->freqDomainPosition = SRS_FREQ_DOM_POS;
+ resourceList->list.array[rsrcIdx]->freqDomainShift = SRS_FREQ_DOM_SHIFT;
+ resourceList->list.array[rsrcIdx]->freqHopping.c_SRS = C_SRS;
+ resourceList->list.array[rsrcIdx]->freqHopping.b_SRS = B_SRS;
+ resourceList->list.array[rsrcIdx]->freqHopping.b_hop = B_HOP;
+ resourceList->list.array[rsrcIdx]->groupOrSequenceHopping = \
+ SRS_Resource__groupOrSequenceHopping_neither;
+
+ /* Setting resource type to aperiodic for intergration purposes */
+ resourceList->list.array[rsrcIdx]->resourceType.present = \
+ SRS_Resource__resourceType_PR_aperiodic;
+ resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic = NULLP;
+ DU_ALLOC(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,
+ sizeof(struct SRS_Resource__resourceType__aperiodic));
+ if(!resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcAddModList");
+ return RFAILED;
+ }
+
+ resourceList->list.array[rsrcIdx]->sequenceId = SRS_SEQ_ID;
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Build SRS resource set Add/mod list
+ *
+ * @details
+ *
+ * Function : BuildSrsRsrcSetAddModList
+ *
+ * Functionality: Build SRS resource set Add/mod list
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+ uint8_t BuildSrsRsrcSetAddModList
+(
+ struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList
+ )
+{
+ uint8_t elementCnt;
+ uint8_t rSetIdx;
+ uint8_t rsrcIdx;
+ struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList;
+
+ elementCnt = 1;
+ rsrcSetList->list.count = elementCnt;
+ rsrcSetList->list.size = elementCnt * sizeof(SRS_ResourceSet_t *);
+ rsrcSetList->list.array = NULLP;
+ DU_ALLOC(rsrcSetList->list.array, rsrcSetList->list.size);
+ if(!rsrcSetList->list.array)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+ return RFAILED;
+ }
+
+ for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
+ {
+ DU_ALLOC(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
+ if(!rsrcSetList->list.array[rSetIdx])
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+ return RFAILED;
+ }
+ }
+
+ rSetIdx = 0;
+ rsrcSetList->list.array[rSetIdx]->srs_ResourceSetId = SRS_RSET_ID;
+
+ /* Fill Resource Id list in resource set */
+ rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
+ DU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
+ sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
+ if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+ return RFAILED;
+ }
+
+ elementCnt = 1;
+ rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
+ rsrcIdList->list.count = elementCnt;
+ rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
+ rsrcIdList->list.array = NULLP;
+ DU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
+ if(!rsrcIdList->list.array)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+ return RFAILED;
+ }
+
+ for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
+ {
+ DU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
+ if(!rsrcIdList->list.array[rsrcIdx])
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+ return RFAILED;
+ }
+ }
+
+ rsrcIdx = 0;
+ *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
+
+ /* Fill resource type */
+ rsrcSetList->list.array[rSetIdx]->resourceType.present = \
+ SRS_ResourceSet__resourceType_PR_aperiodic;
+
+ rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic = NULLP;
+ DU_ALLOC(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
+ sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
+ if(!rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildSrsRsrcSetAddModList");
+ return RFAILED;
+ }
+ rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger \
+ = APERIODIC_SRS_RESRC_TRIGGER;
+
+ /* TODO : Fill values for below IEs as expected by Viavi */
+ rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->csi_RS = NULLP;
+ rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->slotOffset = NULLP;
+
+
+ rsrcSetList->list.array[rSetIdx]->usage = SRS_ResourceSet__usage_codebook;
+ rsrcSetList->list.array[rSetIdx]->alpha = NULLP;
+ rsrcSetList->list.array[rSetIdx]->p0 = NULLP;
+ rsrcSetList->list.array[rSetIdx]->pathlossReferenceRS = NULLP;
+ rsrcSetList->list.array[rSetIdx]->srs_PowerControlAdjustmentStates = NULLP;
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds BWP UL dedicated SRS Config
+ *
+ * @details
+ *
+ * Function : BuildBWPUlDedSrsCfg
+ *
+ * Functionality: Builds BWP UL dedicated SRS Config
+ *
+ * @params[in] SRS Config
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildBWPUlDedSrsCfg(SRS_Config_t *srsCfg)
+{
+ srsCfg->srs_ResourceSetToReleaseList = NULLP;
+ srsCfg->srs_ResourceSetToAddModList = NULLP;
+ DU_ALLOC(srsCfg->srs_ResourceSetToAddModList, \
+ sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
+ if(!srsCfg->srs_ResourceSetToAddModList)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
+ return RFAILED;
+ }
+ if(BuildSrsRsrcSetAddModList(srsCfg->srs_ResourceSetToAddModList) != ROK)
+ {
+ return RFAILED;
+ }
+
+ srsCfg->srs_ResourceToReleaseList = NULLP;
+
+ /* Resource to Add/Modify list */
+ srsCfg->srs_ResourceToAddModList = NULLP;
+ DU_ALLOC(srsCfg->srs_ResourceToAddModList, \
+ sizeof(struct SRS_Config__srs_ResourceToAddModList));
+ if(!srsCfg->srs_ResourceToAddModList)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildBWPUlDedSrsCfg");
+ return RFAILED;
+ }
+
+ if(BuildSrsRsrcAddModList(srsCfg->srs_ResourceToAddModList) != ROK)
+ {
+ return RFAILED;
+ }
+ srsCfg->tpc_Accumulation = NULLP;
+
+ return ROK;
+}
+
+
+
+/*******************************************************************
+ *
+ * @brief Builds Pusch Serving cell Config
+ *
+ * @details
+ *
+ * Function : BuildPuschSrvCellCfg
+ *
+ * Functionality: Builds Pusch Serving cell Config
+ *
+ * @params[in] struct UplinkConfig__pusch_ServingCellConfig *puschCfg
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *puschCfg)
+{
+ puschCfg->present = UplinkConfig__pusch_ServingCellConfig_PR_setup;
+ puschCfg->choice.setup = NULLP;
+ DU_ALLOC(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
+ if(!puschCfg->choice.setup)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+ return RFAILED;
+ }
+
+ puschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
+ puschCfg->choice.setup->rateMatching = NULLP;
+ puschCfg->choice.setup->xOverhead = NULLP;
+ puschCfg->choice.setup->ext1 = NULLP;
+
+ DU_ALLOC(puschCfg->choice.setup->ext1, sizeof(struct PUSCH_ServingCellConfig__ext1));
+ if(!puschCfg->choice.setup->ext1)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+ return RFAILED;
+ }
+
+ puschCfg->choice.setup->ext1->maxMIMO_Layers = NULLP;
+ DU_ALLOC(puschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
+ if(!puschCfg->choice.setup->ext1->maxMIMO_Layers)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+ return RFAILED;
+ }
+ *(puschCfg->choice.setup->ext1->maxMIMO_Layers) = PUSCH_MAX_MIMO_LAYERS;
+
+ puschCfg->choice.setup->ext1->processingType2Enabled= NULLP;
+ DU_ALLOC(puschCfg->choice.setup->ext1->processingType2Enabled,sizeof(BOOLEAN_t));
+ if(!puschCfg->choice.setup->ext1->processingType2Enabled)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+ return RFAILED;
+ }
+ *(puschCfg->choice.setup->ext1->processingType2Enabled) = PUSCH_PROCESS_TYPE2_ENABLED;
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds inital UL BWP
+ *
+ * @details
+ *
+ * Function : BuildInitialUlBWP
+ *
+ * Functionality: Builds initial UL BWP
+ *
+ * @params[in] BWP_UplinkDedicated_t *ulBwp
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildInitialUlBWP(InitialUlBwp *initUlBwp, BWP_UplinkDedicated_t *ulBwp)
+{
+ PucchCfg *pucchCfg = NULLP;
+ PuschCfg *puschCfg = NULLP;
+
+ if(initUlBwp)
+ {
+ if(initUlBwp->pucchPresent)
+ pucchCfg = &initUlBwp->pucchCfg;
+ if(initUlBwp->puschPresent)
+ puschCfg = &initUlBwp->puschCfg;
+ }
+
+ ulBwp->pucch_Config = NULLP;
+ DU_ALLOC(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
+ if(!ulBwp->pucch_Config)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
+ return RFAILED;
+ }
+
+ ulBwp->pucch_Config->present = BWP_UplinkDedicated__pucch_Config_PR_setup;
+ ulBwp->pucch_Config->choice.setup = NULLP;
+ DU_ALLOC(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
+ if(!ulBwp->pucch_Config->choice.setup)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
+ return RFAILED;
+ }
+
+ if(BuildBWPUlDedPucchCfg(pucchCfg, ulBwp->pucch_Config->choice.setup) != ROK)
+ {
+ return RFAILED;
+ }
+
+ /* Fill BWP UL dedicated PUSCH config */
+ ulBwp->pusch_Config = NULLP;
+ DU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
+ if(!ulBwp->pusch_Config)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
+ return RFAILED;
+ }
+
+ ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup;
+ ulBwp->pusch_Config->choice.setup = NULLP;
+ DU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
+ if(!ulBwp->pusch_Config->choice.setup)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
+ return RFAILED;
+ }
+
+ if(BuildBWPUlDedPuschCfg(puschCfg, ulBwp->pusch_Config->choice.setup) != ROK)
+ {
+ return RFAILED;
+ }
+
+ ulBwp->configuredGrantConfig = NULLP;
+
+ /* Fill BPW UL dedicated SRS config */
+ ulBwp->srs_Config = NULLP;
+ DU_ALLOC(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
+ if(!ulBwp->srs_Config)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
+ return RFAILED;
+ }
+
+ ulBwp->srs_Config->present = BWP_UplinkDedicated__srs_Config_PR_setup;
+ ulBwp->srs_Config->choice.setup = NULLP;
+ DU_ALLOC(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
+ if(!ulBwp->srs_Config->choice.setup)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildInitialUlBWP");
+ return RFAILED;
+ }
+
+ if(BuildBWPUlDedSrsCfg(ulBwp->srs_Config->choice.setup) != ROK)
+ {
+ return RFAILED;
+ }
+
+ ulBwp->beamFailureRecoveryConfig = NULLP;
+
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds UL config
+ * @details
+ *
+ * Function : BuildUlCfg
+ *
+ * Functionality: Builds UL config in spCellCfgDed
+ *
+ * @params[in] UplinkConfig_t *ulCfg
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildUlCfg(ServCellRecfgInfo *servCellRecfg, UplinkConfig_t *ulCfg)
+{
+ InitialUlBwp *initUlBwp = NULLP;
+
+ if(servCellRecfg)
+ {
+ initUlBwp = &servCellRecfg->initUlBwp;
+ }
+
+ ulCfg->initialUplinkBWP = NULLP;
+ DU_ALLOC(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
+ if(!ulCfg->initialUplinkBWP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
+ return RFAILED;
+ }
+
+ if(BuildInitialUlBWP(initUlBwp, ulCfg->initialUplinkBWP) != ROK)
+ {
+ return RFAILED;
+ }
+
+ ulCfg->uplinkBWP_ToReleaseList = NULLP;
+ ulCfg->uplinkBWP_ToAddModList = NULLP;
+ ulCfg->firstActiveUplinkBWP_Id = NULLP;
+ DU_ALLOC(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
+ if(!ulCfg->firstActiveUplinkBWP_Id)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
+ return RFAILED;
+ }
+ if(servCellRecfg == NULLP)
+ *(ulCfg->firstActiveUplinkBWP_Id) = ACTIVE_UL_BWP_ID;
+ else
+ *(ulCfg->firstActiveUplinkBWP_Id) = servCellRecfg->firstActvUlBwpId;
+
+ ulCfg->pusch_ServingCellConfig = NULLP;
+ DU_ALLOC(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
+ if(!ulCfg->pusch_ServingCellConfig)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory Allocation failed in BuildUlCfg");
+ return RFAILED;
+ }
+
+ if(BuildPuschSrvCellCfg(ulCfg->pusch_ServingCellConfig) != ROK)
+ {
+ return RFAILED;
+ }
+
+ ulCfg->carrierSwitching = NULLP;
+ ulCfg->ext1 = NULLP;
+ return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds PDSCH serving cell config
+ * @details
+ *
+ * Function : BuildPdschSrvCellCfg
+ *
+ * Functionality: Builds PDSCH serving cell config in spCellCfgDed
+ *
+ * @params[in] struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg
+ *
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPdschSrvCellCfg(PdschServCellCfg *pdschServCellDb, struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg)
+{
+ pdschCfg->present = ServingCellConfig__pdsch_ServingCellConfig_PR_setup;
+ pdschCfg->choice.setup = NULLP;
+ DU_ALLOC(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
+ if(!pdschCfg->choice.setup)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+ return RFAILED;
+ }
+
+ /* Code Block Group Transmission */
+ pdschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
+ if(pdschServCellDb && (pdschServCellDb->maxCodeBlkGrpPerTb || pdschServCellDb->codeBlkGrpFlushInd))
+ {
+ DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission, sizeof(struct PDSCH_ServingCellConfig__codeBlockGroupTransmission));
+ if(pdschCfg->choice.setup->codeBlockGroupTransmission == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+ return RFAILED;
+ }
+
+ pdschCfg->choice.setup->codeBlockGroupTransmission->present = PDSCH_ServingCellConfig__codeBlockGroupTransmission_PR_setup;
+ pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup = NULLP;
+ DU_ALLOC(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup, sizeof(struct PDSCH_CodeBlockGroupTransmission ));
+ if(pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+ return RFAILED;
+ }
+
+ pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock = \
+ *(pdschServCellDb->maxCodeBlkGrpPerTb);
+ pdschCfg->choice.setup->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator = \
+ *(pdschServCellDb->codeBlkGrpFlushInd);
+ }
+
+ /* xOverhead */
+ pdschCfg->choice.setup->xOverhead = NULLP;
+ if(pdschServCellDb && pdschServCellDb->xOverhead)
+ {
+ DU_ALLOC(pdschCfg->choice.setup->xOverhead, sizeof(long));
+ if(pdschCfg->choice.setup->xOverhead == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+ return RFAILED;
+ }
+ *(pdschCfg->choice.setup->xOverhead) = *(pdschServCellDb->xOverhead);
+ }
+
+ /* Number of HARQ processes */
+ pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH = NULLP;
+ DU_ALLOC(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH, sizeof(long));
+ if(!pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+ return RFAILED;
+ }
+
+ if(pdschServCellDb == NULLP)
+ *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = PDSCH_NUM_HARQ_PROC;
+ else
+ *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH) = pdschServCellDb->numHarqProcForPdsch;
+
+ pdschCfg->choice.setup->pucch_Cell = NULLP;
+
+ /* Extension */
+ pdschCfg->choice.setup->ext1 = NULLP;
+ if(pdschServCellDb && pdschServCellDb->maxMimoLayers)
+ {
+ DU_ALLOC(pdschCfg->choice.setup->ext1, sizeof(struct PDSCH_ServingCellConfig__ext1));
+ if(pdschCfg->choice.setup->ext1 == NULLP)
+ {
+ DU_LOG("\nERROR --> F1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+ return RFAILED;
+ }