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.
35 static const char* RLOG_MODULE_NAME="MAC";
36 static int RLOG_FILE_ID=184;
37 static int RLOG_MODULE_ID=4096;
39 /* header include files (.h) */
40 #include "common_def.h"
41 #include "rg_env.h" /* MAC Environment Defines */
42 #include "crg.h" /* CRG Interface defines */
43 #include "rgu.h" /* RGU Interface defines */
44 #include "tfu.h" /* TFU Interface defines */
45 #include "rg_sch_inf.h" /* RGR Interface defines */
46 #include "lrg.h" /* LRG Interface defines */
48 #include "rg.h" /* MAC defines */
49 #include "rg_err.h" /* MAC error defines */
51 /* header/extern include files (.x) */
53 #include "crg.x" /* CRG Interface includes */
54 #include "rgu.x" /* RGU Interface includes */
55 #include "tfu.x" /* TFU Interface includes */
56 #include "rg_sch_inf.x" /* SCH Interface includes */
57 #include "rg_prg.x" /* PRG Interface includes */
58 #include "lrg.x" /* LRG Interface includes */
60 #include "du_app_mac_inf.h"
61 #include "rg.x" /* MAC includes */
64 #define RG_NON_MIMO_IDX 0
68 S16 RgMacSchBrdcmDedBoUpdtReq ARGS((Inst inst, CmLteCellId cellId, CmLteRnti rnti, CmLteLcId lcId, S32 bo ));
69 PRIVATE S16 rgROMHndlCcchDatReq ARGS((RgCellCb *cell,
70 RgRguCmnDatReq *datReq, RgErrInfo *err));
71 PRIVATE S16 rgROMHndlBcchPcchDatReq ARGS((RgCellCb *cell,
72 RgRguCmnDatReq *datReq, RgErrInfo *err));
73 PRIVATE S16 rgROMHndlCcchStaRsp ARGS((RgCellCb *cell,
74 RgRguCmnStaRsp *staRsp, RgErrInfo *err));
75 PRIVATE S16 rgROMHndlBcchPcchStaRsp ARGS((RgCellCb *cell,
76 RgRguCmnStaRsp *staRsp, RgErrInfo *err));
78 /* ADD Changes for Downlink UE Timing Optimization */
79 #ifdef LTEMAC_DLUE_TMGOPTMZ
80 PRIVATE S16 rgROMUpdDlSfRemDataCnt ARGS((RgCellCb *cellCb,
82 S16 rgTOMUtlProcDlSf ARGS(( RgDlSf *dlSf,
87 /* forward references */
90 * @brief Handler for dedicated DatReq received on RGU for an UE.
94 * Function : rgROMDedDatReq
97 * -# store the BO reported for the given logical channels.
98 * -# invoke DL HARQ for further processing.
101 * @param[in] Inst inst
102 * @param[in] RgRguDedDatReq *datReq
111 RgRguDedDatReq *datReq
114 S16 rgROMDedDatReq(inst,datReq)
116 RgRguDedDatReq *datReq;
123 RgDlHqProcCb *hqProc;
128 CmLteTimingInfo timingInfo;
130 #if (ERRCLASS & ERRCLS_DEBUG)
131 RgUstaDgn dgn; /* Alarm diagnostics structure */
133 /* ADD Changes for Downlink UE Timing Optimization */
134 #ifdef LTEMAC_DLUE_TMGOPTMZ
138 //U8 datReqFailCnt = 0;
141 if (((cell = rgCb[inst].cell) == NULLP)
142 || (cell->cellId != datReq->cellId))
144 #if (ERRCLASS & ERRCLS_INT_PAR)
145 /* Handle Cell fetch failure */
146 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG001,(ErrVal)datReq->cellId,
147 "rgROMDedDatReq(): Invalid cell Id");
149 err.errType = RGERR_ROM_DEDDATREQ;
150 err.errCause = RGERR_ROM_INV_CELL_ID;
154 rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
159 /* Add loop here to scan for all UEs in the consolidated DDatReq*/
160 for(idx = 0; idx < datReq->nmbOfUeGrantPerTti; idx++)
163 timingInfo.slot = (U8)((datReq->datReq[idx].transId >> 8) & 0XFF);
164 timingInfo.sfn = (U16)((datReq->datReq[idx].transId >> 16) & 0xFFFF);
165 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
167 if( (sf->txDone == TRUE) ||
168 (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
170 #if (ERRCLASS & ERRCLS_DEBUG)
171 /* Transmission is already done for this slot. This is a delayed
172 * datReq. So discard */
173 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
174 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
175 LRG_CAUSE_DELAYED_DATREQ, &dgn);
177 err.errType = RGERR_ROM_DEDDATREQ;
178 err.errCause = RGERR_ROM_DELAYED_DATREQ;
180 rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
183 EXTERN U32 dbgDelayedDatReqInMac;
184 dbgDelayedDatReqInMac++;
188 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
194 if ((ue = rgDBMGetUeCb(cell, datReq->datReq[idx].rnti)) == NULLP)
196 #if (ERRCLASS & ERRCLS_INT_PAR)
197 /* Handle Ue fetch failure */
198 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG002,(ErrVal)datReq->datReq[idx].rnti,
199 "rgROMDedDatReq(): Invalid ue Id");
201 err.errType = RGERR_ROM_DEDDATREQ;
202 err.errCause = RGERR_ROM_INV_UE_ID;
204 rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
205 /* ADD Changes for Downlink UE Timing Optimization */
206 #ifdef LTEMAC_DLUE_TMGOPTMZ
207 /* Trying to send the prev successful PDU's
209 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
212 RLOG0(L_INFO, "Dropping due to no ue \n");
214 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
216 /* Return from here as above functions found more datReq than expected*/
220 /* Conitnue for next UE */
224 hqPId = (U8)(datReq->datReq[idx].transId);
226 /* get harq process and invoke DHM */
227 rgDHMGetHqProcFrmId(ue, hqPId, &hqProc);
229 if (rgDHMHndlDedDatReq(inst,hqProc, &datReq->datReq[idx], sf, &err) == RFAILED)
231 RLOG_ARG1(L_ERROR,DBG_CELLID,datReq->cellId,
232 "Handling of Data request in DHM failedi RNTI:%d",
233 datReq->datReq[idx].rnti);
234 err.errType = RGERR_ROM_DEDDATREQ;
235 /* errcause shall be filled in appropriately by DHM */
237 rgUpdtRguDedSts(inst,ue->rguDlSap,RG_RGU_SDU_DROP, datReq);
238 /* ADD Changes for Downlink UE Timing Optimization */
239 #ifdef LTEMAC_DLUE_TMGOPTMZ
240 /* Trying to send the prev successful PDU's
242 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
245 RLOG0(L_INFO, "Dropping due to no failure of remCnt update");
247 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
249 /* Return from here as above functions found more datReq than expected*/
256 /* Merging the updation of statistics of SDUs with for loop below */
258 rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
260 boRpt.cellSapId = cell->schInstMap.cellSapId;
261 boRpt.cellId = datReq->cellId;
263 boRpt.rnti = datReq->datReq[idx].rnti;
266 /* Fill the DStaRsp struct and send it to scheduler */
267 for (idx1 = 0; idx1 < datReq->datReq[idx].nmbOfTbs; idx1++)
269 for(idx2 = 0; idx2 < datReq->datReq[idx].datReqTb[idx1].nmbLch; idx2++)
271 /* Updating dedicated SDUs received statistics without
272 additional function above for optimization */
273 ue->rguDlSap->sapSts.numPduRcvd +=
274 datReq->datReq[idx].datReqTb[idx1].lchData[idx2].pdu.numPdu;
276 boRpt.lcId = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].lcId;
277 boRpt.bo = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.bo;
278 boRpt.oldestSduArrTime
279 = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.oldestSduArrTime;
280 boRpt.staPduBo = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.staPduBo;
282 boRpt.setMaxUlPrio= datReq->datReq[idx].datReqTb[idx1].lchData[idx2].setMaxUlPrio;
284 boRpt.setMaxDlPrio= datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.staPduPrsnt;
286 RgMacSchDedBoUpdt(&schPst, &boRpt);
290 /* ADD Changes for Downlink UE Timing Optimization */
291 #ifdef LTEMAC_DLUE_TMGOPTMZ
292 // sf->remDatReqCnt -= datReqFailCnt;
293 /*Presently this function is not returning RFAILED, thus not checking
294 for failure condition.*/
295 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
298 RLOG0(L_INFO, "\n Dropping due to no failure of remCnt update(1) \n");
300 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
302 /* Return from here as above functions found more datReq than expected*/
306 } /* for loop for num of Ue per TTI*/
309 /* Data send successfully to PHY. lets retuns ROK*/
311 } /* rgROMDedDatReq */
315 * @brief Handler for DatReq received on RGU for a common logical channel.
319 * Function : rgROMCmnDatReq
321 * This function shall invoke rgROMHndlCcchDatReq() if datReq is on CCCH
322 * If not, it shall invoke rgROMHndlBcchPcchDatReq().
325 * @param[in] Inst inst
326 * @param[in] RgRguCmnDatReq *datReq
335 RgRguCmnDatReq *datReq
338 S16 rgROMCmnDatReq(inst,datReq)
340 RgRguCmnDatReq *datReq;
346 /* ADD Changes for Downlink UE Timing Optimization */
347 #ifdef LTEMAC_DLUE_TMGOPTMZ
348 CmLteTimingInfo timingInfo;
353 err.errType = RGERR_ROM_CMNDATREQ;
354 if(((cell = rgCb[inst].cell) == NULLP)
355 ||(cell->cellId != datReq->cellId))
357 #if (ERRCLASS & ERRCLS_INT_PAR)
358 /* Handle Cell fetch failure */
359 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG003,(ErrVal)datReq->cellId,
360 "rgROMCmnDatReq(): Invalid cell Id");
362 err.errCause = RGERR_ROM_INV_CELL_ID;
366 rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP);
371 if (datReq->lcId == cell->dlCcchId)
373 ret = rgROMHndlCcchDatReq(cell, datReq, &err);
375 /*Get the timing Info*/
376 /* ADD Changes for Downlink UE Timing Optimization */
377 #ifdef LTEMAC_DLUE_TMGOPTMZ
378 timingInfo.slot = (U8)((datReq->transId >> 8) & 0XFF);
379 timingInfo.sfn = (U16)((datReq->transId >> 16) & 0xFFFF);
384 ret = rgROMHndlBcchPcchDatReq(cell, datReq, &err);
386 /*Get the timing Info*/
387 /* ADD Changes for Downlink UE Timing Optimization */
388 #ifdef LTEMAC_DLUE_TMGOPTMZ
389 timingInfo.slot = (U8)(datReq->transId & 0XFF);
390 timingInfo.sfn = (U16)((datReq->transId >> 8) & 0xFFFF);
397 rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP);
401 /* Update stats with number of SDUs received */
402 rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_RCVD);
405 /* ADD Changes for Downlink UE Timing Optimization */
406 #ifdef LTEMAC_DLUE_TMGOPTMZ
407 RG_ARRAY_BOUND_CHECK(0, cell->subFrms, (timingInfo.slot % RG_NUM_SUB_FRAMES));
408 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
410 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
411 /*Added check for RFAILED as above function can return RFAILED*/
415 } /* rgROMCmnDatReq */
418 * @brief Handler for DatReq received on RGU for CCCH.
422 * Function : rgROMHndlCcchDatReq
424 * This function shall fetch the raCb with the given rnti and indicate msg4
428 * @param[in] RgCellCb *cell
429 * @param[in] RgRguCmnDatReq *datReq
430 * @param[out] RgErrInfo *err
436 PRIVATE S16 rgROMHndlCcchDatReq
439 RgRguCmnDatReq *datReq,
443 PRIVATE S16 rgROMHndlCcchDatReq(cell, datReq, err)
445 RgRguCmnDatReq *datReq;
449 Inst inst = cell->macInst - RG_INST_START;
452 RgDlHqProcCb *hqProc;
453 CmLteTimingInfo timingInfo;
455 #if (ERRCLASS & ERRCLS_DEBUG)
456 RgUstaDgn dgn; /* Alarm diagnostics structure */
459 err->errType = RGERR_ROM_CMNDATREQ;
461 if ((ue = rgDBMGetUeCb(cell, datReq->u.rnti)) == NULLP)
463 if ((ue = rgDBMGetUeCbFromRachLst(cell, datReq->u.rnti)) == NULLP)
465 #if (ERRCLASS & ERRCLS_INT_PAR)
466 /* Handle Ue fetch failure */
467 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG004,(ErrVal)datReq->u.rnti,
468 "rgROMHndlCcchDatReq(): Invalid ue Id");
470 err->errCause = RGERR_ROM_INV_UE_ID;
475 timingInfo.slot = (U8)((datReq->transId >> 8) & 0XFF);
476 timingInfo.sfn = (U16)((datReq->transId >> 16) & 0xFFFF);
477 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
479 if( (sf->txDone == TRUE) ||
480 (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
482 #if (ERRCLASS & ERRCLS_DEBUG)
483 /* Transmission is already done for this slot. This is a delayed
484 * datReq. So discard */
485 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
486 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
487 LRG_CAUSE_DELAYED_DATREQ, &dgn);
489 err->errCause = RGERR_ROM_DELAYED_DATREQ;
493 hqPId = (U8)(datReq->transId);
496 /* get harq process and invoke DHM */
497 rgDHMGetHqProcFrmId(ue, hqPId, &hqProc);
499 /* Changed for CR timer implementation*/
500 /* invoke DHM to process CCCH data */
501 if (rgDHMHndlCmnDatReq(inst,hqProc, datReq, err) == RFAILED)
503 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
504 "Handling of Data request in DHM failed RNTI:%d LCID:%d",
505 datReq->u.rnti,datReq->lcId);
506 /* Release First TB */
507 rgDHMRlsHqProcTB(cell, hqProc, 1);
508 /* err shall be filled in appropriately by DHM */
513 } /* rgROMHndlCcchDatReq */
517 * @brief Handler for DatReq received on RGU for BCCH or PCCH.
521 * Function : rgROMHndlBcchPcchDatReq
523 * This function shall store the buffer and time to transmit in lcCb.
526 * @param[in] RgCellCb *cell
527 * @param[in] RgRguCmnDatReq *datReq
528 * @param[out] RgErrInfo *err
534 PRIVATE S16 rgROMHndlBcchPcchDatReq
537 RgRguCmnDatReq *datReq,
541 PRIVATE S16 rgROMHndlBcchPcchDatReq(cell, datReq, err)
543 RgRguCmnDatReq *datReq;
547 Inst inst = cell->macInst - RG_INST_START;
549 /* Modified for SI Enhancement*/
552 RgBcchDlschLcCb *bcch;
555 CmLteTimingInfo timingInfo;
556 #if (ERRCLASS & ERRCLS_DEBUG)
557 RgUstaDgn dgn; /* Alarm diagnostics structure */
560 timingInfo.slot = (U8)(datReq->transId & 0XFF);
561 timingInfo.sfn = (U16)((datReq->transId >> 8) & 0xFFFF);
562 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
564 if( (sf->txDone == TRUE) ||
565 (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
567 #if (ERRCLASS & ERRCLS_DEBUG)
568 /* Transmission is already done for this slot. This is a delayed
569 * datReq. So discard */
570 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
571 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
572 LRG_CAUSE_DELAYED_DATREQ, &dgn);
574 err->errCause = RGERR_ROM_DELAYED_DATREQ;
579 bcch = rgDBMGetBcchOnDlsch(cell,datReq->lcId);
582 /* Store BCCH-DLSCH data received in Scheduled slot */
583 sf->bcch.tb = datReq->pdu;
585 SCpyMsgMsg(datReq->pdu, RG_GET_MEM_REGION(rgCb[inst]),
586 RG_GET_MEM_POOL(rgCb[inst]), &bcch->tb);
591 bch = rgDBMGetBcchOnBch(cell);
592 if ((bch) && (bch->lcId == datReq->lcId))
594 /* Store BCH data received in Scheduled slot */
595 sf->bch.tb = datReq->pdu;
600 pcch = rgDBMGetPcch(cell);
601 if ((pcch) && (pcch->lcId == datReq->lcId))
603 /* Store PCCH-DLSCH data received in Scheduled slot */
604 sf->pcch.tb = datReq->pdu;
608 /* Handle lcCb fetch failure */
609 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG005,(ErrVal)datReq->lcId,
610 "rgROMHndlBcchPcchDatReq(): Invalid Lc Id");
611 err->errCause = RGERR_ROM_INV_LC_ID;
614 } /* rgROMHndlBcchPcchDatReq */
617 * @brief Handler for StaRsp received on RGU for a dedicated logical channel.
621 * Function : rgROMDedStaRsp
623 * This fucntion shall store the BO reported for the given logical
627 * @param[in] Inst inst
628 * @param[in] RgRguDedStaRsp *staRsp
637 RgRguDedStaRsp *staRsp
640 S16 rgROMDedStaRsp(inst,staRsp)
642 RgRguDedStaRsp *staRsp;
647 /* Moving the error variables and assignments to available scope */
649 /* Avoiding memset, as the variables of this are getting
653 if(((cell = rgCb[inst].cell) != NULLP)
654 && (cell->cellId == staRsp->cellId))
659 boRpt.cellSapId = cell->schInstMap.cellSapId;
660 boRpt.cellId = staRsp->cellId;
661 boRpt.rnti = staRsp->rnti;
662 boRpt.lcId = staRsp->lcId;
663 boRpt.bo = staRsp->boReport.bo;
664 boRpt.oldestSduArrTime = staRsp->boReport.oldestSduArrTime;
665 boRpt.staPduBo = staRsp->boReport.staPduBo;
666 boRpt.oldestSduArrTime = staRsp->boReport.oldestSduArrTime;
668 rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
670 //TODO: commented for compilation without SCH RgMacSchDedBoUpdt(&schPst, &boRpt);
673 RLOG_ARG2(L_ERROR,DBG_CELLID,staRsp->cellId,"Invalid cell for CRNTI:%d LCID:%d ",
674 staRsp->rnti,staRsp->lcId);
677 } /* rgROMDedStaRsp */
679 S16 RgMacSchBrdcmDedBoUpdtReq(
689 //if ((cell = rgDBMGetCellCb(cellId)) != NULLP)
690 if (((cell = rgCb[inst].cell) != NULLP) &&
691 (cell->cellId == cellId))
696 boRpt.cellSapId = cell->schInstMap.cellSapId;
697 boRpt.cellId = cellId;
702 rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
704 //TODO: commented for compilation without SCH RgMacSchDedBoUpdtReq (&schPst,&boRpt);
709 * @brief Handler for StaRsp received on RGU for a common logical channel.
713 * Function : rgROMCmnStaRsp
715 * This fucntion shall invoke rgROMHndlCcchStaRsp() for status response on
716 * CCCH and shall invoke rgROMHndlBcchPcchStaRsp() for status response on
720 * @param[in] Inst inst
721 * @param[in] RgRguCmnStaRsp *staRsp
730 RgRguCmnStaRsp *staRsp
733 S16 rgROMCmnStaRsp(inst,staRsp)
735 RgRguCmnStaRsp *staRsp;
741 if(((cell = rgCb[inst].cell) == NULLP)
742 || (cell->cellId != staRsp->cellId))
744 /* Handle Cell fetch failure */
745 RLOG_ARG2(L_ERROR,DBG_CELLID,staRsp->cellId,
746 "Invalid cell for CRNTI:%d LCID:%d",staRsp->u.rnti,staRsp->lcId);
747 err.errType = RGERR_ROM_CMNSTARSP;
748 err.errCause = RGERR_ROM_INV_CELL_ID;
752 /* handle status response on CCCH */
753 if(staRsp->lcId == cell->dlCcchId)
755 rgROMHndlCcchStaRsp(cell, staRsp, &err);
759 rgROMHndlBcchPcchStaRsp(cell, staRsp, &err);
763 } /* rgROMCmnStaRsp */
768 * @brief Handler for Request received on RGU for a UL Throughput measurement
769 * enabled logical channel.
773 * Function :rgROML2MUlThrpMeasReq
775 * This function shall store the L2M UL Throughput Measurement status information
776 * for the given logical channel.
779 * @param[in] Inst inst
780 * @param[in] RgRguL2MUlThrpMeasReq *measReq
786 S16 rgROML2MUlThrpMeasReq
789 RgRguL2MUlThrpMeasReq *measReq
792 S16 rgROML2MUlThrpMeasReq(inst,measReq)
794 RgRguL2MUlThrpMeasReq *measReq;
802 if(((cell = rgCb[inst].cell) != NULLP)
803 &&(cell->cellId == measReq->cellId))
805 if ((ue = rgDBMGetUeCb(cell, measReq->rnti)) != NULLP)
807 for(loop=0; loop<measReq->numLcId;loop++)
809 if ((rgDBMGetUlDedLcCb(ue, measReq->lcId[loop])) != NULLP)
811 ue->ul.lcCb[measReq->lcId[loop]].measOn = measReq->enbMeas;
812 if(ue->ul.lcCb[measReq->lcId[loop]].measOn == FALSE)
814 lcgId=ue->ul.lcCb[measReq->lcId[loop]].lcgId;
815 ue->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = 0;
816 ue->ul.lcgArr[lcgId].lcgBsInfo.firstDatSegRcvd = FALSE;
823 RLOG_ARG1(L_ERROR,DBG_CELLID,measReq->cellId,"Invalid cell CRNTI:%d",
826 } /* rgROML2MUlThrpMeasReq */
831 * @brief Handler for StaRsp received on RGU for CCCH.
835 * Function : rgROMHndlCcchStaRsp
837 * This function shall fetch the raCb with the given RNTI and ask RAM to
841 * @param[in] RgCellCb *cell
842 * @param[in] RgRguCmnStaRsp *staRsp
843 * @param[out] RgErrInfo *err
849 PRIVATE S16 rgROMHndlCcchStaRsp
852 RgRguCmnStaRsp *staRsp,
856 PRIVATE S16 rgROMHndlCcchStaRsp(cell, staRsp, err)
858 RgRguCmnStaRsp *staRsp;
863 Inst macInst = cell->macInst - RG_INST_START;
864 //RgInfCmnBoRpt boRpt;
868 boRpt.cellSapId = cell->schInstMap.cellSapId;
869 boRpt.cellId = staRsp->cellId;
870 boRpt.u.rnti = staRsp->u.rnti;
871 boRpt.lcId = staRsp->lcId;
872 boRpt.lcType = staRsp->lcType;
873 boRpt.bo = staRsp->bo;
875 rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
876 //TODO: commented for compilation without SCH RgMacSchCmnBoUpdt(&schPst, &boRpt);
879 } /* rgROMHndlCcchStaRsp */
883 * @brief Handler for StaRsp received on RGU for BCCH or PCCH.
887 * Function : rgROMHndlBcchPcchStaRsp
889 * This function shall store the buffer and time to transmit in lcCb.
892 * @param[in] RgCellCb *cell
893 * @param[in] RgRguCmnStaRsp *staRsp
894 * @param[out] RgErrInfo *err
900 PRIVATE S16 rgROMHndlBcchPcchStaRsp
903 RgRguCmnStaRsp *staRsp,
907 PRIVATE S16 rgROMHndlBcchPcchStaRsp(cell, staRsp, err)
909 RgRguCmnStaRsp *staRsp;
914 //RgInfCmnBoRpt boRpt;
915 Inst macInst = cell->macInst - RG_INST_START;
917 memset(&schPst, 0, sizeof(Pst));
919 if (rgDBMChkCmnLcCb(cell, staRsp->lcId) != ROK)
921 /* Handle lcCb fetch failure */
922 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid LCID:%d",staRsp->lcId);
923 err->errCause = RGERR_ROM_INV_LC_ID;
926 /* MS_WORKAROUND : This is to ensure that the queue for BCH is not filled with old BO requests :
927 This assumes that BO is not received more than 4 frames in advance from the enodeb application */
928 if (cell->bcchBchInfo.lcId == staRsp->lcId)
932 nextBchSfn = (cell->crntTime.sfn + 4 - (cell->crntTime.sfn%4)) % RG_MAX_SFN;
933 if ((staRsp->u.timeToTx.sfn != nextBchSfn) ||
934 ((staRsp->u.timeToTx.sfn == cell->crntTime.sfn) && (cell->crntTime.slot >= 7)))
940 boRpt.cellSapId = cell->schInstMap.cellSapId;
941 boRpt.cellId = staRsp->cellId;
942 boRpt.u.timeToTx = staRsp->u.timeToTx;
943 boRpt.lcId = staRsp->lcId;
944 boRpt.lcType = staRsp->lcType;
945 boRpt.bo = staRsp->bo;*/
949 if(boRpt.lcType == CM_LTE_LCH_PCCH)
951 boRpt.emtcDIReason = staRsp->emtcDiReason;
952 boRpt.pnb = staRsp->pnb;
956 rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
957 //TODO: commented for compilation without SCH RgMacSchCmnBoUpdt(&schPst, &boRpt);
960 } /* rgROMHndlBcchPcchStaRsp */
962 /* ADD Changes for Downlink UE Timing Optimization */
963 #ifdef LTEMAC_DLUE_TMGOPTMZ
965 * @brief Handler for updating DL SF information on receiving
966 * DL dedicated data, CCCH, BCCH/PCCH data request.
970 * Function : rgROMUpdDLSfRemDataCnt
973 * @param[in] RgCellCb *cell
974 * @param[in] RgDlSf *dlSf;
980 PRIVATE S16 rgROMUpdDlSfRemDataCnt
986 PRIVATE S16 rgROMUpdDlSfRemDataCnt(cellCb, dlSf)
992 //Inst inst = cellCb->macInst - RG_INST_START;
994 if(!dlSf->remDatReqCnt)
996 /*This is an error scenario of RLC generating more data
997 * request than the allocation. Do nothing for this. */
998 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
999 "RX new data while remDatReqCnt is 0 for cell");
1003 /*Decrement the remaining data request to be received countter
1005 Check if this was the last pending data request for this DL SF.*/
1006 /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
1008 if((0 == --dlSf->remDatReqCnt) && !(dlSf->txDone) &&
1009 (RG_TIMEINFO_SAME(cellCb->crntTime, dlSf->schdTime)) && (dlSf->statIndDone))
1011 /*Check if we have already received a TTI for this Data,
1012 if that is the case then we need to send TFU Data request
1015 if (ROK != rgTOMUtlProcDlSf (dlSf, cellCb, &err))
1017 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
1018 "Unable to process downlink slot for cell");
1019 err.errType = RGERR_ROM_DEDDATREQ;
1022 /* Mark this frame as sent */
1023 dlSf->txDone = TRUE;
1027 } /* rgROMUpdDlSfRemDataCnt*/
1030 /**********************************************************************
1033 **********************************************************************/