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 This module acts as an interface handler for upper interface and
33 manages Pst and Sap related information for upper interface APIs.
36 static const char* RLOG_MODULE_NAME="MAC";
37 static int RLOG_MODULE_ID=4096;
38 static int RLOG_FILE_ID=178;
40 /* header include files -- defines (.h) */
42 /* header/extern include files (.x) */
43 /* header include files (.h) */
44 #include "common_def.h"
45 #include "crg.h" /* CRG defines */
46 #include "lrg.h" /* layer management defines for LTE-MAC */
49 #include "rg_sch_inf.h"
50 #include "rg_env.h" /* customizable defines and macros for MAC */
51 #include "rg.h" /* defines and macros for MAC */
52 #include "rg_err.h" /* RG error defines */
54 /* header/extern include files (.x) */
56 #include "crg.x" /* CRG types */
57 #include "lrg.x" /* layer management typedefs for MAC */
60 #include "rg_sch_inf.x"
61 #include "rg_prg.x" /* PRG interface typedefs*/
62 #include "du_app_mac_inf.h"
63 #include "rg.x" /* typedefs for MAC */
74 /* forward references */
76 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
77 S16 rgBatchProc(Void);
82 * @brief Handler for Bind request.
86 * Function : RgUiRguBndReq
88 * This function handles the bind request from MAC Service User.
92 * @param[in] SuId suId
93 * @param[in] SpId spId
107 Pst tmpPst; /* Temporary Post Structure */
108 RgUstaDgn dgn; /* Alarm diagnostics structure */
110 RG_IS_INST_VALID(pst->dstInst);
111 inst = pst->dstInst - RG_INST_START;
113 tmpPst.prior = pst->prior;
114 tmpPst.route = pst->route;
115 tmpPst.selector = pst->selector;
116 tmpPst.region = rgCb[inst].rgInit.region;
117 tmpPst.pool = rgCb[inst].rgInit.pool;
118 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
119 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
120 tmpPst.srcInst = rgCb[inst].rgInit.inst;
121 tmpPst.event = EVTNONE;
122 tmpPst.dstProcId = pst->srcProcId;
123 tmpPst.dstEnt = pst->srcEnt;
124 tmpPst.dstInst = pst->srcInst;
126 if(spId == rgCb[inst].rguSap[spId].sapCfg.spId)
128 /* Check the state of the SAP */
129 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
131 case LRG_NOT_CFG: /* SAP Not configured */
132 RGDBGINFO(inst,(rgPBuf(inst), "SAP Not Configured\n"));
133 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
134 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
135 LCM_CAUSE_INV_SAP, &dgn);
136 RLOG0(L_DEBUG,"SAP Not Configured");
137 ret = RgUiRguBndCfm(&tmpPst, suId, CM_BND_NOK);
139 case LRG_UNBND: /* SAP is not bound */
140 RLOG0(L_DEBUG,"SAP Not yet bound");
141 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_BND;
142 rgCb[inst].rguSap[spId].sapCfg.suId = suId;
143 /* Send Bind Confirm with status as SUCCESS */
144 /*T2K - Passing spId as it is required to access the SAP CB*/
145 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
146 /* Indicate to Layer manager */
147 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
148 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_RGUSAP_ENB,
149 LCM_CAUSE_UNKNOWN, &dgn);
151 case LRG_BND: /* SAP is already bound*/
152 RLOG0(L_DEBUG,"SAP already bound");
153 /*T2K - Passing spId as it is required to access the SAP CB*/
154 ret = rgUIMRguBndCfm(inst,spId, CM_BND_OK);
156 default: /* Should Never Enter here */
157 #if (ERRCLASS & ERRCLS_ADD_RES)
158 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG008, (ErrVal)rgCb[inst].rguSap[spId].sapSta.sapState,
159 "Invalid SAP State:RgUiRguBndReq failed\n");
161 /*T2K - Passing spId as it is required to access the SAP CB*/
162 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
168 #if (ERRCLASS & ERRCLS_ADD_RES)
169 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG009, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
170 "Invalid SAP Id:RgUiRguBndReq failed\n");
172 /*T2K - Passing spId as it is required to access the SAP CB*/
173 ret = rgUIMRguBndCfm(inst,spId, CM_BND_NOK);
176 } /* RgUiRguBndReq */
180 * @brief Handler for Unbind request.
184 * Function : RgUiRguUbndReq
186 * This function handles the unbind request from MAC Service User.
189 * @param[in] Pst *pst
190 * @param[in] SpId spId
191 * @param[in] Reason reason
205 RG_IS_INST_VALID(pst->dstInst);
206 inst = pst->dstInst - RG_INST_START;
207 /* SAP Id validation */
208 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
210 switch(rgCb[inst].rguSap[spId].sapSta.sapState)
212 case LRG_BND: /* SAP is already bound*/
213 RLOG0(L_DEBUG,"SAP already bound");
214 /* setting SAP state to UN BOUND */
215 rgCb[inst].rguSap[spId].sapSta.sapState = LRG_UNBND;
218 #if (ERRCLASS & ERRCLS_ADD_RES)
219 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguUbndReq failed",
220 rgCb[inst].rguSap[spId].sapSta.sapState);
228 #if (ERRCLASS & ERRCLS_ADD_RES)
229 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG011, (ErrVal)rgCb[inst].rguSap[spId].sapCfg.spId,
230 "Invalid SAP Id:RgUiRguUbndReq failed\n");
235 } /* RgUiRguUbndReq */
237 * @brief API for sending bind confirm from MAC to RLC
241 * Function: rgUIMRguBndCfm
243 * This API is invoked to send bind confirm from MAC to RLC.
244 * This API fills in Pst structure and SAP Ids and invokes
245 * bind confirm API towards RLC.
247 * @param[in] Inst inst
248 * @param[in] SuId suId
249 * @param[in] uint8_t status
254 S16 rgUIMRguBndCfm(Inst inst,SpId spId,uint8_t status)
258 ret = RgUiRguBndCfm(&rgCb[inst].rguSap[spId].sapCfg.sapPst,
259 rgCb[inst].rguSap[spId].sapCfg.suId, status);
263 RLOG0(L_ERROR,"RgUiRguBndCfm Failed ");
267 } /* rgUIMRguBndCfm*/
271 * @brief Handler for dedicated DatReq from RGU
275 * Function : RgUiRguDDatReq
277 * This function validates SAP and invokes ROM for further processing
279 * @param[in] Pst *pst
280 * @param[in] SpId spId
281 * @param[in] RguDDatReqInfo *datReq
286 S16 RgUiRguDDatReq(Pst *pst,SpId spId,RguDDatReqInfo *datReq)
297 RG_IS_INST_VALID(pst->dstInst);
298 inst = pst->dstInst - RG_INST_START;
302 RLOG0(L_ERROR,"Input Message Buffer is NULL");
306 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
308 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
310 case LRG_BND: /* SAP is bound */
311 RLOG0(L_DEBUG,"SAP is already bound");
313 default: /* Should never reach here */
314 #if (ERRCLASS & ERRCLS_ADD_RES)
315 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguDDatReq failed",
316 rgCb[inst].rguSap[spId].sapSta.sapState);
319 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
321 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
329 #if (ERRCLASS & ERRCLS_ADD_RES)
330 RGLOGERROR(inst,ERRCLS_INT_PAR, ERG013, (ErrVal)spId,
331 "Invalid SAP Id:RgUiRguDDatReq failed\n");
334 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
336 RG_DROP_RGUDDATREQ_MBUF(datReq->datReq[id3]);
342 /* Update RGU SAP statistics for received sdu count */
343 /*ccpu00118201 - ADD - Send trace only when its enabled*/
344 if(rgCb[inst].rgInit.trc)
346 for(id3 = 0; id3 < datReq->nmbOfUeGrantPerTti; id3++)
348 RguDDatReqPerUe *datReqPerUe = &datReq->datReq[id3];
349 for (id = 0; id < datReqPerUe->nmbOfTbs; id++)
351 for (id1 = 0; id1 < datReqPerUe->datReqTb[id].nmbLch; id1++)
353 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
354 * rgROMDedDatReq -> rgUpdtRguDedSts function
355 * So numPduRcvd updation is commented here */
356 /* rgCb.rguSap.sapSts.numPduRcvd +=
357 datReq->datReqTb[id].lchData[id1].pdu.numPdu; */
358 for (id2 = 0; id2 < datReqPerUe->datReqTb[id].lchData[id1].pdu.numPdu; id2++)
360 RG_SEND_TRC_IND(inst,datReqPerUe->datReqTb[id].
361 lchData[id1].pdu.mBuf[id2], EVTRGUDDATREQ);
369 /* Call Ownership module for further processing */
370 ret = rgROMDedDatReq(inst,datReq);
371 SPutStaticBuffer(pst->region, pst->pool, (Data *)datReq,sizeof(RguDDatReqInfo), SS_SHARABLE_MEMORY);
374 } /* RgUiRguDDatReq */
378 * @brief Handler for common DatReq from RGU
382 * Function : RgUiRguCDatReq
384 * This function validates SAP invokes ROM for further processing
386 * @param[in] Pst *pst
387 * @param[in] SpId spId
388 * @param[in] RguCDatReqInfo *datReq
397 RguCDatReqInfo *datReq
403 RG_IS_INST_VALID(pst->dstInst);
404 inst = pst->dstInst - RG_INST_START;
408 RLOG0(L_ERROR,"Input Message Buffer is NULL");
412 if(rgCb[inst].rguSap[spId].sapCfg.spId == spId)
414 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
416 case LRG_BND: /* SAP is bound */
417 RLOG0(L_DEBUG,"SAP is already bound");
419 default: /* Should never reach here */
420 #if (ERRCLASS & ERRCLS_ADD_RES)
421 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCDatReq failed",
422 rgCb[inst].rguSap[spId].sapSta.sapState);
429 #if (ERRCLASS & ERRCLS_ADD_RES)
430 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCDatReq failed ",spId);
436 /* Update RGU SAP statistics for received sdu count */
437 /* rgCb.rguSap.sapSts.numPduRcvd is updated by
438 * rgROMCmnDatReq ->rgUpdtRguCmnSts function
439 * So numPduRcvd updation is commented here */
440 /* rgCb.rguSap.sapSts.numPduRcvd++; */
442 ret = rgROMCmnDatReq(inst,datReq);
443 /*ccpu00118201 - ADD - Send trace only when its enabled*/
444 if(rgCb[inst].rgInit.trc)
446 RG_SEND_TRC_IND(inst,datReq->pdu, EVTRGUCDATREQ);
450 RG_DROP_RGUCDATREQ_MBUF(datReq);
452 ret = SPutStaticBuffer(pst->region, pst->pool,(Data *)datReq,sizeof(RguCDatReqInfo) , SS_SHARABLE_MEMORY);
455 } /* RgUiRguCDatReq */
459 * @brief Handler for dedicated StaRsp from RGU
463 * Function : RgUiRguDStaRsp
465 * This function validates SAP and invokes ROM for further processing
467 * @param[in] Pst *pst
468 * @param[in] SpId spId
469 * @param[in] RguDStaRspInfo *staRsp
478 RguDStaRspInfo *staRsp
483 volatile uint32_t startTime = 0;
486 RG_IS_INST_VALID(pst->dstInst);
487 inst = pst->dstInst - RG_INST_START;
489 SStartTask(&startTime, PID_MAC_STA_RSP);
491 ret = rgROMDedStaRsp(inst,staRsp);
494 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,
495 "Processing Of Status Response Failed");
500 SStopTask(startTime, PID_MAC_STA_RSP);
502 } /* RgUiRguDStaRsp */
506 * @brief Handler for common StaRsp from RGU
510 * Function : RgUiRguCStaRsp
512 * This function validates SAP and invokes ROM
513 * for further processing
516 * @param[in] Pst *pst
517 * @param[in] SpId spId
518 * @param[in] RguCStaRspInfo *staRsp
527 RguCStaRspInfo *staRsp
533 RG_IS_INST_VALID(pst->dstInst);
534 inst = pst->dstInst - RG_INST_START;
538 RLOG0(L_ERROR,"Input Response Buffer is NULL");
542 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
544 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
546 case LRG_BND: /* SAP is bound */
547 RLOG0(L_DEBUG,"SAP is already bound");
549 default: /* Should never reach here */
550 #if (ERRCLASS & ERRCLS_ADD_RES)
551 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguCStaRsp failed",
552 rgCb[inst].rguSap[spId].sapSta.sapState);
559 #if (ERRCLASS & ERRCLS_ADD_RES)
560 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguCStaRsp failed",spId);
566 ret = rgROMCmnStaRsp(inst,staRsp);
569 RLOG_ARG0(L_ERROR,DBG_CELLID,staRsp->cellId,"Processing Of Status Response Failed");
573 ret = SPutStaticBuffer(pst->region, pst->pool, (Data *)staRsp,sizeof(RguCStaRspInfo) , SS_SHARABLE_MEMORY);
576 } /* RgUiRguCStaRsp */
581 * @brief Handler for L2M MeasReq from RGU
585 * Function :RgUiRguL2MUlThrpMeasReq
587 * This function validates SAP and invokes ROM for further processing
589 * @param[in] Pst *pst
590 * @param[in] SpId spId
591 * @param[in] RguL2MUlThrpMeasReqInfo *measReq
596 S16 RgUiRguL2MUlThrpMeasReq
600 RguL2MUlThrpMeasReqInfo *measReq
607 RG_IS_INST_VALID(pst->dstInst);
608 inst = pst->dstInst - RG_INST_START;
610 if (measReq == NULLP)
612 RLOG0(L_ERROR,"Input Response Buffer is NULL");
616 if (spId == rgCb[inst].rguSap[spId].sapCfg.spId)
618 switch (rgCb[inst].rguSap[spId].sapSta.sapState)
620 case LRG_BND: /* SAP is bound */
621 RLOG0(L_DEBUG,"SAP is already bound");
623 default: /* Should never reach here */
624 #if (ERRCLASS & ERRCLS_ADD_RES)
625 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiRguL2MUlThrpMeasReq failed",
626 rgCb[inst].rguSap[spId].sapSta.sapState);
633 #if (ERRCLASS & ERRCLS_ADD_RES)
634 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiRguL2MUlThrpMeasReq failed",spId);
640 ret = rgROML2MUlThrpMeasReq(inst,measReq);
643 RLOG_ARG0(L_ERROR,DBG_CELLID,measReq->cellId,"Processing Of Meas Request Failed");
646 SPutStaticBuffer(pst->region, pst->pool, (Data *)measReq,sizeof(RguL2MUlThrpMeasReqInfo) , SS_SHARABLE_MEMORY);
649 } /* RgUiRguL2MUlThrpMeasReq */
653 * @brief Handler for sending staInd to dedicated logical channels of a UE
657 * Function : rgUIMSndDedStaInd
659 * This function fills SAP and Pst information to send the staInd to
663 * @param[in] Inst inst
664 * @param[in] RgUpSapCb *rguSap
665 * @param[in] RgRguDedStaInd *staInd
670 S16 rgUIMSndDedStaInd
674 RgRguDedStaInd *staInd
679 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndDedStaInd(): staInd = %p;\n", (void *)staInd));
681 ret = RgUiRguDStaInd(&(rguSap->sapCfg.sapPst), rguSap->sapCfg.suId,
685 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguDStaInd Failed");
689 } /* rgUIMSndDedStaInd */
693 * @brief Handler for sending staInd to a common logical channel.
697 * Function : rgUIMSndCmnStaInd
699 * This function fills SAP and Pst information to send the staInd to
700 * a common logical channel.
703 * @param[in] Inst inst
704 * @param[in] RgUpSapCb *rguSap
705 * @param[in] RgRguCmnStaInd *staInd
710 S16 rgUIMSndCmnStaInd
714 RgRguCmnStaInd *staInd
719 ret = RgUiRguCStaInd(&(rguDlSap->sapCfg.sapPst), rguDlSap->sapCfg.suId,
723 RLOG_ARG0(L_ERROR,DBG_CELLID,staInd->cellId,"RgUiRguCStaInd Failed");
727 } /* rgUIMSndCmnStaInd */
731 * @brief Handler for sending datInd to dedicated logical channels of a UE
735 * Function : rgUIMSndDedDatInd
737 * This function fills SAP and Pst information to send the datInd to
741 * @param[in] Inst inst
742 * @param[in] RgUpSapCb *rguUlSap
743 * @param[in] RgRguDedDatInd *datInd
748 S16 rgUIMSndDedDatInd
752 RgRguDedDatInd *datInd
757 rguUlSap->sapSts.numPduTxmit += datInd->numLch;
759 ret = RgUiRguDDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
763 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguDdatInd Failed");
767 SRngIncrWIndx(SS_RNG_BUF_ULMAC_TO_ULRLC);
768 SsRngInfoTbl[SS_RNG_BUF_ULMAC_TO_ULRLC].pktRate++;
771 } /* rgUIMSndDedDatInd */
775 * @brief Handler for sending datInd to a common logical channel.
779 * Function : rgUIMSndCmnDatInd
781 * This function fills SAP and Pst information to send the datInd to
782 * a common logical channel.
785 * @param[in] Inst inst
786 * @param[in] RgUpSapCb *rguSap
787 * @param[in] RgRguCmnDatInd *datInd
792 S16 rgUIMSndCmnDatInd(Inst inst,RgUpSapCb *rguUlSap,RgRguCmnDatInd *datInd)
796 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd(): staInd = %p;\n", (void *)datInd));
798 rguUlSap->sapSts.numPduTxmit++;
800 RGDBGPRM(inst,(rgPBuf(inst),"rgUIMSndCmnDatInd suId = %d\n", rguUlSap->sapCfg.suId));
801 ret = RgUiRguCDatInd(&(rguUlSap->sapCfg.sapPst), rguUlSap->sapCfg.suId,
805 RGDBGERRNEW(inst,(rgPBuf(inst),"RgUiRguCDatInd Failed\n"));
806 RLOG_ARG0(L_ERROR,DBG_CELLID,datInd->cellId,"RgUiRguCDatInd Failed");
810 } /* rgUIMSndCmnDatInd */
814 * @brief API for bind request from RRC towards MAC.
818 * Function: RgUiCrgBndReq
820 * This API is invoked by RRC towards MAC to bind CRG SAP.
821 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
824 * @param[in] Pst *pst
825 * @param[in] SuId suId
826 * @param[in] SpId spId
831 S16 RgUiCrgBndReq(Pst *pst, SuId suId,SpId spId)
834 Pst tmpPst; /* Temporary Post Structure */
835 RgUstaDgn dgn; /* Alarm diagnostics structure */
838 RG_IS_INST_VALID(pst->dstInst);
839 inst = pst->dstInst - RG_INST_START;
841 tmpPst.prior = pst->prior;
842 tmpPst.route = pst->route;
843 tmpPst.selector = pst->selector;
844 tmpPst.region = rgCb[inst].rgInit.region;
845 tmpPst.pool = rgCb[inst].rgInit.pool;
846 tmpPst.srcProcId = rgCb[inst].rgInit.procId;
847 tmpPst.srcEnt = rgCb[inst].rgInit.ent;
848 tmpPst.srcInst = rgCb[inst].rgInit.inst;
849 tmpPst.event = EVTNONE;
850 tmpPst.dstProcId = pst->srcProcId;
851 tmpPst.dstEnt = pst->srcEnt;
852 tmpPst.dstInst = pst->srcInst;
855 if(spId == rgCb[inst].crgSap.sapCfg.spId)
857 /* Check the state of the SAP */
858 switch (rgCb[inst].crgSap.sapSta.sapState)
860 case LRG_NOT_CFG: /* SAP Not configured */
862 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
863 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_NOT_CFG,
864 LCM_CAUSE_INV_SAP, &dgn);
865 RLOG0(L_DEBUG,"SAP Not Configured");
866 ret = RgUiCrgBndCfm(&tmpPst, suId, CM_BND_NOK);
868 case LRG_UNBND: /* SAP is not bound */
869 RLOG0(L_DEBUG,"SAP Not yet bound");
871 rgCb[inst].crgSap.sapSta.sapState = LRG_BND;
872 rgCb[inst].crgSap.sapCfg.suId = suId;
873 /* Send Bind Confirm with status as SUCCESS */
874 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
875 /* Indicate to Layer manager */
876 rgFillDgnParams(inst,&dgn, LRG_USTA_DGNVAL_MEM);
877 ret = rgLMMStaInd(inst,LCM_CATEGORY_INTERFACE,LRG_EVENT_CRGSAP_ENB,
878 LCM_CAUSE_UNKNOWN, &dgn);
880 case LRG_BND: /* SAP is already bound*/
881 RLOG0(L_DEBUG,"SAP is already bound");
883 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_OK);
885 default: /* Should Never Enter here */
886 #if (ERRCLASS & ERRCLS_ADD_RES)
887 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgBndReq failed",
888 rgCb[inst].crgSap.sapSta.sapState);
890 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
896 #if (ERRCLASS & ERRCLS_ADD_RES)
897 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgBndReq failed",
898 rgCb[inst].crgSap.sapCfg.spId);
900 ret = rgUIMCrgBndCfm(inst,suId, CM_BND_NOK);
903 } /* RgUiCrgBndReq */
907 * @brief API for unbind request from RRC towards MAC.
911 * Function: RgUiCrgUbndReq
913 * This API is invoked by RRC towards MAC to unbind CRG SAP.
914 * These API validates the Pst, spId, suId and sends the bind confirm to RRC.
917 * @param[in] Pst *pst
918 * @param[in] SuId suId
919 * @param[in] Reason reason
924 S16 RgUiCrgUbndReq(Pst *pst,SpId spId,Reason reason)
928 RG_IS_INST_VALID(pst->dstInst);
929 inst = pst->dstInst - RG_INST_START;
930 /* SAP Id validation */
931 if (spId == rgCb[inst].crgSap.sapCfg.spId)
933 switch(rgCb[inst].crgSap.sapSta.sapState)
935 case LRG_BND: /* SAP is already bound*/
936 /* setting SAP state to UN BOUND */
937 RLOG0(L_DEBUG, "SAP is already bound");
939 rgCb[inst].crgSap.sapSta.sapState = LRG_UNBND;
942 #if (ERRCLASS & ERRCLS_ADD_RES)
943 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgUbndReq failed",
944 rgCb[inst].crgSap.sapSta.sapState);
951 #if (ERRCLASS & ERRCLS_ADD_RES)
952 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgUbndReq failed",
953 rgCb[inst].crgSap.sapCfg.spId);
958 } /* RgUiCrgUbndReq */
961 * @brief API for sending bind confirm from MAC to RRC
965 * Function: rgUIMRgrBndCfm
967 * This API is invoked to send bind confirm from MAC to RRC.
968 * This API fills in Pst structure and SAP Ids and invokes
969 * bind confirm API towards RRC.
971 * @param[in] Inst inst
972 * @param[in] SuId suId
973 * @param[in] uint8_t status
978 S16 rgUIMCrgBndCfm(Inst inst,SuId suId,uint8_t status)
981 if(RgUiCrgBndCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, status) != ROK)
983 RLOG0(L_ERROR,"RgUiCrgBndCfm Failed ");
988 } /* rgUIMCrgBndCfm*/
991 * @brief API for configuration request from RRC towards MAC.
995 * Function: RgUiCrgCfgReq
997 * This API is invoked by RRC towards MAC to configure MAC.
998 * These API validates the Pst, spId, suId and transfers the config request
999 * specific information to corresponding ownership module (COM) API.
1002 * @param[in] Pst *pst
1003 * @param[in] SpId spId
1004 * @param[in] CrgCfgTransId transId
1005 * @param[in] CrgCfgReqInfo *cfgReqInfo
1014 CrgCfgTransId transId,
1015 CrgCfgReqInfo *cfgReqInfo
1020 uint8_t cfmStatus = 0x00ff;
1021 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1023 RG_IS_INST_VALID(pst->dstInst);
1024 inst = pst->dstInst - RG_INST_START;
1025 /* Ensuring transId is always Null terminated. */
1026 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1027 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1030 /* CrgCfgReqInfo Validation for NULLP */
1031 if (cfgReqInfo == NULLP)
1033 RLOG0(L_ERROR,"Input Param crgReqInfo is NULL ");
1034 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1038 /* Upper SAP Id and State validation */
1039 if (spId == rgCb[inst].crgSap.sapCfg.spId)
1041 switch(rgCb[inst].crgSap.sapSta.sapState)
1043 case LRG_BND: /* SAP is already bound */
1044 RLOG0(L_DEBUG,"SAP is already bound");
1046 default: /* Should never reach here */
1047 #if (ERRCLASS & ERRCLS_ADD_RES)
1048 RLOG1(L_ERROR,"Invalid SAP State:%d RgUiCrgCfgReq failed",
1049 rgCb[inst].crgSap.sapSta.sapState);
1051 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1052 sizeof(CrgCfgReqInfo));
1055 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1061 #if (ERRCLASS & ERRCLS_ADD_RES)
1062 RLOG1(L_ERROR,"Invalid SAP Id:%d RgUiCrgCfgReq failed",
1063 rgCb[inst].crgSap.sapCfg.spId);
1065 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1066 sizeof(CrgCfgReqInfo));
1068 rgUIMCrgCfgCfm(inst,transId, cfmStatus);
1071 ret = rgCOMCfgReq(inst,transId, cfgReqInfo);
1072 SPutSBuf (pst->region, pst->pool, (Data *)cfgReqInfo,
1073 sizeof(CrgCfgReqInfo));
1077 RLOG0(L_ERROR,"Configuration Request Handling Failed ");
1082 } /* RgUiCrgCfgReq */
1085 * @brief API for sending configuration confirm from MAC to RRC
1089 * Function: rgUIMCrgCfgCfm
1091 * This API is invoked to send configuration confirm from MAC to RRC.
1092 * This API fills in Pst structure and SAP Ids and invokes
1093 * config confirm API towards RRC.
1095 * @param[in] Inst inst
1096 * @param[in] CrgCfgTransId transId
1097 * @param[in] uint8_t status
1105 CrgCfgTransId transId,
1110 uint8_t prntTrans[CRG_CFG_TRANSID_SIZE+1];
1112 memcpy(prntTrans, transId.trans, CRG_CFG_TRANSID_SIZE);
1113 prntTrans[CRG_CFG_TRANSID_SIZE] = '\0';
1116 ret = RgUiCrgCfgCfm(&(rgCb[inst].crgSap.sapCfg.sapPst), rgCb[inst].crgSap.sapCfg.suId, transId, status);
1119 RLOG0(L_ERROR,"RgUiCrgCfgCfm Failed ");
1124 } /* rgUIMCrgCfgCfm */
1125 #if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF)
1127 S16 rgBatchProc(Void)
1129 /* Read from Ring Buffer and process RLC BO Update */
1132 RguDStaRspInfo *staRsp;
1133 uint32_t elmIndx = 0;
1138 pst.dstEnt = ENTMAC;
1140 pst.srcEnt = ENTRLC;
1143 pst.route = RTESPEC;
1144 pst.event = EVTRGUDSTARSP;
1147 pst.selector = 2; /*SM_SELECTOR_LC */
1151 elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1152 while(NULLP != elmIndx)
1154 staRsp = (RguDStaRspInfo *)elmIndx;
1158 RgUiRguDStaRsp(&pst, spId, staRsp);
1162 SRngIncrRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC);
1164 if((elmIndx = (uint32_t)SRngGetRIndx(SS_RNG_BUF_DLRLC_TO_DLMAC)) == NULLP)
1171 /**********************************************************************
1174 **********************************************************************/