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 PUBLIC 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
108 PUBLIC S16 rgROMDedDatReq
111 RgRguDedDatReq *datReq
114 PUBLIC 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;
143 if (((cell = rgCb[inst].cell) == NULLP)
144 || (cell->cellId != datReq->cellId))
146 #if (ERRCLASS & ERRCLS_INT_PAR)
147 /* Handle Cell fetch failure */
148 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG001,(ErrVal)datReq->cellId,
149 "rgROMDedDatReq(): Invalid cell Id");
151 err.errType = RGERR_ROM_DEDDATREQ;
152 err.errCause = RGERR_ROM_INV_CELL_ID;
156 rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
161 /* Add loop here to scan for all UEs in the consolidated DDatReq*/
162 for(idx = 0; idx < datReq->nmbOfUeGrantPerTti; idx++)
165 timingInfo.slot = (U8)((datReq->datReq[idx].transId >> 8) & 0XFF);
166 timingInfo.sfn = (U16)((datReq->datReq[idx].transId >> 16) & 0xFFFF);
167 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
169 if( (sf->txDone == TRUE) ||
170 (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
172 #if (ERRCLASS & ERRCLS_DEBUG)
173 /* Transmission is already done for this slot. This is a delayed
174 * datReq. So discard */
175 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
176 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
177 LRG_CAUSE_DELAYED_DATREQ, &dgn);
179 err.errType = RGERR_ROM_DEDDATREQ;
180 err.errCause = RGERR_ROM_DELAYED_DATREQ;
182 rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
185 EXTERN U32 dbgDelayedDatReqInMac;
186 dbgDelayedDatReqInMac++;
190 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
193 // RETVALUE(RFAILED);
196 if ((ue = rgDBMGetUeCb(cell, datReq->datReq[idx].rnti)) == NULLP)
198 #if (ERRCLASS & ERRCLS_INT_PAR)
199 /* Handle Ue fetch failure */
200 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG002,(ErrVal)datReq->datReq[idx].rnti,
201 "rgROMDedDatReq(): Invalid ue Id");
203 err.errType = RGERR_ROM_DEDDATREQ;
204 err.errCause = RGERR_ROM_INV_UE_ID;
206 rgUpdtRguDedSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP, datReq);
207 /* ADD Changes for Downlink UE Timing Optimization */
208 #ifdef LTEMAC_DLUE_TMGOPTMZ
209 /* Trying to send the prev successful PDU's
211 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
214 RLOG0(L_INFO, "Dropping due to no ue \n");
216 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
218 /* Return from here as above functions found more datReq than expected*/
222 /* Conitnue for next UE */
226 hqPId = (U8)(datReq->datReq[idx].transId);
228 /* get harq process and invoke DHM */
229 rgDHMGetHqProcFrmId(ue, hqPId, &hqProc);
231 if (rgDHMHndlDedDatReq(inst,hqProc, &datReq->datReq[idx], sf, &err) == RFAILED)
233 RLOG_ARG1(L_ERROR,DBG_CELLID,datReq->cellId,
234 "Handling of Data request in DHM failedi RNTI:%d",
235 datReq->datReq[idx].rnti);
236 err.errType = RGERR_ROM_DEDDATREQ;
237 /* errcause shall be filled in appropriately by DHM */
239 rgUpdtRguDedSts(inst,ue->rguDlSap,RG_RGU_SDU_DROP, datReq);
240 /* ADD Changes for Downlink UE Timing Optimization */
241 #ifdef LTEMAC_DLUE_TMGOPTMZ
242 /* Trying to send the prev successful PDU's
244 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
247 RLOG0(L_INFO, "Dropping due to no failure of remCnt update");
249 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
251 /* Return from here as above functions found more datReq than expected*/
258 /* Merging the updation of statistics of SDUs with for loop below */
260 rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
262 boRpt.cellSapId = cell->schInstMap.cellSapId;
263 boRpt.cellId = datReq->cellId;
265 boRpt.rnti = datReq->datReq[idx].rnti;
268 /* Fill the DStaRsp struct and send it to scheduler */
269 for (idx1 = 0; idx1 < datReq->datReq[idx].nmbOfTbs; idx1++)
271 for(idx2 = 0; idx2 < datReq->datReq[idx].datReqTb[idx1].nmbLch; idx2++)
273 /* Updating dedicated SDUs received statistics without
274 additional function above for optimization */
275 ue->rguDlSap->sapSts.numPduRcvd +=
276 datReq->datReq[idx].datReqTb[idx1].lchData[idx2].pdu.numPdu;
278 boRpt.lcId = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].lcId;
279 boRpt.bo = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.bo;
280 boRpt.oldestSduArrTime
281 = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.oldestSduArrTime;
282 boRpt.staPduBo = datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.staPduBo;
284 boRpt.setMaxUlPrio= datReq->datReq[idx].datReqTb[idx1].lchData[idx2].setMaxUlPrio;
286 boRpt.setMaxDlPrio= datReq->datReq[idx].datReqTb[idx1].lchData[idx2].boReport.staPduPrsnt;
288 RgMacSchDedBoUpdt(&schPst, &boRpt);
292 /* ADD Changes for Downlink UE Timing Optimization */
293 #ifdef LTEMAC_DLUE_TMGOPTMZ
294 // sf->remDatReqCnt -= datReqFailCnt;
295 /*Presently this function is not returning RFAILED, thus not checking
296 for failure condition.*/
297 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
300 RLOG0(L_INFO, "\n Dropping due to no failure of remCnt update(1) \n");
302 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[idx]);
304 /* Return from here as above functions found more datReq than expected*/
308 } /* for loop for num of Ue per TTI*/
311 /* Data send successfully to PHY. lets retuns ROK*/
313 } /* rgROMDedDatReq */
317 * @brief Handler for DatReq received on RGU for a common logical channel.
321 * Function : rgROMCmnDatReq
323 * This function shall invoke rgROMHndlCcchDatReq() if datReq is on CCCH
324 * If not, it shall invoke rgROMHndlBcchPcchDatReq().
327 * @param[in] Inst inst
328 * @param[in] RgRguCmnDatReq *datReq
334 PUBLIC S16 rgROMCmnDatReq
337 RgRguCmnDatReq *datReq
340 PUBLIC S16 rgROMCmnDatReq(inst,datReq)
342 RgRguCmnDatReq *datReq;
348 /* ADD Changes for Downlink UE Timing Optimization */
349 #ifdef LTEMAC_DLUE_TMGOPTMZ
350 CmLteTimingInfo timingInfo;
357 err.errType = RGERR_ROM_CMNDATREQ;
358 if(((cell = rgCb[inst].cell) == NULLP)
359 ||(cell->cellId != datReq->cellId))
361 #if (ERRCLASS & ERRCLS_INT_PAR)
362 /* Handle Cell fetch failure */
363 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG003,(ErrVal)datReq->cellId,
364 "rgROMCmnDatReq(): Invalid cell Id");
366 err.errCause = RGERR_ROM_INV_CELL_ID;
370 rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP);
375 if (datReq->lcId == cell->dlCcchId)
377 ret = rgROMHndlCcchDatReq(cell, datReq, &err);
379 /*Get the timing Info*/
380 /* ADD Changes for Downlink UE Timing Optimization */
381 #ifdef LTEMAC_DLUE_TMGOPTMZ
382 timingInfo.slot = (U8)((datReq->transId >> 8) & 0XFF);
383 timingInfo.sfn = (U16)((datReq->transId >> 16) & 0xFFFF);
388 ret = rgROMHndlBcchPcchDatReq(cell, datReq, &err);
390 /*Get the timing Info*/
391 /* ADD Changes for Downlink UE Timing Optimization */
392 #ifdef LTEMAC_DLUE_TMGOPTMZ
393 timingInfo.slot = (U8)(datReq->transId & 0XFF);
394 timingInfo.sfn = (U16)((datReq->transId >> 8) & 0xFFFF);
401 rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_DROP);
405 /* Update stats with number of SDUs received */
406 rgUpdtRguCmnSts(inst,cell->rguDlSap,RG_RGU_SDU_RCVD);
409 /* ADD Changes for Downlink UE Timing Optimization */
410 #ifdef LTEMAC_DLUE_TMGOPTMZ
411 RG_ARRAY_BOUND_CHECK(0, cell->subFrms, (timingInfo.slot % RG_NUM_SUB_FRAMES));
412 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
414 ret = rgROMUpdDlSfRemDataCnt(cell, sf);
415 /*Added check for RFAILED as above function can return RFAILED*/
419 } /* rgROMCmnDatReq */
422 * @brief Handler for DatReq received on RGU for CCCH.
426 * Function : rgROMHndlCcchDatReq
428 * This function shall fetch the raCb with the given rnti and indicate msg4
432 * @param[in] RgCellCb *cell
433 * @param[in] RgRguCmnDatReq *datReq
434 * @param[out] RgErrInfo *err
440 PRIVATE S16 rgROMHndlCcchDatReq
443 RgRguCmnDatReq *datReq,
447 PRIVATE S16 rgROMHndlCcchDatReq(cell, datReq, err)
449 RgRguCmnDatReq *datReq;
453 Inst inst = cell->macInst - RG_INST_START;
456 RgDlHqProcCb *hqProc;
457 CmLteTimingInfo timingInfo;
459 #if (ERRCLASS & ERRCLS_DEBUG)
460 RgUstaDgn dgn; /* Alarm diagnostics structure */
463 TRC2(rgROMHndlCcchDatReq);
466 err->errType = RGERR_ROM_CMNDATREQ;
468 if ((ue = rgDBMGetUeCb(cell, datReq->u.rnti)) == NULLP)
470 if ((ue = rgDBMGetUeCbFromRachLst(cell, datReq->u.rnti)) == NULLP)
472 #if (ERRCLASS & ERRCLS_INT_PAR)
473 /* Handle Ue fetch failure */
474 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG004,(ErrVal)datReq->u.rnti,
475 "rgROMHndlCcchDatReq(): Invalid ue Id");
477 err->errCause = RGERR_ROM_INV_UE_ID;
482 timingInfo.slot = (U8)((datReq->transId >> 8) & 0XFF);
483 timingInfo.sfn = (U16)((datReq->transId >> 16) & 0xFFFF);
484 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
486 if( (sf->txDone == TRUE) ||
487 (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
489 #if (ERRCLASS & ERRCLS_DEBUG)
490 /* Transmission is already done for this slot. This is a delayed
491 * datReq. So discard */
492 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
493 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
494 LRG_CAUSE_DELAYED_DATREQ, &dgn);
496 err->errCause = RGERR_ROM_DELAYED_DATREQ;
500 hqPId = (U8)(datReq->transId);
503 /* get harq process and invoke DHM */
504 rgDHMGetHqProcFrmId(ue, hqPId, &hqProc);
506 /* Changed for CR timer implementation*/
507 /* invoke DHM to process CCCH data */
508 if (rgDHMHndlCmnDatReq(inst,hqProc, datReq, err) == RFAILED)
510 RLOG_ARG2(L_ERROR,DBG_CELLID,cell->cellId,
511 "Handling of Data request in DHM failed RNTI:%d LCID:%d",
512 datReq->u.rnti,datReq->lcId);
513 /* Release First TB */
514 rgDHMRlsHqProcTB(cell, hqProc, 1);
515 /* err shall be filled in appropriately by DHM */
520 } /* rgROMHndlCcchDatReq */
524 * @brief Handler for DatReq received on RGU for BCCH or PCCH.
528 * Function : rgROMHndlBcchPcchDatReq
530 * This function shall store the buffer and time to transmit in lcCb.
533 * @param[in] RgCellCb *cell
534 * @param[in] RgRguCmnDatReq *datReq
535 * @param[out] RgErrInfo *err
541 PRIVATE S16 rgROMHndlBcchPcchDatReq
544 RgRguCmnDatReq *datReq,
548 PRIVATE S16 rgROMHndlBcchPcchDatReq(cell, datReq, err)
550 RgRguCmnDatReq *datReq;
554 Inst inst = cell->macInst - RG_INST_START;
556 /* Modified for SI Enhancement*/
559 RgBcchDlschLcCb *bcch;
562 CmLteTimingInfo timingInfo;
563 #if (ERRCLASS & ERRCLS_DEBUG)
564 RgUstaDgn dgn; /* Alarm diagnostics structure */
567 TRC2(rgROMHndlBcchPcchDatReq);
570 timingInfo.slot = (U8)(datReq->transId & 0XFF);
571 timingInfo.sfn = (U16)((datReq->transId >> 8) & 0xFFFF);
572 sf = &cell->subFrms[(timingInfo.slot % RG_NUM_SUB_FRAMES)];
574 if( (sf->txDone == TRUE) ||
575 (!RG_TIMEINFO_SAME(sf->schdTime,timingInfo)))
577 #if (ERRCLASS & ERRCLS_DEBUG)
578 /* Transmission is already done for this slot. This is a delayed
579 * datReq. So discard */
580 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
581 rgLMMStaInd(inst,LCM_CATEGORY_PROTOCOL, LCM_EVENT_UI_INV_EVT,
582 LRG_CAUSE_DELAYED_DATREQ, &dgn);
584 err->errCause = RGERR_ROM_DELAYED_DATREQ;
589 bcch = rgDBMGetBcchOnDlsch(cell,datReq->lcId);
592 /* Store BCCH-DLSCH data received in Scheduled slot */
593 sf->bcch.tb = datReq->pdu;
595 SCpyMsgMsg(datReq->pdu, RG_GET_MEM_REGION(rgCb[inst]),
596 RG_GET_MEM_POOL(rgCb[inst]), &bcch->tb);
601 bch = rgDBMGetBcchOnBch(cell);
602 if ((bch) && (bch->lcId == datReq->lcId))
604 /* Store BCH data received in Scheduled slot */
605 sf->bch.tb = datReq->pdu;
610 pcch = rgDBMGetPcch(cell);
611 if ((pcch) && (pcch->lcId == datReq->lcId))
613 /* Store PCCH-DLSCH data received in Scheduled slot */
614 sf->pcch.tb = datReq->pdu;
618 /* Handle lcCb fetch failure */
619 RGLOGERROR(inst,ERRCLS_INT_PAR,ERG005,(ErrVal)datReq->lcId,
620 "rgROMHndlBcchPcchDatReq(): Invalid Lc Id");
621 err->errCause = RGERR_ROM_INV_LC_ID;
624 } /* rgROMHndlBcchPcchDatReq */
627 * @brief Handler for StaRsp received on RGU for a dedicated logical channel.
631 * Function : rgROMDedStaRsp
633 * This fucntion shall store the BO reported for the given logical
637 * @param[in] Inst inst
638 * @param[in] RgRguDedStaRsp *staRsp
644 PUBLIC S16 rgROMDedStaRsp
647 RgRguDedStaRsp *staRsp
650 PUBLIC S16 rgROMDedStaRsp(inst,staRsp)
652 RgRguDedStaRsp *staRsp;
657 /* Moving the error variables and assignments to available scope */
661 /* Avoiding memset, as the variables of this are getting
665 if(((cell = rgCb[inst].cell) != NULLP)
666 && (cell->cellId == staRsp->cellId))
671 boRpt.cellSapId = cell->schInstMap.cellSapId;
672 boRpt.cellId = staRsp->cellId;
673 boRpt.rnti = staRsp->rnti;
674 boRpt.lcId = staRsp->lcId;
675 boRpt.bo = staRsp->boReport.bo;
676 boRpt.oldestSduArrTime = staRsp->boReport.oldestSduArrTime;
677 boRpt.staPduBo = staRsp->boReport.staPduBo;
678 boRpt.oldestSduArrTime = staRsp->boReport.oldestSduArrTime;
680 rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
682 //TODO: commented for compilation without SCH RgMacSchDedBoUpdt(&schPst, &boRpt);
685 RLOG_ARG2(L_ERROR,DBG_CELLID,staRsp->cellId,"Invalid cell for CRNTI:%d LCID:%d ",
686 staRsp->rnti,staRsp->lcId);
689 } /* rgROMDedStaRsp */
691 S16 RgMacSchBrdcmDedBoUpdtReq(
701 //if ((cell = rgDBMGetCellCb(cellId)) != NULLP)
702 if (((cell = rgCb[inst].cell) != NULLP) &&
703 (cell->cellId == cellId))
708 boRpt.cellSapId = cell->schInstMap.cellSapId;
709 boRpt.cellId = cellId;
714 rgGetPstToInst(&schPst,inst, cell->schInstMap.schInst);
716 //TODO: commented for compilation without SCH RgMacSchDedBoUpdtReq (&schPst,&boRpt);
721 * @brief Handler for StaRsp received on RGU for a common logical channel.
725 * Function : rgROMCmnStaRsp
727 * This fucntion shall invoke rgROMHndlCcchStaRsp() for status response on
728 * CCCH and shall invoke rgROMHndlBcchPcchStaRsp() for status response on
732 * @param[in] Inst inst
733 * @param[in] RgRguCmnStaRsp *staRsp
739 PUBLIC S16 rgROMCmnStaRsp
742 RgRguCmnStaRsp *staRsp
745 PUBLIC S16 rgROMCmnStaRsp(inst,staRsp)
747 RgRguCmnStaRsp *staRsp;
756 if(((cell = rgCb[inst].cell) == NULLP)
757 || (cell->cellId != staRsp->cellId))
759 /* Handle Cell fetch failure */
760 RLOG_ARG2(L_ERROR,DBG_CELLID,staRsp->cellId,
761 "Invalid cell for CRNTI:%d LCID:%d",staRsp->u.rnti,staRsp->lcId);
762 err.errType = RGERR_ROM_CMNSTARSP;
763 err.errCause = RGERR_ROM_INV_CELL_ID;
767 /* handle status response on CCCH */
768 if(staRsp->lcId == cell->dlCcchId)
770 rgROMHndlCcchStaRsp(cell, staRsp, &err);
774 rgROMHndlBcchPcchStaRsp(cell, staRsp, &err);
778 } /* rgROMCmnStaRsp */
783 * @brief Handler for Request received on RGU for a UL Throughput measurement
784 * enabled logical channel.
788 * Function :rgROML2MUlThrpMeasReq
790 * This function shall store the L2M UL Throughput Measurement status information
791 * for the given logical channel.
794 * @param[in] Inst inst
795 * @param[in] RgRguL2MUlThrpMeasReq *measReq
801 PUBLIC S16 rgROML2MUlThrpMeasReq
804 RgRguL2MUlThrpMeasReq *measReq
807 PUBLIC S16 rgROML2MUlThrpMeasReq(inst,measReq)
809 RgRguL2MUlThrpMeasReq *measReq;
816 TRC2(rgROML2MUlThrpMeasReq)
820 if(((cell = rgCb[inst].cell) != NULLP)
821 &&(cell->cellId == measReq->cellId))
823 if ((ue = rgDBMGetUeCb(cell, measReq->rnti)) != NULLP)
825 for(loop=0; loop<measReq->numLcId;loop++)
827 if ((rgDBMGetUlDedLcCb(ue, measReq->lcId[loop])) != NULLP)
829 ue->ul.lcCb[measReq->lcId[loop]].measOn = measReq->enbMeas;
830 if(ue->ul.lcCb[measReq->lcId[loop]].measOn == FALSE)
832 lcgId=ue->ul.lcCb[measReq->lcId[loop]].lcgId;
833 ue->ul.lcgArr[lcgId].lcgBsInfo.outStndngBs = 0;
834 ue->ul.lcgArr[lcgId].lcgBsInfo.firstDatSegRcvd = FALSE;
841 RLOG_ARG1(L_ERROR,DBG_CELLID,measReq->cellId,"Invalid cell CRNTI:%d",
844 } /* rgROML2MUlThrpMeasReq */
849 * @brief Handler for StaRsp received on RGU for CCCH.
853 * Function : rgROMHndlCcchStaRsp
855 * This function shall fetch the raCb with the given RNTI and ask RAM to
859 * @param[in] RgCellCb *cell
860 * @param[in] RgRguCmnStaRsp *staRsp
861 * @param[out] RgErrInfo *err
867 PRIVATE S16 rgROMHndlCcchStaRsp
870 RgRguCmnStaRsp *staRsp,
874 PRIVATE S16 rgROMHndlCcchStaRsp(cell, staRsp, err)
876 RgRguCmnStaRsp *staRsp;
881 Inst macInst = cell->macInst - RG_INST_START;
882 //RgInfCmnBoRpt boRpt;
884 TRC2(rgROMHndlCcchStaRsp);
887 boRpt.cellSapId = cell->schInstMap.cellSapId;
888 boRpt.cellId = staRsp->cellId;
889 boRpt.u.rnti = staRsp->u.rnti;
890 boRpt.lcId = staRsp->lcId;
891 boRpt.lcType = staRsp->lcType;
892 boRpt.bo = staRsp->bo;
894 rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
895 //TODO: commented for compilation without SCH RgMacSchCmnBoUpdt(&schPst, &boRpt);
898 } /* rgROMHndlCcchStaRsp */
902 * @brief Handler for StaRsp received on RGU for BCCH or PCCH.
906 * Function : rgROMHndlBcchPcchStaRsp
908 * This function shall store the buffer and time to transmit in lcCb.
911 * @param[in] RgCellCb *cell
912 * @param[in] RgRguCmnStaRsp *staRsp
913 * @param[out] RgErrInfo *err
919 PRIVATE S16 rgROMHndlBcchPcchStaRsp
922 RgRguCmnStaRsp *staRsp,
926 PRIVATE S16 rgROMHndlBcchPcchStaRsp(cell, staRsp, err)
928 RgRguCmnStaRsp *staRsp;
933 //RgInfCmnBoRpt boRpt;
934 Inst macInst = cell->macInst - RG_INST_START;
936 TRC2(rgROMHndlBcchPcchStaRsp);
937 cmMemset((U8*)&schPst, (U8)0, sizeof(Pst));
939 if (rgDBMChkCmnLcCb(cell, staRsp->lcId) != ROK)
941 /* Handle lcCb fetch failure */
942 RLOG_ARG1(L_ERROR,DBG_CELLID,cell->cellId,"Invalid LCID:%d",staRsp->lcId);
943 err->errCause = RGERR_ROM_INV_LC_ID;
946 /* MS_WORKAROUND : This is to ensure that the queue for BCH is not filled with old BO requests :
947 This assumes that BO is not received more than 4 frames in advance from the enodeb application */
948 if (cell->bcchBchInfo.lcId == staRsp->lcId)
952 nextBchSfn = (cell->crntTime.sfn + 4 - (cell->crntTime.sfn%4)) % RG_MAX_SFN;
953 if ((staRsp->u.timeToTx.sfn != nextBchSfn) ||
954 ((staRsp->u.timeToTx.sfn == cell->crntTime.sfn) && (cell->crntTime.slot >= 7)))
960 boRpt.cellSapId = cell->schInstMap.cellSapId;
961 boRpt.cellId = staRsp->cellId;
962 boRpt.u.timeToTx = staRsp->u.timeToTx;
963 boRpt.lcId = staRsp->lcId;
964 boRpt.lcType = staRsp->lcType;
965 boRpt.bo = staRsp->bo;*/
969 if(boRpt.lcType == CM_LTE_LCH_PCCH)
971 boRpt.emtcDIReason = staRsp->emtcDiReason;
972 boRpt.pnb = staRsp->pnb;
976 rgGetPstToInst(&schPst,macInst, cell->schInstMap.schInst);
977 //TODO: commented for compilation without SCH RgMacSchCmnBoUpdt(&schPst, &boRpt);
980 } /* rgROMHndlBcchPcchStaRsp */
982 /* ADD Changes for Downlink UE Timing Optimization */
983 #ifdef LTEMAC_DLUE_TMGOPTMZ
985 * @brief Handler for updating DL SF information on receiving
986 * DL dedicated data, CCCH, BCCH/PCCH data request.
990 * Function : rgROMUpdDLSfRemDataCnt
993 * @param[in] RgCellCb *cell
994 * @param[in] RgDlSf *dlSf;
1000 PRIVATE S16 rgROMUpdDlSfRemDataCnt
1006 PRIVATE S16 rgROMUpdDlSfRemDataCnt(cellCb, dlSf)
1012 //Inst inst = cellCb->macInst - RG_INST_START;
1014 TRC2(rgROMUpdDlSfRemDataCnt);
1017 if(!dlSf->remDatReqCnt)
1019 /*This is an error scenario of RLC generating more data
1020 * request than the allocation. Do nothing for this. */
1021 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
1022 "RX new data while remDatReqCnt is 0 for cell");
1026 /*Decrement the remaining data request to be received countter
1028 Check if this was the last pending data request for this DL SF.*/
1029 /* Fix[ccpu00126310]: Tracks Data Requests from RLC for both loosely and tight coupled
1031 if((0 == --dlSf->remDatReqCnt) && !(dlSf->txDone) &&
1032 (RG_TIMEINFO_SAME(cellCb->crntTime, dlSf->schdTime)) && (dlSf->statIndDone))
1034 /*Check if we have already received a TTI for this Data,
1035 if that is the case then we need to send TFU Data request
1038 if (ROK != rgTOMUtlProcDlSf (dlSf, cellCb, &err))
1040 RLOG_ARG0(L_ERROR,DBG_CELLID,cellCb->cellId,
1041 "Unable to process downlink slot for cell");
1042 err.errType = RGERR_ROM_DEDDATREQ;
1045 /* Mark this frame as sent */
1046 dlSf->txDone = TRUE;
1050 } /* rgROMUpdDlSfRemDataCnt*/
1053 /**********************************************************************
1056 **********************************************************************/