+ FILL_PST_SCH_TO_MAC(pst, inst);
+ pst.event = EVENT_DL_ALLOC;
+
+ return(*schMacDlAllocOpts[pst.selector])(&pst, dlSchedInfo);
+
+}
+
+
+/*******************************************************************
+ *
+ * @brief Handles slot indication at SCH
+ *
+ * @details
+ *
+ * Function : schCalcSlotValues
+ *
+ * Functionality:
+ * Handles TTI indication received from PHY
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+void schCalcSlotValues(SlotIndInfo slotInd, SchSlotValue *schSlotValue)
+{
+ /****************************************************************
+ * PHY_DELTA - the physical layer delta *
+ * SCHED_DELTA - scheduler schedules one slot ahead *
+ * BO_DELTA - this delay is considered for BO response and *
+ * RLC buffer packet to received at MAC *
+ * lower-mac (FAPI filling) will be working on PHY_DELTA *
+ * brdcast scheduler will working on PHY_DELTA + SCHED_DELTA *
+ * RAR scheduler will working on PHY_DELTA + SCHED_DELTA *
+ * msg4 scheduler will working on PHY_DELTA + SCHED_DELTA *
+ * dedicated DL msg scheduler will working *
+ * on PHY_DELTA + SCHED_DELTA + BO_DELTA *
+ ****************************************************************/
+
+ ADD_DELTA_TO_TIME(slotInd, schSlotValue->currentTime, PHY_DELTA);
+ ADD_DELTA_TO_TIME(slotInd, schSlotValue->broadcastTime, PHY_DELTA + SCHED_DELTA);
+ ADD_DELTA_TO_TIME(slotInd, schSlotValue->rarTime, PHY_DELTA + SCHED_DELTA);
+ ADD_DELTA_TO_TIME(slotInd, schSlotValue->dlMsgTime, PHY_DELTA + SCHED_DELTA);
+}
+
+/*******************************************************************
+ *
+ * @brief
+ *
+ * @details
+ *
+ * Function :
+ *
+ * Functionality:
+
+ *
+ * @params[in]
+ * @return ROK - success
+ * RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t schFillBoGrantDlSchedInfo(SchCellCb *cell, DlSchedInfo *dlSchedInfo, DlMsgAlloc *dlMsgAlloc)
+{
+ uint8_t ueIdx, lcIdx;
+ uint16_t slot;
+ uint16_t crnti = 0;
+ uint16_t accumalatedSize = 0;
+ SchUeCb *ueCb = NULLP;
+
+ while(cell->boIndBitMap)
+ {
+ slot = dlSchedInfo->schSlotValue.dlMsgTime.slot;
+
+ GET_RIGHT_MOST_SET_BIT(cell->boIndBitMap, ueIdx);
+ GET_CRNTI(crnti,ueIdx);
+ ueCb = &cell->ueCb[ueIdx-1];
+
+ /* allocate PDCCH and PDSCH resources for the ue */
+ SCH_ALLOC(dlMsgAlloc, sizeof(DlMsgAlloc));
+ if(!dlMsgAlloc)
+ {
+ DU_LOG("\nERROR --> SCH : Memory Allocation failed for ded DL msg alloc");
+ return RFAILED;
+ }
+ memset(dlMsgAlloc, 0, sizeof(DlMsgAlloc));
+ dlSchedInfo->dlMsgAlloc = dlMsgAlloc;
+ dlMsgAlloc->crnti = crnti;
+
+ /* Dl ded Msg info is copied, this was earlier filled in macSchDlRlcBoInfo */
+ memcpy(&dlMsgAlloc->dlMsgInfo, cell->schDlSlotInfo[slot]->dlMsgInfo, \
+ sizeof(DlMsgInfo));
+
+ /* scheduled LC data fill */
+ dlMsgAlloc->numLc = 0;
+ for(lcIdx = 0; lcIdx < MAX_NUM_LC; lcIdx++)
+ {
+ if(ueCb->dlInfo.dlLcCtxt[lcIdx].bo)
+ {
+ dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].lcId = lcIdx;
+
+ /* calculation for BO includse RLC and MAC header size */
+ dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes = \
+ ueCb->dlInfo.dlLcCtxt[lcIdx].bo + RLC_HDR_SIZE + MAC_HDR_SIZE;
+ accumalatedSize += dlMsgAlloc->lcSchInfo[dlMsgAlloc->numLc].schBytes;
+ dlMsgAlloc->numLc++;
+ }
+ ueCb->dlInfo.dlLcCtxt[lcIdx].bo = 0;
+ }