+ uint16_t harqCounter=0;
+ Pst pst;
+ DlHarqInd dlHarqInd;
+ memset(&pst, 0, sizeof(Pst));
+ memset(&dlHarqInd, 0, sizeof(DlHarqInd));
+
+ dlHarqInd.cellId = macCb.macCell[cellIdx]->cellId;
+ dlHarqInd.crnti = crnti;
+ dlHarqInd.slotInd.sfn = slotInd->sfn;
+ dlHarqInd.slotInd.slot = slotInd->slot;
+ dlHarqInd.numHarq = harqInfo->numHarq;
+ memset(dlHarqInd.harqPayload, 0, MAX_SR_BITS_IN_BYTES);
+ for(harqCounter = 0; harqCounter < harqInfo->numHarq; harqCounter++)
+ {
+ dlHarqInd.harqPayload[harqCounter] = harqInfo->harqValue[harqCounter];
+ }
+
+ /* Fill Pst */
+ FILL_PST_MAC_TO_SCH(pst, EVENT_DL_HARQ_IND_TO_SCH);
+
+ return SchMessageRouter(&pst, (void *)&dlHarqInd);
+}
+
+
+/*******************************************************************
+ *
+ * @brief Builds and send SR UCI Indication to SCH
+ *
+ * @details
+ *
+ * Function : buildAndSendSrInd
+ *
+ * Functionality:
+ * Builds and send SR UCI Indication to SCH
+ *
+ * @params[in] SrUciIndInfo Pointer
+ * crnti value
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t buildAndSendSrInd(UciInd *macUciInd, uint16_t crnti)
+{
+ uint16_t cellIdx;
+ Pst pst;
+ SrUciIndInfo srUciInd;
+ memset(&pst, 0, sizeof(Pst));
+ memset(&srUciInd, 0, sizeof(SrUciIndInfo));
+
+ GET_CELL_IDX(macUciInd->cellId, cellIdx);
+ srUciInd.cellId = macCb.macCell[cellIdx]->cellId;
+ srUciInd.crnti = crnti;
+ srUciInd.slotInd.sfn = macUciInd->slotInd.sfn;
+ srUciInd.slotInd.slot = macUciInd->slotInd.slot;
+ srUciInd.numSrBits++;
+ memset(srUciInd.srPayload, 0, MAX_SR_BITS_IN_BYTES);
+
+ /* Fill Pst */
+ FILL_PST_MAC_TO_SCH(pst, EVENT_UCI_IND_TO_SCH);
+
+ return(SchMessageRouter(&pst, (void *)&srUciInd));
+}
+
+/*******************************************************************
+ *
+ * @brief Processes UCI Indication from PHY
+ *
+ * @details
+ *
+ * Function : fapiMacUciInd
+ *
+ * Functionality:
+ * Processes UCI Indication from PHY
+ *
+ * @params[in] Post Structure Pointer
+ * UCI Indication Pointer
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t FapiMacUciInd(Pst *pst, UciInd *macUciInd)
+{
+ uint8_t pduIdx = 0, ret = ROK;
+ uint16_t nPdus = 0, crnti = 0, cellIdx = 0;
+
+ if(macUciInd)
+ {
+ nPdus = macUciInd->numUcis;
+ while(nPdus)
+ {
+ switch(macUciInd->pdus[pduIdx].pduType)
+ {
+ case UCI_IND_PUSCH:
+ break;
+ case UCI_IND_PUCCH_F0F1:
+ {
+ {
+ DU_LOG("\nDEBUG --> MAC : Received HARQ UCI Indication\n");
+ GET_CELL_IDX(macUciInd->cellId, cellIdx);
+ buildAndSendHarqInd(&macUciInd->pdus[pduIdx].uci.uciPucchF0F1.harqInfo, macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti, cellIdx, &macUciInd->slotInd);
+ }
+ if(macUciInd->pdus[pduIdx].uci.uciPucchF0F1.srInfo.srIndPres)
+ {
+ DU_LOG("\nDEBUG --> MAC : Received SR UCI indication");
+ crnti = macUciInd->pdus[pduIdx].uci.uciPucchF0F1.crnti;
+ ret = buildAndSendSrInd(macUciInd, crnti);
+ }
+ }
+ break;
+ case UCI_IND_PUCCH_F2F3F4:
+ break;
+ default:
+ DU_LOG("\nERROR --> MAC: Invalid Pdu Type %d at FapiMacUciInd", macUciInd->pdus[pduIdx].pduType);
+ ret = RFAILED;
+ break;
+ }
+ pduIdx++;
+ nPdus--;
+ }
+ }
+ else
+ {
+ DU_LOG("\nERROR --> MAC: Received Uci Ind is NULL at FapiMacUciInd()");
+ ret = RFAILED;
+ }
+ MAC_FREE_SHRABL_BUF(pst->region, pst->pool, macUciInd, sizeof(UciInd));
+ return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief fill Slice Cfg Request info in shared structre
+ *
+ * @details
+ *
+ * Function : fillSliceCfgInfo
+ *
+ * Functionality:
+ * fill Slice Cfg Request info in shared structre
+ *
+ * @params[in] SchSliceCfgReq *schSliceCfgReq
+ * MacSliceCfgReq *macSliceCfgReq;
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ **********************************************************************/
+uint8_t fillSliceCfgInfo(SchSliceCfgReq *schSliceCfgReq, MacSliceCfgReq *macSliceCfgReq)
+{
+ uint8_t rrmPolicyIdx= 0,cfgIdx = 0, memberListIdx = 0, totalSliceCfgRecvd = 0;
+
+ if(macSliceCfgReq->listOfRrmPolicy)
+ {
+ for(cfgIdx = 0; cfgIdx<macSliceCfgReq->numOfRrmPolicy; cfgIdx++)
+ {
+ totalSliceCfgRecvd += macSliceCfgReq->listOfRrmPolicy[cfgIdx]->numOfRrmPolicyMem;
+ }
+
+ schSliceCfgReq->numOfConfiguredSlice = totalSliceCfgRecvd;
+ MAC_ALLOC(schSliceCfgReq->listOfSlices, schSliceCfgReq->numOfConfiguredSlice *sizeof(SchRrmPolicyOfSlice*));
+ if(schSliceCfgReq->listOfSlices == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo");
+ return RFAILED;
+ }
+ cfgIdx = 0;
+
+ for(rrmPolicyIdx = 0; rrmPolicyIdx<macSliceCfgReq->numOfRrmPolicy; rrmPolicyIdx++)
+ {
+ for(memberListIdx = 0; memberListIdx<macSliceCfgReq->listOfRrmPolicy[rrmPolicyIdx]->numOfRrmPolicyMem; memberListIdx++)
+ {
+ if(macSliceCfgReq->listOfRrmPolicy[rrmPolicyIdx]->rRMPolicyMemberList[memberListIdx])
+ {
+
+ MAC_ALLOC(schSliceCfgReq->listOfSlices[cfgIdx], sizeof(SchRrmPolicyOfSlice));
+ if(schSliceCfgReq->listOfSlices[cfgIdx] == NULLP)
+ {
+ DU_LOG("\nERROR --> MAC : Memory allocation failed in fillSliceCfgInfo");
+ return RFAILED;
+ }
+
+ memcpy(&schSliceCfgReq->listOfSlices[cfgIdx]->snssai, &macSliceCfgReq->listOfRrmPolicy[rrmPolicyIdx]->rRMPolicyMemberList[memberListIdx]->snssai, sizeof(Snssai));
+
+ schSliceCfgReq->listOfSlices[cfgIdx]->rrmPolicyRatioInfo.maxRatio = macSliceCfgReq->listOfRrmPolicy[rrmPolicyIdx]->policyRatio.maxRatio;
+ schSliceCfgReq->listOfSlices[cfgIdx]->rrmPolicyRatioInfo.minRatio = macSliceCfgReq->listOfRrmPolicy[rrmPolicyIdx]->policyRatio.minRatio;
+ schSliceCfgReq->listOfSlices[cfgIdx]->rrmPolicyRatioInfo.dedicatedRatio = macSliceCfgReq->listOfRrmPolicy[rrmPolicyIdx]->policyRatio.dedicatedRatio;
+ cfgIdx++;
+ }
+ }
+ }
+ }