1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /************************************************************************
25 Desc: C source code for Entry point fucntions.
29 **********************************************************************/
32 @brief APIs to handle all the primitives invoked on RGU interface.
36 /* header include files (.h) */
37 #include "common_def.h"
38 #include "rg_env.h" /* MAC Environment Defines */
39 #include "crg.h" /* CRG Interface defines */
40 #include "rgu.h" /* RGU Interface defines */
41 #include "tfu.h" /* TFU Interface defines */
42 #include "rg_sch_inf.h" /* RGR Interface defines */
43 #include "lrg.h" /* LRG Interface defines */
45 #include "rg.h" /* MAC defines */
46 #include "rg_err.h" /* MAC error defines */
48 /* header/extern include files (.x) */
50 #include "crg.x" /* CRG Interface includes */
51 #include "rgu.x" /* RGU Interface includes */
52 #include "tfu.x" /* TFU Interface includes */
53 #include "rg_sch_inf.x" /* SCH Interface includes */
54 #include "rg_prg.x" /* PRG Interface includes */
55 #include "lrg.x" /* LRG Interface includes */
57 #include "du_app_mac_inf.h"
58 #include "rg.x" /* MAC includes */
61 #define RG_NON_MIMO_IDX 0
65 S16 RgMacSchBrdcmDedBoUpdtReq ARGS((Inst inst, CmLteCellId cellId, CmLteRnti rnti, CmLteLcId lcId, S32 bo ));
66 static S16 rgROMHndlCcchDatReq ARGS((RgCellCb *cell,
67 RgRguCmnDatReq *datReq, RgErrInfo *err));
68 static S16 rgROMHndlBcchPcchDatReq ARGS((RgCellCb *cell,
69 RgRguCmnDatReq *datReq, RgErrInfo *err));
70 static S16 rgROMHndlCcchStaRsp ARGS((RgCellCb *cell,
71 RgRguCmnStaRsp *staRsp, RgErrInfo *err));
72 static S16 rgROMHndlBcchPcchStaRsp ARGS((RgCellCb *cell,
73 RgRguCmnStaRsp *staRsp, RgErrInfo *err));
75 /* ADD Changes for Downlink UE Timing Optimization */
76 #ifdef LTEMAC_DLUE_TMGOPTMZ
77 static S16 rgROMUpdDlSfRemDataCnt ARGS((RgCellCb *cellCb,
79 S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf,
84 /* forward references */
87 * @brief Handler for dedicated DatReq received on RGU for an UE.
91 * Function : rgROMDedDatReq
94 * -# store the BO reported for the given logical channels.
95 * -# invoke DL HARQ for further processing.
98 * @param[in] Inst inst
99 * @param[in] RgRguDedDatReq *datReq
104 S16 rgROMDedDatReq(Inst inst,RgRguDedDatReq *datReq)
110 RgDlHqProcCb *hqProc;
115 CmLteTimingInfo timingInfo;
117 #if (ERRCLASS & ERRCLS_DEBUG)
118 RgUstaDgn dgn; /* Alarm diagnostics structure */
120 /* ADD Changes for Downlink UE Timing Optimization */
121 #ifdef LTEMAC_DLUE_TMGOPTMZ
125 //uint8_t datReqFailCnt = 0;
128 if (((cell = rgCb[inst].cell) == NULLP)
129 || (cell->cellId != datReq->cellId))
131 #if (ERRCLASS & ERRCLS_INT_PAR)
132 /* Handle Cell fetch failure */
133 DU_LOG("\nERROR --> MAC : rgROMDedDatReq(): Invalid cell Id");
135 err.errType = RGERR_ROM_DEDDATREQ;
136 err.errCause = RGERR_ROM_INV_CELL_ID;
140 rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
145 /* Add loop here to scan for all UEs in the consolidated DDatReq*/
146 for(idx = 0; idx < datReq->nmbOfUeGrantPerTti; idx++)
149 timingInfo.slot = (uint8_t)((datReq->datReq[idx].transId >> 8) & 0XFF);
150 timingInfo.sfn = (uint16_t)((datReq->datReq[idx].transId >> 16) & 0xFFFF);
151 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
153 if( (sf->txDone == TRUE) ||
154 (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
156 #if (ERRCLASS & ERRCLS_DEBUG)
157 /* Transmission is already done for this slot. This is a delayed
158 * datReq. So discard */
159 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
160 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
161 LRG_CAUSE_DELAYED_DATREQ, &dgn);
163 err.errType = RGERR_ROM_DEDDATREQ;
164 err.errCause = RGERR_ROM_DELAYED_DATREQ;
166 rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
169 uint32_t dbgDelayedDatReqInMac;
170 dbgDelayedDatReqInMac++;
174 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
180 if ((ue = rgDBMGetUeCb(cell, datReq->datReq[idx].rnti)) == NULLP)
182 #if (ERRCLASS & ERRCLS_INT_PAR)
183 /* Handle Ue fetch failure */
184 DU_LOG("\nERROR --> MAC : rgROMDedDatReq(): Invalid ue Id");
186 err.errType = RGERR_ROM_DEDDATREQ;
187 err.errCause = RGERR_ROM_INV_UE_ID;
189 rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
190 /* ADD Changes for Downlink UE Timing Optimization */
191 #ifdef LTEMAC_DLUE_TMGOPTMZ
192 /* Trying to send the prev successful PDU's
194 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
197 DU_LOG("\nERROR --> MAC : Dropping due to no ue \n");
199 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
201 /* Return from here as above functions found more datReq than expected*/
205 /* Conitnue for next UE */
209 hqPId = (uint8_t)(datReq->datReq[idx].transId);
211 /* get harq process and invoke DHM */
212 rgDHMGetHqProcFrmId(ue, hqPId, &hqProc);
214 if (rgDHMHndlDedDatReq(inst,hqProc, &datReq->datReq[idx], sf, &err) == RFAILED)
216 DU_LOG("\nERROR --> MAC : Handling of Data request in DHM failedi RNTI:%d",
217 datReq->datReq[idx].rnti);
218 err.errType = RGERR_ROM_DEDDATREQ;
219 /* errcause shall be filled in appropriately by DHM */
221 rgUpdtRguDedSts(inst,ue->rguDlSap,RG_RGU_SDU_DROP, datReq);
222 /* ADD Changes for Downlink UE Timing Optimization */
223 #ifdef LTEMAC_DLUE_TMGOPTMZ
224 /* Trying to send the prev successful PDU's
226 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
229 DU_LOG("\nERROR --> MAC : Dropping due to no failure of remCnt update");
231 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
233 /* Return from here as above functions found more datReq than expected*/
240 /* Merging the updation of statistics of SDUs with for loop below */
242 rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
244 boRpt.cellSapId = cell->schInstMap.cellSapId;
245 boRpt.cellId = datReq->cellId;
247 boRpt.rnti = datReq->datReq[idx].rnti;
250 /* Fill the DStaRsp struct and send it to scheduler */
251 for (idx1 = 0; idx1 < datReq->datReq[idx].nmbOfTbs; idx1++)
253 for(idx2 = 0; idx2 < datReq->datReq[idx].datReqTb[idx1].nmbLch; idx2++)
255 /* Updating dedicated SDUs received statistics without
256 additional function above for optimization */
257 ue->rguDlSap->sapSts.numPduRcvd +=
258 datReq->datReq[idx].datReqTb[idx1].lchData[idx2].pdu.numPdu;
260 boRpt.lcId = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].lcId;
261 boRpt.bo = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.bo;
262 boRpt.oldestSduArrTime
263 = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.oldestSduArrTime;
264 boRpt.staPduBo = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.staPduBo;
266 boRpt.setMaxUlPrio= datReq->datReq[idx].datReqTb[idx1].lchData[idx2].setMaxUlPrio;
268 boRpt.setMaxDlPrio= datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.staPduPrsnt;
270 RgMacSchDedBoUpdt(&schPst, &boRpt);
274 /* ADD Changes for Downlink UE Timing Optimization */
275 #ifdef LTEMAC_DLUE_TMGOPTMZ
276 // sf->remDatReqCnt -= datReqFailCnt;
277 /*Presently this function is not returning RFAILED, thus not checking
278 for failure condition.*/
279 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
282 DU_LOG("\nERROR --> MAC : Dropping due to no failure of remCnt update(1) \n");
284 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
286 /* Return from here as above functions found more datReq than expected*/
290 } /* for loop for num of Ue per TTI*/
293 /* Data send successfully to PHY. lets retuns ROK*/
295 } /* rgROMDedDatReq */
299 * @brief Handler for DatReq received on RGU for a common logical channel.
303 * Function : rgROMCmnDatReq
305 * This function shall invoke rgROMHndlCcchDatReq() if datReq is on CCCH
306 * If not, it shall invoke rgROMHndlBcchPcchDatReq().
309 * @param[in] Inst inst
310 * @param[in] RgRguCmnDatReq *datReq
315 S16 rgROMCmnDatReq(Inst inst, RgRguCmnDatReq *datReq)
320 /* ADD Changes for Downlink UE Timing Optimization */
321 #ifdef LTEMAC_DLUE_TMGOPTMZ
322 CmLteTimingInfo timingInfo;
327 err.errType = RGERR_ROM_CMNDATREQ;
328 if(((cell = rgCb[inst].cell) == NULLP)
329 ||(cell->cellId != datReq->cellId))
331 #if (ERRCLASS & ERRCLS_INT_PAR)
332 /* Handle Cell fetch failure */
333 DU_LOG("\nERROR --> MAC : rgROMCmnDatReq(): Invalid cell Id");
335 err.errCause = RGERR_ROM_INV_CELL_ID;
339 rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP);
344 if (datReq->lcId == cell->dlCcchId)
346 ret = rgROMHndlCcchDatReq(cell, datReq, &err);
348 /*Get the timing Info*/
349 /* ADD Changes for Downlink UE Timing Optimization */
350 #ifdef LTEMAC_DLUE_TMGOPTMZ
351 timingInfo.slot = (uint8_t)((datReq->transId >> 8) & 0XFF);
352 timingInfo.sfn = (uint16_t)((datReq->transId >> 16) & 0xFFFF);
357 ret = rgROMHndlBcchPcchDatReq(cell, datReq, &err);
359 /*Get the timing Info*/
360 /* ADD Changes for Downlink UE Timing Optimization */
361 #ifdef LTEMAC_DLUE_TMGOPTMZ
362 timingInfo.slot = (uint8_t)(datReq->transId & 0XFF);
363 timingInfo.sfn = (uint16_t)((datReq->transId >> 8) & 0xFFFF);
370 rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP);
374 /* Update stats with number of SDUs received */
375 rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_RCVD);
378 /* ADD Changes for Downlink UE Timing Optimization */
379 #ifdef LTEMAC_DLUE_TMGOPTMZ
380 RG_ARRAY_BOUND_CHECK(0, cell->subFrms, (timingInfo.slot % RG_NUM_SUB_FRAMES));
381 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
383 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
384 /*Added check for RFAILED as above function can return RFAILED*/
388 } /* rgROMCmnDatReq */
391 * @brief Handler for DatReq received on RGU for CCCH.
395 * Function : rgROMHndlCcchDatReq
397 * This function shall fetch the raCb with the given rnti and indicate msg4
401 * @param[in] RgCellCb *cell
402 * @param[in] RgRguCmnDatReq *datReq
403 * @param[out] RgErrInfo *err
408 static S16 rgROMHndlCcchDatReq(RgCellCb *cell, RgRguCmnDatReq *datReq, RgErrInfo *err)
410 Inst inst = cell->macInst - RG_INST_START;
413 RgDlHqProcCb *hqProc;
414 CmLteTimingInfo timingInfo;
416 #if (ERRCLASS & ERRCLS_DEBUG)
417 RgUstaDgn dgn; /* Alarm diagnostics structure */
420 err->errType = RGERR_ROM_CMNDATREQ;
422 if ((ue = rgDBMGetUeCb(cell, datReq->u.rnti)) == NULLP)
424 if ((ue = rgDBMGetUeCbFromRachLst(cell, datReq->u.rnti)) == NULLP)
426 #if (ERRCLASS & ERRCLS_INT_PAR)
427 /* Handle Ue fetch failure */
428 DU_LOG("\nERROR --> MAC : rgROMHndlCcchDatReq(): Invalid ue Id");
430 err->errCause = RGERR_ROM_INV_UE_ID;
435 timingInfo.slot = (uint8_t)((datReq->transId >> 8) & 0XFF);
436 timingInfo.sfn = (uint16_t)((datReq->transId >> 16) & 0xFFFF);
437 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
439 if( (sf->txDone == TRUE) ||
440 (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
442 #if (ERRCLASS & ERRCLS_DEBUG)
443 /* Transmission is already done for this slot. This is a delayed
444 * datReq. So discard */
445 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
446 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
447 LRG_CAUSE_DELAYED_DATREQ, &dgn);
449 err->errCause = RGERR_ROM_DELAYED_DATREQ;
453 hqPId = (uint8_t)(datReq->transId);
456 /* get harq process and invoke DHM */
457 rgDHMGetHqProcFrmId(ue, hqPId, &hqProc);
459 /* Changed for CR timer implementation*/
460 /* invoke DHM to process CCCH data */
461 if (rgDHMHndlCmnDatReq(inst,hqProc, datReq, err) == RFAILED)
463 DU_LOG("\nERROR --> MAC : Handling of Data request in DHM failed RNTI:%d LCID:%d",
464 datReq->u.rnti,datReq->lcId);
465 /* Release First TB */
466 rgDHMRlsHqProcTB(cell, hqProc, 1);
467 /* err shall be filled in appropriately by DHM */
472 } /* rgROMHndlCcchDatReq */
476 * @brief Handler for DatReq received on RGU for BCCH or PCCH.
480 * Function : rgROMHndlBcchPcchDatReq
482 * This function shall store the buffer and time to transmit in lcCb.
485 * @param[in] RgCellCb *cell
486 * @param[in] RgRguCmnDatReq *datReq
487 * @param[out] RgErrInfo *err
492 static S16 rgROMHndlBcchPcchDatReq(RgCellCb *cell, RgRguCmnDatReq *datReq, RgErrInfo *err)
494 Inst inst = cell->macInst - RG_INST_START;
496 /* Modified for SI Enhancement*/
499 RgBcchDlschLcCb *bcch;
502 CmLteTimingInfo timingInfo;
503 #if (ERRCLASS & ERRCLS_DEBUG)
504 RgUstaDgn dgn; /* Alarm diagnostics structure */
508 timingInfo.slot = (uint8_t)(datReq->transId & 0XFF);
509 timingInfo.sfn = (uint16_t)((datReq->transId >> 8) & 0xFFFF);
510 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
512 if( (sf->txDone == TRUE) ||
513 (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
515 #if (ERRCLASS & ERRCLS_DEBUG)
516 /* Transmission is already done for this slot. This is a delayed
517 * datReq. So discard */
518 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
519 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
520 LRG_CAUSE_DELAYED_DATREQ, &dgn);
522 err->errCause = RGERR_ROM_DELAYED_DATREQ;
527 bcch = rgDBMGetBcchOnDlsch(cell,datReq->lcId);
530 /* Store BCCH-DLSCH data received in Scheduled slot */
531 sf->bcch.tb = datReq->pdu;
533 SCpyMsgMsg(datReq->pdu, RG_GET_MEM_REGION(rgCb[inst]),
534 RG_GET_MEM_POOL(rgCb[inst]), &bcch->tb);
539 bch = rgDBMGetBcchOnBch(cell);
540 if ((bch) && (bch->lcId == datReq->lcId))
542 /* Store BCH data received in Scheduled slot */
543 sf->bch.tb = datReq->pdu;
548 pcch = rgDBMGetPcch(cell);
549 if ((pcch) && (pcch->lcId == datReq->lcId))
551 /* Store PCCH-DLSCH data received in Scheduled slot */
552 sf->pcch.tb = datReq->pdu;
556 /* Handle lcCb fetch failure */
557 DU_LOG("\nERROR --> MAC : rgROMHndlBcchPcchDatReq(): Invalid Lc Id");
558 err->errCause = RGERR_ROM_INV_LC_ID;
561 } /* rgROMHndlBcchPcchDatReq */
564 * @brief Handler for StaRsp received on RGU for a dedicated logical channel.
568 * Function : rgROMDedStaRsp
570 * This fucntion shall store the BO reported for the given logical
574 * @param[in] Inst inst
575 * @param[in] RgRguDedStaRsp *staRsp
580 S16 rgROMDedStaRsp(Inst inst, RgRguDedStaRsp *staRsp)
584 /* Moving the error variables and assignments to available scope */
586 /* Avoiding memset, as the variables of this are getting
590 if(((cell = rgCb[inst].cell) != NULLP)
591 && (cell->cellId == staRsp->cellId))
596 boRpt.cellSapId = cell->schInstMap.cellSapId;
597 boRpt.cellId = staRsp->cellId;
598 boRpt.rnti = staRsp->rnti;
599 boRpt.lcId = staRsp->lcId;
600 boRpt.bo = staRsp->boReport.bo;
601 boRpt.oldestSduArrTime = staRsp->boReport.oldestSduArrTime;
602 boRpt.staPduBo = staRsp->boReport.staPduBo;
603 boRpt.oldestSduArrTime = staRsp->boReport.oldestSduArrTime;
605 rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
607 //TODO: commented for compilation without SCH RgMacSchDedBoUpdt(&schPst, &boRpt);
610 DU_LOG("\nERROR --> MAC : Invalid cell for CRNTI:%d LCID:%d ",
611 staRsp->rnti,staRsp->lcId);
614 } /* rgROMDedStaRsp */
616 S16 RgMacSchBrdcmDedBoUpdtReq(
626 //if ((cell = rgDBMGetCellCb(cellId)) != NULLP)
627 if (((cell = rgCb[inst].cell) != NULLP) &&
628 (cell->cellId == cellId))
633 boRpt.cellSapId = cell->schInstMap.cellSapId;
634 boRpt.cellId = cellId;
639 rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
641 //TODO: commented for compilation without SCH RgMacSchDedBoUpdtReq (&schPst,&boRpt);
646 * @brief Handler for StaRsp received on RGU for a common logical channel.
650 * Function : rgROMCmnStaRsp
652 * This fucntion shall invoke rgROMHndlCcchStaRsp() for status response on
653 * CCCH and shall invoke rgROMHndlBcchPcchStaRsp() for status response on
657 * @param[in] Inst inst
658 * @param[in] RgRguCmnStaRsp *staRsp
663 S16 rgROMCmnStaRsp(Inst inst, RgRguCmnStaRsp *staRsp)
668 if(((cell = rgCb[inst].cell) == NULLP)
669 || (cell->cellId != staRsp->cellId))
671 /* Handle Cell fetch failure */
672 DU_LOG("\nERROR --> MAC : Invalid cell for CRNTI:%d LCID:%d",staRsp->u.rnti,staRsp->lcId);
673 err.errType = RGERR_ROM_CMNSTARSP;
674 err.errCause = RGERR_ROM_INV_CELL_ID;
678 /* handle status response on CCCH */
679 if(staRsp->lcId == cell->dlCcchId)
681 rgROMHndlCcchStaRsp(cell, staRsp, &err);
685 rgROMHndlBcchPcchStaRsp(cell, staRsp, &err);
689 } /* rgROMCmnStaRsp */
694 * @brief Handler for Request received on RGU for a UL Throughput measurement
695 * enabled logical channel.
699 * Function :rgROML2MUlThrpMeasReq
701 * This function shall store the L2M UL Throughput Measurement status information
702 * for the given logical channel.
705 * @param[in] Inst inst
706 * @param[in] RgRguL2MUlThrpMeasReq *measReq
711 S16 rgROML2MUlThrpMeasReq(Inst inst, RgRguL2MUlThrpMeasReq *measReq)
718 if(((cell = rgCb[inst].cell) != NULLP)
719 &&(cell->cellId == measReq->cellId))
721 if ((ue = rgDBMGetUeCb(cell, measReq->rnti)) != NULLP)
723 for(loop=0; loop<measReq->numLcId;loop++)
725 if ((rgDBMGetUlDedLcCb(ue, measReq->lcId[loop])) != NULLP)
727 ue->ul.lcCb[measReq->lcId[loop]].measOn = measReq->enbMeas;
728 if(ue->ul.lcCb[measReq->lcId[loop]].measOn == FALSE)
730 lcgId=ue->ul.lcCb[measReq->lcId[loop]].lcgId;
731 ue->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = 0;
732 ue->ul.lcgArr[lcgId].lcgBsInfo.firstDatSegRcvd = FALSE;
739 DU_LOG("\nERROR --> MAC : Invalid cell CRNTI:%d",
742 } /* rgROML2MUlThrpMeasReq */
747 * @brief Handler for StaRsp received on RGU for CCCH.
751 * Function : rgROMHndlCcchStaRsp
753 * This function shall fetch the raCb with the given RNTI and ask RAM to
757 * @param[in] RgCellCb *cell
758 * @param[in] RgRguCmnStaRsp *staRsp
759 * @param[out] RgErrInfo *err
764 static S16 rgROMHndlCcchStaRsp(RgCellCb *cell,RgRguCmnStaRsp *staRsp, RgErrInfo *err)
767 Inst macInst = cell->macInst - RG_INST_START;
768 //RgInfCmnBoRpt boRpt;
772 boRpt.cellSapId = cell->schInstMap.cellSapId;
773 boRpt.cellId = staRsp->cellId;
774 boRpt.u.rnti = staRsp->u.rnti;
775 boRpt.lcId = staRsp->lcId;
776 boRpt.lcType = staRsp->lcType;
777 boRpt.bo = staRsp->bo;
779 rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
780 //TODO: commented for compilation without SCH RgMacSchCmnBoUpdt(&schPst, &boRpt);
783 } /* rgROMHndlCcchStaRsp */
787 * @brief Handler for StaRsp received on RGU for BCCH or PCCH.
791 * Function : rgROMHndlBcchPcchStaRsp
793 * This function shall store the buffer and time to transmit in lcCb.
796 * @param[in] RgCellCb *cell
797 * @param[in] RgRguCmnStaRsp *staRsp
798 * @param[out] RgErrInfo *err
803 static S16 rgROMHndlBcchPcchStaRsp(RgCellCb *cell,RgRguCmnStaRsp *staRsp,RgErrInfo *err)
806 //RgInfCmnBoRpt boRpt;
807 Inst macInst = cell->macInst - RG_INST_START;
809 memset(&schPst, 0, sizeof(Pst));
811 if (rgDBMChkCmnLcCb(cell, staRsp->lcId) != ROK)
813 /* Handle lcCb fetch failure */
814 DU_LOG("\nERROR --> MAC : Invalid LCID:%d",staRsp->lcId);
815 err->errCause = RGERR_ROM_INV_LC_ID;
818 /* MS_WORKAROUND : This is to ensure that the queue for BCH is not filled with old BO requests :
819 This assumes that BO is not received more than 4 frames in advance from the enodeb application */
820 if (cell->bcchBchInfo.lcId == staRsp->lcId)
824 nextBchSfn = (cell->crntTime.sfn + 4 - (cell->crntTime.sfn%4)) % RG_MAX_SFN;
825 if ((staRsp->u.timeToTx.sfn != nextBchSfn) ||
826 ((staRsp->u.timeToTx.sfn == cell->crntTime.sfn) && (cell->crntTime.slot >= 7)))
832 boRpt.cellSapId = cell->schInstMap.cellSapId;
833 boRpt.cellId = staRsp->cellId;
834 boRpt.u.timeToTx = staRsp->u.timeToTx;
835 boRpt.lcId = staRsp->lcId;
836 boRpt.lcType = staRsp->lcType;
837 boRpt.bo = staRsp->bo;*/
841 if(boRpt.lcType == CM_LTE_LCH_PCCH)
843 boRpt.emtcDIReason = staRsp->emtcDiReason;
844 boRpt.pnb = staRsp->pnb;
848 rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
849 //TODO: commented for compilation without SCH RgMacSchCmnBoUpdt(&schPst, &boRpt);
852 } /* rgROMHndlBcchPcchStaRsp */
854 /* ADD Changes for Downlink UE Timing Optimization */
855 #ifdef LTEMAC_DLUE_TMGOPTMZ
857 * @brief Handler for updating DL SF information on receiving
858 * DL dedicated data, CCCH, BCCH/PCCH data request.
862 * Function : rgROMUpdDLSfRemDataCnt
865 * @param[in] RgCellCb *cell
866 * @param[in] RgDlSf *dlSf;
871 static S16 rgROMUpdDlSfRemDataCnt(RgCellCb *cellCb, RgDlSf *dlSf)
874 //Inst inst = cellCb->macInst - RG_INST_START;
876 if(!dlSf->remDatReqCnt)
878 /*This is an error scenario of RLC generating more data
879 * request than the allocation. Do nothing for this. */
880 DU_LOG("\nERROR --> MAC : RX new data while remDatReqCnt is 0 for cell");
884 /*Decrement the remaining data request to be received countter
886 Check if this was the last pending data request for this DL SF.*/
887 /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
889 if((0 == --dlSf->remDatReqCnt) && !(dlSf->txDone) &&
890 (RG_TIMEINFO_SAME(cellCb->crntTime, dlSf->schdTime)) && (dlSf->statIndDone))
892 /*Check if we have already received a TTI for this Data,
893 if that is the case then we need to send TFU Data request
896 if (ROK != rgTOMUtlProcDlSf (dlSf, cellCb, &err))
898 DU_LOG("\nERROR --> MAC : Unable to process downlink slot for cell");
899 err.errType = RGERR_ROM_DEDDATREQ;
902 /* Mark this frame as sent */
907 } /* rgROMUpdDlSfRemDataCnt*/
910 /**********************************************************************
913 **********************************************************************/